@openclaw/nostr 2026.5.20 → 2026.5.22

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 (1336) hide show
  1. package/node_modules/@noble/ciphers/LICENSE +22 -0
  2. package/node_modules/@noble/ciphers/README.md +608 -0
  3. package/node_modules/@noble/ciphers/_arx.d.ts +81 -0
  4. package/node_modules/@noble/ciphers/_arx.d.ts.map +1 -0
  5. package/node_modules/@noble/ciphers/_arx.js +258 -0
  6. package/node_modules/@noble/ciphers/_arx.js.map +1 -0
  7. package/node_modules/@noble/ciphers/_poly1305.d.ts +48 -0
  8. package/node_modules/@noble/ciphers/_poly1305.d.ts.map +1 -0
  9. package/node_modules/@noble/ciphers/_poly1305.js +319 -0
  10. package/node_modules/@noble/ciphers/_poly1305.js.map +1 -0
  11. package/node_modules/@noble/ciphers/_polyval.d.ts +62 -0
  12. package/node_modules/@noble/ciphers/_polyval.d.ts.map +1 -0
  13. package/node_modules/@noble/ciphers/_polyval.js +231 -0
  14. package/node_modules/@noble/ciphers/_polyval.js.map +1 -0
  15. package/node_modules/@noble/ciphers/aes.d.ts +231 -0
  16. package/node_modules/@noble/ciphers/aes.d.ts.map +1 -0
  17. package/node_modules/@noble/ciphers/aes.js +1281 -0
  18. package/node_modules/@noble/ciphers/aes.js.map +1 -0
  19. package/node_modules/@noble/ciphers/chacha.d.ts +75 -0
  20. package/node_modules/@noble/ciphers/chacha.d.ts.map +1 -0
  21. package/node_modules/@noble/ciphers/chacha.js +385 -0
  22. package/node_modules/@noble/ciphers/chacha.js.map +1 -0
  23. package/node_modules/@noble/ciphers/ff1.d.ts +9 -0
  24. package/node_modules/@noble/ciphers/ff1.d.ts.map +1 -0
  25. package/node_modules/@noble/ciphers/ff1.js +160 -0
  26. package/node_modules/@noble/ciphers/ff1.js.map +1 -0
  27. package/node_modules/@noble/ciphers/index.d.ts +2 -0
  28. package/node_modules/@noble/ciphers/index.d.ts.map +1 -0
  29. package/node_modules/@noble/ciphers/index.js +27 -0
  30. package/node_modules/@noble/ciphers/index.js.map +1 -0
  31. package/node_modules/@noble/ciphers/package.json +81 -0
  32. package/node_modules/@noble/ciphers/salsa.d.ts +30 -0
  33. package/node_modules/@noble/ciphers/salsa.d.ts.map +1 -0
  34. package/node_modules/@noble/ciphers/salsa.js +260 -0
  35. package/node_modules/@noble/ciphers/salsa.js.map +1 -0
  36. package/node_modules/@noble/ciphers/src/_arx.ts +338 -0
  37. package/node_modules/@noble/ciphers/src/_poly1305.ts +360 -0
  38. package/node_modules/@noble/ciphers/src/_polyval.ts +272 -0
  39. package/node_modules/@noble/ciphers/src/aes.ts +1439 -0
  40. package/node_modules/@noble/ciphers/src/chacha.ts +367 -0
  41. package/node_modules/@noble/ciphers/src/ff1.ts +162 -0
  42. package/node_modules/@noble/ciphers/src/index.ts +25 -0
  43. package/node_modules/@noble/ciphers/src/salsa.ts +255 -0
  44. package/node_modules/@noble/ciphers/src/utils.ts +497 -0
  45. package/node_modules/@noble/ciphers/src/webcrypto.ts +125 -0
  46. package/node_modules/@noble/ciphers/utils.d.ts +171 -0
  47. package/node_modules/@noble/ciphers/utils.d.ts.map +1 -0
  48. package/node_modules/@noble/ciphers/utils.js +343 -0
  49. package/node_modules/@noble/ciphers/utils.js.map +1 -0
  50. package/node_modules/@noble/ciphers/webcrypto.d.ts +30 -0
  51. package/node_modules/@noble/ciphers/webcrypto.d.ts.map +1 -0
  52. package/node_modules/@noble/ciphers/webcrypto.js +99 -0
  53. package/node_modules/@noble/ciphers/webcrypto.js.map +1 -0
  54. package/node_modules/@noble/curves/LICENSE +21 -0
  55. package/node_modules/@noble/curves/README.md +1037 -0
  56. package/node_modules/@noble/curves/abstract/bls.d.ts +128 -0
  57. package/node_modules/@noble/curves/abstract/bls.d.ts.map +1 -0
  58. package/node_modules/@noble/curves/abstract/bls.js +372 -0
  59. package/node_modules/@noble/curves/abstract/bls.js.map +1 -0
  60. package/node_modules/@noble/curves/abstract/curve.d.ts +195 -0
  61. package/node_modules/@noble/curves/abstract/curve.d.ts.map +1 -0
  62. package/node_modules/@noble/curves/abstract/curve.js +457 -0
  63. package/node_modules/@noble/curves/abstract/curve.js.map +1 -0
  64. package/node_modules/@noble/curves/abstract/edwards.d.ts +184 -0
  65. package/node_modules/@noble/curves/abstract/edwards.d.ts.map +1 -0
  66. package/node_modules/@noble/curves/abstract/edwards.js +558 -0
  67. package/node_modules/@noble/curves/abstract/edwards.js.map +1 -0
  68. package/node_modules/@noble/curves/abstract/fft.d.ts +127 -0
  69. package/node_modules/@noble/curves/abstract/fft.d.ts.map +1 -0
  70. package/node_modules/@noble/curves/abstract/fft.js +426 -0
  71. package/node_modules/@noble/curves/abstract/fft.js.map +1 -0
  72. package/node_modules/@noble/curves/abstract/hash-to-curve.d.ts +90 -0
  73. package/node_modules/@noble/curves/abstract/hash-to-curve.d.ts.map +1 -0
  74. package/node_modules/@noble/curves/abstract/hash-to-curve.js +207 -0
  75. package/node_modules/@noble/curves/abstract/hash-to-curve.js.map +1 -0
  76. package/node_modules/@noble/curves/abstract/modular.d.ts +159 -0
  77. package/node_modules/@noble/curves/abstract/modular.d.ts.map +1 -0
  78. package/node_modules/@noble/curves/abstract/modular.js +555 -0
  79. package/node_modules/@noble/curves/abstract/modular.js.map +1 -0
  80. package/node_modules/@noble/curves/abstract/montgomery.d.ts +25 -0
  81. package/node_modules/@noble/curves/abstract/montgomery.d.ts.map +1 -0
  82. package/node_modules/@noble/curves/abstract/montgomery.js +153 -0
  83. package/node_modules/@noble/curves/abstract/montgomery.js.map +1 -0
  84. package/node_modules/@noble/curves/abstract/oprf.d.ts +282 -0
  85. package/node_modules/@noble/curves/abstract/oprf.d.ts.map +1 -0
  86. package/node_modules/@noble/curves/abstract/oprf.js +297 -0
  87. package/node_modules/@noble/curves/abstract/oprf.js.map +1 -0
  88. package/node_modules/@noble/curves/abstract/poseidon.d.ts +68 -0
  89. package/node_modules/@noble/curves/abstract/poseidon.d.ts.map +1 -0
  90. package/node_modules/@noble/curves/abstract/poseidon.js +300 -0
  91. package/node_modules/@noble/curves/abstract/poseidon.js.map +1 -0
  92. package/node_modules/@noble/curves/abstract/tower.d.ts +95 -0
  93. package/node_modules/@noble/curves/abstract/tower.d.ts.map +1 -0
  94. package/node_modules/@noble/curves/abstract/tower.js +742 -0
  95. package/node_modules/@noble/curves/abstract/tower.js.map +1 -0
  96. package/node_modules/@noble/curves/abstract/weierstrass.d.ts +325 -0
  97. package/node_modules/@noble/curves/abstract/weierstrass.d.ts.map +1 -0
  98. package/node_modules/@noble/curves/abstract/weierstrass.js +1222 -0
  99. package/node_modules/@noble/curves/abstract/weierstrass.js.map +1 -0
  100. package/node_modules/@noble/curves/bls12-381.d.ts +10 -0
  101. package/node_modules/@noble/curves/bls12-381.d.ts.map +1 -0
  102. package/node_modules/@noble/curves/bls12-381.js +688 -0
  103. package/node_modules/@noble/curves/bls12-381.js.map +1 -0
  104. package/node_modules/@noble/curves/bn254.d.ts +66 -0
  105. package/node_modules/@noble/curves/bn254.d.ts.map +1 -0
  106. package/node_modules/@noble/curves/bn254.js +190 -0
  107. package/node_modules/@noble/curves/bn254.js.map +1 -0
  108. package/node_modules/@noble/curves/ed25519.d.ts +101 -0
  109. package/node_modules/@noble/curves/ed25519.d.ts.map +1 -0
  110. package/node_modules/@noble/curves/ed25519.js +462 -0
  111. package/node_modules/@noble/curves/ed25519.js.map +1 -0
  112. package/node_modules/@noble/curves/ed448.d.ts +91 -0
  113. package/node_modules/@noble/curves/ed448.d.ts.map +1 -0
  114. package/node_modules/@noble/curves/ed448.js +442 -0
  115. package/node_modules/@noble/curves/ed448.js.map +1 -0
  116. package/node_modules/@noble/curves/index.d.ts +2 -0
  117. package/node_modules/@noble/curves/index.d.ts.map +1 -0
  118. package/node_modules/@noble/curves/index.js +33 -0
  119. package/node_modules/@noble/curves/index.js.map +1 -0
  120. package/node_modules/@noble/curves/misc.d.ts +15 -0
  121. package/node_modules/@noble/curves/misc.d.ts.map +1 -0
  122. package/node_modules/@noble/curves/misc.js +103 -0
  123. package/node_modules/@noble/curves/misc.js.map +1 -0
  124. package/node_modules/@noble/curves/nist.d.ts +36 -0
  125. package/node_modules/@noble/curves/nist.d.ts.map +1 -0
  126. package/node_modules/@noble/curves/nist.js +146 -0
  127. package/node_modules/@noble/curves/nist.js.map +1 -0
  128. package/node_modules/@noble/curves/package.json +98 -0
  129. package/node_modules/@noble/curves/secp256k1.d.ts +76 -0
  130. package/node_modules/@noble/curves/secp256k1.d.ts.map +1 -0
  131. package/node_modules/@noble/curves/secp256k1.js +283 -0
  132. package/node_modules/@noble/curves/secp256k1.js.map +1 -0
  133. package/node_modules/@noble/curves/src/abstract/bls.ts +604 -0
  134. package/node_modules/@noble/curves/src/abstract/curve.ts +633 -0
  135. package/node_modules/@noble/curves/src/abstract/edwards.ts +789 -0
  136. package/node_modules/@noble/curves/src/abstract/fft.ts +521 -0
  137. package/node_modules/@noble/curves/src/abstract/hash-to-curve.ts +292 -0
  138. package/node_modules/@noble/curves/src/abstract/modular.ts +621 -0
  139. package/node_modules/@noble/curves/src/abstract/montgomery.ts +187 -0
  140. package/node_modules/@noble/curves/src/abstract/oprf.ts +600 -0
  141. package/node_modules/@noble/curves/src/abstract/poseidon.ts +333 -0
  142. package/node_modules/@noble/curves/src/abstract/tower.ts +864 -0
  143. package/node_modules/@noble/curves/src/abstract/weierstrass.ts +1562 -0
  144. package/node_modules/@noble/curves/src/bls12-381.ts +775 -0
  145. package/node_modules/@noble/curves/src/bn254.ts +219 -0
  146. package/node_modules/@noble/curves/src/ed25519.ts +533 -0
  147. package/node_modules/@noble/curves/src/ed448.ts +525 -0
  148. package/node_modules/@noble/curves/src/index.ts +31 -0
  149. package/node_modules/@noble/curves/src/misc.ts +140 -0
  150. package/node_modules/@noble/curves/src/nist.ts +204 -0
  151. package/node_modules/@noble/curves/src/secp256k1.ts +327 -0
  152. package/node_modules/@noble/curves/src/utils.ts +306 -0
  153. package/node_modules/@noble/curves/src/webcrypto.ts +403 -0
  154. package/node_modules/@noble/curves/utils.d.ts +103 -0
  155. package/node_modules/@noble/curves/utils.d.ts.map +1 -0
  156. package/node_modules/@noble/curves/utils.js +241 -0
  157. package/node_modules/@noble/curves/utils.js.map +1 -0
  158. package/node_modules/@noble/curves/webcrypto.d.ts +99 -0
  159. package/node_modules/@noble/curves/webcrypto.d.ts.map +1 -0
  160. package/node_modules/@noble/curves/webcrypto.js +256 -0
  161. package/node_modules/@noble/curves/webcrypto.js.map +1 -0
  162. package/node_modules/@noble/hashes/LICENSE +21 -0
  163. package/node_modules/@noble/hashes/README.md +575 -0
  164. package/node_modules/@noble/hashes/_blake.d.ts +14 -0
  165. package/node_modules/@noble/hashes/_blake.d.ts.map +1 -0
  166. package/node_modules/@noble/hashes/_blake.js +45 -0
  167. package/node_modules/@noble/hashes/_blake.js.map +1 -0
  168. package/node_modules/@noble/hashes/_md.d.ts +49 -0
  169. package/node_modules/@noble/hashes/_md.d.ts.map +1 -0
  170. package/node_modules/@noble/hashes/_md.js +147 -0
  171. package/node_modules/@noble/hashes/_md.js.map +1 -0
  172. package/node_modules/@noble/hashes/_u64.d.ts +55 -0
  173. package/node_modules/@noble/hashes/_u64.d.ts.map +1 -0
  174. package/node_modules/@noble/hashes/_u64.js +67 -0
  175. package/node_modules/@noble/hashes/_u64.js.map +1 -0
  176. package/node_modules/@noble/hashes/argon2.d.ts +32 -0
  177. package/node_modules/@noble/hashes/argon2.d.ts.map +1 -0
  178. package/node_modules/@noble/hashes/argon2.js +391 -0
  179. package/node_modules/@noble/hashes/argon2.js.map +1 -0
  180. package/node_modules/@noble/hashes/blake1.d.ts +110 -0
  181. package/node_modules/@noble/hashes/blake1.d.ts.map +1 -0
  182. package/node_modules/@noble/hashes/blake1.js +485 -0
  183. package/node_modules/@noble/hashes/blake1.js.map +1 -0
  184. package/node_modules/@noble/hashes/blake2.d.ts +120 -0
  185. package/node_modules/@noble/hashes/blake2.d.ts.map +1 -0
  186. package/node_modules/@noble/hashes/blake2.js +417 -0
  187. package/node_modules/@noble/hashes/blake2.js.map +1 -0
  188. package/node_modules/@noble/hashes/blake3.d.ts +54 -0
  189. package/node_modules/@noble/hashes/blake3.d.ts.map +1 -0
  190. package/node_modules/@noble/hashes/blake3.js +255 -0
  191. package/node_modules/@noble/hashes/blake3.js.map +1 -0
  192. package/node_modules/@noble/hashes/eskdf.d.ts +50 -0
  193. package/node_modules/@noble/hashes/eskdf.d.ts.map +1 -0
  194. package/node_modules/@noble/hashes/eskdf.js +161 -0
  195. package/node_modules/@noble/hashes/eskdf.js.map +1 -0
  196. package/node_modules/@noble/hashes/hkdf.d.ts +36 -0
  197. package/node_modules/@noble/hashes/hkdf.d.ts.map +1 -0
  198. package/node_modules/@noble/hashes/hkdf.js +84 -0
  199. package/node_modules/@noble/hashes/hkdf.js.map +1 -0
  200. package/node_modules/@noble/hashes/hmac.d.ts +36 -0
  201. package/node_modules/@noble/hashes/hmac.d.ts.map +1 -0
  202. package/node_modules/@noble/hashes/hmac.js +90 -0
  203. package/node_modules/@noble/hashes/hmac.js.map +1 -0
  204. package/node_modules/@noble/hashes/index.d.ts +2 -0
  205. package/node_modules/@noble/hashes/index.d.ts.map +1 -0
  206. package/node_modules/@noble/hashes/index.js +34 -0
  207. package/node_modules/@noble/hashes/index.js.map +1 -0
  208. package/node_modules/@noble/hashes/legacy.d.ts +71 -0
  209. package/node_modules/@noble/hashes/legacy.d.ts.map +1 -0
  210. package/node_modules/@noble/hashes/legacy.js +281 -0
  211. package/node_modules/@noble/hashes/legacy.js.map +1 -0
  212. package/node_modules/@noble/hashes/package.json +93 -0
  213. package/node_modules/@noble/hashes/pbkdf2.d.ts +29 -0
  214. package/node_modules/@noble/hashes/pbkdf2.d.ts.map +1 -0
  215. package/node_modules/@noble/hashes/pbkdf2.js +97 -0
  216. package/node_modules/@noble/hashes/pbkdf2.js.map +1 -0
  217. package/node_modules/@noble/hashes/scrypt.d.ts +33 -0
  218. package/node_modules/@noble/hashes/scrypt.d.ts.map +1 -0
  219. package/node_modules/@noble/hashes/scrypt.js +216 -0
  220. package/node_modules/@noble/hashes/scrypt.js.map +1 -0
  221. package/node_modules/@noble/hashes/sha2.d.ts +199 -0
  222. package/node_modules/@noble/hashes/sha2.d.ts.map +1 -0
  223. package/node_modules/@noble/hashes/sha2.js +397 -0
  224. package/node_modules/@noble/hashes/sha2.js.map +1 -0
  225. package/node_modules/@noble/hashes/sha3-addons.d.ts +149 -0
  226. package/node_modules/@noble/hashes/sha3-addons.d.ts.map +1 -0
  227. package/node_modules/@noble/hashes/sha3-addons.js +420 -0
  228. package/node_modules/@noble/hashes/sha3-addons.js.map +1 -0
  229. package/node_modules/@noble/hashes/sha3.d.ts +58 -0
  230. package/node_modules/@noble/hashes/sha3.d.ts.map +1 -0
  231. package/node_modules/@noble/hashes/sha3.js +254 -0
  232. package/node_modules/@noble/hashes/sha3.js.map +1 -0
  233. package/node_modules/@noble/hashes/src/_blake.ts +50 -0
  234. package/node_modules/@noble/hashes/src/_md.ts +156 -0
  235. package/node_modules/@noble/hashes/src/_u64.ts +91 -0
  236. package/node_modules/@noble/hashes/src/argon2.ts +493 -0
  237. package/node_modules/@noble/hashes/src/blake1.ts +536 -0
  238. package/node_modules/@noble/hashes/src/blake2.ts +489 -0
  239. package/node_modules/@noble/hashes/src/blake3.ts +275 -0
  240. package/node_modules/@noble/hashes/src/eskdf.ts +188 -0
  241. package/node_modules/@noble/hashes/src/hkdf.ts +94 -0
  242. package/node_modules/@noble/hashes/src/hmac.ts +94 -0
  243. package/node_modules/@noble/hashes/src/index.ts +32 -0
  244. package/node_modules/@noble/hashes/src/legacy.ts +293 -0
  245. package/node_modules/@noble/hashes/src/pbkdf2.ts +129 -0
  246. package/node_modules/@noble/hashes/src/scrypt.ts +249 -0
  247. package/node_modules/@noble/hashes/src/sha2.ts +469 -0
  248. package/node_modules/@noble/hashes/src/sha3-addons.ts +530 -0
  249. package/node_modules/@noble/hashes/src/sha3.ts +295 -0
  250. package/node_modules/@noble/hashes/src/utils.ts +338 -0
  251. package/node_modules/@noble/hashes/src/webcrypto.ts +168 -0
  252. package/node_modules/@noble/hashes/utils.d.ts +130 -0
  253. package/node_modules/@noble/hashes/utils.d.ts.map +1 -0
  254. package/node_modules/@noble/hashes/utils.js +242 -0
  255. package/node_modules/@noble/hashes/utils.js.map +1 -0
  256. package/node_modules/@noble/hashes/webcrypto.d.ts +62 -0
  257. package/node_modules/@noble/hashes/webcrypto.d.ts.map +1 -0
  258. package/node_modules/@noble/hashes/webcrypto.js +126 -0
  259. package/node_modules/@noble/hashes/webcrypto.js.map +1 -0
  260. package/node_modules/@scure/base/LICENSE +21 -0
  261. package/node_modules/@scure/base/README.md +226 -0
  262. package/node_modules/@scure/base/index.d.ts +294 -0
  263. package/node_modules/@scure/base/index.d.ts.map +1 -0
  264. package/node_modules/@scure/base/index.js +704 -0
  265. package/node_modules/@scure/base/index.js.map +1 -0
  266. package/node_modules/@scure/base/index.ts +857 -0
  267. package/node_modules/@scure/base/package.json +58 -0
  268. package/node_modules/@scure/bip32/LICENSE +21 -0
  269. package/node_modules/@scure/bip32/README.md +158 -0
  270. package/node_modules/@scure/bip32/index.d.ts +60 -0
  271. package/node_modules/@scure/bip32/index.d.ts.map +1 -0
  272. package/node_modules/@scure/bip32/index.js +283 -0
  273. package/node_modules/@scure/bip32/index.js.map +1 -0
  274. package/node_modules/@scure/bip32/index.ts +317 -0
  275. package/node_modules/@scure/bip32/package.json +57 -0
  276. package/node_modules/@scure/bip39/LICENSE +21 -0
  277. package/node_modules/@scure/bip39/README.md +134 -0
  278. package/node_modules/@scure/bip39/index.d.ts +75 -0
  279. package/node_modules/@scure/bip39/index.js +149 -0
  280. package/node_modules/@scure/bip39/package.json +70 -0
  281. package/node_modules/@scure/bip39/src/index.ts +161 -0
  282. package/node_modules/@scure/bip39/wordlists/czech.d.ts +1 -0
  283. package/node_modules/@scure/bip39/wordlists/czech.js +2048 -0
  284. package/node_modules/@scure/bip39/wordlists/english.d.ts +1 -0
  285. package/node_modules/@scure/bip39/wordlists/english.js +2048 -0
  286. package/node_modules/@scure/bip39/wordlists/french.d.ts +1 -0
  287. package/node_modules/@scure/bip39/wordlists/french.js +2048 -0
  288. package/node_modules/@scure/bip39/wordlists/italian.d.ts +1 -0
  289. package/node_modules/@scure/bip39/wordlists/italian.js +2048 -0
  290. package/node_modules/@scure/bip39/wordlists/japanese.d.ts +1 -0
  291. package/node_modules/@scure/bip39/wordlists/japanese.js +2048 -0
  292. package/node_modules/@scure/bip39/wordlists/korean.d.ts +1 -0
  293. package/node_modules/@scure/bip39/wordlists/korean.js +2048 -0
  294. package/node_modules/@scure/bip39/wordlists/portuguese.d.ts +1 -0
  295. package/node_modules/@scure/bip39/wordlists/portuguese.js +2048 -0
  296. package/node_modules/@scure/bip39/wordlists/simplified-chinese.d.ts +1 -0
  297. package/node_modules/@scure/bip39/wordlists/simplified-chinese.js +2048 -0
  298. package/node_modules/@scure/bip39/wordlists/spanish.d.ts +1 -0
  299. package/node_modules/@scure/bip39/wordlists/spanish.js +2048 -0
  300. package/node_modules/@scure/bip39/wordlists/traditional-chinese.d.ts +1 -0
  301. package/node_modules/@scure/bip39/wordlists/traditional-chinese.js +2048 -0
  302. package/node_modules/nostr-tools/LICENSE +24 -0
  303. package/node_modules/nostr-tools/README.md +454 -0
  304. package/node_modules/nostr-tools/lib/cjs/abstract-pool.js +889 -0
  305. package/node_modules/nostr-tools/lib/cjs/abstract-pool.js.map +7 -0
  306. package/node_modules/nostr-tools/lib/cjs/abstract-relay.js +596 -0
  307. package/node_modules/nostr-tools/lib/cjs/abstract-relay.js.map +7 -0
  308. package/node_modules/nostr-tools/lib/cjs/core.js +63 -0
  309. package/node_modules/nostr-tools/lib/cjs/core.js.map +7 -0
  310. package/node_modules/nostr-tools/lib/cjs/fakejson.js +66 -0
  311. package/node_modules/nostr-tools/lib/cjs/fakejson.js.map +7 -0
  312. package/node_modules/nostr-tools/lib/cjs/filter.js +111 -0
  313. package/node_modules/nostr-tools/lib/cjs/filter.js.map +7 -0
  314. package/node_modules/nostr-tools/lib/cjs/index.js +3666 -0
  315. package/node_modules/nostr-tools/lib/cjs/index.js.map +7 -0
  316. package/node_modules/nostr-tools/lib/cjs/kinds.js +273 -0
  317. package/node_modules/nostr-tools/lib/cjs/kinds.js.map +7 -0
  318. package/node_modules/nostr-tools/lib/cjs/nip04.js +61 -0
  319. package/node_modules/nostr-tools/lib/cjs/nip04.js.map +7 -0
  320. package/node_modules/nostr-tools/lib/cjs/nip05.js +76 -0
  321. package/node_modules/nostr-tools/lib/cjs/nip05.js.map +7 -0
  322. package/node_modules/nostr-tools/lib/cjs/nip06.js +82 -0
  323. package/node_modules/nostr-tools/lib/cjs/nip06.js.map +7 -0
  324. package/node_modules/nostr-tools/lib/cjs/nip07.js +18 -0
  325. package/node_modules/nostr-tools/lib/cjs/nip07.js.map +7 -0
  326. package/node_modules/nostr-tools/lib/cjs/nip10.js +124 -0
  327. package/node_modules/nostr-tools/lib/cjs/nip10.js.map +7 -0
  328. package/node_modules/nostr-tools/lib/cjs/nip11.js +39 -0
  329. package/node_modules/nostr-tools/lib/cjs/nip11.js.map +7 -0
  330. package/node_modules/nostr-tools/lib/cjs/nip13.js +83 -0
  331. package/node_modules/nostr-tools/lib/cjs/nip13.js.map +7 -0
  332. package/node_modules/nostr-tools/lib/cjs/nip17.js +343 -0
  333. package/node_modules/nostr-tools/lib/cjs/nip17.js.map +7 -0
  334. package/node_modules/nostr-tools/lib/cjs/nip18.js +188 -0
  335. package/node_modules/nostr-tools/lib/cjs/nip18.js.map +7 -0
  336. package/node_modules/nostr-tools/lib/cjs/nip19.js +217 -0
  337. package/node_modules/nostr-tools/lib/cjs/nip19.js.map +7 -0
  338. package/node_modules/nostr-tools/lib/cjs/nip21.js +140 -0
  339. package/node_modules/nostr-tools/lib/cjs/nip21.js.map +7 -0
  340. package/node_modules/nostr-tools/lib/cjs/nip22.js +154 -0
  341. package/node_modules/nostr-tools/lib/cjs/nip22.js.map +7 -0
  342. package/node_modules/nostr-tools/lib/cjs/nip25.js +159 -0
  343. package/node_modules/nostr-tools/lib/cjs/nip25.js.map +7 -0
  344. package/node_modules/nostr-tools/lib/cjs/nip27.js +269 -0
  345. package/node_modules/nostr-tools/lib/cjs/nip27.js.map +7 -0
  346. package/node_modules/nostr-tools/lib/cjs/nip28.js +220 -0
  347. package/node_modules/nostr-tools/lib/cjs/nip28.js.map +7 -0
  348. package/node_modules/nostr-tools/lib/cjs/nip29.js +499 -0
  349. package/node_modules/nostr-tools/lib/cjs/nip29.js.map +7 -0
  350. package/node_modules/nostr-tools/lib/cjs/nip30.js +53 -0
  351. package/node_modules/nostr-tools/lib/cjs/nip30.js.map +7 -0
  352. package/node_modules/nostr-tools/lib/cjs/nip39.js +42 -0
  353. package/node_modules/nostr-tools/lib/cjs/nip39.js.map +7 -0
  354. package/node_modules/nostr-tools/lib/cjs/nip40.js +63 -0
  355. package/node_modules/nostr-tools/lib/cjs/nip40.js.map +7 -0
  356. package/node_modules/nostr-tools/lib/cjs/nip42.js +41 -0
  357. package/node_modules/nostr-tools/lib/cjs/nip42.js.map +7 -0
  358. package/node_modules/nostr-tools/lib/cjs/nip44.js +167 -0
  359. package/node_modules/nostr-tools/lib/cjs/nip44.js.map +7 -0
  360. package/node_modules/nostr-tools/lib/cjs/nip46.js +1455 -0
  361. package/node_modules/nostr-tools/lib/cjs/nip46.js.map +7 -0
  362. package/node_modules/nostr-tools/lib/cjs/nip47.js +168 -0
  363. package/node_modules/nostr-tools/lib/cjs/nip47.js.map +7 -0
  364. package/node_modules/nostr-tools/lib/cjs/nip49.js +77 -0
  365. package/node_modules/nostr-tools/lib/cjs/nip49.js.map +7 -0
  366. package/node_modules/nostr-tools/lib/cjs/nip54.js +35 -0
  367. package/node_modules/nostr-tools/lib/cjs/nip54.js.map +7 -0
  368. package/node_modules/nostr-tools/lib/cjs/nip55.js +103 -0
  369. package/node_modules/nostr-tools/lib/cjs/nip55.js.map +7 -0
  370. package/node_modules/nostr-tools/lib/cjs/nip57.js +274 -0
  371. package/node_modules/nostr-tools/lib/cjs/nip57.js.map +7 -0
  372. package/node_modules/nostr-tools/lib/cjs/nip58.js +117 -0
  373. package/node_modules/nostr-tools/lib/cjs/nip58.js.map +7 -0
  374. package/node_modules/nostr-tools/lib/cjs/nip59.js +320 -0
  375. package/node_modules/nostr-tools/lib/cjs/nip59.js.map +7 -0
  376. package/node_modules/nostr-tools/lib/cjs/nip75.js +70 -0
  377. package/node_modules/nostr-tools/lib/cjs/nip75.js.map +7 -0
  378. package/node_modules/nostr-tools/lib/cjs/nip77.js +519 -0
  379. package/node_modules/nostr-tools/lib/cjs/nip77.js.map +7 -0
  380. package/node_modules/nostr-tools/lib/cjs/nip94.js +142 -0
  381. package/node_modules/nostr-tools/lib/cjs/nip94.js.map +7 -0
  382. package/node_modules/nostr-tools/lib/cjs/nip98.js +230 -0
  383. package/node_modules/nostr-tools/lib/cjs/nip98.js.map +7 -0
  384. package/node_modules/nostr-tools/lib/cjs/nip99.js +153 -0
  385. package/node_modules/nostr-tools/lib/cjs/nip99.js.map +7 -0
  386. package/node_modules/nostr-tools/lib/cjs/nipb7.js +184 -0
  387. package/node_modules/nostr-tools/lib/cjs/nipb7.js.map +7 -0
  388. package/node_modules/nostr-tools/lib/cjs/package.json +1 -0
  389. package/node_modules/nostr-tools/lib/cjs/pool.js +989 -0
  390. package/node_modules/nostr-tools/lib/cjs/pool.js.map +7 -0
  391. package/node_modules/nostr-tools/lib/cjs/pure.js +130 -0
  392. package/node_modules/nostr-tools/lib/cjs/pure.js.map +7 -0
  393. package/node_modules/nostr-tools/lib/cjs/references.js +210 -0
  394. package/node_modules/nostr-tools/lib/cjs/references.js.map +7 -0
  395. package/node_modules/nostr-tools/lib/cjs/relay.js +704 -0
  396. package/node_modules/nostr-tools/lib/cjs/relay.js.map +7 -0
  397. package/node_modules/nostr-tools/lib/cjs/signer.js +130 -0
  398. package/node_modules/nostr-tools/lib/cjs/signer.js.map +7 -0
  399. package/node_modules/nostr-tools/lib/cjs/utils.js +150 -0
  400. package/node_modules/nostr-tools/lib/cjs/utils.js.map +7 -0
  401. package/node_modules/nostr-tools/lib/cjs/wasm.js +103 -0
  402. package/node_modules/nostr-tools/lib/cjs/wasm.js.map +7 -0
  403. package/node_modules/nostr-tools/lib/esm/abstract-pool.js +866 -0
  404. package/node_modules/nostr-tools/lib/esm/abstract-pool.js.map +7 -0
  405. package/node_modules/nostr-tools/lib/esm/abstract-relay.js +573 -0
  406. package/node_modules/nostr-tools/lib/esm/abstract-relay.js.map +7 -0
  407. package/node_modules/nostr-tools/lib/esm/core.js +42 -0
  408. package/node_modules/nostr-tools/lib/esm/core.js.map +7 -0
  409. package/node_modules/nostr-tools/lib/esm/fakejson.js +45 -0
  410. package/node_modules/nostr-tools/lib/esm/fakejson.js.map +7 -0
  411. package/node_modules/nostr-tools/lib/esm/filter.js +88 -0
  412. package/node_modules/nostr-tools/lib/esm/filter.js.map +7 -0
  413. package/node_modules/nostr-tools/lib/esm/index.js +3649 -0
  414. package/node_modules/nostr-tools/lib/esm/index.js.map +7 -0
  415. package/node_modules/nostr-tools/lib/esm/kinds.js +250 -0
  416. package/node_modules/nostr-tools/lib/esm/kinds.js.map +7 -0
  417. package/node_modules/nostr-tools/lib/esm/nip04.js +40 -0
  418. package/node_modules/nostr-tools/lib/esm/nip04.js.map +7 -0
  419. package/node_modules/nostr-tools/lib/esm/nip05.js +55 -0
  420. package/node_modules/nostr-tools/lib/esm/nip05.js.map +7 -0
  421. package/node_modules/nostr-tools/lib/esm/nip06.js +61 -0
  422. package/node_modules/nostr-tools/lib/esm/nip06.js.map +7 -0
  423. package/node_modules/nostr-tools/lib/esm/nip07.js +0 -0
  424. package/node_modules/nostr-tools/lib/esm/nip07.js.map +7 -0
  425. package/node_modules/nostr-tools/lib/esm/nip10.js +103 -0
  426. package/node_modules/nostr-tools/lib/esm/nip10.js.map +7 -0
  427. package/node_modules/nostr-tools/lib/esm/nip11.js +18 -0
  428. package/node_modules/nostr-tools/lib/esm/nip11.js.map +7 -0
  429. package/node_modules/nostr-tools/lib/esm/nip13.js +62 -0
  430. package/node_modules/nostr-tools/lib/esm/nip13.js.map +7 -0
  431. package/node_modules/nostr-tools/lib/esm/nip17.js +320 -0
  432. package/node_modules/nostr-tools/lib/esm/nip17.js.map +7 -0
  433. package/node_modules/nostr-tools/lib/esm/nip18.js +165 -0
  434. package/node_modules/nostr-tools/lib/esm/nip18.js.map +7 -0
  435. package/node_modules/nostr-tools/lib/esm/nip19.js +196 -0
  436. package/node_modules/nostr-tools/lib/esm/nip19.js.map +7 -0
  437. package/node_modules/nostr-tools/lib/esm/nip21.js +117 -0
  438. package/node_modules/nostr-tools/lib/esm/nip21.js.map +7 -0
  439. package/node_modules/nostr-tools/lib/esm/nip22.js +133 -0
  440. package/node_modules/nostr-tools/lib/esm/nip22.js.map +7 -0
  441. package/node_modules/nostr-tools/lib/esm/nip25.js +136 -0
  442. package/node_modules/nostr-tools/lib/esm/nip25.js.map +7 -0
  443. package/node_modules/nostr-tools/lib/esm/nip27.js +246 -0
  444. package/node_modules/nostr-tools/lib/esm/nip27.js.map +7 -0
  445. package/node_modules/nostr-tools/lib/esm/nip28.js +197 -0
  446. package/node_modules/nostr-tools/lib/esm/nip28.js.map +7 -0
  447. package/node_modules/nostr-tools/lib/esm/nip29.js +476 -0
  448. package/node_modules/nostr-tools/lib/esm/nip29.js.map +7 -0
  449. package/node_modules/nostr-tools/lib/esm/nip30.js +32 -0
  450. package/node_modules/nostr-tools/lib/esm/nip30.js.map +7 -0
  451. package/node_modules/nostr-tools/lib/esm/nip39.js +21 -0
  452. package/node_modules/nostr-tools/lib/esm/nip39.js.map +7 -0
  453. package/node_modules/nostr-tools/lib/esm/nip40.js +42 -0
  454. package/node_modules/nostr-tools/lib/esm/nip40.js.map +7 -0
  455. package/node_modules/nostr-tools/lib/esm/nip42.js +18 -0
  456. package/node_modules/nostr-tools/lib/esm/nip42.js.map +7 -0
  457. package/node_modules/nostr-tools/lib/esm/nip44.js +146 -0
  458. package/node_modules/nostr-tools/lib/esm/nip44.js.map +7 -0
  459. package/node_modules/nostr-tools/lib/esm/nip46.js +1432 -0
  460. package/node_modules/nostr-tools/lib/esm/nip46.js.map +7 -0
  461. package/node_modules/nostr-tools/lib/esm/nip47.js +145 -0
  462. package/node_modules/nostr-tools/lib/esm/nip47.js.map +7 -0
  463. package/node_modules/nostr-tools/lib/esm/nip49.js +56 -0
  464. package/node_modules/nostr-tools/lib/esm/nip49.js.map +7 -0
  465. package/node_modules/nostr-tools/lib/esm/nip54.js +14 -0
  466. package/node_modules/nostr-tools/lib/esm/nip54.js.map +7 -0
  467. package/node_modules/nostr-tools/lib/esm/nip55.js +82 -0
  468. package/node_modules/nostr-tools/lib/esm/nip55.js.map +7 -0
  469. package/node_modules/nostr-tools/lib/esm/nip57.js +253 -0
  470. package/node_modules/nostr-tools/lib/esm/nip57.js.map +7 -0
  471. package/node_modules/nostr-tools/lib/esm/nip58.js +94 -0
  472. package/node_modules/nostr-tools/lib/esm/nip58.js.map +7 -0
  473. package/node_modules/nostr-tools/lib/esm/nip59.js +297 -0
  474. package/node_modules/nostr-tools/lib/esm/nip59.js.map +7 -0
  475. package/node_modules/nostr-tools/lib/esm/nip75.js +47 -0
  476. package/node_modules/nostr-tools/lib/esm/nip75.js.map +7 -0
  477. package/node_modules/nostr-tools/lib/esm/nip77.js +498 -0
  478. package/node_modules/nostr-tools/lib/esm/nip77.js.map +7 -0
  479. package/node_modules/nostr-tools/lib/esm/nip94.js +119 -0
  480. package/node_modules/nostr-tools/lib/esm/nip94.js.map +7 -0
  481. package/node_modules/nostr-tools/lib/esm/nip98.js +209 -0
  482. package/node_modules/nostr-tools/lib/esm/nip98.js.map +7 -0
  483. package/node_modules/nostr-tools/lib/esm/nip99.js +130 -0
  484. package/node_modules/nostr-tools/lib/esm/nip99.js.map +7 -0
  485. package/node_modules/nostr-tools/lib/esm/nipb7.js +163 -0
  486. package/node_modules/nostr-tools/lib/esm/nipb7.js.map +7 -0
  487. package/node_modules/nostr-tools/lib/esm/pool.js +966 -0
  488. package/node_modules/nostr-tools/lib/esm/pool.js.map +7 -0
  489. package/node_modules/nostr-tools/lib/esm/pure.js +109 -0
  490. package/node_modules/nostr-tools/lib/esm/pure.js.map +7 -0
  491. package/node_modules/nostr-tools/lib/esm/references.js +187 -0
  492. package/node_modules/nostr-tools/lib/esm/references.js.map +7 -0
  493. package/node_modules/nostr-tools/lib/esm/relay.js +681 -0
  494. package/node_modules/nostr-tools/lib/esm/relay.js.map +7 -0
  495. package/node_modules/nostr-tools/lib/esm/signer.js +107 -0
  496. package/node_modules/nostr-tools/lib/esm/signer.js.map +7 -0
  497. package/node_modules/nostr-tools/lib/esm/utils.js +129 -0
  498. package/node_modules/nostr-tools/lib/esm/utils.js.map +7 -0
  499. package/node_modules/nostr-tools/lib/esm/wasm.js +82 -0
  500. package/node_modules/nostr-tools/lib/esm/wasm.js.map +7 -0
  501. package/node_modules/nostr-tools/lib/nostr.bundle.js +7336 -0
  502. package/node_modules/nostr-tools/lib/nostr.bundle.js.map +7 -0
  503. package/node_modules/nostr-tools/lib/types/abstract-pool.d.ts +60 -0
  504. package/node_modules/nostr-tools/lib/types/abstract-relay.d.ts +110 -0
  505. package/node_modules/nostr-tools/lib/types/benchmarks.d.ts +1 -0
  506. package/node_modules/nostr-tools/lib/types/core.d.ts +32 -0
  507. package/node_modules/nostr-tools/lib/types/core.test.d.ts +1 -0
  508. package/node_modules/nostr-tools/lib/types/fakejson.d.ts +6 -0
  509. package/node_modules/nostr-tools/lib/types/fakejson.test.d.ts +1 -0
  510. package/node_modules/nostr-tools/lib/types/filter.d.ts +19 -0
  511. package/node_modules/nostr-tools/lib/types/filter.test.d.ts +1 -0
  512. package/node_modules/nostr-tools/lib/types/helpers.d.ts +2 -0
  513. package/node_modules/nostr-tools/lib/types/index.d.ts +31 -0
  514. package/node_modules/nostr-tools/lib/types/kinds.d.ts +200 -0
  515. package/node_modules/nostr-tools/lib/types/kinds.test.d.ts +1 -0
  516. package/node_modules/nostr-tools/lib/types/nip04.d.ts +2 -0
  517. package/node_modules/nostr-tools/lib/types/nip04.test.d.ts +1 -0
  518. package/node_modules/nostr-tools/lib/types/nip05.d.ts +17 -0
  519. package/node_modules/nostr-tools/lib/types/nip05.test.d.ts +1 -0
  520. package/node_modules/nostr-tools/lib/types/nip06.d.ts +15 -0
  521. package/node_modules/nostr-tools/lib/types/nip06.test.d.ts +1 -0
  522. package/node_modules/nostr-tools/lib/types/nip07.d.ts +13 -0
  523. package/node_modules/nostr-tools/lib/types/nip10.d.ts +24 -0
  524. package/node_modules/nostr-tools/lib/types/nip10.test.d.ts +1 -0
  525. package/node_modules/nostr-tools/lib/types/nip11.d.ts +266 -0
  526. package/node_modules/nostr-tools/lib/types/nip11.test.d.ts +1 -0
  527. package/node_modules/nostr-tools/lib/types/nip13.d.ts +8 -0
  528. package/node_modules/nostr-tools/lib/types/nip13.test.d.ts +1 -0
  529. package/node_modules/nostr-tools/lib/types/nip17.d.ts +15 -0
  530. package/node_modules/nostr-tools/lib/types/nip17.test.d.ts +1 -0
  531. package/node_modules/nostr-tools/lib/types/nip18.d.ts +22 -0
  532. package/node_modules/nostr-tools/lib/types/nip18.test.d.ts +1 -0
  533. package/node_modules/nostr-tools/lib/types/nip19.d.ts +81 -0
  534. package/node_modules/nostr-tools/lib/types/nip19.test.d.ts +1 -0
  535. package/node_modules/nostr-tools/lib/types/nip21.d.ts +34 -0
  536. package/node_modules/nostr-tools/lib/types/nip21.test.d.ts +1 -0
  537. package/node_modules/nostr-tools/lib/types/nip22.d.ts +36 -0
  538. package/node_modules/nostr-tools/lib/types/nip22.test.d.ts +1 -0
  539. package/node_modules/nostr-tools/lib/types/nip25.d.ts +15 -0
  540. package/node_modules/nostr-tools/lib/types/nip25.test.d.ts +1 -0
  541. package/node_modules/nostr-tools/lib/types/nip27.d.ts +32 -0
  542. package/node_modules/nostr-tools/lib/types/nip27.test.d.ts +1 -0
  543. package/node_modules/nostr-tools/lib/types/nip28.d.ts +46 -0
  544. package/node_modules/nostr-tools/lib/types/nip28.test.d.ts +1 -0
  545. package/node_modules/nostr-tools/lib/types/nip29.d.ts +265 -0
  546. package/node_modules/nostr-tools/lib/types/nip30.d.ts +22 -0
  547. package/node_modules/nostr-tools/lib/types/nip30.test.d.ts +1 -0
  548. package/node_modules/nostr-tools/lib/types/nip39.d.ts +2 -0
  549. package/node_modules/nostr-tools/lib/types/nip39.test.d.ts +1 -0
  550. package/node_modules/nostr-tools/lib/types/nip40.d.ts +10 -0
  551. package/node_modules/nostr-tools/lib/types/nip40.test.d.ts +1 -0
  552. package/node_modules/nostr-tools/lib/types/nip42.d.ts +5 -0
  553. package/node_modules/nostr-tools/lib/types/nip42.test.d.ts +1 -0
  554. package/node_modules/nostr-tools/lib/types/nip44.d.ts +18 -0
  555. package/node_modules/nostr-tools/lib/types/nip44.test.d.ts +1 -0
  556. package/node_modules/nostr-tools/lib/types/nip46.d.ts +119 -0
  557. package/node_modules/nostr-tools/lib/types/nip47.d.ts +11 -0
  558. package/node_modules/nostr-tools/lib/types/nip47.test.d.ts +1 -0
  559. package/node_modules/nostr-tools/lib/types/nip49.d.ts +3 -0
  560. package/node_modules/nostr-tools/lib/types/nip49.test.d.ts +1 -0
  561. package/node_modules/nostr-tools/lib/types/nip54.d.ts +1 -0
  562. package/node_modules/nostr-tools/lib/types/nip54.test.d.ts +1 -0
  563. package/node_modules/nostr-tools/lib/types/nip55.d.ts +30 -0
  564. package/node_modules/nostr-tools/lib/types/nip55.test.d.ts +1 -0
  565. package/node_modules/nostr-tools/lib/types/nip57.d.ts +25 -0
  566. package/node_modules/nostr-tools/lib/types/nip57.test.d.ts +1 -0
  567. package/node_modules/nostr-tools/lib/types/nip58.d.ts +134 -0
  568. package/node_modules/nostr-tools/lib/types/nip58.test.d.ts +1 -0
  569. package/node_modules/nostr-tools/lib/types/nip59.d.ts +12 -0
  570. package/node_modules/nostr-tools/lib/types/nip59.test.d.ts +1 -0
  571. package/node_modules/nostr-tools/lib/types/nip75.d.ts +61 -0
  572. package/node_modules/nostr-tools/lib/types/nip75.test.d.ts +1 -0
  573. package/node_modules/nostr-tools/lib/types/nip77.d.ts +102 -0
  574. package/node_modules/nostr-tools/lib/types/nip77.test.d.ts +1 -0
  575. package/node_modules/nostr-tools/lib/types/nip94.d.ts +87 -0
  576. package/node_modules/nostr-tools/lib/types/nip94.test.d.ts +1 -0
  577. package/node_modules/nostr-tools/lib/types/nip98.d.ts +74 -0
  578. package/node_modules/nostr-tools/lib/types/nip98.test.d.ts +1 -0
  579. package/node_modules/nostr-tools/lib/types/nip99.d.ts +92 -0
  580. package/node_modules/nostr-tools/lib/types/nip99.test.d.ts +1 -0
  581. package/node_modules/nostr-tools/lib/types/nipb7.d.ts +23 -0
  582. package/node_modules/nostr-tools/lib/types/nipb7.test.d.ts +1 -0
  583. package/node_modules/nostr-tools/lib/types/pool.d.ts +6 -0
  584. package/node_modules/nostr-tools/lib/types/pool.test.d.ts +1 -0
  585. package/node_modules/nostr-tools/lib/types/pure.d.ts +8 -0
  586. package/node_modules/nostr-tools/lib/types/pure.test.d.ts +1 -0
  587. package/node_modules/nostr-tools/lib/types/references.d.ts +10 -0
  588. package/node_modules/nostr-tools/lib/types/references.test.d.ts +1 -0
  589. package/node_modules/nostr-tools/lib/types/relay.d.ts +11 -0
  590. package/node_modules/nostr-tools/lib/types/relay.test.d.ts +1 -0
  591. package/node_modules/nostr-tools/lib/types/signer.d.ts +11 -0
  592. package/node_modules/nostr-tools/lib/types/test-helpers.d.ts +14 -0
  593. package/node_modules/nostr-tools/lib/types/utils.d.ts +9 -0
  594. package/node_modules/nostr-tools/lib/types/utils.test.d.ts +1 -0
  595. package/node_modules/nostr-tools/lib/types/wasm.d.ts +8 -0
  596. package/node_modules/nostr-tools/package.json +330 -0
  597. package/node_modules/nostr-wasm/README.md +91 -0
  598. package/node_modules/nostr-wasm/dist/api/emsimp.d.ts +3 -0
  599. package/node_modules/nostr-wasm/dist/api/nostr.d.ts +45 -0
  600. package/node_modules/nostr-wasm/dist/api/secp256k1-types.d.ts +124 -0
  601. package/node_modules/nostr-wasm/dist/api/secp256k1.d.ts +41 -0
  602. package/node_modules/nostr-wasm/dist/api/types.d.ts +124 -0
  603. package/node_modules/nostr-wasm/dist/api/wasm-env.d.ts +3 -0
  604. package/node_modules/nostr-wasm/dist/gen/wasm.d.ts +27 -0
  605. package/node_modules/nostr-wasm/dist/generate.d.ts +1 -0
  606. package/node_modules/nostr-wasm/dist/gzipped.d.ts +3 -0
  607. package/node_modules/nostr-wasm/dist/gzipped.js +44 -0
  608. package/node_modules/nostr-wasm/dist/headless.d.ts +2 -0
  609. package/node_modules/nostr-wasm/dist/main.d.ts +3 -0
  610. package/node_modules/nostr-wasm/dist/main.js +9 -0
  611. package/node_modules/nostr-wasm/dist/nostr.js +248 -0
  612. package/node_modules/nostr-wasm/dist/secp256k1.js +230 -0
  613. package/node_modules/nostr-wasm/dist/types.d.ts +22 -0
  614. package/node_modules/nostr-wasm/package.json +37 -0
  615. package/node_modules/nostr-wasm/public/out/secp256k1.js +1 -0
  616. package/node_modules/nostr-wasm/public/out/secp256k1.wasm +0 -0
  617. package/node_modules/zod/LICENSE +21 -0
  618. package/node_modules/zod/README.md +191 -0
  619. package/node_modules/zod/index.cjs +33 -0
  620. package/node_modules/zod/index.d.cts +4 -0
  621. package/node_modules/zod/index.d.ts +4 -0
  622. package/node_modules/zod/index.js +4 -0
  623. package/node_modules/zod/locales/index.cjs +17 -0
  624. package/node_modules/zod/locales/index.d.cts +1 -0
  625. package/node_modules/zod/locales/index.d.ts +1 -0
  626. package/node_modules/zod/locales/index.js +1 -0
  627. package/node_modules/zod/locales/package.json +7 -0
  628. package/node_modules/zod/mini/index.cjs +32 -0
  629. package/node_modules/zod/mini/index.d.cts +3 -0
  630. package/node_modules/zod/mini/index.d.ts +3 -0
  631. package/node_modules/zod/mini/index.js +3 -0
  632. package/node_modules/zod/mini/package.json +7 -0
  633. package/node_modules/zod/package.json +135 -0
  634. package/node_modules/zod/src/index.ts +4 -0
  635. package/node_modules/zod/src/locales/index.ts +1 -0
  636. package/node_modules/zod/src/mini/index.ts +3 -0
  637. package/node_modules/zod/src/v3/ZodError.ts +330 -0
  638. package/node_modules/zod/src/v3/benchmarks/datetime.ts +58 -0
  639. package/node_modules/zod/src/v3/benchmarks/discriminatedUnion.ts +80 -0
  640. package/node_modules/zod/src/v3/benchmarks/index.ts +59 -0
  641. package/node_modules/zod/src/v3/benchmarks/ipv4.ts +57 -0
  642. package/node_modules/zod/src/v3/benchmarks/object.ts +69 -0
  643. package/node_modules/zod/src/v3/benchmarks/primitives.ts +162 -0
  644. package/node_modules/zod/src/v3/benchmarks/realworld.ts +63 -0
  645. package/node_modules/zod/src/v3/benchmarks/string.ts +55 -0
  646. package/node_modules/zod/src/v3/benchmarks/union.ts +80 -0
  647. package/node_modules/zod/src/v3/errors.ts +13 -0
  648. package/node_modules/zod/src/v3/external.ts +6 -0
  649. package/node_modules/zod/src/v3/helpers/enumUtil.ts +17 -0
  650. package/node_modules/zod/src/v3/helpers/errorUtil.ts +8 -0
  651. package/node_modules/zod/src/v3/helpers/parseUtil.ts +176 -0
  652. package/node_modules/zod/src/v3/helpers/partialUtil.ts +34 -0
  653. package/node_modules/zod/src/v3/helpers/typeAliases.ts +2 -0
  654. package/node_modules/zod/src/v3/helpers/util.ts +224 -0
  655. package/node_modules/zod/src/v3/index.ts +4 -0
  656. package/node_modules/zod/src/v3/locales/en.ts +124 -0
  657. package/node_modules/zod/src/v3/standard-schema.ts +113 -0
  658. package/node_modules/zod/src/v3/tests/Mocker.ts +54 -0
  659. package/node_modules/zod/src/v3/tests/all-errors.test.ts +157 -0
  660. package/node_modules/zod/src/v3/tests/anyunknown.test.ts +28 -0
  661. package/node_modules/zod/src/v3/tests/array.test.ts +71 -0
  662. package/node_modules/zod/src/v3/tests/async-parsing.test.ts +388 -0
  663. package/node_modules/zod/src/v3/tests/async-refinements.test.ts +46 -0
  664. package/node_modules/zod/src/v3/tests/base.test.ts +29 -0
  665. package/node_modules/zod/src/v3/tests/bigint.test.ts +55 -0
  666. package/node_modules/zod/src/v3/tests/branded.test.ts +53 -0
  667. package/node_modules/zod/src/v3/tests/catch.test.ts +220 -0
  668. package/node_modules/zod/src/v3/tests/coerce.test.ts +133 -0
  669. package/node_modules/zod/src/v3/tests/complex.test.ts +70 -0
  670. package/node_modules/zod/src/v3/tests/custom.test.ts +31 -0
  671. package/node_modules/zod/src/v3/tests/date.test.ts +32 -0
  672. package/node_modules/zod/src/v3/tests/deepmasking.test.ts +186 -0
  673. package/node_modules/zod/src/v3/tests/default.test.ts +112 -0
  674. package/node_modules/zod/src/v3/tests/description.test.ts +33 -0
  675. package/node_modules/zod/src/v3/tests/discriminated-unions.test.ts +315 -0
  676. package/node_modules/zod/src/v3/tests/enum.test.ts +80 -0
  677. package/node_modules/zod/src/v3/tests/error.test.ts +551 -0
  678. package/node_modules/zod/src/v3/tests/firstparty.test.ts +87 -0
  679. package/node_modules/zod/src/v3/tests/firstpartyschematypes.test.ts +21 -0
  680. package/node_modules/zod/src/v3/tests/function.test.ts +261 -0
  681. package/node_modules/zod/src/v3/tests/generics.test.ts +48 -0
  682. package/node_modules/zod/src/v3/tests/instanceof.test.ts +37 -0
  683. package/node_modules/zod/src/v3/tests/intersection.test.ts +110 -0
  684. package/node_modules/zod/src/v3/tests/language-server.source.ts +76 -0
  685. package/node_modules/zod/src/v3/tests/language-server.test.ts +207 -0
  686. package/node_modules/zod/src/v3/tests/literal.test.ts +36 -0
  687. package/node_modules/zod/src/v3/tests/map.test.ts +110 -0
  688. package/node_modules/zod/src/v3/tests/masking.test.ts +4 -0
  689. package/node_modules/zod/src/v3/tests/mocker.test.ts +19 -0
  690. package/node_modules/zod/src/v3/tests/nan.test.ts +24 -0
  691. package/node_modules/zod/src/v3/tests/nativeEnum.test.ts +87 -0
  692. package/node_modules/zod/src/v3/tests/nullable.test.ts +42 -0
  693. package/node_modules/zod/src/v3/tests/number.test.ts +176 -0
  694. package/node_modules/zod/src/v3/tests/object-augmentation.test.ts +29 -0
  695. package/node_modules/zod/src/v3/tests/object-in-es5-env.test.ts +29 -0
  696. package/node_modules/zod/src/v3/tests/object.test.ts +434 -0
  697. package/node_modules/zod/src/v3/tests/optional.test.ts +42 -0
  698. package/node_modules/zod/src/v3/tests/parseUtil.test.ts +23 -0
  699. package/node_modules/zod/src/v3/tests/parser.test.ts +41 -0
  700. package/node_modules/zod/src/v3/tests/partials.test.ts +243 -0
  701. package/node_modules/zod/src/v3/tests/pickomit.test.ts +111 -0
  702. package/node_modules/zod/src/v3/tests/pipeline.test.ts +29 -0
  703. package/node_modules/zod/src/v3/tests/preprocess.test.ts +186 -0
  704. package/node_modules/zod/src/v3/tests/primitive.test.ts +440 -0
  705. package/node_modules/zod/src/v3/tests/promise.test.ts +90 -0
  706. package/node_modules/zod/src/v3/tests/readonly.test.ts +194 -0
  707. package/node_modules/zod/src/v3/tests/record.test.ts +171 -0
  708. package/node_modules/zod/src/v3/tests/recursive.test.ts +197 -0
  709. package/node_modules/zod/src/v3/tests/refine.test.ts +313 -0
  710. package/node_modules/zod/src/v3/tests/safeparse.test.ts +27 -0
  711. package/node_modules/zod/src/v3/tests/set.test.ts +142 -0
  712. package/node_modules/zod/src/v3/tests/standard-schema.test.ts +83 -0
  713. package/node_modules/zod/src/v3/tests/string.test.ts +916 -0
  714. package/node_modules/zod/src/v3/tests/transformer.test.ts +233 -0
  715. package/node_modules/zod/src/v3/tests/tuple.test.ts +90 -0
  716. package/node_modules/zod/src/v3/tests/unions.test.ts +57 -0
  717. package/node_modules/zod/src/v3/tests/validations.test.ts +133 -0
  718. package/node_modules/zod/src/v3/tests/void.test.ts +15 -0
  719. package/node_modules/zod/src/v3/types.ts +5138 -0
  720. package/node_modules/zod/src/v4/classic/checks.ts +32 -0
  721. package/node_modules/zod/src/v4/classic/coerce.ts +27 -0
  722. package/node_modules/zod/src/v4/classic/compat.ts +70 -0
  723. package/node_modules/zod/src/v4/classic/errors.ts +82 -0
  724. package/node_modules/zod/src/v4/classic/external.ts +52 -0
  725. package/node_modules/zod/src/v4/classic/from-json-schema.ts +659 -0
  726. package/node_modules/zod/src/v4/classic/index.ts +5 -0
  727. package/node_modules/zod/src/v4/classic/iso.ts +90 -0
  728. package/node_modules/zod/src/v4/classic/parse.ts +82 -0
  729. package/node_modules/zod/src/v4/classic/schemas.ts +2672 -0
  730. package/node_modules/zod/src/v4/classic/tests/anyunknown.test.ts +26 -0
  731. package/node_modules/zod/src/v4/classic/tests/apply.test.ts +59 -0
  732. package/node_modules/zod/src/v4/classic/tests/array.test.ts +264 -0
  733. package/node_modules/zod/src/v4/classic/tests/assignability.test.ts +216 -0
  734. package/node_modules/zod/src/v4/classic/tests/async-parsing.test.ts +381 -0
  735. package/node_modules/zod/src/v4/classic/tests/async-refinements.test.ts +68 -0
  736. package/node_modules/zod/src/v4/classic/tests/base.test.ts +7 -0
  737. package/node_modules/zod/src/v4/classic/tests/bigint.test.ts +54 -0
  738. package/node_modules/zod/src/v4/classic/tests/brand.test.ts +106 -0
  739. package/node_modules/zod/src/v4/classic/tests/catch.test.ts +326 -0
  740. package/node_modules/zod/src/v4/classic/tests/coalesce.test.ts +20 -0
  741. package/node_modules/zod/src/v4/classic/tests/codec-examples.test.ts +573 -0
  742. package/node_modules/zod/src/v4/classic/tests/codec.test.ts +703 -0
  743. package/node_modules/zod/src/v4/classic/tests/coerce.test.ts +160 -0
  744. package/node_modules/zod/src/v4/classic/tests/continuability.test.ts +374 -0
  745. package/node_modules/zod/src/v4/classic/tests/custom.test.ts +40 -0
  746. package/node_modules/zod/src/v4/classic/tests/date.test.ts +62 -0
  747. package/node_modules/zod/src/v4/classic/tests/datetime.test.ts +302 -0
  748. package/node_modules/zod/src/v4/classic/tests/default.test.ts +409 -0
  749. package/node_modules/zod/src/v4/classic/tests/describe-meta-checks.test.ts +27 -0
  750. package/node_modules/zod/src/v4/classic/tests/description.test.ts +32 -0
  751. package/node_modules/zod/src/v4/classic/tests/detached-methods.test.ts +197 -0
  752. package/node_modules/zod/src/v4/classic/tests/discriminated-unions.test.ts +694 -0
  753. package/node_modules/zod/src/v4/classic/tests/enum.test.ts +285 -0
  754. package/node_modules/zod/src/v4/classic/tests/error-utils.test.ts +807 -0
  755. package/node_modules/zod/src/v4/classic/tests/error.test.ts +711 -0
  756. package/node_modules/zod/src/v4/classic/tests/file.test.ts +96 -0
  757. package/node_modules/zod/src/v4/classic/tests/firstparty.test.ts +179 -0
  758. package/node_modules/zod/src/v4/classic/tests/fix-json-issue.test.ts +26 -0
  759. package/node_modules/zod/src/v4/classic/tests/from-json-schema.test.ts +895 -0
  760. package/node_modules/zod/src/v4/classic/tests/function.test.ts +360 -0
  761. package/node_modules/zod/src/v4/classic/tests/generics.test.ts +72 -0
  762. package/node_modules/zod/src/v4/classic/tests/global-config.test.ts +39 -0
  763. package/node_modules/zod/src/v4/classic/tests/hash.test.ts +68 -0
  764. package/node_modules/zod/src/v4/classic/tests/index.test.ts +939 -0
  765. package/node_modules/zod/src/v4/classic/tests/instanceof.test.ts +60 -0
  766. package/node_modules/zod/src/v4/classic/tests/intersection.test.ts +198 -0
  767. package/node_modules/zod/src/v4/classic/tests/jitless-allows-eval.test.ts +46 -0
  768. package/node_modules/zod/src/v4/classic/tests/json.test.ts +109 -0
  769. package/node_modules/zod/src/v4/classic/tests/lazy.test.ts +227 -0
  770. package/node_modules/zod/src/v4/classic/tests/literal.test.ts +117 -0
  771. package/node_modules/zod/src/v4/classic/tests/locales_ka.test.ts +29 -0
  772. package/node_modules/zod/src/v4/classic/tests/locales_ro.test.ts +24 -0
  773. package/node_modules/zod/src/v4/classic/tests/map.test.ts +330 -0
  774. package/node_modules/zod/src/v4/classic/tests/nan.test.ts +21 -0
  775. package/node_modules/zod/src/v4/classic/tests/nested-refine.test.ts +168 -0
  776. package/node_modules/zod/src/v4/classic/tests/nonoptional.test.ts +101 -0
  777. package/node_modules/zod/src/v4/classic/tests/nullable.test.ts +22 -0
  778. package/node_modules/zod/src/v4/classic/tests/number.test.ts +325 -0
  779. package/node_modules/zod/src/v4/classic/tests/object.test.ts +717 -0
  780. package/node_modules/zod/src/v4/classic/tests/optional.test.ts +333 -0
  781. package/node_modules/zod/src/v4/classic/tests/partial.test.ts +450 -0
  782. package/node_modules/zod/src/v4/classic/tests/pickomit.test.ts +211 -0
  783. package/node_modules/zod/src/v4/classic/tests/pipe.test.ts +101 -0
  784. package/node_modules/zod/src/v4/classic/tests/prefault.test.ts +74 -0
  785. package/node_modules/zod/src/v4/classic/tests/preprocess-types.test.ts +26 -0
  786. package/node_modules/zod/src/v4/classic/tests/preprocess.test.ts +351 -0
  787. package/node_modules/zod/src/v4/classic/tests/primitive.test.ts +175 -0
  788. package/node_modules/zod/src/v4/classic/tests/promise.test.ts +81 -0
  789. package/node_modules/zod/src/v4/classic/tests/prototypes.test.ts +23 -0
  790. package/node_modules/zod/src/v4/classic/tests/readonly.test.ts +252 -0
  791. package/node_modules/zod/src/v4/classic/tests/record.test.ts +717 -0
  792. package/node_modules/zod/src/v4/classic/tests/recursive-types.test.ts +631 -0
  793. package/node_modules/zod/src/v4/classic/tests/refine.test.ts +633 -0
  794. package/node_modules/zod/src/v4/classic/tests/registries.test.ts +243 -0
  795. package/node_modules/zod/src/v4/classic/tests/set.test.ts +181 -0
  796. package/node_modules/zod/src/v4/classic/tests/standard-schema.test.ts +134 -0
  797. package/node_modules/zod/src/v4/classic/tests/string-formats.test.ts +125 -0
  798. package/node_modules/zod/src/v4/classic/tests/string.test.ts +1224 -0
  799. package/node_modules/zod/src/v4/classic/tests/stringbool.test.ts +106 -0
  800. package/node_modules/zod/src/v4/classic/tests/template-literal.test.ts +771 -0
  801. package/node_modules/zod/src/v4/classic/tests/to-json-schema-methods.test.ts +438 -0
  802. package/node_modules/zod/src/v4/classic/tests/to-json-schema.test.ts +3125 -0
  803. package/node_modules/zod/src/v4/classic/tests/transform.test.ts +378 -0
  804. package/node_modules/zod/src/v4/classic/tests/tuple.test.ts +496 -0
  805. package/node_modules/zod/src/v4/classic/tests/union.test.ts +273 -0
  806. package/node_modules/zod/src/v4/classic/tests/url.test.ts +13 -0
  807. package/node_modules/zod/src/v4/classic/tests/validations.test.ts +283 -0
  808. package/node_modules/zod/src/v4/classic/tests/void.test.ts +12 -0
  809. package/node_modules/zod/src/v4/core/api.ts +1823 -0
  810. package/node_modules/zod/src/v4/core/checks.ts +1293 -0
  811. package/node_modules/zod/src/v4/core/config.ts +15 -0
  812. package/node_modules/zod/src/v4/core/core.ts +153 -0
  813. package/node_modules/zod/src/v4/core/doc.ts +44 -0
  814. package/node_modules/zod/src/v4/core/errors.ts +455 -0
  815. package/node_modules/zod/src/v4/core/index.ts +16 -0
  816. package/node_modules/zod/src/v4/core/json-schema-generator.ts +126 -0
  817. package/node_modules/zod/src/v4/core/json-schema-processors.ts +666 -0
  818. package/node_modules/zod/src/v4/core/json-schema.ts +147 -0
  819. package/node_modules/zod/src/v4/core/parse.ts +195 -0
  820. package/node_modules/zod/src/v4/core/regexes.ts +190 -0
  821. package/node_modules/zod/src/v4/core/registries.ts +105 -0
  822. package/node_modules/zod/src/v4/core/schemas.ts +4730 -0
  823. package/node_modules/zod/src/v4/core/standard-schema.ts +159 -0
  824. package/node_modules/zod/src/v4/core/tests/extend.test.ts +59 -0
  825. package/node_modules/zod/src/v4/core/tests/index.test.ts +46 -0
  826. package/node_modules/zod/src/v4/core/tests/locales/be.test.ts +124 -0
  827. package/node_modules/zod/src/v4/core/tests/locales/el.test.ts +215 -0
  828. package/node_modules/zod/src/v4/core/tests/locales/en.test.ts +22 -0
  829. package/node_modules/zod/src/v4/core/tests/locales/es.test.ts +181 -0
  830. package/node_modules/zod/src/v4/core/tests/locales/fr.test.ts +72 -0
  831. package/node_modules/zod/src/v4/core/tests/locales/he.test.ts +379 -0
  832. package/node_modules/zod/src/v4/core/tests/locales/hr.test.ts +163 -0
  833. package/node_modules/zod/src/v4/core/tests/locales/nl.test.ts +46 -0
  834. package/node_modules/zod/src/v4/core/tests/locales/ru.test.ts +128 -0
  835. package/node_modules/zod/src/v4/core/tests/locales/tr.test.ts +69 -0
  836. package/node_modules/zod/src/v4/core/tests/locales/uz.test.ts +105 -0
  837. package/node_modules/zod/src/v4/core/tests/record-constructor.test.ts +125 -0
  838. package/node_modules/zod/src/v4/core/tests/recursive-tuples.test.ts +45 -0
  839. package/node_modules/zod/src/v4/core/to-json-schema.ts +622 -0
  840. package/node_modules/zod/src/v4/core/util.ts +983 -0
  841. package/node_modules/zod/src/v4/core/versions.ts +5 -0
  842. package/node_modules/zod/src/v4/core/zsf.ts +323 -0
  843. package/node_modules/zod/src/v4/index.ts +4 -0
  844. package/node_modules/zod/src/v4/locales/ar.ts +115 -0
  845. package/node_modules/zod/src/v4/locales/az.ts +111 -0
  846. package/node_modules/zod/src/v4/locales/be.ts +176 -0
  847. package/node_modules/zod/src/v4/locales/bg.ts +128 -0
  848. package/node_modules/zod/src/v4/locales/ca.ts +116 -0
  849. package/node_modules/zod/src/v4/locales/cs.ts +118 -0
  850. package/node_modules/zod/src/v4/locales/da.ts +123 -0
  851. package/node_modules/zod/src/v4/locales/de.ts +116 -0
  852. package/node_modules/zod/src/v4/locales/el.ts +121 -0
  853. package/node_modules/zod/src/v4/locales/en.ts +123 -0
  854. package/node_modules/zod/src/v4/locales/eo.ts +118 -0
  855. package/node_modules/zod/src/v4/locales/es.ts +141 -0
  856. package/node_modules/zod/src/v4/locales/fa.ts +126 -0
  857. package/node_modules/zod/src/v4/locales/fi.ts +121 -0
  858. package/node_modules/zod/src/v4/locales/fr-CA.ts +116 -0
  859. package/node_modules/zod/src/v4/locales/fr.ts +132 -0
  860. package/node_modules/zod/src/v4/locales/he.ts +246 -0
  861. package/node_modules/zod/src/v4/locales/hr.ts +131 -0
  862. package/node_modules/zod/src/v4/locales/hu.ts +117 -0
  863. package/node_modules/zod/src/v4/locales/hy.ts +164 -0
  864. package/node_modules/zod/src/v4/locales/id.ts +115 -0
  865. package/node_modules/zod/src/v4/locales/index.ts +52 -0
  866. package/node_modules/zod/src/v4/locales/is.ts +119 -0
  867. package/node_modules/zod/src/v4/locales/it.ts +116 -0
  868. package/node_modules/zod/src/v4/locales/ja.ts +114 -0
  869. package/node_modules/zod/src/v4/locales/ka.ts +123 -0
  870. package/node_modules/zod/src/v4/locales/kh.ts +7 -0
  871. package/node_modules/zod/src/v4/locales/km.ts +119 -0
  872. package/node_modules/zod/src/v4/locales/ko.ts +121 -0
  873. package/node_modules/zod/src/v4/locales/lt.ts +239 -0
  874. package/node_modules/zod/src/v4/locales/mk.ts +118 -0
  875. package/node_modules/zod/src/v4/locales/ms.ts +115 -0
  876. package/node_modules/zod/src/v4/locales/nl.ts +121 -0
  877. package/node_modules/zod/src/v4/locales/no.ts +116 -0
  878. package/node_modules/zod/src/v4/locales/ota.ts +117 -0
  879. package/node_modules/zod/src/v4/locales/pl.ts +118 -0
  880. package/node_modules/zod/src/v4/locales/ps.ts +126 -0
  881. package/node_modules/zod/src/v4/locales/pt.ts +116 -0
  882. package/node_modules/zod/src/v4/locales/ro.ts +129 -0
  883. package/node_modules/zod/src/v4/locales/ru.ts +176 -0
  884. package/node_modules/zod/src/v4/locales/sl.ts +118 -0
  885. package/node_modules/zod/src/v4/locales/sv.ts +119 -0
  886. package/node_modules/zod/src/v4/locales/ta.ts +118 -0
  887. package/node_modules/zod/src/v4/locales/th.ts +119 -0
  888. package/node_modules/zod/src/v4/locales/tr.ts +111 -0
  889. package/node_modules/zod/src/v4/locales/ua.ts +7 -0
  890. package/node_modules/zod/src/v4/locales/uk.ts +117 -0
  891. package/node_modules/zod/src/v4/locales/ur.ts +119 -0
  892. package/node_modules/zod/src/v4/locales/uz.ts +117 -0
  893. package/node_modules/zod/src/v4/locales/vi.ts +117 -0
  894. package/node_modules/zod/src/v4/locales/yo.ts +124 -0
  895. package/node_modules/zod/src/v4/locales/zh-CN.ts +116 -0
  896. package/node_modules/zod/src/v4/locales/zh-TW.ts +115 -0
  897. package/node_modules/zod/src/v4/mini/checks.ts +32 -0
  898. package/node_modules/zod/src/v4/mini/coerce.ts +27 -0
  899. package/node_modules/zod/src/v4/mini/external.ts +41 -0
  900. package/node_modules/zod/src/v4/mini/index.ts +3 -0
  901. package/node_modules/zod/src/v4/mini/iso.ts +66 -0
  902. package/node_modules/zod/src/v4/mini/parse.ts +14 -0
  903. package/node_modules/zod/src/v4/mini/schemas.ts +1947 -0
  904. package/node_modules/zod/src/v4/mini/tests/apply.test.ts +24 -0
  905. package/node_modules/zod/src/v4/mini/tests/assignability.test.ts +129 -0
  906. package/node_modules/zod/src/v4/mini/tests/brand.test.ts +94 -0
  907. package/node_modules/zod/src/v4/mini/tests/checks.test.ts +144 -0
  908. package/node_modules/zod/src/v4/mini/tests/codec.test.ts +548 -0
  909. package/node_modules/zod/src/v4/mini/tests/computed.test.ts +36 -0
  910. package/node_modules/zod/src/v4/mini/tests/error.test.ts +22 -0
  911. package/node_modules/zod/src/v4/mini/tests/functions.test.ts +5 -0
  912. package/node_modules/zod/src/v4/mini/tests/index.test.ts +993 -0
  913. package/node_modules/zod/src/v4/mini/tests/number.test.ts +95 -0
  914. package/node_modules/zod/src/v4/mini/tests/object.test.ts +227 -0
  915. package/node_modules/zod/src/v4/mini/tests/prototypes.test.ts +43 -0
  916. package/node_modules/zod/src/v4/mini/tests/recursive-types.test.ts +325 -0
  917. package/node_modules/zod/src/v4/mini/tests/standard-schema.test.ts +50 -0
  918. package/node_modules/zod/src/v4/mini/tests/string.test.ts +352 -0
  919. package/node_modules/zod/src/v4-mini/index.ts +3 -0
  920. package/node_modules/zod/v3/ZodError.cjs +138 -0
  921. package/node_modules/zod/v3/ZodError.d.cts +164 -0
  922. package/node_modules/zod/v3/ZodError.d.ts +164 -0
  923. package/node_modules/zod/v3/ZodError.js +133 -0
  924. package/node_modules/zod/v3/errors.cjs +17 -0
  925. package/node_modules/zod/v3/errors.d.cts +5 -0
  926. package/node_modules/zod/v3/errors.d.ts +5 -0
  927. package/node_modules/zod/v3/errors.js +9 -0
  928. package/node_modules/zod/v3/external.cjs +22 -0
  929. package/node_modules/zod/v3/external.d.cts +6 -0
  930. package/node_modules/zod/v3/external.d.ts +6 -0
  931. package/node_modules/zod/v3/external.js +6 -0
  932. package/node_modules/zod/v3/helpers/enumUtil.cjs +2 -0
  933. package/node_modules/zod/v3/helpers/enumUtil.d.cts +8 -0
  934. package/node_modules/zod/v3/helpers/enumUtil.d.ts +8 -0
  935. package/node_modules/zod/v3/helpers/enumUtil.js +1 -0
  936. package/node_modules/zod/v3/helpers/errorUtil.cjs +9 -0
  937. package/node_modules/zod/v3/helpers/errorUtil.d.cts +9 -0
  938. package/node_modules/zod/v3/helpers/errorUtil.d.ts +9 -0
  939. package/node_modules/zod/v3/helpers/errorUtil.js +6 -0
  940. package/node_modules/zod/v3/helpers/parseUtil.cjs +124 -0
  941. package/node_modules/zod/v3/helpers/parseUtil.d.cts +78 -0
  942. package/node_modules/zod/v3/helpers/parseUtil.d.ts +78 -0
  943. package/node_modules/zod/v3/helpers/parseUtil.js +109 -0
  944. package/node_modules/zod/v3/helpers/partialUtil.cjs +2 -0
  945. package/node_modules/zod/v3/helpers/partialUtil.d.cts +8 -0
  946. package/node_modules/zod/v3/helpers/partialUtil.d.ts +8 -0
  947. package/node_modules/zod/v3/helpers/partialUtil.js +1 -0
  948. package/node_modules/zod/v3/helpers/typeAliases.cjs +2 -0
  949. package/node_modules/zod/v3/helpers/typeAliases.d.cts +2 -0
  950. package/node_modules/zod/v3/helpers/typeAliases.d.ts +2 -0
  951. package/node_modules/zod/v3/helpers/typeAliases.js +1 -0
  952. package/node_modules/zod/v3/helpers/util.cjs +137 -0
  953. package/node_modules/zod/v3/helpers/util.d.cts +85 -0
  954. package/node_modules/zod/v3/helpers/util.d.ts +85 -0
  955. package/node_modules/zod/v3/helpers/util.js +133 -0
  956. package/node_modules/zod/v3/index.cjs +33 -0
  957. package/node_modules/zod/v3/index.d.cts +4 -0
  958. package/node_modules/zod/v3/index.d.ts +4 -0
  959. package/node_modules/zod/v3/index.js +4 -0
  960. package/node_modules/zod/v3/locales/en.cjs +112 -0
  961. package/node_modules/zod/v3/locales/en.d.cts +3 -0
  962. package/node_modules/zod/v3/locales/en.d.ts +3 -0
  963. package/node_modules/zod/v3/locales/en.js +109 -0
  964. package/node_modules/zod/v3/package.json +7 -0
  965. package/node_modules/zod/v3/standard-schema.cjs +2 -0
  966. package/node_modules/zod/v3/standard-schema.d.cts +102 -0
  967. package/node_modules/zod/v3/standard-schema.d.ts +102 -0
  968. package/node_modules/zod/v3/standard-schema.js +1 -0
  969. package/node_modules/zod/v3/types.cjs +3777 -0
  970. package/node_modules/zod/v3/types.d.cts +1034 -0
  971. package/node_modules/zod/v3/types.d.ts +1034 -0
  972. package/node_modules/zod/v3/types.js +3695 -0
  973. package/node_modules/zod/v4/classic/checks.cjs +33 -0
  974. package/node_modules/zod/v4/classic/checks.d.cts +1 -0
  975. package/node_modules/zod/v4/classic/checks.d.ts +1 -0
  976. package/node_modules/zod/v4/classic/checks.js +1 -0
  977. package/node_modules/zod/v4/classic/coerce.cjs +47 -0
  978. package/node_modules/zod/v4/classic/coerce.d.cts +17 -0
  979. package/node_modules/zod/v4/classic/coerce.d.ts +17 -0
  980. package/node_modules/zod/v4/classic/coerce.js +17 -0
  981. package/node_modules/zod/v4/classic/compat.cjs +61 -0
  982. package/node_modules/zod/v4/classic/compat.d.cts +50 -0
  983. package/node_modules/zod/v4/classic/compat.d.ts +50 -0
  984. package/node_modules/zod/v4/classic/compat.js +31 -0
  985. package/node_modules/zod/v4/classic/errors.cjs +74 -0
  986. package/node_modules/zod/v4/classic/errors.d.cts +30 -0
  987. package/node_modules/zod/v4/classic/errors.d.ts +30 -0
  988. package/node_modules/zod/v4/classic/errors.js +48 -0
  989. package/node_modules/zod/v4/classic/external.cjs +73 -0
  990. package/node_modules/zod/v4/classic/external.d.cts +16 -0
  991. package/node_modules/zod/v4/classic/external.d.ts +16 -0
  992. package/node_modules/zod/v4/classic/external.js +20 -0
  993. package/node_modules/zod/v4/classic/from-json-schema.cjs +625 -0
  994. package/node_modules/zod/v4/classic/from-json-schema.d.cts +12 -0
  995. package/node_modules/zod/v4/classic/from-json-schema.d.ts +12 -0
  996. package/node_modules/zod/v4/classic/from-json-schema.js +599 -0
  997. package/node_modules/zod/v4/classic/index.cjs +33 -0
  998. package/node_modules/zod/v4/classic/index.d.cts +4 -0
  999. package/node_modules/zod/v4/classic/index.d.ts +4 -0
  1000. package/node_modules/zod/v4/classic/index.js +4 -0
  1001. package/node_modules/zod/v4/classic/iso.cjs +60 -0
  1002. package/node_modules/zod/v4/classic/iso.d.cts +22 -0
  1003. package/node_modules/zod/v4/classic/iso.d.ts +22 -0
  1004. package/node_modules/zod/v4/classic/iso.js +30 -0
  1005. package/node_modules/zod/v4/classic/package.json +7 -0
  1006. package/node_modules/zod/v4/classic/parse.cjs +41 -0
  1007. package/node_modules/zod/v4/classic/parse.d.cts +31 -0
  1008. package/node_modules/zod/v4/classic/parse.d.ts +31 -0
  1009. package/node_modules/zod/v4/classic/parse.js +15 -0
  1010. package/node_modules/zod/v4/classic/schemas.cjs +1511 -0
  1011. package/node_modules/zod/v4/classic/schemas.d.cts +767 -0
  1012. package/node_modules/zod/v4/classic/schemas.d.ts +767 -0
  1013. package/node_modules/zod/v4/classic/schemas.js +1395 -0
  1014. package/node_modules/zod/v4/core/api.cjs +1227 -0
  1015. package/node_modules/zod/v4/core/api.d.cts +325 -0
  1016. package/node_modules/zod/v4/core/api.d.ts +325 -0
  1017. package/node_modules/zod/v4/core/api.js +1087 -0
  1018. package/node_modules/zod/v4/core/checks.cjs +601 -0
  1019. package/node_modules/zod/v4/core/checks.d.cts +278 -0
  1020. package/node_modules/zod/v4/core/checks.d.ts +278 -0
  1021. package/node_modules/zod/v4/core/checks.js +575 -0
  1022. package/node_modules/zod/v4/core/core.cjs +85 -0
  1023. package/node_modules/zod/v4/core/core.d.cts +70 -0
  1024. package/node_modules/zod/v4/core/core.d.ts +70 -0
  1025. package/node_modules/zod/v4/core/core.js +78 -0
  1026. package/node_modules/zod/v4/core/doc.cjs +39 -0
  1027. package/node_modules/zod/v4/core/doc.d.cts +14 -0
  1028. package/node_modules/zod/v4/core/doc.d.ts +14 -0
  1029. package/node_modules/zod/v4/core/doc.js +35 -0
  1030. package/node_modules/zod/v4/core/errors.cjs +216 -0
  1031. package/node_modules/zod/v4/core/errors.d.cts +221 -0
  1032. package/node_modules/zod/v4/core/errors.d.ts +221 -0
  1033. package/node_modules/zod/v4/core/errors.js +185 -0
  1034. package/node_modules/zod/v4/core/index.cjs +47 -0
  1035. package/node_modules/zod/v4/core/index.d.cts +16 -0
  1036. package/node_modules/zod/v4/core/index.d.ts +16 -0
  1037. package/node_modules/zod/v4/core/index.js +16 -0
  1038. package/node_modules/zod/v4/core/json-schema-generator.cjs +99 -0
  1039. package/node_modules/zod/v4/core/json-schema-generator.d.cts +65 -0
  1040. package/node_modules/zod/v4/core/json-schema-generator.d.ts +65 -0
  1041. package/node_modules/zod/v4/core/json-schema-generator.js +95 -0
  1042. package/node_modules/zod/v4/core/json-schema-processors.cjs +644 -0
  1043. package/node_modules/zod/v4/core/json-schema-processors.d.cts +49 -0
  1044. package/node_modules/zod/v4/core/json-schema-processors.d.ts +49 -0
  1045. package/node_modules/zod/v4/core/json-schema-processors.js +601 -0
  1046. package/node_modules/zod/v4/core/json-schema.cjs +2 -0
  1047. package/node_modules/zod/v4/core/json-schema.d.cts +88 -0
  1048. package/node_modules/zod/v4/core/json-schema.d.ts +88 -0
  1049. package/node_modules/zod/v4/core/json-schema.js +1 -0
  1050. package/node_modules/zod/v4/core/package.json +7 -0
  1051. package/node_modules/zod/v4/core/parse.cjs +131 -0
  1052. package/node_modules/zod/v4/core/parse.d.cts +49 -0
  1053. package/node_modules/zod/v4/core/parse.d.ts +49 -0
  1054. package/node_modules/zod/v4/core/parse.js +93 -0
  1055. package/node_modules/zod/v4/core/regexes.cjs +172 -0
  1056. package/node_modules/zod/v4/core/regexes.d.cts +85 -0
  1057. package/node_modules/zod/v4/core/regexes.d.ts +85 -0
  1058. package/node_modules/zod/v4/core/regexes.js +139 -0
  1059. package/node_modules/zod/v4/core/registries.cjs +56 -0
  1060. package/node_modules/zod/v4/core/registries.d.cts +35 -0
  1061. package/node_modules/zod/v4/core/registries.d.ts +35 -0
  1062. package/node_modules/zod/v4/core/registries.js +51 -0
  1063. package/node_modules/zod/v4/core/schemas.cjs +2270 -0
  1064. package/node_modules/zod/v4/core/schemas.d.cts +1184 -0
  1065. package/node_modules/zod/v4/core/schemas.d.ts +1184 -0
  1066. package/node_modules/zod/v4/core/schemas.js +2239 -0
  1067. package/node_modules/zod/v4/core/standard-schema.cjs +2 -0
  1068. package/node_modules/zod/v4/core/standard-schema.d.cts +126 -0
  1069. package/node_modules/zod/v4/core/standard-schema.d.ts +126 -0
  1070. package/node_modules/zod/v4/core/standard-schema.js +1 -0
  1071. package/node_modules/zod/v4/core/to-json-schema.cjs +457 -0
  1072. package/node_modules/zod/v4/core/to-json-schema.d.cts +114 -0
  1073. package/node_modules/zod/v4/core/to-json-schema.d.ts +114 -0
  1074. package/node_modules/zod/v4/core/to-json-schema.js +448 -0
  1075. package/node_modules/zod/v4/core/util.cjs +734 -0
  1076. package/node_modules/zod/v4/core/util.d.cts +200 -0
  1077. package/node_modules/zod/v4/core/util.d.ts +200 -0
  1078. package/node_modules/zod/v4/core/util.js +674 -0
  1079. package/node_modules/zod/v4/core/versions.cjs +8 -0
  1080. package/node_modules/zod/v4/core/versions.d.cts +5 -0
  1081. package/node_modules/zod/v4/core/versions.d.ts +5 -0
  1082. package/node_modules/zod/v4/core/versions.js +5 -0
  1083. package/node_modules/zod/v4/index.cjs +22 -0
  1084. package/node_modules/zod/v4/index.d.cts +3 -0
  1085. package/node_modules/zod/v4/index.d.ts +3 -0
  1086. package/node_modules/zod/v4/index.js +3 -0
  1087. package/node_modules/zod/v4/locales/ar.cjs +133 -0
  1088. package/node_modules/zod/v4/locales/ar.d.cts +5 -0
  1089. package/node_modules/zod/v4/locales/ar.d.ts +4 -0
  1090. package/node_modules/zod/v4/locales/ar.js +106 -0
  1091. package/node_modules/zod/v4/locales/az.cjs +132 -0
  1092. package/node_modules/zod/v4/locales/az.d.cts +5 -0
  1093. package/node_modules/zod/v4/locales/az.d.ts +4 -0
  1094. package/node_modules/zod/v4/locales/az.js +105 -0
  1095. package/node_modules/zod/v4/locales/be.cjs +183 -0
  1096. package/node_modules/zod/v4/locales/be.d.cts +5 -0
  1097. package/node_modules/zod/v4/locales/be.d.ts +4 -0
  1098. package/node_modules/zod/v4/locales/be.js +156 -0
  1099. package/node_modules/zod/v4/locales/bg.cjs +147 -0
  1100. package/node_modules/zod/v4/locales/bg.d.cts +5 -0
  1101. package/node_modules/zod/v4/locales/bg.d.ts +4 -0
  1102. package/node_modules/zod/v4/locales/bg.js +120 -0
  1103. package/node_modules/zod/v4/locales/ca.cjs +134 -0
  1104. package/node_modules/zod/v4/locales/ca.d.cts +5 -0
  1105. package/node_modules/zod/v4/locales/ca.d.ts +4 -0
  1106. package/node_modules/zod/v4/locales/ca.js +107 -0
  1107. package/node_modules/zod/v4/locales/cs.cjs +138 -0
  1108. package/node_modules/zod/v4/locales/cs.d.cts +5 -0
  1109. package/node_modules/zod/v4/locales/cs.d.ts +4 -0
  1110. package/node_modules/zod/v4/locales/cs.js +111 -0
  1111. package/node_modules/zod/v4/locales/da.cjs +142 -0
  1112. package/node_modules/zod/v4/locales/da.d.cts +5 -0
  1113. package/node_modules/zod/v4/locales/da.d.ts +4 -0
  1114. package/node_modules/zod/v4/locales/da.js +115 -0
  1115. package/node_modules/zod/v4/locales/de.cjs +135 -0
  1116. package/node_modules/zod/v4/locales/de.d.cts +5 -0
  1117. package/node_modules/zod/v4/locales/de.d.ts +4 -0
  1118. package/node_modules/zod/v4/locales/de.js +108 -0
  1119. package/node_modules/zod/v4/locales/el.cjs +136 -0
  1120. package/node_modules/zod/v4/locales/el.d.cts +5 -0
  1121. package/node_modules/zod/v4/locales/el.d.ts +4 -0
  1122. package/node_modules/zod/v4/locales/el.js +109 -0
  1123. package/node_modules/zod/v4/locales/en.cjs +140 -0
  1124. package/node_modules/zod/v4/locales/en.d.cts +5 -0
  1125. package/node_modules/zod/v4/locales/en.d.ts +4 -0
  1126. package/node_modules/zod/v4/locales/en.js +113 -0
  1127. package/node_modules/zod/v4/locales/eo.cjs +136 -0
  1128. package/node_modules/zod/v4/locales/eo.d.cts +5 -0
  1129. package/node_modules/zod/v4/locales/eo.d.ts +4 -0
  1130. package/node_modules/zod/v4/locales/eo.js +109 -0
  1131. package/node_modules/zod/v4/locales/es.cjs +159 -0
  1132. package/node_modules/zod/v4/locales/es.d.cts +5 -0
  1133. package/node_modules/zod/v4/locales/es.d.ts +4 -0
  1134. package/node_modules/zod/v4/locales/es.js +132 -0
  1135. package/node_modules/zod/v4/locales/fa.cjs +141 -0
  1136. package/node_modules/zod/v4/locales/fa.d.cts +5 -0
  1137. package/node_modules/zod/v4/locales/fa.d.ts +4 -0
  1138. package/node_modules/zod/v4/locales/fa.js +114 -0
  1139. package/node_modules/zod/v4/locales/fi.cjs +139 -0
  1140. package/node_modules/zod/v4/locales/fi.d.cts +5 -0
  1141. package/node_modules/zod/v4/locales/fi.d.ts +4 -0
  1142. package/node_modules/zod/v4/locales/fi.js +112 -0
  1143. package/node_modules/zod/v4/locales/fr-CA.cjs +134 -0
  1144. package/node_modules/zod/v4/locales/fr-CA.d.cts +5 -0
  1145. package/node_modules/zod/v4/locales/fr-CA.d.ts +4 -0
  1146. package/node_modules/zod/v4/locales/fr-CA.js +107 -0
  1147. package/node_modules/zod/v4/locales/fr.cjs +152 -0
  1148. package/node_modules/zod/v4/locales/fr.d.cts +5 -0
  1149. package/node_modules/zod/v4/locales/fr.d.ts +4 -0
  1150. package/node_modules/zod/v4/locales/fr.js +125 -0
  1151. package/node_modules/zod/v4/locales/he.cjs +241 -0
  1152. package/node_modules/zod/v4/locales/he.d.cts +5 -0
  1153. package/node_modules/zod/v4/locales/he.d.ts +4 -0
  1154. package/node_modules/zod/v4/locales/he.js +214 -0
  1155. package/node_modules/zod/v4/locales/hr.cjs +149 -0
  1156. package/node_modules/zod/v4/locales/hr.d.cts +5 -0
  1157. package/node_modules/zod/v4/locales/hr.d.ts +4 -0
  1158. package/node_modules/zod/v4/locales/hr.js +122 -0
  1159. package/node_modules/zod/v4/locales/hu.cjs +135 -0
  1160. package/node_modules/zod/v4/locales/hu.d.cts +5 -0
  1161. package/node_modules/zod/v4/locales/hu.d.ts +4 -0
  1162. package/node_modules/zod/v4/locales/hu.js +108 -0
  1163. package/node_modules/zod/v4/locales/hy.cjs +174 -0
  1164. package/node_modules/zod/v4/locales/hy.d.cts +5 -0
  1165. package/node_modules/zod/v4/locales/hy.d.ts +4 -0
  1166. package/node_modules/zod/v4/locales/hy.js +147 -0
  1167. package/node_modules/zod/v4/locales/id.cjs +133 -0
  1168. package/node_modules/zod/v4/locales/id.d.cts +5 -0
  1169. package/node_modules/zod/v4/locales/id.d.ts +4 -0
  1170. package/node_modules/zod/v4/locales/id.js +106 -0
  1171. package/node_modules/zod/v4/locales/index.cjs +111 -0
  1172. package/node_modules/zod/v4/locales/index.d.cts +52 -0
  1173. package/node_modules/zod/v4/locales/index.d.ts +52 -0
  1174. package/node_modules/zod/v4/locales/index.js +52 -0
  1175. package/node_modules/zod/v4/locales/is.cjs +136 -0
  1176. package/node_modules/zod/v4/locales/is.d.cts +5 -0
  1177. package/node_modules/zod/v4/locales/is.d.ts +4 -0
  1178. package/node_modules/zod/v4/locales/is.js +109 -0
  1179. package/node_modules/zod/v4/locales/it.cjs +135 -0
  1180. package/node_modules/zod/v4/locales/it.d.cts +5 -0
  1181. package/node_modules/zod/v4/locales/it.d.ts +4 -0
  1182. package/node_modules/zod/v4/locales/it.js +108 -0
  1183. package/node_modules/zod/v4/locales/ja.cjs +134 -0
  1184. package/node_modules/zod/v4/locales/ja.d.cts +5 -0
  1185. package/node_modules/zod/v4/locales/ja.d.ts +4 -0
  1186. package/node_modules/zod/v4/locales/ja.js +107 -0
  1187. package/node_modules/zod/v4/locales/ka.cjs +139 -0
  1188. package/node_modules/zod/v4/locales/ka.d.cts +5 -0
  1189. package/node_modules/zod/v4/locales/ka.d.ts +4 -0
  1190. package/node_modules/zod/v4/locales/ka.js +112 -0
  1191. package/node_modules/zod/v4/locales/kh.cjs +12 -0
  1192. package/node_modules/zod/v4/locales/kh.d.cts +5 -0
  1193. package/node_modules/zod/v4/locales/kh.d.ts +5 -0
  1194. package/node_modules/zod/v4/locales/kh.js +5 -0
  1195. package/node_modules/zod/v4/locales/km.cjs +137 -0
  1196. package/node_modules/zod/v4/locales/km.d.cts +5 -0
  1197. package/node_modules/zod/v4/locales/km.d.ts +4 -0
  1198. package/node_modules/zod/v4/locales/km.js +110 -0
  1199. package/node_modules/zod/v4/locales/ko.cjs +138 -0
  1200. package/node_modules/zod/v4/locales/ko.d.cts +5 -0
  1201. package/node_modules/zod/v4/locales/ko.d.ts +4 -0
  1202. package/node_modules/zod/v4/locales/ko.js +111 -0
  1203. package/node_modules/zod/v4/locales/lt.cjs +230 -0
  1204. package/node_modules/zod/v4/locales/lt.d.cts +5 -0
  1205. package/node_modules/zod/v4/locales/lt.d.ts +4 -0
  1206. package/node_modules/zod/v4/locales/lt.js +203 -0
  1207. package/node_modules/zod/v4/locales/mk.cjs +136 -0
  1208. package/node_modules/zod/v4/locales/mk.d.cts +5 -0
  1209. package/node_modules/zod/v4/locales/mk.d.ts +4 -0
  1210. package/node_modules/zod/v4/locales/mk.js +109 -0
  1211. package/node_modules/zod/v4/locales/ms.cjs +134 -0
  1212. package/node_modules/zod/v4/locales/ms.d.cts +5 -0
  1213. package/node_modules/zod/v4/locales/ms.d.ts +4 -0
  1214. package/node_modules/zod/v4/locales/ms.js +107 -0
  1215. package/node_modules/zod/v4/locales/nl.cjs +137 -0
  1216. package/node_modules/zod/v4/locales/nl.d.cts +5 -0
  1217. package/node_modules/zod/v4/locales/nl.d.ts +4 -0
  1218. package/node_modules/zod/v4/locales/nl.js +110 -0
  1219. package/node_modules/zod/v4/locales/no.cjs +135 -0
  1220. package/node_modules/zod/v4/locales/no.d.cts +5 -0
  1221. package/node_modules/zod/v4/locales/no.d.ts +4 -0
  1222. package/node_modules/zod/v4/locales/no.js +108 -0
  1223. package/node_modules/zod/v4/locales/ota.cjs +136 -0
  1224. package/node_modules/zod/v4/locales/ota.d.cts +5 -0
  1225. package/node_modules/zod/v4/locales/ota.d.ts +4 -0
  1226. package/node_modules/zod/v4/locales/ota.js +109 -0
  1227. package/node_modules/zod/v4/locales/package.json +7 -0
  1228. package/node_modules/zod/v4/locales/pl.cjs +136 -0
  1229. package/node_modules/zod/v4/locales/pl.d.cts +5 -0
  1230. package/node_modules/zod/v4/locales/pl.d.ts +4 -0
  1231. package/node_modules/zod/v4/locales/pl.js +109 -0
  1232. package/node_modules/zod/v4/locales/ps.cjs +141 -0
  1233. package/node_modules/zod/v4/locales/ps.d.cts +5 -0
  1234. package/node_modules/zod/v4/locales/ps.d.ts +4 -0
  1235. package/node_modules/zod/v4/locales/ps.js +114 -0
  1236. package/node_modules/zod/v4/locales/pt.cjs +135 -0
  1237. package/node_modules/zod/v4/locales/pt.d.cts +5 -0
  1238. package/node_modules/zod/v4/locales/pt.d.ts +4 -0
  1239. package/node_modules/zod/v4/locales/pt.js +108 -0
  1240. package/node_modules/zod/v4/locales/ro.cjs +146 -0
  1241. package/node_modules/zod/v4/locales/ro.d.cts +5 -0
  1242. package/node_modules/zod/v4/locales/ro.d.ts +4 -0
  1243. package/node_modules/zod/v4/locales/ro.js +119 -0
  1244. package/node_modules/zod/v4/locales/ru.cjs +183 -0
  1245. package/node_modules/zod/v4/locales/ru.d.cts +5 -0
  1246. package/node_modules/zod/v4/locales/ru.d.ts +4 -0
  1247. package/node_modules/zod/v4/locales/ru.js +156 -0
  1248. package/node_modules/zod/v4/locales/sl.cjs +136 -0
  1249. package/node_modules/zod/v4/locales/sl.d.cts +5 -0
  1250. package/node_modules/zod/v4/locales/sl.d.ts +4 -0
  1251. package/node_modules/zod/v4/locales/sl.js +109 -0
  1252. package/node_modules/zod/v4/locales/sv.cjs +137 -0
  1253. package/node_modules/zod/v4/locales/sv.d.cts +5 -0
  1254. package/node_modules/zod/v4/locales/sv.d.ts +4 -0
  1255. package/node_modules/zod/v4/locales/sv.js +110 -0
  1256. package/node_modules/zod/v4/locales/ta.cjs +137 -0
  1257. package/node_modules/zod/v4/locales/ta.d.cts +5 -0
  1258. package/node_modules/zod/v4/locales/ta.d.ts +4 -0
  1259. package/node_modules/zod/v4/locales/ta.js +110 -0
  1260. package/node_modules/zod/v4/locales/th.cjs +137 -0
  1261. package/node_modules/zod/v4/locales/th.d.cts +5 -0
  1262. package/node_modules/zod/v4/locales/th.d.ts +4 -0
  1263. package/node_modules/zod/v4/locales/th.js +110 -0
  1264. package/node_modules/zod/v4/locales/tr.cjs +132 -0
  1265. package/node_modules/zod/v4/locales/tr.d.cts +5 -0
  1266. package/node_modules/zod/v4/locales/tr.d.ts +4 -0
  1267. package/node_modules/zod/v4/locales/tr.js +105 -0
  1268. package/node_modules/zod/v4/locales/ua.cjs +12 -0
  1269. package/node_modules/zod/v4/locales/ua.d.cts +5 -0
  1270. package/node_modules/zod/v4/locales/ua.d.ts +5 -0
  1271. package/node_modules/zod/v4/locales/ua.js +5 -0
  1272. package/node_modules/zod/v4/locales/uk.cjs +135 -0
  1273. package/node_modules/zod/v4/locales/uk.d.cts +5 -0
  1274. package/node_modules/zod/v4/locales/uk.d.ts +4 -0
  1275. package/node_modules/zod/v4/locales/uk.js +108 -0
  1276. package/node_modules/zod/v4/locales/ur.cjs +137 -0
  1277. package/node_modules/zod/v4/locales/ur.d.cts +5 -0
  1278. package/node_modules/zod/v4/locales/ur.d.ts +4 -0
  1279. package/node_modules/zod/v4/locales/ur.js +110 -0
  1280. package/node_modules/zod/v4/locales/uz.cjs +137 -0
  1281. package/node_modules/zod/v4/locales/uz.d.cts +5 -0
  1282. package/node_modules/zod/v4/locales/uz.d.ts +4 -0
  1283. package/node_modules/zod/v4/locales/uz.js +110 -0
  1284. package/node_modules/zod/v4/locales/vi.cjs +135 -0
  1285. package/node_modules/zod/v4/locales/vi.d.cts +5 -0
  1286. package/node_modules/zod/v4/locales/vi.d.ts +4 -0
  1287. package/node_modules/zod/v4/locales/vi.js +108 -0
  1288. package/node_modules/zod/v4/locales/yo.cjs +134 -0
  1289. package/node_modules/zod/v4/locales/yo.d.cts +5 -0
  1290. package/node_modules/zod/v4/locales/yo.d.ts +4 -0
  1291. package/node_modules/zod/v4/locales/yo.js +107 -0
  1292. package/node_modules/zod/v4/locales/zh-CN.cjs +136 -0
  1293. package/node_modules/zod/v4/locales/zh-CN.d.cts +5 -0
  1294. package/node_modules/zod/v4/locales/zh-CN.d.ts +4 -0
  1295. package/node_modules/zod/v4/locales/zh-CN.js +109 -0
  1296. package/node_modules/zod/v4/locales/zh-TW.cjs +134 -0
  1297. package/node_modules/zod/v4/locales/zh-TW.d.cts +5 -0
  1298. package/node_modules/zod/v4/locales/zh-TW.d.ts +4 -0
  1299. package/node_modules/zod/v4/locales/zh-TW.js +107 -0
  1300. package/node_modules/zod/v4/mini/checks.cjs +34 -0
  1301. package/node_modules/zod/v4/mini/checks.d.cts +1 -0
  1302. package/node_modules/zod/v4/mini/checks.d.ts +1 -0
  1303. package/node_modules/zod/v4/mini/checks.js +1 -0
  1304. package/node_modules/zod/v4/mini/coerce.cjs +52 -0
  1305. package/node_modules/zod/v4/mini/coerce.d.cts +7 -0
  1306. package/node_modules/zod/v4/mini/coerce.d.ts +7 -0
  1307. package/node_modules/zod/v4/mini/coerce.js +22 -0
  1308. package/node_modules/zod/v4/mini/external.cjs +63 -0
  1309. package/node_modules/zod/v4/mini/external.d.cts +13 -0
  1310. package/node_modules/zod/v4/mini/external.d.ts +13 -0
  1311. package/node_modules/zod/v4/mini/external.js +14 -0
  1312. package/node_modules/zod/v4/mini/index.cjs +32 -0
  1313. package/node_modules/zod/v4/mini/index.d.cts +3 -0
  1314. package/node_modules/zod/v4/mini/index.d.ts +3 -0
  1315. package/node_modules/zod/v4/mini/index.js +3 -0
  1316. package/node_modules/zod/v4/mini/iso.cjs +64 -0
  1317. package/node_modules/zod/v4/mini/iso.d.cts +22 -0
  1318. package/node_modules/zod/v4/mini/iso.d.ts +22 -0
  1319. package/node_modules/zod/v4/mini/iso.js +34 -0
  1320. package/node_modules/zod/v4/mini/package.json +7 -0
  1321. package/node_modules/zod/v4/mini/parse.cjs +16 -0
  1322. package/node_modules/zod/v4/mini/parse.d.cts +1 -0
  1323. package/node_modules/zod/v4/mini/parse.d.ts +1 -0
  1324. package/node_modules/zod/v4/mini/parse.js +1 -0
  1325. package/node_modules/zod/v4/mini/schemas.cjs +1083 -0
  1326. package/node_modules/zod/v4/mini/schemas.d.cts +445 -0
  1327. package/node_modules/zod/v4/mini/schemas.d.ts +445 -0
  1328. package/node_modules/zod/v4/mini/schemas.js +961 -0
  1329. package/node_modules/zod/v4/package.json +7 -0
  1330. package/node_modules/zod/v4-mini/index.cjs +32 -0
  1331. package/node_modules/zod/v4-mini/index.d.cts +3 -0
  1332. package/node_modules/zod/v4-mini/index.d.ts +3 -0
  1333. package/node_modules/zod/v4-mini/index.js +3 -0
  1334. package/node_modules/zod/v4-mini/package.json +7 -0
  1335. package/npm-shrinkwrap.json +137 -0
  1336. package/package.json +9 -8
