@ghostlytools/cli 1.13.0 → 1.13.1

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 (87) hide show
  1. package/README.md +7 -6
  2. package/dist/assets/{api-CVtg7MpI.js → api-DF36rBJK.js} +2 -2
  3. package/dist/assets/{api-CjOaoG-v.js → api-Dnq86JAA.js} +135 -37
  4. package/dist/assets/api-Dnq86JAA.js.map +1 -0
  5. package/dist/assets/{apiKit-BAGvlQtm.js → apiKit-nLK4jeTq.js} +3 -3
  6. package/dist/assets/{apiKit-BAGvlQtm.js.map → apiKit-nLK4jeTq.js.map} +1 -1
  7. package/dist/assets/{appFetch-BwJd-kNq.js → appFetch-wqBWi3Ry.js} +2 -2
  8. package/dist/assets/{appFetch-BwJd-kNq.js.map → appFetch-wqBWi3Ry.js.map} +1 -1
  9. package/dist/assets/{apps-Cuk45sz5.js → apps-DBVhKpfe.js} +10 -10
  10. package/dist/assets/apps-DBVhKpfe.js.map +1 -0
  11. package/dist/assets/{apps-DjY095Af.js → apps-nLtyhC2f.js} +1 -1
  12. package/dist/assets/{backup-DekVCDWv.js → backup-Bczllmzf.js} +4 -4
  13. package/dist/assets/{backup-DekVCDWv.js.map → backup-Bczllmzf.js.map} +1 -1
  14. package/dist/assets/{backup-B56sQqoQ.js → backup-D6s0LQdg.js} +1 -1
  15. package/dist/assets/bark_ffi_wasm_bg-CcafsJla.js.map +1 -1
  16. package/dist/assets/{bitcoind-B2bbVSzh.js → bitcoind-DML_-Xbv.js} +2 -2
  17. package/dist/assets/{bitcoind-B2bbVSzh.js.map → bitcoind-DML_-Xbv.js.map} +1 -1
  18. package/dist/assets/bitcoindevkit_bg-BWQHx7vd.js.map +1 -1
  19. package/dist/assets/{buttons-BGxzOtrq.js → buttons-B3C3vdhH.js} +8 -8
  20. package/dist/assets/buttons-B3C3vdhH.js.map +1 -0
  21. package/dist/assets/buttons-DaY5FYlV.js +1 -0
  22. package/dist/assets/{client-DcQAfc3h.js → client-B7jRrSnb.js} +3 -3
  23. package/dist/assets/{client-DcQAfc3h.js.map → client-B7jRrSnb.js.map} +1 -1
  24. package/dist/assets/{domainProofs-BDNP1dIy.js → domainProofs-b3Y1Gj9g.js} +6 -2
  25. package/dist/assets/{domainProofs-BDNP1dIy.js.map → domainProofs-b3Y1Gj9g.js.map} +1 -1
  26. package/dist/assets/{errors-DDLFO4Gf.js → errors-JVJsO8Iu.js} +18 -2
  27. package/dist/assets/errors-JVJsO8Iu.js.map +1 -0
  28. package/dist/assets/{fixedHosts-C3hBliM9.js → fixedHosts-H3i6o9Iy.js} +2 -2
  29. package/dist/assets/{fixedHosts-C3hBliM9.js.map → fixedHosts-H3i6o9Iy.js.map} +1 -1
  30. package/dist/assets/{ghostly_iroh_web-DIj5xGmR.js → ghostly_iroh_web-9VOwZcJQ.js} +30 -35
  31. package/dist/assets/ghostly_iroh_web-9VOwZcJQ.js.map +1 -0
  32. package/dist/assets/ghostly_iroh_web_bg.wasm +0 -0
  33. package/dist/assets/{groupMeta-goASqzOt.js → groupMeta--fxSh792.js} +72 -4
  34. package/dist/assets/groupMeta--fxSh792.js.map +1 -0
  35. package/dist/assets/{host-C2WRKj3g.js → host-CGzVFfMz.js} +169 -36
  36. package/dist/assets/host-CGzVFfMz.js.map +1 -0
  37. package/dist/assets/{hyperdhtRelay-bjNGacf5.js → hyperdhtRelay-B4_wdCtx.js} +2 -2
  38. package/dist/assets/{hyperdhtRelay-bjNGacf5.js.map → hyperdhtRelay-B4_wdCtx.js.map} +1 -1
  39. package/dist/assets/{hyperdhtRelay-DLUiwfnt.js → hyperdhtRelay-Ce-gWsRY.js} +2 -2
  40. package/dist/assets/{hyperdhtRelay-DLUiwfnt.js.map → hyperdhtRelay-Ce-gWsRY.js.map} +1 -1
  41. package/dist/assets/{irohWeb-NfthOL98.js → irohWeb-Dp1i8v6n.js} +12 -11
  42. package/dist/assets/irohWeb-Dp1i8v6n.js.map +1 -0
  43. package/dist/assets/{main-Dh7fePd8.js → main-C8J53SwH.js} +67 -62
  44. package/dist/assets/main-C8J53SwH.js.map +1 -0
  45. package/dist/assets/{ownDid-BErplN7N.js → ownDid-oa-T2vmZ.js} +8 -4
  46. package/dist/assets/ownDid-oa-T2vmZ.js.map +1 -0
  47. package/dist/assets/{ownStatus-ClrFjd7h.js → ownStatus-Bc08eNJY.js} +6 -6
  48. package/dist/assets/{ownStatus-ClrFjd7h.js.map → ownStatus-Bc08eNJY.js.map} +1 -1
  49. package/dist/assets/{pairedTransports-BKmvlKz1.js → pairedTransports-Dppn8lUN.js} +3 -3
  50. package/dist/assets/pairedTransports-Dppn8lUN.js.map +1 -0
  51. package/dist/assets/{profiles-B8xO8-oj.js → profiles-B2uy04ph.js} +3 -3
  52. package/dist/assets/{profiles-B8xO8-oj.js.map → profiles-B2uy04ph.js.map} +1 -1
  53. package/dist/assets/{registry-CU8PevhI.js → registry-DbTLLs3y.js} +9 -5
  54. package/dist/assets/registry-DbTLLs3y.js.map +1 -0
  55. package/dist/assets/{registry--Rg2YvOH.js → registry-bLIfG619.js} +1 -1
  56. package/dist/assets/{resolve-B1upovPM.js → resolve-DNX-eecG.js} +9 -4
  57. package/dist/assets/resolve-DNX-eecG.js.map +1 -0
  58. package/dist/assets/secretGuard-Bh11MPdI.js +1 -0
  59. package/dist/assets/{secretGuard-BrATm_gl.js → secretGuard-oz_3hBfW.js} +19 -2
  60. package/dist/assets/{secretGuard-BrATm_gl.js.map → secretGuard-oz_3hBfW.js.map} +1 -1
  61. package/dist/assets/{server-Dgxx_DaN.js → server-DWJ4RzJn.js} +536 -209
  62. package/dist/assets/server-DWJ4RzJn.js.map +1 -0
  63. package/dist/assets/{translate-BcbSWkuq.js → translate-CHj_PdLg.js} +13 -8
  64. package/dist/assets/translate-CHj_PdLg.js.map +1 -0
  65. package/dist/assets/{waitNotice-ylU3XwjO.js → waitNotice-Cvz5CiKR.js} +57 -3
  66. package/dist/assets/waitNotice-Cvz5CiKR.js.map +1 -0
  67. package/dist/ghostly.mjs +1 -1
  68. package/npm-shrinkwrap.json +2 -2
  69. package/package.json +1 -1
  70. package/dist/assets/api-CjOaoG-v.js.map +0 -1
  71. package/dist/assets/apps-Cuk45sz5.js.map +0 -1
  72. package/dist/assets/buttons-BGxzOtrq.js.map +0 -1
  73. package/dist/assets/buttons-CsN2WJOf.js +0 -1
  74. package/dist/assets/errors-DDLFO4Gf.js.map +0 -1
  75. package/dist/assets/ghostly_iroh_web-DIj5xGmR.js.map +0 -1
  76. package/dist/assets/groupMeta-goASqzOt.js.map +0 -1
  77. package/dist/assets/host-C2WRKj3g.js.map +0 -1
  78. package/dist/assets/irohWeb-NfthOL98.js.map +0 -1
  79. package/dist/assets/main-Dh7fePd8.js.map +0 -1
  80. package/dist/assets/ownDid-BErplN7N.js.map +0 -1
  81. package/dist/assets/pairedTransports-BKmvlKz1.js.map +0 -1
  82. package/dist/assets/registry-CU8PevhI.js.map +0 -1
  83. package/dist/assets/resolve-B1upovPM.js.map +0 -1
  84. package/dist/assets/secretGuard-Bm6nci0I.js +0 -1
  85. package/dist/assets/server-Dgxx_DaN.js.map +0 -1
  86. package/dist/assets/translate-BcbSWkuq.js.map +0 -1
  87. package/dist/assets/waitNotice-ylU3XwjO.js.map +0 -1
