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