@@ -0,0 +1,3649 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __export = (target, all) => {
3
+ for (var name in all)
4
+ __defProp(target, name, { get: all[name], enumerable: true });
5
+ };
6
+
7
+ // pure.ts
8
+ import { schnorr } from "@noble/curves/secp256k1.js";
9
+ import { bytesToHex as bytesToHex2, hexToBytes as hexToBytes2 } from "@noble/hashes/utils.js";
10
+
11
+ // core.ts
12
+ var verifiedSymbol = Symbol("verified");
13
+ var isRecord = (obj) => obj instanceof Object;
14
+ function validateEvent(event) {
15
+ if (!isRecord(event))
16
+ return false;
17
+ if (typeof event.kind !== "number")
18
+ return false;
19
+ if (typeof event.content !== "string")
20
+ return false;
21
+ if (typeof event.created_at !== "number")
22
+ return false;
23
+ if (typeof event.pubkey !== "string")
24
+ return false;
25
+ if (!event.pubkey.match(/^[a-f0-9]{64}$/))
26
+ return false;
27
+ if (!Array.isArray(event.tags))
28
+ return false;
29
+ for (let i2 = 0; i2 < event.tags.length; i2++) {
30
+ let tag = event.tags[i2];
31
+ if (!Array.isArray(tag))
32
+ return false;
33
+ for (let j = 0; j < tag.length; j++) {
34
+ if (typeof tag[j] !== "string")
35
+ return false;
36
+ }
37
+ }
38
+ return true;
39
+ }
40
+ function sortEvents(events) {
41
+ return events.sort((a, b) => {
42
+ if (a.created_at !== b.created_at) {
43
+ return b.created_at - a.created_at;
44
+ }
45
+ return a.id.localeCompare(b.id);
46
+ });
47
+ }
48
+
49
+ // pure.ts
50
+ import { sha256 } from "@noble/hashes/sha2.js";
51
+
52
+ // utils.ts
53
+ var utils_exports = {};
54
+ __export(utils_exports, {
55
+ binarySearch: () => binarySearch,
56
+ bytesToHex: () => bytesToHex,
57
+ hexToBytes: () => hexToBytes,
58
+ insertEventIntoAscendingList: () => insertEventIntoAscendingList,
59
+ insertEventIntoDescendingList: () => insertEventIntoDescendingList,
60
+ mergeReverseSortedLists: () => mergeReverseSortedLists,
61
+ normalizeURL: () => normalizeURL,
62
+ utf8Decoder: () => utf8Decoder,
63
+ utf8Encoder: () => utf8Encoder
64
+ });
65
+ import { bytesToHex, hexToBytes } from "@noble/hashes/utils.js";
66
+ var utf8Decoder = new TextDecoder("utf-8");
67
+ var utf8Encoder = new TextEncoder();
68
+ function normalizeURL(url) {
69
+ try {
70
+ if (url.indexOf("://") === -1)
71
+ url = "wss://" + url;
72
+ let p = new URL(url);
73
+ if (p.protocol === "http:")
74
+ p.protocol = "ws:";
75
+ else if (p.protocol === "https:")
76
+ p.protocol = "wss:";
77
+ p.pathname = p.pathname.replace(/\/+/g, "/");
78
+ if (p.pathname.endsWith("/"))
79
+ p.pathname = p.pathname.slice(0, -1);
80
+ if (p.port === "80" && p.protocol === "ws:" || p.port === "443" && p.protocol === "wss:")
81
+ p.port = "";
82
+ p.searchParams.sort();
83
+ p.hash = "";
84
+ return p.toString();
85
+ } catch (e) {
86
+ throw new Error(`Invalid URL: ${url}`);
87
+ }
88
+ }
89
+ function insertEventIntoDescendingList(sortedArray, event) {
90
+ const [idx, found] = binarySearch(sortedArray, (b) => {
91
+ if (event.id === b.id)
92
+ return 0;
93
+ if (event.created_at === b.created_at)
94
+ return -1;
95
+ return b.created_at - event.created_at;
96
+ });
97
+ if (!found) {
98
+ sortedArray.splice(idx, 0, event);
99
+ }
100
+ return sortedArray;
101
+ }
102
+ function insertEventIntoAscendingList(sortedArray, event) {
103
+ const [idx, found] = binarySearch(sortedArray, (b) => {
104
+ if (event.id === b.id)
105
+ return 0;
106
+ if (event.created_at === b.created_at)
107
+ return -1;
108
+ return event.created_at - b.created_at;
109
+ });
110
+ if (!found) {
111
+ sortedArray.splice(idx, 0, event);
112
+ }
113
+ return sortedArray;
114
+ }
115
+ function binarySearch(arr, compare) {
116
+ let start = 0;
117
+ let end = arr.length - 1;
118
+ while (start <= end) {
119
+ const mid = Math.floor((start + end) / 2);
120
+ const cmp = compare(arr[mid]);
121
+ if (cmp === 0) {
122
+ return [mid, true];
123
+ }
124
+ if (cmp < 0) {
125
+ end = mid - 1;
126
+ } else {
127
+ start = mid + 1;
128
+ }
129
+ }
130
+ return [start, false];
131
+ }
132
+ function mergeReverseSortedLists(list1, list2) {
133
+ const result = new Array(list1.length + list2.length);
134
+ result.length = 0;
135
+ let i1 = 0;
136
+ let i2 = 0;
137
+ let sameTimestampIds = [];
138
+ while (i1 < list1.length && i2 < list2.length) {
139
+ let next;
140
+ if (list1[i1]?.created_at > list2[i2]?.created_at) {
141
+ next = list1[i1];
142
+ i1++;
143
+ } else {
144
+ next = list2[i2];
145
+ i2++;
146
+ }
147
+ if (result.length > 0 && result[result.length - 1].created_at === next.created_at) {
148
+ if (sameTimestampIds.includes(next.id))
149
+ continue;
150
+ } else {
151
+ sameTimestampIds.length = 0;
152
+ }
153
+ result.push(next);
154
+ sameTimestampIds.push(next.id);
155
+ }
156
+ while (i1 < list1.length) {
157
+ const next = list1[i1];
158
+ i1++;
159
+ if (result.length > 0 && result[result.length - 1].created_at === next.created_at) {
160
+ if (sameTimestampIds.includes(next.id))
161
+ continue;
162
+ } else {
163
+ sameTimestampIds.length = 0;
164
+ }
165
+ result.push(next);
166
+ sameTimestampIds.push(next.id);
167
+ }
168
+ while (i2 < list2.length) {
169
+ const next = list2[i2];
170
+ i2++;
171
+ if (result.length > 0 && result[result.length - 1].created_at === next.created_at) {
172
+ if (sameTimestampIds.includes(next.id))
173
+ continue;
174
+ } else {
175
+ sameTimestampIds.length = 0;
176
+ }
177
+ result.push(next);
178
+ sameTimestampIds.push(next.id);
179
+ }
180
+ return result;
181
+ }
182
+
183
+ // pure.ts
184
+ var JS = class {
185
+ generateSecretKey() {
186
+ return schnorr.utils.randomSecretKey();
187
+ }
188
+ getPublicKey(secretKey) {
189
+ return bytesToHex2(schnorr.getPublicKey(secretKey));
190
+ }
191
+ finalizeEvent(t, secretKey) {
192
+ const event = t;
193
+ event.pubkey = bytesToHex2(schnorr.getPublicKey(secretKey));
194
+ event.id = getEventHash(event);
195
+ event.sig = bytesToHex2(schnorr.sign(hexToBytes2(getEventHash(event)), secretKey));
196
+ event[verifiedSymbol] = true;
197
+ return event;
198
+ }
199
+ verifyEvent(event) {
200
+ if (typeof event[verifiedSymbol] === "boolean")
201
+ return event[verifiedSymbol];
202
+ try {
203
+ const hash = getEventHash(event);
204
+ if (hash !== event.id) {
205
+ event[verifiedSymbol] = false;
206
+ return false;
207
+ }
208
+ const valid = schnorr.verify(hexToBytes2(event.sig), hexToBytes2(hash), hexToBytes2(event.pubkey));
209
+ event[verifiedSymbol] = valid;
210
+ return valid;
211
+ } catch (err) {
212
+ event[verifiedSymbol] = false;
213
+ return false;
214
+ }
215
+ }
216
+ };
217
+ function serializeEvent(evt) {
218
+ if (!validateEvent(evt))
219
+ throw new Error("can't serialize event with wrong or missing properties");
220
+ return JSON.stringify([0, evt.pubkey, evt.created_at, evt.kind, evt.tags, evt.content]);
221
+ }
222
+ function getEventHash(event) {
223
+ let eventHash = sha256(utf8Encoder.encode(serializeEvent(event)));
224
+ return bytesToHex2(eventHash);
225
+ }
226
+ var i = new JS();
227
+ var generateSecretKey = i.generateSecretKey;
228
+ var getPublicKey = i.getPublicKey;
229
+ var finalizeEvent = i.finalizeEvent;
230
+ var verifyEvent = i.verifyEvent;
231
+
232
+ // kinds.ts
233
+ var kinds_exports = {};
234
+ __export(kinds_exports, {
235
+ Application: () => Application,
236
+ BadgeAward: () => BadgeAward,
237
+ BadgeDefinition: () => BadgeDefinition,
238
+ BlockedRelaysList: () => BlockedRelaysList,
239
+ BlossomServerList: () => BlossomServerList,
240
+ BookmarkList: () => BookmarkList,
241
+ Bookmarksets: () => Bookmarksets,
242
+ Calendar: () => Calendar,
243
+ CalendarEventRSVP: () => CalendarEventRSVP,
244
+ ChannelCreation: () => ChannelCreation,
245
+ ChannelHideMessage: () => ChannelHideMessage,
246
+ ChannelMessage: () => ChannelMessage,
247
+ ChannelMetadata: () => ChannelMetadata,
248
+ ChannelMuteUser: () => ChannelMuteUser,
249
+ ChatMessage: () => ChatMessage,
250
+ ClassifiedListing: () => ClassifiedListing,
251
+ ClientAuth: () => ClientAuth,
252
+ Comment: () => Comment,
253
+ CommunitiesList: () => CommunitiesList,
254
+ CommunityDefinition: () => CommunityDefinition,
255
+ CommunityPostApproval: () => CommunityPostApproval,
256
+ Contacts: () => Contacts,
257
+ CreateOrUpdateProduct: () => CreateOrUpdateProduct,
258
+ CreateOrUpdateStall: () => CreateOrUpdateStall,
259
+ Curationsets: () => Curationsets,
260
+ Date: () => Date2,
261
+ DirectMessageRelaysList: () => DirectMessageRelaysList,
262
+ DraftClassifiedListing: () => DraftClassifiedListing,
263
+ DraftLong: () => DraftLong,
264
+ Emojisets: () => Emojisets,
265
+ EncryptedDirectMessage: () => EncryptedDirectMessage,
266
+ EventDeletion: () => EventDeletion,
267
+ FavoriteRelays: () => FavoriteRelays,
268
+ FileMessage: () => FileMessage,
269
+ FileMetadata: () => FileMetadata,
270
+ FileServerPreference: () => FileServerPreference,
271
+ Followsets: () => Followsets,
272
+ ForumThread: () => ForumThread,
273
+ GenericRepost: () => GenericRepost,
274
+ Genericlists: () => Genericlists,
275
+ GiftWrap: () => GiftWrap,
276
+ GroupMetadata: () => GroupMetadata,
277
+ HTTPAuth: () => HTTPAuth,
278
+ Handlerinformation: () => Handlerinformation,
279
+ Handlerrecommendation: () => Handlerrecommendation,
280
+ Highlights: () => Highlights,
281
+ InterestsList: () => InterestsList,
282
+ Interestsets: () => Interestsets,
283
+ JobFeedback: () => JobFeedback,
284
+ JobRequest: () => JobRequest,
285
+ JobResult: () => JobResult,
286
+ Label: () => Label,
287
+ LightningPubRPC: () => LightningPubRPC,
288
+ LiveChatMessage: () => LiveChatMessage,
289
+ LiveEvent: () => LiveEvent,
290
+ LongFormArticle: () => LongFormArticle,
291
+ Metadata: () => Metadata,
292
+ Mutelist: () => Mutelist,
293
+ NWCWalletInfo: () => NWCWalletInfo,
294
+ NWCWalletRequest: () => NWCWalletRequest,
295
+ NWCWalletResponse: () => NWCWalletResponse,
296
+ NormalVideo: () => NormalVideo,
297
+ NostrConnect: () => NostrConnect,
298
+ OpenTimestamps: () => OpenTimestamps,
299
+ Photo: () => Photo,
300
+ Pinlist: () => Pinlist,
301
+ Poll: () => Poll,
302
+ PollResponse: () => PollResponse,
303
+ PrivateDirectMessage: () => PrivateDirectMessage,
304
+ ProblemTracker: () => ProblemTracker,
305
+ ProfileBadges: () => ProfileBadges,
306
+ PublicChatsList: () => PublicChatsList,
307
+ Reaction: () => Reaction,
308
+ RecommendRelay: () => RecommendRelay,
309
+ RelayList: () => RelayList,
310
+ RelayReview: () => RelayReview,
311
+ Relaysets: () => Relaysets,
312
+ Report: () => Report,
313
+ Reporting: () => Reporting,
314
+ Repost: () => Repost,
315
+ Seal: () => Seal,
316
+ SearchRelaysList: () => SearchRelaysList,
317
+ ShortTextNote: () => ShortTextNote,
318
+ ShortVideo: () => ShortVideo,
319
+ Time: () => Time,
320
+ UserEmojiList: () => UserEmojiList,
321
+ UserStatuses: () => UserStatuses,
322
+ Voice: () => Voice,
323
+ VoiceComment: () => VoiceComment,
324
+ Zap: () => Zap,
325
+ ZapGoal: () => ZapGoal,
326
+ ZapRequest: () => ZapRequest,
327
+ classifyKind: () => classifyKind,
328
+ isAddressableKind: () => isAddressableKind,
329
+ isEphemeralKind: () => isEphemeralKind,
330
+ isKind: () => isKind,
331
+ isRegularKind: () => isRegularKind,
332
+ isReplaceableKind: () => isReplaceableKind
333
+ });
334
+ function isRegularKind(kind) {
335
+ return kind < 1e4 && kind !== 0 && kind !== 3;
336
+ }
337
+ function isReplaceableKind(kind) {
338
+ return kind === 0 || kind === 3 || 1e4 <= kind && kind < 2e4;
339
+ }
340
+ function isEphemeralKind(kind) {
341
+ return 2e4 <= kind && kind < 3e4;
342
+ }
343
+ function isAddressableKind(kind) {
344
+ return 3e4 <= kind && kind < 4e4;
345
+ }
346
+ function classifyKind(kind) {
347
+ if (isRegularKind(kind))
348
+ return "regular";
349
+ if (isReplaceableKind(kind))
350
+ return "replaceable";
351
+ if (isEphemeralKind(kind))
352
+ return "ephemeral";
353
+ if (isAddressableKind(kind))
354
+ return "parameterized";
355
+ return "unknown";
356
+ }
357
+ function isKind(event, kind) {
358
+ const kindAsArray = kind instanceof Array ? kind : [kind];
359
+ return validateEvent(event) && kindAsArray.includes(event.kind) || false;
360
+ }
361
+ var Metadata = 0;
362
+ var ShortTextNote = 1;
363
+ var RecommendRelay = 2;
364
+ var Contacts = 3;
365
+ var EncryptedDirectMessage = 4;
366
+ var EventDeletion = 5;
367
+ var Repost = 6;
368
+ var Reaction = 7;
369
+ var BadgeAward = 8;
370
+ var ChatMessage = 9;
371
+ var ForumThread = 11;
372
+ var Seal = 13;
373
+ var PrivateDirectMessage = 14;
374
+ var FileMessage = 15;
375
+ var GenericRepost = 16;
376
+ var Photo = 20;
377
+ var NormalVideo = 21;
378
+ var ShortVideo = 22;
379
+ var ChannelCreation = 40;
380
+ var ChannelMetadata = 41;
381
+ var ChannelMessage = 42;
382
+ var ChannelHideMessage = 43;
383
+ var ChannelMuteUser = 44;
384
+ var OpenTimestamps = 1040;
385
+ var GiftWrap = 1059;
386
+ var Poll = 1068;
387
+ var FileMetadata = 1063;
388
+ var Comment = 1111;
389
+ var LiveChatMessage = 1311;
390
+ var Voice = 1222;
391
+ var VoiceComment = 1244;
392
+ var ProblemTracker = 1971;
393
+ var Report = 1984;
394
+ var Reporting = 1984;
395
+ var Label = 1985;
396
+ var CommunityPostApproval = 4550;
397
+ var JobRequest = 5999;
398
+ var JobResult = 6999;
399
+ var JobFeedback = 7e3;
400
+ var ZapGoal = 9041;
401
+ var ZapRequest = 9734;
402
+ var Zap = 9735;
403
+ var Highlights = 9802;
404
+ var PollResponse = 1018;
405
+ var Mutelist = 1e4;
406
+ var Pinlist = 10001;
407
+ var RelayList = 10002;
408
+ var BookmarkList = 10003;
409
+ var CommunitiesList = 10004;
410
+ var PublicChatsList = 10005;
411
+ var BlockedRelaysList = 10006;
412
+ var SearchRelaysList = 10007;
413
+ var FavoriteRelays = 10012;
414
+ var InterestsList = 10015;
415
+ var UserEmojiList = 10030;
416
+ var DirectMessageRelaysList = 10050;
417
+ var FileServerPreference = 10096;
418
+ var BlossomServerList = 10063;
419
+ var NWCWalletInfo = 13194;
420
+ var LightningPubRPC = 21e3;
421
+ var ClientAuth = 22242;
422
+ var NWCWalletRequest = 23194;
423
+ var NWCWalletResponse = 23195;
424
+ var NostrConnect = 24133;
425
+ var HTTPAuth = 27235;
426
+ var Followsets = 3e4;
427
+ var Genericlists = 30001;
428
+ var Relaysets = 30002;
429
+ var Bookmarksets = 30003;
430
+ var Curationsets = 30004;
431
+ var ProfileBadges = 30008;
432
+ var BadgeDefinition = 30009;
433
+ var Interestsets = 30015;
434
+ var CreateOrUpdateStall = 30017;
435
+ var CreateOrUpdateProduct = 30018;
436
+ var LongFormArticle = 30023;
437
+ var DraftLong = 30024;
438
+ var Emojisets = 30030;
439
+ var Application = 30078;
440
+ var LiveEvent = 30311;
441
+ var UserStatuses = 30315;
442
+ var ClassifiedListing = 30402;
443
+ var DraftClassifiedListing = 30403;
444
+ var Date2 = 31922;
445
+ var Time = 31923;
446
+ var Calendar = 31924;
447
+ var CalendarEventRSVP = 31925;
448
+ var RelayReview = 31987;
449
+ var Handlerrecommendation = 31989;
450
+ var Handlerinformation = 31990;
451
+ var CommunityDefinition = 34550;
452
+ var GroupMetadata = 39e3;
453
+
454
+ // filter.ts
455
+ function matchFilter(filter, event) {
456
+ if (filter.ids && filter.ids.indexOf(event.id) === -1) {
457
+ return false;
458
+ }
459
+ if (filter.kinds && filter.kinds.indexOf(event.kind) === -1) {
460
+ return false;
461
+ }
462
+ if (filter.authors && filter.authors.indexOf(event.pubkey) === -1) {
463
+ return false;
464
+ }
465
+ for (let f in filter) {
466
+ if (f[0] === "#") {
467
+ let tagName = f.slice(1);
468
+ let values = filter[`#${tagName}`];
469
+ if (values && !event.tags.find(([t, v]) => t === f.slice(1) && values.indexOf(v) !== -1))
470
+ return false;
471
+ }
472
+ }
473
+ if (filter.since && event.created_at < filter.since)
474
+ return false;
475
+ if (filter.until && event.created_at > filter.until)
476
+ return false;
477
+ return true;
478
+ }
479
+ function matchFilters(filters, event) {
480
+ for (let i2 = 0; i2 < filters.length; i2++) {
481
+ if (matchFilter(filters[i2], event)) {
482
+ return true;
483
+ }
484
+ }
485
+ return false;
486
+ }
487
+ function mergeFilters(...filters) {
488
+ let result = {};
489
+ for (let i2 = 0; i2 < filters.length; i2++) {
490
+ let filter = filters[i2];
491
+ Object.entries(filter).forEach(([property, values]) => {
492
+ if (property === "kinds" || property === "ids" || property === "authors" || property[0] === "#") {
493
+ result[property] = result[property] || [];
494
+ for (let v = 0; v < values.length; v++) {
495
+ let value = values[v];
496
+ if (!result[property].includes(value))
497
+ result[property].push(value);
498
+ }
499
+ }
500
+ });
501
+ if (filter.limit && (!result.limit || filter.limit > result.limit))
502
+ result.limit = filter.limit;
503
+ if (filter.until && (!result.until || filter.until > result.until))
504
+ result.until = filter.until;
505
+ if (filter.since && (!result.since || filter.since < result.since))
506
+ result.since = filter.since;
507
+ }
508
+ return result;
509
+ }
510
+ function getFilterLimit(filter) {
511
+ if (filter.ids && !filter.ids.length)
512
+ return 0;
513
+ if (filter.kinds && !filter.kinds.length)
514
+ return 0;
515
+ if (filter.authors && !filter.authors.length)
516
+ return 0;
517
+ for (const [key, value] of Object.entries(filter)) {
518
+ if (key[0] === "#" && Array.isArray(value) && !value.length)
519
+ return 0;
520
+ }
521
+ return Math.min(
522
+ Math.max(0, filter.limit ?? Infinity),
523
+ filter.ids?.length ?? Infinity,
524
+ filter.authors?.length && filter.kinds?.every((kind) => isReplaceableKind(kind)) ? filter.authors.length * filter.kinds.length : Infinity,
525
+ filter.authors?.length && filter.kinds?.every((kind) => isAddressableKind(kind)) && filter["#d"]?.length ? filter.authors.length * filter.kinds.length * filter["#d"].length : Infinity
526
+ );
527
+ }
528
+
529
+ // fakejson.ts
530
+ var fakejson_exports = {};
531
+ __export(fakejson_exports, {
532
+ getHex64: () => getHex64,
533
+ getInt: () => getInt,
534
+ getSubscriptionId: () => getSubscriptionId,
535
+ matchEventId: () => matchEventId,
536
+ matchEventKind: () => matchEventKind,
537
+ matchEventPubkey: () => matchEventPubkey
538
+ });
539
+ function getHex64(json, field) {
540
+ let len = field.length + 3;
541
+ let idx = json.indexOf(`"${field}":`) + len;
542
+ let s = json.slice(idx).indexOf(`"`) + idx + 1;
543
+ return json.slice(s, s + 64);
544
+ }
545
+ function getInt(json, field) {
546
+ let len = field.length;
547
+ let idx = json.indexOf(`"${field}":`) + len + 3;
548
+ let sliced = json.slice(idx);
549
+ let end = Math.min(sliced.indexOf(","), sliced.indexOf("}"));
550
+ return parseInt(sliced.slice(0, end), 10);
551
+ }
552
+ function getSubscriptionId(json) {
553
+ let idx = json.slice(0, 22).indexOf(`"EVENT"`);
554
+ if (idx === -1)
555
+ return null;
556
+ let pstart = json.slice(idx + 7 + 1).indexOf(`"`);
557
+ if (pstart === -1)
558
+ return null;
559
+ let start = idx + 7 + 1 + pstart;
560
+ let pend = json.slice(start + 1, 80).indexOf(`"`);
561
+ if (pend === -1)
562
+ return null;
563
+ let end = start + 1 + pend;
564
+ return json.slice(start + 1, end);
565
+ }
566
+ function matchEventId(json, id) {
567
+ return id === getHex64(json, "id");
568
+ }
569
+ function matchEventPubkey(json, pubkey) {
570
+ return pubkey === getHex64(json, "pubkey");
571
+ }
572
+ function matchEventKind(json, kind) {
573
+ return kind === getInt(json, "kind");
574
+ }
575
+
576
+ // nip42.ts
577
+ var nip42_exports = {};
578
+ __export(nip42_exports, {
579
+ makeAuthEvent: () => makeAuthEvent
580
+ });
581
+ function makeAuthEvent(relayURL, challenge) {
582
+ return {
583
+ kind: ClientAuth,
584
+ created_at: Math.floor(Date.now() / 1e3),
585
+ tags: [
586
+ ["relay", relayURL],
587
+ ["challenge", challenge]
588
+ ],
589
+ content: ""
590
+ };
591
+ }
592
+
593
+ // abstract-relay.ts
594
+ var SendingOnClosedConnection = class extends Error {
595
+ constructor(message, relay) {
596
+ super(`Tried to send message '${message} on a closed connection to ${relay}.`);
597
+ this.name = "SendingOnClosedConnection";
598
+ }
599
+ };
600
+ var AbstractRelay = class {
601
+ url;
602
+ _connected = false;
603
+ onclose = null;
604
+ onnotice = (msg) => console.debug(`NOTICE from ${this.url}: ${msg}`);
605
+ onauth;
606
+ baseEoseTimeout = 4400;
607
+ publishTimeout = 4400;
608
+ pingFrequency = 29e3;
609
+ pingTimeout = 2e4;
610
+ resubscribeBackoff = [1e4, 1e4, 1e4, 2e4, 2e4, 3e4, 6e4];
611
+ openSubs = /* @__PURE__ */ new Map();
612
+ enablePing;
613
+ enableReconnect;
614
+ idleSince = Date.now();
615
+ ongoingOperations = 0;
616
+ reconnectTimeoutHandle;
617
+ pingIntervalHandle;
618
+ reconnectAttempts = 0;
619
+ skipReconnection = false;
620
+ connectionPromise;
621
+ openCountRequests = /* @__PURE__ */ new Map();
622
+ openEventPublishes = /* @__PURE__ */ new Map();
623
+ ws;
624
+ challenge;
625
+ authPromise;
626
+ serial = 0;
627
+ verifyEvent;
628
+ _WebSocket;
629
+ constructor(url, opts) {
630
+ this.url = normalizeURL(url);
631
+ this.verifyEvent = opts.verifyEvent;
632
+ this._WebSocket = opts.websocketImplementation || WebSocket;
633
+ this.enablePing = opts.enablePing;
634
+ this.enableReconnect = opts.enableReconnect || false;
635
+ }
636
+ static async connect(url, opts) {
637
+ const relay = new AbstractRelay(url, opts);
638
+ await relay.connect(opts);
639
+ return relay;
640
+ }
641
+ closeAllSubscriptions(reason) {
642
+ for (let [_, sub] of this.openSubs) {
643
+ sub.close(reason);
644
+ }
645
+ this.openSubs.clear();
646
+ for (let [_, ep] of this.openEventPublishes) {
647
+ ep.reject(new Error(reason));
648
+ }
649
+ this.openEventPublishes.clear();
650
+ for (let [_, cr] of this.openCountRequests) {
651
+ cr.reject(new Error(reason));
652
+ }
653
+ this.openCountRequests.clear();
654
+ }
655
+ get connected() {
656
+ return this._connected;
657
+ }
658
+ async reconnect() {
659
+ const backoff = this.resubscribeBackoff[Math.min(this.reconnectAttempts, this.resubscribeBackoff.length - 1)];
660
+ this.reconnectAttempts++;
661
+ this.reconnectTimeoutHandle = setTimeout(async () => {
662
+ try {
663
+ await this.connect();
664
+ } catch (err) {
665
+ }
666
+ }, backoff);
667
+ }
668
+ handleHardClose(reason) {
669
+ if (this.pingIntervalHandle) {
670
+ clearInterval(this.pingIntervalHandle);
671
+ this.pingIntervalHandle = void 0;
672
+ }
673
+ this._connected = false;
674
+ this.connectionPromise = void 0;
675
+ this.idleSince = void 0;
676
+ if (this.enableReconnect && !this.skipReconnection) {
677
+ this.reconnect();
678
+ } else {
679
+ this.onclose?.();
680
+ this.closeAllSubscriptions(reason);
681
+ }
682
+ }
683
+ async connect(opts) {
684
+ let connectionTimeoutHandle;
685
+ if (this.connectionPromise)
686
+ return this.connectionPromise;
687
+ this.challenge = void 0;
688
+ this.authPromise = void 0;
689
+ this.skipReconnection = false;
690
+ this.connectionPromise = new Promise((resolve, reject) => {
691
+ if (opts?.timeout) {
692
+ connectionTimeoutHandle = setTimeout(() => {
693
+ reject("connection timed out");
694
+ this.connectionPromise = void 0;
695
+ this.skipReconnection = true;
696
+ this.onclose?.();
697
+ this.handleHardClose("relay connection timed out");
698
+ }, opts.timeout);
699
+ }
700
+ if (opts?.abort) {
701
+ opts.abort.onabort = reject;
702
+ }
703
+ try {
704
+ this.ws = new this._WebSocket(this.url);
705
+ } catch (err) {
706
+ clearTimeout(connectionTimeoutHandle);
707
+ reject(err);
708
+ return;
709
+ }
710
+ this.ws.onopen = () => {
711
+ if (this.reconnectTimeoutHandle) {
712
+ clearTimeout(this.reconnectTimeoutHandle);
713
+ this.reconnectTimeoutHandle = void 0;
714
+ }
715
+ clearTimeout(connectionTimeoutHandle);
716
+ this._connected = true;
717
+ const isReconnection = this.reconnectAttempts > 0;
718
+ this.reconnectAttempts = 0;
719
+ for (const sub of this.openSubs.values()) {
720
+ sub.eosed = false;
721
+ if (isReconnection) {
722
+ for (let f = 0; f < sub.filters.length; f++) {
723
+ if (sub.lastEmitted) {
724
+ sub.filters[f].since = sub.lastEmitted + 1;
725
+ }
726
+ }
727
+ }
728
+ sub.fire();
729
+ }
730
+ if (this.enablePing) {
731
+ this.pingIntervalHandle = setInterval(() => this.pingpong(), this.pingFrequency);
732
+ }
733
+ resolve();
734
+ };
735
+ this.ws.onerror = () => {
736
+ clearTimeout(connectionTimeoutHandle);
737
+ reject("connection failed");
738
+ this.connectionPromise = void 0;
739
+ this.skipReconnection = true;
740
+ this.onclose?.();
741
+ this.handleHardClose("relay connection failed");
742
+ };
743
+ this.ws.onclose = (ev) => {
744
+ clearTimeout(connectionTimeoutHandle);
745
+ reject(ev.message || "websocket closed");
746
+ this.handleHardClose("relay connection closed");
747
+ };
748
+ this.ws.onmessage = this._onmessage.bind(this);
749
+ });
750
+ return this.connectionPromise;
751
+ }
752
+ waitForPingPong() {
753
+ return new Promise((resolve) => {
754
+ ;
755
+ this.ws.once("pong", () => resolve(true));
756
+ this.ws.ping();
757
+ });
758
+ }
759
+ waitForDummyReq() {
760
+ return new Promise((resolve, reject) => {
761
+ if (!this.connectionPromise)
762
+ return reject(new Error(`no connection to ${this.url}, can't ping`));
763
+ try {
764
+ const sub = this.subscribe(
765
+ [{ ids: ["aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"], limit: 0 }],
766
+ {
767
+ label: "<forced-ping>",
768
+ oneose: () => {
769
+ resolve(true);
770
+ sub.close();
771
+ },
772
+ onclose() {
773
+ resolve(true);
774
+ },
775
+ eoseTimeout: this.pingTimeout + 1e3
776
+ }
777
+ );
778
+ } catch (err) {
779
+ reject(err);
780
+ }
781
+ });
782
+ }
783
+ async pingpong() {
784
+ if (this.ws?.readyState === 1) {
785
+ const result = await Promise.any([
786
+ this.ws && this.ws.ping && this.ws.once ? this.waitForPingPong() : this.waitForDummyReq(),
787
+ new Promise((res) => setTimeout(() => res(false), this.pingTimeout))
788
+ ]);
789
+ if (!result) {
790
+ if (this.ws?.readyState === this._WebSocket.OPEN) {
791
+ this.ws?.close();
792
+ }
793
+ }
794
+ }
795
+ }
796
+ async send(message) {
797
+ if (!this.connectionPromise)
798
+ throw new SendingOnClosedConnection(message, this.url);
799
+ this.connectionPromise.then(() => {
800
+ this.ws?.send(message);
801
+ });
802
+ }
803
+ async auth(signAuthEvent) {
804
+ const challenge = this.challenge;
805
+ if (!challenge)
806
+ throw new Error("can't perform auth, no challenge was received");
807
+ if (this.authPromise)
808
+ return this.authPromise;
809
+ this.authPromise = new Promise(async (resolve, reject) => {
810
+ try {
811
+ let evt = await signAuthEvent(makeAuthEvent(this.url, challenge));
812
+ let timeout = setTimeout(() => {
813
+ let ep = this.openEventPublishes.get(evt.id);
814
+ if (ep) {
815
+ ep.reject(new Error("auth timed out"));
816
+ this.openEventPublishes.delete(evt.id);
817
+ }
818
+ }, this.publishTimeout);
819
+ this.openEventPublishes.set(evt.id, { resolve, reject, timeout });
820
+ this.send('["AUTH",' + JSON.stringify(evt) + "]");
821
+ } catch (err) {
822
+ console.warn("subscribe auth function failed:", err);
823
+ }
824
+ });
825
+ return this.authPromise;
826
+ }
827
+ async publish(event) {
828
+ this.idleSince = void 0;
829
+ this.ongoingOperations++;
830
+ const ret = new Promise((resolve, reject) => {
831
+ const timeout = setTimeout(() => {
832
+ const ep = this.openEventPublishes.get(event.id);
833
+ if (ep) {
834
+ ep.reject(new Error("publish timed out"));
835
+ this.openEventPublishes.delete(event.id);
836
+ }
837
+ }, this.publishTimeout);
838
+ this.openEventPublishes.set(event.id, { resolve, reject, timeout });
839
+ });
840
+ this.send('["EVENT",' + JSON.stringify(event) + "]");
841
+ this.ongoingOperations--;
842
+ if (this.ongoingOperations === 0)
843
+ this.idleSince = Date.now();
844
+ return ret;
845
+ }
846
+ async count(filters, params) {
847
+ this.serial++;
848
+ const id = params?.id || "count:" + this.serial;
849
+ const ret = new Promise((resolve, reject) => {
850
+ this.openCountRequests.set(id, { resolve, reject });
851
+ });
852
+ this.send('["COUNT","' + id + '",' + JSON.stringify(filters).substring(1));
853
+ return ret;
854
+ }
855
+ subscribe(filters, params) {
856
+ if (params.label !== "<forced-ping>") {
857
+ this.idleSince = void 0;
858
+ this.ongoingOperations++;
859
+ }
860
+ const sub = this.prepareSubscription(filters, params);
861
+ sub.fire();
862
+ if (params.abort) {
863
+ params.abort.onabort = () => sub.close(String(params.abort.reason || "<aborted>"));
864
+ }
865
+ return sub;
866
+ }
867
+ prepareSubscription(filters, params) {
868
+ this.serial++;
869
+ const id = params.id || (params.label ? params.label + ":" : "sub:") + this.serial;
870
+ const sub = new Subscription(this, id, filters, params);
871
+ this.openSubs.set(id, sub);
872
+ return sub;
873
+ }
874
+ close() {
875
+ this.skipReconnection = true;
876
+ if (this.reconnectTimeoutHandle) {
877
+ clearTimeout(this.reconnectTimeoutHandle);
878
+ this.reconnectTimeoutHandle = void 0;
879
+ }
880
+ if (this.pingIntervalHandle) {
881
+ clearInterval(this.pingIntervalHandle);
882
+ this.pingIntervalHandle = void 0;
883
+ }
884
+ this.closeAllSubscriptions("relay connection closed by us");
885
+ this._connected = false;
886
+ this.idleSince = void 0;
887
+ this.onclose?.();
888
+ if (this.ws?.readyState === this._WebSocket.OPEN) {
889
+ this.ws?.close();
890
+ }
891
+ }
892
+ _onmessage(ev) {
893
+ const json = ev.data;
894
+ if (!json) {
895
+ return;
896
+ }
897
+ const subid = getSubscriptionId(json);
898
+ if (subid) {
899
+ const so = this.openSubs.get(subid);
900
+ if (!so) {
901
+ return;
902
+ }
903
+ const id = getHex64(json, "id");
904
+ const alreadyHave = so.alreadyHaveEvent?.(id);
905
+ so.receivedEvent?.(this, id);
906
+ if (alreadyHave) {
907
+ return;
908
+ }
909
+ }
910
+ try {
911
+ let data = JSON.parse(json);
912
+ switch (data[0]) {
913
+ case "EVENT": {
914
+ const so = this.openSubs.get(data[1]);
915
+ const event = data[2];
916
+ if (this.verifyEvent(event) && matchFilters(so.filters, event)) {
917
+ so.onevent(event);
918
+ } else {
919
+ so.oninvalidevent?.(event);
920
+ }
921
+ if (!so.lastEmitted || so.lastEmitted < event.created_at)
922
+ so.lastEmitted = event.created_at;
923
+ return;
924
+ }
925
+ case "COUNT": {
926
+ const id = data[1];
927
+ const payload = data[2];
928
+ const cr = this.openCountRequests.get(id);
929
+ if (cr) {
930
+ cr.resolve(payload.count);
931
+ this.openCountRequests.delete(id);
932
+ }
933
+ return;
934
+ }
935
+ case "EOSE": {
936
+ const so = this.openSubs.get(data[1]);
937
+ if (!so)
938
+ return;
939
+ so.receivedEose();
940
+ return;
941
+ }
942
+ case "OK": {
943
+ const id = data[1];
944
+ const ok = data[2];
945
+ const reason = data[3];
946
+ const ep = this.openEventPublishes.get(id);
947
+ if (ep) {
948
+ clearTimeout(ep.timeout);
949
+ if (ok)
950
+ ep.resolve(reason);
951
+ else
952
+ ep.reject(new Error(reason));
953
+ this.openEventPublishes.delete(id);
954
+ }
955
+ return;
956
+ }
957
+ case "CLOSED": {
958
+ const id = data[1];
959
+ const so = this.openSubs.get(id);
960
+ if (!so)
961
+ return;
962
+ so.closed = true;
963
+ so.close(data[2]);
964
+ return;
965
+ }
966
+ case "NOTICE": {
967
+ this.onnotice(data[1]);
968
+ return;
969
+ }
970
+ case "AUTH": {
971
+ this.challenge = data[1];
972
+ if (this.onauth) {
973
+ this.auth(this.onauth).catch((err) => {
974
+ if (!(err instanceof SendingOnClosedConnection)) {
975
+ throw err;
976
+ }
977
+ });
978
+ }
979
+ return;
980
+ }
981
+ default: {
982
+ const so = this.openSubs.get(data[1]);
983
+ so?.oncustom?.(data);
984
+ return;
985
+ }
986
+ }
987
+ } catch (err) {
988
+ try {
989
+ const [_, __, event] = JSON.parse(json);
990
+ console.warn(`[nostr] relay ${this.url} error processing message:`, err, event);
991
+ } catch (_) {
992
+ console.warn(`[nostr] relay ${this.url} error processing message:`, err);
993
+ }
994
+ return;
995
+ }
996
+ }
997
+ };
998
+ var Subscription = class {
999
+ relay;
1000
+ id;
1001
+ lastEmitted;
1002
+ closed = false;
1003
+ eosed = false;
1004
+ filters;
1005
+ alreadyHaveEvent;
1006
+ receivedEvent;
1007
+ onevent;
1008
+ oninvalidevent;
1009
+ oneose;
1010
+ onclose;
1011
+ oncustom;
1012
+ eoseTimeout;
1013
+ eoseTimeoutHandle;
1014
+ constructor(relay, id, filters, params) {
1015
+ if (filters.length === 0)
1016
+ throw new Error("subscription can't be created with zero filters");
1017
+ this.relay = relay;
1018
+ this.filters = filters;
1019
+ this.id = id;
1020
+ this.alreadyHaveEvent = params.alreadyHaveEvent;
1021
+ this.receivedEvent = params.receivedEvent;
1022
+ this.eoseTimeout = params.eoseTimeout || relay.baseEoseTimeout;
1023
+ this.oneose = params.oneose;
1024
+ this.onclose = params.onclose;
1025
+ this.oninvalidevent = params.oninvalidevent;
1026
+ this.onevent = params.onevent || ((event) => {
1027
+ console.warn(
1028
+ `onevent() callback not defined for subscription '${this.id}' in relay ${this.relay.url}. event received:`,
1029
+ event
1030
+ );
1031
+ });
1032
+ }
1033
+ fire() {
1034
+ this.relay.send('["REQ","' + this.id + '",' + JSON.stringify(this.filters).substring(1));
1035
+ this.eoseTimeoutHandle = setTimeout(this.receivedEose.bind(this), this.eoseTimeout);
1036
+ }
1037
+ receivedEose() {
1038
+ if (this.eosed)
1039
+ return;
1040
+ clearTimeout(this.eoseTimeoutHandle);
1041
+ this.eosed = true;
1042
+ this.oneose?.();
1043
+ }
1044
+ close(reason = "closed by caller") {
1045
+ if (!this.closed && this.relay.connected) {
1046
+ try {
1047
+ this.relay.send('["CLOSE",' + JSON.stringify(this.id) + "]");
1048
+ } catch (err) {
1049
+ if (err instanceof SendingOnClosedConnection) {
1050
+ } else {
1051
+ throw err;
1052
+ }
1053
+ }
1054
+ this.closed = true;
1055
+ }
1056
+ this.relay.openSubs.delete(this.id);
1057
+ this.relay.ongoingOperations--;
1058
+ if (this.relay.ongoingOperations === 0)
1059
+ this.relay.idleSince = Date.now();
1060
+ this.onclose?.(reason);
1061
+ }
1062
+ };
1063
+
1064
+ // relay.ts
1065
+ var _WebSocket;
1066
+ try {
1067
+ _WebSocket = WebSocket;
1068
+ } catch {
1069
+ }
1070
+ var Relay = class extends AbstractRelay {
1071
+ constructor(url, options) {
1072
+ super(url, { verifyEvent, websocketImplementation: _WebSocket, ...options });
1073
+ }
1074
+ static async connect(url, options) {
1075
+ const relay = new Relay(url, options);
1076
+ await relay.connect();
1077
+ return relay;
1078
+ }
1079
+ };
1080
+
1081
+ // helpers.ts
1082
+ var alwaysTrue = (t) => {
1083
+ t[verifiedSymbol] = true;
1084
+ return true;
1085
+ };
1086
+
1087
+ // abstract-pool.ts
1088
+ var AbstractSimplePool = class {
1089
+ relays = /* @__PURE__ */ new Map();
1090
+ seenOn = /* @__PURE__ */ new Map();
1091
+ trackRelays = false;
1092
+ verifyEvent;
1093
+ enablePing;
1094
+ enableReconnect;
1095
+ automaticallyAuth;
1096
+ trustedRelayURLs = /* @__PURE__ */ new Set();
1097
+ onRelayConnectionFailure;
1098
+ onRelayConnectionSuccess;
1099
+ allowConnectingToRelay;
1100
+ maxWaitForConnection;
1101
+ _WebSocket;
1102
+ constructor(opts) {
1103
+ this.verifyEvent = opts.verifyEvent;
1104
+ this._WebSocket = opts.websocketImplementation;
1105
+ this.enablePing = opts.enablePing;
1106
+ this.enableReconnect = opts.enableReconnect || false;
1107
+ this.automaticallyAuth = opts.automaticallyAuth;
1108
+ this.onRelayConnectionFailure = opts.onRelayConnectionFailure;
1109
+ this.onRelayConnectionSuccess = opts.onRelayConnectionSuccess;
1110
+ this.allowConnectingToRelay = opts.allowConnectingToRelay;
1111
+ this.maxWaitForConnection = opts.maxWaitForConnection || 3e3;
1112
+ }
1113
+ async ensureRelay(url, params) {
1114
+ url = normalizeURL(url);
1115
+ let relay = this.relays.get(url);
1116
+ if (!relay) {
1117
+ relay = new AbstractRelay(url, {
1118
+ verifyEvent: this.trustedRelayURLs.has(url) ? alwaysTrue : this.verifyEvent,
1119
+ websocketImplementation: this._WebSocket,
1120
+ enablePing: this.enablePing,
1121
+ enableReconnect: this.enableReconnect
1122
+ });
1123
+ relay.onclose = () => {
1124
+ this.relays.delete(url);
1125
+ };
1126
+ this.relays.set(url, relay);
1127
+ }
1128
+ if (this.automaticallyAuth) {
1129
+ const authSignerFn = this.automaticallyAuth(url);
1130
+ if (authSignerFn) {
1131
+ relay.onauth = authSignerFn;
1132
+ }
1133
+ }
1134
+ try {
1135
+ await relay.connect({
1136
+ timeout: params?.connectionTimeout,
1137
+ abort: params?.abort
1138
+ });
1139
+ } catch (err) {
1140
+ this.relays.delete(url);
1141
+ throw err;
1142
+ }
1143
+ return relay;
1144
+ }
1145
+ close(relays) {
1146
+ relays.map(normalizeURL).forEach((url) => {
1147
+ this.relays.get(url)?.close();
1148
+ this.relays.delete(url);
1149
+ });
1150
+ }
1151
+ subscribe(relays, filter, params) {
1152
+ const request = [];
1153
+ const uniqUrls = [];
1154
+ for (let i2 = 0; i2 < relays.length; i2++) {
1155
+ const url = normalizeURL(relays[i2]);
1156
+ if (!request.find((r) => r.url === url)) {
1157
+ if (uniqUrls.indexOf(url) === -1) {
1158
+ uniqUrls.push(url);
1159
+ request.push({ url, filter });
1160
+ }
1161
+ }
1162
+ }
1163
+ return this.subscribeMap(request, params);
1164
+ }
1165
+ subscribeMany(relays, filter, params) {
1166
+ return this.subscribe(relays, filter, params);
1167
+ }
1168
+ subscribeMap(requests, params) {
1169
+ const grouped = /* @__PURE__ */ new Map();
1170
+ for (const req of requests) {
1171
+ const { url, filter } = req;
1172
+ if (!grouped.has(url))
1173
+ grouped.set(url, []);
1174
+ grouped.get(url).push(filter);
1175
+ }
1176
+ const groupedRequests = Array.from(grouped.entries()).map(([url, filters]) => ({ url, filters }));
1177
+ if (this.trackRelays) {
1178
+ params.receivedEvent = (relay, id) => {
1179
+ let set = this.seenOn.get(id);
1180
+ if (!set) {
1181
+ set = /* @__PURE__ */ new Set();
1182
+ this.seenOn.set(id, set);
1183
+ }
1184
+ set.add(relay);
1185
+ };
1186
+ }
1187
+ const _knownIds = /* @__PURE__ */ new Set();
1188
+ const subs = [];
1189
+ const eosesReceived = [];
1190
+ let handleEose = (i2) => {
1191
+ if (eosesReceived[i2])
1192
+ return;
1193
+ eosesReceived[i2] = true;
1194
+ if (eosesReceived.filter((a) => a).length === groupedRequests.length) {
1195
+ params.oneose?.();
1196
+ handleEose = () => {
1197
+ };
1198
+ }
1199
+ };
1200
+ const closesReceived = [];
1201
+ let handleClose = (i2, reason) => {
1202
+ if (closesReceived[i2])
1203
+ return;
1204
+ handleEose(i2);
1205
+ closesReceived[i2] = reason;
1206
+ if (closesReceived.filter((a) => a).length === groupedRequests.length) {
1207
+ params.onclose?.(closesReceived);
1208
+ handleClose = () => {
1209
+ };
1210
+ }
1211
+ };
1212
+ const localAlreadyHaveEventHandler = (id) => {
1213
+ if (params.alreadyHaveEvent?.(id)) {
1214
+ return true;
1215
+ }
1216
+ const have = _knownIds.has(id);
1217
+ _knownIds.add(id);
1218
+ return have;
1219
+ };
1220
+ const allOpened = Promise.all(
1221
+ groupedRequests.map(async ({ url, filters }, i2) => {
1222
+ if (this.allowConnectingToRelay?.(url, ["read", filters]) === false) {
1223
+ handleClose(i2, "connection skipped by allowConnectingToRelay");
1224
+ return;
1225
+ }
1226
+ let relay;
1227
+ try {
1228
+ relay = await this.ensureRelay(url, {
1229
+ connectionTimeout: this.maxWaitForConnection < (params.maxWait || 0) ? Math.max(params.maxWait * 0.8, params.maxWait - 1e3) : this.maxWaitForConnection,
1230
+ abort: params.abort
1231
+ });
1232
+ } catch (err) {
1233
+ this.onRelayConnectionFailure?.(url);
1234
+ handleClose(i2, err?.message || String(err));
1235
+ return;
1236
+ }
1237
+ this.onRelayConnectionSuccess?.(url);
1238
+ let subscription = relay.subscribe(filters, {
1239
+ ...params,
1240
+ oneose: () => handleEose(i2),
1241
+ onclose: (reason) => {
1242
+ if (reason.startsWith("auth-required: ") && params.onauth) {
1243
+ relay.auth(params.onauth).then(() => {
1244
+ relay.subscribe(filters, {
1245
+ ...params,
1246
+ oneose: () => handleEose(i2),
1247
+ onclose: (reason2) => {
1248
+ handleClose(i2, reason2);
1249
+ },
1250
+ alreadyHaveEvent: localAlreadyHaveEventHandler,
1251
+ eoseTimeout: params.maxWait,
1252
+ abort: params.abort
1253
+ });
1254
+ }).catch((err) => {
1255
+ handleClose(i2, `auth was required and attempted, but failed with: ${err}`);
1256
+ });
1257
+ } else {
1258
+ handleClose(i2, reason);
1259
+ }
1260
+ },
1261
+ alreadyHaveEvent: localAlreadyHaveEventHandler,
1262
+ eoseTimeout: params.maxWait,
1263
+ abort: params.abort
1264
+ });
1265
+ subs.push(subscription);
1266
+ })
1267
+ );
1268
+ return {
1269
+ async close(reason) {
1270
+ await allOpened;
1271
+ subs.forEach((sub) => {
1272
+ sub.close(reason);
1273
+ });
1274
+ }
1275
+ };
1276
+ }
1277
+ subscribeEose(relays, filter, params) {
1278
+ let subcloser;
1279
+ subcloser = this.subscribe(relays, filter, {
1280
+ ...params,
1281
+ oneose() {
1282
+ const reason = "closed automatically on eose";
1283
+ if (subcloser)
1284
+ subcloser.close(reason);
1285
+ else
1286
+ params.onclose?.(relays.map((_) => reason));
1287
+ }
1288
+ });
1289
+ return subcloser;
1290
+ }
1291
+ subscribeManyEose(relays, filter, params) {
1292
+ return this.subscribeEose(relays, filter, params);
1293
+ }
1294
+ async querySync(relays, filter, params) {
1295
+ return new Promise(async (resolve) => {
1296
+ const events = [];
1297
+ this.subscribeEose(relays, filter, {
1298
+ ...params,
1299
+ onevent(event) {
1300
+ events.push(event);
1301
+ },
1302
+ onclose(_) {
1303
+ resolve(events);
1304
+ }
1305
+ });
1306
+ });
1307
+ }
1308
+ async get(relays, filter, params) {
1309
+ filter.limit = 1;
1310
+ const events = await this.querySync(relays, filter, params);
1311
+ events.sort((a, b) => b.created_at - a.created_at);
1312
+ return events[0] || null;
1313
+ }
1314
+ publish(relays, event, params) {
1315
+ return relays.map(normalizeURL).map(async (url, i2, arr) => {
1316
+ if (arr.indexOf(url) !== i2) {
1317
+ return Promise.reject("duplicate url");
1318
+ }
1319
+ if (this.allowConnectingToRelay?.(url, ["write", event]) === false) {
1320
+ return Promise.reject("connection skipped by allowConnectingToRelay");
1321
+ }
1322
+ let r;
1323
+ try {
1324
+ r = await this.ensureRelay(url, {
1325
+ connectionTimeout: this.maxWaitForConnection < (params?.maxWait || 0) ? Math.max(params.maxWait * 0.8, params.maxWait - 1e3) : this.maxWaitForConnection,
1326
+ abort: params?.abort
1327
+ });
1328
+ } catch (err) {
1329
+ this.onRelayConnectionFailure?.(url);
1330
+ return String("connection failure: " + String(err));
1331
+ }
1332
+ return r.publish(event).catch(async (err) => {
1333
+ if (err instanceof Error && err.message.startsWith("auth-required: ") && params?.onauth) {
1334
+ await r.auth(params.onauth);
1335
+ return r.publish(event);
1336
+ }
1337
+ throw err;
1338
+ }).then((reason) => {
1339
+ if (this.trackRelays) {
1340
+ let set = this.seenOn.get(event.id);
1341
+ if (!set) {
1342
+ set = /* @__PURE__ */ new Set();
1343
+ this.seenOn.set(event.id, set);
1344
+ }
1345
+ set.add(r);
1346
+ }
1347
+ return reason;
1348
+ });
1349
+ });
1350
+ }
1351
+ listConnectionStatus() {
1352
+ const map = /* @__PURE__ */ new Map();
1353
+ this.relays.forEach((relay, url) => map.set(url, relay.connected));
1354
+ return map;
1355
+ }
1356
+ destroy() {
1357
+ this.relays.forEach((conn) => conn.close());
1358
+ this.relays = /* @__PURE__ */ new Map();
1359
+ }
1360
+ pruneIdleRelays(idleThresholdMs = 1e4) {
1361
+ const prunedUrls = [];
1362
+ for (const [url, relay] of this.relays) {
1363
+ if (relay.idleSince && Date.now() - relay.idleSince >= idleThresholdMs) {
1364
+ this.relays.delete(url);
1365
+ prunedUrls.push(url);
1366
+ relay.close();
1367
+ }
1368
+ }
1369
+ return prunedUrls;
1370
+ }
1371
+ };
1372
+
1373
+ // pool.ts
1374
+ var _WebSocket2;
1375
+ try {
1376
+ _WebSocket2 = WebSocket;
1377
+ } catch {
1378
+ }
1379
+ var SimplePool = class extends AbstractSimplePool {
1380
+ constructor(options) {
1381
+ super({ verifyEvent, websocketImplementation: _WebSocket2, maxWaitForConnection: 3e3, ...options });
1382
+ }
1383
+ };
1384
+
1385
+ // nip19.ts
1386
+ var nip19_exports = {};
1387
+ __export(nip19_exports, {
1388
+ BECH32_REGEX: () => BECH32_REGEX,
1389
+ Bech32MaxSize: () => Bech32MaxSize,
1390
+ NostrTypeGuard: () => NostrTypeGuard,
1391
+ decode: () => decode,
1392
+ decodeNostrURI: () => decodeNostrURI,
1393
+ encodeBytes: () => encodeBytes,
1394
+ naddrEncode: () => naddrEncode,
1395
+ neventEncode: () => neventEncode,
1396
+ noteEncode: () => noteEncode,
1397
+ nprofileEncode: () => nprofileEncode,
1398
+ npubEncode: () => npubEncode,
1399
+ nsecEncode: () => nsecEncode
1400
+ });
1401
+ import { bytesToHex as bytesToHex3, concatBytes, hexToBytes as hexToBytes3 } from "@noble/hashes/utils.js";
1402
+ import { bech32 } from "@scure/base";
1403
+ var NostrTypeGuard = {
1404
+ isNProfile: (value) => /^nprofile1[a-z\d]+$/.test(value || ""),
1405
+ isNEvent: (value) => /^nevent1[a-z\d]+$/.test(value || ""),
1406
+ isNAddr: (value) => /^naddr1[a-z\d]+$/.test(value || ""),
1407
+ isNSec: (value) => /^nsec1[a-z\d]{58}$/.test(value || ""),
1408
+ isNPub: (value) => /^npub1[a-z\d]{58}$/.test(value || ""),
1409
+ isNote: (value) => /^note1[a-z\d]+$/.test(value || ""),
1410
+ isNcryptsec: (value) => /^ncryptsec1[a-z\d]+$/.test(value || "")
1411
+ };
1412
+ var Bech32MaxSize = 5e3;
1413
+ var BECH32_REGEX = /[\x21-\x7E]{1,83}1[023456789acdefghjklmnpqrstuvwxyz]{6,}/;
1414
+ function integerToUint8Array(number) {
1415
+ const uint8Array = new Uint8Array(4);
1416
+ uint8Array[0] = number >> 24 & 255;
1417
+ uint8Array[1] = number >> 16 & 255;
1418
+ uint8Array[2] = number >> 8 & 255;
1419
+ uint8Array[3] = number & 255;
1420
+ return uint8Array;
1421
+ }
1422
+ function decodeNostrURI(nip19code) {
1423
+ try {
1424
+ if (nip19code.startsWith("nostr:"))
1425
+ nip19code = nip19code.substring(6);
1426
+ return decode(nip19code);
1427
+ } catch (_err) {
1428
+ return { type: "invalid", data: null };
1429
+ }
1430
+ }
1431
+ function decode(code) {
1432
+ let { prefix, words } = bech32.decode(code, Bech32MaxSize);
1433
+ let data = new Uint8Array(bech32.fromWords(words));
1434
+ switch (prefix) {
1435
+ case "nprofile": {
1436
+ let tlv = parseTLV(data);
1437
+ if (!tlv[0]?.[0])
1438
+ throw new Error("missing TLV 0 for nprofile");
1439
+ if (tlv[0][0].length !== 32)
1440
+ throw new Error("TLV 0 should be 32 bytes");
1441
+ return {
1442
+ type: "nprofile",
1443
+ data: {
1444
+ pubkey: bytesToHex3(tlv[0][0]),
1445
+ relays: tlv[1] ? tlv[1].map((d) => utf8Decoder.decode(d)) : []
1446
+ }
1447
+ };
1448
+ }
1449
+ case "nevent": {
1450
+ let tlv = parseTLV(data);
1451
+ if (!tlv[0]?.[0])
1452
+ throw new Error("missing TLV 0 for nevent");
1453
+ if (tlv[0][0].length !== 32)
1454
+ throw new Error("TLV 0 should be 32 bytes");
1455
+ if (tlv[2] && tlv[2][0].length !== 32)
1456
+ throw new Error("TLV 2 should be 32 bytes");
1457
+ if (tlv[3] && tlv[3][0].length !== 4)
1458
+ throw new Error("TLV 3 should be 4 bytes");
1459
+ return {
1460
+ type: "nevent",
1461
+ data: {
1462
+ id: bytesToHex3(tlv[0][0]),
1463
+ relays: tlv[1] ? tlv[1].map((d) => utf8Decoder.decode(d)) : [],
1464
+ author: tlv[2]?.[0] ? bytesToHex3(tlv[2][0]) : void 0,
1465
+ kind: tlv[3]?.[0] ? parseInt(bytesToHex3(tlv[3][0]), 16) : void 0
1466
+ }
1467
+ };
1468
+ }
1469
+ case "naddr": {
1470
+ let tlv = parseTLV(data);
1471
+ if (!tlv[0]?.[0])
1472
+ throw new Error("missing TLV 0 for naddr");
1473
+ if (!tlv[2]?.[0])
1474
+ throw new Error("missing TLV 2 for naddr");
1475
+ if (tlv[2][0].length !== 32)
1476
+ throw new Error("TLV 2 should be 32 bytes");
1477
+ if (!tlv[3]?.[0])
1478
+ throw new Error("missing TLV 3 for naddr");
1479
+ if (tlv[3][0].length !== 4)
1480
+ throw new Error("TLV 3 should be 4 bytes");
1481
+ return {
1482
+ type: "naddr",
1483
+ data: {
1484
+ identifier: utf8Decoder.decode(tlv[0][0]),
1485
+ pubkey: bytesToHex3(tlv[2][0]),
1486
+ kind: parseInt(bytesToHex3(tlv[3][0]), 16),
1487
+ relays: tlv[1] ? tlv[1].map((d) => utf8Decoder.decode(d)) : []
1488
+ }
1489
+ };
1490
+ }
1491
+ case "nsec":
1492
+ return { type: prefix, data };
1493
+ case "npub":
1494
+ case "note":
1495
+ return { type: prefix, data: bytesToHex3(data) };
1496
+ default:
1497
+ throw new Error(`unknown prefix ${prefix}`);
1498
+ }
1499
+ }
1500
+ function parseTLV(data) {
1501
+ let result = {};
1502
+ let rest = data;
1503
+ while (rest.length > 0) {
1504
+ let t = rest[0];
1505
+ let l = rest[1];
1506
+ let v = rest.slice(2, 2 + l);
1507
+ rest = rest.slice(2 + l);
1508
+ if (v.length < l)
1509
+ throw new Error(`not enough data to read on TLV ${t}`);
1510
+ result[t] = result[t] || [];
1511
+ result[t].push(v);
1512
+ }
1513
+ return result;
1514
+ }
1515
+ function nsecEncode(key) {
1516
+ return encodeBytes("nsec", key);
1517
+ }
1518
+ function npubEncode(hex) {
1519
+ return encodeBytes("npub", hexToBytes3(hex));
1520
+ }
1521
+ function noteEncode(hex) {
1522
+ return encodeBytes("note", hexToBytes3(hex));
1523
+ }
1524
+ function encodeBech32(prefix, data) {
1525
+ let words = bech32.toWords(data);
1526
+ return bech32.encode(prefix, words, Bech32MaxSize);
1527
+ }
1528
+ function encodeBytes(prefix, bytes) {
1529
+ return encodeBech32(prefix, bytes);
1530
+ }
1531
+ function nprofileEncode(profile) {
1532
+ let data = encodeTLV({
1533
+ 0: [hexToBytes3(profile.pubkey)],
1534
+ 1: (profile.relays || []).map((url) => utf8Encoder.encode(url))
1535
+ });
1536
+ return encodeBech32("nprofile", data);
1537
+ }
1538
+ function neventEncode(event) {
1539
+ let kindArray;
1540
+ if (event.kind !== void 0) {
1541
+ kindArray = integerToUint8Array(event.kind);
1542
+ }
1543
+ let data = encodeTLV({
1544
+ 0: [hexToBytes3(event.id)],
1545
+ 1: (event.relays || []).map((url) => utf8Encoder.encode(url)),
1546
+ 2: event.author ? [hexToBytes3(event.author)] : [],
1547
+ 3: kindArray ? [new Uint8Array(kindArray)] : []
1548
+ });
1549
+ return encodeBech32("nevent", data);
1550
+ }
1551
+ function naddrEncode(addr) {
1552
+ let kind = new ArrayBuffer(4);
1553
+ new DataView(kind).setUint32(0, addr.kind, false);
1554
+ let data = encodeTLV({
1555
+ 0: [utf8Encoder.encode(addr.identifier)],
1556
+ 1: (addr.relays || []).map((url) => utf8Encoder.encode(url)),
1557
+ 2: [hexToBytes3(addr.pubkey)],
1558
+ 3: [new Uint8Array(kind)]
1559
+ });
1560
+ return encodeBech32("naddr", data);
1561
+ }
1562
+ function encodeTLV(tlv) {
1563
+ let entries = [];
1564
+ Object.entries(tlv).reverse().forEach(([t, vs]) => {
1565
+ vs.forEach((v) => {
1566
+ let entry = new Uint8Array(v.length + 2);
1567
+ entry.set([parseInt(t)], 0);
1568
+ entry.set([v.length], 1);
1569
+ entry.set(v, 2);
1570
+ entries.push(entry);
1571
+ });
1572
+ });
1573
+ return concatBytes(...entries);
1574
+ }
1575
+
1576
+ // references.ts
1577
+ var mentionRegex = /\bnostr:((note|npub|naddr|nevent|nprofile)1\w+)\b|#\[(\d+)\]/g;
1578
+ function parseReferences(evt) {
1579
+ let references = [];
1580
+ for (let ref of evt.content.matchAll(mentionRegex)) {
1581
+ if (ref[2]) {
1582
+ try {
1583
+ let { type, data } = decode(ref[1]);
1584
+ switch (type) {
1585
+ case "npub": {
1586
+ references.push({
1587
+ text: ref[0],
1588
+ profile: { pubkey: data, relays: [] }
1589
+ });
1590
+ break;
1591
+ }
1592
+ case "nprofile": {
1593
+ references.push({
1594
+ text: ref[0],
1595
+ profile: data
1596
+ });
1597
+ break;
1598
+ }
1599
+ case "note": {
1600
+ references.push({
1601
+ text: ref[0],
1602
+ event: { id: data, relays: [] }
1603
+ });
1604
+ break;
1605
+ }
1606
+ case "nevent": {
1607
+ references.push({
1608
+ text: ref[0],
1609
+ event: data
1610
+ });
1611
+ break;
1612
+ }
1613
+ case "naddr": {
1614
+ references.push({
1615
+ text: ref[0],
1616
+ address: data
1617
+ });
1618
+ break;
1619
+ }
1620
+ }
1621
+ } catch (err) {
1622
+ }
1623
+ } else if (ref[3]) {
1624
+ let idx = parseInt(ref[3], 10);
1625
+ let tag = evt.tags[idx];
1626
+ if (!tag)
1627
+ continue;
1628
+ switch (tag[0]) {
1629
+ case "p": {
1630
+ references.push({
1631
+ text: ref[0],
1632
+ profile: { pubkey: tag[1], relays: tag[2] ? [tag[2]] : [] }
1633
+ });
1634
+ break;
1635
+ }
1636
+ case "e": {
1637
+ references.push({
1638
+ text: ref[0],
1639
+ event: { id: tag[1], relays: tag[2] ? [tag[2]] : [] }
1640
+ });
1641
+ break;
1642
+ }
1643
+ case "a": {
1644
+ try {
1645
+ let [kind, pubkey, identifier] = tag[1].split(":");
1646
+ references.push({
1647
+ text: ref[0],
1648
+ address: {
1649
+ identifier,
1650
+ pubkey,
1651
+ kind: parseInt(kind, 10),
1652
+ relays: tag[2] ? [tag[2]] : []
1653
+ }
1654
+ });
1655
+ } catch (err) {
1656
+ }
1657
+ break;
1658
+ }
1659
+ }
1660
+ }
1661
+ }
1662
+ return references;
1663
+ }
1664
+
1665
+ // nip04.ts
1666
+ var nip04_exports = {};
1667
+ __export(nip04_exports, {
1668
+ decrypt: () => decrypt,
1669
+ encrypt: () => encrypt
1670
+ });
1671
+ import { hexToBytes as hexToBytes4, randomBytes } from "@noble/hashes/utils.js";
1672
+ import { secp256k1 } from "@noble/curves/secp256k1.js";
1673
+ import { cbc } from "@noble/ciphers/aes.js";
1674
+ import { base64 } from "@scure/base";
1675
+ function encrypt(secretKey, pubkey, text) {
1676
+ const privkey = secretKey instanceof Uint8Array ? secretKey : hexToBytes4(secretKey);
1677
+ const key = secp256k1.getSharedSecret(privkey, hexToBytes4("02" + pubkey));
1678
+ const normalizedKey = getNormalizedX(key);
1679
+ let iv = Uint8Array.from(randomBytes(16));
1680
+ let plaintext = utf8Encoder.encode(text);
1681
+ let ciphertext = cbc(normalizedKey, iv).encrypt(plaintext);
1682
+ let ctb64 = base64.encode(new Uint8Array(ciphertext));
1683
+ let ivb64 = base64.encode(new Uint8Array(iv.buffer));
1684
+ return `${ctb64}?iv=${ivb64}`;
1685
+ }
1686
+ function decrypt(secretKey, pubkey, data) {
1687
+ const privkey = secretKey instanceof Uint8Array ? secretKey : hexToBytes4(secretKey);
1688
+ let [ctb64, ivb64] = data.split("?iv=");
1689
+ let key = secp256k1.getSharedSecret(privkey, hexToBytes4("02" + pubkey));
1690
+ let normalizedKey = getNormalizedX(key);
1691
+ let iv = base64.decode(ivb64);
1692
+ let ciphertext = base64.decode(ctb64);
1693
+ let plaintext = cbc(normalizedKey, iv).decrypt(ciphertext);
1694
+ return utf8Decoder.decode(plaintext);
1695
+ }
1696
+ function getNormalizedX(key) {
1697
+ return key.slice(1, 33);
1698
+ }
1699
+
1700
+ // nip05.ts
1701
+ var nip05_exports = {};
1702
+ __export(nip05_exports, {
1703
+ NIP05_REGEX: () => NIP05_REGEX,
1704
+ isNip05: () => isNip05,
1705
+ isValid: () => isValid,
1706
+ queryProfile: () => queryProfile,
1707
+ searchDomain: () => searchDomain,
1708
+ useFetchImplementation: () => useFetchImplementation
1709
+ });
1710
+ var NIP05_REGEX = /^(?:([\w.+-]+)@)?([\w_-]+(\.[\w_-]+)+)$/;
1711
+ var isNip05 = (value) => NIP05_REGEX.test(value || "");
1712
+ var _fetch;
1713
+ try {
1714
+ _fetch = fetch;
1715
+ } catch (_) {
1716
+ null;
1717
+ }
1718
+ function useFetchImplementation(fetchImplementation) {
1719
+ _fetch = fetchImplementation;
1720
+ }
1721
+ async function searchDomain(domain, query = "") {
1722
+ try {
1723
+ const url = `https://${domain}/.well-known/nostr.json?name=${query}`;
1724
+ const res = await _fetch(url, { redirect: "manual" });
1725
+ if (res.status !== 200) {
1726
+ throw Error("Wrong response code");
1727
+ }
1728
+ const json = await res.json();
1729
+ return json.names;
1730
+ } catch (_) {
1731
+ return {};
1732
+ }
1733
+ }
1734
+ async function queryProfile(fullname) {
1735
+ const match = fullname.match(NIP05_REGEX);
1736
+ if (!match)
1737
+ return null;
1738
+ const [, name = "_", domain] = match;
1739
+ try {
1740
+ const url = `https://${domain}/.well-known/nostr.json?name=${name}`;
1741
+ const res = await _fetch(url, { redirect: "manual" });
1742
+ if (res.status !== 200) {
1743
+ throw Error("Wrong response code");
1744
+ }
1745
+ const json = await res.json();
1746
+ const pubkey = json.names[name];
1747
+ return pubkey ? { pubkey, relays: json.relays?.[pubkey] } : null;
1748
+ } catch (_e) {
1749
+ return null;
1750
+ }
1751
+ }
1752
+ async function isValid(pubkey, nip05) {
1753
+ const res = await queryProfile(nip05);
1754
+ return res ? res.pubkey === pubkey : false;
1755
+ }
1756
+
1757
+ // nip10.ts
1758
+ var nip10_exports = {};
1759
+ __export(nip10_exports, {
1760
+ parse: () => parse
1761
+ });
1762
+ function parse(event) {
1763
+ const result = {
1764
+ reply: void 0,
1765
+ root: void 0,
1766
+ mentions: [],
1767
+ profiles: [],
1768
+ quotes: []
1769
+ };
1770
+ let maybeParent;
1771
+ let maybeRoot;
1772
+ for (let i2 = event.tags.length - 1; i2 >= 0; i2--) {
1773
+ const tag = event.tags[i2];
1774
+ if (tag[0] === "e" && tag[1]) {
1775
+ const [_, eTagEventId, eTagRelayUrl, eTagMarker, eTagAuthor] = tag;
1776
+ const eventPointer = {
1777
+ id: eTagEventId,
1778
+ relays: eTagRelayUrl ? [eTagRelayUrl] : [],
1779
+ author: eTagAuthor
1780
+ };
1781
+ if (eTagMarker === "root") {
1782
+ result.root = eventPointer;
1783
+ continue;
1784
+ }
1785
+ if (eTagMarker === "reply") {
1786
+ result.reply = eventPointer;
1787
+ continue;
1788
+ }
1789
+ if (eTagMarker === "mention") {
1790
+ result.mentions.push(eventPointer);
1791
+ continue;
1792
+ }
1793
+ if (!maybeParent) {
1794
+ maybeParent = eventPointer;
1795
+ } else {
1796
+ maybeRoot = eventPointer;
1797
+ }
1798
+ result.mentions.push(eventPointer);
1799
+ continue;
1800
+ }
1801
+ if (tag[0] === "q" && tag[1]) {
1802
+ const [_, eTagEventId, eTagRelayUrl] = tag;
1803
+ result.quotes.push({
1804
+ id: eTagEventId,
1805
+ relays: eTagRelayUrl ? [eTagRelayUrl] : []
1806
+ });
1807
+ }
1808
+ if (tag[0] === "p" && tag[1]) {
1809
+ result.profiles.push({
1810
+ pubkey: tag[1],
1811
+ relays: tag[2] ? [tag[2]] : []
1812
+ });
1813
+ continue;
1814
+ }
1815
+ }
1816
+ if (!result.root) {
1817
+ result.root = maybeRoot || maybeParent || result.reply;
1818
+ }
1819
+ if (!result.reply) {
1820
+ result.reply = maybeParent || result.root;
1821
+ }
1822
+ ;
1823
+ [result.reply, result.root].forEach((ref) => {
1824
+ if (!ref)
1825
+ return;
1826
+ let idx = result.mentions.indexOf(ref);
1827
+ if (idx !== -1) {
1828
+ result.mentions.splice(idx, 1);
1829
+ }
1830
+ if (ref.author) {
1831
+ let author = result.profiles.find((p) => p.pubkey === ref.author);
1832
+ if (author && author.relays) {
1833
+ if (!ref.relays) {
1834
+ ref.relays = [];
1835
+ }
1836
+ author.relays.forEach((url) => {
1837
+ if (ref.relays?.indexOf(url) === -1)
1838
+ ref.relays.push(url);
1839
+ });
1840
+ author.relays = ref.relays;
1841
+ }
1842
+ }
1843
+ });
1844
+ result.mentions.forEach((ref) => {
1845
+ if (ref.author) {
1846
+ let author = result.profiles.find((p) => p.pubkey === ref.author);
1847
+ if (author && author.relays) {
1848
+ if (!ref.relays) {
1849
+ ref.relays = [];
1850
+ }
1851
+ author.relays.forEach((url) => {
1852
+ if (ref.relays.indexOf(url) === -1)
1853
+ ref.relays.push(url);
1854
+ });
1855
+ author.relays = ref.relays;
1856
+ }
1857
+ }
1858
+ });
1859
+ return result;
1860
+ }
1861
+
1862
+ // nip11.ts
1863
+ var nip11_exports = {};
1864
+ __export(nip11_exports, {
1865
+ fetchRelayInformation: () => fetchRelayInformation,
1866
+ useFetchImplementation: () => useFetchImplementation2
1867
+ });
1868
+ var _fetch2;
1869
+ try {
1870
+ _fetch2 = fetch;
1871
+ } catch {
1872
+ }
1873
+ function useFetchImplementation2(fetchImplementation) {
1874
+ _fetch2 = fetchImplementation;
1875
+ }
1876
+ async function fetchRelayInformation(url) {
1877
+ return await (await fetch(url.replace("ws://", "http://").replace("wss://", "https://"), {
1878
+ headers: { Accept: "application/nostr+json" }
1879
+ })).json();
1880
+ }
1881
+
1882
+ // nip13.ts
1883
+ var nip13_exports = {};
1884
+ __export(nip13_exports, {
1885
+ getPow: () => getPow,
1886
+ minePow: () => minePow
1887
+ });
1888
+ import { bytesToHex as bytesToHex4 } from "@noble/hashes/utils.js";
1889
+ import { sha256 as sha2562 } from "@noble/hashes/sha2.js";
1890
+ function getPow(hex) {
1891
+ let count = 0;
1892
+ for (let i2 = 0; i2 < 64; i2 += 8) {
1893
+ const nibble = parseInt(hex.substring(i2, i2 + 8), 16);
1894
+ if (nibble === 0) {
1895
+ count += 32;
1896
+ } else {
1897
+ count += Math.clz32(nibble);
1898
+ break;
1899
+ }
1900
+ }
1901
+ return count;
1902
+ }
1903
+ function getPowFromBytes(hash) {
1904
+ let count = 0;
1905
+ for (let i2 = 0; i2 < hash.length; i2++) {
1906
+ const byte = hash[i2];
1907
+ if (byte === 0) {
1908
+ count += 8;
1909
+ } else {
1910
+ count += Math.clz32(byte) - 24;
1911
+ break;
1912
+ }
1913
+ }
1914
+ return count;
1915
+ }
1916
+ function minePow(unsigned, difficulty) {
1917
+ let count = 0;
1918
+ const event = unsigned;
1919
+ const tag = ["nonce", count.toString(), difficulty.toString()];
1920
+ event.tags.push(tag);
1921
+ while (true) {
1922
+ const now2 = Math.floor(new Date().getTime() / 1e3);
1923
+ if (now2 !== event.created_at) {
1924
+ count = 0;
1925
+ event.created_at = now2;
1926
+ }
1927
+ tag[1] = (++count).toString();
1928
+ const hash = sha2562(
1929
+ utf8Encoder.encode(JSON.stringify([0, event.pubkey, event.created_at, event.kind, event.tags, event.content]))
1930
+ );
1931
+ if (getPowFromBytes(hash) >= difficulty) {
1932
+ event.id = bytesToHex4(hash);
1933
+ break;
1934
+ }
1935
+ }
1936
+ return event;
1937
+ }
1938
+
1939
+ // nip17.ts
1940
+ var nip17_exports = {};
1941
+ __export(nip17_exports, {
1942
+ unwrapEvent: () => unwrapEvent2,
1943
+ unwrapManyEvents: () => unwrapManyEvents2,
1944
+ wrapEvent: () => wrapEvent2,
1945
+ wrapManyEvents: () => wrapManyEvents2
1946
+ });
1947
+
1948
+ // nip59.ts
1949
+ var nip59_exports = {};
1950
+ __export(nip59_exports, {
1951
+ createRumor: () => createRumor,
1952
+ createSeal: () => createSeal,
1953
+ createWrap: () => createWrap,
1954
+ unwrapEvent: () => unwrapEvent,
1955
+ unwrapManyEvents: () => unwrapManyEvents,
1956
+ wrapEvent: () => wrapEvent,
1957
+ wrapManyEvents: () => wrapManyEvents
1958
+ });
1959
+
1960
+ // nip44.ts
1961
+ var nip44_exports = {};
1962
+ __export(nip44_exports, {
1963
+ decrypt: () => decrypt2,
1964
+ encrypt: () => encrypt2,
1965
+ getConversationKey: () => getConversationKey,
1966
+ v2: () => v2
1967
+ });
1968
+ import { chacha20 } from "@noble/ciphers/chacha.js";
1969
+ import { equalBytes } from "@noble/ciphers/utils.js";
1970
+ import { secp256k1 as secp256k12 } from "@noble/curves/secp256k1.js";
1971
+ import { extract as hkdf_extract, expand as hkdf_expand } from "@noble/hashes/hkdf.js";
1972
+ import { hmac } from "@noble/hashes/hmac.js";
1973
+ import { sha256 as sha2563 } from "@noble/hashes/sha2.js";
1974
+ import { concatBytes as concatBytes2, hexToBytes as hexToBytes5, randomBytes as randomBytes2 } from "@noble/hashes/utils.js";
1975
+ import { base64 as base642 } from "@scure/base";
1976
+ var minPlaintextSize = 1;
1977
+ var maxPlaintextSize = 4294967295;
1978
+ var extendedPrefixThreshold = 65536;
1979
+ function getConversationKey(privkeyA, pubkeyB) {
1980
+ const sharedX = secp256k12.getSharedSecret(privkeyA, hexToBytes5("02" + pubkeyB)).subarray(1, 33);
1981
+ return hkdf_extract(sha2563, sharedX, utf8Encoder.encode("nip44-v2"));
1982
+ }
1983
+ function getMessageKeys(conversationKey, nonce) {
1984
+ const keys = hkdf_expand(sha2563, conversationKey, nonce, 76);
1985
+ return {
1986
+ chacha_key: keys.subarray(0, 32),
1987
+ chacha_nonce: keys.subarray(32, 44),
1988
+ hmac_key: keys.subarray(44, 76)
1989
+ };
1990
+ }
1991
+ function calcPaddedLen(len) {
1992
+ if (!Number.isSafeInteger(len) || len < 1)
1993
+ throw new Error("expected positive integer");
1994
+ if (len <= 32)
1995
+ return 32;
1996
+ const nextPower = 2 ** (Math.floor(Math.log2(len - 1)) + 1);
1997
+ const chunk = nextPower <= 256 ? 32 : nextPower / 8;
1998
+ return chunk * (Math.floor((len - 1) / chunk) + 1);
1999
+ }
2000
+ function writeU16BE(num) {
2001
+ if (!Number.isSafeInteger(num) || num < minPlaintextSize || num > 65535)
2002
+ throw new Error("invalid plaintext size: must be between 1 and 65535 bytes");
2003
+ const arr = new Uint8Array(2);
2004
+ new DataView(arr.buffer).setUint16(0, num, false);
2005
+ return arr;
2006
+ }
2007
+ function writeU32BE(num) {
2008
+ if (!Number.isSafeInteger(num) || num < extendedPrefixThreshold || num > maxPlaintextSize)
2009
+ throw new Error("invalid plaintext size: must be between 65536 and 4294967295 bytes");
2010
+ const arr = new Uint8Array(4);
2011
+ new DataView(arr.buffer).setUint32(0, num, false);
2012
+ return arr;
2013
+ }
2014
+ function pad(plaintext) {
2015
+ const unpadded = utf8Encoder.encode(plaintext);
2016
+ const unpaddedLen = unpadded.length;
2017
+ if (unpaddedLen < minPlaintextSize || unpaddedLen > maxPlaintextSize)
2018
+ throw new Error("invalid plaintext size: must be between 1 and 4294967295 bytes");
2019
+ const prefix = unpaddedLen >= extendedPrefixThreshold ? concatBytes2(new Uint8Array([0, 0]), writeU32BE(unpaddedLen)) : writeU16BE(unpaddedLen);
2020
+ const suffix = new Uint8Array(calcPaddedLen(unpaddedLen) - unpaddedLen);
2021
+ return concatBytes2(prefix, unpadded, suffix);
2022
+ }
2023
+ function unpad(padded) {
2024
+ const dv = new DataView(padded.buffer, padded.byteOffset, padded.byteLength);
2025
+ const firstTwo = dv.getUint16(0);
2026
+ let unpaddedLen;
2027
+ let prefixLen;
2028
+ if (firstTwo === 0) {
2029
+ unpaddedLen = dv.getUint32(2);
2030
+ if (unpaddedLen < extendedPrefixThreshold)
2031
+ throw new Error("invalid padding");
2032
+ prefixLen = 6;
2033
+ } else {
2034
+ unpaddedLen = firstTwo;
2035
+ prefixLen = 2;
2036
+ }
2037
+ const unpadded = padded.subarray(prefixLen, prefixLen + unpaddedLen);
2038
+ if (unpaddedLen < minPlaintextSize || unpaddedLen > maxPlaintextSize || unpadded.length !== unpaddedLen || padded.length !== prefixLen + calcPaddedLen(unpaddedLen))
2039
+ throw new Error("invalid padding");
2040
+ return utf8Decoder.decode(unpadded);
2041
+ }
2042
+ function hmacAad(key, message, aad) {
2043
+ if (aad.length !== 32)
2044
+ throw new Error("AAD associated data must be 32 bytes");
2045
+ const combined = concatBytes2(aad, message);
2046
+ return hmac(sha2563, key, combined);
2047
+ }
2048
+ function decodePayload(payload) {
2049
+ if (typeof payload !== "string")
2050
+ throw new Error("payload must be a valid string");
2051
+ const plen = payload.length;
2052
+ if (plen < 132)
2053
+ throw new Error("invalid payload length: " + plen);
2054
+ if (payload[0] === "#")
2055
+ throw new Error("unknown encryption version");
2056
+ let data;
2057
+ try {
2058
+ data = base642.decode(payload);
2059
+ } catch (error) {
2060
+ throw new Error("invalid base64: " + error.message);
2061
+ }
2062
+ const dlen = data.length;
2063
+ if (dlen < 99)
2064
+ throw new Error("invalid data length: " + dlen);
2065
+ const vers = data[0];
2066
+ if (vers !== 2)
2067
+ throw new Error("unknown encryption version " + vers);
2068
+ return {
2069
+ nonce: data.subarray(1, 33),
2070
+ ciphertext: data.subarray(33, -32),
2071
+ mac: data.subarray(-32)
2072
+ };
2073
+ }
2074
+ function encrypt2(plaintext, conversationKey, nonce = randomBytes2(32)) {
2075
+ const { chacha_key, chacha_nonce, hmac_key } = getMessageKeys(conversationKey, nonce);
2076
+ const padded = pad(plaintext);
2077
+ const ciphertext = chacha20(chacha_key, chacha_nonce, padded);
2078
+ const mac = hmacAad(hmac_key, ciphertext, nonce);
2079
+ return base642.encode(concatBytes2(new Uint8Array([2]), nonce, ciphertext, mac));
2080
+ }
2081
+ function decrypt2(payload, conversationKey) {
2082
+ const { nonce, ciphertext, mac } = decodePayload(payload);
2083
+ const { chacha_key, chacha_nonce, hmac_key } = getMessageKeys(conversationKey, nonce);
2084
+ const calculatedMac = hmacAad(hmac_key, ciphertext, nonce);
2085
+ if (!equalBytes(calculatedMac, mac))
2086
+ throw new Error("invalid MAC");
2087
+ const padded = chacha20(chacha_key, chacha_nonce, ciphertext);
2088
+ return unpad(padded);
2089
+ }
2090
+ var v2 = {
2091
+ utils: {
2092
+ getConversationKey,
2093
+ calcPaddedLen,
2094
+ pad,
2095
+ unpad
2096
+ },
2097
+ encrypt: encrypt2,
2098
+ decrypt: decrypt2
2099
+ };
2100
+
2101
+ // nip59.ts
2102
+ var TWO_DAYS = 2 * 24 * 60 * 60;
2103
+ var now = () => Math.round(Date.now() / 1e3);
2104
+ var randomNow = () => Math.round(now() - Math.random() * TWO_DAYS);
2105
+ var nip44ConversationKey = (privateKey, publicKey) => getConversationKey(privateKey, publicKey);
2106
+ var nip44Encrypt = (data, privateKey, publicKey) => encrypt2(JSON.stringify(data), nip44ConversationKey(privateKey, publicKey));
2107
+ var nip44Decrypt = (data, privateKey) => JSON.parse(decrypt2(data.content, nip44ConversationKey(privateKey, data.pubkey)));
2108
+ function createRumor(event, privateKey) {
2109
+ const rumor = {
2110
+ created_at: now(),
2111
+ content: "",
2112
+ tags: [],
2113
+ ...event,
2114
+ pubkey: getPublicKey(privateKey)
2115
+ };
2116
+ rumor.id = getEventHash(rumor);
2117
+ return rumor;
2118
+ }
2119
+ function createSeal(rumor, privateKey, recipientPublicKey) {
2120
+ return finalizeEvent(
2121
+ {
2122
+ kind: Seal,
2123
+ content: nip44Encrypt(rumor, privateKey, recipientPublicKey),
2124
+ created_at: randomNow(),
2125
+ tags: []
2126
+ },
2127
+ privateKey
2128
+ );
2129
+ }
2130
+ function createWrap(seal, recipientPublicKey) {
2131
+ const randomKey = generateSecretKey();
2132
+ return finalizeEvent(
2133
+ {
2134
+ kind: GiftWrap,
2135
+ content: nip44Encrypt(seal, randomKey, recipientPublicKey),
2136
+ created_at: randomNow(),
2137
+ tags: [["p", recipientPublicKey]]
2138
+ },
2139
+ randomKey
2140
+ );
2141
+ }
2142
+ function wrapEvent(event, senderPrivateKey, recipientPublicKey) {
2143
+ const rumor = createRumor(event, senderPrivateKey);
2144
+ const seal = createSeal(rumor, senderPrivateKey, recipientPublicKey);
2145
+ return createWrap(seal, recipientPublicKey);
2146
+ }
2147
+ function wrapManyEvents(event, senderPrivateKey, recipientsPublicKeys) {
2148
+ if (!recipientsPublicKeys || recipientsPublicKeys.length === 0) {
2149
+ throw new Error("At least one recipient is required.");
2150
+ }
2151
+ const senderPublicKey = getPublicKey(senderPrivateKey);
2152
+ const wrappeds = [wrapEvent(event, senderPrivateKey, senderPublicKey)];
2153
+ recipientsPublicKeys.forEach((recipientPublicKey) => {
2154
+ wrappeds.push(wrapEvent(event, senderPrivateKey, recipientPublicKey));
2155
+ });
2156
+ return wrappeds;
2157
+ }
2158
+ function unwrapEvent(wrap, recipientPrivateKey) {
2159
+ const unwrappedSeal = nip44Decrypt(wrap, recipientPrivateKey);
2160
+ return nip44Decrypt(unwrappedSeal, recipientPrivateKey);
2161
+ }
2162
+ function unwrapManyEvents(wrappedEvents, recipientPrivateKey) {
2163
+ let unwrappedEvents = [];
2164
+ wrappedEvents.forEach((e) => {
2165
+ unwrappedEvents.push(unwrapEvent(e, recipientPrivateKey));
2166
+ });
2167
+ unwrappedEvents.sort((a, b) => a.created_at - b.created_at);
2168
+ return unwrappedEvents;
2169
+ }
2170
+
2171
+ // nip17.ts
2172
+ function createEvent(recipients, message, conversationTitle, replyTo) {
2173
+ const baseEvent = {
2174
+ created_at: Math.ceil(Date.now() / 1e3),
2175
+ kind: PrivateDirectMessage,
2176
+ tags: [],
2177
+ content: message
2178
+ };
2179
+ const recipientsArray = Array.isArray(recipients) ? recipients : [recipients];
2180
+ recipientsArray.forEach(({ publicKey, relayUrl }) => {
2181
+ baseEvent.tags.push(relayUrl ? ["p", publicKey, relayUrl] : ["p", publicKey]);
2182
+ });
2183
+ if (replyTo) {
2184
+ baseEvent.tags.push(["e", replyTo.eventId, replyTo.relayUrl || "", "reply"]);
2185
+ }
2186
+ if (conversationTitle) {
2187
+ baseEvent.tags.push(["subject", conversationTitle]);
2188
+ }
2189
+ return baseEvent;
2190
+ }
2191
+ function wrapEvent2(senderPrivateKey, recipient, message, conversationTitle, replyTo) {
2192
+ const event = createEvent(recipient, message, conversationTitle, replyTo);
2193
+ return wrapEvent(event, senderPrivateKey, recipient.publicKey);
2194
+ }
2195
+ function wrapManyEvents2(senderPrivateKey, recipients, message, conversationTitle, replyTo) {
2196
+ if (!recipients || recipients.length === 0) {
2197
+ throw new Error("At least one recipient is required.");
2198
+ }
2199
+ const senderPublicKey = getPublicKey(senderPrivateKey);
2200
+ return [{ publicKey: senderPublicKey }, ...recipients].map(
2201
+ (recipient) => wrapEvent2(senderPrivateKey, recipient, message, conversationTitle, replyTo)
2202
+ );
2203
+ }
2204
+ var unwrapEvent2 = unwrapEvent;
2205
+ var unwrapManyEvents2 = unwrapManyEvents;
2206
+
2207
+ // nip18.ts
2208
+ var nip18_exports = {};
2209
+ __export(nip18_exports, {
2210
+ finishRepostEvent: () => finishRepostEvent,
2211
+ getRepostedEvent: () => getRepostedEvent,
2212
+ getRepostedEventPointer: () => getRepostedEventPointer
2213
+ });
2214
+ function finishRepostEvent(t, reposted, relayUrl, privateKey) {
2215
+ let kind;
2216
+ const tags = [...t.tags ?? [], ["e", reposted.id, relayUrl], ["p", reposted.pubkey]];
2217
+ if (reposted.kind === ShortTextNote) {
2218
+ kind = Repost;
2219
+ } else {
2220
+ kind = GenericRepost;
2221
+ tags.push(["k", String(reposted.kind)]);
2222
+ }
2223
+ return finalizeEvent(
2224
+ {
2225
+ kind,
2226
+ tags,
2227
+ content: t.content === "" || reposted.tags?.find((tag) => tag[0] === "-") ? "" : JSON.stringify(reposted),
2228
+ created_at: t.created_at
2229
+ },
2230
+ privateKey
2231
+ );
2232
+ }
2233
+ function getRepostedEventPointer(event) {
2234
+ if (![Repost, GenericRepost].includes(event.kind)) {
2235
+ return void 0;
2236
+ }
2237
+ let lastETag;
2238
+ let lastPTag;
2239
+ for (let i2 = event.tags.length - 1; i2 >= 0 && (lastETag === void 0 || lastPTag === void 0); i2--) {
2240
+ const tag = event.tags[i2];
2241
+ if (tag.length >= 2) {
2242
+ if (tag[0] === "e" && lastETag === void 0) {
2243
+ lastETag = tag;
2244
+ } else if (tag[0] === "p" && lastPTag === void 0) {
2245
+ lastPTag = tag;
2246
+ }
2247
+ }
2248
+ }
2249
+ if (lastETag === void 0) {
2250
+ return void 0;
2251
+ }
2252
+ return {
2253
+ id: lastETag[1],
2254
+ relays: [lastETag[2], lastPTag?.[2]].filter((x) => typeof x === "string"),
2255
+ author: lastPTag?.[1]
2256
+ };
2257
+ }
2258
+ function getRepostedEvent(event, { skipVerification } = {}) {
2259
+ const pointer = getRepostedEventPointer(event);
2260
+ if (pointer === void 0 || event.content === "") {
2261
+ return void 0;
2262
+ }
2263
+ let repostedEvent;
2264
+ try {
2265
+ repostedEvent = JSON.parse(event.content);
2266
+ } catch (error) {
2267
+ return void 0;
2268
+ }
2269
+ if (repostedEvent.id !== pointer.id) {
2270
+ return void 0;
2271
+ }
2272
+ if (!skipVerification && !verifyEvent(repostedEvent)) {
2273
+ return void 0;
2274
+ }
2275
+ return repostedEvent;
2276
+ }
2277
+
2278
+ // nip21.ts
2279
+ var nip21_exports = {};
2280
+ __export(nip21_exports, {
2281
+ NOSTR_URI_REGEX: () => NOSTR_URI_REGEX,
2282
+ parse: () => parse2,
2283
+ test: () => test
2284
+ });
2285
+ var NOSTR_URI_REGEX = new RegExp(`nostr:(${BECH32_REGEX.source})`);
2286
+ function test(value) {
2287
+ return typeof value === "string" && new RegExp(`^${NOSTR_URI_REGEX.source}$`).test(value);
2288
+ }
2289
+ function parse2(uri) {
2290
+ const match = uri.match(new RegExp(`^${NOSTR_URI_REGEX.source}$`));
2291
+ if (!match)
2292
+ throw new Error(`Invalid Nostr URI: ${uri}`);
2293
+ return {
2294
+ uri: match[0],
2295
+ value: match[1],
2296
+ decoded: decode(match[1])
2297
+ };
2298
+ }
2299
+
2300
+ // nip22.ts
2301
+ var nip22_exports = {};
2302
+ __export(nip22_exports, {
2303
+ parse: () => parse3
2304
+ });
2305
+ function parseKind(kind) {
2306
+ if (!kind)
2307
+ return void 0;
2308
+ return /^\d+$/.test(kind) ? parseInt(kind, 10) : kind;
2309
+ }
2310
+ function parseAddressPointer(value, relayUrl) {
2311
+ const idx = value.indexOf(":");
2312
+ const idx2 = value.indexOf(":", idx + 1);
2313
+ if (idx === -1 || idx2 === -1)
2314
+ return void 0;
2315
+ const kind = parseInt(value.slice(0, idx), 10);
2316
+ if (Number.isNaN(kind))
2317
+ return void 0;
2318
+ return {
2319
+ kind,
2320
+ pubkey: value.slice(idx + 1, idx2),
2321
+ identifier: value.slice(idx2 + 1),
2322
+ relays: relayUrl ? [relayUrl] : []
2323
+ };
2324
+ }
2325
+ function parsePointer(tag) {
2326
+ switch (tag[0]) {
2327
+ case "E":
2328
+ case "e":
2329
+ if (!tag[1])
2330
+ return void 0;
2331
+ return {
2332
+ id: tag[1],
2333
+ relays: tag[2] ? [tag[2]] : [],
2334
+ author: tag[3]
2335
+ };
2336
+ case "A":
2337
+ case "a":
2338
+ if (!tag[1])
2339
+ return void 0;
2340
+ return parseAddressPointer(tag[1], tag[2]);
2341
+ case "I":
2342
+ case "i":
2343
+ if (!tag[1])
2344
+ return void 0;
2345
+ return {
2346
+ value: tag[1],
2347
+ hint: tag[2]
2348
+ };
2349
+ }
2350
+ }
2351
+ function parseQuote(tag) {
2352
+ if (!tag[1])
2353
+ return void 0;
2354
+ if (tag[1].includes(":")) {
2355
+ return parseAddressPointer(tag[1], tag[2]);
2356
+ }
2357
+ return {
2358
+ id: tag[1],
2359
+ relays: tag[2] ? [tag[2]] : [],
2360
+ author: tag[3]
2361
+ };
2362
+ }
2363
+ function choosePointer(candidates) {
2364
+ return candidates.findLast((candidate) => candidate.tagName === "A" || candidate.tagName === "a")?.pointer || candidates.findLast((candidate) => candidate.tagName === "I" || candidate.tagName === "i")?.pointer || candidates.findLast((candidate) => candidate.tagName === "E" || candidate.tagName === "e")?.pointer;
2365
+ }
2366
+ function inheritRelayHints(pointer, profiles) {
2367
+ if (!pointer || !("id" in pointer) || !pointer.author)
2368
+ return;
2369
+ const author = profiles.find((profile) => profile.pubkey === pointer.author);
2370
+ if (!author || !author.relays)
2371
+ return;
2372
+ if (!pointer.relays) {
2373
+ pointer.relays = [];
2374
+ }
2375
+ author.relays.forEach((url) => {
2376
+ if (pointer.relays.indexOf(url) === -1)
2377
+ pointer.relays.push(url);
2378
+ });
2379
+ author.relays = pointer.relays;
2380
+ }
2381
+ function parse3(event) {
2382
+ const result = {
2383
+ root: void 0,
2384
+ rootKind: void 0,
2385
+ reply: void 0,
2386
+ replyKind: void 0,
2387
+ mentions: [],
2388
+ quotes: [],
2389
+ profiles: []
2390
+ };
2391
+ const rootCandidates = [];
2392
+ const replyCandidates = [];
2393
+ for (const tag of event.tags) {
2394
+ if ((tag[0] === "E" || tag[0] === "A" || tag[0] === "I") && tag[1]) {
2395
+ const pointer = parsePointer(tag);
2396
+ if (pointer)
2397
+ rootCandidates.push({ tagName: tag[0], pointer });
2398
+ continue;
2399
+ }
2400
+ if ((tag[0] === "e" || tag[0] === "a" || tag[0] === "i") && tag[1]) {
2401
+ const pointer = parsePointer(tag);
2402
+ if (pointer)
2403
+ replyCandidates.push({ tagName: tag[0], pointer });
2404
+ continue;
2405
+ }
2406
+ if (tag[0] === "K") {
2407
+ result.rootKind = parseKind(tag[1]);
2408
+ continue;
2409
+ }
2410
+ if (tag[0] === "k") {
2411
+ result.replyKind = parseKind(tag[1]);
2412
+ continue;
2413
+ }
2414
+ if (tag[0] === "q") {
2415
+ const pointer = parseQuote(tag);
2416
+ if (pointer)
2417
+ result.quotes.push(pointer);
2418
+ continue;
2419
+ }
2420
+ if ((tag[0] === "P" || tag[0] === "p") && tag[1]) {
2421
+ result.profiles.push({
2422
+ pubkey: tag[1],
2423
+ relays: tag[2] ? [tag[2]] : []
2424
+ });
2425
+ }
2426
+ }
2427
+ result.root = choosePointer(rootCandidates);
2428
+ result.reply = choosePointer(replyCandidates);
2429
+ inheritRelayHints(result.root, result.profiles);
2430
+ inheritRelayHints(result.reply, result.profiles);
2431
+ result.quotes.forEach((pointer) => inheritRelayHints(pointer, result.profiles));
2432
+ return result;
2433
+ }
2434
+
2435
+ // nip25.ts
2436
+ var nip25_exports = {};
2437
+ __export(nip25_exports, {
2438
+ finishReactionEvent: () => finishReactionEvent,
2439
+ getReactedEventPointer: () => getReactedEventPointer
2440
+ });
2441
+ function finishReactionEvent(t, reacted, privateKey) {
2442
+ const inheritedTags = reacted.tags.filter((tag) => tag.length >= 2 && (tag[0] === "e" || tag[0] === "p"));
2443
+ return finalizeEvent(
2444
+ {
2445
+ ...t,
2446
+ kind: Reaction,
2447
+ tags: [...t.tags ?? [], ...inheritedTags, ["e", reacted.id], ["p", reacted.pubkey]],
2448
+ content: t.content ?? "+"
2449
+ },
2450
+ privateKey
2451
+ );
2452
+ }
2453
+ function getReactedEventPointer(event) {
2454
+ if (event.kind !== Reaction) {
2455
+ return void 0;
2456
+ }
2457
+ let lastETag;
2458
+ let lastPTag;
2459
+ for (let i2 = event.tags.length - 1; i2 >= 0 && (lastETag === void 0 || lastPTag === void 0); i2--) {
2460
+ const tag = event.tags[i2];
2461
+ if (tag.length >= 2) {
2462
+ if (tag[0] === "e" && lastETag === void 0) {
2463
+ lastETag = tag;
2464
+ } else if (tag[0] === "p" && lastPTag === void 0) {
2465
+ lastPTag = tag;
2466
+ }
2467
+ }
2468
+ }
2469
+ if (lastETag === void 0 || lastPTag === void 0) {
2470
+ return void 0;
2471
+ }
2472
+ return {
2473
+ id: lastETag[1],
2474
+ relays: [lastETag[2], lastPTag[2]].filter((x) => x !== void 0),
2475
+ author: lastPTag[1]
2476
+ };
2477
+ }
2478
+
2479
+ // nip27.ts
2480
+ var nip27_exports = {};
2481
+ __export(nip27_exports, {
2482
+ parse: () => parse4
2483
+ });
2484
+ var noCharacter = /\W/m;
2485
+ var noURLCharacter = /[^\w\/] |[^\w\/]$|$|,| /m;
2486
+ var MAX_HASHTAG_LENGTH = 42;
2487
+ function* parse4(content) {
2488
+ let emojis = [];
2489
+ if (typeof content !== "string") {
2490
+ for (let i2 = 0; i2 < content.tags.length; i2++) {
2491
+ const tag = content.tags[i2];
2492
+ if (tag[0] === "emoji" && tag.length >= 3) {
2493
+ emojis.push({ type: "emoji", shortcode: tag[1], url: tag[2] });
2494
+ }
2495
+ }
2496
+ content = content.content;
2497
+ }
2498
+ const max = content.length;
2499
+ let prevIndex = 0;
2500
+ let index = 0;
2501
+ mainloop:
2502
+ while (index < max) {
2503
+ const u = content.indexOf(":", index);
2504
+ const h = content.indexOf("#", index);
2505
+ if (u === -1 && h === -1) {
2506
+ break mainloop;
2507
+ }
2508
+ if (u === -1 || h >= 0 && h < u) {
2509
+ if (h === 0 || content[h - 1].match(noCharacter)) {
2510
+ const m = content.slice(h + 1, h + MAX_HASHTAG_LENGTH).match(noCharacter);
2511
+ const end = m ? h + 1 + m.index : max;
2512
+ yield { type: "text", text: content.slice(prevIndex, h) };
2513
+ yield { type: "hashtag", value: content.slice(h + 1, end) };
2514
+ index = end;
2515
+ prevIndex = index;
2516
+ continue mainloop;
2517
+ }
2518
+ index = h + 1;
2519
+ continue mainloop;
2520
+ }
2521
+ if (content.slice(u - 5, u) === "nostr") {
2522
+ const m = content.slice(u + 60).match(noCharacter);
2523
+ const end = m ? u + 60 + m.index : max;
2524
+ try {
2525
+ let pointer;
2526
+ let { data, type } = decode(content.slice(u + 1, end));
2527
+ switch (type) {
2528
+ case "npub":
2529
+ pointer = { pubkey: data };
2530
+ break;
2531
+ case "note":
2532
+ pointer = { id: data };
2533
+ break;
2534
+ case "nsec":
2535
+ index = end + 1;
2536
+ continue;
2537
+ default:
2538
+ pointer = data;
2539
+ }
2540
+ if (prevIndex !== u - 5) {
2541
+ yield { type: "text", text: content.slice(prevIndex, u - 5) };
2542
+ }
2543
+ yield { type: "reference", pointer };
2544
+ index = end;
2545
+ prevIndex = index;
2546
+ continue mainloop;
2547
+ } catch (_err) {
2548
+ index = u + 1;
2549
+ continue mainloop;
2550
+ }
2551
+ } else if (content.slice(u - 5, u) === "https" || content.slice(u - 4, u) === "http") {
2552
+ const m = content.slice(u + 4).match(noURLCharacter);
2553
+ const end = m ? u + 4 + m.index : max;
2554
+ const prefixLen = content[u - 1] === "s" ? 5 : 4;
2555
+ try {
2556
+ let url = new URL(content.slice(u - prefixLen, end));
2557
+ if (url.hostname.indexOf(".") === -1) {
2558
+ throw new Error("invalid url");
2559
+ }
2560
+ if (prevIndex !== u - prefixLen) {
2561
+ yield { type: "text", text: content.slice(prevIndex, u - prefixLen) };
2562
+ }
2563
+ if (/\.(png|jpe?g|gif|webp|heic|svg)$/i.test(url.pathname)) {
2564
+ yield { type: "image", url: url.toString() };
2565
+ index = end;
2566
+ prevIndex = index;
2567
+ continue mainloop;
2568
+ }
2569
+ if (/\.(mp4|avi|webm|mkv|mov)$/i.test(url.pathname)) {
2570
+ yield { type: "video", url: url.toString() };
2571
+ index = end;
2572
+ prevIndex = index;
2573
+ continue mainloop;
2574
+ }
2575
+ if (/\.(mp3|aac|ogg|opus|wav|flac)$/i.test(url.pathname)) {
2576
+ yield { type: "audio", url: url.toString() };
2577
+ index = end;
2578
+ prevIndex = index;
2579
+ continue mainloop;
2580
+ }
2581
+ yield { type: "url", url: url.toString() };
2582
+ index = end;
2583
+ prevIndex = index;
2584
+ continue mainloop;
2585
+ } catch (_err) {
2586
+ index = end + 1;
2587
+ continue mainloop;
2588
+ }
2589
+ } else if (content.slice(u - 3, u) === "wss" || content.slice(u - 2, u) === "ws") {
2590
+ const m = content.slice(u + 4).match(noURLCharacter);
2591
+ const end = m ? u + 4 + m.index : max;
2592
+ const prefixLen = content[u - 1] === "s" ? 3 : 2;
2593
+ try {
2594
+ let url = new URL(content.slice(u - prefixLen, end));
2595
+ if (url.hostname.indexOf(".") === -1) {
2596
+ throw new Error("invalid ws url");
2597
+ }
2598
+ if (prevIndex !== u - prefixLen) {
2599
+ yield { type: "text", text: content.slice(prevIndex, u - prefixLen) };
2600
+ }
2601
+ yield { type: "relay", url: url.toString() };
2602
+ index = end;
2603
+ prevIndex = index;
2604
+ continue mainloop;
2605
+ } catch (_err) {
2606
+ index = end + 1;
2607
+ continue mainloop;
2608
+ }
2609
+ } else {
2610
+ for (let e = 0; e < emojis.length; e++) {
2611
+ const emoji = emojis[e];
2612
+ if (content[u + emoji.shortcode.length + 1] === ":" && content.slice(u + 1, u + emoji.shortcode.length + 1) === emoji.shortcode) {
2613
+ if (prevIndex !== u) {
2614
+ yield { type: "text", text: content.slice(prevIndex, u) };
2615
+ }
2616
+ yield emoji;
2617
+ index = u + emoji.shortcode.length + 2;
2618
+ prevIndex = index;
2619
+ continue mainloop;
2620
+ }
2621
+ }
2622
+ index = u + 1;
2623
+ continue mainloop;
2624
+ }
2625
+ }
2626
+ if (prevIndex !== max) {
2627
+ yield { type: "text", text: content.slice(prevIndex) };
2628
+ }
2629
+ }
2630
+
2631
+ // nip28.ts
2632
+ var nip28_exports = {};
2633
+ __export(nip28_exports, {
2634
+ channelCreateEvent: () => channelCreateEvent,
2635
+ channelHideMessageEvent: () => channelHideMessageEvent,
2636
+ channelMessageEvent: () => channelMessageEvent,
2637
+ channelMetadataEvent: () => channelMetadataEvent,
2638
+ channelMuteUserEvent: () => channelMuteUserEvent
2639
+ });
2640
+ var channelCreateEvent = (t, privateKey) => {
2641
+ let content;
2642
+ if (typeof t.content === "object") {
2643
+ content = JSON.stringify(t.content);
2644
+ } else if (typeof t.content === "string") {
2645
+ content = t.content;
2646
+ } else {
2647
+ return void 0;
2648
+ }
2649
+ return finalizeEvent(
2650
+ {
2651
+ kind: ChannelCreation,
2652
+ tags: [...t.tags ?? []],
2653
+ content,
2654
+ created_at: t.created_at
2655
+ },
2656
+ privateKey
2657
+ );
2658
+ };
2659
+ var channelMetadataEvent = (t, privateKey) => {
2660
+ let content;
2661
+ if (typeof t.content === "object") {
2662
+ content = JSON.stringify(t.content);
2663
+ } else if (typeof t.content === "string") {
2664
+ content = t.content;
2665
+ } else {
2666
+ return void 0;
2667
+ }
2668
+ return finalizeEvent(
2669
+ {
2670
+ kind: ChannelMetadata,
2671
+ tags: [["e", t.channel_create_event_id], ...t.tags ?? []],
2672
+ content,
2673
+ created_at: t.created_at
2674
+ },
2675
+ privateKey
2676
+ );
2677
+ };
2678
+ var channelMessageEvent = (t, privateKey) => {
2679
+ const tags = [["e", t.channel_create_event_id, t.relay_url, "root"]];
2680
+ if (t.reply_to_channel_message_event_id) {
2681
+ tags.push(["e", t.reply_to_channel_message_event_id, t.relay_url, "reply"]);
2682
+ }
2683
+ return finalizeEvent(
2684
+ {
2685
+ kind: ChannelMessage,
2686
+ tags: [...tags, ...t.tags ?? []],
2687
+ content: t.content,
2688
+ created_at: t.created_at
2689
+ },
2690
+ privateKey
2691
+ );
2692
+ };
2693
+ var channelHideMessageEvent = (t, privateKey) => {
2694
+ let content;
2695
+ if (typeof t.content === "object") {
2696
+ content = JSON.stringify(t.content);
2697
+ } else if (typeof t.content === "string") {
2698
+ content = t.content;
2699
+ } else {
2700
+ return void 0;
2701
+ }
2702
+ return finalizeEvent(
2703
+ {
2704
+ kind: ChannelHideMessage,
2705
+ tags: [["e", t.channel_message_event_id], ...t.tags ?? []],
2706
+ content,
2707
+ created_at: t.created_at
2708
+ },
2709
+ privateKey
2710
+ );
2711
+ };
2712
+ var channelMuteUserEvent = (t, privateKey) => {
2713
+ let content;
2714
+ if (typeof t.content === "object") {
2715
+ content = JSON.stringify(t.content);
2716
+ } else if (typeof t.content === "string") {
2717
+ content = t.content;
2718
+ } else {
2719
+ return void 0;
2720
+ }
2721
+ return finalizeEvent(
2722
+ {
2723
+ kind: ChannelMuteUser,
2724
+ tags: [["p", t.pubkey_to_mute], ...t.tags ?? []],
2725
+ content,
2726
+ created_at: t.created_at
2727
+ },
2728
+ privateKey
2729
+ );
2730
+ };
2731
+
2732
+ // nip30.ts
2733
+ var nip30_exports = {};
2734
+ __export(nip30_exports, {
2735
+ EMOJI_SHORTCODE_REGEX: () => EMOJI_SHORTCODE_REGEX,
2736
+ matchAll: () => matchAll,
2737
+ regex: () => regex,
2738
+ replaceAll: () => replaceAll
2739
+ });
2740
+ var EMOJI_SHORTCODE_REGEX = /:(\w+):/;
2741
+ var regex = () => new RegExp(`\\B${EMOJI_SHORTCODE_REGEX.source}\\B`, "g");
2742
+ function* matchAll(content) {
2743
+ const matches = content.matchAll(regex());
2744
+ for (const match of matches) {
2745
+ try {
2746
+ const [shortcode, name] = match;
2747
+ yield {
2748
+ shortcode,
2749
+ name,
2750
+ start: match.index,
2751
+ end: match.index + shortcode.length
2752
+ };
2753
+ } catch (_e) {
2754
+ }
2755
+ }
2756
+ }
2757
+ function replaceAll(content, replacer) {
2758
+ return content.replaceAll(regex(), (shortcode, name) => {
2759
+ return replacer({
2760
+ shortcode,
2761
+ name
2762
+ });
2763
+ });
2764
+ }
2765
+
2766
+ // nip39.ts
2767
+ var nip39_exports = {};
2768
+ __export(nip39_exports, {
2769
+ useFetchImplementation: () => useFetchImplementation3,
2770
+ validateGithub: () => validateGithub
2771
+ });
2772
+ var _fetch3;
2773
+ try {
2774
+ _fetch3 = fetch;
2775
+ } catch {
2776
+ }
2777
+ function useFetchImplementation3(fetchImplementation) {
2778
+ _fetch3 = fetchImplementation;
2779
+ }
2780
+ async function validateGithub(pubkey, username, proof) {
2781
+ try {
2782
+ let res = await (await _fetch3(`https://gist.github.com/${username}/${proof}/raw`)).text();
2783
+ return res === `Verifying that I control the following Nostr public key: ${pubkey}`;
2784
+ } catch (_) {
2785
+ return false;
2786
+ }
2787
+ }
2788
+
2789
+ // nip47.ts
2790
+ var nip47_exports = {};
2791
+ __export(nip47_exports, {
2792
+ makeNwcRequestEvent: () => makeNwcRequestEvent,
2793
+ parseConnectionString: () => parseConnectionString
2794
+ });
2795
+ function parseConnectionString(connectionString) {
2796
+ const { host, pathname, searchParams } = new URL(connectionString);
2797
+ const pubkey = pathname || host;
2798
+ const relays = searchParams.getAll("relay");
2799
+ const secret = searchParams.get("secret");
2800
+ if (!pubkey || relays.length === 0 || !secret) {
2801
+ throw new Error("invalid connection string");
2802
+ }
2803
+ return { pubkey, relay: relays[0], relays, secret };
2804
+ }
2805
+ async function makeNwcRequestEvent(pubkey, secretKey, invoice) {
2806
+ const content = {
2807
+ method: "pay_invoice",
2808
+ params: {
2809
+ invoice
2810
+ }
2811
+ };
2812
+ const encryptedContent = encrypt(secretKey, pubkey, JSON.stringify(content));
2813
+ const eventTemplate = {
2814
+ kind: NWCWalletRequest,
2815
+ created_at: Math.round(Date.now() / 1e3),
2816
+ content: encryptedContent,
2817
+ tags: [["p", pubkey]]
2818
+ };
2819
+ return finalizeEvent(eventTemplate, secretKey);
2820
+ }
2821
+
2822
+ // nip54.ts
2823
+ var nip54_exports = {};
2824
+ __export(nip54_exports, {
2825
+ normalizeIdentifier: () => normalizeIdentifier
2826
+ });
2827
+ function normalizeIdentifier(name) {
2828
+ name = name.trim().toLowerCase();
2829
+ name = name.normalize("NFKC");
2830
+ return Array.from(name).map((char) => {
2831
+ if (/\p{Letter}/u.test(char) || /\p{Number}/u.test(char)) {
2832
+ return char;
2833
+ }
2834
+ return "-";
2835
+ }).join("");
2836
+ }
2837
+
2838
+ // nip57.ts
2839
+ var nip57_exports = {};
2840
+ __export(nip57_exports, {
2841
+ getSatoshisAmountFromBolt11: () => getSatoshisAmountFromBolt11,
2842
+ getZapEndpoint: () => getZapEndpoint,
2843
+ makeZapReceipt: () => makeZapReceipt,
2844
+ makeZapRequest: () => makeZapRequest,
2845
+ useFetchImplementation: () => useFetchImplementation4,
2846
+ validateZapRequest: () => validateZapRequest
2847
+ });
2848
+ import { bech32 as bech322 } from "@scure/base";
2849
+ var _fetch4;
2850
+ try {
2851
+ _fetch4 = fetch;
2852
+ } catch {
2853
+ }
2854
+ function useFetchImplementation4(fetchImplementation) {
2855
+ _fetch4 = fetchImplementation;
2856
+ }
2857
+ async function getZapEndpoint(metadata) {
2858
+ try {
2859
+ let lnurl = "";
2860
+ let { lud06, lud16 } = JSON.parse(metadata.content);
2861
+ if (lud16) {
2862
+ let [name, domain] = lud16.split("@");
2863
+ lnurl = new URL(`/.well-known/lnurlp/${name}`, `https://${domain}`).toString();
2864
+ } else if (lud06) {
2865
+ let { words } = bech322.decode(lud06, 1e3);
2866
+ let data = bech322.fromWords(words);
2867
+ lnurl = utf8Decoder.decode(data);
2868
+ } else {
2869
+ return null;
2870
+ }
2871
+ let res = await _fetch4(lnurl);
2872
+ let body = await res.json();
2873
+ if (body.allowsNostr && body.nostrPubkey) {
2874
+ return body.callback;
2875
+ }
2876
+ } catch (err) {
2877
+ }
2878
+ return null;
2879
+ }
2880
+ function makeZapRequest(params) {
2881
+ let zr = {
2882
+ kind: 9734,
2883
+ created_at: Math.round(Date.now() / 1e3),
2884
+ content: params.comment || "",
2885
+ tags: [
2886
+ ["p", "pubkey" in params ? params.pubkey : params.event.pubkey],
2887
+ ["amount", params.amount.toString()],
2888
+ ["relays", ...params.relays]
2889
+ ]
2890
+ };
2891
+ if ("event" in params) {
2892
+ zr.tags.push(["e", params.event.id]);
2893
+ if (isReplaceableKind(params.event.kind)) {
2894
+ const a = ["a", `${params.event.kind}:${params.event.pubkey}:`];
2895
+ zr.tags.push(a);
2896
+ } else if (isAddressableKind(params.event.kind)) {
2897
+ let d = params.event.tags.find(([t, v]) => t === "d" && v);
2898
+ if (!d)
2899
+ throw new Error("d tag not found or is empty");
2900
+ const a = ["a", `${params.event.kind}:${params.event.pubkey}:${d[1]}`];
2901
+ zr.tags.push(a);
2902
+ }
2903
+ zr.tags.push(["k", params.event.kind.toString()]);
2904
+ }
2905
+ return zr;
2906
+ }
2907
+ function validateZapRequest(zapRequestString) {
2908
+ let zapRequest;
2909
+ try {
2910
+ zapRequest = JSON.parse(zapRequestString);
2911
+ } catch (err) {
2912
+ return "Invalid zap request JSON.";
2913
+ }
2914
+ if (!validateEvent(zapRequest))
2915
+ return "Zap request is not a valid Nostr event.";
2916
+ if (!verifyEvent(zapRequest))
2917
+ return "Invalid signature on zap request.";
2918
+ let p = zapRequest.tags.find(([t, v]) => t === "p" && v);
2919
+ if (!p)
2920
+ return "Zap request doesn't have a 'p' tag.";
2921
+ if (!p[1].match(/^[a-f0-9]{64}$/))
2922
+ return "Zap request 'p' tag is not valid hex.";
2923
+ let e = zapRequest.tags.find(([t, v]) => t === "e" && v);
2924
+ if (e && !e[1].match(/^[a-f0-9]{64}$/))
2925
+ return "Zap request 'e' tag is not valid hex.";
2926
+ let relays = zapRequest.tags.find(([t, v]) => t === "relays" && v);
2927
+ if (!relays)
2928
+ return "Zap request doesn't have a 'relays' tag.";
2929
+ return null;
2930
+ }
2931
+ function makeZapReceipt({
2932
+ zapRequest,
2933
+ preimage,
2934
+ bolt11,
2935
+ paidAt
2936
+ }) {
2937
+ let zr = JSON.parse(zapRequest);
2938
+ let tagsFromZapRequest = zr.tags.filter(([t]) => t === "e" || t === "p" || t === "a");
2939
+ let zap = {
2940
+ kind: 9735,
2941
+ created_at: Math.round(paidAt.getTime() / 1e3),
2942
+ content: "",
2943
+ tags: [...tagsFromZapRequest, ["P", zr.pubkey], ["bolt11", bolt11], ["description", zapRequest]]
2944
+ };
2945
+ if (preimage) {
2946
+ zap.tags.push(["preimage", preimage]);
2947
+ }
2948
+ return zap;
2949
+ }
2950
+ function getSatoshisAmountFromBolt11(bolt11) {
2951
+ if (bolt11.length < 50) {
2952
+ return 0;
2953
+ }
2954
+ bolt11 = bolt11.substring(0, 50);
2955
+ const idx = bolt11.lastIndexOf("1");
2956
+ if (idx === -1) {
2957
+ return 0;
2958
+ }
2959
+ const hrp = bolt11.substring(0, idx);
2960
+ if (!hrp.startsWith("lnbc")) {
2961
+ return 0;
2962
+ }
2963
+ const amount = hrp.substring(4);
2964
+ if (amount.length < 1) {
2965
+ return 0;
2966
+ }
2967
+ const char = amount[amount.length - 1];
2968
+ const digit = char.charCodeAt(0) - "0".charCodeAt(0);
2969
+ const isDigit = digit >= 0 && digit <= 9;
2970
+ let cutPoint = amount.length - 1;
2971
+ if (isDigit) {
2972
+ cutPoint++;
2973
+ }
2974
+ if (cutPoint < 1) {
2975
+ return 0;
2976
+ }
2977
+ const num = parseInt(amount.substring(0, cutPoint));
2978
+ switch (char) {
2979
+ case "m":
2980
+ return num * 1e5;
2981
+ case "u":
2982
+ return num * 100;
2983
+ case "n":
2984
+ return num / 10;
2985
+ case "p":
2986
+ return num / 1e4;
2987
+ default:
2988
+ return num * 1e8;
2989
+ }
2990
+ }
2991
+
2992
+ // nip77.ts
2993
+ var nip77_exports = {};
2994
+ __export(nip77_exports, {
2995
+ Negentropy: () => Negentropy,
2996
+ NegentropyStorageVector: () => NegentropyStorageVector,
2997
+ NegentropySync: () => NegentropySync
2998
+ });
2999
+ import { bytesToHex as bytesToHex5, hexToBytes as hexToBytes6 } from "@noble/hashes/utils.js";
3000
+ import { sha256 as sha2564 } from "@noble/hashes/sha2.js";
3001
+ var PROTOCOL_VERSION = 97;
3002
+ var ID_SIZE = 32;
3003
+ var FINGERPRINT_SIZE = 16;
3004
+ var Mode = {
3005
+ Skip: 0,
3006
+ Fingerprint: 1,
3007
+ IdList: 2
3008
+ };
3009
+ var WrappedBuffer = class {
3010
+ _raw;
3011
+ length;
3012
+ constructor(buffer) {
3013
+ if (typeof buffer === "number") {
3014
+ this._raw = new Uint8Array(buffer);
3015
+ this.length = 0;
3016
+ } else if (buffer instanceof Uint8Array) {
3017
+ this._raw = new Uint8Array(buffer);
3018
+ this.length = buffer.length;
3019
+ } else {
3020
+ this._raw = new Uint8Array(512);
3021
+ this.length = 0;
3022
+ }
3023
+ }
3024
+ unwrap() {
3025
+ return this._raw.subarray(0, this.length);
3026
+ }
3027
+ get capacity() {
3028
+ return this._raw.byteLength;
3029
+ }
3030
+ extend(buf) {
3031
+ if (buf instanceof WrappedBuffer)
3032
+ buf = buf.unwrap();
3033
+ if (typeof buf.length !== "number")
3034
+ throw Error("bad length");
3035
+ const targetSize = buf.length + this.length;
3036
+ if (this.capacity < targetSize) {
3037
+ const oldRaw = this._raw;
3038
+ const newCapacity = Math.max(this.capacity * 2, targetSize);
3039
+ this._raw = new Uint8Array(newCapacity);
3040
+ this._raw.set(oldRaw);
3041
+ }
3042
+ this._raw.set(buf, this.length);
3043
+ this.length += buf.length;
3044
+ }
3045
+ shift() {
3046
+ const first = this._raw[0];
3047
+ this._raw = this._raw.subarray(1);
3048
+ this.length--;
3049
+ return first;
3050
+ }
3051
+ shiftN(n = 1) {
3052
+ const firstSubarray = this._raw.subarray(0, n);
3053
+ this._raw = this._raw.subarray(n);
3054
+ this.length -= n;
3055
+ return firstSubarray;
3056
+ }
3057
+ };
3058
+ function decodeVarInt(buf) {
3059
+ let res = 0;
3060
+ while (1) {
3061
+ if (buf.length === 0)
3062
+ throw Error("parse ends prematurely");
3063
+ let byte = buf.shift();
3064
+ res = res << 7 | byte & 127;
3065
+ if ((byte & 128) === 0)
3066
+ break;
3067
+ }
3068
+ return res;
3069
+ }
3070
+ function encodeVarInt(n) {
3071
+ if (n === 0)
3072
+ return new WrappedBuffer(new Uint8Array([0]));
3073
+ let o = [];
3074
+ while (n !== 0) {
3075
+ o.push(n & 127);
3076
+ n >>>= 7;
3077
+ }
3078
+ o.reverse();
3079
+ for (let i2 = 0; i2 < o.length - 1; i2++)
3080
+ o[i2] |= 128;
3081
+ return new WrappedBuffer(new Uint8Array(o));
3082
+ }
3083
+ function getByte(buf) {
3084
+ return getBytes(buf, 1)[0];
3085
+ }
3086
+ function getBytes(buf, n) {
3087
+ if (buf.length < n)
3088
+ throw Error("parse ends prematurely");
3089
+ return buf.shiftN(n);
3090
+ }
3091
+ var Accumulator = class {
3092
+ buf;
3093
+ constructor() {
3094
+ this.setToZero();
3095
+ }
3096
+ setToZero() {
3097
+ this.buf = new Uint8Array(ID_SIZE);
3098
+ }
3099
+ add(otherBuf) {
3100
+ let currCarry = 0, nextCarry = 0;
3101
+ let p = new DataView(this.buf.buffer);
3102
+ let po = new DataView(otherBuf.buffer);
3103
+ for (let i2 = 0; i2 < 8; i2++) {
3104
+ let offset = i2 * 4;
3105
+ let orig = p.getUint32(offset, true);
3106
+ let otherV = po.getUint32(offset, true);
3107
+ let next = orig;
3108
+ next += currCarry;
3109
+ next += otherV;
3110
+ if (next > 4294967295)
3111
+ nextCarry = 1;
3112
+ p.setUint32(offset, next & 4294967295, true);
3113
+ currCarry = nextCarry;
3114
+ nextCarry = 0;
3115
+ }
3116
+ }
3117
+ negate() {
3118
+ let p = new DataView(this.buf.buffer);
3119
+ for (let i2 = 0; i2 < 8; i2++) {
3120
+ let offset = i2 * 4;
3121
+ p.setUint32(offset, ~p.getUint32(offset, true));
3122
+ }
3123
+ let one = new Uint8Array(ID_SIZE);
3124
+ one[0] = 1;
3125
+ this.add(one);
3126
+ }
3127
+ getFingerprint(n) {
3128
+ let input = new WrappedBuffer();
3129
+ input.extend(this.buf);
3130
+ input.extend(encodeVarInt(n));
3131
+ let hash = sha2564(input.unwrap());
3132
+ return hash.subarray(0, FINGERPRINT_SIZE);
3133
+ }
3134
+ };
3135
+ var NegentropyStorageVector = class {
3136
+ items;
3137
+ sealed;
3138
+ constructor() {
3139
+ this.items = [];
3140
+ this.sealed = false;
3141
+ }
3142
+ insert(timestamp, id) {
3143
+ if (this.sealed)
3144
+ throw Error("already sealed");
3145
+ const idb = hexToBytes6(id);
3146
+ if (idb.byteLength !== ID_SIZE)
3147
+ throw Error("bad id size for added item");
3148
+ this.items.push({ timestamp, id: idb });
3149
+ }
3150
+ seal() {
3151
+ if (this.sealed)
3152
+ throw Error("already sealed");
3153
+ this.sealed = true;
3154
+ this.items.sort(itemCompare);
3155
+ for (let i2 = 1; i2 < this.items.length; i2++) {
3156
+ if (itemCompare(this.items[i2 - 1], this.items[i2]) === 0)
3157
+ throw Error("duplicate item inserted");
3158
+ }
3159
+ }
3160
+ unseal() {
3161
+ this.sealed = false;
3162
+ }
3163
+ size() {
3164
+ this._checkSealed();
3165
+ return this.items.length;
3166
+ }
3167
+ getItem(i2) {
3168
+ this._checkSealed();
3169
+ if (i2 >= this.items.length)
3170
+ throw Error("out of range");
3171
+ return this.items[i2];
3172
+ }
3173
+ iterate(begin, end, cb) {
3174
+ this._checkSealed();
3175
+ this._checkBounds(begin, end);
3176
+ for (let i2 = begin; i2 < end; ++i2) {
3177
+ if (!cb(this.items[i2], i2))
3178
+ break;
3179
+ }
3180
+ }
3181
+ findLowerBound(begin, end, bound) {
3182
+ this._checkSealed();
3183
+ this._checkBounds(begin, end);
3184
+ return this._binarySearch(this.items, begin, end, (a) => itemCompare(a, bound) < 0);
3185
+ }
3186
+ fingerprint(begin, end) {
3187
+ let out = new Accumulator();
3188
+ out.setToZero();
3189
+ this.iterate(begin, end, (item) => {
3190
+ out.add(item.id);
3191
+ return true;
3192
+ });
3193
+ return out.getFingerprint(end - begin);
3194
+ }
3195
+ _checkSealed() {
3196
+ if (!this.sealed)
3197
+ throw Error("not sealed");
3198
+ }
3199
+ _checkBounds(begin, end) {
3200
+ if (begin > end || end > this.items.length)
3201
+ throw Error("bad range");
3202
+ }
3203
+ _binarySearch(arr, first, last, cmp) {
3204
+ let count = last - first;
3205
+ while (count > 0) {
3206
+ let it = first;
3207
+ let step = Math.floor(count / 2);
3208
+ it += step;
3209
+ if (cmp(arr[it])) {
3210
+ first = ++it;
3211
+ count -= step + 1;
3212
+ } else {
3213
+ count = step;
3214
+ }
3215
+ }
3216
+ return first;
3217
+ }
3218
+ };
3219
+ var Negentropy = class {
3220
+ storage;
3221
+ frameSizeLimit;
3222
+ lastTimestampIn;
3223
+ lastTimestampOut;
3224
+ constructor(storage, frameSizeLimit = 6e4) {
3225
+ if (frameSizeLimit < 4096)
3226
+ throw Error("frameSizeLimit too small");
3227
+ this.storage = storage;
3228
+ this.frameSizeLimit = frameSizeLimit;
3229
+ this.lastTimestampIn = 0;
3230
+ this.lastTimestampOut = 0;
3231
+ }
3232
+ _bound(timestamp, id) {
3233
+ return { timestamp, id: id || new Uint8Array(0) };
3234
+ }
3235
+ initiate() {
3236
+ let output = new WrappedBuffer();
3237
+ output.extend(new Uint8Array([PROTOCOL_VERSION]));
3238
+ this.splitRange(0, this.storage.size(), this._bound(Number.MAX_VALUE), output);
3239
+ return bytesToHex5(output.unwrap());
3240
+ }
3241
+ reconcile(queryMsg, onhave, onneed) {
3242
+ const query = new WrappedBuffer(hexToBytes6(queryMsg));
3243
+ this.lastTimestampIn = this.lastTimestampOut = 0;
3244
+ let fullOutput = new WrappedBuffer();
3245
+ fullOutput.extend(new Uint8Array([PROTOCOL_VERSION]));
3246
+ let protocolVersion = getByte(query);
3247
+ if (protocolVersion < 96 || protocolVersion > 111)
3248
+ throw Error("invalid negentropy protocol version byte");
3249
+ if (protocolVersion !== PROTOCOL_VERSION) {
3250
+ throw Error("unsupported negentropy protocol version requested: " + (protocolVersion - 96));
3251
+ }
3252
+ let storageSize = this.storage.size();
3253
+ let prevBound = this._bound(0);
3254
+ let prevIndex = 0;
3255
+ let skip = false;
3256
+ while (query.length !== 0) {
3257
+ let o = new WrappedBuffer();
3258
+ let doSkip = () => {
3259
+ if (skip) {
3260
+ skip = false;
3261
+ o.extend(this.encodeBound(prevBound));
3262
+ o.extend(encodeVarInt(Mode.Skip));
3263
+ }
3264
+ };
3265
+ let currBound = this.decodeBound(query);
3266
+ let mode = decodeVarInt(query);
3267
+ let lower = prevIndex;
3268
+ let upper = this.storage.findLowerBound(prevIndex, storageSize, currBound);
3269
+ if (mode === Mode.Skip) {
3270
+ skip = true;
3271
+ } else if (mode === Mode.Fingerprint) {
3272
+ let theirFingerprint = getBytes(query, FINGERPRINT_SIZE);
3273
+ let ourFingerprint = this.storage.fingerprint(lower, upper);
3274
+ if (compareUint8Array(theirFingerprint, ourFingerprint) !== 0) {
3275
+ doSkip();
3276
+ this.splitRange(lower, upper, currBound, o);
3277
+ } else {
3278
+ skip = true;
3279
+ }
3280
+ } else if (mode === Mode.IdList) {
3281
+ let numIds = decodeVarInt(query);
3282
+ let theirElems = {};
3283
+ for (let i2 = 0; i2 < numIds; i2++) {
3284
+ let e = getBytes(query, ID_SIZE);
3285
+ theirElems[bytesToHex5(e)] = e;
3286
+ }
3287
+ skip = true;
3288
+ this.storage.iterate(lower, upper, (item) => {
3289
+ let k = item.id;
3290
+ const id = bytesToHex5(k);
3291
+ if (!theirElems[id]) {
3292
+ onhave?.(id);
3293
+ } else {
3294
+ delete theirElems[bytesToHex5(k)];
3295
+ }
3296
+ return true;
3297
+ });
3298
+ if (onneed) {
3299
+ for (let v of Object.values(theirElems)) {
3300
+ onneed(bytesToHex5(v));
3301
+ }
3302
+ }
3303
+ } else {
3304
+ throw Error("unexpected mode");
3305
+ }
3306
+ if (this.exceededFrameSizeLimit(fullOutput.length + o.length)) {
3307
+ let remainingFingerprint = this.storage.fingerprint(upper, storageSize);
3308
+ fullOutput.extend(this.encodeBound(this._bound(Number.MAX_VALUE)));
3309
+ fullOutput.extend(encodeVarInt(Mode.Fingerprint));
3310
+ fullOutput.extend(remainingFingerprint);
3311
+ break;
3312
+ } else {
3313
+ fullOutput.extend(o);
3314
+ }
3315
+ prevIndex = upper;
3316
+ prevBound = currBound;
3317
+ }
3318
+ return fullOutput.length === 1 ? null : bytesToHex5(fullOutput.unwrap());
3319
+ }
3320
+ splitRange(lower, upper, upperBound, o) {
3321
+ let numElems = upper - lower;
3322
+ let buckets = 16;
3323
+ if (numElems < buckets * 2) {
3324
+ o.extend(this.encodeBound(upperBound));
3325
+ o.extend(encodeVarInt(Mode.IdList));
3326
+ o.extend(encodeVarInt(numElems));
3327
+ this.storage.iterate(lower, upper, (item) => {
3328
+ o.extend(item.id);
3329
+ return true;
3330
+ });
3331
+ } else {
3332
+ let itemsPerBucket = Math.floor(numElems / buckets);
3333
+ let bucketsWithExtra = numElems % buckets;
3334
+ let curr = lower;
3335
+ for (let i2 = 0; i2 < buckets; i2++) {
3336
+ let bucketSize = itemsPerBucket + (i2 < bucketsWithExtra ? 1 : 0);
3337
+ let ourFingerprint = this.storage.fingerprint(curr, curr + bucketSize);
3338
+ curr += bucketSize;
3339
+ let nextBound;
3340
+ if (curr === upper) {
3341
+ nextBound = upperBound;
3342
+ } else {
3343
+ let prevItem;
3344
+ let currItem;
3345
+ this.storage.iterate(curr - 1, curr + 1, (item, index) => {
3346
+ if (index === curr - 1)
3347
+ prevItem = item;
3348
+ else
3349
+ currItem = item;
3350
+ return true;
3351
+ });
3352
+ nextBound = this.getMinimalBound(prevItem, currItem);
3353
+ }
3354
+ o.extend(this.encodeBound(nextBound));
3355
+ o.extend(encodeVarInt(Mode.Fingerprint));
3356
+ o.extend(ourFingerprint);
3357
+ }
3358
+ }
3359
+ }
3360
+ exceededFrameSizeLimit(n) {
3361
+ return n > this.frameSizeLimit - 200;
3362
+ }
3363
+ decodeTimestampIn(encoded) {
3364
+ let timestamp = decodeVarInt(encoded);
3365
+ timestamp = timestamp === 0 ? Number.MAX_VALUE : timestamp - 1;
3366
+ if (this.lastTimestampIn === Number.MAX_VALUE || timestamp === Number.MAX_VALUE) {
3367
+ this.lastTimestampIn = Number.MAX_VALUE;
3368
+ return Number.MAX_VALUE;
3369
+ }
3370
+ timestamp += this.lastTimestampIn;
3371
+ this.lastTimestampIn = timestamp;
3372
+ return timestamp;
3373
+ }
3374
+ decodeBound(encoded) {
3375
+ let timestamp = this.decodeTimestampIn(encoded);
3376
+ let len = decodeVarInt(encoded);
3377
+ if (len > ID_SIZE)
3378
+ throw Error("bound key too long");
3379
+ let id = getBytes(encoded, len);
3380
+ return { timestamp, id };
3381
+ }
3382
+ encodeTimestampOut(timestamp) {
3383
+ if (timestamp === Number.MAX_VALUE) {
3384
+ this.lastTimestampOut = Number.MAX_VALUE;
3385
+ return encodeVarInt(0);
3386
+ }
3387
+ let temp = timestamp;
3388
+ timestamp -= this.lastTimestampOut;
3389
+ this.lastTimestampOut = temp;
3390
+ return encodeVarInt(timestamp + 1);
3391
+ }
3392
+ encodeBound(key) {
3393
+ let output = new WrappedBuffer();
3394
+ output.extend(this.encodeTimestampOut(key.timestamp));
3395
+ output.extend(encodeVarInt(key.id.length));
3396
+ output.extend(key.id);
3397
+ return output;
3398
+ }
3399
+ getMinimalBound(prev, curr) {
3400
+ if (curr.timestamp !== prev.timestamp) {
3401
+ return this._bound(curr.timestamp);
3402
+ } else {
3403
+ let sharedPrefixBytes = 0;
3404
+ let currKey = curr.id;
3405
+ let prevKey = prev.id;
3406
+ for (let i2 = 0; i2 < ID_SIZE; i2++) {
3407
+ if (currKey[i2] !== prevKey[i2])
3408
+ break;
3409
+ sharedPrefixBytes++;
3410
+ }
3411
+ return this._bound(curr.timestamp, curr.id.subarray(0, sharedPrefixBytes + 1));
3412
+ }
3413
+ }
3414
+ };
3415
+ function compareUint8Array(a, b) {
3416
+ for (let i2 = 0; i2 < a.byteLength; i2++) {
3417
+ if (a[i2] < b[i2])
3418
+ return -1;
3419
+ if (a[i2] > b[i2])
3420
+ return 1;
3421
+ }
3422
+ if (a.byteLength > b.byteLength)
3423
+ return 1;
3424
+ if (a.byteLength < b.byteLength)
3425
+ return -1;
3426
+ return 0;
3427
+ }
3428
+ function itemCompare(a, b) {
3429
+ if (a.timestamp === b.timestamp) {
3430
+ return compareUint8Array(a.id, b.id);
3431
+ }
3432
+ return a.timestamp - b.timestamp;
3433
+ }
3434
+ var NegentropySync = class {
3435
+ relay;
3436
+ storage;
3437
+ neg;
3438
+ filter;
3439
+ subscription;
3440
+ onhave;
3441
+ onneed;
3442
+ constructor(relay, storage, filter, params = {}) {
3443
+ this.relay = relay;
3444
+ this.storage = storage;
3445
+ this.neg = new Negentropy(storage);
3446
+ this.onhave = params.onhave;
3447
+ this.onneed = params.onneed;
3448
+ this.filter = filter;
3449
+ this.subscription = this.relay.prepareSubscription([{}], { label: params.label || "negentropy" });
3450
+ this.subscription.oncustom = (data) => {
3451
+ switch (data[0]) {
3452
+ case "NEG-MSG": {
3453
+ if (data.length < 3) {
3454
+ console.warn(`got invalid NEG-MSG from ${this.relay.url}: ${data}`);
3455
+ }
3456
+ try {
3457
+ const response = this.neg.reconcile(data[2], this.onhave, this.onneed);
3458
+ if (response) {
3459
+ this.relay.send(`["NEG-MSG", "${this.subscription.id}", "${response}"]`);
3460
+ } else {
3461
+ this.close();
3462
+ params.onclose?.();
3463
+ }
3464
+ } catch (error) {
3465
+ console.error("negentropy reconcile error:", error);
3466
+ params?.onclose?.(`reconcile error: ${error}`);
3467
+ }
3468
+ break;
3469
+ }
3470
+ case "NEG-CLOSE": {
3471
+ const reason = data[2];
3472
+ console.warn("negentropy error:", reason);
3473
+ params.onclose?.(reason);
3474
+ break;
3475
+ }
3476
+ case "NEG-ERR": {
3477
+ params.onclose?.();
3478
+ }
3479
+ }
3480
+ };
3481
+ }
3482
+ async start() {
3483
+ const initMsg = this.neg.initiate();
3484
+ this.relay.send(`["NEG-OPEN","${this.subscription.id}",${JSON.stringify(this.filter)},"${initMsg}"]`);
3485
+ }
3486
+ close() {
3487
+ this.relay.send(`["NEG-CLOSE","${this.subscription.id}"]`);
3488
+ this.subscription.close();
3489
+ }
3490
+ };
3491
+
3492
+ // nip98.ts
3493
+ var nip98_exports = {};
3494
+ __export(nip98_exports, {
3495
+ getToken: () => getToken,
3496
+ hashPayload: () => hashPayload,
3497
+ unpackEventFromToken: () => unpackEventFromToken,
3498
+ validateEvent: () => validateEvent2,
3499
+ validateEventKind: () => validateEventKind,
3500
+ validateEventMethodTag: () => validateEventMethodTag,
3501
+ validateEventPayloadTag: () => validateEventPayloadTag,
3502
+ validateEventTimestamp: () => validateEventTimestamp,
3503
+ validateEventUrlTag: () => validateEventUrlTag,
3504
+ validateToken: () => validateToken
3505
+ });
3506
+ import { sha256 as sha2565 } from "@noble/hashes/sha2.js";
3507
+ import { bytesToHex as bytesToHex6 } from "@noble/hashes/utils.js";
3508
+ import { base64 as base643 } from "@scure/base";
3509
+ var _authorizationScheme = "Nostr ";
3510
+ async function getToken(loginUrl, httpMethod, sign, includeAuthorizationScheme = false, payload) {
3511
+ const event = {
3512
+ kind: HTTPAuth,
3513
+ tags: [
3514
+ ["u", loginUrl],
3515
+ ["method", httpMethod]
3516
+ ],
3517
+ created_at: Math.round(new Date().getTime() / 1e3),
3518
+ content: ""
3519
+ };
3520
+ if (payload) {
3521
+ event.tags.push(["payload", hashPayload(payload)]);
3522
+ }
3523
+ const signedEvent = await sign(event);
3524
+ const authorizationScheme = includeAuthorizationScheme ? _authorizationScheme : "";
3525
+ return authorizationScheme + base643.encode(utf8Encoder.encode(JSON.stringify(signedEvent)));
3526
+ }
3527
+ async function validateToken(token, url, method) {
3528
+ const event = await unpackEventFromToken(token).catch((error) => {
3529
+ throw error;
3530
+ });
3531
+ const valid = await validateEvent2(event, url, method).catch((error) => {
3532
+ throw error;
3533
+ });
3534
+ return valid;
3535
+ }
3536
+ async function unpackEventFromToken(token) {
3537
+ if (!token) {
3538
+ throw new Error("Missing token");
3539
+ }
3540
+ token = token.replace(_authorizationScheme, "");
3541
+ const eventB64 = utf8Decoder.decode(base643.decode(token));
3542
+ if (!eventB64 || eventB64.length === 0 || !eventB64.startsWith("{")) {
3543
+ throw new Error("Invalid token");
3544
+ }
3545
+ const event = JSON.parse(eventB64);
3546
+ return event;
3547
+ }
3548
+ function validateEventTimestamp(event) {
3549
+ if (!event.created_at) {
3550
+ return false;
3551
+ }
3552
+ return Math.round(new Date().getTime() / 1e3) - event.created_at < 60;
3553
+ }
3554
+ function validateEventKind(event) {
3555
+ return event.kind === HTTPAuth;
3556
+ }
3557
+ function validateEventUrlTag(event, url) {
3558
+ const urlTag = event.tags.find((t) => t[0] === "u");
3559
+ if (!urlTag) {
3560
+ return false;
3561
+ }
3562
+ return urlTag.length > 0 && urlTag[1] === url;
3563
+ }
3564
+ function validateEventMethodTag(event, method) {
3565
+ const methodTag = event.tags.find((t) => t[0] === "method");
3566
+ if (!methodTag) {
3567
+ return false;
3568
+ }
3569
+ return methodTag.length > 0 && methodTag[1].toLowerCase() === method.toLowerCase();
3570
+ }
3571
+ function hashPayload(payload) {
3572
+ const hash = sha2565(utf8Encoder.encode(JSON.stringify(payload)));
3573
+ return bytesToHex6(hash);
3574
+ }
3575
+ function validateEventPayloadTag(event, payload) {
3576
+ const payloadTag = event.tags.find((t) => t[0] === "payload");
3577
+ if (!payloadTag) {
3578
+ return false;
3579
+ }
3580
+ const payloadHash = hashPayload(payload);
3581
+ return payloadTag.length > 0 && payloadTag[1] === payloadHash;
3582
+ }
3583
+ async function validateEvent2(event, url, method, body) {
3584
+ if (!verifyEvent(event)) {
3585
+ throw new Error("Invalid nostr event, signature invalid");
3586
+ }
3587
+ if (!validateEventKind(event)) {
3588
+ throw new Error("Invalid nostr event, kind invalid");
3589
+ }
3590
+ if (!validateEventTimestamp(event)) {
3591
+ throw new Error("Invalid nostr event, created_at timestamp invalid");
3592
+ }
3593
+ if (!validateEventUrlTag(event, url)) {
3594
+ throw new Error("Invalid nostr event, url tag invalid");
3595
+ }
3596
+ if (!validateEventMethodTag(event, method)) {
3597
+ throw new Error("Invalid nostr event, method tag invalid");
3598
+ }
3599
+ if (Boolean(body) && typeof body === "object" && Object.keys(body).length > 0) {
3600
+ if (!validateEventPayloadTag(event, body)) {
3601
+ throw new Error("Invalid nostr event, payload tag does not match request body hash");
3602
+ }
3603
+ }
3604
+ return true;
3605
+ }
3606
+ export {
3607
+ Relay,
3608
+ SimplePool,
3609
+ finalizeEvent,
3610
+ fakejson_exports as fj,
3611
+ generateSecretKey,
3612
+ getEventHash,
3613
+ getFilterLimit,
3614
+ getPublicKey,
3615
+ kinds_exports as kinds,
3616
+ matchFilter,
3617
+ matchFilters,
3618
+ mergeFilters,
3619
+ nip04_exports as nip04,
3620
+ nip05_exports as nip05,
3621
+ nip10_exports as nip10,
3622
+ nip11_exports as nip11,
3623
+ nip13_exports as nip13,
3624
+ nip17_exports as nip17,
3625
+ nip18_exports as nip18,
3626
+ nip19_exports as nip19,
3627
+ nip21_exports as nip21,
3628
+ nip22_exports as nip22,
3629
+ nip25_exports as nip25,
3630
+ nip27_exports as nip27,
3631
+ nip28_exports as nip28,
3632
+ nip30_exports as nip30,
3633
+ nip39_exports as nip39,
3634
+ nip42_exports as nip42,
3635
+ nip44_exports as nip44,
3636
+ nip47_exports as nip47,
3637
+ nip54_exports as nip54,
3638
+ nip57_exports as nip57,
3639
+ nip59_exports as nip59,
3640
+ nip77_exports as nip77,
3641
+ nip98_exports as nip98,
3642
+ parseReferences,
3643
+ serializeEvent,
3644
+ sortEvents,
3645
+ utils_exports as utils,
3646
+ validateEvent,
3647
+ verifiedSymbol,
3648
+ verifyEvent
3649
+ };