@@ -1 +0,0 @@
1
- {"version":3,"file":"apps-Cuk45sz5.js","names":[],"sources":["../../src/appTemplate.ts","../../src/nativeEd25519.ts","../../src/apps.ts"],"sourcesContent":["/*\n * What `ghostly app init` writes (WISP 1200, Apps · Publishing): the smallest app that does something with a contact.\n * Three files, each whole in this module, so the CLI's one built file carries them: the manifest as a publisher writes\n * it, a page that says hello to the same app on the contact's side, and a README with the way from here to a store.\n */\n\nexport interface AppTemplate { name: string; title: string }\n\nconst html = (text: string) => text.replace(/[&<>\"]/g, (c) => ({ \"&\": \"&amp;\", \"<\": \"&lt;\", \">\": \"&gt;\", '\"': \"&quot;\" })[c]!);\n\n/** `ghostly-app.json`: the manifest without `publisher`, `sequence` and `files`, which `app publish` writes. */\nexport function templateManifest({ name, title }: AppTemplate): Record<string, unknown> {\n return {\n name,\n version: \"0.1.0\",\n kind: \"mini-app\",\n title,\n tagline: \"Say hello to a contact\",\n description: \"Open it in a chat and your contact gets a card to join. Each side can then say hello to the other.\",\n entry: \"index.html\",\n permissions: [\"chat\"],\n view: \"chat\",\n runtime: { host: \">=1.2\", clients: [\"web\", \"desktop\"] },\n license: \"MIT\",\n };\n}\n\n/**\n * `index.html`: the whole app in one file, as the sandbox needs it (no network, so nothing is loaded from elsewhere).\n * Its script is plain JavaScript typed with JSDoc against `@ghostlytools/sdk/app`, so it runs as written and still type\n * checks (test/appInit.test.ts does). The title is the only thing put into it, as text. Its type imports are in single\n * quotes: they are text of the page, not imports of the CLI's own build (test/packageDeps.test.ts reads those).\n */\nexport function templatePage({ title }: AppTemplate): string {\n return `<!doctype html>\n<html lang=\"en\">\n<head>\n<meta charset=\"utf-8\">\n<meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">\n<title>${html(title)}</title>\n<style>\n :root { color-scheme: light dark; --bg: #ffffff; --fg: #16181d; --muted: #5b6270; --line: #d9dde3; --accent: #2f6fed; }\n :root[data-theme=\"dark\"] { --bg: #16181d; --fg: #f2f4f7; --muted: #a3abb8; --line: #343a45; --accent: #7aa5ff; }\n body { margin: 0; padding: 20px; background: var(--bg); color: var(--fg); font: 16px/1.4 system-ui, sans-serif; }\n h1 { margin: 0 0 4px; font-size: 20px; }\n #status { margin: 0 0 16px; color: var(--muted); }\n button { font: inherit; padding: 8px 16px; border: 1px solid var(--accent); border-radius: 8px; background: var(--accent); color: var(--bg); }\n button:disabled { opacity: 0.5; }\n ul { margin: 16px 0 0; padding: 0; list-style: none; }\n li { padding: 8px 0; border-top: 1px solid var(--line); }\n</style>\n</head>\n<body>\n<h1>${html(title)}</h1>\n<p id=\"status\" role=\"status\">Starting</p>\n<button id=\"hello\" type=\"button\" disabled>Say hello</button>\n<ul id=\"log\" aria-label=\"Messages\"></ul>\n<script type=\"module\">\n// The types of the API come from the SDK (npm install --save-dev --prefix .. @ghostlytools/sdk); nothing of it runs here.\n/** @typedef {import('@ghostlytools/sdk/app').MiniAppApi} MiniAppApi */\n/** @typedef {import('@ghostlytools/sdk/app').MiniAppJson} MiniAppJson */\n\n/** The longest text shown from a contact's frame. */\nconst MAX_TEXT = 200;\n\nconst status = /** @type {HTMLElement} */ (document.getElementById(\"status\"));\nconst button = /** @type {HTMLButtonElement} */ (document.getElementById(\"hello\"));\nconst log = /** @type {HTMLElement} */ (document.getElementById(\"log\"));\n\n/** @param {string} text */\nfunction show(text) {\n const line = document.createElement(\"li\");\n line.textContent = text;\n log.append(line);\n}\n\n/**\n * What the contact's app sent, when it is a hello. A frame comes from another device: read only what this app sends,\n * and never put it in the page as HTML.\n * @param {MiniAppJson} data\n * @returns {string | null}\n */\nfunction helloOf(data) {\n if (!data || typeof data !== \"object\" || Array.isArray(data) || data.type !== \"hello\") return null;\n return typeof data.text === \"string\" && data.text.length <= MAX_TEXT ? data.text : null;\n}\n\n/**\n * Why a send was refused, in words. The code is the rejection's message (MINI_APP_ERROR_CODES in the SDK); a later\n * client may add one.\n * @param {unknown} error\n */\nfunction refusal(error) {\n switch (error instanceof Error ? error.message : \"\") {\n case \"offline\": return \"Not sent: you are not both online\";\n case \"peer-closed\": case \"not-open\": return \"Not sent: your contact has not opened this app\";\n case \"not-allowed\": return \"Open this app in a chat to say hello\";\n default: return \"Not sent\";\n }\n}\n\n/** @param {MiniAppApi} ghostly */\nasync function start(ghostly) {\n // Listen before anything is awaited, so no frame is missed.\n ghostly.chat.on(\"message\", (data) => {\n const text = helloOf(data);\n if (text !== null) show(\"Your contact: \" + text);\n });\n ghostly.chat.on(\"peer\", (peer) => {\n status.textContent = peer.open ? \"Your contact has this app open\" : \"Waiting for your contact to open this app\";\n });\n\n const context = await ghostly.context();\n const dark = context.theme ? context.theme === \"dark\" : matchMedia(\"(prefers-color-scheme: dark)\").matches;\n document.documentElement.dataset.theme = dark ? \"dark\" : \"light\";\n status.textContent = !context.inChat ? \"Open this app in a chat to say hello\"\n : context.peer ? \"Your contact has this app open\" : \"Waiting for your contact to open this app\";\n\n button.disabled = false;\n button.addEventListener(\"click\", async () => {\n try {\n await ghostly.chat.send({ type: \"hello\", text: \"Hello!\" });\n show(\"You: Hello!\");\n } catch (error) {\n show(refusal(error));\n }\n });\n}\n\n/** Ghostly's runner gives the app \\`window.ghostly\\`; a browser tab has none. */\nconst ghostly = /** @type {{ ghostly?: MiniAppApi }} */ (window).ghostly;\nif (ghostly) void start(ghostly);\nelse status.textContent = \"This page is a Ghostly app: publish it and open it in Ghostly\";\n</script>\n</body>\n</html>\n`;\n}\n\n/** `README.md`: what the folder holds and the way from it to a store. */\nexport function templateReadme({ name, title }: AppTemplate): string {\n return `# ${title}\n\nA [Ghostly](https://github.com/MiguelMedeiros/ghostly) app, started with \\`ghostly app init\\`. Opened in a 1:1 chat, it\ngives your contact a card to join, and each side can say hello to the other.\n\nA Ghostly app ([WISP 1200](https://github.com/MiguelMedeiros/ghostly/blob/dev/docs/wisps/1200-marketplace.md)) is a\npage that runs in the client's sandbox. It has no network, and talks to Ghostly only through \\`window.ghostly\\`:\nframes of at most 32 KiB to the same app on the contact's side (\\`chat.send\\`, \\`chat.on\\`), storage per app and per\nchat, and the files of its own bundle. Apps run in Ghostly from release 1.2.\n\n| File | What it is |\n|---|---|\n| \\`ghostly-app.json\\` | The manifest, without \\`publisher\\`, \\`sequence\\` and \\`files\\`: \\`ghostly app publish\\` writes those |\n| \\`index.html\\` | The app, whole: styles and script inline |\n| \\`README.md\\` | This file |\n\n## Write it\n\n\\`index.html\\` is plain JavaScript, typed with JSDoc against \\`@ghostlytools/sdk/app\\`: \\`MiniAppApi\\` is\n\\`window.ghostly\\`, and the same module has the limits (\\`MINI_APP_LIMITS\\`) and the codes a refused call rejects with\n(\\`MINI_APP_ERROR_CODES\\`). For the types in your editor, install it in the folder above this one, where your editor\nstill finds it: \\`ghostly app publish\\` takes every file of this folder, so \\`node_modules\\` and \\`package.json\\` stay\nout of it.\n\n\\`\\`\\`sh\nnpm install --save-dev --prefix .. @ghostlytools/sdk\n\\`\\`\\`\n\n- What a contact's app sends is untrusted: check its shape, bound its size, and show it as text, never as HTML.\n- \\`\"view\": \"chat\"\\` runs the app inside a chat with one contact. \\`\"full\"\\` is a full-screen app opened from the Apps page.\n- \\`permissions\\` lists what the person is asked for: \\`chat\\` (frames to the contact's app), \\`name\\` (the person's\n display name) and \\`internet\\`. Adding one later makes every install ask before it updates.\n\n## Build\n\nThere is nothing to build yet: the page is the app. Once it grows into several source files, or TypeScript, build it\ninto one self-contained \\`index.html\\` (scripts, styles and images inline) and put that file and \\`ghostly-app.json\\`\nalone in a folder of their own, which is the folder you publish.\n[ghostly-chess](https://github.com/MiguelMedeiros/ghostly-chess) does it with Vite and a small\n\\`scripts/stage.mjs\\`. \\`ghostly app publish\\` takes every file of the folder it is given but dot files, this README\nincluded, so do not run it on a repository with sources, \\`node_modules\\` or anything private in it.\n\n## Publish\n\n\\`\\`\\`sh\nghostly app publish . --key ~/ghostly-keys/${name}-publisher.key\nghostly app verify app.ghostlyapp\n\\`\\`\\`\n\n\\`publish\\` signs the folder into \\`app.ghostlyapp\\`. The first run makes the publisher key at the path you name:\n\n- Keep it **outside this folder** and its repository (\\`publish\\` refuses a key inside it), and never commit it.\n- Back it up. An app is updated only with the key that signed it; a lost key means a new app.\n\n\\`verify\\` checks the bundle as Ghostly will and prints its \\`ref\\` (\\`<publisher key>/${name}\\`), \\`sequence\\` and\n\\`digest\\`. For the next version, raise \\`version\\` in \\`ghostly-app.json\\` and publish again: the sequence goes up\nby one by itself.\n\n## Try it\n\nCommit \\`app.ghostlyapp\\` to a public GitHub repository, then in Ghostly open Apps, choose Add, and paste its URL\n(\\`https://raw.githubusercontent.com/<owner>/<repo>/HEAD/app.ghostlyapp\\`). Set \\`sources\\` in \\`ghostly-app.json\\`\nto that URL, in a list, so installs made from it find your updates. Open the app from a chat's + menu; your contact\ngets a card to install and open it.\n\n## List it in a store\n\nA store is a signed list of apps. The official one is a Git repository,\n[ghostly-store](https://github.com/MiguelMedeiros/ghostly-store), and apps enter it by pull request:\n\n1. Commit \\`app.ghostlyapp\\` to your public repository and note that commit.\n2. Add \\`apps/${name}.<first 16 characters of your publisher key>/listing.json\\` with the \\`ref\\`, \\`sequence\\`\n and \\`digest\\` that \\`ghostly app verify\\` printed. Its \\`urls\\` start with a jsDelivr URL pinned to the full commit\n (\\`https://cdn.jsdelivr.net/gh/<owner>/<repo>@<40-character commit>/app.ghostlyapp\\`).\n3. Open the pull request. Its check verifies the bundle; a maintainer reviews the app and the owner signs the index.\n\nThe store's [CONTRIBUTING](https://github.com/MiguelMedeiros/ghostly-store/blob/main/CONTRIBUTING.md) has the rules.\nAn app installed from a store updates only to the version that store lists, so each new version is a pull request too.\n\n## If something goes wrong\n\nIf a version is harmful, \\`ghostly app revoke . --key <your key> --up-to <sequence>\\` writes \\`ghostly-revoke.json\\`;\npublish it beside \\`app.ghostlyapp\\` and Ghostly stops those versions.\n`;\n}\n","import { createPrivateKey, createPublicKey, verify, type KeyObject } from \"node:crypto\";\nimport type { AppSignatureFastPath, PublicKeyFastPath } from \"@ghostly/core\";\n\n/*\n * Node's Ed25519 (OpenSSL's): a signature in tens of microseconds, where the core's portable check takes most of a\n * millisecond, so a list of 4096 revocations is checked in a fraction of a second. OpenSSL verifies as RFC 8032 writes it\n * without the cofactor and compares R byte for byte, which is what the core's fast path asks (see AppSignatureFastPath).\n */\n\n/** SubjectPublicKeyInfo of an Ed25519 key (RFC 8410), before its 32 bytes. */\nconst SPKI_PREFIX = Buffer.from(\"302a300506032b6570032100\", \"hex\");\n/** PKCS #8 of an Ed25519 private key (RFC 8410), before its 32-byte seed. */\nconst PKCS8_PREFIX = Buffer.from(\"302e020100300506032b657004220420\", \"hex\");\n/** The key objects of the keys seen lately: a list repeats its publishers. */\nconst keys = new Map<string, KeyObject>();\n\nexport const nativeEd25519: AppSignatureFastPath = (signature, message, publicKey) => {\n const id = Buffer.from(publicKey).toString(\"hex\");\n let key = keys.get(id);\n if (!key) {\n key = createPublicKey({ key: Buffer.concat([SPKI_PREFIX, publicKey]), format: \"der\", type: \"spki\" });\n if (keys.size >= 256) keys.clear();\n keys.set(id, key);\n }\n return verify(null, message, key, signature);\n};\n\n/**\n * A seed's public key by Node's Ed25519: ~0.08 ms, where noble's takes ~0.3 ms in a fresh process. A one-shot command\n * derives two for each chat of the profile at its start (its own seed and its participation seed): 400 at 200 chats.\n */\nexport const nativePublicKey: PublicKeyFastPath = (seed) =>\n createPublicKey(createPrivateKey({ key: Buffer.concat([PKCS8_PREFIX, seed]), format: \"der\", type: \"pkcs8\" })).export({ format: \"der\", type: \"spki\" }).subarray(SPKI_PREFIX.length);\n","import { createHash, createPrivateKey, generateKeyPairSync } from \"node:crypto\";\nimport { closeSync, existsSync, lstatSync, mkdirSync, openSync, readdirSync, readFileSync, realpathSync, renameSync, rmSync, statSync, writeFileSync, writeSync } from \"node:fs\";\nimport { basename, dirname, isAbsolute, join, relative, sep } from \"node:path\";\nimport {\n APP_BUNDLE_LIMITS, APP_PREFIXES, appFingerprint, appRef, appRevocationFor, appStoreDecision, assembleAppBundle, canonicalJson, canonicalJsonBytes,\n APP_STATEMENT_LIMITS, checkAppManifest, checkAppRevokeStatement, checkAppStoreIndex, fromBase64Url, isAppHash, isAppLine, isAppUrl, readAppBundle,\n readAppRevocations, readAppStore, repeatedJsonKey, seedSigner, setAppSignatureFastPath, signAppObject, signAppRevocation, signAppStore, toBase64Url, toZ32, type AppBundle,\n type AppManifest, type AppRevokeStatement, type AppStoreIndex, type AppStoreReading, type SignedAppRevocation, type Signer,\n} from \"@ghostly/core\";\nimport { APP_FETCH_HOSTS, isAppFetchUrl } from \"@ghostly/browser/engine/appFetch\";\nimport { templateManifest, templatePage, templateReadme } from \"./appTemplate\";\nimport { CliError, localFileError } from \"./errors\";\nimport { jsonOut } from \"./jsonOut\";\nimport { guardText } from \"./secretGuard\";\nimport { nativeEd25519 } from \"./nativeEd25519\";\nimport { userPath } from \"./profiles\";\n\n/*\n * The publisher tools of WISP 1200 (Apps · Publishing): `app init` writes a folder to start from, `app publish` bundles\n * and signs a folder, `app verify` checks a bundle as a client would, `store sign` signs a store index. They run here, on files: no profile, no daemon, no\n * network but the one read `app verify` makes of a URL.\n *\n * Keys. A publisher key and a store key are Ed25519 keys of their own, never a profile's (WISP 1200 · Publisher\n * identity). Each lives in a file the command names with `--key`: a PKCS #8 PEM block (what `openssl genpkey -algorithm\n * ed25519` writes, so secret scanners know it for a private key), after one line that says which kind it is. The file\n * is made owner-only (0600) when a command makes it, and refused when anyone else may read it. A key is never printed:\n * only its public key and fingerprint are.\n */\n\nexport const APP_SOURCE = \"ghostly-app.json\";\nexport const APP_BUNDLE_FILE = \"app.ghostlyapp\";\nexport const APP_REVOKE_FILE = \"ghostly-revoke.json\";\nexport const STORE_INDEX_FILE = \"ghostly-store.json\";\nexport const STORE_SIG_FILE = \"ghostly-store.sig\";\n\n// Every signature the publisher tools check (bundles, revocation lists, store indexes) goes through Node's Ed25519 first.\nsetAppSignatureFastPath(nativeEd25519);\n\n/** How long `app verify` waits for a URL, its redirects included, and how many redirects it follows (each checked as the first). */\nconst FETCH_TIMEOUT_MS = 60_000;\nconst MAX_REDIRECTS = 5;\n\n// ---------- keys ----------\n\nexport type KeyKind = \"publisher\" | \"store\";\n\nconst KEY_HEADER: Record<KeyKind, string> = {\n publisher: \"Ghostly publisher key (WISP 1200). Secret: never share or commit it. Back it up: an app signed with it is updated only with it.\",\n store: \"Ghostly store key (WISP 1200). Secret: keep it offline, never share or commit it. Back it up: a store is its key.\",\n};\nconst PEM = /-----BEGIN PRIVATE KEY-----\\r?\\n([A-Za-z0-9+/=\\r\\n]+)-----END PRIVATE KEY-----/;\n\n/** `pem`: a key made by this run, written to its file by `saveKey` only once every check passed. */\nexport interface LoadedKey { signer: Signer; key: string; created: boolean; pem?: string }\n\n/** Refuses a key file that is not a plain file of this user's, or that anyone else may read or write. */\nfunction checkKeyFile(path: string): void {\n const info = statSync(path);\n if (!info.isFile()) throw new CliError(\"bad_request\", `${path} is not a file: --key names a key file`);\n if (process.platform === \"win32\") return;\n if (process.getuid && info.uid !== process.getuid()) throw new CliError(\"refused\", `${path} is not this user's: a key file must be yours alone`);\n if ((info.mode & 0o077) !== 0) {\n throw new CliError(\"refused\", `${path} may be read by others (mode ${(info.mode & 0o777).toString(8)}): run chmod 600 ${path}, and think whether the key was seen`);\n }\n}\n\n/** Reads a key file: the PEM block, an Ed25519 key, and the kind its first line names (when it names one). */\nfunction readKey(path: string, kind: KeyKind): LoadedKey {\n checkKeyFile(path);\n const text = readFileSync(path, \"utf8\");\n const other: KeyKind = kind === \"publisher\" ? \"store\" : \"publisher\";\n if (text.startsWith(`Ghostly ${other} key`)) {\n throw new CliError(\"refused\", `${path} is a ${other} key: ${kind === \"publisher\" ? \"a store key never signs an app or its revocations\" : \"a publisher key never signs a store index\"} (WISP 1200 · Stores)`);\n }\n const block = PEM.exec(text);\n let seed: Uint8Array | undefined;\n if (block) {\n try {\n const key = createPrivateKey(block[0]);\n const d = key.asymmetricKeyType === \"ed25519\" ? key.export({ format: \"jwk\" }).d : undefined;\n if (d) seed = fromBase64Url(d);\n } catch { /* said below, without the file's text */ }\n }\n if (!seed || seed.length !== 32) throw new CliError(\"bad_request\", `${path} holds no Ed25519 private key (a PEM \"PRIVATE KEY\" block, as openssl genpkey -algorithm ed25519 writes)`);\n const signer = seedSigner(seed);\n return { signer, key: toZ32(signer.publicKey), created: false };\n}\n\n/**\n * Makes a key in memory: its file is written by `saveKey`, right before the bundle or index it signs. A run refused\n * after this step leaves no key file, which the next run would read as an existing key and never say to back up.\n */\nfunction makeKey(kind: KeyKind): LoadedKey {\n const { privateKey } = generateKeyPairSync(\"ed25519\");\n const signer = seedSigner(fromBase64Url(privateKey.export({ format: \"jwk\" }).d!));\n return { signer, key: toZ32(signer.publicKey), created: true, pem: `${KEY_HEADER[kind]}\\n${privateKey.export({ type: \"pkcs8\", format: \"pem\" }) as string}` };\n}\n\n/** Writes a key this run made: owner-only from the start, never over a file that is there. */\nfunction saveKey(path: string, key: LoadedKey): void {\n if (!key.pem) return;\n mkdirSync(dirname(path), { recursive: true, mode: 0o700 });\n const fd = openSync(path, \"wx\", 0o600);\n try { writeSync(fd, key.pem); } finally { closeSync(fd); }\n}\n\n/**\n * Saves the key, then writes what it signs: the key first, so nothing it signed is ever on disk without it. A write\n * that fails (a folder it may not write) takes back the key this run made, which nothing signed by it needs: kept,\n * the next run read it as an existing key and never said to back it up.\n */\nfunction saveKeyThen(path: string, key: LoadedKey, write: () => void): void {\n saveKey(path, key);\n try { write(); } catch (error) {\n if (key.pem) rmSync(path, { force: true });\n throw error;\n }\n}\n\n/** What the person is told on stderr when a key was made: where, which, and to back it up. Never the key. */\nfunction madeKeyNote(path: string, kind: KeyKind, key: string): string {\n return kind === \"publisher\"\n ? `new publisher key written to ${path}; back it up (${appFingerprint(key)}: an app is updated only with the key that signed it, and phase 1 has no recovery)`\n : `new store key written to ${path}; back it up and keep it offline (${appFingerprint(key)}: a store is its key)`;\n}\n\n// ---------- reading bundles ----------\n\nconst refused = (what: string, reading: { reason: string; detail?: string }, extra: Record<string, unknown> = {}) =>\n new CliError(\"refused\", `${what} (${reading.reason}${reading.detail ? `: ${reading.detail}` : \"\"})`, { reason: reading.reason, ...(reading.detail ? { detail: reading.detail } : {}), ...extra });\n\n/**\n * Refuses JSON that writes a key twice in one object, as `readAppListing` does: JSON.parse keeps the last value, where a\n * person reading the file sees the first, so what is signed is not what was read. `text` is JSON that JSON.parse took.\n */\nfunction refuseRepeatedKey(path: string, text: string): void {\n const twice = repeatedJsonKey(text);\n if (twice !== null) throw refused(`${path} writes a key twice`, { reason: \"not-json\", detail: `${JSON.stringify(twice)} is written twice` });\n}\n\n/** A bundle file's bytes: its size is checked before it is read, so a huge file is refused unread. */\nfunction readBundleFile(path: string): Uint8Array {\n const info = statSync(path);\n if (info.isDirectory()) throw new CliError(\"bad_request\", `${path} is a folder: name a .ghostlyapp file`);\n if (info.size > APP_BUNDLE_LIMITS.bundleBytes) throw refused(`${path} is not a valid bundle`, { reason: \"too-large\", detail: `${info.size} bytes` });\n return new Uint8Array(readFileSync(path));\n}\n\n/**\n * A bundle at an https URL, as a client fetches one: `https:` only, no user or password, jsDelivr only at a full\n * commit (WISP 1200 · Manifest, \"Every URL\"); every redirect is held to the same rule, and the download stops past\n * 16 MiB. A redirect stays on the URL's own host and port or goes to a host a client reads from (isAppFetchUrl): never\n * a host or port of the server's choosing on this machine's network.\n */\nasync function fetchBundle(url: string): Promise<Uint8Array> {\n // One wait for the URL, its redirects and its body together: a host that redirects just before a wait runs out\n // never earns another.\n const signal = AbortSignal.timeout(FETCH_TIMEOUT_MS);\n let at = url;\n for (let hop = 0; ; hop++) {\n if (!isAppUrl(at)) {\n throw new CliError(hop ? \"refused\" : \"usage\", hop\n ? `${url} redirects to ${at}, which a client does not read (https only, no user or password, jsDelivr only at a full commit)`\n : `Not a URL a client reads: https only, at most ${APP_BUNDLE_LIMITS.url} characters, no user or password, and jsDelivr only as https://cdn.jsdelivr.net/gh/<owner>/<repo>@<40-hex commit>/<path>`);\n }\n if (hop && new URL(at).host !== new URL(url).host && !isAppFetchUrl(at)) {\n throw new CliError(\"refused\", `${url} redirects to ${at}, on another host: a redirect stays on ${new URL(url).host} or goes to ${APP_FETCH_HOSTS.join(\" or \")}`);\n }\n let response: Response;\n try {\n response = await fetch(at, { redirect: \"manual\", signal });\n } catch (error) {\n if (error instanceof Error && error.name === \"TimeoutError\") throw new CliError(\"timeout\", `${at} did not answer in ${FETCH_TIMEOUT_MS / 1000} s`);\n throw new CliError(\"unavailable\", `Could not read ${at}: ${error instanceof Error ? error.message : String(error)}`);\n }\n if (response.status >= 300 && response.status < 400 && response.headers.get(\"location\")) {\n await response.body?.cancel();\n if (hop >= MAX_REDIRECTS) throw new CliError(\"refused\", `${url} redirects more than ${MAX_REDIRECTS} times`);\n at = new URL(response.headers.get(\"location\")!, at).href;\n continue;\n }\n if (response.status === 404 || response.status === 410) { await response.body?.cancel(); throw new CliError(\"not_found\", `${at} answered ${response.status}`); }\n if (!response.ok || !response.body) { await response.body?.cancel(); throw new CliError(\"unavailable\", `${at} answered ${response.status}`); }\n const limit = APP_BUNDLE_LIMITS.bundleBytes;\n const tooLarge = (bytes: number | string) => refused(`${url} is not a valid bundle`, { reason: \"too-large\", detail: `${bytes} bytes` });\n const length = Number(response.headers.get(\"content-length\"));\n if (Number.isFinite(length) && length > limit) { await response.body.cancel(); throw tooLarge(length); }\n const chunks: Uint8Array[] = [];\n let total = 0;\n const reader = response.body.getReader();\n try {\n for (;;) {\n const { done, value } = await reader.read();\n if (done) break;\n total += value.length;\n if (total > limit) { await reader.cancel(); throw tooLarge(`more than ${limit}`); }\n chunks.push(value);\n }\n } catch (error) {\n if (error instanceof CliError) throw error;\n if (error instanceof Error && error.name === \"TimeoutError\") throw new CliError(\"timeout\", `${at} did not finish in ${FETCH_TIMEOUT_MS / 1000} s`);\n throw new CliError(\"unavailable\", `Could not read ${at}: ${error instanceof Error ? error.message : String(error)}`);\n }\n const out = new Uint8Array(total);\n let offset = 0;\n for (const chunk of chunks) { out.set(chunk, offset); offset += chunk.length; }\n return out;\n }\n}\n\n/** What a checked bundle is, as `app verify` and `app publish` print it. */\nfunction described(bundle: AppBundle, bytes: Uint8Array) {\n const m = bundle.manifest;\n return {\n ref: appRef(m.publisher, m.name), publisher: m.publisher, fingerprint: appFingerprint(m.publisher), name: m.name,\n title: m.title, version: m.version, sequence: m.sequence, digest: bundle.digest, bytes: bytes.length,\n sha256: toBase64Url(createHash(\"sha256\").update(bytes).digest()),\n };\n}\n\n/** `app verify <bundle|url>`: every check a client makes before it stores a bundle (WISP 1200 · Reading a bundle). */\nexport async function verifyApp(source: string): Promise<Record<string, unknown>> {\n const { bundle, bytes } = await checkedBundle(source);\n return { valid: true, ...described(bundle, bytes), manifest: bundle.manifest };\n}\n\n/**\n * The revocations of a `ghostly-revoke.json`, a URL or a file, as a client reads it. None there, one that does not\n * answer, or one a client would not read, revokes nothing.\n */\nasync function revocationsIn(file: string, isUrl: boolean): Promise<SignedAppRevocation[]> {\n let bytes: Uint8Array;\n try {\n if (isUrl) bytes = await fetchBundle(file);\n else if (!existsSync(file)) return [];\n else bytes = readBundleFile(file);\n } catch { return []; }\n const read = readAppRevocations(bytes);\n return read.ok ? read.revocations : [];\n}\n\n/** The `ghostly-revoke.json` beside a bundle URL, its query and fragment left out; none for what is not a URL. */\nfunction besideUrl(url: string): string[] {\n try {\n const at = new URL(url);\n at.search = \"\";\n at.hash = \"\";\n return [new URL(APP_REVOKE_FILE, at).href];\n } catch { return []; }\n}\n\n/**\n * A bundle from a file or an https URL, with every check of `app verify`; `url` when it came from one. A version its\n * publisher revoked is refused, as a client stops it, with no \"Run anyway\": in the `ghostly-revoke.json` beside it and,\n * for a URL, beside each of the manifest's `sources` too (WISP 1200 · Revocation: a client reads them there, where a\n * publisher revokes a version a store's pinned URL still holds). A file is checked offline: beside it only.\n */\nexport async function checkedBundle(source: string): Promise<{ bundle: AppBundle; bytes: Uint8Array; url?: string }> {\n const isUrl = /^[a-z][a-z0-9+.-]*:\\/\\//i.test(source);\n const bytes = isUrl ? await fetchBundle(source) : readBundleFile(userPath(source));\n const read = readAppBundle(bytes);\n if (!read.ok) throw refused(`${source} is not a valid bundle`, read);\n const m = read.bundle.manifest;\n const version = { ref: appRef(m.publisher, m.name), sequence: m.sequence, digest: read.bundle.digest };\n // The `sources` are the publisher's words: beside them only on the hosts a client reads from (isAppFetchUrl), never a\n // host or port of the publisher's choosing on this machine's network.\n const files = isUrl\n ? new Set([source, ...(m.sources ?? []).filter(isAppFetchUrl)].flatMap(besideUrl))\n : [join(dirname(userPath(source)), APP_REVOKE_FILE)];\n // Read together: one host that does not answer holds the check for one wait, not one per file after it.\n const lists = await Promise.all([...files].map((file) => revocationsIn(file, isUrl)));\n for (const [i, file] of [...files].entries()) {\n const revocation = appRevocationFor(version, lists[i]!);\n if (revocation) {\n throw refused(`${source} is a version its publisher revoked in ${file}: a client stops it`, { reason: \"revoked\", ...(revocation.statement.reason !== undefined && { detail: revocation.statement.reason }) }, { file });\n }\n }\n return { bundle: read.bundle, bytes, ...(isUrl && { url: source }) };\n}\n\n// ---------- starting an app ----------\n\n/** A folder's name as an app's: lower case, anything else a hyphen (`My App` is `my-app`). */\nconst nameFrom = (folder: string) => folder.toLowerCase().replace(/[^a-z0-9]+/g, \"-\").replace(/^-+|-+$/g, \"\");\n/** An app's name as a title: `my-app` is `My app`. */\nconst titleFrom = (name: string) => (name[0]!.toUpperCase() + name.slice(1)).replace(/-/g, \" \");\n/**\n * A path as one word of a POSIX shell line: as typed when it is plain, else single-quoted (`My App` is `'My App'`).\n * None for a path the JSON answer would print other than it is (a `\"`, a backslash, a control) or holding a `'`, whose\n * quoting takes a backslash: a line copied from the answer would be another command.\n */\nconst shellWord = (word: string) => /^[\\w@%+=:,./~-]+$/.test(word) ? word : word.includes(\"'\") || jsonOut(word) !== `\"${word}\"` ? null : `'${word}'`;\n\n/**\n * `app init <dir> [--name <name>] [--title <title>] [--force]`: a small working app in `<dir>` (made when missing),\n * which `app publish <dir>` signs as it is: `ghostly-app.json`, an `index.html` that says hello to the contact, and a\n * README with the way to a store (./appTemplate.ts). The name is `--name`, else the folder's; the title `--title`, else\n * the name's. Nothing is written when one of the three files is there, unless `--force`, which replaces those three only.\n */\nexport async function initApp(dirArg: string, what: { name?: string; title?: string; force?: boolean } = {}): Promise<Record<string, unknown>> {\n const usage = \"ghostly app init <dir> [--name <name>] [--title <title>] [--force]\";\n const dir = userPath(dirArg);\n const name = what.name ?? nameFrom(basename(dir));\n const title = what.title ?? (name ? titleFrom(name) : \"\");\n const page = templatePage({ name, title });\n // Checked as publish will check it, under a key of zeros and the page's own entry: what is written always publishes.\n const pageBytes = new TextEncoder().encode(page);\n const checked = checkAppManifest({\n ...templateManifest({ name, title }), ghostlyApp: 1, publisher: toZ32(new Uint8Array(32)), sequence: 1,\n files: [{ path: \"index.html\", size: pageBytes.length, sha256: toBase64Url(createHash(\"sha256\").update(pageBytes).digest()) }],\n }, { strict: true });\n if (!checked.ok) {\n if (checked.detail === \"name is not valid\") {\n throw new CliError(\"usage\", what.name === undefined\n ? `The folder's name gives no app name (${JSON.stringify(basename(dir))}): give --name, a lowercase letter then up to 31 lowercase letters, digits or hyphens: ${usage}`\n : `--name is a lowercase letter then up to 31 lowercase letters, digits or hyphens, not ${JSON.stringify(what.name)}`);\n }\n if (checked.detail === \"title is not valid\") throw new CliError(\"usage\", `--title is one line of 1 to ${APP_BUNDLE_LIMITS.title} characters, not ${JSON.stringify(title)}`);\n throw refused(\"The template makes no valid manifest\", checked);\n }\n\n if (existsSync(dir) && !statSync(dir).isDirectory()) throw new CliError(\"bad_request\", `${dir} is a file: name a folder for the app`);\n const files: [string, string][] = [\n [APP_SOURCE, `${JSON.stringify(templateManifest({ name, title }), null, 2)}\\n`],\n [\"index.html\", page],\n [\"README.md\", templateReadme({ name, title })],\n ];\n const held = files.map(([path]) => path).filter((path) => existsSync(join(dir, path)));\n if (held.length && !what.force) {\n throw refused(`${dir} already holds ${held.join(\", \")}: nothing was written (--force replaces ${held.length > 1 ? \"them\" : \"it\"})`, { reason: \"exists\" }, { files: held });\n }\n mkdirSync(dir, { recursive: true });\n for (const [path, text] of files) writeWhole(join(dir, path), new TextEncoder().encode(text));\n // A line to paste: a folder with a space or a `$` stays one word, the folder given; one the answer cannot print as it\n // is (a quote, a backslash) is left to the person, named in `dir`.\n const typed = shellWord(dirArg);\n return {\n dir, name, title, files: files.map(([path]) => path), ...(held.length ? { replaced: held } : {}),\n next: typed === null ? \"ghostly app publish <the folder> --key <a key file outside it>\" : `ghostly app publish ${typed} --key <a key file outside ${typed}>`,\n };\n}\n\n// ---------- publishing ----------\n\n/** Every file of the folder, as the bundle names it; dot files and folders are left out and listed. */\nfunction collectFiles(dir: string, leaveOut: Set<string>): { files: { path: string; full: string; size: number }[]; skipped: string[] } {\n const files: { path: string; full: string; size: number }[] = [];\n const skipped: string[] = [];\n let bytes = 0;\n const walk = (folder: string) => {\n // Read as bytes: a name that is not UTF-8 comes back from a string read with U+FFFD in it, a path no file has.\n const names = readdirSync(folder, { encoding: \"buffer\" }).map((raw) => ({ raw, name: raw.toString(\"utf8\") }));\n for (const { raw, name } of names.sort((a, b) => (a.name < b.name ? -1 : a.name > b.name ? 1 : 0))) {\n const full = join(folder, name);\n const path = relative(dir, full).split(sep).join(\"/\");\n if (leaveOut.has(full)) continue;\n if (name.startsWith(\".\")) { skipped.push(path); continue; }\n if (!Buffer.from(name, \"utf8\").equals(raw)) throw refused(`${dir} holds a name that is not UTF-8, which no bundle path may be: rename it`, { reason: \"bad-path\", detail: path });\n const info = lstatSync(full);\n if (info.isSymbolicLink()) throw new CliError(\"bad_request\", `${path} is a link: a bundle holds the folder's own files (copy it in, or remove it)`);\n if (info.isDirectory()) { walk(full); continue; }\n if (!info.isFile()) throw new CliError(\"bad_request\", `${path} is not a file`);\n files.push({ path, full, size: info.size });\n bytes += info.size;\n if (files.length > APP_BUNDLE_LIMITS.files) throw refused(`${dir} holds more files than a bundle may`, { reason: \"too-many-files\", detail: `more than ${APP_BUNDLE_LIMITS.files}` });\n if (bytes > APP_BUNDLE_LIMITS.bundleBytes) throw refused(`${dir} holds more than a bundle may`, { reason: \"too-large\", detail: `more than ${APP_BUNDLE_LIMITS.bundleBytes} bytes of files` });\n }\n };\n walk(dir);\n // The manifest lists every path in code-unit order, across folders: `lib-extra.js` before `lib/x.js`, which the walk\n // reaches first (`-` and `.` sort before `/`).\n files.sort((a, b) => (a.path < b.path ? -1 : a.path > b.path ? 1 : 0));\n return { files, skipped };\n}\n\n/**\n * A private key in a file: a PEM private key block with its body (PKCS #8, OpenSSH, RSA, EC, encrypted, the traditional\n * encrypted one's \"Proc-Type: 4,ENCRYPTED\" headers included), an OpenPGP \"PRIVATE KEY BLOCK\" (its \"Version: GnuPG\n * v2.4.5\" headers included), or a Ghostly key file's first line. A library that only names the block's header in its\n * code does not match. The body stops at the next \"-----\": a file of headers with no end is read once, not once per\n * header to the end of the file.\n */\nconst PRIVATE_KEY = /-----BEGIN [A-Z0-9 ]*PRIVATE KEY( BLOCK)?-----\\r?\\n(?:[A-Za-z0-9+/=\\r\\n :,.]|-(?!----)){40,}-----END [A-Z0-9 ]*PRIVATE KEY( BLOCK)?-----|^Ghostly (publisher|store) key \\(WISP 1200\\)/;\n\n/** Whether `path` is `dir` or anything under it (a name like `..k.key` is under it: only a `..` segment leaves). */\nconst isUnder = (dir: string, path: string) => { const rel = relative(dir, path); return rel !== \"..\" && !rel.startsWith(`..${sep}`) && !isAbsolute(rel); };\n/** `path` with its symlinks followed, as far as it exists (the rest, not made yet, kept as written). */\nfunction realPath(path: string): string {\n try { return realpathSync(path); } catch {\n const parent = dirname(path);\n return parent === path ? path : join(realPath(parent), basename(path));\n }\n}\n/** {@link isUnder} as written or through a symlink: another name for the folder (or for the file) is the same place. */\nconst isInside = (dir: string, path: string) => isUnder(dir, path) || isUnder(realPath(dir), realPath(path));\n\n/** Fields of `ghostly-app.json` the command writes itself. */\nconst WRITTEN = [\"publisher\", \"files\"] as const;\n\nfunction readSource(path: string): Record<string, unknown> {\n if (!existsSync(path)) throw new CliError(\"not_found\", `No ${APP_SOURCE} in ${dirname(path)}: it holds the manifest's fields (name, version, title, tagline, entry, permissions, runtime, license, ...) but publisher, sequence and files, which publish writes`);\n let text: string, value: unknown;\n try { text = readFileSync(path, \"utf8\"); value = JSON.parse(text); } catch (error) { throw new CliError(\"bad_request\", `${path} is not JSON: ${error instanceof Error ? error.message : String(error)}`); }\n refuseRepeatedKey(path, text);\n if (!value || typeof value !== \"object\" || Array.isArray(value)) throw new CliError(\"bad_request\", `${path} is not a JSON object`);\n const draft = value as Record<string, unknown>;\n const written = WRITTEN.filter((k) => k in draft);\n if (written.length) throw new CliError(\"bad_request\", `${path} has ${written.join(\" and \")}: publish writes ${written.length > 1 ? \"them\" : \"it\"} from the key and the folder's files`);\n if (draft.ghostlyApp !== undefined && draft.ghostlyApp !== 1) throw refused(`${path} is not a manifest this release makes`, { reason: \"unsupported-format\", detail: \"ghostlyApp is not 1\" });\n if (draft.sequence !== undefined && !(Number.isSafeInteger(draft.sequence) && (draft.sequence as number) >= 1)) {\n throw new CliError(\"bad_request\", `${path}: sequence is a whole number from 1 (or leave it out: publish raises it by itself)`);\n }\n return draft;\n}\n\n/**\n * Writes a file whole or not at all: a reader never sees half a bundle (and a dot file left by a crash is never bundled).\n * The temporary file is always a new one (\"wx\"): a file or link already at its name is removed, never written through.\n */\nexport function writeWhole(path: string, bytes: Uint8Array): void {\n const tmp = join(dirname(path), `.${basename(path)}.${process.pid}.tmp`);\n rmSync(tmp, { force: true });\n writeFileSync(tmp, bytes, { mode: 0o644, flag: \"wx\" });\n renameSync(tmp, path);\n}\n\n/**\n * `app publish <dir> --key <file> [--out <file>] [--sequence n]`:`<dir>/ghostly-app.json` (the manifest without `publisher`,\n * `sequence` and `files`) and every other file in `<dir>` (but its bundles and revocations) become one signed bundle, by default `<dir>/app.ghostlyapp`.\n * The sequence is `--sequence` (higher than the bundle already at `--out`'s), else one more than that bundle's (or\n * the source's `sequence`, if higher, else 1). The\n * key file is made when it is missing and no earlier bundle is there to update.\n */\nexport async function publishApp(dirArg: string, keyArg: string, outArg?: string, sequenceArg?: number): Promise<Record<string, unknown>> {\n if (sequenceArg !== undefined && !(Number.isSafeInteger(sequenceArg) && sequenceArg >= 1)) throw new CliError(\"usage\", `--sequence takes a whole number from 1, not ${sequenceArg}`);\n const dir = userPath(dirArg);\n if (!statSync(dir).isDirectory()) throw new CliError(\"bad_request\", `${dir} is not a folder`);\n const keyPath = userPath(keyArg);\n // Every file of the folder is published, and the folder is often the repository the bundle is committed to.\n if (isInside(dir, keyPath)) {\n throw refused(`${keyPath} is inside ${dir}, which is published: keep the publisher key outside the app's folder (and its repository)`, { reason: \"private-key\" });\n }\n const out = userPath(outArg ?? join(dir, APP_BUNDLE_FILE));\n const sourcePath = join(dir, APP_SOURCE);\n const draft = readSource(sourcePath);\n\n // The version this one follows: the bundle already at the output, which only its own key may follow.\n let previous: AppManifest | null = null;\n if (existsSync(out)) {\n const read = readAppBundle(readBundleFile(out));\n if (!read.ok) throw refused(`${out} is there and is not a valid bundle: move it away, or name another --out`, read);\n previous = read.bundle.manifest;\n }\n\n let key: LoadedKey;\n if (existsSync(keyPath)) key = readKey(keyPath, \"publisher\");\n else if (previous) {\n throw new CliError(\"not_found\", `No key file ${keyPath}: ${out} is signed by ${appFingerprint(previous.publisher)}, and only that key publishes its next version`);\n } else key = makeKey(\"publisher\");\n\n if (previous && previous.publisher !== key.key) {\n throw refused(`${out} is ${appRef(previous.publisher, previous.name)}, signed by another key (${appFingerprint(previous.publisher)}): a version of an app is signed by its own key`, { reason: \"other-app\" }, { publisher: previous.publisher });\n }\n if (previous && previous.name !== draft.name) {\n throw refused(`${out} is the app ${JSON.stringify(previous.name)}, not ${JSON.stringify(draft.name)}: name another --out for another app`, { reason: \"other-app\" });\n }\n\n if (sequenceArg !== undefined && previous && sequenceArg <= previous.sequence) {\n throw refused(`--sequence ${sequenceArg} is not higher than the ${previous.sequence} of ${out}: every client refuses a lower one, and the same one with other content is equivocation`, { reason: sequenceArg < previous.sequence ? \"rollback\" : \"equivocation\" }, { previous: previous.sequence });\n }\n const sequence = sequenceArg ?? Math.max(previous ? previous.sequence + 1 : 1, (draft.sequence as number | undefined) ?? 1);\n // The bundle at the folder's default name is this command's own output too: published into another --out, the\n // version an earlier publish left there went into the new bundle as one of its files.\n // The folder's revocations and those beside the output (where `app revoke --bundle` writes them), one list when the same.\n const lists = [...new Set([join(dir, APP_REVOKE_FILE), join(dirname(out), APP_REVOKE_FILE)])];\n const { files, skipped } = collectFiles(dir, new Set([sourcePath, out, join(dir, APP_BUNDLE_FILE), ...lists]));\n const contents = files.map((f) => ({ path: f.path, bytes: new Uint8Array(readFileSync(f.full)) }));\n // A bundle is public: a private key found in the folder (an old key, a store key, any PEM) stops the publish.\n const keyFile = contents.find((f) => PRIVATE_KEY.test(Buffer.from(f.bytes).toString(\"latin1\")));\n if (keyFile) throw refused(`${keyFile.path} in ${dir} holds a private key, and a bundle is public: move it out of the app's folder`, { reason: \"private-key\", detail: keyFile.path });\n const manifest = {\n ...draft,\n ghostlyApp: 1,\n publisher: key.key,\n sequence,\n files: contents.map((f) => ({ path: f.path, size: f.bytes.length, sha256: toBase64Url(createHash(\"sha256\").update(f.bytes).digest()) })),\n };\n const checked = checkAppManifest(JSON.parse(JSON.stringify(manifest)), { strict: true });\n if (!checked.ok) {\n // A field missing from the source, said where it goes (\"kind in ghostly-app.json\"), not as a missing --key; the\n // JSON detail stays the field's name.\n const said = checked.reason === \"missing-key\" ? { ...checked, detail: `${checked.detail} in ${APP_SOURCE}` } : checked;\n throw refused(`${sourcePath} and the folder's files make no valid manifest`, said, checked.detail ? { detail: checked.detail } : {});\n }\n\n const { bytes: manifestBytes, signature } = await signAppObject(APP_PREFIXES.app, checked.manifest, key.signer);\n const bundle = assembleAppBundle(manifestBytes, canonicalJsonBytes(signature), contents.map((f) => f.bytes));\n // Read back as a client would (the icon's header, the bundle's size): what is written is never a bundle it refuses.\n const read = readAppBundle(bundle);\n if (!read.ok) throw refused(\"The bundle made is not valid\", read);\n // Nor one those revocations already stop: every client that reads them would refuse it, for good.\n const ref = appRef(key.key, checked.manifest.name);\n const held = lists.flatMap((path) => {\n if (!existsSync(path)) return [];\n const revocations = readAppRevocations(new Uint8Array(readFileSync(path)));\n return revocations.ok ? revocations.revocations.map((r) => ({ path, r })) : [];\n });\n const stopping = held.find(({ r }) => appRevocationFor({ ref, sequence, digest: read.bundle.digest }, [r]));\n if (stopping) {\n const clear = Math.max(sequence, ...held.map(({ r }) => r.statement.app === ref && \"upTo\" in r.statement ? r.statement.upTo : 0)) + 1;\n throw refused(`${stopping.path} already revokes version ${sequence} of ${ref}, and every client that reads it would stop it: give --sequence ${clear}`, { reason: \"revoked\" }, { sequence: clear });\n }\n saveKeyThen(keyPath, key, () => {\n mkdirSync(dirname(out), { recursive: true });\n writeWhole(out, bundle);\n });\n\n return {\n ...described(read.bundle, bundle),\n previous: previous?.sequence ?? null,\n out,\n files: contents.map((f) => f.path),\n ...(skipped.length ? { skipped } : {}),\n keyCreated: key.created,\n ...(key.created ? { warning: madeKeyNote(keyPath, \"publisher\", key.key) } : {}),\n };\n}\n\n// ---------- revocations ----------\n\n/**\n * `app revoke <dir> --key <file> (--digest <digest>... | --up-to <sequence>) [--reason <text>] [--bundle <file>]`: a\n * `ghostly-revoke/1` statement (WISP 1200 · Publisher keys, Revocation) for the app whose bundle is `<dir>/app.ghostlyapp`\n * (or `--bundle`), signed by that app's publisher key and added to the `ghostly-revoke.json` beside that bundle, which\n * stays canonical.\n * The key is never made here: only the key that signed the app may revoke its versions.\n */\nexport async function revokeApp(dirArg: string, keyArg: string, what: { digests?: string[]; upTo?: number; reason?: string; bundle?: string; force?: boolean }): Promise<Record<string, unknown>> {\n const dir = userPath(dirArg);\n const bundlePath = userPath(what.bundle ?? join(dir, APP_BUNDLE_FILE));\n // Beside the bundle, where clients, app verify and app serve read it: a list left in <dir> beside a bundle published\n // from elsewhere stops nothing.\n const listPath = join(dirname(bundlePath), APP_REVOKE_FILE);\n const usage = \"ghostly app revoke <dir> --key <file> (--digest <digest>... | --up-to <sequence>) [--reason <text>] [--bundle <file>] [--force]\";\n // Sorted, so the same digests in another order are the same statement, signed and compared once.\n const digests = [...(what.digests ?? [])].sort();\n if ((digests.length > 0) === (what.upTo !== undefined)) throw new CliError(\"usage\", `Give --digest (again for each) or --up-to, one of the two: ${usage}`);\n if (what.upTo !== undefined && !(Number.isSafeInteger(what.upTo) && what.upTo >= 1)) throw new CliError(\"usage\", `--up-to takes a sequence, a whole number from 1, not ${what.upTo}`);\n // Checked here as the statement's checker checks them, so a bad value is a usage error naming its option.\n for (const [i, digest] of digests.entries()) {\n if (!isAppHash(digest)) throw new CliError(\"usage\", `--digest ${JSON.stringify(digest)} is not a bundle digest (43 base64url characters, as app verify prints it)`);\n if (digests.indexOf(digest) !== i) throw new CliError(\"usage\", `--digest ${digest} is given twice`);\n }\n if (digests.length > APP_STATEMENT_LIMITS.revokeDigests) throw new CliError(\"usage\", `--digest is given at most ${APP_STATEMENT_LIMITS.revokeDigests} times in one revocation, not ${digests.length}`);\n // An empty reason is refused as an empty --title is: every client shows it, and it would say nothing.\n if (what.reason !== undefined && !isAppLine(what.reason, APP_STATEMENT_LIMITS.reason, 1)) {\n const length = [...what.reason].length;\n throw new CliError(\"usage\", `--reason is one line of 1 to ${APP_STATEMENT_LIMITS.reason} characters, not ${length > APP_STATEMENT_LIMITS.reason ? `${length} characters` : JSON.stringify(what.reason)}`);\n }\n // The list is published beside the bundle and every client shows the reason (docs/CLI.md § Safety).\n guardText(what.reason, what.force === true, \"reason\", \"revoke\");\n\n if (!existsSync(bundlePath)) throw new CliError(\"not_found\", `No bundle ${bundlePath}: a revocation names the app of the bundle in <dir> (or --bundle)`);\n const read = readAppBundle(readBundleFile(bundlePath));\n if (!read.ok) throw refused(`${bundlePath} is not a valid bundle`, read);\n const manifest = read.bundle.manifest;\n const ref = appRef(manifest.publisher, manifest.name);\n // Clients keep a revocation for good: past the newest version (a typo, 30 for 3), it stops versions not made yet.\n // --force lifts it, so it asks for a confirmation, as every refusal --force lifts does.\n if (what.upTo !== undefined && what.upTo > manifest.sequence && !what.force) {\n throw new CliError(\"confirm\", `--up-to ${what.upTo} is past ${bundlePath}'s version, ${manifest.sequence}: it would also stop versions ${manifest.sequence + 1} to ${what.upTo} before they exist, for good. Give --up-to ${manifest.sequence}, or --force if versions up to ${what.upTo} were published from elsewhere`);\n }\n\n const keyPath = userPath(keyArg);\n if (!existsSync(keyPath)) throw new CliError(\"not_found\", `No key file ${keyPath}: only the key that signed ${ref} (${appFingerprint(manifest.publisher)}) revokes its versions`);\n const key = readKey(keyPath, \"publisher\");\n if (key.key !== manifest.publisher) {\n throw refused(`${keyPath} is not the publisher key of ${ref} (${appFingerprint(manifest.publisher)}): a revocation by any other key is refused by every client`, { reason: \"signature-key\" });\n }\n\n const statement = (digests.length\n ? { ghostlyRevoke: 1, app: ref, digests }\n : { ghostlyRevoke: 1, app: ref, upTo: what.upTo }) as AppRevokeStatement;\n if (what.reason !== undefined) statement.reason = what.reason;\n const problem = checkAppRevokeStatement(statement);\n if (problem) throw refused(\"Not a revocation a client reads\", { reason: \"bad-revocation\", detail: problem });\n\n // Each revocation's signature is checked once: the held list's are not checked again when the new list is read back.\n const checked = new Set<string>();\n let list: SignedAppRevocation[] = [];\n if (existsSync(listPath)) {\n const held = readAppRevocations(new Uint8Array(readFileSync(listPath)), checked);\n if (!held.ok) throw refused(`${listPath} is there and is not a valid ghostly-revoke.json: fix or move it first`, held);\n list = held.revocations;\n }\n const signed = await signAppRevocation(statement, key.signer);\n // A held list made before the digests were sorted may hold them in another order: compared sorted too.\n const sorted = (s: AppRevokeStatement) => canonicalJson(\"digests\" in s ? { ...s, digests: [...s.digests].sort() } : s);\n const same = list.some((r) => sorted(r.statement) === sorted(signed.statement));\n if (!same) {\n if (list.length >= APP_STATEMENT_LIMITS.revocations) throw refused(`${listPath} holds ${list.length} revocations already`, { reason: \"bad-revocation\", detail: `at most ${APP_STATEMENT_LIMITS.revocations}` });\n list = [...list, signed];\n const bytes = canonicalJsonBytes(list);\n const check = readAppRevocations(bytes, checked);\n if (!check.ok) throw refused(\"The revocation list made is not valid\", check);\n writeWhole(listPath, bytes);\n }\n const covers = digests.length\n ? { digests, current: digests.includes(read.bundle.digest) }\n : { upTo: what.upTo, current: manifest.sequence <= what.upTo! };\n return { app: ref, ...covers, ...(what.reason !== undefined ? { reason: what.reason } : {}), added: !same, revocations: list.length, file: listPath };\n}\n\n// ---------- store indexes ----------\n\n/**\n * `store sign <index> --key <file> [--out <dir>]`: a store index written by hand (any JSON layout; `key` may be left\n * out and is then the signing key's) becomes `ghostly-store.json`, canonical, and `ghostly-store.sig`, in `--out` or\n * beside the index. It is read back as a client reads it (`expires` at most 90 days ahead), and refused when the index\n * already there has a higher `sequence`, or the same one with other content, or is signed by another key (another\n * store is another `--out`), or when a `ghostly-store.json` or `.sig` there does not read as a signed index. The key is\n * made only when neither is there, and never read or made inside the output folder, which is published.\n */\nexport async function signStore(indexArg: string, keyArg: string, outArg?: string, now = Math.floor(Date.now() / 1000)): Promise<Record<string, unknown>> {\n const indexPath = userPath(indexArg);\n const keyPath = userPath(keyArg);\n const outDir = userPath(outArg ?? dirname(indexPath));\n let text: string, value: unknown;\n try { text = readFileSync(indexPath, \"utf8\"); value = JSON.parse(text); } catch (error) {\n if (error instanceof SyntaxError) throw new CliError(\"bad_request\", `${indexPath} is not JSON: ${error.message}`);\n throw localFileError(error, indexPath) ?? error;\n }\n refuseRepeatedKey(indexPath, text);\n if (!value || typeof value !== \"object\" || Array.isArray(value)) throw new CliError(\"bad_request\", `${indexPath} is not a JSON object`);\n const index = value as Record<string, unknown>;\n // The folder is published (a repository served raw): a store key there signs any index for every client of the store.\n if (isInside(outDir, keyPath)) {\n throw refused(`${keyPath} is inside ${outDir}, which is published: keep the store key outside the store's folder (and its repository)`, { reason: \"private-key\" });\n }\n\n // The index this one follows, when the folder holds a signed one: a store is its key, so only that key signs over it.\n const indexOut = join(outDir, STORE_INDEX_FILE), sigOut = join(outDir, STORE_SIG_FILE);\n // Each revocation's signature is checked once, though the held index, the new one and its read-back all carry it.\n const checked = new Set<string>();\n let held: AppStoreReading | null = null;\n // A pair there that does not read as a signed index (one of the two missing, or damaged) is not written over, as\n // `app publish` does not write over a bundle it cannot read: its sequence and key are not known, so neither is a rollback.\n let unread: CliError | null = null;\n const heldIndex = existsSync(indexOut) ? new Uint8Array(readFileSync(indexOut)) : null;\n const heldSig = existsSync(sigOut) ? new Uint8Array(readFileSync(sigOut)) : null;\n if (heldIndex || heldSig) {\n const read = !heldIndex ? { ok: false as const, reason: \"missing-file\", detail: `no ${STORE_INDEX_FILE}` }\n : !heldSig ? { ok: false as const, reason: \"bad-signature-statement\", detail: `no ${STORE_SIG_FILE}` }\n : readAppStore(heldIndex, heldSig, now, undefined, checked);\n if (read.ok) held = read.store;\n else unread = refused(`${heldIndex ? indexOut : sigOut} is there and is not a signed store index: move ${STORE_INDEX_FILE} and ${STORE_SIG_FILE} away, or name another --out`, read);\n }\n\n let key: LoadedKey;\n if (existsSync(keyPath)) key = readKey(keyPath, \"store\");\n else if (index.key !== undefined) throw new CliError(\"not_found\", `No key file ${keyPath}: the index names the store key ${typeof index.key === \"string\" ? appFingerprint(index.key) : JSON.stringify(index.key)}`);\n else if (unread) throw unread;\n else if (held) throw new CliError(\"not_found\", `No key file ${keyPath}: ${indexOut} is signed by ${appFingerprint(held.index.key)}, and only that key signs its next index`);\n else key = makeKey(\"store\");\n if (index.key !== undefined && index.key !== key.key) {\n throw refused(`${indexPath} names another store key than ${keyPath}'s (${appFingerprint(key.key)})`, { reason: \"store-key\" });\n }\n if (held && held.index.key !== key.key) {\n throw refused(`${indexOut} is signed by another store key (${appFingerprint(held.index.key)}) than ${keyPath}'s (${appFingerprint(key.key)}): a store is its key; sign with that key, or give another --out for another store`, { reason: \"store-key\" }, { held: held.index.key });\n }\n index.key = key.key;\n\n const valid = checkAppStoreIndex(index, { strict: true }, checked);\n if (!valid.ok) throw refused(`${indexPath} is not a valid store index`, valid);\n const { indexBytes, sigBytes } = await signAppStore(index as unknown as AppStoreIndex, key.signer, checked);\n const read = readAppStore(indexBytes, sigBytes, now, key.key, checked);\n if (!read.ok) throw refused(`${indexPath} would be refused by a client`, read);\n const store = read.store;\n // Unless the signature there is this one's bytes (Ed25519 is deterministic): a run stopped between the signature's\n // rename and the index's, signed again. Not the index's bytes: a held index edited in place is this one's bytes too,\n // and its own signature is the only trace of the sequence it held.\n if (unread && !(heldSig && Buffer.from(heldSig).equals(sigBytes))) throw unread;\n\n let previous: number | null = null;\n if (held) {\n previous = held.index.sequence;\n const decision = appStoreDecision(\n { key: key.key, sequence: held.index.sequence, digest: held.digest },\n { key: key.key, sequence: store.index.sequence, digest: store.digest },\n );\n if (decision === \"rollback\" || decision === \"equivocation\") {\n throw refused(`${indexOut} already holds sequence ${held.index.sequence} of this store: ${decision === \"rollback\" ? \"a lower one is refused by every client\" : \"the same one with other content is refused as equivocation\"}; raise sequence`, { reason: decision }, { held: held.index.sequence });\n }\n }\n\n // The signature first, so a run stopped before the index leaves what a run again tells apart (above); once it is\n // written the key stays: the signature names it, and a run again signs with it.\n saveKeyThen(keyPath, key, () => {\n mkdirSync(outDir, { recursive: true });\n writeWhole(sigOut, sigBytes);\n });\n writeWhole(indexOut, indexBytes);\n const notes = [\n ...(key.created ? [madeKeyNote(keyPath, \"store\", key.key)] : []),\n ...(store.expired ? [`expires (${new Date(store.index.expires * 1000).toISOString()}) is past: clients still install from it and say the store was not updated since then`] : []),\n ];\n return {\n key: key.key, fingerprint: appFingerprint(key.key), name: store.index.name, kind: store.index.kind,\n sequence: store.index.sequence, previous, expires: store.index.expires, expired: store.expired,\n apps: store.index.apps.length, removed: store.index.removed.length, revoked: store.index.revoked.length,\n digest: store.digest, index: indexOut, sig: sigOut, keyCreated: key.created,\n ...(notes.length ? { warning: notes.join(\"; \") } : {}),\n };\n}\n"],"mappings":";;;;;;;;;;;AAQA,IAAM,QAAQ,SAAiB,KAAK,QAAQ,YAAY,OAAO;CAAE,KAAK;CAAS,KAAK;CAAQ,KAAK;CAAQ,MAAK;AAAS,EAAA,CAAG,EAAG;;AAG7H,SAAgB,iBAAiB,EAAE,MAAM,SAA+C;CACtF,OAAO;EACL;EACA,SAAS;EACT,MAAM;EACN;EACA,SAAS;EACT,aAAa;EACb,OAAO;EACP,aAAa,CAAC,MAAM;EACpB,MAAM;EACN,SAAS;GAAE,MAAM;GAAS,SAAS,CAAC,OAAO,SAAS;EAAE;EACtD,SAAS;CACX;AACF;;;;;;;AAQA,SAAgB,aAAa,EAAE,SAA8B;CAC3D,OAAO;;;;;SAKA,KAAK,KAAK,EAAE;;;;;;;;;;;;;;MAcf,KAAK,KAAK,EAAE;;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EAAQ,YAAY,IAAI;EACpE,GAAI,MAAM,SAAS,EAAE,SAAS,MAAM,KAAK,IAAI,EAAE,IAAI,CAAC;CACtD;AACF"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"buttons-BGxzOtrq.js","names":["goesOnIn"],"sources":["../../src/waits.ts","../../src/textSize.ts","../../src/buttons.ts"],"sourcesContent":["import type { GroupView, StoredMessage } from \"@ghostly/browser/shared/types\";\nimport { groupById, noMessage, nobodyJoinedChat, node, type ApiContext, type Method } from \"./apiKit\";\nimport { CliError } from \"./errors\";\nimport type { GhostlyEvent } from \"./events\";\nimport { goesOn as goesOnIn } from \"./waitNotice\";\n\n/*\n * Waiting on what a command sent (WISP 1100): a message's delivery, an edit's confirmation, a group frame taken by an\n * edge. Shared by the chat, group and status card methods. A deadline counts on `performance.now()`: on `Date.now()`\n * a wall clock set back while a wait ran (NTP, a person fixing the time) stretched it by as much, past the client's\n * own deadline, which told the bot to restart a sound daemon.\n */\n\nconst DELIVERY_RANK: Record<string, number> = { sending: 0, waiting: 1, queued: 1, held: 2, sent: 2, delivered: 3 };\n\n/**\n * What a timed-out wait says of what happens next: a daemon goes on, a one-shot's profile closes now. A one-shot's\n * `edit` and `group edit` said \"while this profile is online\" too, as it was about to leave. Ctrl-C says the same.\n * On a chat nobody joined yet nothing goes before they do: it said \"goes with this profile's next command\".\n */\nexport const goesOn = (ctx: ApiContext, chat?: string) => chat !== undefined && nobodyJoinedChat(ctx, chat)\n ? `goes once the contact joins this chat (nobody has yet)${ctx.mode === \"one-shot\" ? \" while this profile is online (`ghostly daemon --detach`)\" : \"\"}`\n : ctx.mode === \"daemon\" && stopped(ctx) ? \"goes by itself once this profile is online again\" : goesOnIn(ctx.mode);\n\n/**\n * A daemon that stops (`ApiContext.stopping`) ends every wait still open at once, with what it knows, as a timeout:\n * what was asked is done and goes on by itself. Its connections ended under the waits before, and the command failed\n * as `unavailable` \"The daemon went away\" with no `messageId`: a bot that sent again sent the message twice.\n */\nconst stopped = (ctx: ApiContext) => ctx.stopping?.aborted === true;\n\n/** How a wait that ends short of its aim begins: its time ran out, or the daemon stopped under it. */\nexport const ended = (ctx: ApiContext, ms: number) => stopped(ctx) ? \"The daemon stopped before the wait ended\" : `Timed out after ${Math.round(ms / 1000)} s`;\n\n/** A timed-out wait's details, and `reason: \"daemon-stopped\"` when the daemon's stop ended it. */\nconst known = (ctx: ApiContext, details: Record<string, unknown>) => stopped(ctx) ? { ...details, reason: \"daemon-stopped\" } : details;\n\n/** Waits until the contact confirmed the latest edit of one of my messages (it is no longer pending). */\nexport async function waitForEdit(ctx: ApiContext, chat: string, messageId: string, ms: number): Promise<StoredMessage> {\n const until = performance.now() + ms;\n for (;;) {\n const message = await node(ctx).getMessage(chat, messageId);\n if (!message) throw noMessage(messageId, { group: false, ref: chat });\n if (!message.edit?.pending) return message;\n if (performance.now() >= until || stopped(ctx)) throw new CliError(\"timeout\", `${ended(ctx, ms)}: the contact has not confirmed the edit yet (it needs a live chat and a contact's app that shows edits). It ${goesOn(ctx, chat)}`, known(ctx, { messageId, edits: message.edit.seq }));\n await new Promise((resolve) => setTimeout(resolve, 250));\n }\n}\n\n/** Waits until the contact confirmed my removal of a message, which is already gone here. */\nexport async function waitForRemoval(ctx: ApiContext, chat: string, messageId: string, ms: number): Promise<void> {\n const until = performance.now() + ms;\n while (node(ctx).removalPending({ linkId: chat, messageId })) {\n if (performance.now() >= until || stopped(ctx)) throw new CliError(\"timeout\", `${ended(ctx, ms)}: the message is gone here and the contact has not confirmed yet. Its removal ${goesOn(ctx, chat)}`, known(ctx, { messageId }));\n await new Promise((resolve) => setTimeout(resolve, 250));\n }\n}\n\n/** How long `purgeMessage` waits for the engine to take the message's row out: it does so in a few milliseconds. */\nconst PURGE_WAIT_MS = 5_000;\n\n/**\n * `message delete --purge`: once the message's row is gone (the engine takes it out on later turns, its files first),\n * the replies that quote it lose its line (a delete here leaves it in their rows, one for everyone to a sweep within\n * 10 s), then the store's journal is folded into a fresh snapshot now, not within the hour of the fold that comes by\n * itself: what the message said leaves rows.db, `db/journal.bin` and rows.db's WAL before the command answers. For a\n * secret pasted into a chat; every delete folding would rewrite the snapshot each time. `message`: its row, read\n * before the delete.\n */\nexport async function purgeMessage(ctx: ApiContext, message: StoredMessage): Promise<void> {\n const { linkId: chat, id: messageId } = message;\n const until = performance.now() + PURGE_WAIT_MS;\n let gone = !(await node(ctx).getMessage(chat, messageId));\n while (!gone && performance.now() < until) {\n await new Promise((resolve) => setTimeout(resolve, 20));\n gone = !(await node(ctx).getMessage(chat, messageId));\n }\n if (gone) await node(ctx).forgetQuotesOf(message);\n await ctx.runtime.store.compact({ scrub: true });\n if (!gone) throw new CliError(\"timeout\", `Timed out after ${PURGE_WAIT_MS / 1000} s: the message is deleted, but what it said may stay in the profile's store until its next fold (within the hour)`, { messageId, deleted: messageId });\n}\n\n/**\n * `message delete --purge` that the delete answers no to (`not_found`, `refused`): the store folds all the same, so\n * the error says so in its words and `details.purged`. A message no longer here (the contact deleted it for everyone,\n * or a delete here without `--purge` took it) and another member's group message (only its author deletes it, and\n * once they do it is gone here) answered no and folded nothing: what a deleted copy said stayed in `db/journal.bin`\n * and rows.db's WAL until the fold within the hour. A usage mistake (`bad_request`) folds nothing.\n */\nexport function foldsAnyway(method: Method): Method {\n return async (ctx, params, call) => {\n try { return await method(ctx, params, call); } catch (error) {\n if (params.purge !== true || !(error instanceof CliError) || (error.code !== \"not_found\" && error.code !== \"refused\")) throw error;\n await ctx.runtime.store.compact({ scrub: true });\n // Said first: a refusal may end in a command to paste (`... is a group, not a chat: ghostly message delete ...`).\n throw new CliError(error.code, `The store was folded anyway, so a deleted copy of it is gone from the profile's folder. ${error.message}`, { ...error.details, purged: true });\n }\n };\n}\n\n/**\n * A private group with no member but me (they all left, or nobody accepted an invitation yet): what I send there now\n * reaches nobody, not even a member who joins later (a joiner reads nothing from before). A community's roster may not\n * list every member yet, so only a private group counts.\n */\nexport const nobodyElseIn = (ctx: ApiContext, groupId: string): boolean => alone(groupIn(ctx, groupId));\n\n/** A group as the engine shows it, built alone: `getState()` builds a view of every chat, once per poll. */\nconst groupIn = (ctx: ApiContext, groupId: string): GroupView | undefined => groupById(ctx, groupId);\n\nconst alone = (group: GroupView | undefined): boolean => group?.profile === \"mesh\" && !group.members.some((m) => !m.me);\n\n/**\n * Why I am no longer in a group (removed, say), or null while I am. A member removed while away learns it only after\n * it is back, so what it sent in between is never taken, and from then on nothing goes. A community's `lost` is not\n * out: it asks to be let in again by itself.\n */\nexport const outOf = (group: GroupView | undefined): string | null =>\n group?.status && group.status !== \"active\" && group.status !== \"lost\" ? group.statusReason ?? \"You are not in this group\" : null;\n\n/**\n * Waits until an edge took my group message, or its edit number `edit`, or my reaction to it numbered `reaction`, or my\n * pin numbered `pin` (WISP 902: a group has no receipts, so this is as far as the author sees): a member's edge in a\n * private group, an edge to one of my hubs in a community. In a private group with nobody else in it, 0 at once: no\n * edge will ever take it, and the wait sat its whole time, then said \"it goes when one opens\" and exited 4, which a\n * bot retries, sending it again each time. Refused as soon as I learn I am out of the group: it sat its whole time\n * there too and said the same, though nothing goes any more.\n */\nexport async function waitForGroupFrame(ctx: ApiContext, groupId: string, messageId: string, edit: number | { reaction: number } | { pin: number } | undefined, ms: number): Promise<number> {\n const until = performance.now() + ms;\n const which = typeof edit === \"object\" ? edit : edit ? { edit } : {};\n for (;;) {\n const taken = node(ctx).groupTaken({ groupId, messageId, ...which });\n if (taken > 0) return taken;\n const group = groupIn(ctx, groupId);\n if (alone(group)) return taken;\n const out = outOf(group);\n if (out) throw new CliError(\"refused\", `${out}: no member took it, and it no longer goes`, { messageId, ...(\"edit\" in which ? { edits: which.edit } : which) });\n if (performance.now() >= until || stopped(ctx)) throw new CliError(\"timeout\", `${ended(ctx, ms)}: no member's edge took it yet (it stays in the group and goes when one opens). It ${goesOn(ctx)}`, known(ctx, { messageId, ...(\"edit\" in which ? { edits: which.edit } : which) }));\n await new Promise((resolve) => setTimeout(resolve, 250));\n }\n}\n\n/**\n * A one-shot whose text went over the live link waits this long for its receipt before it leaves (`waitForMessage`).\n * Left at `sent`, the engine stopping took the text for unconfirmed, the next start sent it again on the DHT, and that\n * copy took the chat's one DHT text awaiting a receipt: a script's next one-shot send waited 30 s behind it, every 5-8\n * messages, and the last text showed \"Connection closed before receipt\" though the contact had it (agents#1640).\n */\nexport const ONE_SHOT_RECEIPT_MS = 2_000;\n\n/**\n * Waits until the contact confirmed my reaction or pin in a 1:1 chat (WISP 401): until `pending` no longer finds it in\n * what the contact has not confirmed (`chatUnconfirmed`). It goes on the live session, a reaction also on the DHT\n * envelopes; one not confirmed in time is kept and said again.\n */\nexport async function waitForConfirmed(ctx: ApiContext, chat: string, what: \"reaction\" | \"pin\", pending: (left: { reactions: number[]; pin: number | null }) => boolean, ms: number): Promise<void> {\n const until = performance.now() + ms;\n while (pending(node(ctx).chatUnconfirmed({ linkId: chat }))) {\n if (performance.now() >= until || stopped(ctx)) throw new CliError(\"timeout\", `${ended(ctx, ms)}: the contact has not confirmed the ${what} yet. It is kept here and ${goesOn(ctx, chat)}`, known(ctx, { chat }));\n await new Promise((resolve) => setTimeout(resolve, 250));\n }\n}\n\n/**\n * Waits until a message of mine reached `target` (`sent`: on its way to the contact; `delivered`: acknowledged). A\n * one-shot's text sent over the live link waits a moment more for its receipt (`ONE_SHOT_RECEIPT_MS`).\n */\nexport async function waitForMessage(ctx: ApiContext, chat: string, messageId: string, target: \"sent\" | \"delivered\", ms: number): Promise<StoredMessage> {\n const reached = await waitForDelivery(ctx, chat, messageId, target, ms);\n if (ctx.mode !== \"one-shot\" || target !== \"sent\" || reached.delivery !== \"sent\" || reached.via !== \"datalink\") return reached;\n return waitForDelivery(ctx, chat, messageId, \"delivered\", ONE_SHOT_RECEIPT_MS).catch(async () => (await node(ctx).getMessage(chat, messageId)) ?? reached);\n}\n\nasync function waitForDelivery(ctx: ApiContext, chat: string, messageId: string, target: \"sent\" | \"delivered\", ms: number): Promise<StoredMessage> {\n const want = DELIVERY_RANK[target];\n const look = (message: StoredMessage | undefined) => {\n if (!message) return undefined;\n const delivery = message.delivery ?? \"sent\";\n if (delivery === \"failed\") throw new CliError(\"engine\", message.deliveryError ?? \"The message could not be sent\", { messageId, delivery });\n return (DELIVERY_RANK[delivery] ?? 0) >= want ? message : undefined;\n };\n return new Promise<StoredMessage>((resolve, reject) => {\n let settled = false;\n const finish = (error: unknown, message?: StoredMessage) => {\n if (settled) return;\n settled = true; clearTimeout(timer); off(); ctx.stopping?.removeEventListener(\"abort\", giveUp);\n if (error) reject(error); else resolve(message!);\n };\n const check = (last = false) => void node(ctx).getMessage(chat, messageId).then((message) => {\n try {\n const done = look(message);\n if (done) finish(null, done);\n else if (last) finish(new CliError(\"timeout\", `${ended(ctx, ms)}: the message is ${message?.delivery ?? \"not sent yet\"} and ${goesOn(ctx, chat)}`, known(ctx, { messageId, delivery: message?.delivery ?? null })));\n } catch (error) { finish(error); }\n }, finish);\n const giveUp = () => check(true);\n const timer = setTimeout(giveUp, ms);\n // Any event naming the message: a message first seen already delivered comes as `message.sent`, never as\n // `message.delivery`. Listening before the first read leaves no gap for a change to slip through.\n const off = ctx.hub.onEvent((event: GhostlyEvent) => {\n if (event.chat === chat && (event.messageId === messageId || (event.message as { id?: string } | undefined)?.id === messageId)) check();\n });\n if (stopped(ctx)) giveUp();\n else { ctx.stopping?.addEventListener(\"abort\", giveUp, { once: true }); check(); }\n });\n}\n","import { LIMITS } from \"@ghostly/core\";\nimport { CliError } from \"./errors\";\n\n/**\n * A text past what a chat or a group carries (16 KiB of UTF-8, as the engine counts it: trimmed) is refused before the\n * secret guard reads it and before the engine is asked, with its size and the bound, as `send` and `edit` refuse it.\n */\nexport function checkTextSize(text: string): void {\n const bytes = new TextEncoder().encode(text.trim()).length;\n if (bytes > LIMITS.maxChatMessageBytes) throw new CliError(\"bad_request\", `Message exceeds ${LIMITS.maxChatMessageBytes} UTF-8 bytes (${bytes}): shorten it, or send it as a file`, { bytes, max: LIMITS.maxChatMessageBytes });\n}\n","import { BUTTONS_CAPABILITY, BUTTON_STYLES, STATUS_CARD_LIMITS, buttonLabelClash, checkStatusCard, randomBytes, toBase64Url, type ButtonsCard } from \"@ghostly/core\";\nimport type { LinkView, StoredMessage } from \"@ghostly/browser/shared/types\";\nimport type { Parsed } from \"./args\";\nimport { bool, chatOrGroup, messageOf, noMessage, node, num, oneOf, oneShotWaits, str, type Method, type Params, type RefPlace } from \"./apiKit\";\nimport { CliError } from \"./errors\";\nimport { findSecret, secretWords } from \"./secretGuard\";\nimport { checkTextSize } from \"./textSize\";\nimport { waitForEdit, waitForGroupFrame, waitForMessage } from \"./waits\";\n\n/*\n * Message buttons (WISP 406 · Message Buttons), the bot's side: a message whose text is the question, with up to six\n * buttons under it (`send --button yes:Yes`). A press comes back as a reply whose text is the button's label; the\n * engine marks it (`press`) and `listen` says `button.pressed`. `button update` then shows the answer (`chosen`) and\n * closes the buttons, by editing the message with the same buttons.\n */\n\n/**\n * `--button id:Label` (again for each, 1 to 6), `--style id=primary|neutral|danger`, `--once` and `--id`, as the\n * method's parameters: `buttons` and `buttonsId`. Nothing when no `--button` is given. The label may hold colons: the\n * id ends at the first one. An id given twice, two labels that read the same (ignoring case and spaces at the ends), a\n * label that is another button's id, or a style not listed are a usage error here, before the profile opens; other\n * bounds (ids, labels, how many) are the card's, checked when it is sent.\n */\nexport function buttonsOf(options: Parsed[\"options\"]): { buttons: Record<string, unknown>[]; buttonsId?: string } | undefined {\n const given = Array.isArray(options.button) ? options.button as string[] : [];\n if (!given.length) {\n for (const flag of [\"style\", \"once\", \"id\"] as const)\n if (options[flag] !== undefined) throw new CliError(\"usage\", `--${flag} goes with --button id:Label`);\n return undefined;\n }\n const buttons: Record<string, unknown>[] = given.map((value) => {\n const colon = value.indexOf(\":\");\n if (colon < 1 || colon === value.length - 1) throw new CliError(\"usage\", `--button takes id:Label, like yes:Yes, not ${JSON.stringify(value)}`);\n return { id: value.slice(0, colon), label: value.slice(colon + 1).trim() };\n });\n const twice = buttons.findIndex((button, at) => buttons.findIndex((other) => other.id === button.id) !== at);\n if (twice !== -1) throw new CliError(\"usage\", `--button ${JSON.stringify(given[twice])} repeats the id ${JSON.stringify(buttons[twice].id)}: each button takes its own`);\n // Two buttons a typed answer could not tell apart: the same label, or a label that is another's id (ignoring case).\n const clash = buttonLabelClash(buttons);\n if (clash) {\n const [at, other] = [JSON.stringify(given[clash.at]), JSON.stringify(given[clash.with])];\n throw new CliError(\"usage\", clash.kind === \"label\"\n ? `--button ${at} repeats the label of --button ${other} (ignoring case and spaces): a typed answer could not tell them apart`\n : `--button ${at} has a label that is the id of --button ${other}: a typed answer could not tell them apart`);\n }\n for (const value of Array.isArray(options.style) ? options.style as string[] : []) {\n const eq = value.indexOf(\"=\");\n const button = eq > 0 ? buttons.find((b) => b.id === value.slice(0, eq)) : undefined;\n if (!button) throw new CliError(\"usage\", `--style takes id=primary|neutral|danger for one of the buttons, not ${JSON.stringify(value)}`);\n const style = value.slice(eq + 1);\n if (!(BUTTON_STYLES as readonly string[]).includes(style)) throw new CliError(\"usage\", `--style ${JSON.stringify(value)}: a button's style is ${BUTTON_STYLES.join(\", \")}`);\n button.style = style;\n }\n if (options.once === true) for (const button of buttons) button.once = true;\n return { buttons, ...(options.id !== undefined && { buttonsId: String(options.id) }) };\n}\n\n/** A buttons card checked by the sender's rule, or a `bad_request` that says what is wrong. */\nfunction checked(card: Record<string, unknown>): ButtonsCard {\n const result = checkStatusCard(card);\n if (\"error\" in result) throw new CliError(\"bad_request\", `Buttons: ${result.error}`, { card });\n return result.card as ButtonsCard;\n}\n\n/**\n * The card a send's `buttons` (and `buttonsId`) make, or undefined when it names none. `buttons` is a list of\n * `{id, label, style?, once?}`; the id of the question is made up (`ask-…`) unless given.\n */\nexport function buttonsCard(params: Params): ButtonsCard | undefined {\n const buttons = params.buttons;\n if (buttons === undefined || buttons === null) {\n if (params.buttonsId !== undefined) throw new CliError(\"bad_request\", \"buttonsId goes with buttons\");\n return undefined;\n }\n if (!Array.isArray(buttons)) throw new CliError(\"bad_request\", \"buttons must be a list of {id, label, style?, once?}\");\n const id = str(params, \"buttonsId\") ?? `ask-${toBase64Url(randomBytes(6))}`;\n return checked({ kind: \"buttons\", id, buttons });\n}\n\n/** Whether a 1:1 contact's app shows and presses buttons: null until its app said what it offers. */\nexport function pressable(link: LinkView): boolean | null {\n const peer = link.sessionOffers?.peer;\n return peer ? peer.includes(BUTTONS_CAPABILITY) : null;\n}\n\n/** The message of mine with buttons that `button update` names, by its id here (or the id both sides know). */\nfunction buttonsMessage(message: StoredMessage | undefined, ref: string, place: RefPlace): StoredMessage & { card: ButtonsCard } {\n if (!message) throw noMessage(ref, place, { whose: \"of yours\" });\n if (message.card?.kind !== \"buttons\") throw new CliError(\"bad_request\", \"That message has no buttons: send one with send --button id:Label\");\n return message as StoredMessage & { card: ButtonsCard };\n}\n\n/**\n * `button update`: the answer shown on a question's buttons (`chosen`), the buttons closed (`close`), or a new text\n * (`text`), by editing the message with the same buttons. What is not given stays as it was.\n */\nasync function updateButtons(ctx: Parameters<Method>[0], params: Params): Promise<Record<string, unknown>> {\n const target = chatOrGroup(ctx, str(params, \"chat\", true));\n const ref = str(params, \"message\", true);\n const chosen = str(params, \"chosen\");\n const close = bool(params, \"close\");\n const newText = str(params, \"text\");\n if (chosen === undefined && !close && newText === undefined) throw new CliError(\"bad_request\", \"Nothing to update: give chosen, close or text\");\n // The engine fills a card's blank text with its fallback line (\"Reply: Yes / No\"): the question's words were lost.\n if (newText !== undefined && !newText.trim()) throw new CliError(\"bad_request\", \"The new text is blank: give the question's new words, or leave text out to keep them\");\n // A new text is a message like any other: the same size check and guard as `send` and `edit`.\n if (newText !== undefined) checkTextSize(newText);\n if (newText !== undefined && !bool(params, \"force\")) {\n const secret = findSecret(newText);\n if (secret) throw new CliError(\"confirm\", `The text looks like ${secretWords(secret)}; update with --force if you mean to`, { kind: secret.kind });\n }\n const message = buttonsMessage(await messageOf(ctx, target.linkId, ref, (m) => m.sender === \"me\"), ref, { group: target.group, ref: str(params, \"chat\", true) });\n if ((message.edit?.seq ?? 0) >= STATUS_CARD_LIMITS.edits)\n throw new CliError(\"refused\", `This message took ${STATUS_CARD_LIMITS.edits} updates, the most one takes: ask again with a new send`, { messageId: message.id, edits: message.edit!.seq });\n const before = message.card;\n // Said here, with the buttons it has, as a press says it (not_found, exit 3): the card's own check names only the field.\n if (chosen !== undefined && !before.buttons.some((b) => b.id === chosen))\n throw new CliError(\"not_found\", `That message has no button ${JSON.stringify(chosen)}; its buttons: ${before.buttons.map((b) => b.id).join(\", \")}`, { card: before });\n const card = checked({ ...before, ...(chosen !== undefined && { chosen }), ...((close || before.closed) && { closed: true }) });\n const text = newText ?? message.text;\n const wait = oneOf(params, \"wait\", target.group ? [\"none\", \"sent\"] as const : [\"none\", \"confirmed\"] as const, \"none\");\n const ms = num(params, \"timeout\", 30, { min: 1, max: 3600 }) * 1000;\n const result = await node(ctx).editMessage({ linkId: target.linkId, messageId: message.id, text, card });\n if (result.error) throw new CliError(result.refused ? \"refused\" : \"unavailable\", result.error);\n let edited = await node(ctx).getMessage(target.linkId, message.id);\n if (wait === \"confirmed\" && edited?.edit?.pending) edited = await waitForEdit(ctx, target.linkId, message.id, ms);\n const edges = wait === \"sent\" && edited?.edit ? await waitForGroupFrame(ctx, target.id, message.id, edited.edit.seq, ms) : undefined;\n return {\n [target.group ? \"group\" : \"chat\"]: target.id, buttons: card.id, messageId: message.id, card, edits: edited?.edit?.seq ?? 0,\n ...(target.group ? { ...(edges !== undefined && { edges }) } : { confirmed: !!edited && !edited.edit?.pending }),\n };\n}\n\n/**\n * `button press`: the other side of a question, as the app's tap: a press on a button of someone else's message, by\n * its id here (or the id both sides know). The engine sends a reply whose text is the button's label, and refuses what\n * an app would: a button the message does not have, closed buttons, a second answer past `once`, a second press\n * within a second. A one-shot in a chat waits until the press went out, as `send` does.\n */\nasync function pressButton(ctx: Parameters<Method>[0], params: Params): Promise<Record<string, unknown>> {\n const target = chatOrGroup(ctx, str(params, \"chat\", true));\n const ref = str(params, \"message\", true);\n const buttonId = str(params, \"button\", true);\n const where = target.group ? \"group\" : \"chat\";\n const message = await messageOf(ctx, target.linkId, ref, (m) => m.sender !== \"me\");\n if (!message) throw noMessage(ref, { group: target.group, ref: str(params, \"chat\", true) }, { whose: \"from someone else\" });\n if (message.card?.kind !== \"buttons\") throw new CliError(\"bad_request\", \"That message has no buttons\");\n const button = message.card.buttons.find((b) => b.id === buttonId);\n if (!button) throw new CliError(\"not_found\", `That message has no button ${JSON.stringify(buttonId)}; its buttons: ${message.card.buttons.map((b) => b.id).join(\", \")}`);\n const wait = target.group\n ? oneOf(params, \"wait\", [\"none\", \"sent\"] as const, \"none\")\n : oneOf(params, \"wait\", [\"none\", \"sent\", \"delivered\"] as const, oneShotWaits(ctx, target.linkId) ? \"sent\" : \"none\");\n const ms = num(params, \"timeout\", 30, { min: 1, max: 3600 }) * 1000;\n const result = await node(ctx).pressButton({ linkId: target.linkId, messageId: message.id, buttonId });\n if (result.error) throw new CliError(result.refused ? \"refused\" : \"unavailable\", result.error, result.paced ? { paced: true } : undefined);\n const replyId = result.messageId ?? null;\n const answer = { [where]: target.id, messageId: message.id, button: button.id, label: button.label, replyId };\n if (!replyId) return answer;\n if (target.group) {\n const edges = wait === \"sent\" ? await waitForGroupFrame(ctx, target.id, replyId, undefined, ms) : node(ctx).groupTaken({ groupId: target.id, messageId: replyId });\n return { ...answer, edges };\n }\n const reply = wait === \"none\" ? await node(ctx).getMessage(target.linkId, replyId) : await waitForMessage(ctx, target.linkId, replyId, wait, ms);\n return { ...answer, delivery: reply?.delivery ?? null };\n}\n\nexport const BUTTON_METHODS: Record<string, Method> = {\n /** WISP 406 · Message Buttons: a press on a button of someone else's message, as the app's tap. */\n \"button.press\": pressButton,\n /** WISP 406 · Message Buttons: the answer chosen on a question of mine, its buttons closed, or its text changed. */\n \"button.update\": updateButtons,\n};\n"],"mappings":";;;;;;;AAaA,IAAM,gBAAwC;CAAE,SAAS;CAAG,SAAS;CAAG,QAAQ;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AAC;CACrG,IAAI,OAAO,OAAO,MAAM,IAAI,SAAS,OAAO,UAAU,YAAY,eAAe,OAAO,OAAO,OAAO,QAAQ,EAAE,OAAO,KAAK,IAAI,KAAA,CAAS;CACzI,MAAM,UAAU,OAAO,aAAa;CACpC,MAAM,SAAS;GAAG,QAAQ,OAAO;EAAI,WAAW,QAAQ;EAAI,QAAQ,OAAO;EAAI,OAAO,OAAO;EAAO;CAAQ;CAC5G,IAAI,CAAC,SAAS,OAAO;CACrB,IAAI,OAAO,OAAO;EAChB,MAAM,QAAQ,SAAS,SAAS,MAAM,kBAAkB,KAAK,OAAO,IAAI,SAAS,KAAA,GAAW,EAAE,IAAI,KAAK,GAAG,CAAC,CAAC,WAAW;GAAE,SAAS,OAAO;GAAI,WAAW;EAAQ,CAAC;EACjK,OAAO;GAAE,GAAG;GAAQ;EAAM;CAC5B;CACA,MAAM,QAAQ,SAAS,SAAS,MAAM,KAAK,GAAG,CAAC,CAAC,WAAW,OAAO,QAAQ,OAAO,IAAI,MAAM,eAAe,KAAK,OAAO,QAAQ,SAAS,MAAM,EAAE;CAC/I,OAAO;EAAE,GAAG;EAAQ,UAAU,OAAO,YAAY;CAAK;AACxD;AAEA,IAAa,iBAAyC;;CAEpD,gBAAgB;;CAEhB,iBAAiB;AACnB"}
@@ -1 +0,0 @@
1
- export { r as buttonsOf } from "./buttons-BGxzOtrq.js";
@@ -1 +0,0 @@
1
- {"version":3,"file":"errors-DDLFO4Gf.js","names":[],"sources":["../../src/errors.ts"],"sourcesContent":["/**\n * Errors that reach a bot: a stable `code` to branch on, a message for people, and the exit status the CLI\n * leaves with (WISP 1100 § Exit codes). The daemon sends `{code, message}` over the socket; the CLI prints\n * `{\"error\": {code, message}}` on stdout and exits with `exit`.\n */\nexport type ErrorCode =\n | \"bad_request\" | \"usage\" | \"not_found\" | \"refused\" | \"unavailable\" | \"confirm\" | \"timeout\"\n | \"engine\" | \"busy\" | \"internal\" | \"interrupted\";\n\n/** `interrupted`: Ctrl-C (SIGINT) ended the command, 128 + 2 as a shell says of a command its signal ended. */\nexport const EXIT: Record<ErrorCode, number> = {\n engine: 1, refused: 1, unavailable: 1, bad_request: 1, busy: 1, internal: 1,\n usage: 2, not_found: 3, timeout: 4, confirm: 5, interrupted: 130,\n};\n\nexport class CliError extends Error {\n constructor(readonly code: ErrorCode, message: string, readonly details?: Record<string, unknown>) {\n super(message);\n this.name = \"CliError\";\n }\n toJSON(): { code: ErrorCode; message: string; details?: Record<string, unknown> } {\n return { code: this.code, message: this.message, ...(this.details ? { details: this.details } : {}) };\n }\n}\n\n/** Anything thrown, as the error a bot sees: the engine's own refusals keep their words. */\nexport function asCliError(error: unknown): CliError {\n if (error instanceof CliError) return error;\n if (error && typeof error === \"object\" && \"code\" in error && \"message\" in error && typeof (error as { code: unknown }).code === \"string\"\n && Object.hasOwn(EXIT, (error as { code: string }).code)) return new CliError((error as { code: ErrorCode }).code, String((error as { message: unknown }).message));\n // A contact the chat's link could not reach (its `GhostlyHttpError` \"unreachable\"): not there now, not the engine failing.\n if (error instanceof Error && (error as { code?: unknown }).code === \"unreachable\") return new CliError(\"unavailable\", error.message);\n const known = engineKnown(error) ?? contactNoRail(error);\n if (known) return known;\n const full = noRoomError(error);\n if (full) return full;\n const local = localFileError(error);\n if (local) return local;\n const unopened = profileOpenError(error);\n if (unopened) return unopened;\n const message = error instanceof Error ? error.message : String(error);\n if (/real money|confirmedReal|Mainnet/i.test(message) && /confirm/i.test(message)) return new CliError(\"confirm\", message);\n if (/other network|cross-network|network does not match/i.test(message)) return new CliError(\"refused\", message);\n // A member asking for a group's admin-only change, one removed from the group (or gone) asking for any, an invitation\n // already answered: not allowed, not the engine failing.\n if (/^Only the admin |^You are no longer in this group$|^No invitation to (accept|decline)$/.test(message)) return new CliError(\"refused\", message);\n // `group invite` to a contact whose app is closed: try again once they are online.\n if (message === \"This contact is not connected right now. Invite them when they are online.\") return new CliError(\"unavailable\", message);\n // `group invite` the group or the contact's app cannot take: one already in, a full group, an app too old for it.\n if (/^This contact is already a member$|^A group holds \\d+ members at most$|^A group grows past \\d+ only when |^Their app (does not take part in groups|takes groups of \\d+ at most)|^This group runs through hubs, which their app /.test(message)) return new CliError(\"refused\", message);\n // `group invite` into a community: it has no invitations, its link is how people join.\n if (message === \"Share the group's link with them: anyone who opens it joins\") return new CliError(\"bad_request\", message);\n return new CliError(\"engine\", message);\n}\n\n/**\n * The engine's known errors (`EngineError`, packages/core engineErrors.ts) a bot branches on, by their `engineCode`: a\n * host or the network not answering is `unavailable` (try again later), one too slow `timeout`, a value the person gave\n * `bad_request`, money that is not there `refused`, a contact that offers no way of paying `refused` with its reason in\n * `details.reason`. Any other keeps `engine`. Read by its shape, as `profileOpenError`.\n */\nconst ENGINE_CODES: Record<string, ErrorCode> = {\n mintUnreachable: \"unavailable\", lnurlUnreachable: \"unavailable\", hostUnreachable: \"unavailable\", networkUnreachable: \"unavailable\", usdtRpcUnavailable: \"unavailable\", mintFailedInvoice: \"unavailable\",\n hostTimedOut: \"timeout\", networkTimedOut: \"timeout\",\n invalidMintUrl: \"bad_request\", mintNotHttps: \"bad_request\", invalidMaxFee: \"bad_request\",\n notEnoughSats: \"refused\", notEnoughForFee: \"refused\", mintsNoAnyAmount: \"refused\", ecashAlreadySpent: \"refused\", ecashFeeTakesAll: \"refused\", lightningRefused: \"refused\", contactNoWallet: \"refused\", contactNoPayments: \"refused\",\n serviceShareFull: \"refused\",\n};\n/** `details.reason` of an engine error a bot tells apart from others of its code. */\nconst ENGINE_REASONS: Record<string, string> = { contactNoWallet: \"contact_no_wallet\", contactNoPayments: \"contact_payments_off\" };\n\nfunction engineKnown(error: unknown): CliError | undefined {\n if (!(error instanceof Error)) return undefined;\n const { engineCode, values } = error as { engineCode?: unknown; values?: { host?: unknown } };\n if (typeof engineCode !== \"string\" || !Object.hasOwn(ENGINE_CODES, engineCode)) return undefined;\n // The app's reason for a Lightning address it could not read (a browser's CORS) is no reason in a terminal.\n if (engineCode === \"lnurlUnreachable\" && typeof values?.host === \"string\") return new CliError(\"unavailable\", `Could not reach ${values.host}`);\n const details = Object.hasOwn(ENGINE_REASONS, engineCode) ? { reason: ENGINE_REASONS[engineCode] } : undefined;\n // The contact's next step, for a contact that is a bot too.\n if (engineCode === \"contactNoWallet\") return new CliError(\"refused\", `${error.message} (on a CLI: ghostly wallet create cashu)`, details);\n return new CliError(ENGINE_CODES[engineCode], error.message, details);\n}\n\n/** The engine's names of the ways of paying (payments.ts `METHOD_NAME`), as `wallet create` takes them; Bark is the app's only. */\nconst RAILS: Record<string, string | null> = { Cashu: \"cashu\", Lightning: \"lightning\", Ark: \"arkade\", USDT: \"usdt\", Bark: null, \"on-chain Bitcoin\": \"bitcoin\", Fedimint: \"fedimint\", Spark: \"spark\" };\n\n/**\n * A contact with no wallet of the way of paying or the network asked (`chat request --method arkade`, a Mainnet `chat\n * pay` to a contact with Testnet Cashu only): the engine says it in words alone. `refused` with `contact_no_wallet` and\n * the contact's next step, as a contact with no wallet at all is said. Before, `engine`, which a bot may retry.\n */\nfunction contactNoRail(error: unknown): CliError | undefined {\n const said = error instanceof Error ? /^Your contact has no (Mainnet|Testnet) (.+) wallet$/.exec(error.message) : null;\n if (!said || !Object.hasOwn(RAILS, said[2])) return undefined;\n const type = RAILS[said[2]];\n const step = type ? ` (on a CLI: ghostly wallet create ${type}${said[1] === \"Mainnet\" ? \" --network mainnet\" : \"\"})` : \"\";\n return new CliError(\"refused\", `${said[0]}${step}`, { reason: \"contact_no_wallet\" });\n}\n\n/**\n * A change the profile's store could not put on disk (`storage.ts` refuses its transaction with a QuotaExceededError;\n * the engine's `committed` wraps it in its own words, the store's as the cause): `unavailable`, try again once there is\n * room, in the store's words, which name the profile's folder. Before, a daemon on a full disk answered done.\n */\nfunction noRoomError(error: unknown): CliError | undefined {\n let said: string | undefined, found = false;\n for (let at = error, depth = 0; at && typeof at === \"object\" && depth < 4; at = (at as { cause?: unknown }).cause, depth++) {\n if ((at as { name?: unknown }).name !== \"QuotaExceededError\") continue;\n found = true;\n const message = (at as { message?: unknown }).message;\n if (typeof message === \"string\" && message.startsWith(\"No room left\")) said = message;\n }\n return found ? new CliError(\"unavailable\", said ?? \"No room left on the disk: free some space, then try again\") : undefined;\n}\n\n/**\n * The profile's database did not open (the engine's `ProfileOpenError`, packages/browser/src/shared/idb.ts): `engine`\n * (exit 1) with the engine's own words, which name the versions when a newer ghostly stored it, and the reason and\n * the versions in `details` for a bot. Read by its shape: this module is also the thin client's, which loads no engine.\n */\nfunction profileOpenError(error: unknown): CliError | undefined {\n if (!(error instanceof Error) || error.name !== \"ProfileOpenError\") return undefined;\n const failure = (error as { failure?: { reason?: unknown; storedVersion?: unknown; supportedVersion?: unknown } }).failure;\n if (!failure || typeof failure.reason !== \"string\") return undefined;\n return new CliError(\"engine\", error.message, {\n reason: failure.reason === \"newer\" ? \"newer_profile\" : `profile_${failure.reason}`,\n ...(typeof failure.storedVersion === \"number\" ? { storedVersion: failure.storedVersion } : {}),\n ...(typeof failure.supportedVersion === \"number\" ? { supportedVersion: failure.supportedVersion } : {}),\n });\n}\n\n/**\n * A file or folder on this machine the command could not open (`file save --dir`, `profile backup --out`): the\n * person's path, not the engine refusing, so it says so with the code a bot branches on. Before, a folder that did\n * not exist was `engine` (exit 1) with Node's `ENOENT: no such file or directory, open '…'`. `file`: the path read, for\n * an error that names none (a folder read as a file).\n */\nexport function localFileError(error: unknown, file?: string): CliError | undefined {\n if (!error || typeof error !== \"object\" || typeof (error as { syscall?: unknown }).syscall !== \"string\") return undefined;\n const { code, path } = error as { code?: unknown; path?: unknown };\n const where = typeof path === \"string\" ? path : file ?? \"the path\";\n if (code === \"ENOENT\" || code === \"ENOTDIR\") return new CliError(\"not_found\", `No such file or folder: ${where}`);\n // A symbolic link to itself (or a ring of them) leads nowhere: before, Node's raw \"ELOOP: …, stat\" as `engine`.\n if (code === \"ELOOP\") return new CliError(\"not_found\", `No such file or folder: ${where} (its symbolic links go round in a loop)`);\n if (code === \"EACCES\" || code === \"EPERM\" || code === \"EROFS\") return new CliError(\"refused\", `Not allowed to write or read ${where}`);\n if (code === \"EISDIR\") return new CliError(\"bad_request\", `${where} is a folder: name a file`);\n // A file where a folder is to be made (`store sign --out`, `app publish --key`/`--out`): Node's \"EEXIST: file already\n // exists, mkdir '…'\" was `engine`. Named as `file save --dir` names one.\n if (code === \"EEXIST\" && (error as { syscall: string }).syscall === \"mkdir\") return new CliError(\"not_found\", `${where} is a file, not a folder`);\n if (code === \"ENAMETOOLONG\") return new CliError(\"bad_request\", `A name in ${where} is too long for this file system (at most 255 bytes)`);\n // A full disk (or a quota) answered Node's raw \"ENOSPC: no space left on device, write\" as `engine`, naming nothing\n // (agents#1710). `unavailable`: it works again once there is room, with nothing lost.\n if (code === \"ENOSPC\" || code === \"EDQUOT\") {\n const at = typeof path === \"string\" ? path : file;\n return new CliError(\"unavailable\", at ? `No room left for ${at}: free some space, then try again` : \"No room left on the disk: free some space, then try again\", { reason: \"no_space\", errno: code, ...(at && { path: at }) });\n }\n return undefined;\n}\n"],"mappings":";;AAUA,IAAa,OAAkC;CAC7C,QAAQ;CAAG,SAAS;CAAG,aAAa;CAAG,aAAa;CAAG,MAAM;CAAG,UAAU;CAC1E,OAAO;CAAG,WAAW;CAAG,SAAS;CAAG,SAAS;CAAG,aAAa;AAC/D;AAEA,IAAa,WAAb,cAA8B,MAAM;CACb;CAA2C;CAAhE,YAAY,MAA0B,SAAiB,SAA4C;EACjG,MAAM,OAAO;EADM,KAAA,OAAA;EAA2C,KAAA,UAAA;EAE9D,KAAK,OAAO;CACd;CACA,SAAkF;EAChF,OAAO;GAAE,MAAM,KAAK;GAAM,SAAS,KAAK;GAAS,GAAI,KAAK,UAAU,EAAE,SAAS,KAAK,QAAQ,IAAI,CAAC;EAAG;CACtG;AACF;;AAGA,SAAgB,WAAW,OAA0B;CACnD,IAAI,iBAAiB,UAAU,OAAO;CACtC,IAAI,SAAS,OAAO,UAAU,YAAY,UAAU,SAAS,aAAa,SAAS,OAAQ,MAA4B,S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AAS,YAAa,MAA8B,YAAY,SAAS,OAAO,IAAI,SAAS,aAAa,GAAG,MAAM,yBAAyB;CAChJ,IAAI,SAAS,gBAAgB,OAAO,IAAI,SAAS,eAAe,aAAa,MAAM,sDAAsD;CAGzI,IAAI,SAAS,YAAY,SAAS,UAAU;EAC1C,MAAM,KAAK,OAAO,SAAS,WAAW,OAAO;EAC7C,OAAO,IAAI,SAAS,eAAe,KAAK,oBAAoB,GAAG,qCAAqC,6DAA6D;GAAE,QAAQ;GAAY,OAAO;GAAM,GAAI,MAAM,EAAE,MAAM,GAAG;EAAG,CAAC;CAC/N;AAEF"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"ghostly_iroh_web-DIj5xGmR.js","names":["ret"],"sources":["../../../iroh-web/pkg/ghostly_iroh_web.js"],"sourcesContent":["let wasm;\n\nfunction addHeapObject(obj) {\n if (heap_next === heap.length) heap.push(heap.length + 1);\n const idx = heap_next;\n heap_next = heap[idx];\n\n heap[idx] = obj;\n return idx;\n}\n\nconst CLOSURE_DTORS = (typeof FinalizationRegistry === 'undefined')\n ? { register: () => {}, unregister: () => {} }\n : new FinalizationRegistry(state => state.dtor(state.a, state.b));\n\nfunction debugString(val) {\n // primitive types\n const type = typeof val;\n if (type == 'number' || type == 'boolean' || val == null) {\n return `${val}`;\n }\n if (type == 'string') {\n return `\"${val}\"`;\n }\n if (type == 'symbol') {\n const description = val.description;\n if (description == null) {\n return 'Symbol';\n } else {\n return `Symbol(${description})`;\n }\n }\n if (type == 'function') {\n const name = val.name;\n if (typeof name == 'string' && name.length > 0) {\n return `Function(${name})`;\n } else {\n return 'Function';\n }\n }\n // objects\n if (Array.isArray(val)) {\n const length = val.length;\n let debug = '[';\n if (length > 0) {\n debug += debugString(val[0]);\n }\n for(let i = 1; i < length; i++) {\n debug += ', ' + debugString(val[i]);\n }\n debug += ']';\n return debug;\n }\n // Test for built-in\n const builtInMatches = /\\[object ([^\\]]+)\\]/.exec(toString.call(val));\n let className;\n if (builtInMatches && builtInMatches.length > 1) {\n className = builtInMatches[1];\n } else {\n // Failed to match the standard '[object ClassName]'\n return toString.call(val);\n }\n if (className == 'Object') {\n // we're a user defined class or Object\n // JSON.stringify avoids problems with cycles, and is generally much\n // easier than looping through ownProperties of `val`.\n try {\n return 'Object(' + JSON.stringify(val) + ')';\n } catch (_) {\n return 'Object';\n }\n }\n // errors\n if (val instanceof Error) {\n return `${val.name}: ${val.message}\\n${val.stack}`;\n }\n // TODO we could test for more things here, like `Set`s and `Map`s.\n return className;\n}\n\nfunction dropObject(idx) {\n if (idx < 132) return;\n heap[idx] = heap_next;\n heap_next = idx;\n}\n\nfunction getArrayU8FromWasm0(ptr, len) {\n ptr = ptr >>> 0;\n return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);\n}\n\nlet cachedDataViewMemory0 = null;\nfunction getDataViewMemory0() {\n if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {\n cachedDataViewMemory0 = new DataView(wasm.memory.buffer);\n }\n return cachedDataViewMemory0;\n}\n\nfunction getStringFromWasm0(ptr, len) {\n ptr = ptr >>> 0;\n return decodeText(ptr, len);\n}\n\nlet cachedUint8ArrayMemory0 = null;\nfunction getUint8ArrayMemory0() {\n if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {\n cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);\n }\n return cachedUint8ArrayMemory0;\n}\n\nfunction getObject(idx) { return heap[idx]; }\n\nfunction handleError(f, args) {\n try {\n return f.apply(this, args);\n } catch (e) {\n wasm.__wbindgen_export3(addHeapObject(e));\n }\n}\n\nlet heap = new Array(128).fill(undefined);\nheap.push(undefined, null, true, false);\n\nlet heap_next = heap.length;\n\nfunction isLikeNone(x) {\n return x === undefined || x === null;\n}\n\nfunction makeClosure(arg0, arg1, dtor, f) {\n const state = { a: arg0, b: arg1, cnt: 1, dtor };\n const real = (...args) => {\n\n // First up with a closure we increment the internal reference\n // count. This ensures that the Rust closure environment won't\n // be deallocated while we're invoking it.\n state.cnt++;\n try {\n return f(state.a, state.b, ...args);\n } finally {\n real._wbg_cb_unref();\n }\n };\n real._wbg_cb_unref = () => {\n if (--state.cnt === 0) {\n state.dtor(state.a, state.b);\n state.a = 0;\n CLOSURE_DTORS.unregister(state);\n }\n };\n CLOSURE_DTORS.register(real, state, state);\n return real;\n}\n\nfunction makeMutClosure(arg0, arg1, dtor, f) {\n const state = { a: arg0, b: arg1, cnt: 1, dtor };\n const real = (...args) => {\n\n // First up with a closure we increment the internal reference\n // count. This ensures that the Rust closure environment won't\n // be deallocated while we're invoking it.\n state.cnt++;\n const a = state.a;\n state.a = 0;\n try {\n return f(a, state.b, ...args);\n } finally {\n state.a = a;\n real._wbg_cb_unref();\n }\n };\n real._wbg_cb_unref = () => {\n if (--state.cnt === 0) {\n state.dtor(state.a, state.b);\n state.a = 0;\n CLOSURE_DTORS.unregister(state);\n }\n };\n CLOSURE_DTORS.register(real, state, state);\n return real;\n}\n\nfunction passArray8ToWasm0(arg, malloc) {\n const ptr = malloc(arg.length * 1, 1) >>> 0;\n getUint8ArrayMemory0().set(arg, ptr / 1);\n WASM_VECTOR_LEN = arg.length;\n return ptr;\n}\n\nfunction passArrayJsValueToWasm0(array, malloc) {\n const ptr = malloc(array.length * 4, 4) >>> 0;\n const mem = getDataViewMemory0();\n for (let i = 0; i < array.length; i++) {\n mem.setUint32(ptr + 4 * i, addHeapObject(array[i]), true);\n }\n WASM_VECTOR_LEN = array.length;\n return ptr;\n}\n\nfunction passStringToWasm0(arg, malloc, realloc) {\n if (realloc === undefined) {\n const buf = cachedTextEncoder.encode(arg);\n const ptr = malloc(buf.length, 1) >>> 0;\n getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);\n WASM_VECTOR_LEN = buf.length;\n return ptr;\n }\n\n let len = arg.length;\n let ptr = malloc(len, 1) >>> 0;\n\n const mem = getUint8ArrayMemory0();\n\n let offset = 0;\n\n for (; offset < len; offset++) {\n const code = arg.charCodeAt(offset);\n if (code > 0x7F) break;\n mem[ptr + offset] = code;\n }\n if (offset !== len) {\n if (offset !== 0) {\n arg = arg.slice(offset);\n }\n ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;\n const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);\n const ret = cachedTextEncoder.encodeInto(arg, view);\n\n offset += ret.written;\n ptr = realloc(ptr, len, offset, 1) >>> 0;\n }\n\n WASM_VECTOR_LEN = offset;\n return ptr;\n}\n\nfunction takeObject(idx) {\n const ret = getObject(idx);\n dropObject(idx);\n return ret;\n}\n\nlet cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });\ncachedTextDecoder.decode();\nconst MAX_SAFARI_DECODE_BYTES = 2146435072;\nlet numBytesDecoded = 0;\nfunction decodeText(ptr, len) {\n numBytesDecoded += len;\n if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {\n cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });\n cachedTextDecoder.decode();\n numBytesDecoded = len;\n }\n return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));\n}\n\nconst cachedTextEncoder = new TextEncoder();\n\nif (!('encodeInto' in cachedTextEncoder)) {\n cachedTextEncoder.encodeInto = function (arg, view) {\n const buf = cachedTextEncoder.encode(arg);\n view.set(buf);\n return {\n read: arg.length,\n written: buf.length\n };\n }\n}\n\nlet WASM_VECTOR_LEN = 0;\n\nfunction __wasm_bindgen_func_elem_3598(arg0, arg1) {\n wasm.__wasm_bindgen_func_elem_3598(arg0, arg1);\n}\n\nfunction __wasm_bindgen_func_elem_1646(arg0, arg1, arg2) {\n wasm.__wasm_bindgen_func_elem_1646(arg0, arg1, addHeapObject(arg2));\n}\n\nfunction __wasm_bindgen_func_elem_3637(arg0, arg1) {\n wasm.__wasm_bindgen_func_elem_3637(arg0, arg1);\n}\n\nfunction __wasm_bindgen_func_elem_4186(arg0, arg1, arg2) {\n wasm.__wasm_bindgen_func_elem_4186(arg0, arg1, addHeapObject(arg2));\n}\n\nfunction __wasm_bindgen_func_elem_8961(arg0, arg1, arg2) {\n wasm.__wasm_bindgen_func_elem_8961(arg0, arg1, addHeapObject(arg2));\n}\n\nfunction __wasm_bindgen_func_elem_8907(arg0, arg1) {\n wasm.__wasm_bindgen_func_elem_8907(arg0, arg1);\n}\n\nfunction __wasm_bindgen_func_elem_3298(arg0, arg1) {\n wasm.__wasm_bindgen_func_elem_3298(arg0, arg1);\n}\n\nfunction __wasm_bindgen_func_elem_9044(arg0, arg1, arg2, arg3) {\n wasm.__wasm_bindgen_func_elem_9044(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));\n}\n\nconst __wbindgen_enum_BinaryType = [\"blob\", \"arraybuffer\"];\n\nconst __wbindgen_enum_ReadableStreamType = [\"bytes\"];\n\nconst __wbindgen_enum_RequestCache = [\"default\", \"no-store\", \"reload\", \"no-cache\", \"force-cache\", \"only-if-cached\"];\n\nconst __wbindgen_enum_RequestCredentials = [\"omit\", \"same-origin\", \"include\"];\n\nconst __wbindgen_enum_RequestMode = [\"same-origin\", \"no-cors\", \"cors\", \"navigate\"];\n\nconst IntoUnderlyingByteSourceFinalization = (typeof FinalizationRegistry === 'undefined')\n ? { register: () => {}, unregister: () => {} }\n : new FinalizationRegistry(ptr => wasm.__wbg_intounderlyingbytesource_free(ptr >>> 0, 1));\n\nconst IntoUnderlyingSinkFinalization = (typeof FinalizationRegistry === 'undefined')\n ? { register: () => {}, unregister: () => {} }\n : new FinalizationRegistry(ptr => wasm.__wbg_intounderlyingsink_free(ptr >>> 0, 1));\n\nconst IntoUnderlyingSourceFinalization = (typeof FinalizationRegistry === 'undefined')\n ? { register: () => {}, unregister: () => {} }\n : new FinalizationRegistry(ptr => wasm.__wbg_intounderlyingsource_free(ptr >>> 0, 1));\n\nconst IrohConnFinalization = (typeof FinalizationRegistry === 'undefined')\n ? { register: () => {}, unregister: () => {} }\n : new FinalizationRegistry(ptr => wasm.__wbg_irohconn_free(ptr >>> 0, 1));\n\nconst IrohNodeFinalization = (typeof FinalizationRegistry === 'undefined')\n ? { register: () => {}, unregister: () => {} }\n : new FinalizationRegistry(ptr => wasm.__wbg_irohnode_free(ptr >>> 0, 1));\n\nexport class IntoUnderlyingByteSource {\n __destroy_into_raw() {\n const ptr = this.__wbg_ptr;\n this.__wbg_ptr = 0;\n IntoUnderlyingByteSourceFinalization.unregister(this);\n return ptr;\n }\n free() {\n const ptr = this.__destroy_into_raw();\n wasm.__wbg_intounderlyingbytesource_free(ptr, 0);\n }\n /**\n * @returns {number}\n */\n get autoAllocateChunkSize() {\n const ret = wasm.intounderlyingbytesource_autoAllocateChunkSize(this.__wbg_ptr);\n return ret >>> 0;\n }\n /**\n * @param {ReadableByteStreamController} controller\n * @returns {Promise<any>}\n */\n pull(controller) {\n const ret = wasm.intounderlyingbytesource_pull(this.__wbg_ptr, addHeapObject(controller));\n return takeObject(ret);\n }\n /**\n * @param {ReadableByteStreamController} controller\n */\n start(controller) {\n wasm.intounderlyingbytesource_start(this.__wbg_ptr, addHeapObject(controller));\n }\n /**\n * @returns {ReadableStreamType}\n */\n get type() {\n const ret = wasm.intounderlyingbytesource_type(this.__wbg_ptr);\n return __wbindgen_enum_ReadableStreamType[ret];\n }\n cancel() {\n const ptr = this.__destroy_into_raw();\n wasm.intounderlyingbytesource_cancel(ptr);\n }\n}\nif (Symbol.dispose) IntoUnderlyingByteSource.prototype[Symbol.dispose] = IntoUnderlyingByteSource.prototype.free;\n\nexport class IntoUnderlyingSink {\n __destroy_into_raw() {\n const ptr = this.__wbg_ptr;\n this.__wbg_ptr = 0;\n IntoUnderlyingSinkFinalization.unregister(this);\n return ptr;\n }\n free() {\n const ptr = this.__destroy_into_raw();\n wasm.__wbg_intounderlyingsink_free(ptr, 0);\n }\n /**\n * @param {any} reason\n * @returns {Promise<any>}\n */\n abort(reason) {\n const ptr = this.__destroy_into_raw();\n const ret = wasm.intounderlyingsink_abort(ptr, addHeapObject(reason));\n return takeObject(ret);\n }\n /**\n * @returns {Promise<any>}\n */\n close() {\n const ptr = this.__destroy_into_raw();\n const ret = wasm.intounderlyingsink_close(ptr);\n return takeObject(ret);\n }\n /**\n * @param {any} chunk\n * @returns {Promise<any>}\n */\n write(chunk) {\n const ret = wasm.intounderlyingsink_write(this.__wbg_ptr, addHeapObject(chunk));\n return takeObject(ret);\n }\n}\nif (Symbol.dispose) IntoUnderlyingSink.prototype[Symbol.dispose] = IntoUnderlyingSink.prototype.free;\n\nexport class IntoUnderlyingSource {\n __destroy_into_raw() {\n const ptr = this.__wbg_ptr;\n this.__wbg_ptr = 0;\n IntoUnderlyingSourceFinalization.unregister(this);\n return ptr;\n }\n free() {\n const ptr = this.__destroy_into_raw();\n wasm.__wbg_intounderlyingsource_free(ptr, 0);\n }\n /**\n * @param {ReadableStreamDefaultController} controller\n * @returns {Promise<any>}\n */\n pull(controller) {\n const ret = wasm.intounderlyingsource_pull(this.__wbg_ptr, addHeapObject(controller));\n return takeObject(ret);\n }\n cancel() {\n const ptr = this.__destroy_into_raw();\n wasm.intounderlyingsource_cancel(ptr);\n }\n}\nif (Symbol.dispose) IntoUnderlyingSource.prototype[Symbol.dispose] = IntoUnderlyingSource.prototype.free;\n\n/**\n * One paired channel: a single bidirectional stream of text frames.\n */\nexport class IrohConn {\n static __wrap(ptr) {\n ptr = ptr >>> 0;\n const obj = Object.create(IrohConn.prototype);\n obj.__wbg_ptr = ptr;\n IrohConnFinalization.register(obj, obj.__wbg_ptr, obj);\n return obj;\n }\n __destroy_into_raw() {\n const ptr = this.__wbg_ptr;\n this.__wbg_ptr = 0;\n IrohConnFinalization.unregister(this);\n return ptr;\n }\n free() {\n const ptr = this.__destroy_into_raw();\n wasm.__wbg_irohconn_free(ptr, 0);\n }\n /**\n * Round-trip time in milliseconds, as QUIC measures it.\n * @returns {number}\n */\n rtt() {\n const ret = wasm.irohconn_rtt(this.__wbg_ptr);\n return ret;\n }\n /**\n * The next text frame, or `undefined` once the channel is closed.\n * @returns {Promise<any>}\n */\n recv() {\n const ret = wasm.irohconn_recv(this.__wbg_ptr);\n return takeObject(ret);\n }\n /**\n * Sends one text frame. Callers serialise sends; a concurrent call fails.\n * @param {string} text\n * @returns {Promise<any>}\n */\n send(text) {\n const ptr0 = passStringToWasm0(text, wasm.__wbindgen_export, wasm.__wbindgen_export2);\n const len0 = WASM_VECTOR_LEN;\n const ret = wasm.irohconn_send(this.__wbg_ptr, ptr0, len0);\n return takeObject(ret);\n }\n close() {\n wasm.irohconn_close(this.__wbg_ptr);\n }\n /**\n * @returns {any}\n */\n binding() {\n try {\n const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);\n wasm.irohconn_binding(retptr, this.__wbg_ptr);\n var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);\n var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);\n var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);\n if (r2) {\n throw takeObject(r1);\n }\n return takeObject(r0);\n } finally {\n wasm.__wbindgen_add_to_stack_pointer(16);\n }\n }\n /**\n * The contact's endpoint id.\n * @returns {string}\n */\n remoteId() {\n let deferred1_0;\n let deferred1_1;\n try {\n const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);\n wasm.irohconn_remoteId(retptr, this.__wbg_ptr);\n var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);\n var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);\n deferred1_0 = r0;\n deferred1_1 = r1;\n return getStringFromWasm0(r0, r1);\n } finally {\n wasm.__wbindgen_add_to_stack_pointer(16);\n wasm.__wbindgen_export4(deferred1_0, deferred1_1, 1);\n }\n }\n}\nif (Symbol.dispose) IrohConn.prototype[Symbol.dispose] = IrohConn.prototype.free;\n\n/**\n * One Iroh endpoint for one paired chat, homed on a relay.\n */\nexport class IrohNode {\n static __wrap(ptr) {\n ptr = ptr >>> 0;\n const obj = Object.create(IrohNode.prototype);\n obj.__wbg_ptr = ptr;\n IrohNodeFinalization.register(obj, obj.__wbg_ptr, obj);\n return obj;\n }\n __destroy_into_raw() {\n const ptr = this.__wbg_ptr;\n this.__wbg_ptr = 0;\n IrohNodeFinalization.unregister(this);\n return ptr;\n }\n free() {\n const ptr = this.__destroy_into_raw();\n wasm.__wbg_irohnode_free(ptr, 0);\n }\n /**\n * @returns {Promise<any>}\n */\n close() {\n const ret = wasm.irohnode_close(this.__wbg_ptr);\n return takeObject(ret);\n }\n /**\n * Binds an endpoint for a 32-byte seed and waits until it is reachable\n * through the first relay that answers. `relays` is a list of relay URLs.\n * @param {Uint8Array} seed\n * @param {string[]} relays\n * @param {number} online_ms\n * @returns {Promise<any>}\n */\n static start(seed, relays, online_ms) {\n const ptr0 = passArray8ToWasm0(seed, wasm.__wbindgen_export);\n const len0 = WASM_VECTOR_LEN;\n const ptr1 = passArrayJsValueToWasm0(relays, wasm.__wbindgen_export);\n const len1 = WASM_VECTOR_LEN;\n const ret = wasm.irohnode_start(ptr0, len0, ptr1, len1, online_ms);\n return takeObject(ret);\n }\n /**\n * Resolves with the next incoming connection, or `undefined` once closed.\n * @returns {Promise<any>}\n */\n accept() {\n const ret = wasm.irohnode_accept(this.__wbg_ptr);\n return takeObject(ret);\n }\n /**\n * `{ id, relay, addresses: [] }`, the same shape the Desktop publishes.\n * @returns {any}\n */\n address() {\n try {\n const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);\n wasm.irohnode_address(retptr, this.__wbg_ptr);\n var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);\n var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);\n var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);\n if (r2) {\n throw takeObject(r1);\n }\n return takeObject(r0);\n } finally {\n wasm.__wbindgen_add_to_stack_pointer(16);\n }\n }\n /**\n * @param {any} descriptor\n * @param {number} timeout_ms\n * @returns {Promise<any>}\n */\n connect(descriptor, timeout_ms) {\n const ret = wasm.irohnode_connect(this.__wbg_ptr, addHeapObject(descriptor), timeout_ms);\n return takeObject(ret);\n }\n}\nif (Symbol.dispose) IrohNode.prototype[Symbol.dispose] = IrohNode.prototype.free;\n\nconst EXPECTED_RESPONSE_TYPES = new Set(['basic', 'cors', 'default']);\n\nasync function __wbg_load(module, imports) {\n if (typeof Response === 'function' && module instanceof Response) {\n if (typeof WebAssembly.instantiateStreaming === 'function') {\n try {\n return await WebAssembly.instantiateStreaming(module, imports);\n } catch (e) {\n const validResponse = module.ok && EXPECTED_RESPONSE_TYPES.has(module.type);\n\n if (validResponse && module.headers.get('Content-Type') !== 'application/wasm') {\n console.warn(\"`WebAssembly.instantiateStreaming` failed because your server does not serve Wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\\n\", e);\n\n } else {\n throw e;\n }\n }\n }\n\n const bytes = await module.arrayBuffer();\n return await WebAssembly.instantiate(bytes, imports);\n } else {\n const instance = await WebAssembly.instantiate(module, imports);\n\n if (instance instanceof WebAssembly.Instance) {\n return { instance, module };\n } else {\n return instance;\n }\n }\n}\n\nfunction __wbg_get_imports() {\n const imports = {};\n imports.wbg = {};\n imports.wbg.__wbg_Error_52673b7de5a0ca89 = function(arg0, arg1) {\n const ret = Error(getStringFromWasm0(arg0, arg1));\n return addHeapObject(ret);\n };\n imports.wbg.__wbg___wbindgen_boolean_get_dea25b33882b895b = function(arg0) {\n const v = getObject(arg0);\n const ret = typeof(v) === 'boolean' ? v : undefined;\n return isLikeNone(ret) ? 0xFFFFFF : ret ? 1 : 0;\n };\n imports.wbg.__wbg___wbindgen_debug_string_adfb662ae34724b6 = function(arg0, arg1) {\n const ret = debugString(getObject(arg1));\n const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);\n const len1 = WASM_VECTOR_LEN;\n getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);\n getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);\n };\n imports.wbg.__wbg___wbindgen_is_function_8d400b8b1af978cd = function(arg0) {\n const ret = typeof(getObject(arg0)) === 'function';\n return ret;\n };\n imports.wbg.__wbg___wbindgen_is_object_ce774f3490692386 = function(arg0) {\n const val = getObject(arg0);\n const ret = typeof(val) === 'object' && val !== null;\n return ret;\n };\n imports.wbg.__wbg___wbindgen_is_string_704ef9c8fc131030 = function(arg0) {\n const ret = typeof(getObject(arg0)) === 'string';\n return ret;\n };\n imports.wbg.__wbg___wbindgen_is_undefined_f6b95eab589e0269 = function(arg0) {\n const ret = getObject(arg0) === undefined;\n return ret;\n };\n imports.wbg.__wbg___wbindgen_string_get_a2a31e16edf96e42 = function(arg0, arg1) {\n const obj = getObject(arg1);\n const ret = typeof(obj) === 'string' ? obj : undefined;\n var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);\n var len1 = WASM_VECTOR_LEN;\n getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);\n getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);\n };\n imports.wbg.__wbg___wbindgen_throw_dd24417ed36fc46e = function(arg0, arg1) {\n throw new Error(getStringFromWasm0(arg0, arg1));\n };\n imports.wbg.__wbg__wbg_cb_unref_87dfb5aaa0cbcea7 = function(arg0) {\n getObject(arg0)._wbg_cb_unref();\n };\n imports.wbg.__wbg_abort_07646c894ebbf2bd = function(arg0) {\n getObject(arg0).abort();\n };\n imports.wbg.__wbg_abort_399ecbcfd6ef3c8e = function(arg0, arg1) {\n getObject(arg0).abort(getObject(arg1));\n };\n imports.wbg.__wbg_addEventListener_e792423147a80626 = function() { return handleError(function (arg0, arg1, arg2, arg3) {\n getObject(arg0).addEventListener(getStringFromWasm0(arg1, arg2), getObject(arg3));\n }, arguments) };\n imports.wbg.__wbg_append_c5cbdf46455cc776 = function() { return handleError(function (arg0, arg1, arg2, arg3, arg4) {\n getObject(arg0).append(getStringFromWasm0(arg1, arg2), getStringFromWasm0(arg3, arg4));\n }, arguments) };\n imports.wbg.__wbg_body_947b901c33f7fe32 = function(arg0) {\n const ret = getObject(arg0).body;\n return isLikeNone(ret) ? 0 : addHeapObject(ret);\n };\n imports.wbg.__wbg_buffer_6cb2fecb1f253d71 = function(arg0) {\n const ret = getObject(arg0).buffer;\n return addHeapObject(ret);\n };\n imports.wbg.__wbg_byobRequest_f8e3517f5f8ad284 = function(arg0) {\n const ret = getObject(arg0).byobRequest;\n return isLikeNone(ret) ? 0 : addHeapObject(ret);\n };\n imports.wbg.__wbg_byteLength_faa9938885bdeee6 = function(arg0) {\n const ret = getObject(arg0).byteLength;\n return ret;\n };\n imports.wbg.__wbg_byteOffset_3868b6a19ba01dea = function(arg0) {\n const ret = getObject(arg0).byteOffset;\n return ret;\n };\n imports.wbg.__wbg_call_3020136f7a2d6e44 = function() { return handleError(function (arg0, arg1, arg2) {\n const ret = getObject(arg0).call(getObject(arg1), getObject(arg2));\n return addHeapObject(ret);\n }, arguments) };\n imports.wbg.__wbg_call_abb4ff46ce38be40 = function() { return handleError(function (arg0, arg1) {\n const ret = getObject(arg0).call(getObject(arg1));\n return addHeapObject(ret);\n }, arguments) };\n imports.wbg.__wbg_cancel_a65cf45dca50ba4c = function(arg0) {\n const ret = getObject(arg0).cancel();\n return addHeapObject(ret);\n };\n imports.wbg.__wbg_catch_b9db41d97d42bd02 = function(arg0, arg1) {\n const ret = getObject(arg0).catch(getObject(arg1));\n return addHeapObject(ret);\n };\n imports.wbg.__wbg_clearTimeout_3b5c565a5ec539dd = function(arg0) {\n const ret = clearTimeout(takeObject(arg0));\n return addHeapObject(ret);\n };\n imports.wbg.__wbg_clearTimeout_5e42188b495715bb = function() { return handleError(function (arg0, arg1) {\n getObject(arg0).clearTimeout(takeObject(arg1));\n }, arguments) };\n imports.wbg.__wbg_close_0af5661bf3d335f2 = function() { return handleError(function (arg0) {\n getObject(arg0).close();\n }, arguments) };\n imports.wbg.__wbg_close_1db3952de1b5b1cf = function() { return handleError(function (arg0) {\n getObject(arg0).close();\n }, arguments) };\n imports.wbg.__wbg_close_3ec111e7b23d94d8 = function() { return handleError(function (arg0) {\n getObject(arg0).close();\n }, arguments) };\n imports.wbg.__wbg_code_85a811fe6ca962be = function(arg0) {\n const ret = getObject(arg0).code;\n return ret;\n };\n imports.wbg.__wbg_code_c2a85f2863ec11b3 = function(arg0) {\n const ret = getObject(arg0).code;\n return ret;\n };\n imports.wbg.__wbg_crypto_86f2631e91b51511 = function(arg0) {\n const ret = getObject(arg0).crypto;\n return addHeapObject(ret);\n };\n imports.wbg.__wbg_data_8bf4ae669a78a688 = function(arg0) {\n const ret = getObject(arg0).data;\n return addHeapObject(ret);\n };\n imports.wbg.__wbg_done_62ea16af4ce34b24 = function(arg0) {\n const ret = getObject(arg0).done;\n return ret;\n };\n imports.wbg.__wbg_enqueue_a7e6b1ee87963aad = function() { return handleError(function (arg0, arg1) {\n getObject(arg0).enqueue(getObject(arg1));\n }, arguments) };\n imports.wbg.__wbg_entries_13da0847a5239578 = function(arg0) {\n const ret = getObject(arg0).entries();\n return addHeapObject(ret);\n };\n imports.wbg.__wbg_fetch_16dcf1cfbbc66b3c = function(arg0) {\n const ret = fetch(getObject(arg0));\n return addHeapObject(ret);\n };\n imports.wbg.__wbg_fetch_90447c28cc0b095e = function(arg0, arg1) {\n const ret = getObject(arg0).fetch(getObject(arg1));\n return addHeapObject(ret);\n };\n imports.wbg.__wbg_getRandomValues_a8ddca022803a145 = function() { return handleError(function (arg0, arg1) {\n globalThis.crypto.getRandomValues(getArrayU8FromWasm0(arg0, arg1));\n }, arguments) };\n imports.wbg.__wbg_getRandomValues_b3f15fcbfabb0f8b = function() { return handleError(function (arg0, arg1) {\n getObject(arg0).getRandomValues(getObject(arg1));\n }, arguments) };\n imports.wbg.__wbg_getReader_48e00749fe3f6089 = function() { return handleError(function (arg0) {\n const ret = getObject(arg0).getReader();\n return addHeapObject(ret);\n }, arguments) };\n imports.wbg.__wbg_get_6b7bd52aca3f9671 = function(arg0, arg1) {\n const ret = getObject(arg0)[arg1 >>> 0];\n return addHeapObject(ret);\n };\n imports.wbg.__wbg_get_af9dab7e9603ea93 = function() { return handleError(function (arg0, arg1) {\n const ret = Reflect.get(getObject(arg0), getObject(arg1));\n return addHeapObject(ret);\n }, arguments) };\n imports.wbg.__wbg_get_done_f98a6e62c4e18fb9 = function(arg0) {\n const ret = getObject(arg0).done;\n return isLikeNone(ret) ? 0xFFFFFF : ret ? 1 : 0;\n };\n imports.wbg.__wbg_get_value_63e39884ef11812e = function(arg0) {\n const ret = getObject(arg0).value;\n return addHeapObject(ret);\n };\n imports.wbg.__wbg_has_0e670569d65d3a45 = function() { return handleError(function (arg0, arg1) {\n const ret = Reflect.has(getObject(arg0), getObject(arg1));\n return ret;\n }, arguments) };\n imports.wbg.__wbg_headers_654c30e1bcccc552 = function(arg0) {\n const ret = getObject(arg0).headers;\n return addHeapObject(ret);\n };\n imports.wbg.__wbg_instanceof_ArrayBuffer_f3320d2419cd0355 = function(arg0) {\n let result;\n try {\n result = getObject(arg0) instanceof ArrayBuffer;\n } catch (_) {\n result = false;\n }\n const ret = result;\n return ret;\n };\n imports.wbg.__wbg_instanceof_Blob_e9c51ce33a4b6181 = function(arg0) {\n let result;\n try {\n result = getObject(arg0) instanceof Blob;\n } catch (_) {\n result = false;\n }\n const ret = result;\n return ret;\n };\n imports.wbg.__wbg_instanceof_Response_cd74d1c2ac92cb0b = function(arg0) {\n let result;\n try {\n result = getObject(arg0) instanceof Response;\n } catch (_) {\n result = false;\n }\n const ret = result;\n return ret;\n };\n imports.wbg.__wbg_irohconn_new = function(arg0) {\n const ret = IrohConn.__wrap(arg0);\n return addHeapObject(ret);\n };\n imports.wbg.__wbg_irohnode_new = function(arg0) {\n const ret = IrohNode.__wrap(arg0);\n return addHeapObject(ret);\n };\n imports.wbg.__wbg_isArray_51fd9e6422c0a395 = function(arg0) {\n const ret = Array.isArray(getObject(arg0));\n return ret;\n };\n imports.wbg.__wbg_length_22ac23eaec9d8053 = function(arg0) {\n const ret = getObject(arg0).length;\n return ret;\n };\n imports.wbg.__wbg_message_a4e9a39ee8f92b17 = function(arg0, arg1) {\n const ret = getObject(arg1).message;\n const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);\n const len1 = WASM_VECTOR_LEN;\n getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);\n getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);\n };\n imports.wbg.__wbg_msCrypto_d562bbe83e0d4b91 = function(arg0) {\n const ret = getObject(arg0).msCrypto;\n return addHeapObject(ret);\n };\n imports.wbg.__wbg_new_1ba21ce319a06297 = function() {\n const ret = new Object();\n return addHeapObject(ret);\n };\n imports.wbg.__wbg_new_25f239778d6112b9 = function() {\n const ret = new Array();\n return addHeapObject(ret);\n };\n imports.wbg.__wbg_new_3c79b3bb1b32b7d3 = function() { return handleError(function () {\n const ret = new Headers();\n return addHeapObject(ret);\n }, arguments) };\n imports.wbg.__wbg_new_6421f6084cc5bc5a = function(arg0) {\n const ret = new Uint8Array(getObject(arg0));\n return addHeapObject(ret);\n };\n imports.wbg.__wbg_new_7c30d1f874652e62 = function() { return handleError(function (arg0, arg1) {\n const ret = new WebSocket(getStringFromWasm0(arg0, arg1));\n return addHeapObject(ret);\n }, arguments) };\n imports.wbg.__wbg_new_881a222c65f168fc = function() { return handleError(function () {\n const ret = new AbortController();\n return addHeapObject(ret);\n }, arguments) };\n imports.wbg.__wbg_new_df1173567d5ff028 = function(arg0, arg1) {\n const ret = new Error(getStringFromWasm0(arg0, arg1));\n return addHeapObject(ret);\n };\n imports.wbg.__wbg_new_ff12d2b041fb48f1 = function(arg0, arg1) {\n try {\n var state0 = {a: arg0, b: arg1};\n var cb0 = (arg0, arg1) => {\n const a = state0.a;\n state0.a = 0;\n try {\n return __wasm_bindgen_func_elem_9044(a, state0.b, arg0, arg1);\n } finally {\n state0.a = a;\n }\n };\n const ret = new Promise(cb0);\n return addHeapObject(ret);\n } finally {\n state0.a = state0.b = 0;\n }\n };\n imports.wbg.__wbg_new_from_slice_f9c22b9153b26992 = function(arg0, arg1) {\n const ret = new Uint8Array(getArrayU8FromWasm0(arg0, arg1));\n return addHeapObject(ret);\n };\n imports.wbg.__wbg_new_no_args_cb138f77cf6151ee = function(arg0, arg1) {\n const ret = new Function(getStringFromWasm0(arg0, arg1));\n return addHeapObject(ret);\n };\n imports.wbg.__wbg_new_with_byte_offset_and_length_d85c3da1fd8df149 = function(arg0, arg1, arg2) {\n const ret = new Uint8Array(getObject(arg0), arg1 >>> 0, arg2 >>> 0);\n return addHeapObject(ret);\n };\n imports.wbg.__wbg_new_with_length_aa5eaf41d35235e5 = function(arg0) {\n const ret = new Uint8Array(arg0 >>> 0);\n return addHeapObject(ret);\n };\n imports.wbg.__wbg_new_with_str_and_init_c5748f76f5108934 = function() { return handleError(function (arg0, arg1, arg2) {\n const ret = new Request(getStringFromWasm0(arg0, arg1), getObject(arg2));\n return addHeapObject(ret);\n }, arguments) };\n imports.wbg.__wbg_new_with_str_sequence_073466a4a5387941 = function() { return handleError(function (arg0, arg1, arg2) {\n const ret = new WebSocket(getStringFromWasm0(arg0, arg1), getObject(arg2));\n return addHeapObject(ret);\n }, arguments) };\n imports.wbg.__wbg_next_3cfe5c0fe2a4cc53 = function() { return handleError(function (arg0) {\n const ret = getObject(arg0).next();\n return addHeapObject(ret);\n }, arguments) };\n imports.wbg.__wbg_node_e1f24f89a7336c2e = function(arg0) {\n const ret = getObject(arg0).node;\n return addHeapObject(ret);\n };\n imports.wbg.__wbg_now_2c95c9de01293173 = function(arg0) {\n const ret = getObject(arg0).now();\n return ret;\n };\n imports.wbg.__wbg_now_69d776cd24f5215b = function() {\n const ret = Date.now();\n return ret;\n };\n imports.wbg.__wbg_parse_a09a54cf72639456 = function() { return handleError(function (arg0, arg1) {\n const ret = JSON.parse(getStringFromWasm0(arg0, arg1));\n return addHeapObject(ret);\n }, arguments) };\n imports.wbg.__wbg_performance_7a3ffd0b17f663ad = function(arg0) {\n const ret = getObject(arg0).performance;\n return addHeapObject(ret);\n };\n imports.wbg.__wbg_process_3975fd6c72f520aa = function(arg0) {\n const ret = getObject(arg0).process;\n return addHeapObject(ret);\n };\n imports.wbg.__wbg_protocol_a74f36816d507cab = function(arg0, arg1) {\n const ret = getObject(arg1).protocol;\n const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);\n const len1 = WASM_VECTOR_LEN;\n getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);\n getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);\n };\n imports.wbg.__wbg_prototypesetcall_dfe9b766cdc1f1fd = function(arg0, arg1, arg2) {\n Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), getObject(arg2));\n };\n imports.wbg.__wbg_push_7d9be8f38fc13975 = function(arg0, arg1) {\n const ret = getObject(arg0).push(getObject(arg1));\n return ret;\n };\n imports.wbg.__wbg_queueMicrotask_9b549dfce8865860 = function(arg0) {\n const ret = getObject(arg0).queueMicrotask;\n return addHeapObject(ret);\n };\n imports.wbg.__wbg_queueMicrotask_fca69f5bfad613a5 = function(arg0) {\n queueMicrotask(getObject(arg0));\n };\n imports.wbg.__wbg_randomFillSync_f8c153b79f285817 = function() { return handleError(function (arg0, arg1) {\n getObject(arg0).randomFillSync(takeObject(arg1));\n }, arguments) };\n imports.wbg.__wbg_read_39c4b35efcd03c25 = function(arg0) {\n const ret = getObject(arg0).read();\n return addHeapObject(ret);\n };\n imports.wbg.__wbg_readyState_9d0976dcad561aa9 = function(arg0) {\n const ret = getObject(arg0).readyState;\n return ret;\n };\n imports.wbg.__wbg_reason_d4eb9e40592438c2 = function(arg0, arg1) {\n const ret = getObject(arg1).reason;\n const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);\n const len1 = WASM_VECTOR_LEN;\n getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);\n getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);\n };\n imports.wbg.__wbg_releaseLock_a5912f590b185180 = function(arg0) {\n getObject(arg0).releaseLock();\n };\n imports.wbg.__wbg_removeEventListener_54bf92f4a849bd7d = function() { return handleError(function (arg0, arg1, arg2, arg3) {\n getObject(arg0).removeEventListener(getStringFromWasm0(arg1, arg2), getObject(arg3));\n }, arguments) };\n imports.wbg.__wbg_require_b74f47fc2d022fd6 = function() { return handleError(function () {\n const ret = module.require;\n return addHeapObject(ret);\n }, arguments) };\n imports.wbg.__wbg_resolve_fd5bfbaa4ce36e1e = function(arg0) {\n const ret = Promise.resolve(getObject(arg0));\n return addHeapObject(ret);\n };\n imports.wbg.__wbg_respond_9f7fc54636c4a3af = function() { return handleError(function (arg0, arg1) {\n getObject(arg0).respond(arg1 >>> 0);\n }, arguments) };\n imports.wbg.__wbg_send_7cc36bb628044281 = function() { return handleError(function (arg0, arg1, arg2) {\n getObject(arg0).send(getStringFromWasm0(arg1, arg2));\n }, arguments) };\n imports.wbg.__wbg_send_ea59e150ab5ebe08 = function() { return handleError(function (arg0, arg1, arg2) {\n getObject(arg0).send(getArrayU8FromWasm0(arg1, arg2));\n }, arguments) };\n imports.wbg.__wbg_setTimeout_2b111259203a2623 = function() { return handleError(function (arg0, arg1, arg2) {\n const ret = getObject(arg0).setTimeout(takeObject(arg1), arg2);\n return addHeapObject(ret);\n }, arguments) };\n imports.wbg.__wbg_setTimeout_cb2a856ba8315e7a = function(arg0, arg1) {\n const ret = setTimeout(getObject(arg0), arg1);\n return addHeapObject(ret);\n };\n imports.wbg.__wbg_set_169e13b608078b7b = function(arg0, arg1, arg2) {\n getObject(arg0).set(getArrayU8FromWasm0(arg1, arg2));\n };\n imports.wbg.__wbg_set_binaryType_73e8c75df97825f8 = function(arg0, arg1) {\n getObject(arg0).binaryType = __wbindgen_enum_BinaryType[arg1];\n };\n imports.wbg.__wbg_set_body_8e743242d6076a4f = function(arg0, arg1) {\n getObject(arg0).body = getObject(arg1);\n };\n imports.wbg.__wbg_set_cache_0e437c7c8e838b9b = function(arg0, arg1) {\n getObject(arg0).cache = __wbindgen_enum_RequestCache[arg1];\n };\n imports.wbg.__wbg_set_credentials_55ae7c3c106fd5be = function(arg0, arg1) {\n getObject(arg0).credentials = __wbindgen_enum_RequestCredentials[arg1];\n };\n imports.wbg.__wbg_set_handle_event_14baa3949ef6909d = function(arg0, arg1) {\n getObject(arg0).handleEvent = getObject(arg1);\n };\n imports.wbg.__wbg_set_headers_5671cf088e114d2b = function(arg0, arg1) {\n getObject(arg0).headers = getObject(arg1);\n };\n imports.wbg.__wbg_set_method_76c69e41b3570627 = function(arg0, arg1, arg2) {\n getObject(arg0).method = getStringFromWasm0(arg1, arg2);\n };\n imports.wbg.__wbg_set_mode_611016a6818fc690 = function(arg0, arg1) {\n getObject(arg0).mode = __wbindgen_enum_RequestMode[arg1];\n };\n imports.wbg.__wbg_set_onclose_032729b3d7ed7a9e = function(arg0, arg1) {\n getObject(arg0).onclose = getObject(arg1);\n };\n imports.wbg.__wbg_set_onerror_7819daa6af176ddb = function(arg0, arg1) {\n getObject(arg0).onerror = getObject(arg1);\n };\n imports.wbg.__wbg_set_onmessage_71321d0bed69856c = function(arg0, arg1) {\n getObject(arg0).onmessage = getObject(arg1);\n };\n imports.wbg.__wbg_set_onopen_6d4abedb27ba5656 = function(arg0, arg1) {\n getObject(arg0).onopen = getObject(arg1);\n };\n imports.wbg.__wbg_set_signal_e89be862d0091009 = function(arg0, arg1) {\n getObject(arg0).signal = getObject(arg1);\n };\n imports.wbg.__wbg_signal_3c14fbdc89694b39 = function(arg0) {\n const ret = getObject(arg0).signal;\n return addHeapObject(ret);\n };\n imports.wbg.__wbg_static_accessor_GLOBAL_769e6b65d6557335 = function() {\n const ret = typeof global === 'undefined' ? null : global;\n return isLikeNone(ret) ? 0 : addHeapObject(ret);\n };\n imports.wbg.__wbg_static_accessor_GLOBAL_THIS_60cf02db4de8e1c1 = function() {\n const ret = typeof globalThis === 'undefined' ? null : globalThis;\n return isLikeNone(ret) ? 0 : addHeapObject(ret);\n };\n imports.wbg.__wbg_static_accessor_SELF_08f5a74c69739274 = function() {\n const ret = typeof self === 'undefined' ? null : self;\n return isLikeNone(ret) ? 0 : addHeapObject(ret);\n };\n imports.wbg.__wbg_static_accessor_WINDOW_a8924b26aa92d024 = function() {\n const ret = typeof window === 'undefined' ? null : window;\n return isLikeNone(ret) ? 0 : addHeapObject(ret);\n };\n imports.wbg.__wbg_status_9bfc680efca4bdfd = function(arg0) {\n const ret = getObject(arg0).status;\n return ret;\n };\n imports.wbg.__wbg_stringify_655a6390e1f5eb6b = function() { return handleError(function (arg0) {\n const ret = JSON.stringify(getObject(arg0));\n return addHeapObject(ret);\n }, arguments) };\n imports.wbg.__wbg_subarray_845f2f5bce7d061a = function(arg0, arg1, arg2) {\n const ret = getObject(arg0).subarray(arg1 >>> 0, arg2 >>> 0);\n return addHeapObject(ret);\n };\n imports.wbg.__wbg_then_429f7caf1026411d = function(arg0, arg1, arg2) {\n const ret = getObject(arg0).then(getObject(arg1), getObject(arg2));\n return addHeapObject(ret);\n };\n imports.wbg.__wbg_then_4f95312d68691235 = function(arg0, arg1) {\n const ret = getObject(arg0).then(getObject(arg1));\n return addHeapObject(ret);\n };\n imports.wbg.__wbg_url_b6d11838a4f95198 = function(arg0, arg1) {\n const ret = getObject(arg1).url;\n const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);\n const len1 = WASM_VECTOR_LEN;\n getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);\n getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);\n };\n imports.wbg.__wbg_url_df28eef824b04410 = function(arg0, arg1) {\n const ret = getObject(arg1).url;\n const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);\n const len1 = WASM_VECTOR_LEN;\n getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);\n getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);\n };\n imports.wbg.__wbg_value_57b7b035e117f7ee = function(arg0) {\n const ret = getObject(arg0).value;\n return addHeapObject(ret);\n };\n imports.wbg.__wbg_versions_4e31226f5e8dc909 = function(arg0) {\n const ret = getObject(arg0).versions;\n return addHeapObject(ret);\n };\n imports.wbg.__wbg_view_788aaf149deefd2f = function(arg0) {\n const ret = getObject(arg0).view;\n return isLikeNone(ret) ? 0 : addHeapObject(ret);\n };\n imports.wbg.__wbg_wasClean_4154a2d59fdb4dd7 = function(arg0) {\n const ret = getObject(arg0).wasClean;\n return ret;\n };\n imports.wbg.__wbindgen_cast_0edd631f92b0110b = function(arg0, arg1) {\n // Cast intrinsic for `Closure(Closure { dtor_idx: 1283, function: Function { arguments: [], shim_idx: 1284, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.\n const ret = makeMutClosure(arg0, arg1, wasm.__wasm_bindgen_func_elem_3281, __wasm_bindgen_func_elem_3298);\n return addHeapObject(ret);\n };\n imports.wbg.__wbindgen_cast_2241b6af4c4b2941 = function(arg0, arg1) {\n // Cast intrinsic for `Ref(String) -> Externref`.\n const ret = getStringFromWasm0(arg0, arg1);\n return addHeapObject(ret);\n };\n imports.wbg.__wbindgen_cast_4538106662548ce4 = function(arg0, arg1) {\n // Cast intrinsic for `Closure(Closure { dtor_idx: 182, function: Function { arguments: [NamedExternref(\"CloseEvent\")], shim_idx: 210, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.\n const ret = makeMutClosure(arg0, arg1, wasm.__wasm_bindgen_func_elem_1145, __wasm_bindgen_func_elem_1646);\n return addHeapObject(ret);\n };\n imports.wbg.__wbindgen_cast_4c22cf293645a24f = function(arg0, arg1) {\n // Cast intrinsic for `Closure(Closure { dtor_idx: 1640, function: Function { arguments: [NamedExternref(\"MessageEvent\")], shim_idx: 1644, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.\n const ret = makeMutClosure(arg0, arg1, wasm.__wasm_bindgen_func_elem_4157, __wasm_bindgen_func_elem_4186);\n return addHeapObject(ret);\n };\n imports.wbg.__wbindgen_cast_508787dc0eab30af = function(arg0, arg1) {\n // Cast intrinsic for `Closure(Closure { dtor_idx: 1354, function: Function { arguments: [], shim_idx: 1355, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.\n const ret = makeMutClosure(arg0, arg1, wasm.__wasm_bindgen_func_elem_3596, __wasm_bindgen_func_elem_3598);\n return addHeapObject(ret);\n };\n imports.wbg.__wbindgen_cast_5bb0c9521bd53709 = function(arg0, arg1) {\n // Cast intrinsic for `Closure(Closure { dtor_idx: 1357, function: Function { arguments: [], shim_idx: 1358, ret: Unit, inner_ret: Some(Unit) }, mutable: false }) -> Externref`.\n const ret = makeClosure(arg0, arg1, wasm.__wasm_bindgen_func_elem_3621, __wasm_bindgen_func_elem_3637);\n return addHeapObject(ret);\n };\n imports.wbg.__wbindgen_cast_a94aa01267934ec1 = function(arg0, arg1) {\n // Cast intrinsic for `Closure(Closure { dtor_idx: 2727, function: Function { arguments: [Externref], shim_idx: 2728, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.\n const ret = makeMutClosure(arg0, arg1, wasm.__wasm_bindgen_func_elem_8951, __wasm_bindgen_func_elem_8961);\n return addHeapObject(ret);\n };\n imports.wbg.__wbindgen_cast_cb9088102bce6b30 = function(arg0, arg1) {\n // Cast intrinsic for `Ref(Slice(U8)) -> NamedExternref(\"Uint8Array\")`.\n const ret = getArrayU8FromWasm0(arg0, arg1);\n return addHeapObject(ret);\n };\n imports.wbg.__wbindgen_cast_eea14ffc1ab98fca = function(arg0, arg1) {\n // Cast intrinsic for `Closure(Closure { dtor_idx: 2719, function: Function { arguments: [], shim_idx: 2720, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.\n const ret = makeMutClosure(arg0, arg1, wasm.__wasm_bindgen_func_elem_8902, __wasm_bindgen_func_elem_8907);\n return addHeapObject(ret);\n };\n imports.wbg.__wbindgen_object_clone_ref = function(arg0) {\n const ret = getObject(arg0);\n return addHeapObject(ret);\n };\n imports.wbg.__wbindgen_object_drop_ref = function(arg0) {\n takeObject(arg0);\n };\n\n return imports;\n}\n\nfunction __wbg_finalize_init(instance, module) {\n wasm = instance.exports;\n __wbg_init.__wbindgen_wasm_module = module;\n cachedDataViewMemory0 = null;\n cachedUint8ArrayMemory0 = null;\n\n\n\n return wasm;\n}\n\nfunction initSync(module) {\n if (wasm !== undefined) return wasm;\n\n\n if (typeof module !== 'undefined') {\n if (Object.getPrototypeOf(module) === Object.prototype) {\n ({module} = module)\n } else {\n console.warn('using deprecated parameters for `initSync()`; pass a single object instead')\n }\n }\n\n const imports = __wbg_get_imports();\n if (!(module instanceof WebAssembly.Module)) {\n module = new WebAssembly.Module(module);\n }\n const instance = new WebAssembly.Instance(module, imports);\n return __wbg_finalize_init(instance, module);\n}\n\nasync function __wbg_init(module_or_path) {\n if (wasm !== undefined) return wasm;\n\n\n if (typeof module_or_path !== 'undefined') {\n if (Object.getPrototypeOf(module_or_path) === Object.prototype) {\n ({module_or_path} = module_or_path)\n } else {\n console.warn('using deprecated parameters for the initialization function; pass a single object instead')\n }\n }\n\n if (typeof module_or_path === 'undefined') {\n module_or_path = new URL('ghostly_iroh_web_bg.wasm', import.meta.url);\n }\n const imports = __wbg_get_imports();\n\n if (typeof module_or_path === 'string' || (typeof Request === 'function' && module_or_path instanceof Request) || (typeof URL === 'function' && module_or_path instanceof URL)) {\n module_or_path = fetch(module_or_path);\n }\n\n const { instance, module } = await __wbg_load(await module_or_path, imports);\n\n return __wbg_finalize_init(instance, module);\n}\n\nexport { initSync };\nexport default __wbg_init;\n"],"mappings":";AAAA,IAAI;AAEJ,SAAS,cAAc,KAAK;CACxB,IAAI,cAAc,KAAK,QAAQ,KAAK,KAAK,KAAK,SAAS,CAAC;CACxD,MAAM,MAAM;CACZ,YAAY,KAAK;CAEjB,KAAK,OAAO;CACZ,OAAO;AACX;A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