@abaxxtech/id 0.0.0

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 (711) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +31 -0
  3. package/README.npm.md +31 -0
  4. package/dist/bundles/dwn.js +83 -0
  5. package/dist/cjs/index.js +31250 -0
  6. package/dist/cjs/package.json +1 -0
  7. package/dist/esm/generated/precompiled-validators.js +7820 -0
  8. package/dist/esm/generated/precompiled-validators.js.map +1 -0
  9. package/dist/esm/json-schemas/definitions.json +23 -0
  10. package/dist/esm/src/core/abstract-message.js +37 -0
  11. package/dist/esm/src/core/abstract-message.js.map +1 -0
  12. package/dist/esm/src/core/auth.js +97 -0
  13. package/dist/esm/src/core/auth.js.map +1 -0
  14. package/dist/esm/src/core/dwn-constant.js +8 -0
  15. package/dist/esm/src/core/dwn-constant.js.map +1 -0
  16. package/dist/esm/src/core/dwn-error.js +138 -0
  17. package/dist/esm/src/core/dwn-error.js.map +1 -0
  18. package/dist/esm/src/core/grant-authorization.js +108 -0
  19. package/dist/esm/src/core/grant-authorization.js.map +1 -0
  20. package/dist/esm/src/core/message-reply.js +5 -0
  21. package/dist/esm/src/core/message-reply.js.map +1 -0
  22. package/dist/esm/src/core/message.js +200 -0
  23. package/dist/esm/src/core/message.js.map +1 -0
  24. package/dist/esm/src/core/protocol-authorization.js +449 -0
  25. package/dist/esm/src/core/protocol-authorization.js.map +1 -0
  26. package/dist/esm/src/core/records-grant-authorization.js +106 -0
  27. package/dist/esm/src/core/records-grant-authorization.js.map +1 -0
  28. package/dist/esm/src/core/tenant-gate.js +20 -0
  29. package/dist/esm/src/core/tenant-gate.js.map +1 -0
  30. package/dist/esm/src/did/did-dht-resolver.js +241 -0
  31. package/dist/esm/src/did/did-dht-resolver.js.map +1 -0
  32. package/dist/esm/src/did/did-ion-resolver.js +53 -0
  33. package/dist/esm/src/did/did-ion-resolver.js.map +1 -0
  34. package/dist/esm/src/did/did-key-resolver.js +135 -0
  35. package/dist/esm/src/did/did-key-resolver.js.map +1 -0
  36. package/dist/esm/src/did/did-resolver.js +70 -0
  37. package/dist/esm/src/did/did-resolver.js.map +1 -0
  38. package/dist/esm/src/did/did.js +36 -0
  39. package/dist/esm/src/did/did.js.map +1 -0
  40. package/dist/esm/src/dwn.js +164 -0
  41. package/dist/esm/src/dwn.js.map +1 -0
  42. package/dist/esm/src/enums/dwn-interface-method.js +22 -0
  43. package/dist/esm/src/enums/dwn-interface-method.js.map +1 -0
  44. package/dist/esm/src/event-log/event-log-level.js +112 -0
  45. package/dist/esm/src/event-log/event-log-level.js.map +1 -0
  46. package/dist/esm/src/handlers/events-get.js +48 -0
  47. package/dist/esm/src/handlers/events-get.js.map +1 -0
  48. package/dist/esm/src/handlers/messages-get.js +76 -0
  49. package/dist/esm/src/handlers/messages-get.js.map +1 -0
  50. package/dist/esm/src/handlers/permissions-grant.js +62 -0
  51. package/dist/esm/src/handlers/permissions-grant.js.map +1 -0
  52. package/dist/esm/src/handlers/permissions-request.js +63 -0
  53. package/dist/esm/src/handlers/permissions-request.js.map +1 -0
  54. package/dist/esm/src/handlers/permissions-revoke.js +114 -0
  55. package/dist/esm/src/handlers/permissions-revoke.js.map +1 -0
  56. package/dist/esm/src/handlers/protocols-configure.js +102 -0
  57. package/dist/esm/src/handlers/protocols-configure.js.map +1 -0
  58. package/dist/esm/src/handlers/protocols-query.js +72 -0
  59. package/dist/esm/src/handlers/protocols-query.js.map +1 -0
  60. package/dist/esm/src/handlers/records-delete.js +119 -0
  61. package/dist/esm/src/handlers/records-delete.js.map +1 -0
  62. package/dist/esm/src/handlers/records-query.js +206 -0
  63. package/dist/esm/src/handlers/records-query.js.map +1 -0
  64. package/dist/esm/src/handlers/records-read.js +118 -0
  65. package/dist/esm/src/handlers/records-read.js.map +1 -0
  66. package/dist/esm/src/handlers/records-write.js +252 -0
  67. package/dist/esm/src/handlers/records-write.js.map +1 -0
  68. package/dist/esm/src/index.js +43 -0
  69. package/dist/esm/src/index.js.map +1 -0
  70. package/dist/esm/src/interfaces/events-get.js +41 -0
  71. package/dist/esm/src/interfaces/events-get.js.map +1 -0
  72. package/dist/esm/src/interfaces/messages-get.js +58 -0
  73. package/dist/esm/src/interfaces/messages-get.js.map +1 -0
  74. package/dist/esm/src/interfaces/permissions-grant.js +130 -0
  75. package/dist/esm/src/interfaces/permissions-grant.js.map +1 -0
  76. package/dist/esm/src/interfaces/permissions-request.js +47 -0
  77. package/dist/esm/src/interfaces/permissions-request.js.map +1 -0
  78. package/dist/esm/src/interfaces/permissions-revoke.js +47 -0
  79. package/dist/esm/src/interfaces/permissions-revoke.js.map +1 -0
  80. package/dist/esm/src/interfaces/protocols-configure.js +149 -0
  81. package/dist/esm/src/interfaces/protocols-configure.js.map +1 -0
  82. package/dist/esm/src/interfaces/protocols-query.js +80 -0
  83. package/dist/esm/src/interfaces/protocols-query.js.map +1 -0
  84. package/dist/esm/src/interfaces/records-delete.js +56 -0
  85. package/dist/esm/src/interfaces/records-delete.js.map +1 -0
  86. package/dist/esm/src/interfaces/records-query.js +81 -0
  87. package/dist/esm/src/interfaces/records-query.js.map +1 -0
  88. package/dist/esm/src/interfaces/records-read.js +65 -0
  89. package/dist/esm/src/interfaces/records-read.js.map +1 -0
  90. package/dist/esm/src/interfaces/records-write.js +677 -0
  91. package/dist/esm/src/interfaces/records-write.js.map +1 -0
  92. package/dist/esm/src/jose/algorithms/signing/ed25519.js +54 -0
  93. package/dist/esm/src/jose/algorithms/signing/ed25519.js.map +1 -0
  94. package/dist/esm/src/jose/algorithms/signing/signature-algorithms.js +13 -0
  95. package/dist/esm/src/jose/algorithms/signing/signature-algorithms.js.map +1 -0
  96. package/dist/esm/src/jose/jws/general/builder.js +47 -0
  97. package/dist/esm/src/jose/jws/general/builder.js.map +1 -0
  98. package/dist/esm/src/jose/jws/general/signer.js +36 -0
  99. package/dist/esm/src/jose/jws/general/signer.js.map +1 -0
  100. package/dist/esm/src/jose/jws/general/verifier.js +97 -0
  101. package/dist/esm/src/jose/jws/general/verifier.js.map +1 -0
  102. package/dist/esm/src/schema-validator.js +28 -0
  103. package/dist/esm/src/schema-validator.js.map +1 -0
  104. package/dist/esm/src/store/blockstore-level.js +187 -0
  105. package/dist/esm/src/store/blockstore-level.js.map +1 -0
  106. package/dist/esm/src/store/data-store-level.js +192 -0
  107. package/dist/esm/src/store/data-store-level.js.map +1 -0
  108. package/dist/esm/src/store/index-level.js +302 -0
  109. package/dist/esm/src/store/index-level.js.map +1 -0
  110. package/dist/esm/src/store/level-wrapper.js +296 -0
  111. package/dist/esm/src/store/level-wrapper.js.map +1 -0
  112. package/dist/esm/src/store/message-store-level.js +236 -0
  113. package/dist/esm/src/store/message-store-level.js.map +1 -0
  114. package/dist/esm/src/store/storage-controller.js +69 -0
  115. package/dist/esm/src/store/storage-controller.js.map +1 -0
  116. package/dist/esm/src/types/cache.js +2 -0
  117. package/dist/esm/src/types/cache.js.map +1 -0
  118. package/dist/esm/src/types/data-store.js +2 -0
  119. package/dist/esm/src/types/data-store.js.map +1 -0
  120. package/dist/esm/src/types/delegated-grant-message.js +2 -0
  121. package/dist/esm/src/types/delegated-grant-message.js.map +1 -0
  122. package/dist/esm/src/types/did-types.js +2 -0
  123. package/dist/esm/src/types/did-types.js.map +1 -0
  124. package/dist/esm/src/types/event-log.js +2 -0
  125. package/dist/esm/src/types/event-log.js.map +1 -0
  126. package/dist/esm/src/types/event-types.js +2 -0
  127. package/dist/esm/src/types/event-types.js.map +1 -0
  128. package/dist/esm/src/types/jose-types.js +2 -0
  129. package/dist/esm/src/types/jose-types.js.map +1 -0
  130. package/dist/esm/src/types/jws-types.js +2 -0
  131. package/dist/esm/src/types/jws-types.js.map +1 -0
  132. package/dist/esm/src/types/message-interface.js +2 -0
  133. package/dist/esm/src/types/message-interface.js.map +1 -0
  134. package/dist/esm/src/types/message-store.js +2 -0
  135. package/dist/esm/src/types/message-store.js.map +1 -0
  136. package/dist/esm/src/types/message-types.js +6 -0
  137. package/dist/esm/src/types/message-types.js.map +1 -0
  138. package/dist/esm/src/types/messages-types.js +2 -0
  139. package/dist/esm/src/types/messages-types.js.map +1 -0
  140. package/dist/esm/src/types/method-handler.js +2 -0
  141. package/dist/esm/src/types/method-handler.js.map +1 -0
  142. package/dist/esm/src/types/permissions-grant-descriptor.js +6 -0
  143. package/dist/esm/src/types/permissions-grant-descriptor.js.map +1 -0
  144. package/dist/esm/src/types/permissions-types.js +2 -0
  145. package/dist/esm/src/types/permissions-types.js.map +1 -0
  146. package/dist/esm/src/types/protocols-types.js +15 -0
  147. package/dist/esm/src/types/protocols-types.js.map +1 -0
  148. package/dist/esm/src/types/records-types.js +8 -0
  149. package/dist/esm/src/types/records-types.js.map +1 -0
  150. package/dist/esm/src/types/signer.js +2 -0
  151. package/dist/esm/src/types/signer.js.map +1 -0
  152. package/dist/esm/src/utils/abort.js +40 -0
  153. package/dist/esm/src/utils/abort.js.map +1 -0
  154. package/dist/esm/src/utils/array.js +72 -0
  155. package/dist/esm/src/utils/array.js.map +1 -0
  156. package/dist/esm/src/utils/cid.js +130 -0
  157. package/dist/esm/src/utils/cid.js.map +1 -0
  158. package/dist/esm/src/utils/data-stream.js +88 -0
  159. package/dist/esm/src/utils/data-stream.js.map +1 -0
  160. package/dist/esm/src/utils/encoder.js +45 -0
  161. package/dist/esm/src/utils/encoder.js.map +1 -0
  162. package/dist/esm/src/utils/encryption.js +128 -0
  163. package/dist/esm/src/utils/encryption.js.map +1 -0
  164. package/dist/esm/src/utils/hd-key.js +60 -0
  165. package/dist/esm/src/utils/hd-key.js.map +1 -0
  166. package/dist/esm/src/utils/jws.js +89 -0
  167. package/dist/esm/src/utils/jws.js.map +1 -0
  168. package/dist/esm/src/utils/memory-cache.js +41 -0
  169. package/dist/esm/src/utils/memory-cache.js.map +1 -0
  170. package/dist/esm/src/utils/object.js +50 -0
  171. package/dist/esm/src/utils/object.js.map +1 -0
  172. package/dist/esm/src/utils/private-key-signer.js +43 -0
  173. package/dist/esm/src/utils/private-key-signer.js.map +1 -0
  174. package/dist/esm/src/utils/protocols.js +51 -0
  175. package/dist/esm/src/utils/protocols.js.map +1 -0
  176. package/dist/esm/src/utils/records.js +267 -0
  177. package/dist/esm/src/utils/records.js.map +1 -0
  178. package/dist/esm/src/utils/secp256k1.js +219 -0
  179. package/dist/esm/src/utils/secp256k1.js.map +1 -0
  180. package/dist/esm/src/utils/string.js +16 -0
  181. package/dist/esm/src/utils/string.js.map +1 -0
  182. package/dist/esm/src/utils/time.js +84 -0
  183. package/dist/esm/src/utils/time.js.map +1 -0
  184. package/dist/esm/src/utils/url.js +63 -0
  185. package/dist/esm/src/utils/url.js.map +1 -0
  186. package/dist/esm/tests/core/auth.spec.js +25 -0
  187. package/dist/esm/tests/core/auth.spec.js.map +1 -0
  188. package/dist/esm/tests/core/message-reply.spec.js +19 -0
  189. package/dist/esm/tests/core/message-reply.spec.js.map +1 -0
  190. package/dist/esm/tests/core/message.spec.js +85 -0
  191. package/dist/esm/tests/core/message.spec.js.map +1 -0
  192. package/dist/esm/tests/did/did-ion-resolver.spec.js +82 -0
  193. package/dist/esm/tests/did/did-ion-resolver.spec.js.map +1 -0
  194. package/dist/esm/tests/did/did-key-resolver.spec.js +74 -0
  195. package/dist/esm/tests/did/did-key-resolver.spec.js.map +1 -0
  196. package/dist/esm/tests/did/did-resolver.spec.js +84 -0
  197. package/dist/esm/tests/did/did-resolver.spec.js.map +1 -0
  198. package/dist/esm/tests/did/did.spec.js +22 -0
  199. package/dist/esm/tests/did/did.spec.js.map +1 -0
  200. package/dist/esm/tests/dwn.spec.js +252 -0
  201. package/dist/esm/tests/dwn.spec.js.map +1 -0
  202. package/dist/esm/tests/end-to-end-tests.spec.js +218 -0
  203. package/dist/esm/tests/end-to-end-tests.spec.js.map +1 -0
  204. package/dist/esm/tests/event-log/event-log-level.spec.js +137 -0
  205. package/dist/esm/tests/event-log/event-log-level.spec.js.map +1 -0
  206. package/dist/esm/tests/handlers/events-get.spec.js +108 -0
  207. package/dist/esm/tests/handlers/events-get.spec.js.map +1 -0
  208. package/dist/esm/tests/handlers/messages-get.spec.js +209 -0
  209. package/dist/esm/tests/handlers/messages-get.spec.js.map +1 -0
  210. package/dist/esm/tests/handlers/permissions-grant.spec.js +249 -0
  211. package/dist/esm/tests/handlers/permissions-grant.spec.js.map +1 -0
  212. package/dist/esm/tests/handlers/permissions-request.spec.js +132 -0
  213. package/dist/esm/tests/handlers/permissions-request.spec.js.map +1 -0
  214. package/dist/esm/tests/handlers/permissions-revoke.spec.js +311 -0
  215. package/dist/esm/tests/handlers/permissions-revoke.spec.js.map +1 -0
  216. package/dist/esm/tests/handlers/protocols-configure.spec.js +254 -0
  217. package/dist/esm/tests/handlers/protocols-configure.spec.js.map +1 -0
  218. package/dist/esm/tests/handlers/protocols-query.spec.js +373 -0
  219. package/dist/esm/tests/handlers/protocols-query.spec.js.map +1 -0
  220. package/dist/esm/tests/handlers/records-delete.spec.js +630 -0
  221. package/dist/esm/tests/handlers/records-delete.spec.js.map +1 -0
  222. package/dist/esm/tests/handlers/records-query.spec.js +1937 -0
  223. package/dist/esm/tests/handlers/records-query.spec.js.map +1 -0
  224. package/dist/esm/tests/handlers/records-read.spec.js +1729 -0
  225. package/dist/esm/tests/handlers/records-read.spec.js.map +1 -0
  226. package/dist/esm/tests/handlers/records-write.spec.js +3381 -0
  227. package/dist/esm/tests/handlers/records-write.spec.js.map +1 -0
  228. package/dist/esm/tests/interfaces/events-get.spec.js +73 -0
  229. package/dist/esm/tests/interfaces/events-get.spec.js.map +1 -0
  230. package/dist/esm/tests/interfaces/messages-get.spec.js +93 -0
  231. package/dist/esm/tests/interfaces/messages-get.spec.js.map +1 -0
  232. package/dist/esm/tests/interfaces/permissions-grant.spec.js +216 -0
  233. package/dist/esm/tests/interfaces/permissions-grant.spec.js.map +1 -0
  234. package/dist/esm/tests/interfaces/permissions-request.spec.js +45 -0
  235. package/dist/esm/tests/interfaces/permissions-request.spec.js.map +1 -0
  236. package/dist/esm/tests/interfaces/protocols-configure.spec.js +334 -0
  237. package/dist/esm/tests/interfaces/protocols-configure.spec.js.map +1 -0
  238. package/dist/esm/tests/interfaces/protocols-query.spec.js +49 -0
  239. package/dist/esm/tests/interfaces/protocols-query.spec.js.map +1 -0
  240. package/dist/esm/tests/interfaces/records-delete.spec.js +42 -0
  241. package/dist/esm/tests/interfaces/records-delete.spec.js.map +1 -0
  242. package/dist/esm/tests/interfaces/records-query.spec.js +75 -0
  243. package/dist/esm/tests/interfaces/records-query.spec.js.map +1 -0
  244. package/dist/esm/tests/interfaces/records-read.spec.js +65 -0
  245. package/dist/esm/tests/interfaces/records-read.spec.js.map +1 -0
  246. package/dist/esm/tests/interfaces/records-write.spec.js +369 -0
  247. package/dist/esm/tests/interfaces/records-write.spec.js.map +1 -0
  248. package/dist/esm/tests/jose/jws/general.spec.js +185 -0
  249. package/dist/esm/tests/jose/jws/general.spec.js.map +1 -0
  250. package/dist/esm/tests/scenarios/delegated-grant.spec.js +490 -0
  251. package/dist/esm/tests/scenarios/delegated-grant.spec.js.map +1 -0
  252. package/dist/esm/tests/scenarios/end-to-end-tests.spec.js +218 -0
  253. package/dist/esm/tests/scenarios/end-to-end-tests.spec.js.map +1 -0
  254. package/dist/esm/tests/store/data-store-level.spec.js +192 -0
  255. package/dist/esm/tests/store/data-store-level.spec.js.map +1 -0
  256. package/dist/esm/tests/store/index-level.spec.js +428 -0
  257. package/dist/esm/tests/store/index-level.spec.js.map +1 -0
  258. package/dist/esm/tests/store/message-store-level.spec.js +51 -0
  259. package/dist/esm/tests/store/message-store-level.spec.js.map +1 -0
  260. package/dist/esm/tests/store/message-store.spec.js +395 -0
  261. package/dist/esm/tests/store/message-store.spec.js.map +1 -0
  262. package/dist/esm/tests/store-dependent-tests.spec.js +8 -0
  263. package/dist/esm/tests/store-dependent-tests.spec.js.map +1 -0
  264. package/dist/esm/tests/test-stores.js +40 -0
  265. package/dist/esm/tests/test-stores.js.map +1 -0
  266. package/dist/esm/tests/test-suite.js +51 -0
  267. package/dist/esm/tests/test-suite.js.map +1 -0
  268. package/dist/esm/tests/utils/cid.spec.js +83 -0
  269. package/dist/esm/tests/utils/cid.spec.js.map +1 -0
  270. package/dist/esm/tests/utils/data-stream.spec.js +30 -0
  271. package/dist/esm/tests/utils/data-stream.spec.js.map +1 -0
  272. package/dist/esm/tests/utils/encryption.spec.js +151 -0
  273. package/dist/esm/tests/utils/encryption.spec.js.map +1 -0
  274. package/dist/esm/tests/utils/jws.spec.js +11 -0
  275. package/dist/esm/tests/utils/jws.spec.js.map +1 -0
  276. package/dist/esm/tests/utils/memory-cache.spec.js +38 -0
  277. package/dist/esm/tests/utils/memory-cache.spec.js.map +1 -0
  278. package/dist/esm/tests/utils/object.spec.js +39 -0
  279. package/dist/esm/tests/utils/object.spec.js.map +1 -0
  280. package/dist/esm/tests/utils/private-key-signer.spec.js +47 -0
  281. package/dist/esm/tests/utils/private-key-signer.spec.js.map +1 -0
  282. package/dist/esm/tests/utils/records.spec.js +56 -0
  283. package/dist/esm/tests/utils/records.spec.js.map +1 -0
  284. package/dist/esm/tests/utils/secp256k1.spec.js +77 -0
  285. package/dist/esm/tests/utils/secp256k1.spec.js.map +1 -0
  286. package/dist/esm/tests/utils/test-data-generator.js +570 -0
  287. package/dist/esm/tests/utils/test-data-generator.js.map +1 -0
  288. package/dist/esm/tests/utils/test-stub-generator.js +39 -0
  289. package/dist/esm/tests/utils/test-stub-generator.js.map +1 -0
  290. package/dist/esm/tests/utils/time.spec.js +67 -0
  291. package/dist/esm/tests/utils/time.spec.js.map +1 -0
  292. package/dist/esm/tests/utils/url.spec.js +46 -0
  293. package/dist/esm/tests/utils/url.spec.js.map +1 -0
  294. package/dist/esm/tests/validation/json-schemas/definitions.spec.js +36 -0
  295. package/dist/esm/tests/validation/json-schemas/definitions.spec.js.map +1 -0
  296. package/dist/esm/tests/validation/json-schemas/jwk/general-jwk.spec.js +53 -0
  297. package/dist/esm/tests/validation/json-schemas/jwk/general-jwk.spec.js.map +1 -0
  298. package/dist/esm/tests/validation/json-schemas/jwk/public-jwk.spec.js +39 -0
  299. package/dist/esm/tests/validation/json-schemas/jwk/public-jwk.spec.js.map +1 -0
  300. package/dist/esm/tests/validation/json-schemas/jwk-verification-method.spec.js +76 -0
  301. package/dist/esm/tests/validation/json-schemas/jwk-verification-method.spec.js.map +1 -0
  302. package/dist/esm/tests/validation/json-schemas/protocols/protocols-configure.spec.js +74 -0
  303. package/dist/esm/tests/validation/json-schemas/protocols/protocols-configure.spec.js.map +1 -0
  304. package/dist/esm/tests/validation/json-schemas/records/records-query.spec.js +151 -0
  305. package/dist/esm/tests/validation/json-schemas/records/records-query.spec.js.map +1 -0
  306. package/dist/esm/tests/validation/json-schemas/records/records-write.spec.js +389 -0
  307. package/dist/esm/tests/validation/json-schemas/records/records-write.spec.js.map +1 -0
  308. package/dist/esm/tests/vectors/protocol-definitions/anyone-collaborate.json +25 -0
  309. package/dist/esm/tests/vectors/protocol-definitions/author-can.json +32 -0
  310. package/dist/esm/tests/vectors/protocol-definitions/chat.json +56 -0
  311. package/dist/esm/tests/vectors/protocol-definitions/credential-issuance.json +37 -0
  312. package/dist/esm/tests/vectors/protocol-definitions/dex.json +52 -0
  313. package/dist/esm/tests/vectors/protocol-definitions/email.json +50 -0
  314. package/dist/esm/tests/vectors/protocol-definitions/free-for-all.json +30 -0
  315. package/dist/esm/tests/vectors/protocol-definitions/friend-role.json +48 -0
  316. package/dist/esm/tests/vectors/protocol-definitions/message.json +20 -0
  317. package/dist/esm/tests/vectors/protocol-definitions/minimal.json +10 -0
  318. package/dist/esm/tests/vectors/protocol-definitions/nested.json +31 -0
  319. package/dist/esm/tests/vectors/protocol-definitions/private-protocol.json +13 -0
  320. package/dist/esm/tests/vectors/protocol-definitions/recipient-can.json +36 -0
  321. package/dist/esm/tests/vectors/protocol-definitions/social-media.json +88 -0
  322. package/dist/esm/tests/vectors/protocol-definitions/thread-role.json +68 -0
  323. package/dist/types/generated/precompiled-validators.d.ts +113 -0
  324. package/dist/types/generated/precompiled-validators.d.ts.map +1 -0
  325. package/dist/types/src/core/abstract-message.d.ts +19 -0
  326. package/dist/types/src/core/abstract-message.d.ts.map +1 -0
  327. package/dist/types/src/core/auth.d.ts +30 -0
  328. package/dist/types/src/core/auth.d.ts.map +1 -0
  329. package/dist/types/src/core/dwn-constant.d.ts +8 -0
  330. package/dist/types/src/core/dwn-constant.d.ts.map +1 -0
  331. package/dist/types/src/core/dwn-error.d.ts +133 -0
  332. package/dist/types/src/core/dwn-error.d.ts.map +1 -0
  333. package/dist/types/src/core/grant-authorization.d.ts +35 -0
  334. package/dist/types/src/core/grant-authorization.d.ts.map +1 -0
  335. package/dist/types/src/core/message-reply.d.ts +33 -0
  336. package/dist/types/src/core/message-reply.d.ts.map +1 -0
  337. package/dist/types/src/core/message.d.ts +79 -0
  338. package/dist/types/src/core/message.d.ts.map +1 -0
  339. package/dist/types/src/core/protocol-authorization.d.ts +85 -0
  340. package/dist/types/src/core/protocol-authorization.d.ts.map +1 -0
  341. package/dist/types/src/core/records-grant-authorization.d.ts +38 -0
  342. package/dist/types/src/core/records-grant-authorization.d.ts.map +1 -0
  343. package/dist/types/src/core/tenant-gate.d.ts +16 -0
  344. package/dist/types/src/core/tenant-gate.d.ts.map +1 -0
  345. package/dist/types/src/did/did-dht-resolver.d.ts +26 -0
  346. package/dist/types/src/did/did-dht-resolver.d.ts.map +1 -0
  347. package/dist/types/src/did/did-ion-resolver.d.ts +20 -0
  348. package/dist/types/src/did/did-ion-resolver.d.ts.map +1 -0
  349. package/dist/types/src/did/did-key-resolver.d.ts +32 -0
  350. package/dist/types/src/did/did-key-resolver.d.ts.map +1 -0
  351. package/dist/types/src/did/did-resolver.d.ts +20 -0
  352. package/dist/types/src/did/did-resolver.d.ts.map +1 -0
  353. package/dist/types/src/did/did.d.ts +15 -0
  354. package/dist/types/src/did/did.d.ts.map +1 -0
  355. package/dist/types/src/dwn.d.ts +74 -0
  356. package/dist/types/src/dwn.d.ts.map +1 -0
  357. package/dist/types/src/enums/dwn-interface-method.d.ts +20 -0
  358. package/dist/types/src/enums/dwn-interface-method.d.ts.map +1 -0
  359. package/dist/types/src/event-log/event-log-level.d.ts +26 -0
  360. package/dist/types/src/event-log/event-log-level.d.ts.map +1 -0
  361. package/dist/types/src/handlers/events-get.d.ts +16 -0
  362. package/dist/types/src/handlers/events-get.d.ts.map +1 -0
  363. package/dist/types/src/handlers/messages-get.d.ts +18 -0
  364. package/dist/types/src/handlers/messages-get.d.ts.map +1 -0
  365. package/dist/types/src/handlers/permissions-grant.d.ts +17 -0
  366. package/dist/types/src/handlers/permissions-grant.d.ts.map +1 -0
  367. package/dist/types/src/handlers/permissions-request.d.ts +17 -0
  368. package/dist/types/src/handlers/permissions-request.d.ts.map +1 -0
  369. package/dist/types/src/handlers/permissions-revoke.d.ts +17 -0
  370. package/dist/types/src/handlers/permissions-revoke.d.ts.map +1 -0
  371. package/dist/types/src/handlers/protocols-configure.d.ts +21 -0
  372. package/dist/types/src/handlers/protocols-configure.d.ts.map +1 -0
  373. package/dist/types/src/handlers/protocols-query.d.ts +20 -0
  374. package/dist/types/src/handlers/protocols-query.d.ts.map +1 -0
  375. package/dist/types/src/handlers/records-delete.d.ts +22 -0
  376. package/dist/types/src/handlers/records-delete.d.ts.map +1 -0
  377. package/dist/types/src/handlers/records-query.d.ts +78 -0
  378. package/dist/types/src/handlers/records-query.d.ts.map +1 -0
  379. package/dist/types/src/handlers/records-read.d.ts +17 -0
  380. package/dist/types/src/handlers/records-read.d.ts.map +1 -0
  381. package/dist/types/src/handlers/records-write.d.ts +61 -0
  382. package/dist/types/src/handlers/records-write.d.ts.map +1 -0
  383. package/dist/types/src/index.d.ts +72 -0
  384. package/dist/types/src/index.d.ts.map +1 -0
  385. package/dist/types/src/interfaces/events-get.d.ts +13 -0
  386. package/dist/types/src/interfaces/events-get.d.ts.map +1 -0
  387. package/dist/types/src/interfaces/messages-get.d.ts +19 -0
  388. package/dist/types/src/interfaces/messages-get.d.ts.map +1 -0
  389. package/dist/types/src/interfaces/permissions-grant.d.ts +59 -0
  390. package/dist/types/src/interfaces/permissions-grant.d.ts.map +1 -0
  391. package/dist/types/src/interfaces/permissions-request.d.ts +19 -0
  392. package/dist/types/src/interfaces/permissions-request.d.ts.map +1 -0
  393. package/dist/types/src/interfaces/permissions-revoke.d.ts +14 -0
  394. package/dist/types/src/interfaces/permissions-revoke.d.ts.map +1 -0
  395. package/dist/types/src/interfaces/protocols-configure.d.ts +21 -0
  396. package/dist/types/src/interfaces/protocols-configure.d.ts.map +1 -0
  397. package/dist/types/src/interfaces/protocols-query.d.ts +17 -0
  398. package/dist/types/src/interfaces/protocols-query.d.ts.map +1 -0
  399. package/dist/types/src/interfaces/records-delete.d.ts +24 -0
  400. package/dist/types/src/interfaces/records-delete.d.ts.map +1 -0
  401. package/dist/types/src/interfaces/records-query.d.ts +29 -0
  402. package/dist/types/src/interfaces/records-query.d.ts.map +1 -0
  403. package/dist/types/src/interfaces/records-read.d.ts +31 -0
  404. package/dist/types/src/interfaces/records-read.d.ts.map +1 -0
  405. package/dist/types/src/interfaces/records-write.d.ts +259 -0
  406. package/dist/types/src/interfaces/records-write.d.ts.map +1 -0
  407. package/dist/types/src/jose/algorithms/signing/ed25519.d.ts +3 -0
  408. package/dist/types/src/jose/algorithms/signing/ed25519.d.ts.map +1 -0
  409. package/dist/types/src/jose/algorithms/signing/signature-algorithms.d.ts +3 -0
  410. package/dist/types/src/jose/algorithms/signing/signature-algorithms.d.ts.map +1 -0
  411. package/dist/types/src/jose/jws/general/builder.d.ts +10 -0
  412. package/dist/types/src/jose/jws/general/builder.d.ts.map +1 -0
  413. package/dist/types/src/jose/jws/general/signer.d.ts +8 -0
  414. package/dist/types/src/jose/jws/general/signer.d.ts.map +1 -0
  415. package/dist/types/src/jose/jws/general/verifier.d.ts +32 -0
  416. package/dist/types/src/jose/jws/general/verifier.d.ts.map +1 -0
  417. package/dist/types/src/schema-validator.d.ts +8 -0
  418. package/dist/types/src/schema-validator.d.ts.map +1 -0
  419. package/dist/types/src/store/blockstore-level.d.ts +35 -0
  420. package/dist/types/src/store/blockstore-level.d.ts.map +1 -0
  421. package/dist/types/src/store/data-store-level.d.ts +44 -0
  422. package/dist/types/src/store/data-store-level.d.ts.map +1 -0
  423. package/dist/types/src/store/index-level.d.ts +69 -0
  424. package/dist/types/src/store/index-level.d.ts.map +1 -0
  425. package/dist/types/src/store/level-wrapper.d.ts +44 -0
  426. package/dist/types/src/store/level-wrapper.d.ts.map +1 -0
  427. package/dist/types/src/store/message-store-level.d.ts +70 -0
  428. package/dist/types/src/store/message-store-level.d.ts.map +1 -0
  429. package/dist/types/src/store/storage-controller.d.ts +19 -0
  430. package/dist/types/src/store/storage-controller.d.ts.map +1 -0
  431. package/dist/types/src/types/cache.d.ts +16 -0
  432. package/dist/types/src/types/cache.d.ts.map +1 -0
  433. package/dist/types/src/types/data-store.d.ts +69 -0
  434. package/dist/types/src/types/data-store.d.ts.map +1 -0
  435. package/dist/types/src/types/delegated-grant-message.d.ts +14 -0
  436. package/dist/types/src/types/delegated-grant-message.d.ts.map +1 -0
  437. package/dist/types/src/types/did-types.d.ts +68 -0
  438. package/dist/types/src/types/did-types.d.ts.map +1 -0
  439. package/dist/types/src/types/event-log.d.ts +39 -0
  440. package/dist/types/src/types/event-log.d.ts.map +1 -0
  441. package/dist/types/src/types/event-types.d.ts +18 -0
  442. package/dist/types/src/types/event-types.d.ts.map +1 -0
  443. package/dist/types/src/types/jose-types.d.ts +75 -0
  444. package/dist/types/src/types/jose-types.d.ts.map +1 -0
  445. package/dist/types/src/types/jws-types.d.ts +27 -0
  446. package/dist/types/src/types/jws-types.d.ts.map +1 -0
  447. package/dist/types/src/types/message-interface.d.ts +22 -0
  448. package/dist/types/src/types/message-interface.d.ts.map +1 -0
  449. package/dist/types/src/types/message-store.d.ts +43 -0
  450. package/dist/types/src/types/message-store.d.ts.map +1 -0
  451. package/dist/types/src/types/message-types.d.ts +113 -0
  452. package/dist/types/src/types/message-types.d.ts.map +1 -0
  453. package/dist/types/src/types/messages-types.d.ts +23 -0
  454. package/dist/types/src/types/messages-types.d.ts.map +1 -0
  455. package/dist/types/src/types/method-handler.d.ts +17 -0
  456. package/dist/types/src/types/method-handler.d.ts.map +1 -0
  457. package/dist/types/src/types/permissions-grant-descriptor.d.ts +65 -0
  458. package/dist/types/src/types/permissions-grant-descriptor.d.ts.map +1 -0
  459. package/dist/types/src/types/permissions-types.d.ts +33 -0
  460. package/dist/types/src/types/permissions-types.d.ts.map +1 -0
  461. package/dist/types/src/types/protocols-types.d.ts +138 -0
  462. package/dist/types/src/types/protocols-types.d.ts.map +1 -0
  463. package/dist/types/src/types/records-types.d.ts +164 -0
  464. package/dist/types/src/types/records-types.d.ts.map +1 -0
  465. package/dist/types/src/types/signer.d.ts +26 -0
  466. package/dist/types/src/types/signer.d.ts.map +1 -0
  467. package/dist/types/src/utils/abort.d.ts +5 -0
  468. package/dist/types/src/utils/abort.d.ts.map +1 -0
  469. package/dist/types/src/utils/array.d.ts +18 -0
  470. package/dist/types/src/utils/array.d.ts.map +1 -0
  471. package/dist/types/src/utils/cid.d.ts +30 -0
  472. package/dist/types/src/utils/cid.d.ts.map +1 -0
  473. package/dist/types/src/utils/data-stream.d.ts +27 -0
  474. package/dist/types/src/utils/data-stream.d.ts.map +1 -0
  475. package/dist/types/src/utils/encoder.d.ts +14 -0
  476. package/dist/types/src/utils/encoder.d.ts.map +1 -0
  477. package/dist/types/src/utils/encryption.d.ts +44 -0
  478. package/dist/types/src/utils/encryption.d.ts.map +1 -0
  479. package/dist/types/src/utils/hd-key.d.ts +35 -0
  480. package/dist/types/src/utils/hd-key.d.ts.map +1 -0
  481. package/dist/types/src/utils/jws.d.ts +39 -0
  482. package/dist/types/src/utils/jws.d.ts.map +1 -0
  483. package/dist/types/src/utils/memory-cache.d.ts +15 -0
  484. package/dist/types/src/utils/memory-cache.d.ts.map +1 -0
  485. package/dist/types/src/utils/object.d.ts +18 -0
  486. package/dist/types/src/utils/object.d.ts.map +1 -0
  487. package/dist/types/src/utils/private-key-signer.d.ts +34 -0
  488. package/dist/types/src/utils/private-key-signer.d.ts.map +1 -0
  489. package/dist/types/src/utils/protocols.d.ts +14 -0
  490. package/dist/types/src/utils/protocols.d.ts.map +1 -0
  491. package/dist/types/src/utils/records.d.ts +68 -0
  492. package/dist/types/src/utils/records.d.ts.map +1 -0
  493. package/dist/types/src/utils/secp256k1.d.ts +78 -0
  494. package/dist/types/src/utils/secp256k1.d.ts.map +1 -0
  495. package/dist/types/src/utils/string.d.ts +6 -0
  496. package/dist/types/src/utils/string.d.ts.map +1 -0
  497. package/dist/types/src/utils/time.d.ts +49 -0
  498. package/dist/types/src/utils/time.d.ts.map +1 -0
  499. package/dist/types/src/utils/url.d.ts +5 -0
  500. package/dist/types/src/utils/url.d.ts.map +1 -0
  501. package/dist/types/tests/core/auth.spec.d.ts +2 -0
  502. package/dist/types/tests/core/auth.spec.d.ts.map +1 -0
  503. package/dist/types/tests/core/message-reply.spec.d.ts +2 -0
  504. package/dist/types/tests/core/message-reply.spec.d.ts.map +1 -0
  505. package/dist/types/tests/core/message.spec.d.ts +2 -0
  506. package/dist/types/tests/core/message.spec.d.ts.map +1 -0
  507. package/dist/types/tests/did/did-ion-resolver.spec.d.ts +2 -0
  508. package/dist/types/tests/did/did-ion-resolver.spec.d.ts.map +1 -0
  509. package/dist/types/tests/did/did-key-resolver.spec.d.ts +2 -0
  510. package/dist/types/tests/did/did-key-resolver.spec.d.ts.map +1 -0
  511. package/dist/types/tests/did/did-resolver.spec.d.ts +2 -0
  512. package/dist/types/tests/did/did-resolver.spec.d.ts.map +1 -0
  513. package/dist/types/tests/did/did.spec.d.ts +2 -0
  514. package/dist/types/tests/did/did.spec.d.ts.map +1 -0
  515. package/dist/types/tests/dwn.spec.d.ts +2 -0
  516. package/dist/types/tests/dwn.spec.d.ts.map +1 -0
  517. package/dist/types/tests/end-to-end-tests.spec.d.ts +2 -0
  518. package/dist/types/tests/end-to-end-tests.spec.d.ts.map +1 -0
  519. package/dist/types/tests/event-log/event-log-level.spec.d.ts +2 -0
  520. package/dist/types/tests/event-log/event-log-level.spec.d.ts.map +1 -0
  521. package/dist/types/tests/handlers/events-get.spec.d.ts +2 -0
  522. package/dist/types/tests/handlers/events-get.spec.d.ts.map +1 -0
  523. package/dist/types/tests/handlers/messages-get.spec.d.ts +2 -0
  524. package/dist/types/tests/handlers/messages-get.spec.d.ts.map +1 -0
  525. package/dist/types/tests/handlers/permissions-grant.spec.d.ts +2 -0
  526. package/dist/types/tests/handlers/permissions-grant.spec.d.ts.map +1 -0
  527. package/dist/types/tests/handlers/permissions-request.spec.d.ts +2 -0
  528. package/dist/types/tests/handlers/permissions-request.spec.d.ts.map +1 -0
  529. package/dist/types/tests/handlers/permissions-revoke.spec.d.ts +2 -0
  530. package/dist/types/tests/handlers/permissions-revoke.spec.d.ts.map +1 -0
  531. package/dist/types/tests/handlers/protocols-configure.spec.d.ts +2 -0
  532. package/dist/types/tests/handlers/protocols-configure.spec.d.ts.map +1 -0
  533. package/dist/types/tests/handlers/protocols-query.spec.d.ts +2 -0
  534. package/dist/types/tests/handlers/protocols-query.spec.d.ts.map +1 -0
  535. package/dist/types/tests/handlers/records-delete.spec.d.ts +2 -0
  536. package/dist/types/tests/handlers/records-delete.spec.d.ts.map +1 -0
  537. package/dist/types/tests/handlers/records-query.spec.d.ts +2 -0
  538. package/dist/types/tests/handlers/records-query.spec.d.ts.map +1 -0
  539. package/dist/types/tests/handlers/records-read.spec.d.ts +2 -0
  540. package/dist/types/tests/handlers/records-read.spec.d.ts.map +1 -0
  541. package/dist/types/tests/handlers/records-write.spec.d.ts +2 -0
  542. package/dist/types/tests/handlers/records-write.spec.d.ts.map +1 -0
  543. package/dist/types/tests/interfaces/events-get.spec.d.ts +2 -0
  544. package/dist/types/tests/interfaces/events-get.spec.d.ts.map +1 -0
  545. package/dist/types/tests/interfaces/messages-get.spec.d.ts +2 -0
  546. package/dist/types/tests/interfaces/messages-get.spec.d.ts.map +1 -0
  547. package/dist/types/tests/interfaces/permissions-grant.spec.d.ts +2 -0
  548. package/dist/types/tests/interfaces/permissions-grant.spec.d.ts.map +1 -0
  549. package/dist/types/tests/interfaces/permissions-request.spec.d.ts +2 -0
  550. package/dist/types/tests/interfaces/permissions-request.spec.d.ts.map +1 -0
  551. package/dist/types/tests/interfaces/protocols-configure.spec.d.ts +2 -0
  552. package/dist/types/tests/interfaces/protocols-configure.spec.d.ts.map +1 -0
  553. package/dist/types/tests/interfaces/protocols-query.spec.d.ts +2 -0
  554. package/dist/types/tests/interfaces/protocols-query.spec.d.ts.map +1 -0
  555. package/dist/types/tests/interfaces/records-delete.spec.d.ts +2 -0
  556. package/dist/types/tests/interfaces/records-delete.spec.d.ts.map +1 -0
  557. package/dist/types/tests/interfaces/records-query.spec.d.ts +2 -0
  558. package/dist/types/tests/interfaces/records-query.spec.d.ts.map +1 -0
  559. package/dist/types/tests/interfaces/records-read.spec.d.ts +2 -0
  560. package/dist/types/tests/interfaces/records-read.spec.d.ts.map +1 -0
  561. package/dist/types/tests/interfaces/records-write.spec.d.ts +2 -0
  562. package/dist/types/tests/interfaces/records-write.spec.d.ts.map +1 -0
  563. package/dist/types/tests/jose/jws/general.spec.d.ts +2 -0
  564. package/dist/types/tests/jose/jws/general.spec.d.ts.map +1 -0
  565. package/dist/types/tests/scenarios/delegated-grant.spec.d.ts +2 -0
  566. package/dist/types/tests/scenarios/delegated-grant.spec.d.ts.map +1 -0
  567. package/dist/types/tests/scenarios/end-to-end-tests.spec.d.ts +2 -0
  568. package/dist/types/tests/scenarios/end-to-end-tests.spec.d.ts.map +1 -0
  569. package/dist/types/tests/store/data-store-level.spec.d.ts +2 -0
  570. package/dist/types/tests/store/data-store-level.spec.d.ts.map +1 -0
  571. package/dist/types/tests/store/index-level.spec.d.ts +2 -0
  572. package/dist/types/tests/store/index-level.spec.d.ts.map +1 -0
  573. package/dist/types/tests/store/message-store-level.spec.d.ts +2 -0
  574. package/dist/types/tests/store/message-store-level.spec.d.ts.map +1 -0
  575. package/dist/types/tests/store/message-store.spec.d.ts +2 -0
  576. package/dist/types/tests/store/message-store.spec.d.ts.map +1 -0
  577. package/dist/types/tests/store-dependent-tests.spec.d.ts +2 -0
  578. package/dist/types/tests/store-dependent-tests.spec.d.ts.map +1 -0
  579. package/dist/types/tests/test-stores.d.ts +30 -0
  580. package/dist/types/tests/test-stores.d.ts.map +1 -0
  581. package/dist/types/tests/test-suite.d.ts +16 -0
  582. package/dist/types/tests/test-suite.d.ts.map +1 -0
  583. package/dist/types/tests/utils/cid.spec.d.ts +2 -0
  584. package/dist/types/tests/utils/cid.spec.d.ts.map +1 -0
  585. package/dist/types/tests/utils/data-stream.spec.d.ts +2 -0
  586. package/dist/types/tests/utils/data-stream.spec.d.ts.map +1 -0
  587. package/dist/types/tests/utils/encryption.spec.d.ts +2 -0
  588. package/dist/types/tests/utils/encryption.spec.d.ts.map +1 -0
  589. package/dist/types/tests/utils/jws.spec.d.ts +2 -0
  590. package/dist/types/tests/utils/jws.spec.d.ts.map +1 -0
  591. package/dist/types/tests/utils/memory-cache.spec.d.ts +2 -0
  592. package/dist/types/tests/utils/memory-cache.spec.d.ts.map +1 -0
  593. package/dist/types/tests/utils/object.spec.d.ts +2 -0
  594. package/dist/types/tests/utils/object.spec.d.ts.map +1 -0
  595. package/dist/types/tests/utils/private-key-signer.spec.d.ts +2 -0
  596. package/dist/types/tests/utils/private-key-signer.spec.d.ts.map +1 -0
  597. package/dist/types/tests/utils/records.spec.d.ts +2 -0
  598. package/dist/types/tests/utils/records.spec.d.ts.map +1 -0
  599. package/dist/types/tests/utils/secp256k1.spec.d.ts +2 -0
  600. package/dist/types/tests/utils/secp256k1.spec.d.ts.map +1 -0
  601. package/dist/types/tests/utils/test-data-generator.d.ts +323 -0
  602. package/dist/types/tests/utils/test-data-generator.d.ts.map +1 -0
  603. package/dist/types/tests/utils/test-stub-generator.d.ts +16 -0
  604. package/dist/types/tests/utils/test-stub-generator.d.ts.map +1 -0
  605. package/dist/types/tests/utils/time.spec.d.ts +2 -0
  606. package/dist/types/tests/utils/time.spec.d.ts.map +1 -0
  607. package/dist/types/tests/utils/url.spec.d.ts +2 -0
  608. package/dist/types/tests/utils/url.spec.d.ts.map +1 -0
  609. package/dist/types/tests/validation/json-schemas/definitions.spec.d.ts +2 -0
  610. package/dist/types/tests/validation/json-schemas/definitions.spec.d.ts.map +1 -0
  611. package/dist/types/tests/validation/json-schemas/jwk/general-jwk.spec.d.ts +2 -0
  612. package/dist/types/tests/validation/json-schemas/jwk/general-jwk.spec.d.ts.map +1 -0
  613. package/dist/types/tests/validation/json-schemas/jwk/public-jwk.spec.d.ts +2 -0
  614. package/dist/types/tests/validation/json-schemas/jwk/public-jwk.spec.d.ts.map +1 -0
  615. package/dist/types/tests/validation/json-schemas/jwk-verification-method.spec.d.ts +2 -0
  616. package/dist/types/tests/validation/json-schemas/jwk-verification-method.spec.d.ts.map +1 -0
  617. package/dist/types/tests/validation/json-schemas/protocols/protocols-configure.spec.d.ts +2 -0
  618. package/dist/types/tests/validation/json-schemas/protocols/protocols-configure.spec.d.ts.map +1 -0
  619. package/dist/types/tests/validation/json-schemas/records/records-query.spec.d.ts +2 -0
  620. package/dist/types/tests/validation/json-schemas/records/records-query.spec.d.ts.map +1 -0
  621. package/dist/types/tests/validation/json-schemas/records/records-write.spec.d.ts +2 -0
  622. package/dist/types/tests/validation/json-schemas/records/records-write.spec.d.ts.map +1 -0
  623. package/package.json +156 -0
  624. package/src/core/abstract-message.ts +48 -0
  625. package/src/core/auth.ts +108 -0
  626. package/src/core/dwn-constant.ts +7 -0
  627. package/src/core/dwn-error.ts +136 -0
  628. package/src/core/grant-authorization.ts +163 -0
  629. package/src/core/message-reply.ts +42 -0
  630. package/src/core/message.ts +224 -0
  631. package/src/core/protocol-authorization.ts +691 -0
  632. package/src/core/records-grant-authorization.ts +167 -0
  633. package/src/core/tenant-gate.ts +18 -0
  634. package/src/did/did-dht-resolver.ts +241 -0
  635. package/src/did/did-ion-resolver.ts +52 -0
  636. package/src/did/did-key-resolver.ts +137 -0
  637. package/src/did/did-resolver.ts +77 -0
  638. package/src/did/did.ts +39 -0
  639. package/src/dwn.ts +213 -0
  640. package/src/enums/dwn-interface-method.ts +20 -0
  641. package/src/event-log/event-log-level.ts +116 -0
  642. package/src/handlers/events-get.ts +46 -0
  643. package/src/handlers/messages-get.ts +80 -0
  644. package/src/handlers/permissions-grant.ts +52 -0
  645. package/src/handlers/permissions-request.ts +54 -0
  646. package/src/handlers/permissions-revoke.ts +121 -0
  647. package/src/handlers/protocols-configure.ts +104 -0
  648. package/src/handlers/protocols-query.ts +81 -0
  649. package/src/handlers/records-delete.ts +139 -0
  650. package/src/handlers/records-query.ts +253 -0
  651. package/src/handlers/records-read.ts +127 -0
  652. package/src/handlers/records-write.ts +296 -0
  653. package/src/index.ts +81 -0
  654. package/src/interfaces/events-get.ts +43 -0
  655. package/src/interfaces/messages-get.ts +59 -0
  656. package/src/interfaces/permissions-grant.ts +175 -0
  657. package/src/interfaces/permissions-request.ts +55 -0
  658. package/src/interfaces/permissions-revoke.ts +46 -0
  659. package/src/interfaces/protocols-configure.ts +188 -0
  660. package/src/interfaces/protocols-query.ts +99 -0
  661. package/src/interfaces/records-delete.ts +67 -0
  662. package/src/interfaces/records-query.ts +100 -0
  663. package/src/interfaces/records-read.ts +82 -0
  664. package/src/interfaces/records-write.ts +924 -0
  665. package/src/jose/algorithms/signing/ed25519.ts +61 -0
  666. package/src/jose/algorithms/signing/signature-algorithms.ts +15 -0
  667. package/src/jose/jws/general/builder.ts +48 -0
  668. package/src/jose/jws/general/signer.ts +29 -0
  669. package/src/jose/jws/general/verifier.ts +113 -0
  670. package/src/schema-validator.ts +34 -0
  671. package/src/store/blockstore-level.ts +113 -0
  672. package/src/store/data-store-level.ts +188 -0
  673. package/src/store/index-level.ts +306 -0
  674. package/src/store/level-wrapper.ts +262 -0
  675. package/src/store/message-store-level.ts +284 -0
  676. package/src/store/storage-controller.ts +80 -0
  677. package/src/types/cache.ts +16 -0
  678. package/src/types/data-store.ts +78 -0
  679. package/src/types/delegated-grant-message.ts +15 -0
  680. package/src/types/did-types.ts +95 -0
  681. package/src/types/event-log.ts +46 -0
  682. package/src/types/event-types.ts +20 -0
  683. package/src/types/jose-types.ts +76 -0
  684. package/src/types/jws-types.ts +28 -0
  685. package/src/types/message-interface.ts +24 -0
  686. package/src/types/message-store.ts +56 -0
  687. package/src/types/message-types.ts +115 -0
  688. package/src/types/messages-types.ts +26 -0
  689. package/src/types/method-handler.ts +17 -0
  690. package/src/types/permissions-grant-descriptor.ts +79 -0
  691. package/src/types/permissions-types.ts +42 -0
  692. package/src/types/protocols-types.ts +154 -0
  693. package/src/types/records-types.ts +184 -0
  694. package/src/types/signer.ts +27 -0
  695. package/src/utils/abort.ts +31 -0
  696. package/src/utils/array.ts +39 -0
  697. package/src/utils/cid.ts +101 -0
  698. package/src/utils/data-stream.ts +85 -0
  699. package/src/utils/encoder.ts +54 -0
  700. package/src/utils/encryption.ts +145 -0
  701. package/src/utils/hd-key.ts +58 -0
  702. package/src/utils/jws.ts +95 -0
  703. package/src/utils/memory-cache.ts +31 -0
  704. package/src/utils/object.ts +55 -0
  705. package/src/utils/private-key-signer.ts +72 -0
  706. package/src/utils/protocols.ts +50 -0
  707. package/src/utils/records.ts +326 -0
  708. package/src/utils/secp256k1.ts +209 -0
  709. package/src/utils/string.ts +13 -0
  710. package/src/utils/time.ts +77 -0
  711. package/src/utils/url.ts +66 -0
@@ -0,0 +1,83 @@
1
+ var Pte=Object.create;var $1=Object.defineProperty;var Ite=Object.getOwnPropertyDescriptor;var Rte=Object.getOwnPropertyNames;var Mte=Object.getPrototypeOf,kte=Object.prototype.hasOwnProperty;var Bte=(t,e,r)=>e in t?$1(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r;var Dte=(t,e)=>()=>(t&&(e=t(t=0)),e);var G=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),dr=(t,e)=>{for(var r in e)$1(t,r,{get:e[r],enumerable:!0})},Cte=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of Rte(e))!kte.call(t,i)&&i!==r&&$1(t,i,{get:()=>e[i],enumerable:!(n=Ite(e,i))||n.enumerable});return t};var mr=(t,e,r)=>(r=t!=null?Pte(Mte(t)):{},Cte(e||!t||!t.__esModule?$1(r,"default",{value:t,enumerable:!0}):r,t));var Zy=(t,e,r)=>(Bte(t,typeof e!="symbol"?e+"":e,r),r),dR=(t,e,r)=>{if(!e.has(t))throw TypeError("Cannot "+r)};var fR=(t,e,r)=>(dR(t,e,"read from private field"),r?r.call(t):e.get(t)),uR=(t,e,r)=>{if(e.has(t))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(t):e.set(t,r)},b8=(t,e,r,n)=>(dR(t,e,"write to private field"),n?n.call(t,r):e.set(t,r),r);var pR=G(G1=>{"use strict";p();G1.byteLength=jte;G1.toByteArray=qte;G1.fromByteArray=Fte;var Ha=[],As=[],Ote=typeof Uint8Array<"u"?Uint8Array:Array,v8="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(yl=0,lR=v8.length;yl<lR;++yl)Ha[yl]=v8[yl],As[v8.charCodeAt(yl)]=yl;var yl,lR;As["-".charCodeAt(0)]=62;As["_".charCodeAt(0)]=63;function hR(t){var e=t.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var r=t.indexOf("=");r===-1&&(r=e);var n=r===e?0:4-r%4;return[r,n]}function jte(t){var e=hR(t),r=e[0],n=e[1];return(r+n)*3/4-n}function Nte(t,e,r){return(e+r)*3/4-r}function qte(t){var e,r=hR(t),n=r[0],i=r[1],o=new Ote(Nte(t,n,i)),s=0,a=i>0?n-4:n,c;for(c=0;c<a;c+=4)e=As[t.charCodeAt(c)]<<18|As[t.charCodeAt(c+1)]<<12|As[t.charCodeAt(c+2)]<<6|As[t.charCodeAt(c+3)],o[s++]=e>>16&255,o[s++]=e>>8&255,o[s++]=e&255;return i===2&&(e=As[t.charCodeAt(c)]<<2|As[t.charCodeAt(c+1)]>>4,o[s++]=e&255),i===1&&(e=As[t.charCodeAt(c)]<<10|As[t.charCodeAt(c+1)]<<4|As[t.charCodeAt(c+2)]>>2,o[s++]=e>>8&255,o[s++]=e&255),o}function Lte(t){return Ha[t>>18&63]+Ha[t>>12&63]+Ha[t>>6&63]+Ha[t&63]}function Ute(t,e,r){for(var n,i=[],o=e;o<r;o+=3)n=(t[o]<<16&16711680)+(t[o+1]<<8&65280)+(t[o+2]&255),i.push(Lte(n));return i.join("")}function Fte(t){for(var e,r=t.length,n=r%3,i=[],o=16383,s=0,a=r-n;s<a;s+=o)i.push(Ute(t,s,s+o>a?a:s+o));return n===1?(e=t[r-1],i.push(Ha[e>>2]+Ha[e<<4&63]+"==")):n===2&&(e=(t[r-2]<<8)+t[r-1],i.push(Ha[e>>10]+Ha[e>>4&63]+Ha[e<<2&63]+"=")),i.join("")}});var mR=G(w8=>{p();w8.read=function(t,e,r,n,i){var o,s,a=i*8-n-1,c=(1<<a)-1,d=c>>1,f=-7,u=r?i-1:0,m=r?-1:1,_=t[e+u];for(u+=m,o=_&(1<<-f)-1,_>>=-f,f+=a;f>0;o=o*256+t[e+u],u+=m,f-=8);for(s=o&(1<<-f)-1,o>>=-f,f+=n;f>0;s=s*256+t[e+u],u+=m,f-=8);if(o===0)o=1-d;else{if(o===c)return s?NaN:(_?-1:1)*(1/0);s=s+Math.pow(2,n),o=o-d}return(_?-1:1)*s*Math.pow(2,o-n)};w8.write=function(t,e,r,n,i,o){var s,a,c,d=o*8-i-1,f=(1<<d)-1,u=f>>1,m=i===23?Math.pow(2,-24)-Math.pow(2,-77):0,_=n?0:o-1,v=n?1:-1,A=e<0||e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(a=isNaN(e)?1:0,s=f):(s=Math.floor(Math.log(e)/Math.LN2),e*(c=Math.pow(2,-s))<1&&(s--,c*=2),s+u>=1?e+=m/c:e+=m*Math.pow(2,1-u),e*c>=2&&(s++,c/=2),s+u>=f?(a=0,s=f):s+u>=1?(a=(e*c-1)*Math.pow(2,i),s=s+u):(a=e*Math.pow(2,u-1)*Math.pow(2,i),s=0));i>=8;t[r+_]=a&255,_+=v,a/=256,i-=8);for(s=s<<i|a,d+=i;d>0;t[r+_]=s&255,_+=v,s/=256,d-=8);t[r+_-v]|=A*128}});var jr=G(Pp=>{"use strict";p();var _8=pR(),Tp=mR(),yR=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;Pp.Buffer=ne;Pp.SlowBuffer=Vte;Pp.INSPECT_MAX_BYTES=50;var H1=2147483647;Pp.kMaxLength=H1;ne.TYPED_ARRAY_SUPPORT=zte();!ne.TYPED_ARRAY_SUPPORT&&typeof console<"u"&&typeof console.error=="function"&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function zte(){try{var t=new Uint8Array(1),e={foo:function(){return 42}};return Object.setPrototypeOf(e,Uint8Array.prototype),Object.setPrototypeOf(t,e),t.foo()===42}catch{return!1}}Object.defineProperty(ne.prototype,"parent",{enumerable:!0,get:function(){if(ne.isBuffer(this))return this.buffer}});Object.defineProperty(ne.prototype,"offset",{enumerable:!0,get:function(){if(ne.isBuffer(this))return this.byteOffset}});function nd(t){if(t>H1)throw new RangeError('The value "'+t+'" is invalid for option "size"');var e=new Uint8Array(t);return Object.setPrototypeOf(e,ne.prototype),e}function ne(t,e,r){if(typeof t=="number"){if(typeof e=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return A8(t)}return vR(t,e,r)}ne.poolSize=8192;function vR(t,e,r){if(typeof t=="string")return Gte(t,e);if(ArrayBuffer.isView(t))return Hte(t);if(t==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t);if(Wa(t,ArrayBuffer)||t&&Wa(t.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(Wa(t,SharedArrayBuffer)||t&&Wa(t.buffer,SharedArrayBuffer)))return E8(t,e,r);if(typeof t=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');var n=t.valueOf&&t.valueOf();if(n!=null&&n!==t)return ne.from(n,e,r);var i=Wte(t);if(i)return i;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof t[Symbol.toPrimitive]=="function")return ne.from(t[Symbol.toPrimitive]("string"),e,r);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t)}ne.from=function(t,e,r){return vR(t,e,r)};Object.setPrototypeOf(ne.prototype,Uint8Array.prototype);Object.setPrototypeOf(ne,Uint8Array);function wR(t){if(typeof t!="number")throw new TypeError('"size" argument must be of type number');if(t<0)throw new RangeError('The value "'+t+'" is invalid for option "size"')}function $te(t,e,r){return wR(t),t<=0?nd(t):e!==void 0?typeof r=="string"?nd(t).fill(e,r):nd(t).fill(e):nd(t)}ne.alloc=function(t,e,r){return $te(t,e,r)};function A8(t){return wR(t),nd(t<0?0:T8(t)|0)}ne.allocUnsafe=function(t){return A8(t)};ne.allocUnsafeSlow=function(t){return A8(t)};function Gte(t,e){if((typeof e!="string"||e==="")&&(e="utf8"),!ne.isEncoding(e))throw new TypeError("Unknown encoding: "+e);var r=_R(t,e)|0,n=nd(r),i=n.write(t,e);return i!==r&&(n=n.slice(0,i)),n}function x8(t){for(var e=t.length<0?0:T8(t.length)|0,r=nd(e),n=0;n<e;n+=1)r[n]=t[n]&255;return r}function Hte(t){if(Wa(t,Uint8Array)){var e=new Uint8Array(t);return E8(e.buffer,e.byteOffset,e.byteLength)}return x8(t)}function E8(t,e,r){if(e<0||t.byteLength<e)throw new RangeError('"offset" is outside of buffer bounds');if(t.byteLength<e+(r||0))throw new RangeError('"length" is outside of buffer bounds');var n;return e===void 0&&r===void 0?n=new Uint8Array(t):r===void 0?n=new Uint8Array(t,e):n=new Uint8Array(t,e,r),Object.setPrototypeOf(n,ne.prototype),n}function Wte(t){if(ne.isBuffer(t)){var e=T8(t.length)|0,r=nd(e);return r.length===0||t.copy(r,0,0,e),r}if(t.length!==void 0)return typeof t.length!="number"||P8(t.length)?nd(0):x8(t);if(t.type==="Buffer"&&Array.isArray(t.data))return x8(t.data)}function T8(t){if(t>=H1)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+H1.toString(16)+" bytes");return t|0}function Vte(t){return+t!=t&&(t=0),ne.alloc(+t)}ne.isBuffer=function(e){return e!=null&&e._isBuffer===!0&&e!==ne.prototype};ne.compare=function(e,r){if(Wa(e,Uint8Array)&&(e=ne.from(e,e.offset,e.byteLength)),Wa(r,Uint8Array)&&(r=ne.from(r,r.offset,r.byteLength)),!ne.isBuffer(e)||!ne.isBuffer(r))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(e===r)return 0;for(var n=e.length,i=r.length,o=0,s=Math.min(n,i);o<s;++o)if(e[o]!==r[o]){n=e[o],i=r[o];break}return n<i?-1:i<n?1:0};ne.isEncoding=function(e){switch(String(e).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}};ne.concat=function(e,r){if(!Array.isArray(e))throw new TypeError('"list" argument must be an Array of Buffers');if(e.length===0)return ne.alloc(0);var n;if(r===void 0)for(r=0,n=0;n<e.length;++n)r+=e[n].length;var i=ne.allocUnsafe(r),o=0;for(n=0;n<e.length;++n){var s=e[n];if(Wa(s,Uint8Array))o+s.length>i.length?ne.from(s).copy(i,o):Uint8Array.prototype.set.call(i,s,o);else if(ne.isBuffer(s))s.copy(i,o);else throw new TypeError('"list" argument must be an Array of Buffers');o+=s.length}return i};function _R(t,e){if(ne.isBuffer(t))return t.length;if(ArrayBuffer.isView(t)||Wa(t,ArrayBuffer))return t.byteLength;if(typeof t!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof t);var r=t.length,n=arguments.length>2&&arguments[2]===!0;if(!n&&r===0)return 0;for(var i=!1;;)switch(e){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return S8(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return r*2;case"hex":return r>>>1;case"base64":return PR(t).length;default:if(i)return n?-1:S8(t).length;e=(""+e).toLowerCase(),i=!0}}ne.byteLength=_R;function Kte(t,e,r){var n=!1;if((e===void 0||e<0)&&(e=0),e>this.length||((r===void 0||r>this.length)&&(r=this.length),r<=0)||(r>>>=0,e>>>=0,r<=e))return"";for(t||(t="utf8");;)switch(t){case"hex":return ire(this,e,r);case"utf8":case"utf-8":return ER(this,e,r);case"ascii":return rre(this,e,r);case"latin1":case"binary":return nre(this,e,r);case"base64":return ere(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return ore(this,e,r);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}ne.prototype._isBuffer=!0;function gl(t,e,r){var n=t[e];t[e]=t[r],t[r]=n}ne.prototype.swap16=function(){var e=this.length;if(e%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var r=0;r<e;r+=2)gl(this,r,r+1);return this};ne.prototype.swap32=function(){var e=this.length;if(e%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var r=0;r<e;r+=4)gl(this,r,r+3),gl(this,r+1,r+2);return this};ne.prototype.swap64=function(){var e=this.length;if(e%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var r=0;r<e;r+=8)gl(this,r,r+7),gl(this,r+1,r+6),gl(this,r+2,r+5),gl(this,r+3,r+4);return this};ne.prototype.toString=function(){var e=this.length;return e===0?"":arguments.length===0?ER(this,0,e):Kte.apply(this,arguments)};ne.prototype.toLocaleString=ne.prototype.toString;ne.prototype.equals=function(e){if(!ne.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e?!0:ne.compare(this,e)===0};ne.prototype.inspect=function(){var e="",r=Pp.INSPECT_MAX_BYTES;return e=this.toString("hex",0,r).replace(/(.{2})/g,"$1 ").trim(),this.length>r&&(e+=" ... "),"<Buffer "+e+">"};yR&&(ne.prototype[yR]=ne.prototype.inspect);ne.prototype.compare=function(e,r,n,i,o){if(Wa(e,Uint8Array)&&(e=ne.from(e,e.offset,e.byteLength)),!ne.isBuffer(e))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(r===void 0&&(r=0),n===void 0&&(n=e?e.length:0),i===void 0&&(i=0),o===void 0&&(o=this.length),r<0||n>e.length||i<0||o>this.length)throw new RangeError("out of range index");if(i>=o&&r>=n)return 0;if(i>=o)return-1;if(r>=n)return 1;if(r>>>=0,n>>>=0,i>>>=0,o>>>=0,this===e)return 0;for(var s=o-i,a=n-r,c=Math.min(s,a),d=this.slice(i,o),f=e.slice(r,n),u=0;u<c;++u)if(d[u]!==f[u]){s=d[u],a=f[u];break}return s<a?-1:a<s?1:0};function xR(t,e,r,n,i){if(t.length===0)return-1;if(typeof r=="string"?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,P8(r)&&(r=i?0:t.length-1),r<0&&(r=t.length+r),r>=t.length){if(i)return-1;r=t.length-1}else if(r<0)if(i)r=0;else return-1;if(typeof e=="string"&&(e=ne.from(e,n)),ne.isBuffer(e))return e.length===0?-1:gR(t,e,r,n,i);if(typeof e=="number")return e=e&255,typeof Uint8Array.prototype.indexOf=="function"?i?Uint8Array.prototype.indexOf.call(t,e,r):Uint8Array.prototype.lastIndexOf.call(t,e,r):gR(t,[e],r,n,i);throw new TypeError("val must be string, number or Buffer")}function gR(t,e,r,n,i){var o=1,s=t.length,a=e.length;if(n!==void 0&&(n=String(n).toLowerCase(),n==="ucs2"||n==="ucs-2"||n==="utf16le"||n==="utf-16le")){if(t.length<2||e.length<2)return-1;o=2,s/=2,a/=2,r/=2}function c(_,v){return o===1?_[v]:_.readUInt16BE(v*o)}var d;if(i){var f=-1;for(d=r;d<s;d++)if(c(t,d)===c(e,f===-1?0:d-f)){if(f===-1&&(f=d),d-f+1===a)return f*o}else f!==-1&&(d-=d-f),f=-1}else for(r+a>s&&(r=s-a),d=r;d>=0;d--){for(var u=!0,m=0;m<a;m++)if(c(t,d+m)!==c(e,m)){u=!1;break}if(u)return d}return-1}ne.prototype.includes=function(e,r,n){return this.indexOf(e,r,n)!==-1};ne.prototype.indexOf=function(e,r,n){return xR(this,e,r,n,!0)};ne.prototype.lastIndexOf=function(e,r,n){return xR(this,e,r,n,!1)};function Zte(t,e,r,n){r=Number(r)||0;var i=t.length-r;n?(n=Number(n),n>i&&(n=i)):n=i;var o=e.length;n>o/2&&(n=o/2);for(var s=0;s<n;++s){var a=parseInt(e.substr(s*2,2),16);if(P8(a))return s;t[r+s]=a}return s}function Yte(t,e,r,n){return W1(S8(e,t.length-r),t,r,n)}function Jte(t,e,r,n){return W1(cre(e),t,r,n)}function Xte(t,e,r,n){return W1(PR(e),t,r,n)}function Qte(t,e,r,n){return W1(dre(e,t.length-r),t,r,n)}ne.prototype.write=function(e,r,n,i){if(r===void 0)i="utf8",n=this.length,r=0;else if(n===void 0&&typeof r=="string")i=r,n=this.length,r=0;else if(isFinite(r))r=r>>>0,isFinite(n)?(n=n>>>0,i===void 0&&(i="utf8")):(i=n,n=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");var o=this.length-r;if((n===void 0||n>o)&&(n=o),e.length>0&&(n<0||r<0)||r>this.length)throw new RangeError("Attempt to write outside buffer bounds");i||(i="utf8");for(var s=!1;;)switch(i){case"hex":return Zte(this,e,r,n);case"utf8":case"utf-8":return Yte(this,e,r,n);case"ascii":case"latin1":case"binary":return Jte(this,e,r,n);case"base64":return Xte(this,e,r,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Qte(this,e,r,n);default:if(s)throw new TypeError("Unknown encoding: "+i);i=(""+i).toLowerCase(),s=!0}};ne.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function ere(t,e,r){return e===0&&r===t.length?_8.fromByteArray(t):_8.fromByteArray(t.slice(e,r))}function ER(t,e,r){r=Math.min(t.length,r);for(var n=[],i=e;i<r;){var o=t[i],s=null,a=o>239?4:o>223?3:o>191?2:1;if(i+a<=r){var c,d,f,u;switch(a){case 1:o<128&&(s=o);break;case 2:c=t[i+1],(c&192)===128&&(u=(o&31)<<6|c&63,u>127&&(s=u));break;case 3:c=t[i+1],d=t[i+2],(c&192)===128&&(d&192)===128&&(u=(o&15)<<12|(c&63)<<6|d&63,u>2047&&(u<55296||u>57343)&&(s=u));break;case 4:c=t[i+1],d=t[i+2],f=t[i+3],(c&192)===128&&(d&192)===128&&(f&192)===128&&(u=(o&15)<<18|(c&63)<<12|(d&63)<<6|f&63,u>65535&&u<1114112&&(s=u))}}s===null?(s=65533,a=1):s>65535&&(s-=65536,n.push(s>>>10&1023|55296),s=56320|s&1023),n.push(s),i+=a}return tre(n)}var bR=4096;function tre(t){var e=t.length;if(e<=bR)return String.fromCharCode.apply(String,t);for(var r="",n=0;n<e;)r+=String.fromCharCode.apply(String,t.slice(n,n+=bR));return r}function rre(t,e,r){var n="";r=Math.min(t.length,r);for(var i=e;i<r;++i)n+=String.fromCharCode(t[i]&127);return n}function nre(t,e,r){var n="";r=Math.min(t.length,r);for(var i=e;i<r;++i)n+=String.fromCharCode(t[i]);return n}function ire(t,e,r){var n=t.length;(!e||e<0)&&(e=0),(!r||r<0||r>n)&&(r=n);for(var i="",o=e;o<r;++o)i+=fre[t[o]];return i}function ore(t,e,r){for(var n=t.slice(e,r),i="",o=0;o<n.length-1;o+=2)i+=String.fromCharCode(n[o]+n[o+1]*256);return i}ne.prototype.slice=function(e,r){var n=this.length;e=~~e,r=r===void 0?n:~~r,e<0?(e+=n,e<0&&(e=0)):e>n&&(e=n),r<0?(r+=n,r<0&&(r=0)):r>n&&(r=n),r<e&&(r=e);var i=this.subarray(e,r);return Object.setPrototypeOf(i,ne.prototype),i};function zn(t,e,r){if(t%1!==0||t<0)throw new RangeError("offset is not uint");if(t+e>r)throw new RangeError("Trying to access beyond buffer length")}ne.prototype.readUintLE=ne.prototype.readUIntLE=function(e,r,n){e=e>>>0,r=r>>>0,n||zn(e,r,this.length);for(var i=this[e],o=1,s=0;++s<r&&(o*=256);)i+=this[e+s]*o;return i};ne.prototype.readUintBE=ne.prototype.readUIntBE=function(e,r,n){e=e>>>0,r=r>>>0,n||zn(e,r,this.length);for(var i=this[e+--r],o=1;r>0&&(o*=256);)i+=this[e+--r]*o;return i};ne.prototype.readUint8=ne.prototype.readUInt8=function(e,r){return e=e>>>0,r||zn(e,1,this.length),this[e]};ne.prototype.readUint16LE=ne.prototype.readUInt16LE=function(e,r){return e=e>>>0,r||zn(e,2,this.length),this[e]|this[e+1]<<8};ne.prototype.readUint16BE=ne.prototype.readUInt16BE=function(e,r){return e=e>>>0,r||zn(e,2,this.length),this[e]<<8|this[e+1]};ne.prototype.readUint32LE=ne.prototype.readUInt32LE=function(e,r){return e=e>>>0,r||zn(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+this[e+3]*16777216};ne.prototype.readUint32BE=ne.prototype.readUInt32BE=function(e,r){return e=e>>>0,r||zn(e,4,this.length),this[e]*16777216+(this[e+1]<<16|this[e+2]<<8|this[e+3])};ne.prototype.readIntLE=function(e,r,n){e=e>>>0,r=r>>>0,n||zn(e,r,this.length);for(var i=this[e],o=1,s=0;++s<r&&(o*=256);)i+=this[e+s]*o;return o*=128,i>=o&&(i-=Math.pow(2,8*r)),i};ne.prototype.readIntBE=function(e,r,n){e=e>>>0,r=r>>>0,n||zn(e,r,this.length);for(var i=r,o=1,s=this[e+--i];i>0&&(o*=256);)s+=this[e+--i]*o;return o*=128,s>=o&&(s-=Math.pow(2,8*r)),s};ne.prototype.readInt8=function(e,r){return e=e>>>0,r||zn(e,1,this.length),this[e]&128?(255-this[e]+1)*-1:this[e]};ne.prototype.readInt16LE=function(e,r){e=e>>>0,r||zn(e,2,this.length);var n=this[e]|this[e+1]<<8;return n&32768?n|4294901760:n};ne.prototype.readInt16BE=function(e,r){e=e>>>0,r||zn(e,2,this.length);var n=this[e+1]|this[e]<<8;return n&32768?n|4294901760:n};ne.prototype.readInt32LE=function(e,r){return e=e>>>0,r||zn(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24};ne.prototype.readInt32BE=function(e,r){return e=e>>>0,r||zn(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]};ne.prototype.readFloatLE=function(e,r){return e=e>>>0,r||zn(e,4,this.length),Tp.read(this,e,!0,23,4)};ne.prototype.readFloatBE=function(e,r){return e=e>>>0,r||zn(e,4,this.length),Tp.read(this,e,!1,23,4)};ne.prototype.readDoubleLE=function(e,r){return e=e>>>0,r||zn(e,8,this.length),Tp.read(this,e,!0,52,8)};ne.prototype.readDoubleBE=function(e,r){return e=e>>>0,r||zn(e,8,this.length),Tp.read(this,e,!1,52,8)};function xo(t,e,r,n,i,o){if(!ne.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>i||e<o)throw new RangeError('"value" argument is out of bounds');if(r+n>t.length)throw new RangeError("Index out of range")}ne.prototype.writeUintLE=ne.prototype.writeUIntLE=function(e,r,n,i){if(e=+e,r=r>>>0,n=n>>>0,!i){var o=Math.pow(2,8*n)-1;xo(this,e,r,n,o,0)}var s=1,a=0;for(this[r]=e&255;++a<n&&(s*=256);)this[r+a]=e/s&255;return r+n};ne.prototype.writeUintBE=ne.prototype.writeUIntBE=function(e,r,n,i){if(e=+e,r=r>>>0,n=n>>>0,!i){var o=Math.pow(2,8*n)-1;xo(this,e,r,n,o,0)}var s=n-1,a=1;for(this[r+s]=e&255;--s>=0&&(a*=256);)this[r+s]=e/a&255;return r+n};ne.prototype.writeUint8=ne.prototype.writeUInt8=function(e,r,n){return e=+e,r=r>>>0,n||xo(this,e,r,1,255,0),this[r]=e&255,r+1};ne.prototype.writeUint16LE=ne.prototype.writeUInt16LE=function(e,r,n){return e=+e,r=r>>>0,n||xo(this,e,r,2,65535,0),this[r]=e&255,this[r+1]=e>>>8,r+2};ne.prototype.writeUint16BE=ne.prototype.writeUInt16BE=function(e,r,n){return e=+e,r=r>>>0,n||xo(this,e,r,2,65535,0),this[r]=e>>>8,this[r+1]=e&255,r+2};ne.prototype.writeUint32LE=ne.prototype.writeUInt32LE=function(e,r,n){return e=+e,r=r>>>0,n||xo(this,e,r,4,4294967295,0),this[r+3]=e>>>24,this[r+2]=e>>>16,this[r+1]=e>>>8,this[r]=e&255,r+4};ne.prototype.writeUint32BE=ne.prototype.writeUInt32BE=function(e,r,n){return e=+e,r=r>>>0,n||xo(this,e,r,4,4294967295,0),this[r]=e>>>24,this[r+1]=e>>>16,this[r+2]=e>>>8,this[r+3]=e&255,r+4};ne.prototype.writeIntLE=function(e,r,n,i){if(e=+e,r=r>>>0,!i){var o=Math.pow(2,8*n-1);xo(this,e,r,n,o-1,-o)}var s=0,a=1,c=0;for(this[r]=e&255;++s<n&&(a*=256);)e<0&&c===0&&this[r+s-1]!==0&&(c=1),this[r+s]=(e/a>>0)-c&255;return r+n};ne.prototype.writeIntBE=function(e,r,n,i){if(e=+e,r=r>>>0,!i){var o=Math.pow(2,8*n-1);xo(this,e,r,n,o-1,-o)}var s=n-1,a=1,c=0;for(this[r+s]=e&255;--s>=0&&(a*=256);)e<0&&c===0&&this[r+s+1]!==0&&(c=1),this[r+s]=(e/a>>0)-c&255;return r+n};ne.prototype.writeInt8=function(e,r,n){return e=+e,r=r>>>0,n||xo(this,e,r,1,127,-128),e<0&&(e=255+e+1),this[r]=e&255,r+1};ne.prototype.writeInt16LE=function(e,r,n){return e=+e,r=r>>>0,n||xo(this,e,r,2,32767,-32768),this[r]=e&255,this[r+1]=e>>>8,r+2};ne.prototype.writeInt16BE=function(e,r,n){return e=+e,r=r>>>0,n||xo(this,e,r,2,32767,-32768),this[r]=e>>>8,this[r+1]=e&255,r+2};ne.prototype.writeInt32LE=function(e,r,n){return e=+e,r=r>>>0,n||xo(this,e,r,4,2147483647,-2147483648),this[r]=e&255,this[r+1]=e>>>8,this[r+2]=e>>>16,this[r+3]=e>>>24,r+4};ne.prototype.writeInt32BE=function(e,r,n){return e=+e,r=r>>>0,n||xo(this,e,r,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[r]=e>>>24,this[r+1]=e>>>16,this[r+2]=e>>>8,this[r+3]=e&255,r+4};function SR(t,e,r,n,i,o){if(r+n>t.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function AR(t,e,r,n,i){return e=+e,r=r>>>0,i||SR(t,e,r,4,34028234663852886e22,-34028234663852886e22),Tp.write(t,e,r,n,23,4),r+4}ne.prototype.writeFloatLE=function(e,r,n){return AR(this,e,r,!0,n)};ne.prototype.writeFloatBE=function(e,r,n){return AR(this,e,r,!1,n)};function TR(t,e,r,n,i){return e=+e,r=r>>>0,i||SR(t,e,r,8,17976931348623157e292,-17976931348623157e292),Tp.write(t,e,r,n,52,8),r+8}ne.prototype.writeDoubleLE=function(e,r,n){return TR(this,e,r,!0,n)};ne.prototype.writeDoubleBE=function(e,r,n){return TR(this,e,r,!1,n)};ne.prototype.copy=function(e,r,n,i){if(!ne.isBuffer(e))throw new TypeError("argument should be a Buffer");if(n||(n=0),!i&&i!==0&&(i=this.length),r>=e.length&&(r=e.length),r||(r=0),i>0&&i<n&&(i=n),i===n||e.length===0||this.length===0)return 0;if(r<0)throw new RangeError("targetStart out of bounds");if(n<0||n>=this.length)throw new RangeError("Index out of range");if(i<0)throw new RangeError("sourceEnd out of bounds");i>this.length&&(i=this.length),e.length-r<i-n&&(i=e.length-r+n);var o=i-n;return this===e&&typeof Uint8Array.prototype.copyWithin=="function"?this.copyWithin(r,n,i):Uint8Array.prototype.set.call(e,this.subarray(n,i),r),o};ne.prototype.fill=function(e,r,n,i){if(typeof e=="string"){if(typeof r=="string"?(i=r,r=0,n=this.length):typeof n=="string"&&(i=n,n=this.length),i!==void 0&&typeof i!="string")throw new TypeError("encoding must be a string");if(typeof i=="string"&&!ne.isEncoding(i))throw new TypeError("Unknown encoding: "+i);if(e.length===1){var o=e.charCodeAt(0);(i==="utf8"&&o<128||i==="latin1")&&(e=o)}}else typeof e=="number"?e=e&255:typeof e=="boolean"&&(e=Number(e));if(r<0||this.length<r||this.length<n)throw new RangeError("Out of range index");if(n<=r)return this;r=r>>>0,n=n===void 0?this.length:n>>>0,e||(e=0);var s;if(typeof e=="number")for(s=r;s<n;++s)this[s]=e;else{var a=ne.isBuffer(e)?e:ne.from(e,i),c=a.length;if(c===0)throw new TypeError('The value "'+e+'" is invalid for argument "value"');for(s=0;s<n-r;++s)this[s+r]=a[s%c]}return this};var sre=/[^+/0-9A-Za-z-_]/g;function are(t){if(t=t.split("=")[0],t=t.trim().replace(sre,""),t.length<2)return"";for(;t.length%4!==0;)t=t+"=";return t}function S8(t,e){e=e||1/0;for(var r,n=t.length,i=null,o=[],s=0;s<n;++s){if(r=t.charCodeAt(s),r>55295&&r<57344){if(!i){if(r>56319){(e-=3)>-1&&o.push(239,191,189);continue}else if(s+1===n){(e-=3)>-1&&o.push(239,191,189);continue}i=r;continue}if(r<56320){(e-=3)>-1&&o.push(239,191,189),i=r;continue}r=(i-55296<<10|r-56320)+65536}else i&&(e-=3)>-1&&o.push(239,191,189);if(i=null,r<128){if((e-=1)<0)break;o.push(r)}else if(r<2048){if((e-=2)<0)break;o.push(r>>6|192,r&63|128)}else if(r<65536){if((e-=3)<0)break;o.push(r>>12|224,r>>6&63|128,r&63|128)}else if(r<1114112){if((e-=4)<0)break;o.push(r>>18|240,r>>12&63|128,r>>6&63|128,r&63|128)}else throw new Error("Invalid code point")}return o}function cre(t){for(var e=[],r=0;r<t.length;++r)e.push(t.charCodeAt(r)&255);return e}function dre(t,e){for(var r,n,i,o=[],s=0;s<t.length&&!((e-=2)<0);++s)r=t.charCodeAt(s),n=r>>8,i=r%256,o.push(i),o.push(n);return o}function PR(t){return _8.toByteArray(are(t))}function W1(t,e,r,n){for(var i=0;i<n&&!(i+r>=e.length||i>=t.length);++i)e[i+r]=t[i];return i}function Wa(t,e){return t instanceof e||t!=null&&t.constructor!=null&&t.constructor.name!=null&&t.constructor.name===e.name}function P8(t){return t!==t}var fre=function(){for(var t="0123456789abcdef",e=new Array(256),r=0;r<16;++r)for(var n=r*16,i=0;i<16;++i)e[n+i]=t[r]+t[i];return e}()});var sd=G((ETe,kR)=>{p();var pn=kR.exports={},Va,Ka;function I8(){throw new Error("setTimeout has not been defined")}function R8(){throw new Error("clearTimeout has not been defined")}(function(){try{typeof setTimeout=="function"?Va=setTimeout:Va=I8}catch{Va=I8}try{typeof clearTimeout=="function"?Ka=clearTimeout:Ka=R8}catch{Ka=R8}})();function IR(t){if(Va===setTimeout)return setTimeout(t,0);if((Va===I8||!Va)&&setTimeout)return Va=setTimeout,setTimeout(t,0);try{return Va(t,0)}catch{try{return Va.call(null,t,0)}catch{return Va.call(this,t,0)}}}function ure(t){if(Ka===clearTimeout)return clearTimeout(t);if((Ka===R8||!Ka)&&clearTimeout)return Ka=clearTimeout,clearTimeout(t);try{return Ka(t)}catch{try{return Ka.call(null,t)}catch{return Ka.call(this,t)}}}var id=[],Ip=!1,bl,V1=-1;function lre(){!Ip||!bl||(Ip=!1,bl.length?id=bl.concat(id):V1=-1,id.length&&RR())}function RR(){if(!Ip){var t=IR(lre);Ip=!0;for(var e=id.length;e;){for(bl=id,id=[];++V1<e;)bl&&bl[V1].run();V1=-1,e=id.length}bl=null,Ip=!1,ure(t)}}pn.nextTick=function(t){var e=new Array(arguments.length-1);if(arguments.length>1)for(var r=1;r<arguments.length;r++)e[r-1]=arguments[r];id.push(new MR(t,e)),id.length===1&&!Ip&&IR(RR)};function MR(t,e){this.fun=t,this.array=e}MR.prototype.run=function(){this.fun.apply(null,this.array)};pn.title="browser";pn.browser=!0;pn.env={};pn.argv=[];pn.version="";pn.versions={};function od(){}pn.on=od;pn.addListener=od;pn.once=od;pn.off=od;pn.removeListener=od;pn.removeAllListeners=od;pn.emit=od;pn.prependListener=od;pn.prependOnceListener=od;pn.listeners=function(t){return[]};pn.binding=function(t){throw new Error("process.binding is not supported")};pn.cwd=function(){return"/"};pn.chdir=function(t){throw new Error("process.chdir is not supported")};pn.umask=function(){return 0}});var C,k,ATe,p=Dte(()=>{C=mr(jr()),k=mr(sd()),ATe=function(t){function e(){var n=this||self;return delete t.prototype.__magic__,n}if(typeof globalThis=="object")return globalThis;if(this)return e();t.defineProperty(t.prototype,"__magic__",{configurable:!0,get:e});var r=__magic__;return r}(Object)});var Wo=G((i7e,uk)=>{"use strict";p();function fk(t,e){for(let r in e)Object.defineProperty(t,r,{value:e[r],enumerable:!0,configurable:!0});return t}function cie(t,e,r){if(!t||typeof t=="string")throw new TypeError("Please pass an Error to err-code");r||(r={}),typeof e=="object"&&(r=e,e=""),e&&(r.code=e);try{return fk(t,r)}catch{r.message=t.message,r.stack=t.stack;let i=function(){};return i.prototype=Object.create(Object.getPrototypeOf(t)),fk(new i,r)}}uk.exports=cie});var NB=G((kBe,jB)=>{"use strict";p();jB.exports=class{constructor(){this._bitArrays=[],this._data=[],this._length=0,this._changedLength=!1,this._changedData=!1}set(e,r){let n=this._internalPositionFor(e,!1);if(r===void 0)n!==-1&&(this._unsetInternalPos(n),this._unsetBit(e),this._changedLength=!0,this._changedData=!0);else{let i=!1;n===-1?(n=this._data.length,this._setBit(e),this._changedData=!0):i=!0,this._setInternalPos(n,e,r,i),this._changedLength=!0}}unset(e){this.set(e,void 0)}get(e){this._sortData();let r=this._internalPositionFor(e,!0);if(r!==-1)return this._data[r][1]}push(e){return this.set(this.length,e),this.length}get length(){if(this._sortData(),this._changedLength){let e=this._data[this._data.length-1];this._length=e?e[0]+1:0,this._changedLength=!1}return this._length}forEach(e){let r=0;for(;r<this.length;)e(this.get(r),r,this),r++}map(e){let r=0,n=new Array(this.length);for(;r<this.length;)n[r]=e(this.get(r),r,this),r++;return n}reduce(e,r){let n=0,i=r;for(;n<this.length;){let o=this.get(n);i=e(i,o,n),n++}return i}find(e){let r=0,n,i;for(;r<this.length&&!n;)i=this.get(r),n=e(i),r++;return n?i:void 0}_internalPositionFor(e,r){let n=this._bytePosFor(e,r);if(n>=this._bitArrays.length)return-1;let i=this._bitArrays[n],o=e-n*7;if(!((i&1<<o)>0))return-1;let a=this._bitArrays.slice(0,n).reduce(kse,0),c=~(4294967295<<o+1),d=OB(i&c);return a+d-1}_bytePosFor(e,r){let n=Math.floor(e/7),i=n+1;for(;!r&&this._bitArrays.length<i;)this._bitArrays.push(0);return n}_setBit(e){let r=this._bytePosFor(e,!1);this._bitArrays[r]|=1<<e-r*7}_unsetBit(e){let r=this._bytePosFor(e,!1);this._bitArrays[r]&=~(1<<e-r*7)}_setInternalPos(e,r,n,i){let o=this._data,s=[r,n];if(i)this._sortData(),o[e]=s;else{if(o.length)if(o[o.length-1][0]>=r)o.push(s);else if(o[0][0]<=r)o.unshift(s);else{let a=Math.round(o.length/2);this._data=o.slice(0,a).concat(s).concat(o.slice(a))}else this._data.push(s);this._changedData=!0,this._changedLength=!0}}_unsetInternalPos(e){this._data.splice(e,1)}_sortData(){this._changedData&&this._data.sort(Bse),this._changedData=!1}bitField(){let e=[],r=8,n=0,i=0,o,s=this._bitArrays.slice();for(;s.length||n;){n===0&&(o=s.shift(),n=7);let c=Math.min(n,r),d=~(255<<c),f=o&d;i|=f<<8-r,o=o>>>c,n-=c,r-=c,(!r||!n&&!s.length)&&(e.push(i),i=0,r=8)}for(var a=e.length-1;a>0&&e[a]===0;a--)e.pop();return e}compactArray(){return this._sortData(),this._data.map(Dse)}};function kse(t,e){return t+OB(e)}function OB(t){let e=t;return e=e-(e>>1&1431655765),e=(e&858993459)+(e>>2&858993459),(e+(e>>4)&252645135)*16843009>>24}function Bse(t,e){return t[0]-e[0]}function Dse(t){return t[1]}});var JB=G((HDe,YB)=>{p();var Qse=typeof globalThis=="object"&&globalThis&&globalThis.Object===Object&&globalThis;YB.exports=Qse});var QB=G((VDe,XB)=>{p();var eae=JB(),tae=typeof self=="object"&&self&&self.Object===Object&&self,rae=eae||tae||Function("return this")();XB.exports=rae});var d4=G((ZDe,eD)=>{p();var nae=QB(),iae=nae.Symbol;eD.exports=iae});var iD=G((JDe,nD)=>{p();var tD=d4(),rD=Object.prototype,oae=rD.hasOwnProperty,sae=rD.toString,Mg=tD?tD.toStringTag:void 0;function aae(t){var e=oae.call(t,Mg),r=t[Mg];try{t[Mg]=void 0;var n=!0}catch{}var i=sae.call(t);return n&&(e?t[Mg]=r:delete t[Mg]),i}nD.exports=aae});var sD=G((QDe,oD)=>{p();var cae=Object.prototype,dae=cae.toString;function fae(t){return dae.call(t)}oD.exports=fae});var fD=G((tCe,dD)=>{p();var aD=d4(),uae=iD(),lae=sD(),hae="[object Null]",pae="[object Undefined]",cD=aD?aD.toStringTag:void 0;function mae(t){return t==null?t===void 0?pae:hae:cD&&cD in Object(t)?uae(t):lae(t)}dD.exports=mae});var lD=G((nCe,uD)=>{p();function yae(t,e){return function(r){return t(e(r))}}uD.exports=yae});var pD=G((oCe,hD)=>{p();var gae=lD(),bae=gae(Object.getPrototypeOf,Object);hD.exports=bae});var yD=G((aCe,mD)=>{p();function vae(t){return t!=null&&typeof t=="object"}mD.exports=vae});var vD=G((dCe,bD)=>{p();var wae=fD(),_ae=pD(),xae=yD(),Eae="[object Object]",Sae=Function.prototype,Aae=Object.prototype,gD=Sae.toString,Tae=Aae.hasOwnProperty,Pae=gD.call(Object);function Iae(t){if(!xae(t)||wae(t)!=Eae)return!1;var e=_ae(t);if(e===null)return!0;var r=Tae.call(e,"constructor")&&e.constructor;return typeof r=="function"&&r instanceof r&&gD.call(r)==Pae}bD.exports=Iae});var oC=G((YCe,iC)=>{p();iC.exports=Fg;Fg.flatten=Fg;Fg.unflatten=nC;function tC(t){return t&&t.constructor&&typeof t.constructor.isBuffer=="function"&&t.constructor.isBuffer(t)}function rC(t){return t}function Fg(t,e){e=e||{};let r=e.delimiter||".",n=e.maxDepth,i=e.transformKey||rC,o={};function s(a,c,d){d=d||1,Object.keys(a).forEach(function(f){let u=a[f],m=e.safe&&Array.isArray(u),_=Object.prototype.toString.call(u),v=tC(u),A=_==="[object Object]"||_==="[object Array]",T=c?c+r+i(f):i(f);if(!m&&!v&&A&&Object.keys(u).length&&(!e.maxDepth||d<n))return s(u,T,d+1);o[T]=u})}return s(t),o}function nC(t,e){e=e||{};let r=e.delimiter||".",n=e.overwrite||!1,i=e.transformKey||rC,o={};if(tC(t)||Object.prototype.toString.call(t)!=="[object Object]")return t;function a(f){let u=Number(f);return isNaN(u)||f.indexOf(".")!==-1||e.object?f:u}function c(f,u,m){return Object.keys(m).reduce(function(_,v){return _[f+r+v]=m[v],_},u)}function d(f){let u=Object.prototype.toString.call(f),m=u==="[object Array]",_=u==="[object Object]";if(f){if(m)return!f.length;if(_)return!Object.keys(f).length}else return!0}return t=Object.keys(t).reduce(function(f,u){let m=Object.prototype.toString.call(t[u]);return!(m==="[object Object]"||m==="[object Array]")||d(t[u])?(f[u]=t[u],f):c(u,f,Fg(t[u],e))},{}),Object.keys(t).forEach(function(f){let u=f.split(r).map(i),m=a(u.shift()),_=a(u[0]),v=o;for(;_!==void 0;){if(m==="__proto__")return;let A=Object.prototype.toString.call(v[m]),T=A==="[object Object]"||A==="[object Array]";if(!n&&!T&&typeof v[m]<"u")return;(n&&!T||!n&&v[m]==null)&&(v[m]=typeof _=="number"&&!e.object?[]:{}),v=v[m],u.length>0&&(m=a(u.shift()),_=a(u[0]))}v[m]=nC(t[f],e)}),o}});var d0=G((C4,xC)=>{p();var Cw=jr(),bd=Cw.Buffer;function _C(t,e){for(var r in t)e[r]=t[r]}bd.from&&bd.alloc&&bd.allocUnsafe&&bd.allocUnsafeSlow?xC.exports=Cw:(_C(Cw,C4),C4.Buffer=c0);function c0(t,e,r){return bd(t,e,r)}_C(bd,c0);c0.from=function(t,e,r){if(typeof t=="number")throw new TypeError("Argument must not be a number");return bd(t,e,r)};c0.alloc=function(t,e,r){if(typeof t!="number")throw new TypeError("Argument must be a number");var n=bd(t);return e!==void 0?typeof r=="string"?n.fill(e,r):n.fill(e):n.fill(0),n};c0.allocUnsafe=function(t){if(typeof t!="number")throw new TypeError("Argument must be a number");return bd(t)};c0.allocUnsafeSlow=function(t){if(typeof t!="number")throw new TypeError("Argument must be a number");return Cw.SlowBuffer(t)}});var Ol=G((vOe,j4)=>{"use strict";p();var O4=65536,_ce=4294967295;function xce(){throw new Error(`Secure random number generation is not supported by this browser.
2
+ Use Chrome, Firefox or Internet Explorer 11`)}var Ece=d0().Buffer,Ow=globalThis.crypto||globalThis.msCrypto;Ow&&Ow.getRandomValues?j4.exports=Sce:j4.exports=xce;function Sce(t,e){if(t>_ce)throw new RangeError("requested too many random bytes");var r=Ece.allocUnsafe(t);if(t>0)if(t>O4)for(var n=0;n<t;n+=O4)Ow.getRandomValues(r.slice(n,n+O4));else Ow.getRandomValues(r);return typeof e=="function"?k.default.nextTick(function(){e(null,r)}):r}});var Je=G((_Oe,N4)=>{p();typeof Object.create=="function"?N4.exports=function(e,r){r&&(e.super_=r,e.prototype=Object.create(r.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:N4.exports=function(e,r){if(r){e.super_=r;var n=function(){};n.prototype=r.prototype,e.prototype=new n,e.prototype.constructor=e}}});var it=G((q4,SC)=>{p();var jw=jr(),rc=jw.Buffer;function EC(t,e){for(var r in t)e[r]=t[r]}rc.from&&rc.alloc&&rc.allocUnsafe&&rc.allocUnsafeSlow?SC.exports=jw:(EC(jw,q4),q4.Buffer=jl);function jl(t,e,r){return rc(t,e,r)}jl.prototype=Object.create(rc.prototype);EC(rc,jl);jl.from=function(t,e,r){if(typeof t=="number")throw new TypeError("Argument must not be a number");return rc(t,e,r)};jl.alloc=function(t,e,r){if(typeof t!="number")throw new TypeError("Argument must be a number");var n=rc(t);return e!==void 0?typeof r=="string"?n.fill(e,r):n.fill(e):n.fill(0),n};jl.allocUnsafe=function(t){if(typeof t!="number")throw new TypeError("Argument must be a number");return rc(t)};jl.allocUnsafeSlow=function(t){if(typeof t!="number")throw new TypeError("Argument must be a number");return jw.SlowBuffer(t)}});var TC=G((SOe,AC)=>{p();var Ace={}.toString;AC.exports=Array.isArray||function(t){return Ace.call(t)=="[object Array]"}});var Nl=G((TOe,PC)=>{"use strict";p();PC.exports=TypeError});var L4=G((IOe,IC)=>{"use strict";p();IC.exports=Object});var MC=G((MOe,RC)=>{"use strict";p();RC.exports=Error});var BC=G((BOe,kC)=>{"use strict";p();kC.exports=EvalError});var CC=G((COe,DC)=>{"use strict";p();DC.exports=RangeError});var jC=G((jOe,OC)=>{"use strict";p();OC.exports=ReferenceError});var U4=G((qOe,NC)=>{"use strict";p();NC.exports=SyntaxError});var LC=G((UOe,qC)=>{"use strict";p();qC.exports=URIError});var FC=G((zOe,UC)=>{"use strict";p();UC.exports=Math.abs});var $C=G((GOe,zC)=>{"use strict";p();zC.exports=Math.floor});var HC=G((WOe,GC)=>{"use strict";p();GC.exports=Math.max});var VC=G((KOe,WC)=>{"use strict";p();WC.exports=Math.min});var ZC=G((YOe,KC)=>{"use strict";p();KC.exports=Math.pow});var JC=G((XOe,YC)=>{"use strict";p();YC.exports=Math.round});var QC=G((eje,XC)=>{"use strict";p();XC.exports=Number.isNaN||function(e){return e!==e}});var tO=G((rje,eO)=>{"use strict";p();var Tce=QC();eO.exports=function(e){return Tce(e)||e===0?e:e<0?-1:1}});var nO=G((ije,rO)=>{"use strict";p();rO.exports=Object.getOwnPropertyDescriptor});var ql=G((sje,iO)=>{"use strict";p();var Nw=nO();if(Nw)try{Nw([],"length")}catch{Nw=null}iO.exports=Nw});var Gg=G((cje,oO)=>{"use strict";p();var qw=Object.defineProperty||!1;if(qw)try{qw({},"a",{value:1})}catch{qw=!1}oO.exports=qw});var F4=G((fje,sO)=>{"use strict";p();sO.exports=function(){if(typeof Symbol!="function"||typeof Object.getOwnPropertySymbols!="function")return!1;if(typeof Symbol.iterator=="symbol")return!0;var e={},r=Symbol("test"),n=Object(r);if(typeof r=="string"||Object.prototype.toString.call(r)!=="[object Symbol]"||Object.prototype.toString.call(n)!=="[object Symbol]")return!1;var i=42;e[r]=i;for(var o in e)return!1;if(typeof Object.keys=="function"&&Object.keys(e).length!==0||typeof Object.getOwnPropertyNames=="function"&&Object.getOwnPropertyNames(e).length!==0)return!1;var s=Object.getOwnPropertySymbols(e);if(s.length!==1||s[0]!==r||!Object.prototype.propertyIsEnumerable.call(e,r))return!1;if(typeof Object.getOwnPropertyDescriptor=="function"){var a=Object.getOwnPropertyDescriptor(e,r);if(a.value!==i||a.enumerable!==!0)return!1}return!0}});var dO=G((lje,cO)=>{"use strict";p();var aO=typeof Symbol<"u"&&Symbol,Pce=F4();cO.exports=function(){return typeof aO!="function"||typeof Symbol!="function"||typeof aO("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:Pce()}});var z4=G((pje,fO)=>{"use strict";p();fO.exports=typeof Reflect<"u"&&Reflect.getPrototypeOf||null});var $4=G((yje,uO)=>{"use strict";p();var Ice=L4();uO.exports=Ice.getPrototypeOf||null});var pO=G((bje,hO)=>{"use strict";p();var Rce="Function.prototype.bind called on incompatible ",Mce=Object.prototype.toString,kce=Math.max,Bce="[object Function]",lO=function(e,r){for(var n=[],i=0;i<e.length;i+=1)n[i]=e[i];for(var o=0;o<r.length;o+=1)n[o+e.length]=r[o];return n},Dce=function(e,r){for(var n=[],i=r||0,o=0;i<e.length;i+=1,o+=1)n[o]=e[i];return n},Cce=function(t,e){for(var r="",n=0;n<t.length;n+=1)r+=t[n],n+1<t.length&&(r+=e);return r};hO.exports=function(e){var r=this;if(typeof r!="function"||Mce.apply(r)!==Bce)throw new TypeError(Rce+r);for(var n=Dce(arguments,1),i,o=function(){if(this instanceof i){var f=r.apply(this,lO(n,arguments));return Object(f)===f?f:this}return r.apply(e,lO(n,arguments))},s=kce(0,r.length-n.length),a=[],c=0;c<s;c++)a[c]="$"+c;if(i=Function("binder","return function ("+Cce(a,",")+"){ return binder.apply(this,arguments); }")(o),r.prototype){var d=function(){};d.prototype=r.prototype,i.prototype=new d,d.prototype=null}return i}});var f0=G((wje,mO)=>{"use strict";p();var Oce=pO();mO.exports=Function.prototype.bind||Oce});var Lw=G((xje,yO)=>{"use strict";p();yO.exports=Function.prototype.call});var Uw=G((Sje,gO)=>{"use strict";p();gO.exports=Function.prototype.apply});var vO=G((Tje,bO)=>{"use strict";p();bO.exports=typeof Reflect<"u"&&Reflect&&Reflect.apply});var G4=G((Ije,wO)=>{"use strict";p();var jce=f0(),Nce=Uw(),qce=Lw(),Lce=vO();wO.exports=Lce||jce.call(qce,Nce)});var Fw=G((Mje,_O)=>{"use strict";p();var Uce=f0(),Fce=Nl(),zce=Lw(),$ce=G4();_O.exports=function(e){if(e.length<1||typeof e[0]!="function")throw new Fce("a function is required");return $ce(Uce,zce,e)}});var PO=G((Bje,TO)=>{"use strict";p();var Gce=Fw(),xO=ql(),SO;try{SO=[].__proto__===Array.prototype}catch(t){if(!t||typeof t!="object"||!("code"in t)||t.code!=="ERR_PROTO_ACCESS")throw t}var H4=!!SO&&xO&&xO(Object.prototype,"__proto__"),AO=Object,EO=AO.getPrototypeOf;TO.exports=H4&&typeof H4.get=="function"?Gce([H4.get]):typeof EO=="function"?function(e){return EO(e==null?e:AO(e))}:!1});var zw=G((Cje,kO)=>{"use strict";p();var IO=z4(),RO=$4(),MO=PO();kO.exports=IO?function(e){return IO(e)}:RO?function(e){if(!e||typeof e!="object"&&typeof e!="function")throw new TypeError("getProto: not an object");return RO(e)}:MO?function(e){return MO(e)}:null});var W4=G((jje,BO)=>{"use strict";p();var Hce=Function.prototype.call,Wce=Object.prototype.hasOwnProperty,Vce=f0();BO.exports=Vce.call(Hce,Wce)});var Z4=G((qje,qO)=>{"use strict";p();var Wt,Kce=L4(),Zce=MC(),Yce=BC(),Jce=CC(),Xce=jC(),p0=U4(),h0=Nl(),Qce=LC(),ede=FC(),tde=$C(),rde=HC(),nde=VC(),ide=ZC(),ode=JC(),sde=tO(),jO=Function,V4=function(t){try{return jO('"use strict"; return ('+t+").constructor;")()}catch{}},Hg=ql(),ade=Gg(),K4=function(){throw new h0},cde=Hg?function(){try{return arguments.callee,K4}catch{try{return Hg(arguments,"callee").get}catch{return K4}}}():K4,u0=dO()(),Vn=zw(),dde=$4(),fde=z4(),NO=Uw(),Wg=Lw(),l0={},ude=typeof Uint8Array>"u"||!Vn?Wt:Vn(Uint8Array),Ll={__proto__:null,"%AggregateError%":typeof AggregateError>"u"?Wt:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?Wt:ArrayBuffer,"%ArrayIteratorPrototype%":u0&&Vn?Vn([][Symbol.iterator]()):Wt,"%AsyncFromSyncIteratorPrototype%":Wt,"%AsyncFunction%":l0,"%AsyncGenerator%":l0,"%AsyncGeneratorFunction%":l0,"%AsyncIteratorPrototype%":l0,"%Atomics%":typeof Atomics>"u"?Wt:Atomics,"%BigInt%":typeof BigInt>"u"?Wt:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?Wt:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?Wt:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?Wt:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":Zce,"%eval%":eval,"%EvalError%":Yce,"%Float16Array%":typeof Float16Array>"u"?Wt:Float16Array,"%Float32Array%":typeof Float32Array>"u"?Wt:Float32Array,"%Float64Array%":typeof Float64Array>"u"?Wt:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?Wt:FinalizationRegistry,"%Function%":jO,"%GeneratorFunction%":l0,"%Int8Array%":typeof Int8Array>"u"?Wt:Int8Array,"%Int16Array%":typeof Int16Array>"u"?Wt:Int16Array,"%Int32Array%":typeof Int32Array>"u"?Wt:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":u0&&Vn?Vn(Vn([][Symbol.iterator]())):Wt,"%JSON%":typeof JSON=="object"?JSON:Wt,"%Map%":typeof Map>"u"?Wt:Map,"%MapIteratorPrototype%":typeof Map>"u"||!u0||!Vn?Wt:Vn(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":Kce,"%Object.getOwnPropertyDescriptor%":Hg,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?Wt:Promise,"%Proxy%":typeof Proxy>"u"?Wt:Proxy,"%RangeError%":Jce,"%ReferenceError%":Xce,"%Reflect%":typeof Reflect>"u"?Wt:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?Wt:Set,"%SetIteratorPrototype%":typeof Set>"u"||!u0||!Vn?Wt:Vn(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?Wt:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":u0&&Vn?Vn(""[Symbol.iterator]()):Wt,"%Symbol%":u0?Symbol:Wt,"%SyntaxError%":p0,"%ThrowTypeError%":cde,"%TypedArray%":ude,"%TypeError%":h0,"%Uint8Array%":typeof Uint8Array>"u"?Wt:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?Wt:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?Wt:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?Wt:Uint32Array,"%URIError%":Qce,"%WeakMap%":typeof WeakMap>"u"?Wt:WeakMap,"%WeakRef%":typeof WeakRef>"u"?Wt:WeakRef,"%WeakSet%":typeof WeakSet>"u"?Wt:WeakSet,"%Function.prototype.call%":Wg,"%Function.prototype.apply%":NO,"%Object.defineProperty%":ade,"%Object.getPrototypeOf%":dde,"%Math.abs%":ede,"%Math.floor%":tde,"%Math.max%":rde,"%Math.min%":nde,"%Math.pow%":ide,"%Math.round%":ode,"%Math.sign%":sde,"%Reflect.getPrototypeOf%":fde};if(Vn)try{null.error}catch(t){DO=Vn(Vn(t)),Ll["%Error.prototype%"]=DO}var DO,lde=function t(e){var r;if(e==="%AsyncFunction%")r=V4("async function () {}");else if(e==="%GeneratorFunction%")r=V4("function* () {}");else if(e==="%AsyncGeneratorFunction%")r=V4("async function* () {}");else if(e==="%AsyncGenerator%"){var n=t("%AsyncGeneratorFunction%");n&&(r=n.prototype)}else if(e==="%AsyncIteratorPrototype%"){var i=t("%AsyncGenerator%");i&&Vn&&(r=Vn(i.prototype))}return Ll[e]=r,r},CO={__proto__:null,"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},Vg=f0(),$w=W4(),hde=Vg.call(Wg,Array.prototype.concat),pde=Vg.call(NO,Array.prototype.splice),OO=Vg.call(Wg,String.prototype.replace),Gw=Vg.call(Wg,String.prototype.slice),mde=Vg.call(Wg,RegExp.prototype.exec),yde=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,gde=/\\(\\)?/g,bde=function(e){var r=Gw(e,0,1),n=Gw(e,-1);if(r==="%"&&n!=="%")throw new p0("invalid intrinsic syntax, expected closing `%`");if(n==="%"&&r!=="%")throw new p0("invalid intrinsic syntax, expected opening `%`");var i=[];return OO(e,yde,function(o,s,a,c){i[i.length]=a?OO(c,gde,"$1"):s||o}),i},vde=function(e,r){var n=e,i;if($w(CO,n)&&(i=CO[n],n="%"+i[0]+"%"),$w(Ll,n)){var o=Ll[n];if(o===l0&&(o=lde(n)),typeof o>"u"&&!r)throw new h0("intrinsic "+e+" exists, but is not available. Please file an issue!");return{alias:i,name:n,value:o}}throw new p0("intrinsic "+e+" does not exist!")};qO.exports=function(e,r){if(typeof e!="string"||e.length===0)throw new h0("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof r!="boolean")throw new h0('"allowMissing" argument must be a boolean');if(mde(/^%?[^%]*%?$/,e)===null)throw new p0("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var n=bde(e),i=n.length>0?n[0]:"",o=vde("%"+i+"%",r),s=o.name,a=o.value,c=!1,d=o.alias;d&&(i=d[0],pde(n,hde([0,1],d)));for(var f=1,u=!0;f<n.length;f+=1){var m=n[f],_=Gw(m,0,1),v=Gw(m,-1);if((_==='"'||_==="'"||_==="`"||v==='"'||v==="'"||v==="`")&&_!==v)throw new p0("property names with quotes must have matching quotes");if((m==="constructor"||!u)&&(c=!0),i+="."+m,s="%"+i+"%",$w(Ll,s))a=Ll[s];else if(a!=null){if(!(m in a)){if(!r)throw new h0("base intrinsic for "+e+" exists, but the property is not available.");return}if(Hg&&f+1>=n.length){var A=Hg(a,m);u=!!A,u&&"get"in A&&!("originalValue"in A.get)?a=A.get:a=a[m]}else u=$w(a,m),a=a[m];u&&!c&&(Ll[s]=a)}}return a}});var Ul=G((Uje,FO)=>{"use strict";p();var LO=Z4(),UO=Fw(),wde=UO([LO("%String.prototype.indexOf%")]);FO.exports=function(e,r){var n=LO(e,!!r);return typeof n=="function"&&wde(e,".prototype.")>-1?UO([n]):n}});var HO=G((zje,GO)=>{"use strict";p();var $O=Function.prototype.toString,m0=typeof Reflect=="object"&&Reflect!==null&&Reflect.apply,J4,Hw;if(typeof m0=="function"&&typeof Object.defineProperty=="function")try{J4=Object.defineProperty({},"length",{get:function(){throw Hw}}),Hw={},m0(function(){throw 42},null,J4)}catch(t){t!==Hw&&(m0=null)}else m0=null;var _de=/^\s*class\b/,X4=function(e){try{var r=$O.call(e);return _de.test(r)}catch{return!1}},Y4=function(e){try{return X4(e)?!1:($O.call(e),!0)}catch{return!1}},Ww=Object.prototype.toString,xde="[object Object]",Ede="[object Function]",Sde="[object GeneratorFunction]",Ade="[object HTMLAllCollection]",Tde="[object HTML document.all class]",Pde="[object HTMLCollection]",Ide=typeof Symbol=="function"&&!!Symbol.toStringTag,Rde=!(0 in[,]),Q4=function(){return!1};typeof document=="object"&&(zO=document.all,Ww.call(zO)===Ww.call(document.all)&&(Q4=function(e){if((Rde||!e)&&(typeof e>"u"||typeof e=="object"))try{var r=Ww.call(e);return(r===Ade||r===Tde||r===Pde||r===xde)&&e("")==null}catch{}return!1}));var zO;GO.exports=m0?function(e){if(Q4(e))return!0;if(!e||typeof e!="function"&&typeof e!="object")return!1;try{m0(e,null,J4)}catch(r){if(r!==Hw)return!1}return!X4(e)&&Y4(e)}:function(e){if(Q4(e))return!0;if(!e||typeof e!="function"&&typeof e!="object")return!1;if(Ide)return Y4(e);if(X4(e))return!1;var r=Ww.call(e);return r!==Ede&&r!==Sde&&!/^\[object HTML/.test(r)?!1:Y4(e)}});var KO=G((Gje,VO)=>{"use strict";p();var Mde=HO(),kde=Object.prototype.toString,WO=Object.prototype.hasOwnProperty,Bde=function(e,r,n){for(var i=0,o=e.length;i<o;i++)WO.call(e,i)&&(n==null?r(e[i],i,e):r.call(n,e[i],i,e))},Dde=function(e,r,n){for(var i=0,o=e.length;i<o;i++)n==null?r(e.charAt(i),i,e):r.call(n,e.charAt(i),i,e)},Cde=function(e,r,n){for(var i in e)WO.call(e,i)&&(n==null?r(e[i],i,e):r.call(n,e[i],i,e))};function Ode(t){return kde.call(t)==="[object Array]"}VO.exports=function(e,r,n){if(!Mde(r))throw new TypeError("iterator must be a function");var i;arguments.length>=3&&(i=n),Ode(e)?Bde(e,r,i):typeof e=="string"?Dde(e,r,i):Cde(e,r,i)}});var YO=G((Wje,ZO)=>{"use strict";p();ZO.exports=["Float16Array","Float32Array","Float64Array","Int8Array","Int16Array","Int32Array","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","BigInt64Array","BigUint64Array"]});var XO=G((Kje,JO)=>{"use strict";p();var e5=YO(),jde=globalThis;JO.exports=function(){for(var e=[],r=0;r<e5.length;r++)typeof jde[e5[r]]=="function"&&(e[e.length]=e5[r]);return e}});var rj=G((Yje,tj)=>{"use strict";p();var QO=Gg(),Nde=U4(),y0=Nl(),ej=ql();tj.exports=function(e,r,n){if(!e||typeof e!="object"&&typeof e!="function")throw new y0("`obj` must be an object or a function`");if(typeof r!="string"&&typeof r!="symbol")throw new y0("`property` must be a string or a symbol`");if(arguments.length>3&&typeof arguments[3]!="boolean"&&arguments[3]!==null)throw new y0("`nonEnumerable`, if provided, must be a boolean or null");if(arguments.length>4&&typeof arguments[4]!="boolean"&&arguments[4]!==null)throw new y0("`nonWritable`, if provided, must be a boolean or null");if(arguments.length>5&&typeof arguments[5]!="boolean"&&arguments[5]!==null)throw new y0("`nonConfigurable`, if provided, must be a boolean or null");if(arguments.length>6&&typeof arguments[6]!="boolean")throw new y0("`loose`, if provided, must be a boolean");var i=arguments.length>3?arguments[3]:null,o=arguments.length>4?arguments[4]:null,s=arguments.length>5?arguments[5]:null,a=arguments.length>6?arguments[6]:!1,c=!!ej&&ej(e,r);if(QO)QO(e,r,{configurable:s===null&&c?c.configurable:!s,enumerable:i===null&&c?c.enumerable:!i,value:n,writable:o===null&&c?c.writable:!o});else if(a||!i&&!o&&!s)e[r]=n;else throw new Nde("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.")}});var oj=G((Xje,ij)=>{"use strict";p();var t5=Gg(),nj=function(){return!!t5};nj.hasArrayLengthDefineBug=function(){if(!t5)return null;try{return t5([],"length",{value:1}).length!==1}catch{return!0}};ij.exports=nj});var fj=G((eNe,dj)=>{"use strict";p();var qde=Z4(),sj=rj(),Lde=oj()(),aj=ql(),cj=Nl(),Ude=qde("%Math.floor%");dj.exports=function(e,r){if(typeof e!="function")throw new cj("`fn` is not a function");if(typeof r!="number"||r<0||r>4294967295||Ude(r)!==r)throw new cj("`length` must be a positive 32-bit integer");var n=arguments.length>2&&!!arguments[2],i=!0,o=!0;if("length"in e&&aj){var s=aj(e,"length");s&&!s.configurable&&(i=!1),s&&!s.writable&&(o=!1)}return(i||o||!n)&&(Lde?sj(e,"length",r,!0,!0):sj(e,"length",r)),e}});var lj=G((rNe,uj)=>{"use strict";p();var Fde=f0(),zde=Uw(),$de=G4();uj.exports=function(){return $de(Fde,zde,arguments)}});var mj=G((iNe,Vw)=>{"use strict";p();var Gde=fj(),hj=Gg(),Hde=Fw(),pj=lj();Vw.exports=function(e){var r=Hde(arguments),n=e.length-(arguments.length-1);return Gde(r,1+(n>0?n:0),!0)};hj?hj(Vw.exports,"apply",{value:pj}):Vw.exports.apply=pj});var Kg=G((sNe,yj)=>{"use strict";p();var Wde=F4();yj.exports=function(){return Wde()&&!!Symbol.toStringTag}});var o5=G((cNe,wj)=>{"use strict";p();var Yw=KO(),Vde=XO(),gj=mj(),n5=Ul(),Zw=ql(),Kw=zw(),Kde=n5("Object.prototype.toString"),vj=Kg()(),bj=globalThis,r5=Vde(),i5=n5("String.prototype.slice"),Zde=n5("Array.prototype.indexOf",!0)||function(e,r){for(var n=0;n<e.length;n+=1)if(e[n]===r)return n;return-1},Jw={__proto__:null};vj&&Zw&&Kw?Yw(r5,function(t){var e=new bj[t];if(Symbol.toStringTag in e&&Kw){var r=Kw(e),n=Zw(r,Symbol.toStringTag);if(!n&&r){var i=Kw(r);n=Zw(i,Symbol.toStringTag)}if(n&&n.get){var o=gj(n.get);Jw["$"+t]=o}}}):Yw(r5,function(t){var e=new bj[t],r=e.slice||e.set;if(r){var n=gj(r);Jw["$"+t]=n}});var Yde=function(e){var r=!1;return Yw(Jw,function(n,i){if(!r)try{"$"+n(e)===i&&(r=i5(i,1))}catch{}}),r},Jde=function(e){var r=!1;return Yw(Jw,function(n,i){if(!r)try{n(e),r=i5(i,1)}catch{}}),r};wj.exports=function(e){if(!e||typeof e!="object")return!1;if(!vj){var r=i5(Kde(e),8,-1);return Zde(r5,r)>-1?r:r!=="Object"?!1:Jde(e)}return Zw?Yde(e):null}});var s5=G((fNe,_j)=>{"use strict";p();var Xde=o5();_j.exports=function(e){return!!Xde(e)}});var Ej=G((lNe,xj)=>{"use strict";p();var Qde=Nl(),efe=Ul(),tfe=efe("TypedArray.prototype.buffer",!0),rfe=s5();xj.exports=tfe||function(e){if(!rfe(e))throw new Qde("Not a Typed Array");return e.buffer}});var Zg=G((pNe,Aj)=>{"use strict";p();var sa=it().Buffer,nfe=TC(),ife=Ej(),ofe=ArrayBuffer.isView||function(e){try{return ife(e),!0}catch{return!1}},sfe=typeof Uint8Array<"u",Sj=typeof ArrayBuffer<"u"&&typeof Uint8Array<"u",afe=Sj&&(sa.prototype instanceof Uint8Array||sa.TYPED_ARRAY_SUPPORT);Aj.exports=function(e,r){if(sa.isBuffer(e))return e.constructor&&!("isBuffer"in e)?sa.from(e):e;if(typeof e=="string")return sa.from(e,r);if(Sj&&ofe(e)){if(e.byteLength===0)return sa.alloc(0);if(afe){var n=sa.from(e.buffer,e.byteOffset,e.byteLength);if(n.byteLength===e.byteLength)return n}var i=e instanceof Uint8Array?e:new Uint8Array(e.buffer,e.byteOffset,e.byteLength),o=sa.from(i);if(o.length===e.byteLength)return o}if(sfe&&e instanceof Uint8Array)return sa.from(e);var s=nfe(e);if(s)for(var a=0;a<e.length;a+=1){var c=e[a];if(typeof c!="number"||c<0||c>255||~~c!==c)throw new RangeError("Array items must be numbers in the range 0-255.")}if(s||sa.isBuffer(e)&&e.constructor&&typeof e.constructor.isBuffer=="function"&&e.constructor.isBuffer(e))return sa.from(e);throw new TypeError('The "data" argument must be a string, an Array, a Buffer, a Uint8Array, or a DataView.')}});var Rj=G((yNe,Ij)=>{"use strict";p();var cfe=it().Buffer,dfe=Zg(),Pj=typeof Uint8Array<"u",ffe=Pj&&typeof ArrayBuffer<"u",Tj=ffe&&ArrayBuffer.isView;Ij.exports=function(t,e){if(typeof t=="string"||cfe.isBuffer(t)||Pj&&t instanceof Uint8Array||Tj&&Tj(t))return dfe(t,e);throw new TypeError('The "data" argument must be a string, a Buffer, a Uint8Array, or a DataView')}});var Yg=G((bNe,a5)=>{"use strict";p();typeof k.default>"u"||!k.default.version||k.default.version.indexOf("v0.")===0||k.default.version.indexOf("v1.")===0&&k.default.version.indexOf("v1.8.")!==0?a5.exports={nextTick:ufe}:a5.exports=k.default;function ufe(t,e,r,n){if(typeof t!="function")throw new TypeError('"callback" argument must be a function');var i=arguments.length,o,s;switch(i){case 0:case 1:return k.default.nextTick(t);case 2:return k.default.nextTick(function(){t.call(null,e)});case 3:return k.default.nextTick(function(){t.call(null,e,r)});case 4:return k.default.nextTick(function(){t.call(null,e,r,n)});default:for(o=new Array(i-1),s=0;s<o.length;)o[s++]=arguments[s];return k.default.nextTick(function(){t.apply(null,o)})}}});var kj=G((wNe,Mj)=>{p();var lfe={}.toString;Mj.exports=Array.isArray||function(t){return lfe.call(t)=="[object Array]"}});var nc=G((xNe,c5)=>{"use strict";p();var g0=typeof Reflect=="object"?Reflect:null,Bj=g0&&typeof g0.apply=="function"?g0.apply:function(e,r,n){return Function.prototype.apply.call(e,r,n)},Xw;g0&&typeof g0.ownKeys=="function"?Xw=g0.ownKeys:Object.getOwnPropertySymbols?Xw=function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:Xw=function(e){return Object.getOwnPropertyNames(e)};function hfe(t){console&&console.warn&&console.warn(t)}var Cj=Number.isNaN||function(e){return e!==e};function wr(){wr.init.call(this)}c5.exports=wr;c5.exports.once=gfe;wr.EventEmitter=wr;wr.prototype._events=void 0;wr.prototype._eventsCount=0;wr.prototype._maxListeners=void 0;var Dj=10;function Qw(t){if(typeof t!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof t)}Object.defineProperty(wr,"defaultMaxListeners",{enumerable:!0,get:function(){return Dj},set:function(t){if(typeof t!="number"||t<0||Cj(t))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+t+".");Dj=t}});wr.init=function(){(this._events===void 0||this._events===Object.getPrototypeOf(this)._events)&&(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0};wr.prototype.setMaxListeners=function(e){if(typeof e!="number"||e<0||Cj(e))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+e+".");return this._maxListeners=e,this};function Oj(t){return t._maxListeners===void 0?wr.defaultMaxListeners:t._maxListeners}wr.prototype.getMaxListeners=function(){return Oj(this)};wr.prototype.emit=function(e){for(var r=[],n=1;n<arguments.length;n++)r.push(arguments[n]);var i=e==="error",o=this._events;if(o!==void 0)i=i&&o.error===void 0;else if(!i)return!1;if(i){var s;if(r.length>0&&(s=r[0]),s instanceof Error)throw s;var a=new Error("Unhandled error."+(s?" ("+s.message+")":""));throw a.context=s,a}var c=o[e];if(c===void 0)return!1;if(typeof c=="function")Bj(c,this,r);else for(var d=c.length,f=Uj(c,d),n=0;n<d;++n)Bj(f[n],this,r);return!0};function jj(t,e,r,n){var i,o,s;if(Qw(r),o=t._events,o===void 0?(o=t._events=Object.create(null),t._eventsCount=0):(o.newListener!==void 0&&(t.emit("newListener",e,r.listener?r.listener:r),o=t._events),s=o[e]),s===void 0)s=o[e]=r,++t._eventsCount;else if(typeof s=="function"?s=o[e]=n?[r,s]:[s,r]:n?s.unshift(r):s.push(r),i=Oj(t),i>0&&s.length>i&&!s.warned){s.warned=!0;var a=new Error("Possible EventEmitter memory leak detected. "+s.length+" "+String(e)+" listeners added. Use emitter.setMaxListeners() to increase limit");a.name="MaxListenersExceededWarning",a.emitter=t,a.type=e,a.count=s.length,hfe(a)}return t}wr.prototype.addListener=function(e,r){return jj(this,e,r,!1)};wr.prototype.on=wr.prototype.addListener;wr.prototype.prependListener=function(e,r){return jj(this,e,r,!0)};function pfe(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function Nj(t,e,r){var n={fired:!1,wrapFn:void 0,target:t,type:e,listener:r},i=pfe.bind(n);return i.listener=r,n.wrapFn=i,i}wr.prototype.once=function(e,r){return Qw(r),this.on(e,Nj(this,e,r)),this};wr.prototype.prependOnceListener=function(e,r){return Qw(r),this.prependListener(e,Nj(this,e,r)),this};wr.prototype.removeListener=function(e,r){var n,i,o,s,a;if(Qw(r),i=this._events,i===void 0)return this;if(n=i[e],n===void 0)return this;if(n===r||n.listener===r)--this._eventsCount===0?this._events=Object.create(null):(delete i[e],i.removeListener&&this.emit("removeListener",e,n.listener||r));else if(typeof n!="function"){for(o=-1,s=n.length-1;s>=0;s--)if(n[s]===r||n[s].listener===r){a=n[s].listener,o=s;break}if(o<0)return this;o===0?n.shift():mfe(n,o),n.length===1&&(i[e]=n[0]),i.removeListener!==void 0&&this.emit("removeListener",e,a||r)}return this};wr.prototype.off=wr.prototype.removeListener;wr.prototype.removeAllListeners=function(e){var r,n,i;if(n=this._events,n===void 0)return this;if(n.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):n[e]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete n[e]),this;if(arguments.length===0){var o=Object.keys(n),s;for(i=0;i<o.length;++i)s=o[i],s!=="removeListener"&&this.removeAllListeners(s);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if(r=n[e],typeof r=="function")this.removeListener(e,r);else if(r!==void 0)for(i=r.length-1;i>=0;i--)this.removeListener(e,r[i]);return this};function qj(t,e,r){var n=t._events;if(n===void 0)return[];var i=n[e];return i===void 0?[]:typeof i=="function"?r?[i.listener||i]:[i]:r?yfe(i):Uj(i,i.length)}wr.prototype.listeners=function(e){return qj(this,e,!0)};wr.prototype.rawListeners=function(e){return qj(this,e,!1)};wr.listenerCount=function(t,e){return typeof t.listenerCount=="function"?t.listenerCount(e):Lj.call(t,e)};wr.prototype.listenerCount=Lj;function Lj(t){var e=this._events;if(e!==void 0){var r=e[t];if(typeof r=="function")return 1;if(r!==void 0)return r.length}return 0}wr.prototype.eventNames=function(){return this._eventsCount>0?Xw(this._events):[]};function Uj(t,e){for(var r=new Array(e),n=0;n<e;++n)r[n]=t[n];return r}function mfe(t,e){for(;e+1<t.length;e++)t[e]=t[e+1];t.pop()}function yfe(t){for(var e=new Array(t.length),r=0;r<e.length;++r)e[r]=t[r].listener||t[r];return e}function gfe(t,e){return new Promise(function(r,n){function i(s){t.removeListener(e,o),n(s)}function o(){typeof t.removeListener=="function"&&t.removeListener("error",i),r([].slice.call(arguments))}Fj(t,e,o,{once:!0}),e!=="error"&&bfe(t,i,{once:!0})})}function bfe(t,e,r){typeof t.on=="function"&&Fj(t,"error",e,r)}function Fj(t,e,r,n){if(typeof t.on=="function")n.once?t.once(e,r):t.on(e,r);else if(typeof t.addEventListener=="function")t.addEventListener(e,function i(o){n.once&&t.removeEventListener(e,i),r(o)});else throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof t)}});var d5=G((SNe,zj)=>{p();zj.exports=nc().EventEmitter});var b0=G(ji=>{p();function vfe(t){return Array.isArray?Array.isArray(t):e2(t)==="[object Array]"}ji.isArray=vfe;function wfe(t){return typeof t=="boolean"}ji.isBoolean=wfe;function _fe(t){return t===null}ji.isNull=_fe;function xfe(t){return t==null}ji.isNullOrUndefined=xfe;function Efe(t){return typeof t=="number"}ji.isNumber=Efe;function Sfe(t){return typeof t=="string"}ji.isString=Sfe;function Afe(t){return typeof t=="symbol"}ji.isSymbol=Afe;function Tfe(t){return t===void 0}ji.isUndefined=Tfe;function Pfe(t){return e2(t)==="[object RegExp]"}ji.isRegExp=Pfe;function Ife(t){return typeof t=="object"&&t!==null}ji.isObject=Ife;function Rfe(t){return e2(t)==="[object Date]"}ji.isDate=Rfe;function Mfe(t){return e2(t)==="[object Error]"||t instanceof Error}ji.isError=Mfe;function kfe(t){return typeof t=="function"}ji.isFunction=kfe;function Bfe(t){return t===null||typeof t=="boolean"||typeof t=="number"||typeof t=="string"||typeof t=="symbol"||typeof t>"u"}ji.isPrimitive=Bfe;ji.isBuffer=jr().Buffer.isBuffer;function e2(t){return Object.prototype.toString.call(t)}});var Hj=G((INe,Gj)=>{"use strict";p();var Dfe=Kg()(),Cfe=Ul(),f5=Cfe("Object.prototype.toString"),t2=function(e){return Dfe&&e&&typeof e=="object"&&Symbol.toStringTag in e?!1:f5(e)==="[object Arguments]"},$j=function(e){return t2(e)?!0:e!==null&&typeof e=="object"&&"length"in e&&typeof e.length=="number"&&e.length>=0&&f5(e)!=="[object Array]"&&"callee"in e&&f5(e.callee)==="[object Function]"},Ofe=function(){return t2(arguments)}();t2.isLegacyArguments=$j;Gj.exports=Ofe?t2:$j});var Jj=G((MNe,Yj)=>{"use strict";p();var Wj=Ul(),jfe=Kg()(),Nfe=W4(),qfe=ql(),h5;jfe?(Vj=Wj("RegExp.prototype.exec"),u5={},r2=function(){throw u5},l5={toString:r2,valueOf:r2},typeof Symbol.toPrimitive=="symbol"&&(l5[Symbol.toPrimitive]=r2),h5=function(e){if(!e||typeof e!="object")return!1;var r=qfe(e,"lastIndex"),n=r&&Nfe(r,"value");if(!n)return!1;try{Vj(e,l5)}catch(i){return i===u5}}):(Kj=Wj("Object.prototype.toString"),Zj="[object RegExp]",h5=function(e){return!e||typeof e!="object"&&typeof e!="function"?!1:Kj(e)===Zj});var Vj,u5,r2,l5,Kj,Zj;Yj.exports=h5});var Qj=G((BNe,Xj)=>{"use strict";p();var Lfe=Ul(),Ufe=Jj(),Ffe=Lfe("RegExp.prototype.exec"),zfe=Nl();Xj.exports=function(e){if(!Ufe(e))throw new zfe("`regex` must be a RegExp");return function(n){return Ffe(e,n)!==null}}});var tN=G((CNe,eN)=>{"use strict";p();var $fe=function*(){}.constructor;eN.exports=()=>$fe});var oN=G((jNe,iN)=>{"use strict";p();var nN=Ul(),Gfe=Qj(),Hfe=Gfe(/^\s*(?:function)?\*/),Wfe=Kg()(),rN=zw(),Vfe=nN("Object.prototype.toString"),Kfe=nN("Function.prototype.toString"),Zfe=tN();iN.exports=function(e){if(typeof e!="function")return!1;if(Hfe(Kfe(e)))return!0;if(!Wfe){var r=Vfe(e);return r==="[object GeneratorFunction]"}if(!rN)return!1;var n=Zfe();return n&&rN(e)===n.prototype}});var vN=G(Vt=>{"use strict";p();var Yfe=Hj(),Jfe=oN(),aa=o5(),sN=s5();function v0(t){return t.call.bind(t)}var aN=typeof BigInt<"u",cN=typeof Symbol<"u",Bs=v0(Object.prototype.toString),Xfe=v0(Number.prototype.valueOf),Qfe=v0(String.prototype.valueOf),eue=v0(Boolean.prototype.valueOf);aN&&(dN=v0(BigInt.prototype.valueOf));var dN;cN&&(fN=v0(Symbol.prototype.valueOf));var fN;function Xg(t,e){if(typeof t!="object")return!1;try{return e(t),!0}catch{return!1}}Vt.isArgumentsObject=Yfe;Vt.isGeneratorFunction=Jfe;Vt.isTypedArray=sN;function tue(t){return typeof Promise<"u"&&t instanceof Promise||t!==null&&typeof t=="object"&&typeof t.then=="function"&&typeof t.catch=="function"}Vt.isPromise=tue;function rue(t){return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?ArrayBuffer.isView(t):sN(t)||lN(t)}Vt.isArrayBufferView=rue;function nue(t){return aa(t)==="Uint8Array"}Vt.isUint8Array=nue;function iue(t){return aa(t)==="Uint8ClampedArray"}Vt.isUint8ClampedArray=iue;function oue(t){return aa(t)==="Uint16Array"}Vt.isUint16Array=oue;function sue(t){return aa(t)==="Uint32Array"}Vt.isUint32Array=sue;function aue(t){return aa(t)==="Int8Array"}Vt.isInt8Array=aue;function cue(t){return aa(t)==="Int16Array"}Vt.isInt16Array=cue;function due(t){return aa(t)==="Int32Array"}Vt.isInt32Array=due;function fue(t){return aa(t)==="Float32Array"}Vt.isFloat32Array=fue;function uue(t){return aa(t)==="Float64Array"}Vt.isFloat64Array=uue;function lue(t){return aa(t)==="BigInt64Array"}Vt.isBigInt64Array=lue;function hue(t){return aa(t)==="BigUint64Array"}Vt.isBigUint64Array=hue;function n2(t){return Bs(t)==="[object Map]"}n2.working=typeof Map<"u"&&n2(new Map);function pue(t){return typeof Map>"u"?!1:n2.working?n2(t):t instanceof Map}Vt.isMap=pue;function i2(t){return Bs(t)==="[object Set]"}i2.working=typeof Set<"u"&&i2(new Set);function mue(t){return typeof Set>"u"?!1:i2.working?i2(t):t instanceof Set}Vt.isSet=mue;function o2(t){return Bs(t)==="[object WeakMap]"}o2.working=typeof WeakMap<"u"&&o2(new WeakMap);function yue(t){return typeof WeakMap>"u"?!1:o2.working?o2(t):t instanceof WeakMap}Vt.isWeakMap=yue;function m5(t){return Bs(t)==="[object WeakSet]"}m5.working=typeof WeakSet<"u"&&m5(new WeakSet);function gue(t){return m5(t)}Vt.isWeakSet=gue;function s2(t){return Bs(t)==="[object ArrayBuffer]"}s2.working=typeof ArrayBuffer<"u"&&s2(new ArrayBuffer);function uN(t){return typeof ArrayBuffer>"u"?!1:s2.working?s2(t):t instanceof ArrayBuffer}Vt.isArrayBuffer=uN;function a2(t){return Bs(t)==="[object DataView]"}a2.working=typeof ArrayBuffer<"u"&&typeof DataView<"u"&&a2(new DataView(new ArrayBuffer(1),0,1));function lN(t){return typeof DataView>"u"?!1:a2.working?a2(t):t instanceof DataView}Vt.isDataView=lN;var p5=typeof SharedArrayBuffer<"u"?SharedArrayBuffer:void 0;function Jg(t){return Bs(t)==="[object SharedArrayBuffer]"}function hN(t){return typeof p5>"u"?!1:(typeof Jg.working>"u"&&(Jg.working=Jg(new p5)),Jg.working?Jg(t):t instanceof p5)}Vt.isSharedArrayBuffer=hN;function bue(t){return Bs(t)==="[object AsyncFunction]"}Vt.isAsyncFunction=bue;function vue(t){return Bs(t)==="[object Map Iterator]"}Vt.isMapIterator=vue;function wue(t){return Bs(t)==="[object Set Iterator]"}Vt.isSetIterator=wue;function _ue(t){return Bs(t)==="[object Generator]"}Vt.isGeneratorObject=_ue;function xue(t){return Bs(t)==="[object WebAssembly.Module]"}Vt.isWebAssemblyCompiledModule=xue;function pN(t){return Xg(t,Xfe)}Vt.isNumberObject=pN;function mN(t){return Xg(t,Qfe)}Vt.isStringObject=mN;function yN(t){return Xg(t,eue)}Vt.isBooleanObject=yN;function gN(t){return aN&&Xg(t,dN)}Vt.isBigIntObject=gN;function bN(t){return cN&&Xg(t,fN)}Vt.isSymbolObject=bN;function Eue(t){return pN(t)||mN(t)||yN(t)||gN(t)||bN(t)}Vt.isBoxedPrimitive=Eue;function Sue(t){return typeof Uint8Array<"u"&&(uN(t)||hN(t))}Vt.isAnyArrayBuffer=Sue;["isProxy","isExternal","isModuleNamespaceObject"].forEach(function(t){Object.defineProperty(Vt,t,{enumerable:!1,value:function(){throw new Error(t+" is not supported in userland")}})})});var _N=G((UNe,wN)=>{p();wN.exports=function(e){return e&&typeof e=="object"&&typeof e.copy=="function"&&typeof e.fill=="function"&&typeof e.readUInt8=="function"}});var tb=G(Kt=>{p();var xN=Object.getOwnPropertyDescriptors||function(e){for(var r=Object.keys(e),n={},i=0;i<r.length;i++)n[r[i]]=Object.getOwnPropertyDescriptor(e,r[i]);return n},Aue=/%[sdj%]/g;Kt.format=function(t){if(!p2(t)){for(var e=[],r=0;r<arguments.length;r++)e.push(Ff(arguments[r]));return e.join(" ")}for(var r=1,n=arguments,i=n.length,o=String(t).replace(Aue,function(a){if(a==="%%")return"%";if(r>=i)return a;switch(a){case"%s":return String(n[r++]);case"%d":return Number(n[r++]);case"%j":try{return JSON.stringify(n[r++])}catch{return"[Circular]"}default:return a}}),s=n[r];r<i;s=n[++r])h2(s)||!w0(s)?o+=" "+s:o+=" "+Ff(s);return o};Kt.deprecate=function(t,e){if(typeof k.default<"u"&&k.default.noDeprecation===!0)return t;if(typeof k.default>"u")return function(){return Kt.deprecate(t,e).apply(this,arguments)};var r=!1;function n(){if(!r){if(k.default.throwDeprecation)throw new Error(e);k.default.traceDeprecation?console.trace(e):console.error(e),r=!0}return t.apply(this,arguments)}return n};var c2={},EN=/^$/;k.default.env.NODE_DEBUG&&(d2=k.default.env.NODE_DEBUG,d2=d2.replace(/[|\\{}()[\]^$+?.]/g,"\\$&").replace(/\*/g,".*").replace(/,/g,"$|^").toUpperCase(),EN=new RegExp("^"+d2+"$","i"));var d2;Kt.debuglog=function(t){if(t=t.toUpperCase(),!c2[t])if(EN.test(t)){var e=k.default.pid;c2[t]=function(){var r=Kt.format.apply(Kt,arguments);console.error("%s %d: %s",t,e,r)}}else c2[t]=function(){};return c2[t]};function Ff(t,e){var r={seen:[],stylize:Pue};return arguments.length>=3&&(r.depth=arguments[2]),arguments.length>=4&&(r.colors=arguments[3]),v5(e)?r.showHidden=e:e&&Kt._extend(r,e),zl(r.showHidden)&&(r.showHidden=!1),zl(r.depth)&&(r.depth=2),zl(r.colors)&&(r.colors=!1),zl(r.customInspect)&&(r.customInspect=!0),r.colors&&(r.stylize=Tue),u2(r,t,r.depth)}Kt.inspect=Ff;Ff.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]};Ff.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"};function Tue(t,e){var r=Ff.styles[e];return r?"\x1B["+Ff.colors[r][0]+"m"+t+"\x1B["+Ff.colors[r][1]+"m":t}function Pue(t,e){return t}function Iue(t){var e={};return t.forEach(function(r,n){e[r]=!0}),e}function u2(t,e,r){if(t.customInspect&&e&&f2(e.inspect)&&e.inspect!==Kt.inspect&&!(e.constructor&&e.constructor.prototype===e)){var n=e.inspect(r,t);return p2(n)||(n=u2(t,n,r)),n}var i=Rue(t,e);if(i)return i;var o=Object.keys(e),s=Iue(o);if(t.showHidden&&(o=Object.getOwnPropertyNames(e)),eb(e)&&(o.indexOf("message")>=0||o.indexOf("description")>=0))return y5(e);if(o.length===0){if(f2(e)){var a=e.name?": "+e.name:"";return t.stylize("[Function"+a+"]","special")}if(Qg(e))return t.stylize(RegExp.prototype.toString.call(e),"regexp");if(l2(e))return t.stylize(Date.prototype.toString.call(e),"date");if(eb(e))return y5(e)}var c="",d=!1,f=["{","}"];if(SN(e)&&(d=!0,f=["[","]"]),f2(e)){var u=e.name?": "+e.name:"";c=" [Function"+u+"]"}if(Qg(e)&&(c=" "+RegExp.prototype.toString.call(e)),l2(e)&&(c=" "+Date.prototype.toUTCString.call(e)),eb(e)&&(c=" "+y5(e)),o.length===0&&(!d||e.length==0))return f[0]+c+f[1];if(r<0)return Qg(e)?t.stylize(RegExp.prototype.toString.call(e),"regexp"):t.stylize("[Object]","special");t.seen.push(e);var m;return d?m=Mue(t,e,r,s,o):m=o.map(function(_){return b5(t,e,r,s,_,d)}),t.seen.pop(),kue(m,c,f)}function Rue(t,e){if(zl(e))return t.stylize("undefined","undefined");if(p2(e)){var r="'"+JSON.stringify(e).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return t.stylize(r,"string")}if(AN(e))return t.stylize(""+e,"number");if(v5(e))return t.stylize(""+e,"boolean");if(h2(e))return t.stylize("null","null")}function y5(t){return"["+Error.prototype.toString.call(t)+"]"}function Mue(t,e,r,n,i){for(var o=[],s=0,a=e.length;s<a;++s)TN(e,String(s))?o.push(b5(t,e,r,n,String(s),!0)):o.push("");return i.forEach(function(c){c.match(/^\d+$/)||o.push(b5(t,e,r,n,c,!0))}),o}function b5(t,e,r,n,i,o){var s,a,c;if(c=Object.getOwnPropertyDescriptor(e,i)||{value:e[i]},c.get?c.set?a=t.stylize("[Getter/Setter]","special"):a=t.stylize("[Getter]","special"):c.set&&(a=t.stylize("[Setter]","special")),TN(n,i)||(s="["+i+"]"),a||(t.seen.indexOf(c.value)<0?(h2(r)?a=u2(t,c.value,null):a=u2(t,c.value,r-1),a.indexOf(`
3
+ `)>-1&&(o?a=a.split(`
4
+ `).map(function(d){return" "+d}).join(`
5
+ `).substr(2):a=`
6
+ `+a.split(`
7
+ `).map(function(d){return" "+d}).join(`
8
+ `))):a=t.stylize("[Circular]","special")),zl(s)){if(o&&i.match(/^\d+$/))return a;s=JSON.stringify(""+i),s.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(s=s.substr(1,s.length-2),s=t.stylize(s,"name")):(s=s.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),s=t.stylize(s,"string"))}return s+": "+a}function kue(t,e,r){var n=0,i=t.reduce(function(o,s){return n++,s.indexOf(`
9
+ `)>=0&&n++,o+s.replace(/\u001b\[\d\d?m/g,"").length+1},0);return i>60?r[0]+(e===""?"":e+`
10
+ `)+" "+t.join(`,
11
+ `)+" "+r[1]:r[0]+e+" "+t.join(", ")+" "+r[1]}Kt.types=vN();function SN(t){return Array.isArray(t)}Kt.isArray=SN;function v5(t){return typeof t=="boolean"}Kt.isBoolean=v5;function h2(t){return t===null}Kt.isNull=h2;function Bue(t){return t==null}Kt.isNullOrUndefined=Bue;function AN(t){return typeof t=="number"}Kt.isNumber=AN;function p2(t){return typeof t=="string"}Kt.isString=p2;function Due(t){return typeof t=="symbol"}Kt.isSymbol=Due;function zl(t){return t===void 0}Kt.isUndefined=zl;function Qg(t){return w0(t)&&w5(t)==="[object RegExp]"}Kt.isRegExp=Qg;Kt.types.isRegExp=Qg;function w0(t){return typeof t=="object"&&t!==null}Kt.isObject=w0;function l2(t){return w0(t)&&w5(t)==="[object Date]"}Kt.isDate=l2;Kt.types.isDate=l2;function eb(t){return w0(t)&&(w5(t)==="[object Error]"||t instanceof Error)}Kt.isError=eb;Kt.types.isNativeError=eb;function f2(t){return typeof t=="function"}Kt.isFunction=f2;function Cue(t){return t===null||typeof t=="boolean"||typeof t=="number"||typeof t=="string"||typeof t=="symbol"||typeof t>"u"}Kt.isPrimitive=Cue;Kt.isBuffer=_N();function w5(t){return Object.prototype.toString.call(t)}function g5(t){return t<10?"0"+t.toString(10):t.toString(10)}var Oue=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function jue(){var t=new Date,e=[g5(t.getHours()),g5(t.getMinutes()),g5(t.getSeconds())].join(":");return[t.getDate(),Oue[t.getMonth()],e].join(" ")}Kt.log=function(){console.log("%s - %s",jue(),Kt.format.apply(Kt,arguments))};Kt.inherits=Je();Kt._extend=function(t,e){if(!e||!w0(e))return t;for(var r=Object.keys(e),n=r.length;n--;)t[r[n]]=e[r[n]];return t};function TN(t,e){return Object.prototype.hasOwnProperty.call(t,e)}var Fl=typeof Symbol<"u"?Symbol("util.promisify.custom"):void 0;Kt.promisify=function(e){if(typeof e!="function")throw new TypeError('The "original" argument must be of type Function');if(Fl&&e[Fl]){var r=e[Fl];if(typeof r!="function")throw new TypeError('The "util.promisify.custom" argument must be of type Function');return Object.defineProperty(r,Fl,{value:r,enumerable:!1,writable:!1,configurable:!0}),r}function r(){for(var n,i,o=new Promise(function(c,d){n=c,i=d}),s=[],a=0;a<arguments.length;a++)s.push(arguments[a]);s.push(function(c,d){c?i(c):n(d)});try{e.apply(this,s)}catch(c){i(c)}return o}return Object.setPrototypeOf(r,Object.getPrototypeOf(e)),Fl&&Object.defineProperty(r,Fl,{value:r,enumerable:!1,writable:!1,configurable:!0}),Object.defineProperties(r,xN(e))};Kt.promisify.custom=Fl;function Nue(t,e){if(!t){var r=new Error("Promise was rejected with a falsy value");r.reason=t,t=r}return e(t)}function que(t){if(typeof t!="function")throw new TypeError('The "original" argument must be of type Function');function e(){for(var r=[],n=0;n<arguments.length;n++)r.push(arguments[n]);var i=r.pop();if(typeof i!="function")throw new TypeError("The last argument must be of type Function");var o=this,s=function(){return i.apply(o,arguments)};t.apply(this,r).then(function(a){k.default.nextTick(s.bind(null,null,a))},function(a){k.default.nextTick(Nue.bind(null,a,s))})}return Object.setPrototypeOf(e,Object.getPrototypeOf(t)),Object.defineProperties(e,xN(t)),e}Kt.callbackify=que});var IN=G((GNe,_5)=>{"use strict";p();function Lue(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var PN=d0().Buffer,rb=tb();function Uue(t,e,r){t.copy(e,r)}_5.exports=function(){function t(){Lue(this,t),this.head=null,this.tail=null,this.length=0}return t.prototype.push=function(r){var n={data:r,next:null};this.length>0?this.tail.next=n:this.head=n,this.tail=n,++this.length},t.prototype.unshift=function(r){var n={data:r,next:this.head};this.length===0&&(this.tail=n),this.head=n,++this.length},t.prototype.shift=function(){if(this.length!==0){var r=this.head.data;return this.length===1?this.head=this.tail=null:this.head=this.head.next,--this.length,r}},t.prototype.clear=function(){this.head=this.tail=null,this.length=0},t.prototype.join=function(r){if(this.length===0)return"";for(var n=this.head,i=""+n.data;n=n.next;)i+=r+n.data;return i},t.prototype.concat=function(r){if(this.length===0)return PN.alloc(0);for(var n=PN.allocUnsafe(r>>>0),i=this.head,o=0;i;)Uue(i.data,n,o),o+=i.data.length,i=i.next;return n},t}();rb&&rb.inspect&&rb.inspect.custom&&(_5.exports.prototype[rb.inspect.custom]=function(){var t=rb.inspect({length:this.length});return this.constructor.name+" "+t})});var x5=G((WNe,RN)=>{"use strict";p();var m2=Yg();function Fue(t,e){var r=this,n=this._readableState&&this._readableState.destroyed,i=this._writableState&&this._writableState.destroyed;return n||i?(e?e(t):t&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,m2.nextTick(y2,this,t)):m2.nextTick(y2,this,t)),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(t||null,function(o){!e&&o?r._writableState?r._writableState.errorEmitted||(r._writableState.errorEmitted=!0,m2.nextTick(y2,r,o)):m2.nextTick(y2,r,o):e&&e(o)}),this)}function zue(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finalCalled=!1,this._writableState.prefinished=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)}function y2(t,e){t.emit("error",e)}RN.exports={destroy:Fue,undestroy:zue}});var S5=G((KNe,MN)=>{p();MN.exports=$ue;function $ue(t,e){if(E5("noDeprecation"))return t;var r=!1;function n(){if(!r){if(E5("throwDeprecation"))throw new Error(e);E5("traceDeprecation")?console.trace(e):console.warn(e),r=!0}return t.apply(this,arguments)}return n}function E5(t){try{if(!globalThis.localStorage)return!1}catch{return!1}var e=globalThis.localStorage[t];return e==null?!1:String(e).toLowerCase()==="true"}});var T5=G((YNe,qN)=>{"use strict";p();var $l=Yg();qN.exports=Pn;function BN(t){var e=this;this.next=null,this.entry=null,this.finish=function(){ale(e,t)}}var Gue=!k.default.browser&&["v0.10","v0.9."].indexOf(k.default.version.slice(0,5))>-1?setImmediate:$l.nextTick,_0;Pn.WritableState=ib;var DN=Object.create(b0());DN.inherits=Je();var Hue={deprecate:S5()},CN=d5(),b2=d0().Buffer,Wue=(typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof self<"u"?self:{}).Uint8Array||function(){};function Vue(t){return b2.from(t)}function Kue(t){return b2.isBuffer(t)||t instanceof Wue}var ON=x5();DN.inherits(Pn,CN);function Zue(){}function ib(t,e){_0=_0||Gl(),t=t||{};var r=e instanceof _0;this.objectMode=!!t.objectMode,r&&(this.objectMode=this.objectMode||!!t.writableObjectMode);var n=t.highWaterMark,i=t.writableHighWaterMark,o=this.objectMode?16:16*1024;n||n===0?this.highWaterMark=n:r&&(i||i===0)?this.highWaterMark=i:this.highWaterMark=o,this.highWaterMark=Math.floor(this.highWaterMark),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var s=t.decodeStrings===!1;this.decodeStrings=!s,this.defaultEncoding=t.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(a){rle(e,a)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.bufferedRequestCount=0,this.corkedRequestsFree=new BN(this)}ib.prototype.getBuffer=function(){for(var e=this.bufferedRequest,r=[];e;)r.push(e),e=e.next;return r};(function(){try{Object.defineProperty(ib.prototype,"buffer",{get:Hue.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch{}})();var g2;typeof Symbol=="function"&&Symbol.hasInstance&&typeof Function.prototype[Symbol.hasInstance]=="function"?(g2=Function.prototype[Symbol.hasInstance],Object.defineProperty(Pn,Symbol.hasInstance,{value:function(t){return g2.call(this,t)?!0:this!==Pn?!1:t&&t._writableState instanceof ib}})):g2=function(t){return t instanceof this};function Pn(t){if(_0=_0||Gl(),!g2.call(Pn,this)&&!(this instanceof _0))return new Pn(t);this._writableState=new ib(t,this),this.writable=!0,t&&(typeof t.write=="function"&&(this._write=t.write),typeof t.writev=="function"&&(this._writev=t.writev),typeof t.destroy=="function"&&(this._destroy=t.destroy),typeof t.final=="function"&&(this._final=t.final)),CN.call(this)}Pn.prototype.pipe=function(){this.emit("error",new Error("Cannot pipe, not readable"))};function Yue(t,e){var r=new Error("write after end");t.emit("error",r),$l.nextTick(e,r)}function Jue(t,e,r,n){var i=!0,o=!1;return r===null?o=new TypeError("May not write null values to stream"):typeof r!="string"&&r!==void 0&&!e.objectMode&&(o=new TypeError("Invalid non-string/buffer chunk")),o&&(t.emit("error",o),$l.nextTick(n,o),i=!1),i}Pn.prototype.write=function(t,e,r){var n=this._writableState,i=!1,o=!n.objectMode&&Kue(t);return o&&!b2.isBuffer(t)&&(t=Vue(t)),typeof e=="function"&&(r=e,e=null),o?e="buffer":e||(e=n.defaultEncoding),typeof r!="function"&&(r=Zue),n.ended?Yue(this,r):(o||Jue(this,n,t,r))&&(n.pendingcb++,i=Que(this,n,o,t,e,r)),i};Pn.prototype.cork=function(){var t=this._writableState;t.corked++};Pn.prototype.uncork=function(){var t=this._writableState;t.corked&&(t.corked--,!t.writing&&!t.corked&&!t.bufferProcessing&&t.bufferedRequest&&jN(this,t))};Pn.prototype.setDefaultEncoding=function(e){if(typeof e=="string"&&(e=e.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((e+"").toLowerCase())>-1))throw new TypeError("Unknown encoding: "+e);return this._writableState.defaultEncoding=e,this};function Xue(t,e,r){return!t.objectMode&&t.decodeStrings!==!1&&typeof e=="string"&&(e=b2.from(e,r)),e}Object.defineProperty(Pn.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}});function Que(t,e,r,n,i,o){if(!r){var s=Xue(e,n,i);n!==s&&(r=!0,i="buffer",n=s)}var a=e.objectMode?1:n.length;e.length+=a;var c=e.length<e.highWaterMark;if(c||(e.needDrain=!0),e.writing||e.corked){var d=e.lastBufferedRequest;e.lastBufferedRequest={chunk:n,encoding:i,isBuf:r,callback:o,next:null},d?d.next=e.lastBufferedRequest:e.bufferedRequest=e.lastBufferedRequest,e.bufferedRequestCount+=1}else A5(t,e,!1,a,n,i,o);return c}function A5(t,e,r,n,i,o,s){e.writelen=n,e.writecb=s,e.writing=!0,e.sync=!0,r?t._writev(i,e.onwrite):t._write(i,o,e.onwrite),e.sync=!1}function ele(t,e,r,n,i){--e.pendingcb,r?($l.nextTick(i,n),$l.nextTick(nb,t,e),t._writableState.errorEmitted=!0,t.emit("error",n)):(i(n),t._writableState.errorEmitted=!0,t.emit("error",n),nb(t,e))}function tle(t){t.writing=!1,t.writecb=null,t.length-=t.writelen,t.writelen=0}function rle(t,e){var r=t._writableState,n=r.sync,i=r.writecb;if(tle(r),e)ele(t,r,n,e,i);else{var o=NN(r);!o&&!r.corked&&!r.bufferProcessing&&r.bufferedRequest&&jN(t,r),n?Gue(kN,t,r,o,i):kN(t,r,o,i)}}function kN(t,e,r,n){r||nle(t,e),e.pendingcb--,n(),nb(t,e)}function nle(t,e){e.length===0&&e.needDrain&&(e.needDrain=!1,t.emit("drain"))}function jN(t,e){e.bufferProcessing=!0;var r=e.bufferedRequest;if(t._writev&&r&&r.next){var n=e.bufferedRequestCount,i=new Array(n),o=e.corkedRequestsFree;o.entry=r;for(var s=0,a=!0;r;)i[s]=r,r.isBuf||(a=!1),r=r.next,s+=1;i.allBuffers=a,A5(t,e,!0,e.length,i,"",o.finish),e.pendingcb++,e.lastBufferedRequest=null,o.next?(e.corkedRequestsFree=o.next,o.next=null):e.corkedRequestsFree=new BN(e),e.bufferedRequestCount=0}else{for(;r;){var c=r.chunk,d=r.encoding,f=r.callback,u=e.objectMode?1:c.length;if(A5(t,e,!1,u,c,d,f),r=r.next,e.bufferedRequestCount--,e.writing)break}r===null&&(e.lastBufferedRequest=null)}e.bufferedRequest=r,e.bufferProcessing=!1}Pn.prototype._write=function(t,e,r){r(new Error("_write() is not implemented"))};Pn.prototype._writev=null;Pn.prototype.end=function(t,e,r){var n=this._writableState;typeof t=="function"?(r=t,t=null,e=null):typeof e=="function"&&(r=e,e=null),t!=null&&this.write(t,e),n.corked&&(n.corked=1,this.uncork()),n.ending||sle(this,n,r)};function NN(t){return t.ending&&t.length===0&&t.bufferedRequest===null&&!t.finished&&!t.writing}function ile(t,e){t._final(function(r){e.pendingcb--,r&&t.emit("error",r),e.prefinished=!0,t.emit("prefinish"),nb(t,e)})}function ole(t,e){!e.prefinished&&!e.finalCalled&&(typeof t._final=="function"?(e.pendingcb++,e.finalCalled=!0,$l.nextTick(ile,t,e)):(e.prefinished=!0,t.emit("prefinish")))}function nb(t,e){var r=NN(e);return r&&(ole(t,e),e.pendingcb===0&&(e.finished=!0,t.emit("finish"))),r}function sle(t,e,r){e.ending=!0,nb(t,e),r&&(e.finished?$l.nextTick(r):t.once("finish",r)),e.ended=!0,t.writable=!1}function ale(t,e,r){var n=t.entry;for(t.entry=null;n;){var i=n.callback;e.pendingcb--,i(r),n=n.next}e.corkedRequestsFree.next=t}Object.defineProperty(Pn.prototype,"destroyed",{get:function(){return this._writableState===void 0?!1:this._writableState.destroyed},set:function(t){this._writableState&&(this._writableState.destroyed=t)}});Pn.prototype.destroy=ON.destroy;Pn.prototype._undestroy=ON.undestroy;Pn.prototype._destroy=function(t,e){this.end(),e(t)}});var Gl=G((XNe,zN)=>{"use strict";p();var LN=Yg(),cle=Object.keys||function(t){var e=[];for(var r in t)e.push(r);return e};zN.exports=vd;var UN=Object.create(b0());UN.inherits=Je();var FN=R5(),I5=T5();UN.inherits(vd,FN);for(P5=cle(I5.prototype),v2=0;v2<P5.length;v2++)w2=P5[v2],vd.prototype[w2]||(vd.prototype[w2]=I5.prototype[w2]);var P5,w2,v2;function vd(t){if(!(this instanceof vd))return new vd(t);FN.call(this,t),I5.call(this,t),t&&t.readable===!1&&(this.readable=!1),t&&t.writable===!1&&(this.writable=!1),this.allowHalfOpen=!0,t&&t.allowHalfOpen===!1&&(this.allowHalfOpen=!1),this.once("end",dle)}Object.defineProperty(vd.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}});function dle(){this.allowHalfOpen||this._writableState.ended||LN.nextTick(fle,this)}function fle(t){t.end()}Object.defineProperty(vd.prototype,"destroyed",{get:function(){return this._readableState===void 0||this._writableState===void 0?!1:this._readableState.destroyed&&this._writableState.destroyed},set:function(t){this._readableState===void 0||this._writableState===void 0||(this._readableState.destroyed=t,this._writableState.destroyed=t)}});vd.prototype._destroy=function(t,e){this.push(null),this.end(),LN.nextTick(e,t)}});var B5=G(GN=>{"use strict";p();var k5=d0().Buffer,$N=k5.isEncoding||function(t){switch(t=""+t,t&&t.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function ule(t){if(!t)return"utf8";for(var e;;)switch(t){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return t;default:if(e)return;t=(""+t).toLowerCase(),e=!0}}function lle(t){var e=ule(t);if(typeof e!="string"&&(k5.isEncoding===$N||!$N(t)))throw new Error("Unknown encoding: "+t);return e||t}GN.StringDecoder=ob;function ob(t){this.encoding=lle(t);var e;switch(this.encoding){case"utf16le":this.text=ble,this.end=vle,e=4;break;case"utf8":this.fillLast=mle,e=4;break;case"base64":this.text=wle,this.end=_le,e=3;break;default:this.write=xle,this.end=Ele;return}this.lastNeed=0,this.lastTotal=0,this.lastChar=k5.allocUnsafe(e)}ob.prototype.write=function(t){if(t.length===0)return"";var e,r;if(this.lastNeed){if(e=this.fillLast(t),e===void 0)return"";r=this.lastNeed,this.lastNeed=0}else r=0;return r<t.length?e?e+this.text(t,r):this.text(t,r):e||""};ob.prototype.end=gle;ob.prototype.text=yle;ob.prototype.fillLast=function(t){if(this.lastNeed<=t.length)return t.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);t.copy(this.lastChar,this.lastTotal-this.lastNeed,0,t.length),this.lastNeed-=t.length};function M5(t){return t<=127?0:t>>5===6?2:t>>4===14?3:t>>3===30?4:t>>6===2?-1:-2}function hle(t,e,r){var n=e.length-1;if(n<r)return 0;var i=M5(e[n]);return i>=0?(i>0&&(t.lastNeed=i-1),i):--n<r||i===-2?0:(i=M5(e[n]),i>=0?(i>0&&(t.lastNeed=i-2),i):--n<r||i===-2?0:(i=M5(e[n]),i>=0?(i>0&&(i===2?i=0:t.lastNeed=i-3),i):0))}function ple(t,e,r){if((e[0]&192)!==128)return t.lastNeed=0,"\uFFFD";if(t.lastNeed>1&&e.length>1){if((e[1]&192)!==128)return t.lastNeed=1,"\uFFFD";if(t.lastNeed>2&&e.length>2&&(e[2]&192)!==128)return t.lastNeed=2,"\uFFFD"}}function mle(t){var e=this.lastTotal-this.lastNeed,r=ple(this,t,e);if(r!==void 0)return r;if(this.lastNeed<=t.length)return t.copy(this.lastChar,e,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);t.copy(this.lastChar,e,0,t.length),this.lastNeed-=t.length}function yle(t,e){var r=hle(this,t,e);if(!this.lastNeed)return t.toString("utf8",e);this.lastTotal=r;var n=t.length-(r-this.lastNeed);return t.copy(this.lastChar,0,n),t.toString("utf8",e,n)}function gle(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+"\uFFFD":e}function ble(t,e){if((t.length-e)%2===0){var r=t.toString("utf16le",e);if(r){var n=r.charCodeAt(r.length-1);if(n>=55296&&n<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=t[t.length-2],this.lastChar[1]=t[t.length-1],r.slice(0,-1)}return r}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=t[t.length-1],t.toString("utf16le",e,t.length-1)}function vle(t){var e=t&&t.length?this.write(t):"";if(this.lastNeed){var r=this.lastTotal-this.lastNeed;return e+this.lastChar.toString("utf16le",0,r)}return e}function wle(t,e){var r=(t.length-e)%3;return r===0?t.toString("base64",e):(this.lastNeed=3-r,this.lastTotal=3,r===1?this.lastChar[0]=t[t.length-1]:(this.lastChar[0]=t[t.length-2],this.lastChar[1]=t[t.length-1]),t.toString("base64",e,t.length-r))}function _le(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+this.lastChar.toString("base64",0,3-this.lastNeed):e}function xle(t){return t.toString(this.encoding)}function Ele(t){return t&&t.length?this.write(t):""}});var R5=G((nqe,rq)=>{"use strict";p();var E0=Yg();rq.exports=Lr;var Sle=kj(),sb;Lr.ReadableState=JN;var rqe=nc().EventEmitter,KN=function(t,e){return t.listeners(e).length},N5=d5(),ab=d0().Buffer,Ale=(typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof self<"u"?self:{}).Uint8Array||function(){};function Tle(t){return ab.from(t)}function Ple(t){return ab.isBuffer(t)||t instanceof Ale}var ZN=Object.create(b0());ZN.inherits=Je();var D5=tb(),ar=void 0;D5&&D5.debuglog?ar=D5.debuglog("stream"):ar=function(){};var Ile=IN(),YN=x5(),x0;ZN.inherits(Lr,N5);var C5=["error","close","destroy","pause","resume"];function Rle(t,e,r){if(typeof t.prependListener=="function")return t.prependListener(e,r);!t._events||!t._events[e]?t.on(e,r):Sle(t._events[e])?t._events[e].unshift(r):t._events[e]=[r,t._events[e]]}function JN(t,e){sb=sb||Gl(),t=t||{};var r=e instanceof sb;this.objectMode=!!t.objectMode,r&&(this.objectMode=this.objectMode||!!t.readableObjectMode);var n=t.highWaterMark,i=t.readableHighWaterMark,o=this.objectMode?16:16*1024;n||n===0?this.highWaterMark=n:r&&(i||i===0)?this.highWaterMark=i:this.highWaterMark=o,this.highWaterMark=Math.floor(this.highWaterMark),this.buffer=new Ile,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.destroyed=!1,this.defaultEncoding=t.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,t.encoding&&(x0||(x0=B5().StringDecoder),this.decoder=new x0(t.encoding),this.encoding=t.encoding)}function Lr(t){if(sb=sb||Gl(),!(this instanceof Lr))return new Lr(t);this._readableState=new JN(t,this),this.readable=!0,t&&(typeof t.read=="function"&&(this._read=t.read),typeof t.destroy=="function"&&(this._destroy=t.destroy)),N5.call(this)}Object.defineProperty(Lr.prototype,"destroyed",{get:function(){return this._readableState===void 0?!1:this._readableState.destroyed},set:function(t){this._readableState&&(this._readableState.destroyed=t)}});Lr.prototype.destroy=YN.destroy;Lr.prototype._undestroy=YN.undestroy;Lr.prototype._destroy=function(t,e){this.push(null),e(t)};Lr.prototype.push=function(t,e){var r=this._readableState,n;return r.objectMode?n=!0:typeof t=="string"&&(e=e||r.defaultEncoding,e!==r.encoding&&(t=ab.from(t,e),e=""),n=!0),XN(this,t,e,!1,n)};Lr.prototype.unshift=function(t){return XN(this,t,null,!0,!1)};function XN(t,e,r,n,i){var o=t._readableState;if(e===null)o.reading=!1,Dle(t,o);else{var s;i||(s=Mle(o,e)),s?t.emit("error",s):o.objectMode||e&&e.length>0?(typeof e!="string"&&!o.objectMode&&Object.getPrototypeOf(e)!==ab.prototype&&(e=Tle(e)),n?o.endEmitted?t.emit("error",new Error("stream.unshift() after end event")):O5(t,o,e,!0):o.ended?t.emit("error",new Error("stream.push() after EOF")):(o.reading=!1,o.decoder&&!r?(e=o.decoder.write(e),o.objectMode||e.length!==0?O5(t,o,e,!1):QN(t,o)):O5(t,o,e,!1))):n||(o.reading=!1)}return kle(o)}function O5(t,e,r,n){e.flowing&&e.length===0&&!e.sync?(t.emit("data",r),t.read(0)):(e.length+=e.objectMode?1:r.length,n?e.buffer.unshift(r):e.buffer.push(r),e.needReadable&&_2(t)),QN(t,e)}function Mle(t,e){var r;return!Ple(e)&&typeof e!="string"&&e!==void 0&&!t.objectMode&&(r=new TypeError("Invalid non-string/buffer chunk")),r}function kle(t){return!t.ended&&(t.needReadable||t.length<t.highWaterMark||t.length===0)}Lr.prototype.isPaused=function(){return this._readableState.flowing===!1};Lr.prototype.setEncoding=function(t){return x0||(x0=B5().StringDecoder),this._readableState.decoder=new x0(t),this._readableState.encoding=t,this};var HN=8388608;function Ble(t){return t>=HN?t=HN:(t--,t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,t|=t>>>16,t++),t}function WN(t,e){return t<=0||e.length===0&&e.ended?0:e.objectMode?1:t!==t?e.flowing&&e.length?e.buffer.head.data.length:e.length:(t>e.highWaterMark&&(e.highWaterMark=Ble(t)),t<=e.length?t:e.ended?e.length:(e.needReadable=!0,0))}Lr.prototype.read=function(t){ar("read",t),t=parseInt(t,10);var e=this._readableState,r=t;if(t!==0&&(e.emittedReadable=!1),t===0&&e.needReadable&&(e.length>=e.highWaterMark||e.ended))return ar("read: emitReadable",e.length,e.ended),e.length===0&&e.ended?j5(this):_2(this),null;if(t=WN(t,e),t===0&&e.ended)return e.length===0&&j5(this),null;var n=e.needReadable;ar("need readable",n),(e.length===0||e.length-t<e.highWaterMark)&&(n=!0,ar("length less than watermark",n)),e.ended||e.reading?(n=!1,ar("reading or ended",n)):n&&(ar("do read"),e.reading=!0,e.sync=!0,e.length===0&&(e.needReadable=!0),this._read(e.highWaterMark),e.sync=!1,e.reading||(t=WN(r,e)));var i;return t>0?i=eq(t,e):i=null,i===null?(e.needReadable=!0,t=0):e.length-=t,e.length===0&&(e.ended||(e.needReadable=!0),r!==t&&e.ended&&j5(this)),i!==null&&this.emit("data",i),i};function Dle(t,e){if(!e.ended){if(e.decoder){var r=e.decoder.end();r&&r.length&&(e.buffer.push(r),e.length+=e.objectMode?1:r.length)}e.ended=!0,_2(t)}}function _2(t){var e=t._readableState;e.needReadable=!1,e.emittedReadable||(ar("emitReadable",e.flowing),e.emittedReadable=!0,e.sync?E0.nextTick(VN,t):VN(t))}function VN(t){ar("emit readable"),t.emit("readable"),q5(t)}function QN(t,e){e.readingMore||(e.readingMore=!0,E0.nextTick(Cle,t,e))}function Cle(t,e){for(var r=e.length;!e.reading&&!e.flowing&&!e.ended&&e.length<e.highWaterMark&&(ar("maybeReadMore read 0"),t.read(0),r!==e.length);)r=e.length;e.readingMore=!1}Lr.prototype._read=function(t){this.emit("error",new Error("_read() is not implemented"))};Lr.prototype.pipe=function(t,e){var r=this,n=this._readableState;switch(n.pipesCount){case 0:n.pipes=t;break;case 1:n.pipes=[n.pipes,t];break;default:n.pipes.push(t);break}n.pipesCount+=1,ar("pipe count=%d opts=%j",n.pipesCount,e);var i=(!e||e.end!==!1)&&t!==k.default.stdout&&t!==k.default.stderr,o=i?a:T;n.endEmitted?E0.nextTick(o):r.once("end",o),t.on("unpipe",s);function s(M,D){ar("onunpipe"),M===r&&D&&D.hasUnpiped===!1&&(D.hasUnpiped=!0,f())}function a(){ar("onend"),t.end()}var c=Ole(r);t.on("drain",c);var d=!1;function f(){ar("cleanup"),t.removeListener("close",v),t.removeListener("finish",A),t.removeListener("drain",c),t.removeListener("error",_),t.removeListener("unpipe",s),r.removeListener("end",a),r.removeListener("end",T),r.removeListener("data",m),d=!0,n.awaitDrain&&(!t._writableState||t._writableState.needDrain)&&c()}var u=!1;r.on("data",m);function m(M){ar("ondata"),u=!1;var D=t.write(M);D===!1&&!u&&((n.pipesCount===1&&n.pipes===t||n.pipesCount>1&&tq(n.pipes,t)!==-1)&&!d&&(ar("false write response, pause",n.awaitDrain),n.awaitDrain++,u=!0),r.pause())}function _(M){ar("onerror",M),T(),t.removeListener("error",_),KN(t,"error")===0&&t.emit("error",M)}Rle(t,"error",_);function v(){t.removeListener("finish",A),T()}t.once("close",v);function A(){ar("onfinish"),t.removeListener("close",v),T()}t.once("finish",A);function T(){ar("unpipe"),r.unpipe(t)}return t.emit("pipe",r),n.flowing||(ar("pipe resume"),r.resume()),t};function Ole(t){return function(){var e=t._readableState;ar("pipeOnDrain",e.awaitDrain),e.awaitDrain&&e.awaitDrain--,e.awaitDrain===0&&KN(t,"data")&&(e.flowing=!0,q5(t))}}Lr.prototype.unpipe=function(t){var e=this._readableState,r={hasUnpiped:!1};if(e.pipesCount===0)return this;if(e.pipesCount===1)return t&&t!==e.pipes?this:(t||(t=e.pipes),e.pipes=null,e.pipesCount=0,e.flowing=!1,t&&t.emit("unpipe",this,r),this);if(!t){var n=e.pipes,i=e.pipesCount;e.pipes=null,e.pipesCount=0,e.flowing=!1;for(var o=0;o<i;o++)n[o].emit("unpipe",this,{hasUnpiped:!1});return this}var s=tq(e.pipes,t);return s===-1?this:(e.pipes.splice(s,1),e.pipesCount-=1,e.pipesCount===1&&(e.pipes=e.pipes[0]),t.emit("unpipe",this,r),this)};Lr.prototype.on=function(t,e){var r=N5.prototype.on.call(this,t,e);if(t==="data")this._readableState.flowing!==!1&&this.resume();else if(t==="readable"){var n=this._readableState;!n.endEmitted&&!n.readableListening&&(n.readableListening=n.needReadable=!0,n.emittedReadable=!1,n.reading?n.length&&_2(this):E0.nextTick(jle,this))}return r};Lr.prototype.addListener=Lr.prototype.on;function jle(t){ar("readable nexttick read 0"),t.read(0)}Lr.prototype.resume=function(){var t=this._readableState;return t.flowing||(ar("resume"),t.flowing=!0,Nle(this,t)),this};function Nle(t,e){e.resumeScheduled||(e.resumeScheduled=!0,E0.nextTick(qle,t,e))}function qle(t,e){e.reading||(ar("resume read 0"),t.read(0)),e.resumeScheduled=!1,e.awaitDrain=0,t.emit("resume"),q5(t),e.flowing&&!e.reading&&t.read(0)}Lr.prototype.pause=function(){return ar("call pause flowing=%j",this._readableState.flowing),this._readableState.flowing!==!1&&(ar("pause"),this._readableState.flowing=!1,this.emit("pause")),this};function q5(t){var e=t._readableState;for(ar("flow",e.flowing);e.flowing&&t.read()!==null;);}Lr.prototype.wrap=function(t){var e=this,r=this._readableState,n=!1;t.on("end",function(){if(ar("wrapped end"),r.decoder&&!r.ended){var s=r.decoder.end();s&&s.length&&e.push(s)}e.push(null)}),t.on("data",function(s){if(ar("wrapped data"),r.decoder&&(s=r.decoder.write(s)),!(r.objectMode&&s==null)&&!(!r.objectMode&&(!s||!s.length))){var a=e.push(s);a||(n=!0,t.pause())}});for(var i in t)this[i]===void 0&&typeof t[i]=="function"&&(this[i]=function(s){return function(){return t[s].apply(t,arguments)}}(i));for(var o=0;o<C5.length;o++)t.on(C5[o],this.emit.bind(this,C5[o]));return this._read=function(s){ar("wrapped _read",s),n&&(n=!1,t.resume())},this};Object.defineProperty(Lr.prototype,"readableHighWaterMark",{enumerable:!1,get:function(){return this._readableState.highWaterMark}});Lr._fromList=eq;function eq(t,e){if(e.length===0)return null;var r;return e.objectMode?r=e.buffer.shift():!t||t>=e.length?(e.decoder?r=e.buffer.join(""):e.buffer.length===1?r=e.buffer.head.data:r=e.buffer.concat(e.length),e.buffer.clear()):r=Lle(t,e.buffer,e.decoder),r}function Lle(t,e,r){var n;return t<e.head.data.length?(n=e.head.data.slice(0,t),e.head.data=e.head.data.slice(t)):t===e.head.data.length?n=e.shift():n=r?Ule(t,e):Fle(t,e),n}function Ule(t,e){var r=e.head,n=1,i=r.data;for(t-=i.length;r=r.next;){var o=r.data,s=t>o.length?o.length:t;if(s===o.length?i+=o:i+=o.slice(0,t),t-=s,t===0){s===o.length?(++n,r.next?e.head=r.next:e.head=e.tail=null):(e.head=r,r.data=o.slice(s));break}++n}return e.length-=n,i}function Fle(t,e){var r=ab.allocUnsafe(t),n=e.head,i=1;for(n.data.copy(r),t-=n.data.length;n=n.next;){var o=n.data,s=t>o.length?o.length:t;if(o.copy(r,r.length-t,0,s),t-=s,t===0){s===o.length?(++i,n.next?e.head=n.next:e.head=e.tail=null):(e.head=n,n.data=o.slice(s));break}++i}return e.length-=i,r}function j5(t){var e=t._readableState;if(e.length>0)throw new Error('"endReadable()" called on non-empty stream');e.endEmitted||(e.ended=!0,E0.nextTick(zle,e,t))}function zle(t,e){!t.endEmitted&&t.length===0&&(t.endEmitted=!0,e.readable=!1,e.emit("end"))}function tq(t,e){for(var r=0,n=t.length;r<n;r++)if(t[r]===e)return r;return-1}});var L5=G((oqe,oq)=>{"use strict";p();oq.exports=wd;var x2=Gl(),iq=Object.create(b0());iq.inherits=Je();iq.inherits(wd,x2);function $le(t,e){var r=this._transformState;r.transforming=!1;var n=r.writecb;if(!n)return this.emit("error",new Error("write callback called multiple times"));r.writechunk=null,r.writecb=null,e!=null&&this.push(e),n(t);var i=this._readableState;i.reading=!1,(i.needReadable||i.length<i.highWaterMark)&&this._read(i.highWaterMark)}function wd(t){if(!(this instanceof wd))return new wd(t);x2.call(this,t),this._transformState={afterTransform:$le.bind(this),needTransform:!1,transforming:!1,writecb:null,writechunk:null,writeencoding:null},this._readableState.needReadable=!0,this._readableState.sync=!1,t&&(typeof t.transform=="function"&&(this._transform=t.transform),typeof t.flush=="function"&&(this._flush=t.flush)),this.on("prefinish",Gle)}function Gle(){var t=this;typeof this._flush=="function"?this._flush(function(e,r){nq(t,e,r)}):nq(this,null,null)}wd.prototype.push=function(t,e){return this._transformState.needTransform=!1,x2.prototype.push.call(this,t,e)};wd.prototype._transform=function(t,e,r){throw new Error("_transform() is not implemented")};wd.prototype._write=function(t,e,r){var n=this._transformState;if(n.writecb=r,n.writechunk=t,n.writeencoding=e,!n.transforming){var i=this._readableState;(n.needTransform||i.needReadable||i.length<i.highWaterMark)&&this._read(i.highWaterMark)}};wd.prototype._read=function(t){var e=this._transformState;e.writechunk!==null&&e.writecb&&!e.transforming?(e.transforming=!0,this._transform(e.writechunk,e.writeencoding,e.afterTransform)):e.needTransform=!0};wd.prototype._destroy=function(t,e){var r=this;x2.prototype._destroy.call(this,t,function(n){e(n),r.emit("close")})};function nq(t,e,r){if(e)return t.emit("error",e);if(r!=null&&t.push(r),t._writableState.length)throw new Error("Calling transform done when ws.length != 0");if(t._transformState.transforming)throw new Error("Calling transform done when still transforming");return t.push(null)}});var dq=G((aqe,cq)=>{"use strict";p();cq.exports=cb;var sq=L5(),aq=Object.create(b0());aq.inherits=Je();aq.inherits(cb,sq);function cb(t){if(!(this instanceof cb))return new cb(t);sq.call(this,t)}cb.prototype._transform=function(t,e,r){r(null,t)}});var U5=G((ic,fq)=>{p();ic=fq.exports=R5();ic.Stream=ic;ic.Readable=ic;ic.Writable=T5();ic.Duplex=Gl();ic.Transform=L5();ic.PassThrough=dq()});var F5=G((fqe,lq)=>{"use strict";p();var Hle=it().Buffer,Wle=Rj(),uq=U5().Transform,Vle=Je();function zf(t){uq.call(this),this._block=Hle.allocUnsafe(t),this._blockSize=t,this._blockOffset=0,this._length=[0,0,0,0],this._finalized=!1}Vle(zf,uq);zf.prototype._transform=function(t,e,r){var n=null;try{this.update(t,e)}catch(i){n=i}r(n)};zf.prototype._flush=function(t){var e=null;try{this.push(this.digest())}catch(r){e=r}t(e)};zf.prototype.update=function(t,e){if(this._finalized)throw new Error("Digest already called");for(var r=Wle(t,e),n=this._block,i=0;this._blockOffset+r.length-i>=this._blockSize;){for(var o=this._blockOffset;o<this._blockSize;)n[o]=r[i],o+=1,i+=1;this._update(),this._blockOffset=0}for(;i<r.length;)n[this._blockOffset]=r[i],this._blockOffset+=1,i+=1;for(var s=0,a=r.length*8;a>0;++s)this._length[s]+=a,a=this._length[s]/4294967296|0,a>0&&(this._length[s]-=4294967296*a);return this};zf.prototype._update=function(){throw new Error("_update is not implemented")};zf.prototype.digest=function(t){if(this._finalized)throw new Error("Digest already called");this._finalized=!0;var e=this._digest();t!==void 0&&(e=e.toString(t)),this._block.fill(0),this._blockOffset=0;for(var r=0;r<4;++r)this._length[r]=0;return e};zf.prototype._digest=function(){throw new Error("_digest is not implemented")};lq.exports=zf});var A2=G((lqe,pq)=>{"use strict";p();var Kle=Je(),hq=F5(),Zle=it().Buffer,Yle=new Array(16);function E2(){hq.call(this,64),this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878}Kle(E2,hq);E2.prototype._update=function(){for(var t=Yle,e=0;e<16;++e)t[e]=this._block.readInt32LE(e*4);var r=this._a,n=this._b,i=this._c,o=this._d;r=Ni(r,n,i,o,t[0],3614090360,7),o=Ni(o,r,n,i,t[1],3905402710,12),i=Ni(i,o,r,n,t[2],606105819,17),n=Ni(n,i,o,r,t[3],3250441966,22),r=Ni(r,n,i,o,t[4],4118548399,7),o=Ni(o,r,n,i,t[5],1200080426,12),i=Ni(i,o,r,n,t[6],2821735955,17),n=Ni(n,i,o,r,t[7],4249261313,22),r=Ni(r,n,i,o,t[8],1770035416,7),o=Ni(o,r,n,i,t[9],2336552879,12),i=Ni(i,o,r,n,t[10],4294925233,17),n=Ni(n,i,o,r,t[11],2304563134,22),r=Ni(r,n,i,o,t[12],1804603682,7),o=Ni(o,r,n,i,t[13],4254626195,12),i=Ni(i,o,r,n,t[14],2792965006,17),n=Ni(n,i,o,r,t[15],1236535329,22),r=qi(r,n,i,o,t[1],4129170786,5),o=qi(o,r,n,i,t[6],3225465664,9),i=qi(i,o,r,n,t[11],643717713,14),n=qi(n,i,o,r,t[0],3921069994,20),r=qi(r,n,i,o,t[5],3593408605,5),o=qi(o,r,n,i,t[10],38016083,9),i=qi(i,o,r,n,t[15],3634488961,14),n=qi(n,i,o,r,t[4],3889429448,20),r=qi(r,n,i,o,t[9],568446438,5),o=qi(o,r,n,i,t[14],3275163606,9),i=qi(i,o,r,n,t[3],4107603335,14),n=qi(n,i,o,r,t[8],1163531501,20),r=qi(r,n,i,o,t[13],2850285829,5),o=qi(o,r,n,i,t[2],4243563512,9),i=qi(i,o,r,n,t[7],1735328473,14),n=qi(n,i,o,r,t[12],2368359562,20),r=Li(r,n,i,o,t[5],4294588738,4),o=Li(o,r,n,i,t[8],2272392833,11),i=Li(i,o,r,n,t[11],1839030562,16),n=Li(n,i,o,r,t[14],4259657740,23),r=Li(r,n,i,o,t[1],2763975236,4),o=Li(o,r,n,i,t[4],1272893353,11),i=Li(i,o,r,n,t[7],4139469664,16),n=Li(n,i,o,r,t[10],3200236656,23),r=Li(r,n,i,o,t[13],681279174,4),o=Li(o,r,n,i,t[0],3936430074,11),i=Li(i,o,r,n,t[3],3572445317,16),n=Li(n,i,o,r,t[6],76029189,23),r=Li(r,n,i,o,t[9],3654602809,4),o=Li(o,r,n,i,t[12],3873151461,11),i=Li(i,o,r,n,t[15],530742520,16),n=Li(n,i,o,r,t[2],3299628645,23),r=Ui(r,n,i,o,t[0],4096336452,6),o=Ui(o,r,n,i,t[7],1126891415,10),i=Ui(i,o,r,n,t[14],2878612391,15),n=Ui(n,i,o,r,t[5],4237533241,21),r=Ui(r,n,i,o,t[12],1700485571,6),o=Ui(o,r,n,i,t[3],2399980690,10),i=Ui(i,o,r,n,t[10],4293915773,15),n=Ui(n,i,o,r,t[1],2240044497,21),r=Ui(r,n,i,o,t[8],1873313359,6),o=Ui(o,r,n,i,t[15],4264355552,10),i=Ui(i,o,r,n,t[6],2734768916,15),n=Ui(n,i,o,r,t[13],1309151649,21),r=Ui(r,n,i,o,t[4],4149444226,6),o=Ui(o,r,n,i,t[11],3174756917,10),i=Ui(i,o,r,n,t[2],718787259,15),n=Ui(n,i,o,r,t[9],3951481745,21),this._a=this._a+r|0,this._b=this._b+n|0,this._c=this._c+i|0,this._d=this._d+o|0};E2.prototype._digest=function(){this._block[this._blockOffset++]=128,this._blockOffset>56&&(this._block.fill(0,this._blockOffset,64),this._update(),this._blockOffset=0),this._block.fill(0,this._blockOffset,56),this._block.writeUInt32LE(this._length[0],56),this._block.writeUInt32LE(this._length[1],60),this._update();var t=Zle.allocUnsafe(16);return t.writeInt32LE(this._a,0),t.writeInt32LE(this._b,4),t.writeInt32LE(this._c,8),t.writeInt32LE(this._d,12),t};function S2(t,e){return t<<e|t>>>32-e}function Ni(t,e,r,n,i,o,s){return S2(t+(e&r|~e&n)+i+o|0,s)+e|0}function qi(t,e,r,n,i,o,s){return S2(t+(e&n|r&~n)+i+o|0,s)+e|0}function Li(t,e,r,n,i,o,s){return S2(t+(e^r^n)+i+o|0,s)+e|0}function Ui(t,e,r,n,i,o,s){return S2(t+(r^(e|~n))+i+o|0,s)+e|0}pq.exports=E2});var P2=G((pqe,_q)=>{"use strict";p();var z5=jr().Buffer,Jle=Je(),wq=F5(),Xle=new Array(16),db=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13],fb=[5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11],ub=[11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6],lb=[8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11],hb=[0,1518500249,1859775393,2400959708,2840853838],pb=[1352829926,1548603684,1836072691,2053994217,0];function Hl(t,e){return t<<e|t>>>32-e}function mq(t,e,r,n,i,o,s,a){return Hl(t+(e^r^n)+o+s|0,a)+i|0}function yq(t,e,r,n,i,o,s,a){return Hl(t+(e&r|~e&n)+o+s|0,a)+i|0}function gq(t,e,r,n,i,o,s,a){return Hl(t+((e|~r)^n)+o+s|0,a)+i|0}function bq(t,e,r,n,i,o,s,a){return Hl(t+(e&n|r&~n)+o+s|0,a)+i|0}function vq(t,e,r,n,i,o,s,a){return Hl(t+(e^(r|~n))+o+s|0,a)+i|0}function T2(){wq.call(this,64),this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520}Jle(T2,wq);T2.prototype._update=function(){for(var t=Xle,e=0;e<16;++e)t[e]=this._block.readInt32LE(e*4);for(var r=this._a|0,n=this._b|0,i=this._c|0,o=this._d|0,s=this._e|0,a=this._a|0,c=this._b|0,d=this._c|0,f=this._d|0,u=this._e|0,m=0;m<80;m+=1){var _,v;m<16?(_=mq(r,n,i,o,s,t[db[m]],hb[0],ub[m]),v=vq(a,c,d,f,u,t[fb[m]],pb[0],lb[m])):m<32?(_=yq(r,n,i,o,s,t[db[m]],hb[1],ub[m]),v=bq(a,c,d,f,u,t[fb[m]],pb[1],lb[m])):m<48?(_=gq(r,n,i,o,s,t[db[m]],hb[2],ub[m]),v=gq(a,c,d,f,u,t[fb[m]],pb[2],lb[m])):m<64?(_=bq(r,n,i,o,s,t[db[m]],hb[3],ub[m]),v=yq(a,c,d,f,u,t[fb[m]],pb[3],lb[m])):(_=vq(r,n,i,o,s,t[db[m]],hb[4],ub[m]),v=mq(a,c,d,f,u,t[fb[m]],pb[4],lb[m])),r=s,s=o,o=Hl(i,10),i=n,n=_,a=u,u=f,f=Hl(d,10),d=c,c=v}var A=this._b+i+f|0;this._b=this._c+o+u|0,this._c=this._d+s+a|0,this._d=this._e+r+c|0,this._e=this._a+n+d|0,this._a=A};T2.prototype._digest=function(){this._block[this._blockOffset]=128,this._blockOffset+=1,this._blockOffset>56&&(this._block.fill(0,this._blockOffset,64),this._update(),this._blockOffset=0),this._block.fill(0,this._blockOffset,56),this._block.writeUInt32LE(this._length[0],56),this._block.writeUInt32LE(this._length[1],60),this._update();var t=z5.alloc?z5.alloc(20):new z5(20);return t.writeInt32LE(this._a,0),t.writeInt32LE(this._b,4),t.writeInt32LE(this._c,8),t.writeInt32LE(this._d,12),t.writeInt32LE(this._e,16),t};_q.exports=T2});var Wl=G((yqe,xq)=>{"use strict";p();var Qle=it().Buffer,ehe=Zg();function I2(t,e){this._block=Qle.alloc(t),this._finalSize=e,this._blockSize=t,this._len=0}I2.prototype.update=function(t,e){t=ehe(t,e||"utf8");for(var r=this._block,n=this._blockSize,i=t.length,o=this._len,s=0;s<i;){for(var a=o%n,c=Math.min(i-s,n-a),d=0;d<c;d++)r[a+d]=t[s+d];o+=c,s+=c,o%n===0&&this._update(r)}return this._len+=i,this};I2.prototype.digest=function(t){var e=this._len%this._blockSize;this._block[e]=128,this._block.fill(0,e+1),e>=this._finalSize&&(this._update(this._block),this._block.fill(0));var r=this._len*8;if(r<=4294967295)this._block.writeUInt32BE(r,this._blockSize-4);else{var n=(r&4294967295)>>>0,i=(r-n)/4294967296;this._block.writeUInt32BE(i,this._blockSize-8),this._block.writeUInt32BE(n,this._blockSize-4)}this._update(this._block);var o=this._hash();return t?o.toString(t):o};I2.prototype._update=function(){throw new Error("_update must be implemented by subclass")};xq.exports=I2});var Aq=G((bqe,Sq)=>{"use strict";p();var the=Je(),Eq=Wl(),rhe=it().Buffer,nhe=[1518500249,1859775393,-1894007588,-899497514],ihe=new Array(80);function mb(){this.init(),this._w=ihe,Eq.call(this,64,56)}the(mb,Eq);mb.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this};function ohe(t){return t<<5|t>>>27}function she(t){return t<<30|t>>>2}function ahe(t,e,r,n){return t===0?e&r|~e&n:t===2?e&r|e&n|r&n:e^r^n}mb.prototype._update=function(t){for(var e=this._w,r=this._a|0,n=this._b|0,i=this._c|0,o=this._d|0,s=this._e|0,a=0;a<16;++a)e[a]=t.readInt32BE(a*4);for(;a<80;++a)e[a]=e[a-3]^e[a-8]^e[a-14]^e[a-16];for(var c=0;c<80;++c){var d=~~(c/20),f=ohe(r)+ahe(d,n,i,o)+s+e[c]+nhe[d]|0;s=o,o=i,i=she(n),n=r,r=f}this._a=r+this._a|0,this._b=n+this._b|0,this._c=i+this._c|0,this._d=o+this._d|0,this._e=s+this._e|0};mb.prototype._hash=function(){var t=rhe.allocUnsafe(20);return t.writeInt32BE(this._a|0,0),t.writeInt32BE(this._b|0,4),t.writeInt32BE(this._c|0,8),t.writeInt32BE(this._d|0,12),t.writeInt32BE(this._e|0,16),t};Sq.exports=mb});var Iq=G((wqe,Pq)=>{"use strict";p();var che=Je(),Tq=Wl(),dhe=it().Buffer,fhe=[1518500249,1859775393,-1894007588,-899497514],uhe=new Array(80);function yb(){this.init(),this._w=uhe,Tq.call(this,64,56)}che(yb,Tq);yb.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this};function lhe(t){return t<<1|t>>>31}function hhe(t){return t<<5|t>>>27}function phe(t){return t<<30|t>>>2}function mhe(t,e,r,n){return t===0?e&r|~e&n:t===2?e&r|e&n|r&n:e^r^n}yb.prototype._update=function(t){for(var e=this._w,r=this._a|0,n=this._b|0,i=this._c|0,o=this._d|0,s=this._e|0,a=0;a<16;++a)e[a]=t.readInt32BE(a*4);for(;a<80;++a)e[a]=lhe(e[a-3]^e[a-8]^e[a-14]^e[a-16]);for(var c=0;c<80;++c){var d=~~(c/20),f=hhe(r)+mhe(d,n,i,o)+s+e[c]+fhe[d]|0;s=o,o=i,i=phe(n),n=r,r=f}this._a=r+this._a|0,this._b=n+this._b|0,this._c=i+this._c|0,this._d=o+this._d|0,this._e=s+this._e|0};yb.prototype._hash=function(){var t=dhe.allocUnsafe(20);return t.writeInt32BE(this._a|0,0),t.writeInt32BE(this._b|0,4),t.writeInt32BE(this._c|0,8),t.writeInt32BE(this._d|0,12),t.writeInt32BE(this._e|0,16),t};Pq.exports=yb});var $5=G((xqe,Mq)=>{"use strict";p();var yhe=Je(),Rq=Wl(),ghe=it().Buffer,bhe=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298],vhe=new Array(64);function gb(){this.init(),this._w=vhe,Rq.call(this,64,56)}yhe(gb,Rq);gb.prototype.init=function(){return this._a=1779033703,this._b=3144134277,this._c=1013904242,this._d=2773480762,this._e=1359893119,this._f=2600822924,this._g=528734635,this._h=1541459225,this};function whe(t,e,r){return r^t&(e^r)}function _he(t,e,r){return t&e|r&(t|e)}function xhe(t){return(t>>>2|t<<30)^(t>>>13|t<<19)^(t>>>22|t<<10)}function Ehe(t){return(t>>>6|t<<26)^(t>>>11|t<<21)^(t>>>25|t<<7)}function She(t){return(t>>>7|t<<25)^(t>>>18|t<<14)^t>>>3}function Ahe(t){return(t>>>17|t<<15)^(t>>>19|t<<13)^t>>>10}gb.prototype._update=function(t){for(var e=this._w,r=this._a|0,n=this._b|0,i=this._c|0,o=this._d|0,s=this._e|0,a=this._f|0,c=this._g|0,d=this._h|0,f=0;f<16;++f)e[f]=t.readInt32BE(f*4);for(;f<64;++f)e[f]=Ahe(e[f-2])+e[f-7]+She(e[f-15])+e[f-16]|0;for(var u=0;u<64;++u){var m=d+Ehe(s)+whe(s,a,c)+bhe[u]+e[u]|0,_=xhe(r)+_he(r,n,i)|0;d=c,c=a,a=s,s=o+m|0,o=i,i=n,n=r,r=m+_|0}this._a=r+this._a|0,this._b=n+this._b|0,this._c=i+this._c|0,this._d=o+this._d|0,this._e=s+this._e|0,this._f=a+this._f|0,this._g=c+this._g|0,this._h=d+this._h|0};gb.prototype._hash=function(){var t=ghe.allocUnsafe(32);return t.writeInt32BE(this._a,0),t.writeInt32BE(this._b,4),t.writeInt32BE(this._c,8),t.writeInt32BE(this._d,12),t.writeInt32BE(this._e,16),t.writeInt32BE(this._f,20),t.writeInt32BE(this._g,24),t.writeInt32BE(this._h,28),t};Mq.exports=gb});var Bq=G((Sqe,kq)=>{"use strict";p();var The=Je(),Phe=$5(),Ihe=Wl(),Rhe=it().Buffer,Mhe=new Array(64);function R2(){this.init(),this._w=Mhe,Ihe.call(this,64,56)}The(R2,Phe);R2.prototype.init=function(){return this._a=3238371032,this._b=914150663,this._c=812702999,this._d=4144912697,this._e=4290775857,this._f=1750603025,this._g=1694076839,this._h=3204075428,this};R2.prototype._hash=function(){var t=Rhe.allocUnsafe(28);return t.writeInt32BE(this._a,0),t.writeInt32BE(this._b,4),t.writeInt32BE(this._c,8),t.writeInt32BE(this._d,12),t.writeInt32BE(this._e,16),t.writeInt32BE(this._f,20),t.writeInt32BE(this._g,24),t};kq.exports=R2});var G5=G((Tqe,Lq)=>{"use strict";p();var khe=Je(),qq=Wl(),Bhe=it().Buffer,Dq=[1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591],Dhe=new Array(160);function bb(){this.init(),this._w=Dhe,qq.call(this,128,112)}khe(bb,qq);bb.prototype.init=function(){return this._ah=1779033703,this._bh=3144134277,this._ch=1013904242,this._dh=2773480762,this._eh=1359893119,this._fh=2600822924,this._gh=528734635,this._hh=1541459225,this._al=4089235720,this._bl=2227873595,this._cl=4271175723,this._dl=1595750129,this._el=2917565137,this._fl=725511199,this._gl=4215389547,this._hl=327033209,this};function Cq(t,e,r){return r^t&(e^r)}function Oq(t,e,r){return t&e|r&(t|e)}function jq(t,e){return(t>>>28|e<<4)^(e>>>2|t<<30)^(e>>>7|t<<25)}function Nq(t,e){return(t>>>14|e<<18)^(t>>>18|e<<14)^(e>>>9|t<<23)}function Che(t,e){return(t>>>1|e<<31)^(t>>>8|e<<24)^t>>>7}function Ohe(t,e){return(t>>>1|e<<31)^(t>>>8|e<<24)^(t>>>7|e<<25)}function jhe(t,e){return(t>>>19|e<<13)^(e>>>29|t<<3)^t>>>6}function Nhe(t,e){return(t>>>19|e<<13)^(e>>>29|t<<3)^(t>>>6|e<<26)}function Kn(t,e){return t>>>0<e>>>0?1:0}bb.prototype._update=function(t){for(var e=this._w,r=this._ah|0,n=this._bh|0,i=this._ch|0,o=this._dh|0,s=this._eh|0,a=this._fh|0,c=this._gh|0,d=this._hh|0,f=this._al|0,u=this._bl|0,m=this._cl|0,_=this._dl|0,v=this._el|0,A=this._fl|0,T=this._gl|0,M=this._hl|0,D=0;D<32;D+=2)e[D]=t.readInt32BE(D*4),e[D+1]=t.readInt32BE(D*4+4);for(;D<160;D+=2){var O=e[D-30],U=e[D-15*2+1],L=Che(O,U),F=Ohe(U,O);O=e[D-2*2],U=e[D-2*2+1];var $=jhe(O,U),H=Nhe(U,O),z=e[D-7*2],j=e[D-7*2+1],y=e[D-16*2],P=e[D-16*2+1],x=F+j|0,l=L+z+Kn(x,F)|0;x=x+H|0,l=l+$+Kn(x,H)|0,x=x+P|0,l=l+y+Kn(x,P)|0,e[D]=l,e[D+1]=x}for(var b=0;b<160;b+=2){l=e[b],x=e[b+1];var h=Oq(r,n,i),w=Oq(f,u,m),E=jq(r,f),g=jq(f,r),I=Nq(s,v),B=Nq(v,s),R=Dq[b],q=Dq[b+1],V=Cq(s,a,c),W=Cq(v,A,T),K=M+B|0,Y=d+I+Kn(K,M)|0;K=K+W|0,Y=Y+V+Kn(K,W)|0,K=K+q|0,Y=Y+R+Kn(K,q)|0,K=K+x|0,Y=Y+l+Kn(K,x)|0;var J=g+w|0,Z=E+h+Kn(J,g)|0;d=c,M=T,c=a,T=A,a=s,A=v,v=_+K|0,s=o+Y+Kn(v,_)|0,o=i,_=m,i=n,m=u,n=r,u=f,f=K+J|0,r=Y+Z+Kn(f,K)|0}this._al=this._al+f|0,this._bl=this._bl+u|0,this._cl=this._cl+m|0,this._dl=this._dl+_|0,this._el=this._el+v|0,this._fl=this._fl+A|0,this._gl=this._gl+T|0,this._hl=this._hl+M|0,this._ah=this._ah+r+Kn(this._al,f)|0,this._bh=this._bh+n+Kn(this._bl,u)|0,this._ch=this._ch+i+Kn(this._cl,m)|0,this._dh=this._dh+o+Kn(this._dl,_)|0,this._eh=this._eh+s+Kn(this._el,v)|0,this._fh=this._fh+a+Kn(this._fl,A)|0,this._gh=this._gh+c+Kn(this._gl,T)|0,this._hh=this._hh+d+Kn(this._hl,M)|0};bb.prototype._hash=function(){var t=Bhe.allocUnsafe(64);function e(r,n,i){t.writeInt32BE(r,i),t.writeInt32BE(n,i+4)}return e(this._ah,this._al,0),e(this._bh,this._bl,8),e(this._ch,this._cl,16),e(this._dh,this._dl,24),e(this._eh,this._el,32),e(this._fh,this._fl,40),e(this._gh,this._gl,48),e(this._hh,this._hl,56),t};Lq.exports=bb});var Fq=G((Iqe,Uq)=>{"use strict";p();var qhe=Je(),Lhe=G5(),Uhe=Wl(),Fhe=it().Buffer,zhe=new Array(160);function M2(){this.init(),this._w=zhe,Uhe.call(this,128,112)}qhe(M2,Lhe);M2.prototype.init=function(){return this._ah=3418070365,this._bh=1654270250,this._ch=2438529370,this._dh=355462360,this._eh=1731405415,this._fh=2394180231,this._gh=3675008525,this._hh=1203062813,this._al=3238371032,this._bl=914150663,this._cl=812702999,this._dl=4144912697,this._el=4290775857,this._fl=1750603025,this._gl=1694076839,this._hl=3204075428,this};M2.prototype._hash=function(){var t=Fhe.allocUnsafe(48);function e(r,n,i){t.writeInt32BE(r,i),t.writeInt32BE(n,i+4)}return e(this._ah,this._al,0),e(this._bh,this._bl,8),e(this._ch,this._cl,16),e(this._dh,this._dl,24),e(this._eh,this._el,32),e(this._fh,this._fl,40),t};Uq.exports=M2});var k2=G((Mqe,_d)=>{"use strict";p();_d.exports=function(e){var r=e.toLowerCase(),n=_d.exports[r];if(!n)throw new Error(r+" is not supported (we accept pull requests)");return new n};_d.exports.sha=Aq();_d.exports.sha1=Iq();_d.exports.sha224=Bq();_d.exports.sha256=$5();_d.exports.sha384=Fq();_d.exports.sha512=G5()});var H5=G((Bqe,zq)=>{p();zq.exports=nc().EventEmitter});var Kq=G((Cqe,Vq)=>{"use strict";p();function $q(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),r.push.apply(r,n)}return r}function Gq(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?$q(Object(r),!0).forEach(function(n){$he(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):$q(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function $he(t,e,r){return e=Wq(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function Ghe(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Hq(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,Wq(n.key),n)}}function Hhe(t,e,r){return e&&Hq(t.prototype,e),r&&Hq(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function Wq(t){var e=Whe(t,"string");return typeof e=="symbol"?e:String(e)}function Whe(t,e){if(typeof t!="object"||t===null)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var Vhe=jr(),B2=Vhe.Buffer,Khe=tb(),W5=Khe.inspect,Zhe=W5&&W5.custom||"inspect";function Yhe(t,e,r){B2.prototype.copy.call(t,e,r)}Vq.exports=function(){function t(){Ghe(this,t),this.head=null,this.tail=null,this.length=0}return Hhe(t,[{key:"push",value:function(r){var n={data:r,next:null};this.length>0?this.tail.next=n:this.head=n,this.tail=n,++this.length}},{key:"unshift",value:function(r){var n={data:r,next:this.head};this.length===0&&(this.tail=n),this.head=n,++this.length}},{key:"shift",value:function(){if(this.length!==0){var r=this.head.data;return this.length===1?this.head=this.tail=null:this.head=this.head.next,--this.length,r}}},{key:"clear",value:function(){this.head=this.tail=null,this.length=0}},{key:"join",value:function(r){if(this.length===0)return"";for(var n=this.head,i=""+n.data;n=n.next;)i+=r+n.data;return i}},{key:"concat",value:function(r){if(this.length===0)return B2.alloc(0);for(var n=B2.allocUnsafe(r>>>0),i=this.head,o=0;i;)Yhe(i.data,n,o),o+=i.data.length,i=i.next;return n}},{key:"consume",value:function(r,n){var i;return r<this.head.data.length?(i=this.head.data.slice(0,r),this.head.data=this.head.data.slice(r)):r===this.head.data.length?i=this.shift():i=n?this._getString(r):this._getBuffer(r),i}},{key:"first",value:function(){return this.head.data}},{key:"_getString",value:function(r){var n=this.head,i=1,o=n.data;for(r-=o.length;n=n.next;){var s=n.data,a=r>s.length?s.length:r;if(a===s.length?o+=s:o+=s.slice(0,r),r-=a,r===0){a===s.length?(++i,n.next?this.head=n.next:this.head=this.tail=null):(this.head=n,n.data=s.slice(a));break}++i}return this.length-=i,o}},{key:"_getBuffer",value:function(r){var n=B2.allocUnsafe(r),i=this.head,o=1;for(i.data.copy(n),r-=i.data.length;i=i.next;){var s=i.data,a=r>s.length?s.length:r;if(s.copy(n,n.length-r,0,a),r-=a,r===0){a===s.length?(++o,i.next?this.head=i.next:this.head=this.tail=null):(this.head=i,i.data=s.slice(a));break}++o}return this.length-=o,n}},{key:Zhe,value:function(r,n){return W5(this,Gq(Gq({},n),{},{depth:0,customInspect:!1}))}}]),t}()});var K5=G((jqe,Yq)=>{"use strict";p();function Jhe(t,e){var r=this,n=this._readableState&&this._readableState.destroyed,i=this._writableState&&this._writableState.destroyed;return n||i?(e?e(t):t&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,k.default.nextTick(V5,this,t)):k.default.nextTick(V5,this,t)),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(t||null,function(o){!e&&o?r._writableState?r._writableState.errorEmitted?k.default.nextTick(D2,r):(r._writableState.errorEmitted=!0,k.default.nextTick(Zq,r,o)):k.default.nextTick(Zq,r,o):e?(k.default.nextTick(D2,r),e(o)):k.default.nextTick(D2,r)}),this)}function Zq(t,e){V5(t,e),D2(t)}function D2(t){t._writableState&&!t._writableState.emitClose||t._readableState&&!t._readableState.emitClose||t.emit("close")}function Xhe(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finalCalled=!1,this._writableState.prefinished=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)}function V5(t,e){t.emit("error",e)}function Qhe(t,e){var r=t._readableState,n=t._writableState;r&&r.autoDestroy||n&&n.autoDestroy?t.destroy(e):t.emit("error",e)}Yq.exports={destroy:Jhe,undestroy:Xhe,errorOrDestroy:Qhe}});var Vl=G((qqe,Qq)=>{"use strict";p();function epe(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,t.__proto__=e}var Xq={};function Ds(t,e,r){r||(r=Error);function n(o,s,a){return typeof e=="string"?e:e(o,s,a)}var i=function(o){epe(s,o);function s(a,c,d){return o.call(this,n(a,c,d))||this}return s}(r);i.prototype.name=r.name,i.prototype.code=t,Xq[t]=i}function Jq(t,e){if(Array.isArray(t)){var r=t.length;return t=t.map(function(n){return String(n)}),r>2?"one of ".concat(e," ").concat(t.slice(0,r-1).join(", "),", or ")+t[r-1]:r===2?"one of ".concat(e," ").concat(t[0]," or ").concat(t[1]):"of ".concat(e," ").concat(t[0])}else return"of ".concat(e," ").concat(String(t))}function tpe(t,e,r){return t.substr(!r||r<0?0:+r,e.length)===e}function rpe(t,e,r){return(r===void 0||r>t.length)&&(r=t.length),t.substring(r-e.length,r)===e}function npe(t,e,r){return typeof r!="number"&&(r=0),r+e.length>t.length?!1:t.indexOf(e,r)!==-1}Ds("ERR_INVALID_OPT_VALUE",function(t,e){return'The value "'+e+'" is invalid for option "'+t+'"'},TypeError);Ds("ERR_INVALID_ARG_TYPE",function(t,e,r){var n;typeof e=="string"&&tpe(e,"not ")?(n="must not be",e=e.replace(/^not /,"")):n="must be";var i;if(rpe(t," argument"))i="The ".concat(t," ").concat(n," ").concat(Jq(e,"type"));else{var o=npe(t,".")?"property":"argument";i='The "'.concat(t,'" ').concat(o," ").concat(n," ").concat(Jq(e,"type"))}return i+=". Received type ".concat(typeof r),i},TypeError);Ds("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF");Ds("ERR_METHOD_NOT_IMPLEMENTED",function(t){return"The "+t+" method is not implemented"});Ds("ERR_STREAM_PREMATURE_CLOSE","Premature close");Ds("ERR_STREAM_DESTROYED",function(t){return"Cannot call "+t+" after a stream was destroyed"});Ds("ERR_MULTIPLE_CALLBACK","Callback called multiple times");Ds("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable");Ds("ERR_STREAM_WRITE_AFTER_END","write after end");Ds("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError);Ds("ERR_UNKNOWN_ENCODING",function(t){return"Unknown encoding: "+t},TypeError);Ds("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event");Qq.exports.codes=Xq});var Z5=G((Uqe,eL)=>{"use strict";p();var ipe=Vl().codes.ERR_INVALID_OPT_VALUE;function ope(t,e,r){return t.highWaterMark!=null?t.highWaterMark:e?t[r]:null}function spe(t,e,r,n){var i=ope(e,n,r);if(i!=null){if(!(isFinite(i)&&Math.floor(i)===i)||i<0){var o=n?r:"highWaterMark";throw new ipe(o,i)}return Math.floor(i)}return t.objectMode?16:16*1024}eL.exports={getHighWaterMark:spe}});var X5=G((zqe,sL)=>{"use strict";p();sL.exports=fn;function rL(t){var e=this;this.next=null,this.entry=null,this.finish=function(){Dpe(e,t)}}var S0;fn.WritableState=wb;var ape={deprecate:S5()},nL=H5(),O2=jr().Buffer,cpe=(typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof self<"u"?self:{}).Uint8Array||function(){};function dpe(t){return O2.from(t)}function fpe(t){return O2.isBuffer(t)||t instanceof cpe}var J5=K5(),upe=Z5(),lpe=upe.getHighWaterMark,$f=Vl().codes,hpe=$f.ERR_INVALID_ARG_TYPE,ppe=$f.ERR_METHOD_NOT_IMPLEMENTED,mpe=$f.ERR_MULTIPLE_CALLBACK,ype=$f.ERR_STREAM_CANNOT_PIPE,gpe=$f.ERR_STREAM_DESTROYED,bpe=$f.ERR_STREAM_NULL_VALUES,vpe=$f.ERR_STREAM_WRITE_AFTER_END,wpe=$f.ERR_UNKNOWN_ENCODING,A0=J5.errorOrDestroy;Je()(fn,nL);function _pe(){}function wb(t,e,r){S0=S0||Kl(),t=t||{},typeof r!="boolean"&&(r=e instanceof S0),this.objectMode=!!t.objectMode,r&&(this.objectMode=this.objectMode||!!t.writableObjectMode),this.highWaterMark=lpe(this,t,"writableHighWaterMark",r),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var n=t.decodeStrings===!1;this.decodeStrings=!n,this.defaultEncoding=t.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(i){Ipe(e,i)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=t.emitClose!==!1,this.autoDestroy=!!t.autoDestroy,this.bufferedRequestCount=0,this.corkedRequestsFree=new rL(this)}wb.prototype.getBuffer=function(){for(var e=this.bufferedRequest,r=[];e;)r.push(e),e=e.next;return r};(function(){try{Object.defineProperty(wb.prototype,"buffer",{get:ape.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch{}})();var C2;typeof Symbol=="function"&&Symbol.hasInstance&&typeof Function.prototype[Symbol.hasInstance]=="function"?(C2=Function.prototype[Symbol.hasInstance],Object.defineProperty(fn,Symbol.hasInstance,{value:function(e){return C2.call(this,e)?!0:this!==fn?!1:e&&e._writableState instanceof wb}})):C2=function(e){return e instanceof this};function fn(t){S0=S0||Kl();var e=this instanceof S0;if(!e&&!C2.call(fn,this))return new fn(t);this._writableState=new wb(t,this,e),this.writable=!0,t&&(typeof t.write=="function"&&(this._write=t.write),typeof t.writev=="function"&&(this._writev=t.writev),typeof t.destroy=="function"&&(this._destroy=t.destroy),typeof t.final=="function"&&(this._final=t.final)),nL.call(this)}fn.prototype.pipe=function(){A0(this,new ype)};function xpe(t,e){var r=new vpe;A0(t,r),k.default.nextTick(e,r)}function Epe(t,e,r,n){var i;return r===null?i=new bpe:typeof r!="string"&&!e.objectMode&&(i=new hpe("chunk",["string","Buffer"],r)),i?(A0(t,i),k.default.nextTick(n,i),!1):!0}fn.prototype.write=function(t,e,r){var n=this._writableState,i=!1,o=!n.objectMode&&fpe(t);return o&&!O2.isBuffer(t)&&(t=dpe(t)),typeof e=="function"&&(r=e,e=null),o?e="buffer":e||(e=n.defaultEncoding),typeof r!="function"&&(r=_pe),n.ending?xpe(this,r):(o||Epe(this,n,t,r))&&(n.pendingcb++,i=Ape(this,n,o,t,e,r)),i};fn.prototype.cork=function(){this._writableState.corked++};fn.prototype.uncork=function(){var t=this._writableState;t.corked&&(t.corked--,!t.writing&&!t.corked&&!t.bufferProcessing&&t.bufferedRequest&&iL(this,t))};fn.prototype.setDefaultEncoding=function(e){if(typeof e=="string"&&(e=e.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((e+"").toLowerCase())>-1))throw new wpe(e);return this._writableState.defaultEncoding=e,this};Object.defineProperty(fn.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}});function Spe(t,e,r){return!t.objectMode&&t.decodeStrings!==!1&&typeof e=="string"&&(e=O2.from(e,r)),e}Object.defineProperty(fn.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}});function Ape(t,e,r,n,i,o){if(!r){var s=Spe(e,n,i);n!==s&&(r=!0,i="buffer",n=s)}var a=e.objectMode?1:n.length;e.length+=a;var c=e.length<e.highWaterMark;if(c||(e.needDrain=!0),e.writing||e.corked){var d=e.lastBufferedRequest;e.lastBufferedRequest={chunk:n,encoding:i,isBuf:r,callback:o,next:null},d?d.next=e.lastBufferedRequest:e.bufferedRequest=e.lastBufferedRequest,e.bufferedRequestCount+=1}else Y5(t,e,!1,a,n,i,o);return c}function Y5(t,e,r,n,i,o,s){e.writelen=n,e.writecb=s,e.writing=!0,e.sync=!0,e.destroyed?e.onwrite(new gpe("write")):r?t._writev(i,e.onwrite):t._write(i,o,e.onwrite),e.sync=!1}function Tpe(t,e,r,n,i){--e.pendingcb,r?(k.default.nextTick(i,n),k.default.nextTick(vb,t,e),t._writableState.errorEmitted=!0,A0(t,n)):(i(n),t._writableState.errorEmitted=!0,A0(t,n),vb(t,e))}function Ppe(t){t.writing=!1,t.writecb=null,t.length-=t.writelen,t.writelen=0}function Ipe(t,e){var r=t._writableState,n=r.sync,i=r.writecb;if(typeof i!="function")throw new mpe;if(Ppe(r),e)Tpe(t,r,n,e,i);else{var o=oL(r)||t.destroyed;!o&&!r.corked&&!r.bufferProcessing&&r.bufferedRequest&&iL(t,r),n?k.default.nextTick(tL,t,r,o,i):tL(t,r,o,i)}}function tL(t,e,r,n){r||Rpe(t,e),e.pendingcb--,n(),vb(t,e)}function Rpe(t,e){e.length===0&&e.needDrain&&(e.needDrain=!1,t.emit("drain"))}function iL(t,e){e.bufferProcessing=!0;var r=e.bufferedRequest;if(t._writev&&r&&r.next){var n=e.bufferedRequestCount,i=new Array(n),o=e.corkedRequestsFree;o.entry=r;for(var s=0,a=!0;r;)i[s]=r,r.isBuf||(a=!1),r=r.next,s+=1;i.allBuffers=a,Y5(t,e,!0,e.length,i,"",o.finish),e.pendingcb++,e.lastBufferedRequest=null,o.next?(e.corkedRequestsFree=o.next,o.next=null):e.corkedRequestsFree=new rL(e),e.bufferedRequestCount=0}else{for(;r;){var c=r.chunk,d=r.encoding,f=r.callback,u=e.objectMode?1:c.length;if(Y5(t,e,!1,u,c,d,f),r=r.next,e.bufferedRequestCount--,e.writing)break}r===null&&(e.lastBufferedRequest=null)}e.bufferedRequest=r,e.bufferProcessing=!1}fn.prototype._write=function(t,e,r){r(new ppe("_write()"))};fn.prototype._writev=null;fn.prototype.end=function(t,e,r){var n=this._writableState;return typeof t=="function"?(r=t,t=null,e=null):typeof e=="function"&&(r=e,e=null),t!=null&&this.write(t,e),n.corked&&(n.corked=1,this.uncork()),n.ending||Bpe(this,n,r),this};Object.defineProperty(fn.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}});function oL(t){return t.ending&&t.length===0&&t.bufferedRequest===null&&!t.finished&&!t.writing}function Mpe(t,e){t._final(function(r){e.pendingcb--,r&&A0(t,r),e.prefinished=!0,t.emit("prefinish"),vb(t,e)})}function kpe(t,e){!e.prefinished&&!e.finalCalled&&(typeof t._final=="function"&&!e.destroyed?(e.pendingcb++,e.finalCalled=!0,k.default.nextTick(Mpe,t,e)):(e.prefinished=!0,t.emit("prefinish")))}function vb(t,e){var r=oL(e);if(r&&(kpe(t,e),e.pendingcb===0&&(e.finished=!0,t.emit("finish"),e.autoDestroy))){var n=t._readableState;(!n||n.autoDestroy&&n.endEmitted)&&t.destroy()}return r}function Bpe(t,e,r){e.ending=!0,vb(t,e),r&&(e.finished?k.default.nextTick(r):t.once("finish",r)),e.ended=!0,t.writable=!1}function Dpe(t,e,r){var n=t.entry;for(t.entry=null;n;){var i=n.callback;e.pendingcb--,i(r),n=n.next}e.corkedRequestsFree.next=t}Object.defineProperty(fn.prototype,"destroyed",{enumerable:!1,get:function(){return this._writableState===void 0?!1:this._writableState.destroyed},set:function(e){this._writableState&&(this._writableState.destroyed=e)}});fn.prototype.destroy=J5.destroy;fn.prototype._undestroy=J5.undestroy;fn.prototype._destroy=function(t,e){e(t)}});var Kl=G((Gqe,cL)=>{"use strict";p();var Cpe=Object.keys||function(t){var e=[];for(var r in t)e.push(r);return e};cL.exports=oc;var aL=tS(),eS=X5();Je()(oc,aL);for(Q5=Cpe(eS.prototype),j2=0;j2<Q5.length;j2++)N2=Q5[j2],oc.prototype[N2]||(oc.prototype[N2]=eS.prototype[N2]);var Q5,N2,j2;function oc(t){if(!(this instanceof oc))return new oc(t);aL.call(this,t),eS.call(this,t),this.allowHalfOpen=!0,t&&(t.readable===!1&&(this.readable=!1),t.writable===!1&&(this.writable=!1),t.allowHalfOpen===!1&&(this.allowHalfOpen=!1,this.once("end",Ope)))}Object.defineProperty(oc.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}});Object.defineProperty(oc.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}});Object.defineProperty(oc.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}});function Ope(){this._writableState.ended||k.default.nextTick(jpe,this)}function jpe(t){t.end()}Object.defineProperty(oc.prototype,"destroyed",{enumerable:!1,get:function(){return this._readableState===void 0||this._writableState===void 0?!1:this._readableState.destroyed&&this._writableState.destroyed},set:function(e){this._readableState===void 0||this._writableState===void 0||(this._readableState.destroyed=e,this._writableState.destroyed=e)}})});var xb=G(fL=>{"use strict";p();var nS=it().Buffer,dL=nS.isEncoding||function(t){switch(t=""+t,t&&t.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function Npe(t){if(!t)return"utf8";for(var e;;)switch(t){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return t;default:if(e)return;t=(""+t).toLowerCase(),e=!0}}function qpe(t){var e=Npe(t);if(typeof e!="string"&&(nS.isEncoding===dL||!dL(t)))throw new Error("Unknown encoding: "+t);return e||t}fL.StringDecoder=_b;function _b(t){this.encoding=qpe(t);var e;switch(this.encoding){case"utf16le":this.text=Gpe,this.end=Hpe,e=4;break;case"utf8":this.fillLast=Fpe,e=4;break;case"base64":this.text=Wpe,this.end=Vpe,e=3;break;default:this.write=Kpe,this.end=Zpe;return}this.lastNeed=0,this.lastTotal=0,this.lastChar=nS.allocUnsafe(e)}_b.prototype.write=function(t){if(t.length===0)return"";var e,r;if(this.lastNeed){if(e=this.fillLast(t),e===void 0)return"";r=this.lastNeed,this.lastNeed=0}else r=0;return r<t.length?e?e+this.text(t,r):this.text(t,r):e||""};_b.prototype.end=$pe;_b.prototype.text=zpe;_b.prototype.fillLast=function(t){if(this.lastNeed<=t.length)return t.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);t.copy(this.lastChar,this.lastTotal-this.lastNeed,0,t.length),this.lastNeed-=t.length};function rS(t){return t<=127?0:t>>5===6?2:t>>4===14?3:t>>3===30?4:t>>6===2?-1:-2}function Lpe(t,e,r){var n=e.length-1;if(n<r)return 0;var i=rS(e[n]);return i>=0?(i>0&&(t.lastNeed=i-1),i):--n<r||i===-2?0:(i=rS(e[n]),i>=0?(i>0&&(t.lastNeed=i-2),i):--n<r||i===-2?0:(i=rS(e[n]),i>=0?(i>0&&(i===2?i=0:t.lastNeed=i-3),i):0))}function Upe(t,e,r){if((e[0]&192)!==128)return t.lastNeed=0,"\uFFFD";if(t.lastNeed>1&&e.length>1){if((e[1]&192)!==128)return t.lastNeed=1,"\uFFFD";if(t.lastNeed>2&&e.length>2&&(e[2]&192)!==128)return t.lastNeed=2,"\uFFFD"}}function Fpe(t){var e=this.lastTotal-this.lastNeed,r=Upe(this,t,e);if(r!==void 0)return r;if(this.lastNeed<=t.length)return t.copy(this.lastChar,e,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);t.copy(this.lastChar,e,0,t.length),this.lastNeed-=t.length}function zpe(t,e){var r=Lpe(this,t,e);if(!this.lastNeed)return t.toString("utf8",e);this.lastTotal=r;var n=t.length-(r-this.lastNeed);return t.copy(this.lastChar,0,n),t.toString("utf8",e,n)}function $pe(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+"\uFFFD":e}function Gpe(t,e){if((t.length-e)%2===0){var r=t.toString("utf16le",e);if(r){var n=r.charCodeAt(r.length-1);if(n>=55296&&n<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=t[t.length-2],this.lastChar[1]=t[t.length-1],r.slice(0,-1)}return r}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=t[t.length-1],t.toString("utf16le",e,t.length-1)}function Hpe(t){var e=t&&t.length?this.write(t):"";if(this.lastNeed){var r=this.lastTotal-this.lastNeed;return e+this.lastChar.toString("utf16le",0,r)}return e}function Wpe(t,e){var r=(t.length-e)%3;return r===0?t.toString("base64",e):(this.lastNeed=3-r,this.lastTotal=3,r===1?this.lastChar[0]=t[t.length-1]:(this.lastChar[0]=t[t.length-2],this.lastChar[1]=t[t.length-1]),t.toString("base64",e,t.length-r))}function Vpe(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+this.lastChar.toString("base64",0,3-this.lastNeed):e}function Kpe(t){return t.toString(this.encoding)}function Zpe(t){return t&&t.length?this.write(t):""}});var q2=G((Kqe,hL)=>{"use strict";p();var uL=Vl().codes.ERR_STREAM_PREMATURE_CLOSE;function Ype(t){var e=!1;return function(){if(!e){e=!0;for(var r=arguments.length,n=new Array(r),i=0;i<r;i++)n[i]=arguments[i];t.apply(this,n)}}}function Jpe(){}function Xpe(t){return t.setHeader&&typeof t.abort=="function"}function lL(t,e,r){if(typeof e=="function")return lL(t,null,e);e||(e={}),r=Ype(r||Jpe);var n=e.readable||e.readable!==!1&&t.readable,i=e.writable||e.writable!==!1&&t.writable,o=function(){t.writable||a()},s=t._writableState&&t._writableState.finished,a=function(){i=!1,s=!0,n||r.call(t)},c=t._readableState&&t._readableState.endEmitted,d=function(){n=!1,c=!0,i||r.call(t)},f=function(v){r.call(t,v)},u=function(){var v;if(n&&!c)return(!t._readableState||!t._readableState.ended)&&(v=new uL),r.call(t,v);if(i&&!s)return(!t._writableState||!t._writableState.ended)&&(v=new uL),r.call(t,v)},m=function(){t.req.on("finish",a)};return Xpe(t)?(t.on("complete",a),t.on("abort",u),t.req?m():t.on("request",m)):i&&!t._writableState&&(t.on("end",o),t.on("close",o)),t.on("end",d),t.on("finish",a),e.error!==!1&&t.on("error",f),t.on("close",u),function(){t.removeListener("complete",a),t.removeListener("abort",u),t.removeListener("request",m),t.req&&t.req.removeListener("finish",a),t.removeListener("end",o),t.removeListener("close",o),t.removeListener("finish",a),t.removeListener("end",d),t.removeListener("error",f),t.removeListener("close",u)}}hL.exports=lL});var mL=G((Yqe,pL)=>{"use strict";p();var L2;function Gf(t,e,r){return e=Qpe(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function Qpe(t){var e=e0e(t,"string");return typeof e=="symbol"?e:String(e)}function e0e(t,e){if(typeof t!="object"||t===null)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var t0e=q2(),Hf=Symbol("lastResolve"),Zl=Symbol("lastReject"),Eb=Symbol("error"),U2=Symbol("ended"),Yl=Symbol("lastPromise"),iS=Symbol("handlePromise"),Jl=Symbol("stream");function Wf(t,e){return{value:t,done:e}}function r0e(t){var e=t[Hf];if(e!==null){var r=t[Jl].read();r!==null&&(t[Yl]=null,t[Hf]=null,t[Zl]=null,e(Wf(r,!1)))}}function n0e(t){k.default.nextTick(r0e,t)}function i0e(t,e){return function(r,n){t.then(function(){if(e[U2]){r(Wf(void 0,!0));return}e[iS](r,n)},n)}}var o0e=Object.getPrototypeOf(function(){}),s0e=Object.setPrototypeOf((L2={get stream(){return this[Jl]},next:function(){var e=this,r=this[Eb];if(r!==null)return Promise.reject(r);if(this[U2])return Promise.resolve(Wf(void 0,!0));if(this[Jl].destroyed)return new Promise(function(s,a){k.default.nextTick(function(){e[Eb]?a(e[Eb]):s(Wf(void 0,!0))})});var n=this[Yl],i;if(n)i=new Promise(i0e(n,this));else{var o=this[Jl].read();if(o!==null)return Promise.resolve(Wf(o,!1));i=new Promise(this[iS])}return this[Yl]=i,i}},Gf(L2,Symbol.asyncIterator,function(){return this}),Gf(L2,"return",function(){var e=this;return new Promise(function(r,n){e[Jl].destroy(null,function(i){if(i){n(i);return}r(Wf(void 0,!0))})})}),L2),o0e),a0e=function(e){var r,n=Object.create(s0e,(r={},Gf(r,Jl,{value:e,writable:!0}),Gf(r,Hf,{value:null,writable:!0}),Gf(r,Zl,{value:null,writable:!0}),Gf(r,Eb,{value:null,writable:!0}),Gf(r,U2,{value:e._readableState.endEmitted,writable:!0}),Gf(r,iS,{value:function(o,s){var a=n[Jl].read();a?(n[Yl]=null,n[Hf]=null,n[Zl]=null,o(Wf(a,!1))):(n[Hf]=o,n[Zl]=s)},writable:!0}),r));return n[Yl]=null,t0e(e,function(i){if(i&&i.code!=="ERR_STREAM_PREMATURE_CLOSE"){var o=n[Zl];o!==null&&(n[Yl]=null,n[Hf]=null,n[Zl]=null,o(i)),n[Eb]=i;return}var s=n[Hf];s!==null&&(n[Yl]=null,n[Hf]=null,n[Zl]=null,s(Wf(void 0,!0))),n[U2]=!0}),e.on("readable",n0e.bind(null,n)),n};pL.exports=a0e});var gL=G((Xqe,yL)=>{p();yL.exports=function(){throw new Error("Readable.from is not available in the browser")}});var tS=G((tLe,PL)=>{"use strict";p();PL.exports=rr;var T0;rr.ReadableState=_L;var eLe=nc().EventEmitter,wL=function(e,r){return e.listeners(r).length},Ab=H5(),F2=jr().Buffer,c0e=(typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof self<"u"?self:{}).Uint8Array||function(){};function d0e(t){return F2.from(t)}function f0e(t){return F2.isBuffer(t)||t instanceof c0e}var oS=tb(),$t;oS&&oS.debuglog?$t=oS.debuglog("stream"):$t=function(){};var u0e=Kq(),lS=K5(),l0e=Z5(),h0e=l0e.getHighWaterMark,z2=Vl().codes,p0e=z2.ERR_INVALID_ARG_TYPE,m0e=z2.ERR_STREAM_PUSH_AFTER_EOF,y0e=z2.ERR_METHOD_NOT_IMPLEMENTED,g0e=z2.ERR_STREAM_UNSHIFT_AFTER_END_EVENT,P0,sS,aS;Je()(rr,Ab);var Sb=lS.errorOrDestroy,cS=["error","close","destroy","pause","resume"];function b0e(t,e,r){if(typeof t.prependListener=="function")return t.prependListener(e,r);!t._events||!t._events[e]?t.on(e,r):Array.isArray(t._events[e])?t._events[e].unshift(r):t._events[e]=[r,t._events[e]]}function _L(t,e,r){T0=T0||Kl(),t=t||{},typeof r!="boolean"&&(r=e instanceof T0),this.objectMode=!!t.objectMode,r&&(this.objectMode=this.objectMode||!!t.readableObjectMode),this.highWaterMark=h0e(this,t,"readableHighWaterMark",r),this.buffer=new u0e,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.paused=!0,this.emitClose=t.emitClose!==!1,this.autoDestroy=!!t.autoDestroy,this.destroyed=!1,this.defaultEncoding=t.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,t.encoding&&(P0||(P0=xb().StringDecoder),this.decoder=new P0(t.encoding),this.encoding=t.encoding)}function rr(t){if(T0=T0||Kl(),!(this instanceof rr))return new rr(t);var e=this instanceof T0;this._readableState=new _L(t,this,e),this.readable=!0,t&&(typeof t.read=="function"&&(this._read=t.read),typeof t.destroy=="function"&&(this._destroy=t.destroy)),Ab.call(this)}Object.defineProperty(rr.prototype,"destroyed",{enumerable:!1,get:function(){return this._readableState===void 0?!1:this._readableState.destroyed},set:function(e){this._readableState&&(this._readableState.destroyed=e)}});rr.prototype.destroy=lS.destroy;rr.prototype._undestroy=lS.undestroy;rr.prototype._destroy=function(t,e){e(t)};rr.prototype.push=function(t,e){var r=this._readableState,n;return r.objectMode?n=!0:typeof t=="string"&&(e=e||r.defaultEncoding,e!==r.encoding&&(t=F2.from(t,e),e=""),n=!0),xL(this,t,e,!1,n)};rr.prototype.unshift=function(t){return xL(this,t,null,!0,!1)};function xL(t,e,r,n,i){$t("readableAddChunk",e);var o=t._readableState;if(e===null)o.reading=!1,_0e(t,o);else{var s;if(i||(s=v0e(o,e)),s)Sb(t,s);else if(o.objectMode||e&&e.length>0)if(typeof e!="string"&&!o.objectMode&&Object.getPrototypeOf(e)!==F2.prototype&&(e=d0e(e)),n)o.endEmitted?Sb(t,new g0e):dS(t,o,e,!0);else if(o.ended)Sb(t,new m0e);else{if(o.destroyed)return!1;o.reading=!1,o.decoder&&!r?(e=o.decoder.write(e),o.objectMode||e.length!==0?dS(t,o,e,!1):uS(t,o)):dS(t,o,e,!1)}else n||(o.reading=!1,uS(t,o))}return!o.ended&&(o.length<o.highWaterMark||o.length===0)}function dS(t,e,r,n){e.flowing&&e.length===0&&!e.sync?(e.awaitDrain=0,t.emit("data",r)):(e.length+=e.objectMode?1:r.length,n?e.buffer.unshift(r):e.buffer.push(r),e.needReadable&&$2(t)),uS(t,e)}function v0e(t,e){var r;return!f0e(e)&&typeof e!="string"&&e!==void 0&&!t.objectMode&&(r=new p0e("chunk",["string","Buffer","Uint8Array"],e)),r}rr.prototype.isPaused=function(){return this._readableState.flowing===!1};rr.prototype.setEncoding=function(t){P0||(P0=xb().StringDecoder);var e=new P0(t);this._readableState.decoder=e,this._readableState.encoding=this._readableState.decoder.encoding;for(var r=this._readableState.buffer.head,n="";r!==null;)n+=e.write(r.data),r=r.next;return this._readableState.buffer.clear(),n!==""&&this._readableState.buffer.push(n),this._readableState.length=n.length,this};var bL=1073741824;function w0e(t){return t>=bL?t=bL:(t--,t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,t|=t>>>16,t++),t}function vL(t,e){return t<=0||e.length===0&&e.ended?0:e.objectMode?1:t!==t?e.flowing&&e.length?e.buffer.head.data.length:e.length:(t>e.highWaterMark&&(e.highWaterMark=w0e(t)),t<=e.length?t:e.ended?e.length:(e.needReadable=!0,0))}rr.prototype.read=function(t){$t("read",t),t=parseInt(t,10);var e=this._readableState,r=t;if(t!==0&&(e.emittedReadable=!1),t===0&&e.needReadable&&((e.highWaterMark!==0?e.length>=e.highWaterMark:e.length>0)||e.ended))return $t("read: emitReadable",e.length,e.ended),e.length===0&&e.ended?fS(this):$2(this),null;if(t=vL(t,e),t===0&&e.ended)return e.length===0&&fS(this),null;var n=e.needReadable;$t("need readable",n),(e.length===0||e.length-t<e.highWaterMark)&&(n=!0,$t("length less than watermark",n)),e.ended||e.reading?(n=!1,$t("reading or ended",n)):n&&($t("do read"),e.reading=!0,e.sync=!0,e.length===0&&(e.needReadable=!0),this._read(e.highWaterMark),e.sync=!1,e.reading||(t=vL(r,e)));var i;return t>0?i=AL(t,e):i=null,i===null?(e.needReadable=e.length<=e.highWaterMark,t=0):(e.length-=t,e.awaitDrain=0),e.length===0&&(e.ended||(e.needReadable=!0),r!==t&&e.ended&&fS(this)),i!==null&&this.emit("data",i),i};function _0e(t,e){if($t("onEofChunk"),!e.ended){if(e.decoder){var r=e.decoder.end();r&&r.length&&(e.buffer.push(r),e.length+=e.objectMode?1:r.length)}e.ended=!0,e.sync?$2(t):(e.needReadable=!1,e.emittedReadable||(e.emittedReadable=!0,EL(t)))}}function $2(t){var e=t._readableState;$t("emitReadable",e.needReadable,e.emittedReadable),e.needReadable=!1,e.emittedReadable||($t("emitReadable",e.flowing),e.emittedReadable=!0,k.default.nextTick(EL,t))}function EL(t){var e=t._readableState;$t("emitReadable_",e.destroyed,e.length,e.ended),!e.destroyed&&(e.length||e.ended)&&(t.emit("readable"),e.emittedReadable=!1),e.needReadable=!e.flowing&&!e.ended&&e.length<=e.highWaterMark,hS(t)}function uS(t,e){e.readingMore||(e.readingMore=!0,k.default.nextTick(x0e,t,e))}function x0e(t,e){for(;!e.reading&&!e.ended&&(e.length<e.highWaterMark||e.flowing&&e.length===0);){var r=e.length;if($t("maybeReadMore read 0"),t.read(0),r===e.length)break}e.readingMore=!1}rr.prototype._read=function(t){Sb(this,new y0e("_read()"))};rr.prototype.pipe=function(t,e){var r=this,n=this._readableState;switch(n.pipesCount){case 0:n.pipes=t;break;case 1:n.pipes=[n.pipes,t];break;default:n.pipes.push(t);break}n.pipesCount+=1,$t("pipe count=%d opts=%j",n.pipesCount,e);var i=(!e||e.end!==!1)&&t!==k.default.stdout&&t!==k.default.stderr,o=i?a:A;n.endEmitted?k.default.nextTick(o):r.once("end",o),t.on("unpipe",s);function s(T,M){$t("onunpipe"),T===r&&M&&M.hasUnpiped===!1&&(M.hasUnpiped=!0,f())}function a(){$t("onend"),t.end()}var c=E0e(r);t.on("drain",c);var d=!1;function f(){$t("cleanup"),t.removeListener("close",_),t.removeListener("finish",v),t.removeListener("drain",c),t.removeListener("error",m),t.removeListener("unpipe",s),r.removeListener("end",a),r.removeListener("end",A),r.removeListener("data",u),d=!0,n.awaitDrain&&(!t._writableState||t._writableState.needDrain)&&c()}r.on("data",u);function u(T){$t("ondata");var M=t.write(T);$t("dest.write",M),M===!1&&((n.pipesCount===1&&n.pipes===t||n.pipesCount>1&&TL(n.pipes,t)!==-1)&&!d&&($t("false write response, pause",n.awaitDrain),n.awaitDrain++),r.pause())}function m(T){$t("onerror",T),A(),t.removeListener("error",m),wL(t,"error")===0&&Sb(t,T)}b0e(t,"error",m);function _(){t.removeListener("finish",v),A()}t.once("close",_);function v(){$t("onfinish"),t.removeListener("close",_),A()}t.once("finish",v);function A(){$t("unpipe"),r.unpipe(t)}return t.emit("pipe",r),n.flowing||($t("pipe resume"),r.resume()),t};function E0e(t){return function(){var r=t._readableState;$t("pipeOnDrain",r.awaitDrain),r.awaitDrain&&r.awaitDrain--,r.awaitDrain===0&&wL(t,"data")&&(r.flowing=!0,hS(t))}}rr.prototype.unpipe=function(t){var e=this._readableState,r={hasUnpiped:!1};if(e.pipesCount===0)return this;if(e.pipesCount===1)return t&&t!==e.pipes?this:(t||(t=e.pipes),e.pipes=null,e.pipesCount=0,e.flowing=!1,t&&t.emit("unpipe",this,r),this);if(!t){var n=e.pipes,i=e.pipesCount;e.pipes=null,e.pipesCount=0,e.flowing=!1;for(var o=0;o<i;o++)n[o].emit("unpipe",this,{hasUnpiped:!1});return this}var s=TL(e.pipes,t);return s===-1?this:(e.pipes.splice(s,1),e.pipesCount-=1,e.pipesCount===1&&(e.pipes=e.pipes[0]),t.emit("unpipe",this,r),this)};rr.prototype.on=function(t,e){var r=Ab.prototype.on.call(this,t,e),n=this._readableState;return t==="data"?(n.readableListening=this.listenerCount("readable")>0,n.flowing!==!1&&this.resume()):t==="readable"&&!n.endEmitted&&!n.readableListening&&(n.readableListening=n.needReadable=!0,n.flowing=!1,n.emittedReadable=!1,$t("on readable",n.length,n.reading),n.length?$2(this):n.reading||k.default.nextTick(S0e,this)),r};rr.prototype.addListener=rr.prototype.on;rr.prototype.removeListener=function(t,e){var r=Ab.prototype.removeListener.call(this,t,e);return t==="readable"&&k.default.nextTick(SL,this),r};rr.prototype.removeAllListeners=function(t){var e=Ab.prototype.removeAllListeners.apply(this,arguments);return(t==="readable"||t===void 0)&&k.default.nextTick(SL,this),e};function SL(t){var e=t._readableState;e.readableListening=t.listenerCount("readable")>0,e.resumeScheduled&&!e.paused?e.flowing=!0:t.listenerCount("data")>0&&t.resume()}function S0e(t){$t("readable nexttick read 0"),t.read(0)}rr.prototype.resume=function(){var t=this._readableState;return t.flowing||($t("resume"),t.flowing=!t.readableListening,A0e(this,t)),t.paused=!1,this};function A0e(t,e){e.resumeScheduled||(e.resumeScheduled=!0,k.default.nextTick(T0e,t,e))}function T0e(t,e){$t("resume",e.reading),e.reading||t.read(0),e.resumeScheduled=!1,t.emit("resume"),hS(t),e.flowing&&!e.reading&&t.read(0)}rr.prototype.pause=function(){return $t("call pause flowing=%j",this._readableState.flowing),this._readableState.flowing!==!1&&($t("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState.paused=!0,this};function hS(t){var e=t._readableState;for($t("flow",e.flowing);e.flowing&&t.read()!==null;);}rr.prototype.wrap=function(t){var e=this,r=this._readableState,n=!1;t.on("end",function(){if($t("wrapped end"),r.decoder&&!r.ended){var s=r.decoder.end();s&&s.length&&e.push(s)}e.push(null)}),t.on("data",function(s){if($t("wrapped data"),r.decoder&&(s=r.decoder.write(s)),!(r.objectMode&&s==null)&&!(!r.objectMode&&(!s||!s.length))){var a=e.push(s);a||(n=!0,t.pause())}});for(var i in t)this[i]===void 0&&typeof t[i]=="function"&&(this[i]=function(a){return function(){return t[a].apply(t,arguments)}}(i));for(var o=0;o<cS.length;o++)t.on(cS[o],this.emit.bind(this,cS[o]));return this._read=function(s){$t("wrapped _read",s),n&&(n=!1,t.resume())},this};typeof Symbol=="function"&&(rr.prototype[Symbol.asyncIterator]=function(){return sS===void 0&&(sS=mL()),sS(this)});Object.defineProperty(rr.prototype,"readableHighWaterMark",{enumerable:!1,get:function(){return this._readableState.highWaterMark}});Object.defineProperty(rr.prototype,"readableBuffer",{enumerable:!1,get:function(){return this._readableState&&this._readableState.buffer}});Object.defineProperty(rr.prototype,"readableFlowing",{enumerable:!1,get:function(){return this._readableState.flowing},set:function(e){this._readableState&&(this._readableState.flowing=e)}});rr._fromList=AL;Object.defineProperty(rr.prototype,"readableLength",{enumerable:!1,get:function(){return this._readableState.length}});function AL(t,e){if(e.length===0)return null;var r;return e.objectMode?r=e.buffer.shift():!t||t>=e.length?(e.decoder?r=e.buffer.join(""):e.buffer.length===1?r=e.buffer.first():r=e.buffer.concat(e.length),e.buffer.clear()):r=e.buffer.consume(t,e.decoder),r}function fS(t){var e=t._readableState;$t("endReadable",e.endEmitted),e.endEmitted||(e.ended=!0,k.default.nextTick(P0e,e,t))}function P0e(t,e){if($t("endReadableNT",t.endEmitted,t.length),!t.endEmitted&&t.length===0&&(t.endEmitted=!0,e.readable=!1,e.emit("end"),t.autoDestroy)){var r=e._writableState;(!r||r.autoDestroy&&r.finished)&&e.destroy()}}typeof Symbol=="function"&&(rr.from=function(t,e){return aS===void 0&&(aS=gL()),aS(rr,t,e)});function TL(t,e){for(var r=0,n=t.length;r<n;r++)if(t[r]===e)return r;return-1}});var pS=G((nLe,RL)=>{"use strict";p();RL.exports=xd;var G2=Vl().codes,I0e=G2.ERR_METHOD_NOT_IMPLEMENTED,R0e=G2.ERR_MULTIPLE_CALLBACK,M0e=G2.ERR_TRANSFORM_ALREADY_TRANSFORMING,k0e=G2.ERR_TRANSFORM_WITH_LENGTH_0,H2=Kl();Je()(xd,H2);function B0e(t,e){var r=this._transformState;r.transforming=!1;var n=r.writecb;if(n===null)return this.emit("error",new R0e);r.writechunk=null,r.writecb=null,e!=null&&this.push(e),n(t);var i=this._readableState;i.reading=!1,(i.needReadable||i.length<i.highWaterMark)&&this._read(i.highWaterMark)}function xd(t){if(!(this instanceof xd))return new xd(t);H2.call(this,t),this._transformState={afterTransform:B0e.bind(this),needTransform:!1,transforming:!1,writecb:null,writechunk:null,writeencoding:null},this._readableState.needReadable=!0,this._readableState.sync=!1,t&&(typeof t.transform=="function"&&(this._transform=t.transform),typeof t.flush=="function"&&(this._flush=t.flush)),this.on("prefinish",D0e)}function D0e(){var t=this;typeof this._flush=="function"&&!this._readableState.destroyed?this._flush(function(e,r){IL(t,e,r)}):IL(this,null,null)}xd.prototype.push=function(t,e){return this._transformState.needTransform=!1,H2.prototype.push.call(this,t,e)};xd.prototype._transform=function(t,e,r){r(new I0e("_transform()"))};xd.prototype._write=function(t,e,r){var n=this._transformState;if(n.writecb=r,n.writechunk=t,n.writeencoding=e,!n.transforming){var i=this._readableState;(n.needTransform||i.needReadable||i.length<i.highWaterMark)&&this._read(i.highWaterMark)}};xd.prototype._read=function(t){var e=this._transformState;e.writechunk!==null&&!e.transforming?(e.transforming=!0,this._transform(e.writechunk,e.writeencoding,e.afterTransform)):e.needTransform=!0};xd.prototype._destroy=function(t,e){H2.prototype._destroy.call(this,t,function(r){e(r)})};function IL(t,e,r){if(e)return t.emit("error",e);if(r!=null&&t.push(r),t._writableState.length)throw new k0e;if(t._transformState.transforming)throw new M0e;return t.push(null)}});var BL=G((oLe,kL)=>{"use strict";p();kL.exports=Tb;var ML=pS();Je()(Tb,ML);function Tb(t){if(!(this instanceof Tb))return new Tb(t);ML.call(this,t)}Tb.prototype._transform=function(t,e,r){r(null,t)}});var NL=G((aLe,jL)=>{"use strict";p();var mS;function C0e(t){var e=!1;return function(){e||(e=!0,t.apply(void 0,arguments))}}var OL=Vl().codes,O0e=OL.ERR_MISSING_ARGS,j0e=OL.ERR_STREAM_DESTROYED;function DL(t){if(t)throw t}function N0e(t){return t.setHeader&&typeof t.abort=="function"}function q0e(t,e,r,n){n=C0e(n);var i=!1;t.on("close",function(){i=!0}),mS===void 0&&(mS=q2()),mS(t,{readable:e,writable:r},function(s){if(s)return n(s);i=!0,n()});var o=!1;return function(s){if(!i&&!o){if(o=!0,N0e(t))return t.abort();if(typeof t.destroy=="function")return t.destroy();n(s||new j0e("pipe"))}}}function CL(t){t()}function L0e(t,e){return t.pipe(e)}function U0e(t){return!t.length||typeof t[t.length-1]!="function"?DL:t.pop()}function F0e(){for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];var n=U0e(e);if(Array.isArray(e[0])&&(e=e[0]),e.length<2)throw new O0e("streams");var i,o=e.map(function(s,a){var c=a<e.length-1,d=a>0;return q0e(s,c,d,function(f){i||(i=f),f&&o.forEach(CL),!c&&(o.forEach(CL),n(i))})});return e.reduce(L0e)}jL.exports=F0e});var gS=G((dLe,qL)=>{p();qL.exports=Cs;var yS=nc().EventEmitter,z0e=Je();z0e(Cs,yS);Cs.Readable=tS();Cs.Writable=X5();Cs.Duplex=Kl();Cs.Transform=pS();Cs.PassThrough=BL();Cs.finished=q2();Cs.pipeline=NL();Cs.Stream=Cs;function Cs(){yS.call(this)}Cs.prototype.pipe=function(t,e){var r=this;function n(f){t.writable&&t.write(f)===!1&&r.pause&&r.pause()}r.on("data",n);function i(){r.readable&&r.resume&&r.resume()}t.on("drain",i),!t._isStdio&&(!e||e.end!==!1)&&(r.on("end",s),r.on("close",a));var o=!1;function s(){o||(o=!0,t.end())}function a(){o||(o=!0,typeof t.destroy=="function"&&t.destroy())}function c(f){if(d(),yS.listenerCount(this,"error")===0)throw f}r.on("error",c),t.on("error",c);function d(){r.removeListener("data",n),t.removeListener("drain",i),r.removeListener("end",s),r.removeListener("close",a),r.removeListener("error",c),t.removeListener("error",c),r.removeListener("end",d),r.removeListener("close",d),t.removeListener("close",d)}return r.on("end",d),r.on("close",d),t.on("close",d),t.emit("pipe",r),t}});var Ed=G((uLe,UL)=>{"use strict";p();var $0e=it().Buffer,LL=gS().Transform,G0e=xb().StringDecoder,H0e=Je(),W0e=Zg();function ca(t){LL.call(this),this.hashMode=typeof t=="string",this.hashMode?this[t]=this._finalOrDigest:this.final=this._finalOrDigest,this._final&&(this.__final=this._final,this._final=null),this._decoder=null,this._encoding=null}H0e(ca,LL);ca.prototype.update=function(t,e,r){var n=W0e(t,e),i=this._update(n);return this.hashMode?this:(r&&(i=this._toString(i,r)),i)};ca.prototype.setAutoPadding=function(){};ca.prototype.getAuthTag=function(){throw new Error("trying to get auth tag in unsupported state")};ca.prototype.setAuthTag=function(){throw new Error("trying to set auth tag in unsupported state")};ca.prototype.setAAD=function(){throw new Error("trying to set aad in unsupported state")};ca.prototype._transform=function(t,e,r){var n;try{this.hashMode?this._update(t):this.push(this._update(t))}catch(i){n=i}finally{r(n)}};ca.prototype._flush=function(t){var e;try{this.push(this.__final())}catch(r){e=r}t(e)};ca.prototype._finalOrDigest=function(t){var e=this.__final()||$0e.alloc(0);return t&&(e=this._toString(e,t,!0)),e};ca.prototype._toString=function(t,e,r){if(this._decoder||(this._decoder=new G0e(e),this._encoding=e),this._encoding!==e)throw new Error("can\u2019t switch encodings");var n=this._decoder.write(t);return r&&(n+=this._decoder.end()),n};UL.exports=ca});var I0=G((hLe,zL)=>{"use strict";p();var V0e=Je(),K0e=A2(),Z0e=P2(),Y0e=k2(),FL=Ed();function W2(t){FL.call(this,"digest"),this._hash=t}V0e(W2,FL);W2.prototype._update=function(t){this._hash.update(t)};W2.prototype._final=function(){return this._hash.digest()};zL.exports=function(e){return e=e.toLowerCase(),e==="md5"?new K0e:e==="rmd160"||e==="ripemd160"?new Z0e:new W2(Y0e(e))}});var HL=G((mLe,GL)=>{"use strict";p();var J0e=Je(),Xl=it().Buffer,$L=Ed(),X0e=Xl.alloc(128),R0=64;function V2(t,e){$L.call(this,"digest"),typeof e=="string"&&(e=Xl.from(e)),this._alg=t,this._key=e,e.length>R0?e=t(e):e.length<R0&&(e=Xl.concat([e,X0e],R0));for(var r=this._ipad=Xl.allocUnsafe(R0),n=this._opad=Xl.allocUnsafe(R0),i=0;i<R0;i++)r[i]=e[i]^54,n[i]=e[i]^92;this._hash=[r]}J0e(V2,$L);V2.prototype._update=function(t){this._hash.push(t)};V2.prototype._final=function(){var t=this._alg(Xl.concat(this._hash));return this._alg(Xl.concat([this._opad,t]))};GL.exports=V2});var bS=G((gLe,WL)=>{p();var Q0e=A2();WL.exports=function(t){return new Q0e().update(t).digest()}});var _S=G((vLe,KL)=>{"use strict";p();var eme=Je(),tme=HL(),VL=Ed(),Pb=it().Buffer,rme=bS(),vS=P2(),wS=k2(),nme=Pb.alloc(128);function Ib(t,e){VL.call(this,"digest"),typeof e=="string"&&(e=Pb.from(e));var r=t==="sha512"||t==="sha384"?128:64;if(this._alg=t,this._key=e,e.length>r){var n=t==="rmd160"?new vS:wS(t);e=n.update(e).digest()}else e.length<r&&(e=Pb.concat([e,nme],r));for(var i=this._ipad=Pb.allocUnsafe(r),o=this._opad=Pb.allocUnsafe(r),s=0;s<r;s++)i[s]=e[s]^54,o[s]=e[s]^92;this._hash=t==="rmd160"?new vS:wS(t),this._hash.update(i)}eme(Ib,VL);Ib.prototype._update=function(t){this._hash.update(t)};Ib.prototype._final=function(){var t=this._hash.digest(),e=this._alg==="rmd160"?new vS:wS(this._alg);return e.update(this._opad).update(t).digest()};KL.exports=function(e,r){return e=e.toLowerCase(),e==="rmd160"||e==="ripemd160"?new Ib("rmd160",r):e==="md5"?new tme(rme,r):new Ib(e,r)}});var xS=G((_Le,ime)=>{ime.exports={sha224WithRSAEncryption:{sign:"rsa",hash:"sha224",id:"302d300d06096086480165030402040500041c"},"RSA-SHA224":{sign:"ecdsa/rsa",hash:"sha224",id:"302d300d06096086480165030402040500041c"},sha256WithRSAEncryption:{sign:"rsa",hash:"sha256",id:"3031300d060960864801650304020105000420"},"RSA-SHA256":{sign:"ecdsa/rsa",hash:"sha256",id:"3031300d060960864801650304020105000420"},sha384WithRSAEncryption:{sign:"rsa",hash:"sha384",id:"3041300d060960864801650304020205000430"},"RSA-SHA384":{sign:"ecdsa/rsa",hash:"sha384",id:"3041300d060960864801650304020205000430"},sha512WithRSAEncryption:{sign:"rsa",hash:"sha512",id:"3051300d060960864801650304020305000440"},"RSA-SHA512":{sign:"ecdsa/rsa",hash:"sha512",id:"3051300d060960864801650304020305000440"},"RSA-SHA1":{sign:"rsa",hash:"sha1",id:"3021300906052b0e03021a05000414"},"ecdsa-with-SHA1":{sign:"ecdsa",hash:"sha1",id:""},sha256:{sign:"ecdsa",hash:"sha256",id:""},sha224:{sign:"ecdsa",hash:"sha224",id:""},sha384:{sign:"ecdsa",hash:"sha384",id:""},sha512:{sign:"ecdsa",hash:"sha512",id:""},"DSA-SHA":{sign:"dsa",hash:"sha1",id:""},"DSA-SHA1":{sign:"dsa",hash:"sha1",id:""},DSA:{sign:"dsa",hash:"sha1",id:""},"DSA-WITH-SHA224":{sign:"dsa",hash:"sha224",id:""},"DSA-SHA224":{sign:"dsa",hash:"sha224",id:""},"DSA-WITH-SHA256":{sign:"dsa",hash:"sha256",id:""},"DSA-SHA256":{sign:"dsa",hash:"sha256",id:""},"DSA-WITH-SHA384":{sign:"dsa",hash:"sha384",id:""},"DSA-SHA384":{sign:"dsa",hash:"sha384",id:""},"DSA-WITH-SHA512":{sign:"dsa",hash:"sha512",id:""},"DSA-SHA512":{sign:"dsa",hash:"sha512",id:""},"DSA-RIPEMD160":{sign:"dsa",hash:"rmd160",id:""},ripemd160WithRSA:{sign:"rsa",hash:"rmd160",id:"3021300906052b2403020105000414"},"RSA-RIPEMD160":{sign:"rsa",hash:"rmd160",id:"3021300906052b2403020105000414"},md5WithRSAEncryption:{sign:"rsa",hash:"md5",id:"3020300c06082a864886f70d020505000410"},"RSA-MD5":{sign:"rsa",hash:"md5",id:"3020300c06082a864886f70d020505000410"}}});var YL=G((xLe,ZL)=>{"use strict";p();ZL.exports=xS()});var ES=G((SLe,JL)=>{"use strict";p();var ome=isFinite,sme=Math.pow(2,30)-1;JL.exports=function(t,e){if(typeof t!="number")throw new TypeError("Iterations not a number");if(t<0||!ome(t))throw new TypeError("Bad iterations");if(typeof e!="number")throw new TypeError("Key length not a number");if(e<0||e>sme||e!==e)throw new TypeError("Bad key length")}});var SS=G((TLe,QL)=>{"use strict";p();var K2;globalThis.process&&globalThis.process.browser?K2="utf-8":globalThis.process&&globalThis.process.version?(XL=parseInt(k.default.version.split(".")[0].slice(1),10),K2=XL>=6?"utf-8":"binary"):K2="utf-8";var XL;QL.exports=K2});var AS=G((ILe,rU)=>{"use strict";p();var ame=it().Buffer,cme=Zg(),tU=typeof Uint8Array<"u",dme=tU&&typeof ArrayBuffer<"u",eU=dme&&ArrayBuffer.isView;rU.exports=function(t,e,r){if(typeof t=="string"||ame.isBuffer(t)||tU&&t instanceof Uint8Array||eU&&eU(t))return cme(t,e);throw new TypeError(r+" must be a string, a Buffer, a Uint8Array, or a DataView")}});var TS=G((MLe,sU)=>{"use strict";p();var fme=bS(),ume=P2(),lme=k2(),Ql=it().Buffer,hme=ES(),nU=SS(),iU=AS(),pme=Ql.alloc(128),Z2={__proto__:null,md5:16,sha1:20,sha224:28,sha256:32,sha384:48,sha512:64,"sha512-256":32,ripemd160:20,rmd160:20},mme={__proto__:null,"sha-1":"sha1","sha-224":"sha224","sha-256":"sha256","sha-384":"sha384","sha-512":"sha512","ripemd-160":"ripemd160"};function yme(t){return new ume().update(t).digest()}function gme(t){function e(r){return lme(t).update(r).digest()}return t==="rmd160"||t==="ripemd160"?yme:t==="md5"?fme:e}function oU(t,e,r){var n=gme(t),i=t==="sha512"||t==="sha384"?128:64;e.length>i?e=n(e):e.length<i&&(e=Ql.concat([e,pme],i));for(var o=Ql.allocUnsafe(i+Z2[t]),s=Ql.allocUnsafe(i+Z2[t]),a=0;a<i;a++)o[a]=e[a]^54,s[a]=e[a]^92;var c=Ql.allocUnsafe(i+r+4);o.copy(c,0,0,i),this.ipad1=c,this.ipad2=o,this.opad=s,this.alg=t,this.blocksize=i,this.hash=n,this.size=Z2[t]}oU.prototype.run=function(t,e){t.copy(e,this.blocksize);var r=this.hash(e);return r.copy(this.opad,this.blocksize),this.hash(this.opad)};function bme(t,e,r,n,i){hme(r,n),t=iU(t,nU,"Password"),e=iU(e,nU,"Salt");var o=(i||"sha1").toLowerCase(),s=mme[o]||o,a=Z2[s];if(typeof a!="number"||!a)throw new TypeError("Digest algorithm not supported: "+i);var c=new oU(s,t,e.length),d=Ql.allocUnsafe(n),f=Ql.allocUnsafe(e.length+4);e.copy(f,0,0,e.length);for(var u=0,m=a,_=Math.ceil(n/m),v=1;v<=_;v++){f.writeUInt32BE(v,e.length);for(var A=c.run(f,c.ipad1),T=A,M=1;M<r;M++){T=c.run(T,c.ipad2);for(var D=0;D<m;D++)A[D]^=T[D]}A.copy(d,u),u+=m}return d}sU.exports=bme});var hU=G((BLe,lU)=>{"use strict";p();var fU=it().Buffer,vme=ES(),aU=SS(),cU=TS(),dU=AS(),Y2,Rb=globalThis.crypto&&globalThis.crypto.subtle,wme={sha:"SHA-1","sha-1":"SHA-1",sha1:"SHA-1",sha256:"SHA-256","sha-256":"SHA-256",sha384:"SHA-384","sha-384":"SHA-384","sha-512":"SHA-512",sha512:"SHA-512"},PS=[],eh;function IS(){return eh||(globalThis.process&&globalThis.process.nextTick?eh=globalThis.process.nextTick:globalThis.queueMicrotask?eh=globalThis.queueMicrotask:globalThis.setImmediate?eh=globalThis.setImmediate:eh=globalThis.setTimeout,eh)}function uU(t,e,r,n,i){return Rb.importKey("raw",t,{name:"PBKDF2"},!1,["deriveBits"]).then(function(o){return Rb.deriveBits({name:"PBKDF2",salt:e,iterations:r,hash:{name:i}},o,n<<3)}).then(function(o){return fU.from(o)})}function _me(t){if(globalThis.process&&!globalThis.process.browser||!Rb||!Rb.importKey||!Rb.deriveBits)return Promise.resolve(!1);if(PS[t]!==void 0)return PS[t];Y2=Y2||fU.alloc(8);var e=uU(Y2,Y2,10,128,t).then(function(){return!0},function(){return!1});return PS[t]=e,e}function xme(t,e){t.then(function(r){IS()(function(){e(null,r)})},function(r){IS()(function(){e(r)})})}lU.exports=function(t,e,r,n,i,o){if(typeof i=="function"&&(o=i,i=void 0),vme(r,n),t=dU(t,aU,"Password"),e=dU(e,aU,"Salt"),typeof o!="function")throw new Error("No callback provided to pbkdf2");i=i||"sha1";var s=wme[i.toLowerCase()];if(!s||typeof globalThis.Promise!="function"){IS()(function(){var a;try{a=cU(t,e,r,n,i)}catch(c){o(c);return}o(null,a)});return}xme(_me(s).then(function(a){return a?uU(t,e,r,n,s):cU(t,e,r,n,i)}),o)}});var MS=G(RS=>{"use strict";p();RS.pbkdf2=hU();RS.pbkdf2Sync=TS()});var kS=G(Os=>{"use strict";p();Os.readUInt32BE=function(e,r){var n=e[0+r]<<24|e[1+r]<<16|e[2+r]<<8|e[3+r];return n>>>0};Os.writeUInt32BE=function(e,r,n){e[0+n]=r>>>24,e[1+n]=r>>>16&255,e[2+n]=r>>>8&255,e[3+n]=r&255};Os.ip=function(e,r,n,i){for(var o=0,s=0,a=6;a>=0;a-=2){for(var c=0;c<=24;c+=8)o<<=1,o|=r>>>c+a&1;for(var c=0;c<=24;c+=8)o<<=1,o|=e>>>c+a&1}for(var a=6;a>=0;a-=2){for(var c=1;c<=25;c+=8)s<<=1,s|=r>>>c+a&1;for(var c=1;c<=25;c+=8)s<<=1,s|=e>>>c+a&1}n[i+0]=o>>>0,n[i+1]=s>>>0};Os.rip=function(e,r,n,i){for(var o=0,s=0,a=0;a<4;a++)for(var c=24;c>=0;c-=8)o<<=1,o|=r>>>c+a&1,o<<=1,o|=e>>>c+a&1;for(var a=4;a<8;a++)for(var c=24;c>=0;c-=8)s<<=1,s|=r>>>c+a&1,s<<=1,s|=e>>>c+a&1;n[i+0]=o>>>0,n[i+1]=s>>>0};Os.pc1=function(e,r,n,i){for(var o=0,s=0,a=7;a>=5;a--){for(var c=0;c<=24;c+=8)o<<=1,o|=r>>c+a&1;for(var c=0;c<=24;c+=8)o<<=1,o|=e>>c+a&1}for(var c=0;c<=24;c+=8)o<<=1,o|=r>>c+a&1;for(var a=1;a<=3;a++){for(var c=0;c<=24;c+=8)s<<=1,s|=r>>c+a&1;for(var c=0;c<=24;c+=8)s<<=1,s|=e>>c+a&1}for(var c=0;c<=24;c+=8)s<<=1,s|=e>>c+a&1;n[i+0]=o>>>0,n[i+1]=s>>>0};Os.r28shl=function(e,r){return e<<r&268435455|e>>>28-r};var J2=[14,11,17,4,27,23,25,0,13,22,7,18,5,9,16,24,2,20,12,21,1,8,15,26,15,4,25,19,9,1,26,16,5,11,23,8,12,7,17,0,22,3,10,14,6,20,27,24];Os.pc2=function(e,r,n,i){for(var o=0,s=0,a=J2.length>>>1,c=0;c<a;c++)o<<=1,o|=e>>>J2[c]&1;for(var c=a;c<J2.length;c++)s<<=1,s|=r>>>J2[c]&1;n[i+0]=o>>>0,n[i+1]=s>>>0};Os.expand=function(e,r,n){var i=0,o=0;i=(e&1)<<5|e>>>27;for(var s=23;s>=15;s-=4)i<<=6,i|=e>>>s&63;for(var s=11;s>=3;s-=4)o|=e>>>s&63,o<<=6;o|=(e&31)<<1|e>>>31,r[n+0]=i>>>0,r[n+1]=o>>>0};var pU=[14,0,4,15,13,7,1,4,2,14,15,2,11,13,8,1,3,10,10,6,6,12,12,11,5,9,9,5,0,3,7,8,4,15,1,12,14,8,8,2,13,4,6,9,2,1,11,7,15,5,12,11,9,3,7,14,3,10,10,0,5,6,0,13,15,3,1,13,8,4,14,7,6,15,11,2,3,8,4,14,9,12,7,0,2,1,13,10,12,6,0,9,5,11,10,5,0,13,14,8,7,10,11,1,10,3,4,15,13,4,1,2,5,11,8,6,12,7,6,12,9,0,3,5,2,14,15,9,10,13,0,7,9,0,14,9,6,3,3,4,15,6,5,10,1,2,13,8,12,5,7,14,11,12,4,11,2,15,8,1,13,1,6,10,4,13,9,0,8,6,15,9,3,8,0,7,11,4,1,15,2,14,12,3,5,11,10,5,14,2,7,12,7,13,13,8,14,11,3,5,0,6,6,15,9,0,10,3,1,4,2,7,8,2,5,12,11,1,12,10,4,14,15,9,10,3,6,15,9,0,0,6,12,10,11,1,7,13,13,8,15,9,1,4,3,5,14,11,5,12,2,7,8,2,4,14,2,14,12,11,4,2,1,12,7,4,10,7,11,13,6,1,8,5,5,0,3,15,15,10,13,3,0,9,14,8,9,6,4,11,2,8,1,12,11,7,10,1,13,14,7,2,8,13,15,6,9,15,12,0,5,9,6,10,3,4,0,5,14,3,12,10,1,15,10,4,15,2,9,7,2,12,6,9,8,5,0,6,13,1,3,13,4,14,14,0,7,11,5,3,11,8,9,4,14,3,15,2,5,12,2,9,8,5,12,15,3,10,7,11,0,14,4,1,10,7,1,6,13,0,11,8,6,13,4,13,11,0,2,11,14,7,15,4,0,9,8,1,13,10,3,14,12,3,9,5,7,12,5,2,10,15,6,8,1,6,1,6,4,11,11,13,13,8,12,1,3,4,7,10,14,7,10,9,15,5,6,0,8,15,0,14,5,2,9,3,2,12,13,1,2,15,8,13,4,8,6,10,15,3,11,7,1,4,10,12,9,5,3,6,14,11,5,0,0,14,12,9,7,2,7,2,11,1,4,14,1,7,9,4,12,10,14,8,2,13,0,15,6,12,10,9,13,0,15,3,3,5,5,6,8,11];Os.substitute=function(e,r){for(var n=0,i=0;i<4;i++){var o=e>>>18-i*6&63,s=pU[i*64+o];n<<=4,n|=s}for(var i=0;i<4;i++){var o=r>>>18-i*6&63,s=pU[4*64+i*64+o];n<<=4,n|=s}return n>>>0};var mU=[16,25,12,11,3,20,4,15,31,17,9,6,27,14,1,22,30,24,8,18,0,5,29,23,13,19,2,26,10,21,28,7];Os.permute=function(e){for(var r=0,n=0;n<mU.length;n++)r<<=1,r|=e>>>mU[n]&1;return r>>>0};Os.padSplit=function(e,r,n){for(var i=e.toString(2);i.length<r;)i="0"+i;for(var o=[],s=0;s<r;s+=n)o.push(i.slice(s,s+n));return o.join(" ")}});var es=G((qLe,gU)=>{p();gU.exports=yU;function yU(t,e){if(!t)throw new Error(e||"Assertion failed")}yU.equal=function(e,r,n){if(e!=r)throw new Error(n||"Assertion failed: "+e+" != "+r)}});var X2=G((ULe,bU)=>{"use strict";p();var Eme=es();function js(t){this.options=t,this.type=this.options.type,this.blockSize=8,this._init(),this.buffer=new Array(this.blockSize),this.bufferOff=0,this.padding=t.padding!==!1}bU.exports=js;js.prototype._init=function(){};js.prototype.update=function(e){return e.length===0?[]:this.type==="decrypt"?this._updateDecrypt(e):this._updateEncrypt(e)};js.prototype._buffer=function(e,r){for(var n=Math.min(this.buffer.length-this.bufferOff,e.length-r),i=0;i<n;i++)this.buffer[this.bufferOff+i]=e[r+i];return this.bufferOff+=n,n};js.prototype._flushBuffer=function(e,r){return this._update(this.buffer,0,e,r),this.bufferOff=0,this.blockSize};js.prototype._updateEncrypt=function(e){var r=0,n=0,i=(this.bufferOff+e.length)/this.blockSize|0,o=new Array(i*this.blockSize);this.bufferOff!==0&&(r+=this._buffer(e,r),this.bufferOff===this.buffer.length&&(n+=this._flushBuffer(o,n)));for(var s=e.length-(e.length-r)%this.blockSize;r<s;r+=this.blockSize)this._update(e,r,o,n),n+=this.blockSize;for(;r<e.length;r++,this.bufferOff++)this.buffer[this.bufferOff]=e[r];return o};js.prototype._updateDecrypt=function(e){for(var r=0,n=0,i=Math.ceil((this.bufferOff+e.length)/this.blockSize)-1,o=new Array(i*this.blockSize);i>0;i--)r+=this._buffer(e,r),n+=this._flushBuffer(o,n);return r+=this._buffer(e,r),o};js.prototype.final=function(e){var r;e&&(r=this.update(e));var n;return this.type==="encrypt"?n=this._finalEncrypt():n=this._finalDecrypt(),r?r.concat(n):n};js.prototype._pad=function(e,r){if(r===0)return!1;for(;r<e.length;)e[r++]=0;return!0};js.prototype._finalEncrypt=function(){if(!this._pad(this.buffer,this.bufferOff))return[];var e=new Array(this.blockSize);return this._update(this.buffer,0,e,0),e};js.prototype._unpad=function(e){return e};js.prototype._finalDecrypt=function(){Eme.equal(this.bufferOff,this.blockSize,"Not enough data to decrypt");var e=new Array(this.blockSize);return this._flushBuffer(e,0),this._unpad(e)}});var BS=G((zLe,_U)=>{"use strict";p();var vU=es(),Sme=Je(),On=kS(),wU=X2();function Ame(){this.tmp=new Array(2),this.keys=null}function sc(t){wU.call(this,t);var e=new Ame;this._desState=e,this.deriveKeys(e,t.key)}Sme(sc,wU);_U.exports=sc;sc.create=function(e){return new sc(e)};var Tme=[1,1,2,2,2,2,2,2,1,2,2,2,2,2,2,1];sc.prototype.deriveKeys=function(e,r){e.keys=new Array(16*2),vU.equal(r.length,this.blockSize,"Invalid key length");var n=On.readUInt32BE(r,0),i=On.readUInt32BE(r,4);On.pc1(n,i,e.tmp,0),n=e.tmp[0],i=e.tmp[1];for(var o=0;o<e.keys.length;o+=2){var s=Tme[o>>>1];n=On.r28shl(n,s),i=On.r28shl(i,s),On.pc2(n,i,e.keys,o)}};sc.prototype._update=function(e,r,n,i){var o=this._desState,s=On.readUInt32BE(e,r),a=On.readUInt32BE(e,r+4);On.ip(s,a,o.tmp,0),s=o.tmp[0],a=o.tmp[1],this.type==="encrypt"?this._encrypt(o,s,a,o.tmp,0):this._decrypt(o,s,a,o.tmp,0),s=o.tmp[0],a=o.tmp[1],On.writeUInt32BE(n,s,i),On.writeUInt32BE(n,a,i+4)};sc.prototype._pad=function(e,r){if(this.padding===!1)return!1;for(var n=e.length-r,i=r;i<e.length;i++)e[i]=n;return!0};sc.prototype._unpad=function(e){if(this.padding===!1)return e;for(var r=e[e.length-1],n=e.length-r;n<e.length;n++)vU.equal(e[n],r);return e.slice(0,e.length-r)};sc.prototype._encrypt=function(e,r,n,i,o){for(var s=r,a=n,c=0;c<e.keys.length;c+=2){var d=e.keys[c],f=e.keys[c+1];On.expand(a,e.tmp,0),d^=e.tmp[0],f^=e.tmp[1];var u=On.substitute(d,f),m=On.permute(u),_=a;a=(s^m)>>>0,s=_}On.rip(a,s,i,o)};sc.prototype._decrypt=function(e,r,n,i,o){for(var s=n,a=r,c=e.keys.length-2;c>=0;c-=2){var d=e.keys[c],f=e.keys[c+1];On.expand(s,e.tmp,0),d^=e.tmp[0],f^=e.tmp[1];var u=On.substitute(d,f),m=On.permute(u),_=s;s=(a^m)>>>0,a=_}On.rip(s,a,i,o)}});var EU=G(xU=>{"use strict";p();var Pme=es(),Ime=Je(),Q2={};function Rme(t){Pme.equal(t.length,8,"Invalid IV length"),this.iv=new Array(8);for(var e=0;e<this.iv.length;e++)this.iv[e]=t[e]}function Mme(t){function e(o){t.call(this,o),this._cbcInit()}Ime(e,t);for(var r=Object.keys(Q2),n=0;n<r.length;n++){var i=r[n];e.prototype[i]=Q2[i]}return e.create=function(s){return new e(s)},e}xU.instantiate=Mme;Q2._cbcInit=function(){var e=new Rme(this.options.iv);this._cbcState=e};Q2._update=function(e,r,n,i){var o=this._cbcState,s=this.constructor.super_.prototype,a=o.iv;if(this.type==="encrypt"){for(var c=0;c<this.blockSize;c++)a[c]^=e[r+c];s._update.call(this,a,0,n,i);for(var c=0;c<this.blockSize;c++)a[c]=n[i+c]}else{s._update.call(this,e,r,n,i);for(var c=0;c<this.blockSize;c++)n[i+c]^=a[c];for(var c=0;c<this.blockSize;c++)a[c]=e[r+c]}}});var TU=G((WLe,AU)=>{"use strict";p();var kme=es(),Bme=Je(),SU=X2(),Vf=BS();function Dme(t,e){kme.equal(e.length,24,"Invalid key length");var r=e.slice(0,8),n=e.slice(8,16),i=e.slice(16,24);t==="encrypt"?this.ciphers=[Vf.create({type:"encrypt",key:r}),Vf.create({type:"decrypt",key:n}),Vf.create({type:"encrypt",key:i})]:this.ciphers=[Vf.create({type:"decrypt",key:i}),Vf.create({type:"encrypt",key:n}),Vf.create({type:"decrypt",key:r})]}function th(t){SU.call(this,t);var e=new Dme(this.type,this.options.key);this._edeState=e}Bme(th,SU);AU.exports=th;th.create=function(e){return new th(e)};th.prototype._update=function(e,r,n,i){var o=this._edeState;o.ciphers[0]._update(e,r,n,i),o.ciphers[1]._update(n,i,n,i),o.ciphers[2]._update(n,i,n,i)};th.prototype._pad=Vf.prototype._pad;th.prototype._unpad=Vf.prototype._unpad});var PU=G(M0=>{"use strict";p();M0.utils=kS();M0.Cipher=X2();M0.DES=BS();M0.CBC=EU();M0.EDE=TU()});var MU=G((YLe,RU)=>{p();var IU=Ed(),Sd=PU(),Cme=Je(),rh=it().Buffer,Mb={"des-ede3-cbc":Sd.CBC.instantiate(Sd.EDE),"des-ede3":Sd.EDE,"des-ede-cbc":Sd.CBC.instantiate(Sd.EDE),"des-ede":Sd.EDE,"des-cbc":Sd.CBC.instantiate(Sd.DES),"des-ecb":Sd.DES};Mb.des=Mb["des-cbc"];Mb.des3=Mb["des-ede3-cbc"];RU.exports=e_;Cme(e_,IU);function e_(t){IU.call(this);var e=t.mode.toLowerCase(),r=Mb[e],n;t.decrypt?n="decrypt":n="encrypt";var i=t.key;rh.isBuffer(i)||(i=rh.from(i)),(e==="des-ede"||e==="des-ede-cbc")&&(i=rh.concat([i,i.slice(0,8)]));var o=t.iv;rh.isBuffer(o)||(o=rh.from(o)),this._des=r.create({key:i,iv:o,type:n})}e_.prototype._update=function(t){return rh.from(this._des.update(t))};e_.prototype._final=function(){return rh.from(this._des.final())}});var kU=G(DS=>{p();DS.encrypt=function(t,e){return t._cipher.encryptBlock(e)};DS.decrypt=function(t,e){return t._cipher.decryptBlock(e)}});var k0=G((eUe,BU)=>{p();BU.exports=function(e,r){for(var n=Math.min(e.length,r.length),i=new C.Buffer(n),o=0;o<n;++o)i[o]=e[o]^r[o];return i}});var CU=G(CS=>{p();var DU=k0();CS.encrypt=function(t,e){var r=DU(e,t._prev);return t._prev=t._cipher.encryptBlock(r),t._prev};CS.decrypt=function(t,e){var r=t._prev;t._prev=e;var n=t._cipher.decryptBlock(e);return DU(n,r)}});var NU=G(jU=>{p();var kb=it().Buffer,Ome=k0();function OU(t,e,r){var n=e.length,i=Ome(e,t._cache);return t._cache=t._cache.slice(n),t._prev=kb.concat([t._prev,r?e:i]),i}jU.encrypt=function(t,e,r){for(var n=kb.allocUnsafe(0),i;e.length;)if(t._cache.length===0&&(t._cache=t._cipher.encryptBlock(t._prev),t._prev=kb.allocUnsafe(0)),t._cache.length<=e.length)i=t._cache.length,n=kb.concat([n,OU(t,e.slice(0,i),r)]),e=e.slice(i);else{n=kb.concat([n,OU(t,e,r)]);break}return n}});var LU=G(qU=>{p();var OS=it().Buffer;function jme(t,e,r){var n=t._cipher.encryptBlock(t._prev),i=n[0]^e;return t._prev=OS.concat([t._prev.slice(1),OS.from([r?e:i])]),i}qU.encrypt=function(t,e,r){for(var n=e.length,i=OS.allocUnsafe(n),o=-1;++o<n;)i[o]=jme(t,e[o],r);return i}});var FU=G(UU=>{p();var t_=it().Buffer;function Nme(t,e,r){for(var n,i=-1,o=8,s=0,a,c;++i<o;)n=t._cipher.encryptBlock(t._prev),a=e&1<<7-i?128:0,c=n[0]^a,s+=(c&128)>>i%8,t._prev=qme(t._prev,r?a:c);return s}function qme(t,e){var r=t.length,n=-1,i=t_.allocUnsafe(t.length);for(t=t_.concat([t,t_.from([e])]);++n<r;)i[n]=t[n]<<1|t[n+1]>>7;return i}UU.encrypt=function(t,e,r){for(var n=e.length,i=t_.allocUnsafe(n),o=-1;++o<n;)i[o]=Nme(t,e[o],r);return i}});var $U=G(zU=>{p();var Lme=k0();function Ume(t){return t._prev=t._cipher.encryptBlock(t._prev),t._prev}zU.encrypt=function(t,e){for(;t._cache.length<e.length;)t._cache=C.Buffer.concat([t._cache,Ume(t)]);var r=t._cache.slice(0,e.length);return t._cache=t._cache.slice(e.length),Lme(e,r)}});var jS=G((lUe,GU)=>{p();function Fme(t){for(var e=t.length,r;e--;)if(r=t.readUInt8(e),r===255)t.writeUInt8(0,e);else{r++,t.writeUInt8(r,e);break}}GU.exports=Fme});var qS=G(WU=>{p();var zme=k0(),HU=it().Buffer,$me=jS();function Gme(t){var e=t._cipher.encryptBlockRaw(t._prev);return $me(t._prev),e}var NS=16;WU.encrypt=function(t,e){var r=Math.ceil(e.length/NS),n=t._cache.length;t._cache=HU.concat([t._cache,HU.allocUnsafe(r*NS)]);for(var i=0;i<r;i++){var o=Gme(t),s=n+i*NS;t._cache.writeUInt32BE(o[0],s+0),t._cache.writeUInt32BE(o[1],s+4),t._cache.writeUInt32BE(o[2],s+8),t._cache.writeUInt32BE(o[3],s+12)}var a=t._cache.slice(0,e.length);return t._cache=t._cache.slice(e.length),zme(e,a)}});var LS=G((yUe,Hme)=>{Hme.exports={"aes-128-ecb":{cipher:"AES",key:128,iv:0,mode:"ECB",type:"block"},"aes-192-ecb":{cipher:"AES",key:192,iv:0,mode:"ECB",type:"block"},"aes-256-ecb":{cipher:"AES",key:256,iv:0,mode:"ECB",type:"block"},"aes-128-cbc":{cipher:"AES",key:128,iv:16,mode:"CBC",type:"block"},"aes-192-cbc":{cipher:"AES",key:192,iv:16,mode:"CBC",type:"block"},"aes-256-cbc":{cipher:"AES",key:256,iv:16,mode:"CBC",type:"block"},aes128:{cipher:"AES",key:128,iv:16,mode:"CBC",type:"block"},aes192:{cipher:"AES",key:192,iv:16,mode:"CBC",type:"block"},aes256:{cipher:"AES",key:256,iv:16,mode:"CBC",type:"block"},"aes-128-cfb":{cipher:"AES",key:128,iv:16,mode:"CFB",type:"stream"},"aes-192-cfb":{cipher:"AES",key:192,iv:16,mode:"CFB",type:"stream"},"aes-256-cfb":{cipher:"AES",key:256,iv:16,mode:"CFB",type:"stream"},"aes-128-cfb8":{cipher:"AES",key:128,iv:16,mode:"CFB8",type:"stream"},"aes-192-cfb8":{cipher:"AES",key:192,iv:16,mode:"CFB8",type:"stream"},"aes-256-cfb8":{cipher:"AES",key:256,iv:16,mode:"CFB8",type:"stream"},"aes-128-cfb1":{cipher:"AES",key:128,iv:16,mode:"CFB1",type:"stream"},"aes-192-cfb1":{cipher:"AES",key:192,iv:16,mode:"CFB1",type:"stream"},"aes-256-cfb1":{cipher:"AES",key:256,iv:16,mode:"CFB1",type:"stream"},"aes-128-ofb":{cipher:"AES",key:128,iv:16,mode:"OFB",type:"stream"},"aes-192-ofb":{cipher:"AES",key:192,iv:16,mode:"OFB",type:"stream"},"aes-256-ofb":{cipher:"AES",key:256,iv:16,mode:"OFB",type:"stream"},"aes-128-ctr":{cipher:"AES",key:128,iv:16,mode:"CTR",type:"stream"},"aes-192-ctr":{cipher:"AES",key:192,iv:16,mode:"CTR",type:"stream"},"aes-256-ctr":{cipher:"AES",key:256,iv:16,mode:"CTR",type:"stream"},"aes-128-gcm":{cipher:"AES",key:128,iv:12,mode:"GCM",type:"auth"},"aes-192-gcm":{cipher:"AES",key:192,iv:12,mode:"GCM",type:"auth"},"aes-256-gcm":{cipher:"AES",key:256,iv:12,mode:"GCM",type:"auth"}}});var n_=G((gUe,VU)=>{p();var Wme={ECB:kU(),CBC:CU(),CFB:NU(),CFB8:LU(),CFB1:FU(),OFB:$U(),CTR:qS(),GCM:qS()},r_=LS();for(US in r_)r_[US].module=Wme[r_[US].mode];var US;VU.exports=r_});var Bb=G((vUe,ZU)=>{p();var i_=it().Buffer;function zS(t){i_.isBuffer(t)||(t=i_.from(t));for(var e=t.length/4|0,r=new Array(e),n=0;n<e;n++)r[n]=t.readUInt32BE(n*4);return r}function FS(t){for(var e=0;e<t.length;t++)t[e]=0}function KU(t,e,r,n,i){for(var o=r[0],s=r[1],a=r[2],c=r[3],d=t[0]^e[0],f=t[1]^e[1],u=t[2]^e[2],m=t[3]^e[3],_,v,A,T,M=4,D=1;D<i;D++)_=o[d>>>24]^s[f>>>16&255]^a[u>>>8&255]^c[m&255]^e[M++],v=o[f>>>24]^s[u>>>16&255]^a[m>>>8&255]^c[d&255]^e[M++],A=o[u>>>24]^s[m>>>16&255]^a[d>>>8&255]^c[f&255]^e[M++],T=o[m>>>24]^s[d>>>16&255]^a[f>>>8&255]^c[u&255]^e[M++],d=_,f=v,u=A,m=T;return _=(n[d>>>24]<<24|n[f>>>16&255]<<16|n[u>>>8&255]<<8|n[m&255])^e[M++],v=(n[f>>>24]<<24|n[u>>>16&255]<<16|n[m>>>8&255]<<8|n[d&255])^e[M++],A=(n[u>>>24]<<24|n[m>>>16&255]<<16|n[d>>>8&255]<<8|n[f&255])^e[M++],T=(n[m>>>24]<<24|n[d>>>16&255]<<16|n[f>>>8&255]<<8|n[u&255])^e[M++],_=_>>>0,v=v>>>0,A=A>>>0,T=T>>>0,[_,v,A,T]}var Vme=[0,1,2,4,8,16,32,64,128,27,54],In=function(){for(var t=new Array(256),e=0;e<256;e++)e<128?t[e]=e<<1:t[e]=e<<1^283;for(var r=[],n=[],i=[[],[],[],[]],o=[[],[],[],[]],s=0,a=0,c=0;c<256;++c){var d=a^a<<1^a<<2^a<<3^a<<4;d=d>>>8^d&255^99,r[s]=d,n[d]=s;var f=t[s],u=t[f],m=t[u],_=t[d]*257^d*16843008;i[0][s]=_<<24|_>>>8,i[1][s]=_<<16|_>>>16,i[2][s]=_<<8|_>>>24,i[3][s]=_,_=m*16843009^u*65537^f*257^s*16843008,o[0][d]=_<<24|_>>>8,o[1][d]=_<<16|_>>>16,o[2][d]=_<<8|_>>>24,o[3][d]=_,s===0?s=a=1:(s=f^t[t[t[m^f]]],a^=t[t[a]])}return{SBOX:r,INV_SBOX:n,SUB_MIX:i,INV_SUB_MIX:o}}();function Ns(t){this._key=zS(t),this._reset()}Ns.blockSize=4*4;Ns.keySize=256/8;Ns.prototype.blockSize=Ns.blockSize;Ns.prototype.keySize=Ns.keySize;Ns.prototype._reset=function(){for(var t=this._key,e=t.length,r=e+6,n=(r+1)*4,i=[],o=0;o<e;o++)i[o]=t[o];for(o=e;o<n;o++){var s=i[o-1];o%e===0?(s=s<<8|s>>>24,s=In.SBOX[s>>>24]<<24|In.SBOX[s>>>16&255]<<16|In.SBOX[s>>>8&255]<<8|In.SBOX[s&255],s^=Vme[o/e|0]<<24):e>6&&o%e===4&&(s=In.SBOX[s>>>24]<<24|In.SBOX[s>>>16&255]<<16|In.SBOX[s>>>8&255]<<8|In.SBOX[s&255]),i[o]=i[o-e]^s}for(var a=[],c=0;c<n;c++){var d=n-c,f=i[d-(c%4?0:4)];c<4||d<=4?a[c]=f:a[c]=In.INV_SUB_MIX[0][In.SBOX[f>>>24]]^In.INV_SUB_MIX[1][In.SBOX[f>>>16&255]]^In.INV_SUB_MIX[2][In.SBOX[f>>>8&255]]^In.INV_SUB_MIX[3][In.SBOX[f&255]]}this._nRounds=r,this._keySchedule=i,this._invKeySchedule=a};Ns.prototype.encryptBlockRaw=function(t){return t=zS(t),KU(t,this._keySchedule,In.SUB_MIX,In.SBOX,this._nRounds)};Ns.prototype.encryptBlock=function(t){var e=this.encryptBlockRaw(t),r=i_.allocUnsafe(16);return r.writeUInt32BE(e[0],0),r.writeUInt32BE(e[1],4),r.writeUInt32BE(e[2],8),r.writeUInt32BE(e[3],12),r};Ns.prototype.decryptBlock=function(t){t=zS(t);var e=t[1];t[1]=t[3],t[3]=e;var r=KU(t,this._invKeySchedule,In.INV_SUB_MIX,In.INV_SBOX,this._nRounds),n=i_.allocUnsafe(16);return n.writeUInt32BE(r[0],0),n.writeUInt32BE(r[3],4),n.writeUInt32BE(r[2],8),n.writeUInt32BE(r[1],12),n};Ns.prototype.scrub=function(){FS(this._keySchedule),FS(this._invKeySchedule),FS(this._key)};ZU.exports.AES=Ns});var XU=G((_Ue,JU)=>{p();var B0=it().Buffer,Kme=B0.alloc(16,0);function Zme(t){return[t.readUInt32BE(0),t.readUInt32BE(4),t.readUInt32BE(8),t.readUInt32BE(12)]}function YU(t){var e=B0.allocUnsafe(16);return e.writeUInt32BE(t[0]>>>0,0),e.writeUInt32BE(t[1]>>>0,4),e.writeUInt32BE(t[2]>>>0,8),e.writeUInt32BE(t[3]>>>0,12),e}function Db(t){this.h=t,this.state=B0.alloc(16,0),this.cache=B0.allocUnsafe(0)}Db.prototype.ghash=function(t){for(var e=-1;++e<t.length;)this.state[e]^=t[e];this._multiply()};Db.prototype._multiply=function(){for(var t=Zme(this.h),e=[0,0,0,0],r,n,i,o=-1;++o<128;){for(n=(this.state[~~(o/8)]&1<<7-o%8)!==0,n&&(e[0]^=t[0],e[1]^=t[1],e[2]^=t[2],e[3]^=t[3]),i=(t[3]&1)!==0,r=3;r>0;r--)t[r]=t[r]>>>1|(t[r-1]&1)<<31;t[0]=t[0]>>>1,i&&(t[0]=t[0]^225<<24)}this.state=YU(e)};Db.prototype.update=function(t){this.cache=B0.concat([this.cache,t]);for(var e;this.cache.length>=16;)e=this.cache.slice(0,16),this.cache=this.cache.slice(16),this.ghash(e)};Db.prototype.final=function(t,e){return this.cache.length&&this.ghash(B0.concat([this.cache,Kme],16)),this.ghash(YU([0,t,0,e])),this.state};JU.exports=Db});var $S=G((EUe,tF)=>{p();var Yme=Bb(),Po=it().Buffer,QU=Ed(),Jme=Je(),eF=XU(),Xme=k0(),Qme=jS();function eye(t,e){var r=0;t.length!==e.length&&r++;for(var n=Math.min(t.length,e.length),i=0;i<n;++i)r+=t[i]^e[i];return r}function tye(t,e,r){if(e.length===12)return t._finID=Po.concat([e,Po.from([0,0,0,1])]),Po.concat([e,Po.from([0,0,0,2])]);var n=new eF(r),i=e.length,o=i%16;n.update(e),o&&(o=16-o,n.update(Po.alloc(o,0))),n.update(Po.alloc(8,0));var s=i*8,a=Po.alloc(8);a.writeUIntBE(s,0,8),n.update(a),t._finID=n.state;var c=Po.from(t._finID);return Qme(c),c}function nh(t,e,r,n){QU.call(this);var i=Po.alloc(4,0);this._cipher=new Yme.AES(e);var o=this._cipher.encryptBlock(i);this._ghash=new eF(o),r=tye(this,r,o),this._prev=Po.from(r),this._cache=Po.allocUnsafe(0),this._secCache=Po.allocUnsafe(0),this._decrypt=n,this._alen=0,this._len=0,this._mode=t,this._authTag=null,this._called=!1}Jme(nh,QU);nh.prototype._update=function(t){if(!this._called&&this._alen){var e=16-this._alen%16;e<16&&(e=Po.alloc(e,0),this._ghash.update(e))}this._called=!0;var r=this._mode.encrypt(this,t);return this._decrypt?this._ghash.update(t):this._ghash.update(r),this._len+=t.length,r};nh.prototype._final=function(){if(this._decrypt&&!this._authTag)throw new Error("Unsupported state or unable to authenticate data");var t=Xme(this._ghash.final(this._alen*8,this._len*8),this._cipher.encryptBlock(this._finID));if(this._decrypt&&eye(t,this._authTag))throw new Error("Unsupported state or unable to authenticate data");this._authTag=t,this._cipher.scrub()};nh.prototype.getAuthTag=function(){if(this._decrypt||!Po.isBuffer(this._authTag))throw new Error("Attempting to get auth tag in unsupported state");return this._authTag};nh.prototype.setAuthTag=function(e){if(!this._decrypt)throw new Error("Attempting to set auth tag in unsupported state");this._authTag=e};nh.prototype.setAAD=function(e){if(this._called)throw new Error("Attempting to set AAD in unsupported state");this._ghash.update(e),this._alen+=e.length};tF.exports=nh});var HS=G((AUe,nF)=>{p();var rye=Bb(),GS=it().Buffer,rF=Ed(),nye=Je();function o_(t,e,r,n){rF.call(this),this._cipher=new rye.AES(e),this._prev=GS.from(r),this._cache=GS.allocUnsafe(0),this._secCache=GS.allocUnsafe(0),this._decrypt=n,this._mode=t}nye(o_,rF);o_.prototype._update=function(t){return this._mode.encrypt(this,t,this._decrypt)};o_.prototype._final=function(){this._cipher.scrub()};nF.exports=o_});var Cb=G((PUe,iF)=>{p();var ih=it().Buffer,iye=A2();function oye(t,e,r,n){if(ih.isBuffer(t)||(t=ih.from(t,"binary")),e&&(ih.isBuffer(e)||(e=ih.from(e,"binary")),e.length!==8))throw new RangeError("salt should be Buffer with 8 byte length");for(var i=r/8,o=ih.alloc(i),s=ih.alloc(n||0),a=ih.alloc(0);i>0||n>0;){var c=new iye;c.update(a),c.update(t),e&&c.update(e),a=c.digest();var d=0;if(i>0){var f=o.length-i;d=Math.min(i,a.length),a.copy(o,f,0,d),i-=d}if(d<a.length&&n>0){var u=s.length-n,m=Math.min(n,a.length-d);a.copy(s,u,d,d+m),n-=m}}return a.fill(0),{key:o,iv:s}}iF.exports=oye});var cF=G(WS=>{p();var oF=n_(),sye=$S(),Ad=it().Buffer,aye=HS(),sF=Ed(),cye=Bb(),dye=Cb(),fye=Je();function Ob(t,e,r){sF.call(this),this._cache=new s_,this._cipher=new cye.AES(e),this._prev=Ad.from(r),this._mode=t,this._autopadding=!0}fye(Ob,sF);Ob.prototype._update=function(t){this._cache.add(t);for(var e,r,n=[];e=this._cache.get();)r=this._mode.encrypt(this,e),n.push(r);return Ad.concat(n)};var uye=Ad.alloc(16,16);Ob.prototype._final=function(){var t=this._cache.flush();if(this._autopadding)return t=this._mode.encrypt(this,t),this._cipher.scrub(),t;if(!t.equals(uye))throw this._cipher.scrub(),new Error("data not multiple of block length")};Ob.prototype.setAutoPadding=function(t){return this._autopadding=!!t,this};function s_(){this.cache=Ad.allocUnsafe(0)}s_.prototype.add=function(t){this.cache=Ad.concat([this.cache,t])};s_.prototype.get=function(){if(this.cache.length>15){var t=this.cache.slice(0,16);return this.cache=this.cache.slice(16),t}return null};s_.prototype.flush=function(){for(var t=16-this.cache.length,e=Ad.allocUnsafe(t),r=-1;++r<t;)e.writeUInt8(t,r);return Ad.concat([this.cache,e])};function aF(t,e,r){var n=oF[t.toLowerCase()];if(!n)throw new TypeError("invalid suite type");if(typeof e=="string"&&(e=Ad.from(e)),e.length!==n.key/8)throw new TypeError("invalid key length "+e.length);if(typeof r=="string"&&(r=Ad.from(r)),n.mode!=="GCM"&&r.length!==n.iv)throw new TypeError("invalid iv length "+r.length);return n.type==="stream"?new aye(n.module,e,r):n.type==="auth"?new sye(n.module,e,r):new Ob(n.module,e,r)}function lye(t,e){var r=oF[t.toLowerCase()];if(!r)throw new TypeError("invalid suite type");var n=dye(e,!1,r.key,r.iv);return aF(t,n.key,n.iv)}WS.createCipheriv=aF;WS.createCipher=lye});var lF=G(VS=>{p();var hye=$S(),D0=it().Buffer,dF=n_(),pye=HS(),fF=Ed(),mye=Bb(),yye=Cb(),gye=Je();function jb(t,e,r){fF.call(this),this._cache=new a_,this._last=void 0,this._cipher=new mye.AES(e),this._prev=D0.from(r),this._mode=t,this._autopadding=!0}gye(jb,fF);jb.prototype._update=function(t){this._cache.add(t);for(var e,r,n=[];e=this._cache.get(this._autopadding);)r=this._mode.decrypt(this,e),n.push(r);return D0.concat(n)};jb.prototype._final=function(){var t=this._cache.flush();if(this._autopadding)return bye(this._mode.decrypt(this,t));if(t)throw new Error("data not multiple of block length")};jb.prototype.setAutoPadding=function(t){return this._autopadding=!!t,this};function a_(){this.cache=D0.allocUnsafe(0)}a_.prototype.add=function(t){this.cache=D0.concat([this.cache,t])};a_.prototype.get=function(t){var e;if(t){if(this.cache.length>16)return e=this.cache.slice(0,16),this.cache=this.cache.slice(16),e}else if(this.cache.length>=16)return e=this.cache.slice(0,16),this.cache=this.cache.slice(16),e;return null};a_.prototype.flush=function(){if(this.cache.length)return this.cache};function bye(t){var e=t[15];if(e<1||e>16)throw new Error("unable to decrypt data");for(var r=-1;++r<e;)if(t[r+(16-e)]!==e)throw new Error("unable to decrypt data");if(e!==16)return t.slice(0,16-e)}function uF(t,e,r){var n=dF[t.toLowerCase()];if(!n)throw new TypeError("invalid suite type");if(typeof r=="string"&&(r=D0.from(r)),n.mode!=="GCM"&&r.length!==n.iv)throw new TypeError("invalid iv length "+r.length);if(typeof e=="string"&&(e=D0.from(e)),e.length!==n.key/8)throw new TypeError("invalid key length "+e.length);return n.type==="stream"?new pye(n.module,e,r,!0):n.type==="auth"?new hye(n.module,e,r,!0):new jb(n.module,e,r)}function vye(t,e){var r=dF[t.toLowerCase()];if(!r)throw new TypeError("invalid suite type");var n=yye(e,!1,r.key,r.iv);return uF(t,n.key,n.iv)}VS.createDecipher=vye;VS.createDecipheriv=uF});var c_=G(da=>{p();var hF=cF(),pF=lF(),wye=LS();function _ye(){return Object.keys(wye)}da.createCipher=da.Cipher=hF.createCipher;da.createCipheriv=da.Cipheriv=hF.createCipheriv;da.createDecipher=da.Decipher=pF.createDecipher;da.createDecipheriv=da.Decipheriv=pF.createDecipheriv;da.listCiphers=da.getCiphers=_ye});var mF=G(Td=>{p();Td["des-ecb"]={key:8,iv:0};Td["des-cbc"]=Td.des={key:8,iv:8};Td["des-ede3-cbc"]=Td.des3={key:24,iv:8};Td["des-ede3"]={key:24,iv:0};Td["des-ede-cbc"]={key:16,iv:8};Td["des-ede"]={key:16,iv:0}});var wF=G(fa=>{p();var yF=MU(),KS=c_(),Kf=n_(),Pd=mF(),gF=Cb();function xye(t,e){t=t.toLowerCase();var r,n;if(Kf[t])r=Kf[t].key,n=Kf[t].iv;else if(Pd[t])r=Pd[t].key*8,n=Pd[t].iv;else throw new TypeError("invalid suite type");var i=gF(e,!1,r,n);return bF(t,i.key,i.iv)}function Eye(t,e){t=t.toLowerCase();var r,n;if(Kf[t])r=Kf[t].key,n=Kf[t].iv;else if(Pd[t])r=Pd[t].key*8,n=Pd[t].iv;else throw new TypeError("invalid suite type");var i=gF(e,!1,r,n);return vF(t,i.key,i.iv)}function bF(t,e,r){if(t=t.toLowerCase(),Kf[t])return KS.createCipheriv(t,e,r);if(Pd[t])return new yF({key:e,iv:r,mode:t});throw new TypeError("invalid suite type")}function vF(t,e,r){if(t=t.toLowerCase(),Kf[t])return KS.createDecipheriv(t,e,r);if(Pd[t])return new yF({key:e,iv:r,mode:t,decrypt:!0});throw new TypeError("invalid suite type")}function Sye(){return Object.keys(Pd).concat(KS.getCiphers())}fa.createCipher=fa.Cipher=xye;fa.createCipheriv=fa.Cipheriv=bF;fa.createDecipher=fa.Decipher=Eye;fa.createDecipheriv=fa.Decipheriv=vF;fa.listCiphers=fa.getCiphers=Sye});var Zn=G((_F,ZS)=>{p();(function(t,e){"use strict";function r(j,y){if(!j)throw new Error(y||"Assertion failed")}function n(j,y){j.super_=y;var P=function(){};P.prototype=y.prototype,j.prototype=new P,j.prototype.constructor=j}function i(j,y,P){if(i.isBN(j))return j;this.negative=0,this.words=null,this.length=0,this.red=null,j!==null&&((y==="le"||y==="be")&&(P=y,y=10),this._init(j||0,y||10,P||"be"))}typeof t=="object"?t.exports=i:e.BN=i,i.BN=i,i.wordSize=26;var o;try{typeof window<"u"&&typeof window.Buffer<"u"?o=window.Buffer:o=jr().Buffer}catch{}i.isBN=function(y){return y instanceof i?!0:y!==null&&typeof y=="object"&&y.constructor.wordSize===i.wordSize&&Array.isArray(y.words)},i.max=function(y,P){return y.cmp(P)>0?y:P},i.min=function(y,P){return y.cmp(P)<0?y:P},i.prototype._init=function(y,P,x){if(typeof y=="number")return this._initNumber(y,P,x);if(typeof y=="object")return this._initArray(y,P,x);P==="hex"&&(P=16),r(P===(P|0)&&P>=2&&P<=36),y=y.toString().replace(/\s+/g,"");var l=0;y[0]==="-"&&(l++,this.negative=1),l<y.length&&(P===16?this._parseHex(y,l,x):(this._parseBase(y,P,l),x==="le"&&this._initArray(this.toArray(),P,x)))},i.prototype._initNumber=function(y,P,x){y<0&&(this.negative=1,y=-y),y<67108864?(this.words=[y&67108863],this.length=1):y<4503599627370496?(this.words=[y&67108863,y/67108864&67108863],this.length=2):(r(y<9007199254740992),this.words=[y&67108863,y/67108864&67108863,1],this.length=3),x==="le"&&this._initArray(this.toArray(),P,x)},i.prototype._initArray=function(y,P,x){if(r(typeof y.length=="number"),y.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(y.length/3),this.words=new Array(this.length);for(var l=0;l<this.length;l++)this.words[l]=0;var b,h,w=0;if(x==="be")for(l=y.length-1,b=0;l>=0;l-=3)h=y[l]|y[l-1]<<8|y[l-2]<<16,this.words[b]|=h<<w&67108863,this.words[b+1]=h>>>26-w&67108863,w+=24,w>=26&&(w-=26,b++);else if(x==="le")for(l=0,b=0;l<y.length;l+=3)h=y[l]|y[l+1]<<8|y[l+2]<<16,this.words[b]|=h<<w&67108863,this.words[b+1]=h>>>26-w&67108863,w+=24,w>=26&&(w-=26,b++);return this.strip()};function s(j,y){var P=j.charCodeAt(y);return P>=65&&P<=70?P-55:P>=97&&P<=102?P-87:P-48&15}function a(j,y,P){var x=s(j,P);return P-1>=y&&(x|=s(j,P-1)<<4),x}i.prototype._parseHex=function(y,P,x){this.length=Math.ceil((y.length-P)/6),this.words=new Array(this.length);for(var l=0;l<this.length;l++)this.words[l]=0;var b=0,h=0,w;if(x==="be")for(l=y.length-1;l>=P;l-=2)w=a(y,P,l)<<b,this.words[h]|=w&67108863,b>=18?(b-=18,h+=1,this.words[h]|=w>>>26):b+=8;else{var E=y.length-P;for(l=E%2===0?P+1:P;l<y.length;l+=2)w=a(y,P,l)<<b,this.words[h]|=w&67108863,b>=18?(b-=18,h+=1,this.words[h]|=w>>>26):b+=8}this.strip()};function c(j,y,P,x){for(var l=0,b=Math.min(j.length,P),h=y;h<b;h++){var w=j.charCodeAt(h)-48;l*=x,w>=49?l+=w-49+10:w>=17?l+=w-17+10:l+=w}return l}i.prototype._parseBase=function(y,P,x){this.words=[0],this.length=1;for(var l=0,b=1;b<=67108863;b*=P)l++;l--,b=b/P|0;for(var h=y.length-x,w=h%l,E=Math.min(h,h-w)+x,g=0,I=x;I<E;I+=l)g=c(y,I,I+l,P),this.imuln(b),this.words[0]+g<67108864?this.words[0]+=g:this._iaddn(g);if(w!==0){var B=1;for(g=c(y,I,y.length,P),I=0;I<w;I++)B*=P;this.imuln(B),this.words[0]+g<67108864?this.words[0]+=g:this._iaddn(g)}this.strip()},i.prototype.copy=function(y){y.words=new Array(this.length);for(var P=0;P<this.length;P++)y.words[P]=this.words[P];y.length=this.length,y.negative=this.negative,y.red=this.red},i.prototype.clone=function(){var y=new i(null);return this.copy(y),y},i.prototype._expand=function(y){for(;this.length<y;)this.words[this.length++]=0;return this},i.prototype.strip=function(){for(;this.length>1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},i.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},i.prototype.inspect=function(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"};var d=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],f=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],u=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];i.prototype.toString=function(y,P){y=y||10,P=P|0||1;var x;if(y===16||y==="hex"){x="";for(var l=0,b=0,h=0;h<this.length;h++){var w=this.words[h],E=((w<<l|b)&16777215).toString(16);b=w>>>24-l&16777215,l+=2,l>=26&&(l-=26,h--),b!==0||h!==this.length-1?x=d[6-E.length]+E+x:x=E+x}for(b!==0&&(x=b.toString(16)+x);x.length%P!==0;)x="0"+x;return this.negative!==0&&(x="-"+x),x}if(y===(y|0)&&y>=2&&y<=36){var g=f[y],I=u[y];x="";var B=this.clone();for(B.negative=0;!B.isZero();){var R=B.modn(I).toString(y);B=B.idivn(I),B.isZero()?x=R+x:x=d[g-R.length]+R+x}for(this.isZero()&&(x="0"+x);x.length%P!==0;)x="0"+x;return this.negative!==0&&(x="-"+x),x}r(!1,"Base should be between 2 and 36")},i.prototype.toNumber=function(){var y=this.words[0];return this.length===2?y+=this.words[1]*67108864:this.length===3&&this.words[2]===1?y+=4503599627370496+this.words[1]*67108864:this.length>2&&r(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-y:y},i.prototype.toJSON=function(){return this.toString(16)},i.prototype.toBuffer=function(y,P){return r(typeof o<"u"),this.toArrayLike(o,y,P)},i.prototype.toArray=function(y,P){return this.toArrayLike(Array,y,P)},i.prototype.toArrayLike=function(y,P,x){var l=this.byteLength(),b=x||Math.max(1,l);r(l<=b,"byte array longer than desired length"),r(b>0,"Requested array length <= 0"),this.strip();var h=P==="le",w=new y(b),E,g,I=this.clone();if(h){for(g=0;!I.isZero();g++)E=I.andln(255),I.iushrn(8),w[g]=E;for(;g<b;g++)w[g]=0}else{for(g=0;g<b-l;g++)w[g]=0;for(g=0;!I.isZero();g++)E=I.andln(255),I.iushrn(8),w[b-g-1]=E}return w},Math.clz32?i.prototype._countBits=function(y){return 32-Math.clz32(y)}:i.prototype._countBits=function(y){var P=y,x=0;return P>=4096&&(x+=13,P>>>=13),P>=64&&(x+=7,P>>>=7),P>=8&&(x+=4,P>>>=4),P>=2&&(x+=2,P>>>=2),x+P},i.prototype._zeroBits=function(y){if(y===0)return 26;var P=y,x=0;return P&8191||(x+=13,P>>>=13),P&127||(x+=7,P>>>=7),P&15||(x+=4,P>>>=4),P&3||(x+=2,P>>>=2),P&1||x++,x},i.prototype.bitLength=function(){var y=this.words[this.length-1],P=this._countBits(y);return(this.length-1)*26+P};function m(j){for(var y=new Array(j.bitLength()),P=0;P<y.length;P++){var x=P/26|0,l=P%26;y[P]=(j.words[x]&1<<l)>>>l}return y}i.prototype.zeroBits=function(){if(this.isZero())return 0;for(var y=0,P=0;P<this.length;P++){var x=this._zeroBits(this.words[P]);if(y+=x,x!==26)break}return y},i.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},i.prototype.toTwos=function(y){return this.negative!==0?this.abs().inotn(y).iaddn(1):this.clone()},i.prototype.fromTwos=function(y){return this.testn(y-1)?this.notn(y).iaddn(1).ineg():this.clone()},i.prototype.isNeg=function(){return this.negative!==0},i.prototype.neg=function(){return this.clone().ineg()},i.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},i.prototype.iuor=function(y){for(;this.length<y.length;)this.words[this.length++]=0;for(var P=0;P<y.length;P++)this.words[P]=this.words[P]|y.words[P];return this.strip()},i.prototype.ior=function(y){return r((this.negative|y.negative)===0),this.iuor(y)},i.prototype.or=function(y){return this.length>y.length?this.clone().ior(y):y.clone().ior(this)},i.prototype.uor=function(y){return this.length>y.length?this.clone().iuor(y):y.clone().iuor(this)},i.prototype.iuand=function(y){var P;this.length>y.length?P=y:P=this;for(var x=0;x<P.length;x++)this.words[x]=this.words[x]&y.words[x];return this.length=P.length,this.strip()},i.prototype.iand=function(y){return r((this.negative|y.negative)===0),this.iuand(y)},i.prototype.and=function(y){return this.length>y.length?this.clone().iand(y):y.clone().iand(this)},i.prototype.uand=function(y){return this.length>y.length?this.clone().iuand(y):y.clone().iuand(this)},i.prototype.iuxor=function(y){var P,x;this.length>y.length?(P=this,x=y):(P=y,x=this);for(var l=0;l<x.length;l++)this.words[l]=P.words[l]^x.words[l];if(this!==P)for(;l<P.length;l++)this.words[l]=P.words[l];return this.length=P.length,this.strip()},i.prototype.ixor=function(y){return r((this.negative|y.negative)===0),this.iuxor(y)},i.prototype.xor=function(y){return this.length>y.length?this.clone().ixor(y):y.clone().ixor(this)},i.prototype.uxor=function(y){return this.length>y.length?this.clone().iuxor(y):y.clone().iuxor(this)},i.prototype.inotn=function(y){r(typeof y=="number"&&y>=0);var P=Math.ceil(y/26)|0,x=y%26;this._expand(P),x>0&&P--;for(var l=0;l<P;l++)this.words[l]=~this.words[l]&67108863;return x>0&&(this.words[l]=~this.words[l]&67108863>>26-x),this.strip()},i.prototype.notn=function(y){return this.clone().inotn(y)},i.prototype.setn=function(y,P){r(typeof y=="number"&&y>=0);var x=y/26|0,l=y%26;return this._expand(x+1),P?this.words[x]=this.words[x]|1<<l:this.words[x]=this.words[x]&~(1<<l),this.strip()},i.prototype.iadd=function(y){var P;if(this.negative!==0&&y.negative===0)return this.negative=0,P=this.isub(y),this.negative^=1,this._normSign();if(this.negative===0&&y.negative!==0)return y.negative=0,P=this.isub(y),y.negative=1,P._normSign();var x,l;this.length>y.length?(x=this,l=y):(x=y,l=this);for(var b=0,h=0;h<l.length;h++)P=(x.words[h]|0)+(l.words[h]|0)+b,this.words[h]=P&67108863,b=P>>>26;for(;b!==0&&h<x.length;h++)P=(x.words[h]|0)+b,this.words[h]=P&67108863,b=P>>>26;if(this.length=x.length,b!==0)this.words[this.length]=b,this.length++;else if(x!==this)for(;h<x.length;h++)this.words[h]=x.words[h];return this},i.prototype.add=function(y){var P;return y.negative!==0&&this.negative===0?(y.negative=0,P=this.sub(y),y.negative^=1,P):y.negative===0&&this.negative!==0?(this.negative=0,P=y.sub(this),this.negative=1,P):this.length>y.length?this.clone().iadd(y):y.clone().iadd(this)},i.prototype.isub=function(y){if(y.negative!==0){y.negative=0;var P=this.iadd(y);return y.negative=1,P._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(y),this.negative=1,this._normSign();var x=this.cmp(y);if(x===0)return this.negative=0,this.length=1,this.words[0]=0,this;var l,b;x>0?(l=this,b=y):(l=y,b=this);for(var h=0,w=0;w<b.length;w++)P=(l.words[w]|0)-(b.words[w]|0)+h,h=P>>26,this.words[w]=P&67108863;for(;h!==0&&w<l.length;w++)P=(l.words[w]|0)+h,h=P>>26,this.words[w]=P&67108863;if(h===0&&w<l.length&&l!==this)for(;w<l.length;w++)this.words[w]=l.words[w];return this.length=Math.max(this.length,w),l!==this&&(this.negative=1),this.strip()},i.prototype.sub=function(y){return this.clone().isub(y)};function _(j,y,P){P.negative=y.negative^j.negative;var x=j.length+y.length|0;P.length=x,x=x-1|0;var l=j.words[0]|0,b=y.words[0]|0,h=l*b,w=h&67108863,E=h/67108864|0;P.words[0]=w;for(var g=1;g<x;g++){for(var I=E>>>26,B=E&67108863,R=Math.min(g,y.length-1),q=Math.max(0,g-j.length+1);q<=R;q++){var V=g-q|0;l=j.words[V]|0,b=y.words[q]|0,h=l*b+B,I+=h/67108864|0,B=h&67108863}P.words[g]=B|0,E=I|0}return E!==0?P.words[g]=E|0:P.length--,P.strip()}var v=function(y,P,x){var l=y.words,b=P.words,h=x.words,w=0,E,g,I,B=l[0]|0,R=B&8191,q=B>>>13,V=l[1]|0,W=V&8191,K=V>>>13,Y=l[2]|0,J=Y&8191,Z=Y>>>13,ce=l[3]|0,oe=ce&8191,ae=ce>>>13,He=l[4]|0,ye=He&8191,xe=He>>>13,zr=l[5]|0,ke=zr&8191,Ne=zr>>>13,Ss=l[6]|0,Ke=Ss&8191,Ze=Ss>>>13,Qu=l[7]|0,ct=Qu&8191,dt=Qu>>>13,Ny=l[8]|0,ft=Ny&8191,ut=Ny>>>13,qy=l[9]|0,lt=qy&8191,ht=qy>>>13,Ly=b[0]|0,pt=Ly&8191,mt=Ly>>>13,Uy=b[1]|0,yt=Uy&8191,gt=Uy>>>13,Fy=b[2]|0,bt=Fy&8191,vt=Fy>>>13,zy=b[3]|0,wt=zy&8191,_t=zy>>>13,$y=b[4]|0,xt=$y&8191,Et=$y>>>13,Gy=b[5]|0,St=Gy&8191,At=Gy>>>13,Hy=b[6]|0,Tt=Hy&8191,Pt=Hy>>>13,Wy=b[7]|0,It=Wy&8191,Rt=Wy>>>13,Vy=b[8]|0,Mt=Vy&8191,kt=Vy>>>13,Ky=b[9]|0,Bt=Ky&8191,Dt=Ky>>>13;x.negative=y.negative^P.negative,x.length=19,E=Math.imul(R,pt),g=Math.imul(R,mt),g=g+Math.imul(q,pt)|0,I=Math.imul(q,mt);var Ap=(w+E|0)+((g&8191)<<13)|0;w=(I+(g>>>13)|0)+(Ap>>>26)|0,Ap&=67108863,E=Math.imul(W,pt),g=Math.imul(W,mt),g=g+Math.imul(K,pt)|0,I=Math.imul(K,mt),E=E+Math.imul(R,yt)|0,g=g+Math.imul(R,gt)|0,g=g+Math.imul(q,yt)|0,I=I+Math.imul(q,gt)|0;var $r=(w+E|0)+((g&8191)<<13)|0;w=(I+(g>>>13)|0)+($r>>>26)|0,$r&=67108863,E=Math.imul(J,pt),g=Math.imul(J,mt),g=g+Math.imul(Z,pt)|0,I=Math.imul(Z,mt),E=E+Math.imul(W,yt)|0,g=g+Math.imul(W,gt)|0,g=g+Math.imul(K,yt)|0,I=I+Math.imul(K,gt)|0,E=E+Math.imul(R,bt)|0,g=g+Math.imul(R,vt)|0,g=g+Math.imul(q,bt)|0,I=I+Math.imul(q,vt)|0;var Gr=(w+E|0)+((g&8191)<<13)|0;w=(I+(g>>>13)|0)+(Gr>>>26)|0,Gr&=67108863,E=Math.imul(oe,pt),g=Math.imul(oe,mt),g=g+Math.imul(ae,pt)|0,I=Math.imul(ae,mt),E=E+Math.imul(J,yt)|0,g=g+Math.imul(J,gt)|0,g=g+Math.imul(Z,yt)|0,I=I+Math.imul(Z,gt)|0,E=E+Math.imul(W,bt)|0,g=g+Math.imul(W,vt)|0,g=g+Math.imul(K,bt)|0,I=I+Math.imul(K,vt)|0,E=E+Math.imul(R,wt)|0,g=g+Math.imul(R,_t)|0,g=g+Math.imul(q,wt)|0,I=I+Math.imul(q,_t)|0;var el=(w+E|0)+((g&8191)<<13)|0;w=(I+(g>>>13)|0)+(el>>>26)|0,el&=67108863,E=Math.imul(ye,pt),g=Math.imul(ye,mt),g=g+Math.imul(xe,pt)|0,I=Math.imul(xe,mt),E=E+Math.imul(oe,yt)|0,g=g+Math.imul(oe,gt)|0,g=g+Math.imul(ae,yt)|0,I=I+Math.imul(ae,gt)|0,E=E+Math.imul(J,bt)|0,g=g+Math.imul(J,vt)|0,g=g+Math.imul(Z,bt)|0,I=I+Math.imul(Z,vt)|0,E=E+Math.imul(W,wt)|0,g=g+Math.imul(W,_t)|0,g=g+Math.imul(K,wt)|0,I=I+Math.imul(K,_t)|0,E=E+Math.imul(R,xt)|0,g=g+Math.imul(R,Et)|0,g=g+Math.imul(q,xt)|0,I=I+Math.imul(q,Et)|0;var tl=(w+E|0)+((g&8191)<<13)|0;w=(I+(g>>>13)|0)+(tl>>>26)|0,tl&=67108863,E=Math.imul(ke,pt),g=Math.imul(ke,mt),g=g+Math.imul(Ne,pt)|0,I=Math.imul(Ne,mt),E=E+Math.imul(ye,yt)|0,g=g+Math.imul(ye,gt)|0,g=g+Math.imul(xe,yt)|0,I=I+Math.imul(xe,gt)|0,E=E+Math.imul(oe,bt)|0,g=g+Math.imul(oe,vt)|0,g=g+Math.imul(ae,bt)|0,I=I+Math.imul(ae,vt)|0,E=E+Math.imul(J,wt)|0,g=g+Math.imul(J,_t)|0,g=g+Math.imul(Z,wt)|0,I=I+Math.imul(Z,_t)|0,E=E+Math.imul(W,xt)|0,g=g+Math.imul(W,Et)|0,g=g+Math.imul(K,xt)|0,I=I+Math.imul(K,Et)|0,E=E+Math.imul(R,St)|0,g=g+Math.imul(R,At)|0,g=g+Math.imul(q,St)|0,I=I+Math.imul(q,At)|0;var rl=(w+E|0)+((g&8191)<<13)|0;w=(I+(g>>>13)|0)+(rl>>>26)|0,rl&=67108863,E=Math.imul(Ke,pt),g=Math.imul(Ke,mt),g=g+Math.imul(Ze,pt)|0,I=Math.imul(Ze,mt),E=E+Math.imul(ke,yt)|0,g=g+Math.imul(ke,gt)|0,g=g+Math.imul(Ne,yt)|0,I=I+Math.imul(Ne,gt)|0,E=E+Math.imul(ye,bt)|0,g=g+Math.imul(ye,vt)|0,g=g+Math.imul(xe,bt)|0,I=I+Math.imul(xe,vt)|0,E=E+Math.imul(oe,wt)|0,g=g+Math.imul(oe,_t)|0,g=g+Math.imul(ae,wt)|0,I=I+Math.imul(ae,_t)|0,E=E+Math.imul(J,xt)|0,g=g+Math.imul(J,Et)|0,g=g+Math.imul(Z,xt)|0,I=I+Math.imul(Z,Et)|0,E=E+Math.imul(W,St)|0,g=g+Math.imul(W,At)|0,g=g+Math.imul(K,St)|0,I=I+Math.imul(K,At)|0,E=E+Math.imul(R,Tt)|0,g=g+Math.imul(R,Pt)|0,g=g+Math.imul(q,Tt)|0,I=I+Math.imul(q,Pt)|0;var nl=(w+E|0)+((g&8191)<<13)|0;w=(I+(g>>>13)|0)+(nl>>>26)|0,nl&=67108863,E=Math.imul(ct,pt),g=Math.imul(ct,mt),g=g+Math.imul(dt,pt)|0,I=Math.imul(dt,mt),E=E+Math.imul(Ke,yt)|0,g=g+Math.imul(Ke,gt)|0,g=g+Math.imul(Ze,yt)|0,I=I+Math.imul(Ze,gt)|0,E=E+Math.imul(ke,bt)|0,g=g+Math.imul(ke,vt)|0,g=g+Math.imul(Ne,bt)|0,I=I+Math.imul(Ne,vt)|0,E=E+Math.imul(ye,wt)|0,g=g+Math.imul(ye,_t)|0,g=g+Math.imul(xe,wt)|0,I=I+Math.imul(xe,_t)|0,E=E+Math.imul(oe,xt)|0,g=g+Math.imul(oe,Et)|0,g=g+Math.imul(ae,xt)|0,I=I+Math.imul(ae,Et)|0,E=E+Math.imul(J,St)|0,g=g+Math.imul(J,At)|0,g=g+Math.imul(Z,St)|0,I=I+Math.imul(Z,At)|0,E=E+Math.imul(W,Tt)|0,g=g+Math.imul(W,Pt)|0,g=g+Math.imul(K,Tt)|0,I=I+Math.imul(K,Pt)|0,E=E+Math.imul(R,It)|0,g=g+Math.imul(R,Rt)|0,g=g+Math.imul(q,It)|0,I=I+Math.imul(q,Rt)|0;var il=(w+E|0)+((g&8191)<<13)|0;w=(I+(g>>>13)|0)+(il>>>26)|0,il&=67108863,E=Math.imul(ft,pt),g=Math.imul(ft,mt),g=g+Math.imul(ut,pt)|0,I=Math.imul(ut,mt),E=E+Math.imul(ct,yt)|0,g=g+Math.imul(ct,gt)|0,g=g+Math.imul(dt,yt)|0,I=I+Math.imul(dt,gt)|0,E=E+Math.imul(Ke,bt)|0,g=g+Math.imul(Ke,vt)|0,g=g+Math.imul(Ze,bt)|0,I=I+Math.imul(Ze,vt)|0,E=E+Math.imul(ke,wt)|0,g=g+Math.imul(ke,_t)|0,g=g+Math.imul(Ne,wt)|0,I=I+Math.imul(Ne,_t)|0,E=E+Math.imul(ye,xt)|0,g=g+Math.imul(ye,Et)|0,g=g+Math.imul(xe,xt)|0,I=I+Math.imul(xe,Et)|0,E=E+Math.imul(oe,St)|0,g=g+Math.imul(oe,At)|0,g=g+Math.imul(ae,St)|0,I=I+Math.imul(ae,At)|0,E=E+Math.imul(J,Tt)|0,g=g+Math.imul(J,Pt)|0,g=g+Math.imul(Z,Tt)|0,I=I+Math.imul(Z,Pt)|0,E=E+Math.imul(W,It)|0,g=g+Math.imul(W,Rt)|0,g=g+Math.imul(K,It)|0,I=I+Math.imul(K,Rt)|0,E=E+Math.imul(R,Mt)|0,g=g+Math.imul(R,kt)|0,g=g+Math.imul(q,Mt)|0,I=I+Math.imul(q,kt)|0;var ol=(w+E|0)+((g&8191)<<13)|0;w=(I+(g>>>13)|0)+(ol>>>26)|0,ol&=67108863,E=Math.imul(lt,pt),g=Math.imul(lt,mt),g=g+Math.imul(ht,pt)|0,I=Math.imul(ht,mt),E=E+Math.imul(ft,yt)|0,g=g+Math.imul(ft,gt)|0,g=g+Math.imul(ut,yt)|0,I=I+Math.imul(ut,gt)|0,E=E+Math.imul(ct,bt)|0,g=g+Math.imul(ct,vt)|0,g=g+Math.imul(dt,bt)|0,I=I+Math.imul(dt,vt)|0,E=E+Math.imul(Ke,wt)|0,g=g+Math.imul(Ke,_t)|0,g=g+Math.imul(Ze,wt)|0,I=I+Math.imul(Ze,_t)|0,E=E+Math.imul(ke,xt)|0,g=g+Math.imul(ke,Et)|0,g=g+Math.imul(Ne,xt)|0,I=I+Math.imul(Ne,Et)|0,E=E+Math.imul(ye,St)|0,g=g+Math.imul(ye,At)|0,g=g+Math.imul(xe,St)|0,I=I+Math.imul(xe,At)|0,E=E+Math.imul(oe,Tt)|0,g=g+Math.imul(oe,Pt)|0,g=g+Math.imul(ae,Tt)|0,I=I+Math.imul(ae,Pt)|0,E=E+Math.imul(J,It)|0,g=g+Math.imul(J,Rt)|0,g=g+Math.imul(Z,It)|0,I=I+Math.imul(Z,Rt)|0,E=E+Math.imul(W,Mt)|0,g=g+Math.imul(W,kt)|0,g=g+Math.imul(K,Mt)|0,I=I+Math.imul(K,kt)|0,E=E+Math.imul(R,Bt)|0,g=g+Math.imul(R,Dt)|0,g=g+Math.imul(q,Bt)|0,I=I+Math.imul(q,Dt)|0;var sl=(w+E|0)+((g&8191)<<13)|0;w=(I+(g>>>13)|0)+(sl>>>26)|0,sl&=67108863,E=Math.imul(lt,yt),g=Math.imul(lt,gt),g=g+Math.imul(ht,yt)|0,I=Math.imul(ht,gt),E=E+Math.imul(ft,bt)|0,g=g+Math.imul(ft,vt)|0,g=g+Math.imul(ut,bt)|0,I=I+Math.imul(ut,vt)|0,E=E+Math.imul(ct,wt)|0,g=g+Math.imul(ct,_t)|0,g=g+Math.imul(dt,wt)|0,I=I+Math.imul(dt,_t)|0,E=E+Math.imul(Ke,xt)|0,g=g+Math.imul(Ke,Et)|0,g=g+Math.imul(Ze,xt)|0,I=I+Math.imul(Ze,Et)|0,E=E+Math.imul(ke,St)|0,g=g+Math.imul(ke,At)|0,g=g+Math.imul(Ne,St)|0,I=I+Math.imul(Ne,At)|0,E=E+Math.imul(ye,Tt)|0,g=g+Math.imul(ye,Pt)|0,g=g+Math.imul(xe,Tt)|0,I=I+Math.imul(xe,Pt)|0,E=E+Math.imul(oe,It)|0,g=g+Math.imul(oe,Rt)|0,g=g+Math.imul(ae,It)|0,I=I+Math.imul(ae,Rt)|0,E=E+Math.imul(J,Mt)|0,g=g+Math.imul(J,kt)|0,g=g+Math.imul(Z,Mt)|0,I=I+Math.imul(Z,kt)|0,E=E+Math.imul(W,Bt)|0,g=g+Math.imul(W,Dt)|0,g=g+Math.imul(K,Bt)|0,I=I+Math.imul(K,Dt)|0;var al=(w+E|0)+((g&8191)<<13)|0;w=(I+(g>>>13)|0)+(al>>>26)|0,al&=67108863,E=Math.imul(lt,bt),g=Math.imul(lt,vt),g=g+Math.imul(ht,bt)|0,I=Math.imul(ht,vt),E=E+Math.imul(ft,wt)|0,g=g+Math.imul(ft,_t)|0,g=g+Math.imul(ut,wt)|0,I=I+Math.imul(ut,_t)|0,E=E+Math.imul(ct,xt)|0,g=g+Math.imul(ct,Et)|0,g=g+Math.imul(dt,xt)|0,I=I+Math.imul(dt,Et)|0,E=E+Math.imul(Ke,St)|0,g=g+Math.imul(Ke,At)|0,g=g+Math.imul(Ze,St)|0,I=I+Math.imul(Ze,At)|0,E=E+Math.imul(ke,Tt)|0,g=g+Math.imul(ke,Pt)|0,g=g+Math.imul(Ne,Tt)|0,I=I+Math.imul(Ne,Pt)|0,E=E+Math.imul(ye,It)|0,g=g+Math.imul(ye,Rt)|0,g=g+Math.imul(xe,It)|0,I=I+Math.imul(xe,Rt)|0,E=E+Math.imul(oe,Mt)|0,g=g+Math.imul(oe,kt)|0,g=g+Math.imul(ae,Mt)|0,I=I+Math.imul(ae,kt)|0,E=E+Math.imul(J,Bt)|0,g=g+Math.imul(J,Dt)|0,g=g+Math.imul(Z,Bt)|0,I=I+Math.imul(Z,Dt)|0;var cl=(w+E|0)+((g&8191)<<13)|0;w=(I+(g>>>13)|0)+(cl>>>26)|0,cl&=67108863,E=Math.imul(lt,wt),g=Math.imul(lt,_t),g=g+Math.imul(ht,wt)|0,I=Math.imul(ht,_t),E=E+Math.imul(ft,xt)|0,g=g+Math.imul(ft,Et)|0,g=g+Math.imul(ut,xt)|0,I=I+Math.imul(ut,Et)|0,E=E+Math.imul(ct,St)|0,g=g+Math.imul(ct,At)|0,g=g+Math.imul(dt,St)|0,I=I+Math.imul(dt,At)|0,E=E+Math.imul(Ke,Tt)|0,g=g+Math.imul(Ke,Pt)|0,g=g+Math.imul(Ze,Tt)|0,I=I+Math.imul(Ze,Pt)|0,E=E+Math.imul(ke,It)|0,g=g+Math.imul(ke,Rt)|0,g=g+Math.imul(Ne,It)|0,I=I+Math.imul(Ne,Rt)|0,E=E+Math.imul(ye,Mt)|0,g=g+Math.imul(ye,kt)|0,g=g+Math.imul(xe,Mt)|0,I=I+Math.imul(xe,kt)|0,E=E+Math.imul(oe,Bt)|0,g=g+Math.imul(oe,Dt)|0,g=g+Math.imul(ae,Bt)|0,I=I+Math.imul(ae,Dt)|0;var dl=(w+E|0)+((g&8191)<<13)|0;w=(I+(g>>>13)|0)+(dl>>>26)|0,dl&=67108863,E=Math.imul(lt,xt),g=Math.imul(lt,Et),g=g+Math.imul(ht,xt)|0,I=Math.imul(ht,Et),E=E+Math.imul(ft,St)|0,g=g+Math.imul(ft,At)|0,g=g+Math.imul(ut,St)|0,I=I+Math.imul(ut,At)|0,E=E+Math.imul(ct,Tt)|0,g=g+Math.imul(ct,Pt)|0,g=g+Math.imul(dt,Tt)|0,I=I+Math.imul(dt,Pt)|0,E=E+Math.imul(Ke,It)|0,g=g+Math.imul(Ke,Rt)|0,g=g+Math.imul(Ze,It)|0,I=I+Math.imul(Ze,Rt)|0,E=E+Math.imul(ke,Mt)|0,g=g+Math.imul(ke,kt)|0,g=g+Math.imul(Ne,Mt)|0,I=I+Math.imul(Ne,kt)|0,E=E+Math.imul(ye,Bt)|0,g=g+Math.imul(ye,Dt)|0,g=g+Math.imul(xe,Bt)|0,I=I+Math.imul(xe,Dt)|0;var fl=(w+E|0)+((g&8191)<<13)|0;w=(I+(g>>>13)|0)+(fl>>>26)|0,fl&=67108863,E=Math.imul(lt,St),g=Math.imul(lt,At),g=g+Math.imul(ht,St)|0,I=Math.imul(ht,At),E=E+Math.imul(ft,Tt)|0,g=g+Math.imul(ft,Pt)|0,g=g+Math.imul(ut,Tt)|0,I=I+Math.imul(ut,Pt)|0,E=E+Math.imul(ct,It)|0,g=g+Math.imul(ct,Rt)|0,g=g+Math.imul(dt,It)|0,I=I+Math.imul(dt,Rt)|0,E=E+Math.imul(Ke,Mt)|0,g=g+Math.imul(Ke,kt)|0,g=g+Math.imul(Ze,Mt)|0,I=I+Math.imul(Ze,kt)|0,E=E+Math.imul(ke,Bt)|0,g=g+Math.imul(ke,Dt)|0,g=g+Math.imul(Ne,Bt)|0,I=I+Math.imul(Ne,Dt)|0;var ul=(w+E|0)+((g&8191)<<13)|0;w=(I+(g>>>13)|0)+(ul>>>26)|0,ul&=67108863,E=Math.imul(lt,Tt),g=Math.imul(lt,Pt),g=g+Math.imul(ht,Tt)|0,I=Math.imul(ht,Pt),E=E+Math.imul(ft,It)|0,g=g+Math.imul(ft,Rt)|0,g=g+Math.imul(ut,It)|0,I=I+Math.imul(ut,Rt)|0,E=E+Math.imul(ct,Mt)|0,g=g+Math.imul(ct,kt)|0,g=g+Math.imul(dt,Mt)|0,I=I+Math.imul(dt,kt)|0,E=E+Math.imul(Ke,Bt)|0,g=g+Math.imul(Ke,Dt)|0,g=g+Math.imul(Ze,Bt)|0,I=I+Math.imul(Ze,Dt)|0;var ll=(w+E|0)+((g&8191)<<13)|0;w=(I+(g>>>13)|0)+(ll>>>26)|0,ll&=67108863,E=Math.imul(lt,It),g=Math.imul(lt,Rt),g=g+Math.imul(ht,It)|0,I=Math.imul(ht,Rt),E=E+Math.imul(ft,Mt)|0,g=g+Math.imul(ft,kt)|0,g=g+Math.imul(ut,Mt)|0,I=I+Math.imul(ut,kt)|0,E=E+Math.imul(ct,Bt)|0,g=g+Math.imul(ct,Dt)|0,g=g+Math.imul(dt,Bt)|0,I=I+Math.imul(dt,Dt)|0;var hl=(w+E|0)+((g&8191)<<13)|0;w=(I+(g>>>13)|0)+(hl>>>26)|0,hl&=67108863,E=Math.imul(lt,Mt),g=Math.imul(lt,kt),g=g+Math.imul(ht,Mt)|0,I=Math.imul(ht,kt),E=E+Math.imul(ft,Bt)|0,g=g+Math.imul(ft,Dt)|0,g=g+Math.imul(ut,Bt)|0,I=I+Math.imul(ut,Dt)|0;var pl=(w+E|0)+((g&8191)<<13)|0;w=(I+(g>>>13)|0)+(pl>>>26)|0,pl&=67108863,E=Math.imul(lt,Bt),g=Math.imul(lt,Dt),g=g+Math.imul(ht,Bt)|0,I=Math.imul(ht,Dt);var ml=(w+E|0)+((g&8191)<<13)|0;return w=(I+(g>>>13)|0)+(ml>>>26)|0,ml&=67108863,h[0]=Ap,h[1]=$r,h[2]=Gr,h[3]=el,h[4]=tl,h[5]=rl,h[6]=nl,h[7]=il,h[8]=ol,h[9]=sl,h[10]=al,h[11]=cl,h[12]=dl,h[13]=fl,h[14]=ul,h[15]=ll,h[16]=hl,h[17]=pl,h[18]=ml,w!==0&&(h[19]=w,x.length++),x};Math.imul||(v=_);function A(j,y,P){P.negative=y.negative^j.negative,P.length=j.length+y.length;for(var x=0,l=0,b=0;b<P.length-1;b++){var h=l;l=0;for(var w=x&67108863,E=Math.min(b,y.length-1),g=Math.max(0,b-j.length+1);g<=E;g++){var I=b-g,B=j.words[I]|0,R=y.words[g]|0,q=B*R,V=q&67108863;h=h+(q/67108864|0)|0,V=V+w|0,w=V&67108863,h=h+(V>>>26)|0,l+=h>>>26,h&=67108863}P.words[b]=w,x=h,h=l}return x!==0?P.words[b]=x:P.length--,P.strip()}function T(j,y,P){var x=new M;return x.mulp(j,y,P)}i.prototype.mulTo=function(y,P){var x,l=this.length+y.length;return this.length===10&&y.length===10?x=v(this,y,P):l<63?x=_(this,y,P):l<1024?x=A(this,y,P):x=T(this,y,P),x};function M(j,y){this.x=j,this.y=y}M.prototype.makeRBT=function(y){for(var P=new Array(y),x=i.prototype._countBits(y)-1,l=0;l<y;l++)P[l]=this.revBin(l,x,y);return P},M.prototype.revBin=function(y,P,x){if(y===0||y===x-1)return y;for(var l=0,b=0;b<P;b++)l|=(y&1)<<P-b-1,y>>=1;return l},M.prototype.permute=function(y,P,x,l,b,h){for(var w=0;w<h;w++)l[w]=P[y[w]],b[w]=x[y[w]]},M.prototype.transform=function(y,P,x,l,b,h){this.permute(h,y,P,x,l,b);for(var w=1;w<b;w<<=1)for(var E=w<<1,g=Math.cos(2*Math.PI/E),I=Math.sin(2*Math.PI/E),B=0;B<b;B+=E)for(var R=g,q=I,V=0;V<w;V++){var W=x[B+V],K=l[B+V],Y=x[B+V+w],J=l[B+V+w],Z=R*Y-q*J;J=R*J+q*Y,Y=Z,x[B+V]=W+Y,l[B+V]=K+J,x[B+V+w]=W-Y,l[B+V+w]=K-J,V!==E&&(Z=g*R-I*q,q=g*q+I*R,R=Z)}},M.prototype.guessLen13b=function(y,P){var x=Math.max(P,y)|1,l=x&1,b=0;for(x=x/2|0;x;x=x>>>1)b++;return 1<<b+1+l},M.prototype.conjugate=function(y,P,x){if(!(x<=1))for(var l=0;l<x/2;l++){var b=y[l];y[l]=y[x-l-1],y[x-l-1]=b,b=P[l],P[l]=-P[x-l-1],P[x-l-1]=-b}},M.prototype.normalize13b=function(y,P){for(var x=0,l=0;l<P/2;l++){var b=Math.round(y[2*l+1]/P)*8192+Math.round(y[2*l]/P)+x;y[l]=b&67108863,b<67108864?x=0:x=b/67108864|0}return y},M.prototype.convert13b=function(y,P,x,l){for(var b=0,h=0;h<P;h++)b=b+(y[h]|0),x[2*h]=b&8191,b=b>>>13,x[2*h+1]=b&8191,b=b>>>13;for(h=2*P;h<l;++h)x[h]=0;r(b===0),r((b&-8192)===0)},M.prototype.stub=function(y){for(var P=new Array(y),x=0;x<y;x++)P[x]=0;return P},M.prototype.mulp=function(y,P,x){var l=2*this.guessLen13b(y.length,P.length),b=this.makeRBT(l),h=this.stub(l),w=new Array(l),E=new Array(l),g=new Array(l),I=new Array(l),B=new Array(l),R=new Array(l),q=x.words;q.length=l,this.convert13b(y.words,y.length,w,l),this.convert13b(P.words,P.length,I,l),this.transform(w,h,E,g,l,b),this.transform(I,h,B,R,l,b);for(var V=0;V<l;V++){var W=E[V]*B[V]-g[V]*R[V];g[V]=E[V]*R[V]+g[V]*B[V],E[V]=W}return this.conjugate(E,g,l),this.transform(E,g,q,h,l,b),this.conjugate(q,h,l),this.normalize13b(q,l),x.negative=y.negative^P.negative,x.length=y.length+P.length,x.strip()},i.prototype.mul=function(y){var P=new i(null);return P.words=new Array(this.length+y.length),this.mulTo(y,P)},i.prototype.mulf=function(y){var P=new i(null);return P.words=new Array(this.length+y.length),T(this,y,P)},i.prototype.imul=function(y){return this.clone().mulTo(y,this)},i.prototype.imuln=function(y){r(typeof y=="number"),r(y<67108864);for(var P=0,x=0;x<this.length;x++){var l=(this.words[x]|0)*y,b=(l&67108863)+(P&67108863);P>>=26,P+=l/67108864|0,P+=b>>>26,this.words[x]=b&67108863}return P!==0&&(this.words[x]=P,this.length++),this.length=y===0?1:this.length,this},i.prototype.muln=function(y){return this.clone().imuln(y)},i.prototype.sqr=function(){return this.mul(this)},i.prototype.isqr=function(){return this.imul(this.clone())},i.prototype.pow=function(y){var P=m(y);if(P.length===0)return new i(1);for(var x=this,l=0;l<P.length&&P[l]===0;l++,x=x.sqr());if(++l<P.length)for(var b=x.sqr();l<P.length;l++,b=b.sqr())P[l]!==0&&(x=x.mul(b));return x},i.prototype.iushln=function(y){r(typeof y=="number"&&y>=0);var P=y%26,x=(y-P)/26,l=67108863>>>26-P<<26-P,b;if(P!==0){var h=0;for(b=0;b<this.length;b++){var w=this.words[b]&l,E=(this.words[b]|0)-w<<P;this.words[b]=E|h,h=w>>>26-P}h&&(this.words[b]=h,this.length++)}if(x!==0){for(b=this.length-1;b>=0;b--)this.words[b+x]=this.words[b];for(b=0;b<x;b++)this.words[b]=0;this.length+=x}return this.strip()},i.prototype.ishln=function(y){return r(this.negative===0),this.iushln(y)},i.prototype.iushrn=function(y,P,x){r(typeof y=="number"&&y>=0);var l;P?l=(P-P%26)/26:l=0;var b=y%26,h=Math.min((y-b)/26,this.length),w=67108863^67108863>>>b<<b,E=x;if(l-=h,l=Math.max(0,l),E){for(var g=0;g<h;g++)E.words[g]=this.words[g];E.length=h}if(h!==0)if(this.length>h)for(this.length-=h,g=0;g<this.length;g++)this.words[g]=this.words[g+h];else this.words[0]=0,this.length=1;var I=0;for(g=this.length-1;g>=0&&(I!==0||g>=l);g--){var B=this.words[g]|0;this.words[g]=I<<26-b|B>>>b,I=B&w}return E&&I!==0&&(E.words[E.length++]=I),this.length===0&&(this.words[0]=0,this.length=1),this.strip()},i.prototype.ishrn=function(y,P,x){return r(this.negative===0),this.iushrn(y,P,x)},i.prototype.shln=function(y){return this.clone().ishln(y)},i.prototype.ushln=function(y){return this.clone().iushln(y)},i.prototype.shrn=function(y){return this.clone().ishrn(y)},i.prototype.ushrn=function(y){return this.clone().iushrn(y)},i.prototype.testn=function(y){r(typeof y=="number"&&y>=0);var P=y%26,x=(y-P)/26,l=1<<P;if(this.length<=x)return!1;var b=this.words[x];return!!(b&l)},i.prototype.imaskn=function(y){r(typeof y=="number"&&y>=0);var P=y%26,x=(y-P)/26;if(r(this.negative===0,"imaskn works only with positive numbers"),this.length<=x)return this;if(P!==0&&x++,this.length=Math.min(x,this.length),P!==0){var l=67108863^67108863>>>P<<P;this.words[this.length-1]&=l}return this.length===0&&(this.words[0]=0,this.length=1),this.strip()},i.prototype.maskn=function(y){return this.clone().imaskn(y)},i.prototype.iaddn=function(y){return r(typeof y=="number"),r(y<67108864),y<0?this.isubn(-y):this.negative!==0?this.length===1&&(this.words[0]|0)<y?(this.words[0]=y-(this.words[0]|0),this.negative=0,this):(this.negative=0,this.isubn(y),this.negative=1,this):this._iaddn(y)},i.prototype._iaddn=function(y){this.words[0]+=y;for(var P=0;P<this.length&&this.words[P]>=67108864;P++)this.words[P]-=67108864,P===this.length-1?this.words[P+1]=1:this.words[P+1]++;return this.length=Math.max(this.length,P+1),this},i.prototype.isubn=function(y){if(r(typeof y=="number"),r(y<67108864),y<0)return this.iaddn(-y);if(this.negative!==0)return this.negative=0,this.iaddn(y),this.negative=1,this;if(this.words[0]-=y,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var P=0;P<this.length&&this.words[P]<0;P++)this.words[P]+=67108864,this.words[P+1]-=1;return this.strip()},i.prototype.addn=function(y){return this.clone().iaddn(y)},i.prototype.subn=function(y){return this.clone().isubn(y)},i.prototype.iabs=function(){return this.negative=0,this},i.prototype.abs=function(){return this.clone().iabs()},i.prototype._ishlnsubmul=function(y,P,x){var l=y.length+x,b;this._expand(l);var h,w=0;for(b=0;b<y.length;b++){h=(this.words[b+x]|0)+w;var E=(y.words[b]|0)*P;h-=E&67108863,w=(h>>26)-(E/67108864|0),this.words[b+x]=h&67108863}for(;b<this.length-x;b++)h=(this.words[b+x]|0)+w,w=h>>26,this.words[b+x]=h&67108863;if(w===0)return this.strip();for(r(w===-1),w=0,b=0;b<this.length;b++)h=-(this.words[b]|0)+w,w=h>>26,this.words[b]=h&67108863;return this.negative=1,this.strip()},i.prototype._wordDiv=function(y,P){var x=this.length-y.length,l=this.clone(),b=y,h=b.words[b.length-1]|0,w=this._countBits(h);x=26-w,x!==0&&(b=b.ushln(x),l.iushln(x),h=b.words[b.length-1]|0);var E=l.length-b.length,g;if(P!=="mod"){g=new i(null),g.length=E+1,g.words=new Array(g.length);for(var I=0;I<g.length;I++)g.words[I]=0}var B=l.clone()._ishlnsubmul(b,1,E);B.negative===0&&(l=B,g&&(g.words[E]=1));for(var R=E-1;R>=0;R--){var q=(l.words[b.length+R]|0)*67108864+(l.words[b.length+R-1]|0);for(q=Math.min(q/h|0,67108863),l._ishlnsubmul(b,q,R);l.negative!==0;)q--,l.negative=0,l._ishlnsubmul(b,1,R),l.isZero()||(l.negative^=1);g&&(g.words[R]=q)}return g&&g.strip(),l.strip(),P!=="div"&&x!==0&&l.iushrn(x),{div:g||null,mod:l}},i.prototype.divmod=function(y,P,x){if(r(!y.isZero()),this.isZero())return{div:new i(0),mod:new i(0)};var l,b,h;return this.negative!==0&&y.negative===0?(h=this.neg().divmod(y,P),P!=="mod"&&(l=h.div.neg()),P!=="div"&&(b=h.mod.neg(),x&&b.negative!==0&&b.iadd(y)),{div:l,mod:b}):this.negative===0&&y.negative!==0?(h=this.divmod(y.neg(),P),P!=="mod"&&(l=h.div.neg()),{div:l,mod:h.mod}):this.negative&y.negative?(h=this.neg().divmod(y.neg(),P),P!=="div"&&(b=h.mod.neg(),x&&b.negative!==0&&b.isub(y)),{div:h.div,mod:b}):y.length>this.length||this.cmp(y)<0?{div:new i(0),mod:this}:y.length===1?P==="div"?{div:this.divn(y.words[0]),mod:null}:P==="mod"?{div:null,mod:new i(this.modn(y.words[0]))}:{div:this.divn(y.words[0]),mod:new i(this.modn(y.words[0]))}:this._wordDiv(y,P)},i.prototype.div=function(y){return this.divmod(y,"div",!1).div},i.prototype.mod=function(y){return this.divmod(y,"mod",!1).mod},i.prototype.umod=function(y){return this.divmod(y,"mod",!0).mod},i.prototype.divRound=function(y){var P=this.divmod(y);if(P.mod.isZero())return P.div;var x=P.div.negative!==0?P.mod.isub(y):P.mod,l=y.ushrn(1),b=y.andln(1),h=x.cmp(l);return h<0||b===1&&h===0?P.div:P.div.negative!==0?P.div.isubn(1):P.div.iaddn(1)},i.prototype.modn=function(y){r(y<=67108863);for(var P=(1<<26)%y,x=0,l=this.length-1;l>=0;l--)x=(P*x+(this.words[l]|0))%y;return x},i.prototype.idivn=function(y){r(y<=67108863);for(var P=0,x=this.length-1;x>=0;x--){var l=(this.words[x]|0)+P*67108864;this.words[x]=l/y|0,P=l%y}return this.strip()},i.prototype.divn=function(y){return this.clone().idivn(y)},i.prototype.egcd=function(y){r(y.negative===0),r(!y.isZero());var P=this,x=y.clone();P.negative!==0?P=P.umod(y):P=P.clone();for(var l=new i(1),b=new i(0),h=new i(0),w=new i(1),E=0;P.isEven()&&x.isEven();)P.iushrn(1),x.iushrn(1),++E;for(var g=x.clone(),I=P.clone();!P.isZero();){for(var B=0,R=1;!(P.words[0]&R)&&B<26;++B,R<<=1);if(B>0)for(P.iushrn(B);B-- >0;)(l.isOdd()||b.isOdd())&&(l.iadd(g),b.isub(I)),l.iushrn(1),b.iushrn(1);for(var q=0,V=1;!(x.words[0]&V)&&q<26;++q,V<<=1);if(q>0)for(x.iushrn(q);q-- >0;)(h.isOdd()||w.isOdd())&&(h.iadd(g),w.isub(I)),h.iushrn(1),w.iushrn(1);P.cmp(x)>=0?(P.isub(x),l.isub(h),b.isub(w)):(x.isub(P),h.isub(l),w.isub(b))}return{a:h,b:w,gcd:x.iushln(E)}},i.prototype._invmp=function(y){r(y.negative===0),r(!y.isZero());var P=this,x=y.clone();P.negative!==0?P=P.umod(y):P=P.clone();for(var l=new i(1),b=new i(0),h=x.clone();P.cmpn(1)>0&&x.cmpn(1)>0;){for(var w=0,E=1;!(P.words[0]&E)&&w<26;++w,E<<=1);if(w>0)for(P.iushrn(w);w-- >0;)l.isOdd()&&l.iadd(h),l.iushrn(1);for(var g=0,I=1;!(x.words[0]&I)&&g<26;++g,I<<=1);if(g>0)for(x.iushrn(g);g-- >0;)b.isOdd()&&b.iadd(h),b.iushrn(1);P.cmp(x)>=0?(P.isub(x),l.isub(b)):(x.isub(P),b.isub(l))}var B;return P.cmpn(1)===0?B=l:B=b,B.cmpn(0)<0&&B.iadd(y),B},i.prototype.gcd=function(y){if(this.isZero())return y.abs();if(y.isZero())return this.abs();var P=this.clone(),x=y.clone();P.negative=0,x.negative=0;for(var l=0;P.isEven()&&x.isEven();l++)P.iushrn(1),x.iushrn(1);do{for(;P.isEven();)P.iushrn(1);for(;x.isEven();)x.iushrn(1);var b=P.cmp(x);if(b<0){var h=P;P=x,x=h}else if(b===0||x.cmpn(1)===0)break;P.isub(x)}while(!0);return x.iushln(l)},i.prototype.invm=function(y){return this.egcd(y).a.umod(y)},i.prototype.isEven=function(){return(this.words[0]&1)===0},i.prototype.isOdd=function(){return(this.words[0]&1)===1},i.prototype.andln=function(y){return this.words[0]&y},i.prototype.bincn=function(y){r(typeof y=="number");var P=y%26,x=(y-P)/26,l=1<<P;if(this.length<=x)return this._expand(x+1),this.words[x]|=l,this;for(var b=l,h=x;b!==0&&h<this.length;h++){var w=this.words[h]|0;w+=b,b=w>>>26,w&=67108863,this.words[h]=w}return b!==0&&(this.words[h]=b,this.length++),this},i.prototype.isZero=function(){return this.length===1&&this.words[0]===0},i.prototype.cmpn=function(y){var P=y<0;if(this.negative!==0&&!P)return-1;if(this.negative===0&&P)return 1;this.strip();var x;if(this.length>1)x=1;else{P&&(y=-y),r(y<=67108863,"Number is too big");var l=this.words[0]|0;x=l===y?0:l<y?-1:1}return this.negative!==0?-x|0:x},i.prototype.cmp=function(y){if(this.negative!==0&&y.negative===0)return-1;if(this.negative===0&&y.negative!==0)return 1;var P=this.ucmp(y);return this.negative!==0?-P|0:P},i.prototype.ucmp=function(y){if(this.length>y.length)return 1;if(this.length<y.length)return-1;for(var P=0,x=this.length-1;x>=0;x--){var l=this.words[x]|0,b=y.words[x]|0;if(l!==b){l<b?P=-1:l>b&&(P=1);break}}return P},i.prototype.gtn=function(y){return this.cmpn(y)===1},i.prototype.gt=function(y){return this.cmp(y)===1},i.prototype.gten=function(y){return this.cmpn(y)>=0},i.prototype.gte=function(y){return this.cmp(y)>=0},i.prototype.ltn=function(y){return this.cmpn(y)===-1},i.prototype.lt=function(y){return this.cmp(y)===-1},i.prototype.lten=function(y){return this.cmpn(y)<=0},i.prototype.lte=function(y){return this.cmp(y)<=0},i.prototype.eqn=function(y){return this.cmpn(y)===0},i.prototype.eq=function(y){return this.cmp(y)===0},i.red=function(y){return new H(y)},i.prototype.toRed=function(y){return r(!this.red,"Already a number in reduction context"),r(this.negative===0,"red works only with positives"),y.convertTo(this)._forceRed(y)},i.prototype.fromRed=function(){return r(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},i.prototype._forceRed=function(y){return this.red=y,this},i.prototype.forceRed=function(y){return r(!this.red,"Already a number in reduction context"),this._forceRed(y)},i.prototype.redAdd=function(y){return r(this.red,"redAdd works only with red numbers"),this.red.add(this,y)},i.prototype.redIAdd=function(y){return r(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,y)},i.prototype.redSub=function(y){return r(this.red,"redSub works only with red numbers"),this.red.sub(this,y)},i.prototype.redISub=function(y){return r(this.red,"redISub works only with red numbers"),this.red.isub(this,y)},i.prototype.redShl=function(y){return r(this.red,"redShl works only with red numbers"),this.red.shl(this,y)},i.prototype.redMul=function(y){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,y),this.red.mul(this,y)},i.prototype.redIMul=function(y){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,y),this.red.imul(this,y)},i.prototype.redSqr=function(){return r(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},i.prototype.redISqr=function(){return r(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},i.prototype.redSqrt=function(){return r(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},i.prototype.redInvm=function(){return r(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},i.prototype.redNeg=function(){return r(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},i.prototype.redPow=function(y){return r(this.red&&!y.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,y)};var D={k256:null,p224:null,p192:null,p25519:null};function O(j,y){this.name=j,this.p=new i(y,16),this.n=this.p.bitLength(),this.k=new i(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}O.prototype._tmp=function(){var y=new i(null);return y.words=new Array(Math.ceil(this.n/13)),y},O.prototype.ireduce=function(y){var P=y,x;do this.split(P,this.tmp),P=this.imulK(P),P=P.iadd(this.tmp),x=P.bitLength();while(x>this.n);var l=x<this.n?-1:P.ucmp(this.p);return l===0?(P.words[0]=0,P.length=1):l>0?P.isub(this.p):P.strip!==void 0?P.strip():P._strip(),P},O.prototype.split=function(y,P){y.iushrn(this.n,0,P)},O.prototype.imulK=function(y){return y.imul(this.k)};function U(){O.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}n(U,O),U.prototype.split=function(y,P){for(var x=4194303,l=Math.min(y.length,9),b=0;b<l;b++)P.words[b]=y.words[b];if(P.length=l,y.length<=9){y.words[0]=0,y.length=1;return}var h=y.words[9];for(P.words[P.length++]=h&x,b=10;b<y.length;b++){var w=y.words[b]|0;y.words[b-10]=(w&x)<<4|h>>>22,h=w}h>>>=22,y.words[b-10]=h,h===0&&y.length>10?y.length-=10:y.length-=9},U.prototype.imulK=function(y){y.words[y.length]=0,y.words[y.length+1]=0,y.length+=2;for(var P=0,x=0;x<y.length;x++){var l=y.words[x]|0;P+=l*977,y.words[x]=P&67108863,P=l*64+(P/67108864|0)}return y.words[y.length-1]===0&&(y.length--,y.words[y.length-1]===0&&y.length--),y};function L(){O.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}n(L,O);function F(){O.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}n(F,O);function $(){O.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}n($,O),$.prototype.imulK=function(y){for(var P=0,x=0;x<y.length;x++){var l=(y.words[x]|0)*19+P,b=l&67108863;l>>>=26,y.words[x]=b,P=l}return P!==0&&(y.words[y.length++]=P),y},i._prime=function(y){if(D[y])return D[y];var P;if(y==="k256")P=new U;else if(y==="p224")P=new L;else if(y==="p192")P=new F;else if(y==="p25519")P=new $;else throw new Error("Unknown prime "+y);return D[y]=P,P};function H(j){if(typeof j=="string"){var y=i._prime(j);this.m=y.p,this.prime=y}else r(j.gtn(1),"modulus must be greater than 1"),this.m=j,this.prime=null}H.prototype._verify1=function(y){r(y.negative===0,"red works only with positives"),r(y.red,"red works only with red numbers")},H.prototype._verify2=function(y,P){r((y.negative|P.negative)===0,"red works only with positives"),r(y.red&&y.red===P.red,"red works only with red numbers")},H.prototype.imod=function(y){return this.prime?this.prime.ireduce(y)._forceRed(this):y.umod(this.m)._forceRed(this)},H.prototype.neg=function(y){return y.isZero()?y.clone():this.m.sub(y)._forceRed(this)},H.prototype.add=function(y,P){this._verify2(y,P);var x=y.add(P);return x.cmp(this.m)>=0&&x.isub(this.m),x._forceRed(this)},H.prototype.iadd=function(y,P){this._verify2(y,P);var x=y.iadd(P);return x.cmp(this.m)>=0&&x.isub(this.m),x},H.prototype.sub=function(y,P){this._verify2(y,P);var x=y.sub(P);return x.cmpn(0)<0&&x.iadd(this.m),x._forceRed(this)},H.prototype.isub=function(y,P){this._verify2(y,P);var x=y.isub(P);return x.cmpn(0)<0&&x.iadd(this.m),x},H.prototype.shl=function(y,P){return this._verify1(y),this.imod(y.ushln(P))},H.prototype.imul=function(y,P){return this._verify2(y,P),this.imod(y.imul(P))},H.prototype.mul=function(y,P){return this._verify2(y,P),this.imod(y.mul(P))},H.prototype.isqr=function(y){return this.imul(y,y.clone())},H.prototype.sqr=function(y){return this.mul(y,y)},H.prototype.sqrt=function(y){if(y.isZero())return y.clone();var P=this.m.andln(3);if(r(P%2===1),P===3){var x=this.m.add(new i(1)).iushrn(2);return this.pow(y,x)}for(var l=this.m.subn(1),b=0;!l.isZero()&&l.andln(1)===0;)b++,l.iushrn(1);r(!l.isZero());var h=new i(1).toRed(this),w=h.redNeg(),E=this.m.subn(1).iushrn(1),g=this.m.bitLength();for(g=new i(2*g*g).toRed(this);this.pow(g,E).cmp(w)!==0;)g.redIAdd(w);for(var I=this.pow(g,l),B=this.pow(y,l.addn(1).iushrn(1)),R=this.pow(y,l),q=b;R.cmp(h)!==0;){for(var V=R,W=0;V.cmp(h)!==0;W++)V=V.redSqr();r(W<q);var K=this.pow(I,new i(1).iushln(q-W-1));B=B.redMul(K),I=K.redSqr(),R=R.redMul(I),q=W}return B},H.prototype.invm=function(y){var P=y._invmp(this.m);return P.negative!==0?(P.negative=0,this.imod(P).redNeg()):this.imod(P)},H.prototype.pow=function(y,P){if(P.isZero())return new i(1).toRed(this);if(P.cmpn(1)===0)return y.clone();var x=4,l=new Array(1<<x);l[0]=new i(1).toRed(this),l[1]=y;for(var b=2;b<l.length;b++)l[b]=this.mul(l[b-1],y);var h=l[0],w=0,E=0,g=P.bitLength()%26;for(g===0&&(g=26),b=P.length-1;b>=0;b--){for(var I=P.words[b],B=g-1;B>=0;B--){var R=I>>B&1;if(h!==l[0]&&(h=this.sqr(h)),R===0&&w===0){E=0;continue}w<<=1,w|=R,E++,!(E!==x&&(b!==0||B!==0))&&(h=this.mul(h,l[w]),E=0,w=0)}g=26}return h},H.prototype.convertTo=function(y){var P=y.umod(this.m);return P===y?P.clone():P},H.prototype.convertFrom=function(y){var P=y.clone();return P.red=null,P},i.mont=function(y){return new z(y)};function z(j){H.call(this,j),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new i(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}n(z,H),z.prototype.convertTo=function(y){return this.imod(y.ushln(this.shift))},z.prototype.convertFrom=function(y){var P=this.imod(y.mul(this.rinv));return P.red=null,P},z.prototype.imul=function(y,P){if(y.isZero()||P.isZero())return y.words[0]=0,y.length=1,y;var x=y.imul(P),l=x.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),b=x.isub(l).iushrn(this.shift),h=b;return b.cmp(this.m)>=0?h=b.isub(this.m):b.cmpn(0)<0&&(h=b.iadd(this.m)),h._forceRed(this)},z.prototype.mul=function(y,P){if(y.isZero()||P.isZero())return new i(0)._forceRed(this);var x=y.mul(P),l=x.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),b=x.isub(l).iushrn(this.shift),h=b;return b.cmp(this.m)>=0?h=b.isub(this.m):b.cmpn(0)<0&&(h=b.iadd(this.m)),h._forceRed(this)},z.prototype.invm=function(y){var P=this.imod(y._invmp(this.m).mul(this.r2));return P._forceRed(this)}})(typeof ZS>"u"||ZS,_F)});var d_=G((UUe,XS)=>{p();var YS;XS.exports=function(e){return YS||(YS=new Zf(null)),YS.generate(e)};function Zf(t){this.rand=t}XS.exports.Rand=Zf;Zf.prototype.generate=function(e){return this._rand(e)};Zf.prototype._rand=function(e){if(this.rand.getBytes)return this.rand.getBytes(e);for(var r=new Uint8Array(e),n=0;n<r.length;n++)r[n]=this.rand.getByte();return r};if(typeof self=="object")self.crypto&&self.crypto.getRandomValues?Zf.prototype._rand=function(e){var r=new Uint8Array(e);return self.crypto.getRandomValues(r),r}:self.msCrypto&&self.msCrypto.getRandomValues?Zf.prototype._rand=function(e){var r=new Uint8Array(e);return self.msCrypto.getRandomValues(r),r}:typeof window=="object"&&(Zf.prototype._rand=function(){throw new Error("Not implemented yet")});else try{if(JS=f_(),typeof JS.randomBytes!="function")throw new Error("Not supported");Zf.prototype._rand=function(e){return JS.randomBytes(e)}}catch{}var JS});var QS=G((zUe,xF)=>{p();var oh=Zn(),Aye=d_();function sh(t){this.rand=t||new Aye.Rand}xF.exports=sh;sh.create=function(e){return new sh(e)};sh.prototype._randbelow=function(e){var r=e.bitLength(),n=Math.ceil(r/8);do var i=new oh(this.rand.generate(n));while(i.cmp(e)>=0);return i};sh.prototype._randrange=function(e,r){var n=r.sub(e);return e.add(this._randbelow(n))};sh.prototype.test=function(e,r,n){var i=e.bitLength(),o=oh.mont(e),s=new oh(1).toRed(o);r||(r=Math.max(1,i/48|0));for(var a=e.subn(1),c=0;!a.testn(c);c++);for(var d=e.shrn(c),f=a.toRed(o),u=!0;r>0;r--){var m=this._randrange(new oh(2),a);n&&n(m);var _=m.toRed(o).redPow(d);if(!(_.cmp(s)===0||_.cmp(f)===0)){for(var v=1;v<c;v++){if(_=_.redSqr(),_.cmp(s)===0)return!1;if(_.cmp(f)===0)break}if(v===c)return!1}}return u};sh.prototype.getDivisor=function(e,r){var n=e.bitLength(),i=oh.mont(e),o=new oh(1).toRed(i);r||(r=Math.max(1,n/48|0));for(var s=e.subn(1),a=0;!s.testn(a);a++);for(var c=e.shrn(a),d=s.toRed(i);r>0;r--){var f=this._randrange(new oh(2),s),u=e.gcd(f);if(u.cmpn(1)!==0)return u;var m=f.toRed(i).redPow(c);if(!(m.cmp(o)===0||m.cmp(d)===0)){for(var _=1;_<a;_++){if(m=m.redSqr(),m.cmp(o)===0)return m.fromRed().subn(1).gcd(e);if(m.cmp(d)===0)break}if(_===a)return m=m.redSqr(),m.fromRed().subn(1).gcd(e)}}return!1}});var oA=G((KUe,AF)=>{p();var Tye=Ol();AF.exports=iA;iA.simpleSieve=rA;iA.fermatTest=nA;var li=Zn(),Pye=new li(24),Iye=QS(),EF=new Iye,Rye=new li(1),tA=new li(2),Mye=new li(5),GUe=new li(16),HUe=new li(8),kye=new li(10),Bye=new li(3),WUe=new li(7),Dye=new li(11),SF=new li(4),VUe=new li(12),eA=null;function Cye(){if(eA!==null)return eA;var t=1048576,e=[];e[0]=2;for(var r=1,n=3;n<t;n+=2){for(var i=Math.ceil(Math.sqrt(n)),o=0;o<r&&e[o]<=i&&n%e[o]!==0;o++);r!==o&&e[o]<=i||(e[r++]=n)}return eA=e,e}function rA(t){for(var e=Cye(),r=0;r<e.length;r++)if(t.modn(e[r])===0)return t.cmpn(e[r])===0;return!0}function nA(t){var e=li.mont(t);return tA.toRed(e).redPow(t.subn(1)).fromRed().cmpn(1)===0}function iA(t,e){if(t<16)return e===2||e===5?new li([140,123]):new li([140,39]);e=new li(e);for(var r,n;;){for(r=new li(Tye(Math.ceil(t/8)));r.bitLength()>t;)r.ishrn(1);if(r.isEven()&&r.iadd(Rye),r.testn(1)||r.iadd(tA),e.cmp(tA)){if(!e.cmp(Mye))for(;r.mod(kye).cmp(Bye);)r.iadd(SF)}else for(;r.mod(Pye).cmp(Dye);)r.iadd(SF);if(n=r.shrn(1),rA(n)&&rA(r)&&nA(n)&&nA(r)&&EF.test(n)&&EF.test(r))return r}}});var TF=G((YUe,Oye)=>{Oye.exports={modp1:{gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a63a3620ffffffffffffffff"},modp2:{gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece65381ffffffffffffffff"},modp5:{gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca237327ffffffffffffffff"},modp14:{gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aacaa68ffffffffffffffff"},modp15:{gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a93ad2caffffffffffffffff"},modp16:{gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c934063199ffffffffffffffff"},modp17:{gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c93402849236c3fab4d27c7026c1d4dcb2602646dec9751e763dba37bdf8ff9406ad9e530ee5db382f413001aeb06a53ed9027d831179727b0865a8918da3edbebcf9b14ed44ce6cbaced4bb1bdb7f1447e6cc254b332051512bd7af426fb8f401378cd2bf5983ca01c64b92ecf032ea15d1721d03f482d7ce6e74fef6d55e702f46980c82b5a84031900b1c9e59e7c97fbec7e8f323a97a7e36cc88be0f1d45b7ff585ac54bd407b22b4154aacc8f6d7ebf48e1d814cc5ed20f8037e0a79715eef29be32806a1d58bb7c5da76f550aa3d8a1fbff0eb19ccb1a313d55cda56c9ec2ef29632387fe8d76e3c0468043e8f663f4860ee12bf2d5b0b7474d6e694f91e6dcc4024ffffffffffffffff"},modp18:{gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c93402849236c3fab4d27c7026c1d4dcb2602646dec9751e763dba37bdf8ff9406ad9e530ee5db382f413001aeb06a53ed9027d831179727b0865a8918da3edbebcf9b14ed44ce6cbaced4bb1bdb7f1447e6cc254b332051512bd7af426fb8f401378cd2bf5983ca01c64b92ecf032ea15d1721d03f482d7ce6e74fef6d55e702f46980c82b5a84031900b1c9e59e7c97fbec7e8f323a97a7e36cc88be0f1d45b7ff585ac54bd407b22b4154aacc8f6d7ebf48e1d814cc5ed20f8037e0a79715eef29be32806a1d58bb7c5da76f550aa3d8a1fbff0eb19ccb1a313d55cda56c9ec2ef29632387fe8d76e3c0468043e8f663f4860ee12bf2d5b0b7474d6e694f91e6dbe115974a3926f12fee5e438777cb6a932df8cd8bec4d073b931ba3bc832b68d9dd300741fa7bf8afc47ed2576f6936ba424663aab639c5ae4f5683423b4742bf1c978238f16cbe39d652de3fdb8befc848ad922222e04a4037c0713eb57a81a23f0c73473fc646cea306b4bcbc8862f8385ddfa9d4b7fa2c087e879683303ed5bdd3a062b3cf5b3a278a66d2a13f83f44f82ddf310ee074ab6a364597e899a0255dc164f31cc50846851df9ab48195ded7ea1b1d510bd7ee74d73faf36bc31ecfa268359046f4eb879f924009438b481c6cd7889a002ed5ee382bc9190da6fc026e479558e4475677e9aa9e3050e2765694dfc81f56e880b96e7160c980dd98edd3dfffffffffffffffff"}}});var MF=G((JUe,RF)=>{p();var qs=Zn(),jye=QS(),PF=new jye,Nye=new qs(24),qye=new qs(11),Lye=new qs(10),Uye=new qs(3),Fye=new qs(7),IF=oA(),zye=Ol();RF.exports=Id;function $ye(t,e){return e=e||"utf8",C.Buffer.isBuffer(t)||(t=new C.Buffer(t,e)),this._pub=new qs(t),this}function Gye(t,e){return e=e||"utf8",C.Buffer.isBuffer(t)||(t=new C.Buffer(t,e)),this._priv=new qs(t),this}var u_={};function Hye(t,e){var r=e.toString("hex"),n=[r,t.toString(16)].join("_");if(n in u_)return u_[n];var i=0;if(t.isEven()||!IF.simpleSieve||!IF.fermatTest(t)||!PF.test(t))return i+=1,r==="02"||r==="05"?i+=8:i+=4,u_[n]=i,i;PF.test(t.shrn(1))||(i+=2);var o;switch(r){case"02":t.mod(Nye).cmp(qye)&&(i+=8);break;case"05":o=t.mod(Lye),o.cmp(Uye)&&o.cmp(Fye)&&(i+=8);break;default:i+=4}return u_[n]=i,i}function Id(t,e,r){this.setGenerator(e),this.__prime=new qs(t),this._prime=qs.mont(this.__prime),this._primeLen=t.length,this._pub=void 0,this._priv=void 0,this._primeCode=void 0,r?(this.setPublicKey=$ye,this.setPrivateKey=Gye):this._primeCode=8}Object.defineProperty(Id.prototype,"verifyError",{enumerable:!0,get:function(){return typeof this._primeCode!="number"&&(this._primeCode=Hye(this.__prime,this.__gen)),this._primeCode}});Id.prototype.generateKeys=function(){return this._priv||(this._priv=new qs(zye(this._primeLen))),this._pub=this._gen.toRed(this._prime).redPow(this._priv).fromRed(),this.getPublicKey()};Id.prototype.computeSecret=function(t){t=new qs(t),t=t.toRed(this._prime);var e=t.redPow(this._priv).fromRed(),r=new C.Buffer(e.toArray()),n=this.getPrime();if(r.length<n.length){var i=new C.Buffer(n.length-r.length);i.fill(0),r=C.Buffer.concat([i,r])}return r};Id.prototype.getPublicKey=function(e){return l_(this._pub,e)};Id.prototype.getPrivateKey=function(e){return l_(this._priv,e)};Id.prototype.getPrime=function(t){return l_(this.__prime,t)};Id.prototype.getGenerator=function(t){return l_(this._gen,t)};Id.prototype.setGenerator=function(t,e){return e=e||"utf8",C.Buffer.isBuffer(t)||(t=new C.Buffer(t,e)),this.__gen=t,this._gen=new qs(t),this};function l_(t,e){var r=new C.Buffer(t.toArray());return e?r.toString(e):r}});var DF=G(C0=>{p();var Wye=oA(),kF=TF(),sA=MF();function Vye(t){var e=new C.Buffer(kF[t].prime,"hex"),r=new C.Buffer(kF[t].gen,"hex");return new sA(e,r)}var Kye={binary:!0,hex:!0,base64:!0};function BF(t,e,r,n){return C.Buffer.isBuffer(e)||Kye[e]===void 0?BF(t,"binary",e,r):(e=e||"binary",n=n||"binary",r=r||new C.Buffer([2]),C.Buffer.isBuffer(r)||(r=new C.Buffer(r,n)),typeof t=="number"?new sA(Wye(t,r),r,!0):(C.Buffer.isBuffer(t)||(t=new C.Buffer(t,e)),new sA(t,r,!0)))}C0.DiffieHellmanGroup=C0.createDiffieHellmanGroup=C0.getDiffieHellman=Vye;C0.createDiffieHellman=C0.DiffieHellman=BF});var h_=G((CF,aA)=>{p();(function(t,e){"use strict";function r(x,l){if(!x)throw new Error(l||"Assertion failed")}function n(x,l){x.super_=l;var b=function(){};b.prototype=l.prototype,x.prototype=new b,x.prototype.constructor=x}function i(x,l,b){if(i.isBN(x))return x;this.negative=0,this.words=null,this.length=0,this.red=null,x!==null&&((l==="le"||l==="be")&&(b=l,l=10),this._init(x||0,l||10,b||"be"))}typeof t=="object"?t.exports=i:e.BN=i,i.BN=i,i.wordSize=26;var o;try{typeof window<"u"&&typeof window.Buffer<"u"?o=window.Buffer:o=jr().Buffer}catch{}i.isBN=function(l){return l instanceof i?!0:l!==null&&typeof l=="object"&&l.constructor.wordSize===i.wordSize&&Array.isArray(l.words)},i.max=function(l,b){return l.cmp(b)>0?l:b},i.min=function(l,b){return l.cmp(b)<0?l:b},i.prototype._init=function(l,b,h){if(typeof l=="number")return this._initNumber(l,b,h);if(typeof l=="object")return this._initArray(l,b,h);b==="hex"&&(b=16),r(b===(b|0)&&b>=2&&b<=36),l=l.toString().replace(/\s+/g,"");var w=0;l[0]==="-"&&(w++,this.negative=1),w<l.length&&(b===16?this._parseHex(l,w,h):(this._parseBase(l,b,w),h==="le"&&this._initArray(this.toArray(),b,h)))},i.prototype._initNumber=function(l,b,h){l<0&&(this.negative=1,l=-l),l<67108864?(this.words=[l&67108863],this.length=1):l<4503599627370496?(this.words=[l&67108863,l/67108864&67108863],this.length=2):(r(l<9007199254740992),this.words=[l&67108863,l/67108864&67108863,1],this.length=3),h==="le"&&this._initArray(this.toArray(),b,h)},i.prototype._initArray=function(l,b,h){if(r(typeof l.length=="number"),l.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(l.length/3),this.words=new Array(this.length);for(var w=0;w<this.length;w++)this.words[w]=0;var E,g,I=0;if(h==="be")for(w=l.length-1,E=0;w>=0;w-=3)g=l[w]|l[w-1]<<8|l[w-2]<<16,this.words[E]|=g<<I&67108863,this.words[E+1]=g>>>26-I&67108863,I+=24,I>=26&&(I-=26,E++);else if(h==="le")for(w=0,E=0;w<l.length;w+=3)g=l[w]|l[w+1]<<8|l[w+2]<<16,this.words[E]|=g<<I&67108863,this.words[E+1]=g>>>26-I&67108863,I+=24,I>=26&&(I-=26,E++);return this._strip()};function s(x,l){var b=x.charCodeAt(l);if(b>=48&&b<=57)return b-48;if(b>=65&&b<=70)return b-55;if(b>=97&&b<=102)return b-87;r(!1,"Invalid character in "+x)}function a(x,l,b){var h=s(x,b);return b-1>=l&&(h|=s(x,b-1)<<4),h}i.prototype._parseHex=function(l,b,h){this.length=Math.ceil((l.length-b)/6),this.words=new Array(this.length);for(var w=0;w<this.length;w++)this.words[w]=0;var E=0,g=0,I;if(h==="be")for(w=l.length-1;w>=b;w-=2)I=a(l,b,w)<<E,this.words[g]|=I&67108863,E>=18?(E-=18,g+=1,this.words[g]|=I>>>26):E+=8;else{var B=l.length-b;for(w=B%2===0?b+1:b;w<l.length;w+=2)I=a(l,b,w)<<E,this.words[g]|=I&67108863,E>=18?(E-=18,g+=1,this.words[g]|=I>>>26):E+=8}this._strip()};function c(x,l,b,h){for(var w=0,E=0,g=Math.min(x.length,b),I=l;I<g;I++){var B=x.charCodeAt(I)-48;w*=h,B>=49?E=B-49+10:B>=17?E=B-17+10:E=B,r(B>=0&&E<h,"Invalid character"),w+=E}return w}i.prototype._parseBase=function(l,b,h){this.words=[0],this.length=1;for(var w=0,E=1;E<=67108863;E*=b)w++;w--,E=E/b|0;for(var g=l.length-h,I=g%w,B=Math.min(g,g-I)+h,R=0,q=h;q<B;q+=w)R=c(l,q,q+w,b),this.imuln(E),this.words[0]+R<67108864?this.words[0]+=R:this._iaddn(R);if(I!==0){var V=1;for(R=c(l,q,l.length,b),q=0;q<I;q++)V*=b;this.imuln(V),this.words[0]+R<67108864?this.words[0]+=R:this._iaddn(R)}this._strip()},i.prototype.copy=function(l){l.words=new Array(this.length);for(var b=0;b<this.length;b++)l.words[b]=this.words[b];l.length=this.length,l.negative=this.negative,l.red=this.red};function d(x,l){x.words=l.words,x.length=l.length,x.negative=l.negative,x.red=l.red}if(i.prototype._move=function(l){d(l,this)},i.prototype.clone=function(){var l=new i(null);return this.copy(l),l},i.prototype._expand=function(l){for(;this.length<l;)this.words[this.length++]=0;return this},i.prototype._strip=function(){for(;this.length>1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},i.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},typeof Symbol<"u"&&typeof Symbol.for=="function")try{i.prototype[Symbol.for("nodejs.util.inspect.custom")]=f}catch{i.prototype.inspect=f}else i.prototype.inspect=f;function f(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"}var u=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],m=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],_=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];i.prototype.toString=function(l,b){l=l||10,b=b|0||1;var h;if(l===16||l==="hex"){h="";for(var w=0,E=0,g=0;g<this.length;g++){var I=this.words[g],B=((I<<w|E)&16777215).toString(16);E=I>>>24-w&16777215,w+=2,w>=26&&(w-=26,g--),E!==0||g!==this.length-1?h=u[6-B.length]+B+h:h=B+h}for(E!==0&&(h=E.toString(16)+h);h.length%b!==0;)h="0"+h;return this.negative!==0&&(h="-"+h),h}if(l===(l|0)&&l>=2&&l<=36){var R=m[l],q=_[l];h="";var V=this.clone();for(V.negative=0;!V.isZero();){var W=V.modrn(q).toString(l);V=V.idivn(q),V.isZero()?h=W+h:h=u[R-W.length]+W+h}for(this.isZero()&&(h="0"+h);h.length%b!==0;)h="0"+h;return this.negative!==0&&(h="-"+h),h}r(!1,"Base should be between 2 and 36")},i.prototype.toNumber=function(){var l=this.words[0];return this.length===2?l+=this.words[1]*67108864:this.length===3&&this.words[2]===1?l+=4503599627370496+this.words[1]*67108864:this.length>2&&r(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-l:l},i.prototype.toJSON=function(){return this.toString(16,2)},o&&(i.prototype.toBuffer=function(l,b){return this.toArrayLike(o,l,b)}),i.prototype.toArray=function(l,b){return this.toArrayLike(Array,l,b)};var v=function(l,b){return l.allocUnsafe?l.allocUnsafe(b):new l(b)};i.prototype.toArrayLike=function(l,b,h){this._strip();var w=this.byteLength(),E=h||Math.max(1,w);r(w<=E,"byte array longer than desired length"),r(E>0,"Requested array length <= 0");var g=v(l,E),I=b==="le"?"LE":"BE";return this["_toArrayLike"+I](g,w),g},i.prototype._toArrayLikeLE=function(l,b){for(var h=0,w=0,E=0,g=0;E<this.length;E++){var I=this.words[E]<<g|w;l[h++]=I&255,h<l.length&&(l[h++]=I>>8&255),h<l.length&&(l[h++]=I>>16&255),g===6?(h<l.length&&(l[h++]=I>>24&255),w=0,g=0):(w=I>>>24,g+=2)}if(h<l.length)for(l[h++]=w;h<l.length;)l[h++]=0},i.prototype._toArrayLikeBE=function(l,b){for(var h=l.length-1,w=0,E=0,g=0;E<this.length;E++){var I=this.words[E]<<g|w;l[h--]=I&255,h>=0&&(l[h--]=I>>8&255),h>=0&&(l[h--]=I>>16&255),g===6?(h>=0&&(l[h--]=I>>24&255),w=0,g=0):(w=I>>>24,g+=2)}if(h>=0)for(l[h--]=w;h>=0;)l[h--]=0},Math.clz32?i.prototype._countBits=function(l){return 32-Math.clz32(l)}:i.prototype._countBits=function(l){var b=l,h=0;return b>=4096&&(h+=13,b>>>=13),b>=64&&(h+=7,b>>>=7),b>=8&&(h+=4,b>>>=4),b>=2&&(h+=2,b>>>=2),h+b},i.prototype._zeroBits=function(l){if(l===0)return 26;var b=l,h=0;return b&8191||(h+=13,b>>>=13),b&127||(h+=7,b>>>=7),b&15||(h+=4,b>>>=4),b&3||(h+=2,b>>>=2),b&1||h++,h},i.prototype.bitLength=function(){var l=this.words[this.length-1],b=this._countBits(l);return(this.length-1)*26+b};function A(x){for(var l=new Array(x.bitLength()),b=0;b<l.length;b++){var h=b/26|0,w=b%26;l[b]=x.words[h]>>>w&1}return l}i.prototype.zeroBits=function(){if(this.isZero())return 0;for(var l=0,b=0;b<this.length;b++){var h=this._zeroBits(this.words[b]);if(l+=h,h!==26)break}return l},i.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},i.prototype.toTwos=function(l){return this.negative!==0?this.abs().inotn(l).iaddn(1):this.clone()},i.prototype.fromTwos=function(l){return this.testn(l-1)?this.notn(l).iaddn(1).ineg():this.clone()},i.prototype.isNeg=function(){return this.negative!==0},i.prototype.neg=function(){return this.clone().ineg()},i.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},i.prototype.iuor=function(l){for(;this.length<l.length;)this.words[this.length++]=0;for(var b=0;b<l.length;b++)this.words[b]=this.words[b]|l.words[b];return this._strip()},i.prototype.ior=function(l){return r((this.negative|l.negative)===0),this.iuor(l)},i.prototype.or=function(l){return this.length>l.length?this.clone().ior(l):l.clone().ior(this)},i.prototype.uor=function(l){return this.length>l.length?this.clone().iuor(l):l.clone().iuor(this)},i.prototype.iuand=function(l){var b;this.length>l.length?b=l:b=this;for(var h=0;h<b.length;h++)this.words[h]=this.words[h]&l.words[h];return this.length=b.length,this._strip()},i.prototype.iand=function(l){return r((this.negative|l.negative)===0),this.iuand(l)},i.prototype.and=function(l){return this.length>l.length?this.clone().iand(l):l.clone().iand(this)},i.prototype.uand=function(l){return this.length>l.length?this.clone().iuand(l):l.clone().iuand(this)},i.prototype.iuxor=function(l){var b,h;this.length>l.length?(b=this,h=l):(b=l,h=this);for(var w=0;w<h.length;w++)this.words[w]=b.words[w]^h.words[w];if(this!==b)for(;w<b.length;w++)this.words[w]=b.words[w];return this.length=b.length,this._strip()},i.prototype.ixor=function(l){return r((this.negative|l.negative)===0),this.iuxor(l)},i.prototype.xor=function(l){return this.length>l.length?this.clone().ixor(l):l.clone().ixor(this)},i.prototype.uxor=function(l){return this.length>l.length?this.clone().iuxor(l):l.clone().iuxor(this)},i.prototype.inotn=function(l){r(typeof l=="number"&&l>=0);var b=Math.ceil(l/26)|0,h=l%26;this._expand(b),h>0&&b--;for(var w=0;w<b;w++)this.words[w]=~this.words[w]&67108863;return h>0&&(this.words[w]=~this.words[w]&67108863>>26-h),this._strip()},i.prototype.notn=function(l){return this.clone().inotn(l)},i.prototype.setn=function(l,b){r(typeof l=="number"&&l>=0);var h=l/26|0,w=l%26;return this._expand(h+1),b?this.words[h]=this.words[h]|1<<w:this.words[h]=this.words[h]&~(1<<w),this._strip()},i.prototype.iadd=function(l){var b;if(this.negative!==0&&l.negative===0)return this.negative=0,b=this.isub(l),this.negative^=1,this._normSign();if(this.negative===0&&l.negative!==0)return l.negative=0,b=this.isub(l),l.negative=1,b._normSign();var h,w;this.length>l.length?(h=this,w=l):(h=l,w=this);for(var E=0,g=0;g<w.length;g++)b=(h.words[g]|0)+(w.words[g]|0)+E,this.words[g]=b&67108863,E=b>>>26;for(;E!==0&&g<h.length;g++)b=(h.words[g]|0)+E,this.words[g]=b&67108863,E=b>>>26;if(this.length=h.length,E!==0)this.words[this.length]=E,this.length++;else if(h!==this)for(;g<h.length;g++)this.words[g]=h.words[g];return this},i.prototype.add=function(l){var b;return l.negative!==0&&this.negative===0?(l.negative=0,b=this.sub(l),l.negative^=1,b):l.negative===0&&this.negative!==0?(this.negative=0,b=l.sub(this),this.negative=1,b):this.length>l.length?this.clone().iadd(l):l.clone().iadd(this)},i.prototype.isub=function(l){if(l.negative!==0){l.negative=0;var b=this.iadd(l);return l.negative=1,b._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(l),this.negative=1,this._normSign();var h=this.cmp(l);if(h===0)return this.negative=0,this.length=1,this.words[0]=0,this;var w,E;h>0?(w=this,E=l):(w=l,E=this);for(var g=0,I=0;I<E.length;I++)b=(w.words[I]|0)-(E.words[I]|0)+g,g=b>>26,this.words[I]=b&67108863;for(;g!==0&&I<w.length;I++)b=(w.words[I]|0)+g,g=b>>26,this.words[I]=b&67108863;if(g===0&&I<w.length&&w!==this)for(;I<w.length;I++)this.words[I]=w.words[I];return this.length=Math.max(this.length,I),w!==this&&(this.negative=1),this._strip()},i.prototype.sub=function(l){return this.clone().isub(l)};function T(x,l,b){b.negative=l.negative^x.negative;var h=x.length+l.length|0;b.length=h,h=h-1|0;var w=x.words[0]|0,E=l.words[0]|0,g=w*E,I=g&67108863,B=g/67108864|0;b.words[0]=I;for(var R=1;R<h;R++){for(var q=B>>>26,V=B&67108863,W=Math.min(R,l.length-1),K=Math.max(0,R-x.length+1);K<=W;K++){var Y=R-K|0;w=x.words[Y]|0,E=l.words[K]|0,g=w*E+V,q+=g/67108864|0,V=g&67108863}b.words[R]=V|0,B=q|0}return B!==0?b.words[R]=B|0:b.length--,b._strip()}var M=function(l,b,h){var w=l.words,E=b.words,g=h.words,I=0,B,R,q,V=w[0]|0,W=V&8191,K=V>>>13,Y=w[1]|0,J=Y&8191,Z=Y>>>13,ce=w[2]|0,oe=ce&8191,ae=ce>>>13,He=w[3]|0,ye=He&8191,xe=He>>>13,zr=w[4]|0,ke=zr&8191,Ne=zr>>>13,Ss=w[5]|0,Ke=Ss&8191,Ze=Ss>>>13,Qu=w[6]|0,ct=Qu&8191,dt=Qu>>>13,Ny=w[7]|0,ft=Ny&8191,ut=Ny>>>13,qy=w[8]|0,lt=qy&8191,ht=qy>>>13,Ly=w[9]|0,pt=Ly&8191,mt=Ly>>>13,Uy=E[0]|0,yt=Uy&8191,gt=Uy>>>13,Fy=E[1]|0,bt=Fy&8191,vt=Fy>>>13,zy=E[2]|0,wt=zy&8191,_t=zy>>>13,$y=E[3]|0,xt=$y&8191,Et=$y>>>13,Gy=E[4]|0,St=Gy&8191,At=Gy>>>13,Hy=E[5]|0,Tt=Hy&8191,Pt=Hy>>>13,Wy=E[6]|0,It=Wy&8191,Rt=Wy>>>13,Vy=E[7]|0,Mt=Vy&8191,kt=Vy>>>13,Ky=E[8]|0,Bt=Ky&8191,Dt=Ky>>>13,Ap=E[9]|0,$r=Ap&8191,Gr=Ap>>>13;h.negative=l.negative^b.negative,h.length=19,B=Math.imul(W,yt),R=Math.imul(W,gt),R=R+Math.imul(K,yt)|0,q=Math.imul(K,gt);var el=(I+B|0)+((R&8191)<<13)|0;I=(q+(R>>>13)|0)+(el>>>26)|0,el&=67108863,B=Math.imul(J,yt),R=Math.imul(J,gt),R=R+Math.imul(Z,yt)|0,q=Math.imul(Z,gt),B=B+Math.imul(W,bt)|0,R=R+Math.imul(W,vt)|0,R=R+Math.imul(K,bt)|0,q=q+Math.imul(K,vt)|0;var tl=(I+B|0)+((R&8191)<<13)|0;I=(q+(R>>>13)|0)+(tl>>>26)|0,tl&=67108863,B=Math.imul(oe,yt),R=Math.imul(oe,gt),R=R+Math.imul(ae,yt)|0,q=Math.imul(ae,gt),B=B+Math.imul(J,bt)|0,R=R+Math.imul(J,vt)|0,R=R+Math.imul(Z,bt)|0,q=q+Math.imul(Z,vt)|0,B=B+Math.imul(W,wt)|0,R=R+Math.imul(W,_t)|0,R=R+Math.imul(K,wt)|0,q=q+Math.imul(K,_t)|0;var rl=(I+B|0)+((R&8191)<<13)|0;I=(q+(R>>>13)|0)+(rl>>>26)|0,rl&=67108863,B=Math.imul(ye,yt),R=Math.imul(ye,gt),R=R+Math.imul(xe,yt)|0,q=Math.imul(xe,gt),B=B+Math.imul(oe,bt)|0,R=R+Math.imul(oe,vt)|0,R=R+Math.imul(ae,bt)|0,q=q+Math.imul(ae,vt)|0,B=B+Math.imul(J,wt)|0,R=R+Math.imul(J,_t)|0,R=R+Math.imul(Z,wt)|0,q=q+Math.imul(Z,_t)|0,B=B+Math.imul(W,xt)|0,R=R+Math.imul(W,Et)|0,R=R+Math.imul(K,xt)|0,q=q+Math.imul(K,Et)|0;var nl=(I+B|0)+((R&8191)<<13)|0;I=(q+(R>>>13)|0)+(nl>>>26)|0,nl&=67108863,B=Math.imul(ke,yt),R=Math.imul(ke,gt),R=R+Math.imul(Ne,yt)|0,q=Math.imul(Ne,gt),B=B+Math.imul(ye,bt)|0,R=R+Math.imul(ye,vt)|0,R=R+Math.imul(xe,bt)|0,q=q+Math.imul(xe,vt)|0,B=B+Math.imul(oe,wt)|0,R=R+Math.imul(oe,_t)|0,R=R+Math.imul(ae,wt)|0,q=q+Math.imul(ae,_t)|0,B=B+Math.imul(J,xt)|0,R=R+Math.imul(J,Et)|0,R=R+Math.imul(Z,xt)|0,q=q+Math.imul(Z,Et)|0,B=B+Math.imul(W,St)|0,R=R+Math.imul(W,At)|0,R=R+Math.imul(K,St)|0,q=q+Math.imul(K,At)|0;var il=(I+B|0)+((R&8191)<<13)|0;I=(q+(R>>>13)|0)+(il>>>26)|0,il&=67108863,B=Math.imul(Ke,yt),R=Math.imul(Ke,gt),R=R+Math.imul(Ze,yt)|0,q=Math.imul(Ze,gt),B=B+Math.imul(ke,bt)|0,R=R+Math.imul(ke,vt)|0,R=R+Math.imul(Ne,bt)|0,q=q+Math.imul(Ne,vt)|0,B=B+Math.imul(ye,wt)|0,R=R+Math.imul(ye,_t)|0,R=R+Math.imul(xe,wt)|0,q=q+Math.imul(xe,_t)|0,B=B+Math.imul(oe,xt)|0,R=R+Math.imul(oe,Et)|0,R=R+Math.imul(ae,xt)|0,q=q+Math.imul(ae,Et)|0,B=B+Math.imul(J,St)|0,R=R+Math.imul(J,At)|0,R=R+Math.imul(Z,St)|0,q=q+Math.imul(Z,At)|0,B=B+Math.imul(W,Tt)|0,R=R+Math.imul(W,Pt)|0,R=R+Math.imul(K,Tt)|0,q=q+Math.imul(K,Pt)|0;var ol=(I+B|0)+((R&8191)<<13)|0;I=(q+(R>>>13)|0)+(ol>>>26)|0,ol&=67108863,B=Math.imul(ct,yt),R=Math.imul(ct,gt),R=R+Math.imul(dt,yt)|0,q=Math.imul(dt,gt),B=B+Math.imul(Ke,bt)|0,R=R+Math.imul(Ke,vt)|0,R=R+Math.imul(Ze,bt)|0,q=q+Math.imul(Ze,vt)|0,B=B+Math.imul(ke,wt)|0,R=R+Math.imul(ke,_t)|0,R=R+Math.imul(Ne,wt)|0,q=q+Math.imul(Ne,_t)|0,B=B+Math.imul(ye,xt)|0,R=R+Math.imul(ye,Et)|0,R=R+Math.imul(xe,xt)|0,q=q+Math.imul(xe,Et)|0,B=B+Math.imul(oe,St)|0,R=R+Math.imul(oe,At)|0,R=R+Math.imul(ae,St)|0,q=q+Math.imul(ae,At)|0,B=B+Math.imul(J,Tt)|0,R=R+Math.imul(J,Pt)|0,R=R+Math.imul(Z,Tt)|0,q=q+Math.imul(Z,Pt)|0,B=B+Math.imul(W,It)|0,R=R+Math.imul(W,Rt)|0,R=R+Math.imul(K,It)|0,q=q+Math.imul(K,Rt)|0;var sl=(I+B|0)+((R&8191)<<13)|0;I=(q+(R>>>13)|0)+(sl>>>26)|0,sl&=67108863,B=Math.imul(ft,yt),R=Math.imul(ft,gt),R=R+Math.imul(ut,yt)|0,q=Math.imul(ut,gt),B=B+Math.imul(ct,bt)|0,R=R+Math.imul(ct,vt)|0,R=R+Math.imul(dt,bt)|0,q=q+Math.imul(dt,vt)|0,B=B+Math.imul(Ke,wt)|0,R=R+Math.imul(Ke,_t)|0,R=R+Math.imul(Ze,wt)|0,q=q+Math.imul(Ze,_t)|0,B=B+Math.imul(ke,xt)|0,R=R+Math.imul(ke,Et)|0,R=R+Math.imul(Ne,xt)|0,q=q+Math.imul(Ne,Et)|0,B=B+Math.imul(ye,St)|0,R=R+Math.imul(ye,At)|0,R=R+Math.imul(xe,St)|0,q=q+Math.imul(xe,At)|0,B=B+Math.imul(oe,Tt)|0,R=R+Math.imul(oe,Pt)|0,R=R+Math.imul(ae,Tt)|0,q=q+Math.imul(ae,Pt)|0,B=B+Math.imul(J,It)|0,R=R+Math.imul(J,Rt)|0,R=R+Math.imul(Z,It)|0,q=q+Math.imul(Z,Rt)|0,B=B+Math.imul(W,Mt)|0,R=R+Math.imul(W,kt)|0,R=R+Math.imul(K,Mt)|0,q=q+Math.imul(K,kt)|0;var al=(I+B|0)+((R&8191)<<13)|0;I=(q+(R>>>13)|0)+(al>>>26)|0,al&=67108863,B=Math.imul(lt,yt),R=Math.imul(lt,gt),R=R+Math.imul(ht,yt)|0,q=Math.imul(ht,gt),B=B+Math.imul(ft,bt)|0,R=R+Math.imul(ft,vt)|0,R=R+Math.imul(ut,bt)|0,q=q+Math.imul(ut,vt)|0,B=B+Math.imul(ct,wt)|0,R=R+Math.imul(ct,_t)|0,R=R+Math.imul(dt,wt)|0,q=q+Math.imul(dt,_t)|0,B=B+Math.imul(Ke,xt)|0,R=R+Math.imul(Ke,Et)|0,R=R+Math.imul(Ze,xt)|0,q=q+Math.imul(Ze,Et)|0,B=B+Math.imul(ke,St)|0,R=R+Math.imul(ke,At)|0,R=R+Math.imul(Ne,St)|0,q=q+Math.imul(Ne,At)|0,B=B+Math.imul(ye,Tt)|0,R=R+Math.imul(ye,Pt)|0,R=R+Math.imul(xe,Tt)|0,q=q+Math.imul(xe,Pt)|0,B=B+Math.imul(oe,It)|0,R=R+Math.imul(oe,Rt)|0,R=R+Math.imul(ae,It)|0,q=q+Math.imul(ae,Rt)|0,B=B+Math.imul(J,Mt)|0,R=R+Math.imul(J,kt)|0,R=R+Math.imul(Z,Mt)|0,q=q+Math.imul(Z,kt)|0,B=B+Math.imul(W,Bt)|0,R=R+Math.imul(W,Dt)|0,R=R+Math.imul(K,Bt)|0,q=q+Math.imul(K,Dt)|0;var cl=(I+B|0)+((R&8191)<<13)|0;I=(q+(R>>>13)|0)+(cl>>>26)|0,cl&=67108863,B=Math.imul(pt,yt),R=Math.imul(pt,gt),R=R+Math.imul(mt,yt)|0,q=Math.imul(mt,gt),B=B+Math.imul(lt,bt)|0,R=R+Math.imul(lt,vt)|0,R=R+Math.imul(ht,bt)|0,q=q+Math.imul(ht,vt)|0,B=B+Math.imul(ft,wt)|0,R=R+Math.imul(ft,_t)|0,R=R+Math.imul(ut,wt)|0,q=q+Math.imul(ut,_t)|0,B=B+Math.imul(ct,xt)|0,R=R+Math.imul(ct,Et)|0,R=R+Math.imul(dt,xt)|0,q=q+Math.imul(dt,Et)|0,B=B+Math.imul(Ke,St)|0,R=R+Math.imul(Ke,At)|0,R=R+Math.imul(Ze,St)|0,q=q+Math.imul(Ze,At)|0,B=B+Math.imul(ke,Tt)|0,R=R+Math.imul(ke,Pt)|0,R=R+Math.imul(Ne,Tt)|0,q=q+Math.imul(Ne,Pt)|0,B=B+Math.imul(ye,It)|0,R=R+Math.imul(ye,Rt)|0,R=R+Math.imul(xe,It)|0,q=q+Math.imul(xe,Rt)|0,B=B+Math.imul(oe,Mt)|0,R=R+Math.imul(oe,kt)|0,R=R+Math.imul(ae,Mt)|0,q=q+Math.imul(ae,kt)|0,B=B+Math.imul(J,Bt)|0,R=R+Math.imul(J,Dt)|0,R=R+Math.imul(Z,Bt)|0,q=q+Math.imul(Z,Dt)|0,B=B+Math.imul(W,$r)|0,R=R+Math.imul(W,Gr)|0,R=R+Math.imul(K,$r)|0,q=q+Math.imul(K,Gr)|0;var dl=(I+B|0)+((R&8191)<<13)|0;I=(q+(R>>>13)|0)+(dl>>>26)|0,dl&=67108863,B=Math.imul(pt,bt),R=Math.imul(pt,vt),R=R+Math.imul(mt,bt)|0,q=Math.imul(mt,vt),B=B+Math.imul(lt,wt)|0,R=R+Math.imul(lt,_t)|0,R=R+Math.imul(ht,wt)|0,q=q+Math.imul(ht,_t)|0,B=B+Math.imul(ft,xt)|0,R=R+Math.imul(ft,Et)|0,R=R+Math.imul(ut,xt)|0,q=q+Math.imul(ut,Et)|0,B=B+Math.imul(ct,St)|0,R=R+Math.imul(ct,At)|0,R=R+Math.imul(dt,St)|0,q=q+Math.imul(dt,At)|0,B=B+Math.imul(Ke,Tt)|0,R=R+Math.imul(Ke,Pt)|0,R=R+Math.imul(Ze,Tt)|0,q=q+Math.imul(Ze,Pt)|0,B=B+Math.imul(ke,It)|0,R=R+Math.imul(ke,Rt)|0,R=R+Math.imul(Ne,It)|0,q=q+Math.imul(Ne,Rt)|0,B=B+Math.imul(ye,Mt)|0,R=R+Math.imul(ye,kt)|0,R=R+Math.imul(xe,Mt)|0,q=q+Math.imul(xe,kt)|0,B=B+Math.imul(oe,Bt)|0,R=R+Math.imul(oe,Dt)|0,R=R+Math.imul(ae,Bt)|0,q=q+Math.imul(ae,Dt)|0,B=B+Math.imul(J,$r)|0,R=R+Math.imul(J,Gr)|0,R=R+Math.imul(Z,$r)|0,q=q+Math.imul(Z,Gr)|0;var fl=(I+B|0)+((R&8191)<<13)|0;I=(q+(R>>>13)|0)+(fl>>>26)|0,fl&=67108863,B=Math.imul(pt,wt),R=Math.imul(pt,_t),R=R+Math.imul(mt,wt)|0,q=Math.imul(mt,_t),B=B+Math.imul(lt,xt)|0,R=R+Math.imul(lt,Et)|0,R=R+Math.imul(ht,xt)|0,q=q+Math.imul(ht,Et)|0,B=B+Math.imul(ft,St)|0,R=R+Math.imul(ft,At)|0,R=R+Math.imul(ut,St)|0,q=q+Math.imul(ut,At)|0,B=B+Math.imul(ct,Tt)|0,R=R+Math.imul(ct,Pt)|0,R=R+Math.imul(dt,Tt)|0,q=q+Math.imul(dt,Pt)|0,B=B+Math.imul(Ke,It)|0,R=R+Math.imul(Ke,Rt)|0,R=R+Math.imul(Ze,It)|0,q=q+Math.imul(Ze,Rt)|0,B=B+Math.imul(ke,Mt)|0,R=R+Math.imul(ke,kt)|0,R=R+Math.imul(Ne,Mt)|0,q=q+Math.imul(Ne,kt)|0,B=B+Math.imul(ye,Bt)|0,R=R+Math.imul(ye,Dt)|0,R=R+Math.imul(xe,Bt)|0,q=q+Math.imul(xe,Dt)|0,B=B+Math.imul(oe,$r)|0,R=R+Math.imul(oe,Gr)|0,R=R+Math.imul(ae,$r)|0,q=q+Math.imul(ae,Gr)|0;var ul=(I+B|0)+((R&8191)<<13)|0;I=(q+(R>>>13)|0)+(ul>>>26)|0,ul&=67108863,B=Math.imul(pt,xt),R=Math.imul(pt,Et),R=R+Math.imul(mt,xt)|0,q=Math.imul(mt,Et),B=B+Math.imul(lt,St)|0,R=R+Math.imul(lt,At)|0,R=R+Math.imul(ht,St)|0,q=q+Math.imul(ht,At)|0,B=B+Math.imul(ft,Tt)|0,R=R+Math.imul(ft,Pt)|0,R=R+Math.imul(ut,Tt)|0,q=q+Math.imul(ut,Pt)|0,B=B+Math.imul(ct,It)|0,R=R+Math.imul(ct,Rt)|0,R=R+Math.imul(dt,It)|0,q=q+Math.imul(dt,Rt)|0,B=B+Math.imul(Ke,Mt)|0,R=R+Math.imul(Ke,kt)|0,R=R+Math.imul(Ze,Mt)|0,q=q+Math.imul(Ze,kt)|0,B=B+Math.imul(ke,Bt)|0,R=R+Math.imul(ke,Dt)|0,R=R+Math.imul(Ne,Bt)|0,q=q+Math.imul(Ne,Dt)|0,B=B+Math.imul(ye,$r)|0,R=R+Math.imul(ye,Gr)|0,R=R+Math.imul(xe,$r)|0,q=q+Math.imul(xe,Gr)|0;var ll=(I+B|0)+((R&8191)<<13)|0;I=(q+(R>>>13)|0)+(ll>>>26)|0,ll&=67108863,B=Math.imul(pt,St),R=Math.imul(pt,At),R=R+Math.imul(mt,St)|0,q=Math.imul(mt,At),B=B+Math.imul(lt,Tt)|0,R=R+Math.imul(lt,Pt)|0,R=R+Math.imul(ht,Tt)|0,q=q+Math.imul(ht,Pt)|0,B=B+Math.imul(ft,It)|0,R=R+Math.imul(ft,Rt)|0,R=R+Math.imul(ut,It)|0,q=q+Math.imul(ut,Rt)|0,B=B+Math.imul(ct,Mt)|0,R=R+Math.imul(ct,kt)|0,R=R+Math.imul(dt,Mt)|0,q=q+Math.imul(dt,kt)|0,B=B+Math.imul(Ke,Bt)|0,R=R+Math.imul(Ke,Dt)|0,R=R+Math.imul(Ze,Bt)|0,q=q+Math.imul(Ze,Dt)|0,B=B+Math.imul(ke,$r)|0,R=R+Math.imul(ke,Gr)|0,R=R+Math.imul(Ne,$r)|0,q=q+Math.imul(Ne,Gr)|0;var hl=(I+B|0)+((R&8191)<<13)|0;I=(q+(R>>>13)|0)+(hl>>>26)|0,hl&=67108863,B=Math.imul(pt,Tt),R=Math.imul(pt,Pt),R=R+Math.imul(mt,Tt)|0,q=Math.imul(mt,Pt),B=B+Math.imul(lt,It)|0,R=R+Math.imul(lt,Rt)|0,R=R+Math.imul(ht,It)|0,q=q+Math.imul(ht,Rt)|0,B=B+Math.imul(ft,Mt)|0,R=R+Math.imul(ft,kt)|0,R=R+Math.imul(ut,Mt)|0,q=q+Math.imul(ut,kt)|0,B=B+Math.imul(ct,Bt)|0,R=R+Math.imul(ct,Dt)|0,R=R+Math.imul(dt,Bt)|0,q=q+Math.imul(dt,Dt)|0,B=B+Math.imul(Ke,$r)|0,R=R+Math.imul(Ke,Gr)|0,R=R+Math.imul(Ze,$r)|0,q=q+Math.imul(Ze,Gr)|0;var pl=(I+B|0)+((R&8191)<<13)|0;I=(q+(R>>>13)|0)+(pl>>>26)|0,pl&=67108863,B=Math.imul(pt,It),R=Math.imul(pt,Rt),R=R+Math.imul(mt,It)|0,q=Math.imul(mt,Rt),B=B+Math.imul(lt,Mt)|0,R=R+Math.imul(lt,kt)|0,R=R+Math.imul(ht,Mt)|0,q=q+Math.imul(ht,kt)|0,B=B+Math.imul(ft,Bt)|0,R=R+Math.imul(ft,Dt)|0,R=R+Math.imul(ut,Bt)|0,q=q+Math.imul(ut,Dt)|0,B=B+Math.imul(ct,$r)|0,R=R+Math.imul(ct,Gr)|0,R=R+Math.imul(dt,$r)|0,q=q+Math.imul(dt,Gr)|0;var ml=(I+B|0)+((R&8191)<<13)|0;I=(q+(R>>>13)|0)+(ml>>>26)|0,ml&=67108863,B=Math.imul(pt,Mt),R=Math.imul(pt,kt),R=R+Math.imul(mt,Mt)|0,q=Math.imul(mt,kt),B=B+Math.imul(lt,Bt)|0,R=R+Math.imul(lt,Dt)|0,R=R+Math.imul(ht,Bt)|0,q=q+Math.imul(ht,Dt)|0,B=B+Math.imul(ft,$r)|0,R=R+Math.imul(ft,Gr)|0,R=R+Math.imul(ut,$r)|0,q=q+Math.imul(ut,Gr)|0;var m8=(I+B|0)+((R&8191)<<13)|0;I=(q+(R>>>13)|0)+(m8>>>26)|0,m8&=67108863,B=Math.imul(pt,Bt),R=Math.imul(pt,Dt),R=R+Math.imul(mt,Bt)|0,q=Math.imul(mt,Dt),B=B+Math.imul(lt,$r)|0,R=R+Math.imul(lt,Gr)|0,R=R+Math.imul(ht,$r)|0,q=q+Math.imul(ht,Gr)|0;var y8=(I+B|0)+((R&8191)<<13)|0;I=(q+(R>>>13)|0)+(y8>>>26)|0,y8&=67108863,B=Math.imul(pt,$r),R=Math.imul(pt,Gr),R=R+Math.imul(mt,$r)|0,q=Math.imul(mt,Gr);var g8=(I+B|0)+((R&8191)<<13)|0;return I=(q+(R>>>13)|0)+(g8>>>26)|0,g8&=67108863,g[0]=el,g[1]=tl,g[2]=rl,g[3]=nl,g[4]=il,g[5]=ol,g[6]=sl,g[7]=al,g[8]=cl,g[9]=dl,g[10]=fl,g[11]=ul,g[12]=ll,g[13]=hl,g[14]=pl,g[15]=ml,g[16]=m8,g[17]=y8,g[18]=g8,I!==0&&(g[19]=I,h.length++),h};Math.imul||(M=T);function D(x,l,b){b.negative=l.negative^x.negative,b.length=x.length+l.length;for(var h=0,w=0,E=0;E<b.length-1;E++){var g=w;w=0;for(var I=h&67108863,B=Math.min(E,l.length-1),R=Math.max(0,E-x.length+1);R<=B;R++){var q=E-R,V=x.words[q]|0,W=l.words[R]|0,K=V*W,Y=K&67108863;g=g+(K/67108864|0)|0,Y=Y+I|0,I=Y&67108863,g=g+(Y>>>26)|0,w+=g>>>26,g&=67108863}b.words[E]=I,h=g,g=w}return h!==0?b.words[E]=h:b.length--,b._strip()}function O(x,l,b){return D(x,l,b)}i.prototype.mulTo=function(l,b){var h,w=this.length+l.length;return this.length===10&&l.length===10?h=M(this,l,b):w<63?h=T(this,l,b):w<1024?h=D(this,l,b):h=O(this,l,b),h};function U(x,l){this.x=x,this.y=l}U.prototype.makeRBT=function(l){for(var b=new Array(l),h=i.prototype._countBits(l)-1,w=0;w<l;w++)b[w]=this.revBin(w,h,l);return b},U.prototype.revBin=function(l,b,h){if(l===0||l===h-1)return l;for(var w=0,E=0;E<b;E++)w|=(l&1)<<b-E-1,l>>=1;return w},U.prototype.permute=function(l,b,h,w,E,g){for(var I=0;I<g;I++)w[I]=b[l[I]],E[I]=h[l[I]]},U.prototype.transform=function(l,b,h,w,E,g){this.permute(g,l,b,h,w,E);for(var I=1;I<E;I<<=1)for(var B=I<<1,R=Math.cos(2*Math.PI/B),q=Math.sin(2*Math.PI/B),V=0;V<E;V+=B)for(var W=R,K=q,Y=0;Y<I;Y++){var J=h[V+Y],Z=w[V+Y],ce=h[V+Y+I],oe=w[V+Y+I],ae=W*ce-K*oe;oe=W*oe+K*ce,ce=ae,h[V+Y]=J+ce,w[V+Y]=Z+oe,h[V+Y+I]=J-ce,w[V+Y+I]=Z-oe,Y!==B&&(ae=R*W-q*K,K=R*K+q*W,W=ae)}},U.prototype.guessLen13b=function(l,b){var h=Math.max(b,l)|1,w=h&1,E=0;for(h=h/2|0;h;h=h>>>1)E++;return 1<<E+1+w},U.prototype.conjugate=function(l,b,h){if(!(h<=1))for(var w=0;w<h/2;w++){var E=l[w];l[w]=l[h-w-1],l[h-w-1]=E,E=b[w],b[w]=-b[h-w-1],b[h-w-1]=-E}},U.prototype.normalize13b=function(l,b){for(var h=0,w=0;w<b/2;w++){var E=Math.round(l[2*w+1]/b)*8192+Math.round(l[2*w]/b)+h;l[w]=E&67108863,E<67108864?h=0:h=E/67108864|0}return l},U.prototype.convert13b=function(l,b,h,w){for(var E=0,g=0;g<b;g++)E=E+(l[g]|0),h[2*g]=E&8191,E=E>>>13,h[2*g+1]=E&8191,E=E>>>13;for(g=2*b;g<w;++g)h[g]=0;r(E===0),r((E&-8192)===0)},U.prototype.stub=function(l){for(var b=new Array(l),h=0;h<l;h++)b[h]=0;return b},U.prototype.mulp=function(l,b,h){var w=2*this.guessLen13b(l.length,b.length),E=this.makeRBT(w),g=this.stub(w),I=new Array(w),B=new Array(w),R=new Array(w),q=new Array(w),V=new Array(w),W=new Array(w),K=h.words;K.length=w,this.convert13b(l.words,l.length,I,w),this.convert13b(b.words,b.length,q,w),this.transform(I,g,B,R,w,E),this.transform(q,g,V,W,w,E);for(var Y=0;Y<w;Y++){var J=B[Y]*V[Y]-R[Y]*W[Y];R[Y]=B[Y]*W[Y]+R[Y]*V[Y],B[Y]=J}return this.conjugate(B,R,w),this.transform(B,R,K,g,w,E),this.conjugate(K,g,w),this.normalize13b(K,w),h.negative=l.negative^b.negative,h.length=l.length+b.length,h._strip()},i.prototype.mul=function(l){var b=new i(null);return b.words=new Array(this.length+l.length),this.mulTo(l,b)},i.prototype.mulf=function(l){var b=new i(null);return b.words=new Array(this.length+l.length),O(this,l,b)},i.prototype.imul=function(l){return this.clone().mulTo(l,this)},i.prototype.imuln=function(l){var b=l<0;b&&(l=-l),r(typeof l=="number"),r(l<67108864);for(var h=0,w=0;w<this.length;w++){var E=(this.words[w]|0)*l,g=(E&67108863)+(h&67108863);h>>=26,h+=E/67108864|0,h+=g>>>26,this.words[w]=g&67108863}return h!==0&&(this.words[w]=h,this.length++),this.length=l===0?1:this.length,b?this.ineg():this},i.prototype.muln=function(l){return this.clone().imuln(l)},i.prototype.sqr=function(){return this.mul(this)},i.prototype.isqr=function(){return this.imul(this.clone())},i.prototype.pow=function(l){var b=A(l);if(b.length===0)return new i(1);for(var h=this,w=0;w<b.length&&b[w]===0;w++,h=h.sqr());if(++w<b.length)for(var E=h.sqr();w<b.length;w++,E=E.sqr())b[w]!==0&&(h=h.mul(E));return h},i.prototype.iushln=function(l){r(typeof l=="number"&&l>=0);var b=l%26,h=(l-b)/26,w=67108863>>>26-b<<26-b,E;if(b!==0){var g=0;for(E=0;E<this.length;E++){var I=this.words[E]&w,B=(this.words[E]|0)-I<<b;this.words[E]=B|g,g=I>>>26-b}g&&(this.words[E]=g,this.length++)}if(h!==0){for(E=this.length-1;E>=0;E--)this.words[E+h]=this.words[E];for(E=0;E<h;E++)this.words[E]=0;this.length+=h}return this._strip()},i.prototype.ishln=function(l){return r(this.negative===0),this.iushln(l)},i.prototype.iushrn=function(l,b,h){r(typeof l=="number"&&l>=0);var w;b?w=(b-b%26)/26:w=0;var E=l%26,g=Math.min((l-E)/26,this.length),I=67108863^67108863>>>E<<E,B=h;if(w-=g,w=Math.max(0,w),B){for(var R=0;R<g;R++)B.words[R]=this.words[R];B.length=g}if(g!==0)if(this.length>g)for(this.length-=g,R=0;R<this.length;R++)this.words[R]=this.words[R+g];else this.words[0]=0,this.length=1;var q=0;for(R=this.length-1;R>=0&&(q!==0||R>=w);R--){var V=this.words[R]|0;this.words[R]=q<<26-E|V>>>E,q=V&I}return B&&q!==0&&(B.words[B.length++]=q),this.length===0&&(this.words[0]=0,this.length=1),this._strip()},i.prototype.ishrn=function(l,b,h){return r(this.negative===0),this.iushrn(l,b,h)},i.prototype.shln=function(l){return this.clone().ishln(l)},i.prototype.ushln=function(l){return this.clone().iushln(l)},i.prototype.shrn=function(l){return this.clone().ishrn(l)},i.prototype.ushrn=function(l){return this.clone().iushrn(l)},i.prototype.testn=function(l){r(typeof l=="number"&&l>=0);var b=l%26,h=(l-b)/26,w=1<<b;if(this.length<=h)return!1;var E=this.words[h];return!!(E&w)},i.prototype.imaskn=function(l){r(typeof l=="number"&&l>=0);var b=l%26,h=(l-b)/26;if(r(this.negative===0,"imaskn works only with positive numbers"),this.length<=h)return this;if(b!==0&&h++,this.length=Math.min(h,this.length),b!==0){var w=67108863^67108863>>>b<<b;this.words[this.length-1]&=w}return this.length===0&&(this.words[0]=0,this.length=1),this._strip()},i.prototype.maskn=function(l){return this.clone().imaskn(l)},i.prototype.iaddn=function(l){return r(typeof l=="number"),r(l<67108864),l<0?this.isubn(-l):this.negative!==0?this.length===1&&(this.words[0]|0)<=l?(this.words[0]=l-(this.words[0]|0),this.negative=0,this):(this.negative=0,this.isubn(l),this.negative=1,this):this._iaddn(l)},i.prototype._iaddn=function(l){this.words[0]+=l;for(var b=0;b<this.length&&this.words[b]>=67108864;b++)this.words[b]-=67108864,b===this.length-1?this.words[b+1]=1:this.words[b+1]++;return this.length=Math.max(this.length,b+1),this},i.prototype.isubn=function(l){if(r(typeof l=="number"),r(l<67108864),l<0)return this.iaddn(-l);if(this.negative!==0)return this.negative=0,this.iaddn(l),this.negative=1,this;if(this.words[0]-=l,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var b=0;b<this.length&&this.words[b]<0;b++)this.words[b]+=67108864,this.words[b+1]-=1;return this._strip()},i.prototype.addn=function(l){return this.clone().iaddn(l)},i.prototype.subn=function(l){return this.clone().isubn(l)},i.prototype.iabs=function(){return this.negative=0,this},i.prototype.abs=function(){return this.clone().iabs()},i.prototype._ishlnsubmul=function(l,b,h){var w=l.length+h,E;this._expand(w);var g,I=0;for(E=0;E<l.length;E++){g=(this.words[E+h]|0)+I;var B=(l.words[E]|0)*b;g-=B&67108863,I=(g>>26)-(B/67108864|0),this.words[E+h]=g&67108863}for(;E<this.length-h;E++)g=(this.words[E+h]|0)+I,I=g>>26,this.words[E+h]=g&67108863;if(I===0)return this._strip();for(r(I===-1),I=0,E=0;E<this.length;E++)g=-(this.words[E]|0)+I,I=g>>26,this.words[E]=g&67108863;return this.negative=1,this._strip()},i.prototype._wordDiv=function(l,b){var h=this.length-l.length,w=this.clone(),E=l,g=E.words[E.length-1]|0,I=this._countBits(g);h=26-I,h!==0&&(E=E.ushln(h),w.iushln(h),g=E.words[E.length-1]|0);var B=w.length-E.length,R;if(b!=="mod"){R=new i(null),R.length=B+1,R.words=new Array(R.length);for(var q=0;q<R.length;q++)R.words[q]=0}var V=w.clone()._ishlnsubmul(E,1,B);V.negative===0&&(w=V,R&&(R.words[B]=1));for(var W=B-1;W>=0;W--){var K=(w.words[E.length+W]|0)*67108864+(w.words[E.length+W-1]|0);for(K=Math.min(K/g|0,67108863),w._ishlnsubmul(E,K,W);w.negative!==0;)K--,w.negative=0,w._ishlnsubmul(E,1,W),w.isZero()||(w.negative^=1);R&&(R.words[W]=K)}return R&&R._strip(),w._strip(),b!=="div"&&h!==0&&w.iushrn(h),{div:R||null,mod:w}},i.prototype.divmod=function(l,b,h){if(r(!l.isZero()),this.isZero())return{div:new i(0),mod:new i(0)};var w,E,g;return this.negative!==0&&l.negative===0?(g=this.neg().divmod(l,b),b!=="mod"&&(w=g.div.neg()),b!=="div"&&(E=g.mod.neg(),h&&E.negative!==0&&E.iadd(l)),{div:w,mod:E}):this.negative===0&&l.negative!==0?(g=this.divmod(l.neg(),b),b!=="mod"&&(w=g.div.neg()),{div:w,mod:g.mod}):this.negative&l.negative?(g=this.neg().divmod(l.neg(),b),b!=="div"&&(E=g.mod.neg(),h&&E.negative!==0&&E.isub(l)),{div:g.div,mod:E}):l.length>this.length||this.cmp(l)<0?{div:new i(0),mod:this}:l.length===1?b==="div"?{div:this.divn(l.words[0]),mod:null}:b==="mod"?{div:null,mod:new i(this.modrn(l.words[0]))}:{div:this.divn(l.words[0]),mod:new i(this.modrn(l.words[0]))}:this._wordDiv(l,b)},i.prototype.div=function(l){return this.divmod(l,"div",!1).div},i.prototype.mod=function(l){return this.divmod(l,"mod",!1).mod},i.prototype.umod=function(l){return this.divmod(l,"mod",!0).mod},i.prototype.divRound=function(l){var b=this.divmod(l);if(b.mod.isZero())return b.div;var h=b.div.negative!==0?b.mod.isub(l):b.mod,w=l.ushrn(1),E=l.andln(1),g=h.cmp(w);return g<0||E===1&&g===0?b.div:b.div.negative!==0?b.div.isubn(1):b.div.iaddn(1)},i.prototype.modrn=function(l){var b=l<0;b&&(l=-l),r(l<=67108863);for(var h=(1<<26)%l,w=0,E=this.length-1;E>=0;E--)w=(h*w+(this.words[E]|0))%l;return b?-w:w},i.prototype.modn=function(l){return this.modrn(l)},i.prototype.idivn=function(l){var b=l<0;b&&(l=-l),r(l<=67108863);for(var h=0,w=this.length-1;w>=0;w--){var E=(this.words[w]|0)+h*67108864;this.words[w]=E/l|0,h=E%l}return this._strip(),b?this.ineg():this},i.prototype.divn=function(l){return this.clone().idivn(l)},i.prototype.egcd=function(l){r(l.negative===0),r(!l.isZero());var b=this,h=l.clone();b.negative!==0?b=b.umod(l):b=b.clone();for(var w=new i(1),E=new i(0),g=new i(0),I=new i(1),B=0;b.isEven()&&h.isEven();)b.iushrn(1),h.iushrn(1),++B;for(var R=h.clone(),q=b.clone();!b.isZero();){for(var V=0,W=1;!(b.words[0]&W)&&V<26;++V,W<<=1);if(V>0)for(b.iushrn(V);V-- >0;)(w.isOdd()||E.isOdd())&&(w.iadd(R),E.isub(q)),w.iushrn(1),E.iushrn(1);for(var K=0,Y=1;!(h.words[0]&Y)&&K<26;++K,Y<<=1);if(K>0)for(h.iushrn(K);K-- >0;)(g.isOdd()||I.isOdd())&&(g.iadd(R),I.isub(q)),g.iushrn(1),I.iushrn(1);b.cmp(h)>=0?(b.isub(h),w.isub(g),E.isub(I)):(h.isub(b),g.isub(w),I.isub(E))}return{a:g,b:I,gcd:h.iushln(B)}},i.prototype._invmp=function(l){r(l.negative===0),r(!l.isZero());var b=this,h=l.clone();b.negative!==0?b=b.umod(l):b=b.clone();for(var w=new i(1),E=new i(0),g=h.clone();b.cmpn(1)>0&&h.cmpn(1)>0;){for(var I=0,B=1;!(b.words[0]&B)&&I<26;++I,B<<=1);if(I>0)for(b.iushrn(I);I-- >0;)w.isOdd()&&w.iadd(g),w.iushrn(1);for(var R=0,q=1;!(h.words[0]&q)&&R<26;++R,q<<=1);if(R>0)for(h.iushrn(R);R-- >0;)E.isOdd()&&E.iadd(g),E.iushrn(1);b.cmp(h)>=0?(b.isub(h),w.isub(E)):(h.isub(b),E.isub(w))}var V;return b.cmpn(1)===0?V=w:V=E,V.cmpn(0)<0&&V.iadd(l),V},i.prototype.gcd=function(l){if(this.isZero())return l.abs();if(l.isZero())return this.abs();var b=this.clone(),h=l.clone();b.negative=0,h.negative=0;for(var w=0;b.isEven()&&h.isEven();w++)b.iushrn(1),h.iushrn(1);do{for(;b.isEven();)b.iushrn(1);for(;h.isEven();)h.iushrn(1);var E=b.cmp(h);if(E<0){var g=b;b=h,h=g}else if(E===0||h.cmpn(1)===0)break;b.isub(h)}while(!0);return h.iushln(w)},i.prototype.invm=function(l){return this.egcd(l).a.umod(l)},i.prototype.isEven=function(){return(this.words[0]&1)===0},i.prototype.isOdd=function(){return(this.words[0]&1)===1},i.prototype.andln=function(l){return this.words[0]&l},i.prototype.bincn=function(l){r(typeof l=="number");var b=l%26,h=(l-b)/26,w=1<<b;if(this.length<=h)return this._expand(h+1),this.words[h]|=w,this;for(var E=w,g=h;E!==0&&g<this.length;g++){var I=this.words[g]|0;I+=E,E=I>>>26,I&=67108863,this.words[g]=I}return E!==0&&(this.words[g]=E,this.length++),this},i.prototype.isZero=function(){return this.length===1&&this.words[0]===0},i.prototype.cmpn=function(l){var b=l<0;if(this.negative!==0&&!b)return-1;if(this.negative===0&&b)return 1;this._strip();var h;if(this.length>1)h=1;else{b&&(l=-l),r(l<=67108863,"Number is too big");var w=this.words[0]|0;h=w===l?0:w<l?-1:1}return this.negative!==0?-h|0:h},i.prototype.cmp=function(l){if(this.negative!==0&&l.negative===0)return-1;if(this.negative===0&&l.negative!==0)return 1;var b=this.ucmp(l);return this.negative!==0?-b|0:b},i.prototype.ucmp=function(l){if(this.length>l.length)return 1;if(this.length<l.length)return-1;for(var b=0,h=this.length-1;h>=0;h--){var w=this.words[h]|0,E=l.words[h]|0;if(w!==E){w<E?b=-1:w>E&&(b=1);break}}return b},i.prototype.gtn=function(l){return this.cmpn(l)===1},i.prototype.gt=function(l){return this.cmp(l)===1},i.prototype.gten=function(l){return this.cmpn(l)>=0},i.prototype.gte=function(l){return this.cmp(l)>=0},i.prototype.ltn=function(l){return this.cmpn(l)===-1},i.prototype.lt=function(l){return this.cmp(l)===-1},i.prototype.lten=function(l){return this.cmpn(l)<=0},i.prototype.lte=function(l){return this.cmp(l)<=0},i.prototype.eqn=function(l){return this.cmpn(l)===0},i.prototype.eq=function(l){return this.cmp(l)===0},i.red=function(l){return new y(l)},i.prototype.toRed=function(l){return r(!this.red,"Already a number in reduction context"),r(this.negative===0,"red works only with positives"),l.convertTo(this)._forceRed(l)},i.prototype.fromRed=function(){return r(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},i.prototype._forceRed=function(l){return this.red=l,this},i.prototype.forceRed=function(l){return r(!this.red,"Already a number in reduction context"),this._forceRed(l)},i.prototype.redAdd=function(l){return r(this.red,"redAdd works only with red numbers"),this.red.add(this,l)},i.prototype.redIAdd=function(l){return r(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,l)},i.prototype.redSub=function(l){return r(this.red,"redSub works only with red numbers"),this.red.sub(this,l)},i.prototype.redISub=function(l){return r(this.red,"redISub works only with red numbers"),this.red.isub(this,l)},i.prototype.redShl=function(l){return r(this.red,"redShl works only with red numbers"),this.red.shl(this,l)},i.prototype.redMul=function(l){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,l),this.red.mul(this,l)},i.prototype.redIMul=function(l){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,l),this.red.imul(this,l)},i.prototype.redSqr=function(){return r(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},i.prototype.redISqr=function(){return r(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},i.prototype.redSqrt=function(){return r(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},i.prototype.redInvm=function(){return r(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},i.prototype.redNeg=function(){return r(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},i.prototype.redPow=function(l){return r(this.red&&!l.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,l)};var L={k256:null,p224:null,p192:null,p25519:null};function F(x,l){this.name=x,this.p=new i(l,16),this.n=this.p.bitLength(),this.k=new i(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}F.prototype._tmp=function(){var l=new i(null);return l.words=new Array(Math.ceil(this.n/13)),l},F.prototype.ireduce=function(l){var b=l,h;do this.split(b,this.tmp),b=this.imulK(b),b=b.iadd(this.tmp),h=b.bitLength();while(h>this.n);var w=h<this.n?-1:b.ucmp(this.p);return w===0?(b.words[0]=0,b.length=1):w>0?b.isub(this.p):b.strip!==void 0?b.strip():b._strip(),b},F.prototype.split=function(l,b){l.iushrn(this.n,0,b)},F.prototype.imulK=function(l){return l.imul(this.k)};function $(){F.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}n($,F),$.prototype.split=function(l,b){for(var h=4194303,w=Math.min(l.length,9),E=0;E<w;E++)b.words[E]=l.words[E];if(b.length=w,l.length<=9){l.words[0]=0,l.length=1;return}var g=l.words[9];for(b.words[b.length++]=g&h,E=10;E<l.length;E++){var I=l.words[E]|0;l.words[E-10]=(I&h)<<4|g>>>22,g=I}g>>>=22,l.words[E-10]=g,g===0&&l.length>10?l.length-=10:l.length-=9},$.prototype.imulK=function(l){l.words[l.length]=0,l.words[l.length+1]=0,l.length+=2;for(var b=0,h=0;h<l.length;h++){var w=l.words[h]|0;b+=w*977,l.words[h]=b&67108863,b=w*64+(b/67108864|0)}return l.words[l.length-1]===0&&(l.length--,l.words[l.length-1]===0&&l.length--),l};function H(){F.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}n(H,F);function z(){F.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}n(z,F);function j(){F.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}n(j,F),j.prototype.imulK=function(l){for(var b=0,h=0;h<l.length;h++){var w=(l.words[h]|0)*19+b,E=w&67108863;w>>>=26,l.words[h]=E,b=w}return b!==0&&(l.words[l.length++]=b),l},i._prime=function(l){if(L[l])return L[l];var b;if(l==="k256")b=new $;else if(l==="p224")b=new H;else if(l==="p192")b=new z;else if(l==="p25519")b=new j;else throw new Error("Unknown prime "+l);return L[l]=b,b};function y(x){if(typeof x=="string"){var l=i._prime(x);this.m=l.p,this.prime=l}else r(x.gtn(1),"modulus must be greater than 1"),this.m=x,this.prime=null}y.prototype._verify1=function(l){r(l.negative===0,"red works only with positives"),r(l.red,"red works only with red numbers")},y.prototype._verify2=function(l,b){r((l.negative|b.negative)===0,"red works only with positives"),r(l.red&&l.red===b.red,"red works only with red numbers")},y.prototype.imod=function(l){return this.prime?this.prime.ireduce(l)._forceRed(this):(d(l,l.umod(this.m)._forceRed(this)),l)},y.prototype.neg=function(l){return l.isZero()?l.clone():this.m.sub(l)._forceRed(this)},y.prototype.add=function(l,b){this._verify2(l,b);var h=l.add(b);return h.cmp(this.m)>=0&&h.isub(this.m),h._forceRed(this)},y.prototype.iadd=function(l,b){this._verify2(l,b);var h=l.iadd(b);return h.cmp(this.m)>=0&&h.isub(this.m),h},y.prototype.sub=function(l,b){this._verify2(l,b);var h=l.sub(b);return h.cmpn(0)<0&&h.iadd(this.m),h._forceRed(this)},y.prototype.isub=function(l,b){this._verify2(l,b);var h=l.isub(b);return h.cmpn(0)<0&&h.iadd(this.m),h},y.prototype.shl=function(l,b){return this._verify1(l),this.imod(l.ushln(b))},y.prototype.imul=function(l,b){return this._verify2(l,b),this.imod(l.imul(b))},y.prototype.mul=function(l,b){return this._verify2(l,b),this.imod(l.mul(b))},y.prototype.isqr=function(l){return this.imul(l,l.clone())},y.prototype.sqr=function(l){return this.mul(l,l)},y.prototype.sqrt=function(l){if(l.isZero())return l.clone();var b=this.m.andln(3);if(r(b%2===1),b===3){var h=this.m.add(new i(1)).iushrn(2);return this.pow(l,h)}for(var w=this.m.subn(1),E=0;!w.isZero()&&w.andln(1)===0;)E++,w.iushrn(1);r(!w.isZero());var g=new i(1).toRed(this),I=g.redNeg(),B=this.m.subn(1).iushrn(1),R=this.m.bitLength();for(R=new i(2*R*R).toRed(this);this.pow(R,B).cmp(I)!==0;)R.redIAdd(I);for(var q=this.pow(R,w),V=this.pow(l,w.addn(1).iushrn(1)),W=this.pow(l,w),K=E;W.cmp(g)!==0;){for(var Y=W,J=0;Y.cmp(g)!==0;J++)Y=Y.redSqr();r(J<K);var Z=this.pow(q,new i(1).iushln(K-J-1));V=V.redMul(Z),q=Z.redSqr(),W=W.redMul(q),K=J}return V},y.prototype.invm=function(l){var b=l._invmp(this.m);return b.negative!==0?(b.negative=0,this.imod(b).redNeg()):this.imod(b)},y.prototype.pow=function(l,b){if(b.isZero())return new i(1).toRed(this);if(b.cmpn(1)===0)return l.clone();var h=4,w=new Array(1<<h);w[0]=new i(1).toRed(this),w[1]=l;for(var E=2;E<w.length;E++)w[E]=this.mul(w[E-1],l);var g=w[0],I=0,B=0,R=b.bitLength()%26;for(R===0&&(R=26),E=b.length-1;E>=0;E--){for(var q=b.words[E],V=R-1;V>=0;V--){var W=q>>V&1;if(g!==w[0]&&(g=this.sqr(g)),W===0&&I===0){B=0;continue}I<<=1,I|=W,B++,!(B!==h&&(E!==0||V!==0))&&(g=this.mul(g,w[I]),B=0,I=0)}R=26}return g},y.prototype.convertTo=function(l){var b=l.umod(this.m);return b===l?b.clone():b},y.prototype.convertFrom=function(l){var b=l.clone();return b.red=null,b},i.mont=function(l){return new P(l)};function P(x){y.call(this,x),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new i(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}n(P,y),P.prototype.convertTo=function(l){return this.imod(l.ushln(this.shift))},P.prototype.convertFrom=function(l){var b=this.imod(l.mul(this.rinv));return b.red=null,b},P.prototype.imul=function(l,b){if(l.isZero()||b.isZero())return l.words[0]=0,l.length=1,l;var h=l.imul(b),w=h.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),E=h.isub(w).iushrn(this.shift),g=E;return E.cmp(this.m)>=0?g=E.isub(this.m):E.cmpn(0)<0&&(g=E.iadd(this.m)),g._forceRed(this)},P.prototype.mul=function(l,b){if(l.isZero()||b.isZero())return new i(0)._forceRed(this);var h=l.mul(b),w=h.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),E=h.isub(w).iushrn(this.shift),g=E;return E.cmp(this.m)>=0?g=E.isub(this.m):E.cmpn(0)<0&&(g=E.iadd(this.m)),g._forceRed(this)},P.prototype.invm=function(l){var b=this.imod(l._invmp(this.m).mul(this.r2));return b._forceRed(this)}})(typeof aA>"u"||aA,CF)});var p_=G((rFe,NF)=>{"use strict";p();var O0=h_(),Zye=Ol(),Yye=it().Buffer;function OF(t){var e=t.modulus.byteLength(),r;do r=new O0(Zye(e));while(r.cmp(t.modulus)>=0||!r.umod(t.prime1)||!r.umod(t.prime2));return r}function Jye(t){var e=OF(t),r=e.toRed(O0.mont(t.modulus)).redPow(new O0(t.publicExponent)).fromRed();return{blinder:r,unblinder:e.invm(t.modulus)}}function jF(t,e){var r=Jye(e),n=e.modulus.byteLength(),i=new O0(t).mul(r.blinder).umod(e.modulus),o=i.toRed(O0.mont(e.prime1)),s=i.toRed(O0.mont(e.prime2)),a=e.coefficient,c=e.prime1,d=e.prime2,f=o.redPow(e.exponent1).fromRed(),u=s.redPow(e.exponent2).fromRed(),m=f.isub(u).imul(a).umod(c).imul(d);return u.iadd(m).imul(r.unblinder).umod(e.modulus).toArrayLike(Yye,"be",n)}jF.getr=OF;NF.exports=jF});var qF=G((iFe,Xye)=>{Xye.exports={name:"elliptic",version:"6.6.1",description:"EC cryptography",main:"lib/elliptic.js",files:["lib"],scripts:{lint:"eslint lib test","lint:fix":"npm run lint -- --fix",unit:"istanbul test _mocha --reporter=spec test/index.js",test:"npm run lint && npm run unit",version:"grunt dist && git add dist/"},repository:{type:"git",url:"git@github.com:indutny/elliptic"},keywords:["EC","Elliptic","curve","Cryptography"],author:"Fedor Indutny <fedor@indutny.com>",license:"MIT",bugs:{url:"https://github.com/indutny/elliptic/issues"},homepage:"https://github.com/indutny/elliptic",devDependencies:{brfs:"^2.0.2",coveralls:"^3.1.0",eslint:"^7.6.0",grunt:"^1.2.1","grunt-browserify":"^5.3.0","grunt-cli":"^1.3.2","grunt-contrib-connect":"^3.0.0","grunt-contrib-copy":"^1.0.0","grunt-contrib-uglify":"^5.0.0","grunt-mocha-istanbul":"^5.0.2","grunt-saucelabs":"^9.0.1",istanbul:"^0.4.5",mocha:"^8.0.1"},dependencies:{"bn.js":"^4.11.9",brorand:"^1.1.0","hash.js":"^1.0.0","hmac-drbg":"^1.0.1",inherits:"^2.0.4","minimalistic-assert":"^1.0.1","minimalistic-crypto-utils":"^1.0.1"}}});var cA=G(FF=>{"use strict";p();var m_=FF;function Qye(t,e){if(Array.isArray(t))return t.slice();if(!t)return[];var r=[];if(typeof t!="string"){for(var n=0;n<t.length;n++)r[n]=t[n]|0;return r}if(e==="hex"){t=t.replace(/[^a-z0-9]+/ig,""),t.length%2!==0&&(t="0"+t);for(var n=0;n<t.length;n+=2)r.push(parseInt(t[n]+t[n+1],16))}else for(var n=0;n<t.length;n++){var i=t.charCodeAt(n),o=i>>8,s=i&255;o?r.push(o,s):r.push(s)}return r}m_.toArray=Qye;function LF(t){return t.length===1?"0"+t:t}m_.zero2=LF;function UF(t){for(var e="",r=0;r<t.length;r++)e+=LF(t[r].toString(16));return e}m_.toHex=UF;m_.encode=function(e,r){return r==="hex"?UF(e):e}});var ts=G(zF=>{"use strict";p();var ua=zF,ege=Zn(),tge=es(),y_=cA();ua.assert=tge;ua.toArray=y_.toArray;ua.zero2=y_.zero2;ua.toHex=y_.toHex;ua.encode=y_.encode;function rge(t,e,r){var n=new Array(Math.max(t.bitLength(),r)+1),i;for(i=0;i<n.length;i+=1)n[i]=0;var o=1<<e+1,s=t.clone();for(i=0;i<n.length;i++){var a,c=s.andln(o-1);s.isOdd()?(c>(o>>1)-1?a=(o>>1)-c:a=c,s.isubn(a)):a=0,n[i]=a,s.iushrn(1)}return n}ua.getNAF=rge;function nge(t,e){var r=[[],[]];t=t.clone(),e=e.clone();for(var n=0,i=0,o;t.cmpn(-n)>0||e.cmpn(-i)>0;){var s=t.andln(3)+n&3,a=e.andln(3)+i&3;s===3&&(s=-1),a===3&&(a=-1);var c;s&1?(o=t.andln(7)+n&7,(o===3||o===5)&&a===2?c=-s:c=s):c=0,r[0].push(c);var d;a&1?(o=e.andln(7)+i&7,(o===3||o===5)&&s===2?d=-a:d=a):d=0,r[1].push(d),2*n===c+1&&(n=1-n),2*i===d+1&&(i=1-i),t.iushrn(1),e.iushrn(1)}return r}ua.getJSF=nge;function ige(t,e,r){var n="_"+e;t.prototype[e]=function(){return this[n]!==void 0?this[n]:this[n]=r.call(this)}}ua.cachedProperty=ige;function oge(t){return typeof t=="string"?ua.toArray(t,"hex"):t}ua.parseBytes=oge;function sge(t){return new ege(t,"hex","le")}ua.intFromLE=sge});var qb=G((dFe,$F)=>{"use strict";p();var ah=Zn(),Nb=ts(),g_=Nb.getNAF,age=Nb.getJSF,b_=Nb.assert;function Yf(t,e){this.type=t,this.p=new ah(e.p,16),this.red=e.prime?ah.red(e.prime):ah.mont(this.p),this.zero=new ah(0).toRed(this.red),this.one=new ah(1).toRed(this.red),this.two=new ah(2).toRed(this.red),this.n=e.n&&new ah(e.n,16),this.g=e.g&&this.pointFromJSON(e.g,e.gRed),this._wnafT1=new Array(4),this._wnafT2=new Array(4),this._wnafT3=new Array(4),this._wnafT4=new Array(4),this._bitLength=this.n?this.n.bitLength():0;var r=this.n&&this.p.div(this.n);!r||r.cmpn(100)>0?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}$F.exports=Yf;Yf.prototype.point=function(){throw new Error("Not implemented")};Yf.prototype.validate=function(){throw new Error("Not implemented")};Yf.prototype._fixedNafMul=function(e,r){b_(e.precomputed);var n=e._getDoubles(),i=g_(r,1,this._bitLength),o=(1<<n.step+1)-(n.step%2===0?2:1);o/=3;var s=[],a,c;for(a=0;a<i.length;a+=n.step){c=0;for(var d=a+n.step-1;d>=a;d--)c=(c<<1)+i[d];s.push(c)}for(var f=this.jpoint(null,null,null),u=this.jpoint(null,null,null),m=o;m>0;m--){for(a=0;a<s.length;a++)c=s[a],c===m?u=u.mixedAdd(n.points[a]):c===-m&&(u=u.mixedAdd(n.points[a].neg()));f=f.add(u)}return f.toP()};Yf.prototype._wnafMul=function(e,r){var n=4,i=e._getNAFPoints(n);n=i.wnd;for(var o=i.points,s=g_(r,n,this._bitLength),a=this.jpoint(null,null,null),c=s.length-1;c>=0;c--){for(var d=0;c>=0&&s[c]===0;c--)d++;if(c>=0&&d++,a=a.dblp(d),c<0)break;var f=s[c];b_(f!==0),e.type==="affine"?f>0?a=a.mixedAdd(o[f-1>>1]):a=a.mixedAdd(o[-f-1>>1].neg()):f>0?a=a.add(o[f-1>>1]):a=a.add(o[-f-1>>1].neg())}return e.type==="affine"?a.toP():a};Yf.prototype._wnafMulAdd=function(e,r,n,i,o){var s=this._wnafT1,a=this._wnafT2,c=this._wnafT3,d=0,f,u,m;for(f=0;f<i;f++){m=r[f];var _=m._getNAFPoints(e);s[f]=_.wnd,a[f]=_.points}for(f=i-1;f>=1;f-=2){var v=f-1,A=f;if(s[v]!==1||s[A]!==1){c[v]=g_(n[v],s[v],this._bitLength),c[A]=g_(n[A],s[A],this._bitLength),d=Math.max(c[v].length,d),d=Math.max(c[A].length,d);continue}var T=[r[v],null,null,r[A]];r[v].y.cmp(r[A].y)===0?(T[1]=r[v].add(r[A]),T[2]=r[v].toJ().mixedAdd(r[A].neg())):r[v].y.cmp(r[A].y.redNeg())===0?(T[1]=r[v].toJ().mixedAdd(r[A]),T[2]=r[v].add(r[A].neg())):(T[1]=r[v].toJ().mixedAdd(r[A]),T[2]=r[v].toJ().mixedAdd(r[A].neg()));var M=[-3,-1,-5,-7,0,7,5,1,3],D=age(n[v],n[A]);for(d=Math.max(D[0].length,d),c[v]=new Array(d),c[A]=new Array(d),u=0;u<d;u++){var O=D[0][u]|0,U=D[1][u]|0;c[v][u]=M[(O+1)*3+(U+1)],c[A][u]=0,a[v]=T}}var L=this.jpoint(null,null,null),F=this._wnafT4;for(f=d;f>=0;f--){for(var $=0;f>=0;){var H=!0;for(u=0;u<i;u++)F[u]=c[u][f]|0,F[u]!==0&&(H=!1);if(!H)break;$++,f--}if(f>=0&&$++,L=L.dblp($),f<0)break;for(u=0;u<i;u++){var z=F[u];z!==0&&(z>0?m=a[u][z-1>>1]:z<0&&(m=a[u][-z-1>>1].neg()),m.type==="affine"?L=L.mixedAdd(m):L=L.add(m))}}for(f=0;f<i;f++)a[f]=null;return o?L:L.toP()};function Ls(t,e){this.curve=t,this.type=e,this.precomputed=null}Yf.BasePoint=Ls;Ls.prototype.eq=function(){throw new Error("Not implemented")};Ls.prototype.validate=function(){return this.curve.validate(this)};Yf.prototype.decodePoint=function(e,r){e=Nb.toArray(e,r);var n=this.p.byteLength();if((e[0]===4||e[0]===6||e[0]===7)&&e.length-1===2*n){e[0]===6?b_(e[e.length-1]%2===0):e[0]===7&&b_(e[e.length-1]%2===1);var i=this.point(e.slice(1,1+n),e.slice(1+n,1+2*n));return i}else if((e[0]===2||e[0]===3)&&e.length-1===n)return this.pointFromX(e.slice(1,1+n),e[0]===3);throw new Error("Unknown point format")};Ls.prototype.encodeCompressed=function(e){return this.encode(e,!0)};Ls.prototype._encode=function(e){var r=this.curve.p.byteLength(),n=this.getX().toArray("be",r);return e?[this.getY().isEven()?2:3].concat(n):[4].concat(n,this.getY().toArray("be",r))};Ls.prototype.encode=function(e,r){return Nb.encode(this._encode(r),e)};Ls.prototype.precompute=function(e){if(this.precomputed)return this;var r={doubles:null,naf:null,beta:null};return r.naf=this._getNAFPoints(8),r.doubles=this._getDoubles(4,e),r.beta=this._getBeta(),this.precomputed=r,this};Ls.prototype._hasDoubles=function(e){if(!this.precomputed)return!1;var r=this.precomputed.doubles;return r?r.points.length>=Math.ceil((e.bitLength()+1)/r.step):!1};Ls.prototype._getDoubles=function(e,r){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var n=[this],i=this,o=0;o<r;o+=e){for(var s=0;s<e;s++)i=i.dbl();n.push(i)}return{step:e,points:n}};Ls.prototype._getNAFPoints=function(e){if(this.precomputed&&this.precomputed.naf)return this.precomputed.naf;for(var r=[this],n=(1<<e)-1,i=n===1?null:this.dbl(),o=1;o<n;o++)r[o]=r[o-1].add(i);return{wnd:e,points:r}};Ls.prototype._getBeta=function(){return null};Ls.prototype.dblp=function(e){for(var r=this,n=0;n<e;n++)r=r.dbl();return r}});var HF=G((uFe,GF)=>{"use strict";p();var cge=ts(),un=Zn(),dA=Je(),j0=qb(),dge=cge.assert;function Us(t){j0.call(this,"short",t),this.a=new un(t.a,16).toRed(this.red),this.b=new un(t.b,16).toRed(this.red),this.tinv=this.two.redInvm(),this.zeroA=this.a.fromRed().cmpn(0)===0,this.threeA=this.a.fromRed().sub(this.p).cmpn(-3)===0,this.endo=this._getEndomorphism(t),this._endoWnafT1=new Array(4),this._endoWnafT2=new Array(4)}dA(Us,j0);GF.exports=Us;Us.prototype._getEndomorphism=function(e){if(!(!this.zeroA||!this.g||!this.n||this.p.modn(3)!==1)){var r,n;if(e.beta)r=new un(e.beta,16).toRed(this.red);else{var i=this._getEndoRoots(this.p);r=i[0].cmp(i[1])<0?i[0]:i[1],r=r.toRed(this.red)}if(e.lambda)n=new un(e.lambda,16);else{var o=this._getEndoRoots(this.n);this.g.mul(o[0]).x.cmp(this.g.x.redMul(r))===0?n=o[0]:(n=o[1],dge(this.g.mul(n).x.cmp(this.g.x.redMul(r))===0))}var s;return e.basis?s=e.basis.map(function(a){return{a:new un(a.a,16),b:new un(a.b,16)}}):s=this._getEndoBasis(n),{beta:r,lambda:n,basis:s}}};Us.prototype._getEndoRoots=function(e){var r=e===this.p?this.red:un.mont(e),n=new un(2).toRed(r).redInvm(),i=n.redNeg(),o=new un(3).toRed(r).redNeg().redSqrt().redMul(n),s=i.redAdd(o).fromRed(),a=i.redSub(o).fromRed();return[s,a]};Us.prototype._getEndoBasis=function(e){for(var r=this.n.ushrn(Math.floor(this.n.bitLength()/2)),n=e,i=this.n.clone(),o=new un(1),s=new un(0),a=new un(0),c=new un(1),d,f,u,m,_,v,A,T=0,M,D;n.cmpn(0)!==0;){var O=i.div(n);M=i.sub(O.mul(n)),D=a.sub(O.mul(o));var U=c.sub(O.mul(s));if(!u&&M.cmp(r)<0)d=A.neg(),f=o,u=M.neg(),m=D;else if(u&&++T===2)break;A=M,i=n,n=M,a=o,o=D,c=s,s=U}_=M.neg(),v=D;var L=u.sqr().add(m.sqr()),F=_.sqr().add(v.sqr());return F.cmp(L)>=0&&(_=d,v=f),u.negative&&(u=u.neg(),m=m.neg()),_.negative&&(_=_.neg(),v=v.neg()),[{a:u,b:m},{a:_,b:v}]};Us.prototype._endoSplit=function(e){var r=this.endo.basis,n=r[0],i=r[1],o=i.b.mul(e).divRound(this.n),s=n.b.neg().mul(e).divRound(this.n),a=o.mul(n.a),c=s.mul(i.a),d=o.mul(n.b),f=s.mul(i.b),u=e.sub(a).sub(c),m=d.add(f).neg();return{k1:u,k2:m}};Us.prototype.pointFromX=function(e,r){e=new un(e,16),e.red||(e=e.toRed(this.red));var n=e.redSqr().redMul(e).redIAdd(e.redMul(this.a)).redIAdd(this.b),i=n.redSqrt();if(i.redSqr().redSub(n).cmp(this.zero)!==0)throw new Error("invalid point");var o=i.fromRed().isOdd();return(r&&!o||!r&&o)&&(i=i.redNeg()),this.point(e,i)};Us.prototype.validate=function(e){if(e.inf)return!0;var r=e.x,n=e.y,i=this.a.redMul(r),o=r.redSqr().redMul(r).redIAdd(i).redIAdd(this.b);return n.redSqr().redISub(o).cmpn(0)===0};Us.prototype._endoWnafMulAdd=function(e,r,n){for(var i=this._endoWnafT1,o=this._endoWnafT2,s=0;s<e.length;s++){var a=this._endoSplit(r[s]),c=e[s],d=c._getBeta();a.k1.negative&&(a.k1.ineg(),c=c.neg(!0)),a.k2.negative&&(a.k2.ineg(),d=d.neg(!0)),i[s*2]=c,i[s*2+1]=d,o[s*2]=a.k1,o[s*2+1]=a.k2}for(var f=this._wnafMulAdd(1,i,o,s*2,n),u=0;u<s*2;u++)i[u]=null,o[u]=null;return f};function Yn(t,e,r,n){j0.BasePoint.call(this,t,"affine"),e===null&&r===null?(this.x=null,this.y=null,this.inf=!0):(this.x=new un(e,16),this.y=new un(r,16),n&&(this.x.forceRed(this.curve.red),this.y.forceRed(this.curve.red)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.inf=!1)}dA(Yn,j0.BasePoint);Us.prototype.point=function(e,r,n){return new Yn(this,e,r,n)};Us.prototype.pointFromJSON=function(e,r){return Yn.fromJSON(this,e,r)};Yn.prototype._getBeta=function(){if(this.curve.endo){var e=this.precomputed;if(e&&e.beta)return e.beta;var r=this.curve.point(this.x.redMul(this.curve.endo.beta),this.y);if(e){var n=this.curve,i=function(o){return n.point(o.x.redMul(n.endo.beta),o.y)};e.beta=r,r.precomputed={beta:null,naf:e.naf&&{wnd:e.naf.wnd,points:e.naf.points.map(i)},doubles:e.doubles&&{step:e.doubles.step,points:e.doubles.points.map(i)}}}return r}};Yn.prototype.toJSON=function(){return this.precomputed?[this.x,this.y,this.precomputed&&{doubles:this.precomputed.doubles&&{step:this.precomputed.doubles.step,points:this.precomputed.doubles.points.slice(1)},naf:this.precomputed.naf&&{wnd:this.precomputed.naf.wnd,points:this.precomputed.naf.points.slice(1)}}]:[this.x,this.y]};Yn.fromJSON=function(e,r,n){typeof r=="string"&&(r=JSON.parse(r));var i=e.point(r[0],r[1],n);if(!r[2])return i;function o(a){return e.point(a[0],a[1],n)}var s=r[2];return i.precomputed={beta:null,doubles:s.doubles&&{step:s.doubles.step,points:[i].concat(s.doubles.points.map(o))},naf:s.naf&&{wnd:s.naf.wnd,points:[i].concat(s.naf.points.map(o))}},i};Yn.prototype.inspect=function(){return this.isInfinity()?"<EC Point Infinity>":"<EC Point x: "+this.x.fromRed().toString(16,2)+" y: "+this.y.fromRed().toString(16,2)+">"};Yn.prototype.isInfinity=function(){return this.inf};Yn.prototype.add=function(e){if(this.inf)return e;if(e.inf)return this;if(this.eq(e))return this.dbl();if(this.neg().eq(e))return this.curve.point(null,null);if(this.x.cmp(e.x)===0)return this.curve.point(null,null);var r=this.y.redSub(e.y);r.cmpn(0)!==0&&(r=r.redMul(this.x.redSub(e.x).redInvm()));var n=r.redSqr().redISub(this.x).redISub(e.x),i=r.redMul(this.x.redSub(n)).redISub(this.y);return this.curve.point(n,i)};Yn.prototype.dbl=function(){if(this.inf)return this;var e=this.y.redAdd(this.y);if(e.cmpn(0)===0)return this.curve.point(null,null);var r=this.curve.a,n=this.x.redSqr(),i=e.redInvm(),o=n.redAdd(n).redIAdd(n).redIAdd(r).redMul(i),s=o.redSqr().redISub(this.x.redAdd(this.x)),a=o.redMul(this.x.redSub(s)).redISub(this.y);return this.curve.point(s,a)};Yn.prototype.getX=function(){return this.x.fromRed()};Yn.prototype.getY=function(){return this.y.fromRed()};Yn.prototype.mul=function(e){return e=new un(e,16),this.isInfinity()?this:this._hasDoubles(e)?this.curve._fixedNafMul(this,e):this.curve.endo?this.curve._endoWnafMulAdd([this],[e]):this.curve._wnafMul(this,e)};Yn.prototype.mulAdd=function(e,r,n){var i=[this,r],o=[e,n];return this.curve.endo?this.curve._endoWnafMulAdd(i,o):this.curve._wnafMulAdd(1,i,o,2)};Yn.prototype.jmulAdd=function(e,r,n){var i=[this,r],o=[e,n];return this.curve.endo?this.curve._endoWnafMulAdd(i,o,!0):this.curve._wnafMulAdd(1,i,o,2,!0)};Yn.prototype.eq=function(e){return this===e||this.inf===e.inf&&(this.inf||this.x.cmp(e.x)===0&&this.y.cmp(e.y)===0)};Yn.prototype.neg=function(e){if(this.inf)return this;var r=this.curve.point(this.x,this.y.redNeg());if(e&&this.precomputed){var n=this.precomputed,i=function(o){return o.neg()};r.precomputed={naf:n.naf&&{wnd:n.naf.wnd,points:n.naf.points.map(i)},doubles:n.doubles&&{step:n.doubles.step,points:n.doubles.points.map(i)}}}return r};Yn.prototype.toJ=function(){if(this.inf)return this.curve.jpoint(null,null,null);var e=this.curve.jpoint(this.x,this.y,this.curve.one);return e};function hi(t,e,r,n){j0.BasePoint.call(this,t,"jacobian"),e===null&&r===null&&n===null?(this.x=this.curve.one,this.y=this.curve.one,this.z=new un(0)):(this.x=new un(e,16),this.y=new un(r,16),this.z=new un(n,16)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.zOne=this.z===this.curve.one}dA(hi,j0.BasePoint);Us.prototype.jpoint=function(e,r,n){return new hi(this,e,r,n)};hi.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var e=this.z.redInvm(),r=e.redSqr(),n=this.x.redMul(r),i=this.y.redMul(r).redMul(e);return this.curve.point(n,i)};hi.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)};hi.prototype.add=function(e){if(this.isInfinity())return e;if(e.isInfinity())return this;var r=e.z.redSqr(),n=this.z.redSqr(),i=this.x.redMul(r),o=e.x.redMul(n),s=this.y.redMul(r.redMul(e.z)),a=e.y.redMul(n.redMul(this.z)),c=i.redSub(o),d=s.redSub(a);if(c.cmpn(0)===0)return d.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var f=c.redSqr(),u=f.redMul(c),m=i.redMul(f),_=d.redSqr().redIAdd(u).redISub(m).redISub(m),v=d.redMul(m.redISub(_)).redISub(s.redMul(u)),A=this.z.redMul(e.z).redMul(c);return this.curve.jpoint(_,v,A)};hi.prototype.mixedAdd=function(e){if(this.isInfinity())return e.toJ();if(e.isInfinity())return this;var r=this.z.redSqr(),n=this.x,i=e.x.redMul(r),o=this.y,s=e.y.redMul(r).redMul(this.z),a=n.redSub(i),c=o.redSub(s);if(a.cmpn(0)===0)return c.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var d=a.redSqr(),f=d.redMul(a),u=n.redMul(d),m=c.redSqr().redIAdd(f).redISub(u).redISub(u),_=c.redMul(u.redISub(m)).redISub(o.redMul(f)),v=this.z.redMul(a);return this.curve.jpoint(m,_,v)};hi.prototype.dblp=function(e){if(e===0)return this;if(this.isInfinity())return this;if(!e)return this.dbl();var r;if(this.curve.zeroA||this.curve.threeA){var n=this;for(r=0;r<e;r++)n=n.dbl();return n}var i=this.curve.a,o=this.curve.tinv,s=this.x,a=this.y,c=this.z,d=c.redSqr().redSqr(),f=a.redAdd(a);for(r=0;r<e;r++){var u=s.redSqr(),m=f.redSqr(),_=m.redSqr(),v=u.redAdd(u).redIAdd(u).redIAdd(i.redMul(d)),A=s.redMul(m),T=v.redSqr().redISub(A.redAdd(A)),M=A.redISub(T),D=v.redMul(M);D=D.redIAdd(D).redISub(_);var O=f.redMul(c);r+1<e&&(d=d.redMul(_)),s=T,c=O,f=D}return this.curve.jpoint(s,f.redMul(o),c)};hi.prototype.dbl=function(){return this.isInfinity()?this:this.curve.zeroA?this._zeroDbl():this.curve.threeA?this._threeDbl():this._dbl()};hi.prototype._zeroDbl=function(){var e,r,n;if(this.zOne){var i=this.x.redSqr(),o=this.y.redSqr(),s=o.redSqr(),a=this.x.redAdd(o).redSqr().redISub(i).redISub(s);a=a.redIAdd(a);var c=i.redAdd(i).redIAdd(i),d=c.redSqr().redISub(a).redISub(a),f=s.redIAdd(s);f=f.redIAdd(f),f=f.redIAdd(f),e=d,r=c.redMul(a.redISub(d)).redISub(f),n=this.y.redAdd(this.y)}else{var u=this.x.redSqr(),m=this.y.redSqr(),_=m.redSqr(),v=this.x.redAdd(m).redSqr().redISub(u).redISub(_);v=v.redIAdd(v);var A=u.redAdd(u).redIAdd(u),T=A.redSqr(),M=_.redIAdd(_);M=M.redIAdd(M),M=M.redIAdd(M),e=T.redISub(v).redISub(v),r=A.redMul(v.redISub(e)).redISub(M),n=this.y.redMul(this.z),n=n.redIAdd(n)}return this.curve.jpoint(e,r,n)};hi.prototype._threeDbl=function(){var e,r,n;if(this.zOne){var i=this.x.redSqr(),o=this.y.redSqr(),s=o.redSqr(),a=this.x.redAdd(o).redSqr().redISub(i).redISub(s);a=a.redIAdd(a);var c=i.redAdd(i).redIAdd(i).redIAdd(this.curve.a),d=c.redSqr().redISub(a).redISub(a);e=d;var f=s.redIAdd(s);f=f.redIAdd(f),f=f.redIAdd(f),r=c.redMul(a.redISub(d)).redISub(f),n=this.y.redAdd(this.y)}else{var u=this.z.redSqr(),m=this.y.redSqr(),_=this.x.redMul(m),v=this.x.redSub(u).redMul(this.x.redAdd(u));v=v.redAdd(v).redIAdd(v);var A=_.redIAdd(_);A=A.redIAdd(A);var T=A.redAdd(A);e=v.redSqr().redISub(T),n=this.y.redAdd(this.z).redSqr().redISub(m).redISub(u);var M=m.redSqr();M=M.redIAdd(M),M=M.redIAdd(M),M=M.redIAdd(M),r=v.redMul(A.redISub(e)).redISub(M)}return this.curve.jpoint(e,r,n)};hi.prototype._dbl=function(){var e=this.curve.a,r=this.x,n=this.y,i=this.z,o=i.redSqr().redSqr(),s=r.redSqr(),a=n.redSqr(),c=s.redAdd(s).redIAdd(s).redIAdd(e.redMul(o)),d=r.redAdd(r);d=d.redIAdd(d);var f=d.redMul(a),u=c.redSqr().redISub(f.redAdd(f)),m=f.redISub(u),_=a.redSqr();_=_.redIAdd(_),_=_.redIAdd(_),_=_.redIAdd(_);var v=c.redMul(m).redISub(_),A=n.redAdd(n).redMul(i);return this.curve.jpoint(u,v,A)};hi.prototype.trpl=function(){if(!this.curve.zeroA)return this.dbl().add(this);var e=this.x.redSqr(),r=this.y.redSqr(),n=this.z.redSqr(),i=r.redSqr(),o=e.redAdd(e).redIAdd(e),s=o.redSqr(),a=this.x.redAdd(r).redSqr().redISub(e).redISub(i);a=a.redIAdd(a),a=a.redAdd(a).redIAdd(a),a=a.redISub(s);var c=a.redSqr(),d=i.redIAdd(i);d=d.redIAdd(d),d=d.redIAdd(d),d=d.redIAdd(d);var f=o.redIAdd(a).redSqr().redISub(s).redISub(c).redISub(d),u=r.redMul(f);u=u.redIAdd(u),u=u.redIAdd(u);var m=this.x.redMul(c).redISub(u);m=m.redIAdd(m),m=m.redIAdd(m);var _=this.y.redMul(f.redMul(d.redISub(f)).redISub(a.redMul(c)));_=_.redIAdd(_),_=_.redIAdd(_),_=_.redIAdd(_);var v=this.z.redAdd(a).redSqr().redISub(n).redISub(c);return this.curve.jpoint(m,_,v)};hi.prototype.mul=function(e,r){return e=new un(e,r),this.curve._wnafMul(this,e)};hi.prototype.eq=function(e){if(e.type==="affine")return this.eq(e.toJ());if(this===e)return!0;var r=this.z.redSqr(),n=e.z.redSqr();if(this.x.redMul(n).redISub(e.x.redMul(r)).cmpn(0)!==0)return!1;var i=r.redMul(this.z),o=n.redMul(e.z);return this.y.redMul(o).redISub(e.y.redMul(i)).cmpn(0)===0};hi.prototype.eqXToP=function(e){var r=this.z.redSqr(),n=e.toRed(this.curve.red).redMul(r);if(this.x.cmp(n)===0)return!0;for(var i=e.clone(),o=this.curve.redN.redMul(r);;){if(i.iadd(this.curve.n),i.cmp(this.curve.p)>=0)return!1;if(n.redIAdd(o),this.x.cmp(n)===0)return!0}};hi.prototype.inspect=function(){return this.isInfinity()?"<EC JPoint Infinity>":"<EC JPoint x: "+this.x.toString(16,2)+" y: "+this.y.toString(16,2)+" z: "+this.z.toString(16,2)+">"};hi.prototype.isInfinity=function(){return this.z.cmpn(0)===0}});var KF=G((hFe,VF)=>{"use strict";p();var N0=Zn(),WF=Je(),v_=qb(),fge=ts();function q0(t){v_.call(this,"mont",t),this.a=new N0(t.a,16).toRed(this.red),this.b=new N0(t.b,16).toRed(this.red),this.i4=new N0(4).toRed(this.red).redInvm(),this.two=new N0(2).toRed(this.red),this.a24=this.i4.redMul(this.a.redAdd(this.two))}WF(q0,v_);VF.exports=q0;q0.prototype.validate=function(e){var r=e.normalize().x,n=r.redSqr(),i=n.redMul(r).redAdd(n.redMul(this.a)).redAdd(r),o=i.redSqrt();return o.redSqr().cmp(i)===0};function Jn(t,e,r){v_.BasePoint.call(this,t,"projective"),e===null&&r===null?(this.x=this.curve.one,this.z=this.curve.zero):(this.x=new N0(e,16),this.z=new N0(r,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)))}WF(Jn,v_.BasePoint);q0.prototype.decodePoint=function(e,r){return this.point(fge.toArray(e,r),1)};q0.prototype.point=function(e,r){return new Jn(this,e,r)};q0.prototype.pointFromJSON=function(e){return Jn.fromJSON(this,e)};Jn.prototype.precompute=function(){};Jn.prototype._encode=function(){return this.getX().toArray("be",this.curve.p.byteLength())};Jn.fromJSON=function(e,r){return new Jn(e,r[0],r[1]||e.one)};Jn.prototype.inspect=function(){return this.isInfinity()?"<EC Point Infinity>":"<EC Point x: "+this.x.fromRed().toString(16,2)+" z: "+this.z.fromRed().toString(16,2)+">"};Jn.prototype.isInfinity=function(){return this.z.cmpn(0)===0};Jn.prototype.dbl=function(){var e=this.x.redAdd(this.z),r=e.redSqr(),n=this.x.redSub(this.z),i=n.redSqr(),o=r.redSub(i),s=r.redMul(i),a=o.redMul(i.redAdd(this.curve.a24.redMul(o)));return this.curve.point(s,a)};Jn.prototype.add=function(){throw new Error("Not supported on Montgomery curve")};Jn.prototype.diffAdd=function(e,r){var n=this.x.redAdd(this.z),i=this.x.redSub(this.z),o=e.x.redAdd(e.z),s=e.x.redSub(e.z),a=s.redMul(n),c=o.redMul(i),d=r.z.redMul(a.redAdd(c).redSqr()),f=r.x.redMul(a.redISub(c).redSqr());return this.curve.point(d,f)};Jn.prototype.mul=function(e){for(var r=e.clone(),n=this,i=this.curve.point(null,null),o=this,s=[];r.cmpn(0)!==0;r.iushrn(1))s.push(r.andln(1));for(var a=s.length-1;a>=0;a--)s[a]===0?(n=n.diffAdd(i,o),i=i.dbl()):(i=n.diffAdd(i,o),n=n.dbl());return i};Jn.prototype.mulAdd=function(){throw new Error("Not supported on Montgomery curve")};Jn.prototype.jumlAdd=function(){throw new Error("Not supported on Montgomery curve")};Jn.prototype.eq=function(e){return this.getX().cmp(e.getX())===0};Jn.prototype.normalize=function(){return this.x=this.x.redMul(this.z.redInvm()),this.z=this.curve.one,this};Jn.prototype.getX=function(){return this.normalize(),this.x.fromRed()}});var JF=G((mFe,YF)=>{"use strict";p();var uge=ts(),Rd=Zn(),ZF=Je(),w_=qb(),lge=uge.assert;function ac(t){this.twisted=(t.a|0)!==1,this.mOneA=this.twisted&&(t.a|0)===-1,this.extended=this.mOneA,w_.call(this,"edwards",t),this.a=new Rd(t.a,16).umod(this.red.m),this.a=this.a.toRed(this.red),this.c=new Rd(t.c,16).toRed(this.red),this.c2=this.c.redSqr(),this.d=new Rd(t.d,16).toRed(this.red),this.dd=this.d.redAdd(this.d),lge(!this.twisted||this.c.fromRed().cmpn(1)===0),this.oneC=(t.c|0)===1}ZF(ac,w_);YF.exports=ac;ac.prototype._mulA=function(e){return this.mOneA?e.redNeg():this.a.redMul(e)};ac.prototype._mulC=function(e){return this.oneC?e:this.c.redMul(e)};ac.prototype.jpoint=function(e,r,n,i){return this.point(e,r,n,i)};ac.prototype.pointFromX=function(e,r){e=new Rd(e,16),e.red||(e=e.toRed(this.red));var n=e.redSqr(),i=this.c2.redSub(this.a.redMul(n)),o=this.one.redSub(this.c2.redMul(this.d).redMul(n)),s=i.redMul(o.redInvm()),a=s.redSqrt();if(a.redSqr().redSub(s).cmp(this.zero)!==0)throw new Error("invalid point");var c=a.fromRed().isOdd();return(r&&!c||!r&&c)&&(a=a.redNeg()),this.point(e,a)};ac.prototype.pointFromY=function(e,r){e=new Rd(e,16),e.red||(e=e.toRed(this.red));var n=e.redSqr(),i=n.redSub(this.c2),o=n.redMul(this.d).redMul(this.c2).redSub(this.a),s=i.redMul(o.redInvm());if(s.cmp(this.zero)===0){if(r)throw new Error("invalid point");return this.point(this.zero,e)}var a=s.redSqrt();if(a.redSqr().redSub(s).cmp(this.zero)!==0)throw new Error("invalid point");return a.fromRed().isOdd()!==r&&(a=a.redNeg()),this.point(a,e)};ac.prototype.validate=function(e){if(e.isInfinity())return!0;e.normalize();var r=e.x.redSqr(),n=e.y.redSqr(),i=r.redMul(this.a).redAdd(n),o=this.c2.redMul(this.one.redAdd(this.d.redMul(r).redMul(n)));return i.cmp(o)===0};function Mr(t,e,r,n,i){w_.BasePoint.call(this,t,"projective"),e===null&&r===null&&n===null?(this.x=this.curve.zero,this.y=this.curve.one,this.z=this.curve.one,this.t=this.curve.zero,this.zOne=!0):(this.x=new Rd(e,16),this.y=new Rd(r,16),this.z=n?new Rd(n,16):this.curve.one,this.t=i&&new Rd(i,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.t&&!this.t.red&&(this.t=this.t.toRed(this.curve.red)),this.zOne=this.z===this.curve.one,this.curve.extended&&!this.t&&(this.t=this.x.redMul(this.y),this.zOne||(this.t=this.t.redMul(this.z.redInvm()))))}ZF(Mr,w_.BasePoint);ac.prototype.pointFromJSON=function(e){return Mr.fromJSON(this,e)};ac.prototype.point=function(e,r,n,i){return new Mr(this,e,r,n,i)};Mr.fromJSON=function(e,r){return new Mr(e,r[0],r[1],r[2])};Mr.prototype.inspect=function(){return this.isInfinity()?"<EC Point Infinity>":"<EC Point x: "+this.x.fromRed().toString(16,2)+" y: "+this.y.fromRed().toString(16,2)+" z: "+this.z.fromRed().toString(16,2)+">"};Mr.prototype.isInfinity=function(){return this.x.cmpn(0)===0&&(this.y.cmp(this.z)===0||this.zOne&&this.y.cmp(this.curve.c)===0)};Mr.prototype._extDbl=function(){var e=this.x.redSqr(),r=this.y.redSqr(),n=this.z.redSqr();n=n.redIAdd(n);var i=this.curve._mulA(e),o=this.x.redAdd(this.y).redSqr().redISub(e).redISub(r),s=i.redAdd(r),a=s.redSub(n),c=i.redSub(r),d=o.redMul(a),f=s.redMul(c),u=o.redMul(c),m=a.redMul(s);return this.curve.point(d,f,m,u)};Mr.prototype._projDbl=function(){var e=this.x.redAdd(this.y).redSqr(),r=this.x.redSqr(),n=this.y.redSqr(),i,o,s,a,c,d;if(this.curve.twisted){a=this.curve._mulA(r);var f=a.redAdd(n);this.zOne?(i=e.redSub(r).redSub(n).redMul(f.redSub(this.curve.two)),o=f.redMul(a.redSub(n)),s=f.redSqr().redSub(f).redSub(f)):(c=this.z.redSqr(),d=f.redSub(c).redISub(c),i=e.redSub(r).redISub(n).redMul(d),o=f.redMul(a.redSub(n)),s=f.redMul(d))}else a=r.redAdd(n),c=this.curve._mulC(this.z).redSqr(),d=a.redSub(c).redSub(c),i=this.curve._mulC(e.redISub(a)).redMul(d),o=this.curve._mulC(a).redMul(r.redISub(n)),s=a.redMul(d);return this.curve.point(i,o,s)};Mr.prototype.dbl=function(){return this.isInfinity()?this:this.curve.extended?this._extDbl():this._projDbl()};Mr.prototype._extAdd=function(e){var r=this.y.redSub(this.x).redMul(e.y.redSub(e.x)),n=this.y.redAdd(this.x).redMul(e.y.redAdd(e.x)),i=this.t.redMul(this.curve.dd).redMul(e.t),o=this.z.redMul(e.z.redAdd(e.z)),s=n.redSub(r),a=o.redSub(i),c=o.redAdd(i),d=n.redAdd(r),f=s.redMul(a),u=c.redMul(d),m=s.redMul(d),_=a.redMul(c);return this.curve.point(f,u,_,m)};Mr.prototype._projAdd=function(e){var r=this.z.redMul(e.z),n=r.redSqr(),i=this.x.redMul(e.x),o=this.y.redMul(e.y),s=this.curve.d.redMul(i).redMul(o),a=n.redSub(s),c=n.redAdd(s),d=this.x.redAdd(this.y).redMul(e.x.redAdd(e.y)).redISub(i).redISub(o),f=r.redMul(a).redMul(d),u,m;return this.curve.twisted?(u=r.redMul(c).redMul(o.redSub(this.curve._mulA(i))),m=a.redMul(c)):(u=r.redMul(c).redMul(o.redSub(i)),m=this.curve._mulC(a).redMul(c)),this.curve.point(f,u,m)};Mr.prototype.add=function(e){return this.isInfinity()?e:e.isInfinity()?this:this.curve.extended?this._extAdd(e):this._projAdd(e)};Mr.prototype.mul=function(e){return this._hasDoubles(e)?this.curve._fixedNafMul(this,e):this.curve._wnafMul(this,e)};Mr.prototype.mulAdd=function(e,r,n){return this.curve._wnafMulAdd(1,[this,r],[e,n],2,!1)};Mr.prototype.jmulAdd=function(e,r,n){return this.curve._wnafMulAdd(1,[this,r],[e,n],2,!0)};Mr.prototype.normalize=function(){if(this.zOne)return this;var e=this.z.redInvm();return this.x=this.x.redMul(e),this.y=this.y.redMul(e),this.t&&(this.t=this.t.redMul(e)),this.z=this.curve.one,this.zOne=!0,this};Mr.prototype.neg=function(){return this.curve.point(this.x.redNeg(),this.y,this.z,this.t&&this.t.redNeg())};Mr.prototype.getX=function(){return this.normalize(),this.x.fromRed()};Mr.prototype.getY=function(){return this.normalize(),this.y.fromRed()};Mr.prototype.eq=function(e){return this===e||this.getX().cmp(e.getX())===0&&this.getY().cmp(e.getY())===0};Mr.prototype.eqXToP=function(e){var r=e.toRed(this.curve.red).redMul(this.z);if(this.x.cmp(r)===0)return!0;for(var n=e.clone(),i=this.curve.redN.redMul(this.z);;){if(n.iadd(this.curve.n),n.cmp(this.curve.p)>=0)return!1;if(r.redIAdd(i),this.x.cmp(r)===0)return!0}};Mr.prototype.toP=Mr.prototype.normalize;Mr.prototype.mixedAdd=Mr.prototype.add});var fA=G(XF=>{"use strict";p();var __=XF;__.base=qb();__.short=HF();__.mont=KF();__.edwards=JF()});var la=G(Tr=>{"use strict";p();var hge=es(),pge=Je();Tr.inherits=pge;function mge(t,e){return(t.charCodeAt(e)&64512)!==55296||e<0||e+1>=t.length?!1:(t.charCodeAt(e+1)&64512)===56320}function yge(t,e){if(Array.isArray(t))return t.slice();if(!t)return[];var r=[];if(typeof t=="string")if(e){if(e==="hex")for(t=t.replace(/[^a-z0-9]+/ig,""),t.length%2!==0&&(t="0"+t),i=0;i<t.length;i+=2)r.push(parseInt(t[i]+t[i+1],16))}else for(var n=0,i=0;i<t.length;i++){var o=t.charCodeAt(i);o<128?r[n++]=o:o<2048?(r[n++]=o>>6|192,r[n++]=o&63|128):mge(t,i)?(o=65536+((o&1023)<<10)+(t.charCodeAt(++i)&1023),r[n++]=o>>18|240,r[n++]=o>>12&63|128,r[n++]=o>>6&63|128,r[n++]=o&63|128):(r[n++]=o>>12|224,r[n++]=o>>6&63|128,r[n++]=o&63|128)}else for(i=0;i<t.length;i++)r[i]=t[i]|0;return r}Tr.toArray=yge;function gge(t){for(var e="",r=0;r<t.length;r++)e+=ez(t[r].toString(16));return e}Tr.toHex=gge;function QF(t){var e=t>>>24|t>>>8&65280|t<<8&16711680|(t&255)<<24;return e>>>0}Tr.htonl=QF;function bge(t,e){for(var r="",n=0;n<t.length;n++){var i=t[n];e==="little"&&(i=QF(i)),r+=tz(i.toString(16))}return r}Tr.toHex32=bge;function ez(t){return t.length===1?"0"+t:t}Tr.zero2=ez;function tz(t){return t.length===7?"0"+t:t.length===6?"00"+t:t.length===5?"000"+t:t.length===4?"0000"+t:t.length===3?"00000"+t:t.length===2?"000000"+t:t.length===1?"0000000"+t:t}Tr.zero8=tz;function vge(t,e,r,n){var i=r-e;hge(i%4===0);for(var o=new Array(i/4),s=0,a=e;s<o.length;s++,a+=4){var c;n==="big"?c=t[a]<<24|t[a+1]<<16|t[a+2]<<8|t[a+3]:c=t[a+3]<<24|t[a+2]<<16|t[a+1]<<8|t[a],o[s]=c>>>0}return o}Tr.join32=vge;function wge(t,e){for(var r=new Array(t.length*4),n=0,i=0;n<t.length;n++,i+=4){var o=t[n];e==="big"?(r[i]=o>>>24,r[i+1]=o>>>16&255,r[i+2]=o>>>8&255,r[i+3]=o&255):(r[i+3]=o>>>24,r[i+2]=o>>>16&255,r[i+1]=o>>>8&255,r[i]=o&255)}return r}Tr.split32=wge;function _ge(t,e){return t>>>e|t<<32-e}Tr.rotr32=_ge;function xge(t,e){return t<<e|t>>>32-e}Tr.rotl32=xge;function Ege(t,e){return t+e>>>0}Tr.sum32=Ege;function Sge(t,e,r){return t+e+r>>>0}Tr.sum32_3=Sge;function Age(t,e,r,n){return t+e+r+n>>>0}Tr.sum32_4=Age;function Tge(t,e,r,n,i){return t+e+r+n+i>>>0}Tr.sum32_5=Tge;function Pge(t,e,r,n){var i=t[e],o=t[e+1],s=n+o>>>0,a=(s<n?1:0)+r+i;t[e]=a>>>0,t[e+1]=s}Tr.sum64=Pge;function Ige(t,e,r,n){var i=e+n>>>0,o=(i<e?1:0)+t+r;return o>>>0}Tr.sum64_hi=Ige;function Rge(t,e,r,n){var i=e+n;return i>>>0}Tr.sum64_lo=Rge;function Mge(t,e,r,n,i,o,s,a){var c=0,d=e;d=d+n>>>0,c+=d<e?1:0,d=d+o>>>0,c+=d<o?1:0,d=d+a>>>0,c+=d<a?1:0;var f=t+r+i+s+c;return f>>>0}Tr.sum64_4_hi=Mge;function kge(t,e,r,n,i,o,s,a){var c=e+n+o+a;return c>>>0}Tr.sum64_4_lo=kge;function Bge(t,e,r,n,i,o,s,a,c,d){var f=0,u=e;u=u+n>>>0,f+=u<e?1:0,u=u+o>>>0,f+=u<o?1:0,u=u+a>>>0,f+=u<a?1:0,u=u+d>>>0,f+=u<d?1:0;var m=t+r+i+s+c+f;return m>>>0}Tr.sum64_5_hi=Bge;function Dge(t,e,r,n,i,o,s,a,c,d){var f=e+n+o+a+d;return f>>>0}Tr.sum64_5_lo=Dge;function Cge(t,e,r){var n=e<<32-r|t>>>r;return n>>>0}Tr.rotr64_hi=Cge;function Oge(t,e,r){var n=t<<32-r|e>>>r;return n>>>0}Tr.rotr64_lo=Oge;function jge(t,e,r){return t>>>r}Tr.shr64_hi=jge;function Nge(t,e,r){var n=t<<32-r|e>>>r;return n>>>0}Tr.shr64_lo=Nge});var L0=G(nz=>{"use strict";p();var rz=la(),qge=es();function x_(){this.pending=null,this.pendingTotal=0,this.blockSize=this.constructor.blockSize,this.outSize=this.constructor.outSize,this.hmacStrength=this.constructor.hmacStrength,this.padLength=this.constructor.padLength/8,this.endian="big",this._delta8=this.blockSize/8,this._delta32=this.blockSize/32}nz.BlockHash=x_;x_.prototype.update=function(e,r){if(e=rz.toArray(e,r),this.pending?this.pending=this.pending.concat(e):this.pending=e,this.pendingTotal+=e.length,this.pending.length>=this._delta8){e=this.pending;var n=e.length%this._delta8;this.pending=e.slice(e.length-n,e.length),this.pending.length===0&&(this.pending=null),e=rz.join32(e,0,e.length-n,this.endian);for(var i=0;i<e.length;i+=this._delta32)this._update(e,i,i+this._delta32)}return this};x_.prototype.digest=function(e){return this.update(this._pad()),qge(this.pending===null),this._digest(e)};x_.prototype._pad=function(){var e=this.pendingTotal,r=this._delta8,n=r-(e+this.padLength)%r,i=new Array(n+this.padLength);i[0]=128;for(var o=1;o<n;o++)i[o]=0;if(e<<=3,this.endian==="big"){for(var s=8;s<this.padLength;s++)i[o++]=0;i[o++]=0,i[o++]=0,i[o++]=0,i[o++]=0,i[o++]=e>>>24&255,i[o++]=e>>>16&255,i[o++]=e>>>8&255,i[o++]=e&255}else for(i[o++]=e&255,i[o++]=e>>>8&255,i[o++]=e>>>16&255,i[o++]=e>>>24&255,i[o++]=0,i[o++]=0,i[o++]=0,i[o++]=0,s=8;s<this.padLength;s++)i[o++]=0;return i}});var uA=G(Md=>{"use strict";p();var Lge=la(),cc=Lge.rotr32;function Uge(t,e,r,n){if(t===0)return iz(e,r,n);if(t===1||t===3)return sz(e,r,n);if(t===2)return oz(e,r,n)}Md.ft_1=Uge;function iz(t,e,r){return t&e^~t&r}Md.ch32=iz;function oz(t,e,r){return t&e^t&r^e&r}Md.maj32=oz;function sz(t,e,r){return t^e^r}Md.p32=sz;function Fge(t){return cc(t,2)^cc(t,13)^cc(t,22)}Md.s0_256=Fge;function zge(t){return cc(t,6)^cc(t,11)^cc(t,25)}Md.s1_256=zge;function $ge(t){return cc(t,7)^cc(t,18)^t>>>3}Md.g0_256=$ge;function Gge(t){return cc(t,17)^cc(t,19)^t>>>10}Md.g1_256=Gge});var dz=G((AFe,cz)=>{"use strict";p();var U0=la(),Hge=L0(),Wge=uA(),lA=U0.rotl32,Lb=U0.sum32,Vge=U0.sum32_5,Kge=Wge.ft_1,az=Hge.BlockHash,Zge=[1518500249,1859775393,2400959708,3395469782];function dc(){if(!(this instanceof dc))return new dc;az.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.W=new Array(80)}U0.inherits(dc,az);cz.exports=dc;dc.blockSize=512;dc.outSize=160;dc.hmacStrength=80;dc.padLength=64;dc.prototype._update=function(e,r){for(var n=this.W,i=0;i<16;i++)n[i]=e[r+i];for(;i<n.length;i++)n[i]=lA(n[i-3]^n[i-8]^n[i-14]^n[i-16],1);var o=this.h[0],s=this.h[1],a=this.h[2],c=this.h[3],d=this.h[4];for(i=0;i<n.length;i++){var f=~~(i/20),u=Vge(lA(o,5),Kge(f,s,a,c),d,n[i],Zge[f]);d=c,c=a,a=lA(s,30),s=o,o=u}this.h[0]=Lb(this.h[0],o),this.h[1]=Lb(this.h[1],s),this.h[2]=Lb(this.h[2],a),this.h[3]=Lb(this.h[3],c),this.h[4]=Lb(this.h[4],d)};dc.prototype._digest=function(e){return e==="hex"?U0.toHex32(this.h,"big"):U0.split32(this.h,"big")}});var hA=G((PFe,uz)=>{"use strict";p();var F0=la(),Yge=L0(),z0=uA(),Jge=es(),ha=F0.sum32,Xge=F0.sum32_4,Qge=F0.sum32_5,ebe=z0.ch32,tbe=z0.maj32,rbe=z0.s0_256,nbe=z0.s1_256,ibe=z0.g0_256,obe=z0.g1_256,fz=Yge.BlockHash,sbe=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298];function fc(){if(!(this instanceof fc))return new fc;fz.call(this),this.h=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225],this.k=sbe,this.W=new Array(64)}F0.inherits(fc,fz);uz.exports=fc;fc.blockSize=512;fc.outSize=256;fc.hmacStrength=192;fc.padLength=64;fc.prototype._update=function(e,r){for(var n=this.W,i=0;i<16;i++)n[i]=e[r+i];for(;i<n.length;i++)n[i]=Xge(obe(n[i-2]),n[i-7],ibe(n[i-15]),n[i-16]);var o=this.h[0],s=this.h[1],a=this.h[2],c=this.h[3],d=this.h[4],f=this.h[5],u=this.h[6],m=this.h[7];for(Jge(this.k.length===n.length),i=0;i<n.length;i++){var _=Qge(m,nbe(d),ebe(d,f,u),this.k[i],n[i]),v=ha(rbe(o),tbe(o,s,a));m=u,u=f,f=d,d=ha(c,_),c=a,a=s,s=o,o=ha(_,v)}this.h[0]=ha(this.h[0],o),this.h[1]=ha(this.h[1],s),this.h[2]=ha(this.h[2],a),this.h[3]=ha(this.h[3],c),this.h[4]=ha(this.h[4],d),this.h[5]=ha(this.h[5],f),this.h[6]=ha(this.h[6],u),this.h[7]=ha(this.h[7],m)};fc.prototype._digest=function(e){return e==="hex"?F0.toHex32(this.h,"big"):F0.split32(this.h,"big")}});var pz=G((RFe,hz)=>{"use strict";p();var pA=la(),lz=hA();function kd(){if(!(this instanceof kd))return new kd;lz.call(this),this.h=[3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428]}pA.inherits(kd,lz);hz.exports=kd;kd.blockSize=512;kd.outSize=224;kd.hmacStrength=192;kd.padLength=64;kd.prototype._digest=function(e){return e==="hex"?pA.toHex32(this.h.slice(0,7),"big"):pA.split32(this.h.slice(0,7),"big")}});var gA=G((kFe,bz)=>{"use strict";p();var Io=la(),abe=L0(),cbe=es(),uc=Io.rotr64_hi,lc=Io.rotr64_lo,mz=Io.shr64_hi,yz=Io.shr64_lo,Jf=Io.sum64,mA=Io.sum64_hi,yA=Io.sum64_lo,dbe=Io.sum64_4_hi,fbe=Io.sum64_4_lo,ube=Io.sum64_5_hi,lbe=Io.sum64_5_lo,gz=abe.BlockHash,hbe=[1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591];function pa(){if(!(this instanceof pa))return new pa;gz.call(this),this.h=[1779033703,4089235720,3144134277,2227873595,1013904242,4271175723,2773480762,1595750129,1359893119,2917565137,2600822924,725511199,528734635,4215389547,1541459225,327033209],this.k=hbe,this.W=new Array(160)}Io.inherits(pa,gz);bz.exports=pa;pa.blockSize=1024;pa.outSize=512;pa.hmacStrength=192;pa.padLength=128;pa.prototype._prepareBlock=function(e,r){for(var n=this.W,i=0;i<32;i++)n[i]=e[r+i];for(;i<n.length;i+=2){var o=Sbe(n[i-4],n[i-3]),s=Abe(n[i-4],n[i-3]),a=n[i-14],c=n[i-13],d=xbe(n[i-30],n[i-29]),f=Ebe(n[i-30],n[i-29]),u=n[i-32],m=n[i-31];n[i]=dbe(o,s,a,c,d,f,u,m),n[i+1]=fbe(o,s,a,c,d,f,u,m)}};pa.prototype._update=function(e,r){this._prepareBlock(e,r);var n=this.W,i=this.h[0],o=this.h[1],s=this.h[2],a=this.h[3],c=this.h[4],d=this.h[5],f=this.h[6],u=this.h[7],m=this.h[8],_=this.h[9],v=this.h[10],A=this.h[11],T=this.h[12],M=this.h[13],D=this.h[14],O=this.h[15];cbe(this.k.length===n.length);for(var U=0;U<n.length;U+=2){var L=D,F=O,$=wbe(m,_),H=_be(m,_),z=pbe(m,_,v,A,T,M),j=mbe(m,_,v,A,T,M),y=this.k[U],P=this.k[U+1],x=n[U],l=n[U+1],b=ube(L,F,$,H,z,j,y,P,x,l),h=lbe(L,F,$,H,z,j,y,P,x,l);L=bbe(i,o),F=vbe(i,o),$=ybe(i,o,s,a,c,d),H=gbe(i,o,s,a,c,d);var w=mA(L,F,$,H),E=yA(L,F,$,H);D=T,O=M,T=v,M=A,v=m,A=_,m=mA(f,u,b,h),_=yA(u,u,b,h),f=c,u=d,c=s,d=a,s=i,a=o,i=mA(b,h,w,E),o=yA(b,h,w,E)}Jf(this.h,0,i,o),Jf(this.h,2,s,a),Jf(this.h,4,c,d),Jf(this.h,6,f,u),Jf(this.h,8,m,_),Jf(this.h,10,v,A),Jf(this.h,12,T,M),Jf(this.h,14,D,O)};pa.prototype._digest=function(e){return e==="hex"?Io.toHex32(this.h,"big"):Io.split32(this.h,"big")};function pbe(t,e,r,n,i){var o=t&r^~t&i;return o<0&&(o+=4294967296),o}function mbe(t,e,r,n,i,o){var s=e&n^~e&o;return s<0&&(s+=4294967296),s}function ybe(t,e,r,n,i){var o=t&r^t&i^r&i;return o<0&&(o+=4294967296),o}function gbe(t,e,r,n,i,o){var s=e&n^e&o^n&o;return s<0&&(s+=4294967296),s}function bbe(t,e){var r=uc(t,e,28),n=uc(e,t,2),i=uc(e,t,7),o=r^n^i;return o<0&&(o+=4294967296),o}function vbe(t,e){var r=lc(t,e,28),n=lc(e,t,2),i=lc(e,t,7),o=r^n^i;return o<0&&(o+=4294967296),o}function wbe(t,e){var r=uc(t,e,14),n=uc(t,e,18),i=uc(e,t,9),o=r^n^i;return o<0&&(o+=4294967296),o}function _be(t,e){var r=lc(t,e,14),n=lc(t,e,18),i=lc(e,t,9),o=r^n^i;return o<0&&(o+=4294967296),o}function xbe(t,e){var r=uc(t,e,1),n=uc(t,e,8),i=mz(t,e,7),o=r^n^i;return o<0&&(o+=4294967296),o}function Ebe(t,e){var r=lc(t,e,1),n=lc(t,e,8),i=yz(t,e,7),o=r^n^i;return o<0&&(o+=4294967296),o}function Sbe(t,e){var r=uc(t,e,19),n=uc(e,t,29),i=mz(t,e,6),o=r^n^i;return o<0&&(o+=4294967296),o}function Abe(t,e){var r=lc(t,e,19),n=lc(e,t,29),i=yz(t,e,6),o=r^n^i;return o<0&&(o+=4294967296),o}});var _z=G((DFe,wz)=>{"use strict";p();var bA=la(),vz=gA();function Bd(){if(!(this instanceof Bd))return new Bd;vz.call(this),this.h=[3418070365,3238371032,1654270250,914150663,2438529370,812702999,355462360,4144912697,1731405415,4290775857,2394180231,1750603025,3675008525,1694076839,1203062813,3204075428]}bA.inherits(Bd,vz);wz.exports=Bd;Bd.blockSize=1024;Bd.outSize=384;Bd.hmacStrength=192;Bd.padLength=128;Bd.prototype._digest=function(e){return e==="hex"?bA.toHex32(this.h.slice(0,12),"big"):bA.split32(this.h.slice(0,12),"big")}});var xz=G($0=>{"use strict";p();$0.sha1=dz();$0.sha224=pz();$0.sha256=hA();$0.sha384=_z();$0.sha512=gA()});var Iz=G(Pz=>{"use strict";p();var ch=la(),Tbe=L0(),E_=ch.rotl32,Ez=ch.sum32,Ub=ch.sum32_3,Sz=ch.sum32_4,Tz=Tbe.BlockHash;function hc(){if(!(this instanceof hc))return new hc;Tz.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.endian="little"}ch.inherits(hc,Tz);Pz.ripemd160=hc;hc.blockSize=512;hc.outSize=160;hc.hmacStrength=192;hc.padLength=64;hc.prototype._update=function(e,r){for(var n=this.h[0],i=this.h[1],o=this.h[2],s=this.h[3],a=this.h[4],c=n,d=i,f=o,u=s,m=a,_=0;_<80;_++){var v=Ez(E_(Sz(n,Az(_,i,o,s),e[Rbe[_]+r],Pbe(_)),kbe[_]),a);n=a,a=s,s=E_(o,10),o=i,i=v,v=Ez(E_(Sz(c,Az(79-_,d,f,u),e[Mbe[_]+r],Ibe(_)),Bbe[_]),m),c=m,m=u,u=E_(f,10),f=d,d=v}v=Ub(this.h[1],o,u),this.h[1]=Ub(this.h[2],s,m),this.h[2]=Ub(this.h[3],a,c),this.h[3]=Ub(this.h[4],n,d),this.h[4]=Ub(this.h[0],i,f),this.h[0]=v};hc.prototype._digest=function(e){return e==="hex"?ch.toHex32(this.h,"little"):ch.split32(this.h,"little")};function Az(t,e,r,n){return t<=15?e^r^n:t<=31?e&r|~e&n:t<=47?(e|~r)^n:t<=63?e&n|r&~n:e^(r|~n)}function Pbe(t){return t<=15?0:t<=31?1518500249:t<=47?1859775393:t<=63?2400959708:2840853838}function Ibe(t){return t<=15?1352829926:t<=31?1548603684:t<=47?1836072691:t<=63?2053994217:0}var Rbe=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13],Mbe=[5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11],kbe=[11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6],Bbe=[8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11]});var Mz=G((LFe,Rz)=>{"use strict";p();var Dbe=la(),Cbe=es();function G0(t,e,r){if(!(this instanceof G0))return new G0(t,e,r);this.Hash=t,this.blockSize=t.blockSize/8,this.outSize=t.outSize/8,this.inner=null,this.outer=null,this._init(Dbe.toArray(e,r))}Rz.exports=G0;G0.prototype._init=function(e){e.length>this.blockSize&&(e=new this.Hash().update(e).digest()),Cbe(e.length<=this.blockSize);for(var r=e.length;r<this.blockSize;r++)e.push(0);for(r=0;r<e.length;r++)e[r]^=54;for(this.inner=new this.Hash().update(e),r=0;r<e.length;r++)e[r]^=106;this.outer=new this.Hash().update(e)};G0.prototype.update=function(e,r){return this.inner.update(e,r),this};G0.prototype.digest=function(e){return this.outer.update(this.inner.digest()),this.outer.digest(e)}});var S_=G(kz=>{p();var pi=kz;pi.utils=la();pi.common=L0();pi.sha=xz();pi.ripemd=Iz();pi.hmac=Mz();pi.sha1=pi.sha.sha1;pi.sha256=pi.sha.sha256;pi.sha224=pi.sha.sha224;pi.sha384=pi.sha.sha384;pi.sha512=pi.sha.sha512;pi.ripemd160=pi.ripemd.ripemd160});var Dz=G(($Fe,Bz)=>{p();Bz.exports={doubles:{step:4,points:[["e60fce93b59e9ec53011aabc21c23e97b2a31369b87a5ae9c44ee89e2a6dec0a","f7e3507399e595929db99f34f57937101296891e44d23f0be1f32cce69616821"],["8282263212c609d9ea2a6e3e172de238d8c39cabd5ac1ca10646e23fd5f51508","11f8a8098557dfe45e8256e830b60ace62d613ac2f7b17bed31b6eaff6e26caf"],["175e159f728b865a72f99cc6c6fc846de0b93833fd2222ed73fce5b551e5b739","d3506e0d9e3c79eba4ef97a51ff71f5eacb5955add24345c6efa6ffee9fed695"],["363d90d447b00c9c99ceac05b6262ee053441c7e55552ffe526bad8f83ff4640","4e273adfc732221953b445397f3363145b9a89008199ecb62003c7f3bee9de9"],["8b4b5f165df3c2be8c6244b5b745638843e4a781a15bcd1b69f79a55dffdf80c","4aad0a6f68d308b4b3fbd7813ab0da04f9e336546162ee56b3eff0c65fd4fd36"],["723cbaa6e5db996d6bf771c00bd548c7b700dbffa6c0e77bcb6115925232fcda","96e867b5595cc498a921137488824d6e2660a0653779494801dc069d9eb39f5f"],["eebfa4d493bebf98ba5feec812c2d3b50947961237a919839a533eca0e7dd7fa","5d9a8ca3970ef0f269ee7edaf178089d9ae4cdc3a711f712ddfd4fdae1de8999"],["100f44da696e71672791d0a09b7bde459f1215a29b3c03bfefd7835b39a48db0","cdd9e13192a00b772ec8f3300c090666b7ff4a18ff5195ac0fbd5cd62bc65a09"],["e1031be262c7ed1b1dc9227a4a04c017a77f8d4464f3b3852c8acde6e534fd2d","9d7061928940405e6bb6a4176597535af292dd419e1ced79a44f18f29456a00d"],["feea6cae46d55b530ac2839f143bd7ec5cf8b266a41d6af52d5e688d9094696d","e57c6b6c97dce1bab06e4e12bf3ecd5c981c8957cc41442d3155debf18090088"],["da67a91d91049cdcb367be4be6ffca3cfeed657d808583de33fa978bc1ec6cb1","9bacaa35481642bc41f463f7ec9780e5dec7adc508f740a17e9ea8e27a68be1d"],["53904faa0b334cdda6e000935ef22151ec08d0f7bb11069f57545ccc1a37b7c0","5bc087d0bc80106d88c9eccac20d3c1c13999981e14434699dcb096b022771c8"],["8e7bcd0bd35983a7719cca7764ca906779b53a043a9b8bcaeff959f43ad86047","10b7770b2a3da4b3940310420ca9514579e88e2e47fd68b3ea10047e8460372a"],["385eed34c1cdff21e6d0818689b81bde71a7f4f18397e6690a841e1599c43862","283bebc3e8ea23f56701de19e9ebf4576b304eec2086dc8cc0458fe5542e5453"],["6f9d9b803ecf191637c73a4413dfa180fddf84a5947fbc9c606ed86c3fac3a7","7c80c68e603059ba69b8e2a30e45c4d47ea4dd2f5c281002d86890603a842160"],["3322d401243c4e2582a2147c104d6ecbf774d163db0f5e5313b7e0e742d0e6bd","56e70797e9664ef5bfb019bc4ddaf9b72805f63ea2873af624f3a2e96c28b2a0"],["85672c7d2de0b7da2bd1770d89665868741b3f9af7643397721d74d28134ab83","7c481b9b5b43b2eb6374049bfa62c2e5e77f17fcc5298f44c8e3094f790313a6"],["948bf809b1988a46b06c9f1919413b10f9226c60f668832ffd959af60c82a0a","53a562856dcb6646dc6b74c5d1c3418c6d4dff08c97cd2bed4cb7f88d8c8e589"],["6260ce7f461801c34f067ce0f02873a8f1b0e44dfc69752accecd819f38fd8e8","bc2da82b6fa5b571a7f09049776a1ef7ecd292238051c198c1a84e95b2b4ae17"],["e5037de0afc1d8d43d8348414bbf4103043ec8f575bfdc432953cc8d2037fa2d","4571534baa94d3b5f9f98d09fb990bddbd5f5b03ec481f10e0e5dc841d755bda"],["e06372b0f4a207adf5ea905e8f1771b4e7e8dbd1c6a6c5b725866a0ae4fce725","7a908974bce18cfe12a27bb2ad5a488cd7484a7787104870b27034f94eee31dd"],["213c7a715cd5d45358d0bbf9dc0ce02204b10bdde2a3f58540ad6908d0559754","4b6dad0b5ae462507013ad06245ba190bb4850f5f36a7eeddff2c27534b458f2"],["4e7c272a7af4b34e8dbb9352a5419a87e2838c70adc62cddf0cc3a3b08fbd53c","17749c766c9d0b18e16fd09f6def681b530b9614bff7dd33e0b3941817dcaae6"],["fea74e3dbe778b1b10f238ad61686aa5c76e3db2be43057632427e2840fb27b6","6e0568db9b0b13297cf674deccb6af93126b596b973f7b77701d3db7f23cb96f"],["76e64113f677cf0e10a2570d599968d31544e179b760432952c02a4417bdde39","c90ddf8dee4e95cf577066d70681f0d35e2a33d2b56d2032b4b1752d1901ac01"],["c738c56b03b2abe1e8281baa743f8f9a8f7cc643df26cbee3ab150242bcbb891","893fb578951ad2537f718f2eacbfbbbb82314eef7880cfe917e735d9699a84c3"],["d895626548b65b81e264c7637c972877d1d72e5f3a925014372e9f6588f6c14b","febfaa38f2bc7eae728ec60818c340eb03428d632bb067e179363ed75d7d991f"],["b8da94032a957518eb0f6433571e8761ceffc73693e84edd49150a564f676e03","2804dfa44805a1e4d7c99cc9762808b092cc584d95ff3b511488e4e74efdf6e7"],["e80fea14441fb33a7d8adab9475d7fab2019effb5156a792f1a11778e3c0df5d","eed1de7f638e00771e89768ca3ca94472d155e80af322ea9fcb4291b6ac9ec78"],["a301697bdfcd704313ba48e51d567543f2a182031efd6915ddc07bbcc4e16070","7370f91cfb67e4f5081809fa25d40f9b1735dbf7c0a11a130c0d1a041e177ea1"],["90ad85b389d6b936463f9d0512678de208cc330b11307fffab7ac63e3fb04ed4","e507a3620a38261affdcbd9427222b839aefabe1582894d991d4d48cb6ef150"],["8f68b9d2f63b5f339239c1ad981f162ee88c5678723ea3351b7b444c9ec4c0da","662a9f2dba063986de1d90c2b6be215dbbea2cfe95510bfdf23cbf79501fff82"],["e4f3fb0176af85d65ff99ff9198c36091f48e86503681e3e6686fd5053231e11","1e63633ad0ef4f1c1661a6d0ea02b7286cc7e74ec951d1c9822c38576feb73bc"],["8c00fa9b18ebf331eb961537a45a4266c7034f2f0d4e1d0716fb6eae20eae29e","efa47267fea521a1a9dc343a3736c974c2fadafa81e36c54e7d2a4c66702414b"],["e7a26ce69dd4829f3e10cec0a9e98ed3143d084f308b92c0997fddfc60cb3e41","2a758e300fa7984b471b006a1aafbb18d0a6b2c0420e83e20e8a9421cf2cfd51"],["b6459e0ee3662ec8d23540c223bcbdc571cbcb967d79424f3cf29eb3de6b80ef","67c876d06f3e06de1dadf16e5661db3c4b3ae6d48e35b2ff30bf0b61a71ba45"],["d68a80c8280bb840793234aa118f06231d6f1fc67e73c5a5deda0f5b496943e8","db8ba9fff4b586d00c4b1f9177b0e28b5b0e7b8f7845295a294c84266b133120"],["324aed7df65c804252dc0270907a30b09612aeb973449cea4095980fc28d3d5d","648a365774b61f2ff130c0c35aec1f4f19213b0c7e332843967224af96ab7c84"],["4df9c14919cde61f6d51dfdbe5fee5dceec4143ba8d1ca888e8bd373fd054c96","35ec51092d8728050974c23a1d85d4b5d506cdc288490192ebac06cad10d5d"],["9c3919a84a474870faed8a9c1cc66021523489054d7f0308cbfc99c8ac1f98cd","ddb84f0f4a4ddd57584f044bf260e641905326f76c64c8e6be7e5e03d4fc599d"],["6057170b1dd12fdf8de05f281d8e06bb91e1493a8b91d4cc5a21382120a959e5","9a1af0b26a6a4807add9a2daf71df262465152bc3ee24c65e899be932385a2a8"],["a576df8e23a08411421439a4518da31880cef0fba7d4df12b1a6973eecb94266","40a6bf20e76640b2c92b97afe58cd82c432e10a7f514d9f3ee8be11ae1b28ec8"],["7778a78c28dec3e30a05fe9629de8c38bb30d1f5cf9a3a208f763889be58ad71","34626d9ab5a5b22ff7098e12f2ff580087b38411ff24ac563b513fc1fd9f43ac"],["928955ee637a84463729fd30e7afd2ed5f96274e5ad7e5cb09eda9c06d903ac","c25621003d3f42a827b78a13093a95eeac3d26efa8a8d83fc5180e935bcd091f"],["85d0fef3ec6db109399064f3a0e3b2855645b4a907ad354527aae75163d82751","1f03648413a38c0be29d496e582cf5663e8751e96877331582c237a24eb1f962"],["ff2b0dce97eece97c1c9b6041798b85dfdfb6d8882da20308f5404824526087e","493d13fef524ba188af4c4dc54d07936c7b7ed6fb90e2ceb2c951e01f0c29907"],["827fbbe4b1e880ea9ed2b2e6301b212b57f1ee148cd6dd28780e5e2cf856e241","c60f9c923c727b0b71bef2c67d1d12687ff7a63186903166d605b68baec293ec"],["eaa649f21f51bdbae7be4ae34ce6e5217a58fdce7f47f9aa7f3b58fa2120e2b3","be3279ed5bbbb03ac69a80f89879aa5a01a6b965f13f7e59d47a5305ba5ad93d"],["e4a42d43c5cf169d9391df6decf42ee541b6d8f0c9a137401e23632dda34d24f","4d9f92e716d1c73526fc99ccfb8ad34ce886eedfa8d8e4f13a7f7131deba9414"],["1ec80fef360cbdd954160fadab352b6b92b53576a88fea4947173b9d4300bf19","aeefe93756b5340d2f3a4958a7abbf5e0146e77f6295a07b671cdc1cc107cefd"],["146a778c04670c2f91b00af4680dfa8bce3490717d58ba889ddb5928366642be","b318e0ec3354028add669827f9d4b2870aaa971d2f7e5ed1d0b297483d83efd0"],["fa50c0f61d22e5f07e3acebb1aa07b128d0012209a28b9776d76a8793180eef9","6b84c6922397eba9b72cd2872281a68a5e683293a57a213b38cd8d7d3f4f2811"],["da1d61d0ca721a11b1a5bf6b7d88e8421a288ab5d5bba5220e53d32b5f067ec2","8157f55a7c99306c79c0766161c91e2966a73899d279b48a655fba0f1ad836f1"],["a8e282ff0c9706907215ff98e8fd416615311de0446f1e062a73b0610d064e13","7f97355b8db81c09abfb7f3c5b2515888b679a3e50dd6bd6cef7c73111f4cc0c"],["174a53b9c9a285872d39e56e6913cab15d59b1fa512508c022f382de8319497c","ccc9dc37abfc9c1657b4155f2c47f9e6646b3a1d8cb9854383da13ac079afa73"],["959396981943785c3d3e57edf5018cdbe039e730e4918b3d884fdff09475b7ba","2e7e552888c331dd8ba0386a4b9cd6849c653f64c8709385e9b8abf87524f2fd"],["d2a63a50ae401e56d645a1153b109a8fcca0a43d561fba2dbb51340c9d82b151","e82d86fb6443fcb7565aee58b2948220a70f750af484ca52d4142174dcf89405"],["64587e2335471eb890ee7896d7cfdc866bacbdbd3839317b3436f9b45617e073","d99fcdd5bf6902e2ae96dd6447c299a185b90a39133aeab358299e5e9faf6589"],["8481bde0e4e4d885b3a546d3e549de042f0aa6cea250e7fd358d6c86dd45e458","38ee7b8cba5404dd84a25bf39cecb2ca900a79c42b262e556d64b1b59779057e"],["13464a57a78102aa62b6979ae817f4637ffcfed3c4b1ce30bcd6303f6caf666b","69be159004614580ef7e433453ccb0ca48f300a81d0942e13f495a907f6ecc27"],["bc4a9df5b713fe2e9aef430bcc1dc97a0cd9ccede2f28588cada3a0d2d83f366","d3a81ca6e785c06383937adf4b798caa6e8a9fbfa547b16d758d666581f33c1"],["8c28a97bf8298bc0d23d8c749452a32e694b65e30a9472a3954ab30fe5324caa","40a30463a3305193378fedf31f7cc0eb7ae784f0451cb9459e71dc73cbef9482"],["8ea9666139527a8c1dd94ce4f071fd23c8b350c5a4bb33748c4ba111faccae0","620efabbc8ee2782e24e7c0cfb95c5d735b783be9cf0f8e955af34a30e62b945"],["dd3625faef5ba06074669716bbd3788d89bdde815959968092f76cc4eb9a9787","7a188fa3520e30d461da2501045731ca941461982883395937f68d00c644a573"],["f710d79d9eb962297e4f6232b40e8f7feb2bc63814614d692c12de752408221e","ea98e67232d3b3295d3b535532115ccac8612c721851617526ae47a9c77bfc82"]]},naf:{wnd:7,points:[["f9308a019258c31049344f85f89d5229b531c845836f99b08601f113bce036f9","388f7b0f632de8140fe337e62a37f3566500a99934c2231b6cb9fd7584b8e672"],["2f8bde4d1a07209355b4a7250a5c5128e88b84bddc619ab7cba8d569b240efe4","d8ac222636e5e3d6d4dba9dda6c9c426f788271bab0d6840dca87d3aa6ac62d6"],["5cbdf0646e5db4eaa398f365f2ea7a0e3d419b7e0330e39ce92bddedcac4f9bc","6aebca40ba255960a3178d6d861a54dba813d0b813fde7b5a5082628087264da"],["acd484e2f0c7f65309ad178a9f559abde09796974c57e714c35f110dfc27ccbe","cc338921b0a7d9fd64380971763b61e9add888a4375f8e0f05cc262ac64f9c37"],["774ae7f858a9411e5ef4246b70c65aac5649980be5c17891bbec17895da008cb","d984a032eb6b5e190243dd56d7b7b365372db1e2dff9d6a8301d74c9c953c61b"],["f28773c2d975288bc7d1d205c3748651b075fbc6610e58cddeeddf8f19405aa8","ab0902e8d880a89758212eb65cdaf473a1a06da521fa91f29b5cb52db03ed81"],["d7924d4f7d43ea965a465ae3095ff41131e5946f3c85f79e44adbcf8e27e080e","581e2872a86c72a683842ec228cc6defea40af2bd896d3a5c504dc9ff6a26b58"],["defdea4cdb677750a420fee807eacf21eb9898ae79b9768766e4faa04a2d4a34","4211ab0694635168e997b0ead2a93daeced1f4a04a95c0f6cfb199f69e56eb77"],["2b4ea0a797a443d293ef5cff444f4979f06acfebd7e86d277475656138385b6c","85e89bc037945d93b343083b5a1c86131a01f60c50269763b570c854e5c09b7a"],["352bbf4a4cdd12564f93fa332ce333301d9ad40271f8107181340aef25be59d5","321eb4075348f534d59c18259dda3e1f4a1b3b2e71b1039c67bd3d8bcf81998c"],["2fa2104d6b38d11b0230010559879124e42ab8dfeff5ff29dc9cdadd4ecacc3f","2de1068295dd865b64569335bd5dd80181d70ecfc882648423ba76b532b7d67"],["9248279b09b4d68dab21a9b066edda83263c3d84e09572e269ca0cd7f5453714","73016f7bf234aade5d1aa71bdea2b1ff3fc0de2a887912ffe54a32ce97cb3402"],["daed4f2be3a8bf278e70132fb0beb7522f570e144bf615c07e996d443dee8729","a69dce4a7d6c98e8d4a1aca87ef8d7003f83c230f3afa726ab40e52290be1c55"],["c44d12c7065d812e8acf28d7cbb19f9011ecd9e9fdf281b0e6a3b5e87d22e7db","2119a460ce326cdc76c45926c982fdac0e106e861edf61c5a039063f0e0e6482"],["6a245bf6dc698504c89a20cfded60853152b695336c28063b61c65cbd269e6b4","e022cf42c2bd4a708b3f5126f16a24ad8b33ba48d0423b6efd5e6348100d8a82"],["1697ffa6fd9de627c077e3d2fe541084ce13300b0bec1146f95ae57f0d0bd6a5","b9c398f186806f5d27561506e4557433a2cf15009e498ae7adee9d63d01b2396"],["605bdb019981718b986d0f07e834cb0d9deb8360ffb7f61df982345ef27a7479","2972d2de4f8d20681a78d93ec96fe23c26bfae84fb14db43b01e1e9056b8c49"],["62d14dab4150bf497402fdc45a215e10dcb01c354959b10cfe31c7e9d87ff33d","80fc06bd8cc5b01098088a1950eed0db01aa132967ab472235f5642483b25eaf"],["80c60ad0040f27dade5b4b06c408e56b2c50e9f56b9b8b425e555c2f86308b6f","1c38303f1cc5c30f26e66bad7fe72f70a65eed4cbe7024eb1aa01f56430bd57a"],["7a9375ad6167ad54aa74c6348cc54d344cc5dc9487d847049d5eabb0fa03c8fb","d0e3fa9eca8726909559e0d79269046bdc59ea10c70ce2b02d499ec224dc7f7"],["d528ecd9b696b54c907a9ed045447a79bb408ec39b68df504bb51f459bc3ffc9","eecf41253136e5f99966f21881fd656ebc4345405c520dbc063465b521409933"],["49370a4b5f43412ea25f514e8ecdad05266115e4a7ecb1387231808f8b45963","758f3f41afd6ed428b3081b0512fd62a54c3f3afbb5b6764b653052a12949c9a"],["77f230936ee88cbbd73df930d64702ef881d811e0e1498e2f1c13eb1fc345d74","958ef42a7886b6400a08266e9ba1b37896c95330d97077cbbe8eb3c7671c60d6"],["f2dac991cc4ce4b9ea44887e5c7c0bce58c80074ab9d4dbaeb28531b7739f530","e0dedc9b3b2f8dad4da1f32dec2531df9eb5fbeb0598e4fd1a117dba703a3c37"],["463b3d9f662621fb1b4be8fbbe2520125a216cdfc9dae3debcba4850c690d45b","5ed430d78c296c3543114306dd8622d7c622e27c970a1de31cb377b01af7307e"],["f16f804244e46e2a09232d4aff3b59976b98fac14328a2d1a32496b49998f247","cedabd9b82203f7e13d206fcdf4e33d92a6c53c26e5cce26d6579962c4e31df6"],["caf754272dc84563b0352b7a14311af55d245315ace27c65369e15f7151d41d1","cb474660ef35f5f2a41b643fa5e460575f4fa9b7962232a5c32f908318a04476"],["2600ca4b282cb986f85d0f1709979d8b44a09c07cb86d7c124497bc86f082120","4119b88753c15bd6a693b03fcddbb45d5ac6be74ab5f0ef44b0be9475a7e4b40"],["7635ca72d7e8432c338ec53cd12220bc01c48685e24f7dc8c602a7746998e435","91b649609489d613d1d5e590f78e6d74ecfc061d57048bad9e76f302c5b9c61"],["754e3239f325570cdbbf4a87deee8a66b7f2b33479d468fbc1a50743bf56cc18","673fb86e5bda30fb3cd0ed304ea49a023ee33d0197a695d0c5d98093c536683"],["e3e6bd1071a1e96aff57859c82d570f0330800661d1c952f9fe2694691d9b9e8","59c9e0bba394e76f40c0aa58379a3cb6a5a2283993e90c4167002af4920e37f5"],["186b483d056a033826ae73d88f732985c4ccb1f32ba35f4b4cc47fdcf04aa6eb","3b952d32c67cf77e2e17446e204180ab21fb8090895138b4a4a797f86e80888b"],["df9d70a6b9876ce544c98561f4be4f725442e6d2b737d9c91a8321724ce0963f","55eb2dafd84d6ccd5f862b785dc39d4ab157222720ef9da217b8c45cf2ba2417"],["5edd5cc23c51e87a497ca815d5dce0f8ab52554f849ed8995de64c5f34ce7143","efae9c8dbc14130661e8cec030c89ad0c13c66c0d17a2905cdc706ab7399a868"],["290798c2b6476830da12fe02287e9e777aa3fba1c355b17a722d362f84614fba","e38da76dcd440621988d00bcf79af25d5b29c094db2a23146d003afd41943e7a"],["af3c423a95d9f5b3054754efa150ac39cd29552fe360257362dfdecef4053b45","f98a3fd831eb2b749a93b0e6f35cfb40c8cd5aa667a15581bc2feded498fd9c6"],["766dbb24d134e745cccaa28c99bf274906bb66b26dcf98df8d2fed50d884249a","744b1152eacbe5e38dcc887980da38b897584a65fa06cedd2c924f97cbac5996"],["59dbf46f8c94759ba21277c33784f41645f7b44f6c596a58ce92e666191abe3e","c534ad44175fbc300f4ea6ce648309a042ce739a7919798cd85e216c4a307f6e"],["f13ada95103c4537305e691e74e9a4a8dd647e711a95e73cb62dc6018cfd87b8","e13817b44ee14de663bf4bc808341f326949e21a6a75c2570778419bdaf5733d"],["7754b4fa0e8aced06d4167a2c59cca4cda1869c06ebadfb6488550015a88522c","30e93e864e669d82224b967c3020b8fa8d1e4e350b6cbcc537a48b57841163a2"],["948dcadf5990e048aa3874d46abef9d701858f95de8041d2a6828c99e2262519","e491a42537f6e597d5d28a3224b1bc25df9154efbd2ef1d2cbba2cae5347d57e"],["7962414450c76c1689c7b48f8202ec37fb224cf5ac0bfa1570328a8a3d7c77ab","100b610ec4ffb4760d5c1fc133ef6f6b12507a051f04ac5760afa5b29db83437"],["3514087834964b54b15b160644d915485a16977225b8847bb0dd085137ec47ca","ef0afbb2056205448e1652c48e8127fc6039e77c15c2378b7e7d15a0de293311"],["d3cc30ad6b483e4bc79ce2c9dd8bc54993e947eb8df787b442943d3f7b527eaf","8b378a22d827278d89c5e9be8f9508ae3c2ad46290358630afb34db04eede0a4"],["1624d84780732860ce1c78fcbfefe08b2b29823db913f6493975ba0ff4847610","68651cf9b6da903e0914448c6cd9d4ca896878f5282be4c8cc06e2a404078575"],["733ce80da955a8a26902c95633e62a985192474b5af207da6df7b4fd5fc61cd4","f5435a2bd2badf7d485a4d8b8db9fcce3e1ef8e0201e4578c54673bc1dc5ea1d"],["15d9441254945064cf1a1c33bbd3b49f8966c5092171e699ef258dfab81c045c","d56eb30b69463e7234f5137b73b84177434800bacebfc685fc37bbe9efe4070d"],["a1d0fcf2ec9de675b612136e5ce70d271c21417c9d2b8aaaac138599d0717940","edd77f50bcb5a3cab2e90737309667f2641462a54070f3d519212d39c197a629"],["e22fbe15c0af8ccc5780c0735f84dbe9a790badee8245c06c7ca37331cb36980","a855babad5cd60c88b430a69f53a1a7a38289154964799be43d06d77d31da06"],["311091dd9860e8e20ee13473c1155f5f69635e394704eaa74009452246cfa9b3","66db656f87d1f04fffd1f04788c06830871ec5a64feee685bd80f0b1286d8374"],["34c1fd04d301be89b31c0442d3e6ac24883928b45a9340781867d4232ec2dbdf","9414685e97b1b5954bd46f730174136d57f1ceeb487443dc5321857ba73abee"],["f219ea5d6b54701c1c14de5b557eb42a8d13f3abbcd08affcc2a5e6b049b8d63","4cb95957e83d40b0f73af4544cccf6b1f4b08d3c07b27fb8d8c2962a400766d1"],["d7b8740f74a8fbaab1f683db8f45de26543a5490bca627087236912469a0b448","fa77968128d9c92ee1010f337ad4717eff15db5ed3c049b3411e0315eaa4593b"],["32d31c222f8f6f0ef86f7c98d3a3335ead5bcd32abdd94289fe4d3091aa824bf","5f3032f5892156e39ccd3d7915b9e1da2e6dac9e6f26e961118d14b8462e1661"],["7461f371914ab32671045a155d9831ea8793d77cd59592c4340f86cbc18347b5","8ec0ba238b96bec0cbdddcae0aa442542eee1ff50c986ea6b39847b3cc092ff6"],["ee079adb1df1860074356a25aa38206a6d716b2c3e67453d287698bad7b2b2d6","8dc2412aafe3be5c4c5f37e0ecc5f9f6a446989af04c4e25ebaac479ec1c8c1e"],["16ec93e447ec83f0467b18302ee620f7e65de331874c9dc72bfd8616ba9da6b5","5e4631150e62fb40d0e8c2a7ca5804a39d58186a50e497139626778e25b0674d"],["eaa5f980c245f6f038978290afa70b6bd8855897f98b6aa485b96065d537bd99","f65f5d3e292c2e0819a528391c994624d784869d7e6ea67fb18041024edc07dc"],["78c9407544ac132692ee1910a02439958ae04877151342ea96c4b6b35a49f51","f3e0319169eb9b85d5404795539a5e68fa1fbd583c064d2462b675f194a3ddb4"],["494f4be219a1a77016dcd838431aea0001cdc8ae7a6fc688726578d9702857a5","42242a969283a5f339ba7f075e36ba2af925ce30d767ed6e55f4b031880d562c"],["a598a8030da6d86c6bc7f2f5144ea549d28211ea58faa70ebf4c1e665c1fe9b5","204b5d6f84822c307e4b4a7140737aec23fc63b65b35f86a10026dbd2d864e6b"],["c41916365abb2b5d09192f5f2dbeafec208f020f12570a184dbadc3e58595997","4f14351d0087efa49d245b328984989d5caf9450f34bfc0ed16e96b58fa9913"],["841d6063a586fa475a724604da03bc5b92a2e0d2e0a36acfe4c73a5514742881","73867f59c0659e81904f9a1c7543698e62562d6744c169ce7a36de01a8d6154"],["5e95bb399a6971d376026947f89bde2f282b33810928be4ded112ac4d70e20d5","39f23f366809085beebfc71181313775a99c9aed7d8ba38b161384c746012865"],["36e4641a53948fd476c39f8a99fd974e5ec07564b5315d8bf99471bca0ef2f66","d2424b1b1abe4eb8164227b085c9aa9456ea13493fd563e06fd51cf5694c78fc"],["336581ea7bfbbb290c191a2f507a41cf5643842170e914faeab27c2c579f726","ead12168595fe1be99252129b6e56b3391f7ab1410cd1e0ef3dcdcabd2fda224"],["8ab89816dadfd6b6a1f2634fcf00ec8403781025ed6890c4849742706bd43ede","6fdcef09f2f6d0a044e654aef624136f503d459c3e89845858a47a9129cdd24e"],["1e33f1a746c9c5778133344d9299fcaa20b0938e8acff2544bb40284b8c5fb94","60660257dd11b3aa9c8ed618d24edff2306d320f1d03010e33a7d2057f3b3b6"],["85b7c1dcb3cec1b7ee7f30ded79dd20a0ed1f4cc18cbcfcfa410361fd8f08f31","3d98a9cdd026dd43f39048f25a8847f4fcafad1895d7a633c6fed3c35e999511"],["29df9fbd8d9e46509275f4b125d6d45d7fbe9a3b878a7af872a2800661ac5f51","b4c4fe99c775a606e2d8862179139ffda61dc861c019e55cd2876eb2a27d84b"],["a0b1cae06b0a847a3fea6e671aaf8adfdfe58ca2f768105c8082b2e449fce252","ae434102edde0958ec4b19d917a6a28e6b72da1834aff0e650f049503a296cf2"],["4e8ceafb9b3e9a136dc7ff67e840295b499dfb3b2133e4ba113f2e4c0e121e5","cf2174118c8b6d7a4b48f6d534ce5c79422c086a63460502b827ce62a326683c"],["d24a44e047e19b6f5afb81c7ca2f69080a5076689a010919f42725c2b789a33b","6fb8d5591b466f8fc63db50f1c0f1c69013f996887b8244d2cdec417afea8fa3"],["ea01606a7a6c9cdd249fdfcfacb99584001edd28abbab77b5104e98e8e3b35d4","322af4908c7312b0cfbfe369f7a7b3cdb7d4494bc2823700cfd652188a3ea98d"],["af8addbf2b661c8a6c6328655eb96651252007d8c5ea31be4ad196de8ce2131f","6749e67c029b85f52a034eafd096836b2520818680e26ac8f3dfbcdb71749700"],["e3ae1974566ca06cc516d47e0fb165a674a3dabcfca15e722f0e3450f45889","2aeabe7e4531510116217f07bf4d07300de97e4874f81f533420a72eeb0bd6a4"],["591ee355313d99721cf6993ffed1e3e301993ff3ed258802075ea8ced397e246","b0ea558a113c30bea60fc4775460c7901ff0b053d25ca2bdeee98f1a4be5d196"],["11396d55fda54c49f19aa97318d8da61fa8584e47b084945077cf03255b52984","998c74a8cd45ac01289d5833a7beb4744ff536b01b257be4c5767bea93ea57a4"],["3c5d2a1ba39c5a1790000738c9e0c40b8dcdfd5468754b6405540157e017aa7a","b2284279995a34e2f9d4de7396fc18b80f9b8b9fdd270f6661f79ca4c81bd257"],["cc8704b8a60a0defa3a99a7299f2e9c3fbc395afb04ac078425ef8a1793cc030","bdd46039feed17881d1e0862db347f8cf395b74fc4bcdc4e940b74e3ac1f1b13"],["c533e4f7ea8555aacd9777ac5cad29b97dd4defccc53ee7ea204119b2889b197","6f0a256bc5efdf429a2fb6242f1a43a2d9b925bb4a4b3a26bb8e0f45eb596096"],["c14f8f2ccb27d6f109f6d08d03cc96a69ba8c34eec07bbcf566d48e33da6593","c359d6923bb398f7fd4473e16fe1c28475b740dd098075e6c0e8649113dc3a38"],["a6cbc3046bc6a450bac24789fa17115a4c9739ed75f8f21ce441f72e0b90e6ef","21ae7f4680e889bb130619e2c0f95a360ceb573c70603139862afd617fa9b9f"],["347d6d9a02c48927ebfb86c1359b1caf130a3c0267d11ce6344b39f99d43cc38","60ea7f61a353524d1c987f6ecec92f086d565ab687870cb12689ff1e31c74448"],["da6545d2181db8d983f7dcb375ef5866d47c67b1bf31c8cf855ef7437b72656a","49b96715ab6878a79e78f07ce5680c5d6673051b4935bd897fea824b77dc208a"],["c40747cc9d012cb1a13b8148309c6de7ec25d6945d657146b9d5994b8feb1111","5ca560753be2a12fc6de6caf2cb489565db936156b9514e1bb5e83037e0fa2d4"],["4e42c8ec82c99798ccf3a610be870e78338c7f713348bd34c8203ef4037f3502","7571d74ee5e0fb92a7a8b33a07783341a5492144cc54bcc40a94473693606437"],["3775ab7089bc6af823aba2e1af70b236d251cadb0c86743287522a1b3b0dedea","be52d107bcfa09d8bcb9736a828cfa7fac8db17bf7a76a2c42ad961409018cf7"],["cee31cbf7e34ec379d94fb814d3d775ad954595d1314ba8846959e3e82f74e26","8fd64a14c06b589c26b947ae2bcf6bfa0149ef0be14ed4d80f448a01c43b1c6d"],["b4f9eaea09b6917619f6ea6a4eb5464efddb58fd45b1ebefcdc1a01d08b47986","39e5c9925b5a54b07433a4f18c61726f8bb131c012ca542eb24a8ac07200682a"],["d4263dfc3d2df923a0179a48966d30ce84e2515afc3dccc1b77907792ebcc60e","62dfaf07a0f78feb30e30d6295853ce189e127760ad6cf7fae164e122a208d54"],["48457524820fa65a4f8d35eb6930857c0032acc0a4a2de422233eeda897612c4","25a748ab367979d98733c38a1fa1c2e7dc6cc07db2d60a9ae7a76aaa49bd0f77"],["dfeeef1881101f2cb11644f3a2afdfc2045e19919152923f367a1767c11cceda","ecfb7056cf1de042f9420bab396793c0c390bde74b4bbdff16a83ae09a9a7517"],["6d7ef6b17543f8373c573f44e1f389835d89bcbc6062ced36c82df83b8fae859","cd450ec335438986dfefa10c57fea9bcc521a0959b2d80bbf74b190dca712d10"],["e75605d59102a5a2684500d3b991f2e3f3c88b93225547035af25af66e04541f","f5c54754a8f71ee540b9b48728473e314f729ac5308b06938360990e2bfad125"],["eb98660f4c4dfaa06a2be453d5020bc99a0c2e60abe388457dd43fefb1ed620c","6cb9a8876d9cb8520609af3add26cd20a0a7cd8a9411131ce85f44100099223e"],["13e87b027d8514d35939f2e6892b19922154596941888336dc3563e3b8dba942","fef5a3c68059a6dec5d624114bf1e91aac2b9da568d6abeb2570d55646b8adf1"],["ee163026e9fd6fe017c38f06a5be6fc125424b371ce2708e7bf4491691e5764a","1acb250f255dd61c43d94ccc670d0f58f49ae3fa15b96623e5430da0ad6c62b2"],["b268f5ef9ad51e4d78de3a750c2dc89b1e626d43505867999932e5db33af3d80","5f310d4b3c99b9ebb19f77d41c1dee018cf0d34fd4191614003e945a1216e423"],["ff07f3118a9df035e9fad85eb6c7bfe42b02f01ca99ceea3bf7ffdba93c4750d","438136d603e858a3a5c440c38eccbaddc1d2942114e2eddd4740d098ced1f0d8"],["8d8b9855c7c052a34146fd20ffb658bea4b9f69e0d825ebec16e8c3ce2b526a1","cdb559eedc2d79f926baf44fb84ea4d44bcf50fee51d7ceb30e2e7f463036758"],["52db0b5384dfbf05bfa9d472d7ae26dfe4b851ceca91b1eba54263180da32b63","c3b997d050ee5d423ebaf66a6db9f57b3180c902875679de924b69d84a7b375"],["e62f9490d3d51da6395efd24e80919cc7d0f29c3f3fa48c6fff543becbd43352","6d89ad7ba4876b0b22c2ca280c682862f342c8591f1daf5170e07bfd9ccafa7d"],["7f30ea2476b399b4957509c88f77d0191afa2ff5cb7b14fd6d8e7d65aaab1193","ca5ef7d4b231c94c3b15389a5f6311e9daff7bb67b103e9880ef4bff637acaec"],["5098ff1e1d9f14fb46a210fada6c903fef0fb7b4a1dd1d9ac60a0361800b7a00","9731141d81fc8f8084d37c6e7542006b3ee1b40d60dfe5362a5b132fd17ddc0"],["32b78c7de9ee512a72895be6b9cbefa6e2f3c4ccce445c96b9f2c81e2778ad58","ee1849f513df71e32efc3896ee28260c73bb80547ae2275ba497237794c8753c"],["e2cb74fddc8e9fbcd076eef2a7c72b0ce37d50f08269dfc074b581550547a4f7","d3aa2ed71c9dd2247a62df062736eb0baddea9e36122d2be8641abcb005cc4a4"],["8438447566d4d7bedadc299496ab357426009a35f235cb141be0d99cd10ae3a8","c4e1020916980a4da5d01ac5e6ad330734ef0d7906631c4f2390426b2edd791f"],["4162d488b89402039b584c6fc6c308870587d9c46f660b878ab65c82c711d67e","67163e903236289f776f22c25fb8a3afc1732f2b84b4e95dbda47ae5a0852649"],["3fad3fa84caf0f34f0f89bfd2dcf54fc175d767aec3e50684f3ba4a4bf5f683d","cd1bc7cb6cc407bb2f0ca647c718a730cf71872e7d0d2a53fa20efcdfe61826"],["674f2600a3007a00568c1a7ce05d0816c1fb84bf1370798f1c69532faeb1a86b","299d21f9413f33b3edf43b257004580b70db57da0b182259e09eecc69e0d38a5"],["d32f4da54ade74abb81b815ad1fb3b263d82d6c692714bcff87d29bd5ee9f08f","f9429e738b8e53b968e99016c059707782e14f4535359d582fc416910b3eea87"],["30e4e670435385556e593657135845d36fbb6931f72b08cb1ed954f1e3ce3ff6","462f9bce619898638499350113bbc9b10a878d35da70740dc695a559eb88db7b"],["be2062003c51cc3004682904330e4dee7f3dcd10b01e580bf1971b04d4cad297","62188bc49d61e5428573d48a74e1c655b1c61090905682a0d5558ed72dccb9bc"],["93144423ace3451ed29e0fb9ac2af211cb6e84a601df5993c419859fff5df04a","7c10dfb164c3425f5c71a3f9d7992038f1065224f72bb9d1d902a6d13037b47c"],["b015f8044f5fcbdcf21ca26d6c34fb8197829205c7b7d2a7cb66418c157b112c","ab8c1e086d04e813744a655b2df8d5f83b3cdc6faa3088c1d3aea1454e3a1d5f"],["d5e9e1da649d97d89e4868117a465a3a4f8a18de57a140d36b3f2af341a21b52","4cb04437f391ed73111a13cc1d4dd0db1693465c2240480d8955e8592f27447a"],["d3ae41047dd7ca065dbf8ed77b992439983005cd72e16d6f996a5316d36966bb","bd1aeb21ad22ebb22a10f0303417c6d964f8cdd7df0aca614b10dc14d125ac46"],["463e2763d885f958fc66cdd22800f0a487197d0a82e377b49f80af87c897b065","bfefacdb0e5d0fd7df3a311a94de062b26b80c61fbc97508b79992671ef7ca7f"],["7985fdfd127c0567c6f53ec1bb63ec3158e597c40bfe747c83cddfc910641917","603c12daf3d9862ef2b25fe1de289aed24ed291e0ec6708703a5bd567f32ed03"],["74a1ad6b5f76e39db2dd249410eac7f99e74c59cb83d2d0ed5ff1543da7703e9","cc6157ef18c9c63cd6193d83631bbea0093e0968942e8c33d5737fd790e0db08"],["30682a50703375f602d416664ba19b7fc9bab42c72747463a71d0896b22f6da3","553e04f6b018b4fa6c8f39e7f311d3176290d0e0f19ca73f17714d9977a22ff8"],["9e2158f0d7c0d5f26c3791efefa79597654e7a2b2464f52b1ee6c1347769ef57","712fcdd1b9053f09003a3481fa7762e9ffd7c8ef35a38509e2fbf2629008373"],["176e26989a43c9cfeba4029c202538c28172e566e3c4fce7322857f3be327d66","ed8cc9d04b29eb877d270b4878dc43c19aefd31f4eee09ee7b47834c1fa4b1c3"],["75d46efea3771e6e68abb89a13ad747ecf1892393dfc4f1b7004788c50374da8","9852390a99507679fd0b86fd2b39a868d7efc22151346e1a3ca4726586a6bed8"],["809a20c67d64900ffb698c4c825f6d5f2310fb0451c869345b7319f645605721","9e994980d9917e22b76b061927fa04143d096ccc54963e6a5ebfa5f3f8e286c1"],["1b38903a43f7f114ed4500b4eac7083fdefece1cf29c63528d563446f972c180","4036edc931a60ae889353f77fd53de4a2708b26b6f5da72ad3394119daf408f9"]]}}});var A_=G(jz=>{"use strict";p();var wA=jz,Xf=S_(),vA=fA(),Obe=ts(),Cz=Obe.assert;function Oz(t){t.type==="short"?this.curve=new vA.short(t):t.type==="edwards"?this.curve=new vA.edwards(t):this.curve=new vA.mont(t),this.g=this.curve.g,this.n=this.curve.n,this.hash=t.hash,Cz(this.g.validate(),"Invalid curve"),Cz(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}wA.PresetCurve=Oz;function Qf(t,e){Object.defineProperty(wA,t,{configurable:!0,enumerable:!0,get:function(){var r=new Oz(e);return Object.defineProperty(wA,t,{configurable:!0,enumerable:!0,value:r}),r}})}Qf("p192",{type:"short",prime:"p192",p:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff",a:"ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc",b:"64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1",n:"ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831",hash:Xf.sha256,gRed:!1,g:["188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012","07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811"]});Qf("p224",{type:"short",prime:"p224",p:"ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001",a:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe",b:"b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4",n:"ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d",hash:Xf.sha256,gRed:!1,g:["b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21","bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34"]});Qf("p256",{type:"short",prime:null,p:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff ffffffff",a:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc",b:"5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b",n:"ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551",hash:Xf.sha256,gRed:!1,g:["6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296","4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5"]});Qf("p384",{type:"short",prime:null,p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 ffffffff",a:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 fffffffc",b:"b3312fa7 e23ee7e4 988e056b e3f82d19 181d9c6e fe814112 0314088f 5013875a c656398d 8a2ed19d 2a85c8ed d3ec2aef",n:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff c7634d81 f4372ddf 581a0db2 48b0a77a ecec196a ccc52973",hash:Xf.sha384,gRed:!1,g:["aa87ca22 be8b0537 8eb1c71e f320ad74 6e1d3b62 8ba79b98 59f741e0 82542a38 5502f25d bf55296c 3a545e38 72760ab7","3617de4a 96262c6f 5d9e98bf 9292dc29 f8f41dbd 289a147c e9da3113 b5f0b8c0 0a60b1ce 1d7e819d 7a431d7c 90ea0e5f"]});Qf("p521",{type:"short",prime:null,p:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff",a:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffc",b:"00000051 953eb961 8e1c9a1f 929a21a0 b68540ee a2da725b 99b315f3 b8b48991 8ef109e1 56193951 ec7e937b 1652c0bd 3bb1bf07 3573df88 3d2c34f1 ef451fd4 6b503f00",n:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffa 51868783 bf2f966b 7fcc0148 f709a5d0 3bb5c9b8 899c47ae bb6fb71e 91386409",hash:Xf.sha512,gRed:!1,g:["000000c6 858e06b7 0404e9cd 9e3ecb66 2395b442 9c648139 053fb521 f828af60 6b4d3dba a14b5e77 efe75928 fe1dc127 a2ffa8de 3348b3c1 856a429b f97e7e31 c2e5bd66","00000118 39296a78 9a3bc004 5c8a5fb4 2c7d1bd9 98f54449 579b4468 17afbd17 273e662c 97ee7299 5ef42640 c550b901 3fad0761 353c7086 a272c240 88be9476 9fd16650"]});Qf("curve25519",{type:"mont",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"76d06",b:"1",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:Xf.sha256,gRed:!1,g:["9"]});Qf("ed25519",{type:"edwards",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"-1",c:"1",d:"52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:Xf.sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});var _A;try{_A=Dz()}catch{_A=void 0}Qf("secp256k1",{type:"short",prime:"k256",p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f",a:"0",b:"7",n:"ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141",h:"1",hash:Xf.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",_A]})});var Lz=G((VFe,qz)=>{"use strict";p();var jbe=S_(),dh=cA(),Nz=es();function eu(t){if(!(this instanceof eu))return new eu(t);this.hash=t.hash,this.predResist=!!t.predResist,this.outLen=this.hash.outSize,this.minEntropy=t.minEntropy||this.hash.hmacStrength,this._reseed=null,this.reseedInterval=null,this.K=null,this.V=null;var e=dh.toArray(t.entropy,t.entropyEnc||"hex"),r=dh.toArray(t.nonce,t.nonceEnc||"hex"),n=dh.toArray(t.pers,t.persEnc||"hex");Nz(e.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(e,r,n)}qz.exports=eu;eu.prototype._init=function(e,r,n){var i=e.concat(r).concat(n);this.K=new Array(this.outLen/8),this.V=new Array(this.outLen/8);for(var o=0;o<this.V.length;o++)this.K[o]=0,this.V[o]=1;this._update(i),this._reseed=1,this.reseedInterval=281474976710656};eu.prototype._hmac=function(){return new jbe.hmac(this.hash,this.K)};eu.prototype._update=function(e){var r=this._hmac().update(this.V).update([0]);e&&(r=r.update(e)),this.K=r.digest(),this.V=this._hmac().update(this.V).digest(),e&&(this.K=this._hmac().update(this.V).update([1]).update(e).digest(),this.V=this._hmac().update(this.V).digest())};eu.prototype.reseed=function(e,r,n,i){typeof r!="string"&&(i=n,n=r,r=null),e=dh.toArray(e,r),n=dh.toArray(n,i),Nz(e.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(e.concat(n||[])),this._reseed=1};eu.prototype.generate=function(e,r,n,i){if(this._reseed>this.reseedInterval)throw new Error("Reseed is required");typeof r!="string"&&(i=n,n=r,r=null),n&&(n=dh.toArray(n,i||"hex"),this._update(n));for(var o=[];o.length<e;)this.V=this._hmac().update(this.V).digest(),o=o.concat(this.V);var s=o.slice(0,e);return this._update(n),this._reseed++,dh.encode(s,r)}});var Fz=G((ZFe,Uz)=>{"use strict";p();var Nbe=Zn(),qbe=ts(),xA=qbe.assert;function Fi(t,e){this.ec=t,this.priv=null,this.pub=null,e.priv&&this._importPrivate(e.priv,e.privEnc),e.pub&&this._importPublic(e.pub,e.pubEnc)}Uz.exports=Fi;Fi.fromPublic=function(e,r,n){return r instanceof Fi?r:new Fi(e,{pub:r,pubEnc:n})};Fi.fromPrivate=function(e,r,n){return r instanceof Fi?r:new Fi(e,{priv:r,privEnc:n})};Fi.prototype.validate=function(){var e=this.getPublic();return e.isInfinity()?{result:!1,reason:"Invalid public key"}:e.validate()?e.mul(this.ec.curve.n).isInfinity()?{result:!0,reason:null}:{result:!1,reason:"Public key * N != O"}:{result:!1,reason:"Public key is not a point"}};Fi.prototype.getPublic=function(e,r){return typeof e=="string"&&(r=e,e=null),this.pub||(this.pub=this.ec.g.mul(this.priv)),r?this.pub.encode(r,e):this.pub};Fi.prototype.getPrivate=function(e){return e==="hex"?this.priv.toString(16,2):this.priv};Fi.prototype._importPrivate=function(e,r){this.priv=new Nbe(e,r||16),this.priv=this.priv.umod(this.ec.curve.n)};Fi.prototype._importPublic=function(e,r){if(e.x||e.y){this.ec.curve.type==="mont"?xA(e.x,"Need x coordinate"):(this.ec.curve.type==="short"||this.ec.curve.type==="edwards")&&xA(e.x&&e.y,"Need both x and y coordinate"),this.pub=this.ec.curve.point(e.x,e.y);return}this.pub=this.ec.curve.decodePoint(e,r)};Fi.prototype.derive=function(e){return e.validate()||xA(e.validate(),"public point not validated"),e.mul(this.priv).getX()};Fi.prototype.sign=function(e,r,n){return this.ec.sign(e,this,r,n)};Fi.prototype.verify=function(e,r,n){return this.ec.verify(e,r,this,void 0,n)};Fi.prototype.inspect=function(){return"<Key priv: "+(this.priv&&this.priv.toString(16,2))+" pub: "+(this.pub&&this.pub.inspect())+" >"}});var Gz=G((JFe,$z)=>{"use strict";p();var T_=Zn(),AA=ts(),Lbe=AA.assert;function P_(t,e){if(t instanceof P_)return t;this._importDER(t,e)||(Lbe(t.r&&t.s,"Signature without r or s"),this.r=new T_(t.r,16),this.s=new T_(t.s,16),t.recoveryParam===void 0?this.recoveryParam=null:this.recoveryParam=t.recoveryParam)}$z.exports=P_;function Ube(){this.place=0}function EA(t,e){var r=t[e.place++];if(!(r&128))return r;var n=r&15;if(n===0||n>4||t[e.place]===0)return!1;for(var i=0,o=0,s=e.place;o<n;o++,s++)i<<=8,i|=t[s],i>>>=0;return i<=127?!1:(e.place=s,i)}function zz(t){for(var e=0,r=t.length-1;!t[e]&&!(t[e+1]&128)&&e<r;)e++;return e===0?t:t.slice(e)}P_.prototype._importDER=function(e,r){e=AA.toArray(e,r);var n=new Ube;if(e[n.place++]!==48)return!1;var i=EA(e,n);if(i===!1||i+n.place!==e.length||e[n.place++]!==2)return!1;var o=EA(e,n);if(o===!1||e[n.place]&128)return!1;var s=e.slice(n.place,o+n.place);if(n.place+=o,e[n.place++]!==2)return!1;var a=EA(e,n);if(a===!1||e.length!==a+n.place||e[n.place]&128)return!1;var c=e.slice(n.place,a+n.place);if(s[0]===0)if(s[1]&128)s=s.slice(1);else return!1;if(c[0]===0)if(c[1]&128)c=c.slice(1);else return!1;return this.r=new T_(s),this.s=new T_(c),this.recoveryParam=null,!0};function SA(t,e){if(e<128){t.push(e);return}var r=1+(Math.log(e)/Math.LN2>>>3);for(t.push(r|128);--r;)t.push(e>>>(r<<3)&255);t.push(e)}P_.prototype.toDER=function(e){var r=this.r.toArray(),n=this.s.toArray();for(r[0]&128&&(r=[0].concat(r)),n[0]&128&&(n=[0].concat(n)),r=zz(r),n=zz(n);!n[0]&&!(n[1]&128);)n=n.slice(1);var i=[2];SA(i,r.length),i=i.concat(r),i.push(2),SA(i,n.length);var o=i.concat(n),s=[48];return SA(s,o.length),s=s.concat(o),AA.encode(s,e)}});var Vz=G((QFe,Wz)=>{"use strict";p();var ma=Zn(),Hz=Lz(),Fbe=ts(),TA=A_(),zbe=d_(),fh=Fbe.assert,PA=Fz(),I_=Gz();function Fs(t){if(!(this instanceof Fs))return new Fs(t);typeof t=="string"&&(fh(Object.prototype.hasOwnProperty.call(TA,t),"Unknown curve "+t),t=TA[t]),t instanceof TA.PresetCurve&&(t={curve:t}),this.curve=t.curve.curve,this.n=this.curve.n,this.nh=this.n.ushrn(1),this.g=this.curve.g,this.g=t.curve.g,this.g.precompute(t.curve.n.bitLength()+1),this.hash=t.hash||t.curve.hash}Wz.exports=Fs;Fs.prototype.keyPair=function(e){return new PA(this,e)};Fs.prototype.keyFromPrivate=function(e,r){return PA.fromPrivate(this,e,r)};Fs.prototype.keyFromPublic=function(e,r){return PA.fromPublic(this,e,r)};Fs.prototype.genKeyPair=function(e){e||(e={});for(var r=new Hz({hash:this.hash,pers:e.pers,persEnc:e.persEnc||"utf8",entropy:e.entropy||zbe(this.hash.hmacStrength),entropyEnc:e.entropy&&e.entropyEnc||"utf8",nonce:this.n.toArray()}),n=this.n.byteLength(),i=this.n.sub(new ma(2));;){var o=new ma(r.generate(n));if(!(o.cmp(i)>0))return o.iaddn(1),this.keyFromPrivate(o)}};Fs.prototype._truncateToN=function(e,r,n){var i;if(ma.isBN(e)||typeof e=="number")e=new ma(e,16),i=e.byteLength();else if(typeof e=="object")i=e.length,e=new ma(e,16);else{var o=e.toString();i=o.length+1>>>1,e=new ma(o,16)}typeof n!="number"&&(n=i*8);var s=n-this.n.bitLength();return s>0&&(e=e.ushrn(s)),!r&&e.cmp(this.n)>=0?e.sub(this.n):e};Fs.prototype.sign=function(e,r,n,i){if(typeof n=="object"&&(i=n,n=null),i||(i={}),typeof e!="string"&&typeof e!="number"&&!ma.isBN(e)){fh(typeof e=="object"&&e&&typeof e.length=="number","Expected message to be an array-like, a hex string, or a BN instance"),fh(e.length>>>0===e.length);for(var o=0;o<e.length;o++)fh((e[o]&255)===e[o])}r=this.keyFromPrivate(r,n),e=this._truncateToN(e,!1,i.msgBitLength),fh(!e.isNeg(),"Can not sign a negative message");var s=this.n.byteLength(),a=r.getPrivate().toArray("be",s),c=e.toArray("be",s);fh(new ma(c).eq(e),"Can not sign message");for(var d=new Hz({hash:this.hash,entropy:a,nonce:c,pers:i.pers,persEnc:i.persEnc||"utf8"}),f=this.n.sub(new ma(1)),u=0;;u++){var m=i.k?i.k(u):new ma(d.generate(this.n.byteLength()));if(m=this._truncateToN(m,!0),!(m.cmpn(1)<=0||m.cmp(f)>=0)){var _=this.g.mul(m);if(!_.isInfinity()){var v=_.getX(),A=v.umod(this.n);if(A.cmpn(0)!==0){var T=m.invm(this.n).mul(A.mul(r.getPrivate()).iadd(e));if(T=T.umod(this.n),T.cmpn(0)!==0){var M=(_.getY().isOdd()?1:0)|(v.cmp(A)!==0?2:0);return i.canonical&&T.cmp(this.nh)>0&&(T=this.n.sub(T),M^=1),new I_({r:A,s:T,recoveryParam:M})}}}}}};Fs.prototype.verify=function(e,r,n,i,o){o||(o={}),e=this._truncateToN(e,!1,o.msgBitLength),n=this.keyFromPublic(n,i),r=new I_(r,"hex");var s=r.r,a=r.s;if(s.cmpn(1)<0||s.cmp(this.n)>=0||a.cmpn(1)<0||a.cmp(this.n)>=0)return!1;var c=a.invm(this.n),d=c.mul(e).umod(this.n),f=c.mul(s).umod(this.n),u;return this.curve._maxwellTrick?(u=this.g.jmulAdd(d,n.getPublic(),f),u.isInfinity()?!1:u.eqXToP(s)):(u=this.g.mulAdd(d,n.getPublic(),f),u.isInfinity()?!1:u.getX().umod(this.n).cmp(s)===0)};Fs.prototype.recoverPubKey=function(t,e,r,n){fh((3&r)===r,"The recovery param is more than two bits"),e=new I_(e,n);var i=this.n,o=new ma(t),s=e.r,a=e.s,c=r&1,d=r>>1;if(s.cmp(this.curve.p.umod(this.curve.n))>=0&&d)throw new Error("Unable to find sencond key candinate");d?s=this.curve.pointFromX(s.add(this.curve.n),c):s=this.curve.pointFromX(s,c);var f=e.r.invm(i),u=i.sub(o).mul(f).umod(i),m=a.mul(f).umod(i);return this.g.mulAdd(u,s,m)};Fs.prototype.getKeyRecoveryParam=function(t,e,r,n){if(e=new I_(e,n),e.recoveryParam!==null)return e.recoveryParam;for(var i=0;i<4;i++){var o;try{o=this.recoverPubKey(t,e,i)}catch{continue}if(o.eq(r))return i}throw new Error("Unable to find valid recovery factor")}});var Jz=G((tze,Yz)=>{"use strict";p();var Fb=ts(),Zz=Fb.assert,Kz=Fb.parseBytes,H0=Fb.cachedProperty;function Xn(t,e){this.eddsa=t,this._secret=Kz(e.secret),t.isPoint(e.pub)?this._pub=e.pub:this._pubBytes=Kz(e.pub)}Xn.fromPublic=function(e,r){return r instanceof Xn?r:new Xn(e,{pub:r})};Xn.fromSecret=function(e,r){return r instanceof Xn?r:new Xn(e,{secret:r})};Xn.prototype.secret=function(){return this._secret};H0(Xn,"pubBytes",function(){return this.eddsa.encodePoint(this.pub())});H0(Xn,"pub",function(){return this._pubBytes?this.eddsa.decodePoint(this._pubBytes):this.eddsa.g.mul(this.priv())});H0(Xn,"privBytes",function(){var e=this.eddsa,r=this.hash(),n=e.encodingLength-1,i=r.slice(0,e.encodingLength);return i[0]&=248,i[n]&=127,i[n]|=64,i});H0(Xn,"priv",function(){return this.eddsa.decodeInt(this.privBytes())});H0(Xn,"hash",function(){return this.eddsa.hash().update(this.secret()).digest()});H0(Xn,"messagePrefix",function(){return this.hash().slice(this.eddsa.encodingLength)});Xn.prototype.sign=function(e){return Zz(this._secret,"KeyPair can only verify"),this.eddsa.sign(e,this)};Xn.prototype.verify=function(e,r){return this.eddsa.verify(e,r,this)};Xn.prototype.getSecret=function(e){return Zz(this._secret,"KeyPair is public only"),Fb.encode(this.secret(),e)};Xn.prototype.getPublic=function(e){return Fb.encode(this.pubBytes(),e)};Yz.exports=Xn});var e$=G((nze,Qz)=>{"use strict";p();var $be=Zn(),R_=ts(),Xz=R_.assert,M_=R_.cachedProperty,Gbe=R_.parseBytes;function uh(t,e){this.eddsa=t,typeof e!="object"&&(e=Gbe(e)),Array.isArray(e)&&(Xz(e.length===t.encodingLength*2,"Signature has invalid size"),e={R:e.slice(0,t.encodingLength),S:e.slice(t.encodingLength)}),Xz(e.R&&e.S,"Signature without R or S"),t.isPoint(e.R)&&(this._R=e.R),e.S instanceof $be&&(this._S=e.S),this._Rencoded=Array.isArray(e.R)?e.R:e.Rencoded,this._Sencoded=Array.isArray(e.S)?e.S:e.Sencoded}M_(uh,"S",function(){return this.eddsa.decodeInt(this.Sencoded())});M_(uh,"R",function(){return this.eddsa.decodePoint(this.Rencoded())});M_(uh,"Rencoded",function(){return this.eddsa.encodePoint(this.R())});M_(uh,"Sencoded",function(){return this.eddsa.encodeInt(this.S())});uh.prototype.toBytes=function(){return this.Rencoded().concat(this.Sencoded())};uh.prototype.toHex=function(){return R_.encode(this.toBytes(),"hex").toUpperCase()};Qz.exports=uh});var o$=G((oze,i$)=>{"use strict";p();var Hbe=S_(),Wbe=A_(),W0=ts(),Vbe=W0.assert,r$=W0.parseBytes,n$=Jz(),t$=e$();function Ro(t){if(Vbe(t==="ed25519","only tested with ed25519 so far"),!(this instanceof Ro))return new Ro(t);t=Wbe[t].curve,this.curve=t,this.g=t.g,this.g.precompute(t.n.bitLength()+1),this.pointClass=t.point().constructor,this.encodingLength=Math.ceil(t.n.bitLength()/8),this.hash=Hbe.sha512}i$.exports=Ro;Ro.prototype.sign=function(e,r){e=r$(e);var n=this.keyFromSecret(r),i=this.hashInt(n.messagePrefix(),e),o=this.g.mul(i),s=this.encodePoint(o),a=this.hashInt(s,n.pubBytes(),e).mul(n.priv()),c=i.add(a).umod(this.curve.n);return this.makeSignature({R:o,S:c,Rencoded:s})};Ro.prototype.verify=function(e,r,n){if(e=r$(e),r=this.makeSignature(r),r.S().gte(r.eddsa.curve.n)||r.S().isNeg())return!1;var i=this.keyFromPublic(n),o=this.hashInt(r.Rencoded(),i.pubBytes(),e),s=this.g.mul(r.S()),a=r.R().add(i.pub().mul(o));return a.eq(s)};Ro.prototype.hashInt=function(){for(var e=this.hash(),r=0;r<arguments.length;r++)e.update(arguments[r]);return W0.intFromLE(e.digest()).umod(this.curve.n)};Ro.prototype.keyFromPublic=function(e){return n$.fromPublic(this,e)};Ro.prototype.keyFromSecret=function(e){return n$.fromSecret(this,e)};Ro.prototype.makeSignature=function(e){return e instanceof t$?e:new t$(this,e)};Ro.prototype.encodePoint=function(e){var r=e.getY().toArray("le",this.encodingLength);return r[this.encodingLength-1]|=e.getX().isOdd()?128:0,r};Ro.prototype.decodePoint=function(e){e=W0.parseBytes(e);var r=e.length-1,n=e.slice(0,r).concat(e[r]&-129),i=(e[r]&128)!==0,o=W0.intFromLE(n);return this.curve.pointFromY(o,i)};Ro.prototype.encodeInt=function(e){return e.toArray("le",this.encodingLength)};Ro.prototype.decodeInt=function(e){return W0.intFromLE(e)};Ro.prototype.isPoint=function(e){return e instanceof this.pointClass}});var k_=G(s$=>{"use strict";p();var lh=s$;lh.version=qF().version;lh.utils=ts();lh.rand=d_();lh.curve=fA();lh.curves=A_();lh.ec=Vz();lh.eddsa=o$()});var a$=G((exports,module)=>{p();var indexOf=function(t,e){if(t.indexOf)return t.indexOf(e);for(var r=0;r<t.length;r++)if(t[r]===e)return r;return-1},Object_keys=function(t){if(Object.keys)return Object.keys(t);var e=[];for(var r in t)e.push(r);return e},forEach=function(t,e){if(t.forEach)return t.forEach(e);for(var r=0;r<t.length;r++)e(t[r],r,t)},defineProp=function(){try{return Object.defineProperty({},"_",{}),function(t,e,r){Object.defineProperty(t,e,{writable:!0,enumerable:!1,configurable:!0,value:r})}}catch{return function(e,r,n){e[r]=n}}}(),globals=["Array","Boolean","Date","Error","EvalError","Function","Infinity","JSON","Math","NaN","Number","Object","RangeError","ReferenceError","RegExp","String","SyntaxError","TypeError","URIError","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","escape","eval","isFinite","isNaN","parseFloat","parseInt","undefined","unescape"];function Context(){}Context.prototype={};var Script=exports.Script=function(e){if(!(this instanceof Script))return new Script(e);this.code=e};Script.prototype.runInContext=function(t){if(!(t instanceof Context))throw new TypeError("needs a 'context' argument.");var e=document.createElement("iframe");e.style||(e.style={}),e.style.display="none",document.body.appendChild(e);var r=e.contentWindow,n=r.eval,i=r.execScript;!n&&i&&(i.call(r,"null"),n=r.eval),forEach(Object_keys(t),function(a){r[a]=t[a]}),forEach(globals,function(a){t[a]&&(r[a]=t[a])});var o=Object_keys(r),s=n.call(r,this.code);return forEach(Object_keys(r),function(a){(a in t||indexOf(o,a)===-1)&&(t[a]=r[a])}),forEach(globals,function(a){a in t||defineProp(t,a,r[a])}),document.body.removeChild(e),s};Script.prototype.runInThisContext=function(){return eval(this.code)};Script.prototype.runInNewContext=function(t){var e=Script.createContext(t),r=this.runInContext(e);return t&&forEach(Object_keys(e),function(n){t[n]=e[n]}),r};forEach(Object_keys(Script.prototype),function(t){exports[t]=Script[t]=function(e){var r=Script(e);return r[t].apply(r,[].slice.call(arguments,1))}});exports.isContext=function(t){return t instanceof Context};exports.createScript=function(t){return exports.Script(t)};exports.createContext=Script.createContext=function(t){var e=new Context;return typeof t=="object"&&forEach(Object_keys(t),function(r){e[r]=t[r]}),e}});var f$=G(d$=>{p();var c$=K0(),Kbe=Je(),Zbe=d$;Zbe.define=function(e,r){return new V0(e,r)};function V0(t,e){this.name=t,this.body=e,this.decoders={},this.encoders={}}V0.prototype._createNamed=function(e){var r;try{r=a$().runInThisContext("(function "+this.name+`(entity) {
12
+ this._initNamed(entity);
13
+ })`)}catch{r=function(i){this._initNamed(i)}}return Kbe(r,e),r.prototype._initNamed=function(i){e.call(this,i)},new r(this)};V0.prototype._getDecoder=function(e){return e=e||"der",this.decoders.hasOwnProperty(e)||(this.decoders[e]=this._createNamed(c$.decoders[e])),this.decoders[e]};V0.prototype.decode=function(e,r,n){return this._getDecoder(r).decode(e,n)};V0.prototype._getEncoder=function(e){return e=e||"der",this.encoders.hasOwnProperty(e)||(this.encoders[e]=this._createNamed(c$.encoders[e])),this.encoders[e]};V0.prototype.encode=function(e,r,n){return this._getEncoder(r).encode(e,n)}});var l$=G(u$=>{p();var Ybe=Je();function zs(t){this._reporterState={obj:null,path:[],options:t||{},errors:[]}}u$.Reporter=zs;zs.prototype.isError=function(e){return e instanceof Z0};zs.prototype.save=function(){var e=this._reporterState;return{obj:e.obj,pathLen:e.path.length}};zs.prototype.restore=function(e){var r=this._reporterState;r.obj=e.obj,r.path=r.path.slice(0,e.pathLen)};zs.prototype.enterKey=function(e){return this._reporterState.path.push(e)};zs.prototype.exitKey=function(e){var r=this._reporterState;r.path=r.path.slice(0,e-1)};zs.prototype.leaveKey=function(e,r,n){var i=this._reporterState;this.exitKey(e),i.obj!==null&&(i.obj[r]=n)};zs.prototype.path=function(){return this._reporterState.path.join("/")};zs.prototype.enterObject=function(){var e=this._reporterState,r=e.obj;return e.obj={},r};zs.prototype.leaveObject=function(e){var r=this._reporterState,n=r.obj;return r.obj=e,n};zs.prototype.error=function(e){var r,n=this._reporterState,i=e instanceof Z0;if(i?r=e:r=new Z0(n.path.map(function(o){return"["+JSON.stringify(o)+"]"}).join(""),e.message||e,e.stack),!n.options.partial)throw r;return i||n.errors.push(r),r};zs.prototype.wrapResult=function(e){var r=this._reporterState;return r.options.partial?{result:this.isError(e)?null:e,errors:r.errors}:e};function Z0(t,e){this.path=t,this.rethrow(e)}Ybe(Z0,Error);Z0.prototype.rethrow=function(e){if(this.message=e+" at: "+(this.path||"(shallow)"),Error.captureStackTrace&&Error.captureStackTrace(this,Z0),!this.stack)try{throw new Error(this.message)}catch(r){this.stack=r.stack}return this}});var RA=G(IA=>{p();var Jbe=Je(),D_=Y0().Reporter,zb=jr().Buffer;function pc(t,e){if(D_.call(this,e),!zb.isBuffer(t)){this.error("Input not Buffer");return}this.base=t,this.offset=0,this.length=t.length}Jbe(pc,D_);IA.DecoderBuffer=pc;pc.prototype.save=function(){return{offset:this.offset,reporter:D_.prototype.save.call(this)}};pc.prototype.restore=function(e){var r=new pc(this.base);return r.offset=e.offset,r.length=this.offset,this.offset=e.offset,D_.prototype.restore.call(this,e.reporter),r};pc.prototype.isEmpty=function(){return this.offset===this.length};pc.prototype.readUInt8=function(e){return this.offset+1<=this.length?this.base.readUInt8(this.offset++,!0):this.error(e||"DecoderBuffer overrun")};pc.prototype.skip=function(e,r){if(!(this.offset+e<=this.length))return this.error(r||"DecoderBuffer overrun");var n=new pc(this.base);return n._reporterState=this._reporterState,n.offset=this.offset,n.length=this.offset+e,this.offset+=e,n};pc.prototype.raw=function(e){return this.base.slice(e?e.offset:this.offset,this.length)};function B_(t,e){if(Array.isArray(t))this.length=0,this.value=t.map(function(r){return r instanceof B_||(r=new B_(r,e)),this.length+=r.length,r},this);else if(typeof t=="number"){if(!(0<=t&&t<=255))return e.error("non-byte EncoderBuffer value");this.value=t,this.length=1}else if(typeof t=="string")this.value=t,this.length=zb.byteLength(t);else if(zb.isBuffer(t))this.value=t,this.length=t.length;else return e.error("Unsupported type: "+typeof t)}IA.EncoderBuffer=B_;B_.prototype.join=function(e,r){return e||(e=new zb(this.length)),r||(r=0),this.length===0||(Array.isArray(this.value)?this.value.forEach(function(n){n.join(e,r),r+=n.length}):(typeof this.value=="number"?e[r]=this.value:typeof this.value=="string"?e.write(this.value,r):zb.isBuffer(this.value)&&this.value.copy(e,r),r+=this.length)),e}});var m$=G((yze,p$)=>{p();var Xbe=Y0().Reporter,Qbe=Y0().EncoderBuffer,eve=Y0().DecoderBuffer,io=es(),h$=["seq","seqof","set","setof","objid","bool","gentime","utctime","null_","enum","int","objDesc","bitstr","bmpstr","charstr","genstr","graphstr","ia5str","iso646str","numstr","octstr","printstr","t61str","unistr","utf8str","videostr"],tve=["key","obj","use","optional","explicit","implicit","def","choice","any","contains"].concat(h$),rve=["_peekTag","_decodeTag","_use","_decodeStr","_decodeObjid","_decodeTime","_decodeNull","_decodeInt","_decodeBool","_decodeList","_encodeComposite","_encodeStr","_encodeObjid","_encodeTime","_encodeNull","_encodeInt","_encodeBool"];function _r(t,e){var r={};this._baseState=r,r.enc=t,r.parent=e||null,r.children=null,r.tag=null,r.args=null,r.reverseArgs=null,r.choice=null,r.optional=!1,r.any=!1,r.obj=!1,r.use=null,r.useDecoder=null,r.key=null,r.default=null,r.explicit=null,r.implicit=null,r.contains=null,r.parent||(r.children=[],this._wrap())}p$.exports=_r;var nve=["enc","parent","children","tag","args","reverseArgs","choice","optional","any","obj","use","alteredUse","key","default","explicit","implicit","contains"];_r.prototype.clone=function(){var e=this._baseState,r={};nve.forEach(function(i){r[i]=e[i]});var n=new this.constructor(r.parent);return n._baseState=r,n};_r.prototype._wrap=function(){var e=this._baseState;tve.forEach(function(r){this[r]=function(){var i=new this.constructor(this);return e.children.push(i),i[r].apply(i,arguments)}},this)};_r.prototype._init=function(e){var r=this._baseState;io(r.parent===null),e.call(this),r.children=r.children.filter(function(n){return n._baseState.parent===this},this),io.equal(r.children.length,1,"Root node can have only one child")};_r.prototype._useArgs=function(e){var r=this._baseState,n=e.filter(function(i){return i instanceof this.constructor},this);e=e.filter(function(i){return!(i instanceof this.constructor)},this),n.length!==0&&(io(r.children===null),r.children=n,n.forEach(function(i){i._baseState.parent=this},this)),e.length!==0&&(io(r.args===null),r.args=e,r.reverseArgs=e.map(function(i){if(typeof i!="object"||i.constructor!==Object)return i;var o={};return Object.keys(i).forEach(function(s){s==(s|0)&&(s|=0);var a=i[s];o[a]=s}),o}))};rve.forEach(function(t){_r.prototype[t]=function(){var r=this._baseState;throw new Error(t+" not implemented for encoding: "+r.enc)}});h$.forEach(function(t){_r.prototype[t]=function(){var r=this._baseState,n=Array.prototype.slice.call(arguments);return io(r.tag===null),r.tag=t,this._useArgs(n),this}});_r.prototype.use=function(e){io(e);var r=this._baseState;return io(r.use===null),r.use=e,this};_r.prototype.optional=function(){var e=this._baseState;return e.optional=!0,this};_r.prototype.def=function(e){var r=this._baseState;return io(r.default===null),r.default=e,r.optional=!0,this};_r.prototype.explicit=function(e){var r=this._baseState;return io(r.explicit===null&&r.implicit===null),r.explicit=e,this};_r.prototype.implicit=function(e){var r=this._baseState;return io(r.explicit===null&&r.implicit===null),r.implicit=e,this};_r.prototype.obj=function(){var e=this._baseState,r=Array.prototype.slice.call(arguments);return e.obj=!0,r.length!==0&&this._useArgs(r),this};_r.prototype.key=function(e){var r=this._baseState;return io(r.key===null),r.key=e,this};_r.prototype.any=function(){var e=this._baseState;return e.any=!0,this};_r.prototype.choice=function(e){var r=this._baseState;return io(r.choice===null),r.choice=e,this._useArgs(Object.keys(e).map(function(n){return e[n]})),this};_r.prototype.contains=function(e){var r=this._baseState;return io(r.use===null),r.contains=e,this};_r.prototype._decode=function(e,r){var n=this._baseState;if(n.parent===null)return e.wrapResult(n.children[0]._decode(e,r));var i=n.default,o=!0,s=null;if(n.key!==null&&(s=e.enterKey(n.key)),n.optional){var a=null;if(n.explicit!==null?a=n.explicit:n.implicit!==null?a=n.implicit:n.tag!==null&&(a=n.tag),a===null&&!n.any){var c=e.save();try{n.choice===null?this._decodeGeneric(n.tag,e,r):this._decodeChoice(e,r),o=!0}catch{o=!1}e.restore(c)}else if(o=this._peekTag(e,a,n.any),e.isError(o))return o}var d;if(n.obj&&o&&(d=e.enterObject()),o){if(n.explicit!==null){var f=this._decodeTag(e,n.explicit);if(e.isError(f))return f;e=f}var u=e.offset;if(n.use===null&&n.choice===null){if(n.any)var c=e.save();var m=this._decodeTag(e,n.implicit!==null?n.implicit:n.tag,n.any);if(e.isError(m))return m;n.any?i=e.raw(c):e=m}if(r&&r.track&&n.tag!==null&&r.track(e.path(),u,e.length,"tagged"),r&&r.track&&n.tag!==null&&r.track(e.path(),e.offset,e.length,"content"),n.any?i=i:n.choice===null?i=this._decodeGeneric(n.tag,e,r):i=this._decodeChoice(e,r),e.isError(i))return i;if(!n.any&&n.choice===null&&n.children!==null&&n.children.forEach(function(A){A._decode(e,r)}),n.contains&&(n.tag==="octstr"||n.tag==="bitstr")){var _=new eve(i);i=this._getUse(n.contains,e._reporterState.obj)._decode(_,r)}}return n.obj&&o&&(i=e.leaveObject(d)),n.key!==null&&(i!==null||o===!0)?e.leaveKey(s,n.key,i):s!==null&&e.exitKey(s),i};_r.prototype._decodeGeneric=function(e,r,n){var i=this._baseState;return e==="seq"||e==="set"?null:e==="seqof"||e==="setof"?this._decodeList(r,e,i.args[0],n):/str$/.test(e)?this._decodeStr(r,e,n):e==="objid"&&i.args?this._decodeObjid(r,i.args[0],i.args[1],n):e==="objid"?this._decodeObjid(r,null,null,n):e==="gentime"||e==="utctime"?this._decodeTime(r,e,n):e==="null_"?this._decodeNull(r,n):e==="bool"?this._decodeBool(r,n):e==="objDesc"?this._decodeStr(r,e,n):e==="int"||e==="enum"?this._decodeInt(r,i.args&&i.args[0],n):i.use!==null?this._getUse(i.use,r._reporterState.obj)._decode(r,n):r.error("unknown tag: "+e)};_r.prototype._getUse=function(e,r){var n=this._baseState;return n.useDecoder=this._use(e,r),io(n.useDecoder._baseState.parent===null),n.useDecoder=n.useDecoder._baseState.children[0],n.implicit!==n.useDecoder._baseState.implicit&&(n.useDecoder=n.useDecoder.clone(),n.useDecoder._baseState.implicit=n.implicit),n.useDecoder};_r.prototype._decodeChoice=function(e,r){var n=this._baseState,i=null,o=!1;return Object.keys(n.choice).some(function(s){var a=e.save(),c=n.choice[s];try{var d=c._decode(e,r);if(e.isError(d))return!1;i={type:s,value:d},o=!0}catch{return e.restore(a),!1}return!0},this),o?i:e.error("Choice not matched")};_r.prototype._createEncoderBuffer=function(e){return new Qbe(e,this.reporter)};_r.prototype._encode=function(e,r,n){var i=this._baseState;if(!(i.default!==null&&i.default===e)){var o=this._encodeValue(e,r,n);if(o!==void 0&&!this._skipDefault(o,r,n))return o}};_r.prototype._encodeValue=function(e,r,n){var i=this._baseState;if(i.parent===null)return i.children[0]._encode(e,r||new Xbe);var c=null;if(this.reporter=r,i.optional&&e===void 0)if(i.default!==null)e=i.default;else return;var o=null,s=!1;if(i.any)c=this._createEncoderBuffer(e);else if(i.choice)c=this._encodeChoice(e,r);else if(i.contains)o=this._getUse(i.contains,n)._encode(e,r),s=!0;else if(i.children)o=i.children.map(function(u){if(u._baseState.tag==="null_")return u._encode(null,r,e);if(u._baseState.key===null)return r.error("Child should have a key");var m=r.enterKey(u._baseState.key);if(typeof e!="object")return r.error("Child expected, but input is not object");var _=u._encode(e[u._baseState.key],r,e);return r.leaveKey(m),_},this).filter(function(u){return u}),o=this._createEncoderBuffer(o);else if(i.tag==="seqof"||i.tag==="setof"){if(!(i.args&&i.args.length===1))return r.error("Too many args for : "+i.tag);if(!Array.isArray(e))return r.error("seqof/setof, but data is not Array");var a=this.clone();a._baseState.implicit=null,o=this._createEncoderBuffer(e.map(function(u){var m=this._baseState;return this._getUse(m.args[0],e)._encode(u,r)},a))}else i.use!==null?c=this._getUse(i.use,n)._encode(e,r):(o=this._encodePrimitive(i.tag,e),s=!0);var c;if(!i.any&&i.choice===null){var d=i.implicit!==null?i.implicit:i.tag,f=i.implicit===null?"universal":"context";d===null?i.use===null&&r.error("Tag could be omitted only for .use()"):i.use===null&&(c=this._encodeComposite(d,s,f,o))}return i.explicit!==null&&(c=this._encodeComposite(i.explicit,!1,"context",c)),c};_r.prototype._encodeChoice=function(e,r){var n=this._baseState,i=n.choice[e.type];return i||io(!1,e.type+" not found in "+JSON.stringify(Object.keys(n.choice))),i._encode(e.value,r)};_r.prototype._encodePrimitive=function(e,r){var n=this._baseState;if(/str$/.test(e))return this._encodeStr(r,e);if(e==="objid"&&n.args)return this._encodeObjid(r,n.reverseArgs[0],n.args[1]);if(e==="objid")return this._encodeObjid(r,null,null);if(e==="gentime"||e==="utctime")return this._encodeTime(r,e);if(e==="null_")return this._encodeNull();if(e==="int"||e==="enum")return this._encodeInt(r,n.args&&n.reverseArgs[0]);if(e==="bool")return this._encodeBool(r);if(e==="objDesc")return this._encodeStr(r,e);throw new Error("Unsupported tag: "+e)};_r.prototype._isNumstr=function(e){return/^[0-9 ]*$/.test(e)};_r.prototype._isPrintstr=function(e){return/^[A-Za-z0-9 '\(\)\+,\-\.\/:=\?]*$/.test(e)}});var Y0=G(y$=>{p();var C_=y$;C_.Reporter=l$().Reporter;C_.DecoderBuffer=RA().DecoderBuffer;C_.EncoderBuffer=RA().EncoderBuffer;C_.Node=m$()});var b$=G(hh=>{p();var g$=MA();hh.tagClass={0:"universal",1:"application",2:"context",3:"private"};hh.tagClassByName=g$._reverse(hh.tagClass);hh.tag={0:"end",1:"bool",2:"int",3:"bitstr",4:"octstr",5:"null_",6:"objid",7:"objDesc",8:"external",9:"real",10:"enum",11:"embed",12:"utf8str",13:"relativeOid",16:"seq",17:"set",18:"numstr",19:"printstr",20:"t61str",21:"videostr",22:"ia5str",23:"utctime",24:"gentime",25:"graphstr",26:"iso646str",27:"genstr",28:"unistr",29:"charstr",30:"bmpstr"};hh.tagByName=g$._reverse(hh.tag)});var MA=G(w$=>{p();var v$=w$;v$._reverse=function(e){var r={};return Object.keys(e).forEach(function(n){(n|0)==n&&(n=n|0);var i=e[n];r[i]=n}),r};v$.der=b$()});var DA=G((Sze,S$)=>{p();var ive=Je(),kA=K0(),O_=kA.base,ove=kA.bignum,_$=kA.constants.der;function x$(t){this.enc="der",this.name=t.name,this.entity=t,this.tree=new rs,this.tree._init(t.body)}S$.exports=x$;x$.prototype.decode=function(e,r){return e instanceof O_.DecoderBuffer||(e=new O_.DecoderBuffer(e,r)),this.tree._decode(e,r)};function rs(t){O_.Node.call(this,"der",t)}ive(rs,O_.Node);rs.prototype._peekTag=function(e,r,n){if(e.isEmpty())return!1;var i=e.save(),o=BA(e,'Failed to peek tag: "'+r+'"');return e.isError(o)?o:(e.restore(i),o.tag===r||o.tagStr===r||o.tagStr+"of"===r||n)};rs.prototype._decodeTag=function(e,r,n){var i=BA(e,'Failed to decode tag of "'+r+'"');if(e.isError(i))return i;var o=E$(e,i.primitive,'Failed to get length of "'+r+'"');if(e.isError(o))return o;if(!n&&i.tag!==r&&i.tagStr!==r&&i.tagStr+"of"!==r)return e.error('Failed to match tag: "'+r+'"');if(i.primitive||o!==null)return e.skip(o,'Failed to match body of: "'+r+'"');var s=e.save(),a=this._skipUntilEnd(e,'Failed to skip indefinite length body: "'+this.tag+'"');return e.isError(a)?a:(o=e.offset-s.offset,e.restore(s),e.skip(o,'Failed to match body of: "'+r+'"'))};rs.prototype._skipUntilEnd=function(e,r){for(;;){var n=BA(e,r);if(e.isError(n))return n;var i=E$(e,n.primitive,r);if(e.isError(i))return i;var o;if(n.primitive||i!==null?o=e.skip(i):o=this._skipUntilEnd(e,r),e.isError(o))return o;if(n.tagStr==="end")break}};rs.prototype._decodeList=function(e,r,n,i){for(var o=[];!e.isEmpty();){var s=this._peekTag(e,"end");if(e.isError(s))return s;var a=n.decode(e,"der",i);if(e.isError(a)&&s)break;o.push(a)}return o};rs.prototype._decodeStr=function(e,r){if(r==="bitstr"){var n=e.readUInt8();return e.isError(n)?n:{unused:n,data:e.raw()}}else if(r==="bmpstr"){var i=e.raw();if(i.length%2===1)return e.error("Decoding of string type: bmpstr length mismatch");for(var o="",s=0;s<i.length/2;s++)o+=String.fromCharCode(i.readUInt16BE(s*2));return o}else if(r==="numstr"){var a=e.raw().toString("ascii");return this._isNumstr(a)?a:e.error("Decoding of string type: numstr unsupported characters")}else{if(r==="octstr")return e.raw();if(r==="objDesc")return e.raw();if(r==="printstr"){var c=e.raw().toString("ascii");return this._isPrintstr(c)?c:e.error("Decoding of string type: printstr unsupported characters")}else return/str$/.test(r)?e.raw().toString():e.error("Decoding of string type: "+r+" unsupported")}};rs.prototype._decodeObjid=function(e,r,n){for(var i,o=[],s=0;!e.isEmpty();){var a=e.readUInt8();s<<=7,s|=a&127,a&128||(o.push(s),s=0)}a&128&&o.push(s);var c=o[0]/40|0,d=o[0]%40;if(n?i=o:i=[c,d].concat(o.slice(1)),r){var f=r[i.join(" ")];f===void 0&&(f=r[i.join(".")]),f!==void 0&&(i=f)}return i};rs.prototype._decodeTime=function(e,r){var n=e.raw().toString();if(r==="gentime")var i=n.slice(0,4)|0,o=n.slice(4,6)|0,s=n.slice(6,8)|0,a=n.slice(8,10)|0,c=n.slice(10,12)|0,d=n.slice(12,14)|0;else if(r==="utctime"){var i=n.slice(0,2)|0,o=n.slice(2,4)|0,s=n.slice(4,6)|0,a=n.slice(6,8)|0,c=n.slice(8,10)|0,d=n.slice(10,12)|0;i<70?i=2e3+i:i=1900+i}else return e.error("Decoding "+r+" time is not supported yet");return Date.UTC(i,o-1,s,a,c,d,0)};rs.prototype._decodeNull=function(e){return null};rs.prototype._decodeBool=function(e){var r=e.readUInt8();return e.isError(r)?r:r!==0};rs.prototype._decodeInt=function(e,r){var n=e.raw(),i=new ove(n);return r&&(i=r[i.toString(10)]||i),i};rs.prototype._use=function(e,r){return typeof e=="function"&&(e=e(r)),e._getDecoder("der").tree};function BA(t,e){var r=t.readUInt8(e);if(t.isError(r))return r;var n=_$.tagClass[r>>6],i=(r&32)===0;if((r&31)===31){var o=r;for(r=0;(o&128)===128;){if(o=t.readUInt8(e),t.isError(o))return o;r<<=7,r|=o&127}}else r&=31;var s=_$.tag[r];return{cls:n,primitive:i,tag:r,tagStr:s}}function E$(t,e,r){var n=t.readUInt8(r);if(t.isError(n))return n;if(!e&&n===128)return null;if(!(n&128))return n;var i=n&127;if(i>4)return t.error("length octect is too long");n=0;for(var o=0;o<i;o++){n<<=8;var s=t.readUInt8(r);if(t.isError(s))return s;n|=s}return n}});var T$=G((Tze,A$)=>{p();var sve=Je(),ave=jr().Buffer,CA=DA();function OA(t){CA.call(this,t),this.enc="pem"}sve(OA,CA);A$.exports=OA;OA.prototype.decode=function(e,r){for(var n=e.toString().split(/[\r\n]+/g),i=r.label.toUpperCase(),o=/^-----(BEGIN|END) ([^-]+)-----$/,s=-1,a=-1,c=0;c<n.length;c++){var d=n[c].match(o);if(d!==null&&d[2]===i)if(s===-1){if(d[1]!=="BEGIN")break;s=c}else{if(d[1]!=="END")break;a=c;break}}if(s===-1||a===-1)throw new Error("PEM section not found for: "+i);var f=n.slice(s+1,a).join("");f.replace(/[^a-z0-9\+\/=]+/gi,"");var u=new ave(f,"base64");return CA.prototype.decode.call(this,u,r)}});var R$=G(I$=>{p();var P$=I$;P$.der=DA();P$.pem=T$()});var NA=G((Mze,D$)=>{p();var cve=Je(),Dd=jr().Buffer,M$=K0(),k$=M$.base,jA=M$.constants.der;function B$(t){this.enc="der",this.name=t.name,this.entity=t,this.tree=new ya,this.tree._init(t.body)}D$.exports=B$;B$.prototype.encode=function(e,r){return this.tree._encode(e,r).join()};function ya(t){k$.Node.call(this,"der",t)}cve(ya,k$.Node);ya.prototype._encodeComposite=function(e,r,n,i){var o=dve(e,r,n,this.reporter);if(i.length<128){var c=new Dd(2);return c[0]=o,c[1]=i.length,this._createEncoderBuffer([c,i])}for(var s=1,a=i.length;a>=256;a>>=8)s++;var c=new Dd(1+1+s);c[0]=o,c[1]=128|s;for(var a=1+s,d=i.length;d>0;a--,d>>=8)c[a]=d&255;return this._createEncoderBuffer([c,i])};ya.prototype._encodeStr=function(e,r){if(r==="bitstr")return this._createEncoderBuffer([e.unused|0,e.data]);if(r==="bmpstr"){for(var n=new Dd(e.length*2),i=0;i<e.length;i++)n.writeUInt16BE(e.charCodeAt(i),i*2);return this._createEncoderBuffer(n)}else return r==="numstr"?this._isNumstr(e)?this._createEncoderBuffer(e):this.reporter.error("Encoding of string type: numstr supports only digits and space"):r==="printstr"?this._isPrintstr(e)?this._createEncoderBuffer(e):this.reporter.error("Encoding of string type: printstr supports only latin upper and lower case letters, digits, space, apostrophe, left and rigth parenthesis, plus sign, comma, hyphen, dot, slash, colon, equal sign, question mark"):/str$/.test(r)?this._createEncoderBuffer(e):r==="objDesc"?this._createEncoderBuffer(e):this.reporter.error("Encoding of string type: "+r+" unsupported")};ya.prototype._encodeObjid=function(e,r,n){if(typeof e=="string"){if(!r)return this.reporter.error("string objid given, but no values map found");if(!r.hasOwnProperty(e))return this.reporter.error("objid not found in values map");e=r[e].split(/[\s\.]+/g);for(var i=0;i<e.length;i++)e[i]|=0}else if(Array.isArray(e)){e=e.slice();for(var i=0;i<e.length;i++)e[i]|=0}if(!Array.isArray(e))return this.reporter.error("objid() should be either array or string, got: "+JSON.stringify(e));if(!n){if(e[1]>=40)return this.reporter.error("Second objid identifier OOB");e.splice(0,2,e[0]*40+e[1])}for(var o=0,i=0;i<e.length;i++){var s=e[i];for(o++;s>=128;s>>=7)o++}for(var a=new Dd(o),c=a.length-1,i=e.length-1;i>=0;i--){var s=e[i];for(a[c--]=s&127;(s>>=7)>0;)a[c--]=128|s&127}return this._createEncoderBuffer(a)};function $s(t){return t<10?"0"+t:t}ya.prototype._encodeTime=function(e,r){var n,i=new Date(e);return r==="gentime"?n=[$s(i.getFullYear()),$s(i.getUTCMonth()+1),$s(i.getUTCDate()),$s(i.getUTCHours()),$s(i.getUTCMinutes()),$s(i.getUTCSeconds()),"Z"].join(""):r==="utctime"?n=[$s(i.getFullYear()%100),$s(i.getUTCMonth()+1),$s(i.getUTCDate()),$s(i.getUTCHours()),$s(i.getUTCMinutes()),$s(i.getUTCSeconds()),"Z"].join(""):this.reporter.error("Encoding "+r+" time is not supported yet"),this._encodeStr(n,"octstr")};ya.prototype._encodeNull=function(){return this._createEncoderBuffer("")};ya.prototype._encodeInt=function(e,r){if(typeof e=="string"){if(!r)return this.reporter.error("String int or enum given, but no values map");if(!r.hasOwnProperty(e))return this.reporter.error("Values map doesn't contain: "+JSON.stringify(e));e=r[e]}if(typeof e!="number"&&!Dd.isBuffer(e)){var n=e.toArray();!e.sign&&n[0]&128&&n.unshift(0),e=new Dd(n)}if(Dd.isBuffer(e)){var i=e.length;e.length===0&&i++;var s=new Dd(i);return e.copy(s),e.length===0&&(s[0]=0),this._createEncoderBuffer(s)}if(e<128)return this._createEncoderBuffer(e);if(e<256)return this._createEncoderBuffer([0,e]);for(var i=1,o=e;o>=256;o>>=8)i++;for(var s=new Array(i),o=s.length-1;o>=0;o--)s[o]=e&255,e>>=8;return s[0]&128&&s.unshift(0),this._createEncoderBuffer(new Dd(s))};ya.prototype._encodeBool=function(e){return this._createEncoderBuffer(e?255:0)};ya.prototype._use=function(e,r){return typeof e=="function"&&(e=e(r)),e._getEncoder("der").tree};ya.prototype._skipDefault=function(e,r,n){var i=this._baseState,o;if(i.default===null)return!1;var s=e.join();if(i.defaultBuffer===void 0&&(i.defaultBuffer=this._encodeValue(i.default,r,n).join()),s.length!==i.defaultBuffer.length)return!1;for(o=0;o<s.length;o++)if(s[o]!==i.defaultBuffer[o])return!1;return!0};function dve(t,e,r,n){var i;if(t==="seqof"?t="seq":t==="setof"&&(t="set"),jA.tagByName.hasOwnProperty(t))i=jA.tagByName[t];else if(typeof t=="number"&&(t|0)===t)i=t;else return n.error("Unknown tag: "+t);return i>=31?n.error("Multi-octet tag encoding unsupported"):(e||(i|=32),i|=jA.tagClassByName[r||"universal"]<<6,i)}});var O$=G((Bze,C$)=>{p();var fve=Je(),qA=NA();function LA(t){qA.call(this,t),this.enc="pem"}fve(LA,qA);C$.exports=LA;LA.prototype.encode=function(e,r){for(var n=qA.prototype.encode.call(this,e),i=n.toString("base64"),o=["-----BEGIN "+r.label+"-----"],s=0;s<i.length;s+=64)o.push(i.slice(s,s+64));return o.push("-----END "+r.label+"-----"),o.join(`
14
+ `)}});var q$=G(N$=>{p();var j$=N$;j$.der=NA();j$.pem=O$()});var K0=G(L$=>{p();var J0=L$;J0.bignum=Zn();J0.define=f$().define;J0.base=Y0();J0.constants=MA();J0.decoders=R$();J0.encoders=q$()});var $$=G((qze,z$)=>{"use strict";p();var ga=K0(),U$=ga.define("Time",function(){this.choice({utcTime:this.utctime(),generalTime:this.gentime()})}),uve=ga.define("AttributeTypeValue",function(){this.seq().obj(this.key("type").objid(),this.key("value").any())}),UA=ga.define("AlgorithmIdentifier",function(){this.seq().obj(this.key("algorithm").objid(),this.key("parameters").optional(),this.key("curve").objid().optional())}),lve=ga.define("SubjectPublicKeyInfo",function(){this.seq().obj(this.key("algorithm").use(UA),this.key("subjectPublicKey").bitstr())}),hve=ga.define("RelativeDistinguishedName",function(){this.setof(uve)}),pve=ga.define("RDNSequence",function(){this.seqof(hve)}),F$=ga.define("Name",function(){this.choice({rdnSequence:this.use(pve)})}),mve=ga.define("Validity",function(){this.seq().obj(this.key("notBefore").use(U$),this.key("notAfter").use(U$))}),yve=ga.define("Extension",function(){this.seq().obj(this.key("extnID").objid(),this.key("critical").bool().def(!1),this.key("extnValue").octstr())}),gve=ga.define("TBSCertificate",function(){this.seq().obj(this.key("version").explicit(0).int().optional(),this.key("serialNumber").int(),this.key("signature").use(UA),this.key("issuer").use(F$),this.key("validity").use(mve),this.key("subject").use(F$),this.key("subjectPublicKeyInfo").use(lve),this.key("issuerUniqueID").implicit(1).bitstr().optional(),this.key("subjectUniqueID").implicit(2).bitstr().optional(),this.key("extensions").explicit(3).seqof(yve).optional())}),bve=ga.define("X509Certificate",function(){this.seq().obj(this.key("tbsCertificate").use(gve),this.key("signatureAlgorithm").use(UA),this.key("signatureValue").bitstr())});z$.exports=bve});var H$=G(va=>{"use strict";p();var ba=K0();va.certificate=$$();var vve=ba.define("RSAPrivateKey",function(){this.seq().obj(this.key("version").int(),this.key("modulus").int(),this.key("publicExponent").int(),this.key("privateExponent").int(),this.key("prime1").int(),this.key("prime2").int(),this.key("exponent1").int(),this.key("exponent2").int(),this.key("coefficient").int())});va.RSAPrivateKey=vve;var wve=ba.define("RSAPublicKey",function(){this.seq().obj(this.key("modulus").int(),this.key("publicExponent").int())});va.RSAPublicKey=wve;var G$=ba.define("AlgorithmIdentifier",function(){this.seq().obj(this.key("algorithm").objid(),this.key("none").null_().optional(),this.key("curve").objid().optional(),this.key("params").seq().obj(this.key("p").int(),this.key("q").int(),this.key("g").int()).optional())}),_ve=ba.define("SubjectPublicKeyInfo",function(){this.seq().obj(this.key("algorithm").use(G$),this.key("subjectPublicKey").bitstr())});va.PublicKey=_ve;var xve=ba.define("PrivateKeyInfo",function(){this.seq().obj(this.key("version").int(),this.key("algorithm").use(G$),this.key("subjectPrivateKey").octstr())});va.PrivateKey=xve;var Eve=ba.define("EncryptedPrivateKeyInfo",function(){this.seq().obj(this.key("algorithm").seq().obj(this.key("id").objid(),this.key("decrypt").seq().obj(this.key("kde").seq().obj(this.key("id").objid(),this.key("kdeparams").seq().obj(this.key("salt").octstr(),this.key("iters").int())),this.key("cipher").seq().obj(this.key("algo").objid(),this.key("iv").octstr()))),this.key("subjectPrivateKey").octstr())});va.EncryptedPrivateKey=Eve;var Sve=ba.define("DSAPrivateKey",function(){this.seq().obj(this.key("version").int(),this.key("p").int(),this.key("q").int(),this.key("g").int(),this.key("pub_key").int(),this.key("priv_key").int())});va.DSAPrivateKey=Sve;va.DSAparam=ba.define("DSAparam",function(){this.int()});var Ave=ba.define("ECParameters",function(){this.choice({namedCurve:this.objid()})}),Tve=ba.define("ECPrivateKey",function(){this.seq().obj(this.key("version").int(),this.key("privateKey").octstr(),this.key("parameters").optional().explicit(0).use(Ave),this.key("publicKey").optional().explicit(1).bitstr())});va.ECPrivateKey=Tve;va.signature=ba.define("signature",function(){this.seq().obj(this.key("r").int(),this.key("s").int())})});var W$=G((zze,Pve)=>{Pve.exports={"2.16.840.1.101.3.4.1.1":"aes-128-ecb","2.16.840.1.101.3.4.1.2":"aes-128-cbc","2.16.840.1.101.3.4.1.3":"aes-128-ofb","2.16.840.1.101.3.4.1.4":"aes-128-cfb","2.16.840.1.101.3.4.1.21":"aes-192-ecb","2.16.840.1.101.3.4.1.22":"aes-192-cbc","2.16.840.1.101.3.4.1.23":"aes-192-ofb","2.16.840.1.101.3.4.1.24":"aes-192-cfb","2.16.840.1.101.3.4.1.41":"aes-256-ecb","2.16.840.1.101.3.4.1.42":"aes-256-cbc","2.16.840.1.101.3.4.1.43":"aes-256-ofb","2.16.840.1.101.3.4.1.44":"aes-256-cfb"}});var K$=G(($ze,V$)=>{"use strict";p();var Ive=/Proc-Type: 4,ENCRYPTED[\n\r]+DEK-Info: AES-((?:128)|(?:192)|(?:256))-CBC,([0-9A-H]+)[\n\r]+([0-9A-z\n\r+/=]+)[\n\r]+/m,Rve=/^-----BEGIN ((?:.*? KEY)|CERTIFICATE)-----/m,Mve=/^-----BEGIN ((?:.*? KEY)|CERTIFICATE)-----([0-9A-z\n\r+/=]+)-----END \1-----$/m,kve=Cb(),Bve=c_(),j_=it().Buffer;V$.exports=function(t,e){var r=t.toString(),n=r.match(Ive),i;if(n){var s="aes"+n[1],a=j_.from(n[2],"hex"),c=j_.from(n[3].replace(/[\r\n]/g,""),"base64"),d=kve(e,a.slice(0,8),parseInt(n[1],10)).key,f=[],u=Bve.createDecipheriv(s,d,a);f.push(u.update(c)),f.push(u.final()),i=j_.concat(f)}else{var o=r.match(Mve);i=j_.from(o[2].replace(/[\r\n]/g,""),"base64")}var m=r.match(Rve)[1];return{tag:m,data:i}}});var $b=G((Hze,Y$)=>{"use strict";p();var Mo=H$(),Dve=W$(),Cve=K$(),Ove=c_(),jve=MS().pbkdf2Sync,FA=it().Buffer;function Nve(t,e){var r=t.algorithm.decrypt.kde.kdeparams.salt,n=parseInt(t.algorithm.decrypt.kde.kdeparams.iters.toString(),10),i=Dve[t.algorithm.decrypt.cipher.algo.join(".")],o=t.algorithm.decrypt.cipher.iv,s=t.subjectPrivateKey,a=parseInt(i.split("-")[1],10)/8,c=jve(e,r,n,a,"sha1"),d=Ove.createDecipheriv(i,c,o),f=[];return f.push(d.update(s)),f.push(d.final()),FA.concat(f)}function Z$(t){var e;typeof t=="object"&&!FA.isBuffer(t)&&(e=t.passphrase,t=t.key),typeof t=="string"&&(t=FA.from(t));var r=Cve(t,e),n=r.tag,i=r.data,o,s;switch(n){case"CERTIFICATE":s=Mo.certificate.decode(i,"der").tbsCertificate.subjectPublicKeyInfo;case"PUBLIC KEY":switch(s||(s=Mo.PublicKey.decode(i,"der")),o=s.algorithm.algorithm.join("."),o){case"1.2.840.113549.1.1.1":return Mo.RSAPublicKey.decode(s.subjectPublicKey.data,"der");case"1.2.840.10045.2.1":return s.subjectPrivateKey=s.subjectPublicKey,{type:"ec",data:s};case"1.2.840.10040.4.1":return s.algorithm.params.pub_key=Mo.DSAparam.decode(s.subjectPublicKey.data,"der"),{type:"dsa",data:s.algorithm.params};default:throw new Error("unknown key id "+o)}case"ENCRYPTED PRIVATE KEY":i=Mo.EncryptedPrivateKey.decode(i,"der"),i=Nve(i,e);case"PRIVATE KEY":switch(s=Mo.PrivateKey.decode(i,"der"),o=s.algorithm.algorithm.join("."),o){case"1.2.840.113549.1.1.1":return Mo.RSAPrivateKey.decode(s.subjectPrivateKey,"der");case"1.2.840.10045.2.1":return{curve:s.algorithm.curve,privateKey:Mo.ECPrivateKey.decode(s.subjectPrivateKey,"der").privateKey};case"1.2.840.10040.4.1":return s.algorithm.params.priv_key=Mo.DSAparam.decode(s.subjectPrivateKey,"der"),{type:"dsa",params:s.algorithm.params};default:throw new Error("unknown key id "+o)}case"RSA PUBLIC KEY":return Mo.RSAPublicKey.decode(i,"der");case"RSA PRIVATE KEY":return Mo.RSAPrivateKey.decode(i,"der");case"DSA PRIVATE KEY":return{type:"dsa",params:Mo.DSAPrivateKey.decode(i,"der")};case"EC PRIVATE KEY":return i=Mo.ECPrivateKey.decode(i,"der"),{curve:i.parameters.value,privateKey:i.privateKey};default:throw new Error("unknown key type "+n)}}Z$.signature=Mo.signature;Y$.exports=Z$});var zA=G((Vze,qve)=>{qve.exports={"1.3.132.0.10":"secp256k1","1.3.132.0.33":"p224","1.2.840.10045.3.1.1":"p192","1.2.840.10045.3.1.7":"p256","1.3.132.0.34":"p384","1.3.132.0.35":"p521"}});var Q$=G((Kze,q_)=>{"use strict";p();var zi=it().Buffer,ph=_S(),Lve=p_(),Uve=k_().ec,N_=h_(),Fve=$b(),zve=zA(),$ve=1;function Gve(t,e,r,n,i){var o=Fve(e);if(o.curve){if(n!=="ecdsa"&&n!=="ecdsa/rsa")throw new Error("wrong private key type");return Hve(t,o)}else if(o.type==="dsa"){if(n!=="dsa")throw new Error("wrong private key type");return Wve(t,o,r)}if(n!=="rsa"&&n!=="ecdsa/rsa")throw new Error("wrong private key type");if(e.padding!==void 0&&e.padding!==$ve)throw new Error("illegal or unsupported padding mode");t=zi.concat([i,t]);for(var s=o.modulus.byteLength(),a=[0,1];t.length+a.length+1<s;)a.push(255);a.push(0);for(var c=-1;++c<t.length;)a.push(t[c]);var d=Lve(a,o);return d}function Hve(t,e){var r=zve[e.curve.join(".")];if(!r)throw new Error("unknown curve "+e.curve.join("."));var n=new Uve(r),i=n.keyFromPrivate(e.privateKey),o=i.sign(t);return zi.from(o.toDER())}function Wve(t,e,r){for(var n=e.params.priv_key,i=e.params.p,o=e.params.q,s=e.params.g,a=new N_(0),c,d=$A(t,o).mod(o),f=!1,u=J$(n,o,t,r);f===!1;)c=X$(o,u,r),a=Zve(s,c,i,o),f=c.invm(o).imul(d.add(n.mul(a))).mod(o),f.cmpn(0)===0&&(f=!1,a=new N_(0));return Vve(a,f)}function Vve(t,e){t=t.toArray(),e=e.toArray(),t[0]&128&&(t=[0].concat(t)),e[0]&128&&(e=[0].concat(e));var r=t.length+e.length+4,n=[48,r,2,t.length];return n=n.concat(t,[2,e.length],e),zi.from(n)}function J$(t,e,r,n){if(t=zi.from(t.toArray()),t.length<e.byteLength()){var i=zi.alloc(e.byteLength()-t.length);t=zi.concat([i,t])}var o=r.length,s=Kve(r,e),a=zi.alloc(o);a.fill(1);var c=zi.alloc(o);return c=ph(n,c).update(a).update(zi.from([0])).update(t).update(s).digest(),a=ph(n,c).update(a).digest(),c=ph(n,c).update(a).update(zi.from([1])).update(t).update(s).digest(),a=ph(n,c).update(a).digest(),{k:c,v:a}}function $A(t,e){var r=new N_(t),n=(t.length<<3)-e.bitLength();return n>0&&r.ishrn(n),r}function Kve(t,e){t=$A(t,e),t=t.mod(e);var r=zi.from(t.toArray());if(r.length<e.byteLength()){var n=zi.alloc(e.byteLength()-r.length);r=zi.concat([n,r])}return r}function X$(t,e,r){var n,i;do{for(n=zi.alloc(0);n.length*8<t.bitLength();)e.v=ph(r,e.k).update(e.v).digest(),n=zi.concat([n,e.v]);i=$A(n,t),e.k=ph(r,e.k).update(e.v).update(zi.from([0])).digest(),e.v=ph(r,e.k).update(e.v).digest()}while(i.cmp(t)!==-1);return i}function Zve(t,e,r,n){return t.toRed(N_.mont(r)).redPow(e).fromRed().mod(n)}q_.exports=Gve;q_.exports.getKey=J$;q_.exports.makeKey=X$});var nG=G((Yze,rG)=>{"use strict";p();var GA=it().Buffer,Gb=h_(),Yve=k_().ec,tG=$b(),Jve=zA();function Xve(t,e,r,n,i){var o=tG(r);if(o.type==="ec"){if(n!=="ecdsa"&&n!=="ecdsa/rsa")throw new Error("wrong public key type");return Qve(t,e,o)}else if(o.type==="dsa"){if(n!=="dsa")throw new Error("wrong public key type");return e1e(t,e,o)}if(n!=="rsa"&&n!=="ecdsa/rsa")throw new Error("wrong public key type");e=GA.concat([i,e]);for(var s=o.modulus.byteLength(),a=[1],c=0;e.length+a.length+2<s;)a.push(255),c+=1;a.push(0);for(var d=-1;++d<e.length;)a.push(e[d]);a=GA.from(a);var f=Gb.mont(o.modulus);t=new Gb(t).toRed(f),t=t.redPow(new Gb(o.publicExponent)),t=GA.from(t.fromRed().toArray());var u=c<8?1:0;for(s=Math.min(t.length,a.length),t.length!==a.length&&(u=1),d=-1;++d<s;)u|=t[d]^a[d];return u===0}function Qve(t,e,r){var n=Jve[r.data.algorithm.curve.join(".")];if(!n)throw new Error("unknown curve "+r.data.algorithm.curve.join("."));var i=new Yve(n),o=r.data.subjectPrivateKey.data;return i.verify(e,t,o)}function e1e(t,e,r){var n=r.data.p,i=r.data.q,o=r.data.g,s=r.data.pub_key,a=tG.signature.decode(t,"der"),c=a.s,d=a.r;eG(c,i),eG(d,i);var f=Gb.mont(n),u=c.invm(i),m=o.toRed(f).redPow(new Gb(e).mul(u).mod(i)).fromRed().mul(s.toRed(f).redPow(d.mul(u).mod(i)).fromRed()).mod(n).mod(i);return m.cmp(d)===0}function eG(t,e){if(t.cmpn(0)<=0)throw new Error("invalid sig");if(t.cmp(e)>=0)throw new Error("invalid sig")}rG.exports=Xve});var dG=G((Xze,cG)=>{"use strict";p();var L_=it().Buffer,sG=I0(),U_=U5(),aG=Je(),t1e=Q$(),r1e=nG(),mh=xS();Object.keys(mh).forEach(function(t){mh[t].id=L_.from(mh[t].id,"hex"),mh[t.toLowerCase()]=mh[t]});function Hb(t){U_.Writable.call(this);var e=mh[t];if(!e)throw new Error("Unknown message digest");this._hashType=e.hash,this._hash=sG(e.hash),this._tag=e.id,this._signType=e.sign}aG(Hb,U_.Writable);Hb.prototype._write=function(e,r,n){this._hash.update(e),n()};Hb.prototype.update=function(e,r){return this._hash.update(typeof e=="string"?L_.from(e,r):e),this};Hb.prototype.sign=function(e,r){this.end();var n=this._hash.digest(),i=t1e(n,e,this._hashType,this._signType,this._tag);return r?i.toString(r):i};function Wb(t){U_.Writable.call(this);var e=mh[t];if(!e)throw new Error("Unknown message digest");this._hash=sG(e.hash),this._tag=e.id,this._signType=e.sign}aG(Wb,U_.Writable);Wb.prototype._write=function(e,r,n){this._hash.update(e),n()};Wb.prototype.update=function(e,r){return this._hash.update(typeof e=="string"?L_.from(e,r):e),this};Wb.prototype.verify=function(e,r,n){var i=typeof r=="string"?L_.from(r,n):r;this.end();var o=this._hash.digest();return r1e(i,o,e,this._signType,this._tag)};function iG(t){return new Hb(t)}function oG(t){return new Wb(t)}cG.exports={Sign:iG,Verify:oG,createSign:iG,createVerify:oG}});var uG=G((e$e,fG)=>{p();var n1e=k_(),i1e=Zn();fG.exports=function(e){return new yh(e)};var ns={secp256k1:{name:"secp256k1",byteLength:32},secp224r1:{name:"p224",byteLength:28},prime256v1:{name:"p256",byteLength:32},prime192v1:{name:"p192",byteLength:24},ed25519:{name:"ed25519",byteLength:32},secp384r1:{name:"p384",byteLength:48},secp521r1:{name:"p521",byteLength:66}};ns.p224=ns.secp224r1;ns.p256=ns.secp256r1=ns.prime256v1;ns.p192=ns.secp192r1=ns.prime192v1;ns.p384=ns.secp384r1;ns.p521=ns.secp521r1;function yh(t){this.curveType=ns[t],this.curveType||(this.curveType={name:t}),this.curve=new n1e.ec(this.curveType.name),this.keys=void 0}yh.prototype.generateKeys=function(t,e){return this.keys=this.curve.genKeyPair(),this.getPublicKey(t,e)};yh.prototype.computeSecret=function(t,e,r){e=e||"utf8",C.Buffer.isBuffer(t)||(t=new C.Buffer(t,e));var n=this.curve.keyFromPublic(t).getPublic(),i=n.mul(this.keys.getPrivate()).getX();return HA(i,r,this.curveType.byteLength)};yh.prototype.getPublicKey=function(t,e){var r=this.keys.getPublic(e==="compressed",!0);return e==="hybrid"&&(r[r.length-1]%2?r[0]=7:r[0]=6),HA(r,t)};yh.prototype.getPrivateKey=function(t){return HA(this.keys.getPrivate(),t)};yh.prototype.setPublicKey=function(t,e){return e=e||"utf8",C.Buffer.isBuffer(t)||(t=new C.Buffer(t,e)),this.keys._importPublic(t),this};yh.prototype.setPrivateKey=function(t,e){e=e||"utf8",C.Buffer.isBuffer(t)||(t=new C.Buffer(t,e));var r=new i1e(t);return r=r.toString(16),this.keys=this.curve.genKeyPair(),this.keys._importPrivate(r),this};function HA(t,e,r){Array.isArray(t)||(t=t.toArray());var n=new C.Buffer(t);if(r&&n.length<r){var i=new C.Buffer(r-n.length);i.fill(0),n=C.Buffer.concat([i,n])}return e?n.toString(e):n}});var VA=G((r$e,lG)=>{p();var o1e=I0(),WA=it().Buffer;lG.exports=function(t,e){for(var r=WA.alloc(0),n=0,i;r.length<e;)i=s1e(n++),r=WA.concat([r,o1e("sha1").update(t).update(i).digest()]);return r.slice(0,e)};function s1e(t){var e=WA.allocUnsafe(4);return e.writeUInt32BE(t,0),e}});var KA=G((i$e,hG)=>{p();hG.exports=function(e,r){for(var n=e.length,i=-1;++i<n;)e[i]^=r[i];return e}});var ZA=G((s$e,mG)=>{p();var pG=Zn(),a1e=it().Buffer;function c1e(t,e){return a1e.from(t.toRed(pG.mont(e.modulus)).redPow(new pG(e.publicExponent)).fromRed().toArray())}mG.exports=c1e});var vG=G((c$e,bG)=>{p();var d1e=$b(),YA=Ol(),f1e=I0(),yG=VA(),gG=KA(),JA=Zn(),u1e=ZA(),l1e=p_(),wa=it().Buffer;bG.exports=function(e,r,n){var i;e.padding?i=e.padding:n?i=1:i=4;var o=d1e(e),s;if(i===4)s=h1e(o,r);else if(i===1)s=p1e(o,r,n);else if(i===3){if(s=new JA(r),s.cmp(o.modulus)>=0)throw new Error("data too long for modulus")}else throw new Error("unknown padding");return n?l1e(s,o):u1e(s,o)};function h1e(t,e){var r=t.modulus.byteLength(),n=e.length,i=f1e("sha1").update(wa.alloc(0)).digest(),o=i.length,s=2*o;if(n>r-s-2)throw new Error("message too long");var a=wa.alloc(r-n-s-2),c=r-o-1,d=YA(o),f=gG(wa.concat([i,a,wa.alloc(1,1),e],c),yG(d,c)),u=gG(d,yG(f,o));return new JA(wa.concat([wa.alloc(1),u,f],r))}function p1e(t,e,r){var n=e.length,i=t.modulus.byteLength();if(n>i-11)throw new Error("message too long");var o;return r?o=wa.alloc(i-n-3,255):o=m1e(i-n-3),new JA(wa.concat([wa.from([0,r?1:2]),o,wa.alloc(1),e],i))}function m1e(t){for(var e=wa.allocUnsafe(t),r=0,n=YA(t*2),i=0,o;r<t;)i===n.length&&(n=YA(t*2),i=0),o=n[i++],o&&(e[r++]=o);return e}});var SG=G((f$e,EG)=>{p();var y1e=$b(),wG=VA(),_G=KA(),xG=Zn(),g1e=p_(),b1e=I0(),v1e=ZA(),Vb=it().Buffer;EG.exports=function(e,r,n){var i;e.padding?i=e.padding:n?i=1:i=4;var o=y1e(e),s=o.modulus.byteLength();if(r.length>s||new xG(r).cmp(o.modulus)>=0)throw new Error("decryption error");var a;n?a=v1e(new xG(r),o):a=g1e(r,o);var c=Vb.alloc(s-a.length);if(a=Vb.concat([c,a],s),i===4)return w1e(o,a);if(i===1)return _1e(o,a,n);if(i===3)return a;throw new Error("unknown padding")};function w1e(t,e){var r=t.modulus.byteLength(),n=b1e("sha1").update(Vb.alloc(0)).digest(),i=n.length;if(e[0]!==0)throw new Error("decryption error");var o=e.slice(1,i+1),s=e.slice(i+1),a=_G(o,wG(s,i)),c=_G(s,wG(a,r-i-1));if(x1e(n,c.slice(0,i)))throw new Error("decryption error");for(var d=i;c[d]===0;)d++;if(c[d++]!==1)throw new Error("decryption error");return c.slice(d)}function _1e(t,e,r){for(var n=e.slice(0,2),i=2,o=0;e[i++]!==0;)if(i>=e.length){o++;break}var s=e.slice(2,i-1);if((n.toString("hex")!=="0002"&&!r||n.toString("hex")!=="0001"&&r)&&o++,s.length<8&&o++,o)throw new Error("decryption error");return e.slice(i)}function x1e(t,e){t=Vb.from(t),e=Vb.from(e);var r=0,n=t.length;t.length!==e.length&&(r++,n=Math.min(t.length,e.length));for(var i=-1;++i<n;)r+=t[i]^e[i];return r}});var AG=G(gh=>{p();gh.publicEncrypt=vG();gh.privateDecrypt=SG();gh.privateEncrypt=function(e,r){return gh.publicEncrypt(e,r,!0)};gh.publicDecrypt=function(e,r){return gh.privateDecrypt(e,r,!0)}});var OG=G(Kb=>{"use strict";p();function TG(){throw new Error(`secure random number generation not supported by this browser
15
+ use chrome, FireFox or Internet Explorer 11`)}var IG=it(),PG=Ol(),RG=IG.Buffer,MG=IG.kMaxLength,XA=globalThis.crypto||globalThis.msCrypto,kG=Math.pow(2,32)-1;function BG(t,e){if(typeof t!="number"||t!==t)throw new TypeError("offset must be a number");if(t>kG||t<0)throw new TypeError("offset must be a uint32");if(t>MG||t>e)throw new RangeError("offset out of range")}function DG(t,e,r){if(typeof t!="number"||t!==t)throw new TypeError("size must be a number");if(t>kG||t<0)throw new TypeError("size must be a uint32");if(t+e>r||t>MG)throw new RangeError("buffer too small")}XA&&XA.getRandomValues||!k.default.browser?(Kb.randomFill=E1e,Kb.randomFillSync=S1e):(Kb.randomFill=TG,Kb.randomFillSync=TG);function E1e(t,e,r,n){if(!RG.isBuffer(t)&&!(t instanceof globalThis.Uint8Array))throw new TypeError('"buf" argument must be a Buffer or Uint8Array');if(typeof e=="function")n=e,e=0,r=t.length;else if(typeof r=="function")n=r,r=t.length-e;else if(typeof n!="function")throw new TypeError('"cb" argument must be a function');return BG(e,t.length),DG(r,e,t.length),CG(t,e,r,n)}function CG(t,e,r,n){if(k.default.browser){var i=t.buffer,o=new Uint8Array(i,e,r);if(XA.getRandomValues(o),n){k.default.nextTick(function(){n(null,t)});return}return t}if(n){PG(r,function(a,c){if(a)return n(a);c.copy(t,e),n(null,t)});return}var s=PG(r);return s.copy(t,e),t}function S1e(t,e,r){if(typeof e>"u"&&(e=0),!RG.isBuffer(t)&&!(t instanceof globalThis.Uint8Array))throw new TypeError('"buf" argument must be a Buffer or Uint8Array');return BG(e,t.length),r===void 0&&(r=t.length-e),DG(r,e,t.length),CG(t,e,r)}});var f_=G(Ct=>{"use strict";p();Ct.randomBytes=Ct.rng=Ct.pseudoRandomBytes=Ct.prng=Ol();Ct.createHash=Ct.Hash=I0();Ct.createHmac=Ct.Hmac=_S();var A1e=YL(),T1e=Object.keys(A1e),P1e=["sha1","sha224","sha256","sha384","sha512","md5","rmd160"].concat(T1e);Ct.getHashes=function(){return P1e};var jG=MS();Ct.pbkdf2=jG.pbkdf2;Ct.pbkdf2Sync=jG.pbkdf2Sync;var mc=wF();Ct.Cipher=mc.Cipher;Ct.createCipher=mc.createCipher;Ct.Cipheriv=mc.Cipheriv;Ct.createCipheriv=mc.createCipheriv;Ct.Decipher=mc.Decipher;Ct.createDecipher=mc.createDecipher;Ct.Decipheriv=mc.Decipheriv;Ct.createDecipheriv=mc.createDecipheriv;Ct.getCiphers=mc.getCiphers;Ct.listCiphers=mc.listCiphers;var Zb=DF();Ct.DiffieHellmanGroup=Zb.DiffieHellmanGroup;Ct.createDiffieHellmanGroup=Zb.createDiffieHellmanGroup;Ct.getDiffieHellman=Zb.getDiffieHellman;Ct.createDiffieHellman=Zb.createDiffieHellman;Ct.DiffieHellman=Zb.DiffieHellman;var F_=dG();Ct.createSign=F_.createSign;Ct.Sign=F_.Sign;Ct.createVerify=F_.createVerify;Ct.Verify=F_.Verify;Ct.createECDH=uG();var z_=AG();Ct.publicEncrypt=z_.publicEncrypt;Ct.privateEncrypt=z_.privateEncrypt;Ct.publicDecrypt=z_.publicDecrypt;Ct.privateDecrypt=z_.privateDecrypt;var NG=OG();Ct.randomFill=NG.randomFill;Ct.randomFillSync=NG.randomFillSync;Ct.createCredentials=function(){throw new Error(`sorry, createCredentials is not implemented yet
16
+ we accept pull requests
17
+ https://github.com/browserify/crypto-browserify`)};Ct.constants={DH_CHECK_P_NOT_SAFE_PRIME:2,DH_CHECK_P_NOT_PRIME:1,DH_UNABLE_TO_CHECK_GENERATOR:4,DH_NOT_SUITABLE_GENERATOR:8,NPN_ENABLED:1,ALPN_ENABLED:1,RSA_PKCS1_PADDING:1,RSA_SSLV23_PADDING:2,RSA_NO_PADDING:3,RSA_PKCS1_OAEP_PADDING:4,RSA_X931_PADDING:5,RSA_PKCS1_PSS_PADDING:6,POINT_CONVERSION_COMPRESSED:2,POINT_CONVERSION_UNCOMPRESSED:4,POINT_CONVERSION_HYBRID:6}});var _a=G(Ot=>{"use strict";p();Object.defineProperty(Ot,"__esModule",{value:!0});Ot.setBigUint64=Ot.Hash=Ot.equalBytes=Ot.ensureBytes=Ot.checkOpts=Ot.concatBytes=Ot.toBytes=Ot.bytesToUtf8=Ot.utf8ToBytes=Ot.asyncLoop=Ot.nextTick=Ot.hexToBytes=Ot.bytesToHex=Ot.isLE=Ot.createView=Ot.u32=Ot.u16=Ot.u8=void 0;var eT=t=>t instanceof Uint8Array,I1e=t=>new Uint8Array(t.buffer,t.byteOffset,t.byteLength);Ot.u8=I1e;var R1e=t=>new Uint16Array(t.buffer,t.byteOffset,Math.floor(t.byteLength/2));Ot.u16=R1e;var M1e=t=>new Uint32Array(t.buffer,t.byteOffset,Math.floor(t.byteLength/4));Ot.u32=M1e;var k1e=t=>new DataView(t.buffer,t.byteOffset,t.byteLength);Ot.createView=k1e;Ot.isLE=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;if(!Ot.isLE)throw new Error("Non little-endian hardware is not supported");var B1e=Array.from({length:256},(t,e)=>e.toString(16).padStart(2,"0"));function D1e(t){if(!eT(t))throw new Error("Uint8Array expected");let e="";for(let r=0;r<t.length;r++)e+=B1e[t[r]];return e}Ot.bytesToHex=D1e;function C1e(t){if(typeof t!="string")throw new Error("hex string expected, got "+typeof t);let e=t.length;if(e%2)throw new Error("padded hex string expected, got unpadded hex of length "+e);let r=new Uint8Array(e/2);for(let n=0;n<r.length;n++){let i=n*2,o=t.slice(i,i+2),s=Number.parseInt(o,16);if(Number.isNaN(s)||s<0)throw new Error("Invalid byte sequence");r[n]=s}return r}Ot.hexToBytes=C1e;var O1e=async()=>{};Ot.nextTick=O1e;async function j1e(t,e,r){let n=Date.now();for(let i=0;i<t;i++){r(i);let o=Date.now()-n;o>=0&&o<e||(await(0,Ot.nextTick)(),n+=o)}}Ot.asyncLoop=j1e;function qG(t){if(typeof t!="string")throw new Error(`utf8ToBytes expected string, got ${typeof t}`);return new Uint8Array(new TextEncoder().encode(t))}Ot.utf8ToBytes=qG;function N1e(t){return new TextDecoder().decode(t)}Ot.bytesToUtf8=N1e;function q1e(t){if(typeof t=="string"&&(t=qG(t)),!eT(t))throw new Error(`expected Uint8Array, got ${typeof t}`);return t}Ot.toBytes=q1e;function L1e(...t){let e=new Uint8Array(t.reduce((n,i)=>n+i.length,0)),r=0;return t.forEach(n=>{if(!eT(n))throw new Error("Uint8Array expected");e.set(n,r),r+=n.length}),e}Ot.concatBytes=L1e;var U1e=t=>Object.prototype.toString.call(t)==="[object Object]"&&t.constructor===Object;function F1e(t,e){if(e!==void 0&&(typeof e!="object"||!U1e(e)))throw new Error("options must be object or undefined");return Object.assign(t,e)}Ot.checkOpts=F1e;function z1e(t,e){if(!(t instanceof Uint8Array))throw new Error("Uint8Array expected");if(typeof e=="number"&&t.length!==e)throw new Error(`Uint8Array length ${e} expected`)}Ot.ensureBytes=z1e;function $1e(t,e){if(t.length!==e.length)throw new Error("equalBytes: Different size of Uint8Arrays");let r=!0;for(let n=0;n<t.length;n++)r&&(r=t[n]===e[n]);return r}Ot.equalBytes=$1e;var QA=class{};Ot.Hash=QA;function G1e(t,e,r,n){if(typeof t.setBigUint64=="function")return t.setBigUint64(e,r,n);let i=BigInt(32),o=BigInt(4294967295),s=Number(r>>i&o),a=Number(r&o),c=n?4:0,d=n?0:4;t.setUint32(e+c,s,n),t.setUint32(e+d,a,n)}Ot.setBigUint64=G1e});var Yb=G($i=>{"use strict";p();Object.defineProperty($i,"__esModule",{value:!0});$i.AEAD_TAG_LENGTH=$i.XCHACHA20_NONCE_LENGTH=$i.CURVE25519_PUBLIC_KEY_SIZE=$i.ETH_PUBLIC_KEY_SIZE=$i.UNCOMPRESSED_PUBLIC_KEY_SIZE=$i.COMPRESSED_PUBLIC_KEY_SIZE=$i.SECRET_KEY_LENGTH=void 0;$i.SECRET_KEY_LENGTH=32;$i.COMPRESSED_PUBLIC_KEY_SIZE=33;$i.UNCOMPRESSED_PUBLIC_KEY_SIZE=65;$i.ETH_PUBLIC_KEY_SIZE=64;$i.CURVE25519_PUBLIC_KEY_SIZE=32;$i.XCHACHA20_NONCE_LENGTH=24;$i.AEAD_TAG_LENGTH=16});var bh=G(Vr=>{"use strict";p();Object.defineProperty(Vr,"__esModule",{value:!0});Vr.ephemeralKeySize=Vr.symmetricNonceLength=Vr.symmetricAlgorithm=Vr.isHkdfKeyCompressed=Vr.isEphemeralKeyCompressed=Vr.ellipticCurve=Vr.ECIES_CONFIG=void 0;var $_=Yb(),H1e=function(){function t(){this.ellipticCurve="secp256k1",this.isEphemeralKeyCompressed=!1,this.isHkdfKeyCompressed=!1,this.symmetricAlgorithm="aes-256-gcm",this.symmetricNonceLength=16}return t}();Vr.ECIES_CONFIG=new H1e;var W1e=function(){return Vr.ECIES_CONFIG.ellipticCurve};Vr.ellipticCurve=W1e;var V1e=function(){return Vr.ECIES_CONFIG.isEphemeralKeyCompressed};Vr.isEphemeralKeyCompressed=V1e;var K1e=function(){return Vr.ECIES_CONFIG.isHkdfKeyCompressed};Vr.isHkdfKeyCompressed=K1e;var Z1e=function(){return Vr.ECIES_CONFIG.symmetricAlgorithm};Vr.symmetricAlgorithm=Z1e;var Y1e=function(){return Vr.ECIES_CONFIG.symmetricNonceLength};Vr.symmetricNonceLength=Y1e;var J1e=function(){var t={secp256k1:Vr.ECIES_CONFIG.isEphemeralKeyCompressed?$_.COMPRESSED_PUBLIC_KEY_SIZE:$_.UNCOMPRESSED_PUBLIC_KEY_SIZE,x25519:$_.CURVE25519_PUBLIC_KEY_SIZE,ed25519:$_.CURVE25519_PUBLIC_KEY_SIZE};if(Vr.ECIES_CONFIG.ellipticCurve in t)return t[Vr.ECIES_CONFIG.ellipticCurve];throw new Error("Not implemented")};Vr.ephemeralKeySize=J1e});var LG=G(G_=>{"use strict";p();Object.defineProperty(G_,"__esModule",{value:!0});G_.crypto=void 0;G_.crypto=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0});var tT=G(X0=>{"use strict";p();Object.defineProperty(X0,"__esModule",{value:!0});X0.getWebcryptoSubtle=X0.randomBytes=void 0;var vh=LG();function X1e(t=32){if(vh.crypto&&typeof vh.crypto.getRandomValues=="function")return vh.crypto.getRandomValues(new Uint8Array(t));throw new Error("crypto.getRandomValues must be defined")}X0.randomBytes=X1e;function Q1e(){if(vh.crypto&&typeof vh.crypto.subtle=="object"&&vh.crypto.subtle!=null)return vh.crypto.subtle;throw new Error("crypto.subtle must be defined")}X0.getWebcryptoSubtle=Q1e});var UG=G(H_=>{"use strict";p();Object.defineProperty(H_,"__esModule",{value:!0});H_.crypto=void 0;H_.crypto=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0});var yc=G(Oe=>{"use strict";p();Object.defineProperty(Oe,"__esModule",{value:!0});Oe.wrapXOFConstructorWithOpts=Oe.wrapConstructorWithOpts=Oe.wrapConstructor=Oe.Hash=Oe.nextTick=Oe.swap32IfBE=Oe.byteSwapIfBE=Oe.swap8IfBE=Oe.isLE=void 0;Oe.isBytes=zG;Oe.anumber=rT;Oe.abytes=em;Oe.ahash=ewe;Oe.aexists=twe;Oe.aoutput=rwe;Oe.u8=nwe;Oe.u32=iwe;Oe.clean=owe;Oe.createView=swe;Oe.rotr=awe;Oe.rotl=cwe;Oe.byteSwap=iT;Oe.byteSwap32=$G;Oe.bytesToHex=fwe;Oe.hexToBytes=uwe;Oe.asyncLoop=hwe;Oe.utf8ToBytes=oT;Oe.bytesToUtf8=pwe;Oe.toBytes=W_;Oe.kdfInputToBytes=mwe;Oe.concatBytes=ywe;Oe.checkOpts=gwe;Oe.createHasher=HG;Oe.createOptHasher=WG;Oe.createXOFer=VG;Oe.randomBytes=bwe;var Q0=UG();function zG(t){return t instanceof Uint8Array||ArrayBuffer.isView(t)&&t.constructor.name==="Uint8Array"}function rT(t){if(!Number.isSafeInteger(t)||t<0)throw new Error("positive integer expected, got "+t)}function em(t,...e){if(!zG(t))throw new Error("Uint8Array expected");if(e.length>0&&!e.includes(t.length))throw new Error("Uint8Array expected of length "+e+", got length="+t.length)}function ewe(t){if(typeof t!="function"||typeof t.create!="function")throw new Error("Hash should be wrapped by utils.createHasher");rT(t.outputLen),rT(t.blockLen)}function twe(t,e=!0){if(t.destroyed)throw new Error("Hash instance has been destroyed");if(e&&t.finished)throw new Error("Hash#digest() has already been called")}function rwe(t,e){em(t);let r=e.outputLen;if(t.length<r)throw new Error("digestInto() expects output buffer of length at least "+r)}function nwe(t){return new Uint8Array(t.buffer,t.byteOffset,t.byteLength)}function iwe(t){return new Uint32Array(t.buffer,t.byteOffset,Math.floor(t.byteLength/4))}function owe(...t){for(let e=0;e<t.length;e++)t[e].fill(0)}function swe(t){return new DataView(t.buffer,t.byteOffset,t.byteLength)}function awe(t,e){return t<<32-e|t>>>e}function cwe(t,e){return t<<e|t>>>32-e>>>0}Oe.isLE=(()=>new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68)();function iT(t){return t<<24&4278190080|t<<8&16711680|t>>>8&65280|t>>>24&255}Oe.swap8IfBE=Oe.isLE?t=>t:t=>iT(t);Oe.byteSwapIfBE=Oe.swap8IfBE;function $G(t){for(let e=0;e<t.length;e++)t[e]=iT(t[e]);return t}Oe.swap32IfBE=Oe.isLE?t=>t:$G;var GG=(()=>typeof Uint8Array.from([]).toHex=="function"&&typeof Uint8Array.fromHex=="function")(),dwe=Array.from({length:256},(t,e)=>e.toString(16).padStart(2,"0"));function fwe(t){if(em(t),GG)return t.toHex();let e="";for(let r=0;r<t.length;r++)e+=dwe[t[r]];return e}var Cd={_0:48,_9:57,A:65,F:70,a:97,f:102};function FG(t){if(t>=Cd._0&&t<=Cd._9)return t-Cd._0;if(t>=Cd.A&&t<=Cd.F)return t-(Cd.A-10);if(t>=Cd.a&&t<=Cd.f)return t-(Cd.a-10)}function uwe(t){if(typeof t!="string")throw new Error("hex string expected, got "+typeof t);if(GG)return Uint8Array.fromHex(t);let e=t.length,r=e/2;if(e%2)throw new Error("hex string expected, got unpadded hex of length "+e);let n=new Uint8Array(r);for(let i=0,o=0;i<r;i++,o+=2){let s=FG(t.charCodeAt(o)),a=FG(t.charCodeAt(o+1));if(s===void 0||a===void 0){let c=t[o]+t[o+1];throw new Error('hex string expected, got non-hex character "'+c+'" at index '+o)}n[i]=s*16+a}return n}var lwe=async()=>{};Oe.nextTick=lwe;async function hwe(t,e,r){let n=Date.now();for(let i=0;i<t;i++){r(i);let o=Date.now()-n;o>=0&&o<e||(await(0,Oe.nextTick)(),n+=o)}}function oT(t){if(typeof t!="string")throw new Error("string expected");return new Uint8Array(new TextEncoder().encode(t))}function pwe(t){return new TextDecoder().decode(t)}function W_(t){return typeof t=="string"&&(t=oT(t)),em(t),t}function mwe(t){return typeof t=="string"&&(t=oT(t)),em(t),t}function ywe(...t){let e=0;for(let n=0;n<t.length;n++){let i=t[n];em(i),e+=i.length}let r=new Uint8Array(e);for(let n=0,i=0;n<t.length;n++){let o=t[n];r.set(o,i),i+=o.length}return r}function gwe(t,e){if(e!==void 0&&{}.toString.call(e)!=="[object Object]")throw new Error("options should be object or undefined");return Object.assign(t,e)}var nT=class{};Oe.Hash=nT;function HG(t){let e=n=>t().update(W_(n)).digest(),r=t();return e.outputLen=r.outputLen,e.blockLen=r.blockLen,e.create=()=>t(),e}function WG(t){let e=(n,i)=>t(i).update(W_(n)).digest(),r=t({});return e.outputLen=r.outputLen,e.blockLen=r.blockLen,e.create=n=>t(n),e}function VG(t){let e=(n,i)=>t(i).update(W_(n)).digest(),r=t({});return e.outputLen=r.outputLen,e.blockLen=r.blockLen,e.create=n=>t(n),e}Oe.wrapConstructor=HG;Oe.wrapConstructorWithOpts=WG;Oe.wrapXOFConstructorWithOpts=VG;function bwe(t=32){if(Q0.crypto&&typeof Q0.crypto.getRandomValues=="function")return Q0.crypto.getRandomValues(new Uint8Array(t));if(Q0.crypto&&typeof Q0.crypto.randomBytes=="function")return Uint8Array.from(Q0.crypto.randomBytes(t));throw new Error("crypto.getRandomValues must be defined")}});var ZG=G(oo=>{"use strict";p();Object.defineProperty(oo,"__esModule",{value:!0});oo.SHA512_IV=oo.SHA384_IV=oo.SHA224_IV=oo.SHA256_IV=oo.HashMD=void 0;oo.setBigUint64=KG;oo.Chi=vwe;oo.Maj=wwe;var gc=yc();function KG(t,e,r,n){if(typeof t.setBigUint64=="function")return t.setBigUint64(e,r,n);let i=BigInt(32),o=BigInt(4294967295),s=Number(r>>i&o),a=Number(r&o),c=n?4:0,d=n?0:4;t.setUint32(e+c,s,n),t.setUint32(e+d,a,n)}function vwe(t,e,r){return t&e^~t&r}function wwe(t,e,r){return t&e^t&r^e&r}var sT=class extends gc.Hash{constructor(e,r,n,i){super(),this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.blockLen=e,this.outputLen=r,this.padOffset=n,this.isLE=i,this.buffer=new Uint8Array(e),this.view=(0,gc.createView)(this.buffer)}update(e){(0,gc.aexists)(this),e=(0,gc.toBytes)(e),(0,gc.abytes)(e);let{view:r,buffer:n,blockLen:i}=this,o=e.length;for(let s=0;s<o;){let a=Math.min(i-this.pos,o-s);if(a===i){let c=(0,gc.createView)(e);for(;i<=o-s;s+=i)this.process(c,s);continue}n.set(e.subarray(s,s+a),this.pos),this.pos+=a,s+=a,this.pos===i&&(this.process(r,0),this.pos=0)}return this.length+=e.length,this.roundClean(),this}digestInto(e){(0,gc.aexists)(this),(0,gc.aoutput)(e,this),this.finished=!0;let{buffer:r,view:n,blockLen:i,isLE:o}=this,{pos:s}=this;r[s++]=128,(0,gc.clean)(this.buffer.subarray(s)),this.padOffset>i-s&&(this.process(n,0),s=0);for(let u=s;u<i;u++)r[u]=0;KG(n,i-8,BigInt(this.length*8),o),this.process(n,0);let a=(0,gc.createView)(e),c=this.outputLen;if(c%4)throw new Error("_sha2: outputLen should be aligned to 32bit");let d=c/4,f=this.get();if(d>f.length)throw new Error("_sha2: outputLen bigger than state");for(let u=0;u<d;u++)a.setUint32(4*u,f[u],o)}digest(){let{buffer:e,outputLen:r}=this;this.digestInto(e);let n=e.slice(0,r);return this.destroy(),n}_cloneInto(e){e||(e=new this.constructor),e.set(...this.get());let{blockLen:r,buffer:n,length:i,finished:o,destroyed:s,pos:a}=this;return e.destroyed=s,e.finished=o,e.length=i,e.pos=a,i%r&&e.buffer.set(n),e}clone(){return this._cloneInto()}};oo.HashMD=sT;oo.SHA256_IV=Uint32Array.from([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]);oo.SHA224_IV=Uint32Array.from([3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428]);oo.SHA384_IV=Uint32Array.from([3418070365,3238371032,1654270250,914150663,2438529370,812702999,355462360,4144912697,1731405415,4290775857,2394180231,1750603025,3675008525,1694076839,1203062813,3204075428]);oo.SHA512_IV=Uint32Array.from([1779033703,4089235720,3144134277,2227873595,1013904242,4271175723,2773480762,1595750129,1359893119,2917565137,2600822924,725511199,528734635,4215389547,1541459225,327033209])});var gH=G(tt=>{"use strict";p();Object.defineProperty(tt,"__esModule",{value:!0});tt.toBig=tt.shrSL=tt.shrSH=tt.rotrSL=tt.rotrSH=tt.rotrBL=tt.rotrBH=tt.rotr32L=tt.rotr32H=tt.rotlSL=tt.rotlSH=tt.rotlBL=tt.rotlBH=tt.add5L=tt.add5H=tt.add4L=tt.add4H=tt.add3L=tt.add3H=void 0;tt.add=fH;tt.fromBig=cT;tt.split=YG;var V_=BigInt(2**32-1),aT=BigInt(32);function cT(t,e=!1){return e?{h:Number(t&V_),l:Number(t>>aT&V_)}:{h:Number(t>>aT&V_)|0,l:Number(t&V_)|0}}function YG(t,e=!1){let r=t.length,n=new Uint32Array(r),i=new Uint32Array(r);for(let o=0;o<r;o++){let{h:s,l:a}=cT(t[o],e);[n[o],i[o]]=[s,a]}return[n,i]}var JG=(t,e)=>BigInt(t>>>0)<<aT|BigInt(e>>>0);tt.toBig=JG;var XG=(t,e,r)=>t>>>r;tt.shrSH=XG;var QG=(t,e,r)=>t<<32-r|e>>>r;tt.shrSL=QG;var eH=(t,e,r)=>t>>>r|e<<32-r;tt.rotrSH=eH;var tH=(t,e,r)=>t<<32-r|e>>>r;tt.rotrSL=tH;var rH=(t,e,r)=>t<<64-r|e>>>r-32;tt.rotrBH=rH;var nH=(t,e,r)=>t>>>r-32|e<<64-r;tt.rotrBL=nH;var iH=(t,e)=>e;tt.rotr32H=iH;var oH=(t,e)=>t;tt.rotr32L=oH;var sH=(t,e,r)=>t<<r|e>>>32-r;tt.rotlSH=sH;var aH=(t,e,r)=>e<<r|t>>>32-r;tt.rotlSL=aH;var cH=(t,e,r)=>e<<r-32|t>>>64-r;tt.rotlBH=cH;var dH=(t,e,r)=>t<<r-32|e>>>64-r;tt.rotlBL=dH;function fH(t,e,r,n){let i=(e>>>0)+(n>>>0);return{h:t+r+(i/2**32|0)|0,l:i|0}}var uH=(t,e,r)=>(t>>>0)+(e>>>0)+(r>>>0);tt.add3L=uH;var lH=(t,e,r,n)=>e+r+n+(t/2**32|0)|0;tt.add3H=lH;var hH=(t,e,r,n)=>(t>>>0)+(e>>>0)+(r>>>0)+(n>>>0);tt.add4L=hH;var pH=(t,e,r,n,i)=>e+r+n+i+(t/2**32|0)|0;tt.add4H=pH;var mH=(t,e,r,n,i)=>(t>>>0)+(e>>>0)+(r>>>0)+(n>>>0)+(i>>>0);tt.add5L=mH;var yH=(t,e,r,n,i,o)=>e+r+n+i+o+(t/2**32|0)|0;tt.add5H=yH;var _we={fromBig:cT,split:YG,toBig:JG,shrSH:XG,shrSL:QG,rotrSH:eH,rotrSL:tH,rotrBH:rH,rotrBL:nH,rotr32H:iH,rotr32L:oH,rotlSH:sH,rotlSL:aH,rotlBH:cH,rotlBL:dH,add:fH,add3L:uH,add3H:lH,add4L:hH,add4H:pH,add5H:yH,add5L:mH};tt.default=_we});var X_=G(kr=>{"use strict";p();Object.defineProperty(kr,"__esModule",{value:!0});kr.sha512_224=kr.sha512_256=kr.sha384=kr.sha512=kr.sha224=kr.sha256=kr.SHA512_256=kr.SHA512_224=kr.SHA384=kr.SHA512=kr.SHA224=kr.SHA256=void 0;var Ce=ZG(),jt=gH(),Rn=yc(),xwe=Uint32Array.from([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),tu=new Uint32Array(64),Jb=class extends Ce.HashMD{constructor(e=32){super(64,e,8,!1),this.A=Ce.SHA256_IV[0]|0,this.B=Ce.SHA256_IV[1]|0,this.C=Ce.SHA256_IV[2]|0,this.D=Ce.SHA256_IV[3]|0,this.E=Ce.SHA256_IV[4]|0,this.F=Ce.SHA256_IV[5]|0,this.G=Ce.SHA256_IV[6]|0,this.H=Ce.SHA256_IV[7]|0}get(){let{A:e,B:r,C:n,D:i,E:o,F:s,G:a,H:c}=this;return[e,r,n,i,o,s,a,c]}set(e,r,n,i,o,s,a,c){this.A=e|0,this.B=r|0,this.C=n|0,this.D=i|0,this.E=o|0,this.F=s|0,this.G=a|0,this.H=c|0}process(e,r){for(let u=0;u<16;u++,r+=4)tu[u]=e.getUint32(r,!1);for(let u=16;u<64;u++){let m=tu[u-15],_=tu[u-2],v=(0,Rn.rotr)(m,7)^(0,Rn.rotr)(m,18)^m>>>3,A=(0,Rn.rotr)(_,17)^(0,Rn.rotr)(_,19)^_>>>10;tu[u]=A+tu[u-7]+v+tu[u-16]|0}let{A:n,B:i,C:o,D:s,E:a,F:c,G:d,H:f}=this;for(let u=0;u<64;u++){let m=(0,Rn.rotr)(a,6)^(0,Rn.rotr)(a,11)^(0,Rn.rotr)(a,25),_=f+m+(0,Ce.Chi)(a,c,d)+xwe[u]+tu[u]|0,A=((0,Rn.rotr)(n,2)^(0,Rn.rotr)(n,13)^(0,Rn.rotr)(n,22))+(0,Ce.Maj)(n,i,o)|0;f=d,d=c,c=a,a=s+_|0,s=o,o=i,i=n,n=_+A|0}n=n+this.A|0,i=i+this.B|0,o=o+this.C|0,s=s+this.D|0,a=a+this.E|0,c=c+this.F|0,d=d+this.G|0,f=f+this.H|0,this.set(n,i,o,s,a,c,d,f)}roundClean(){(0,Rn.clean)(tu)}destroy(){this.set(0,0,0,0,0,0,0,0),(0,Rn.clean)(this.buffer)}};kr.SHA256=Jb;var K_=class extends Jb{constructor(){super(28),this.A=Ce.SHA224_IV[0]|0,this.B=Ce.SHA224_IV[1]|0,this.C=Ce.SHA224_IV[2]|0,this.D=Ce.SHA224_IV[3]|0,this.E=Ce.SHA224_IV[4]|0,this.F=Ce.SHA224_IV[5]|0,this.G=Ce.SHA224_IV[6]|0,this.H=Ce.SHA224_IV[7]|0}};kr.SHA224=K_;var bH=(()=>jt.split(["0x428a2f98d728ae22","0x7137449123ef65cd","0xb5c0fbcfec4d3b2f","0xe9b5dba58189dbbc","0x3956c25bf348b538","0x59f111f1b605d019","0x923f82a4af194f9b","0xab1c5ed5da6d8118","0xd807aa98a3030242","0x12835b0145706fbe","0x243185be4ee4b28c","0x550c7dc3d5ffb4e2","0x72be5d74f27b896f","0x80deb1fe3b1696b1","0x9bdc06a725c71235","0xc19bf174cf692694","0xe49b69c19ef14ad2","0xefbe4786384f25e3","0x0fc19dc68b8cd5b5","0x240ca1cc77ac9c65","0x2de92c6f592b0275","0x4a7484aa6ea6e483","0x5cb0a9dcbd41fbd4","0x76f988da831153b5","0x983e5152ee66dfab","0xa831c66d2db43210","0xb00327c898fb213f","0xbf597fc7beef0ee4","0xc6e00bf33da88fc2","0xd5a79147930aa725","0x06ca6351e003826f","0x142929670a0e6e70","0x27b70a8546d22ffc","0x2e1b21385c26c926","0x4d2c6dfc5ac42aed","0x53380d139d95b3df","0x650a73548baf63de","0x766a0abb3c77b2a8","0x81c2c92e47edaee6","0x92722c851482353b","0xa2bfe8a14cf10364","0xa81a664bbc423001","0xc24b8b70d0f89791","0xc76c51a30654be30","0xd192e819d6ef5218","0xd69906245565a910","0xf40e35855771202a","0x106aa07032bbd1b8","0x19a4c116b8d2d0c8","0x1e376c085141ab53","0x2748774cdf8eeb99","0x34b0bcb5e19b48a8","0x391c0cb3c5c95a63","0x4ed8aa4ae3418acb","0x5b9cca4f7763e373","0x682e6ff3d6b2b8a3","0x748f82ee5defb2fc","0x78a5636f43172f60","0x84c87814a1f0ab72","0x8cc702081a6439ec","0x90befffa23631e28","0xa4506cebde82bde9","0xbef9a3f7b2c67915","0xc67178f2e372532b","0xca273eceea26619c","0xd186b8c721c0c207","0xeada7dd6cde0eb1e","0xf57d4f7fee6ed178","0x06f067aa72176fba","0x0a637dc5a2c898a6","0x113f9804bef90dae","0x1b710b35131c471b","0x28db77f523047d84","0x32caab7b40c72493","0x3c9ebe0a15c9bebc","0x431d67c49c100d4c","0x4cc5d4becb3e42b6","0x597f299cfc657e2a","0x5fcb6fab3ad6faec","0x6c44198c4a475817"].map(t=>BigInt(t))))(),Ewe=(()=>bH[0])(),Swe=(()=>bH[1])(),ru=new Uint32Array(80),nu=new Uint32Array(80),wh=class extends Ce.HashMD{constructor(e=64){super(128,e,16,!1),this.Ah=Ce.SHA512_IV[0]|0,this.Al=Ce.SHA512_IV[1]|0,this.Bh=Ce.SHA512_IV[2]|0,this.Bl=Ce.SHA512_IV[3]|0,this.Ch=Ce.SHA512_IV[4]|0,this.Cl=Ce.SHA512_IV[5]|0,this.Dh=Ce.SHA512_IV[6]|0,this.Dl=Ce.SHA512_IV[7]|0,this.Eh=Ce.SHA512_IV[8]|0,this.El=Ce.SHA512_IV[9]|0,this.Fh=Ce.SHA512_IV[10]|0,this.Fl=Ce.SHA512_IV[11]|0,this.Gh=Ce.SHA512_IV[12]|0,this.Gl=Ce.SHA512_IV[13]|0,this.Hh=Ce.SHA512_IV[14]|0,this.Hl=Ce.SHA512_IV[15]|0}get(){let{Ah:e,Al:r,Bh:n,Bl:i,Ch:o,Cl:s,Dh:a,Dl:c,Eh:d,El:f,Fh:u,Fl:m,Gh:_,Gl:v,Hh:A,Hl:T}=this;return[e,r,n,i,o,s,a,c,d,f,u,m,_,v,A,T]}set(e,r,n,i,o,s,a,c,d,f,u,m,_,v,A,T){this.Ah=e|0,this.Al=r|0,this.Bh=n|0,this.Bl=i|0,this.Ch=o|0,this.Cl=s|0,this.Dh=a|0,this.Dl=c|0,this.Eh=d|0,this.El=f|0,this.Fh=u|0,this.Fl=m|0,this.Gh=_|0,this.Gl=v|0,this.Hh=A|0,this.Hl=T|0}process(e,r){for(let O=0;O<16;O++,r+=4)ru[O]=e.getUint32(r),nu[O]=e.getUint32(r+=4);for(let O=16;O<80;O++){let U=ru[O-15]|0,L=nu[O-15]|0,F=jt.rotrSH(U,L,1)^jt.rotrSH(U,L,8)^jt.shrSH(U,L,7),$=jt.rotrSL(U,L,1)^jt.rotrSL(U,L,8)^jt.shrSL(U,L,7),H=ru[O-2]|0,z=nu[O-2]|0,j=jt.rotrSH(H,z,19)^jt.rotrBH(H,z,61)^jt.shrSH(H,z,6),y=jt.rotrSL(H,z,19)^jt.rotrBL(H,z,61)^jt.shrSL(H,z,6),P=jt.add4L($,y,nu[O-7],nu[O-16]),x=jt.add4H(P,F,j,ru[O-7],ru[O-16]);ru[O]=x|0,nu[O]=P|0}let{Ah:n,Al:i,Bh:o,Bl:s,Ch:a,Cl:c,Dh:d,Dl:f,Eh:u,El:m,Fh:_,Fl:v,Gh:A,Gl:T,Hh:M,Hl:D}=this;for(let O=0;O<80;O++){let U=jt.rotrSH(u,m,14)^jt.rotrSH(u,m,18)^jt.rotrBH(u,m,41),L=jt.rotrSL(u,m,14)^jt.rotrSL(u,m,18)^jt.rotrBL(u,m,41),F=u&_^~u&A,$=m&v^~m&T,H=jt.add5L(D,L,$,Swe[O],nu[O]),z=jt.add5H(H,M,U,F,Ewe[O],ru[O]),j=H|0,y=jt.rotrSH(n,i,28)^jt.rotrBH(n,i,34)^jt.rotrBH(n,i,39),P=jt.rotrSL(n,i,28)^jt.rotrBL(n,i,34)^jt.rotrBL(n,i,39),x=n&o^n&a^o&a,l=i&s^i&c^s&c;M=A|0,D=T|0,A=_|0,T=v|0,_=u|0,v=m|0,{h:u,l:m}=jt.add(d|0,f|0,z|0,j|0),d=a|0,f=c|0,a=o|0,c=s|0,o=n|0,s=i|0;let b=jt.add3L(j,P,l);n=jt.add3H(b,z,y,x),i=b|0}({h:n,l:i}=jt.add(this.Ah|0,this.Al|0,n|0,i|0)),{h:o,l:s}=jt.add(this.Bh|0,this.Bl|0,o|0,s|0),{h:a,l:c}=jt.add(this.Ch|0,this.Cl|0,a|0,c|0),{h:d,l:f}=jt.add(this.Dh|0,this.Dl|0,d|0,f|0),{h:u,l:m}=jt.add(this.Eh|0,this.El|0,u|0,m|0),{h:_,l:v}=jt.add(this.Fh|0,this.Fl|0,_|0,v|0),{h:A,l:T}=jt.add(this.Gh|0,this.Gl|0,A|0,T|0),{h:M,l:D}=jt.add(this.Hh|0,this.Hl|0,M|0,D|0),this.set(n,i,o,s,a,c,d,f,u,m,_,v,A,T,M,D)}roundClean(){(0,Rn.clean)(ru,nu)}destroy(){(0,Rn.clean)(this.buffer),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}};kr.SHA512=wh;var Z_=class extends wh{constructor(){super(48),this.Ah=Ce.SHA384_IV[0]|0,this.Al=Ce.SHA384_IV[1]|0,this.Bh=Ce.SHA384_IV[2]|0,this.Bl=Ce.SHA384_IV[3]|0,this.Ch=Ce.SHA384_IV[4]|0,this.Cl=Ce.SHA384_IV[5]|0,this.Dh=Ce.SHA384_IV[6]|0,this.Dl=Ce.SHA384_IV[7]|0,this.Eh=Ce.SHA384_IV[8]|0,this.El=Ce.SHA384_IV[9]|0,this.Fh=Ce.SHA384_IV[10]|0,this.Fl=Ce.SHA384_IV[11]|0,this.Gh=Ce.SHA384_IV[12]|0,this.Gl=Ce.SHA384_IV[13]|0,this.Hh=Ce.SHA384_IV[14]|0,this.Hl=Ce.SHA384_IV[15]|0}};kr.SHA384=Z_;var Gi=Uint32Array.from([2352822216,424955298,1944164710,2312950998,502970286,855612546,1738396948,1479516111,258812777,2077511080,2011393907,79989058,1067287976,1780299464,286451373,2446758561]),Hi=Uint32Array.from([573645204,4230739756,2673172387,3360449730,596883563,1867755857,2520282905,1497426621,2519219938,2827943907,3193839141,1401305490,721525244,746961066,246885852,2177182882]),Y_=class extends wh{constructor(){super(28),this.Ah=Gi[0]|0,this.Al=Gi[1]|0,this.Bh=Gi[2]|0,this.Bl=Gi[3]|0,this.Ch=Gi[4]|0,this.Cl=Gi[5]|0,this.Dh=Gi[6]|0,this.Dl=Gi[7]|0,this.Eh=Gi[8]|0,this.El=Gi[9]|0,this.Fh=Gi[10]|0,this.Fl=Gi[11]|0,this.Gh=Gi[12]|0,this.Gl=Gi[13]|0,this.Hh=Gi[14]|0,this.Hl=Gi[15]|0}};kr.SHA512_224=Y_;var J_=class extends wh{constructor(){super(32),this.Ah=Hi[0]|0,this.Al=Hi[1]|0,this.Bh=Hi[2]|0,this.Bl=Hi[3]|0,this.Ch=Hi[4]|0,this.Cl=Hi[5]|0,this.Dh=Hi[6]|0,this.Dl=Hi[7]|0,this.Eh=Hi[8]|0,this.El=Hi[9]|0,this.Fh=Hi[10]|0,this.Fl=Hi[11]|0,this.Gh=Hi[12]|0,this.Gl=Hi[13]|0,this.Hh=Hi[14]|0,this.Hl=Hi[15]|0}};kr.SHA512_256=J_;kr.sha256=(0,Rn.createHasher)(()=>new Jb);kr.sha224=(0,Rn.createHasher)(()=>new K_);kr.sha512=(0,Rn.createHasher)(()=>new wh);kr.sha384=(0,Rn.createHasher)(()=>new Z_);kr.sha512_256=(0,Rn.createHasher)(()=>new J_);kr.sha512_224=(0,Rn.createHasher)(()=>new Y_)});var jd=G(We=>{"use strict";p();Object.defineProperty(We,"__esModule",{value:!0});We.notImplemented=We.bitMask=We.utf8ToBytes=We.randomBytes=We.isBytes=We.hexToBytes=We.concatBytes=We.bytesToUtf8=We.bytesToHex=We.anumber=We.abytes=void 0;We.abool=Awe;We._abool2=Twe;We._abytes2=Pwe;We.numberToHexUnpadded=vH;We.hexToNumber=fT;We.bytesToNumberBE=Iwe;We.bytesToNumberLE=Rwe;We.numberToBytesBE=wH;We.numberToBytesLE=Mwe;We.numberToVarBytesBE=kwe;We.ensureBytes=Bwe;We.equalBytes=Dwe;We.copyBytes=Cwe;We.asciiToBytes=Owe;We.inRange=_H;We.aInRange=jwe;We.bitLen=Nwe;We.bitGet=qwe;We.bitSet=Lwe;We.createHmacDrbg=Fwe;We.validateObject=$we;We.isHash=Gwe;We._validateObject=Hwe;We.memoized=Vwe;var bc=yc(),Od=yc();Object.defineProperty(We,"abytes",{enumerable:!0,get:function(){return Od.abytes}});Object.defineProperty(We,"anumber",{enumerable:!0,get:function(){return Od.anumber}});Object.defineProperty(We,"bytesToHex",{enumerable:!0,get:function(){return Od.bytesToHex}});Object.defineProperty(We,"bytesToUtf8",{enumerable:!0,get:function(){return Od.bytesToUtf8}});Object.defineProperty(We,"concatBytes",{enumerable:!0,get:function(){return Od.concatBytes}});Object.defineProperty(We,"hexToBytes",{enumerable:!0,get:function(){return Od.hexToBytes}});Object.defineProperty(We,"isBytes",{enumerable:!0,get:function(){return Od.isBytes}});Object.defineProperty(We,"randomBytes",{enumerable:!0,get:function(){return Od.randomBytes}});Object.defineProperty(We,"utf8ToBytes",{enumerable:!0,get:function(){return Od.utf8ToBytes}});var Q_=BigInt(0),Xb=BigInt(1);function Awe(t,e){if(typeof e!="boolean")throw new Error(t+" boolean expected, got "+e)}function Twe(t,e=""){if(typeof t!="boolean"){let r=e&&`"${e}"`;throw new Error(r+"expected boolean, got type="+typeof t)}return t}function Pwe(t,e,r=""){let n=(0,bc.isBytes)(t),i=t?.length,o=e!==void 0;if(!n||o&&i!==e){let s=r&&`"${r}" `,a=o?` of length ${e}`:"",c=n?`length=${i}`:`type=${typeof t}`;throw new Error(s+"expected Uint8Array"+a+", got "+c)}return t}function vH(t){let e=t.toString(16);return e.length&1?"0"+e:e}function fT(t){if(typeof t!="string")throw new Error("hex string expected, got "+typeof t);return t===""?Q_:BigInt("0x"+t)}function Iwe(t){return fT((0,bc.bytesToHex)(t))}function Rwe(t){return(0,bc.abytes)(t),fT((0,bc.bytesToHex)(Uint8Array.from(t).reverse()))}function wH(t,e){return(0,bc.hexToBytes)(t.toString(16).padStart(e*2,"0"))}function Mwe(t,e){return wH(t,e).reverse()}function kwe(t){return(0,bc.hexToBytes)(vH(t))}function Bwe(t,e,r){let n;if(typeof e=="string")try{n=(0,bc.hexToBytes)(e)}catch(o){throw new Error(t+" must be hex string or Uint8Array, cause: "+o)}else if((0,bc.isBytes)(e))n=Uint8Array.from(e);else throw new Error(t+" must be hex string or Uint8Array");let i=n.length;if(typeof r=="number"&&i!==r)throw new Error(t+" of length "+r+" expected, got "+i);return n}function Dwe(t,e){if(t.length!==e.length)return!1;let r=0;for(let n=0;n<t.length;n++)r|=t[n]^e[n];return r===0}function Cwe(t){return Uint8Array.from(t)}function Owe(t){return Uint8Array.from(t,(e,r)=>{let n=e.charCodeAt(0);if(e.length!==1||n>127)throw new Error(`string contains non-ASCII character "${t[r]}" with code ${n} at position ${r}`);return n})}var dT=t=>typeof t=="bigint"&&Q_<=t;function _H(t,e,r){return dT(t)&&dT(e)&&dT(r)&&e<=t&&t<r}function jwe(t,e,r,n){if(!_H(e,r,n))throw new Error("expected valid "+t+": "+r+" <= n < "+n+", got "+e)}function Nwe(t){let e;for(e=0;t>Q_;t>>=Xb,e+=1);return e}function qwe(t,e){return t>>BigInt(e)&Xb}function Lwe(t,e,r){return t|(r?Xb:Q_)<<BigInt(e)}var Uwe=t=>(Xb<<BigInt(t))-Xb;We.bitMask=Uwe;function Fwe(t,e,r){if(typeof t!="number"||t<2)throw new Error("hashLen must be a number");if(typeof e!="number"||e<2)throw new Error("qByteLen must be a number");if(typeof r!="function")throw new Error("hmacFn must be a function");let n=_=>new Uint8Array(_),i=_=>Uint8Array.of(_),o=n(t),s=n(t),a=0,c=()=>{o.fill(1),s.fill(0),a=0},d=(..._)=>r(s,o,..._),f=(_=n(0))=>{s=d(i(0),_),o=d(),_.length!==0&&(s=d(i(1),_),o=d())},u=()=>{if(a++>=1e3)throw new Error("drbg: tried 1000 values");let _=0,v=[];for(;_<e;){o=d();let A=o.slice();v.push(A),_+=o.length}return(0,bc.concatBytes)(...v)};return(_,v)=>{c(),f(_);let A;for(;!(A=v(u()));)f();return c(),A}}var zwe={bigint:t=>typeof t=="bigint",function:t=>typeof t=="function",boolean:t=>typeof t=="boolean",string:t=>typeof t=="string",stringOrUint8Array:t=>typeof t=="string"||(0,bc.isBytes)(t),isSafeInteger:t=>Number.isSafeInteger(t),array:t=>Array.isArray(t),field:(t,e)=>e.Fp.isValid(t),hash:t=>typeof t=="function"&&Number.isSafeInteger(t.outputLen)};function $we(t,e,r={}){let n=(i,o,s)=>{let a=zwe[o];if(typeof a!="function")throw new Error("invalid validator function");let c=t[i];if(!(s&&c===void 0)&&!a(c,t))throw new Error("param "+String(i)+" is invalid. Expected "+o+", got "+c)};for(let[i,o]of Object.entries(e))n(i,o,!1);for(let[i,o]of Object.entries(r))n(i,o,!0);return t}function Gwe(t){return typeof t=="function"&&Number.isSafeInteger(t.outputLen)}function Hwe(t,e,r={}){if(!t||typeof t!="object")throw new Error("expected valid options object");function n(i,o,s){let a=t[i];if(s&&a===void 0)return;let c=typeof a;if(c!==o||a===null)throw new Error(`param "${i}" is invalid: expected ${o}, got ${c}`)}Object.entries(e).forEach(([i,o])=>n(i,o,!1)),Object.entries(r).forEach(([i,o])=>n(i,o,!0))}var Wwe=()=>{throw new Error("not implemented")};We.notImplemented=Wwe;function Vwe(t){let e=new WeakMap;return(r,...n)=>{let i=e.get(r);if(i!==void 0)return i;let o=t(r,...n);return e.set(r,o),o}}});var iu=G(Kr=>{"use strict";p();Object.defineProperty(Kr,"__esModule",{value:!0});Kr.isNegativeLE=void 0;Kr.mod=ko;Kr.pow=Ywe;Kr.pow2=Jwe;Kr.invert=e6;Kr.tonelliShanks=lT;Kr.FpSqrt=IH;Kr.validateField=r2e;Kr.FpPow=hT;Kr.FpInvertBatch=RH;Kr.FpDiv=n2e;Kr.FpLegendre=t6;Kr.FpIsSquare=i2e;Kr.nLength=pT;Kr.Field=r6;Kr.FpSqrtOdd=o2e;Kr.FpSqrtEven=s2e;Kr.hashToPrivateScalar=a2e;Kr.getFieldBytesLength=mT;Kr.getMinHashLength=MH;Kr.mapHashToField=c2e;var Bo=jd(),so=BigInt(0),Mn=BigInt(1),_h=BigInt(2),xH=BigInt(3),EH=BigInt(4),SH=BigInt(5),Kwe=BigInt(7),AH=BigInt(8),Zwe=BigInt(9),TH=BigInt(16);function ko(t,e){let r=t%e;return r>=so?r:e+r}function Ywe(t,e,r){return hT(r6(r),t,e)}function Jwe(t,e,r){let n=t;for(;e-- >so;)n*=n,n%=r;return n}function e6(t,e){if(t===so)throw new Error("invert: expected non-zero number");if(e<=so)throw new Error("invert: expected positive modulus, got "+e);let r=ko(t,e),n=e,i=so,o=Mn,s=Mn,a=so;for(;r!==so;){let d=n/r,f=n%r,u=i-s*d,m=o-a*d;n=r,r=f,i=s,o=a,s=u,a=m}if(n!==Mn)throw new Error("invert: does not exist");return ko(i,e)}function uT(t,e,r){if(!t.eql(t.sqr(e),r))throw new Error("Cannot find square root")}function PH(t,e){let r=(t.ORDER+Mn)/EH,n=t.pow(e,r);return uT(t,n,e),n}function Xwe(t,e){let r=(t.ORDER-SH)/AH,n=t.mul(e,_h),i=t.pow(n,r),o=t.mul(e,i),s=t.mul(t.mul(o,_h),i),a=t.mul(o,t.sub(s,t.ONE));return uT(t,a,e),a}function Qwe(t){let e=r6(t),r=lT(t),n=r(e,e.neg(e.ONE)),i=r(e,n),o=r(e,e.neg(n)),s=(t+Kwe)/TH;return(a,c)=>{let d=a.pow(c,s),f=a.mul(d,n),u=a.mul(d,i),m=a.mul(d,o),_=a.eql(a.sqr(f),c),v=a.eql(a.sqr(u),c);d=a.cmov(d,f,_),f=a.cmov(m,u,v);let A=a.eql(a.sqr(f),c),T=a.cmov(d,f,A);return uT(a,T,c),T}}function lT(t){if(t<xH)throw new Error("sqrt is not defined for small field");let e=t-Mn,r=0;for(;e%_h===so;)e/=_h,r++;let n=_h,i=r6(t);for(;t6(i,n)===1;)if(n++>1e3)throw new Error("Cannot find square root: probably non-prime P");if(r===1)return PH;let o=i.pow(n,e),s=(e+Mn)/_h;return function(c,d){if(c.is0(d))return d;if(t6(c,d)!==1)throw new Error("Cannot find square root");let f=r,u=c.mul(c.ONE,o),m=c.pow(d,e),_=c.pow(d,s);for(;!c.eql(m,c.ONE);){if(c.is0(m))return c.ZERO;let v=1,A=c.sqr(m);for(;!c.eql(A,c.ONE);)if(v++,A=c.sqr(A),v===f)throw new Error("Cannot find square root");let T=Mn<<BigInt(f-v-1),M=c.pow(u,T);f=v,u=c.sqr(M),m=c.mul(m,u),_=c.mul(_,M)}return _}}function IH(t){return t%EH===xH?PH:t%AH===SH?Xwe:t%TH===Zwe?Qwe(t):lT(t)}var e2e=(t,e)=>(ko(t,e)&Mn)===Mn;Kr.isNegativeLE=e2e;var t2e=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function r2e(t){let e={ORDER:"bigint",MASK:"bigint",BYTES:"number",BITS:"number"},r=t2e.reduce((n,i)=>(n[i]="function",n),e);return(0,Bo._validateObject)(t,r),t}function hT(t,e,r){if(r<so)throw new Error("invalid exponent, negatives unsupported");if(r===so)return t.ONE;if(r===Mn)return e;let n=t.ONE,i=e;for(;r>so;)r&Mn&&(n=t.mul(n,i)),i=t.sqr(i),r>>=Mn;return n}function RH(t,e,r=!1){let n=new Array(e.length).fill(r?t.ZERO:void 0),i=e.reduce((s,a,c)=>t.is0(a)?s:(n[c]=s,t.mul(s,a)),t.ONE),o=t.inv(i);return e.reduceRight((s,a,c)=>t.is0(a)?s:(n[c]=t.mul(s,n[c]),t.mul(s,a)),o),n}function n2e(t,e,r){return t.mul(e,typeof r=="bigint"?e6(r,t.ORDER):t.inv(r))}function t6(t,e){let r=(t.ORDER-Mn)/_h,n=t.pow(e,r),i=t.eql(n,t.ONE),o=t.eql(n,t.ZERO),s=t.eql(n,t.neg(t.ONE));if(!i&&!o&&!s)throw new Error("invalid Legendre symbol result");return i?1:o?0:-1}function i2e(t,e){return t6(t,e)===1}function pT(t,e){e!==void 0&&(0,Bo.anumber)(e);let r=e!==void 0?e:t.toString(2).length,n=Math.ceil(r/8);return{nBitLength:r,nByteLength:n}}function r6(t,e,r=!1,n={}){if(t<=so)throw new Error("invalid field: expected ORDER > 0, got "+t);let i,o,s=!1,a;if(typeof e=="object"&&e!=null){if(n.sqrt||r)throw new Error("cannot specify opts in two arguments");let m=e;m.BITS&&(i=m.BITS),m.sqrt&&(o=m.sqrt),typeof m.isLE=="boolean"&&(r=m.isLE),typeof m.modFromBytes=="boolean"&&(s=m.modFromBytes),a=m.allowedLengths}else typeof e=="number"&&(i=e),n.sqrt&&(o=n.sqrt);let{nBitLength:c,nByteLength:d}=pT(t,i);if(d>2048)throw new Error("invalid field: expected ORDER of <= 2048 bytes");let f,u=Object.freeze({ORDER:t,isLE:r,BITS:c,BYTES:d,MASK:(0,Bo.bitMask)(c),ZERO:so,ONE:Mn,allowedLengths:a,create:m=>ko(m,t),isValid:m=>{if(typeof m!="bigint")throw new Error("invalid field element: expected bigint, got "+typeof m);return so<=m&&m<t},is0:m=>m===so,isValidNot0:m=>!u.is0(m)&&u.isValid(m),isOdd:m=>(m&Mn)===Mn,neg:m=>ko(-m,t),eql:(m,_)=>m===_,sqr:m=>ko(m*m,t),add:(m,_)=>ko(m+_,t),sub:(m,_)=>ko(m-_,t),mul:(m,_)=>ko(m*_,t),pow:(m,_)=>hT(u,m,_),div:(m,_)=>ko(m*e6(_,t),t),sqrN:m=>m*m,addN:(m,_)=>m+_,subN:(m,_)=>m-_,mulN:(m,_)=>m*_,inv:m=>e6(m,t),sqrt:o||(m=>(f||(f=IH(t)),f(u,m))),toBytes:m=>r?(0,Bo.numberToBytesLE)(m,d):(0,Bo.numberToBytesBE)(m,d),fromBytes:(m,_=!0)=>{if(a){if(!a.includes(m.length)||m.length>d)throw new Error("Field.fromBytes: expected "+a+" bytes, got "+m.length);let A=new Uint8Array(d);A.set(m,r?0:A.length-m.length),m=A}if(m.length!==d)throw new Error("Field.fromBytes: expected "+d+" bytes, got "+m.length);let v=r?(0,Bo.bytesToNumberLE)(m):(0,Bo.bytesToNumberBE)(m);if(s&&(v=ko(v,t)),!_&&!u.isValid(v))throw new Error("invalid field element: outside of range 0..ORDER");return v},invertBatch:m=>RH(u,m),cmov:(m,_,v)=>v?_:m});return Object.freeze(u)}function o2e(t,e){if(!t.isOdd)throw new Error("Field doesn't have isOdd");let r=t.sqrt(e);return t.isOdd(r)?r:t.neg(r)}function s2e(t,e){if(!t.isOdd)throw new Error("Field doesn't have isOdd");let r=t.sqrt(e);return t.isOdd(r)?t.neg(r):r}function a2e(t,e,r=!1){t=(0,Bo.ensureBytes)("privateHash",t);let n=t.length,i=pT(e).nByteLength+8;if(i<24||n<i||n>1024)throw new Error("hashToPrivateScalar: expected "+i+"-1024 bytes of input, got "+n);let o=r?(0,Bo.bytesToNumberLE)(t):(0,Bo.bytesToNumberBE)(t);return ko(o,e-Mn)+Mn}function mT(t){if(typeof t!="bigint")throw new Error("field order must be bigint");let e=t.toString(2).length;return Math.ceil(e/8)}function MH(t){let e=mT(t);return e+Math.ceil(e/2)}function c2e(t,e,r=!1){let n=t.length,i=mT(e),o=MH(e);if(n<16||n<o||n>1024)throw new Error("expected "+o+"-1024 bytes of input, got "+n);let s=r?(0,Bo.bytesToNumberLE)(t):(0,Bo.bytesToNumberBE)(t),a=ko(s,e-Mn)+Mn;return r?(0,Bo.numberToBytesLE)(a,i):(0,Bo.numberToBytesBE)(a,i)}});var n6=G(xa=>{"use strict";p();Object.defineProperty(xa,"__esModule",{value:!0});xa.wNAF=void 0;xa.negateCt=vT;xa.normalizeZ=d2e;xa.mulEndoUnsafe=f2e;xa.pippenger=u2e;xa.precomputeMSMUnsafe=l2e;xa.validateBasic=h2e;xa._createCurveFields=p2e;var Qb=jd(),ev=iu(),tm=BigInt(0),xh=BigInt(1);function vT(t,e){let r=e.negate();return t?r:e}function d2e(t,e){let r=(0,ev.FpInvertBatch)(t.Fp,e.map(n=>n.Z));return e.map((n,i)=>t.fromAffine(n.toAffine(r[i])))}function _T(t,e){if(!Number.isSafeInteger(t)||t<=0||t>e)throw new Error("invalid window size, expected [1.."+e+"], got W="+t)}function yT(t,e){_T(t,e);let r=Math.ceil(e/t)+1,n=2**(t-1),i=2**t,o=(0,Qb.bitMask)(t),s=BigInt(t);return{windows:r,windowSize:n,mask:o,maxNumber:i,shiftBy:s}}function kH(t,e,r){let{windowSize:n,mask:i,maxNumber:o,shiftBy:s}=r,a=Number(t&i),c=t>>s;a>n&&(a-=o,c+=xh);let d=e*n,f=d+Math.abs(a)-1,u=a===0,m=a<0,_=e%2!==0;return{nextN:c,offset:f,isZero:u,isNeg:m,isNegF:_,offsetF:d}}function CH(t,e){if(!Array.isArray(t))throw new Error("array expected");t.forEach((r,n)=>{if(!(r instanceof e))throw new Error("invalid point at index "+n)})}function OH(t,e){if(!Array.isArray(t))throw new Error("array of scalars expected");t.forEach((r,n)=>{if(!e.isValid(r))throw new Error("invalid scalar at index "+n)})}var gT=new WeakMap,jH=new WeakMap;function bT(t){return jH.get(t)||1}function BH(t){if(t!==tm)throw new Error("invalid wNAF")}var wT=class{constructor(e,r){this.BASE=e.BASE,this.ZERO=e.ZERO,this.Fn=e.Fn,this.bits=r}_unsafeLadder(e,r,n=this.ZERO){let i=e;for(;r>tm;)r&xh&&(n=n.add(i)),i=i.double(),r>>=xh;return n}precomputeWindow(e,r){let{windows:n,windowSize:i}=yT(r,this.bits),o=[],s=e,a=s;for(let c=0;c<n;c++){a=s,o.push(a);for(let d=1;d<i;d++)a=a.add(s),o.push(a);s=a.double()}return o}wNAF(e,r,n){if(!this.Fn.isValid(n))throw new Error("invalid scalar");let i=this.ZERO,o=this.BASE,s=yT(e,this.bits);for(let a=0;a<s.windows;a++){let{nextN:c,offset:d,isZero:f,isNeg:u,isNegF:m,offsetF:_}=kH(n,a,s);n=c,f?o=o.add(vT(m,r[_])):i=i.add(vT(u,r[d]))}return BH(n),{p:i,f:o}}wNAFUnsafe(e,r,n,i=this.ZERO){let o=yT(e,this.bits);for(let s=0;s<o.windows&&n!==tm;s++){let{nextN:a,offset:c,isZero:d,isNeg:f}=kH(n,s,o);if(n=a,!d){let u=r[c];i=i.add(f?u.negate():u)}}return BH(n),i}getPrecomputes(e,r,n){let i=gT.get(r);return i||(i=this.precomputeWindow(r,e),e!==1&&(typeof n=="function"&&(i=n(i)),gT.set(r,i))),i}cached(e,r,n){let i=bT(e);return this.wNAF(i,this.getPrecomputes(i,e,n),r)}unsafe(e,r,n,i){let o=bT(e);return o===1?this._unsafeLadder(e,r,i):this.wNAFUnsafe(o,this.getPrecomputes(o,e,n),r,i)}createCache(e,r){_T(r,this.bits),jH.set(e,r),gT.delete(e)}hasCache(e){return bT(e)!==1}};xa.wNAF=wT;function f2e(t,e,r,n){let i=e,o=t.ZERO,s=t.ZERO;for(;r>tm||n>tm;)r&xh&&(o=o.add(i)),n&xh&&(s=s.add(i)),i=i.double(),r>>=xh,n>>=xh;return{p1:o,p2:s}}function u2e(t,e,r,n){CH(r,t),OH(n,e);let i=r.length,o=n.length;if(i!==o)throw new Error("arrays of points and scalars must have equal length");let s=t.ZERO,a=(0,Qb.bitLen)(BigInt(i)),c=1;a>12?c=a-3:a>4?c=a-2:a>0&&(c=2);let d=(0,Qb.bitMask)(c),f=new Array(Number(d)+1).fill(s),u=Math.floor((e.BITS-1)/c)*c,m=s;for(let _=u;_>=0;_-=c){f.fill(s);for(let A=0;A<o;A++){let T=n[A],M=Number(T>>BigInt(_)&d);f[M]=f[M].add(r[A])}let v=s;for(let A=f.length-1,T=s;A>0;A--)T=T.add(f[A]),v=v.add(T);if(m=m.add(v),_!==0)for(let A=0;A<c;A++)m=m.double()}return m}function l2e(t,e,r,n){_T(n,e.BITS),CH(r,t);let i=t.ZERO,o=2**n-1,s=Math.ceil(e.BITS/n),a=(0,Qb.bitMask)(n),c=r.map(d=>{let f=[];for(let u=0,m=d;u<o;u++)f.push(m),m=m.add(d);return f});return d=>{if(OH(d,e),d.length>r.length)throw new Error("array of scalars must be smaller than array of points");let f=i;for(let u=0;u<s;u++){if(f!==i)for(let _=0;_<n;_++)f=f.double();let m=BigInt(s*n-(u+1)*n);for(let _=0;_<d.length;_++){let v=d[_],A=Number(v>>m&a);A&&(f=f.add(c[_][A-1]))}}return f}}function h2e(t){return(0,ev.validateField)(t.Fp),(0,Qb.validateObject)(t,{n:"bigint",h:"bigint",Gx:"field",Gy:"field"},{nBitLength:"isSafeInteger",nByteLength:"isSafeInteger"}),Object.freeze({...(0,ev.nLength)(t.n,t.nBitLength),...t,p:t.Fp.ORDER})}function DH(t,e,r){if(e){if(e.ORDER!==t)throw new Error("Field.ORDER must match order: Fp == p, Fn == n");return(0,ev.validateField)(e),e}else return(0,ev.Field)(t,{isLE:r})}function p2e(t,e,r={},n){if(n===void 0&&(n=t==="edwards"),!e||typeof e!="object")throw new Error(`expected valid ${t} CURVE object`);for(let c of["p","n","h"]){let d=e[c];if(!(typeof d=="bigint"&&d>tm))throw new Error(`CURVE.${c} must be positive bigint`)}let i=DH(e.p,r.Fp,n),o=DH(e.n,r.Fn,n),a=["Gx","Gy","a",t==="weierstrass"?"b":"d"];for(let c of a)if(!i.isValid(e[c]))throw new Error(`CURVE.${c} must be valid field element of CURVE.Fp`);return e=Object.freeze(Object.assign({},e)),{CURVE:e,Fp:i,Fn:o}}});var LH=G(Sh=>{"use strict";p();Object.defineProperty(Sh,"__esModule",{value:!0});Sh.PrimeEdwardsPoint=void 0;Sh.edwards=NH;Sh.eddsa=qH;Sh.twistedEdwards=w2e;var Qt=jd(),Eh=n6(),m2e=iu(),ou=BigInt(0),Qn=BigInt(1),xT=BigInt(2),y2e=BigInt(8);function g2e(t,e,r,n){let i=t.sqr(r),o=t.sqr(n),s=t.add(t.mul(e.a,i),o),a=t.add(t.ONE,t.mul(e.d,t.mul(i,o)));return t.eql(s,a)}function NH(t,e={}){let r=(0,Eh._createCurveFields)("edwards",t,e,e.FpFnLE),{Fp:n,Fn:i}=r,o=r.CURVE,{h:s}=o;(0,Qt._validateObject)(e,{},{uvRatio:"function"});let a=xT<<BigInt(i.BYTES*8)-Qn,c=T=>n.create(T),d=e.uvRatio||((T,M)=>{try{return{isValid:!0,value:n.sqrt(n.div(T,M))}}catch{return{isValid:!1,value:ou}}});if(!g2e(n,o,o.Gx,o.Gy))throw new Error("bad curve params: generator point");function f(T,M,D=!1){let O=D?Qn:ou;return(0,Qt.aInRange)("coordinate "+T,M,O,a),M}function u(T){if(!(T instanceof v))throw new Error("ExtendedPoint expected")}let m=(0,Qt.memoized)((T,M)=>{let{X:D,Y:O,Z:U}=T,L=T.is0();M==null&&(M=L?y2e:n.inv(U));let F=c(D*M),$=c(O*M),H=n.mul(U,M);if(L)return{x:ou,y:Qn};if(H!==Qn)throw new Error("invZ was invalid");return{x:F,y:$}}),_=(0,Qt.memoized)(T=>{let{a:M,d:D}=o;if(T.is0())throw new Error("bad point: ZERO");let{X:O,Y:U,Z:L,T:F}=T,$=c(O*O),H=c(U*U),z=c(L*L),j=c(z*z),y=c($*M),P=c(z*c(y+H)),x=c(j+c(D*c($*H)));if(P!==x)throw new Error("bad point: equation left != right (1)");let l=c(O*U),b=c(L*F);if(l!==b)throw new Error("bad point: equation left != right (2)");return!0});class v{constructor(M,D,O,U){this.X=f("x",M),this.Y=f("y",D),this.Z=f("z",O,!0),this.T=f("t",U),Object.freeze(this)}static CURVE(){return o}static fromAffine(M){if(M instanceof v)throw new Error("extended point not allowed");let{x:D,y:O}=M||{};return f("x",D),f("y",O),new v(D,O,Qn,c(D*O))}static fromBytes(M,D=!1){let O=n.BYTES,{a:U,d:L}=o;M=(0,Qt.copyBytes)((0,Qt._abytes2)(M,O,"point")),(0,Qt._abool2)(D,"zip215");let F=(0,Qt.copyBytes)(M),$=M[O-1];F[O-1]=$&-129;let H=(0,Qt.bytesToNumberLE)(F),z=D?a:n.ORDER;(0,Qt.aInRange)("point.y",H,ou,z);let j=c(H*H),y=c(j-Qn),P=c(L*j-U),{isValid:x,value:l}=d(y,P);if(!x)throw new Error("bad point: invalid y coordinate");let b=(l&Qn)===Qn,h=($&128)!==0;if(!D&&l===ou&&h)throw new Error("bad point: x=0 and x_0=1");return h!==b&&(l=c(-l)),v.fromAffine({x:l,y:H})}static fromHex(M,D=!1){return v.fromBytes((0,Qt.ensureBytes)("point",M),D)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}precompute(M=8,D=!0){return A.createCache(this,M),D||this.multiply(xT),this}assertValidity(){_(this)}equals(M){u(M);let{X:D,Y:O,Z:U}=this,{X:L,Y:F,Z:$}=M,H=c(D*$),z=c(L*U),j=c(O*$),y=c(F*U);return H===z&&j===y}is0(){return this.equals(v.ZERO)}negate(){return new v(c(-this.X),this.Y,this.Z,c(-this.T))}double(){let{a:M}=o,{X:D,Y:O,Z:U}=this,L=c(D*D),F=c(O*O),$=c(xT*c(U*U)),H=c(M*L),z=D+O,j=c(c(z*z)-L-F),y=H+F,P=y-$,x=H-F,l=c(j*P),b=c(y*x),h=c(j*x),w=c(P*y);return new v(l,b,w,h)}add(M){u(M);let{a:D,d:O}=o,{X:U,Y:L,Z:F,T:$}=this,{X:H,Y:z,Z:j,T:y}=M,P=c(U*H),x=c(L*z),l=c($*O*y),b=c(F*j),h=c((U+L)*(H+z)-P-x),w=b-l,E=b+l,g=c(x-D*P),I=c(h*w),B=c(E*g),R=c(h*g),q=c(w*E);return new v(I,B,q,R)}subtract(M){return this.add(M.negate())}multiply(M){if(!i.isValidNot0(M))throw new Error("invalid scalar: expected 1 <= sc < curve.n");let{p:D,f:O}=A.cached(this,M,U=>(0,Eh.normalizeZ)(v,U));return(0,Eh.normalizeZ)(v,[D,O])[0]}multiplyUnsafe(M,D=v.ZERO){if(!i.isValid(M))throw new Error("invalid scalar: expected 0 <= sc < curve.n");return M===ou?v.ZERO:this.is0()||M===Qn?this:A.unsafe(this,M,O=>(0,Eh.normalizeZ)(v,O),D)}isSmallOrder(){return this.multiplyUnsafe(s).is0()}isTorsionFree(){return A.unsafe(this,o.n).is0()}toAffine(M){return m(this,M)}clearCofactor(){return s===Qn?this:this.multiplyUnsafe(s)}toBytes(){let{x:M,y:D}=this.toAffine(),O=n.toBytes(D);return O[O.length-1]|=M&Qn?128:0,O}toHex(){return(0,Qt.bytesToHex)(this.toBytes())}toString(){return`<Point ${this.is0()?"ZERO":this.toHex()}>`}get ex(){return this.X}get ey(){return this.Y}get ez(){return this.Z}get et(){return this.T}static normalizeZ(M){return(0,Eh.normalizeZ)(v,M)}static msm(M,D){return(0,Eh.pippenger)(v,i,M,D)}_setWindowSize(M){this.precompute(M)}toRawBytes(){return this.toBytes()}}v.BASE=new v(o.Gx,o.Gy,Qn,c(o.Gx*o.Gy)),v.ZERO=new v(ou,Qn,Qn,ou),v.Fp=n,v.Fn=i;let A=new Eh.wNAF(v,i.BITS);return v.BASE.precompute(8),v}var ET=class{constructor(e){this.ep=e}static fromBytes(e){(0,Qt.notImplemented)()}static fromHex(e){(0,Qt.notImplemented)()}get x(){return this.toAffine().x}get y(){return this.toAffine().y}clearCofactor(){return this}assertValidity(){this.ep.assertValidity()}toAffine(e){return this.ep.toAffine(e)}toHex(){return(0,Qt.bytesToHex)(this.toBytes())}toString(){return this.toHex()}isTorsionFree(){return!0}isSmallOrder(){return!1}add(e){return this.assertSame(e),this.init(this.ep.add(e.ep))}subtract(e){return this.assertSame(e),this.init(this.ep.subtract(e.ep))}multiply(e){return this.init(this.ep.multiply(e))}multiplyUnsafe(e){return this.init(this.ep.multiplyUnsafe(e))}double(){return this.init(this.ep.double())}negate(){return this.init(this.ep.negate())}precompute(e,r){return this.init(this.ep.precompute(e,r))}toRawBytes(){return this.toBytes()}};Sh.PrimeEdwardsPoint=ET;function qH(t,e,r={}){if(typeof e!="function")throw new Error('"hash" function param is required');(0,Qt._validateObject)(r,{},{adjustScalarBytes:"function",randomBytes:"function",domain:"function",prehash:"function",mapToCurve:"function"});let{prehash:n}=r,{BASE:i,Fp:o,Fn:s}=t,a=r.randomBytes||Qt.randomBytes,c=r.adjustScalarBytes||(z=>z),d=r.domain||((z,j,y)=>{if((0,Qt._abool2)(y,"phflag"),j.length||y)throw new Error("Contexts/pre-hash are not supported");return z});function f(z){return s.create((0,Qt.bytesToNumberLE)(z))}function u(z){let j=O.secretKey;z=(0,Qt.ensureBytes)("private key",z,j);let y=(0,Qt.ensureBytes)("hashed private key",e(z),2*j),P=c(y.slice(0,j)),x=y.slice(j,2*j),l=f(P);return{head:P,prefix:x,scalar:l}}function m(z){let{head:j,prefix:y,scalar:P}=u(z),x=i.multiply(P),l=x.toBytes();return{head:j,prefix:y,scalar:P,point:x,pointBytes:l}}function _(z){return m(z).pointBytes}function v(z=Uint8Array.of(),...j){let y=(0,Qt.concatBytes)(...j);return f(e(d(y,(0,Qt.ensureBytes)("context",z),!!n)))}function A(z,j,y={}){z=(0,Qt.ensureBytes)("message",z),n&&(z=n(z));let{prefix:P,scalar:x,pointBytes:l}=m(j),b=v(y.context,P,z),h=i.multiply(b).toBytes(),w=v(y.context,h,l,z),E=s.create(b+w*x);if(!s.isValid(E))throw new Error("sign failed: invalid s");let g=(0,Qt.concatBytes)(h,s.toBytes(E));return(0,Qt._abytes2)(g,O.signature,"result")}let T={zip215:!0};function M(z,j,y,P=T){let{context:x,zip215:l}=P,b=O.signature;z=(0,Qt.ensureBytes)("signature",z,b),j=(0,Qt.ensureBytes)("message",j),y=(0,Qt.ensureBytes)("publicKey",y,O.publicKey),l!==void 0&&(0,Qt._abool2)(l,"zip215"),n&&(j=n(j));let h=b/2,w=z.subarray(0,h),E=(0,Qt.bytesToNumberLE)(z.subarray(h,b)),g,I,B;try{g=t.fromBytes(y,l),I=t.fromBytes(w,l),B=i.multiplyUnsafe(E)}catch{return!1}if(!l&&g.isSmallOrder())return!1;let R=v(x,I.toBytes(),g.toBytes(),j);return I.add(g.multiplyUnsafe(R)).subtract(B).clearCofactor().is0()}let D=o.BYTES,O={secretKey:D,publicKey:D,signature:2*D,seed:D};function U(z=a(O.seed)){return(0,Qt._abytes2)(z,O.seed,"seed")}function L(z){let j=H.randomSecretKey(z);return{secretKey:j,publicKey:_(j)}}function F(z){return(0,Qt.isBytes)(z)&&z.length===s.BYTES}function $(z,j){try{return!!t.fromBytes(z,j)}catch{return!1}}let H={getExtendedPublicKey:m,randomSecretKey:U,isValidSecretKey:F,isValidPublicKey:$,toMontgomery(z){let{y:j}=t.fromBytes(z),y=O.publicKey,P=y===32;if(!P&&y!==57)throw new Error("only defined for 25519 and 448");let x=P?o.div(Qn+j,Qn-j):o.div(j-Qn,j+Qn);return o.toBytes(x)},toMontgomerySecret(z){let j=O.secretKey;(0,Qt._abytes2)(z,j);let y=e(z.subarray(0,j));return c(y).subarray(0,j)},randomPrivateKey:U,precompute(z=8,j=t.BASE){return j.precompute(z,!1)}};return Object.freeze({keygen:L,getPublicKey:_,sign:A,verify:M,utils:H,Point:t,lengths:O})}function b2e(t){let e={a:t.a,d:t.d,p:t.Fp.ORDER,n:t.n,h:t.h,Gx:t.Gx,Gy:t.Gy},r=t.Fp,n=(0,m2e.Field)(e.n,t.nBitLength,!0),i={Fp:r,Fn:n,uvRatio:t.uvRatio},o={randomBytes:t.randomBytes,adjustScalarBytes:t.adjustScalarBytes,domain:t.domain,prehash:t.prehash,mapToCurve:t.mapToCurve};return{CURVE:e,curveOpts:i,hash:t.hash,eddsaOpts:o}}function v2e(t,e){let r=e.Point;return Object.assign({},e,{ExtendedPoint:r,CURVE:t,nBitLength:r.Fn.BITS,nByteLength:r.Fn.BYTES})}function w2e(t){let{CURVE:e,curveOpts:r,hash:n,eddsaOpts:i}=b2e(t),o=NH(e,r),s=qH(o,n,i);return v2e(t,s)}});var ST=G(vc=>{"use strict";p();Object.defineProperty(vc,"__esModule",{value:!0});vc._DST_scalar=void 0;vc.expand_message_xmd=zH;vc.expand_message_xof=$H;vc.hash_to_field=i6;vc.isogenyMap=E2e;vc.createHasher=S2e;var mi=jd(),UH=iu(),_2e=mi.bytesToNumberBE;function su(t,e){if(tv(t),tv(e),t<0||t>=1<<8*e)throw new Error("invalid I2OSP input: "+t);let r=Array.from({length:e}).fill(0);for(let n=e-1;n>=0;n--)r[n]=t&255,t>>>=8;return new Uint8Array(r)}function x2e(t,e){let r=new Uint8Array(t.length);for(let n=0;n<t.length;n++)r[n]=t[n]^e[n];return r}function tv(t){if(!Number.isSafeInteger(t))throw new Error("number expected")}function FH(t){if(!(0,mi.isBytes)(t)&&typeof t!="string")throw new Error("DST must be Uint8Array or string");return typeof t=="string"?(0,mi.utf8ToBytes)(t):t}function zH(t,e,r,n){(0,mi.abytes)(t),tv(r),e=FH(e),e.length>255&&(e=n((0,mi.concatBytes)((0,mi.utf8ToBytes)("H2C-OVERSIZE-DST-"),e)));let{outputLen:i,blockLen:o}=n,s=Math.ceil(r/i);if(r>65535||s>255)throw new Error("expand_message_xmd: invalid lenInBytes");let a=(0,mi.concatBytes)(e,su(e.length,1)),c=su(0,o),d=su(r,2),f=new Array(s),u=n((0,mi.concatBytes)(c,t,d,su(0,1),a));f[0]=n((0,mi.concatBytes)(u,su(1,1),a));for(let _=1;_<=s;_++){let v=[x2e(u,f[_-1]),su(_+1,1),a];f[_]=n((0,mi.concatBytes)(...v))}return(0,mi.concatBytes)(...f).slice(0,r)}function $H(t,e,r,n,i){if((0,mi.abytes)(t),tv(r),e=FH(e),e.length>255){let o=Math.ceil(2*n/8);e=i.create({dkLen:o}).update((0,mi.utf8ToBytes)("H2C-OVERSIZE-DST-")).update(e).digest()}if(r>65535||e.length>255)throw new Error("expand_message_xof: invalid lenInBytes");return i.create({dkLen:r}).update(t).update(su(r,2)).update(e).update(su(e.length,1)).digest()}function i6(t,e,r){(0,mi._validateObject)(r,{p:"bigint",m:"number",k:"number",hash:"function"});let{p:n,k:i,m:o,hash:s,expand:a,DST:c}=r;if(!(0,mi.isHash)(r.hash))throw new Error("expected valid hash");(0,mi.abytes)(t),tv(e);let d=n.toString(2).length,f=Math.ceil((d+i)/8),u=e*o*f,m;if(a==="xmd")m=zH(t,c,u,s);else if(a==="xof")m=$H(t,c,u,i,s);else if(a==="_internal_pass")m=t;else throw new Error('expand must be "xmd" or "xof"');let _=new Array(e);for(let v=0;v<e;v++){let A=new Array(o);for(let T=0;T<o;T++){let M=f*(T+v*o),D=m.subarray(M,M+f);A[T]=(0,UH.mod)(_2e(D),n)}_[v]=A}return _}function E2e(t,e){let r=e.map(n=>Array.from(n).reverse());return(n,i)=>{let[o,s,a,c]=r.map(u=>u.reduce((m,_)=>t.add(t.mul(m,n),_))),[d,f]=(0,UH.FpInvertBatch)(t,[s,c],!0);return n=t.mul(o,d),i=t.mul(i,t.mul(a,f)),{x:n,y:i}}}vc._DST_scalar=(0,mi.utf8ToBytes)("HashToScalar-");function S2e(t,e,r){if(typeof e!="function")throw new Error("mapToCurve() must be defined");function n(o){return t.fromAffine(e(o))}function i(o){let s=o.clearCofactor();return s.equals(t.ZERO)?t.ZERO:(s.assertValidity(),s)}return{defaults:r,hashToCurve(o,s){let a=Object.assign({},r,s),c=i6(o,2,a),d=n(c[0]),f=n(c[1]);return i(d.add(f))},encodeToCurve(o,s){let a=r.encodeDST?{DST:r.encodeDST}:{},c=Object.assign({},r,a,s),d=i6(o,1,c),f=n(d[0]);return i(f)},mapToCurve(o){if(!Array.isArray(o))throw new Error("expected array of bigints");for(let s of o)if(typeof s!="bigint")throw new Error("expected array of bigints");return i(n(o))},hashToScalar(o,s){let a=t.Fn.ORDER,c=Object.assign({},r,{p:a,m:1,DST:vc._DST_scalar},s);return i6(o,1,c)[0][0]}}}});var GH=G(AT=>{"use strict";p();Object.defineProperty(AT,"__esModule",{value:!0});AT.montgomery=P2e;var wc=jd(),A2e=iu(),rv=BigInt(0),rm=BigInt(1),o6=BigInt(2);function T2e(t){return(0,wc._validateObject)(t,{adjustScalarBytes:"function",powPminus2:"function"}),Object.freeze({...t})}function P2e(t){let e=T2e(t),{P:r,type:n,adjustScalarBytes:i,powPminus2:o,randomBytes:s}=e,a=n==="x25519";if(!a&&n!=="x448")throw new Error("invalid type");let c=s||wc.randomBytes,d=a?255:448,f=a?32:56,u=BigInt(a?9:5),m=BigInt(a?121665:39081),_=a?o6**BigInt(254):o6**BigInt(447),v=a?BigInt(8)*o6**BigInt(251)-rm:BigInt(4)*o6**BigInt(445)-rm,A=_+v+rm,T=x=>(0,A2e.mod)(x,r),M=D(u);function D(x){return(0,wc.numberToBytesLE)(T(x),f)}function O(x){let l=(0,wc.ensureBytes)("u coordinate",x,f);return a&&(l[31]&=127),T((0,wc.bytesToNumberLE)(l))}function U(x){return(0,wc.bytesToNumberLE)(i((0,wc.ensureBytes)("scalar",x,f)))}function L(x,l){let b=H(O(l),U(x));if(b===rv)throw new Error("invalid private or public key received");return D(b)}function F(x){return L(x,M)}function $(x,l,b){let h=T(x*(l-b));return l=T(l-h),b=T(b+h),{x_2:l,x_3:b}}function H(x,l){(0,wc.aInRange)("u",x,rv,r),(0,wc.aInRange)("scalar",l,_,A);let b=l,h=x,w=rm,E=rv,g=x,I=rm,B=rv;for(let q=BigInt(d-1);q>=rv;q--){let V=b>>q&rm;B^=V,{x_2:w,x_3:g}=$(B,w,g),{x_2:E,x_3:I}=$(B,E,I),B=V;let W=w+E,K=T(W*W),Y=w-E,J=T(Y*Y),Z=K-J,ce=g+I,oe=g-I,ae=T(oe*W),He=T(ce*Y),ye=ae+He,xe=ae-He;g=T(ye*ye),I=T(h*T(xe*xe)),w=T(K*J),E=T(Z*(K+T(m*Z)))}({x_2:w,x_3:g}=$(B,w,g)),{x_2:E,x_3:I}=$(B,E,I);let R=o(E);return T(w*R)}let z={secretKey:f,publicKey:f,seed:f},j=(x=c(f))=>((0,wc.abytes)(x,z.seed),x);function y(x){let l=j(x);return{secretKey:l,publicKey:F(l)}}return{keygen:y,getSharedSecret:(x,l)=>L(x,l),getPublicKey:x=>F(x),scalarMult:L,scalarMultBase:F,utils:{randomSecretKey:j,randomPrivateKey:j},GuBytes:M.slice(),lengths:z}}});var rW=G(Xe=>{"use strict";p();Object.defineProperty(Xe,"__esModule",{value:!0});Xe.hash_to_ristretto255=Xe.hashToRistretto255=Xe.encodeToCurve=Xe.hashToCurve=Xe.RistrettoPoint=Xe.edwardsToMontgomery=Xe.ED25519_TORSION_SUBGROUP=Xe.ristretto255_hasher=Xe.ristretto255=Xe.ed25519_hasher=Xe.x25519=Xe.ed25519ph=Xe.ed25519ctx=Xe.ed25519=void 0;Xe.edwardsToMontgomeryPub=tW;Xe.edwardsToMontgomeryPriv=F2e;var nv=X_(),a6=yc(),I2e=n6(),d6=LH(),s6=ST(),ir=iu(),R2e=GH(),Ah=jd(),M2e=BigInt(0),_c=BigInt(1),c6=BigInt(2),KH=BigInt(3),ZH=BigInt(5),RT=BigInt(8),Nd=BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffed"),iv=(()=>({p:Nd,n:BigInt("0x1000000000000000000000000000000014def9dea2f79cd65812631a5cf5d3ed"),h:RT,a:BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffec"),d:BigInt("0x52036cee2b6ffe738cc740797779e89800700a4d4141d8ab75eb4dca135978a3"),Gx:BigInt("0x216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a"),Gy:BigInt("0x6666666666666666666666666666666666666666666666666666666666666658")}))();function YH(t){let e=BigInt(10),r=BigInt(20),n=BigInt(40),i=BigInt(80),o=Nd,a=t*t%o*t%o,c=(0,ir.pow2)(a,c6,o)*a%o,d=(0,ir.pow2)(c,_c,o)*t%o,f=(0,ir.pow2)(d,ZH,o)*d%o,u=(0,ir.pow2)(f,e,o)*f%o,m=(0,ir.pow2)(u,r,o)*u%o,_=(0,ir.pow2)(m,n,o)*m%o,v=(0,ir.pow2)(_,i,o)*_%o,A=(0,ir.pow2)(v,i,o)*_%o,T=(0,ir.pow2)(A,e,o)*f%o;return{pow_p_5_8:(0,ir.pow2)(T,c6,o)*t%o,b2:a}}function JH(t){return t[0]&=248,t[31]&=127,t[31]|=64,t}var TT=BigInt("19681161376707505956807079304988542015446066515923890162744021073123829784752");function MT(t,e){let r=Nd,n=(0,ir.mod)(e*e*e,r),i=(0,ir.mod)(n*n*e,r),o=YH(t*i).pow_p_5_8,s=(0,ir.mod)(t*n*o,r),a=(0,ir.mod)(e*s*s,r),c=s,d=(0,ir.mod)(s*TT,r),f=a===t,u=a===(0,ir.mod)(-t,r),m=a===(0,ir.mod)(-t*TT,r);return f&&(s=c),(u||m)&&(s=d),(0,ir.isNegativeLE)(s,r)&&(s=(0,ir.mod)(-s,r)),{isValid:f||u,value:s}}var pe=(()=>(0,ir.Field)(iv.p,{isLE:!0}))(),XH=(()=>(0,ir.Field)(iv.n,{isLE:!0}))(),kT=(()=>({...iv,Fp:pe,hash:nv.sha512,adjustScalarBytes:JH,uvRatio:MT}))();Xe.ed25519=(()=>(0,d6.twistedEdwards)(kT))();function QH(t,e,r){if(e.length>255)throw new Error("Context is too big");return(0,a6.concatBytes)((0,a6.utf8ToBytes)("SigEd25519 no Ed25519 collisions"),new Uint8Array([r?1:0,e.length]),e,t)}Xe.ed25519ctx=(()=>(0,d6.twistedEdwards)({...kT,domain:QH}))();Xe.ed25519ph=(()=>(0,d6.twistedEdwards)(Object.assign({},kT,{domain:QH,prehash:nv.sha512})))();Xe.x25519=(()=>{let t=pe.ORDER;return(0,R2e.montgomery)({P:t,type:"x25519",powPminus2:e=>{let{pow_p_5_8:r,b2:n}=YH(e);return(0,ir.mod)((0,ir.pow2)(r,KH,t)*n,t)},adjustScalarBytes:JH})})();var k2e=(()=>(Nd+KH)/RT)(),B2e=(()=>pe.pow(c6,k2e))(),HH=(()=>pe.sqrt(pe.neg(pe.ONE)))();function D2e(t){let e=(Nd-ZH)/RT,r=BigInt(486662),n=pe.sqr(t);n=pe.mul(n,c6);let i=pe.add(n,pe.ONE),o=pe.neg(r),s=pe.sqr(i),a=pe.mul(s,i),c=pe.mul(n,r);c=pe.mul(c,o),c=pe.add(c,s),c=pe.mul(c,o);let d=pe.sqr(a);s=pe.sqr(d),d=pe.mul(d,a),d=pe.mul(d,c),s=pe.mul(s,d);let f=pe.pow(s,e);f=pe.mul(f,d);let u=pe.mul(f,HH);s=pe.sqr(f),s=pe.mul(s,a);let m=pe.eql(s,c),_=pe.cmov(u,f,m),v=pe.mul(o,n),A=pe.mul(f,t);A=pe.mul(A,B2e);let T=pe.mul(A,HH),M=pe.mul(c,n);s=pe.sqr(A),s=pe.mul(s,a);let D=pe.eql(s,M),O=pe.cmov(T,A,D);s=pe.sqr(_),s=pe.mul(s,a);let U=pe.eql(s,c),L=pe.cmov(v,o,U),F=pe.cmov(O,_,U),$=pe.isOdd(F);return F=pe.cmov(F,pe.neg(F),U!==$),{xMn:L,xMd:i,yMn:F,yMd:_c}}var C2e=(()=>(0,ir.FpSqrtEven)(pe,pe.neg(BigInt(486664))))();function O2e(t){let{xMn:e,xMd:r,yMn:n,yMd:i}=D2e(t),o=pe.mul(e,i);o=pe.mul(o,C2e);let s=pe.mul(r,n),a=pe.sub(e,r),c=pe.add(e,r),d=pe.mul(s,c),f=pe.eql(d,pe.ZERO);o=pe.cmov(o,pe.ZERO,f),s=pe.cmov(s,pe.ONE,f),a=pe.cmov(a,pe.ONE,f),c=pe.cmov(c,pe.ONE,f);let[u,m]=(0,ir.FpInvertBatch)(pe,[s,c],!0);return{x:pe.mul(o,u),y:pe.mul(a,m)}}Xe.ed25519_hasher=(()=>(0,s6.createHasher)(Xe.ed25519.Point,t=>O2e(t[0]),{DST:"edwards25519_XMD:SHA-512_ELL2_RO_",encodeDST:"edwards25519_XMD:SHA-512_ELL2_NU_",p:Nd,m:1,k:128,expand:"xmd",hash:nv.sha512}))();var PT=TT,j2e=BigInt("25063068953384623474111414158702152701244531502492656460079210482610430750235"),N2e=BigInt("54469307008909316920995813868745141605393597292927456921205312896311721017578"),q2e=BigInt("1159843021668779879193775521855586647937357759715417654439879720876111806838"),L2e=BigInt("40440834346308536858101042469323190826248399146238708352240133220865137265952"),WH=t=>MT(_c,t),U2e=BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"),IT=t=>Xe.ed25519.Point.Fp.create((0,Ah.bytesToNumberLE)(t)&U2e);function VH(t){let{d:e}=iv,r=Nd,n=M=>pe.create(M),i=n(PT*t*t),o=n((i+_c)*q2e),s=BigInt(-1),a=n((s-e*i)*n(i+e)),{isValid:c,value:d}=MT(o,a),f=n(d*t);(0,ir.isNegativeLE)(f,r)||(f=n(-f)),c||(d=f),c||(s=i);let u=n(s*(i-_c)*L2e-a),m=d*d,_=n((d+d)*a),v=n(u*j2e),A=n(_c-m),T=n(_c+m);return new Xe.ed25519.Point(n(_*T),n(A*v),n(v*T),n(_*A))}function eW(t){(0,a6.abytes)(t,64);let e=IT(t.subarray(0,32)),r=VH(e),n=IT(t.subarray(32,64)),i=VH(n);return new jn(r.add(i))}var jn=class extends d6.PrimeEdwardsPoint{constructor(e){super(e)}static fromAffine(e){return new jn(Xe.ed25519.Point.fromAffine(e))}assertSame(e){if(!(e instanceof jn))throw new Error("RistrettoPoint expected")}init(e){return new jn(e)}static hashToCurve(e){return eW((0,Ah.ensureBytes)("ristrettoHash",e,64))}static fromBytes(e){(0,a6.abytes)(e,32);let{a:r,d:n}=iv,i=Nd,o=U=>pe.create(U),s=IT(e);if(!(0,Ah.equalBytes)(pe.toBytes(s),e)||(0,ir.isNegativeLE)(s,i))throw new Error("invalid ristretto255 encoding 1");let a=o(s*s),c=o(_c+r*a),d=o(_c-r*a),f=o(c*c),u=o(d*d),m=o(r*n*f-u),{isValid:_,value:v}=WH(o(m*u)),A=o(v*d),T=o(v*A*m),M=o((s+s)*A);(0,ir.isNegativeLE)(M,i)&&(M=o(-M));let D=o(c*T),O=o(M*D);if(!_||(0,ir.isNegativeLE)(O,i)||D===M2e)throw new Error("invalid ristretto255 encoding 2");return new jn(new Xe.ed25519.Point(M,D,_c,O))}static fromHex(e){return jn.fromBytes((0,Ah.ensureBytes)("ristrettoHex",e,32))}static msm(e,r){return(0,I2e.pippenger)(jn,Xe.ed25519.Point.Fn,e,r)}toBytes(){let{X:e,Y:r,Z:n,T:i}=this.ep,o=Nd,s=T=>pe.create(T),a=s(s(n+r)*s(n-r)),c=s(e*r),d=s(c*c),{value:f}=WH(s(a*d)),u=s(f*a),m=s(f*c),_=s(u*m*i),v;if((0,ir.isNegativeLE)(i*_,o)){let T=s(r*PT),M=s(e*PT);e=T,r=M,v=s(u*N2e)}else v=m;(0,ir.isNegativeLE)(e*_,o)&&(r=s(-r));let A=s((n-r)*v);return(0,ir.isNegativeLE)(A,o)&&(A=s(-A)),pe.toBytes(A)}equals(e){this.assertSame(e);let{X:r,Y:n}=this.ep,{X:i,Y:o}=e.ep,s=d=>pe.create(d),a=s(r*o)===s(n*i),c=s(n*o)===s(r*i);return a||c}is0(){return this.equals(jn.ZERO)}};jn.BASE=(()=>new jn(Xe.ed25519.Point.BASE))();jn.ZERO=(()=>new jn(Xe.ed25519.Point.ZERO))();jn.Fp=(()=>pe)();jn.Fn=(()=>XH)();Xe.ristretto255={Point:jn};Xe.ristretto255_hasher={hashToCurve(t,e){let r=e?.DST||"ristretto255_XMD:SHA-512_R255MAP_RO_",n=(0,s6.expand_message_xmd)(t,r,64,nv.sha512);return eW(n)},hashToScalar(t,e={DST:s6._DST_scalar}){let r=(0,s6.expand_message_xmd)(t,e.DST,64,nv.sha512);return XH.create((0,Ah.bytesToNumberLE)(r))}};Xe.ED25519_TORSION_SUBGROUP=["0100000000000000000000000000000000000000000000000000000000000000","c7176a703d4dd84fba3c0b760d10670f2a2053fa2c39ccc64ec7fd7792ac037a","0000000000000000000000000000000000000000000000000000000000000080","26e8958fc2b227b045c3f489f2ef98f0d5dfac05d3c63339b13802886d53fc05","ecffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff7f","26e8958fc2b227b045c3f489f2ef98f0d5dfac05d3c63339b13802886d53fc85","0000000000000000000000000000000000000000000000000000000000000000","c7176a703d4dd84fba3c0b760d10670f2a2053fa2c39ccc64ec7fd7792ac03fa"];function tW(t){return Xe.ed25519.utils.toMontgomery((0,Ah.ensureBytes)("pub",t))}Xe.edwardsToMontgomery=tW;function F2e(t){return Xe.ed25519.utils.toMontgomerySecret((0,Ah.ensureBytes)("pub",t))}Xe.RistrettoPoint=jn;Xe.hashToCurve=(()=>Xe.ed25519_hasher.hashToCurve)();Xe.encodeToCurve=(()=>Xe.ed25519_hasher.encodeToCurve)();Xe.hashToRistretto255=(()=>Xe.ristretto255_hasher.hashToCurve)();Xe.hash_to_ristretto255=(()=>Xe.ristretto255_hasher.hashToCurve)()});var BT=G(Ph=>{"use strict";p();Object.defineProperty(Ph,"__esModule",{value:!0});Ph.hmac=Ph.HMAC=void 0;var Th=yc(),ov=class extends Th.Hash{constructor(e,r){super(),this.finished=!1,this.destroyed=!1,(0,Th.ahash)(e);let n=(0,Th.toBytes)(r);if(this.iHash=e.create(),typeof this.iHash.update!="function")throw new Error("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;let i=this.blockLen,o=new Uint8Array(i);o.set(n.length>i?e.create().update(n).digest():n);for(let s=0;s<o.length;s++)o[s]^=54;this.iHash.update(o),this.oHash=e.create();for(let s=0;s<o.length;s++)o[s]^=106;this.oHash.update(o),(0,Th.clean)(o)}update(e){return(0,Th.aexists)(this),this.iHash.update(e),this}digestInto(e){(0,Th.aexists)(this),(0,Th.abytes)(e,this.outputLen),this.finished=!0,this.iHash.digestInto(e),this.oHash.update(e),this.oHash.digestInto(e),this.destroy()}digest(){let e=new Uint8Array(this.oHash.outputLen);return this.digestInto(e),e}_cloneInto(e){e||(e=Object.create(Object.getPrototypeOf(this),{}));let{oHash:r,iHash:n,finished:i,destroyed:o,blockLen:s,outputLen:a}=this;return e=e,e.finished=i,e.destroyed=o,e.blockLen=s,e.outputLen=a,e.oHash=r._cloneInto(e.oHash),e.iHash=n._cloneInto(e.iHash),e}clone(){return this._cloneInto()}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}};Ph.HMAC=ov;var z2e=(t,e,r)=>new ov(t,e).update(r).digest();Ph.hmac=z2e;Ph.hmac.create=(t,e)=>new ov(t,e)});var NT=G(Ur=>{"use strict";p();Object.defineProperty(Ur,"__esModule",{value:!0});Ur.DER=Ur.DERErr=void 0;Ur._splitEndoScalar=iW;Ur._normFnElement=au;Ur.weierstrassN=jT;Ur.SWUFpSqrtRatio=sW;Ur.mapToCurveSimpleSWU=H2e;Ur.ecdh=cW;Ur.ecdsa=dW;Ur.weierstrassPoints=W2e;Ur._legacyHelperEquat=uW;Ur.weierstrass=Y2e;var $2e=BT(),G2e=yc(),Ie=jd(),qd=n6(),im=iu(),nW=(t,e)=>(t+(t>=0?e:-e)/xc)/e;function iW(t,e,r){let[[n,i],[o,s]]=e,a=nW(s*t,r),c=nW(-i*t,r),d=t-a*n-c*o,f=-a*i-c*s,u=d<Ea,m=f<Ea;u&&(d=-d),m&&(f=-f);let _=(0,Ie.bitMask)(Math.ceil((0,Ie.bitLen)(r)/2))+yi;if(d<Ea||d>=_||f<Ea||f>=_)throw new Error("splitScalar (endomorphism): failed, k="+t);return{k1neg:u,k1:d,k2neg:m,k2:f}}function CT(t){if(!["compact","recovered","der"].includes(t))throw new Error('Signature format must be "compact", "recovered", or "der"');return t}function DT(t,e){let r={};for(let n of Object.keys(e))r[n]=t[n]===void 0?e[n]:t[n];return(0,Ie._abool2)(r.lowS,"lowS"),(0,Ie._abool2)(r.prehash,"prehash"),r.format!==void 0&&CT(r.format),r}var f6=class extends Error{constructor(e=""){super(e)}};Ur.DERErr=f6;Ur.DER={Err:f6,_tlv:{encode:(t,e)=>{let{Err:r}=Ur.DER;if(t<0||t>256)throw new r("tlv.encode: wrong tag");if(e.length&1)throw new r("tlv.encode: unpadded data");let n=e.length/2,i=(0,Ie.numberToHexUnpadded)(n);if(i.length/2&128)throw new r("tlv.encode: long form length too big");let o=n>127?(0,Ie.numberToHexUnpadded)(i.length/2|128):"";return(0,Ie.numberToHexUnpadded)(t)+o+i+e},decode(t,e){let{Err:r}=Ur.DER,n=0;if(t<0||t>256)throw new r("tlv.encode: wrong tag");if(e.length<2||e[n++]!==t)throw new r("tlv.decode: wrong tlv");let i=e[n++],o=!!(i&128),s=0;if(!o)s=i;else{let c=i&127;if(!c)throw new r("tlv.decode(long): indefinite length not supported");if(c>4)throw new r("tlv.decode(long): byte length is too big");let d=e.subarray(n,n+c);if(d.length!==c)throw new r("tlv.decode: length bytes not complete");if(d[0]===0)throw new r("tlv.decode(long): zero leftmost byte");for(let f of d)s=s<<8|f;if(n+=c,s<128)throw new r("tlv.decode(long): not minimal encoding")}let a=e.subarray(n,n+s);if(a.length!==s)throw new r("tlv.decode: wrong value length");return{v:a,l:e.subarray(n+s)}}},_int:{encode(t){let{Err:e}=Ur.DER;if(t<Ea)throw new e("integer: negative integers are not allowed");let r=(0,Ie.numberToHexUnpadded)(t);if(Number.parseInt(r[0],16)&8&&(r="00"+r),r.length&1)throw new e("unexpected DER parsing assertion: unpadded hex");return r},decode(t){let{Err:e}=Ur.DER;if(t[0]&128)throw new e("invalid signature integer: negative");if(t[0]===0&&!(t[1]&128))throw new e("invalid signature integer: unnecessary leading zero");return(0,Ie.bytesToNumberBE)(t)}},toSig(t){let{Err:e,_int:r,_tlv:n}=Ur.DER,i=(0,Ie.ensureBytes)("signature",t),{v:o,l:s}=n.decode(48,i);if(s.length)throw new e("invalid signature: left bytes after parsing");let{v:a,l:c}=n.decode(2,o),{v:d,l:f}=n.decode(2,c);if(f.length)throw new e("invalid signature: left bytes after parsing");return{r:r.decode(a),s:r.decode(d)}},hexFromSig(t){let{_tlv:e,_int:r}=Ur.DER,n=e.encode(2,r.encode(t.r)),i=e.encode(2,r.encode(t.s)),o=n+i;return e.encode(48,o)}};var Ea=BigInt(0),yi=BigInt(1),xc=BigInt(2),nm=BigInt(3),OT=BigInt(4);function au(t,e){let{BYTES:r}=t,n;if(typeof e=="bigint")n=e;else{let i=(0,Ie.ensureBytes)("private key",e);try{n=t.fromBytes(i)}catch{throw new Error(`invalid private key: expected ui8a of size ${r}, got ${typeof e}`)}}if(!t.isValidNot0(n))throw new Error("invalid private key: out of range [1..N-1]");return n}function jT(t,e={}){let r=(0,qd._createCurveFields)("weierstrass",t,e),{Fp:n,Fn:i}=r,o=r.CURVE,{h:s,n:a}=o;(0,Ie._validateObject)(e,{},{allowInfinityPoint:"boolean",clearCofactor:"function",isTorsionFree:"function",fromBytes:"function",toBytes:"function",endo:"object",wrapPrivateKey:"boolean"});let{endo:c}=e;if(c&&(!n.is0(o.a)||typeof c.beta!="bigint"||!Array.isArray(c.basises)))throw new Error('invalid endo: expected "beta": bigint and "basises": array');let d=aW(n,i);function f(){if(!n.isOdd)throw new Error("compression is not supported: Field does not have .isOdd()")}function u(P,x,l){let{x:b,y:h}=x.toAffine(),w=n.toBytes(b);if((0,Ie._abool2)(l,"isCompressed"),l){f();let E=!n.isOdd(h);return(0,Ie.concatBytes)(oW(E),w)}else return(0,Ie.concatBytes)(Uint8Array.of(4),w,n.toBytes(h))}function m(P){(0,Ie._abytes2)(P,void 0,"Point");let{publicKey:x,publicKeyUncompressed:l}=d,b=P.length,h=P[0],w=P.subarray(1);if(b===x&&(h===2||h===3)){let E=n.fromBytes(w);if(!n.isValid(E))throw new Error("bad point: is not on curve, wrong x");let g=A(E),I;try{I=n.sqrt(g)}catch(q){let V=q instanceof Error?": "+q.message:"";throw new Error("bad point: is not on curve, sqrt error"+V)}f();let B=n.isOdd(I);return(h&1)===1!==B&&(I=n.neg(I)),{x:E,y:I}}else if(b===l&&h===4){let E=n.BYTES,g=n.fromBytes(w.subarray(0,E)),I=n.fromBytes(w.subarray(E,E*2));if(!T(g,I))throw new Error("bad point: is not on curve");return{x:g,y:I}}else throw new Error(`bad point: got length ${b}, expected compressed=${x} or uncompressed=${l}`)}let _=e.toBytes||u,v=e.fromBytes||m;function A(P){let x=n.sqr(P),l=n.mul(x,P);return n.add(n.add(l,n.mul(P,o.a)),o.b)}function T(P,x){let l=n.sqr(x),b=A(P);return n.eql(l,b)}if(!T(o.Gx,o.Gy))throw new Error("bad curve params: generator point");let M=n.mul(n.pow(o.a,nm),OT),D=n.mul(n.sqr(o.b),BigInt(27));if(n.is0(n.add(M,D)))throw new Error("bad curve params: a or b");function O(P,x,l=!1){if(!n.isValid(x)||l&&n.is0(x))throw new Error(`bad point coordinate ${P}`);return x}function U(P){if(!(P instanceof z))throw new Error("ProjectivePoint expected")}function L(P){if(!c||!c.basises)throw new Error("no endo");return iW(P,c.basises,i.ORDER)}let F=(0,Ie.memoized)((P,x)=>{let{X:l,Y:b,Z:h}=P;if(n.eql(h,n.ONE))return{x:l,y:b};let w=P.is0();x==null&&(x=w?n.ONE:n.inv(h));let E=n.mul(l,x),g=n.mul(b,x),I=n.mul(h,x);if(w)return{x:n.ZERO,y:n.ZERO};if(!n.eql(I,n.ONE))throw new Error("invZ was invalid");return{x:E,y:g}}),$=(0,Ie.memoized)(P=>{if(P.is0()){if(e.allowInfinityPoint&&!n.is0(P.Y))return;throw new Error("bad point: ZERO")}let{x,y:l}=P.toAffine();if(!n.isValid(x)||!n.isValid(l))throw new Error("bad point: x or y not field elements");if(!T(x,l))throw new Error("bad point: equation left != right");if(!P.isTorsionFree())throw new Error("bad point: not in prime-order subgroup");return!0});function H(P,x,l,b,h){return l=new z(n.mul(l.X,P),l.Y,l.Z),x=(0,qd.negateCt)(b,x),l=(0,qd.negateCt)(h,l),x.add(l)}class z{constructor(x,l,b){this.X=O("x",x),this.Y=O("y",l,!0),this.Z=O("z",b),Object.freeze(this)}static CURVE(){return o}static fromAffine(x){let{x:l,y:b}=x||{};if(!x||!n.isValid(l)||!n.isValid(b))throw new Error("invalid affine point");if(x instanceof z)throw new Error("projective point not allowed");return n.is0(l)&&n.is0(b)?z.ZERO:new z(l,b,n.ONE)}static fromBytes(x){let l=z.fromAffine(v((0,Ie._abytes2)(x,void 0,"point")));return l.assertValidity(),l}static fromHex(x){return z.fromBytes((0,Ie.ensureBytes)("pointHex",x))}get x(){return this.toAffine().x}get y(){return this.toAffine().y}precompute(x=8,l=!0){return y.createCache(this,x),l||this.multiply(nm),this}assertValidity(){$(this)}hasEvenY(){let{y:x}=this.toAffine();if(!n.isOdd)throw new Error("Field doesn't support isOdd");return!n.isOdd(x)}equals(x){U(x);let{X:l,Y:b,Z:h}=this,{X:w,Y:E,Z:g}=x,I=n.eql(n.mul(l,g),n.mul(w,h)),B=n.eql(n.mul(b,g),n.mul(E,h));return I&&B}negate(){return new z(this.X,n.neg(this.Y),this.Z)}double(){let{a:x,b:l}=o,b=n.mul(l,nm),{X:h,Y:w,Z:E}=this,g=n.ZERO,I=n.ZERO,B=n.ZERO,R=n.mul(h,h),q=n.mul(w,w),V=n.mul(E,E),W=n.mul(h,w);return W=n.add(W,W),B=n.mul(h,E),B=n.add(B,B),g=n.mul(x,B),I=n.mul(b,V),I=n.add(g,I),g=n.sub(q,I),I=n.add(q,I),I=n.mul(g,I),g=n.mul(W,g),B=n.mul(b,B),V=n.mul(x,V),W=n.sub(R,V),W=n.mul(x,W),W=n.add(W,B),B=n.add(R,R),R=n.add(B,R),R=n.add(R,V),R=n.mul(R,W),I=n.add(I,R),V=n.mul(w,E),V=n.add(V,V),R=n.mul(V,W),g=n.sub(g,R),B=n.mul(V,q),B=n.add(B,B),B=n.add(B,B),new z(g,I,B)}add(x){U(x);let{X:l,Y:b,Z:h}=this,{X:w,Y:E,Z:g}=x,I=n.ZERO,B=n.ZERO,R=n.ZERO,q=o.a,V=n.mul(o.b,nm),W=n.mul(l,w),K=n.mul(b,E),Y=n.mul(h,g),J=n.add(l,b),Z=n.add(w,E);J=n.mul(J,Z),Z=n.add(W,K),J=n.sub(J,Z),Z=n.add(l,h);let ce=n.add(w,g);return Z=n.mul(Z,ce),ce=n.add(W,Y),Z=n.sub(Z,ce),ce=n.add(b,h),I=n.add(E,g),ce=n.mul(ce,I),I=n.add(K,Y),ce=n.sub(ce,I),R=n.mul(q,Z),I=n.mul(V,Y),R=n.add(I,R),I=n.sub(K,R),R=n.add(K,R),B=n.mul(I,R),K=n.add(W,W),K=n.add(K,W),Y=n.mul(q,Y),Z=n.mul(V,Z),K=n.add(K,Y),Y=n.sub(W,Y),Y=n.mul(q,Y),Z=n.add(Z,Y),W=n.mul(K,Z),B=n.add(B,W),W=n.mul(ce,Z),I=n.mul(J,I),I=n.sub(I,W),W=n.mul(J,K),R=n.mul(ce,R),R=n.add(R,W),new z(I,B,R)}subtract(x){return this.add(x.negate())}is0(){return this.equals(z.ZERO)}multiply(x){let{endo:l}=e;if(!i.isValidNot0(x))throw new Error("invalid scalar: out of range");let b,h,w=E=>y.cached(this,E,g=>(0,qd.normalizeZ)(z,g));if(l){let{k1neg:E,k1:g,k2neg:I,k2:B}=L(x),{p:R,f:q}=w(g),{p:V,f:W}=w(B);h=q.add(W),b=H(l.beta,R,V,E,I)}else{let{p:E,f:g}=w(x);b=E,h=g}return(0,qd.normalizeZ)(z,[b,h])[0]}multiplyUnsafe(x){let{endo:l}=e,b=this;if(!i.isValid(x))throw new Error("invalid scalar: out of range");if(x===Ea||b.is0())return z.ZERO;if(x===yi)return b;if(y.hasCache(this))return this.multiply(x);if(l){let{k1neg:h,k1:w,k2neg:E,k2:g}=L(x),{p1:I,p2:B}=(0,qd.mulEndoUnsafe)(z,b,w,g);return H(l.beta,I,B,h,E)}else return y.unsafe(b,x)}multiplyAndAddUnsafe(x,l,b){let h=this.multiplyUnsafe(l).add(x.multiplyUnsafe(b));return h.is0()?void 0:h}toAffine(x){return F(this,x)}isTorsionFree(){let{isTorsionFree:x}=e;return s===yi?!0:x?x(z,this):y.unsafe(this,a).is0()}clearCofactor(){let{clearCofactor:x}=e;return s===yi?this:x?x(z,this):this.multiplyUnsafe(s)}isSmallOrder(){return this.multiplyUnsafe(s).is0()}toBytes(x=!0){return(0,Ie._abool2)(x,"isCompressed"),this.assertValidity(),_(z,this,x)}toHex(x=!0){return(0,Ie.bytesToHex)(this.toBytes(x))}toString(){return`<Point ${this.is0()?"ZERO":this.toHex()}>`}get px(){return this.X}get py(){return this.X}get pz(){return this.Z}toRawBytes(x=!0){return this.toBytes(x)}_setWindowSize(x){this.precompute(x)}static normalizeZ(x){return(0,qd.normalizeZ)(z,x)}static msm(x,l){return(0,qd.pippenger)(z,i,x,l)}static fromPrivateKey(x){return z.BASE.multiply(au(i,x))}}z.BASE=new z(o.Gx,o.Gy,n.ONE),z.ZERO=new z(n.ZERO,n.ONE,n.ZERO),z.Fp=n,z.Fn=i;let j=i.BITS,y=new qd.wNAF(z,e.endo?Math.ceil(j/2):j);return z.BASE.precompute(8),z}function oW(t){return Uint8Array.of(t?2:3)}function sW(t,e){let r=t.ORDER,n=Ea;for(let v=r-yi;v%xc===Ea;v/=xc)n+=yi;let i=n,o=xc<<i-yi-yi,s=o*xc,a=(r-yi)/s,c=(a-yi)/xc,d=s-yi,f=o,u=t.pow(e,a),m=t.pow(e,(a+yi)/xc),_=(v,A)=>{let T=u,M=t.pow(A,d),D=t.sqr(M);D=t.mul(D,A);let O=t.mul(v,D);O=t.pow(O,c),O=t.mul(O,M),M=t.mul(O,A),D=t.mul(O,v);let U=t.mul(D,M);O=t.pow(U,f);let L=t.eql(O,t.ONE);M=t.mul(D,m),O=t.mul(U,T),D=t.cmov(M,D,L),U=t.cmov(O,U,L);for(let F=i;F>yi;F--){let $=F-xc;$=xc<<$-yi;let H=t.pow(U,$),z=t.eql(H,t.ONE);M=t.mul(D,T),T=t.mul(T,T),H=t.mul(U,T),D=t.cmov(M,D,z),U=t.cmov(H,U,z)}return{isValid:L,value:D}};if(t.ORDER%OT===nm){let v=(t.ORDER-nm)/OT,A=t.sqrt(t.neg(e));_=(T,M)=>{let D=t.sqr(M),O=t.mul(T,M);D=t.mul(D,O);let U=t.pow(D,v);U=t.mul(U,O);let L=t.mul(U,A),F=t.mul(t.sqr(U),M),$=t.eql(F,T),H=t.cmov(L,U,$);return{isValid:$,value:H}}}return _}function H2e(t,e){(0,im.validateField)(t);let{A:r,B:n,Z:i}=e;if(!t.isValid(r)||!t.isValid(n)||!t.isValid(i))throw new Error("mapToCurveSimpleSWU: invalid opts");let o=sW(t,i);if(!t.isOdd)throw new Error("Field does not have .isOdd()");return s=>{let a,c,d,f,u,m,_,v;a=t.sqr(s),a=t.mul(a,i),c=t.sqr(a),c=t.add(c,a),d=t.add(c,t.ONE),d=t.mul(d,n),f=t.cmov(i,t.neg(c),!t.eql(c,t.ZERO)),f=t.mul(f,r),c=t.sqr(d),m=t.sqr(f),u=t.mul(m,r),c=t.add(c,u),c=t.mul(c,d),m=t.mul(m,f),u=t.mul(m,n),c=t.add(c,u),_=t.mul(a,d);let{isValid:A,value:T}=o(c,m);v=t.mul(a,s),v=t.mul(v,T),_=t.cmov(_,d,A),v=t.cmov(v,T,A);let M=t.isOdd(s)===t.isOdd(v);v=t.cmov(t.neg(v),v,M);let D=(0,im.FpInvertBatch)(t,[f],!0)[0];return _=t.mul(_,D),{x:_,y:v}}}function aW(t,e){return{secretKey:e.BYTES,publicKey:1+t.BYTES,publicKeyUncompressed:1+2*t.BYTES,publicKeyHasPrefix:!0,signature:2*e.BYTES}}function cW(t,e={}){let{Fn:r}=t,n=e.randomBytes||Ie.randomBytes,i=Object.assign(aW(t.Fp,r),{seed:(0,im.getMinHashLength)(r.ORDER)});function o(_){try{return!!au(r,_)}catch{return!1}}function s(_,v){let{publicKey:A,publicKeyUncompressed:T}=i;try{let M=_.length;return v===!0&&M!==A||v===!1&&M!==T?!1:!!t.fromBytes(_)}catch{return!1}}function a(_=n(i.seed)){return(0,im.mapHashToField)((0,Ie._abytes2)(_,i.seed,"seed"),r.ORDER)}function c(_,v=!0){return t.BASE.multiply(au(r,_)).toBytes(v)}function d(_){let v=a(_);return{secretKey:v,publicKey:c(v)}}function f(_){if(typeof _=="bigint")return!1;if(_ instanceof t)return!0;let{secretKey:v,publicKey:A,publicKeyUncompressed:T}=i;if(r.allowedLengths||v===A)return;let M=(0,Ie.ensureBytes)("key",_).length;return M===A||M===T}function u(_,v,A=!0){if(f(_)===!0)throw new Error("first arg must be private key");if(f(v)===!1)throw new Error("second arg must be public key");let T=au(r,_);return t.fromHex(v).multiply(T).toBytes(A)}return Object.freeze({getPublicKey:c,getSharedSecret:u,keygen:d,Point:t,utils:{isValidSecretKey:o,isValidPublicKey:s,randomSecretKey:a,isValidPrivateKey:o,randomPrivateKey:a,normPrivateKeyToScalar:_=>au(r,_),precompute(_=8,v=t.BASE){return v.precompute(_,!1)}},lengths:i})}function dW(t,e,r={}){(0,G2e.ahash)(e),(0,Ie._validateObject)(r,{},{hmac:"function",lowS:"boolean",randomBytes:"function",bits2int:"function",bits2int_modN:"function"});let n=r.randomBytes||Ie.randomBytes,i=r.hmac||((l,...b)=>(0,$2e.hmac)(e,l,(0,Ie.concatBytes)(...b))),{Fp:o,Fn:s}=t,{ORDER:a,BITS:c}=s,{keygen:d,getPublicKey:f,getSharedSecret:u,utils:m,lengths:_}=cW(t,r),v={prehash:!1,lowS:typeof r.lowS=="boolean"?r.lowS:!1,format:void 0,extraEntropy:!1},A="compact";function T(l){let b=a>>yi;return l>b}function M(l,b){if(!s.isValidNot0(b))throw new Error(`invalid signature ${l}: out of range 1..Point.Fn.ORDER`);return b}function D(l,b){CT(b);let h=_.signature,w=b==="compact"?h:b==="recovered"?h+1:void 0;return(0,Ie._abytes2)(l,w,`${b} signature`)}class O{constructor(b,h,w){this.r=M("r",b),this.s=M("s",h),w!=null&&(this.recovery=w),Object.freeze(this)}static fromBytes(b,h=A){D(b,h);let w;if(h==="der"){let{r:B,s:R}=Ur.DER.toSig((0,Ie._abytes2)(b));return new O(B,R)}h==="recovered"&&(w=b[0],h="compact",b=b.subarray(1));let E=s.BYTES,g=b.subarray(0,E),I=b.subarray(E,E*2);return new O(s.fromBytes(g),s.fromBytes(I),w)}static fromHex(b,h){return this.fromBytes((0,Ie.hexToBytes)(b),h)}addRecoveryBit(b){return new O(this.r,this.s,b)}recoverPublicKey(b){let h=o.ORDER,{r:w,s:E,recovery:g}=this;if(g==null||![0,1,2,3].includes(g))throw new Error("recovery id invalid");if(a*xc<h&&g>1)throw new Error("recovery id is ambiguous for h>1 curve");let B=g===2||g===3?w+a:w;if(!o.isValid(B))throw new Error("recovery id 2 or 3 invalid");let R=o.toBytes(B),q=t.fromBytes((0,Ie.concatBytes)(oW((g&1)===0),R)),V=s.inv(B),W=L((0,Ie.ensureBytes)("msgHash",b)),K=s.create(-W*V),Y=s.create(E*V),J=t.BASE.multiplyUnsafe(K).add(q.multiplyUnsafe(Y));if(J.is0())throw new Error("point at infinify");return J.assertValidity(),J}hasHighS(){return T(this.s)}toBytes(b=A){if(CT(b),b==="der")return(0,Ie.hexToBytes)(Ur.DER.hexFromSig(this));let h=s.toBytes(this.r),w=s.toBytes(this.s);if(b==="recovered"){if(this.recovery==null)throw new Error("recovery bit must be present");return(0,Ie.concatBytes)(Uint8Array.of(this.recovery),h,w)}return(0,Ie.concatBytes)(h,w)}toHex(b){return(0,Ie.bytesToHex)(this.toBytes(b))}assertValidity(){}static fromCompact(b){return O.fromBytes((0,Ie.ensureBytes)("sig",b),"compact")}static fromDER(b){return O.fromBytes((0,Ie.ensureBytes)("sig",b),"der")}normalizeS(){return this.hasHighS()?new O(this.r,s.neg(this.s),this.recovery):this}toDERRawBytes(){return this.toBytes("der")}toDERHex(){return(0,Ie.bytesToHex)(this.toBytes("der"))}toCompactRawBytes(){return this.toBytes("compact")}toCompactHex(){return(0,Ie.bytesToHex)(this.toBytes("compact"))}}let U=r.bits2int||function(b){if(b.length>8192)throw new Error("input is too large");let h=(0,Ie.bytesToNumberBE)(b),w=b.length*8-c;return w>0?h>>BigInt(w):h},L=r.bits2int_modN||function(b){return s.create(U(b))},F=(0,Ie.bitMask)(c);function $(l){return(0,Ie.aInRange)("num < 2^"+c,l,Ea,F),s.toBytes(l)}function H(l,b){return(0,Ie._abytes2)(l,void 0,"message"),b?(0,Ie._abytes2)(e(l),void 0,"prehashed message"):l}function z(l,b,h){if(["recovered","canonical"].some(K=>K in h))throw new Error("sign() legacy options not supported");let{lowS:w,prehash:E,extraEntropy:g}=DT(h,v);l=H(l,E);let I=L(l),B=au(s,b),R=[$(B),$(I)];if(g!=null&&g!==!1){let K=g===!0?n(_.secretKey):g;R.push((0,Ie.ensureBytes)("extraEntropy",K))}let q=(0,Ie.concatBytes)(...R),V=I;function W(K){let Y=U(K);if(!s.isValidNot0(Y))return;let J=s.inv(Y),Z=t.BASE.multiply(Y).toAffine(),ce=s.create(Z.x);if(ce===Ea)return;let oe=s.create(J*s.create(V+ce*B));if(oe===Ea)return;let ae=(Z.x===ce?0:2)|Number(Z.y&yi),He=oe;return w&&T(oe)&&(He=s.neg(oe),ae^=1),new O(ce,He,ae)}return{seed:q,k2sig:W}}function j(l,b,h={}){l=(0,Ie.ensureBytes)("message",l);let{seed:w,k2sig:E}=z(l,b,h);return(0,Ie.createHmacDrbg)(e.outputLen,s.BYTES,i)(w,E)}function y(l){let b,h=typeof l=="string"||(0,Ie.isBytes)(l),w=!h&&l!==null&&typeof l=="object"&&typeof l.r=="bigint"&&typeof l.s=="bigint";if(!h&&!w)throw new Error("invalid signature, expected Uint8Array, hex string or Signature instance");if(w)b=new O(l.r,l.s);else if(h){try{b=O.fromBytes((0,Ie.ensureBytes)("sig",l),"der")}catch(E){if(!(E instanceof Ur.DER.Err))throw E}if(!b)try{b=O.fromBytes((0,Ie.ensureBytes)("sig",l),"compact")}catch{return!1}}return b||!1}function P(l,b,h,w={}){let{lowS:E,prehash:g,format:I}=DT(w,v);if(h=(0,Ie.ensureBytes)("publicKey",h),b=H((0,Ie.ensureBytes)("message",b),g),"strict"in w)throw new Error("options.strict was renamed to lowS");let B=I===void 0?y(l):O.fromBytes((0,Ie.ensureBytes)("sig",l),I);if(B===!1)return!1;try{let R=t.fromBytes(h);if(E&&B.hasHighS())return!1;let{r:q,s:V}=B,W=L(b),K=s.inv(V),Y=s.create(W*K),J=s.create(q*K),Z=t.BASE.multiplyUnsafe(Y).add(R.multiplyUnsafe(J));return Z.is0()?!1:s.create(Z.x)===q}catch{return!1}}function x(l,b,h={}){let{prehash:w}=DT(h,v);return b=H(b,w),O.fromBytes(l,"recovered").recoverPublicKey(b).toBytes()}return Object.freeze({keygen:d,getPublicKey:f,getSharedSecret:u,utils:m,lengths:_,Point:t,sign:j,verify:P,recoverPublicKey:x,Signature:O,hash:e})}function W2e(t){let{CURVE:e,curveOpts:r}=fW(t),n=jT(e,r);return K2e(t,n)}function fW(t){let e={a:t.a,b:t.b,p:t.Fp.ORDER,n:t.n,h:t.h,Gx:t.Gx,Gy:t.Gy},r=t.Fp,n=t.allowedPrivateKeyLengths?Array.from(new Set(t.allowedPrivateKeyLengths.map(s=>Math.ceil(s/2)))):void 0,i=(0,im.Field)(e.n,{BITS:t.nBitLength,allowedLengths:n,modFromBytes:t.wrapPrivateKey}),o={Fp:r,Fn:i,allowInfinityPoint:t.allowInfinityPoint,endo:t.endo,isTorsionFree:t.isTorsionFree,clearCofactor:t.clearCofactor,fromBytes:t.fromBytes,toBytes:t.toBytes};return{CURVE:e,curveOpts:o}}function V2e(t){let{CURVE:e,curveOpts:r}=fW(t),n={hmac:t.hmac,randomBytes:t.randomBytes,lowS:t.lowS,bits2int:t.bits2int,bits2int_modN:t.bits2int_modN};return{CURVE:e,curveOpts:r,hash:t.hash,ecdsaOpts:n}}function uW(t,e,r){function n(i){let o=t.sqr(i),s=t.mul(o,i);return t.add(t.add(s,t.mul(i,e)),r)}return n}function K2e(t,e){let{Fp:r,Fn:n}=e;function i(s){return(0,Ie.inRange)(s,yi,n.ORDER)}let o=uW(r,t.a,t.b);return Object.assign({},{CURVE:t,Point:e,ProjectivePoint:e,normPrivateKeyToScalar:s=>au(n,s),weierstrassEquation:o,isWithinCurveOrder:i})}function Z2e(t,e){let r=e.Point;return Object.assign({},e,{ProjectivePoint:r,CURVE:Object.assign({},t,(0,im.nLength)(r.Fn.ORDER,r.Fn.BITS))})}function Y2e(t){let{CURVE:e,curveOpts:r,hash:n,ecdsaOpts:i}=V2e(t),o=jT(e,r),s=dW(o,n,i);return Z2e(t,s)}});var lW=G(u6=>{"use strict";p();Object.defineProperty(u6,"__esModule",{value:!0});u6.getHash=X2e;u6.createCurve=Q2e;var J2e=NT();function X2e(t){return{hash:t}}function Q2e(t,e){let r=n=>(0,J2e.weierstrass)({...t,hash:n});return{...r(e),create:r}}});var xW=G(gi=>{"use strict";p();Object.defineProperty(gi,"__esModule",{value:!0});gi.encodeToCurve=gi.hashToCurve=gi.secp256k1_hasher=gi.schnorr=gi.secp256k1=void 0;var l6=X_(),yW=yc(),e_e=lW(),gW=ST(),ao=iu(),bW=NT(),is=jd(),om={p:BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),n:BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),h:BigInt(1),a:BigInt(0),b:BigInt(7),Gx:BigInt("0x79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798"),Gy:BigInt("0x483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8")},t_e={beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),basises:[[BigInt("0x3086d221a7d46bcde86c90e49284eb15"),-BigInt("0xe4437ed6010e88286f547fa90abfe4c3")],[BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),BigInt("0x3086d221a7d46bcde86c90e49284eb15")]]},r_e=BigInt(0),hW=BigInt(1),qT=BigInt(2);function n_e(t){let e=om.p,r=BigInt(3),n=BigInt(6),i=BigInt(11),o=BigInt(22),s=BigInt(23),a=BigInt(44),c=BigInt(88),d=t*t*t%e,f=d*d*t%e,u=(0,ao.pow2)(f,r,e)*f%e,m=(0,ao.pow2)(u,r,e)*f%e,_=(0,ao.pow2)(m,qT,e)*d%e,v=(0,ao.pow2)(_,i,e)*_%e,A=(0,ao.pow2)(v,o,e)*v%e,T=(0,ao.pow2)(A,a,e)*A%e,M=(0,ao.pow2)(T,c,e)*T%e,D=(0,ao.pow2)(M,a,e)*A%e,O=(0,ao.pow2)(D,r,e)*f%e,U=(0,ao.pow2)(O,s,e)*v%e,L=(0,ao.pow2)(U,n,e)*d%e,F=(0,ao.pow2)(L,qT,e);if(!Ld.eql(Ld.sqr(F),t))throw new Error("Cannot find square root");return F}var Ld=(0,ao.Field)(om.p,{sqrt:n_e});gi.secp256k1=(0,e_e.createCurve)({...om,Fp:Ld,lowS:!0,endo:t_e},l6.sha256);var pW={};function h6(t,...e){let r=pW[t];if(r===void 0){let n=(0,l6.sha256)((0,is.utf8ToBytes)(t));r=(0,is.concatBytes)(n,n),pW[t]=r}return(0,l6.sha256)((0,is.concatBytes)(r,...e))}var UT=t=>t.toBytes(!0).slice(1),sm=(()=>gi.secp256k1.Point)(),FT=t=>t%qT===r_e;function LT(t){let{Fn:e,BASE:r}=sm,n=(0,bW._normFnElement)(e,t),i=r.multiply(n);return{scalar:FT(i.y)?n:e.neg(n),bytes:UT(i)}}function vW(t){let e=Ld;if(!e.isValidNot0(t))throw new Error("invalid x: Fail if x \u2265 p");let r=e.create(t*t),n=e.create(r*t+BigInt(7)),i=e.sqrt(n);FT(i)||(i=e.neg(i));let o=sm.fromAffine({x:t,y:i});return o.assertValidity(),o}var sv=is.bytesToNumberBE;function wW(...t){return sm.Fn.create(sv(h6("BIP0340/challenge",...t)))}function mW(t){return LT(t).bytes}function i_e(t,e,r=(0,yW.randomBytes)(32)){let{Fn:n}=sm,i=(0,is.ensureBytes)("message",t),{bytes:o,scalar:s}=LT(e),a=(0,is.ensureBytes)("auxRand",r,32),c=n.toBytes(s^sv(h6("BIP0340/aux",a))),d=h6("BIP0340/nonce",c,o,i),{bytes:f,scalar:u}=LT(d),m=wW(f,o,i),_=new Uint8Array(64);if(_.set(f,0),_.set(n.toBytes(n.create(u+m*s)),32),!_W(_,i,o))throw new Error("sign: Invalid signature produced");return _}function _W(t,e,r){let{Fn:n,BASE:i}=sm,o=(0,is.ensureBytes)("signature",t,64),s=(0,is.ensureBytes)("message",e),a=(0,is.ensureBytes)("publicKey",r,32);try{let c=vW(sv(a)),d=sv(o.subarray(0,32));if(!(0,is.inRange)(d,hW,om.p))return!1;let f=sv(o.subarray(32,64));if(!(0,is.inRange)(f,hW,om.n))return!1;let u=wW(n.toBytes(d),UT(c),s),m=i.multiplyUnsafe(f).add(c.multiplyUnsafe(n.neg(u))),{x:_,y:v}=m.toAffine();return!(m.is0()||!FT(v)||_!==d)}catch{return!1}}gi.schnorr=(()=>{let r=(i=(0,yW.randomBytes)(48))=>(0,ao.mapHashToField)(i,om.n);gi.secp256k1.utils.randomSecretKey;function n(i){let o=r(i);return{secretKey:o,publicKey:mW(o)}}return{keygen:n,getPublicKey:mW,sign:i_e,verify:_W,Point:sm,utils:{randomSecretKey:r,randomPrivateKey:r,taggedHash:h6,lift_x:vW,pointToBytes:UT,numberToBytesBE:is.numberToBytesBE,bytesToNumberBE:is.bytesToNumberBE,mod:ao.mod},lengths:{secretKey:32,publicKey:32,publicKeyHasPrefix:!1,signature:32*2,seed:48}}})();var o_e=(()=>(0,gW.isogenyMap)(Ld,[["0x8e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38daaaaa8c7","0x7d3d4c80bc321d5b9f315cea7fd44c5d595d2fc0bf63b92dfff1044f17c6581","0x534c328d23f234e6e2a413deca25caece4506144037c40314ecbd0b53d9dd262","0x8e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38daaaaa88c"],["0xd35771193d94918a9ca34ccbb7b640dd86cd409542f8487d9fe6b745781eb49b","0xedadc6f64383dc1df7c4b2d51b54225406d36b641f5e41bbc52a56612a8c6d14","0x0000000000000000000000000000000000000000000000000000000000000001"],["0x4bda12f684bda12f684bda12f684bda12f684bda12f684bda12f684b8e38e23c","0xc75e0c32d5cb7c0fa9d0a54b12a0a6d5647ab046d686da6fdffc90fc201d71a3","0x29a6194691f91a73715209ef6512e576722830a201be2018a765e85a9ecee931","0x2f684bda12f684bda12f684bda12f684bda12f684bda12f684bda12f38e38d84"],["0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffff93b","0x7a06534bb8bdb49fd5e9e6632722c2989467c1bfc8e8d978dfb425d2685c2573","0x6484aa716545ca2cf3a70c3fa8fe337e0a3d21162f0d6299a7bf8192bfd2a76f","0x0000000000000000000000000000000000000000000000000000000000000001"]].map(t=>t.map(e=>BigInt(e)))))(),s_e=(()=>(0,bW.mapToCurveSimpleSWU)(Ld,{A:BigInt("0x3f8731abdd661adca08a5558f0f5d272e953d363cb6f0e5d405447c01a444533"),B:BigInt("1771"),Z:Ld.create(BigInt("-11"))}))();gi.secp256k1_hasher=(()=>(0,gW.createHasher)(gi.secp256k1.Point,t=>{let{x:e,y:r}=s_e(Ld.create(t[0]));return o_e(e,r)},{DST:"secp256k1_XMD:SHA-256_SSWU_RO_",encodeDST:"secp256k1_XMD:SHA-256_SSWU_NU_",p:Ld.ORDER,m:1,k:128,expand:"xmd",hash:l6.sha256}))();gi.hashToCurve=(()=>gi.secp256k1_hasher.hashToCurve)();gi.encodeToCurve=(()=>gi.secp256k1_hasher.encodeToCurve)()});var zT=G(am=>{"use strict";p();Object.defineProperty(am,"__esModule",{value:!0});am.decodeHex=am.remove0x=void 0;var a_e=_a();function EW(t){return t.startsWith("0x")||t.startsWith("0X")?t.slice(2):t}am.remove0x=EW;function c_e(t){return(0,a_e.hexToBytes)(EW(t))}am.decodeHex=c_e});var GT=G(co=>{"use strict";p();Object.defineProperty(co,"__esModule",{value:!0});co.output=co.exists=co.hash=co.bytes=co.bool=co.number=void 0;function p6(t){if(!Number.isSafeInteger(t)||t<0)throw new Error(`Wrong positive integer: ${t}`)}co.number=p6;function SW(t){if(typeof t!="boolean")throw new Error(`Expected boolean, not ${t}`)}co.bool=SW;function $T(t,...e){if(!(t instanceof Uint8Array))throw new Error("Expected Uint8Array");if(e.length>0&&!e.includes(t.length))throw new Error(`Expected Uint8Array of length ${e}, not of length=${t.length}`)}co.bytes=$T;function AW(t){if(typeof t!="function"||typeof t.create!="function")throw new Error("hash must be wrapped by utils.wrapConstructor");p6(t.outputLen),p6(t.blockLen)}co.hash=AW;function TW(t,e=!0){if(t.destroyed)throw new Error("Hash instance has been destroyed");if(e&&t.finished)throw new Error("Hash#digest() has already been called")}co.exists=TW;function PW(t,e){$T(t);let r=e.outputLen;if(t.length<r)throw new Error(`digestInto() expects output buffer of length at least ${r}`)}co.output=PW;var d_e={number:p6,bool:SW,bytes:$T,hash:AW,exists:TW,output:PW};co.default=d_e});var RW=G(cm=>{"use strict";p();Object.defineProperty(cm,"__esModule",{value:!0});cm.poly1305=cm.wrapConstructorWithKey=void 0;var m6=_a(),HT=GT(),bi=(t,e)=>t[e++]&255|(t[e++]&255)<<8,WT=class{constructor(e){this.blockLen=16,this.outputLen=16,this.buffer=new Uint8Array(16),this.r=new Uint16Array(10),this.h=new Uint16Array(10),this.pad=new Uint16Array(8),this.pos=0,this.finished=!1,e=(0,m6.toBytes)(e),(0,m6.ensureBytes)(e,32);let r=bi(e,0),n=bi(e,2),i=bi(e,4),o=bi(e,6),s=bi(e,8),a=bi(e,10),c=bi(e,12),d=bi(e,14);this.r[0]=r&8191,this.r[1]=(r>>>13|n<<3)&8191,this.r[2]=(n>>>10|i<<6)&7939,this.r[3]=(i>>>7|o<<9)&8191,this.r[4]=(o>>>4|s<<12)&255,this.r[5]=s>>>1&8190,this.r[6]=(s>>>14|a<<2)&8191,this.r[7]=(a>>>11|c<<5)&8065,this.r[8]=(c>>>8|d<<8)&8191,this.r[9]=d>>>5&127;for(let f=0;f<8;f++)this.pad[f]=bi(e,16+2*f)}process(e,r,n=!1){let i=n?0:2048,{h:o,r:s}=this,a=s[0],c=s[1],d=s[2],f=s[3],u=s[4],m=s[5],_=s[6],v=s[7],A=s[8],T=s[9],M=bi(e,r+0),D=bi(e,r+2),O=bi(e,r+4),U=bi(e,r+6),L=bi(e,r+8),F=bi(e,r+10),$=bi(e,r+12),H=bi(e,r+14),z=o[0]+(M&8191),j=o[1]+((M>>>13|D<<3)&8191),y=o[2]+((D>>>10|O<<6)&8191),P=o[3]+((O>>>7|U<<9)&8191),x=o[4]+((U>>>4|L<<12)&8191),l=o[5]+(L>>>1&8191),b=o[6]+((L>>>14|F<<2)&8191),h=o[7]+((F>>>11|$<<5)&8191),w=o[8]+(($>>>8|H<<8)&8191),E=o[9]+(H>>>5|i),g=0,I=g+z*a+j*(5*T)+y*(5*A)+P*(5*v)+x*(5*_);g=I>>>13,I&=8191,I+=l*(5*m)+b*(5*u)+h*(5*f)+w*(5*d)+E*(5*c),g+=I>>>13,I&=8191;let B=g+z*c+j*a+y*(5*T)+P*(5*A)+x*(5*v);g=B>>>13,B&=8191,B+=l*(5*_)+b*(5*m)+h*(5*u)+w*(5*f)+E*(5*d),g+=B>>>13,B&=8191;let R=g+z*d+j*c+y*a+P*(5*T)+x*(5*A);g=R>>>13,R&=8191,R+=l*(5*v)+b*(5*_)+h*(5*m)+w*(5*u)+E*(5*f),g+=R>>>13,R&=8191;let q=g+z*f+j*d+y*c+P*a+x*(5*T);g=q>>>13,q&=8191,q+=l*(5*A)+b*(5*v)+h*(5*_)+w*(5*m)+E*(5*u),g+=q>>>13,q&=8191;let V=g+z*u+j*f+y*d+P*c+x*a;g=V>>>13,V&=8191,V+=l*(5*T)+b*(5*A)+h*(5*v)+w*(5*_)+E*(5*m),g+=V>>>13,V&=8191;let W=g+z*m+j*u+y*f+P*d+x*c;g=W>>>13,W&=8191,W+=l*a+b*(5*T)+h*(5*A)+w*(5*v)+E*(5*_),g+=W>>>13,W&=8191;let K=g+z*_+j*m+y*u+P*f+x*d;g=K>>>13,K&=8191,K+=l*c+b*a+h*(5*T)+w*(5*A)+E*(5*v),g+=K>>>13,K&=8191;let Y=g+z*v+j*_+y*m+P*u+x*f;g=Y>>>13,Y&=8191,Y+=l*d+b*c+h*a+w*(5*T)+E*(5*A),g+=Y>>>13,Y&=8191;let J=g+z*A+j*v+y*_+P*m+x*u;g=J>>>13,J&=8191,J+=l*f+b*d+h*c+w*a+E*(5*T),g+=J>>>13,J&=8191;let Z=g+z*T+j*A+y*v+P*_+x*m;g=Z>>>13,Z&=8191,Z+=l*u+b*f+h*d+w*c+E*a,g+=Z>>>13,Z&=8191,g=(g<<2)+g|0,g=g+I|0,I=g&8191,g=g>>>13,B+=g,o[0]=I,o[1]=B,o[2]=R,o[3]=q,o[4]=V,o[5]=W,o[6]=K,o[7]=Y,o[8]=J,o[9]=Z}finalize(){let{h:e,pad:r}=this,n=new Uint16Array(10),i=e[1]>>>13;e[1]&=8191;for(let a=2;a<10;a++)e[a]+=i,i=e[a]>>>13,e[a]&=8191;e[0]+=i*5,i=e[0]>>>13,e[0]&=8191,e[1]+=i,i=e[1]>>>13,e[1]&=8191,e[2]+=i,n[0]=e[0]+5,i=n[0]>>>13,n[0]&=8191;for(let a=1;a<10;a++)n[a]=e[a]+i,i=n[a]>>>13,n[a]&=8191;n[9]-=1<<13;let o=(i^1)-1;for(let a=0;a<10;a++)n[a]&=o;o=~o;for(let a=0;a<10;a++)e[a]=e[a]&o|n[a];e[0]=(e[0]|e[1]<<13)&65535,e[1]=(e[1]>>>3|e[2]<<10)&65535,e[2]=(e[2]>>>6|e[3]<<7)&65535,e[3]=(e[3]>>>9|e[4]<<4)&65535,e[4]=(e[4]>>>12|e[5]<<1|e[6]<<14)&65535,e[5]=(e[6]>>>2|e[7]<<11)&65535,e[6]=(e[7]>>>5|e[8]<<8)&65535,e[7]=(e[8]>>>8|e[9]<<5)&65535;let s=e[0]+r[0];e[0]=s&65535;for(let a=1;a<8;a++)s=(e[a]+r[a]|0)+(s>>>16)|0,e[a]=s&65535}update(e){HT.default.exists(this);let{buffer:r,blockLen:n}=this;e=(0,m6.toBytes)(e);let i=e.length;for(let o=0;o<i;){let s=Math.min(n-this.pos,i-o);if(s===n){for(;n<=i-o;o+=n)this.process(e,o);continue}r.set(e.subarray(o,o+s),this.pos),this.pos+=s,o+=s,this.pos===n&&(this.process(r,0,!1),this.pos=0)}return this}destroy(){this.h.fill(0),this.r.fill(0),this.buffer.fill(0),this.pad.fill(0)}digestInto(e){HT.default.exists(this),HT.default.output(e,this),this.finished=!0;let{buffer:r,h:n}=this,{pos:i}=this;if(i){for(r[i++]=1;i<16;i++)r[i]=0;this.process(r,0,!0)}this.finalize();let o=0;for(let s=0;s<8;s++)e[o++]=n[s]>>>0,e[o++]=n[s]>>>8;return e}digest(){let{buffer:e,outputLen:r}=this;this.digestInto(e);let n=e.slice(0,r);return this.destroy(),n}};function IW(t){let e=(n,i)=>t(i).update((0,m6.toBytes)(n)).digest(),r=t(new Uint8Array(32));return e.outputLen=r.outputLen,e.blockLen=r.blockLen,e.create=n=>t(n),e}cm.wrapConstructorWithKey=IW;cm.poly1305=IW(t=>new WT(t))});var MW=G(g6=>{"use strict";p();Object.defineProperty(g6,"__esModule",{value:!0});g6.salsaBasic=void 0;var Ec=GT(),Sc=_a(),f_e=(0,Sc.utf8ToBytes)("expand 16-byte k"),u_e=(0,Sc.utf8ToBytes)("expand 32-byte k"),l_e=(0,Sc.u32)(f_e),h_e=(0,Sc.u32)(u_e),y6=t=>!(t.byteOffset%4),p_e=t=>{let{core:e,rounds:r,counterRight:n,counterLen:i,allow128bitKeys:o,extendNonceFn:s,blockLen:a}=(0,Sc.checkOpts)({rounds:20,counterRight:!1,counterLen:8,allow128bitKeys:!0,blockLen:64},t);Ec.default.number(i),Ec.default.number(r),Ec.default.number(a),Ec.default.bool(n),Ec.default.bool(o);let c=a/4;if(a%4!==0)throw new Error("Salsa/ChaCha: blockLen must be aligned to 4 bytes");return(d,f,u,m,_=0)=>{if(Ec.default.bytes(d),Ec.default.bytes(f),Ec.default.bytes(u),m||(m=new Uint8Array(u.length)),Ec.default.bytes(m),Ec.default.number(_),_<0||_>=2**32-1)throw new Error("Salsa/ChaCha: counter overflow");if(m.length<u.length)throw new Error(`Salsa/ChaCha: output (${m.length}) is shorter than data (${u.length})`);let v=[],A,T;if(d.length===32)y6(d)?A=d:(A=d.slice(),v.push(A)),T=h_e;else if(d.length===16&&o)A=new Uint8Array(32),A.set(d),A.set(d,16),T=l_e,v.push(A);else throw new Error(`Salsa/ChaCha: invalid 32-byte key, got length=${d.length}`);if(y6(f)||(f=f.slice(),v.push(f)),s){if(f.length<=16)throw new Error("Salsa/ChaCha: extended nonce must be bigger than 16 bytes");A=s(T,A,f.subarray(0,16),new Uint8Array(32)),v.push(A),f=f.subarray(16)}let M=16-i;if(f.length!==M)throw new Error(`Salsa/ChaCha: nonce must be ${M} or 16 bytes`);if(M!==12){let z=new Uint8Array(12);z.set(f,n?0:12-f.length),v.push(f=z)}let D=new Uint8Array(a),O=(0,Sc.u32)(D),U=(0,Sc.u32)(A),L=(0,Sc.u32)(f),F=y6(u)&&(0,Sc.u32)(u),$=y6(m)&&(0,Sc.u32)(m);v.push(O);let H=u.length;for(let z=0,j=_;z<H;j++){if(e(T,U,L,O,j,r),j>=2**32-1)throw new Error("Salsa/ChaCha: counter overflow");let y=Math.min(a,H-z);if(y===a&&$&&F){let P=z/4;if(z%4!==0)throw new Error("Salsa/ChaCha: invalid block position");for(let x=0;x<c;x++)$[P+x]=F[P+x]^O[x];z+=a;continue}for(let P=0;P<y;P++)m[z+P]=u[z+P]^D[P];z+=y}for(let z=0;z<v.length;z++)v[z].fill(0);return m}};g6.salsaBasic=p_e});var CW=G(Zr=>{"use strict";p();Object.defineProperty(Zr,"__esModule",{value:!0});Zr.xchacha20poly1305=Zr.chacha20poly1305=Zr._poly1305_aead=Zr.chacha12=Zr.chacha8=Zr.xchacha20=Zr.chacha20=Zr.chacha20orig=Zr.hchacha=void 0;var Sa=_a(),m_e=RW(),av=MW(),Ee=(t,e)=>t<<e|t>>>32-e;function cv(t,e,r,n,i,o=20){let s=t[0],a=t[1],c=t[2],d=t[3],f=e[0],u=e[1],m=e[2],_=e[3],v=e[4],A=e[5],T=e[6],M=e[7],D=i,O=r[0],U=r[1],L=r[2],F=s,$=a,H=c,z=d,j=f,y=u,P=m,x=_,l=v,b=A,h=T,w=M,E=D,g=O,I=U,B=L;for(let q=0;q<o;q+=2)F=F+j|0,E=Ee(E^F,16),l=l+E|0,j=Ee(j^l,12),F=F+j|0,E=Ee(E^F,8),l=l+E|0,j=Ee(j^l,7),$=$+y|0,g=Ee(g^$,16),b=b+g|0,y=Ee(y^b,12),$=$+y|0,g=Ee(g^$,8),b=b+g|0,y=Ee(y^b,7),H=H+P|0,I=Ee(I^H,16),h=h+I|0,P=Ee(P^h,12),H=H+P|0,I=Ee(I^H,8),h=h+I|0,P=Ee(P^h,7),z=z+x|0,B=Ee(B^z,16),w=w+B|0,x=Ee(x^w,12),z=z+x|0,B=Ee(B^z,8),w=w+B|0,x=Ee(x^w,7),F=F+y|0,B=Ee(B^F,16),h=h+B|0,y=Ee(y^h,12),F=F+y|0,B=Ee(B^F,8),h=h+B|0,y=Ee(y^h,7),$=$+P|0,E=Ee(E^$,16),w=w+E|0,P=Ee(P^w,12),$=$+P|0,E=Ee(E^$,8),w=w+E|0,P=Ee(P^w,7),H=H+x|0,g=Ee(g^H,16),l=l+g|0,x=Ee(x^l,12),H=H+x|0,g=Ee(g^H,8),l=l+g|0,x=Ee(x^l,7),z=z+j|0,I=Ee(I^z,16),b=b+I|0,j=Ee(j^b,12),z=z+j|0,I=Ee(I^z,8),b=b+I|0,j=Ee(j^b,7);let R=0;n[R++]=s+F|0,n[R++]=a+$|0,n[R++]=c+H|0,n[R++]=d+z|0,n[R++]=f+j|0,n[R++]=u+y|0,n[R++]=m+P|0,n[R++]=_+x|0,n[R++]=v+l|0,n[R++]=A+b|0,n[R++]=T+h|0,n[R++]=M+w|0,n[R++]=D+E|0,n[R++]=O+g|0,n[R++]=U+I|0,n[R++]=L+B|0}function DW(t,e,r,n){let i=(0,Sa.u32)(e),o=(0,Sa.u32)(r),s=(0,Sa.u32)(n),a=t[0],c=t[1],d=t[2],f=t[3],u=i[0],m=i[1],_=i[2],v=i[3],A=i[4],T=i[5],M=i[6],D=i[7],O=o[0],U=o[1],L=o[2],F=o[3];for(let $=0;$<20;$+=2)a=a+u|0,O=Ee(O^a,16),A=A+O|0,u=Ee(u^A,12),a=a+u|0,O=Ee(O^a,8),A=A+O|0,u=Ee(u^A,7),c=c+m|0,U=Ee(U^c,16),T=T+U|0,m=Ee(m^T,12),c=c+m|0,U=Ee(U^c,8),T=T+U|0,m=Ee(m^T,7),d=d+_|0,L=Ee(L^d,16),M=M+L|0,_=Ee(_^M,12),d=d+_|0,L=Ee(L^d,8),M=M+L|0,_=Ee(_^M,7),f=f+v|0,F=Ee(F^f,16),D=D+F|0,v=Ee(v^D,12),f=f+v|0,F=Ee(F^f,8),D=D+F|0,v=Ee(v^D,7),a=a+m|0,F=Ee(F^a,16),M=M+F|0,m=Ee(m^M,12),a=a+m|0,F=Ee(F^a,8),M=M+F|0,m=Ee(m^M,7),c=c+_|0,O=Ee(O^c,16),D=D+O|0,_=Ee(_^D,12),c=c+_|0,O=Ee(O^c,8),D=D+O|0,_=Ee(_^D,7),d=d+v|0,U=Ee(U^d,16),A=A+U|0,v=Ee(v^A,12),d=d+v|0,U=Ee(U^d,8),A=A+U|0,v=Ee(v^A,7),f=f+u|0,L=Ee(L^f,16),T=T+L|0,u=Ee(u^T,12),f=f+u|0,L=Ee(L^f,8),T=T+L|0,u=Ee(u^T,7);return s[0]=a,s[1]=c,s[2]=d,s[3]=f,s[4]=O,s[5]=U,s[6]=L,s[7]=F,n}Zr.hchacha=DW;Zr.chacha20orig=(0,av.salsaBasic)({core:cv,counterRight:!1,counterLen:8});Zr.chacha20=(0,av.salsaBasic)({core:cv,counterRight:!1,counterLen:4,allow128bitKeys:!1});Zr.xchacha20=(0,av.salsaBasic)({core:cv,counterRight:!1,counterLen:8,extendNonceFn:DW,allow128bitKeys:!1});Zr.chacha8=(0,av.salsaBasic)({core:cv,counterRight:!1,counterLen:4,rounds:8});Zr.chacha12=(0,av.salsaBasic)({core:cv,counterRight:!1,counterLen:4,rounds:12});var y_e=new Uint8Array(16),kW=(t,e)=>{t.update(e);let r=e.length%16;r&&t.update(y_e.subarray(r))},BW=(t,e,r,n,i)=>{let o=t(e,r,new Uint8Array(32)),s=m_e.poly1305.create(o);i&&kW(s,i),kW(s,n);let a=new Uint8Array(16),c=(0,Sa.createView)(a);(0,Sa.setBigUint64)(c,0,BigInt(i?i.length:0),!0),(0,Sa.setBigUint64)(c,8,BigInt(n.length),!0),s.update(a);let d=s.digest();return o.fill(0),d},g_e=t=>(e,r,n)=>((0,Sa.ensureBytes)(e,32),(0,Sa.ensureBytes)(r),{tagLength:16,encrypt:(o,s)=>{let a=o.length,c=a+16;s?(0,Sa.ensureBytes)(s,c):s=new Uint8Array(c),t(e,r,o,s,1);let d=BW(t,e,r,s.subarray(0,-16),n);return s.set(d,a),s},decrypt:(o,s)=>{let a=o.length,c=a-16;if(a<16)throw new Error(`encrypted data must be at least ${16} bytes`);s?(0,Sa.ensureBytes)(s,c):s=new Uint8Array(c);let d=o.subarray(0,-16),f=o.subarray(-16),u=BW(t,e,r,d,n);if(!(0,Sa.equalBytes)(f,u))throw new Error("invalid tag");return t(e,r,d,s,1),s}});Zr._poly1305_aead=g_e;Zr.chacha20poly1305=(0,Zr._poly1305_aead)(Zr.chacha20);Zr.xchacha20poly1305=(0,Zr._poly1305_aead)(Zr.xchacha20)});var LW=G(fm=>{"use strict";p();Object.defineProperty(fm,"__esModule",{value:!0});fm.hkdf=void 0;fm.extract=NW;fm.expand=qW;var jW=BT(),dm=yc();function NW(t,e,r){return(0,dm.ahash)(t),r===void 0&&(r=new Uint8Array(t.outputLen)),(0,jW.hmac)(t,(0,dm.toBytes)(r),(0,dm.toBytes)(e))}var VT=Uint8Array.from([0]),OW=Uint8Array.of();function qW(t,e,r,n=32){(0,dm.ahash)(t),(0,dm.anumber)(n);let i=t.outputLen;if(n>255*i)throw new Error("Length should be <= 255*HashLen");let o=Math.ceil(n/i);r===void 0&&(r=OW);let s=new Uint8Array(o*i),a=jW.hmac.create(t,e),c=a._cloneInto(),d=new Uint8Array(a.outputLen);for(let f=0;f<o;f++)VT[0]=f+1,c.update(f===0?OW:d).update(r).update(VT).digestInto(d),s.set(d,i*f),a._cloneInto(c);return a.destroy(),c.destroy(),(0,dm.clean)(d,VT),s.slice(0,n)}var b_e=(t,e,r,n,i)=>qW(t,NW(t,e,r),n,i);fm.hkdf=b_e});var UW=G(Ac=>{"use strict";p();Object.defineProperty(Ac,"__esModule",{value:!0});Ac.sha224=Ac.SHA224=Ac.sha256=Ac.SHA256=void 0;var b6=X_();Ac.SHA256=b6.SHA256;Ac.sha256=b6.sha256;Ac.SHA224=b6.SHA224;Ac.sha224=b6.sha224});var $W=G(v6=>{"use strict";p();Object.defineProperty(v6,"__esModule",{value:!0});v6.aes256gcm=void 0;var FW=_a(),zW=f_(),KT=Yb();function v_e(t,e,r){var n=function(o){var s=(0,zW.createCipheriv)("aes-256-gcm",t,e);r&&s.setAAD(r);var a=s.update(o),c=s.final();return(0,FW.concatBytes)(a,c,s.getAuthTag())},i=function(o){var s=o.subarray(0,o.length-KT.AEAD_TAG_LENGTH),a=o.subarray(-KT.AEAD_TAG_LENGTH),c=(0,zW.createDecipheriv)("aes-256-gcm",t,e);r&&c.setAAD(r),c.setAuthTag(a);var d=c.update(s),f=c.final();return(0,FW.concatBytes)(d,f)};return{tagLength:KT.AEAD_TAG_LENGTH,encrypt:n,decrypt:i}}v6.aes256gcm=v_e});var ZT=G(cu=>{"use strict";p();Object.defineProperty(cu,"__esModule",{value:!0});cu.deriveKey=cu.aesDecrypt=cu.aesEncrypt=void 0;var w_e=CW(),HW=_a(),__e=tT(),x_e=LW(),E_e=UW(),GW=bh(),w6=Yb(),S_e=$W();function A_e(t,e){return WW(!0,t,e)}cu.aesEncrypt=A_e;function T_e(t,e){return WW(!1,t,e)}cu.aesDecrypt=T_e;function P_e(t){return(0,x_e.hkdf)(E_e.sha256,t,void 0,void 0,32)}cu.deriveKey=P_e;function WW(t,e,r){var n=(0,GW.symmetricAlgorithm)(),i=t?I_e:R_e;if(n==="aes-256-gcm")return i(S_e.aes256gcm,e,r,(0,GW.symmetricNonceLength)());if(n==="xchacha20")return i(w_e.xchacha20poly1305,e,r,w6.XCHACHA20_NONCE_LENGTH);throw new Error("Not implemented")}function I_e(t,e,r,n){var i=(0,__e.randomBytes)(n),o=t(e,i),s=o.encrypt(r),a=s.subarray(0,s.length-w6.AEAD_TAG_LENGTH),c=s.subarray(-w6.AEAD_TAG_LENGTH);return(0,HW.concatBytes)(i,c,a)}function R_e(t,e,r,n){var i=n+w6.AEAD_TAG_LENGTH,o=r.subarray(0,n),s=r.subarray(n,i),a=r.subarray(i),c=t(e,Uint8Array.from(o)),d=(0,HW.concatBytes)(a,s);return c.decrypt(d)}});var YW=G(Wi=>{"use strict";p();Object.defineProperty(Wi,"__esModule",{value:!0});Wi.hexToPublicKey=Wi.convertPublicKeyFormat=Wi.getSharedPoint=Wi.getSharedKey=Wi.getPublicKey=Wi.isValidPrivateKey=Wi.getValidSecret=void 0;var M_e=_a(),k_e=tT(),VW=rW(),B_e=xW(),YT=bh(),KW=Yb(),D_e=zT(),C_e=ZT();function O_e(){var t;do t=(0,k_e.randomBytes)(KW.SECRET_KEY_LENGTH);while(!ZW(t));return t}Wi.getValidSecret=O_e;function ZW(t){return dv(function(e){return e.utils.isValidPrivateKey(t)},function(){return!0},function(){return!0})}Wi.isValidPrivateKey=ZW;function j_e(t){return dv(function(e){return e.getPublicKey(t)},function(e){return e.getPublicKey(t)},function(e){return e.getPublicKey(t)})}Wi.getPublicKey=j_e;function N_e(t,e){return(0,C_e.deriveKey)((0,M_e.concatBytes)(t,e))}Wi.getSharedKey=N_e;function q_e(t,e,r){return dv(function(n){return n.getSharedSecret(t,e,r)},function(n){return n.getSharedSecret(t,e)},function(n){var i=n.utils.getExtendedPublicKey(t).scalar,o=n.ExtendedPoint.fromHex(e).multiply(i);return o.toRawBytes()})}Wi.getSharedPoint=q_e;function L_e(t,e){return dv(function(r){return r.getSharedSecret(BigInt(1),t,e)},function(){return t},function(){return t})}Wi.convertPublicKeyFormat=L_e;function U_e(t){var e=(0,D_e.decodeHex)(t);return dv(function(){if(e.length===KW.ETH_PUBLIC_KEY_SIZE){var r=new Uint8Array(1+e.length);return r.set([4]),r.set(e,1),r}return e},function(){return e},function(){return e})}Wi.hexToPublicKey=U_e;function dv(t,e,r){if((0,YT.ellipticCurve)()==="secp256k1")return t(B_e.secp256k1);if((0,YT.ellipticCurve)()==="x25519")return e(VW.x25519);if((0,YT.ellipticCurve)()==="ed25519")return r(VW.ed25519);throw new Error("Not implemented")}});var _6=G(Ud=>{"use strict";p();var F_e=Ud&&Ud.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,i)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),JT=Ud&&Ud.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&F_e(e,t,r)};Object.defineProperty(Ud,"__esModule",{value:!0});JT(YW(),Ud);JT(zT(),Ud);JT(ZT(),Ud)});var QT=G(E6=>{"use strict";p();Object.defineProperty(E6,"__esModule",{value:!0});E6.PublicKey=void 0;var XT=_a(),z_e=bh(),x6=_6(),$_e=function(){function t(e){this.data=(0,x6.convertPublicKeyFormat)(e,!0)}return t.fromHex=function(e){return new t((0,x6.hexToPublicKey)(e))},Object.defineProperty(t.prototype,"uncompressed",{get:function(){return C.Buffer.from((0,x6.convertPublicKeyFormat)(this.data,!1))},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"compressed",{get:function(){return C.Buffer.from(this.data)},enumerable:!1,configurable:!0}),t.prototype.toHex=function(e){return e===void 0&&(e=!0),e?(0,XT.bytesToHex)(this.data):(0,XT.bytesToHex)(this.uncompressed)},t.prototype.decapsulate=function(e){var r,n;return(0,z_e.isHkdfKeyCompressed)()?(r=this.data,n=e.multiply(this,!0)):(r=this.uncompressed,n=e.multiply(this,!1)),(0,x6.getSharedKey)(r,n)},t.prototype.equals=function(e){return(0,XT.equalBytes)(this.data,e.data)},t}();E6.PublicKey=$_e});var XW=G(S6=>{"use strict";p();Object.defineProperty(S6,"__esModule",{value:!0});S6.PrivateKey=void 0;var JW=_a(),G_e=bh(),um=_6(),H_e=QT(),W_e=function(){function t(e){var r=e===void 0?(0,um.getValidSecret)():e;if(!(0,um.isValidPrivateKey)(r))throw new Error("Invalid private key");this.data=r,this.publicKey=new H_e.PublicKey((0,um.getPublicKey)(r))}return t.fromHex=function(e){return new t((0,um.decodeHex)(e))},Object.defineProperty(t.prototype,"secret",{get:function(){return C.Buffer.from(this.data)},enumerable:!1,configurable:!0}),t.prototype.toHex=function(){return(0,JW.bytesToHex)(this.data)},t.prototype.encapsulate=function(e){var r,n;return(0,G_e.isHkdfKeyCompressed)()?(r=this.publicKey.compressed,n=this.multiply(e,!0)):(r=this.publicKey.uncompressed,n=this.multiply(e,!1)),(0,um.getSharedKey)(r,n)},t.prototype.multiply=function(e,r){return r===void 0&&(r=!1),(0,um.getSharedPoint)(this.data,e.compressed,r)},t.prototype.equals=function(e){return(0,JW.equalBytes)(this.data,e.data)},t}();S6.PrivateKey=W_e});var eP=G(lm=>{"use strict";p();Object.defineProperty(lm,"__esModule",{value:!0});lm.PublicKey=lm.PrivateKey=void 0;var V_e=XW();Object.defineProperty(lm,"PrivateKey",{enumerable:!0,get:function(){return V_e.PrivateKey}});var K_e=QT();Object.defineProperty(lm,"PublicKey",{enumerable:!0,get:function(){return K_e.PublicKey}})});var tV=G(Do=>{"use strict";p();Object.defineProperty(Do,"__esModule",{value:!0});Do.utils=Do.PublicKey=Do.PrivateKey=Do.ECIES_CONFIG=Do.decrypt=Do.encrypt=void 0;var Z_e=_a(),QW=bh(),hm=eP(),Ih=_6();function Y_e(t,e){var r=new hm.PrivateKey,n=t instanceof Uint8Array?new hm.PublicKey(t):hm.PublicKey.fromHex(t),i=r.encapsulate(n),o=(0,Ih.aesEncrypt)(i,e),s;return(0,QW.isEphemeralKeyCompressed)()?s=r.publicKey.compressed:s=r.publicKey.uncompressed,C.Buffer.from((0,Z_e.concatBytes)(s,o))}Do.encrypt=Y_e;function J_e(t,e){var r=t instanceof Uint8Array?new hm.PrivateKey(t):hm.PrivateKey.fromHex(t),n=(0,QW.ephemeralKeySize)(),i=new hm.PublicKey(e.subarray(0,n)),o=e.subarray(n),s=i.decapsulate(r);return C.Buffer.from((0,Ih.aesDecrypt)(s,o))}Do.decrypt=J_e;var X_e=bh();Object.defineProperty(Do,"ECIES_CONFIG",{enumerable:!0,get:function(){return X_e.ECIES_CONFIG}});var eV=eP();Object.defineProperty(Do,"PrivateKey",{enumerable:!0,get:function(){return eV.PrivateKey}});Object.defineProperty(Do,"PublicKey",{enumerable:!0,get:function(){return eV.PublicKey}});Do.utils={aesDecrypt:Ih.aesDecrypt,aesEncrypt:Ih.aesEncrypt,decodeHex:Ih.decodeHex,getValidSecret:Ih.getValidSecret,remove0x:Ih.remove0x}});var kn=G((jGe,rV)=>{"use strict";p();rV.exports={ArrayIsArray(t){return Array.isArray(t)},ArrayPrototypeIncludes(t,e){return t.includes(e)},ArrayPrototypeIndexOf(t,e){return t.indexOf(e)},ArrayPrototypeJoin(t,e){return t.join(e)},ArrayPrototypeMap(t,e){return t.map(e)},ArrayPrototypePop(t,e){return t.pop(e)},ArrayPrototypePush(t,e){return t.push(e)},ArrayPrototypeSlice(t,e,r){return t.slice(e,r)},Error,FunctionPrototypeCall(t,e,...r){return t.call(e,...r)},FunctionPrototypeSymbolHasInstance(t,e){return Function.prototype[Symbol.hasInstance].call(t,e)},MathFloor:Math.floor,Number,NumberIsInteger:Number.isInteger,NumberIsNaN:Number.isNaN,NumberMAX_SAFE_INTEGER:Number.MAX_SAFE_INTEGER,NumberMIN_SAFE_INTEGER:Number.MIN_SAFE_INTEGER,NumberParseInt:Number.parseInt,ObjectDefineProperties(t,e){return Object.defineProperties(t,e)},ObjectDefineProperty(t,e,r){return Object.defineProperty(t,e,r)},ObjectGetOwnPropertyDescriptor(t,e){return Object.getOwnPropertyDescriptor(t,e)},ObjectKeys(t){return Object.keys(t)},ObjectSetPrototypeOf(t,e){return Object.setPrototypeOf(t,e)},Promise,PromisePrototypeCatch(t,e){return t.catch(e)},PromisePrototypeThen(t,e,r){return t.then(e,r)},PromiseReject(t){return Promise.reject(t)},ReflectApply:Reflect.apply,RegExpPrototypeTest(t,e){return t.test(e)},SafeSet:Set,String,StringPrototypeSlice(t,e,r){return t.slice(e,r)},StringPrototypeToLowerCase(t){return t.toLowerCase()},StringPrototypeToUpperCase(t){return t.toUpperCase()},StringPrototypeTrim(t){return t.trim()},Symbol,SymbolFor:Symbol.for,SymbolAsyncIterator:Symbol.asyncIterator,SymbolHasInstance:Symbol.hasInstance,SymbolIterator:Symbol.iterator,TypedArrayPrototypeSet(t,e,r){return t.set(e,r)},Uint8Array}});var Tc=G((qGe,rP)=>{"use strict";p();var Q_e=jr(),e6e=Object.getPrototypeOf(async function(){}).constructor,nV=globalThis.Blob||Q_e.Blob,t6e=typeof nV<"u"?function(e){return e instanceof nV}:function(e){return!1},tP=class extends Error{constructor(e){if(!Array.isArray(e))throw new TypeError(`Expected input to be an Array, got ${typeof e}`);let r="";for(let n=0;n<e.length;n++)r+=` ${e[n].stack}
18
+ `;super(r),this.name="AggregateError",this.errors=e}};rP.exports={AggregateError:tP,kEmptyObject:Object.freeze({}),once(t){let e=!1;return function(...r){e||(e=!0,t.apply(this,r))}},createDeferredPromise:function(){let t,e;return{promise:new Promise((n,i)=>{t=n,e=i}),resolve:t,reject:e}},promisify(t){return new Promise((e,r)=>{t((n,...i)=>n?r(n):e(...i))})},debuglog(){return function(){}},format(t,...e){return t.replace(/%([sdifj])/g,function(...[r,n]){let i=e.shift();return n==="f"?i.toFixed(6):n==="j"?JSON.stringify(i):n==="s"&&typeof i=="object"?`${i.constructor!==Object?i.constructor.name:""} {}`.trim():i.toString()})},inspect(t){switch(typeof t){case"string":if(t.includes("'"))if(t.includes('"')){if(!t.includes("`")&&!t.includes("${"))return`\`${t}\``}else return`"${t}"`;return`'${t}'`;case"number":return isNaN(t)?"NaN":Object.is(t,-0)?String(t):t;case"bigint":return`${String(t)}n`;case"boolean":case"undefined":return String(t);case"object":return"{}"}},types:{isAsyncFunction(t){return t instanceof e6e},isArrayBufferView(t){return ArrayBuffer.isView(t)}},isBlob:t6e};rP.exports.promisify.custom=Symbol.for("nodejs.util.promisify.custom")});var T6=G((UGe,A6)=>{"use strict";p();var{AbortController:iV,AbortSignal:r6e}=typeof self<"u"?self:typeof window<"u"?window:void 0;A6.exports=iV;A6.exports.AbortSignal=r6e;A6.exports.default=iV});var fo=G((zGe,aV)=>{"use strict";p();var{format:n6e,inspect:P6,AggregateError:i6e}=Tc(),o6e=globalThis.AggregateError||i6e,s6e=Symbol("kIsNodeError"),a6e=["string","function","number","object","Function","Object","boolean","bigint","symbol"],c6e=/^([A-Z][a-z0-9]*)+$/,d6e="__node_internal_",I6={};function Rh(t,e){if(!t)throw new I6.ERR_INTERNAL_ASSERTION(e)}function oV(t){let e="",r=t.length,n=t[0]==="-"?1:0;for(;r>=n+4;r-=3)e=`_${t.slice(r-3,r)}${e}`;return`${t.slice(0,r)}${e}`}function f6e(t,e,r){if(typeof e=="function")return Rh(e.length<=r.length,`Code: ${t}; The provided arguments length (${r.length}) does not match the required ones (${e.length}).`),e(...r);let n=(e.match(/%[dfijoOs]/g)||[]).length;return Rh(n===r.length,`Code: ${t}; The provided arguments length (${r.length}) does not match the required ones (${n}).`),r.length===0?e:n6e(e,...r)}function vi(t,e,r){r||(r=Error);class n extends r{constructor(...o){super(f6e(t,e,o))}toString(){return`${this.name} [${t}]: ${this.message}`}}Object.defineProperties(n.prototype,{name:{value:r.name,writable:!0,enumerable:!1,configurable:!0},toString:{value(){return`${this.name} [${t}]: ${this.message}`},writable:!0,enumerable:!1,configurable:!0}}),n.prototype.code=t,n.prototype[s6e]=!0,I6[t]=n}function sV(t){let e=d6e+t.name;return Object.defineProperty(t,"name",{value:e}),t}function u6e(t,e){if(t&&e&&t!==e){if(Array.isArray(e.errors))return e.errors.push(t),e;let r=new o6e([e,t],e.message);return r.code=e.code,r}return t||e}var nP=class extends Error{constructor(e="The operation was aborted",r=void 0){if(r!==void 0&&typeof r!="object")throw new I6.ERR_INVALID_ARG_TYPE("options","Object",r);super(e,r),this.code="ABORT_ERR",this.name="AbortError"}};vi("ERR_ASSERTION","%s",Error);vi("ERR_INVALID_ARG_TYPE",(t,e,r)=>{Rh(typeof t=="string","'name' must be a string"),Array.isArray(e)||(e=[e]);let n="The ";t.endsWith(" argument")?n+=`${t} `:n+=`"${t}" ${t.includes(".")?"property":"argument"} `,n+="must be ";let i=[],o=[],s=[];for(let c of e)Rh(typeof c=="string","All expected entries have to be of type string"),a6e.includes(c)?i.push(c.toLowerCase()):c6e.test(c)?o.push(c):(Rh(c!=="object",'The value "object" should be written as "Object"'),s.push(c));if(o.length>0){let c=i.indexOf("object");c!==-1&&(i.splice(i,c,1),o.push("Object"))}if(i.length>0){switch(i.length){case 1:n+=`of type ${i[0]}`;break;case 2:n+=`one of type ${i[0]} or ${i[1]}`;break;default:{let c=i.pop();n+=`one of type ${i.join(", ")}, or ${c}`}}(o.length>0||s.length>0)&&(n+=" or ")}if(o.length>0){switch(o.length){case 1:n+=`an instance of ${o[0]}`;break;case 2:n+=`an instance of ${o[0]} or ${o[1]}`;break;default:{let c=o.pop();n+=`an instance of ${o.join(", ")}, or ${c}`}}s.length>0&&(n+=" or ")}switch(s.length){case 0:break;case 1:s[0].toLowerCase()!==s[0]&&(n+="an "),n+=`${s[0]}`;break;case 2:n+=`one of ${s[0]} or ${s[1]}`;break;default:{let c=s.pop();n+=`one of ${s.join(", ")}, or ${c}`}}if(r==null)n+=`. Received ${r}`;else if(typeof r=="function"&&r.name)n+=`. Received function ${r.name}`;else if(typeof r=="object"){var a;if((a=r.constructor)!==null&&a!==void 0&&a.name)n+=`. Received an instance of ${r.constructor.name}`;else{let c=P6(r,{depth:-1});n+=`. Received ${c}`}}else{let c=P6(r,{colors:!1});c.length>25&&(c=`${c.slice(0,25)}...`),n+=`. Received type ${typeof r} (${c})`}return n},TypeError);vi("ERR_INVALID_ARG_VALUE",(t,e,r="is invalid")=>{let n=P6(e);return n.length>128&&(n=n.slice(0,128)+"..."),`The ${t.includes(".")?"property":"argument"} '${t}' ${r}. Received ${n}`},TypeError);vi("ERR_INVALID_RETURN_VALUE",(t,e,r)=>{var n;let i=r!=null&&(n=r.constructor)!==null&&n!==void 0&&n.name?`instance of ${r.constructor.name}`:`type ${typeof r}`;return`Expected ${t} to be returned from the "${e}" function but got ${i}.`},TypeError);vi("ERR_MISSING_ARGS",(...t)=>{Rh(t.length>0,"At least one arg needs to be specified");let e,r=t.length;switch(t=(Array.isArray(t)?t:[t]).map(n=>`"${n}"`).join(" or "),r){case 1:e+=`The ${t[0]} argument`;break;case 2:e+=`The ${t[0]} and ${t[1]} arguments`;break;default:{let n=t.pop();e+=`The ${t.join(", ")}, and ${n} arguments`}break}return`${e} must be specified`},TypeError);vi("ERR_OUT_OF_RANGE",(t,e,r)=>{Rh(e,'Missing "range" argument');let n;return Number.isInteger(r)&&Math.abs(r)>2**32?n=oV(String(r)):typeof r=="bigint"?(n=String(r),(r>2n**32n||r<-(2n**32n))&&(n=oV(n)),n+="n"):n=P6(r),`The value of "${t}" is out of range. It must be ${e}. Received ${n}`},RangeError);vi("ERR_MULTIPLE_CALLBACK","Callback called multiple times",Error);vi("ERR_METHOD_NOT_IMPLEMENTED","The %s method is not implemented",Error);vi("ERR_STREAM_ALREADY_FINISHED","Cannot call %s after a stream was finished",Error);vi("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable",Error);vi("ERR_STREAM_DESTROYED","Cannot call %s after a stream was destroyed",Error);vi("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError);vi("ERR_STREAM_PREMATURE_CLOSE","Premature close",Error);vi("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF",Error);vi("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event",Error);vi("ERR_STREAM_WRITE_AFTER_END","write after end",Error);vi("ERR_UNKNOWN_ENCODING","Unknown encoding: %s",TypeError);aV.exports={AbortError:nP,aggregateTwoErrors:sV(u6e),hideStackFrames:sV,codes:I6}});var fv=G((GGe,yV)=>{"use strict";p();var{ArrayIsArray:oP,ArrayPrototypeIncludes:uV,ArrayPrototypeJoin:lV,ArrayPrototypeMap:l6e,NumberIsInteger:sP,NumberIsNaN:h6e,NumberMAX_SAFE_INTEGER:p6e,NumberMIN_SAFE_INTEGER:m6e,NumberParseInt:y6e,ObjectPrototypeHasOwnProperty:g6e,RegExpPrototypeExec:hV,String:b6e,StringPrototypeToUpperCase:v6e,StringPrototypeTrim:w6e}=kn(),{hideStackFrames:Gs,codes:{ERR_SOCKET_BAD_PORT:_6e,ERR_INVALID_ARG_TYPE:uo,ERR_INVALID_ARG_VALUE:pm,ERR_OUT_OF_RANGE:Mh,ERR_UNKNOWN_SIGNAL:cV}}=fo(),{normalizeEncoding:x6e}=Tc(),{isAsyncFunction:E6e,isArrayBufferView:S6e}=Tc().types,dV={};function A6e(t){return t===(t|0)}function T6e(t){return t===t>>>0}var P6e=/^[0-7]+$/,I6e="must be a 32-bit unsigned integer or an octal string";function R6e(t,e,r){if(typeof t>"u"&&(t=r),typeof t=="string"){if(hV(P6e,t)===null)throw new pm(e,t,I6e);t=y6e(t,8)}return pV(t,e),t}var M6e=Gs((t,e,r=m6e,n=p6e)=>{if(typeof t!="number")throw new uo(e,"number",t);if(!sP(t))throw new Mh(e,"an integer",t);if(t<r||t>n)throw new Mh(e,`>= ${r} && <= ${n}`,t)}),k6e=Gs((t,e,r=-2147483648,n=2147483647)=>{if(typeof t!="number")throw new uo(e,"number",t);if(!sP(t))throw new Mh(e,"an integer",t);if(t<r||t>n)throw new Mh(e,`>= ${r} && <= ${n}`,t)}),pV=Gs((t,e,r=!1)=>{if(typeof t!="number")throw new uo(e,"number",t);if(!sP(t))throw new Mh(e,"an integer",t);let n=r?1:0,i=4294967295;if(t<n||t>i)throw new Mh(e,`>= ${n} && <= ${i}`,t)});function aP(t,e){if(typeof t!="string")throw new uo(e,"string",t)}function B6e(t,e,r=void 0,n){if(typeof t!="number")throw new uo(e,"number",t);if(r!=null&&t<r||n!=null&&t>n||(r!=null||n!=null)&&h6e(t))throw new Mh(e,`${r!=null?`>= ${r}`:""}${r!=null&&n!=null?" && ":""}${n!=null?`<= ${n}`:""}`,t)}var D6e=Gs((t,e,r)=>{if(!uV(r,t)){let i="must be one of: "+lV(l6e(r,o=>typeof o=="string"?`'${o}'`:b6e(o)),", ");throw new pm(e,t,i)}});function mV(t,e){if(typeof t!="boolean")throw new uo(e,"boolean",t)}function iP(t,e,r){return t==null||!g6e(t,e)?r:t[e]}var C6e=Gs((t,e,r=null)=>{let n=iP(r,"allowArray",!1),i=iP(r,"allowFunction",!1);if(!iP(r,"nullable",!1)&&t===null||!n&&oP(t)||typeof t!="object"&&(!i||typeof t!="function"))throw new uo(e,"Object",t)}),O6e=Gs((t,e)=>{if(t!=null&&typeof t!="object"&&typeof t!="function")throw new uo(e,"a dictionary",t)}),cP=Gs((t,e,r=0)=>{if(!oP(t))throw new uo(e,"Array",t);if(t.length<r){let n=`must be longer than ${r}`;throw new pm(e,t,n)}});function j6e(t,e){cP(t,e);for(let r=0;r<t.length;r++)aP(t[r],`${e}[${r}]`)}function N6e(t,e){cP(t,e);for(let r=0;r<t.length;r++)mV(t[r],`${e}[${r}]`)}function q6e(t,e="signal"){if(aP(t,e),dV[t]===void 0)throw dV[v6e(t)]!==void 0?new cV(t+" (signals must use all capital letters)"):new cV(t)}var L6e=Gs((t,e="buffer")=>{if(!S6e(t))throw new uo(e,["Buffer","TypedArray","DataView"],t)});function U6e(t,e){let r=x6e(e),n=t.length;if(r==="hex"&&n%2!==0)throw new pm("encoding",e,`is invalid for data of length ${n}`)}function F6e(t,e="Port",r=!0){if(typeof t!="number"&&typeof t!="string"||typeof t=="string"&&w6e(t).length===0||+t!==+t>>>0||t>65535||t===0&&!r)throw new _6e(e,t,r);return t|0}var z6e=Gs((t,e)=>{if(t!==void 0&&(t===null||typeof t!="object"||!("aborted"in t)))throw new uo(e,"AbortSignal",t)}),$6e=Gs((t,e)=>{if(typeof t!="function")throw new uo(e,"Function",t)}),G6e=Gs((t,e)=>{if(typeof t!="function"||E6e(t))throw new uo(e,"Function",t)}),H6e=Gs((t,e)=>{if(t!==void 0)throw new uo(e,"undefined",t)});function W6e(t,e,r){if(!uV(r,t))throw new uo(e,`('${lV(r,"|")}')`,t)}var V6e=/^(?:<[^>]*>)(?:\s*;\s*[^;"\s]+(?:=(")?[^;"\s]*\1)?)*$/;function fV(t,e){if(typeof t>"u"||!hV(V6e,t))throw new pm(e,t,'must be an array or string of format "</styles.css>; rel=preload; as=style"')}function K6e(t){if(typeof t=="string")return fV(t,"hints"),t;if(oP(t)){let e=t.length,r="";if(e===0)return r;for(let n=0;n<e;n++){let i=t[n];fV(i,"hints"),r+=i,n!==e-1&&(r+=", ")}return r}throw new pm("hints",t,'must be an array or string of format "</styles.css>; rel=preload; as=style"')}yV.exports={isInt32:A6e,isUint32:T6e,parseFileMode:R6e,validateArray:cP,validateStringArray:j6e,validateBooleanArray:N6e,validateBoolean:mV,validateBuffer:L6e,validateDictionary:O6e,validateEncoding:U6e,validateFunction:$6e,validateInt32:k6e,validateInteger:M6e,validateNumber:B6e,validateObject:C6e,validateOneOf:D6e,validatePlainFunction:G6e,validatePort:F6e,validateSignalName:q6e,validateString:aP,validateUint32:pV,validateUndefined:H6e,validateUnion:W6e,validateAbortSignal:z6e,validateLinkHeaderValue:K6e}});var Ic=G((WGe,BV)=>{"use strict";p();var{Symbol:R6,SymbolAsyncIterator:gV,SymbolIterator:bV,SymbolFor:vV}=kn(),wV=R6("kDestroyed"),_V=R6("kIsErrored"),dP=R6("kIsReadable"),xV=R6("kIsDisturbed"),Z6e=vV("nodejs.webstream.isClosedPromise"),Y6e=vV("nodejs.webstream.controllerErrorFunction");function M6(t,e=!1){var r;return!!(t&&typeof t.pipe=="function"&&typeof t.on=="function"&&(!e||typeof t.pause=="function"&&typeof t.resume=="function")&&(!t._writableState||((r=t._readableState)===null||r===void 0?void 0:r.readable)!==!1)&&(!t._writableState||t._readableState))}function k6(t){var e;return!!(t&&typeof t.write=="function"&&typeof t.on=="function"&&(!t._readableState||((e=t._writableState)===null||e===void 0?void 0:e.writable)!==!1))}function J6e(t){return!!(t&&typeof t.pipe=="function"&&t._readableState&&typeof t.on=="function"&&typeof t.write=="function")}function Pc(t){return t&&(t._readableState||t._writableState||typeof t.write=="function"&&typeof t.on=="function"||typeof t.pipe=="function"&&typeof t.on=="function")}function EV(t){return!!(t&&!Pc(t)&&typeof t.pipeThrough=="function"&&typeof t.getReader=="function"&&typeof t.cancel=="function")}function SV(t){return!!(t&&!Pc(t)&&typeof t.getWriter=="function"&&typeof t.abort=="function")}function AV(t){return!!(t&&!Pc(t)&&typeof t.readable=="object"&&typeof t.writable=="object")}function X6e(t){return EV(t)||SV(t)||AV(t)}function Q6e(t,e){return t==null?!1:e===!0?typeof t[gV]=="function":e===!1?typeof t[bV]=="function":typeof t[gV]=="function"||typeof t[bV]=="function"}function B6(t){if(!Pc(t))return null;let e=t._writableState,r=t._readableState,n=e||r;return!!(t.destroyed||t[wV]||n!=null&&n.destroyed)}function TV(t){if(!k6(t))return null;if(t.writableEnded===!0)return!0;let e=t._writableState;return e!=null&&e.errored?!1:typeof e?.ended!="boolean"?null:e.ended}function exe(t,e){if(!k6(t))return null;if(t.writableFinished===!0)return!0;let r=t._writableState;return r!=null&&r.errored?!1:typeof r?.finished!="boolean"?null:!!(r.finished||e===!1&&r.ended===!0&&r.length===0)}function txe(t){if(!M6(t))return null;if(t.readableEnded===!0)return!0;let e=t._readableState;return!e||e.errored?!1:typeof e?.ended!="boolean"?null:e.ended}function PV(t,e){if(!M6(t))return null;let r=t._readableState;return r!=null&&r.errored?!1:typeof r?.endEmitted!="boolean"?null:!!(r.endEmitted||e===!1&&r.ended===!0&&r.length===0)}function IV(t){return t&&t[dP]!=null?t[dP]:typeof t?.readable!="boolean"?null:B6(t)?!1:M6(t)&&t.readable&&!PV(t)}function RV(t){return typeof t?.writable!="boolean"?null:B6(t)?!1:k6(t)&&t.writable&&!TV(t)}function rxe(t,e){return Pc(t)?B6(t)?!0:!(e?.readable!==!1&&IV(t)||e?.writable!==!1&&RV(t)):null}function nxe(t){var e,r;return Pc(t)?t.writableErrored?t.writableErrored:(e=(r=t._writableState)===null||r===void 0?void 0:r.errored)!==null&&e!==void 0?e:null:null}function ixe(t){var e,r;return Pc(t)?t.readableErrored?t.readableErrored:(e=(r=t._readableState)===null||r===void 0?void 0:r.errored)!==null&&e!==void 0?e:null:null}function oxe(t){if(!Pc(t))return null;if(typeof t.closed=="boolean")return t.closed;let e=t._writableState,r=t._readableState;return typeof e?.closed=="boolean"||typeof r?.closed=="boolean"?e?.closed||r?.closed:typeof t._closed=="boolean"&&MV(t)?t._closed:null}function MV(t){return typeof t._closed=="boolean"&&typeof t._defaultKeepAlive=="boolean"&&typeof t._removedConnection=="boolean"&&typeof t._removedContLen=="boolean"}function kV(t){return typeof t._sent100=="boolean"&&MV(t)}function sxe(t){var e;return typeof t._consuming=="boolean"&&typeof t._dumped=="boolean"&&((e=t.req)===null||e===void 0?void 0:e.upgradeOrConnect)===void 0}function axe(t){if(!Pc(t))return null;let e=t._writableState,r=t._readableState,n=e||r;return!n&&kV(t)||!!(n&&n.autoDestroy&&n.emitClose&&n.closed===!1)}function cxe(t){var e;return!!(t&&((e=t[xV])!==null&&e!==void 0?e:t.readableDidRead||t.readableAborted))}function dxe(t){var e,r,n,i,o,s,a,c,d,f;return!!(t&&((e=(r=(n=(i=(o=(s=t[_V])!==null&&s!==void 0?s:t.readableErrored)!==null&&o!==void 0?o:t.writableErrored)!==null&&i!==void 0?i:(a=t._readableState)===null||a===void 0?void 0:a.errorEmitted)!==null&&n!==void 0?n:(c=t._writableState)===null||c===void 0?void 0:c.errorEmitted)!==null&&r!==void 0?r:(d=t._readableState)===null||d===void 0?void 0:d.errored)!==null&&e!==void 0?e:!((f=t._writableState)===null||f===void 0)&&f.errored))}BV.exports={kDestroyed:wV,isDisturbed:cxe,kIsDisturbed:xV,isErrored:dxe,kIsErrored:_V,isReadable:IV,kIsReadable:dP,kIsClosedPromise:Z6e,kControllerErrorFunction:Y6e,isClosed:oxe,isDestroyed:B6,isDuplexNodeStream:J6e,isFinished:rxe,isIterable:Q6e,isReadableNodeStream:M6,isReadableStream:EV,isReadableEnded:txe,isReadableFinished:PV,isReadableErrored:ixe,isNodeStream:Pc,isWebStream:X6e,isWritable:RV,isWritableNodeStream:k6,isWritableStream:SV,isWritableEnded:TV,isWritableFinished:exe,isWritableErrored:nxe,isServerRequest:sxe,isServerResponse:kV,willEmitClose:axe,isTransformStream:AV}});var Fd=G((KGe,pP)=>{p();var du=sd(),{AbortError:FV,codes:fxe}=fo(),{ERR_INVALID_ARG_TYPE:uxe,ERR_STREAM_PREMATURE_CLOSE:DV}=fxe,{kEmptyObject:uP,once:lP}=Tc(),{validateAbortSignal:lxe,validateFunction:hxe,validateObject:pxe,validateBoolean:mxe}=fv(),{Promise:yxe,PromisePrototypeThen:gxe}=kn(),{isClosed:bxe,isReadable:CV,isReadableNodeStream:fP,isReadableStream:vxe,isReadableFinished:OV,isReadableErrored:jV,isWritable:NV,isWritableNodeStream:qV,isWritableStream:wxe,isWritableFinished:LV,isWritableErrored:UV,isNodeStream:_xe,willEmitClose:xxe,kIsClosedPromise:Exe}=Ic();function Sxe(t){return t.setHeader&&typeof t.abort=="function"}var hP=()=>{};function zV(t,e,r){var n,i;if(arguments.length===2?(r=e,e=uP):e==null?e=uP:pxe(e,"options"),hxe(r,"callback"),lxe(e.signal,"options.signal"),r=lP(r),vxe(t)||wxe(t))return Axe(t,e,r);if(!_xe(t))throw new uxe("stream",["ReadableStream","WritableStream","Stream"],t);let o=(n=e.readable)!==null&&n!==void 0?n:fP(t),s=(i=e.writable)!==null&&i!==void 0?i:qV(t),a=t._writableState,c=t._readableState,d=()=>{t.writable||m()},f=xxe(t)&&fP(t)===o&&qV(t)===s,u=LV(t,!1),m=()=>{u=!0,t.destroyed&&(f=!1),!(f&&(!t.readable||o))&&(!o||_)&&r.call(t)},_=OV(t,!1),v=()=>{_=!0,t.destroyed&&(f=!1),!(f&&(!t.writable||s))&&(!s||u)&&r.call(t)},A=L=>{r.call(t,L)},T=bxe(t),M=()=>{T=!0;let L=UV(t)||jV(t);if(L&&typeof L!="boolean")return r.call(t,L);if(o&&!_&&fP(t,!0)&&!OV(t,!1))return r.call(t,new DV);if(s&&!u&&!LV(t,!1))return r.call(t,new DV);r.call(t)},D=()=>{T=!0;let L=UV(t)||jV(t);if(L&&typeof L!="boolean")return r.call(t,L);r.call(t)},O=()=>{t.req.on("finish",m)};Sxe(t)?(t.on("complete",m),f||t.on("abort",M),t.req?O():t.on("request",O)):s&&!a&&(t.on("end",d),t.on("close",d)),!f&&typeof t.aborted=="boolean"&&t.on("aborted",M),t.on("end",v),t.on("finish",m),e.error!==!1&&t.on("error",A),t.on("close",M),T?du.nextTick(M):a!=null&&a.errorEmitted||c!=null&&c.errorEmitted?f||du.nextTick(D):(!o&&(!f||CV(t))&&(u||NV(t)===!1)||!s&&(!f||NV(t))&&(_||CV(t)===!1)||c&&t.req&&t.aborted)&&du.nextTick(D);let U=()=>{r=hP,t.removeListener("aborted",M),t.removeListener("complete",m),t.removeListener("abort",M),t.removeListener("request",O),t.req&&t.req.removeListener("finish",m),t.removeListener("end",d),t.removeListener("close",d),t.removeListener("finish",m),t.removeListener("end",v),t.removeListener("error",A),t.removeListener("close",M)};if(e.signal&&!T){let L=()=>{let F=r;U(),F.call(t,new FV(void 0,{cause:e.signal.reason}))};if(e.signal.aborted)du.nextTick(L);else{let F=r;r=lP((...$)=>{e.signal.removeEventListener("abort",L),F.apply(t,$)}),e.signal.addEventListener("abort",L)}}return U}function Axe(t,e,r){let n=!1,i=hP;if(e.signal)if(i=()=>{n=!0,r.call(t,new FV(void 0,{cause:e.signal.reason}))},e.signal.aborted)du.nextTick(i);else{let s=r;r=lP((...a)=>{e.signal.removeEventListener("abort",i),s.apply(t,a)}),e.signal.addEventListener("abort",i)}let o=(...s)=>{n||du.nextTick(()=>r.apply(t,s))};return gxe(t[Exe].promise,o,o),hP}function Txe(t,e){var r;let n=!1;return e===null&&(e=uP),(r=e)!==null&&r!==void 0&&r.cleanup&&(mxe(e.cleanup,"cleanup"),n=e.cleanup),new yxe((i,o)=>{let s=zV(t,e,a=>{n&&s(),a?o(a):i()})})}pP.exports=zV;pP.exports.finished=Txe});var kh=G((YGe,YV)=>{"use strict";p();var Rc=sd(),{aggregateTwoErrors:Pxe,codes:{ERR_MULTIPLE_CALLBACK:Ixe},AbortError:Rxe}=fo(),{Symbol:HV}=kn(),{kDestroyed:Mxe,isDestroyed:kxe,isFinished:Bxe,isServerRequest:Dxe}=Ic(),WV=HV("kDestroy"),mP=HV("kConstruct");function VV(t,e,r){t&&(t.stack,e&&!e.errored&&(e.errored=t),r&&!r.errored&&(r.errored=t))}function Cxe(t,e){let r=this._readableState,n=this._writableState,i=n||r;return n!=null&&n.destroyed||r!=null&&r.destroyed?(typeof e=="function"&&e(),this):(VV(t,n,r),n&&(n.destroyed=!0),r&&(r.destroyed=!0),i.constructed?$V(this,t,e):this.once(WV,function(o){$V(this,Pxe(o,t),e)}),this)}function $V(t,e,r){let n=!1;function i(o){if(n)return;n=!0;let s=t._readableState,a=t._writableState;VV(o,a,s),a&&(a.closed=!0),s&&(s.closed=!0),typeof r=="function"&&r(o),o?Rc.nextTick(Oxe,t,o):Rc.nextTick(KV,t)}try{t._destroy(e||null,i)}catch(o){i(o)}}function Oxe(t,e){yP(t,e),KV(t)}function KV(t){let e=t._readableState,r=t._writableState;r&&(r.closeEmitted=!0),e&&(e.closeEmitted=!0),(r!=null&&r.emitClose||e!=null&&e.emitClose)&&t.emit("close")}function yP(t,e){let r=t._readableState,n=t._writableState;n!=null&&n.errorEmitted||r!=null&&r.errorEmitted||(n&&(n.errorEmitted=!0),r&&(r.errorEmitted=!0),t.emit("error",e))}function jxe(){let t=this._readableState,e=this._writableState;t&&(t.constructed=!0,t.closed=!1,t.closeEmitted=!1,t.destroyed=!1,t.errored=null,t.errorEmitted=!1,t.reading=!1,t.ended=t.readable===!1,t.endEmitted=t.readable===!1),e&&(e.constructed=!0,e.destroyed=!1,e.closed=!1,e.closeEmitted=!1,e.errored=null,e.errorEmitted=!1,e.finalCalled=!1,e.prefinished=!1,e.ended=e.writable===!1,e.ending=e.writable===!1,e.finished=e.writable===!1)}function gP(t,e,r){let n=t._readableState,i=t._writableState;if(i!=null&&i.destroyed||n!=null&&n.destroyed)return this;n!=null&&n.autoDestroy||i!=null&&i.autoDestroy?t.destroy(e):e&&(e.stack,i&&!i.errored&&(i.errored=e),n&&!n.errored&&(n.errored=e),r?Rc.nextTick(yP,t,e):yP(t,e))}function Nxe(t,e){if(typeof t._construct!="function")return;let r=t._readableState,n=t._writableState;r&&(r.constructed=!1),n&&(n.constructed=!1),t.once(mP,e),!(t.listenerCount(mP)>1)&&Rc.nextTick(qxe,t)}function qxe(t){let e=!1;function r(n){if(e){gP(t,n??new Ixe);return}e=!0;let i=t._readableState,o=t._writableState,s=o||i;i&&(i.constructed=!0),o&&(o.constructed=!0),s.destroyed?t.emit(WV,n):n?gP(t,n,!0):Rc.nextTick(Lxe,t)}try{t._construct(n=>{Rc.nextTick(r,n)})}catch(n){Rc.nextTick(r,n)}}function Lxe(t){t.emit(mP)}function GV(t){return t?.setHeader&&typeof t.abort=="function"}function ZV(t){t.emit("close")}function Uxe(t,e){t.emit("error",e),Rc.nextTick(ZV,t)}function Fxe(t,e){!t||kxe(t)||(!e&&!Bxe(t)&&(e=new Rxe),Dxe(t)?(t.socket=null,t.destroy(e)):GV(t)?t.abort():GV(t.req)?t.req.abort():typeof t.destroy=="function"?t.destroy(e):typeof t.close=="function"?t.close():e?Rc.nextTick(Uxe,t,e):Rc.nextTick(ZV,t),t.destroyed||(t[Mxe]=!0))}YV.exports={construct:Nxe,destroyer:Fxe,destroy:Cxe,undestroy:jxe,errorOrDestroy:gP}});var O6=G((XGe,XV)=>{"use strict";p();var{ArrayIsArray:zxe,ObjectSetPrototypeOf:JV}=kn(),{EventEmitter:D6}=nc();function C6(t){D6.call(this,t)}JV(C6.prototype,D6.prototype);JV(C6,D6);C6.prototype.pipe=function(t,e){let r=this;function n(f){t.writable&&t.write(f)===!1&&r.pause&&r.pause()}r.on("data",n);function i(){r.readable&&r.resume&&r.resume()}t.on("drain",i),!t._isStdio&&(!e||e.end!==!1)&&(r.on("end",s),r.on("close",a));let o=!1;function s(){o||(o=!0,t.end())}function a(){o||(o=!0,typeof t.destroy=="function"&&t.destroy())}function c(f){d(),D6.listenerCount(this,"error")===0&&this.emit("error",f)}bP(r,"error",c),bP(t,"error",c);function d(){r.removeListener("data",n),t.removeListener("drain",i),r.removeListener("end",s),r.removeListener("close",a),r.removeListener("error",c),t.removeListener("error",c),r.removeListener("end",d),r.removeListener("close",d),t.removeListener("close",d)}return r.on("end",d),r.on("close",d),t.on("close",d),t.emit("pipe",r),t};function bP(t,e,r){if(typeof t.prependListener=="function")return t.prependListener(e,r);!t._events||!t._events[e]?t.on(e,r):zxe(t._events[e])?t._events[e].unshift(r):t._events[e]=[r,t._events[e]]}XV.exports={Stream:C6,prependListener:bP}});var uv=G((eHe,j6)=>{"use strict";p();var{AbortError:QV,codes:$xe}=fo(),{isNodeStream:eK,isWebStream:Gxe,kControllerErrorFunction:Hxe}=Ic(),Wxe=Fd(),{ERR_INVALID_ARG_TYPE:tK}=$xe,Vxe=(t,e)=>{if(typeof t!="object"||!("aborted"in t))throw new tK(e,"AbortSignal",t)};j6.exports.addAbortSignal=function(e,r){if(Vxe(e,"signal"),!eK(r)&&!Gxe(r))throw new tK("stream",["ReadableStream","WritableStream","Stream"],r);return j6.exports.addAbortSignalNoValidate(e,r)};j6.exports.addAbortSignalNoValidate=function(t,e){if(typeof t!="object"||!("aborted"in t))return e;let r=eK(e)?()=>{e.destroy(new QV(void 0,{cause:t.reason}))}:()=>{e[Hxe](new QV(void 0,{cause:t.reason}))};return t.aborted?r():(t.addEventListener("abort",r),Wxe(e,()=>t.removeEventListener("abort",r))),e}});var iK=G((nHe,nK)=>{"use strict";p();var{StringPrototypeSlice:rK,SymbolIterator:Kxe,TypedArrayPrototypeSet:N6,Uint8Array:Zxe}=kn(),{Buffer:vP}=jr(),{inspect:Yxe}=Tc();nK.exports=class{constructor(){this.head=null,this.tail=null,this.length=0}push(e){let r={data:e,next:null};this.length>0?this.tail.next=r:this.head=r,this.tail=r,++this.length}unshift(e){let r={data:e,next:this.head};this.length===0&&(this.tail=r),this.head=r,++this.length}shift(){if(this.length===0)return;let e=this.head.data;return this.length===1?this.head=this.tail=null:this.head=this.head.next,--this.length,e}clear(){this.head=this.tail=null,this.length=0}join(e){if(this.length===0)return"";let r=this.head,n=""+r.data;for(;(r=r.next)!==null;)n+=e+r.data;return n}concat(e){if(this.length===0)return vP.alloc(0);let r=vP.allocUnsafe(e>>>0),n=this.head,i=0;for(;n;)N6(r,n.data,i),i+=n.data.length,n=n.next;return r}consume(e,r){let n=this.head.data;if(e<n.length){let i=n.slice(0,e);return this.head.data=n.slice(e),i}return e===n.length?this.shift():r?this._getString(e):this._getBuffer(e)}first(){return this.head.data}*[Kxe](){for(let e=this.head;e;e=e.next)yield e.data}_getString(e){let r="",n=this.head,i=0;do{let o=n.data;if(e>o.length)r+=o,e-=o.length;else{e===o.length?(r+=o,++i,n.next?this.head=n.next:this.head=this.tail=null):(r+=rK(o,0,e),this.head=n,n.data=rK(o,e));break}++i}while((n=n.next)!==null);return this.length-=i,r}_getBuffer(e){let r=vP.allocUnsafe(e),n=e,i=this.head,o=0;do{let s=i.data;if(e>s.length)N6(r,s,n-e),e-=s.length;else{e===s.length?(N6(r,s,n-e),++o,i.next?this.head=i.next:this.head=this.tail=null):(N6(r,new Zxe(s.buffer,s.byteOffset,e),n-e),this.head=i,i.data=s.slice(e));break}++o}while((i=i.next)!==null);return this.length-=o,r}[Symbol.for("nodejs.util.inspect.custom")](e,r){return Yxe(this,{...r,depth:0,customInspect:!1})}}});var q6=G((oHe,sK)=>{"use strict";p();var{MathFloor:Jxe,NumberIsInteger:Xxe}=kn(),{ERR_INVALID_ARG_VALUE:Qxe}=fo().codes;function e3e(t,e,r){return t.highWaterMark!=null?t.highWaterMark:e?t[r]:null}function oK(t){return t?16:16*1024}function t3e(t,e,r,n){let i=e3e(e,n,r);if(i!=null){if(!Xxe(i)||i<0){let o=n?`options.${r}`:"options.highWaterMark";throw new Qxe(o,i)}return Jxe(i)}return oK(t.objectMode)}sK.exports={getHighWaterMark:t3e,getDefaultHighWaterMark:oK}});var wP=G((aHe,fK)=>{"use strict";p();var aK=sd(),{PromisePrototypeThen:r3e,SymbolAsyncIterator:cK,SymbolIterator:dK}=kn(),{Buffer:n3e}=jr(),{ERR_INVALID_ARG_TYPE:i3e,ERR_STREAM_NULL_VALUES:o3e}=fo().codes;function s3e(t,e,r){let n;if(typeof e=="string"||e instanceof n3e)return new t({objectMode:!0,...r,read(){this.push(e),this.push(null)}});let i;if(e&&e[cK])i=!0,n=e[cK]();else if(e&&e[dK])i=!1,n=e[dK]();else throw new i3e("iterable",["Iterable"],e);let o=new t({objectMode:!0,highWaterMark:1,...r}),s=!1;o._read=function(){s||(s=!0,c())},o._destroy=function(d,f){r3e(a(d),()=>aK.nextTick(f,d),u=>aK.nextTick(f,u||d))};async function a(d){let f=d!=null,u=typeof n.throw=="function";if(f&&u){let{value:m,done:_}=await n.throw(d);if(await m,_)return}if(typeof n.return=="function"){let{value:m}=await n.return();await m}}async function c(){for(;;){try{let{value:d,done:f}=i?await n.next():n.next();if(f)o.push(null);else{let u=d&&typeof d.then=="function"?await d:d;if(u===null)throw s=!1,new o3e;if(o.push(u))continue;s=!1}}catch(d){o.destroy(d)}break}}return o}fK.exports=s3e});var lv=G((dHe,EK)=>{p();var Aa=sd(),{ArrayPrototypeIndexOf:a3e,NumberIsInteger:c3e,NumberIsNaN:d3e,NumberParseInt:f3e,ObjectDefineProperties:hK,ObjectKeys:u3e,ObjectSetPrototypeOf:pK,Promise:l3e,SafeSet:h3e,SymbolAsyncIterator:p3e,Symbol:m3e}=kn();EK.exports=Lt;Lt.ReadableState=TP;var{EventEmitter:y3e}=nc(),{Stream:fu,prependListener:g3e}=O6(),{Buffer:_P}=jr(),{addAbortSignal:b3e}=uv(),v3e=Fd(),Jt=Tc().debuglog("stream",t=>{Jt=t}),w3e=iK(),ym=kh(),{getHighWaterMark:_3e,getDefaultHighWaterMark:x3e}=q6(),{aggregateTwoErrors:uK,codes:{ERR_INVALID_ARG_TYPE:E3e,ERR_METHOD_NOT_IMPLEMENTED:S3e,ERR_OUT_OF_RANGE:A3e,ERR_STREAM_PUSH_AFTER_EOF:T3e,ERR_STREAM_UNSHIFT_AFTER_END_EVENT:P3e}}=fo(),{validateObject:I3e}=fv(),Bh=m3e("kPaused"),{StringDecoder:mK}=xb(),R3e=wP();pK(Lt.prototype,fu.prototype);pK(Lt,fu);var xP=()=>{},{errorOrDestroy:mm}=ym;function TP(t,e,r){typeof r!="boolean"&&(r=e instanceof Mc()),this.objectMode=!!(t&&t.objectMode),r&&(this.objectMode=this.objectMode||!!(t&&t.readableObjectMode)),this.highWaterMark=t?_3e(this,t,"readableHighWaterMark",r):x3e(!1),this.buffer=new w3e,this.length=0,this.pipes=[],this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.constructed=!0,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this[Bh]=null,this.errorEmitted=!1,this.emitClose=!t||t.emitClose!==!1,this.autoDestroy=!t||t.autoDestroy!==!1,this.destroyed=!1,this.errored=null,this.closed=!1,this.closeEmitted=!1,this.defaultEncoding=t&&t.defaultEncoding||"utf8",this.awaitDrainWriters=null,this.multiAwaitDrain=!1,this.readingMore=!1,this.dataEmitted=!1,this.decoder=null,this.encoding=null,t&&t.encoding&&(this.decoder=new mK(t.encoding),this.encoding=t.encoding)}function Lt(t){if(!(this instanceof Lt))return new Lt(t);let e=this instanceof Mc();this._readableState=new TP(t,this,e),t&&(typeof t.read=="function"&&(this._read=t.read),typeof t.destroy=="function"&&(this._destroy=t.destroy),typeof t.construct=="function"&&(this._construct=t.construct),t.signal&&!e&&b3e(t.signal,this)),fu.call(this,t),ym.construct(this,()=>{this._readableState.needReadable&&L6(this,this._readableState)})}Lt.prototype.destroy=ym.destroy;Lt.prototype._undestroy=ym.undestroy;Lt.prototype._destroy=function(t,e){e(t)};Lt.prototype[y3e.captureRejectionSymbol]=function(t){this.destroy(t)};Lt.prototype.push=function(t,e){return yK(this,t,e,!1)};Lt.prototype.unshift=function(t,e){return yK(this,t,e,!0)};function yK(t,e,r,n){Jt("readableAddChunk",e);let i=t._readableState,o;if(i.objectMode||(typeof e=="string"?(r=r||i.defaultEncoding,i.encoding!==r&&(n&&i.encoding?e=_P.from(e,r).toString(i.encoding):(e=_P.from(e,r),r=""))):e instanceof _P?r="":fu._isUint8Array(e)?(e=fu._uint8ArrayToBuffer(e),r=""):e!=null&&(o=new E3e("chunk",["string","Buffer","Uint8Array"],e))),o)mm(t,o);else if(e===null)i.reading=!1,B3e(t,i);else if(i.objectMode||e&&e.length>0)if(n)if(i.endEmitted)mm(t,new P3e);else{if(i.destroyed||i.errored)return!1;EP(t,i,e,!0)}else if(i.ended)mm(t,new T3e);else{if(i.destroyed||i.errored)return!1;i.reading=!1,i.decoder&&!r?(e=i.decoder.write(e),i.objectMode||e.length!==0?EP(t,i,e,!1):L6(t,i)):EP(t,i,e,!1)}else n||(i.reading=!1,L6(t,i));return!i.ended&&(i.length<i.highWaterMark||i.length===0)}function EP(t,e,r,n){e.flowing&&e.length===0&&!e.sync&&t.listenerCount("data")>0?(e.multiAwaitDrain?e.awaitDrainWriters.clear():e.awaitDrainWriters=null,e.dataEmitted=!0,t.emit("data",r)):(e.length+=e.objectMode?1:r.length,n?e.buffer.unshift(r):e.buffer.push(r),e.needReadable&&U6(t)),L6(t,e)}Lt.prototype.isPaused=function(){let t=this._readableState;return t[Bh]===!0||t.flowing===!1};Lt.prototype.setEncoding=function(t){let e=new mK(t);this._readableState.decoder=e,this._readableState.encoding=this._readableState.decoder.encoding;let r=this._readableState.buffer,n="";for(let i of r)n+=e.write(i);return r.clear(),n!==""&&r.push(n),this._readableState.length=n.length,this};var M3e=1073741824;function k3e(t){if(t>M3e)throw new A3e("size","<= 1GiB",t);return t--,t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,t|=t>>>16,t++,t}function lK(t,e){return t<=0||e.length===0&&e.ended?0:e.objectMode?1:d3e(t)?e.flowing&&e.length?e.buffer.first().length:e.length:t<=e.length?t:e.ended?e.length:0}Lt.prototype.read=function(t){Jt("read",t),t===void 0?t=NaN:c3e(t)||(t=f3e(t,10));let e=this._readableState,r=t;if(t>e.highWaterMark&&(e.highWaterMark=k3e(t)),t!==0&&(e.emittedReadable=!1),t===0&&e.needReadable&&((e.highWaterMark!==0?e.length>=e.highWaterMark:e.length>0)||e.ended))return Jt("read: emitReadable",e.length,e.ended),e.length===0&&e.ended?SP(this):U6(this),null;if(t=lK(t,e),t===0&&e.ended)return e.length===0&&SP(this),null;let n=e.needReadable;if(Jt("need readable",n),(e.length===0||e.length-t<e.highWaterMark)&&(n=!0,Jt("length less than watermark",n)),e.ended||e.reading||e.destroyed||e.errored||!e.constructed)n=!1,Jt("reading, ended or constructing",n);else if(n){Jt("do read"),e.reading=!0,e.sync=!0,e.length===0&&(e.needReadable=!0);try{this._read(e.highWaterMark)}catch(o){mm(this,o)}e.sync=!1,e.reading||(t=lK(r,e))}let i;return t>0?i=_K(t,e):i=null,i===null?(e.needReadable=e.length<=e.highWaterMark,t=0):(e.length-=t,e.multiAwaitDrain?e.awaitDrainWriters.clear():e.awaitDrainWriters=null),e.length===0&&(e.ended||(e.needReadable=!0),r!==t&&e.ended&&SP(this)),i!==null&&!e.errorEmitted&&!e.closeEmitted&&(e.dataEmitted=!0,this.emit("data",i)),i};function B3e(t,e){if(Jt("onEofChunk"),!e.ended){if(e.decoder){let r=e.decoder.end();r&&r.length&&(e.buffer.push(r),e.length+=e.objectMode?1:r.length)}e.ended=!0,e.sync?U6(t):(e.needReadable=!1,e.emittedReadable=!0,gK(t))}}function U6(t){let e=t._readableState;Jt("emitReadable",e.needReadable,e.emittedReadable),e.needReadable=!1,e.emittedReadable||(Jt("emitReadable",e.flowing),e.emittedReadable=!0,Aa.nextTick(gK,t))}function gK(t){let e=t._readableState;Jt("emitReadable_",e.destroyed,e.length,e.ended),!e.destroyed&&!e.errored&&(e.length||e.ended)&&(t.emit("readable"),e.emittedReadable=!1),e.needReadable=!e.flowing&&!e.ended&&e.length<=e.highWaterMark,vK(t)}function L6(t,e){!e.readingMore&&e.constructed&&(e.readingMore=!0,Aa.nextTick(D3e,t,e))}function D3e(t,e){for(;!e.reading&&!e.ended&&(e.length<e.highWaterMark||e.flowing&&e.length===0);){let r=e.length;if(Jt("maybeReadMore read 0"),t.read(0),r===e.length)break}e.readingMore=!1}Lt.prototype._read=function(t){throw new S3e("_read()")};Lt.prototype.pipe=function(t,e){let r=this,n=this._readableState;n.pipes.length===1&&(n.multiAwaitDrain||(n.multiAwaitDrain=!0,n.awaitDrainWriters=new h3e(n.awaitDrainWriters?[n.awaitDrainWriters]:[]))),n.pipes.push(t),Jt("pipe count=%d opts=%j",n.pipes.length,e);let o=(!e||e.end!==!1)&&t!==Aa.stdout&&t!==Aa.stderr?a:T;n.endEmitted?Aa.nextTick(o):r.once("end",o),t.on("unpipe",s);function s(M,D){Jt("onunpipe"),M===r&&D&&D.hasUnpiped===!1&&(D.hasUnpiped=!0,f())}function a(){Jt("onend"),t.end()}let c,d=!1;function f(){Jt("cleanup"),t.removeListener("close",v),t.removeListener("finish",A),c&&t.removeListener("drain",c),t.removeListener("error",_),t.removeListener("unpipe",s),r.removeListener("end",a),r.removeListener("end",T),r.removeListener("data",m),d=!0,c&&n.awaitDrainWriters&&(!t._writableState||t._writableState.needDrain)&&c()}function u(){d||(n.pipes.length===1&&n.pipes[0]===t?(Jt("false write response, pause",0),n.awaitDrainWriters=t,n.multiAwaitDrain=!1):n.pipes.length>1&&n.pipes.includes(t)&&(Jt("false write response, pause",n.awaitDrainWriters.size),n.awaitDrainWriters.add(t)),r.pause()),c||(c=C3e(r,t),t.on("drain",c))}r.on("data",m);function m(M){Jt("ondata");let D=t.write(M);Jt("dest.write",D),D===!1&&u()}function _(M){if(Jt("onerror",M),T(),t.removeListener("error",_),t.listenerCount("error")===0){let D=t._writableState||t._readableState;D&&!D.errorEmitted?mm(t,M):t.emit("error",M)}}g3e(t,"error",_);function v(){t.removeListener("finish",A),T()}t.once("close",v);function A(){Jt("onfinish"),t.removeListener("close",v),T()}t.once("finish",A);function T(){Jt("unpipe"),r.unpipe(t)}return t.emit("pipe",r),t.writableNeedDrain===!0?n.flowing&&u():n.flowing||(Jt("pipe resume"),r.resume()),t};function C3e(t,e){return function(){let n=t._readableState;n.awaitDrainWriters===e?(Jt("pipeOnDrain",1),n.awaitDrainWriters=null):n.multiAwaitDrain&&(Jt("pipeOnDrain",n.awaitDrainWriters.size),n.awaitDrainWriters.delete(e)),(!n.awaitDrainWriters||n.awaitDrainWriters.size===0)&&t.listenerCount("data")&&t.resume()}}Lt.prototype.unpipe=function(t){let e=this._readableState,r={hasUnpiped:!1};if(e.pipes.length===0)return this;if(!t){let i=e.pipes;e.pipes=[],this.pause();for(let o=0;o<i.length;o++)i[o].emit("unpipe",this,{hasUnpiped:!1});return this}let n=a3e(e.pipes,t);return n===-1?this:(e.pipes.splice(n,1),e.pipes.length===0&&this.pause(),t.emit("unpipe",this,r),this)};Lt.prototype.on=function(t,e){let r=fu.prototype.on.call(this,t,e),n=this._readableState;return t==="data"?(n.readableListening=this.listenerCount("readable")>0,n.flowing!==!1&&this.resume()):t==="readable"&&!n.endEmitted&&!n.readableListening&&(n.readableListening=n.needReadable=!0,n.flowing=!1,n.emittedReadable=!1,Jt("on readable",n.length,n.reading),n.length?U6(this):n.reading||Aa.nextTick(O3e,this)),r};Lt.prototype.addListener=Lt.prototype.on;Lt.prototype.removeListener=function(t,e){let r=fu.prototype.removeListener.call(this,t,e);return t==="readable"&&Aa.nextTick(bK,this),r};Lt.prototype.off=Lt.prototype.removeListener;Lt.prototype.removeAllListeners=function(t){let e=fu.prototype.removeAllListeners.apply(this,arguments);return(t==="readable"||t===void 0)&&Aa.nextTick(bK,this),e};function bK(t){let e=t._readableState;e.readableListening=t.listenerCount("readable")>0,e.resumeScheduled&&e[Bh]===!1?e.flowing=!0:t.listenerCount("data")>0?t.resume():e.readableListening||(e.flowing=null)}function O3e(t){Jt("readable nexttick read 0"),t.read(0)}Lt.prototype.resume=function(){let t=this._readableState;return t.flowing||(Jt("resume"),t.flowing=!t.readableListening,j3e(this,t)),t[Bh]=!1,this};function j3e(t,e){e.resumeScheduled||(e.resumeScheduled=!0,Aa.nextTick(N3e,t,e))}function N3e(t,e){Jt("resume",e.reading),e.reading||t.read(0),e.resumeScheduled=!1,t.emit("resume"),vK(t),e.flowing&&!e.reading&&t.read(0)}Lt.prototype.pause=function(){return Jt("call pause flowing=%j",this._readableState.flowing),this._readableState.flowing!==!1&&(Jt("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState[Bh]=!0,this};function vK(t){let e=t._readableState;for(Jt("flow",e.flowing);e.flowing&&t.read()!==null;);}Lt.prototype.wrap=function(t){let e=!1;t.on("data",n=>{!this.push(n)&&t.pause&&(e=!0,t.pause())}),t.on("end",()=>{this.push(null)}),t.on("error",n=>{mm(this,n)}),t.on("close",()=>{this.destroy()}),t.on("destroy",()=>{this.destroy()}),this._read=()=>{e&&t.resume&&(e=!1,t.resume())};let r=u3e(t);for(let n=1;n<r.length;n++){let i=r[n];this[i]===void 0&&typeof t[i]=="function"&&(this[i]=t[i].bind(t))}return this};Lt.prototype[p3e]=function(){return wK(this)};Lt.prototype.iterator=function(t){return t!==void 0&&I3e(t,"options"),wK(this,t)};function wK(t,e){typeof t.read!="function"&&(t=Lt.wrap(t,{objectMode:!0}));let r=q3e(t,e);return r.stream=t,r}async function*q3e(t,e){let r=xP;function n(s){this===t?(r(),r=xP):r=s}t.on("readable",n);let i,o=v3e(t,{writable:!1},s=>{i=s?uK(i,s):null,r(),r=xP});try{for(;;){let s=t.destroyed?null:t.read();if(s!==null)yield s;else{if(i)throw i;if(i===null)return;await new l3e(n)}}}catch(s){throw i=uK(i,s),i}finally{(i||e?.destroyOnReturn!==!1)&&(i===void 0||t._readableState.autoDestroy)?ym.destroyer(t,null):(t.off("readable",n),o())}}hK(Lt.prototype,{readable:{__proto__:null,get(){let t=this._readableState;return!!t&&t.readable!==!1&&!t.destroyed&&!t.errorEmitted&&!t.endEmitted},set(t){this._readableState&&(this._readableState.readable=!!t)}},readableDidRead:{__proto__:null,enumerable:!1,get:function(){return this._readableState.dataEmitted}},readableAborted:{__proto__:null,enumerable:!1,get:function(){return!!(this._readableState.readable!==!1&&(this._readableState.destroyed||this._readableState.errored)&&!this._readableState.endEmitted)}},readableHighWaterMark:{__proto__:null,enumerable:!1,get:function(){return this._readableState.highWaterMark}},readableBuffer:{__proto__:null,enumerable:!1,get:function(){return this._readableState&&this._readableState.buffer}},readableFlowing:{__proto__:null,enumerable:!1,get:function(){return this._readableState.flowing},set:function(t){this._readableState&&(this._readableState.flowing=t)}},readableLength:{__proto__:null,enumerable:!1,get(){return this._readableState.length}},readableObjectMode:{__proto__:null,enumerable:!1,get(){return this._readableState?this._readableState.objectMode:!1}},readableEncoding:{__proto__:null,enumerable:!1,get(){return this._readableState?this._readableState.encoding:null}},errored:{__proto__:null,enumerable:!1,get(){return this._readableState?this._readableState.errored:null}},closed:{__proto__:null,get(){return this._readableState?this._readableState.closed:!1}},destroyed:{__proto__:null,enumerable:!1,get(){return this._readableState?this._readableState.destroyed:!1},set(t){this._readableState&&(this._readableState.destroyed=t)}},readableEnded:{__proto__:null,enumerable:!1,get(){return this._readableState?this._readableState.endEmitted:!1}}});hK(TP.prototype,{pipesCount:{__proto__:null,get(){return this.pipes.length}},paused:{__proto__:null,get(){return this[Bh]!==!1},set(t){this[Bh]=!!t}}});Lt._fromList=_K;function _K(t,e){if(e.length===0)return null;let r;return e.objectMode?r=e.buffer.shift():!t||t>=e.length?(e.decoder?r=e.buffer.join(""):e.buffer.length===1?r=e.buffer.first():r=e.buffer.concat(e.length),e.buffer.clear()):r=e.buffer.consume(t,e.decoder),r}function SP(t){let e=t._readableState;Jt("endReadable",e.endEmitted),e.endEmitted||(e.ended=!0,Aa.nextTick(L3e,e,t))}function L3e(t,e){if(Jt("endReadableNT",t.endEmitted,t.length),!t.errored&&!t.closeEmitted&&!t.endEmitted&&t.length===0){if(t.endEmitted=!0,e.emit("end"),e.writable&&e.allowHalfOpen===!1)Aa.nextTick(U3e,e);else if(t.autoDestroy){let r=e._writableState;(!r||r.autoDestroy&&(r.finished||r.writable===!1))&&e.destroy()}}}function U3e(t){t.writable&&!t.writableEnded&&!t.destroyed&&t.end()}Lt.from=function(t,e){return R3e(Lt,t,e)};var AP;function xK(){return AP===void 0&&(AP={}),AP}Lt.fromWeb=function(t,e){return xK().newStreamReadableFromReadableStream(t,e)};Lt.toWeb=function(t,e){return xK().newReadableStreamFromStreamReadable(t,e)};Lt.wrap=function(t,e){var r,n;return new Lt({objectMode:(r=(n=t.readableObjectMode)!==null&&n!==void 0?n:t.objectMode)!==null&&r!==void 0?r:!0,...e,destroy(i,o){ym.destroyer(t,i),o(i)}}).wrap(t)}});var DP=G((uHe,OK)=>{p();var Dh=sd(),{ArrayPrototypeSlice:TK,Error:F3e,FunctionPrototypeSymbolHasInstance:PK,ObjectDefineProperty:IK,ObjectDefineProperties:z3e,ObjectSetPrototypeOf:RK,StringPrototypeToLowerCase:$3e,Symbol:G3e,SymbolHasInstance:H3e}=kn();OK.exports=tn;tn.WritableState=mv;var{EventEmitter:W3e}=nc(),hv=O6().Stream,{Buffer:F6}=jr(),G6=kh(),{addAbortSignal:V3e}=uv(),{getHighWaterMark:K3e,getDefaultHighWaterMark:Z3e}=q6(),{ERR_INVALID_ARG_TYPE:Y3e,ERR_METHOD_NOT_IMPLEMENTED:J3e,ERR_MULTIPLE_CALLBACK:MK,ERR_STREAM_CANNOT_PIPE:X3e,ERR_STREAM_DESTROYED:pv,ERR_STREAM_ALREADY_FINISHED:Q3e,ERR_STREAM_NULL_VALUES:e8e,ERR_STREAM_WRITE_AFTER_END:t8e,ERR_UNKNOWN_ENCODING:kK}=fo().codes,{errorOrDestroy:gm}=G6;RK(tn.prototype,hv.prototype);RK(tn,hv);function RP(){}var bm=G3e("kOnFinished");function mv(t,e,r){typeof r!="boolean"&&(r=e instanceof Mc()),this.objectMode=!!(t&&t.objectMode),r&&(this.objectMode=this.objectMode||!!(t&&t.writableObjectMode)),this.highWaterMark=t?K3e(this,t,"writableHighWaterMark",r):Z3e(!1),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;let n=!!(t&&t.decodeStrings===!1);this.decodeStrings=!n,this.defaultEncoding=t&&t.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=n8e.bind(void 0,e),this.writecb=null,this.writelen=0,this.afterWriteTickInfo=null,$6(this),this.pendingcb=0,this.constructed=!0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=!t||t.emitClose!==!1,this.autoDestroy=!t||t.autoDestroy!==!1,this.errored=null,this.closed=!1,this.closeEmitted=!1,this[bm]=[]}function $6(t){t.buffered=[],t.bufferedIndex=0,t.allBuffers=!0,t.allNoop=!0}mv.prototype.getBuffer=function(){return TK(this.buffered,this.bufferedIndex)};IK(mv.prototype,"bufferedRequestCount",{__proto__:null,get(){return this.buffered.length-this.bufferedIndex}});function tn(t){let e=this instanceof Mc();if(!e&&!PK(tn,this))return new tn(t);this._writableState=new mv(t,this,e),t&&(typeof t.write=="function"&&(this._write=t.write),typeof t.writev=="function"&&(this._writev=t.writev),typeof t.destroy=="function"&&(this._destroy=t.destroy),typeof t.final=="function"&&(this._final=t.final),typeof t.construct=="function"&&(this._construct=t.construct),t.signal&&V3e(t.signal,this)),hv.call(this,t),G6.construct(this,()=>{let r=this._writableState;r.writing||kP(this,r),BP(this,r)})}IK(tn,H3e,{__proto__:null,value:function(t){return PK(this,t)?!0:this!==tn?!1:t&&t._writableState instanceof mv}});tn.prototype.pipe=function(){gm(this,new X3e)};function BK(t,e,r,n){let i=t._writableState;if(typeof r=="function")n=r,r=i.defaultEncoding;else{if(!r)r=i.defaultEncoding;else if(r!=="buffer"&&!F6.isEncoding(r))throw new kK(r);typeof n!="function"&&(n=RP)}if(e===null)throw new e8e;if(!i.objectMode)if(typeof e=="string")i.decodeStrings!==!1&&(e=F6.from(e,r),r="buffer");else if(e instanceof F6)r="buffer";else if(hv._isUint8Array(e))e=hv._uint8ArrayToBuffer(e),r="buffer";else throw new Y3e("chunk",["string","Buffer","Uint8Array"],e);let o;return i.ending?o=new t8e:i.destroyed&&(o=new pv("write")),o?(Dh.nextTick(n,o),gm(t,o,!0),o):(i.pendingcb++,r8e(t,i,e,r,n))}tn.prototype.write=function(t,e,r){return BK(this,t,e,r)===!0};tn.prototype.cork=function(){this._writableState.corked++};tn.prototype.uncork=function(){let t=this._writableState;t.corked&&(t.corked--,t.writing||kP(this,t))};tn.prototype.setDefaultEncoding=function(e){if(typeof e=="string"&&(e=$3e(e)),!F6.isEncoding(e))throw new kK(e);return this._writableState.defaultEncoding=e,this};function r8e(t,e,r,n,i){let o=e.objectMode?1:r.length;e.length+=o;let s=e.length<e.highWaterMark;return s||(e.needDrain=!0),e.writing||e.corked||e.errored||!e.constructed?(e.buffered.push({chunk:r,encoding:n,callback:i}),e.allBuffers&&n!=="buffer"&&(e.allBuffers=!1),e.allNoop&&i!==RP&&(e.allNoop=!1)):(e.writelen=o,e.writecb=i,e.writing=!0,e.sync=!0,t._write(r,n,e.onwrite),e.sync=!1),s&&!e.errored&&!e.destroyed}function SK(t,e,r,n,i,o,s){e.writelen=n,e.writecb=s,e.writing=!0,e.sync=!0,e.destroyed?e.onwrite(new pv("write")):r?t._writev(i,e.onwrite):t._write(i,o,e.onwrite),e.sync=!1}function AK(t,e,r,n){--e.pendingcb,n(r),MP(e),gm(t,r)}function n8e(t,e){let r=t._writableState,n=r.sync,i=r.writecb;if(typeof i!="function"){gm(t,new MK);return}r.writing=!1,r.writecb=null,r.length-=r.writelen,r.writelen=0,e?(e.stack,r.errored||(r.errored=e),t._readableState&&!t._readableState.errored&&(t._readableState.errored=e),n?Dh.nextTick(AK,t,r,e,i):AK(t,r,e,i)):(r.buffered.length>r.bufferedIndex&&kP(t,r),n?r.afterWriteTickInfo!==null&&r.afterWriteTickInfo.cb===i?r.afterWriteTickInfo.count++:(r.afterWriteTickInfo={count:1,cb:i,stream:t,state:r},Dh.nextTick(i8e,r.afterWriteTickInfo)):DK(t,r,1,i))}function i8e({stream:t,state:e,count:r,cb:n}){return e.afterWriteTickInfo=null,DK(t,e,r,n)}function DK(t,e,r,n){for(!e.ending&&!t.destroyed&&e.length===0&&e.needDrain&&(e.needDrain=!1,t.emit("drain"));r-- >0;)e.pendingcb--,n();e.destroyed&&MP(e),BP(t,e)}function MP(t){if(t.writing)return;for(let i=t.bufferedIndex;i<t.buffered.length;++i){var e;let{chunk:o,callback:s}=t.buffered[i],a=t.objectMode?1:o.length;t.length-=a,s((e=t.errored)!==null&&e!==void 0?e:new pv("write"))}let r=t[bm].splice(0);for(let i=0;i<r.length;i++){var n;r[i]((n=t.errored)!==null&&n!==void 0?n:new pv("end"))}$6(t)}function kP(t,e){if(e.corked||e.bufferProcessing||e.destroyed||!e.constructed)return;let{buffered:r,bufferedIndex:n,objectMode:i}=e,o=r.length-n;if(!o)return;let s=n;if(e.bufferProcessing=!0,o>1&&t._writev){e.pendingcb-=o-1;let a=e.allNoop?RP:d=>{for(let f=s;f<r.length;++f)r[f].callback(d)},c=e.allNoop&&s===0?r:TK(r,s);c.allBuffers=e.allBuffers,SK(t,e,!0,e.length,c,"",a),$6(e)}else{do{let{chunk:a,encoding:c,callback:d}=r[s];r[s++]=null;let f=i?1:a.length;SK(t,e,!1,f,a,c,d)}while(s<r.length&&!e.writing);s===r.length?$6(e):s>256?(r.splice(0,s),e.bufferedIndex=0):e.bufferedIndex=s}e.bufferProcessing=!1}tn.prototype._write=function(t,e,r){if(this._writev)this._writev([{chunk:t,encoding:e}],r);else throw new J3e("_write()")};tn.prototype._writev=null;tn.prototype.end=function(t,e,r){let n=this._writableState;typeof t=="function"?(r=t,t=null,e=null):typeof e=="function"&&(r=e,e=null);let i;if(t!=null){let o=BK(this,t,e);o instanceof F3e&&(i=o)}return n.corked&&(n.corked=1,this.uncork()),i||(!n.errored&&!n.ending?(n.ending=!0,BP(this,n,!0),n.ended=!0):n.finished?i=new Q3e("end"):n.destroyed&&(i=new pv("end"))),typeof r=="function"&&(i||n.finished?Dh.nextTick(r,i):n[bm].push(r)),this};function z6(t){return t.ending&&!t.destroyed&&t.constructed&&t.length===0&&!t.errored&&t.buffered.length===0&&!t.finished&&!t.writing&&!t.errorEmitted&&!t.closeEmitted}function o8e(t,e){let r=!1;function n(i){if(r){gm(t,i??MK());return}if(r=!0,e.pendingcb--,i){let o=e[bm].splice(0);for(let s=0;s<o.length;s++)o[s](i);gm(t,i,e.sync)}else z6(e)&&(e.prefinished=!0,t.emit("prefinish"),e.pendingcb++,Dh.nextTick(IP,t,e))}e.sync=!0,e.pendingcb++;try{t._final(n)}catch(i){n(i)}e.sync=!1}function s8e(t,e){!e.prefinished&&!e.finalCalled&&(typeof t._final=="function"&&!e.destroyed?(e.finalCalled=!0,o8e(t,e)):(e.prefinished=!0,t.emit("prefinish")))}function BP(t,e,r){z6(e)&&(s8e(t,e),e.pendingcb===0&&(r?(e.pendingcb++,Dh.nextTick((n,i)=>{z6(i)?IP(n,i):i.pendingcb--},t,e)):z6(e)&&(e.pendingcb++,IP(t,e))))}function IP(t,e){e.pendingcb--,e.finished=!0;let r=e[bm].splice(0);for(let n=0;n<r.length;n++)r[n]();if(t.emit("finish"),e.autoDestroy){let n=t._readableState;(!n||n.autoDestroy&&(n.endEmitted||n.readable===!1))&&t.destroy()}}z3e(tn.prototype,{closed:{__proto__:null,get(){return this._writableState?this._writableState.closed:!1}},destroyed:{__proto__:null,get(){return this._writableState?this._writableState.destroyed:!1},set(t){this._writableState&&(this._writableState.destroyed=t)}},writable:{__proto__:null,get(){let t=this._writableState;return!!t&&t.writable!==!1&&!t.destroyed&&!t.errored&&!t.ending&&!t.ended},set(t){this._writableState&&(this._writableState.writable=!!t)}},writableFinished:{__proto__:null,get(){return this._writableState?this._writableState.finished:!1}},writableObjectMode:{__proto__:null,get(){return this._writableState?this._writableState.objectMode:!1}},writableBuffer:{__proto__:null,get(){return this._writableState&&this._writableState.getBuffer()}},writableEnded:{__proto__:null,get(){return this._writableState?this._writableState.ending:!1}},writableNeedDrain:{__proto__:null,get(){let t=this._writableState;return t?!t.destroyed&&!t.ending&&t.needDrain:!1}},writableHighWaterMark:{__proto__:null,get(){return this._writableState&&this._writableState.highWaterMark}},writableCorked:{__proto__:null,get(){return this._writableState?this._writableState.corked:0}},writableLength:{__proto__:null,get(){return this._writableState&&this._writableState.length}},errored:{__proto__:null,enumerable:!1,get(){return this._writableState?this._writableState.errored:null}},writableAborted:{__proto__:null,enumerable:!1,get:function(){return!!(this._writableState.writable!==!1&&(this._writableState.destroyed||this._writableState.errored)&&!this._writableState.finished)}}});var a8e=G6.destroy;tn.prototype.destroy=function(t,e){let r=this._writableState;return!r.destroyed&&(r.bufferedIndex<r.buffered.length||r[bm].length)&&Dh.nextTick(MP,r),a8e.call(this,t,e),this};tn.prototype._undestroy=G6.undestroy;tn.prototype._destroy=function(t,e){e(t)};tn.prototype[W3e.captureRejectionSymbol]=function(t){this.destroy(t)};var PP;function CK(){return PP===void 0&&(PP={}),PP}tn.fromWeb=function(t,e){return CK().newStreamWritableFromWritableStream(t,e)};tn.toWeb=function(t){return CK().newWritableStreamFromStreamWritable(t)}});var VK=G((hHe,WK)=>{p();var CP=sd(),c8e=jr(),{isReadable:d8e,isWritable:f8e,isIterable:jK,isNodeStream:u8e,isReadableNodeStream:NK,isWritableNodeStream:qK,isDuplexNodeStream:l8e}=Ic(),LK=Fd(),{AbortError:HK,codes:{ERR_INVALID_ARG_TYPE:h8e,ERR_INVALID_RETURN_VALUE:UK}}=fo(),{destroyer:vm}=kh(),p8e=Mc(),m8e=lv(),{createDeferredPromise:FK}=Tc(),zK=wP(),$K=globalThis.Blob||c8e.Blob,y8e=typeof $K<"u"?function(e){return e instanceof $K}:function(e){return!1},g8e=globalThis.AbortController||T6().AbortController,{FunctionPrototypeCall:GK}=kn(),Ch=class extends p8e{constructor(e){super(e),e?.readable===!1&&(this._readableState.readable=!1,this._readableState.ended=!0,this._readableState.endEmitted=!0),e?.writable===!1&&(this._writableState.writable=!1,this._writableState.ending=!0,this._writableState.ended=!0,this._writableState.finished=!0)}};WK.exports=function t(e,r){if(l8e(e))return e;if(NK(e))return H6({readable:e});if(qK(e))return H6({writable:e});if(u8e(e))return H6({writable:!1,readable:!1});if(typeof e=="function"){let{value:i,write:o,final:s,destroy:a}=b8e(e);if(jK(i))return zK(Ch,i,{objectMode:!0,write:o,final:s,destroy:a});let c=i?.then;if(typeof c=="function"){let d,f=GK(c,i,u=>{if(u!=null)throw new UK("nully","body",u)},u=>{vm(d,u)});return d=new Ch({objectMode:!0,readable:!1,write:o,final(u){s(async()=>{try{await f,CP.nextTick(u,null)}catch(m){CP.nextTick(u,m)}})},destroy:a})}throw new UK("Iterable, AsyncIterable or AsyncFunction",r,i)}if(y8e(e))return t(e.arrayBuffer());if(jK(e))return zK(Ch,e,{objectMode:!0,writable:!1});if(typeof e?.writable=="object"||typeof e?.readable=="object"){let i=e!=null&&e.readable?NK(e?.readable)?e?.readable:t(e.readable):void 0,o=e!=null&&e.writable?qK(e?.writable)?e?.writable:t(e.writable):void 0;return H6({readable:i,writable:o})}let n=e?.then;if(typeof n=="function"){let i;return GK(n,e,o=>{o!=null&&i.push(o),i.push(null)},o=>{vm(i,o)}),i=new Ch({objectMode:!0,writable:!1,read(){}})}throw new h8e(r,["Blob","ReadableStream","WritableStream","Stream","Iterable","AsyncIterable","Function","{ readable, writable } pair","Promise"],e)};function b8e(t){let{promise:e,resolve:r}=FK(),n=new g8e,i=n.signal;return{value:t(async function*(){for(;;){let s=e;e=null;let{chunk:a,done:c,cb:d}=await s;if(CP.nextTick(d),c)return;if(i.aborted)throw new HK(void 0,{cause:i.reason});({promise:e,resolve:r}=FK()),yield a}}(),{signal:i}),write(s,a,c){let d=r;r=null,d({chunk:s,done:!1,cb:c})},final(s){let a=r;r=null,a({done:!0,cb:s})},destroy(s,a){n.abort(),a(s)}}}function H6(t){let e=t.readable&&typeof t.readable.read!="function"?m8e.wrap(t.readable):t.readable,r=t.writable,n=!!d8e(e),i=!!f8e(r),o,s,a,c,d;function f(u){let m=c;c=null,m?m(u):u&&d.destroy(u)}return d=new Ch({readableObjectMode:!!(e!=null&&e.readableObjectMode),writableObjectMode:!!(r!=null&&r.writableObjectMode),readable:n,writable:i}),i&&(LK(r,u=>{i=!1,u&&vm(e,u),f(u)}),d._write=function(u,m,_){r.write(u,m)?_():o=_},d._final=function(u){r.end(),s=u},r.on("drain",function(){if(o){let u=o;o=null,u()}}),r.on("finish",function(){if(s){let u=s;s=null,u()}})),n&&(LK(e,u=>{n=!1,u&&vm(e,u),f(u)}),e.on("readable",function(){if(a){let u=a;a=null,u()}}),e.on("end",function(){d.push(null)}),d._read=function(){for(;;){let u=e.read();if(u===null){a=d._read;return}if(!d.push(u))return}}),d._destroy=function(u,m){!u&&c!==null&&(u=new HK),a=null,o=null,s=null,c===null?m(u):(c=m,vm(r,u),vm(e,u))},d}});var Mc=G((mHe,YK)=>{"use strict";p();var{ObjectDefineProperties:v8e,ObjectGetOwnPropertyDescriptor:zd,ObjectKeys:w8e,ObjectSetPrototypeOf:KK}=kn();YK.exports=Ta;var NP=lv(),Hs=DP();KK(Ta.prototype,NP.prototype);KK(Ta,NP);{let t=w8e(Hs.prototype);for(let e=0;e<t.length;e++){let r=t[e];Ta.prototype[r]||(Ta.prototype[r]=Hs.prototype[r])}}function Ta(t){if(!(this instanceof Ta))return new Ta(t);NP.call(this,t),Hs.call(this,t),t?(this.allowHalfOpen=t.allowHalfOpen!==!1,t.readable===!1&&(this._readableState.readable=!1,this._readableState.ended=!0,this._readableState.endEmitted=!0),t.writable===!1&&(this._writableState.writable=!1,this._writableState.ending=!0,this._writableState.ended=!0,this._writableState.finished=!0)):this.allowHalfOpen=!0}v8e(Ta.prototype,{writable:{__proto__:null,...zd(Hs.prototype,"writable")},writableHighWaterMark:{__proto__:null,...zd(Hs.prototype,"writableHighWaterMark")},writableObjectMode:{__proto__:null,...zd(Hs.prototype,"writableObjectMode")},writableBuffer:{__proto__:null,...zd(Hs.prototype,"writableBuffer")},writableLength:{__proto__:null,...zd(Hs.prototype,"writableLength")},writableFinished:{__proto__:null,...zd(Hs.prototype,"writableFinished")},writableCorked:{__proto__:null,...zd(Hs.prototype,"writableCorked")},writableEnded:{__proto__:null,...zd(Hs.prototype,"writableEnded")},writableNeedDrain:{__proto__:null,...zd(Hs.prototype,"writableNeedDrain")},destroyed:{__proto__:null,get(){return this._readableState===void 0||this._writableState===void 0?!1:this._readableState.destroyed&&this._writableState.destroyed},set(t){this._readableState&&this._writableState&&(this._readableState.destroyed=t,this._writableState.destroyed=t)}}});var OP;function ZK(){return OP===void 0&&(OP={}),OP}Ta.fromWeb=function(t,e){return ZK().newStreamDuplexFromReadableWritablePair(t,e)};Ta.toWeb=function(t){return ZK().newReadableWritablePairFromDuplex(t)};var jP;Ta.from=function(t){return jP||(jP=VK()),jP(t,"body")}});var UP=G((gHe,XK)=>{"use strict";p();var{ObjectSetPrototypeOf:JK,Symbol:_8e}=kn();XK.exports=$d;var{ERR_METHOD_NOT_IMPLEMENTED:x8e}=fo().codes,LP=Mc(),{getHighWaterMark:E8e}=q6();JK($d.prototype,LP.prototype);JK($d,LP);var yv=_8e("kCallback");function $d(t){if(!(this instanceof $d))return new $d(t);let e=t?E8e(this,t,"readableHighWaterMark",!0):null;e===0&&(t={...t,highWaterMark:null,readableHighWaterMark:e,writableHighWaterMark:t.writableHighWaterMark||0}),LP.call(this,t),this._readableState.sync=!1,this[yv]=null,t&&(typeof t.transform=="function"&&(this._transform=t.transform),typeof t.flush=="function"&&(this._flush=t.flush)),this.on("prefinish",S8e)}function qP(t){typeof this._flush=="function"&&!this.destroyed?this._flush((e,r)=>{if(e){t?t(e):this.destroy(e);return}r!=null&&this.push(r),this.push(null),t&&t()}):(this.push(null),t&&t())}function S8e(){this._final!==qP&&qP.call(this)}$d.prototype._final=qP;$d.prototype._transform=function(t,e,r){throw new x8e("_transform()")};$d.prototype._write=function(t,e,r){let n=this._readableState,i=this._writableState,o=n.length;this._transform(t,e,(s,a)=>{if(s){r(s);return}a!=null&&this.push(a),i.ended||o===n.length||n.length<n.highWaterMark?r():this[yv]=r})};$d.prototype._read=function(){if(this[yv]){let t=this[yv];this[yv]=null,t()}}});var zP=G((vHe,eZ)=>{"use strict";p();var{ObjectSetPrototypeOf:QK}=kn();eZ.exports=wm;var FP=UP();QK(wm.prototype,FP.prototype);QK(wm,FP);function wm(t){if(!(this instanceof wm))return new wm(t);FP.call(this,t)}wm.prototype._transform=function(t,e,r){r(null,t)}});var Z6=G((_He,oZ)=>{p();var gv=sd(),{ArrayIsArray:A8e,Promise:T8e,SymbolAsyncIterator:P8e}=kn(),K6=Fd(),{once:I8e}=Tc(),R8e=kh(),tZ=Mc(),{aggregateTwoErrors:M8e,codes:{ERR_INVALID_ARG_TYPE:YP,ERR_INVALID_RETURN_VALUE:$P,ERR_MISSING_ARGS:k8e,ERR_STREAM_DESTROYED:B8e,ERR_STREAM_PREMATURE_CLOSE:D8e},AbortError:C8e}=fo(),{validateFunction:O8e,validateAbortSignal:j8e}=fv(),{isIterable:Oh,isReadable:GP,isReadableNodeStream:V6,isNodeStream:rZ,isTransformStream:_m,isWebStream:N8e,isReadableStream:HP,isReadableEnded:q8e}=Ic(),L8e=globalThis.AbortController||T6().AbortController,WP,VP;function nZ(t,e,r){let n=!1;t.on("close",()=>{n=!0});let i=K6(t,{readable:e,writable:r},o=>{n=!o});return{destroy:o=>{n||(n=!0,R8e.destroyer(t,o||new B8e("pipe")))},cleanup:i}}function U8e(t){return O8e(t[t.length-1],"streams[stream.length - 1]"),t.pop()}function KP(t){if(Oh(t))return t;if(V6(t))return F8e(t);throw new YP("val",["Readable","Iterable","AsyncIterable"],t)}async function*F8e(t){VP||(VP=lv()),yield*VP.prototype[P8e].call(t)}async function W6(t,e,r,{end:n}){let i,o=null,s=d=>{if(d&&(i=d),o){let f=o;o=null,f()}},a=()=>new T8e((d,f)=>{i?f(i):o=()=>{i?f(i):d()}});e.on("drain",s);let c=K6(e,{readable:!1},s);try{e.writableNeedDrain&&await a();for await(let d of t)e.write(d)||await a();n&&e.end(),await a(),r()}catch(d){r(i!==d?M8e(i,d):d)}finally{c(),e.off("drain",s)}}async function ZP(t,e,r,{end:n}){_m(e)&&(e=e.writable);let i=e.getWriter();try{for await(let o of t)await i.ready,i.write(o).catch(()=>{});await i.ready,n&&await i.close(),r()}catch(o){try{await i.abort(o),r(o)}catch(s){r(s)}}}function z8e(...t){return iZ(t,I8e(U8e(t)))}function iZ(t,e,r){if(t.length===1&&A8e(t[0])&&(t=t[0]),t.length<2)throw new k8e("streams");let n=new L8e,i=n.signal,o=r?.signal,s=[];j8e(o,"options.signal");function a(){_(new C8e)}o?.addEventListener("abort",a);let c,d,f=[],u=0;function m(D){_(D,--u===0)}function _(D,O){if(D&&(!c||c.code==="ERR_STREAM_PREMATURE_CLOSE")&&(c=D),!(!c&&!O)){for(;f.length;)f.shift()(c);o?.removeEventListener("abort",a),n.abort(),O&&(c||s.forEach(U=>U()),gv.nextTick(e,c,d))}}let v;for(let D=0;D<t.length;D++){let O=t[D],U=D<t.length-1,L=D>0,F=U||r?.end!==!1,$=D===t.length-1;if(rZ(O)){let H=function(z){z&&z.name!=="AbortError"&&z.code!=="ERR_STREAM_PREMATURE_CLOSE"&&m(z)};var M=H;if(F){let{destroy:z,cleanup:j}=nZ(O,U,L);f.push(z),GP(O)&&$&&s.push(j)}O.on("error",H),GP(O)&&$&&s.push(()=>{O.removeListener("error",H)})}if(D===0)if(typeof O=="function"){if(v=O({signal:i}),!Oh(v))throw new $P("Iterable, AsyncIterable or Stream","source",v)}else Oh(O)||V6(O)||_m(O)?v=O:v=tZ.from(O);else if(typeof O=="function"){if(_m(v)){var A;v=KP((A=v)===null||A===void 0?void 0:A.readable)}else v=KP(v);if(v=O(v,{signal:i}),U){if(!Oh(v,!0))throw new $P("AsyncIterable",`transform[${D-1}]`,v)}else{var T;WP||(WP=zP());let H=new WP({objectMode:!0}),z=(T=v)===null||T===void 0?void 0:T.then;if(typeof z=="function")u++,z.call(v,P=>{d=P,P!=null&&H.write(P),F&&H.end(),gv.nextTick(m)},P=>{H.destroy(P),gv.nextTick(m,P)});else if(Oh(v,!0))u++,W6(v,H,m,{end:F});else if(HP(v)||_m(v)){let P=v.readable||v;u++,W6(P,H,m,{end:F})}else throw new $P("AsyncIterable or Promise","destination",v);v=H;let{destroy:j,cleanup:y}=nZ(v,!1,!0);f.push(j),$&&s.push(y)}}else if(rZ(O)){if(V6(v)){u+=2;let H=$8e(v,O,m,{end:F});GP(O)&&$&&s.push(H)}else if(_m(v)||HP(v)){let H=v.readable||v;u++,W6(H,O,m,{end:F})}else if(Oh(v))u++,W6(v,O,m,{end:F});else throw new YP("val",["Readable","Iterable","AsyncIterable","ReadableStream","TransformStream"],v);v=O}else if(N8e(O)){if(V6(v))u++,ZP(KP(v),O,m,{end:F});else if(HP(v)||Oh(v))u++,ZP(v,O,m,{end:F});else if(_m(v))u++,ZP(v.readable,O,m,{end:F});else throw new YP("val",["Readable","Iterable","AsyncIterable","ReadableStream","TransformStream"],v);v=O}else v=tZ.from(O)}return(i!=null&&i.aborted||o!=null&&o.aborted)&&gv.nextTick(a),v}function $8e(t,e,r,{end:n}){let i=!1;if(e.on("close",()=>{i||r(new D8e)}),t.pipe(e,{end:!1}),n){let s=function(){i=!0,e.end()};var o=s;q8e(t)?gv.nextTick(s):t.once("end",s)}else r();return K6(t,{readable:!0,writable:!1},s=>{let a=t._readableState;s&&s.code==="ERR_STREAM_PREMATURE_CLOSE"&&a&&a.ended&&!a.errored&&!a.errorEmitted?t.once("end",r).once("error",r):r(s)}),K6(e,{readable:!1,writable:!0},r)}oZ.exports={pipelineImpl:iZ,pipeline:z8e}});var XP=G((EHe,uZ)=>{"use strict";p();var{pipeline:G8e}=Z6(),Y6=Mc(),{destroyer:H8e}=kh(),{isNodeStream:J6,isReadable:sZ,isWritable:aZ,isWebStream:JP,isTransformStream:jh,isWritableStream:cZ,isReadableStream:dZ}=Ic(),{AbortError:W8e,codes:{ERR_INVALID_ARG_VALUE:fZ,ERR_MISSING_ARGS:V8e}}=fo(),K8e=Fd();uZ.exports=function(...e){if(e.length===0)throw new V8e("streams");if(e.length===1)return Y6.from(e[0]);let r=[...e];if(typeof e[0]=="function"&&(e[0]=Y6.from(e[0])),typeof e[e.length-1]=="function"){let _=e.length-1;e[_]=Y6.from(e[_])}for(let _=0;_<e.length;++_)if(!(!J6(e[_])&&!JP(e[_]))){if(_<e.length-1&&!(sZ(e[_])||dZ(e[_])||jh(e[_])))throw new fZ(`streams[${_}]`,r[_],"must be readable");if(_>0&&!(aZ(e[_])||cZ(e[_])||jh(e[_])))throw new fZ(`streams[${_}]`,r[_],"must be writable")}let n,i,o,s,a;function c(_){let v=s;s=null,v?v(_):_?a.destroy(_):!m&&!u&&a.destroy()}let d=e[0],f=G8e(e,c),u=!!(aZ(d)||cZ(d)||jh(d)),m=!!(sZ(f)||dZ(f)||jh(f));if(a=new Y6({writableObjectMode:!!(d!=null&&d.writableObjectMode),readableObjectMode:!!(f!=null&&f.writableObjectMode),writable:u,readable:m}),u){if(J6(d))a._write=function(v,A,T){d.write(v,A)?T():n=T},a._final=function(v){d.end(),i=v},d.on("drain",function(){if(n){let v=n;n=null,v()}});else if(JP(d)){let A=(jh(d)?d.writable:d).getWriter();a._write=async function(T,M,D){try{await A.ready,A.write(T).catch(()=>{}),D()}catch(O){D(O)}},a._final=async function(T){try{await A.ready,A.close().catch(()=>{}),i=T}catch(M){T(M)}}}let _=jh(f)?f.readable:f;K8e(_,()=>{if(i){let v=i;i=null,v()}})}if(m){if(J6(f))f.on("readable",function(){if(o){let _=o;o=null,_()}}),f.on("end",function(){a.push(null)}),a._read=function(){for(;;){let _=f.read();if(_===null){o=a._read;return}if(!a.push(_))return}};else if(JP(f)){let v=(jh(f)?f.readable:f).getReader();a._read=async function(){for(;;)try{let{value:A,done:T}=await v.read();if(!a.push(A))return;if(T){a.push(null);return}}catch{return}}}}return a._destroy=function(_,v){!_&&s!==null&&(_=new W8e),o=null,n=null,i=null,s===null?v(_):(s=v,J6(f)&&H8e(f,_))},a}});var vZ=G((AHe,t9)=>{"use strict";p();var mZ=globalThis.AbortController||T6().AbortController,{codes:{ERR_INVALID_ARG_VALUE:Z8e,ERR_INVALID_ARG_TYPE:bv,ERR_MISSING_ARGS:Y8e,ERR_OUT_OF_RANGE:J8e},AbortError:kc}=fo(),{validateAbortSignal:Nh,validateInteger:X8e,validateObject:qh}=fv(),Q8e=kn().Symbol("kWeak"),{finished:eEe}=Fd(),tEe=XP(),{addAbortSignalNoValidate:rEe}=uv(),{isWritable:nEe,isNodeStream:iEe}=Ic(),{ArrayPrototypePush:oEe,MathFloor:sEe,Number:aEe,NumberIsNaN:cEe,Promise:lZ,PromiseReject:hZ,PromisePrototypeThen:dEe,Symbol:yZ}=kn(),X6=yZ("kEmpty"),pZ=yZ("kEof");function fEe(t,e){if(e!=null&&qh(e,"options"),e?.signal!=null&&Nh(e.signal,"options.signal"),iEe(t)&&!nEe(t))throw new Z8e("stream",t,"must be writable");let r=tEe(this,t);return e!=null&&e.signal&&rEe(e.signal,r),r}function Q6(t,e){if(typeof t!="function")throw new bv("fn",["Function","AsyncFunction"],t);e!=null&&qh(e,"options"),e?.signal!=null&&Nh(e.signal,"options.signal");let r=1;return e?.concurrency!=null&&(r=sEe(e.concurrency)),X8e(r,"concurrency",1),async function*(){var i,o;let s=new mZ,a=this,c=[],d=s.signal,f={signal:d},u=()=>s.abort();e!=null&&(i=e.signal)!==null&&i!==void 0&&i.aborted&&u(),e==null||(o=e.signal)===null||o===void 0||o.addEventListener("abort",u);let m,_,v=!1;function A(){v=!0}async function T(){try{for await(let O of a){var M;if(v)return;if(d.aborted)throw new kc;try{O=t(O,f)}catch(U){O=hZ(U)}O!==X6&&(typeof((M=O)===null||M===void 0?void 0:M.catch)=="function"&&O.catch(A),c.push(O),m&&(m(),m=null),!v&&c.length&&c.length>=r&&await new lZ(U=>{_=U}))}c.push(pZ)}catch(O){let U=hZ(O);dEe(U,void 0,A),c.push(U)}finally{var D;v=!0,m&&(m(),m=null),e==null||(D=e.signal)===null||D===void 0||D.removeEventListener("abort",u)}}T();try{for(;;){for(;c.length>0;){let M=await c[0];if(M===pZ)return;if(d.aborted)throw new kc;M!==X6&&(yield M),c.shift(),_&&(_(),_=null)}await new lZ(M=>{m=M})}}finally{s.abort(),v=!0,_&&(_(),_=null)}}.call(this)}function uEe(t=void 0){return t!=null&&qh(t,"options"),t?.signal!=null&&Nh(t.signal,"options.signal"),async function*(){let r=0;for await(let i of this){var n;if(t!=null&&(n=t.signal)!==null&&n!==void 0&&n.aborted)throw new kc({cause:t.signal.reason});yield[r++,i]}}.call(this)}async function gZ(t,e=void 0){for await(let r of e9.call(this,t,e))return!0;return!1}async function lEe(t,e=void 0){if(typeof t!="function")throw new bv("fn",["Function","AsyncFunction"],t);return!await gZ.call(this,async(...r)=>!await t(...r),e)}async function hEe(t,e){for await(let r of e9.call(this,t,e))return r}async function pEe(t,e){if(typeof t!="function")throw new bv("fn",["Function","AsyncFunction"],t);async function r(n,i){return await t(n,i),X6}for await(let n of Q6.call(this,r,e));}function e9(t,e){if(typeof t!="function")throw new bv("fn",["Function","AsyncFunction"],t);async function r(n,i){return await t(n,i)?n:X6}return Q6.call(this,r,e)}var QP=class extends Y8e{constructor(){super("reduce"),this.message="Reduce of an empty stream requires an initial value"}};async function mEe(t,e,r){var n;if(typeof t!="function")throw new bv("reducer",["Function","AsyncFunction"],t);r!=null&&qh(r,"options"),r?.signal!=null&&Nh(r.signal,"options.signal");let i=arguments.length>1;if(r!=null&&(n=r.signal)!==null&&n!==void 0&&n.aborted){let d=new kc(void 0,{cause:r.signal.reason});throw this.once("error",()=>{}),await eEe(this.destroy(d)),d}let o=new mZ,s=o.signal;if(r!=null&&r.signal){let d={once:!0,[Q8e]:this};r.signal.addEventListener("abort",()=>o.abort(),d)}let a=!1;try{for await(let d of this){var c;if(a=!0,r!=null&&(c=r.signal)!==null&&c!==void 0&&c.aborted)throw new kc;i?e=await t(e,d,{signal:s}):(e=d,i=!0)}if(!a&&!i)throw new QP}finally{o.abort()}return e}async function yEe(t){t!=null&&qh(t,"options"),t?.signal!=null&&Nh(t.signal,"options.signal");let e=[];for await(let n of this){var r;if(t!=null&&(r=t.signal)!==null&&r!==void 0&&r.aborted)throw new kc(void 0,{cause:t.signal.reason});oEe(e,n)}return e}function gEe(t,e){let r=Q6.call(this,t,e);return async function*(){for await(let i of r)yield*i}.call(this)}function bZ(t){if(t=aEe(t),cEe(t))return 0;if(t<0)throw new J8e("number",">= 0",t);return t}function bEe(t,e=void 0){return e!=null&&qh(e,"options"),e?.signal!=null&&Nh(e.signal,"options.signal"),t=bZ(t),async function*(){var n;if(e!=null&&(n=e.signal)!==null&&n!==void 0&&n.aborted)throw new kc;for await(let o of this){var i;if(e!=null&&(i=e.signal)!==null&&i!==void 0&&i.aborted)throw new kc;t--<=0&&(yield o)}}.call(this)}function vEe(t,e=void 0){return e!=null&&qh(e,"options"),e?.signal!=null&&Nh(e.signal,"options.signal"),t=bZ(t),async function*(){var n;if(e!=null&&(n=e.signal)!==null&&n!==void 0&&n.aborted)throw new kc;for await(let o of this){var i;if(e!=null&&(i=e.signal)!==null&&i!==void 0&&i.aborted)throw new kc;if(t-- >0)yield o;else return}}.call(this)}t9.exports.streamReturningOperators={asIndexedPairs:uEe,drop:bEe,filter:e9,flatMap:gEe,map:Q6,take:vEe,compose:fEe};t9.exports.promiseReturningOperators={every:lEe,forEach:pEe,reduce:mEe,toArray:yEe,some:gZ,find:hEe}});var r9=G((PHe,wZ)=>{"use strict";p();var{ArrayPrototypePop:wEe,Promise:_Ee}=kn(),{isIterable:xEe,isNodeStream:EEe,isWebStream:SEe}=Ic(),{pipelineImpl:AEe}=Z6(),{finished:TEe}=Fd();gS();function PEe(...t){return new _Ee((e,r)=>{let n,i,o=t[t.length-1];if(o&&typeof o=="object"&&!EEe(o)&&!xEe(o)&&!SEe(o)){let s=wEe(t);n=s.signal,i=s.end}AEe(t,(s,a)=>{s?r(s):e(a)},{signal:n,end:i})})}wZ.exports={finished:TEe,pipeline:PEe}});var MZ=G((RHe,RZ)=>{p();var{Buffer:IEe}=jr(),{ObjectDefineProperty:Gd,ObjectKeys:EZ,ReflectApply:SZ}=kn(),{promisify:{custom:AZ}}=Tc(),{streamReturningOperators:_Z,promiseReturningOperators:xZ}=vZ(),{codes:{ERR_ILLEGAL_CONSTRUCTOR:TZ}}=fo(),REe=XP(),{pipeline:PZ}=Z6(),{destroyer:MEe}=kh(),IZ=Fd(),n9=r9(),i9=Ic(),gn=RZ.exports=O6().Stream;gn.isDisturbed=i9.isDisturbed;gn.isErrored=i9.isErrored;gn.isReadable=i9.isReadable;gn.Readable=lv();for(let t of EZ(_Z)){let r=function(...n){if(new.target)throw TZ();return gn.Readable.from(SZ(e,this,n))};BEe=r;let e=_Z[t];Gd(r,"name",{__proto__:null,value:e.name}),Gd(r,"length",{__proto__:null,value:e.length}),Gd(gn.Readable.prototype,t,{__proto__:null,value:r,enumerable:!1,configurable:!0,writable:!0})}var BEe;for(let t of EZ(xZ)){let r=function(...i){if(new.target)throw TZ();return SZ(e,this,i)};BEe=r;let e=xZ[t];Gd(r,"name",{__proto__:null,value:e.name}),Gd(r,"length",{__proto__:null,value:e.length}),Gd(gn.Readable.prototype,t,{__proto__:null,value:r,enumerable:!1,configurable:!0,writable:!0})}var BEe;gn.Writable=DP();gn.Duplex=Mc();gn.Transform=UP();gn.PassThrough=zP();gn.pipeline=PZ;var{addAbortSignal:kEe}=uv();gn.addAbortSignal=kEe;gn.finished=IZ;gn.destroy=MEe;gn.compose=REe;Gd(gn,"promises",{__proto__:null,configurable:!0,enumerable:!0,get(){return n9}});Gd(PZ,AZ,{__proto__:null,enumerable:!0,get(){return n9.pipeline}});Gd(IZ,AZ,{__proto__:null,enumerable:!0,get(){return n9.finished}});gn.Stream=gn;gn._isUint8Array=function(e){return e instanceof Uint8Array};gn._uint8ArrayToBuffer=function(e){return IEe.from(e.buffer,e.byteOffset,e.byteLength)}});var ex=G((kHe,bn)=>{"use strict";p();var Nn=MZ(),DEe=r9(),CEe=Nn.Readable.destroy;bn.exports=Nn.Readable;bn.exports._uint8ArrayToBuffer=Nn._uint8ArrayToBuffer;bn.exports._isUint8Array=Nn._isUint8Array;bn.exports.isDisturbed=Nn.isDisturbed;bn.exports.isErrored=Nn.isErrored;bn.exports.isReadable=Nn.isReadable;bn.exports.Readable=Nn.Readable;bn.exports.Writable=Nn.Writable;bn.exports.Duplex=Nn.Duplex;bn.exports.Transform=Nn.Transform;bn.exports.PassThrough=Nn.PassThrough;bn.exports.addAbortSignal=Nn.addAbortSignal;bn.exports.finished=Nn.finished;bn.exports.destroy=Nn.destroy;bn.exports.destroy=CEe;bn.exports.pipeline=Nn.pipeline;bn.exports.compose=Nn.compose;Object.defineProperty(Nn,"promises",{configurable:!0,enumerable:!0,get(){return DEe}});bn.exports.Stream=Nn.Stream;bn.exports.default=bn.exports});var BZ=G((a9,c9)=>{p();(function(t,e){typeof a9=="object"&&typeof c9<"u"?c9.exports=e():typeof define=="function"&&define.amd?define(e):(t=t||self,t.JSBI=e())})(a9,function(){"use strict";var t=Math.imul,e=Math.clz32;function r(j,y){(y==null||y>j.length)&&(y=j.length);for(var P=0,x=Array(y);P<y;P++)x[P]=j[P];return x}function n(j){if(Array.isArray(j))return j}function i(j){if(j===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return j}function o(j,y,P){return y=u(y),M(j,v()?Reflect.construct(y,P||[],u(j).constructor):y.apply(j,P))}function s(j,y){if(!(j instanceof y))throw new TypeError("Cannot call a class as a function")}function a(j,y,P){if(v())return Reflect.construct.apply(null,arguments);var x=[null];x.push.apply(x,y);var l=new(j.bind.apply(j,x));return P&&D(l,P.prototype),l}function c(j,y){for(var P,x=0;x<y.length;x++)P=y[x],P.enumerable=P.enumerable||!1,P.configurable=!0,"value"in P&&(P.writable=!0),Object.defineProperty(j,L(P.key),P)}function d(j,y,P){return y&&c(j.prototype,y),P&&c(j,P),Object.defineProperty(j,"prototype",{writable:!1}),j}function f(j,y){var P=typeof Symbol<"u"&&j[Symbol.iterator]||j["@@iterator"];if(!P){if(Array.isArray(j)||(P=$(j))||y&&j&&typeof j.length=="number"){P&&(j=P);var x=0,l=function(){};return{s:l,n:function(){return x>=j.length?{done:!0}:{done:!1,value:j[x++]}},e:function(E){throw E},f:l}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
19
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var b,h=!0,w=!1;return{s:function(){P=P.call(j)},n:function(){var E=P.next();return h=E.done,E},e:function(E){w=!0,b=E},f:function(){try{h||P.return==null||P.return()}finally{if(w)throw b}}}}function u(j){return u=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(y){return y.__proto__||Object.getPrototypeOf(y)},u(j)}function m(j,y){if(typeof y!="function"&&y!==null)throw new TypeError("Super expression must either be null or a function");j.prototype=Object.create(y&&y.prototype,{constructor:{value:j,writable:!0,configurable:!0}}),Object.defineProperty(j,"prototype",{writable:!1}),y&&D(j,y)}function _(j){try{return Function.toString.call(j).indexOf("[native code]")!==-1}catch{return typeof j=="function"}}function v(){try{var j=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(v=function(){return!!j})()}function A(j,y){var P=j==null?null:typeof Symbol<"u"&&j[Symbol.iterator]||j["@@iterator"];if(P!=null){var x,l,b,h,w=[],E=!0,g=!1;try{if(b=(P=P.call(j)).next,y===0){if(Object(P)!==P)return;E=!1}else for(;!(E=(x=b.call(P)).done)&&(w.push(x.value),w.length!==y);E=!0);}catch(I){g=!0,l=I}finally{try{if(!E&&P.return!=null&&(h=P.return(),Object(h)!==h))return}finally{if(g)throw l}}return w}}function T(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
20
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function M(j,y){if(y&&(typeof y=="object"||typeof y=="function"))return y;if(y!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return i(j)}function D(j,y){return D=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(P,x){return P.__proto__=x,P},D(j,y)}function O(j,y){return n(j)||A(j,y)||$(j,y)||T()}function U(j,y){if(typeof j!="object"||!j)return j;var P=j[Symbol.toPrimitive];if(P!==void 0){var x=P.call(j,y||"default");if(typeof x!="object")return x;throw new TypeError("@@toPrimitive must return a primitive value.")}return(y==="string"?String:Number)(j)}function L(j){var y=U(j,"string");return typeof y=="symbol"?y:y+""}function F(j){return F=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(y){return typeof y}:function(y){return y&&typeof Symbol=="function"&&y.constructor===Symbol&&y!==Symbol.prototype?"symbol":typeof y},F(j)}function $(j,y){if(j){if(typeof j=="string")return r(j,y);var P={}.toString.call(j).slice(8,-1);return P==="Object"&&j.constructor&&(P=j.constructor.name),P==="Map"||P==="Set"?Array.from(j):P==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(P)?r(j,y):void 0}}function H(j){var y=typeof Map=="function"?new Map:void 0;return H=function(P){function x(){return a(P,arguments,u(this).constructor)}if(P===null||!_(P))return P;if(typeof P!="function")throw new TypeError("Super expression must either be null or a function");if(y!==void 0){if(y.has(P))return y.get(P);y.set(P,x)}return x.prototype=Object.create(P.prototype,{constructor:{value:x,enumerable:!1,writable:!0,configurable:!0}}),D(x,P)},H(j)}var z=function(j){var y=Math.abs,P=Math.max,x=Math.floor;function l(b,h){var w;if(s(this,l),w=o(this,l,[b]),w.sign=h,Object.setPrototypeOf(w,l.prototype),b>l.__kMaxLength)throw new RangeError("Maximum BigInt size exceeded");return w}return m(l,j),d(l,[{key:"toDebugString",value:function(){var h,w=["BigInt["],E=f(this);try{for(E.s();!(h=E.n()).done;){var g=h.value;w.push((g&&(g>>>0).toString(16))+", ")}}catch(I){E.e(I)}finally{E.f()}return w.push("]"),w.join("")}},{key:"toString",value:function(){var h=0<arguments.length&&arguments[0]!==void 0?arguments[0]:10;if(2>h||36<h)throw new RangeError("toString() radix argument must be between 2 and 36");return this.length===0?"0":h&h-1?l.__toStringGeneric(this,h,!1):l.__toStringBasePowerOfTwo(this,h)}},{key:"valueOf",value:function(){throw new Error("Convert JSBI instances to native numbers using `toNumber`.")}},{key:"__copy",value:function(){for(var h=new l(this.length,this.sign),w=0;w<this.length;w++)h[w]=this[w];return h}},{key:"__trim",value:function(){for(var h=this.length,w=this[h-1];w===0;)h--,w=this[h-1],this.pop();return h===0&&(this.sign=!1),this}},{key:"__initializeDigits",value:function(){for(var h=0;h<this.length;h++)this[h]=0}},{key:"__clzmsd",value:function(){return l.__clz30(this.__digit(this.length-1))}},{key:"__inplaceMultiplyAdd",value:function(h,w,E){E>this.length&&(E=this.length);for(var g=32767&h,I=h>>>15,B=0,R=w,q=0;q<E;q++){var V=this.__digit(q),W=32767&V,K=V>>>15,Y=l.__imul(W,g),J=l.__imul(W,I),Z=l.__imul(K,g),ce=l.__imul(K,I),oe=R+Y+B;B=oe>>>30,oe&=1073741823,oe+=((32767&J)<<15)+((32767&Z)<<15),B+=oe>>>30,R=ce+(J>>>15)+(Z>>>15),this.__setDigit(q,1073741823&oe)}if(B!==0||R!==0)throw new Error("implementation bug")}},{key:"__inplaceAdd",value:function(h,w,E){for(var g,I=0,B=0;B<E;B++)g=this.__halfDigit(w+B)+h.__halfDigit(B)+I,I=g>>>15,this.__setHalfDigit(w+B,32767&g);return I}},{key:"__inplaceSub",value:function(h,w,E){var g=E-1>>>1,I=0;if(1&w){w>>=1;for(var B=this.__digit(w),R=32767&B,q=0;q<g;q++){var V=h.__digit(q),W=(B>>>15)-(32767&V)-I;I=1&W>>>15,this.__setDigit(w+q,(32767&W)<<15|32767&R),B=this.__digit(w+q+1),R=(32767&B)-(V>>>15)-I,I=1&R>>>15}var K=h.__digit(q),Y=(B>>>15)-(32767&K)-I;I=1&Y>>>15,this.__setDigit(w+q,(32767&Y)<<15|32767&R);var J=K>>>15;if(w+q+1>=this.length)throw new RangeError("out of bounds");!(1&E)&&(B=this.__digit(w+q+1),R=(32767&B)-J-I,I=1&R>>>15,this.__setDigit(w+h.length,1073709056&B|32767&R))}else{w>>=1;for(var Z=0;Z<h.length-1;Z++){var ce=this.__digit(w+Z),oe=h.__digit(Z),ae=(32767&ce)-(32767&oe)-I;I=1&ae>>>15;var He=(ce>>>15)-(oe>>>15)-I;I=1&He>>>15,this.__setDigit(w+Z,(32767&He)<<15|32767&ae)}var ye=this.__digit(w+Z),xe=h.__digit(Z),zr=(32767&ye)-(32767&xe)-I;I=1&zr>>>15;var ke=0;!(1&E)&&(ke=(ye>>>15)-(xe>>>15)-I,I=1&ke>>>15),this.__setDigit(w+Z,(32767&ke)<<15|32767&zr)}return I}},{key:"__inplaceRightShift",value:function(h){if(h!==0){for(var w,E=this.__digit(0)>>>h,g=this.length-1,I=0;I<g;I++)w=this.__digit(I+1),this.__setDigit(I,1073741823&w<<30-h|E),E=w>>>h;this.__setDigit(g,E)}}},{key:"__digit",value:function(h){return this[h]}},{key:"__unsignedDigit",value:function(h){return this[h]>>>0}},{key:"__setDigit",value:function(h,w){this[h]=0|w}},{key:"__setDigitGrow",value:function(h,w){this[h]=0|w}},{key:"__halfDigitLength",value:function(){var h=this.length;return 32767>=this.__unsignedDigit(h-1)?2*h-1:2*h}},{key:"__halfDigit",value:function(h){return 32767&this[h>>>1]>>>15*(1&h)}},{key:"__setHalfDigit",value:function(h,w){var E=h>>>1,g=this.__digit(E),I=1&h?32767&g|w<<15:1073709056&g|32767&w;this.__setDigit(E,I)}}],[{key:"BigInt",value:function(h){var w=Number.isFinite;if(typeof h=="number"){if(h===0)return l.__zero();if(l.__isOneDigitInt(h))return 0>h?l.__oneDigit(-h,!0):l.__oneDigit(h,!1);if(!w(h)||x(h)!==h)throw new RangeError("The number "+h+" cannot be converted to BigInt because it is not an integer");return l.__fromDouble(h)}if(typeof h=="string"){var E=l.__fromString(h);if(E===null)throw new SyntaxError("Cannot convert "+h+" to a BigInt");return E}if(typeof h=="boolean")return h===!0?l.__oneDigit(1,!1):l.__zero();if(F(h)==="object"){if(h.constructor===l)return h;var g=l.__toPrimitive(h);return l.BigInt(g)}throw new TypeError("Cannot convert "+h+" to a BigInt")}},{key:"toNumber",value:function(h){var w=h.length;if(w===0)return 0;if(w===1){var E=h.__unsignedDigit(0);return h.sign?-E:E}var g=h.__digit(w-1),I=l.__clz30(g),B=30*w-I;if(1024<B)return h.sign?-1/0:1/0;var R=B-1,q=g,V=w-1,W=I+3,K=W===32?0:q<<W;K>>>=12;var Y=W-12,J=12<=W?0:q<<20+W,Z=20+W;for(0<Y&&0<V&&(V--,q=h.__digit(V),K|=q>>>30-Y,J=q<<Y+2,Z=Y+2);0<Z&&0<V;)V--,q=h.__digit(V),J|=30<=Z?q<<Z-30:q>>>30-Z,Z-=30;var ce=l.__decideRounding(h,Z,V,q);if((ce===1||ce===0&&(1&J)==1)&&(J=J+1>>>0,J===0&&(K++,K>>>20!=0&&(K=0,R++,1023<R))))return h.sign?-1/0:1/0;var oe=h.sign?-2147483648:0;return R=R+1023<<20,l.__kBitConversionInts[l.__kBitConversionIntHigh]=oe|R|K,l.__kBitConversionInts[l.__kBitConversionIntLow]=J,l.__kBitConversionDouble[0]}},{key:"unaryMinus",value:function(h){if(h.length===0)return h;var w=h.__copy();return w.sign=!h.sign,w}},{key:"bitwiseNot",value:function(h){return h.sign?l.__absoluteSubOne(h).__trim():l.__absoluteAddOne(h,!0)}},{key:"exponentiate",value:function(h,w){if(w.sign)throw new RangeError("Exponent must be positive");if(w.length===0)return l.__oneDigit(1,!1);if(h.length===0)return h;if(h.length===1&&h.__digit(0)===1)return h.sign&&!(1&w.__digit(0))?l.unaryMinus(h):h;if(1<w.length)throw new RangeError("BigInt too big");var E=w.__unsignedDigit(0);if(E===1)return h;if(E>=l.__kMaxLengthBits)throw new RangeError("BigInt too big");if(h.length===1&&h.__digit(0)===2){var g=1+(0|E/30),I=h.sign&&(1&E)!=0,B=new l(g,I);B.__initializeDigits();var R=1<<E%30;return B.__setDigit(g-1,R),B}var q=null,V=h;for(1&E&&(q=h),E>>=1;E!==0;E>>=1)V=l.multiply(V,V),1&E&&(q===null?q=V:q=l.multiply(q,V));return q}},{key:"multiply",value:function(h,w){if(h.length===0)return h;if(w.length===0)return w;var E=h.length+w.length;30<=h.__clzmsd()+w.__clzmsd()&&E--;var g=new l(E,h.sign!==w.sign);g.__initializeDigits();for(var I=0;I<h.length;I++)l.__multiplyAccumulate(w,h.__digit(I),g,I);return g.__trim()}},{key:"divide",value:function(h,w){if(w.length===0)throw new RangeError("Division by zero");if(0>l.__absoluteCompare(h,w))return l.__zero();var E,g=h.sign!==w.sign,I=w.__unsignedDigit(0);if(w.length===1&&32767>=I){if(I===1)return g===h.sign?h:l.unaryMinus(h);E=l.__absoluteDivSmall(h,I,null)}else E=l.__absoluteDivLarge(h,w,!0,!1);return E.sign=g,E.__trim()}},{key:"remainder",value:function(h,w){if(w.length===0)throw new RangeError("Division by zero");if(0>l.__absoluteCompare(h,w))return h;var E=w.__unsignedDigit(0);if(w.length===1&&32767>=E){if(E===1)return l.__zero();var g=l.__absoluteModSmall(h,E);return g===0?l.__zero():l.__oneDigit(g,h.sign)}var I=l.__absoluteDivLarge(h,w,!1,!0);return I.sign=h.sign,I.__trim()}},{key:"add",value:function(h,w){var E=h.sign;return E===w.sign?l.__absoluteAdd(h,w,E):0<=l.__absoluteCompare(h,w)?l.__absoluteSub(h,w,E):l.__absoluteSub(w,h,!E)}},{key:"subtract",value:function(h,w){var E=h.sign;return E===w.sign?0<=l.__absoluteCompare(h,w)?l.__absoluteSub(h,w,E):l.__absoluteSub(w,h,!E):l.__absoluteAdd(h,w,E)}},{key:"leftShift",value:function(h,w){return w.length===0||h.length===0?h:w.sign?l.__rightShiftByAbsolute(h,w):l.__leftShiftByAbsolute(h,w)}},{key:"signedRightShift",value:function(h,w){return w.length===0||h.length===0?h:w.sign?l.__leftShiftByAbsolute(h,w):l.__rightShiftByAbsolute(h,w)}},{key:"unsignedRightShift",value:function(){throw new TypeError("BigInts have no unsigned right shift; use >> instead")}},{key:"lessThan",value:function(h,w){return 0>l.__compareToBigInt(h,w)}},{key:"lessThanOrEqual",value:function(h,w){return 0>=l.__compareToBigInt(h,w)}},{key:"greaterThan",value:function(h,w){return 0<l.__compareToBigInt(h,w)}},{key:"greaterThanOrEqual",value:function(h,w){return 0<=l.__compareToBigInt(h,w)}},{key:"equal",value:function(h,w){if(h.sign!==w.sign||h.length!==w.length)return!1;for(var E=0;E<h.length;E++)if(h.__digit(E)!==w.__digit(E))return!1;return!0}},{key:"notEqual",value:function(h,w){return!l.equal(h,w)}},{key:"bitwiseAnd",value:function(h,w){if(!h.sign&&!w.sign)return l.__absoluteAnd(h,w).__trim();if(h.sign&&w.sign){var E=P(h.length,w.length)+1,g=l.__absoluteSubOne(h,E),I=l.__absoluteSubOne(w);return g=l.__absoluteOr(g,I,g),l.__absoluteAddOne(g,!0,g).__trim()}if(h.sign){var B=[w,h];h=B[0],w=B[1]}return l.__absoluteAndNot(h,l.__absoluteSubOne(w)).__trim()}},{key:"bitwiseXor",value:function(h,w){if(!h.sign&&!w.sign)return l.__absoluteXor(h,w).__trim();if(h.sign&&w.sign){var E=P(h.length,w.length),g=l.__absoluteSubOne(h,E),I=l.__absoluteSubOne(w);return l.__absoluteXor(g,I,g).__trim()}var B=P(h.length,w.length)+1;if(h.sign){var R=[w,h];h=R[0],w=R[1]}var q=l.__absoluteSubOne(w,B);return q=l.__absoluteXor(q,h,q),l.__absoluteAddOne(q,!0,q).__trim()}},{key:"bitwiseOr",value:function(h,w){var E=P(h.length,w.length);if(!h.sign&&!w.sign)return l.__absoluteOr(h,w).__trim();if(h.sign&&w.sign){var g=l.__absoluteSubOne(h,E),I=l.__absoluteSubOne(w);return g=l.__absoluteAnd(g,I,g),l.__absoluteAddOne(g,!0,g).__trim()}if(h.sign){var B=[w,h];h=B[0],w=B[1]}var R=l.__absoluteSubOne(w,E);return R=l.__absoluteAndNot(R,h,R),l.__absoluteAddOne(R,!0,R).__trim()}},{key:"asIntN",value:function(h,w){if(w.length===0)return w;if(h=x(h),0>h)throw new RangeError("Invalid value: not (convertible to) a safe integer");if(h===0)return l.__zero();if(h>=l.__kMaxLengthBits)return w;var E=0|(h+29)/30;if(w.length<E)return w;var g=w.__unsignedDigit(E-1),I=1<<(h-1)%30;if(w.length===E&&g<I)return w;var B=(g&I)===I;if(!B)return l.__truncateToNBits(h,w);if(!w.sign)return l.__truncateAndSubFromPowerOfTwo(h,w,!0);if(!(g&I-1)){for(var R=E-2;0<=R;R--)if(w.__digit(R)!==0)return l.__truncateAndSubFromPowerOfTwo(h,w,!1);return w.length===E&&g===I?w:l.__truncateToNBits(h,w)}return l.__truncateAndSubFromPowerOfTwo(h,w,!1)}},{key:"asUintN",value:function(h,w){if(w.length===0)return w;if(h=x(h),0>h)throw new RangeError("Invalid value: not (convertible to) a safe integer");if(h===0)return l.__zero();if(w.sign){if(h>l.__kMaxLengthBits)throw new RangeError("BigInt too big");return l.__truncateAndSubFromPowerOfTwo(h,w,!1)}if(h>=l.__kMaxLengthBits)return w;var E=0|(h+29)/30;if(w.length<E)return w;var g=h%30;if(w.length==E){if(g===0)return w;var I=w.__digit(E-1);if(!(I>>>g))return w}return l.__truncateToNBits(h,w)}},{key:"ADD",value:function(h,w){if(h=l.__toPrimitive(h),w=l.__toPrimitive(w),typeof h=="string")return typeof w!="string"&&(w=w.toString()),h+w;if(typeof w=="string")return h.toString()+w;if(h=l.__toNumeric(h),w=l.__toNumeric(w),l.__isBigInt(h)&&l.__isBigInt(w))return l.add(h,w);if(typeof h=="number"&&typeof w=="number")return h+w;throw new TypeError("Cannot mix BigInt and other types, use explicit conversions")}},{key:"LT",value:function(h,w){return l.__compare(h,w,0)}},{key:"LE",value:function(h,w){return l.__compare(h,w,1)}},{key:"GT",value:function(h,w){return l.__compare(h,w,2)}},{key:"GE",value:function(h,w){return l.__compare(h,w,3)}},{key:"EQ",value:function(h,w){for(;;){if(l.__isBigInt(h))return l.__isBigInt(w)?l.equal(h,w):l.EQ(w,h);if(typeof h=="number"){if(l.__isBigInt(w))return l.__equalToNumber(w,h);if(F(w)!=="object")return h==w;w=l.__toPrimitive(w)}else if(typeof h=="string"){if(l.__isBigInt(w))return h=l.__fromString(h),h!==null&&l.equal(h,w);if(F(w)!=="object")return h==w;w=l.__toPrimitive(w)}else if(typeof h=="boolean"){if(l.__isBigInt(w))return l.__equalToNumber(w,+h);if(F(w)!=="object")return h==w;w=l.__toPrimitive(w)}else if(F(h)==="symbol"){if(l.__isBigInt(w))return!1;if(F(w)!=="object")return h==w;w=l.__toPrimitive(w)}else if(F(h)==="object"){if(F(w)==="object"&&w.constructor!==l)return h==w;h=l.__toPrimitive(h)}else return h==w}}},{key:"NE",value:function(h,w){return!l.EQ(h,w)}},{key:"DataViewGetBigInt64",value:function(h,w){var E=2<arguments.length&&arguments[2]!==void 0&&arguments[2];return l.asIntN(64,l.DataViewGetBigUint64(h,w,E))}},{key:"DataViewGetBigUint64",value:function(h,w){var E=2<arguments.length&&arguments[2]!==void 0&&arguments[2],g=E?[4,0]:[0,4],I=O(g,2),B=I[0],R=I[1],q=h.getUint32(w+B,E),V=h.getUint32(w+R,E),W=new l(3,!1);return W.__setDigit(0,1073741823&V),W.__setDigit(1,(268435455&q)<<2|V>>>30),W.__setDigit(2,q>>>28),W.__trim()}},{key:"DataViewSetBigInt64",value:function(h,w,E){var g=3<arguments.length&&arguments[3]!==void 0&&arguments[3];l.DataViewSetBigUint64(h,w,E,g)}},{key:"DataViewSetBigUint64",value:function(h,w,E){var g=3<arguments.length&&arguments[3]!==void 0&&arguments[3];E=l.asUintN(64,E);var I=0,B=0;if(0<E.length&&(B=E.__digit(0),1<E.length)){var R=E.__digit(1);B|=R<<30,I=R>>>2,2<E.length&&(I|=E.__digit(2)<<28)}var q=g?[4,0]:[0,4],V=O(q,2),W=V[0],K=V[1];h.setUint32(w+W,I,g),h.setUint32(w+K,B,g)}},{key:"__zero",value:function(){return new l(0,!1)}},{key:"__oneDigit",value:function(h,w){var E=new l(1,w);return E.__setDigit(0,h),E}},{key:"__decideRounding",value:function(h,w,E,g){if(0<w)return-1;var I;if(0>w)I=-w-1;else{if(E===0)return-1;E--,g=h.__digit(E),I=29}var B=1<<I;if(!(g&B))return-1;if(B-=1,(g&B)!=0)return 1;for(;0<E;)if(E--,h.__digit(E)!==0)return 1;return 0}},{key:"__fromDouble",value:function(h){var w=0>h;l.__kBitConversionDouble[0]=h;var E,g=2047&l.__kBitConversionInts[l.__kBitConversionIntHigh]>>>20,I=g-1023,B=(0|I/30)+1,R=new l(B,w),q=1048576,V=1048575&l.__kBitConversionInts[l.__kBitConversionIntHigh]|q,W=l.__kBitConversionInts[l.__kBitConversionIntLow],K=20,Y=I%30,J=0;if(Y<K){var Z=K-Y;J=Z+32,E=V>>>Z,V=V<<32-Z|W>>>Z,W<<=32-Z}else if(Y===K)J=32,E=V,V=W,W=0;else{var ce=Y-K;J=32-ce,E=V<<ce|W>>>32-ce,V=W<<ce,W=0}R.__setDigit(B-1,E);for(var oe=B-2;0<=oe;oe--)0<J?(J-=30,E=V>>>2,V=V<<30|W>>>2,W<<=30):E=0,R.__setDigit(oe,E);return R.__trim()}},{key:"__isWhitespace",value:function(h){return 13>=h&&9<=h||(159>=h?h==32:131071>=h?h==160||h==5760:196607>=h?(h&=131071,10>=h||h==40||h==41||h==47||h==95||h==4096):h==65279)}},{key:"__fromString",value:function(h){var w=1<arguments.length&&arguments[1]!==void 0?arguments[1]:0,E=0,g=h.length,I=0;if(I===g)return l.__zero();for(var B=h.charCodeAt(I);l.__isWhitespace(B);){if(++I===g)return l.__zero();B=h.charCodeAt(I)}if(B===43){if(++I===g)return null;B=h.charCodeAt(I),E=1}else if(B===45){if(++I===g)return null;B=h.charCodeAt(I),E=-1}if(w===0){if(w=10,B===48){if(++I===g)return l.__zero();if(B=h.charCodeAt(I),B===88||B===120){if(w=16,++I===g)return null;B=h.charCodeAt(I)}else if(B===79||B===111){if(w=8,++I===g)return null;B=h.charCodeAt(I)}else if(B===66||B===98){if(w=2,++I===g)return null;B=h.charCodeAt(I)}}}else if(w===16&&B===48){if(++I===g)return l.__zero();if(B=h.charCodeAt(I),B===88||B===120){if(++I===g)return null;B=h.charCodeAt(I)}}if(E!==0&&w!==10)return null;for(;B===48;){if(++I===g)return l.__zero();B=h.charCodeAt(I)}var R=g-I,q=l.__kMaxBitsPerChar[w],V=l.__kBitsPerCharTableMultiplier-1;if(R>1073741824/q)return null;var W=q*R+V>>>l.__kBitsPerCharTableShift,K=0|(W+29)/30,Y=new l(K,!1),J=10>w?w:10,Z=10<w?w-10:0;if(w&w-1){Y.__initializeDigits();var zr=!1,ke=0;do{for(var Ne,Ss=0,Ke=1;;){if(Ne=void 0,B-48>>>0<J)Ne=B-48;else if((32|B)-97>>>0<Z)Ne=(32|B)-87;else{zr=!0;break}var Ze=Ke*w;if(1073741823<Ze)break;if(Ke=Ze,Ss=Ss*w+Ne,ke++,++I===g){zr=!0;break}B=h.charCodeAt(I)}V=30*l.__kBitsPerCharTableMultiplier-1;var Qu=0|(q*ke+V>>>l.__kBitsPerCharTableShift)/30;Y.__inplaceMultiplyAdd(Ke,Ss,Qu)}while(!zr)}else{q>>=l.__kBitsPerCharTableShift;var ce=[],oe=[],ae=!1;do{for(var He,ye=0,xe=0;;){if(He=void 0,B-48>>>0<J)He=B-48;else if((32|B)-97>>>0<Z)He=(32|B)-87;else{ae=!0;break}if(xe+=q,ye=ye<<q|He,++I===g){ae=!0;break}if(B=h.charCodeAt(I),30<xe+q)break}ce.push(ye),oe.push(xe)}while(!ae);l.__fillFromParts(Y,ce,oe)}if(I!==g){if(!l.__isWhitespace(B))return null;for(I++;I<g;I++)if(B=h.charCodeAt(I),!l.__isWhitespace(B))return null}return Y.sign=E===-1,Y.__trim()}},{key:"__fillFromParts",value:function(h,w,E){for(var g=0,I=0,B=0,R=w.length-1;0<=R;R--){var q=w[R],V=E[R];I|=q<<B,B+=V,B===30?(h.__setDigit(g++,I),B=0,I=0):30<B&&(h.__setDigit(g++,1073741823&I),B-=30,I=q>>>V-B)}if(I!==0){if(g>=h.length)throw new Error("implementation bug");h.__setDigit(g++,I)}for(;g<h.length;g++)h.__setDigit(g,0)}},{key:"__toStringBasePowerOfTwo",value:function(h,w){var E=h.length,g=w-1;g=(85&g>>>1)+(85&g),g=(51&g>>>2)+(51&g),g=(15&g>>>4)+(15&g);var I=g,B=w-1,R=h.__digit(E-1),q=l.__clz30(R),V=30*E-q,W=0|(V+I-1)/I;if(h.sign&&W++,268435456<W)throw new Error("string too long");for(var K=Array(W),Y=W-1,J=0,Z=0,ce=0;ce<E-1;ce++){var oe=h.__digit(ce),ae=(J|oe<<Z)&B;K[Y--]=l.__kConversionChars[ae];var He=I-Z;for(J=oe>>>He,Z=30-He;Z>=I;)K[Y--]=l.__kConversionChars[J&B],J>>>=I,Z-=I}var ye=(J|R<<Z)&B;for(K[Y--]=l.__kConversionChars[ye],J=R>>>I-Z;J!==0;)K[Y--]=l.__kConversionChars[J&B],J>>>=I;if(h.sign&&(K[Y--]="-"),Y!==-1)throw new Error("implementation bug");return K.join("")}},{key:"__toStringGeneric",value:function(h,w,E){var g=h.length;if(g===0)return"";if(g===1){var I=h.__unsignedDigit(0).toString(w);return E===!1&&h.sign&&(I="-"+I),I}var B=30*g-l.__clz30(h.__digit(g-1)),R=l.__kMaxBitsPerChar[w],q=R-1,V=B*l.__kBitsPerCharTableMultiplier;V+=q-1,V=0|V/q;var W,K,Y=V+1>>1,J=l.exponentiate(l.__oneDigit(w,!1),l.__oneDigit(Y,!1)),Z=J.__unsignedDigit(0);if(J.length===1&&32767>=Z){W=new l(h.length,!1),W.__initializeDigits();for(var ce,oe=0,ae=2*h.length-1;0<=ae;ae--)ce=oe<<15|h.__halfDigit(ae),W.__setHalfDigit(ae,0|ce/Z),oe=0|ce%Z;K=oe.toString(w)}else{var He=l.__absoluteDivLarge(h,J,!0,!0);W=He.quotient;var ye=He.remainder.__trim();K=l.__toStringGeneric(ye,w,!0)}W.__trim();for(var xe=l.__toStringGeneric(W,w,!0);K.length<Y;)K="0"+K;return E===!1&&h.sign&&(xe="-"+xe),xe+K}},{key:"__unequalSign",value:function(h){return h?-1:1}},{key:"__absoluteGreater",value:function(h){return h?-1:1}},{key:"__absoluteLess",value:function(h){return h?1:-1}},{key:"__compareToBigInt",value:function(h,w){var E=h.sign;if(E!==w.sign)return l.__unequalSign(E);var g=l.__absoluteCompare(h,w);return 0<g?l.__absoluteGreater(E):0>g?l.__absoluteLess(E):0}},{key:"__compareToNumber",value:function(h,w){if(l.__isOneDigitInt(w)){var E=h.sign,g=0>w;if(E!==g)return l.__unequalSign(E);if(h.length===0){if(g)throw new Error("implementation bug");return w===0?0:-1}if(1<h.length)return l.__absoluteGreater(E);var I=y(w),B=h.__unsignedDigit(0);return B>I?l.__absoluteGreater(E):B<I?l.__absoluteLess(E):0}return l.__compareToDouble(h,w)}},{key:"__compareToDouble",value:function(h,w){if(w!==w)return w;if(w===1/0)return-1;if(w===-1/0)return 1;var E=h.sign,g=0>w;if(E!==g)return l.__unequalSign(E);if(w===0)throw new Error("implementation bug: should be handled elsewhere");if(h.length===0)return-1;l.__kBitConversionDouble[0]=w;var I=2047&l.__kBitConversionInts[l.__kBitConversionIntHigh]>>>20;if(I==2047)throw new Error("implementation bug: handled elsewhere");var B=I-1023;if(0>B)return l.__absoluteGreater(E);var R=h.length,q=h.__digit(R-1),V=l.__clz30(q),W=30*R-V,K=B+1;if(W<K)return l.__absoluteLess(E);if(W>K)return l.__absoluteGreater(E);var Y=1048576,J=1048576|1048575&l.__kBitConversionInts[l.__kBitConversionIntHigh],Z=l.__kBitConversionInts[l.__kBitConversionIntLow],ce=20,oe=29-V;if(oe!==(0|(W-1)%30))throw new Error("implementation bug");var ae,He=0;if(oe<ce){var ye=ce-oe;He=ye+32,ae=J>>>ye,J=J<<32-ye|Z>>>ye,Z<<=32-ye}else if(oe===ce)He=32,ae=J,J=Z,Z=0;else{var xe=oe-ce;He=32-xe,ae=J<<xe|Z>>>32-xe,J=Z<<xe,Z=0}if(q>>>=0,ae>>>=0,q>ae)return l.__absoluteGreater(E);if(q<ae)return l.__absoluteLess(E);for(var zr=R-2;0<=zr;zr--){0<He?(He-=30,ae=J>>>2,J=J<<30|Z>>>2,Z<<=30):ae=0;var ke=h.__unsignedDigit(zr);if(ke>ae)return l.__absoluteGreater(E);if(ke<ae)return l.__absoluteLess(E)}if(J!==0||Z!==0){if(He===0)throw new Error("implementation bug");return l.__absoluteLess(E)}return 0}},{key:"__equalToNumber",value:function(h,w){return l.__isOneDigitInt(w)?w===0?h.length===0:h.length===1&&h.sign===0>w&&h.__unsignedDigit(0)===y(w):l.__compareToDouble(h,w)===0}},{key:"__comparisonResultToBool",value:function(h,w){return w===0?0>h:w===1?0>=h:w===2?0<h:w===3?0<=h:void 0}},{key:"__compare",value:function(h,w,E){if(h=l.__toPrimitive(h),w=l.__toPrimitive(w),typeof h=="string"&&typeof w=="string")switch(E){case 0:return h<w;case 1:return h<=w;case 2:return h>w;case 3:return h>=w}if(l.__isBigInt(h)&&typeof w=="string")return w=l.__fromString(w),w!==null&&l.__comparisonResultToBool(l.__compareToBigInt(h,w),E);if(typeof h=="string"&&l.__isBigInt(w))return h=l.__fromString(h),h!==null&&l.__comparisonResultToBool(l.__compareToBigInt(h,w),E);if(h=l.__toNumeric(h),w=l.__toNumeric(w),l.__isBigInt(h)){if(l.__isBigInt(w))return l.__comparisonResultToBool(l.__compareToBigInt(h,w),E);if(typeof w!="number")throw new Error("implementation bug");return l.__comparisonResultToBool(l.__compareToNumber(h,w),E)}if(typeof h!="number")throw new Error("implementation bug");if(l.__isBigInt(w))return l.__comparisonResultToBool(l.__compareToNumber(w,h),2^E);if(typeof w!="number")throw new Error("implementation bug");return E===0?h<w:E===1?h<=w:E===2?h>w:E===3?h>=w:void 0}},{key:"__absoluteAdd",value:function(h,w,E){if(h.length<w.length)return l.__absoluteAdd(w,h,E);if(h.length===0)return h;if(w.length===0)return h.sign===E?h:l.unaryMinus(h);var g=h.length;(h.__clzmsd()===0||w.length===h.length&&w.__clzmsd()===0)&&g++;for(var I,B=new l(g,E),R=0,q=0;q<w.length;q++)I=h.__digit(q)+w.__digit(q)+R,R=I>>>30,B.__setDigit(q,1073741823&I);for(;q<h.length;q++){var V=h.__digit(q)+R;R=V>>>30,B.__setDigit(q,1073741823&V)}return q<B.length&&B.__setDigit(q,R),B.__trim()}},{key:"__absoluteSub",value:function(h,w,E){if(h.length===0)return h;if(w.length===0)return h.sign===E?h:l.unaryMinus(h);for(var g,I=new l(h.length,E),B=0,R=0;R<w.length;R++)g=h.__digit(R)-w.__digit(R)-B,B=1&g>>>30,I.__setDigit(R,1073741823&g);for(;R<h.length;R++){var q=h.__digit(R)-B;B=1&q>>>30,I.__setDigit(R,1073741823&q)}return I.__trim()}},{key:"__absoluteAddOne",value:function(h,w){var E=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null,g=h.length;E===null?E=new l(g,w):E.sign=w;for(var I,B=1,R=0;R<g;R++)I=h.__digit(R)+B,B=I>>>30,E.__setDigit(R,1073741823&I);return B!==0&&E.__setDigitGrow(g,1),E}},{key:"__absoluteSubOne",value:function(h,w){var E=h.length;w=w||E;for(var g,I=new l(w,!1),B=1,R=0;R<E;R++)g=h.__digit(R)-B,B=1&g>>>30,I.__setDigit(R,1073741823&g);if(B!==0)throw new Error("implementation bug");for(var q=E;q<w;q++)I.__setDigit(q,0);return I}},{key:"__absoluteAnd",value:function(h,w){var E=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null,g=h.length,I=w.length,B=I;if(g<I){B=g;var R=h,q=g;h=w,g=I,w=R,I=q}var V=B;E===null?E=new l(V,!1):V=E.length;for(var W=0;W<B;W++)E.__setDigit(W,h.__digit(W)&w.__digit(W));for(;W<V;W++)E.__setDigit(W,0);return E}},{key:"__absoluteAndNot",value:function(h,w){var E=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null,g=h.length,I=w.length,B=I;g<I&&(B=g);var R=g;E===null?E=new l(R,!1):R=E.length;for(var q=0;q<B;q++)E.__setDigit(q,h.__digit(q)&~w.__digit(q));for(;q<g;q++)E.__setDigit(q,h.__digit(q));for(;q<R;q++)E.__setDigit(q,0);return E}},{key:"__absoluteOr",value:function(h,w){var E=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null,g=h.length,I=w.length,B=I;if(g<I){B=g;var R=h,q=g;h=w,g=I,w=R,I=q}var V=g;E===null?E=new l(V,!1):V=E.length;for(var W=0;W<B;W++)E.__setDigit(W,h.__digit(W)|w.__digit(W));for(;W<g;W++)E.__setDigit(W,h.__digit(W));for(;W<V;W++)E.__setDigit(W,0);return E}},{key:"__absoluteXor",value:function(h,w){var E=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null,g=h.length,I=w.length,B=I;if(g<I){B=g;var R=h,q=g;h=w,g=I,w=R,I=q}var V=g;E===null?E=new l(V,!1):V=E.length;for(var W=0;W<B;W++)E.__setDigit(W,h.__digit(W)^w.__digit(W));for(;W<g;W++)E.__setDigit(W,h.__digit(W));for(;W<V;W++)E.__setDigit(W,0);return E}},{key:"__absoluteCompare",value:function(h,w){var E=h.length-w.length;if(E!=0)return E;for(var g=h.length-1;0<=g&&h.__digit(g)===w.__digit(g);)g--;return 0>g?0:h.__unsignedDigit(g)>w.__unsignedDigit(g)?1:-1}},{key:"__multiplyAccumulate",value:function(h,w,E,g){if(w!==0){for(var I=32767&w,B=w>>>15,R=0,q=0,V=0;V<h.length;V++,g++){var W=E.__digit(g),K=h.__digit(V),Y=32767&K,J=K>>>15,Z=l.__imul(Y,I),ce=l.__imul(Y,B),oe=l.__imul(J,I),ae=l.__imul(J,B);W+=q+Z+R,R=W>>>30,W&=1073741823,W+=((32767&ce)<<15)+((32767&oe)<<15),R+=W>>>30,q=ae+(ce>>>15)+(oe>>>15),E.__setDigit(g,1073741823&W)}for(;R!==0||q!==0;g++){var He=E.__digit(g);He+=R+q,q=0,R=He>>>30,E.__setDigit(g,1073741823&He)}}}},{key:"__internalMultiplyAdd",value:function(h,w,E,g,I){for(var B=E,R=0,q=0;q<g;q++){var V=h.__digit(q),W=l.__imul(32767&V,w),K=l.__imul(V>>>15,w),Y=W+((32767&K)<<15)+R+B;B=Y>>>30,R=K>>>15,I.__setDigit(q,1073741823&Y)}if(I.length>g)for(I.__setDigit(g++,B+R);g<I.length;)I.__setDigit(g++,0);else if(B+R!==0)throw new Error("implementation bug")}},{key:"__absoluteDivSmall",value:function(h,w){var E=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;E===null&&(E=new l(h.length,!1));for(var g=0,I=2*h.length-1;0<=I;I-=2){var B=(g<<15|h.__halfDigit(I))>>>0,R=0|B/w;g=0|B%w,B=(g<<15|h.__halfDigit(I-1))>>>0;var q=0|B/w;g=0|B%w,E.__setDigit(I>>>1,R<<15|q)}return E}},{key:"__absoluteModSmall",value:function(h,w){for(var E,g=0,I=2*h.length-1;0<=I;I--)E=(g<<15|h.__halfDigit(I))>>>0,g=0|E%w;return g}},{key:"__absoluteDivLarge",value:function(h,w,E,g){var I=w.__halfDigitLength(),B=w.length,R=h.__halfDigitLength()-I,q=null;E&&(q=new l(R+2>>>1,!1),q.__initializeDigits());var V=new l(I+2>>>1,!1);V.__initializeDigits();var W=l.__clz15(w.__halfDigit(I-1));0<W&&(w=l.__specialLeftShift(w,W,0));for(var K=l.__specialLeftShift(h,W,1),Y=w.__halfDigit(I-1),J=0,Z=R;0<=Z;Z--){var ce=32767,oe=K.__halfDigit(Z+I);if(oe!==Y){var ae=(oe<<15|K.__halfDigit(Z+I-1))>>>0;ce=0|ae/Y;for(var He=0|ae%Y,ye=w.__halfDigit(I-2),xe=K.__halfDigit(Z+I-2);l.__imul(ce,ye)>>>0>(He<<16|xe)>>>0&&(ce--,He+=Y,!(32767<He)););}l.__internalMultiplyAdd(w,ce,0,B,V);var zr=K.__inplaceSub(V,Z,I+1);zr!==0&&(zr=K.__inplaceAdd(w,Z,I),K.__setHalfDigit(Z+I,32767&K.__halfDigit(Z+I)+zr),ce--),E&&(1&Z?J=ce<<15:q.__setDigit(Z>>>1,J|ce))}if(g)return K.__inplaceRightShift(W),E?{quotient:q,remainder:K}:K;if(E)return q;throw new Error("unreachable")}},{key:"__clz15",value:function(h){return l.__clz30(h)-15}},{key:"__specialLeftShift",value:function(h,w,E){var g=h.length,I=g+E,B=new l(I,!1);if(w===0){for(var R=0;R<g;R++)B.__setDigit(R,h.__digit(R));return 0<E&&B.__setDigit(g,0),B}for(var q,V=0,W=0;W<g;W++)q=h.__digit(W),B.__setDigit(W,1073741823&q<<w|V),V=q>>>30-w;return 0<E&&B.__setDigit(g,V),B}},{key:"__leftShiftByAbsolute",value:function(h,w){var E=l.__toShiftAmount(w);if(0>E)throw new RangeError("BigInt too big");var g=0|E/30,I=E%30,B=h.length,R=I!==0&&h.__digit(B-1)>>>30-I!=0,q=B+g+(R?1:0),V=new l(q,h.sign);if(I===0){for(var W=0;W<g;W++)V.__setDigit(W,0);for(;W<q;W++)V.__setDigit(W,h.__digit(W-g))}else{for(var K=0,Y=0;Y<g;Y++)V.__setDigit(Y,0);for(var J,Z=0;Z<B;Z++)J=h.__digit(Z),V.__setDigit(Z+g,1073741823&J<<I|K),K=J>>>30-I;if(R)V.__setDigit(B+g,K);else if(K!==0)throw new Error("implementation bug")}return V.__trim()}},{key:"__rightShiftByAbsolute",value:function(h,w){var E=h.length,g=h.sign,I=l.__toShiftAmount(w);if(0>I)return l.__rightShiftByMaximum(g);var B=0|I/30,R=I%30,q=E-B;if(0>=q)return l.__rightShiftByMaximum(g);var V=!1;if(g){var W=(1<<R)-1;if(h.__digit(B)&W)V=!0;else for(var K=0;K<B;K++)if(h.__digit(K)!==0){V=!0;break}}if(V&&R===0){var Y=h.__digit(E-1),J=~Y==0;J&&q++}var Z=new l(q,g);if(R===0){Z.__setDigit(q-1,0);for(var ce=B;ce<E;ce++)Z.__setDigit(ce-B,h.__digit(ce))}else{for(var oe,ae=h.__digit(B)>>>R,He=E-B-1,ye=0;ye<He;ye++)oe=h.__digit(ye+B+1),Z.__setDigit(ye,1073741823&oe<<30-R|ae),ae=oe>>>R;Z.__setDigit(He,ae)}return V&&(Z=l.__absoluteAddOne(Z,!0,Z)),Z.__trim()}},{key:"__rightShiftByMaximum",value:function(h){return h?l.__oneDigit(1,!0):l.__zero()}},{key:"__toShiftAmount",value:function(h){if(1<h.length)return-1;var w=h.__unsignedDigit(0);return w>l.__kMaxLengthBits?-1:w}},{key:"__toPrimitive",value:function(h){var w=1<arguments.length&&arguments[1]!==void 0?arguments[1]:"default";if(F(h)!=="object"||h.constructor===l)return h;if(typeof Symbol<"u"&&F(Symbol.toPrimitive)==="symbol"&&h[Symbol.toPrimitive]){var E=h[Symbol.toPrimitive](w);if(F(E)!=="object")return E;throw new TypeError("Cannot convert object to primitive value")}var g=h.valueOf;if(g){var I=g.call(h);if(F(I)!=="object")return I}var B=h.toString;if(B){var R=B.call(h);if(F(R)!=="object")return R}throw new TypeError("Cannot convert object to primitive value")}},{key:"__toNumeric",value:function(h){return l.__isBigInt(h)?h:+h}},{key:"__isBigInt",value:function(h){return F(h)==="object"&&h!==null&&h.constructor===l}},{key:"__truncateToNBits",value:function(h,w){for(var E=0|(h+29)/30,g=new l(E,w.sign),I=E-1,B=0;B<I;B++)g.__setDigit(B,w.__digit(B));var R=w.__digit(I);if(h%30!=0){var q=32-h%30;R=R<<q>>>q}return g.__setDigit(I,R),g.__trim()}},{key:"__truncateAndSubFromPowerOfTwo",value:function(h,w,E){for(var g=Math.min,I,B=0|(h+29)/30,R=new l(B,E),q=0,V=B-1,W=0,K=g(V,w.length);q<K;q++)I=0-w.__digit(q)-W,W=1&I>>>30,R.__setDigit(q,1073741823&I);for(;q<V;q++)R.__setDigit(q,0|1073741823&-W);var Y,J=V<w.length?w.__digit(V):0,Z=h%30;if(Z===0)Y=0-J-W,Y&=1073741823;else{var ce=32-Z;J=J<<ce>>>ce;var oe=1<<32-ce;Y=oe-J-W,Y&=oe-1}return R.__setDigit(V,Y),R.__trim()}},{key:"__digitPow",value:function(h,w){for(var E=1;0<w;)1&w&&(E*=h),w>>>=1,h*=h;return E}},{key:"__detectBigEndian",value:function(){return l.__kBitConversionDouble[0]=-0,l.__kBitConversionInts[0]!==0}},{key:"__isOneDigitInt",value:function(h){return(1073741823&h)===h}}])}(H(Array));return z.__kMaxLength=33554432,z.__kMaxLengthBits=z.__kMaxLength<<5,z.__kMaxBitsPerChar=[0,0,32,51,64,75,83,90,96,102,107,111,115,119,122,126,128,131,134,136,139,141,143,145,147,149,151,153,154,156,158,159,160,162,163,165,166],z.__kBitsPerCharTableShift=5,z.__kBitsPerCharTableMultiplier=1<<z.__kBitsPerCharTableShift,z.__kConversionChars=["0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"],z.__kBitConversionBuffer=new ArrayBuffer(8),z.__kBitConversionDouble=new Float64Array(z.__kBitConversionBuffer),z.__kBitConversionInts=new Int32Array(z.__kBitConversionBuffer),z.__kBitConversionIntHigh=z.__detectBigEndian()?0:1,z.__kBitConversionIntLow=z.__detectBigEndian()?1:0,z.__clz30=e?function(j){return e(j)-2}:function(j){var y=Math.LN2,P=Math.log;return j===0?30:0|29-(0|P(j>>>0)/y)},z.__imul=t||function(j,y){return 0|j*y},z})});var xJ=G((_We,_J)=>{p();_J.exports=g7;var wJ=128,x4e=127,E4e=~x4e,S4e=Math.pow(2,31);function g7(t,e,r){if(Number.MAX_SAFE_INTEGER&&t>Number.MAX_SAFE_INTEGER)throw g7.bytes=0,new RangeError("Could not encode varint");e=e||[],r=r||0;for(var n=r;t>=S4e;)e[r++]=t&255|wJ,t/=128;for(;t&E4e;)e[r++]=t&255|wJ,t>>>=7;return e[r]=t|0,g7.bytes=r-n+1,e}});var AJ=G((EWe,SJ)=>{p();SJ.exports=b7;var A4e=128,EJ=127;function b7(t,n){var r=0,n=n||0,i=0,o=n,s,a=t.length;do{if(o>=a||i>49)throw b7.bytes=0,new RangeError("Could not decode varint");s=t[o++],r+=i<28?(s&EJ)<<i:(s&EJ)*Math.pow(2,i),i+=7}while(s>=A4e);return b7.bytes=o-n,r}});var PJ=G((AWe,TJ)=>{p();var T4e=Math.pow(2,7),P4e=Math.pow(2,14),I4e=Math.pow(2,21),R4e=Math.pow(2,28),M4e=Math.pow(2,35),k4e=Math.pow(2,42),B4e=Math.pow(2,49),D4e=Math.pow(2,56),C4e=Math.pow(2,63);TJ.exports=function(t){return t<T4e?1:t<P4e?2:t<I4e?3:t<R4e?4:t<M4e?5:t<k4e?6:t<B4e?7:t<D4e?8:t<C4e?9:10}});var RJ=G((PWe,IJ)=>{p();IJ.exports={encode:xJ(),decode:AJ(),encodingLength:PJ()}});var kJ=G((Pu,MJ)=>{p();var Lx=typeof globalThis<"u"&&globalThis||typeof self<"u"&&self||typeof globalThis<"u"&&globalThis,Ux=function(){function t(){this.fetch=!1,this.DOMException=Lx.DOMException}return t.prototype=Lx,new t}();(function(t){var e=function(r){var n=typeof t<"u"&&t||typeof self<"u"&&self||typeof n<"u"&&n,i={searchParams:"URLSearchParams"in n,iterable:"Symbol"in n&&"iterator"in Symbol,blob:"FileReader"in n&&"Blob"in n&&function(){try{return new Blob,!0}catch{return!1}}(),formData:"FormData"in n,arrayBuffer:"ArrayBuffer"in n};function o(y){return y&&DataView.prototype.isPrototypeOf(y)}if(i.arrayBuffer)var s=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],a=ArrayBuffer.isView||function(y){return y&&s.indexOf(Object.prototype.toString.call(y))>-1};function c(y){if(typeof y!="string"&&(y=String(y)),/[^a-z0-9\-#$%&'*+.^_`|~!]/i.test(y)||y==="")throw new TypeError('Invalid character in header field name: "'+y+'"');return y.toLowerCase()}function d(y){return typeof y!="string"&&(y=String(y)),y}function f(y){var P={next:function(){var x=y.shift();return{done:x===void 0,value:x}}};return i.iterable&&(P[Symbol.iterator]=function(){return P}),P}function u(y){this.map={},y instanceof u?y.forEach(function(P,x){this.append(x,P)},this):Array.isArray(y)?y.forEach(function(P){this.append(P[0],P[1])},this):y&&Object.getOwnPropertyNames(y).forEach(function(P){this.append(P,y[P])},this)}u.prototype.append=function(y,P){y=c(y),P=d(P);var x=this.map[y];this.map[y]=x?x+", "+P:P},u.prototype.delete=function(y){delete this.map[c(y)]},u.prototype.get=function(y){return y=c(y),this.has(y)?this.map[y]:null},u.prototype.has=function(y){return this.map.hasOwnProperty(c(y))},u.prototype.set=function(y,P){this.map[c(y)]=d(P)},u.prototype.forEach=function(y,P){for(var x in this.map)this.map.hasOwnProperty(x)&&y.call(P,this.map[x],x,this)},u.prototype.keys=function(){var y=[];return this.forEach(function(P,x){y.push(x)}),f(y)},u.prototype.values=function(){var y=[];return this.forEach(function(P){y.push(P)}),f(y)},u.prototype.entries=function(){var y=[];return this.forEach(function(P,x){y.push([x,P])}),f(y)},i.iterable&&(u.prototype[Symbol.iterator]=u.prototype.entries);function m(y){if(y.bodyUsed)return Promise.reject(new TypeError("Already read"));y.bodyUsed=!0}function _(y){return new Promise(function(P,x){y.onload=function(){P(y.result)},y.onerror=function(){x(y.error)}})}function v(y){var P=new FileReader,x=_(P);return P.readAsArrayBuffer(y),x}function A(y){var P=new FileReader,x=_(P);return P.readAsText(y),x}function T(y){for(var P=new Uint8Array(y),x=new Array(P.length),l=0;l<P.length;l++)x[l]=String.fromCharCode(P[l]);return x.join("")}function M(y){if(y.slice)return y.slice(0);var P=new Uint8Array(y.byteLength);return P.set(new Uint8Array(y)),P.buffer}function D(){return this.bodyUsed=!1,this._initBody=function(y){this.bodyUsed=this.bodyUsed,this._bodyInit=y,y?typeof y=="string"?this._bodyText=y:i.blob&&Blob.prototype.isPrototypeOf(y)?this._bodyBlob=y:i.formData&&FormData.prototype.isPrototypeOf(y)?this._bodyFormData=y:i.searchParams&&URLSearchParams.prototype.isPrototypeOf(y)?this._bodyText=y.toString():i.arrayBuffer&&i.blob&&o(y)?(this._bodyArrayBuffer=M(y.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):i.arrayBuffer&&(ArrayBuffer.prototype.isPrototypeOf(y)||a(y))?this._bodyArrayBuffer=M(y):this._bodyText=y=Object.prototype.toString.call(y):this._bodyText="",this.headers.get("content-type")||(typeof y=="string"?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):i.searchParams&&URLSearchParams.prototype.isPrototypeOf(y)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},i.blob&&(this.blob=function(){var y=m(this);if(y)return y;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){if(this._bodyArrayBuffer){var y=m(this);return y||(ArrayBuffer.isView(this._bodyArrayBuffer)?Promise.resolve(this._bodyArrayBuffer.buffer.slice(this._bodyArrayBuffer.byteOffset,this._bodyArrayBuffer.byteOffset+this._bodyArrayBuffer.byteLength)):Promise.resolve(this._bodyArrayBuffer))}else return this.blob().then(v)}),this.text=function(){var y=m(this);if(y)return y;if(this._bodyBlob)return A(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(T(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},i.formData&&(this.formData=function(){return this.text().then(F)}),this.json=function(){return this.text().then(JSON.parse)},this}var O=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];function U(y){var P=y.toUpperCase();return O.indexOf(P)>-1?P:y}function L(y,P){if(!(this instanceof L))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');P=P||{};var x=P.body;if(y instanceof L){if(y.bodyUsed)throw new TypeError("Already read");this.url=y.url,this.credentials=y.credentials,P.headers||(this.headers=new u(y.headers)),this.method=y.method,this.mode=y.mode,this.signal=y.signal,!x&&y._bodyInit!=null&&(x=y._bodyInit,y.bodyUsed=!0)}else this.url=String(y);if(this.credentials=P.credentials||this.credentials||"same-origin",(P.headers||!this.headers)&&(this.headers=new u(P.headers)),this.method=U(P.method||this.method||"GET"),this.mode=P.mode||this.mode||null,this.signal=P.signal||this.signal,this.referrer=null,(this.method==="GET"||this.method==="HEAD")&&x)throw new TypeError("Body not allowed for GET or HEAD requests");if(this._initBody(x),(this.method==="GET"||this.method==="HEAD")&&(P.cache==="no-store"||P.cache==="no-cache")){var l=/([?&])_=[^&]*/;if(l.test(this.url))this.url=this.url.replace(l,"$1_="+new Date().getTime());else{var b=/\?/;this.url+=(b.test(this.url)?"&":"?")+"_="+new Date().getTime()}}}L.prototype.clone=function(){return new L(this,{body:this._bodyInit})};function F(y){var P=new FormData;return y.trim().split("&").forEach(function(x){if(x){var l=x.split("="),b=l.shift().replace(/\+/g," "),h=l.join("=").replace(/\+/g," ");P.append(decodeURIComponent(b),decodeURIComponent(h))}}),P}function $(y){var P=new u,x=y.replace(/\r?\n[\t ]+/g," ");return x.split("\r").map(function(l){return l.indexOf(`
21
+ `)===0?l.substr(1,l.length):l}).forEach(function(l){var b=l.split(":"),h=b.shift().trim();if(h){var w=b.join(":").trim();P.append(h,w)}}),P}D.call(L.prototype);function H(y,P){if(!(this instanceof H))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');P||(P={}),this.type="default",this.status=P.status===void 0?200:P.status,this.ok=this.status>=200&&this.status<300,this.statusText=P.statusText===void 0?"":""+P.statusText,this.headers=new u(P.headers),this.url=P.url||"",this._initBody(y)}D.call(H.prototype),H.prototype.clone=function(){return new H(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new u(this.headers),url:this.url})},H.error=function(){var y=new H(null,{status:0,statusText:""});return y.type="error",y};var z=[301,302,303,307,308];H.redirect=function(y,P){if(z.indexOf(P)===-1)throw new RangeError("Invalid status code");return new H(null,{status:P,headers:{location:y}})},r.DOMException=n.DOMException;try{new r.DOMException}catch{r.DOMException=function(P,x){this.message=P,this.name=x;var l=Error(P);this.stack=l.stack},r.DOMException.prototype=Object.create(Error.prototype),r.DOMException.prototype.constructor=r.DOMException}function j(y,P){return new Promise(function(x,l){var b=new L(y,P);if(b.signal&&b.signal.aborted)return l(new r.DOMException("Aborted","AbortError"));var h=new XMLHttpRequest;function w(){h.abort()}h.onload=function(){var g={status:h.status,statusText:h.statusText,headers:$(h.getAllResponseHeaders()||"")};g.url="responseURL"in h?h.responseURL:g.headers.get("X-Request-URL");var I="response"in h?h.response:h.responseText;setTimeout(function(){x(new H(I,g))},0)},h.onerror=function(){setTimeout(function(){l(new TypeError("Network request failed"))},0)},h.ontimeout=function(){setTimeout(function(){l(new TypeError("Network request failed"))},0)},h.onabort=function(){setTimeout(function(){l(new r.DOMException("Aborted","AbortError"))},0)};function E(g){try{return g===""&&n.location.href?n.location.href:g}catch{return g}}h.open(b.method,E(b.url),!0),b.credentials==="include"?h.withCredentials=!0:b.credentials==="omit"&&(h.withCredentials=!1),"responseType"in h&&(i.blob?h.responseType="blob":i.arrayBuffer&&b.headers.get("Content-Type")&&b.headers.get("Content-Type").indexOf("application/octet-stream")!==-1&&(h.responseType="arraybuffer")),P&&typeof P.headers=="object"&&!(P.headers instanceof u)?Object.getOwnPropertyNames(P.headers).forEach(function(g){h.setRequestHeader(g,d(P.headers[g]))}):b.headers.forEach(function(g,I){h.setRequestHeader(I,g)}),b.signal&&(b.signal.addEventListener("abort",w),h.onreadystatechange=function(){h.readyState===4&&b.signal.removeEventListener("abort",w)}),h.send(typeof b._bodyInit>"u"?null:b._bodyInit)})}return j.polyfill=!0,n.fetch||(n.fetch=j,n.Headers=u,n.Request=L,n.Response=H),r.Headers=u,r.Request=L,r.Response=H,r.fetch=j,r}({})})(Ux);Ux.fetch.ponyfill=!0;delete Ux.fetch.polyfill;var Zm=Lx.fetch?Lx:Ux;Pu=Zm.fetch;Pu.default=Zm.fetch;Pu.fetch=Zm.fetch;Pu.Headers=Zm.Headers;Pu.Request=Zm.Request;Pu.Response=Zm.Response;MJ.exports=Pu});var DJ=G(w7=>{"use strict";p();w7.toString=function(t){switch(t){case 1:return"A";case 10:return"NULL";case 28:return"AAAA";case 18:return"AFSDB";case 42:return"APL";case 257:return"CAA";case 60:return"CDNSKEY";case 59:return"CDS";case 37:return"CERT";case 5:return"CNAME";case 49:return"DHCID";case 32769:return"DLV";case 39:return"DNAME";case 48:return"DNSKEY";case 43:return"DS";case 55:return"HIP";case 13:return"HINFO";case 45:return"IPSECKEY";case 25:return"KEY";case 36:return"KX";case 29:return"LOC";case 15:return"MX";case 35:return"NAPTR";case 2:return"NS";case 47:return"NSEC";case 50:return"NSEC3";case 51:return"NSEC3PARAM";case 12:return"PTR";case 46:return"RRSIG";case 17:return"RP";case 24:return"SIG";case 6:return"SOA";case 99:return"SPF";case 33:return"SRV";case 44:return"SSHFP";case 32768:return"TA";case 249:return"TKEY";case 52:return"TLSA";case 250:return"TSIG";case 16:return"TXT";case 252:return"AXFR";case 251:return"IXFR";case 41:return"OPT";case 255:return"ANY"}return"UNKNOWN_"+t};w7.toType=function(t){switch(t.toUpperCase()){case"A":return 1;case"NULL":return 10;case"AAAA":return 28;case"AFSDB":return 18;case"APL":return 42;case"CAA":return 257;case"CDNSKEY":return 60;case"CDS":return 59;case"CERT":return 37;case"CNAME":return 5;case"DHCID":return 49;case"DLV":return 32769;case"DNAME":return 39;case"DNSKEY":return 48;case"DS":return 43;case"HIP":return 55;case"HINFO":return 13;case"IPSECKEY":return 45;case"KEY":return 25;case"KX":return 36;case"LOC":return 29;case"MX":return 15;case"NAPTR":return 35;case"NS":return 2;case"NSEC":return 47;case"NSEC3":return 50;case"NSEC3PARAM":return 51;case"PTR":return 12;case"RRSIG":return 46;case"RP":return 17;case"SIG":return 24;case"SOA":return 6;case"SPF":return 99;case"SRV":return 33;case"SSHFP":return 44;case"TA":return 32768;case"TKEY":return 249;case"TLSA":return 52;case"TSIG":return 250;case"TXT":return 16;case"AXFR":return 252;case"IXFR":return 251;case"OPT":return 41;case"ANY":return 255;case"*":return 255}return t.toUpperCase().startsWith("UNKNOWN_")?parseInt(t.slice(8)):0}});var CJ=G(_7=>{"use strict";p();_7.toString=function(t){switch(t){case 0:return"NOERROR";case 1:return"FORMERR";case 2:return"SERVFAIL";case 3:return"NXDOMAIN";case 4:return"NOTIMP";case 5:return"REFUSED";case 6:return"YXDOMAIN";case 7:return"YXRRSET";case 8:return"NXRRSET";case 9:return"NOTAUTH";case 10:return"NOTZONE";case 11:return"RCODE_11";case 12:return"RCODE_12";case 13:return"RCODE_13";case 14:return"RCODE_14";case 15:return"RCODE_15"}return"RCODE_"+t};_7.toRcode=function(t){switch(t.toUpperCase()){case"NOERROR":return 0;case"FORMERR":return 1;case"SERVFAIL":return 2;case"NXDOMAIN":return 3;case"NOTIMP":return 4;case"REFUSED":return 5;case"YXDOMAIN":return 6;case"YXRRSET":return 7;case"NXRRSET":return 8;case"NOTAUTH":return 9;case"NOTZONE":return 10;case"RCODE_11":return 11;case"RCODE_12":return 12;case"RCODE_13":return 13;case"RCODE_14":return 14;case"RCODE_15":return 15}return 0}});var OJ=G(x7=>{"use strict";p();x7.toString=function(t){switch(t){case 0:return"QUERY";case 1:return"IQUERY";case 2:return"STATUS";case 3:return"OPCODE_3";case 4:return"NOTIFY";case 5:return"UPDATE";case 6:return"OPCODE_6";case 7:return"OPCODE_7";case 8:return"OPCODE_8";case 9:return"OPCODE_9";case 10:return"OPCODE_10";case 11:return"OPCODE_11";case 12:return"OPCODE_12";case 13:return"OPCODE_13";case 14:return"OPCODE_14";case 15:return"OPCODE_15"}return"OPCODE_"+t};x7.toOpcode=function(t){switch(t.toUpperCase()){case"QUERY":return 0;case"IQUERY":return 1;case"STATUS":return 2;case"OPCODE_3":return 3;case"NOTIFY":return 4;case"UPDATE":return 5;case"OPCODE_6":return 6;case"OPCODE_7":return 7;case"OPCODE_8":return 8;case"OPCODE_9":return 9;case"OPCODE_10":return 10;case"OPCODE_11":return 11;case"OPCODE_12":return 12;case"OPCODE_13":return 13;case"OPCODE_14":return 14;case"OPCODE_15":return 15}return 0}});var jJ=G(E7=>{"use strict";p();E7.toString=function(t){switch(t){case 1:return"IN";case 2:return"CS";case 3:return"CH";case 4:return"HS";case 255:return"ANY"}return"UNKNOWN_"+t};E7.toClass=function(t){switch(t.toUpperCase()){case"IN":return 1;case"CS":return 2;case"CH":return 3;case"HS":return 4;case"ANY":return 255}return 0}});var NJ=G(S7=>{"use strict";p();S7.toString=function(t){switch(t){case 1:return"LLQ";case 2:return"UL";case 3:return"NSID";case 5:return"DAU";case 6:return"DHU";case 7:return"N3U";case 8:return"CLIENT_SUBNET";case 9:return"EXPIRE";case 10:return"COOKIE";case 11:return"TCP_KEEPALIVE";case 12:return"PADDING";case 13:return"CHAIN";case 14:return"KEY_TAG";case 26946:return"DEVICEID"}return t<0?null:`OPTION_${t}`};S7.toCode=function(t){if(typeof t=="number")return t;if(!t)return-1;switch(t.toUpperCase()){case"OPTION_0":return 0;case"LLQ":return 1;case"UL":return 2;case"NSID":return 3;case"OPTION_4":return 4;case"DAU":return 5;case"DHU":return 6;case"N3U":return 7;case"CLIENT_SUBNET":return 8;case"EXPIRE":return 9;case"COOKIE":return 10;case"TCP_KEEPALIVE":return 11;case"PADDING":return 12;case"CHAIN":return 13;case"KEY_TAG":return 14;case"DEVICEID":return 26946;case"OPTION_65535":return 65535}let e=t.match(/_(\d+)$/);return e?parseInt(e[1],10):-1}});var UJ=G((LJ,A7)=>{p();var qJ=function(t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.decode=u,t.encode=f,t.familyOf=d,t.name=void 0,t.sizeOf=c,t.v6=t.v4=void 0;let e=/^(\d{1,3}\.){3,3}\d{1,3}$/,r=4,n=/^(::)?(((\d{1,3}\.){3}(\d{1,3}){1})?([0-9a-f]){0,4}:{0,2}){1,8}(::)?$/i,i=16,o={name:"v4",size:r,isFormat:m=>e.test(m),encode(m,_,v){v=~~v,_=_||new Uint8Array(v+r);let A=m.length,T=0;for(let M=0;M<A;){let D=m.charCodeAt(M++);D===46?(_[v++]=T,T=0):T=T*10+(D-48)}return _[v]=T,_},decode(m,_){return _=~~_,`${m[_++]}.${m[_++]}.${m[_++]}.${m[_]}`}};t.v4=o;let s={name:"v6",size:i,isFormat:m=>m.length>0&&n.test(m),encode(m,_,v){v=~~v;let A=v+i,T=-1,M=0,D=0,O=!0,U=!1;_=_||new Uint8Array(v+i);for(let L=0;L<m.length;L++){let F=m.charCodeAt(L);F===58?(O?T!==-1?(v<A&&(_[v]=0),v<A-1&&(_[v+1]=0),v+=2):v<A&&(T=v):(U===!0?(v<A&&(_[v]=D),v++):(v<A&&(_[v]=M>>8),v<A-1&&(_[v+1]=M&255),v+=2),M=0,D=0),O=!0,U=!1):F===46?(v<A&&(_[v]=D),v++,D=0,M=0,O=!1,U=!0):(O=!1,F>=97?F-=87:F>=65?F-=55:(F-=48,D=D*10+F),M=(M<<4)+F)}if(O===!1)U===!0?(v<A&&(_[v]=D),v++):(v<A&&(_[v]=M>>8),v<A-1&&(_[v+1]=M&255),v+=2);else if(T===0)v<A&&(_[v]=0),v<A-1&&(_[v+1]=0),v+=2;else if(T!==-1){v+=2;for(let L=Math.min(v-1,A-1);L>=T+2;L--)_[L]=_[L-2];_[T]=0,_[T+1]=0,T=v}if(T!==v&&T!==-1)for(v>A-2&&(v=A-2);A>T;)_[--A]=v<A&&v>T?_[--v]:0;else for(;v<A;)_[v++]=0;return _},decode(m,_){_=~~_;let v="";for(let A=0;A<i;A+=2)A!==0&&(v+=":"),v+=(m[_+A]<<8|m[_+A+1]).toString(16);return v.replace(/(^|:)0(:0)*:0(:|$)/,"$1::$3").replace(/:{3,4}/,"::")}};t.v6=s;let a="ip";t.name=a;function c(m){if(o.isFormat(m))return o.size;if(s.isFormat(m))return s.size;throw Error(`Invalid ip address: ${m}`)}function d(m){return c(m)===o.size?1:2}function f(m,_,v){v=~~v;let A=c(m);return typeof _=="function"&&(_=_(v+A)),A===o.size?o.encode(m,_,v):s.encode(m,_,v)}function u(m,_,v){if(_=~~_,v=v||m.length-_,v===o.size)return o.decode(m,_,v);if(v===s.size)return s.decode(m,_,v);throw Error(`Invalid buffer size needs to be ${o.size} for v4 or ${s.size} for v6.`)}return"default"in t?t.default:t}({});typeof define=="function"&&define.amd?define([],function(){return qJ}):typeof A7=="object"&&typeof LJ=="object"&&(A7.exports=qJ)});var $J=G(Re=>{"use strict";p();var Me=jr().Buffer,hf=DJ(),j4e=CJ(),N4e=OJ(),zx=jJ(),T7=NJ(),np=UJ(),q4e=0,FJ=1<<15,P7=1<<15,L4e=~P7,zJ=1<<15,U4e=~zJ,me=Re.name={};me.encode=function(t,e,r,{mail:n=!1}={}){e||(e=Me.alloc(me.encodingLength(t))),r||(r=0);let i=r,o=t.replace(/^\.|\.$/gm,"");if(o.length){let s=[];if(n){let a="";o.split(".").forEach(c=>{c.endsWith("\\")?a+=(a.length?".":"")+c.slice(0,-1):s.length===0&&a.length?s.push(a+"."+c):s.push(c)})}else s=o.split(".");for(let a=0;a<s.length;a++){let c=e.write(s[a],r+1);e[r]=c,r+=c+1}}return e[r++]=0,me.encode.bytes=r-i,e};me.encode.bytes=0;me.decode=function(t,e,{mail:r=!1}={}){e||(e=0);let n=[],i=e,o=0,s=0,a=!1;for(;;){if(e>=t.length)throw new Error("Cannot decode name (buffer overflow)");let c=t[e++];if(s+=a?0:1,c===0)break;if(c&192)if((c&192)===192){if(e+1>t.length)throw new Error("Cannot decode name (buffer overflow)");let d=t.readUInt16BE(e-1)-49152;if(d>=i)throw new Error("Cannot decode name (bad pointer)");e=d,i=d,s+=a?0:1,a=!0}else throw new Error("Cannot decode name (bad label)");else{if(e+c>t.length)throw new Error("Cannot decode name (buffer overflow)");if(o+=c+1,o>254)throw new Error("Cannot decode name (name too long)");let d=t.toString("utf-8",e,e+c);r&&(d=d.replace(/\./g,"\\.")),n.push(d),e+=c,s+=a?0:c}}return me.decode.bytes=s,n.length===0?".":n.join(".")};me.decode.bytes=0;me.encodingLength=function(t){return t==="."||t===".."?1:Me.byteLength(t.replace(/^\.|\.$/gm,""))+2};var Ft={};Ft.encode=function(t,e,r){e||(e=Me.alloc(Ft.encodingLength(t))),r||(r=0);let n=e.write(t,r+1);return e[r]=n,Ft.encode.bytes=n+1,e};Ft.encode.bytes=0;Ft.decode=function(t,e){e||(e=0);let r=t[e],n=t.toString("utf-8",e+1,e+1+r);return Ft.decode.bytes=r+1,n};Ft.decode.bytes=0;Ft.encodingLength=function(t){return Me.byteLength(t)+1};var Oa={};Oa.encode=function(t,e,r){e||(e=Oa.encodingLength(t)),r||(r=0);let n=(t.flags||0)&32767,i=t.type==="response"?FJ:q4e;return e.writeUInt16BE(t.id||0,r),e.writeUInt16BE(n|i,r+2),e.writeUInt16BE(t.questions.length,r+4),e.writeUInt16BE(t.answers.length,r+6),e.writeUInt16BE(t.authorities.length,r+8),e.writeUInt16BE(t.additionals.length,r+10),e};Oa.encode.bytes=12;Oa.decode=function(t,e){if(e||(e=0),t.length<12)throw new Error("Header must be 12 bytes");let r=t.readUInt16BE(e+2);return{id:t.readUInt16BE(e),type:r&FJ?"response":"query",flags:r&32767,flag_qr:(r>>15&1)===1,opcode:N4e.toString(r>>11&15),flag_aa:(r>>10&1)===1,flag_tc:(r>>9&1)===1,flag_rd:(r>>8&1)===1,flag_ra:(r>>7&1)===1,flag_z:(r>>6&1)===1,flag_ad:(r>>5&1)===1,flag_cd:(r>>4&1)===1,rcode:j4e.toString(r&15),questions:new Array(t.readUInt16BE(e+4)),answers:new Array(t.readUInt16BE(e+6)),authorities:new Array(t.readUInt16BE(e+8)),additionals:new Array(t.readUInt16BE(e+10))}};Oa.decode.bytes=12;Oa.encodingLength=function(){return 12};var nf=Re.unknown={};nf.encode=function(t,e,r){return e||(e=Me.alloc(nf.encodingLength(t))),r||(r=0),e.writeUInt16BE(t.length,r),t.copy(e,r+2),nf.encode.bytes=t.length+2,e};nf.encode.bytes=0;nf.decode=function(t,e){e||(e=0);let r=t.readUInt16BE(e),n=t.slice(e+2,e+2+r);return nf.decode.bytes=r+2,n};nf.decode.bytes=0;nf.encodingLength=function(t){return t.length+2};var of=Re.ns={};of.encode=function(t,e,r){return e||(e=Me.alloc(of.encodingLength(t))),r||(r=0),me.encode(t,e,r+2),e.writeUInt16BE(me.encode.bytes,r),of.encode.bytes=me.encode.bytes+2,e};of.encode.bytes=0;of.decode=function(t,e){e||(e=0);let r=t.readUInt16BE(e),n=me.decode(t,e+2);return of.decode.bytes=r+2,n};of.decode.bytes=0;of.encodingLength=function(t){return me.encodingLength(t)+2};var sf=Re.soa={};sf.encode=function(t,e,r){e||(e=Me.alloc(sf.encodingLength(t))),r||(r=0);let n=r;return r+=2,me.encode(t.mname,e,r),r+=me.encode.bytes,me.encode(t.rname,e,r,{mail:!0}),r+=me.encode.bytes,e.writeUInt32BE(t.serial||0,r),r+=4,e.writeUInt32BE(t.refresh||0,r),r+=4,e.writeUInt32BE(t.retry||0,r),r+=4,e.writeUInt32BE(t.expire||0,r),r+=4,e.writeUInt32BE(t.minimum||0,r),r+=4,e.writeUInt16BE(r-n-2,n),sf.encode.bytes=r-n,e};sf.encode.bytes=0;sf.decode=function(t,e){e||(e=0);let r=e,n={};return e+=2,n.mname=me.decode(t,e),e+=me.decode.bytes,n.rname=me.decode(t,e,{mail:!0}),e+=me.decode.bytes,n.serial=t.readUInt32BE(e),e+=4,n.refresh=t.readUInt32BE(e),e+=4,n.retry=t.readUInt32BE(e),e+=4,n.expire=t.readUInt32BE(e),e+=4,n.minimum=t.readUInt32BE(e),e+=4,sf.decode.bytes=e-r,n};sf.decode.bytes=0;sf.encodingLength=function(t){return 22+me.encodingLength(t.mname)+me.encodingLength(t.rname)};var af=Re.txt={};af.encode=function(t,e,r){Array.isArray(t)||(t=[t]);for(let i=0;i<t.length;i++)if(typeof t[i]=="string"&&(t[i]=Me.from(t[i])),!Me.isBuffer(t[i]))throw new Error("Must be a Buffer");e||(e=Me.alloc(af.encodingLength(t))),r||(r=0);let n=r;return r+=2,t.forEach(function(i){e[r++]=i.length,i.copy(e,r,0,i.length),r+=i.length}),e.writeUInt16BE(r-n-2,n),af.encode.bytes=r-n,e};af.encode.bytes=0;af.decode=function(t,e){e||(e=0);let r=e,n=t.readUInt16BE(e);e+=2;let i=[];for(;n>0;){let o=t[e++];if(--n,n<o)throw new Error("Buffer overflow");i.push(t.slice(e,e+o)),e+=o,n-=o}return af.decode.bytes=e-r,i};af.decode.bytes=0;af.encodingLength=function(t){Array.isArray(t)||(t=[t]);let e=2;return t.forEach(function(r){typeof r=="string"?e+=Me.byteLength(r)+1:e+=r.length+1}),e};var cf=Re.null={};cf.encode=function(t,e,r){e||(e=Me.alloc(cf.encodingLength(t))),r||(r=0),typeof t=="string"&&(t=Me.from(t)),t||(t=Me.alloc(0));let n=r;r+=2;let i=t.length;return t.copy(e,r,0,i),r+=i,e.writeUInt16BE(r-n-2,n),cf.encode.bytes=r-n,e};cf.encode.bytes=0;cf.decode=function(t,e){e||(e=0);let r=e,n=t.readUInt16BE(e);e+=2;let i=t.slice(e,e+n);return e+=n,cf.decode.bytes=e-r,i};cf.decode.bytes=0;cf.encodingLength=function(t){return t?(Me.isBuffer(t)?t.length:Me.byteLength(t))+2:2};var df=Re.hinfo={};df.encode=function(t,e,r){e||(e=Me.alloc(df.encodingLength(t))),r||(r=0);let n=r;return r+=2,Ft.encode(t.cpu,e,r),r+=Ft.encode.bytes,Ft.encode(t.os,e,r),r+=Ft.encode.bytes,e.writeUInt16BE(r-n-2,n),df.encode.bytes=r-n,e};df.encode.bytes=0;df.decode=function(t,e){e||(e=0);let r=e,n={};return e+=2,n.cpu=Ft.decode(t,e),e+=Ft.decode.bytes,n.os=Ft.decode(t,e),e+=Ft.decode.bytes,df.decode.bytes=e-r,n};df.decode.bytes=0;df.encodingLength=function(t){return Ft.encodingLength(t.cpu)+Ft.encodingLength(t.os)+2};var Da=Re.ptr={},F4e=Re.cname=Da,z4e=Re.dname=Da;Da.encode=function(t,e,r){return e||(e=Me.alloc(Da.encodingLength(t))),r||(r=0),me.encode(t,e,r+2),e.writeUInt16BE(me.encode.bytes,r),Da.encode.bytes=me.encode.bytes+2,e};Da.encode.bytes=0;Da.decode=function(t,e){e||(e=0);let r=me.decode(t,e+2);return Da.decode.bytes=me.decode.bytes+2,r};Da.decode.bytes=0;Da.encodingLength=function(t){return me.encodingLength(t)+2};var ff=Re.srv={};ff.encode=function(t,e,r){e||(e=Me.alloc(ff.encodingLength(t))),r||(r=0),e.writeUInt16BE(t.priority||0,r+2),e.writeUInt16BE(t.weight||0,r+4),e.writeUInt16BE(t.port||0,r+6),me.encode(t.target,e,r+8);let n=me.encode.bytes+6;return e.writeUInt16BE(n,r),ff.encode.bytes=n+2,e};ff.encode.bytes=0;ff.decode=function(t,e){e||(e=0);let r=t.readUInt16BE(e),n={};return n.priority=t.readUInt16BE(e+2),n.weight=t.readUInt16BE(e+4),n.port=t.readUInt16BE(e+6),n.target=me.decode(t,e+8),ff.decode.bytes=r+2,n};ff.decode.bytes=0;ff.encodingLength=function(t){return 8+me.encodingLength(t.target)};var us=Re.caa={};us.ISSUER_CRITICAL=1<<7;us.encode=function(t,e,r){let n=us.encodingLength(t);return e||(e=Me.alloc(us.encodingLength(t))),r||(r=0),t.issuerCritical&&(t.flags=us.ISSUER_CRITICAL),e.writeUInt16BE(n-2,r),r+=2,e.writeUInt8(t.flags||0,r),r+=1,Ft.encode(t.tag,e,r),r+=Ft.encode.bytes,e.write(t.value,r),r+=Me.byteLength(t.value),us.encode.bytes=n,e};us.encode.bytes=0;us.decode=function(t,e){e||(e=0);let r=t.readUInt16BE(e);e+=2;let n=e,i={};return i.flags=t.readUInt8(e),e+=1,i.tag=Ft.decode(t,e),e+=Ft.decode.bytes,i.value=t.toString("utf-8",e,n+r),i.issuerCritical=!!(i.flags&us.ISSUER_CRITICAL),us.decode.bytes=r+2,i};us.decode.bytes=0;us.encodingLength=function(t){return Ft.encodingLength(t.tag)+Ft.encodingLength(t.value)+2};var Iu=Re.mx={};Iu.encode=function(t,e,r){e||(e=Me.alloc(Iu.encodingLength(t))),r||(r=0);let n=r;return r+=2,e.writeUInt16BE(t.preference||0,r),r+=2,me.encode(t.exchange,e,r),r+=me.encode.bytes,e.writeUInt16BE(r-n-2,n),Iu.encode.bytes=r-n,e};Iu.encode.bytes=0;Iu.decode=function(t,e){e||(e=0);let r=e,n={};return e+=2,n.preference=t.readUInt16BE(e),e+=2,n.exchange=me.decode(t,e),e+=me.decode.bytes,Iu.decode.bytes=e-r,n};Iu.encodingLength=function(t){return 4+me.encodingLength(t.exchange)};var uf=Re.a={};uf.encode=function(t,e,r){return e||(e=Me.alloc(uf.encodingLength(t))),r||(r=0),e.writeUInt16BE(4,r),r+=2,np.v4.encode(t,e,r),uf.encode.bytes=6,e};uf.encode.bytes=0;uf.decode=function(t,e){e||(e=0),e+=2;let r=np.v4.decode(t,e);return uf.decode.bytes=6,r};uf.decode.bytes=0;uf.encodingLength=function(){return 6};var lf=Re.aaaa={};lf.encode=function(t,e,r){return e||(e=Me.alloc(lf.encodingLength(t))),r||(r=0),e.writeUInt16BE(16,r),r+=2,np.v6.encode(t,e,r),lf.encode.bytes=18,e};lf.encode.bytes=0;lf.decode=function(t,e){e||(e=0),e+=2;let r=np.v6.decode(t,e);return lf.decode.bytes=18,r};lf.decode.bytes=0;lf.encodingLength=function(){return 18};var No=Re.option={};No.encode=function(t,e,r){e||(e=Me.alloc(No.encodingLength(t))),r||(r=0);let n=r,i=T7.toCode(t.code);if(e.writeUInt16BE(i,r),r+=2,t.data)e.writeUInt16BE(t.data.length,r),r+=2,t.data.copy(e,r),r+=t.data.length;else switch(i){case 8:let o=t.sourcePrefixLength||0,s=t.family||np.familyOf(t.ip),a=np.encode(t.ip,Me.alloc),c=Math.ceil(o/8);e.writeUInt16BE(c+4,r),r+=2,e.writeUInt16BE(s,r),r+=2,e.writeUInt8(o,r++),e.writeUInt8(t.scopePrefixLength||0,r++),a.copy(e,r,0,c),r+=c;break;case 11:t.timeout?(e.writeUInt16BE(2,r),r+=2,e.writeUInt16BE(t.timeout,r),r+=2):(e.writeUInt16BE(0,r),r+=2);break;case 12:let d=t.length||0;e.writeUInt16BE(d,r),r+=2,e.fill(0,r,r+d),r+=d;break;case 14:let f=t.tags.length*2;e.writeUInt16BE(f,r),r+=2;for(let u of t.tags)e.writeUInt16BE(u,r),r+=2;break;default:throw new Error(`Unknown roption code: ${t.code}`)}return No.encode.bytes=r-n,e};No.encode.bytes=0;No.decode=function(t,e){e||(e=0);let r={};r.code=t.readUInt16BE(e),r.type=T7.toString(r.code),e+=2;let n=t.readUInt16BE(e);switch(e+=2,r.data=t.slice(e,e+n),r.code){case 8:r.family=t.readUInt16BE(e),e+=2,r.sourcePrefixLength=t.readUInt8(e++),r.scopePrefixLength=t.readUInt8(e++);let i=Me.alloc(r.family===1?4:16);t.copy(i,0,e,e+n-4),r.ip=np.decode(i);break;case 11:n>0&&(r.timeout=t.readUInt16BE(e),e+=2);break;case 14:r.tags=[];for(let o=0;o<n;o+=2)r.tags.push(t.readUInt16BE(e)),e+=2}return No.decode.bytes=n+4,r};No.decode.bytes=0;No.encodingLength=function(t){if(t.data)return t.data.length+4;switch(T7.toCode(t.code)){case 8:let r=t.sourcePrefixLength||0;return Math.ceil(r/8)+8;case 11:return typeof t.timeout=="number"?6:4;case 12:return t.length+4;case 14:return 4+t.tags.length*2}throw new Error(`Unknown roption code: ${t.code}`)};var hs=Re.opt={};hs.encode=function(t,e,r){e||(e=Me.alloc(hs.encodingLength(t))),r||(r=0);let n=r,i=Ym(t,No);return e.writeUInt16BE(i,r),r=Hv(t,No,e,r+2),hs.encode.bytes=r-n,e};hs.encode.bytes=0;hs.decode=function(t,e){e||(e=0);let r=e,n=[],i=t.readUInt16BE(e);e+=2;let o=0;for(;i>0;)n[o++]=No.decode(t,e),e+=No.decode.bytes,i-=No.decode.bytes;return hs.decode.bytes=e-r,n};hs.decode.bytes=0;hs.encodingLength=function(t){return 2+Ym(t||[],No)};var go=Re.dnskey={};go.PROTOCOL_DNSSEC=3;go.ZONE_KEY=128;go.SECURE_ENTRYPOINT=32768;go.encode=function(t,e,r){e||(e=Me.alloc(go.encodingLength(t))),r||(r=0);let n=r,i=t.key;if(!Me.isBuffer(i))throw new Error("Key must be a Buffer");return r+=2,e.writeUInt16BE(t.flags,r),r+=2,e.writeUInt8(go.PROTOCOL_DNSSEC,r),r+=1,e.writeUInt8(t.algorithm,r),r+=1,i.copy(e,r,0,i.length),r+=i.length,go.encode.bytes=r-n,e.writeUInt16BE(go.encode.bytes-2,n),e};go.encode.bytes=0;go.decode=function(t,e){e||(e=0);let r=e;var n={},i=t.readUInt16BE(e);if(e+=2,n.flags=t.readUInt16BE(e),e+=2,t.readUInt8(e)!==go.PROTOCOL_DNSSEC)throw new Error("Protocol must be 3");return e+=1,n.algorithm=t.readUInt8(e),e+=1,n.key=t.slice(e,r+i+2),e+=n.key.length,go.decode.bytes=e-r,n};go.decode.bytes=0;go.encodingLength=function(t){return 6+Me.byteLength(t.key)};var Hc=Re.rrsig={};Hc.encode=function(t,e,r){e||(e=Me.alloc(Hc.encodingLength(t))),r||(r=0);let n=r,i=t.signature;if(!Me.isBuffer(i))throw new Error("Signature must be a Buffer");return r+=2,e.writeUInt16BE(hf.toType(t.typeCovered),r),r+=2,e.writeUInt8(t.algorithm,r),r+=1,e.writeUInt8(t.labels,r),r+=1,e.writeUInt32BE(t.originalTTL,r),r+=4,e.writeUInt32BE(t.expiration,r),r+=4,e.writeUInt32BE(t.inception,r),r+=4,e.writeUInt16BE(t.keyTag,r),r+=2,me.encode(t.signersName,e,r),r+=me.encode.bytes,i.copy(e,r,0,i.length),r+=i.length,Hc.encode.bytes=r-n,e.writeUInt16BE(Hc.encode.bytes-2,n),e};Hc.encode.bytes=0;Hc.decode=function(t,e){e||(e=0);let r=e;var n={},i=t.readUInt16BE(e);return e+=2,n.typeCovered=hf.toString(t.readUInt16BE(e)),e+=2,n.algorithm=t.readUInt8(e),e+=1,n.labels=t.readUInt8(e),e+=1,n.originalTTL=t.readUInt32BE(e),e+=4,n.expiration=t.readUInt32BE(e),e+=4,n.inception=t.readUInt32BE(e),e+=4,n.keyTag=t.readUInt16BE(e),e+=2,n.signersName=me.decode(t,e),e+=me.decode.bytes,n.signature=t.slice(e,r+i+2),e+=n.signature.length,Hc.decode.bytes=e-r,n};Hc.decode.bytes=0;Hc.encodingLength=function(t){return 20+me.encodingLength(t.signersName)+Me.byteLength(t.signature)};var Wc=Re.rp={};Wc.encode=function(t,e,r){e||(e=Me.alloc(Wc.encodingLength(t))),r||(r=0);let n=r;return r+=2,me.encode(t.mbox||".",e,r,{mail:!0}),r+=me.encode.bytes,me.encode(t.txt||".",e,r),r+=me.encode.bytes,Wc.encode.bytes=r-n,e.writeUInt16BE(Wc.encode.bytes-2,n),e};Wc.encode.bytes=0;Wc.decode=function(t,e){e||(e=0);let r=e,n={};return e+=2,n.mbox=me.decode(t,e,{mail:!0})||".",e+=me.decode.bytes,n.txt=me.decode(t,e)||".",e+=me.decode.bytes,Wc.decode.bytes=e-r,n};Wc.decode.bytes=0;Wc.encodingLength=function(t){return 2+me.encodingLength(t.mbox||".")+me.encodingLength(t.txt||".")};var oi={};oi.encode=function(t,e,r){e||(e=Me.alloc(oi.encodingLength(t))),r||(r=0);let n=r;for(var i=[],o=0;o<t.length;o++){var s=hf.toType(t[o]);i[s>>8]===void 0&&(i[s>>8]=[]),i[s>>8][s>>3&31]|=1<<7-(s&7)}for(o=0;o<i.length;o++)if(i[o]!==void 0){var a=Me.from(i[o]);e.writeUInt8(o,r),r+=1,e.writeUInt8(a.length,r),r+=1,a.copy(e,r),r+=a.length}return oi.encode.bytes=r-n,e};oi.encode.bytes=0;oi.decode=function(t,e,r){e||(e=0);let n=e;for(var i=[];e-n<r;){var o=t.readUInt8(e);e+=1;var s=t.readUInt8(e);e+=1;for(var a=0;a<s;a++)for(var c=t.readUInt8(e+a),d=0;d<8;d++)if(c&1<<7-d){var f=hf.toString(o<<8|a<<3|d);i.push(f)}e+=s}return oi.decode.bytes=e-n,i};oi.decode.bytes=0;oi.encodingLength=function(t){for(var e=[],r=0;r<t.length;r++){var n=hf.toType(t[r]);e[n>>8]=Math.max(e[n>>8]||0,n&255)}var i=0;for(r=0;r<e.length;r++)e[r]!==void 0&&(i+=2+Math.ceil((e[r]+1)/8));return i};var Vc=Re.nsec={};Vc.encode=function(t,e,r){e||(e=Me.alloc(Vc.encodingLength(t))),r||(r=0);let n=r;return r+=2,me.encode(t.nextDomain,e,r),r+=me.encode.bytes,oi.encode(t.rrtypes,e,r),r+=oi.encode.bytes,Vc.encode.bytes=r-n,e.writeUInt16BE(Vc.encode.bytes-2,n),e};Vc.encode.bytes=0;Vc.decode=function(t,e){e||(e=0);let r=e;var n={},i=t.readUInt16BE(e);return e+=2,n.nextDomain=me.decode(t,e),e+=me.decode.bytes,n.rrtypes=oi.decode(t,e,i-(e-r)),e+=oi.decode.bytes,Vc.decode.bytes=e-r,n};Vc.decode.bytes=0;Vc.encodingLength=function(t){return 2+me.encodingLength(t.nextDomain)+oi.encodingLength(t.rrtypes)};var Kc=Re.nsec3={};Kc.encode=function(t,e,r){e||(e=Me.alloc(Kc.encodingLength(t))),r||(r=0);let n=r,i=t.salt;if(!Me.isBuffer(i))throw new Error("salt must be a Buffer");let o=t.nextDomain;if(!Me.isBuffer(o))throw new Error("nextDomain must be a Buffer");return r+=2,e.writeUInt8(t.algorithm,r),r+=1,e.writeUInt8(t.flags,r),r+=1,e.writeUInt16BE(t.iterations,r),r+=2,e.writeUInt8(i.length,r),r+=1,i.copy(e,r,0,i.length),r+=i.length,e.writeUInt8(o.length,r),r+=1,o.copy(e,r,0,o.length),r+=o.length,oi.encode(t.rrtypes,e,r),r+=oi.encode.bytes,Kc.encode.bytes=r-n,e.writeUInt16BE(Kc.encode.bytes-2,n),e};Kc.encode.bytes=0;Kc.decode=function(t,e){e||(e=0);let r=e;var n={},i=t.readUInt16BE(e);e+=2,n.algorithm=t.readUInt8(e),e+=1,n.flags=t.readUInt8(e),e+=1,n.iterations=t.readUInt16BE(e),e+=2;let o=t.readUInt8(e);e+=1,n.salt=t.slice(e,e+o),e+=o;let s=t.readUInt8(e);return e+=1,n.nextDomain=t.slice(e,e+s),e+=s,n.rrtypes=oi.decode(t,e,i-(e-r)),e+=oi.decode.bytes,Kc.decode.bytes=e-r,n};Kc.decode.bytes=0;Kc.encodingLength=function(t){return 8+t.salt.length+t.nextDomain.length+oi.encodingLength(t.rrtypes)};var Zc=Re.ds={};Zc.encode=function(t,e,r){e||(e=Me.alloc(Zc.encodingLength(t))),r||(r=0);let n=r,i=t.digest;if(!Me.isBuffer(i))throw new Error("Digest must be a Buffer");return r+=2,e.writeUInt16BE(t.keyTag,r),r+=2,e.writeUInt8(t.algorithm,r),r+=1,e.writeUInt8(t.digestType,r),r+=1,i.copy(e,r,0,i.length),r+=i.length,Zc.encode.bytes=r-n,e.writeUInt16BE(Zc.encode.bytes-2,n),e};Zc.encode.bytes=0;Zc.decode=function(t,e){e||(e=0);let r=e;var n={},i=t.readUInt16BE(e);return e+=2,n.keyTag=t.readUInt16BE(e),e+=2,n.algorithm=t.readUInt8(e),e+=1,n.digestType=t.readUInt8(e),e+=1,n.digest=t.slice(e,r+i+2),e+=n.digest.length,Zc.decode.bytes=e-r,n};Zc.decode.bytes=0;Zc.encodingLength=function(t){return 6+Me.byteLength(t.digest)};var ls=Re.sshfp={};ls.getFingerprintLengthForHashType=function(e){switch(e){case 1:return 20;case 2:return 32}};ls.encode=function(e,r,n){r||(r=Me.alloc(ls.encodingLength(e))),n||(n=0);let i=n;n+=2,r[n]=e.algorithm,n+=1,r[n]=e.hash,n+=1;let o=Me.from(e.fingerprint.toUpperCase(),"hex");if(o.length!==ls.getFingerprintLengthForHashType(e.hash))throw new Error("Invalid fingerprint length");return o.copy(r,n),n+=o.byteLength,ls.encode.bytes=n-i,r.writeUInt16BE(ls.encode.bytes-2,i),r};ls.encode.bytes=0;ls.decode=function(e,r){r||(r=0);let n=r,i={};r+=2,i.algorithm=e[r],r+=1,i.hash=e[r],r+=1;let o=ls.getFingerprintLengthForHashType(i.hash);return i.fingerprint=e.slice(r,r+o).toString("hex").toUpperCase(),r+=o,ls.decode.bytes=r-n,i};ls.decode.bytes=0;ls.encodingLength=function(t){return 4+Me.from(t.fingerprint,"hex").byteLength};var Yc=Re.naptr={};Yc.encode=function(t,e,r){e||(e=Me.alloc(Yc.encodingLength(t))),r||(r=0);let n=r;return r+=2,e.writeUInt16BE(t.order||0,r),r+=2,e.writeUInt16BE(t.preference||0,r),r+=2,Ft.encode(t.flags,e,r),r+=Ft.encode.bytes,Ft.encode(t.services,e,r),r+=Ft.encode.bytes,Ft.encode(t.regexp,e,r),r+=Ft.encode.bytes,me.encode(t.replacement,e,r),r+=me.encode.bytes,Yc.encode.bytes=r-n,e.writeUInt16BE(Yc.encode.bytes-2,n),e};Yc.encode.bytes=0;Yc.decode=function(t,e){e||(e=0);let r=e,n={};return e+=2,n.order=t.readUInt16BE(e),e+=2,n.preference=t.readUInt16BE(e),e+=2,n.flags=Ft.decode(t,e),e+=Ft.decode.bytes,n.services=Ft.decode(t,e),e+=Ft.decode.bytes,n.regexp=Ft.decode(t,e),e+=Ft.decode.bytes,n.replacement=me.decode(t,e),e+=me.decode.bytes,Yc.decode.bytes=e-r,n};Yc.decode.bytes=0;Yc.encodingLength=function(t){return Ft.encodingLength(t.flags)+Ft.encodingLength(t.services)+Ft.encodingLength(t.regexp)+me.encodingLength(t.replacement)+6};var Jc=Re.tlsa={};Jc.encode=function(t,e,r){e||(e=Me.alloc(Jc.encodingLength(t))),r||(r=0);let n=r,i=t.certificate;if(!Me.isBuffer(i))throw new Error("Certificate must be a Buffer");return r+=2,e.writeUInt8(t.usage,r),r+=1,e.writeUInt8(t.selector,r),r+=1,e.writeUInt8(t.matchingType,r),r+=1,i.copy(e,r,0,i.length),r+=i.length,Jc.encode.bytes=r-n,e.writeUInt16BE(Jc.encode.bytes-2,n),e};Jc.encode.bytes=0;Jc.decode=function(t,e){e||(e=0);let r=e,n={},i=t.readUInt16BE(e);return e+=2,n.usage=t.readUInt8(e),e+=1,n.selector=t.readUInt8(e),e+=1,n.matchingType=t.readUInt8(e),e+=1,n.certificate=t.slice(e,r+i+2),e+=n.certificate.length,Jc.decode.bytes=e-r,n};Jc.decode.bytes=0;Jc.encodingLength=function(t){return 5+Me.byteLength(t.certificate)};var I7=Re.record=function(t){switch(t.toUpperCase()){case"A":return uf;case"PTR":return Da;case"CNAME":return F4e;case"DNAME":return z4e;case"TXT":return af;case"NULL":return cf;case"AAAA":return lf;case"SRV":return ff;case"HINFO":return df;case"CAA":return us;case"NS":return of;case"SOA":return sf;case"MX":return Iu;case"OPT":return hs;case"DNSKEY":return go;case"RRSIG":return Hc;case"RP":return Wc;case"NSEC":return Vc;case"NSEC3":return Kc;case"SSHFP":return ls;case"DS":return Zc;case"NAPTR":return Yc;case"TLSA":return Jc}return nf},ki=Re.answer={};ki.encode=function(t,e,r){e||(e=Me.alloc(ki.encodingLength(t))),r||(r=0);let n=r;if(me.encode(t.name,e,r),r+=me.encode.bytes,e.writeUInt16BE(hf.toType(t.type),r),t.type.toUpperCase()==="OPT"){if(t.name!==".")throw new Error("OPT name must be root.");e.writeUInt16BE(t.udpPayloadSize||4096,r+2),e.writeUInt8(t.extendedRcode||0,r+4),e.writeUInt8(t.ednsVersion||0,r+5),e.writeUInt16BE(t.flags||0,r+6),r+=8,hs.encode(t.options||[],e,r),r+=hs.encode.bytes}else{let i=zx.toClass(t.class===void 0?"IN":t.class);t.flush&&(i|=P7),e.writeUInt16BE(i,r+2),e.writeUInt32BE(t.ttl||0,r+4),r+=8;let o=I7(t.type);o.encode(t.data,e,r),r+=o.encode.bytes}return ki.encode.bytes=r-n,e};ki.encode.bytes=0;ki.decode=function(t,e){e||(e=0);let r={},n=e;if(r.name=me.decode(t,e),e+=me.decode.bytes,r.type=hf.toString(t.readUInt16BE(e)),r.type==="OPT")r.udpPayloadSize=t.readUInt16BE(e+2),r.extendedRcode=t.readUInt8(e+4),r.ednsVersion=t.readUInt8(e+5),r.flags=t.readUInt16BE(e+6),r.flag_do=(r.flags>>15&1)===1,r.options=hs.decode(t,e+8),e+=8+hs.decode.bytes;else{let i=t.readUInt16BE(e+2);r.ttl=t.readUInt32BE(e+4),r.class=zx.toString(i&L4e),r.flush=!!(i&P7);let o=I7(r.type);r.data=o.decode(t,e+8),e+=8+o.decode.bytes}return ki.decode.bytes=e-n,r};ki.decode.bytes=0;ki.encodingLength=function(t){let e=t.data!==null&&t.data!==void 0?t.data:t.options;return me.encodingLength(t.name)+8+I7(t.type).encodingLength(e)};var Ca=Re.question={};Ca.encode=function(t,e,r){e||(e=Me.alloc(Ca.encodingLength(t))),r||(r=0);let n=r;return me.encode(t.name,e,r),r+=me.encode.bytes,e.writeUInt16BE(hf.toType(t.type),r),r+=2,e.writeUInt16BE(zx.toClass(t.class===void 0?"IN":t.class),r),r+=2,Ca.encode.bytes=r-n,t};Ca.encode.bytes=0;Ca.decode=function(t,e){e||(e=0);let r=e,n={};return n.name=me.decode(t,e),e+=me.decode.bytes,n.type=hf.toString(t.readUInt16BE(e)),e+=2,n.class=zx.toString(t.readUInt16BE(e)),e+=2,!!(n.class&zJ)&&(n.class&=U4e),Ca.decode.bytes=e-r,n};Ca.decode.bytes=0;Ca.encodingLength=function(t){return me.encodingLength(t.name)+4};Re.AUTHORITATIVE_ANSWER=1<<10;Re.TRUNCATED_RESPONSE=1<<9;Re.RECURSION_DESIRED=1<<8;Re.RECURSION_AVAILABLE=1<<7;Re.AUTHENTIC_DATA=1<<5;Re.CHECKING_DISABLED=1<<4;Re.DNSSEC_OK=1<<15;Re.encode=function(t,e,r){let n=!e;n&&(e=Me.alloc(Re.encodingLength(t))),r||(r=0);let i=r;return t.questions||(t.questions=[]),t.answers||(t.answers=[]),t.authorities||(t.authorities=[]),t.additionals||(t.additionals=[]),Oa.encode(t,e,r),r+=Oa.encode.bytes,r=Hv(t.questions,Ca,e,r),r=Hv(t.answers,ki,e,r),r=Hv(t.authorities,ki,e,r),r=Hv(t.additionals,ki,e,r),Re.encode.bytes=r-i,n&&Re.encode.bytes!==e.length?e.slice(0,Re.encode.bytes):e};Re.encode.bytes=0;Re.decode=function(t,e){e||(e=0);let r=e,n=Oa.decode(t,e);return e+=Oa.decode.bytes,e=Fx(n.questions,Ca,t,e),e=Fx(n.answers,ki,t,e),e=Fx(n.authorities,ki,t,e),e=Fx(n.additionals,ki,t,e),Re.decode.bytes=e-r,n};Re.decode.bytes=0;Re.encodingLength=function(t){return Oa.encodingLength(t)+Ym(t.questions||[],Ca)+Ym(t.answers||[],ki)+Ym(t.authorities||[],ki)+Ym(t.additionals||[],ki)};Re.streamEncode=function(t){let e=Re.encode(t),r=Me.alloc(2);r.writeUInt16BE(e.byteLength);let n=Me.concat([r,e]);return Re.streamEncode.bytes=n.byteLength,n};Re.streamEncode.bytes=0;Re.streamDecode=function(t){let e=t.readUInt16BE(0);if(t.byteLength<e+2)return null;let r=Re.decode(t.slice(2));return Re.streamDecode.bytes=Re.decode.bytes,r};Re.streamDecode.bytes=0;function Ym(t,e){let r=0;for(let n=0;n<t.length;n++)r+=e.encodingLength(t[n]);return r}function Hv(t,e,r,n){for(let i=0;i<t.length;i++)e.encode(t[i],r,n),n+=e.encode.bytes;return n}function Fx(t,e,r,n){for(let i=0;i<t.length;i++)t[i]=e.decode(r,n),n+=e.decode.bytes;return n}});var YJ=G(ZJ=>{"use strict";p();ZJ.supports=function(...e){let r=e.reduce((n,i)=>Object.assign(n,i),{});return Object.assign(r,{snapshots:r.snapshots||!1,permanence:r.permanence||!1,seek:r.seek||!1,clear:r.clear||!1,getMany:r.getMany||!1,keyIterator:r.keyIterator||!1,valueIterator:r.valueIterator||!1,iteratorNextv:r.iteratorNextv||!1,iteratorAll:r.iteratorAll||!1,status:r.status||!1,createIfMissing:r.createIfMissing||!1,errorIfExists:r.errorIfExists||!1,deferredOpen:r.deferredOpen||!1,promises:r.promises||!1,streams:r.streams||!1,encodings:Object.assign({},r.encodings),events:Object.assign({},r.events),additionalMethods:Object.assign({},r.additionalMethods)})}});var ja=G((vXe,JJ)=>{"use strict";p();JJ.exports=class extends Error{constructor(e,r){super(e||""),typeof r=="object"&&r!==null&&(r.code&&(this.code=String(r.code)),r.expected&&(this.expected=!0),r.transient&&(this.transient=!0),r.cause&&(this.cause=r.cause)),Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor)}}});var D7=G((_Xe,XJ)=>{"use strict";p();var B7=null;XJ.exports=function(){return B7===null&&(B7={textEncoder:new TextEncoder,textDecoder:new TextDecoder}),B7}});var j7=G(QJ=>{"use strict";p();var C7=ja(),V4e=new Set(["buffer","view","utf8"]),O7=class{constructor(e){if(this.encode=e.encode||this.encode,this.decode=e.decode||this.decode,this.name=e.name||this.name,this.format=e.format||this.format,typeof this.encode!="function")throw new TypeError("The 'encode' property must be a function");if(typeof this.decode!="function")throw new TypeError("The 'decode' property must be a function");if(this.encode=this.encode.bind(this),this.decode=this.decode.bind(this),typeof this.name!="string"||this.name==="")throw new TypeError("The 'name' property must be a string");if(typeof this.format!="string"||!V4e.has(this.format))throw new TypeError("The 'format' property must be one of 'buffer', 'view', 'utf8'");e.createViewTranscoder&&(this.createViewTranscoder=e.createViewTranscoder),e.createBufferTranscoder&&(this.createBufferTranscoder=e.createBufferTranscoder),e.createUTF8Transcoder&&(this.createUTF8Transcoder=e.createUTF8Transcoder)}get commonName(){return this.name.split("+")[0]}createBufferTranscoder(){throw new C7(`Encoding '${this.name}' cannot be transcoded to 'buffer'`,{code:"LEVEL_ENCODING_NOT_SUPPORTED"})}createViewTranscoder(){throw new C7(`Encoding '${this.name}' cannot be transcoded to 'view'`,{code:"LEVEL_ENCODING_NOT_SUPPORTED"})}createUTF8Transcoder(){throw new C7(`Encoding '${this.name}' cannot be transcoded to 'utf8'`,{code:"LEVEL_ENCODING_NOT_SUPPORTED"})}};QJ.Encoding=O7});var U7=G(Xx=>{"use strict";p();var{Buffer:q7}=jr()||{},{Encoding:L7}=j7(),K4e=D7(),Zv=class extends L7{constructor(e){super({...e,format:"buffer"})}createViewTranscoder(){return new Yv({encode:this.encode,decode:e=>this.decode(q7.from(e.buffer,e.byteOffset,e.byteLength)),name:`${this.name}+view`})}createBufferTranscoder(){return this}},Yv=class extends L7{constructor(e){super({...e,format:"view"})}createBufferTranscoder(){return new Zv({encode:e=>{let r=this.encode(e);return q7.from(r.buffer,r.byteOffset,r.byteLength)},decode:this.decode,name:`${this.name}+buffer`})}createViewTranscoder(){return this}},N7=class extends L7{constructor(e){super({...e,format:"utf8"})}createBufferTranscoder(){return new Zv({encode:e=>q7.from(this.encode(e),"utf8"),decode:e=>this.decode(e.toString("utf8")),name:`${this.name}+buffer`})}createViewTranscoder(){let{textEncoder:e,textDecoder:r}=K4e();return new Yv({encode:n=>e.encode(this.encode(n)),decode:n=>this.decode(r.decode(n)),name:`${this.name}+view`})}createUTF8Transcoder(){return this}};Xx.BufferFormat=Zv;Xx.ViewFormat=Yv;Xx.UTF8Format=N7});var nX=G(op=>{"use strict";p();var{Buffer:Yi}=jr()||{Buffer:{isBuffer:()=>!1}},{textEncoder:tX,textDecoder:eX}=D7()(),{BufferFormat:Jv,ViewFormat:F7,UTF8Format:rX}=U7(),Qx=t=>t;op.utf8=new rX({encode:function(t){return Yi.isBuffer(t)?t.toString("utf8"):ArrayBuffer.isView(t)?eX.decode(t):String(t)},decode:Qx,name:"utf8",createViewTranscoder(){return new F7({encode:function(t){return ArrayBuffer.isView(t)?t:tX.encode(t)},decode:function(t){return eX.decode(t)},name:`${this.name}+view`})},createBufferTranscoder(){return new Jv({encode:function(t){return Yi.isBuffer(t)?t:ArrayBuffer.isView(t)?Yi.from(t.buffer,t.byteOffset,t.byteLength):Yi.from(String(t),"utf8")},decode:function(t){return t.toString("utf8")},name:`${this.name}+buffer`})}});op.json=new rX({encode:JSON.stringify,decode:JSON.parse,name:"json"});op.buffer=new Jv({encode:function(t){return Yi.isBuffer(t)?t:ArrayBuffer.isView(t)?Yi.from(t.buffer,t.byteOffset,t.byteLength):Yi.from(String(t),"utf8")},decode:Qx,name:"buffer",createViewTranscoder(){return new F7({encode:function(t){return ArrayBuffer.isView(t)?t:Yi.from(String(t),"utf8")},decode:function(t){return Yi.from(t.buffer,t.byteOffset,t.byteLength)},name:`${this.name}+view`})}});op.view=new F7({encode:function(t){return ArrayBuffer.isView(t)?t:tX.encode(t)},decode:Qx,name:"view",createBufferTranscoder(){return new Jv({encode:function(t){return Yi.isBuffer(t)?t:ArrayBuffer.isView(t)?Yi.from(t.buffer,t.byteOffset,t.byteLength):Yi.from(String(t),"utf8")},decode:Qx,name:`${this.name}+buffer`})}});op.hex=new Jv({encode:function(t){return Yi.isBuffer(t)?t:Yi.from(String(t),"hex")},decode:function(t){return t.toString("hex")},name:"hex"});op.base64=new Jv({encode:function(t){return Yi.isBuffer(t)?t:Yi.from(String(t),"base64")},decode:function(t){return t.toString("base64")},name:"base64"})});var sX=G(oX=>{"use strict";p();var iX=ja(),t3=nX(),{Encoding:Z4e}=j7(),{BufferFormat:Y4e,ViewFormat:J4e,UTF8Format:X4e}=U7(),Xv=Symbol("formats"),e3=Symbol("encodings"),Q4e=new Set(["buffer","view","utf8"]),z7=class{constructor(e){if(Array.isArray(e)){if(!e.every(r=>Q4e.has(r)))throw new TypeError("Format must be one of 'buffer', 'view', 'utf8'")}else throw new TypeError("The first argument 'formats' must be an array");this[e3]=new Map,this[Xv]=new Set(e);for(let r in t3)try{this.encoding(r)}catch(n){if(n.code!=="LEVEL_ENCODING_NOT_SUPPORTED")throw n}}encodings(){return Array.from(new Set(this[e3].values()))}encoding(e){let r=this[e3].get(e);if(r===void 0){if(typeof e=="string"&&e!==""){if(r=n5e[e],!r)throw new iX(`Encoding '${e}' is not found`,{code:"LEVEL_ENCODING_NOT_FOUND"})}else{if(typeof e!="object"||e===null)throw new TypeError("First argument 'encoding' must be a string or object");r=e5e(e)}let{name:n,format:i}=r;if(!this[Xv].has(i))if(this[Xv].has("view"))r=r.createViewTranscoder();else if(this[Xv].has("buffer"))r=r.createBufferTranscoder();else if(this[Xv].has("utf8"))r=r.createUTF8Transcoder();else throw new iX(`Encoding '${n}' cannot be transcoded`,{code:"LEVEL_ENCODING_NOT_SUPPORTED"});for(let o of[e,n,r.name,r.commonName])this[e3].set(o,r)}return r}};oX.Transcoder=z7;function e5e(t){if(t instanceof Z4e)return t;let e="type"in t&&typeof t.type=="string"?t.type:void 0,r=t.name||e||`anonymous-${i5e++}`;switch(t5e(t)){case"view":return new J4e({...t,name:r});case"utf8":return new X4e({...t,name:r});case"buffer":return new Y4e({...t,name:r});default:throw new TypeError("Format must be one of 'buffer', 'view', 'utf8'")}}function t5e(t){return"format"in t&&t.format!==void 0?t.format:"buffer"in t&&typeof t.buffer=="boolean"?t.buffer?"buffer":"utf8":"code"in t&&Number.isInteger(t.code)?"view":"buffer"}var r5e={binary:t3.buffer,"utf-8":t3.utf8},n5e={...t3,...r5e},i5e=0});var cX=G((kXe,aX)=>{p();aX.exports=typeof queueMicrotask=="function"?queueMicrotask:t=>Promise.resolve().then(t)});var Qv=G($7=>{"use strict";p();var dX=cX();$7.fromCallback=function(t,e){if(t===void 0){var r=new Promise(function(n,i){t=function(o,s){o?i(o):n(s)}});t[e!==void 0?e:"promise"]=r}else if(typeof t!="function")throw new TypeError("Callback must be a function");return t};$7.fromPromise=function(t,e){if(e===void 0)return t;t.then(function(r){dX(()=>e(null,r))}).catch(function(r){dX(()=>e(r))})}});var r3=G(G7=>{"use strict";p();G7.getCallback=function(t,e){return typeof t=="function"?t:e};G7.getOptions=function(t,e){return typeof t=="object"&&t!==null?t:e!==void 0?e:{}}});var zu=G(s3=>{"use strict";p();var{fromCallback:H7}=Qv(),ps=ja(),{getOptions:W7,getCallback:fX}=r3(),sp=Symbol("promise"),sy=Symbol("callback"),Xc=Symbol("working"),ap=Symbol("handleOne"),gf=Symbol("handleMany"),V7=Symbol("autoClose"),Uu=Symbol("finishWork"),Qc=Symbol("returnMany"),Nu=Symbol("closing"),e1=Symbol("handleClose"),n3=Symbol("closed"),t1=Symbol("closeCallbacks"),Lu=Symbol("keyEncoding"),cp=Symbol("valueEncoding"),K7=Symbol("abortOnClose"),i3=Symbol("legacy"),Z7=Symbol("keys"),Y7=Symbol("values"),qu=Symbol("limit"),Ks=Symbol("count"),o3=Object.freeze({}),o5e=()=>{},uX=!1,r1=class{constructor(e,r,n){if(typeof e!="object"||e===null){let i=e===null?"null":typeof e;throw new TypeError(`The first argument must be an abstract-level database, received ${i}`)}if(typeof r!="object"||r===null)throw new TypeError("The second argument must be an options object");this[n3]=!1,this[t1]=[],this[Xc]=!1,this[Nu]=!1,this[V7]=!1,this[sy]=null,this[ap]=this[ap].bind(this),this[gf]=this[gf].bind(this),this[e1]=this[e1].bind(this),this[Lu]=r[Lu],this[cp]=r[cp],this[i3]=n,this[qu]=Number.isInteger(r.limit)&&r.limit>=0?r.limit:1/0,this[Ks]=0,this[K7]=!!r.abortOnClose,this.db=e,this.db.attachResource(this),this.nextTick=e.nextTick}get count(){return this[Ks]}get limit(){return this[qu]}next(e){let r;if(e===void 0)r=new Promise((n,i)=>{e=(o,s,a)=>{o?i(o):this[i3]?s===void 0&&a===void 0?n():n([s,a]):n(s)}});else if(typeof e!="function")throw new TypeError("Callback must be a function");return this[Nu]?this.nextTick(e,new ps("Iterator is not open: cannot call next() after close()",{code:"LEVEL_ITERATOR_NOT_OPEN"})):this[Xc]?this.nextTick(e,new ps("Iterator is busy: cannot call next() until previous call has completed",{code:"LEVEL_ITERATOR_BUSY"})):(this[Xc]=!0,this[sy]=e,this[Ks]>=this[qu]?this.nextTick(this[ap],null):this._next(this[ap])),r}_next(e){this.nextTick(e)}nextv(e,r,n){return n=fX(r,n),n=H7(n,sp),r=W7(r,o3),Number.isInteger(e)?(this[Nu]?this.nextTick(n,new ps("Iterator is not open: cannot call nextv() after close()",{code:"LEVEL_ITERATOR_NOT_OPEN"})):this[Xc]?this.nextTick(n,new ps("Iterator is busy: cannot call nextv() until previous call has completed",{code:"LEVEL_ITERATOR_BUSY"})):(e<1&&(e=1),this[qu]<1/0&&(e=Math.min(e,this[qu]-this[Ks])),this[Xc]=!0,this[sy]=n,e<=0?this.nextTick(this[gf],null,[]):this._nextv(e,r,this[gf])),n[sp]):(this.nextTick(n,new TypeError("The first argument 'size' must be an integer")),n[sp])}_nextv(e,r,n){let i=[],o=(s,a,c)=>{if(s)return n(s);if(this[i3]?a===void 0&&c===void 0:a===void 0)return n(null,i);i.push(this[i3]?[a,c]:a),i.length===e?n(null,i):this._next(o)};this._next(o)}all(e,r){return r=fX(e,r),r=H7(r,sp),e=W7(e,o3),this[Nu]?this.nextTick(r,new ps("Iterator is not open: cannot call all() after close()",{code:"LEVEL_ITERATOR_NOT_OPEN"})):this[Xc]?this.nextTick(r,new ps("Iterator is busy: cannot call all() until previous call has completed",{code:"LEVEL_ITERATOR_BUSY"})):(this[Xc]=!0,this[sy]=r,this[V7]=!0,this[Ks]>=this[qu]?this.nextTick(this[gf],null,[]):this._all(e,this[gf])),r[sp]}_all(e,r){let n=this[Ks],i=[],o=()=>{let a=this[qu]<1/0?Math.min(1e3,this[qu]-n):1e3;a<=0?this.nextTick(r,null,i):this._nextv(a,o3,s)},s=(a,c)=>{a?r(a):c.length===0?r(null,i):(i.push.apply(i,c),n+=c.length,o())};o()}[Uu](){let e=this[sy];return this[K7]&&e===null?o5e:(this[Xc]=!1,this[sy]=null,this[Nu]&&this._close(this[e1]),e)}[Qc](e,r,n){this[V7]?this.close(e.bind(null,r,n)):e(r,n)}seek(e,r){if(r=W7(r,o3),!this[Nu]){if(this[Xc])throw new ps("Iterator is busy: cannot call seek() until next() has completed",{code:"LEVEL_ITERATOR_BUSY"});{let n=this.db.keyEncoding(r.keyEncoding||this[Lu]),i=n.format;r.keyEncoding!==i&&(r={...r,keyEncoding:i});let o=this.db.prefixKey(n.encode(e),i);this._seek(o,r)}}}_seek(e,r){throw new ps("Iterator does not support seek()",{code:"LEVEL_NOT_SUPPORTED"})}close(e){return e=H7(e,sp),this[n3]?this.nextTick(e):this[Nu]?this[t1].push(e):(this[Nu]=!0,this[t1].push(e),this[Xc]?this[K7]&&this[Uu]()(new ps("Aborted on iterator close()",{code:"LEVEL_ITERATOR_NOT_OPEN"})):this._close(this[e1])),e[sp]}_close(e){this.nextTick(e)}[e1](){this[n3]=!0,this.db.detachResource(this);let e=this[t1];this[t1]=[];for(let r of e)r()}async*[Symbol.asyncIterator](){try{let e;for(;(e=await this.next())!==void 0;)yield e}finally{this[n3]||await this.close()}}},ay=class extends r1{constructor(e,r){super(e,r,!0),this[Z7]=r.keys!==!1,this[Y7]=r.values!==!1}[ap](e,r,n){let i=this[Uu]();if(e)return i(e);try{r=this[Z7]&&r!==void 0?this[Lu].decode(r):void 0,n=this[Y7]&&n!==void 0?this[cp].decode(n):void 0}catch(o){return i(new Fu("entry",o))}r===void 0&&n===void 0||this[Ks]++,i(null,r,n)}[gf](e,r){let n=this[Uu]();if(e)return this[Qc](n,e);try{for(let i of r){let o=i[0],s=i[1];i[0]=this[Z7]&&o!==void 0?this[Lu].decode(o):void 0,i[1]=this[Y7]&&s!==void 0?this[cp].decode(s):void 0}}catch(i){return this[Qc](n,new Fu("entries",i))}this[Ks]+=r.length,this[Qc](n,null,r)}end(e){return!uX&&typeof console<"u"&&(uX=!0,console.warn(new ps("The iterator.end() method was renamed to close() and end() is an alias that will be removed in a future version",{code:"LEVEL_LEGACY"}))),this.close(e)}},J7=class extends r1{constructor(e,r){super(e,r,!1)}[ap](e,r){let n=this[Uu]();if(e)return n(e);try{r=r!==void 0?this[Lu].decode(r):void 0}catch(i){return n(new Fu("key",i))}r!==void 0&&this[Ks]++,n(null,r)}[gf](e,r){let n=this[Uu]();if(e)return this[Qc](n,e);try{for(let i=0;i<r.length;i++){let o=r[i];r[i]=o!==void 0?this[Lu].decode(o):void 0}}catch(i){return this[Qc](n,new Fu("keys",i))}this[Ks]+=r.length,this[Qc](n,null,r)}},X7=class extends r1{constructor(e,r){super(e,r,!1)}[ap](e,r){let n=this[Uu]();if(e)return n(e);try{r=r!==void 0?this[cp].decode(r):void 0}catch(i){return n(new Fu("value",i))}r!==void 0&&this[Ks]++,n(null,r)}[gf](e,r){let n=this[Uu]();if(e)return this[Qc](n,e);try{for(let i=0;i<r.length;i++){let o=r[i];r[i]=o!==void 0?this[cp].decode(o):void 0}}catch(i){return this[Qc](n,new Fu("values",i))}this[Ks]+=r.length,this[Qc](n,null,r)}},Fu=class extends ps{constructor(e,r){super(`Iterator could not decode ${e}`,{code:"LEVEL_DECODE_ERROR",cause:r})}};for(let t of["_ended property","_nexting property","_end method"])Object.defineProperty(ay.prototype,t.split(" ")[0],{get(){throw new ps(`The ${t} has been removed`,{code:"LEVEL_LEGACY"})},set(){throw new ps(`The ${t} has been removed`,{code:"LEVEL_LEGACY"})}});ay.keyEncoding=Lu;ay.valueEncoding=cp;s3.AbstractIterator=ay;s3.AbstractKeyIterator=J7;s3.AbstractValueIterator=X7});var lX=G(Q7=>{"use strict";p();var{AbstractKeyIterator:s5e,AbstractValueIterator:a5e}=zu(),dp=Symbol("iterator"),n1=Symbol("callback"),cy=Symbol("handleOne"),fp=Symbol("handleMany"),i1=class extends s5e{constructor(e,r){super(e,r),this[dp]=e.iterator({...r,keys:!0,values:!1}),this[cy]=this[cy].bind(this),this[fp]=this[fp].bind(this)}},a3=class extends a5e{constructor(e,r){super(e,r),this[dp]=e.iterator({...r,keys:!1,values:!0}),this[cy]=this[cy].bind(this),this[fp]=this[fp].bind(this)}};for(let t of[i1,a3]){let e=t===i1,r=e?n=>n[0]:n=>n[1];t.prototype._next=function(n){this[n1]=n,this[dp].next(this[cy])},t.prototype[cy]=function(n,i,o){let s=this[n1];n?s(n):s(null,e?i:o)},t.prototype._nextv=function(n,i,o){this[n1]=o,this[dp].nextv(n,i,this[fp])},t.prototype._all=function(n,i){this[n1]=i,this[dp].all(n,this[fp])},t.prototype[fp]=function(n,i){let o=this[n1];n?o(n):o(null,i.map(r))},t.prototype._seek=function(n,i){this[dp].seek(n,i)},t.prototype._close=function(n){this[dp].close(n)}}Q7.DefaultKeyIterator=i1;Q7.DefaultValueIterator=a3});var hX=G(h3=>{"use strict";p();var{AbstractIterator:c5e,AbstractKeyIterator:d5e,AbstractValueIterator:f5e}=zu(),eI=ja(),Lo=Symbol("nut"),u3=Symbol("undefer"),l3=Symbol("factory"),c3=class extends c5e{constructor(e,r){super(e,r),this[Lo]=null,this[l3]=()=>e.iterator(r),this.db.defer(()=>this[u3]())}},d3=class extends d5e{constructor(e,r){super(e,r),this[Lo]=null,this[l3]=()=>e.keys(r),this.db.defer(()=>this[u3]())}},f3=class extends f5e{constructor(e,r){super(e,r),this[Lo]=null,this[l3]=()=>e.values(r),this.db.defer(()=>this[u3]())}};for(let t of[c3,d3,f3])t.prototype[u3]=function(){this.db.status==="open"&&(this[Lo]=this[l3]())},t.prototype._next=function(e){this[Lo]!==null?this[Lo].next(e):this.db.status==="opening"?this.db.defer(()=>this._next(e)):this.nextTick(e,new eI("Iterator is not open: cannot call next() after close()",{code:"LEVEL_ITERATOR_NOT_OPEN"}))},t.prototype._nextv=function(e,r,n){this[Lo]!==null?this[Lo].nextv(e,r,n):this.db.status==="opening"?this.db.defer(()=>this._nextv(e,r,n)):this.nextTick(n,new eI("Iterator is not open: cannot call nextv() after close()",{code:"LEVEL_ITERATOR_NOT_OPEN"}))},t.prototype._all=function(e,r){this[Lo]!==null?this[Lo].all(r):this.db.status==="opening"?this.db.defer(()=>this._all(e,r)):this.nextTick(r,new eI("Iterator is not open: cannot call all() after close()",{code:"LEVEL_ITERATOR_NOT_OPEN"}))},t.prototype._seek=function(e,r){this[Lo]!==null?this[Lo]._seek(e,r):this.db.status==="opening"&&this.db.defer(()=>this._seek(e,r))},t.prototype._close=function(e){this[Lo]!==null?this[Lo].close(e):this.db.status==="opening"?this.db.defer(()=>this._close(e)):this.nextTick(e)};h3.DeferredIterator=c3;h3.DeferredKeyIterator=d3;h3.DeferredValueIterator=f3});var rI=G(mX=>{"use strict";p();var{fromCallback:pX}=Qv(),p3=ja(),{getCallback:u5e,getOptions:l5e}=r3(),m3=Symbol("promise"),Zs=Symbol("status"),dy=Symbol("operations"),o1=Symbol("finishClose"),fy=Symbol("closeCallbacks"),tI=class{constructor(e){if(typeof e!="object"||e===null){let r=e===null?"null":typeof e;throw new TypeError(`The first argument must be an abstract-level database, received ${r}`)}this[dy]=[],this[fy]=[],this[Zs]="open",this[o1]=this[o1].bind(this),this.db=e,this.db.attachResource(this),this.nextTick=e.nextTick}get length(){return this[dy].length}put(e,r,n){if(this[Zs]!=="open")throw new p3("Batch is not open: cannot call put() after write() or close()",{code:"LEVEL_BATCH_NOT_OPEN"});let i=this.db._checkKey(e)||this.db._checkValue(r);if(i)throw i;let o=n&&n.sublevel!=null?n.sublevel:this.db,s=n,a=o.keyEncoding(n&&n.keyEncoding),c=o.valueEncoding(n&&n.valueEncoding),d=a.format;n={...n,keyEncoding:d,valueEncoding:c.format},o!==this.db&&(n.sublevel=null);let f=o.prefixKey(a.encode(e),d),u=c.encode(r);return this._put(f,u,n),this[dy].push({...s,type:"put",key:e,value:r}),this}_put(e,r,n){}del(e,r){if(this[Zs]!=="open")throw new p3("Batch is not open: cannot call del() after write() or close()",{code:"LEVEL_BATCH_NOT_OPEN"});let n=this.db._checkKey(e);if(n)throw n;let i=r&&r.sublevel!=null?r.sublevel:this.db,o=r,s=i.keyEncoding(r&&r.keyEncoding),a=s.format;return r={...r,keyEncoding:a},i!==this.db&&(r.sublevel=null),this._del(i.prefixKey(s.encode(e),a),r),this[dy].push({...o,type:"del",key:e}),this}_del(e,r){}clear(){if(this[Zs]!=="open")throw new p3("Batch is not open: cannot call clear() after write() or close()",{code:"LEVEL_BATCH_NOT_OPEN"});return this._clear(),this[dy]=[],this}_clear(){}write(e,r){return r=u5e(e,r),r=pX(r,m3),e=l5e(e),this[Zs]!=="open"?this.nextTick(r,new p3("Batch is not open: cannot call write() after write() or close()",{code:"LEVEL_BATCH_NOT_OPEN"})):this.length===0?this.close(r):(this[Zs]="writing",this._write(e,n=>{this[Zs]="closing",this[fy].push(()=>r(n)),n||this.db.emit("batch",this[dy]),this._close(this[o1])})),r[m3]}_write(e,r){}close(e){return e=pX(e,m3),this[Zs]==="closing"?this[fy].push(e):this[Zs]==="closed"?this.nextTick(e):(this[fy].push(e),this[Zs]!=="writing"&&(this[Zs]="closing",this._close(this[o1]))),e[m3]}_close(e){this.nextTick(e)}[o1](){this[Zs]="closed",this.db.detachResource(this);let e=this[fy];this[fy]=[];for(let r of e)r()}};mX.AbstractChainedBatch=tI});var gX=G(yX=>{"use strict";p();var{AbstractChainedBatch:h5e}=rI(),p5e=ja(),uy=Symbol("encoded"),nI=class extends h5e{constructor(e){super(e),this[uy]=[]}_put(e,r,n){this[uy].push({...n,type:"put",key:e,value:r})}_del(e,r){this[uy].push({...r,type:"del",key:e})}_clear(){this[uy]=[]}_write(e,r){this.db.status==="opening"?this.db.defer(()=>this._write(e,r)):this.db.status==="open"?this[uy].length===0?this.nextTick(r):this.db._batch(this[uy],e,r):this.nextTick(r,new p5e("Batch is not open: cannot call write() after write() or close()",{code:"LEVEL_BATCH_NOT_OPEN"}))}};yX.DefaultChainedBatch=nI});var wX=G((VXe,vX)=>{"use strict";p();var bX=ja(),m5e=Object.prototype.hasOwnProperty,y5e=new Set(["lt","lte","gt","gte"]);vX.exports=function(t,e){let r={};for(let n in t)if(m5e.call(t,n)&&!(n==="keyEncoding"||n==="valueEncoding")){if(n==="start"||n==="end")throw new bX(`The legacy range option '${n}' has been removed`,{code:"LEVEL_LEGACY"});if(n==="encoding")throw new bX("The levelup-style 'encoding' alias has been removed, use 'valueEncoding' instead",{code:"LEVEL_LEGACY"});y5e.has(n)?r[n]=e.encode(t[n]):r[n]=t[n]}return r.reverse=!!r.reverse,r.limit=Number.isInteger(r.limit)&&r.limit>=0?r.limit:-1,r}});var iI=G((ZXe,xX)=>{p();var _X;xX.exports=typeof queueMicrotask=="function"?queueMicrotask.bind(typeof window<"u"?window:globalThis):t=>(_X||(_X=Promise.resolve())).then(t).catch(e=>setTimeout(()=>{throw e},0))});var AX=G((JXe,SX)=>{"use strict";p();var EX=iI();SX.exports=function(t,...e){e.length===0?EX(t):EX(()=>t(...e))}});var TX=G(y3=>{"use strict";p();var{AbstractIterator:g5e,AbstractKeyIterator:b5e,AbstractValueIterator:v5e}=zu(),ly=Symbol("unfix"),Na=Symbol("iterator"),up=Symbol("handleOne"),$u=Symbol("handleMany"),bf=Symbol("callback"),s1=class extends g5e{constructor(e,r,n,i){super(e,r),this[Na]=n,this[ly]=i,this[up]=this[up].bind(this),this[$u]=this[$u].bind(this),this[bf]=null}[up](e,r,n){let i=this[bf];if(e)return i(e);r!==void 0&&(r=this[ly](r)),i(e,r,n)}[$u](e,r){let n=this[bf];if(e)return n(e);for(let i of r){let o=i[0];o!==void 0&&(i[0]=this[ly](o))}n(e,r)}},a1=class extends b5e{constructor(e,r,n,i){super(e,r),this[Na]=n,this[ly]=i,this[up]=this[up].bind(this),this[$u]=this[$u].bind(this),this[bf]=null}[up](e,r){let n=this[bf];if(e)return n(e);r!==void 0&&(r=this[ly](r)),n(e,r)}[$u](e,r){let n=this[bf];if(e)return n(e);for(let i=0;i<r.length;i++){let o=r[i];o!==void 0&&(r[i]=this[ly](o))}n(e,r)}},c1=class extends v5e{constructor(e,r,n){super(e,r),this[Na]=n}};for(let t of[s1,a1])t.prototype._next=function(e){this[bf]=e,this[Na].next(this[up])},t.prototype._nextv=function(e,r,n){this[bf]=n,this[Na].nextv(e,r,this[$u])},t.prototype._all=function(e,r){this[bf]=r,this[Na].all(e,this[$u])};for(let t of[c1])t.prototype._next=function(e){this[Na].next(e)},t.prototype._nextv=function(e,r,n){this[Na].nextv(e,r,n)},t.prototype._all=function(e,r){this[Na].all(e,r)};for(let t of[s1,a1,c1])t.prototype._seek=function(e,r){this[Na].seek(e,r)},t.prototype._close=function(e){this[Na].close(e)};y3.AbstractSublevelIterator=s1;y3.AbstractSublevelKeyIterator=a1;y3.AbstractSublevelValueIterator=c1});var MX=G((tQe,RX)=>{"use strict";p();var oI=ja(),{Buffer:cI}=jr()||{},{AbstractSublevelIterator:w5e,AbstractSublevelKeyIterator:_5e,AbstractSublevelValueIterator:x5e}=TX(),vf=Symbol("prefix"),PX=Symbol("upperBound"),d1=Symbol("prefixRange"),ms=Symbol("parent"),sI=Symbol("unfix"),IX=new TextEncoder,E5e={separator:"!"};RX.exports=function({AbstractLevel:t}){class e extends t{static defaults(n){if(typeof n=="string")throw new oI("The subleveldown string shorthand for { separator } has been removed",{code:"LEVEL_LEGACY"});if(n&&n.open)throw new oI("The subleveldown open option has been removed",{code:"LEVEL_LEGACY"});return n==null?E5e:n.separator?n:{...n,separator:"!"}}constructor(n,i,o){let{separator:s,manifest:a,...c}=e.defaults(o);i=A5e(i,s);let d=s.charCodeAt(0)+1,f=n[ms]||n;if(!IX.encode(i).every(_=>_>d&&_<127))throw new oI(`Prefix must use bytes > ${d} < ${127}`,{code:"LEVEL_INVALID_PREFIX"});super(S5e(f,a),c);let u=(n.prefix||"")+s+i+s,m=u.slice(0,-1)+String.fromCharCode(d);this[ms]=f,this[vf]=new g3(u),this[PX]=new g3(m),this[sI]=new dI,this.nextTick=f.nextTick}prefixKey(n,i){if(i==="utf8")return this[vf].utf8+n;if(n.byteLength===0)return this[vf][i];if(i==="view"){let o=this[vf].view,s=new Uint8Array(o.byteLength+n.byteLength);return s.set(o,0),s.set(n,o.byteLength),s}else{let o=this[vf].buffer;return cI.concat([o,n],o.byteLength+n.byteLength)}}[d1](n,i){n.gte!==void 0?n.gte=this.prefixKey(n.gte,i):n.gt!==void 0?n.gt=this.prefixKey(n.gt,i):n.gte=this[vf][i],n.lte!==void 0?n.lte=this.prefixKey(n.lte,i):n.lt!==void 0?n.lt=this.prefixKey(n.lt,i):n.lte=this[PX][i]}get prefix(){return this[vf].utf8}get db(){return this[ms]}_open(n,i){this[ms].open({passive:!0},i)}_put(n,i,o,s){this[ms].put(n,i,o,s)}_get(n,i,o){this[ms].get(n,i,o)}_getMany(n,i,o){this[ms].getMany(n,i,o)}_del(n,i,o){this[ms].del(n,i,o)}_batch(n,i,o){this[ms].batch(n,i,o)}_clear(n,i){this[d1](n,n.keyEncoding),this[ms].clear(n,i)}_iterator(n){this[d1](n,n.keyEncoding);let i=this[ms].iterator(n),o=this[sI].get(this[vf].utf8.length,n.keyEncoding);return new w5e(this,n,i,o)}_keys(n){this[d1](n,n.keyEncoding);let i=this[ms].keys(n),o=this[sI].get(this[vf].utf8.length,n.keyEncoding);return new _5e(this,n,i,o)}_values(n){this[d1](n,n.keyEncoding);let i=this[ms].values(n);return new x5e(this,n,i)}}return{AbstractSublevel:e}};var S5e=function(t,e){return{...t.supports,createIfMissing:!1,errorIfExists:!1,events:{},additionalMethods:{},...e,encodings:{utf8:aI(t,"utf8"),buffer:aI(t,"buffer"),view:aI(t,"view")}}},aI=function(t,e){return t.supports.encodings[e]?t.keyEncoding(e).name===e:!1},g3=class{constructor(e){this.utf8=e,this.view=IX.encode(e),this.buffer=cI?cI.from(this.view.buffer,0,this.view.byteLength):{}}},dI=class{constructor(){this.cache=new Map}get(e,r){let n=this.cache.get(r);return n===void 0&&(r==="view"?n=function(i,o){return o.subarray(i)}.bind(null,e):n=function(i,o){return o.slice(i)}.bind(null,e),this.cache.set(r,n)),n}},A5e=function(t,e){let r=0,n=t.length;for(;r<n&&t[r]===e;)r++;for(;n>r&&t[n-1]===e;)n--;return t.slice(r,n)}});var pI=G(hI=>{"use strict";p();var{supports:T5e}=YJ(),{Transcoder:P5e}=sX(),{EventEmitter:I5e}=nc(),{fromCallback:Gu}=Qv(),qa=ja(),{AbstractIterator:lp}=zu(),{DefaultKeyIterator:R5e,DefaultValueIterator:M5e}=lX(),{DeferredIterator:k5e,DeferredKeyIterator:B5e,DeferredValueIterator:D5e}=hX(),{DefaultChainedBatch:kX}=gX(),{getCallback:hp,getOptions:Hu}=r3(),b3=wX(),Nt=Symbol("promise"),wf=Symbol("landed"),pp=Symbol("resources"),fI=Symbol("closeResources"),f1=Symbol("operations"),u1=Symbol("undefer"),v3=Symbol("deferOpen"),BX=Symbol("options"),Yt=Symbol("status"),mp=Symbol("defaultOptions"),hy=Symbol("transcoder"),w3=Symbol("keyEncoding"),uI=Symbol("valueEncoding"),C5e=()=>{},l1=class extends I5e{constructor(e,r){if(super(),typeof e!="object"||e===null)throw new TypeError("The first argument 'manifest' must be an object");r=Hu(r);let{keyEncoding:n,valueEncoding:i,passive:o,...s}=r;this[pp]=new Set,this[f1]=[],this[v3]=!0,this[BX]=s,this[Yt]="opening",this.supports=T5e(e,{status:!0,promises:!0,clear:!0,getMany:!0,deferredOpen:!0,snapshots:e.snapshots!==!1,permanence:e.permanence!==!1,keyIterator:!0,valueIterator:!0,iteratorNextv:!0,iteratorAll:!0,encodings:e.encodings||{},events:Object.assign({},e.events,{opening:!0,open:!0,closing:!0,closed:!0,put:!0,del:!0,batch:!0,clear:!0})}),this[hy]=new P5e(O5e(this)),this[w3]=this[hy].encoding(n||"utf8"),this[uI]=this[hy].encoding(i||"utf8");for(let a of this[hy].encodings())this.supports.encodings[a.commonName]||(this.supports.encodings[a.commonName]=!0);this[mp]={empty:Object.freeze({}),entry:Object.freeze({keyEncoding:this[w3].commonName,valueEncoding:this[uI].commonName}),key:Object.freeze({keyEncoding:this[w3].commonName})},this.nextTick(()=>{this[v3]&&this.open({passive:!1},C5e)})}get status(){return this[Yt]}keyEncoding(e){return this[hy].encoding(e??this[w3])}valueEncoding(e){return this[hy].encoding(e??this[uI])}open(e,r){r=hp(e,r),r=Gu(r,Nt),e={...this[BX],...Hu(e)},e.createIfMissing=e.createIfMissing!==!1,e.errorIfExists=!!e.errorIfExists;let n=i=>{this[Yt]==="closing"||this[Yt]==="opening"?this.once(wf,i?()=>n(i):n):this[Yt]!=="open"?r(new qa("Database is not open",{code:"LEVEL_DATABASE_NOT_OPEN",cause:i})):r()};return e.passive?this[Yt]==="opening"?this.once(wf,n):this.nextTick(n):this[Yt]==="closed"||this[v3]?(this[v3]=!1,this[Yt]="opening",this.emit("opening"),this._open(e,i=>{if(i){this[Yt]="closed",this[fI](()=>{this.emit(wf),n(i)}),this[u1]();return}this[Yt]="open",this[u1](),this.emit(wf),this[Yt]==="open"&&this.emit("open"),this[Yt]==="open"&&this.emit("ready"),n()})):this[Yt]==="open"?this.nextTick(n):this.once(wf,()=>this.open(e,r)),r[Nt]}_open(e,r){this.nextTick(r)}close(e){e=Gu(e,Nt);let r=n=>{this[Yt]==="opening"||this[Yt]==="closing"?this.once(wf,n?r(n):r):this[Yt]!=="closed"?e(new qa("Database is not closed",{code:"LEVEL_DATABASE_NOT_CLOSED",cause:n})):e()};if(this[Yt]==="open"){this[Yt]="closing",this.emit("closing");let n=i=>{this[Yt]="open",this[u1](),this.emit(wf),r(i)};this[fI](()=>{this._close(i=>{if(i)return n(i);this[Yt]="closed",this[u1](),this.emit(wf),this[Yt]==="closed"&&this.emit("closed"),r()})})}else this[Yt]==="closed"?this.nextTick(r):this.once(wf,()=>this.close(e));return e[Nt]}[fI](e){if(this[pp].size===0)return this.nextTick(e);let r=this[pp].size,n=!0,i=()=>{--r===0&&(n?this.nextTick(e):e())};for(let o of this[pp])o.close(i);n=!1,this[pp].clear()}_close(e){this.nextTick(e)}get(e,r,n){if(n=hp(r,n),n=Gu(n,Nt),r=Hu(r,this[mp].entry),this[Yt]==="opening")return this.defer(()=>this.get(e,r,n)),n[Nt];if(py(this,n))return n[Nt];let i=this._checkKey(e);if(i)return this.nextTick(n,i),n[Nt];let o=this.keyEncoding(r.keyEncoding),s=this.valueEncoding(r.valueEncoding),a=o.format,c=s.format;return(r.keyEncoding!==a||r.valueEncoding!==c)&&(r=Object.assign({},r,{keyEncoding:a,valueEncoding:c})),this._get(this.prefixKey(o.encode(e),a),r,(d,f)=>{if(d)return(d.code==="LEVEL_NOT_FOUND"||d.notFound||/NotFound/i.test(d))&&(d.code||(d.code="LEVEL_NOT_FOUND"),d.notFound||(d.notFound=!0),d.status||(d.status=404)),n(d);try{f=s.decode(f)}catch(u){return n(new qa("Could not decode value",{code:"LEVEL_DECODE_ERROR",cause:u}))}n(null,f)}),n[Nt]}_get(e,r,n){this.nextTick(n,new Error("NotFound"))}getMany(e,r,n){if(n=hp(r,n),n=Gu(n,Nt),r=Hu(r,this[mp].entry),this[Yt]==="opening")return this.defer(()=>this.getMany(e,r,n)),n[Nt];if(py(this,n))return n[Nt];if(!Array.isArray(e))return this.nextTick(n,new TypeError("The first argument 'keys' must be an array")),n[Nt];if(e.length===0)return this.nextTick(n,null,[]),n[Nt];let i=this.keyEncoding(r.keyEncoding),o=this.valueEncoding(r.valueEncoding),s=i.format,a=o.format;(r.keyEncoding!==s||r.valueEncoding!==a)&&(r=Object.assign({},r,{keyEncoding:s,valueEncoding:a}));let c=new Array(e.length);for(let d=0;d<e.length;d++){let f=e[d],u=this._checkKey(f);if(u)return this.nextTick(n,u),n[Nt];c[d]=this.prefixKey(i.encode(f),s)}return this._getMany(c,r,(d,f)=>{if(d)return n(d);try{for(let u=0;u<f.length;u++)f[u]!==void 0&&(f[u]=o.decode(f[u]))}catch(u){return n(new qa(`Could not decode one or more of ${f.length} value(s)`,{code:"LEVEL_DECODE_ERROR",cause:u}))}n(null,f)}),n[Nt]}_getMany(e,r,n){this.nextTick(n,null,new Array(e.length).fill(void 0))}put(e,r,n,i){if(i=hp(n,i),i=Gu(i,Nt),n=Hu(n,this[mp].entry),this[Yt]==="opening")return this.defer(()=>this.put(e,r,n,i)),i[Nt];if(py(this,i))return i[Nt];let o=this._checkKey(e)||this._checkValue(r);if(o)return this.nextTick(i,o),i[Nt];let s=this.keyEncoding(n.keyEncoding),a=this.valueEncoding(n.valueEncoding),c=s.format,d=a.format;(n.keyEncoding!==c||n.valueEncoding!==d)&&(n=Object.assign({},n,{keyEncoding:c,valueEncoding:d}));let f=this.prefixKey(s.encode(e),c),u=a.encode(r);return this._put(f,u,n,m=>{if(m)return i(m);this.emit("put",e,r),i()}),i[Nt]}_put(e,r,n,i){this.nextTick(i)}del(e,r,n){if(n=hp(r,n),n=Gu(n,Nt),r=Hu(r,this[mp].key),this[Yt]==="opening")return this.defer(()=>this.del(e,r,n)),n[Nt];if(py(this,n))return n[Nt];let i=this._checkKey(e);if(i)return this.nextTick(n,i),n[Nt];let o=this.keyEncoding(r.keyEncoding),s=o.format;return r.keyEncoding!==s&&(r=Object.assign({},r,{keyEncoding:s})),this._del(this.prefixKey(o.encode(e),s),r,a=>{if(a)return n(a);this.emit("del",e),n()}),n[Nt]}_del(e,r,n){this.nextTick(n)}batch(e,r,n){if(!arguments.length){if(this[Yt]==="opening")return new kX(this);if(this[Yt]!=="open")throw new qa("Database is not open",{code:"LEVEL_DATABASE_NOT_OPEN"});return this._chainedBatch()}if(typeof e=="function"?n=e:n=hp(r,n),n=Gu(n,Nt),r=Hu(r,this[mp].empty),this[Yt]==="opening")return this.defer(()=>this.batch(e,r,n)),n[Nt];if(py(this,n))return n[Nt];if(!Array.isArray(e))return this.nextTick(n,new TypeError("The first argument 'operations' must be an array")),n[Nt];if(e.length===0)return this.nextTick(n),n[Nt];let i=new Array(e.length),{keyEncoding:o,valueEncoding:s,...a}=r;for(let c=0;c<e.length;c++){if(typeof e[c]!="object"||e[c]===null)return this.nextTick(n,new TypeError("A batch operation must be an object")),n[Nt];let d=Object.assign({},e[c]);if(d.type!=="put"&&d.type!=="del")return this.nextTick(n,new TypeError("A batch operation must have a type property that is 'put' or 'del'")),n[Nt];let f=this._checkKey(d.key);if(f)return this.nextTick(n,f),n[Nt];let u=d.sublevel!=null?d.sublevel:this,m=u.keyEncoding(d.keyEncoding||o),_=m.format;if(d.key=u.prefixKey(m.encode(d.key),_),d.keyEncoding=_,d.type==="put"){let v=this._checkValue(d.value);if(v)return this.nextTick(n,v),n[Nt];let A=u.valueEncoding(d.valueEncoding||s);d.value=A.encode(d.value),d.valueEncoding=A.format}u!==this&&(d.sublevel=null),i[c]=d}return this._batch(i,a,c=>{if(c)return n(c);this.emit("batch",e),n()}),n[Nt]}_batch(e,r,n){this.nextTick(n)}sublevel(e,r){return this._sublevel(e,lI.defaults(r))}_sublevel(e,r){return new lI(this,e,r)}prefixKey(e,r){return e}clear(e,r){if(r=hp(e,r),r=Gu(r,Nt),e=Hu(e,this[mp].empty),this[Yt]==="opening")return this.defer(()=>this.clear(e,r)),r[Nt];if(py(this,r))return r[Nt];let n=e,i=this.keyEncoding(e.keyEncoding);return e=b3(e,i),e.keyEncoding=i.format,e.limit===0?this.nextTick(r):this._clear(e,o=>{if(o)return r(o);this.emit("clear",n),r()}),r[Nt]}_clear(e,r){this.nextTick(r)}iterator(e){let r=this.keyEncoding(e&&e.keyEncoding),n=this.valueEncoding(e&&e.valueEncoding);if(e=b3(e,r),e.keys=e.keys!==!1,e.values=e.values!==!1,e[lp.keyEncoding]=r,e[lp.valueEncoding]=n,e.keyEncoding=r.format,e.valueEncoding=n.format,this[Yt]==="opening")return new k5e(this,e);if(this[Yt]!=="open")throw new qa("Database is not open",{code:"LEVEL_DATABASE_NOT_OPEN"});return this._iterator(e)}_iterator(e){return new lp(this,e)}keys(e){let r=this.keyEncoding(e&&e.keyEncoding),n=this.valueEncoding(e&&e.valueEncoding);if(e=b3(e,r),e[lp.keyEncoding]=r,e[lp.valueEncoding]=n,e.keyEncoding=r.format,e.valueEncoding=n.format,this[Yt]==="opening")return new B5e(this,e);if(this[Yt]!=="open")throw new qa("Database is not open",{code:"LEVEL_DATABASE_NOT_OPEN"});return this._keys(e)}_keys(e){return new R5e(this,e)}values(e){let r=this.keyEncoding(e&&e.keyEncoding),n=this.valueEncoding(e&&e.valueEncoding);if(e=b3(e,r),e[lp.keyEncoding]=r,e[lp.valueEncoding]=n,e.keyEncoding=r.format,e.valueEncoding=n.format,this[Yt]==="opening")return new D5e(this,e);if(this[Yt]!=="open")throw new qa("Database is not open",{code:"LEVEL_DATABASE_NOT_OPEN"});return this._values(e)}_values(e){return new M5e(this,e)}defer(e){if(typeof e!="function")throw new TypeError("The first argument must be a function");this[f1].push(e)}[u1](){if(this[f1].length===0)return;let e=this[f1];this[f1]=[];for(let r of e)r()}attachResource(e){if(typeof e!="object"||e===null||typeof e.close!="function")throw new TypeError("The first argument must be a resource object");this[pp].add(e)}detachResource(e){this[pp].delete(e)}_chainedBatch(){return new kX(this)}_checkKey(e){if(e==null)return new qa("Key cannot be null or undefined",{code:"LEVEL_INVALID_KEY"})}_checkValue(e){if(e==null)return new qa("Value cannot be null or undefined",{code:"LEVEL_INVALID_VALUE"})}};l1.prototype.nextTick=AX();var{AbstractSublevel:lI}=MX()({AbstractLevel:l1});hI.AbstractLevel=l1;hI.AbstractSublevel=lI;var py=function(t,e){return t[Yt]!=="open"?(t.nextTick(e,new qa("Database is not open",{code:"LEVEL_DATABASE_NOT_OPEN"})),!0):!1},O5e=function(t){return Object.keys(t.supports.encodings).filter(e=>!!t.supports.encodings[e])}});var mI=G(yp=>{"use strict";p();yp.AbstractLevel=pI().AbstractLevel;yp.AbstractSublevel=pI().AbstractSublevel;yp.AbstractIterator=zu().AbstractIterator;yp.AbstractKeyIterator=zu().AbstractKeyIterator;yp.AbstractValueIterator=zu().AbstractValueIterator;yp.AbstractChainedBatch=rI().AbstractChainedBatch});var CX=G((aQe,DX)=>{p();DX.exports=N5e;var j5e=iI();function N5e(t,e,r){if(typeof e!="number")throw new Error("second argument must be a Number");let n,i,o,s,a,c=!0,d;Array.isArray(t)?(n=[],o=i=t.length):(s=Object.keys(t),n={},o=i=s.length);function f(m){function _(){r&&r(m,n),r=null}c?j5e(_):_()}function u(m,_,v){if(n[m]=v,_&&(a=!0),--o===0||_)f(_);else if(!a&&d<i){let A;s?(A=s[d],d+=1,t[A](function(T,M){u(A,T,M)})):(A=d,d+=1,t[A](function(T,M){u(A,T,M)}))}}d=e,o?s?s.some(function(m,_){return t[m](function(v,A){u(m,v,A)}),_===e-1}):t.some(function(m,_){return m(function(v,A){u(_,v,A)}),_===e-1}):f(null),c=!1}});var yI=G((dQe,OX)=>{"use strict";p();OX.exports=function(e){let r=e.gte!==void 0?e.gte:e.gt!==void 0?e.gt:void 0,n=e.lte!==void 0?e.lte:e.lt!==void 0?e.lt:void 0,i=e.gte===void 0,o=e.lte===void 0;return r!==void 0&&n!==void 0?IDBKeyRange.bound(r,n,i,o):r!==void 0?IDBKeyRange.lowerBound(r,i):n!==void 0?IDBKeyRange.upperBound(n,o):null}});var gI=G((uQe,jX)=>{"use strict";p();var q5e=new TextEncoder;jX.exports=function(t){return t instanceof Uint8Array?t:t instanceof ArrayBuffer?new Uint8Array(t):q5e.encode(t)}});var FX=G(UX=>{"use strict";p();var{AbstractIterator:L5e}=mI(),NX=yI(),_3=gI(),ed=Symbol("cache"),_f=Symbol("finished"),ys=Symbol("options"),xf=Symbol("currentOptions"),gp=Symbol("position"),bI=Symbol("location"),my=Symbol("first"),qX={},vI=class extends L5e{constructor(e,r,n){super(e,n),this[ed]=[],this[_f]=this.limit===0,this[ys]=n,this[xf]={...n},this[gp]=void 0,this[bI]=r,this[my]=!0}_nextv(e,r,n){if(this[my]=!1,this[_f])return this.nextTick(n,null,[]);if(this[ed].length>0)return e=Math.min(e,this[ed].length),this.nextTick(n,null,this[ed].splice(0,e));this[gp]!==void 0&&(this[ys].reverse?(this[xf].lt=this[gp],this[xf].lte=void 0):(this[xf].gt=this[gp],this[xf].gte=void 0));let i;try{i=NX(this[xf])}catch{return this[_f]=!0,this.nextTick(n,null,[])}let o=this.db.db.transaction([this[bI]],"readonly"),s=o.objectStore(this[bI]),a=[];if(this[ys].reverse){let c=!this[ys].values&&s.openKeyCursor?"openKeyCursor":"openCursor";s[c](i,"prev").onsuccess=d=>{let f=d.target.result;if(f){let{key:u,value:m}=f;this[gp]=u,a.push([this[ys].keys&&u!==void 0?_3(u):void 0,this[ys].values&&m!==void 0?_3(m):void 0]),a.length<e?f.continue():LX(o)}else this[_f]=!0}}else{let c,d,f=()=>{if(c===void 0||d===void 0)return;let u=Math.max(c.length,d.length);u===0||e===1/0?this[_f]=!0:this[gp]=c[u-1],a.length=u;for(let m=0;m<u;m++){let _=c[m],v=d[m];a[m]=[this[ys].keys&&_!==void 0?_3(_):void 0,this[ys].values&&v!==void 0?_3(v):void 0]}LX(o)};this[ys].keys||e<1/0?s.getAllKeys(i,e<1/0?e:void 0).onsuccess=u=>{c=u.target.result,f()}:(c=[],this.nextTick(f)),this[ys].values?s.getAll(i,e<1/0?e:void 0).onsuccess=u=>{d=u.target.result,f()}:(d=[],this.nextTick(f))}o.onabort=()=>{n(o.error||new Error("aborted by user")),n=null},o.oncomplete=()=>{n(null,a),n=null}}_next(e){if(this[ed].length>0){let[r,n]=this[ed].shift();this.nextTick(e,null,r,n)}else if(this[_f])this.nextTick(e);else{let r=Math.min(100,this.limit-this.count);this[my]&&(this[my]=!1,r=1),this._nextv(r,qX,(n,i)=>{if(n)return e(n);this[ed]=i,this._next(e)})}}_all(e,r){this[my]=!1;let n=this[ed].splice(0,this[ed].length),i=this.limit-this.count-n.length;if(i<=0)return this.nextTick(r,null,n);this._nextv(i,qX,(o,s)=>{if(o)return r(o);n.length>0&&(s=n.concat(s)),r(null,s)})}_seek(e,r){this[my]=!0,this[ed]=[],this[_f]=!1,this[gp]=void 0,this[xf]={...this[ys]};let n;try{n=NX(this[ys])}catch{this[_f]=!0;return}n!==null&&!n.includes(e)?this[_f]=!0:this[ys].reverse?this[xf].lte=e:this[xf].gte=e}};UX.Iterator=vI;function LX(t){typeof t.commit=="function"&&t.commit()}});var $X=G((mQe,zX)=>{"use strict";p();zX.exports=function(e,r,n,i,o){if(i.limit===0)return e.nextTick(o);let s=e.db.transaction([r],"readwrite"),a=s.objectStore(r),c=0;s.oncomplete=function(){o()},s.onabort=function(){o(s.error||new Error("aborted by user"))};let d=a.openKeyCursor?"openKeyCursor":"openCursor",f=i.reverse?"prev":"next";a[d](n,f).onsuccess=function(u){let m=u.target.result;m&&(a.delete(m.key).onsuccess=function(){(i.limit<=0||++c<i.limit)&&m.continue()})}}});var ZX=G(KX=>{"use strict";p();var{AbstractLevel:U5e}=mI(),GX=ja(),F5e=CX(),{fromCallback:z5e}=Qv(),{Iterator:$5e}=FX(),HX=gI(),G5e=$X(),H5e=yI(),VX="level-js-",h1=Symbol("idb"),wI=Symbol("namePrefix"),Ef=Symbol("location"),_I=Symbol("version"),bp=Symbol("store"),p1=Symbol("onComplete"),WX=Symbol("promise"),x3=class extends U5e{constructor(e,r,n){if(typeof r=="function"||typeof n=="function")throw new GX("The levelup-style callback argument has been removed",{code:"LEVEL_LEGACY"});let{prefix:i,version:o,...s}=r||{};if(super({encodings:{view:!0},snapshots:!1,createIfMissing:!1,errorIfExists:!1,seek:!0},s),typeof e!="string")throw new Error("constructor requires a location string argument");this[Ef]=e,this[wI]=i??VX,this[_I]=parseInt(o||1,10),this[h1]=null}get location(){return this[Ef]}get namePrefix(){return this[wI]}get version(){return this[_I]}get db(){return this[h1]}get type(){return"browser-level"}_open(e,r){let n=indexedDB.open(this[wI]+this[Ef],this[_I]);n.onerror=function(){r(n.error||new Error("unknown error"))},n.onsuccess=()=>{this[h1]=n.result,r()},n.onupgradeneeded=i=>{let o=i.target.result;o.objectStoreNames.contains(this[Ef])||o.createObjectStore(this[Ef])}}[bp](e){return this[h1].transaction([this[Ef]],e).objectStore(this[Ef])}[p1](e,r){let n=e.transaction;n.onabort=function(){r(n.error||new Error("aborted by user"))},n.oncomplete=function(){r(null,e.result)}}_get(e,r,n){let i=this[bp]("readonly"),o;try{o=i.get(e)}catch(s){return this.nextTick(n,s)}this[p1](o,function(s,a){if(s)return n(s);if(a===void 0)return n(new GX("Entry not found",{code:"LEVEL_NOT_FOUND"}));n(null,HX(a))})}_getMany(e,r,n){let i=this[bp]("readonly"),o=e.map(s=>a=>{let c;try{c=i.get(s)}catch(d){return a(d)}c.onsuccess=()=>{let d=c.result;a(null,d===void 0?d:HX(d))},c.onerror=d=>{d.stopPropagation(),a(c.error)}});F5e(o,16,n)}_del(e,r,n){let i=this[bp]("readwrite"),o;try{o=i.delete(e)}catch(s){return this.nextTick(n,s)}this[p1](o,n)}_put(e,r,n,i){let o=this[bp]("readwrite"),s;try{s=o.put(r,e)}catch(a){return this.nextTick(i,a)}this[p1](s,i)}_iterator(e){return new $5e(this,this[Ef],e)}_batch(e,r,n){let i=this[bp]("readwrite"),o=i.transaction,s=0,a;o.onabort=function(){n(a||o.error||new Error("aborted by user"))},o.oncomplete=function(){n()};function c(){let d=e[s++],f=d.key,u;try{u=d.type==="del"?i.delete(f):i.put(d.value,f)}catch(m){a=m,o.abort();return}s<e.length?u.onsuccess=c:typeof o.commit=="function"&&o.commit()}c()}_clear(e,r){let n,i;try{n=H5e(e)}catch{return this.nextTick(r)}if(e.limit>=0)return G5e(this,this[Ef],n,e,r);try{let o=this[bp]("readwrite");i=n?o.delete(n):o.clear()}catch(o){return this.nextTick(r,o)}this[p1](i,r)}_close(e){this[h1].close(),this.nextTick(e)}};x3.destroy=function(t,e,r){typeof e=="function"&&(r=e,e=VX),r=z5e(r,WX);let n=indexedDB.deleteDatabase(e+t);return n.onsuccess=function(){r()},n.onerror=function(i){r(i)},r[WX]};KX.BrowserLevel=x3});var JX=G(YX=>{p();YX.Level=ZX().BrowserLevel});var zee=G((snt,zI)=>{"use strict";p();var kAe=Object.prototype.hasOwnProperty,_o="~";function P1(){}Object.create&&(P1.prototype=Object.create(null),new P1().__proto__||(_o=!1));function BAe(t,e,r){this.fn=t,this.context=e,this.once=r||!1}function Fee(t,e,r,n,i){if(typeof r!="function")throw new TypeError("The listener must be a function");var o=new BAe(r,n||t,i),s=_o?_o+e:e;return t._events[s]?t._events[s].fn?t._events[s]=[t._events[s],o]:t._events[s].push(o):(t._events[s]=o,t._eventsCount++),t}function z3(t,e){--t._eventsCount===0?t._events=new P1:delete t._events[e]}function Ji(){this._events=new P1,this._eventsCount=0}Ji.prototype.eventNames=function(){var e=[],r,n;if(this._eventsCount===0)return e;for(n in r=this._events)kAe.call(r,n)&&e.push(_o?n.slice(1):n);return Object.getOwnPropertySymbols?e.concat(Object.getOwnPropertySymbols(r)):e};Ji.prototype.listeners=function(e){var r=_o?_o+e:e,n=this._events[r];if(!n)return[];if(n.fn)return[n.fn];for(var i=0,o=n.length,s=new Array(o);i<o;i++)s[i]=n[i].fn;return s};Ji.prototype.listenerCount=function(e){var r=_o?_o+e:e,n=this._events[r];return n?n.fn?1:n.length:0};Ji.prototype.emit=function(e,r,n,i,o,s){var a=_o?_o+e:e;if(!this._events[a])return!1;var c=this._events[a],d=arguments.length,f,u;if(c.fn){switch(c.once&&this.removeListener(e,c.fn,void 0,!0),d){case 1:return c.fn.call(c.context),!0;case 2:return c.fn.call(c.context,r),!0;case 3:return c.fn.call(c.context,r,n),!0;case 4:return c.fn.call(c.context,r,n,i),!0;case 5:return c.fn.call(c.context,r,n,i,o),!0;case 6:return c.fn.call(c.context,r,n,i,o,s),!0}for(u=1,f=new Array(d-1);u<d;u++)f[u-1]=arguments[u];c.fn.apply(c.context,f)}else{var m=c.length,_;for(u=0;u<m;u++)switch(c[u].once&&this.removeListener(e,c[u].fn,void 0,!0),d){case 1:c[u].fn.call(c[u].context);break;case 2:c[u].fn.call(c[u].context,r);break;case 3:c[u].fn.call(c[u].context,r,n);break;case 4:c[u].fn.call(c[u].context,r,n,i);break;default:if(!f)for(_=1,f=new Array(d-1);_<d;_++)f[_-1]=arguments[_];c[u].fn.apply(c[u].context,f)}}return!0};Ji.prototype.on=function(e,r,n){return Fee(this,e,r,n,!1)};Ji.prototype.once=function(e,r,n){return Fee(this,e,r,n,!0)};Ji.prototype.removeListener=function(e,r,n,i){var o=_o?_o+e:e;if(!this._events[o])return this;if(!r)return z3(this,o),this;var s=this._events[o];if(s.fn)s.fn===r&&(!i||s.once)&&(!n||s.context===n)&&z3(this,o);else{for(var a=0,c=[],d=s.length;a<d;a++)(s[a].fn!==r||i&&!s[a].once||n&&s[a].context!==n)&&c.push(s[a]);c.length?this._events[o]=c.length===1?c[0]:c:z3(this,o)}return this};Ji.prototype.removeAllListeners=function(e){var r;return e?(r=_o?_o+e:e,this._events[r]&&z3(this,r)):(this._events=new P1,this._eventsCount=0),this};Ji.prototype.off=Ji.prototype.removeListener;Ji.prototype.addListener=Ji.prototype.on;Ji.prefixed=_o;Ji.EventEmitter=Ji;typeof zI<"u"&&(zI.exports=Ji)});p();p();var Yy=class{async isTenant(e){return!0}};p();var Up={};dr(Up,{code:()=>ow,decode:()=>Dne,encode:()=>Bne,name:()=>kne});p();p();p();p();var hre=["string","number","bigint","symbol"],pre=["Function","Generator","AsyncGenerator","GeneratorFunction","AsyncGeneratorFunction","AsyncFunction","Observable","Array","Buffer","Object","RegExp","Date","Error","Map","Set","WeakMap","WeakSet","ArrayBuffer","SharedArrayBuffer","DataView","Promise","URL","HTMLElement","Int8Array","Uint8Array","Uint8ClampedArray","Int16Array","Uint16Array","Int32Array","Uint32Array","Float32Array","Float64Array","BigInt64Array","BigUint64Array"];function BR(t){if(t===null)return"null";if(t===void 0)return"undefined";if(t===!0||t===!1)return"boolean";let e=typeof t;if(hre.includes(e))return e;if(e==="function")return"Function";if(Array.isArray(t))return"Array";if(mre(t))return"Buffer";let r=yre(t);return r||"Object"}function mre(t){return t&&t.constructor&&t.constructor.isBuffer&&t.constructor.isBuffer.call(null,t)}function yre(t){let e=Object.prototype.toString.call(t).slice(8,-1);if(pre.includes(e))return e}p();var te=class{constructor(e,r,n){this.major=e,this.majorEncoded=e<<5,this.name=r,this.terminal=n}toString(){return`Type[${this.major}].${this.name}`}compare(e){return this.major<e.major?-1:this.major>e.major?1:0}};te.uint=new te(0,"uint",!0);te.negint=new te(1,"negint",!0);te.bytes=new te(2,"bytes",!0);te.string=new te(3,"string",!0);te.array=new te(4,"array",!1);te.map=new te(5,"map",!1);te.tag=new te(6,"tag",!1);te.float=new te(7,"float",!0);te.false=new te(7,"false",!0);te.true=new te(7,"true",!0);te.null=new te(7,"null",!0);te.undefined=new te(7,"undefined",!0);te.break=new te(7,"break",!0);var ve=class{constructor(e,r,n){this.type=e,this.value=r,this.encodedLength=n,this.encodedBytes=void 0,this.byteValue=void 0}toString(){return`Token[${this.type}].${this.value}`}};p();p();var Rp=globalThis.process&&!globalThis.process.browser&&globalThis.Buffer&&typeof globalThis.Buffer.isBuffer=="function",gre=new TextDecoder,bre=new TextEncoder;function K1(t){return Rp&&globalThis.Buffer.isBuffer(t)}function M8(t){return t instanceof Uint8Array?K1(t)?new Uint8Array(t.buffer,t.byteOffset,t.byteLength):t:Uint8Array.from(t)}var jR=Rp?(t,e,r)=>r-e>64?globalThis.Buffer.from(t.subarray(e,r)).toString("utf8"):CR(t,e,r):(t,e,r)=>r-e>64?gre.decode(t.subarray(e,r)):CR(t,e,r),NR=Rp?t=>t.length>64?globalThis.Buffer.from(t):DR(t):t=>t.length>64?bre.encode(t):DR(t),Za=t=>Uint8Array.from(t),Mp=Rp?(t,e,r)=>K1(t)?new Uint8Array(t.subarray(e,r)):t.slice(e,r):(t,e,r)=>t.slice(e,r),qR=Rp?(t,e)=>(t=t.map(r=>r instanceof Uint8Array?r:globalThis.Buffer.from(r)),M8(globalThis.Buffer.concat(t,e))):(t,e)=>{let r=new Uint8Array(e),n=0;for(let i of t)n+i.length>r.length&&(i=i.subarray(0,r.length-n)),r.set(i,n),n+=i.length;return r},LR=Rp?t=>globalThis.Buffer.allocUnsafe(t):t=>new Uint8Array(t);function UR(t,e){if(K1(t)&&K1(e))return t.compare(e);for(let r=0;r<t.length;r++)if(t[r]!==e[r])return t[r]<e[r]?-1:1;return 0}function DR(t,e=1/0){let r,n=t.length,i=null,o=[];for(let s=0;s<n;++s){if(r=t.charCodeAt(s),r>55295&&r<57344){if(!i){if(r>56319){(e-=3)>-1&&o.push(239,191,189);continue}else if(s+1===n){(e-=3)>-1&&o.push(239,191,189);continue}i=r;continue}if(r<56320){(e-=3)>-1&&o.push(239,191,189),i=r;continue}r=(i-55296<<10|r-56320)+65536}else i&&(e-=3)>-1&&o.push(239,191,189);if(i=null,r<128){if((e-=1)<0)break;o.push(r)}else if(r<2048){if((e-=2)<0)break;o.push(r>>6|192,r&63|128)}else if(r<65536){if((e-=3)<0)break;o.push(r>>12|224,r>>6&63|128,r&63|128)}else if(r<1114112){if((e-=4)<0)break;o.push(r>>18|240,r>>12&63|128,r>>6&63|128,r&63|128)}else throw new Error("Invalid code point")}return o}function CR(t,e,r){let n=[];for(;e<r;){let i=t[e],o=null,s=i>239?4:i>223?3:i>191?2:1;if(e+s<=r){let a,c,d,f;switch(s){case 1:i<128&&(o=i);break;case 2:a=t[e+1],(a&192)===128&&(f=(i&31)<<6|a&63,f>127&&(o=f));break;case 3:a=t[e+1],c=t[e+2],(a&192)===128&&(c&192)===128&&(f=(i&15)<<12|(a&63)<<6|c&63,f>2047&&(f<55296||f>57343)&&(o=f));break;case 4:a=t[e+1],c=t[e+2],d=t[e+3],(a&192)===128&&(c&192)===128&&(d&192)===128&&(f=(i&15)<<18|(a&63)<<12|(c&63)<<6|d&63,f>65535&&f<1114112&&(o=f))}}o===null?(o=65533,s=1):o>65535&&(o-=65536,n.push(o>>>10&1023|55296),o=56320|o&1023),n.push(o),e+=s}return vre(n)}var OR=4096;function vre(t){let e=t.length;if(e<=OR)return String.fromCharCode.apply(String,t);let r="",n=0;for(;n<e;)r+=String.fromCharCode.apply(String,t.slice(n,n+=OR));return r}var wre=256,Jy=class{constructor(e=wre){this.chunkSize=e,this.cursor=0,this.maxCursor=-1,this.chunks=[],this._initReuseChunk=null}reset(){this.cursor=0,this.maxCursor=-1,this.chunks.length&&(this.chunks=[]),this._initReuseChunk!==null&&(this.chunks.push(this._initReuseChunk),this.maxCursor=this._initReuseChunk.length-1)}push(e){let r=this.chunks[this.chunks.length-1];if(this.cursor+e.length<=this.maxCursor+1){let i=r.length-(this.maxCursor-this.cursor)-1;r.set(e,i)}else{if(r){let i=r.length-(this.maxCursor-this.cursor)-1;i<r.length&&(this.chunks[this.chunks.length-1]=r.subarray(0,i),this.maxCursor=this.cursor-1)}e.length<64&&e.length<this.chunkSize?(r=LR(this.chunkSize),this.chunks.push(r),this.maxCursor+=r.length,this._initReuseChunk===null&&(this._initReuseChunk=r),r.set(e,0)):(this.chunks.push(e),this.maxCursor+=e.length)}this.cursor+=e.length}toBytes(e=!1){let r;if(this.chunks.length===1){let n=this.chunks[0];e&&this.cursor>n.length/2?(r=this.cursor===n.length?n:n.subarray(0,this.cursor),this._initReuseChunk=null,this.chunks=[]):r=Mp(n,0,this.cursor)}else r=qR(this.chunks,this.cursor);return e&&this.reset(),r}};p();var Qe="CBOR decode error:",k8="CBOR encode error:",Xy=[];Xy[23]=1;Xy[24]=2;Xy[25]=3;Xy[26]=5;Xy[27]=9;function ad(t,e,r){if(t.length-e<r)throw new Error(`${Qe} not enough data for type`)}p();p();var $n=[24,256,65536,4294967296,BigInt("18446744073709551616")];function zo(t,e,r){ad(t,e,1);let n=t[e];if(r.strict===!0&&n<$n[0])throw new Error(`${Qe} integer encoded in more bytes than necessary (strict decode)`);return n}function $o(t,e,r){ad(t,e,2);let n=t[e]<<8|t[e+1];if(r.strict===!0&&n<$n[1])throw new Error(`${Qe} integer encoded in more bytes than necessary (strict decode)`);return n}function Go(t,e,r){ad(t,e,4);let n=t[e]*16777216+(t[e+1]<<16)+(t[e+2]<<8)+t[e+3];if(r.strict===!0&&n<$n[2])throw new Error(`${Qe} integer encoded in more bytes than necessary (strict decode)`);return n}function Ho(t,e,r){ad(t,e,8);let n=t[e]*16777216+(t[e+1]<<16)+(t[e+2]<<8)+t[e+3],i=t[e+4]*16777216+(t[e+5]<<16)+(t[e+6]<<8)+t[e+7],o=(BigInt(n)<<BigInt(32))+BigInt(i);if(r.strict===!0&&o<$n[3])throw new Error(`${Qe} integer encoded in more bytes than necessary (strict decode)`);if(o<=Number.MAX_SAFE_INTEGER)return Number(o);if(r.allowBigInt===!0)return o;throw new Error(`${Qe} integers outside of the safe integer range are not supported`)}function FR(t,e,r,n){return new ve(te.uint,zo(t,e+1,n),2)}function zR(t,e,r,n){return new ve(te.uint,$o(t,e+1,n),3)}function $R(t,e,r,n){return new ve(te.uint,Go(t,e+1,n),5)}function GR(t,e,r,n){return new ve(te.uint,Ho(t,e+1,n),9)}function Ts(t,e){return ci(t,0,e.value)}function ci(t,e,r){if(r<$n[0]){let n=Number(r);t.push([e|n])}else if(r<$n[1]){let n=Number(r);t.push([e|24,n])}else if(r<$n[2]){let n=Number(r);t.push([e|25,n>>>8,n&255])}else if(r<$n[3]){let n=Number(r);t.push([e|26,n>>>24&255,n>>>16&255,n>>>8&255,n&255])}else{let n=BigInt(r);if(n<$n[4]){let i=[e|27,0,0,0,0,0,0,0],o=Number(n&BigInt(4294967295)),s=Number(n>>BigInt(32)&BigInt(4294967295));i[8]=o&255,o=o>>8,i[7]=o&255,o=o>>8,i[6]=o&255,o=o>>8,i[5]=o&255,i[4]=s&255,s=s>>8,i[3]=s&255,s=s>>8,i[2]=s&255,s=s>>8,i[1]=s&255,t.push(i)}else throw new Error(`${Qe} encountered BigInt larger than allowable range`)}}Ts.encodedSize=function(e){return ci.encodedSize(e.value)};ci.encodedSize=function(e){return e<$n[0]?1:e<$n[1]?2:e<$n[2]?3:e<$n[3]?5:9};Ts.compareTokens=function(e,r){return e.value<r.value?-1:e.value>r.value?1:0};p();function HR(t,e,r,n){return new ve(te.negint,-1-zo(t,e+1,n),2)}function WR(t,e,r,n){return new ve(te.negint,-1-$o(t,e+1,n),3)}function VR(t,e,r,n){return new ve(te.negint,-1-Go(t,e+1,n),5)}var B8=BigInt(-1),KR=BigInt(1);function ZR(t,e,r,n){let i=Ho(t,e+1,n);if(typeof i!="bigint"){let o=-1-i;if(o>=Number.MIN_SAFE_INTEGER)return new ve(te.negint,o,9)}if(n.allowBigInt!==!0)throw new Error(`${Qe} integers outside of the safe integer range are not supported`);return new ve(te.negint,B8-BigInt(i),9)}function Z1(t,e){let r=e.value,n=typeof r=="bigint"?r*B8-KR:r*-1-1;ci(t,e.type.majorEncoded,n)}Z1.encodedSize=function(e){let r=e.value,n=typeof r=="bigint"?r*B8-KR:r*-1-1;return n<$n[0]?1:n<$n[1]?2:n<$n[2]?3:n<$n[3]?5:9};Z1.compareTokens=function(e,r){return e.value<r.value?1:e.value>r.value?-1:0};p();function Qy(t,e,r,n){ad(t,e,r+n);let i=Mp(t,e+r,e+r+n);return new ve(te.bytes,i,r+n)}function YR(t,e,r,n){return Qy(t,e,1,r)}function JR(t,e,r,n){return Qy(t,e,2,zo(t,e+1,n))}function XR(t,e,r,n){return Qy(t,e,3,$o(t,e+1,n))}function QR(t,e,r,n){return Qy(t,e,5,Go(t,e+1,n))}function eM(t,e,r,n){let i=Ho(t,e+1,n);if(typeof i=="bigint")throw new Error(`${Qe} 64-bit integer bytes lengths not supported`);return Qy(t,e,9,i)}function Y1(t){return t.encodedBytes===void 0&&(t.encodedBytes=t.type===te.string?NR(t.value):t.value),t.encodedBytes}function kp(t,e){let r=Y1(e);ci(t,e.type.majorEncoded,r.length),t.push(r)}kp.encodedSize=function(e){let r=Y1(e);return ci.encodedSize(r.length)+r.length};kp.compareTokens=function(e,r){return xre(Y1(e),Y1(r))};function xre(t,e){return t.length<e.length?-1:t.length>e.length?1:UR(t,e)}p();function eg(t,e,r,n,i){let o=r+n;ad(t,e,o);let s=new ve(te.string,jR(t,e+r,e+o),o);return i.retainStringBytes===!0&&(s.byteValue=Mp(t,e+r,e+o)),s}function tM(t,e,r,n){return eg(t,e,1,r,n)}function rM(t,e,r,n){return eg(t,e,2,zo(t,e+1,n),n)}function nM(t,e,r,n){return eg(t,e,3,$o(t,e+1,n),n)}function iM(t,e,r,n){return eg(t,e,5,Go(t,e+1,n),n)}function oM(t,e,r,n){let i=Ho(t,e+1,n);if(typeof i=="bigint")throw new Error(`${Qe} 64-bit integer string lengths not supported`);return eg(t,e,9,i,n)}var sM=kp;p();function Bp(t,e,r,n){return new ve(te.array,n,r)}function aM(t,e,r,n){return Bp(t,e,1,r)}function cM(t,e,r,n){return Bp(t,e,2,zo(t,e+1,n))}function dM(t,e,r,n){return Bp(t,e,3,$o(t,e+1,n))}function fM(t,e,r,n){return Bp(t,e,5,Go(t,e+1,n))}function uM(t,e,r,n){let i=Ho(t,e+1,n);if(typeof i=="bigint")throw new Error(`${Qe} 64-bit integer array lengths not supported`);return Bp(t,e,9,i)}function lM(t,e,r,n){if(n.allowIndefinite===!1)throw new Error(`${Qe} indefinite length items not allowed`);return Bp(t,e,1,1/0)}function J1(t,e){ci(t,te.array.majorEncoded,e.value)}J1.compareTokens=Ts.compareTokens;J1.encodedSize=function(e){return ci.encodedSize(e.value)};p();function Dp(t,e,r,n){return new ve(te.map,n,r)}function hM(t,e,r,n){return Dp(t,e,1,r)}function pM(t,e,r,n){return Dp(t,e,2,zo(t,e+1,n))}function mM(t,e,r,n){return Dp(t,e,3,$o(t,e+1,n))}function yM(t,e,r,n){return Dp(t,e,5,Go(t,e+1,n))}function gM(t,e,r,n){let i=Ho(t,e+1,n);if(typeof i=="bigint")throw new Error(`${Qe} 64-bit integer map lengths not supported`);return Dp(t,e,9,i)}function bM(t,e,r,n){if(n.allowIndefinite===!1)throw new Error(`${Qe} indefinite length items not allowed`);return Dp(t,e,1,1/0)}function X1(t,e){ci(t,te.map.majorEncoded,e.value)}X1.compareTokens=Ts.compareTokens;X1.encodedSize=function(e){return ci.encodedSize(e.value)};p();function vM(t,e,r,n){return new ve(te.tag,r,1)}function wM(t,e,r,n){return new ve(te.tag,zo(t,e+1,n),2)}function _M(t,e,r,n){return new ve(te.tag,$o(t,e+1,n),3)}function xM(t,e,r,n){return new ve(te.tag,Go(t,e+1,n),5)}function EM(t,e,r,n){return new ve(te.tag,Ho(t,e+1,n),9)}function Q1(t,e){ci(t,te.tag.majorEncoded,e.value)}Q1.compareTokens=Ts.compareTokens;Q1.encodedSize=function(e){return ci.encodedSize(e.value)};p();var Ire=20,Rre=21,Mre=22,kre=23;function SM(t,e,r,n){if(n.allowUndefined===!1)throw new Error(`${Qe} undefined values are not supported`);return n.coerceUndefinedToNull===!0?new ve(te.null,null,1):new ve(te.undefined,void 0,1)}function AM(t,e,r,n){if(n.allowIndefinite===!1)throw new Error(`${Qe} indefinite length items not allowed`);return new ve(te.break,void 0,1)}function D8(t,e,r){if(r){if(r.allowNaN===!1&&Number.isNaN(t))throw new Error(`${Qe} NaN values are not supported`);if(r.allowInfinity===!1&&(t===1/0||t===-1/0))throw new Error(`${Qe} Infinity values are not supported`)}return new ve(te.float,t,e)}function TM(t,e,r,n){return D8(C8(t,e+1),3,n)}function PM(t,e,r,n){return D8(O8(t,e+1),5,n)}function IM(t,e,r,n){return D8(BM(t,e+1),9,n)}function ew(t,e,r){let n=e.value;if(n===!1)t.push([te.float.majorEncoded|Ire]);else if(n===!0)t.push([te.float.majorEncoded|Rre]);else if(n===null)t.push([te.float.majorEncoded|Mre]);else if(n===void 0)t.push([te.float.majorEncoded|kre]);else{let i,o=!1;(!r||r.float64!==!0)&&(MM(n),i=C8(Qs,1),n===i||Number.isNaN(n)?(Qs[0]=249,t.push(Qs.slice(0,3)),o=!0):(kM(n),i=O8(Qs,1),n===i&&(Qs[0]=250,t.push(Qs.slice(0,5)),o=!0))),o||(Bre(n),i=BM(Qs,1),Qs[0]=251,t.push(Qs.slice(0,9)))}}ew.encodedSize=function(e,r){let n=e.value;if(n===!1||n===!0||n===null||n===void 0)return 1;if(!r||r.float64!==!0){MM(n);let i=C8(Qs,1);if(n===i||Number.isNaN(n))return 3;if(kM(n),i=O8(Qs,1),n===i)return 5}return 9};var RM=new ArrayBuffer(9),Ps=new DataView(RM,1),Qs=new Uint8Array(RM,0);function MM(t){if(t===1/0)Ps.setUint16(0,31744,!1);else if(t===-1/0)Ps.setUint16(0,64512,!1);else if(Number.isNaN(t))Ps.setUint16(0,32256,!1);else{Ps.setFloat32(0,t);let e=Ps.getUint32(0),r=(e&2139095040)>>23,n=e&8388607;if(r===255)Ps.setUint16(0,31744,!1);else if(r===0)Ps.setUint16(0,(t&2147483648)>>16|n>>13,!1);else{let i=r-127;i<-24?Ps.setUint16(0,0):i<-14?Ps.setUint16(0,(e&2147483648)>>16|1<<24+i,!1):Ps.setUint16(0,(e&2147483648)>>16|i+15<<10|n>>13,!1)}}}function C8(t,e){if(t.length-e<2)throw new Error(`${Qe} not enough data for float16`);let r=(t[e]<<8)+t[e+1];if(r===31744)return 1/0;if(r===64512)return-1/0;if(r===32256)return NaN;let n=r>>10&31,i=r&1023,o;return n===0?o=i*2**-24:n!==31?o=(i+1024)*2**(n-25):o=i===0?1/0:NaN,r&32768?-o:o}function kM(t){Ps.setFloat32(0,t,!1)}function O8(t,e){if(t.length-e<4)throw new Error(`${Qe} not enough data for float32`);let r=(t.byteOffset||0)+e;return new DataView(t.buffer,r,4).getFloat32(0,!1)}function Bre(t){Ps.setFloat64(0,t,!1)}function BM(t,e){if(t.length-e<8)throw new Error(`${Qe} not enough data for float64`);let r=(t.byteOffset||0)+e;return new DataView(t.buffer,r,8).getFloat64(0,!1)}ew.compareTokens=Ts.compareTokens;function nr(t,e,r){throw new Error(`${Qe} encountered invalid minor (${r}) for major ${t[e]>>>5}`)}function tw(t){return()=>{throw new Error(`${Qe} ${t}`)}}var ue=[];for(let t=0;t<=23;t++)ue[t]=nr;ue[24]=FR;ue[25]=zR;ue[26]=$R;ue[27]=GR;ue[28]=nr;ue[29]=nr;ue[30]=nr;ue[31]=nr;for(let t=32;t<=55;t++)ue[t]=nr;ue[56]=HR;ue[57]=WR;ue[58]=VR;ue[59]=ZR;ue[60]=nr;ue[61]=nr;ue[62]=nr;ue[63]=nr;for(let t=64;t<=87;t++)ue[t]=YR;ue[88]=JR;ue[89]=XR;ue[90]=QR;ue[91]=eM;ue[92]=nr;ue[93]=nr;ue[94]=nr;ue[95]=tw("indefinite length bytes/strings are not supported");for(let t=96;t<=119;t++)ue[t]=tM;ue[120]=rM;ue[121]=nM;ue[122]=iM;ue[123]=oM;ue[124]=nr;ue[125]=nr;ue[126]=nr;ue[127]=tw("indefinite length bytes/strings are not supported");for(let t=128;t<=151;t++)ue[t]=aM;ue[152]=cM;ue[153]=dM;ue[154]=fM;ue[155]=uM;ue[156]=nr;ue[157]=nr;ue[158]=nr;ue[159]=lM;for(let t=160;t<=183;t++)ue[t]=hM;ue[184]=pM;ue[185]=mM;ue[186]=yM;ue[187]=gM;ue[188]=nr;ue[189]=nr;ue[190]=nr;ue[191]=bM;for(let t=192;t<=215;t++)ue[t]=vM;ue[216]=wM;ue[217]=_M;ue[218]=xM;ue[219]=EM;ue[220]=nr;ue[221]=nr;ue[222]=nr;ue[223]=nr;for(let t=224;t<=243;t++)ue[t]=tw("simple values are not supported");ue[244]=nr;ue[245]=nr;ue[246]=nr;ue[247]=SM;ue[248]=tw("simple values are not supported");ue[249]=TM;ue[250]=PM;ue[251]=IM;ue[252]=nr;ue[253]=nr;ue[254]=nr;ue[255]=AM;var ea=[];for(let t=0;t<24;t++)ea[t]=new ve(te.uint,t,1);for(let t=-1;t>=-24;t--)ea[31-t]=new ve(te.negint,t,1);ea[64]=new ve(te.bytes,new Uint8Array(0),1);ea[96]=new ve(te.string,"",1);ea[128]=new ve(te.array,0,1);ea[160]=new ve(te.map,0,1);ea[244]=new ve(te.false,!1,1);ea[245]=new ve(te.true,!0,1);ea[246]=new ve(te.null,null,1);function DM(t){switch(t.type){case te.false:return Za([244]);case te.true:return Za([245]);case te.null:return Za([246]);case te.bytes:return t.value.length?void 0:Za([64]);case te.string:return t.value===""?Za([96]):void 0;case te.array:return t.value===0?Za([128]):void 0;case te.map:return t.value===0?Za([160]):void 0;case te.uint:return t.value<24?Za([Number(t.value)]):void 0;case te.negint:if(t.value>=-24)return Za([31-Number(t.value)])}}var Cre={float64:!1,mapSorter:Nre,quickEncodeToken:DM};function Ore(){let t=[];return t[te.uint.major]=Ts,t[te.negint.major]=Z1,t[te.bytes.major]=kp,t[te.string.major]=sM,t[te.array.major]=J1,t[te.map.major]=X1,t[te.tag.major]=Q1,t[te.float.major]=ew,t}var CM=Ore(),j8=new Jy,Cp=class{constructor(e,r){this.obj=e,this.parent=r}includes(e){let r=this;do if(r.obj===e)return!0;while(r=r.parent);return!1}static createCheck(e,r){if(e&&e.includes(r))throw new Error(`${k8} object contains circular references`);return new Cp(r,e)}},Rf={null:new ve(te.null,null),undefined:new ve(te.undefined,void 0),true:new ve(te.true,!0),false:new ve(te.false,!1),emptyArray:new ve(te.array,0),emptyMap:new ve(te.map,0)},Mf={number(t,e,r,n){return!Number.isInteger(t)||!Number.isSafeInteger(t)?new ve(te.float,t):t>=0?new ve(te.uint,t):new ve(te.negint,t)},bigint(t,e,r,n){return t>=BigInt(0)?new ve(te.uint,t):new ve(te.negint,t)},Uint8Array(t,e,r,n){return new ve(te.bytes,t)},string(t,e,r,n){return new ve(te.string,t)},boolean(t,e,r,n){return t?Rf.true:Rf.false},null(t,e,r,n){return Rf.null},undefined(t,e,r,n){return Rf.undefined},ArrayBuffer(t,e,r,n){return new ve(te.bytes,new Uint8Array(t))},DataView(t,e,r,n){return new ve(te.bytes,new Uint8Array(t.buffer,t.byteOffset,t.byteLength))},Array(t,e,r,n){if(!t.length)return r.addBreakTokens===!0?[Rf.emptyArray,new ve(te.break)]:Rf.emptyArray;n=Cp.createCheck(n,t);let i=[],o=0;for(let s of t)i[o++]=rw(s,r,n);return r.addBreakTokens?[new ve(te.array,t.length),i,new ve(te.break)]:[new ve(te.array,t.length),i]},Object(t,e,r,n){let i=e!=="Object",o=i?t.keys():Object.keys(t),s=i?t.size:o.length;if(!s)return r.addBreakTokens===!0?[Rf.emptyMap,new ve(te.break)]:Rf.emptyMap;n=Cp.createCheck(n,t);let a=[],c=0;for(let d of o)a[c++]=[rw(d,r,n),rw(i?t.get(d):t[d],r,n)];return jre(a,r),r.addBreakTokens?[new ve(te.map,s),a,new ve(te.break)]:[new ve(te.map,s),a]}};Mf.Map=Mf.Object;Mf.Buffer=Mf.Uint8Array;for(let t of"Uint8Clamped Uint16 Uint32 Int8 Int16 Int32 BigUint64 BigInt64 Float32 Float64".split(" "))Mf[`${t}Array`]=Mf.DataView;function rw(t,e={},r){let n=BR(t),i=e&&e.typeEncoders&&e.typeEncoders[n]||Mf[n];if(typeof i=="function"){let s=i(t,n,e,r);if(s!=null)return s}let o=Mf[n];if(!o)throw new Error(`${k8} unsupported type: ${n}`);return o(t,n,e,r)}function jre(t,e){e.mapSorter&&t.sort(e.mapSorter)}function Nre(t,e){let r=Array.isArray(t[0])?t[0][0]:t[0],n=Array.isArray(e[0])?e[0][0]:e[0];if(r.type!==n.type)return r.type.compare(n.type);let i=r.type.major,o=CM[i].compareTokens(r,n);return o===0&&console.warn("WARNING: complex key types used, CBOR key sorting guarantees are gone"),o}function OM(t,e,r,n){if(Array.isArray(e))for(let i of e)OM(t,i,r,n);else r[e.type.major](t,e,n)}function qre(t,e,r){let n=rw(t,r);if(!Array.isArray(n)&&r.quickEncodeToken){let i=r.quickEncodeToken(n);if(i)return i;let o=e[n.type.major];if(o.encodedSize){let s=o.encodedSize(n,r),a=new Jy(s);if(o(a,n,r),a.chunks.length!==1)throw new Error(`Unexpected error: pre-calculated length for ${n} was wrong`);return M8(a.chunks[0])}}return j8.reset(),OM(j8,n,e,r),j8.toBytes(!0)}function N8(t,e){return e=Object.assign({},Cre,e),qre(t,CM,e)}p();var Lre={strict:!1,allowIndefinite:!0,allowUndefined:!0,allowBigInt:!0},q8=class{constructor(e,r={}){this.pos=0,this.data=e,this.options=r}done(){return this.pos>=this.data.length}next(){let e=this.data[this.pos],r=ea[e];if(r===void 0){let n=ue[e];if(!n)throw new Error(`${Qe} no decoder for major type ${e>>>5} (byte 0x${e.toString(16).padStart(2,"0")})`);let i=e&31;r=n(this.data,this.pos,i,this.options)}return this.pos+=r.encodedLength,r}},tg=Symbol.for("DONE"),nw=Symbol.for("BREAK");function Ure(t,e,r){let n=[];for(let i=0;i<t.value;i++){let o=rg(e,r);if(o===nw){if(t.value===1/0)break;throw new Error(`${Qe} got unexpected break to lengthed array`)}if(o===tg)throw new Error(`${Qe} found array but not enough entries (got ${i}, expected ${t.value})`);n[i]=o}return n}function Fre(t,e,r){let n=r.useMaps===!0,i=n?void 0:{},o=n?new Map:void 0;for(let s=0;s<t.value;s++){let a=rg(e,r);if(a===nw){if(t.value===1/0)break;throw new Error(`${Qe} got unexpected break to lengthed map`)}if(a===tg)throw new Error(`${Qe} found map but not enough entries (got ${s} [no key], expected ${t.value})`);if(n!==!0&&typeof a!="string")throw new Error(`${Qe} non-string keys not supported (got ${typeof a})`);if(r.rejectDuplicateMapKeys===!0&&(n&&o.has(a)||!n&&a in i))throw new Error(`${Qe} found repeat map key "${a}"`);let c=rg(e,r);if(c===tg)throw new Error(`${Qe} found map but not enough entries (got ${s} [no value], expected ${t.value})`);n?o.set(a,c):i[a]=c}return n?o:i}function rg(t,e){if(t.done())return tg;let r=t.next();if(r.type===te.break)return nw;if(r.type.terminal)return r.value;if(r.type===te.array)return Ure(r,t,e);if(r.type===te.map)return Fre(r,t,e);if(r.type===te.tag){if(e.tags&&typeof e.tags[r.value]=="function"){let n=rg(t,e);return e.tags[r.value](n)}throw new Error(`${Qe} tag not supported (${r.value})`)}throw new Error("unsupported")}function L8(t,e){if(!(t instanceof Uint8Array))throw new Error(`${Qe} data to decode must be a Uint8Array`);e=Object.assign({},Lre,e);let r=e.tokenizer||new q8(t,e),n=rg(r,e);if(n===tg)throw new Error(`${Qe} did not find any content to decode`);if(n===nw)throw new Error(`${Qe} got unexpected break`);if(!r.done())throw new Error(`${Qe} too many terminals, data makes no sense`);return n}p();var G8={};dr(G8,{base32:()=>jp,base32hex:()=>Jre,base32hexpad:()=>Qre,base32hexpadupper:()=>ene,base32hexupper:()=>Xre,base32pad:()=>Zre,base32padupper:()=>Yre,base32upper:()=>Kre,base32z:()=>tne});p();p();p();function $re(t,e){if(t.length>=255)throw new TypeError("Alphabet too long");for(var r=new Uint8Array(256),n=0;n<r.length;n++)r[n]=255;for(var i=0;i<t.length;i++){var o=t.charAt(i),s=o.charCodeAt(0);if(r[s]!==255)throw new TypeError(o+" is ambiguous");r[s]=i}var a=t.length,c=t.charAt(0),d=Math.log(a)/Math.log(256),f=Math.log(256)/Math.log(a);function u(v){if(v instanceof Uint8Array||(ArrayBuffer.isView(v)?v=new Uint8Array(v.buffer,v.byteOffset,v.byteLength):Array.isArray(v)&&(v=Uint8Array.from(v))),!(v instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(v.length===0)return"";for(var A=0,T=0,M=0,D=v.length;M!==D&&v[M]===0;)M++,A++;for(var O=(D-M)*f+1>>>0,U=new Uint8Array(O);M!==D;){for(var L=v[M],F=0,$=O-1;(L!==0||F<T)&&$!==-1;$--,F++)L+=256*U[$]>>>0,U[$]=L%a>>>0,L=L/a>>>0;if(L!==0)throw new Error("Non-zero carry");T=F,M++}for(var H=O-T;H!==O&&U[H]===0;)H++;for(var z=c.repeat(A);H<O;++H)z+=t.charAt(U[H]);return z}function m(v){if(typeof v!="string")throw new TypeError("Expected String");if(v.length===0)return new Uint8Array;var A=0;if(v[A]!==" "){for(var T=0,M=0;v[A]===c;)T++,A++;for(var D=(v.length-A)*d+1>>>0,O=new Uint8Array(D);v[A];){var U=r[v.charCodeAt(A)];if(U===255)return;for(var L=0,F=D-1;(U!==0||L<M)&&F!==-1;F--,L++)U+=a*O[F]>>>0,O[F]=U%256>>>0,U=U/256>>>0;if(U!==0)throw new Error("Non-zero carry");M=L,A++}if(v[A]!==" "){for(var $=D-M;$!==D&&O[$]===0;)$++;for(var H=new Uint8Array(T+(D-$)),z=T;$!==D;)H[z++]=O[$++];return H}}}function _(v){var A=m(v);if(A)return A;throw new Error(`Non-${e} character`)}return{encode:u,decodeUnsafe:m,decode:_}}var Gre=$re,Hre=Gre,jM=Hre;p();var HPe=new Uint8Array(0);var NM=(t,e)=>{if(t===e)return!0;if(t.byteLength!==e.byteLength)return!1;for(let r=0;r<t.byteLength;r++)if(t[r]!==e[r])return!1;return!0},cd=t=>{if(t instanceof Uint8Array&&t.constructor.name==="Uint8Array")return t;if(t instanceof ArrayBuffer)return new Uint8Array(t);if(ArrayBuffer.isView(t))return new Uint8Array(t.buffer,t.byteOffset,t.byteLength);throw new Error("Unknown type, must be binary type")};var qM=t=>new TextEncoder().encode(t),LM=t=>new TextDecoder().decode(t);p();var U8=class{constructor(e,r,n){this.name=e,this.prefix=r,this.baseEncode=n}encode(e){if(e instanceof Uint8Array)return`${this.prefix}${this.baseEncode(e)}`;throw Error("Unknown type, must be binary type")}},F8=class{constructor(e,r,n){if(this.name=e,this.prefix=r,r.codePointAt(0)===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=r.codePointAt(0),this.baseDecode=n}decode(e){if(typeof e=="string"){if(e.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(e)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(e.slice(this.prefix.length))}else throw Error("Can only multibase decode strings")}or(e){return FM(this,e)}},z8=class{constructor(e){this.decoders=e}or(e){return FM(this,e)}decode(e){let r=e[0],n=this.decoders[r];if(n)return n.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}},FM=(t,e)=>new z8({...t.decoders||{[t.prefix]:t},...e.decoders||{[e.prefix]:e}}),$8=class{constructor(e,r,n,i){this.name=e,this.prefix=r,this.baseEncode=n,this.baseDecode=i,this.encoder=new U8(e,r,n),this.decoder=new F8(e,r,i)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}},Op=({name:t,prefix:e,encode:r,decode:n})=>new $8(t,e,r,n),kf=({prefix:t,name:e,alphabet:r})=>{let{encode:n,decode:i}=jM(r,e);return Op({prefix:t,name:e,encode:n,decode:o=>cd(i(o))})},Wre=(t,e,r,n)=>{let i={};for(let f=0;f<e.length;++f)i[e[f]]=f;let o=t.length;for(;t[o-1]==="=";)--o;let s=new Uint8Array(o*r/8|0),a=0,c=0,d=0;for(let f=0;f<o;++f){let u=i[t[f]];if(u===void 0)throw new SyntaxError(`Non-${n} character`);c=c<<r|u,a+=r,a>=8&&(a-=8,s[d++]=255&c>>a)}if(a>=r||255&c<<8-a)throw new SyntaxError("Unexpected end of data");return s},Vre=(t,e,r)=>{let n=e[e.length-1]==="=",i=(1<<r)-1,o="",s=0,a=0;for(let c=0;c<t.length;++c)for(a=a<<8|t[c],s+=8;s>r;)s-=r,o+=e[i&a>>s];if(s&&(o+=e[i&a<<r-s]),n)for(;o.length*r&7;)o+="=";return o},sn=({name:t,prefix:e,bitsPerChar:r,alphabet:n})=>Op({prefix:e,name:t,encode(i){return Vre(i,n,r)},decode(i){return Wre(i,n,r,t)}});var jp=sn({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),Kre=sn({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),Zre=sn({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),Yre=sn({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),Jre=sn({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),Xre=sn({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),Qre=sn({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),ene=sn({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),tne=sn({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});var H8={};dr(H8,{base58btc:()=>Ya,base58flickr:()=>rne});p();var Ya=kf({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),rne=kf({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});p();p();p();var nne=GM,zM=128,ine=127,one=~ine,sne=Math.pow(2,31);function GM(t,e,r){e=e||[],r=r||0;for(var n=r;t>=sne;)e[r++]=t&255|zM,t/=128;for(;t&one;)e[r++]=t&255|zM,t>>>=7;return e[r]=t|0,GM.bytes=r-n+1,e}var ane=W8,cne=128,$M=127;function W8(t,n){var r=0,n=n||0,i=0,o=n,s,a=t.length;do{if(o>=a)throw W8.bytes=0,new RangeError("Could not decode varint");s=t[o++],r+=i<28?(s&$M)<<i:(s&$M)*Math.pow(2,i),i+=7}while(s>=cne);return W8.bytes=o-n,r}var dne=Math.pow(2,7),fne=Math.pow(2,14),une=Math.pow(2,21),lne=Math.pow(2,28),hne=Math.pow(2,35),pne=Math.pow(2,42),mne=Math.pow(2,49),yne=Math.pow(2,56),gne=Math.pow(2,63),bne=function(t){return t<dne?1:t<fne?2:t<une?3:t<lne?4:t<hne?5:t<pne?6:t<mne?7:t<yne?8:t<gne?9:10},vne={encode:nne,decode:ane,encodingLength:bne},wne=vne,ng=wne;var ig=(t,e=0)=>[ng.decode(t,e),ng.decode.bytes],Np=(t,e,r=0)=>(ng.encode(t,e,r),e),qp=t=>ng.encodingLength(t);var wl=(t,e)=>{let r=e.byteLength,n=qp(t),i=n+qp(r),o=new Uint8Array(i+r);return Np(t,o,0),Np(r,o,n),o.set(e,i),new Lp(t,r,e,o)},HM=t=>{let e=cd(t),[r,n]=ig(e),[i,o]=ig(e.subarray(n)),s=e.subarray(n+o);if(s.byteLength!==i)throw new Error("Incorrect length");return new Lp(r,i,s,e)},WM=(t,e)=>{if(t===e)return!0;{let r=e;return t.code===r.code&&t.size===r.size&&r.bytes instanceof Uint8Array&&NM(t.bytes,r.bytes)}},Lp=class{constructor(e,r,n,i){this.code=e,this.size=r,this.digest=n,this.bytes=i}};p();var VM=(t,e)=>{let{bytes:r,version:n}=t;switch(n){case 0:return xne(r,V8(t),e||Ya.encoder);default:return Ene(r,V8(t),e||jp.encoder)}};var KM=new WeakMap,V8=t=>{let e=KM.get(t);if(e==null){let r=new Map;return KM.set(t,r),r}return e},en=class{constructor(e,r,n,i){this.code=r,this.version=e,this.multihash=n,this.bytes=i,this["/"]=i}get asCID(){return this}get byteOffset(){return this.bytes.byteOffset}get byteLength(){return this.bytes.byteLength}toV0(){switch(this.version){case 0:return this;case 1:{let{code:e,multihash:r}=this;if(e!==sg)throw new Error("Cannot convert a non dag-pb CID to CIDv0");if(r.code!==Sne)throw new Error("Cannot convert non sha2-256 multihash CID to CIDv0");return en.createV0(r)}default:throw Error(`Can not convert CID version ${this.version} to version 0. This is a bug please report`)}}toV1(){switch(this.version){case 0:{let{code:e,digest:r}=this.multihash,n=wl(e,r);return en.createV1(this.code,n)}case 1:return this;default:throw Error(`Can not convert CID version ${this.version} to version 1. This is a bug please report`)}}equals(e){return en.equals(this,e)}static equals(e,r){let n=r;return n&&e.code===n.code&&e.version===n.version&&WM(e.multihash,n.multihash)}toString(e){return VM(this,e)}toJSON(){return{"/":VM(this)}}link(){return this}get[Symbol.toStringTag](){return"CID"}[Symbol.for("nodejs.util.inspect.custom")](){return`CID(${this.toString()})`}static asCID(e){if(e==null)return null;let r=e;if(r instanceof en)return r;if(r["/"]!=null&&r["/"]===r.bytes||r.asCID===r){let{version:n,code:i,multihash:o,bytes:s}=r;return new en(n,i,o,s||ZM(n,i,o.bytes))}else if(r[Ane]===!0){let{version:n,multihash:i,code:o}=r,s=HM(i);return en.create(n,o,s)}else return null}static create(e,r,n){if(typeof r!="number")throw new Error("String codecs are no longer supported");if(!(n.bytes instanceof Uint8Array))throw new Error("Invalid digest");switch(e){case 0:{if(r!==sg)throw new Error(`Version 0 CID must use dag-pb (code: ${sg}) block encoding`);return new en(e,r,n,n.bytes)}case 1:{let i=ZM(e,r,n.bytes);return new en(e,r,n,i)}default:throw new Error("Invalid version")}}static createV0(e){return en.create(0,sg,e)}static createV1(e,r){return en.create(1,e,r)}static decode(e){let[r,n]=en.decodeFirst(e);if(n.length)throw new Error("Incorrect length");return r}static decodeFirst(e){let r=en.inspectBytes(e),n=r.size-r.multihashSize,i=cd(e.subarray(n,n+r.multihashSize));if(i.byteLength!==r.multihashSize)throw new Error("Incorrect length");let o=i.subarray(r.multihashSize-r.digestSize),s=new Lp(r.multihashCode,r.digestSize,o,i);return[r.version===0?en.createV0(s):en.createV1(r.codec,s),e.subarray(r.size)]}static inspectBytes(e){let r=0,n=()=>{let[u,m]=ig(e.subarray(r));return r+=m,u},i=n(),o=sg;if(i===18?(i=0,r=0):o=n(),i!==0&&i!==1)throw new RangeError(`Invalid CID version ${i}`);let s=r,a=n(),c=n(),d=r+c,f=d-s;return{version:i,codec:o,multihashCode:a,digestSize:c,multihashSize:f,size:d}}static parse(e,r){let[n,i]=_ne(e,r),o=en.decode(i);if(o.version===0&&e[0]!=="Q")throw Error("Version 0 CID string must not include multibase prefix");return V8(o).set(n,e),o}},_ne=(t,e)=>{switch(t[0]){case"Q":{let r=e||Ya;return[Ya.prefix,r.decode(`${Ya.prefix}${t}`)]}case Ya.prefix:{let r=e||Ya;return[Ya.prefix,r.decode(t)]}case jp.prefix:{let r=e||jp;return[jp.prefix,r.decode(t)]}default:{if(e==null)throw Error("To parse non base32 or base58btc encoded CID multibase decoder must be provided");return[t[0],e.decode(t)]}}},xne=(t,e,r)=>{let{prefix:n}=r;if(n!==Ya.prefix)throw Error(`Cannot string encode V0 in ${r.name} encoding`);let i=e.get(n);if(i==null){let o=r.encode(t).slice(1);return e.set(n,o),o}else return i},Ene=(t,e,r)=>{let{prefix:n}=r,i=e.get(n);if(i==null){let o=r.encode(t);return e.set(n,o),o}else return i},sg=112,Sne=18,ZM=(t,e,r)=>{let n=qp(t),i=n+qp(e),o=new Uint8Array(i+r.byteLength);return Np(t,o,0),Np(e,o,n),o.set(r,i),o},Ane=Symbol.for("@ipld/js-cid/CID");var YM=42;function Tne(t){if(t.asCID!==t&&t["/"]!==t.bytes)return null;let e=en.asCID(t);if(!e)return null;let r=new Uint8Array(e.bytes.byteLength+1);return r.set(e.bytes,1),[new ve(te.tag,YM),new ve(te.bytes,r)]}function Pne(){throw new Error("`undefined` is not supported by the IPLD Data Model and cannot be encoded")}function Ine(t){if(Number.isNaN(t))throw new Error("`NaN` is not supported by the IPLD Data Model and cannot be encoded");if(t===1/0||t===-1/0)throw new Error("`Infinity` and `-Infinity` is not supported by the IPLD Data Model and cannot be encoded");return null}var Rne={float64:!0,typeEncoders:{Object:Tne,undefined:Pne,number:Ine}};function Mne(t){if(t[0]!==0)throw new Error("Invalid CID for CBOR tag 42; expected leading 0x00");return en.decode(t.subarray(1))}var JM={allowIndefinite:!1,coerceUndefinedToNull:!0,allowNaN:!1,allowInfinity:!1,allowBigInt:!0,strict:!0,useMaps:!1,rejectDuplicateMapKeys:!0,tags:[]};JM.tags[YM]=Mne;var kne="dag-cbor",ow=113,Bne=t=>N8(t,Rne),Dne=t=>L8(t,JM);p();p();p();var Cne=ek,XM=128,One=127,jne=~One,Nne=Math.pow(2,31);function ek(t,e,r){e=e||[],r=r||0;for(var n=r;t>=Nne;)e[r++]=t&255|XM,t/=128;for(;t&jne;)e[r++]=t&255|XM,t>>>=7;return e[r]=t|0,ek.bytes=r-n+1,e}var qne=K8,Lne=128,QM=127;function K8(t,n){var r=0,n=n||0,i=0,o=n,s,a=t.length;do{if(o>=a)throw K8.bytes=0,new RangeError("Could not decode varint");s=t[o++],r+=i<28?(s&QM)<<i:(s&QM)*Math.pow(2,i),i+=7}while(s>=Lne);return K8.bytes=o-n,r}var Une=Math.pow(2,7),Fne=Math.pow(2,14),zne=Math.pow(2,21),$ne=Math.pow(2,28),Gne=Math.pow(2,35),Hne=Math.pow(2,42),Wne=Math.pow(2,49),Vne=Math.pow(2,56),Kne=Math.pow(2,63),Zne=function(t){return t<Une?1:t<Fne?2:t<zne?3:t<$ne?4:t<Gne?5:t<Hne?6:t<Wne?7:t<Vne?8:t<Kne?9:10},Yne={encode:Cne,decode:qne,encodingLength:Zne},Jne=Yne,ag=Jne;var cg=(t,e=0)=>[ag.decode(t,e),ag.decode.bytes],Fp=(t,e,r=0)=>(ag.encode(t,e,r),e),zp=t=>ag.encodingLength(t);p();p();var E9e=new Uint8Array(0);var tk=(t,e)=>{if(t===e)return!0;if(t.byteLength!==e.byteLength)return!1;for(let r=0;r<t.byteLength;r++)if(t[r]!==e[r])return!1;return!0},ta=t=>{if(t instanceof Uint8Array&&t.constructor.name==="Uint8Array")return t;if(t instanceof ArrayBuffer)return new Uint8Array(t);if(ArrayBuffer.isView(t))return new Uint8Array(t.buffer,t.byteOffset,t.byteLength);throw new Error("Unknown type, must be binary type")};var _l=(t,e)=>{let r=e.byteLength,n=zp(t),i=n+zp(r),o=new Uint8Array(i+r);return Fp(t,o,0),Fp(r,o,n),o.set(e,i),new $p(t,r,e,o)},Gp=t=>{let e=ta(t),[r,n]=cg(e),[i,o]=cg(e.subarray(n)),s=e.subarray(n+o);if(s.byteLength!==i)throw new Error("Incorrect length");return new $p(r,i,s,e)},nk=(t,e)=>{if(t===e)return!0;{let r=e;return t.code===r.code&&t.size===r.size&&r.bytes instanceof Uint8Array&&tk(t.bytes,r.bytes)}},$p=class{constructor(e,r,n,i){this.code=e,this.size=r,this.digest=n,this.bytes=i}};p();p();p();function Xne(t,e){if(t.length>=255)throw new TypeError("Alphabet too long");for(var r=new Uint8Array(256),n=0;n<r.length;n++)r[n]=255;for(var i=0;i<t.length;i++){var o=t.charAt(i),s=o.charCodeAt(0);if(r[s]!==255)throw new TypeError(o+" is ambiguous");r[s]=i}var a=t.length,c=t.charAt(0),d=Math.log(a)/Math.log(256),f=Math.log(256)/Math.log(a);function u(v){if(v instanceof Uint8Array||(ArrayBuffer.isView(v)?v=new Uint8Array(v.buffer,v.byteOffset,v.byteLength):Array.isArray(v)&&(v=Uint8Array.from(v))),!(v instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(v.length===0)return"";for(var A=0,T=0,M=0,D=v.length;M!==D&&v[M]===0;)M++,A++;for(var O=(D-M)*f+1>>>0,U=new Uint8Array(O);M!==D;){for(var L=v[M],F=0,$=O-1;(L!==0||F<T)&&$!==-1;$--,F++)L+=256*U[$]>>>0,U[$]=L%a>>>0,L=L/a>>>0;if(L!==0)throw new Error("Non-zero carry");T=F,M++}for(var H=O-T;H!==O&&U[H]===0;)H++;for(var z=c.repeat(A);H<O;++H)z+=t.charAt(U[H]);return z}function m(v){if(typeof v!="string")throw new TypeError("Expected String");if(v.length===0)return new Uint8Array;var A=0;if(v[A]!==" "){for(var T=0,M=0;v[A]===c;)T++,A++;for(var D=(v.length-A)*d+1>>>0,O=new Uint8Array(D);v[A];){var U=r[v.charCodeAt(A)];if(U===255)return;for(var L=0,F=D-1;(U!==0||L<M)&&F!==-1;F--,L++)U+=a*O[F]>>>0,O[F]=U%256>>>0,U=U/256>>>0;if(U!==0)throw new Error("Non-zero carry");M=L,A++}if(v[A]!==" "){for(var $=D-M;$!==D&&O[$]===0;)$++;for(var H=new Uint8Array(T+(D-$)),z=T;$!==D;)H[z++]=O[$++];return H}}}function _(v){var A=m(v);if(A)return A;throw new Error(`Non-${e} character`)}return{encode:u,decodeUnsafe:m,decode:_}}var Qne=Xne,eie=Qne,ik=eie;p();var Y8=class{constructor(e,r,n){this.name=e,this.prefix=r,this.baseEncode=n}encode(e){if(e instanceof Uint8Array)return`${this.prefix}${this.baseEncode(e)}`;throw Error("Unknown type, must be binary type")}},J8=class{constructor(e,r,n){if(this.name=e,this.prefix=r,r.codePointAt(0)===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=r.codePointAt(0),this.baseDecode=n}decode(e){if(typeof e=="string"){if(e.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(e)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(e.slice(this.prefix.length))}else throw Error("Can only multibase decode strings")}or(e){return ok(this,e)}},X8=class{constructor(e){this.decoders=e}or(e){return ok(this,e)}decode(e){let r=e[0],n=this.decoders[r];if(n)return n.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}},ok=(t,e)=>new X8({...t.decoders||{[t.prefix]:t},...e.decoders||{[e.prefix]:e}}),Q8=class{constructor(e,r,n,i){this.name=e,this.prefix=r,this.baseEncode=n,this.baseDecode=i,this.encoder=new Y8(e,r,n),this.decoder=new J8(e,r,i)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}},sk=({name:t,prefix:e,encode:r,decode:n})=>new Q8(t,e,r,n),eE=({prefix:t,name:e,alphabet:r})=>{let{encode:n,decode:i}=ik(r,e);return sk({prefix:t,name:e,encode:n,decode:o=>ta(i(o))})},tie=(t,e,r,n)=>{let i={};for(let f=0;f<e.length;++f)i[e[f]]=f;let o=t.length;for(;t[o-1]==="=";)--o;let s=new Uint8Array(o*r/8|0),a=0,c=0,d=0;for(let f=0;f<o;++f){let u=i[t[f]];if(u===void 0)throw new SyntaxError(`Non-${n} character`);c=c<<r|u,a+=r,a>=8&&(a-=8,s[d++]=255&c>>a)}if(a>=r||255&c<<8-a)throw new SyntaxError("Unexpected end of data");return s},rie=(t,e,r)=>{let n=e[e.length-1]==="=",i=(1<<r)-1,o="",s=0,a=0;for(let c=0;c<t.length;++c)for(a=a<<8|t[c],s+=8;s>r;)s-=r,o+=e[i&a>>s];if(s&&(o+=e[i&a<<r-s]),n)for(;o.length*r&7;)o+="=";return o},Xi=({name:t,prefix:e,bitsPerChar:r,alphabet:n})=>sk({prefix:e,name:t,encode(i){return rie(i,n,r)},decode(i){return tie(i,n,r,t)}});var Is=eE({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),j9e=eE({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});p();var ra=Xi({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),U9e=Xi({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),F9e=Xi({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),z9e=Xi({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),$9e=Xi({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),G9e=Xi({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),H9e=Xi({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),W9e=Xi({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),V9e=Xi({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});p();var ak=(t,e)=>{let{bytes:r,version:n}=t;switch(n){case 0:return iie(r,tE(t),e||Is.encoder);default:return oie(r,tE(t),e||ra.encoder)}};var ck=new WeakMap,tE=t=>{let e=ck.get(t);if(e==null){let r=new Map;return ck.set(t,r),r}return e},qe=class{constructor(e,r,n,i){this.code=r,this.version=e,this.multihash=n,this.bytes=i,this["/"]=i}get asCID(){return this}get byteOffset(){return this.bytes.byteOffset}get byteLength(){return this.bytes.byteLength}toV0(){switch(this.version){case 0:return this;case 1:{let{code:e,multihash:r}=this;if(e!==dg)throw new Error("Cannot convert a non dag-pb CID to CIDv0");if(r.code!==sie)throw new Error("Cannot convert non sha2-256 multihash CID to CIDv0");return qe.createV0(r)}default:throw Error(`Can not convert CID version ${this.version} to version 0. This is a bug please report`)}}toV1(){switch(this.version){case 0:{let{code:e,digest:r}=this.multihash,n=_l(e,r);return qe.createV1(this.code,n)}case 1:return this;default:throw Error(`Can not convert CID version ${this.version} to version 1. This is a bug please report`)}}equals(e){return qe.equals(this,e)}static equals(e,r){let n=r;return n&&e.code===n.code&&e.version===n.version&&nk(e.multihash,n.multihash)}toString(e){return ak(this,e)}toJSON(){return{"/":ak(this)}}link(){return this}get[Symbol.toStringTag](){return"CID"}[Symbol.for("nodejs.util.inspect.custom")](){return`CID(${this.toString()})`}static asCID(e){if(e==null)return null;let r=e;if(r instanceof qe)return r;if(r["/"]!=null&&r["/"]===r.bytes||r.asCID===r){let{version:n,code:i,multihash:o,bytes:s}=r;return new qe(n,i,o,s||dk(n,i,o.bytes))}else if(r[aie]===!0){let{version:n,multihash:i,code:o}=r,s=Gp(i);return qe.create(n,o,s)}else return null}static create(e,r,n){if(typeof r!="number")throw new Error("String codecs are no longer supported");if(!(n.bytes instanceof Uint8Array))throw new Error("Invalid digest");switch(e){case 0:{if(r!==dg)throw new Error(`Version 0 CID must use dag-pb (code: ${dg}) block encoding`);return new qe(e,r,n,n.bytes)}case 1:{let i=dk(e,r,n.bytes);return new qe(e,r,n,i)}default:throw new Error("Invalid version")}}static createV0(e){return qe.create(0,dg,e)}static createV1(e,r){return qe.create(1,e,r)}static decode(e){let[r,n]=qe.decodeFirst(e);if(n.length)throw new Error("Incorrect length");return r}static decodeFirst(e){let r=qe.inspectBytes(e),n=r.size-r.multihashSize,i=ta(e.subarray(n,n+r.multihashSize));if(i.byteLength!==r.multihashSize)throw new Error("Incorrect length");let o=i.subarray(r.multihashSize-r.digestSize),s=new $p(r.multihashCode,r.digestSize,o,i);return[r.version===0?qe.createV0(s):qe.createV1(r.codec,s),e.subarray(r.size)]}static inspectBytes(e){let r=0,n=()=>{let[u,m]=cg(e.subarray(r));return r+=m,u},i=n(),o=dg;if(i===18?(i=0,r=0):o=n(),i!==0&&i!==1)throw new RangeError(`Invalid CID version ${i}`);let s=r,a=n(),c=n(),d=r+c,f=d-s;return{version:i,codec:o,multihashCode:a,digestSize:c,multihashSize:f,size:d}}static parse(e,r){let[n,i]=nie(e,r),o=qe.decode(i);if(o.version===0&&e[0]!=="Q")throw Error("Version 0 CID string must not include multibase prefix");return tE(o).set(n,e),o}},nie=(t,e)=>{switch(t[0]){case"Q":{let r=e||Is;return[Is.prefix,r.decode(`${Is.prefix}${t}`)]}case Is.prefix:{let r=e||Is;return[Is.prefix,r.decode(t)]}case ra.prefix:{let r=e||ra;return[ra.prefix,r.decode(t)]}default:{if(e==null)throw Error("To parse non base32 or base58btc encoded CID multibase decoder must be provided");return[t[0],e.decode(t)]}}},iie=(t,e,r)=>{let{prefix:n}=r;if(n!==Is.prefix)throw Error(`Cannot string encode V0 in ${r.name} encoding`);let i=e.get(n);if(i==null){let o=r.encode(t).slice(1);return e.set(n,o),o}else return i},oie=(t,e,r)=>{let{prefix:n}=r,i=e.get(n);if(i==null){let o=r.encode(t);return e.set(n,o),o}else return i},dg=112,sie=18,dk=(t,e,r)=>{let n=zp(t),i=n+zp(e),o=new Uint8Array(i+r.byteLength);return Fp(t,o,0),Fp(e,o,n),o.set(r,i),o},aie=Symbol.for("@ipld/js-cid/CID");p();var Hse=mr(Wo(),1);p();p();p();function die(t){return t[Symbol.asyncIterator]!=null}function fie(t,e=1){return e=Number(e),die(t)?async function*(){let r=[];if(e<1&&(e=1),e!==Math.round(e))throw new Error("Batch size must be an integer");for await(let n of t)for(r.push(n);r.length>=e;)yield r.slice(0,e),r=r.slice(e);for(;r.length>0;)yield r.slice(0,e),r=r.slice(e)}():function*(){let r=[];if(e<1&&(e=1),e!==Math.round(e))throw new Error("Batch size must be an integer");for(let n of t)for(r.push(n);r.length>=e;)yield r.slice(0,e),r=r.slice(e);for(;r.length>0;)yield r.slice(0,e),r=r.slice(e)}()}var fg=fie;async function*ug(t,e=1){for await(let r of fg(t,e)){let n=r.map(async i=>i().then(o=>({ok:!0,value:o}),o=>({ok:!1,err:o})));for(let i=0;i<n.length;i++){let o=await n[i];if(o.ok)yield o.value;else throw o.err}}}p();p();p();function dd(t=0){return new Uint8Array(t)}function Vo(t=0){return new Uint8Array(t)}p();p();function lg(t,e){e==null&&(e=t.reduce((i,o)=>i+o.length,0));let r=Vo(e),n=0;for(let i of t)r.set(i,n),n+=i.length;return r}p();function lk(t,e){if(t===e)return!0;if(t.byteLength!==e.byteLength)return!1;for(let r=0;r<t.byteLength;r++)if(t[r]!==e[r])return!1;return!0}var pk=Symbol.for("@achingbrain/uint8arraylist");function hk(t,e){if(e==null||e<0)throw new RangeError("index is out of bounds");let r=0;for(let n of t){let i=r+n.byteLength;if(e<i)return{buf:n,index:e-r};r=i}throw new RangeError("index is out of bounds")}function sw(t){return Boolean(t?.[pk])}var Ja=class{bufs;length;[pk]=!0;constructor(...e){this.bufs=[],this.length=0,e.length>0&&this.appendAll(e)}*[Symbol.iterator](){yield*this.bufs}get byteLength(){return this.length}append(...e){this.appendAll(e)}appendAll(e){let r=0;for(let n of e)if(n instanceof Uint8Array)r+=n.byteLength,this.bufs.push(n);else if(sw(n))r+=n.byteLength,this.bufs.push(...n.bufs);else throw new Error("Could not append value, must be an Uint8Array or a Uint8ArrayList");this.length+=r}prepend(...e){this.prependAll(e)}prependAll(e){let r=0;for(let n of e.reverse())if(n instanceof Uint8Array)r+=n.byteLength,this.bufs.unshift(n);else if(sw(n))r+=n.byteLength,this.bufs.unshift(...n.bufs);else throw new Error("Could not prepend value, must be an Uint8Array or a Uint8ArrayList");this.length+=r}get(e){let r=hk(this.bufs,e);return r.buf[r.index]}set(e,r){let n=hk(this.bufs,e);n.buf[n.index]=r}write(e,r=0){if(e instanceof Uint8Array)for(let n=0;n<e.length;n++)this.set(r+n,e[n]);else if(sw(e))for(let n=0;n<e.length;n++)this.set(r+n,e.get(n));else throw new Error("Could not write value, must be an Uint8Array or a Uint8ArrayList")}consume(e){if(e=Math.trunc(e),!(Number.isNaN(e)||e<=0)){if(e===this.byteLength){this.bufs=[],this.length=0;return}for(;this.bufs.length>0;)if(e>=this.bufs[0].byteLength)e-=this.bufs[0].byteLength,this.length-=this.bufs[0].byteLength,this.bufs.shift();else{this.bufs[0]=this.bufs[0].subarray(e),this.length-=e;break}}}slice(e,r){let{bufs:n,length:i}=this._subList(e,r);return lg(n,i)}subarray(e,r){let{bufs:n,length:i}=this._subList(e,r);return n.length===1?n[0]:lg(n,i)}sublist(e,r){let{bufs:n,length:i}=this._subList(e,r),o=new Ja;return o.length=i,o.bufs=[...n],o}_subList(e,r){if(e=e??0,r=r??this.length,e<0&&(e=this.length+e),r<0&&(r=this.length+r),e<0||r>this.length)throw new RangeError("index is out of bounds");if(e===r)return{bufs:[],length:0};if(e===0&&r===this.length)return{bufs:this.bufs,length:this.length};let n=[],i=0;for(let o=0;o<this.bufs.length;o++){let s=this.bufs[o],a=i,c=a+s.byteLength;if(i=c,e>=c)continue;let d=e>=a&&e<c,f=r>a&&r<=c;if(d&&f){if(e===a&&r===c){n.push(s);break}let u=e-a;n.push(s.subarray(u,u+(r-e)));break}if(d){if(e===0){n.push(s);continue}n.push(s.subarray(e-a));continue}if(f){if(r===c){n.push(s);break}n.push(s.subarray(0,r-a));break}n.push(s)}return{bufs:n,length:r-e}}indexOf(e,r=0){if(!sw(e)&&!(e instanceof Uint8Array))throw new TypeError('The "value" argument must be a Uint8ArrayList or Uint8Array');let n=e instanceof Uint8Array?e:e.subarray();if(r=Number(r??0),isNaN(r)&&(r=0),r<0&&(r=this.length+r),r<0&&(r=0),e.length===0)return r>this.length?this.length:r;let i=n.byteLength;if(i===0)throw new TypeError("search must be at least 1 byte long");let o=256,s=new Int32Array(o);for(let u=0;u<o;u++)s[u]=-1;for(let u=0;u<i;u++)s[n[u]]=u;let a=s,c=this.byteLength-n.byteLength,d=n.byteLength-1,f;for(let u=r;u<=c;u+=f){f=0;for(let m=d;m>=0;m--){let _=this.get(u+m);if(n[m]!==_){f=Math.max(1,m-a[_]);break}}if(f===0)return u}return-1}getInt8(e){let r=this.subarray(e,e+1);return new DataView(r.buffer,r.byteOffset,r.byteLength).getInt8(0)}setInt8(e,r){let n=Vo(1);new DataView(n.buffer,n.byteOffset,n.byteLength).setInt8(0,r),this.write(n,e)}getInt16(e,r){let n=this.subarray(e,e+2);return new DataView(n.buffer,n.byteOffset,n.byteLength).getInt16(0,r)}setInt16(e,r,n){let i=dd(2);new DataView(i.buffer,i.byteOffset,i.byteLength).setInt16(0,r,n),this.write(i,e)}getInt32(e,r){let n=this.subarray(e,e+4);return new DataView(n.buffer,n.byteOffset,n.byteLength).getInt32(0,r)}setInt32(e,r,n){let i=dd(4);new DataView(i.buffer,i.byteOffset,i.byteLength).setInt32(0,r,n),this.write(i,e)}getBigInt64(e,r){let n=this.subarray(e,e+8);return new DataView(n.buffer,n.byteOffset,n.byteLength).getBigInt64(0,r)}setBigInt64(e,r,n){let i=dd(8);new DataView(i.buffer,i.byteOffset,i.byteLength).setBigInt64(0,r,n),this.write(i,e)}getUint8(e){let r=this.subarray(e,e+1);return new DataView(r.buffer,r.byteOffset,r.byteLength).getUint8(0)}setUint8(e,r){let n=Vo(1);new DataView(n.buffer,n.byteOffset,n.byteLength).setUint8(0,r),this.write(n,e)}getUint16(e,r){let n=this.subarray(e,e+2);return new DataView(n.buffer,n.byteOffset,n.byteLength).getUint16(0,r)}setUint16(e,r,n){let i=dd(2);new DataView(i.buffer,i.byteOffset,i.byteLength).setUint16(0,r,n),this.write(i,e)}getUint32(e,r){let n=this.subarray(e,e+4);return new DataView(n.buffer,n.byteOffset,n.byteLength).getUint32(0,r)}setUint32(e,r,n){let i=dd(4);new DataView(i.buffer,i.byteOffset,i.byteLength).setUint32(0,r,n),this.write(i,e)}getBigUint64(e,r){let n=this.subarray(e,e+8);return new DataView(n.buffer,n.byteOffset,n.byteLength).getBigUint64(0,r)}setBigUint64(e,r,n){let i=dd(8);new DataView(i.buffer,i.byteOffset,i.byteLength).setBigUint64(0,r,n),this.write(i,e)}getFloat32(e,r){let n=this.subarray(e,e+4);return new DataView(n.buffer,n.byteOffset,n.byteLength).getFloat32(0,r)}setFloat32(e,r,n){let i=dd(4);new DataView(i.buffer,i.byteOffset,i.byteLength).setFloat32(0,r,n),this.write(i,e)}getFloat64(e,r){let n=this.subarray(e,e+8);return new DataView(n.buffer,n.byteOffset,n.byteLength).getFloat64(0,r)}setFloat64(e,r,n){let i=dd(8);new DataView(i.buffer,i.byteOffset,i.byteLength).setFloat64(0,r,n),this.write(i,e)}equals(e){if(e==null||!(e instanceof Ja)||e.bufs.length!==this.bufs.length)return!1;for(let r=0;r<this.bufs.length;r++)if(!lk(this.bufs[r],e.bufs[r]))return!1;return!0}static fromUint8Arrays(e,r){let n=new Ja;return n.bufs=e,r==null&&(r=e.reduce((i,o)=>i+o.byteLength,0)),n.length=r,n}};var uie=262144,mk=(t={})=>{let e=t.chunkSize??uie;return async function*(n){let i=new Ja,o=0,s=!1;for await(let a of n)for(i.append(a),o+=a.length;o>=e;)if(yield i.slice(0,e),s=!0,e===i.length)i=new Ja,o=0;else{let c=new Ja;c.append(i.sublist(e)),i=c,o-=e}(!s||o>0)&&(yield i.subarray(0,o))}};p();var xl={};dr(xl,{code:()=>vg,createLink:()=>Lk,createNode:()=>qk,decode:()=>ud,encode:()=>Zo,name:()=>aoe,prepare:()=>Ko,validate:()=>hE});p();p();var sE={};dr(sE,{base32:()=>Vp,base32hex:()=>_ie,base32hexpad:()=>Eie,base32hexpadupper:()=>Sie,base32hexupper:()=>xie,base32pad:()=>vie,base32padupper:()=>wie,base32upper:()=>bie,base32z:()=>Aie});p();p();p();var B7e=new Uint8Array(0);function yk(t,e){if(t===e)return!0;if(t.byteLength!==e.byteLength)return!1;for(let r=0;r<t.byteLength;r++)if(t[r]!==e[r])return!1;return!0}function fd(t){if(t instanceof Uint8Array&&t.constructor.name==="Uint8Array")return t;if(t instanceof ArrayBuffer)return new Uint8Array(t);if(ArrayBuffer.isView(t))return new Uint8Array(t.buffer,t.byteOffset,t.byteLength);throw new Error("Unknown type, must be binary type")}function gk(t){return new TextEncoder().encode(t)}function bk(t){return new TextDecoder().decode(t)}p();function lie(t,e){if(t.length>=255)throw new TypeError("Alphabet too long");for(var r=new Uint8Array(256),n=0;n<r.length;n++)r[n]=255;for(var i=0;i<t.length;i++){var o=t.charAt(i),s=o.charCodeAt(0);if(r[s]!==255)throw new TypeError(o+" is ambiguous");r[s]=i}var a=t.length,c=t.charAt(0),d=Math.log(a)/Math.log(256),f=Math.log(256)/Math.log(a);function u(v){if(v instanceof Uint8Array||(ArrayBuffer.isView(v)?v=new Uint8Array(v.buffer,v.byteOffset,v.byteLength):Array.isArray(v)&&(v=Uint8Array.from(v))),!(v instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(v.length===0)return"";for(var A=0,T=0,M=0,D=v.length;M!==D&&v[M]===0;)M++,A++;for(var O=(D-M)*f+1>>>0,U=new Uint8Array(O);M!==D;){for(var L=v[M],F=0,$=O-1;(L!==0||F<T)&&$!==-1;$--,F++)L+=256*U[$]>>>0,U[$]=L%a>>>0,L=L/a>>>0;if(L!==0)throw new Error("Non-zero carry");T=F,M++}for(var H=O-T;H!==O&&U[H]===0;)H++;for(var z=c.repeat(A);H<O;++H)z+=t.charAt(U[H]);return z}function m(v){if(typeof v!="string")throw new TypeError("Expected String");if(v.length===0)return new Uint8Array;var A=0;if(v[A]!==" "){for(var T=0,M=0;v[A]===c;)T++,A++;for(var D=(v.length-A)*d+1>>>0,O=new Uint8Array(D);v[A];){var U=r[v.charCodeAt(A)];if(U===255)return;for(var L=0,F=D-1;(U!==0||L<M)&&F!==-1;F--,L++)U+=a*O[F]>>>0,O[F]=U%256>>>0,U=U/256>>>0;if(U!==0)throw new Error("Non-zero carry");M=L,A++}if(v[A]!==" "){for(var $=D-M;$!==D&&O[$]===0;)$++;for(var H=new Uint8Array(T+(D-$)),z=T;$!==D;)H[z++]=O[$++];return H}}}function _(v){var A=m(v);if(A)return A;throw new Error(`Non-${e} character`)}return{encode:u,decodeUnsafe:m,decode:_}}var hie=lie,pie=hie,wk=pie;var rE=class{name;prefix;baseEncode;constructor(e,r,n){this.name=e,this.prefix=r,this.baseEncode=n}encode(e){if(e instanceof Uint8Array)return`${this.prefix}${this.baseEncode(e)}`;throw Error("Unknown type, must be binary type")}},nE=class{name;prefix;baseDecode;prefixCodePoint;constructor(e,r,n){this.name=e,this.prefix=r;let i=r.codePointAt(0);if(i===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=i,this.baseDecode=n}decode(e){if(typeof e=="string"){if(e.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(e)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(e.slice(this.prefix.length))}else throw Error("Can only multibase decode strings")}or(e){return _k(this,e)}},iE=class{decoders;constructor(e){this.decoders=e}or(e){return _k(this,e)}decode(e){let r=e[0],n=this.decoders[r];if(n!=null)return n.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}};function _k(t,e){return new iE({...t.decoders??{[t.prefix]:t},...e.decoders??{[e.prefix]:e}})}var oE=class{name;prefix;baseEncode;baseDecode;encoder;decoder;constructor(e,r,n,i){this.name=e,this.prefix=r,this.baseEncode=n,this.baseDecode=i,this.encoder=new rE(e,r,n),this.decoder=new nE(e,r,i)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}};function Wp({name:t,prefix:e,encode:r,decode:n}){return new oE(t,e,r,n)}function Bf({name:t,prefix:e,alphabet:r}){let{encode:n,decode:i}=wk(r,t);return Wp({prefix:e,name:t,encode:n,decode:o=>fd(i(o))})}function mie(t,e,r,n){let i=t.length;for(;t[i-1]==="=";)--i;let o=new Uint8Array(i*r/8|0),s=0,a=0,c=0;for(let d=0;d<i;++d){let f=e[t[d]];if(f===void 0)throw new SyntaxError(`Non-${n} character`);a=a<<r|f,s+=r,s>=8&&(s-=8,o[c++]=255&a>>s)}if(s>=r||255&a<<8-s)throw new SyntaxError("Unexpected end of data");return o}function yie(t,e,r){let n=e[e.length-1]==="=",i=(1<<r)-1,o="",s=0,a=0;for(let c=0;c<t.length;++c)for(a=a<<8|t[c],s+=8;s>r;)s-=r,o+=e[i&a>>s];if(s!==0&&(o+=e[i&a<<r-s]),n)for(;o.length*r&7;)o+="=";return o}function gie(t){let e={};for(let r=0;r<t.length;++r)e[t[r]]=r;return e}function an({name:t,prefix:e,bitsPerChar:r,alphabet:n}){let i=gie(n);return Wp({prefix:e,name:t,encode(o){return yie(o,n,r)},decode(o){return mie(o,i,r,t)}})}var Vp=an({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),bie=an({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),vie=an({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),wie=an({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),_ie=an({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),xie=an({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),Eie=an({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),Sie=an({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),Aie=an({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});var aE={};dr(aE,{base36:()=>hg,base36upper:()=>Tie});p();var hg=Bf({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),Tie=Bf({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"});var cE={};dr(cE,{base58btc:()=>Xa,base58flickr:()=>Pie});p();var Xa=Bf({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),Pie=Bf({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});p();p();p();var Iie=Sk,xk=128,Rie=127,Mie=~Rie,kie=Math.pow(2,31);function Sk(t,e,r){e=e||[],r=r||0;for(var n=r;t>=kie;)e[r++]=t&255|xk,t/=128;for(;t&Mie;)e[r++]=t&255|xk,t>>>=7;return e[r]=t|0,Sk.bytes=r-n+1,e}var Bie=dE,Die=128,Ek=127;function dE(t,n){var r=0,n=n||0,i=0,o=n,s,a=t.length;do{if(o>=a)throw dE.bytes=0,new RangeError("Could not decode varint");s=t[o++],r+=i<28?(s&Ek)<<i:(s&Ek)*Math.pow(2,i),i+=7}while(s>=Die);return dE.bytes=o-n,r}var Cie=Math.pow(2,7),Oie=Math.pow(2,14),jie=Math.pow(2,21),Nie=Math.pow(2,28),qie=Math.pow(2,35),Lie=Math.pow(2,42),Uie=Math.pow(2,49),Fie=Math.pow(2,56),zie=Math.pow(2,63),$ie=function(t){return t<Cie?1:t<Oie?2:t<jie?3:t<Nie?4:t<qie?5:t<Lie?6:t<Uie?7:t<Fie?8:t<zie?9:10},Gie={encode:Iie,decode:Bie,encodingLength:$ie},Hie=Gie,pg=Hie;function mg(t,e=0){return[pg.decode(t,e),pg.decode.bytes]}function Kp(t,e,r=0){return pg.encode(t,e,r),e}function Zp(t){return pg.encodingLength(t)}function Jp(t,e){let r=e.byteLength,n=Zp(t),i=n+Zp(r),o=new Uint8Array(i+r);return Kp(t,o,0),Kp(r,o,n),o.set(e,i),new Yp(t,r,e,o)}function Ak(t){let e=fd(t),[r,n]=mg(e),[i,o]=mg(e.subarray(n)),s=e.subarray(n+o);if(s.byteLength!==i)throw new Error("Incorrect length");return new Yp(r,i,s,e)}function Tk(t,e){if(t===e)return!0;{let r=e;return t.code===r.code&&t.size===r.size&&r.bytes instanceof Uint8Array&&yk(t.bytes,r.bytes)}}var Yp=class{code;size;digest;bytes;constructor(e,r,n,i){this.code=e,this.size=r,this.digest=n,this.bytes=i}};p();function Pk(t,e){let{bytes:r,version:n}=t;switch(n){case 0:return Vie(r,fE(t),e??Xa.encoder);default:return Kie(r,fE(t),e??Vp.encoder)}}var Ik=new WeakMap;function fE(t){let e=Ik.get(t);if(e==null){let r=new Map;return Ik.set(t,r),r}return e}var Ar=class{code;version;multihash;bytes;"/";constructor(e,r,n,i){this.code=r,this.version=e,this.multihash=n,this.bytes=i,this["/"]=i}get asCID(){return this}get byteOffset(){return this.bytes.byteOffset}get byteLength(){return this.bytes.byteLength}toV0(){switch(this.version){case 0:return this;case 1:{let{code:e,multihash:r}=this;if(e!==gg)throw new Error("Cannot convert a non dag-pb CID to CIDv0");if(r.code!==Zie)throw new Error("Cannot convert non sha2-256 multihash CID to CIDv0");return Ar.createV0(r)}default:throw Error(`Can not convert CID version ${this.version} to version 0. This is a bug please report`)}}toV1(){switch(this.version){case 0:{let{code:e,digest:r}=this.multihash,n=Jp(e,r);return Ar.createV1(this.code,n)}case 1:return this;default:throw Error(`Can not convert CID version ${this.version} to version 1. This is a bug please report`)}}equals(e){return Ar.equals(this,e)}static equals(e,r){let n=r;return n!=null&&e.code===n.code&&e.version===n.version&&Tk(e.multihash,n.multihash)}toString(e){return Pk(this,e)}toJSON(){return{"/":Pk(this)}}link(){return this}[Symbol.toStringTag]="CID";[Symbol.for("nodejs.util.inspect.custom")](){return`CID(${this.toString()})`}static asCID(e){if(e==null)return null;let r=e;if(r instanceof Ar)return r;if(r["/"]!=null&&r["/"]===r.bytes||r.asCID===r){let{version:n,code:i,multihash:o,bytes:s}=r;return new Ar(n,i,o,s??Rk(n,i,o.bytes))}else if(r[Yie]===!0){let{version:n,multihash:i,code:o}=r,s=Ak(i);return Ar.create(n,o,s)}else return null}static create(e,r,n){if(typeof r!="number")throw new Error("String codecs are no longer supported");if(!(n.bytes instanceof Uint8Array))throw new Error("Invalid digest");switch(e){case 0:{if(r!==gg)throw new Error(`Version 0 CID must use dag-pb (code: ${gg}) block encoding`);return new Ar(e,r,n,n.bytes)}case 1:{let i=Rk(e,r,n.bytes);return new Ar(e,r,n,i)}default:throw new Error("Invalid version")}}static createV0(e){return Ar.create(0,gg,e)}static createV1(e,r){return Ar.create(1,e,r)}static decode(e){let[r,n]=Ar.decodeFirst(e);if(n.length!==0)throw new Error("Incorrect length");return r}static decodeFirst(e){let r=Ar.inspectBytes(e),n=r.size-r.multihashSize,i=fd(e.subarray(n,n+r.multihashSize));if(i.byteLength!==r.multihashSize)throw new Error("Incorrect length");let o=i.subarray(r.multihashSize-r.digestSize),s=new Yp(r.multihashCode,r.digestSize,o,i);return[r.version===0?Ar.createV0(s):Ar.createV1(r.codec,s),e.subarray(r.size)]}static inspectBytes(e){let r=0,n=()=>{let[u,m]=mg(e.subarray(r));return r+=m,u},i=n(),o=gg;if(i===18?(i=0,r=0):o=n(),i!==0&&i!==1)throw new RangeError(`Invalid CID version ${i}`);let s=r,a=n(),c=n(),d=r+c,f=d-s;return{version:i,codec:o,multihashCode:a,digestSize:c,multihashSize:f,size:d}}static parse(e,r){let[n,i]=Wie(e,r),o=Ar.decode(i);if(o.version===0&&e[0]!=="Q")throw Error("Version 0 CID string must not include multibase prefix");return fE(o).set(n,e),o}};function Wie(t,e){switch(t[0]){case"Q":{let r=e??Xa;return[Xa.prefix,r.decode(`${Xa.prefix}${t}`)]}case Xa.prefix:{let r=e??Xa;return[Xa.prefix,r.decode(t)]}case Vp.prefix:{let r=e??Vp;return[Vp.prefix,r.decode(t)]}case hg.prefix:{let r=e??hg;return[hg.prefix,r.decode(t)]}default:{if(e==null)throw Error("To parse non base32, base36 or base58btc encoded CID multibase decoder must be provided");return[t[0],e.decode(t)]}}}function Vie(t,e,r){let{prefix:n}=r;if(n!==Xa.prefix)throw Error(`Cannot string encode V0 in ${r.name} encoding`);let i=e.get(n);if(i==null){let o=r.encode(t).slice(1);return e.set(n,o),o}else return i}function Kie(t,e,r){let{prefix:n}=r,i=e.get(n);if(i==null){let o=r.encode(t);return e.set(n,o),o}else return i}var gg=112,Zie=18;function Rk(t,e,r){let n=Zp(t),i=n+Zp(e),o=new Uint8Array(i+r.byteLength);return Kp(t,o,0),Kp(e,o,n),o.set(r,i),o}var Yie=Symbol.for("@ipld/js-cid/CID");p();var Jie=new TextDecoder;function uE(t,e){let r=0;for(let n=0;;n+=7){if(n>=64)throw new Error("protobuf: varint overflow");if(e>=t.length)throw new Error("protobuf: unexpected end of data");let i=t[e++];if(r+=n<28?(i&127)<<n:(i&127)*2**n,i<128)break}return[r,e]}function cw(t,e){let r;[r,e]=uE(t,e);let n=e+r;if(r<0||n<0)throw new Error("protobuf: invalid length");if(n>t.length)throw new Error("protobuf: unexpected end of data");return[t.subarray(e,n),n]}function Mk(t,e){let r;return[r,e]=uE(t,e),[r&7,r>>3,e]}function Xie(t){let e={},r=t.length,n=0;for(;n<r;){let i,o;if([i,o,n]=Mk(t,n),o===1){if(e.Hash)throw new Error("protobuf: (PBLink) duplicate Hash section");if(i!==2)throw new Error(`protobuf: (PBLink) wrong wireType (${i}) for Hash`);if(e.Name!==void 0)throw new Error("protobuf: (PBLink) invalid order, found Name before Hash");if(e.Tsize!==void 0)throw new Error("protobuf: (PBLink) invalid order, found Tsize before Hash");[e.Hash,n]=cw(t,n)}else if(o===2){if(e.Name!==void 0)throw new Error("protobuf: (PBLink) duplicate Name section");if(i!==2)throw new Error(`protobuf: (PBLink) wrong wireType (${i}) for Name`);if(e.Tsize!==void 0)throw new Error("protobuf: (PBLink) invalid order, found Tsize before Name");let s;[s,n]=cw(t,n),e.Name=Jie.decode(s)}else if(o===3){if(e.Tsize!==void 0)throw new Error("protobuf: (PBLink) duplicate Tsize section");if(i!==0)throw new Error(`protobuf: (PBLink) wrong wireType (${i}) for Tsize`);[e.Tsize,n]=uE(t,n)}else throw new Error(`protobuf: (PBLink) invalid fieldNumber, expected 1, 2 or 3, got ${o}`)}if(n>r)throw new Error("protobuf: (PBLink) unexpected end of data");return e}function kk(t){let e=t.length,r=0,n,i=!1,o;for(;r<e;){let a,c;if([a,c,r]=Mk(t,r),a!==2)throw new Error(`protobuf: (PBNode) invalid wireType, expected 2, got ${a}`);if(c===1){if(o)throw new Error("protobuf: (PBNode) duplicate Data section");[o,r]=cw(t,r),n&&(i=!0)}else if(c===2){if(i)throw new Error("protobuf: (PBNode) duplicate Links section");n||(n=[]);let d;[d,r]=cw(t,r),n.push(Xie(d))}else throw new Error(`protobuf: (PBNode) invalid fieldNumber, expected 1 or 2, got ${c}`)}if(r>e)throw new Error("protobuf: (PBNode) unexpected end of data");let s={};return o&&(s.Data=o),s.Links=n||[],s}p();var Dk=new TextEncoder,Bk=2**32,Qie=2**31;function eoe(t,e){let r=e.length;if(typeof t.Tsize=="number"){if(t.Tsize<0)throw new Error("Tsize cannot be negative");if(!Number.isSafeInteger(t.Tsize))throw new Error("Tsize too large for encoding");r=bg(e,r,t.Tsize)-1,e[r]=24}if(typeof t.Name=="string"){let n=Dk.encode(t.Name);r-=n.length,e.set(n,r),r=bg(e,r,n.length)-1,e[r]=18}return t.Hash&&(r-=t.Hash.length,e.set(t.Hash,r),r=bg(e,r,t.Hash.length)-1,e[r]=10),e.length-r}function Ck(t){let e=roe(t),r=new Uint8Array(e),n=e;if(t.Data&&(n-=t.Data.length,r.set(t.Data,n),n=bg(r,n,t.Data.length)-1,r[n]=10),t.Links)for(let i=t.Links.length-1;i>=0;i--){let o=eoe(t.Links[i],r.subarray(0,n));n-=o,n=bg(r,n,o)-1,r[n]=18}return r}function toe(t){let e=0;if(t.Hash){let r=t.Hash.length;e+=1+r+Xp(r)}if(typeof t.Name=="string"){let r=Dk.encode(t.Name).length;e+=1+r+Xp(r)}return typeof t.Tsize=="number"&&(e+=1+Xp(t.Tsize)),e}function roe(t){let e=0;if(t.Data){let r=t.Data.length;e+=1+r+Xp(r)}if(t.Links)for(let r of t.Links){let n=toe(r);e+=1+n+Xp(n)}return e}function bg(t,e,r){e-=Xp(r);let n=e;for(;r>=Qie;)t[e++]=r&127|128,r/=128;for(;r>=128;)t[e++]=r&127|128,r>>>=7;return t[e]=r,n}function Xp(t){return t%2===0&&t++,Math.floor((noe(t)+6)/7)}function noe(t){let e=0;return t>=Bk&&(t=Math.floor(t/Bk),e=32),t>=1<<16&&(t>>>=16,e+=16),t>=1<<8&&(t>>>=8,e+=8),e+ioe[t]}var ioe=[0,1,2,2,3,3,3,3,4,4,4,4,4,4,4,4,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8];p();var ooe=["Data","Links"],soe=["Hash","Name","Tsize"],lE=new TextEncoder;function jk(t,e){if(t===e)return 0;let r=t.Name?lE.encode(t.Name):[],n=e.Name?lE.encode(e.Name):[],i=r.length,o=n.length;for(let s=0,a=Math.min(i,o);s<a;++s)if(r[s]!==n[s]){i=r[s],o=n[s];break}return i<o?-1:o<i?1:0}function Ok(t,e){return!Object.keys(t).some(r=>!e.includes(r))}function Nk(t){if(typeof t.asCID=="object"){let r=Ar.asCID(t);if(!r)throw new TypeError("Invalid DAG-PB form");return{Hash:r}}if(typeof t!="object"||Array.isArray(t))throw new TypeError("Invalid DAG-PB form");let e={};if(t.Hash){let r=Ar.asCID(t.Hash);try{r||(typeof t.Hash=="string"?r=Ar.parse(t.Hash):t.Hash instanceof Uint8Array&&(r=Ar.decode(t.Hash)))}catch(n){throw new TypeError(`Invalid DAG-PB form: ${n.message}`)}r&&(e.Hash=r)}if(!e.Hash)throw new TypeError("Invalid DAG-PB form");return typeof t.Name=="string"&&(e.Name=t.Name),typeof t.Tsize=="number"&&(e.Tsize=t.Tsize),e}function Ko(t){if((t instanceof Uint8Array||typeof t=="string")&&(t={Data:t}),typeof t!="object"||Array.isArray(t))throw new TypeError("Invalid DAG-PB form");let e={};if(t.Data!==void 0)if(typeof t.Data=="string")e.Data=lE.encode(t.Data);else if(t.Data instanceof Uint8Array)e.Data=t.Data;else throw new TypeError("Invalid DAG-PB form");if(t.Links!==void 0)if(Array.isArray(t.Links))e.Links=t.Links.map(Nk),e.Links.sort(jk);else throw new TypeError("Invalid DAG-PB form");else e.Links=[];return e}function hE(t){if(!t||typeof t!="object"||Array.isArray(t)||t instanceof Uint8Array||t["/"]&&t["/"]===t.bytes)throw new TypeError("Invalid DAG-PB form");if(!Ok(t,ooe))throw new TypeError("Invalid DAG-PB form (extraneous properties)");if(t.Data!==void 0&&!(t.Data instanceof Uint8Array))throw new TypeError("Invalid DAG-PB form (Data must be bytes)");if(!Array.isArray(t.Links))throw new TypeError("Invalid DAG-PB form (Links must be a list)");for(let e=0;e<t.Links.length;e++){let r=t.Links[e];if(!r||typeof r!="object"||Array.isArray(r)||r instanceof Uint8Array||r["/"]&&r["/"]===r.bytes)throw new TypeError("Invalid DAG-PB form (bad link)");if(!Ok(r,soe))throw new TypeError("Invalid DAG-PB form (extraneous properties on link)");if(r.Hash===void 0)throw new TypeError("Invalid DAG-PB form (link must have a Hash)");if(r.Hash==null||!r.Hash["/"]||r.Hash["/"]!==r.Hash.bytes)throw new TypeError("Invalid DAG-PB form (link Hash must be a CID)");if(r.Name!==void 0&&typeof r.Name!="string")throw new TypeError("Invalid DAG-PB form (link Name must be a string)");if(r.Tsize!==void 0){if(typeof r.Tsize!="number"||r.Tsize%1!==0)throw new TypeError("Invalid DAG-PB form (link Tsize must be an integer)");if(r.Tsize<0)throw new TypeError("Invalid DAG-PB form (link Tsize cannot be negative)")}if(e>0&&jk(r,t.Links[e-1])===-1)throw new TypeError("Invalid DAG-PB form (links must be sorted by Name bytes)")}}function qk(t,e=[]){return Ko({Data:t,Links:e})}function Lk(t,e,r){return Nk({Hash:r,Name:t,Tsize:e})}function Uk(t){return t instanceof ArrayBuffer?new Uint8Array(t,0,t.byteLength):t}var aoe="dag-pb",vg=112;function Zo(t){hE(t);let e={};return t.Links&&(e.Links=t.Links.map(r=>{let n={};return r.Hash&&(n.Hash=r.Hash.bytes),r.Name!==void 0&&(n.Name=r.Name),r.Tsize!==void 0&&(n.Tsize=r.Tsize),n})),t.Data&&(e.Data=t.Data),Ck(e)}function ud(t){let e=Uk(t),r=kk(e),n={};return r.Data&&(n.Data=r.Data),r.Links&&(n.Links=r.Links.map(i=>{let o={};try{o.Hash=Ar.decode(i.Hash)}catch{}if(!o.Hash)throw new Error("Invalid Hash field found in link, expected CID");return i.Name!==void 0&&(o.Name=i.Name),i.Tsize!==void 0&&(o.Tsize=i.Tsize),o})),n}p();p();var dw=class extends Error{name=dw.name;code=dw.code;constructor(e="Invalid type"){super(e)}},El=dw;Zy(El,"name","InvalidTypeError"),Zy(El,"code","ERR_INVALID_TYPE");var fw=class extends Error{name=fw.name;code=fw.code;constructor(e="Invalid message"){super(e)}},Qp=fw;Zy(Qp,"name","InvalidUnixFSMessageError"),Zy(Qp,"code","ERR_INVALID_MESSAGE");p();p();p();p();p();var coe=Math.pow(2,7),doe=Math.pow(2,14),foe=Math.pow(2,21),Fk=Math.pow(2,28),zk=Math.pow(2,35),$k=Math.pow(2,42),Gk=Math.pow(2,49),Qi=128,Df=127;function wg(t){if(t<coe)return 1;if(t<doe)return 2;if(t<foe)return 3;if(t<Fk)return 4;if(t<zk)return 5;if(t<$k)return 6;if(t<Gk)return 7;if(Number.MAX_SAFE_INTEGER!=null&&t>Number.MAX_SAFE_INTEGER)throw new RangeError("Could not encode varint");return 8}function Hk(t,e,r=0){switch(wg(t)){case 8:e[r++]=t&255|Qi,t/=128;case 7:e[r++]=t&255|Qi,t/=128;case 6:e[r++]=t&255|Qi,t/=128;case 5:e[r++]=t&255|Qi,t/=128;case 4:e[r++]=t&255|Qi,t>>>=7;case 3:e[r++]=t&255|Qi,t>>>=7;case 2:e[r++]=t&255|Qi,t>>>=7;case 1:{e[r++]=t&255,t>>>=7;break}default:throw new Error("unreachable")}return e}function Wk(t,e){let r=t[e],n=0;if(n+=r&Df,r<Qi||(r=t[e+1],n+=(r&Df)<<7,r<Qi)||(r=t[e+2],n+=(r&Df)<<14,r<Qi)||(r=t[e+3],n+=(r&Df)<<21,r<Qi)||(r=t[e+4],n+=(r&Df)*Fk,r<Qi)||(r=t[e+5],n+=(r&Df)*zk,r<Qi)||(r=t[e+6],n+=(r&Df)*$k,r<Qi)||(r=t[e+7],n+=(r&Df)*Gk,r<Qi))return n;throw new RangeError("Could not decode varint")}p();var pE=new Float32Array([-0]),Cf=new Uint8Array(pE.buffer);function Vk(t,e,r){pE[0]=t,e[r]=Cf[0],e[r+1]=Cf[1],e[r+2]=Cf[2],e[r+3]=Cf[3]}function Kk(t,e){return Cf[0]=t[e],Cf[1]=t[e+1],Cf[2]=t[e+2],Cf[3]=t[e+3],pE[0]}var mE=new Float64Array([-0]),Di=new Uint8Array(mE.buffer);function Zk(t,e,r){mE[0]=t,e[r]=Di[0],e[r+1]=Di[1],e[r+2]=Di[2],e[r+3]=Di[3],e[r+4]=Di[4],e[r+5]=Di[5],e[r+6]=Di[6],e[r+7]=Di[7]}function Yk(t,e){return Di[0]=t[e],Di[1]=t[e+1],Di[2]=t[e+2],Di[3]=t[e+3],Di[4]=t[e+4],Di[5]=t[e+5],Di[6]=t[e+6],Di[7]=t[e+7],mE[0]}p();var uoe=BigInt(Number.MAX_SAFE_INTEGER),loe=BigInt(Number.MIN_SAFE_INTEGER),Sn=class{lo;hi;constructor(e,r){this.lo=e|0,this.hi=r|0}toNumber(e=!1){if(!e&&this.hi>>>31>0){let r=~this.lo+1>>>0,n=~this.hi>>>0;return r===0&&(n=n+1>>>0),-(r+n*4294967296)}return this.lo+this.hi*4294967296}toBigInt(e=!1){if(e)return BigInt(this.lo>>>0)+(BigInt(this.hi>>>0)<<32n);if(this.hi>>>31){let r=~this.lo+1>>>0,n=~this.hi>>>0;return r===0&&(n=n+1>>>0),-(BigInt(r)+(BigInt(n)<<32n))}return BigInt(this.lo>>>0)+(BigInt(this.hi>>>0)<<32n)}toString(e=!1){return this.toBigInt(e).toString()}zzEncode(){let e=this.hi>>31;return this.hi=((this.hi<<1|this.lo>>>31)^e)>>>0,this.lo=(this.lo<<1^e)>>>0,this}zzDecode(){let e=-(this.lo&1);return this.lo=((this.lo>>>1|this.hi<<31)^e)>>>0,this.hi=(this.hi>>>1^e)>>>0,this}length(){let e=this.lo,r=(this.lo>>>28|this.hi<<4)>>>0,n=this.hi>>>24;return n===0?r===0?e<16384?e<128?1:2:e<2097152?3:4:r<16384?r<128?5:6:r<2097152?7:8:n<128?9:10}static fromBigInt(e){if(e===0n)return Sl;if(e<uoe&&e>loe)return this.fromNumber(Number(e));let r=e<0n;r&&(e=-e);let n=e>>32n,i=e-(n<<32n);return r&&(n=~n|0n,i=~i|0n,++i>Jk&&(i=0n,++n>Jk&&(n=0n))),new Sn(Number(i),Number(n))}static fromNumber(e){if(e===0)return Sl;let r=e<0;r&&(e=-e);let n=e>>>0,i=(e-n)/4294967296>>>0;return r&&(i=~i>>>0,n=~n>>>0,++n>4294967295&&(n=0,++i>4294967295&&(i=0))),new Sn(n,i)}static from(e){return typeof e=="number"?Sn.fromNumber(e):typeof e=="bigint"?Sn.fromBigInt(e):typeof e=="string"?Sn.fromBigInt(BigInt(e)):e.low!=null||e.high!=null?new Sn(e.low>>>0,e.high>>>0):Sl}},Sl=new Sn(0,0);Sl.toBigInt=function(){return 0n};Sl.zzEncode=Sl.zzDecode=function(){return this};Sl.length=function(){return 1};var Jk=4294967296n;p();function Xk(t){let e=0,r=0;for(let n=0;n<t.length;++n)r=t.charCodeAt(n),r<128?e+=1:r<2048?e+=2:(r&64512)===55296&&(t.charCodeAt(n+1)&64512)===56320?(++n,e+=4):e+=3;return e}function Qk(t,e,r){if(r-e<1)return"";let i,o=[],s=0,a;for(;e<r;)a=t[e++],a<128?o[s++]=a:a>191&&a<224?o[s++]=(a&31)<<6|t[e++]&63:a>239&&a<365?(a=((a&7)<<18|(t[e++]&63)<<12|(t[e++]&63)<<6|t[e++]&63)-65536,o[s++]=55296+(a>>10),o[s++]=56320+(a&1023)):o[s++]=(a&15)<<12|(t[e++]&63)<<6|t[e++]&63,s>8191&&((i??(i=[])).push(String.fromCharCode.apply(String,o)),s=0);return i!=null?(s>0&&i.push(String.fromCharCode.apply(String,o.slice(0,s))),i.join("")):String.fromCharCode.apply(String,o.slice(0,s))}function yE(t,e,r){let n=r,i,o;for(let s=0;s<t.length;++s)i=t.charCodeAt(s),i<128?e[r++]=i:i<2048?(e[r++]=i>>6|192,e[r++]=i&63|128):(i&64512)===55296&&((o=t.charCodeAt(s+1))&64512)===56320?(i=65536+((i&1023)<<10)+(o&1023),++s,e[r++]=i>>18|240,e[r++]=i>>12&63|128,e[r++]=i>>6&63|128,e[r++]=i&63|128):(e[r++]=i>>12|224,e[r++]=i>>6&63|128,e[r++]=i&63|128);return r-n}function na(t,e){return RangeError(`index out of range: ${t.pos} + ${e??1} > ${t.len}`)}function uw(t,e){return(t[e-4]|t[e-3]<<8|t[e-2]<<16|t[e-1]<<24)>>>0}var gE=class{buf;pos;len;_slice=Uint8Array.prototype.subarray;constructor(e){this.buf=e,this.pos=0,this.len=e.length}uint32(){let e=4294967295;if(e=(this.buf[this.pos]&127)>>>0,this.buf[this.pos++]<128||(e=(e|(this.buf[this.pos]&127)<<7)>>>0,this.buf[this.pos++]<128)||(e=(e|(this.buf[this.pos]&127)<<14)>>>0,this.buf[this.pos++]<128)||(e=(e|(this.buf[this.pos]&127)<<21)>>>0,this.buf[this.pos++]<128)||(e=(e|(this.buf[this.pos]&15)<<28)>>>0,this.buf[this.pos++]<128))return e;if((this.pos+=5)>this.len)throw this.pos=this.len,na(this,10);return e}int32(){return this.uint32()|0}sint32(){let e=this.uint32();return e>>>1^-(e&1)|0}bool(){return this.uint32()!==0}fixed32(){if(this.pos+4>this.len)throw na(this,4);return uw(this.buf,this.pos+=4)}sfixed32(){if(this.pos+4>this.len)throw na(this,4);return uw(this.buf,this.pos+=4)|0}float(){if(this.pos+4>this.len)throw na(this,4);let e=Kk(this.buf,this.pos);return this.pos+=4,e}double(){if(this.pos+8>this.len)throw na(this,4);let e=Yk(this.buf,this.pos);return this.pos+=8,e}bytes(){let e=this.uint32(),r=this.pos,n=this.pos+e;if(n>this.len)throw na(this,e);return this.pos+=e,r===n?new Uint8Array(0):this.buf.subarray(r,n)}string(){let e=this.bytes();return Qk(e,0,e.length)}skip(e){if(typeof e=="number"){if(this.pos+e>this.len)throw na(this,e);this.pos+=e}else do if(this.pos>=this.len)throw na(this);while(this.buf[this.pos++]&128);return this}skipType(e){switch(e){case 0:this.skip();break;case 1:this.skip(8);break;case 2:this.skip(this.uint32());break;case 3:for(;(e=this.uint32()&7)!==4;)this.skipType(e);break;case 5:this.skip(4);break;default:throw Error(`invalid wire type ${e} at offset ${this.pos}`)}return this}readLongVarint(){let e=new Sn(0,0),r=0;if(this.len-this.pos>4){for(;r<4;++r)if(e.lo=(e.lo|(this.buf[this.pos]&127)<<r*7)>>>0,this.buf[this.pos++]<128)return e;if(e.lo=(e.lo|(this.buf[this.pos]&127)<<28)>>>0,e.hi=(e.hi|(this.buf[this.pos]&127)>>4)>>>0,this.buf[this.pos++]<128)return e;r=0}else{for(;r<3;++r){if(this.pos>=this.len)throw na(this);if(e.lo=(e.lo|(this.buf[this.pos]&127)<<r*7)>>>0,this.buf[this.pos++]<128)return e}return e.lo=(e.lo|(this.buf[this.pos++]&127)<<r*7)>>>0,e}if(this.len-this.pos>4){for(;r<5;++r)if(e.hi=(e.hi|(this.buf[this.pos]&127)<<r*7+3)>>>0,this.buf[this.pos++]<128)return e}else for(;r<5;++r){if(this.pos>=this.len)throw na(this);if(e.hi=(e.hi|(this.buf[this.pos]&127)<<r*7+3)>>>0,this.buf[this.pos++]<128)return e}throw Error("invalid varint encoding")}readFixed64(){if(this.pos+8>this.len)throw na(this,8);let e=uw(this.buf,this.pos+=4),r=uw(this.buf,this.pos+=4);return new Sn(e,r)}int64(){return this.readLongVarint().toBigInt()}int64Number(){return this.readLongVarint().toNumber()}int64String(){return this.readLongVarint().toString()}uint64(){return this.readLongVarint().toBigInt(!0)}uint64Number(){let e=Wk(this.buf,this.pos);return this.pos+=wg(e),e}uint64String(){return this.readLongVarint().toString(!0)}sint64(){return this.readLongVarint().zzDecode().toBigInt()}sint64Number(){return this.readLongVarint().zzDecode().toNumber()}sint64String(){return this.readLongVarint().zzDecode().toString()}fixed64(){return this.readFixed64().toBigInt()}fixed64Number(){return this.readFixed64().toNumber()}fixed64String(){return this.readFixed64().toString()}sfixed64(){return this.readFixed64().toBigInt()}sfixed64Number(){return this.readFixed64().toNumber()}sfixed64String(){return this.readFixed64().toString()}};function bE(t){return new gE(t instanceof Uint8Array?t:t.subarray())}function _g(t,e,r){let n=bE(t);return e.decode(n,void 0,r)}p();p();p();p();p();var vE={};dr(vE,{base10:()=>hoe});p();var hoe=Bf({prefix:"9",name:"base10",alphabet:"0123456789"});var wE={};dr(wE,{base16:()=>poe,base16upper:()=>moe});p();var poe=an({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),moe=an({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4});var _E={};dr(_E,{base2:()=>yoe});p();var yoe=an({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1});var xE={};dr(xE,{base256emoji:()=>_oe});p();var tB=Array.from("\u{1F680}\u{1FA90}\u2604\u{1F6F0}\u{1F30C}\u{1F311}\u{1F312}\u{1F313}\u{1F314}\u{1F315}\u{1F316}\u{1F317}\u{1F318}\u{1F30D}\u{1F30F}\u{1F30E}\u{1F409}\u2600\u{1F4BB}\u{1F5A5}\u{1F4BE}\u{1F4BF}\u{1F602}\u2764\u{1F60D}\u{1F923}\u{1F60A}\u{1F64F}\u{1F495}\u{1F62D}\u{1F618}\u{1F44D}\u{1F605}\u{1F44F}\u{1F601}\u{1F525}\u{1F970}\u{1F494}\u{1F496}\u{1F499}\u{1F622}\u{1F914}\u{1F606}\u{1F644}\u{1F4AA}\u{1F609}\u263A\u{1F44C}\u{1F917}\u{1F49C}\u{1F614}\u{1F60E}\u{1F607}\u{1F339}\u{1F926}\u{1F389}\u{1F49E}\u270C\u2728\u{1F937}\u{1F631}\u{1F60C}\u{1F338}\u{1F64C}\u{1F60B}\u{1F497}\u{1F49A}\u{1F60F}\u{1F49B}\u{1F642}\u{1F493}\u{1F929}\u{1F604}\u{1F600}\u{1F5A4}\u{1F603}\u{1F4AF}\u{1F648}\u{1F447}\u{1F3B6}\u{1F612}\u{1F92D}\u2763\u{1F61C}\u{1F48B}\u{1F440}\u{1F62A}\u{1F611}\u{1F4A5}\u{1F64B}\u{1F61E}\u{1F629}\u{1F621}\u{1F92A}\u{1F44A}\u{1F973}\u{1F625}\u{1F924}\u{1F449}\u{1F483}\u{1F633}\u270B\u{1F61A}\u{1F61D}\u{1F634}\u{1F31F}\u{1F62C}\u{1F643}\u{1F340}\u{1F337}\u{1F63B}\u{1F613}\u2B50\u2705\u{1F97A}\u{1F308}\u{1F608}\u{1F918}\u{1F4A6}\u2714\u{1F623}\u{1F3C3}\u{1F490}\u2639\u{1F38A}\u{1F498}\u{1F620}\u261D\u{1F615}\u{1F33A}\u{1F382}\u{1F33B}\u{1F610}\u{1F595}\u{1F49D}\u{1F64A}\u{1F639}\u{1F5E3}\u{1F4AB}\u{1F480}\u{1F451}\u{1F3B5}\u{1F91E}\u{1F61B}\u{1F534}\u{1F624}\u{1F33C}\u{1F62B}\u26BD\u{1F919}\u2615\u{1F3C6}\u{1F92B}\u{1F448}\u{1F62E}\u{1F646}\u{1F37B}\u{1F343}\u{1F436}\u{1F481}\u{1F632}\u{1F33F}\u{1F9E1}\u{1F381}\u26A1\u{1F31E}\u{1F388}\u274C\u270A\u{1F44B}\u{1F630}\u{1F928}\u{1F636}\u{1F91D}\u{1F6B6}\u{1F4B0}\u{1F353}\u{1F4A2}\u{1F91F}\u{1F641}\u{1F6A8}\u{1F4A8}\u{1F92C}\u2708\u{1F380}\u{1F37A}\u{1F913}\u{1F619}\u{1F49F}\u{1F331}\u{1F616}\u{1F476}\u{1F974}\u25B6\u27A1\u2753\u{1F48E}\u{1F4B8}\u2B07\u{1F628}\u{1F31A}\u{1F98B}\u{1F637}\u{1F57A}\u26A0\u{1F645}\u{1F61F}\u{1F635}\u{1F44E}\u{1F932}\u{1F920}\u{1F927}\u{1F4CC}\u{1F535}\u{1F485}\u{1F9D0}\u{1F43E}\u{1F352}\u{1F617}\u{1F911}\u{1F30A}\u{1F92F}\u{1F437}\u260E\u{1F4A7}\u{1F62F}\u{1F486}\u{1F446}\u{1F3A4}\u{1F647}\u{1F351}\u2744\u{1F334}\u{1F4A3}\u{1F438}\u{1F48C}\u{1F4CD}\u{1F940}\u{1F922}\u{1F445}\u{1F4A1}\u{1F4A9}\u{1F450}\u{1F4F8}\u{1F47B}\u{1F910}\u{1F92E}\u{1F3BC}\u{1F975}\u{1F6A9}\u{1F34E}\u{1F34A}\u{1F47C}\u{1F48D}\u{1F4E3}\u{1F942}"),goe=tB.reduce((t,e,r)=>(t[r]=e,t),[]),boe=tB.reduce((t,e,r)=>{let n=e.codePointAt(0);if(n==null)throw new Error(`Invalid character: ${e}`);return t[n]=r,t},[]);function voe(t){return t.reduce((e,r)=>(e+=goe[r],e),"")}function woe(t){let e=[];for(let r of t){let n=r.codePointAt(0);if(n==null)throw new Error(`Invalid character: ${r}`);let i=boe[n];if(i==null)throw new Error(`Non-base256emoji character: ${r}`);e.push(i)}return new Uint8Array(e)}var _oe=Wp({prefix:"\u{1F680}",name:"base256emoji",encode:voe,decode:woe});var EE={};dr(EE,{base64:()=>xoe,base64pad:()=>Eoe,base64url:()=>Soe,base64urlpad:()=>Aoe});p();var xoe=an({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),Eoe=an({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),Soe=an({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),Aoe=an({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});var SE={};dr(SE,{base8:()=>Toe});p();var Toe=an({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3});var AE={};dr(AE,{identity:()=>Poe});p();var Poe=Wp({prefix:"\0",name:"identity",encode:t=>bk(t),decode:t=>gk(t)});p();var XIe=new TextEncoder,QIe=new TextDecoder;p();var TE={};dr(TE,{identity:()=>Boe});p();var rB=0,Moe="identity",nB=fd;function koe(t,e){if(e?.truncate!=null&&e.truncate!==t.byteLength){if(e.truncate<0||e.truncate>t.byteLength)throw new Error(`Invalid truncate option, must be less than or equal to ${t.byteLength}`);t=t.subarray(0,e.truncate)}return Jp(rB,nB(t))}var Boe={code:rB,name:Moe,encode:nB,digest:koe};var IE={};dr(IE,{sha256:()=>Coe,sha512:()=>Ooe});p();p();var Doe=20;function Al({name:t,code:e,encode:r,minDigestLength:n,maxDigestLength:i}){return new PE(t,e,r,n,i)}var PE=class{name;code;encode;minDigestLength;maxDigestLength;constructor(e,r,n,i,o){this.name=e,this.code=r,this.encode=n,this.minDigestLength=i??Doe,this.maxDigestLength=o}digest(e,r){if(r?.truncate!=null){if(r.truncate<this.minDigestLength)throw new Error(`Invalid truncate option, must be greater than or equal to ${this.minDigestLength}`);if(this.maxDigestLength!=null&&r.truncate>this.maxDigestLength)throw new Error(`Invalid truncate option, must be less than or equal to ${this.maxDigestLength}`)}if(e instanceof Uint8Array){let n=this.encode(e);return n instanceof Uint8Array?iB(n,this.code,r?.truncate):n.then(i=>iB(i,this.code,r?.truncate))}else throw Error("Unknown type, must be binary type")}};function iB(t,e,r){if(r!=null&&r!==t.byteLength){if(r>t.byteLength)throw new Error(`Invalid truncate option, must be less than or equal to ${t.byteLength}`);t=t.subarray(0,r)}return Jp(e,t)}function sB(t){return async e=>new Uint8Array(await crypto.subtle.digest(t,e))}var Coe=Al({name:"sha2-256",code:18,encode:sB("SHA-256")}),Ooe=Al({name:"sha2-512",code:19,encode:sB("SHA-512")});p();p();p();p();p();p();var RE={...AE,..._E,...SE,...vE,...wE,...sE,...aE,...cE,...EE,...xE},ERe={...IE,...TE};function cB(t,e,r,n){return{name:t,prefix:e,encoder:{name:t,prefix:e,encode:r},decoder:{decode:n}}}var aB=cB("utf8","u",t=>"u"+new TextDecoder("utf8").decode(t),t=>new TextEncoder().encode(t.substring(1))),ME=cB("ascii","a",t=>{let e="a";for(let r=0;r<t.length;r++)e+=String.fromCharCode(t[r]);return e},t=>{t=t.substring(1);let e=Vo(t.length);for(let r=0;r<t.length;r++)e[r]=t.charCodeAt(r);return e}),joe={utf8:aB,"utf-8":aB,hex:RE.base16,latin1:ME,ascii:ME,binary:ME,...RE},dB=joe;function lw(t,e="utf8"){let r=dB[e];if(r==null)throw new Error(`Unsupported encoding "${e}"`);return r.decoder.decode(`${r.prefix}${t}`)}p();function kE(t){let e=t??8192,r=e>>>1,n,i=e;return function(s){if(s<1||s>r)return Vo(s);i+s>e&&(n=Vo(e),i=0);let a=n.subarray(i,i+=s);return i&7&&(i=(i|7)+1),a}}var Tl=class{fn;len;next;val;constructor(e,r,n){this.fn=e,this.len=r,this.next=void 0,this.val=n}};function BE(){}var CE=class{head;tail;len;next;constructor(e){this.head=e.head,this.tail=e.tail,this.len=e.len,this.next=e.states}},Noe=kE();function qoe(t){return globalThis.Buffer!=null?Vo(t):Noe(t)}var Eg=class{len;head;tail;states;constructor(){this.len=0,this.head=new Tl(BE,0,0),this.tail=this.head,this.states=null}_push(e,r,n){return this.tail=this.tail.next=new Tl(e,r,n),this.len+=r,this}uint32(e){return this.len+=(this.tail=this.tail.next=new OE((e=e>>>0)<128?1:e<16384?2:e<2097152?3:e<268435456?4:5,e)).len,this}int32(e){return e<0?this._push(hw,10,Sn.fromNumber(e)):this.uint32(e)}sint32(e){return this.uint32((e<<1^e>>31)>>>0)}uint64(e){let r=Sn.fromBigInt(e);return this._push(hw,r.length(),r)}uint64Number(e){return this._push(Hk,wg(e),e)}uint64String(e){return this.uint64(BigInt(e))}int64(e){return this.uint64(e)}int64Number(e){return this.uint64Number(e)}int64String(e){return this.uint64String(e)}sint64(e){let r=Sn.fromBigInt(e).zzEncode();return this._push(hw,r.length(),r)}sint64Number(e){let r=Sn.fromNumber(e).zzEncode();return this._push(hw,r.length(),r)}sint64String(e){return this.sint64(BigInt(e))}bool(e){return this._push(DE,1,e?1:0)}fixed32(e){return this._push(xg,4,e>>>0)}sfixed32(e){return this.fixed32(e)}fixed64(e){let r=Sn.fromBigInt(e);return this._push(xg,4,r.lo)._push(xg,4,r.hi)}fixed64Number(e){let r=Sn.fromNumber(e);return this._push(xg,4,r.lo)._push(xg,4,r.hi)}fixed64String(e){return this.fixed64(BigInt(e))}sfixed64(e){return this.fixed64(e)}sfixed64Number(e){return this.fixed64Number(e)}sfixed64String(e){return this.fixed64String(e)}float(e){return this._push(Vk,4,e)}double(e){return this._push(Zk,8,e)}bytes(e){let r=e.length>>>0;return r===0?this._push(DE,1,0):this.uint32(r)._push(Uoe,r,e)}string(e){let r=Xk(e);return r!==0?this.uint32(r)._push(yE,r,e):this._push(DE,1,0)}fork(){return this.states=new CE(this),this.head=this.tail=new Tl(BE,0,0),this.len=0,this}reset(){return this.states!=null?(this.head=this.states.head,this.tail=this.states.tail,this.len=this.states.len,this.states=this.states.next):(this.head=this.tail=new Tl(BE,0,0),this.len=0),this}ldelim(){let e=this.head,r=this.tail,n=this.len;return this.reset().uint32(n),n!==0&&(this.tail.next=e.next,this.tail=r,this.len+=n),this}finish(){let e=this.head.next,r=qoe(this.len),n=0;for(;e!=null;)e.fn(e.val,r,n),n+=e.len,e=e.next;return r}};function DE(t,e,r){e[r]=t&255}function Loe(t,e,r){for(;t>127;)e[r++]=t&127|128,t>>>=7;e[r]=t}var OE=class extends Tl{next;constructor(e,r){super(Loe,e,r),this.next=void 0}};function hw(t,e,r){for(;t.hi!==0;)e[r++]=t.lo&127|128,t.lo=(t.lo>>>7|t.hi<<25)>>>0,t.hi>>>=7;for(;t.lo>127;)e[r++]=t.lo&127|128,t.lo=t.lo>>>7;e[r++]=t.lo}function xg(t,e,r){e[r]=t&255,e[r+1]=t>>>8&255,e[r+2]=t>>>16&255,e[r+3]=t>>>24}function Uoe(t,e,r){e.set(t,r)}globalThis.Buffer!=null&&(Eg.prototype.bytes=function(t){let e=t.length>>>0;return this.uint32(e),e>0&&this._push(Foe,e,t),this},Eg.prototype.string=function(t){let e=globalThis.Buffer.byteLength(t);return this.uint32(e),e>0&&this._push(zoe,e,t),this});function Foe(t,e,r){e.set(t,r)}function zoe(t,e,r){t.length<40?yE(t,e,r):e.utf8Write!=null?e.utf8Write(t,r):e.set(lw(t),r)}function jE(){return new Eg}function Sg(t,e){let r=jE();return e.encode(t,r,{lengthDelimited:!1}),r.finish()}p();p();var e0;(function(t){t[t.VARINT=0]="VARINT",t[t.BIT64=1]="BIT64",t[t.LENGTH_DELIMITED=2]="LENGTH_DELIMITED",t[t.START_GROUP=3]="START_GROUP",t[t.END_GROUP=4]="END_GROUP",t[t.BIT32=5]="BIT32"})(e0||(e0={}));function pw(t,e,r,n){return{name:t,type:e,encode:r,decode:n}}function NE(t){function e(i){if(t[i.toString()]==null)throw new Error("Invalid enum value");return t[i]}let r=function(o,s){let a=e(o);s.int32(a)},n=function(o){let s=o.int32();return e(s)};return pw("enum",e0.VARINT,r,n)}p();function Ag(t,e){return pw("message",e0.LENGTH_DELIMITED,t,e)}var ia;(function(t){let e;(function(i){i.Raw="Raw",i.Directory="Directory",i.File="File",i.Metadata="Metadata",i.Symlink="Symlink",i.HAMTShard="HAMTShard"})(e=t.DataType||(t.DataType={}));let r;(function(i){i[i.Raw=0]="Raw",i[i.Directory=1]="Directory",i[i.File=2]="File",i[i.Metadata=3]="Metadata",i[i.Symlink=4]="Symlink",i[i.HAMTShard=5]="HAMTShard"})(r||(r={})),function(i){i.codec=()=>NE(r)}(e=t.DataType||(t.DataType={}));let n;t.codec=()=>(n==null&&(n=Ag((i,o,s={})=>{if(s.lengthDelimited!==!1&&o.fork(),i.Type!=null&&(o.uint32(8),t.DataType.codec().encode(i.Type,o)),i.Data!=null&&(o.uint32(18),o.bytes(i.Data)),i.filesize!=null&&(o.uint32(24),o.uint64(i.filesize)),i.blocksizes!=null)for(let a of i.blocksizes)o.uint32(32),o.uint64(a);i.hashType!=null&&(o.uint32(40),o.uint64(i.hashType)),i.fanout!=null&&(o.uint32(48),o.uint64(i.fanout)),i.mode!=null&&(o.uint32(56),o.uint32(i.mode)),i.mtime!=null&&(o.uint32(66),mw.codec().encode(i.mtime,o)),s.lengthDelimited!==!1&&o.ldelim()},(i,o)=>{let s={blocksizes:[]},a=o==null?i.len:i.pos+o;for(;i.pos<a;){let c=i.uint32();switch(c>>>3){case 1:s.Type=t.DataType.codec().decode(i);break;case 2:s.Data=i.bytes();break;case 3:s.filesize=i.uint64();break;case 4:s.blocksizes.push(i.uint64());break;case 5:s.hashType=i.uint64();break;case 6:s.fanout=i.uint64();break;case 7:s.mode=i.uint32();break;case 8:s.mtime=mw.codec().decode(i,i.uint32());break;default:i.skipType(c&7);break}}return s})),n),t.encode=i=>Sg(i,t.codec()),t.decode=i=>_g(i,t.codec())})(ia||(ia={}));var mw;(function(t){let e;t.codec=()=>(e==null&&(e=Ag((r,n,i={})=>{i.lengthDelimited!==!1&&n.fork(),r.Seconds!=null&&(n.uint32(8),n.int64(r.Seconds)),r.FractionalNanoseconds!=null&&(n.uint32(21),n.fixed32(r.FractionalNanoseconds)),i.lengthDelimited!==!1&&n.ldelim()},(r,n)=>{let i={},o=n==null?r.len:r.pos+n;for(;r.pos<o;){let s=r.uint32();switch(s>>>3){case 1:i.Seconds=r.int64();break;case 2:i.FractionalNanoseconds=r.fixed32();break;default:r.skipType(s&7);break}}return i})),e),t.encode=r=>Sg(r,t.codec()),t.decode=r=>_g(r,t.codec())})(mw||(mw={}));var fB;(function(t){let e;t.codec=()=>(e==null&&(e=Ag((r,n,i={})=>{i.lengthDelimited!==!1&&n.fork(),r.MimeType!=null&&(n.uint32(10),n.string(r.MimeType)),i.lengthDelimited!==!1&&n.ldelim()},(r,n)=>{let i={},o=n==null?r.len:r.pos+n;for(;r.pos<o;){let s=r.uint32();switch(s>>>3){case 1:i.MimeType=r.string();break;default:r.skipType(s&7);break}}return i})),e),t.encode=r=>Sg(r,t.codec()),t.decode=r=>_g(r,t.codec())})(fB||(fB={}));var uB={Raw:"raw",Directory:"directory",File:"file",Metadata:"metadata",Symlink:"symlink",HAMTShard:"hamt-sharded-directory"},$oe=["directory","hamt-sharded-directory"],lB=parseInt("0644",8),hB=parseInt("0755",8),pB=BigInt(1<<10),An=class{static unmarshal(e){let r=ia.decode(e);if(r.fanout!=null&&r.fanout>pB)throw new Qp(`Fanout size was too large - ${r.fanout} > ${pB}`);let n=new An({type:uB[r.Type!=null?r.Type.toString():"File"],data:r.Data,blockSizes:r.blocksizes,mode:r.mode,mtime:r.mtime!=null?{secs:r.mtime.Seconds??0n,nsecs:r.mtime.FractionalNanoseconds}:void 0,fanout:r.fanout});return n._originalMode=r.mode??0,n}type;data;blockSizes;hashType;fanout;mtime;_mode;_originalMode;constructor(e={type:"file"}){let{type:r,data:n,blockSizes:i,hashType:o,fanout:s,mtime:a,mode:c}=e;if(r!=null&&!Object.values(uB).includes(r))throw new El("Type: "+r+" is not valid");this.type=r??"file",this.data=n,this.hashType=o,this.fanout=s,this.blockSizes=i??[],this._originalMode=0,this.mode=c,this.mtime=a}set mode(e){e==null?this._mode=this.isDirectory()?hB:lB:this._mode=e&4095}get mode(){return this._mode}isDirectory(){return $oe.includes(this.type)}addBlockSize(e){this.blockSizes.push(e)}removeBlockSize(e){this.blockSizes.splice(e,1)}fileSize(){if(this.isDirectory())return 0n;let e=0n;return this.blockSizes.forEach(r=>{e+=r}),this.data!=null&&(e+=BigInt(this.data.length)),e}marshal(){let e;switch(this.type){case"raw":e=ia.DataType.Raw;break;case"directory":e=ia.DataType.Directory;break;case"file":e=ia.DataType.File;break;case"metadata":e=ia.DataType.Metadata;break;case"symlink":e=ia.DataType.Symlink;break;case"hamt-sharded-directory":e=ia.DataType.HAMTShard;break;default:throw new El(`Type: ${e} is not valid`)}let r=this.data;(this.data==null||this.data.length===0)&&(r=void 0);let n;this.mode!=null&&(n=this._originalMode&4294963200|(this.mode??0),n===lB&&!this.isDirectory()&&(n=void 0),n===hB&&this.isDirectory()&&(n=void 0));let i;return this.mtime!=null&&(i={Seconds:this.mtime.secs,FractionalNanoseconds:this.mtime.nsecs}),ia.encode({Type:e,Data:r,filesize:this.isDirectory()?void 0:this.fileSize(),blocksizes:this.blockSizes,hashType:this.hashType,fanout:this.fanout,mode:n,mtime:i})}};var Pl={};dr(Pl,{code:()=>Qa,decode:()=>Woe,encode:()=>Hoe,name:()=>Goe});p();var Goe="raw",Qa=85,Hoe=t=>ta(t),Woe=t=>ta(t);p();var cn=class extends Event{type;detail;constructor(e,r){super(e),this.type=e,this.detail=r}};p();p();p();var LE=({name:t,code:e,encode:r})=>new qE(t,e,r),qE=class{constructor(e,r,n){this.name=e,this.code=r,this.encode=n}digest(e){if(e instanceof Uint8Array){let r=this.encode(e);return r instanceof Uint8Array?_l(this.code,r):r.then(n=>_l(this.code,n))}else throw Error("Unknown type, must be binary type")}};var mB=t=>async e=>new Uint8Array(await crypto.subtle.digest(t,e)),Eo=LE({name:"sha2-256",code:18,encode:mB("SHA-256")}),EMe=LE({name:"sha2-512",code:19,encode:mB("SHA-512")});var oa=async(t,e,r)=>{r.codec==null&&(r.codec=xl);let n=await Eo.digest(t),i=qe.create(r.cidVersion,r.codec.code,n);return await e.put(i,t,r),i};function yB(t){return async function*(r,n){let i=0n;for await(let o of r.content)yield async()=>{let s,a={codec:xl,cidVersion:t.cidVersion,onProgress:t.onProgress};t.rawLeaves?(a.codec=Pl,a.cidVersion=1):(s=new An({type:t.leafType,data:o}),o=Zo({Data:s.marshal(),Links:[]}));let c=await oa(o,n,a);return i+=BigInt(o.byteLength),t.onProgress?.(new cn("unixfs:importer:progress:file:write",{bytesWritten:i,cid:c,path:r.path})),{cid:c,unixfs:s,size:BigInt(o.length),block:o}}}}p();var UE=mr(Wo(),1);p();var gB=async(t,e,r)=>{let n=new An({type:"directory",mtime:t.mtime,mode:t.mode}),i=Zo(Ko({Data:n.marshal()})),o=await oa(i,e,r),s=t.path;return{cid:o,path:s,unixfs:n,size:BigInt(i.length),originalPath:t.originalPath,block:i}};p();async function*Koe(t,e,r){let n=-1,i;for await(let o of ug(r.bufferImporter(t,e),r.blockWriteConcurrency)){if(n++,n===0){i={...o,single:!0};continue}else n===1&&i!=null&&(yield{...i,block:void 0,single:void 0},i=void 0);yield{...o,block:void 0}}i!=null&&(yield i)}function bB(t){return t.single===!0}var Zoe=(t,e,r)=>async function(i){if(i.length===1&&bB(i[0])&&r.reduceSingleLeafToSelf){let f=i[0],u=f.block;return bB(f)&&(t.mtime!==void 0||t.mode!==void 0)&&(f.unixfs=new An({type:"file",mtime:t.mtime,mode:t.mode,data:f.block}),u={Data:f.unixfs.marshal(),Links:[]},f.block=Zo(Ko(u)),f.cid=await oa(f.block,e,{...r,cidVersion:r.cidVersion}),f.size=BigInt(f.block.length)),r.onProgress?.(new cn("unixfs:importer:progress:file:layout",{cid:f.cid,path:f.originalPath})),{cid:f.cid,path:t.path,unixfs:f.unixfs,size:f.size,originalPath:f.originalPath}}let o=new An({type:"file",mtime:t.mtime,mode:t.mode}),s=i.filter(f=>f.cid.code===Qa&&f.size>0||f.unixfs!=null&&f.unixfs.data==null&&f.unixfs.fileSize()>0n?!0:Boolean(f.unixfs?.data?.length)).map(f=>f.cid.code===Qa?(o.addBlockSize(f.size),{Name:"",Tsize:Number(f.size),Hash:f.cid}):(f.unixfs==null||f.unixfs.data==null?o.addBlockSize(f.unixfs?.fileSize()??0n):o.addBlockSize(BigInt(f.unixfs.data.length)),{Name:"",Tsize:Number(f.size),Hash:f.cid})),a={Data:o.marshal(),Links:s},c=Zo(Ko(a)),d=await oa(c,e,r);return r.onProgress?.(new cn("unixfs:importer:progress:file:layout",{cid:d,path:t.originalPath})),{cid:d,path:t.path,unixfs:o,size:BigInt(c.length+a.Links.reduce((f,u)=>f+(u.Tsize??0),0)),originalPath:t.originalPath,block:c}},vB=async(t,e,r)=>r.layout(Koe(t,e,r),Zoe(t,e,r));function Yoe(t){return Symbol.iterator in t}function Joe(t){return Symbol.asyncIterator in t}function Xoe(t){try{if(t instanceof Uint8Array)return async function*(){yield t}();if(Yoe(t))return async function*(){yield*t}();if(Joe(t))return t}catch{throw(0,UE.default)(new Error("Content was invalid"),"ERR_INVALID_CONTENT")}throw(0,UE.default)(new Error("Content was invalid"),"ERR_INVALID_CONTENT")}function wB(t){return async function*(r,n){for await(let i of r){let o;if(i.path!=null&&(o=i.path,i.path=i.path.split("/").filter(s=>s!=null&&s!==".").join("/")),Qoe(i)){let s={path:i.path,mtime:i.mtime,mode:i.mode,content:async function*(){let a=0n;for await(let c of t.chunker(t.chunkValidator(Xoe(i.content)))){let d=BigInt(c.byteLength);a+=d,t.onProgress?.(new cn("unixfs:importer:progress:file:read",{bytesRead:a,chunkSize:d,path:i.path})),yield c}}(),originalPath:o};yield async()=>vB(s,n,t)}else if(i.path!=null){let s={path:i.path,mtime:i.mtime,mode:i.mode,originalPath:o};yield async()=>gB(s,n,t)}else throw new Error("Import candidate must have content or path or both")}}}function Qoe(t){return t.content!=null}p();var t4=mr(Wo(),1);p();p();function yw(t){return globalThis.Buffer!=null?new Uint8Array(t.buffer,t.byteOffset,t.byteLength):t}p();p();var FE={};dr(FE,{base10:()=>ese});p();var ese=kf({prefix:"9",name:"base10",alphabet:"0123456789"});var zE={};dr(zE,{base16:()=>tse,base16upper:()=>rse});p();var tse=sn({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),rse=sn({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4});var $E={};dr($E,{base2:()=>nse});p();var nse=sn({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1});var GE={};dr(GE,{base256emoji:()=>cse});p();var _B=Array.from("\u{1F680}\u{1FA90}\u2604\u{1F6F0}\u{1F30C}\u{1F311}\u{1F312}\u{1F313}\u{1F314}\u{1F315}\u{1F316}\u{1F317}\u{1F318}\u{1F30D}\u{1F30F}\u{1F30E}\u{1F409}\u2600\u{1F4BB}\u{1F5A5}\u{1F4BE}\u{1F4BF}\u{1F602}\u2764\u{1F60D}\u{1F923}\u{1F60A}\u{1F64F}\u{1F495}\u{1F62D}\u{1F618}\u{1F44D}\u{1F605}\u{1F44F}\u{1F601}\u{1F525}\u{1F970}\u{1F494}\u{1F496}\u{1F499}\u{1F622}\u{1F914}\u{1F606}\u{1F644}\u{1F4AA}\u{1F609}\u263A\u{1F44C}\u{1F917}\u{1F49C}\u{1F614}\u{1F60E}\u{1F607}\u{1F339}\u{1F926}\u{1F389}\u{1F49E}\u270C\u2728\u{1F937}\u{1F631}\u{1F60C}\u{1F338}\u{1F64C}\u{1F60B}\u{1F497}\u{1F49A}\u{1F60F}\u{1F49B}\u{1F642}\u{1F493}\u{1F929}\u{1F604}\u{1F600}\u{1F5A4}\u{1F603}\u{1F4AF}\u{1F648}\u{1F447}\u{1F3B6}\u{1F612}\u{1F92D}\u2763\u{1F61C}\u{1F48B}\u{1F440}\u{1F62A}\u{1F611}\u{1F4A5}\u{1F64B}\u{1F61E}\u{1F629}\u{1F621}\u{1F92A}\u{1F44A}\u{1F973}\u{1F625}\u{1F924}\u{1F449}\u{1F483}\u{1F633}\u270B\u{1F61A}\u{1F61D}\u{1F634}\u{1F31F}\u{1F62C}\u{1F643}\u{1F340}\u{1F337}\u{1F63B}\u{1F613}\u2B50\u2705\u{1F97A}\u{1F308}\u{1F608}\u{1F918}\u{1F4A6}\u2714\u{1F623}\u{1F3C3}\u{1F490}\u2639\u{1F38A}\u{1F498}\u{1F620}\u261D\u{1F615}\u{1F33A}\u{1F382}\u{1F33B}\u{1F610}\u{1F595}\u{1F49D}\u{1F64A}\u{1F639}\u{1F5E3}\u{1F4AB}\u{1F480}\u{1F451}\u{1F3B5}\u{1F91E}\u{1F61B}\u{1F534}\u{1F624}\u{1F33C}\u{1F62B}\u26BD\u{1F919}\u2615\u{1F3C6}\u{1F92B}\u{1F448}\u{1F62E}\u{1F646}\u{1F37B}\u{1F343}\u{1F436}\u{1F481}\u{1F632}\u{1F33F}\u{1F9E1}\u{1F381}\u26A1\u{1F31E}\u{1F388}\u274C\u270A\u{1F44B}\u{1F630}\u{1F928}\u{1F636}\u{1F91D}\u{1F6B6}\u{1F4B0}\u{1F353}\u{1F4A2}\u{1F91F}\u{1F641}\u{1F6A8}\u{1F4A8}\u{1F92C}\u2708\u{1F380}\u{1F37A}\u{1F913}\u{1F619}\u{1F49F}\u{1F331}\u{1F616}\u{1F476}\u{1F974}\u25B6\u27A1\u2753\u{1F48E}\u{1F4B8}\u2B07\u{1F628}\u{1F31A}\u{1F98B}\u{1F637}\u{1F57A}\u26A0\u{1F645}\u{1F61F}\u{1F635}\u{1F44E}\u{1F932}\u{1F920}\u{1F927}\u{1F4CC}\u{1F535}\u{1F485}\u{1F9D0}\u{1F43E}\u{1F352}\u{1F617}\u{1F911}\u{1F30A}\u{1F92F}\u{1F437}\u260E\u{1F4A7}\u{1F62F}\u{1F486}\u{1F446}\u{1F3A4}\u{1F647}\u{1F351}\u2744\u{1F334}\u{1F4A3}\u{1F438}\u{1F48C}\u{1F4CD}\u{1F940}\u{1F922}\u{1F445}\u{1F4A1}\u{1F4A9}\u{1F450}\u{1F4F8}\u{1F47B}\u{1F910}\u{1F92E}\u{1F3BC}\u{1F975}\u{1F6A9}\u{1F34E}\u{1F34A}\u{1F47C}\u{1F48D}\u{1F4E3}\u{1F942}"),ise=_B.reduce((t,e,r)=>(t[r]=e,t),[]),ose=_B.reduce((t,e,r)=>(t[e.codePointAt(0)]=r,t),[]);function sse(t){return t.reduce((e,r)=>(e+=ise[r],e),"")}function ase(t){let e=[];for(let r of t){let n=ose[r.codePointAt(0)];if(n===void 0)throw new Error(`Non-base256emoji character: ${r}`);e.push(n)}return new Uint8Array(e)}var cse=Op({prefix:"\u{1F680}",name:"base256emoji",encode:sse,decode:ase});var HE={};dr(HE,{base36:()=>dse,base36upper:()=>fse});p();var dse=kf({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),fse=kf({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"});var WE={};dr(WE,{base64:()=>use,base64pad:()=>lse,base64url:()=>hse,base64urlpad:()=>pse});p();var use=sn({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),lse=sn({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),hse=sn({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),pse=sn({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});var VE={};dr(VE,{base8:()=>mse});p();var mse=sn({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3});var KE={};dr(KE,{identity:()=>yse});p();var yse=Op({prefix:"\0",name:"identity",encode:t=>LM(t),decode:t=>qM(t)});p();var gke=new TextEncoder,bke=new TextDecoder;p();var ZE={};dr(ZE,{identity:()=>_se});p();var xB=0,vse="identity",EB=cd,wse=t=>wl(xB,EB(t)),_se={code:xB,name:vse,encode:EB,digest:wse};var XE={};dr(XE,{sha256:()=>xse,sha512:()=>Ese});p();p();var JE=({name:t,code:e,encode:r})=>new YE(t,e,r),YE=class{constructor(e,r,n){this.name=e,this.code=r,this.encode=n}digest(e){if(e instanceof Uint8Array){let r=this.encode(e);return r instanceof Uint8Array?wl(this.code,r):r.then(n=>wl(this.code,n))}else throw Error("Unknown type, must be binary type")}};var AB=t=>async e=>new Uint8Array(await crypto.subtle.digest(t,e)),xse=JE({name:"sha2-256",code:18,encode:AB("SHA-256")}),Ese=JE({name:"sha2-512",code:19,encode:AB("SHA-512")});p();p();var QE={...KE,...$E,...VE,...FE,...zE,...G8,...HE,...H8,...WE,...GE},Dke={...XE,...ZE};p();function TB(t=0){return globalThis.Buffer?.allocUnsafe!=null?yw(globalThis.Buffer.allocUnsafe(t)):new Uint8Array(t)}function IB(t,e,r,n){return{name:t,prefix:e,encoder:{name:t,prefix:e,encode:r},decoder:{decode:n}}}var PB=IB("utf8","u",t=>"u"+new TextDecoder("utf8").decode(t),t=>new TextEncoder().encode(t.substring(1))),e4=IB("ascii","a",t=>{let e="a";for(let r=0;r<t.length;r++)e+=String.fromCharCode(t[r]);return e},t=>{t=t.substring(1);let e=TB(t.length);for(let r=0;r<t.length;r++)e[r]=t.charCodeAt(r);return e}),Sse={utf8:PB,"utf-8":PB,hex:QE.base16,latin1:e4,ascii:e4,binary:e4,...QE},RB=Sse;function MB(t,e="utf8"){let r=RB[e];if(r==null)throw new Error(`Unsupported encoding "${e}"`);return(e==="utf8"||e==="utf-8")&&globalThis.Buffer!=null&&globalThis.Buffer.from!=null?yw(globalThis.Buffer.from(t,"utf-8")):r.decoder.decode(`${r.prefix}${t}`)}var kB=()=>async function*(e){for await(let r of e){if(r.length===void 0)throw(0,t4.default)(new Error("Content was invalid"),"ERR_INVALID_CONTENT");if(typeof r=="string"||r instanceof String)yield MB(r.toString());else if(Array.isArray(r))yield Uint8Array.from(r);else if(r instanceof Uint8Array)yield r;else throw(0,t4.default)(new Error("Content was invalid"),"ERR_INVALID_CONTENT")}};p();p();var Ase=174;function r4(t){let e=t?.maxChildrenPerNode??Ase;return async function r(n,i){let o=[];for await(let s of fg(n,e))o.push(await i(s));return o.length>1?r(o,i):o[0]}}p();p();p();p();p();p();var ec=class{options;root;dir;path;dirty;flat;parent;parentKey;unixfs;mode;mtime;cid;size;nodeSize;constructor(e,r){this.options=r??{},this.root=e.root,this.dir=e.dir,this.path=e.path,this.dirty=e.dirty,this.flat=e.flat,this.parent=e.parent,this.parentKey=e.parentKey,this.unixfs=e.unixfs,this.mode=e.mode,this.mtime=e.mtime}},Tg=qe.parse("QmUNLLsPACCz1vLxQVkXqqLX5R1X345qqfHbsf67hvA3Nn"),Pg=qe.parse("zdj7WbTaiJT1fgatdet9Ei9iDB5hdCxkbVyhyh8YTUnXMiwYi");var Il=class extends ec{_children;constructor(e,r){super(e,r),this._children=new Map}async put(e,r){this.cid=void 0,this.size=void 0,this.nodeSize=void 0,this._children.set(e,r)}async get(e){return Promise.resolve(this._children.get(e))}childCount(){return this._children.size}directChildrenCount(){return this.childCount()}onlyChild(){return this._children.values().next().value}async*eachChildSeries(){for(let[e,r]of this._children.entries())yield{key:e,child:r}}estimateNodeSize(){if(this.nodeSize!==void 0)return this.nodeSize;this.nodeSize=0;for(let[e,r]of this._children.entries())r.size!=null&&r.cid!=null&&(this.nodeSize+=e.length+(this.options.cidVersion===1?Pg.bytes.byteLength:Tg.bytes.byteLength));return this.nodeSize}async*flush(e){let r=[];for(let[c,d]of this._children.entries()){let f=d;if(d instanceof ec)for await(let u of d.flush(e))f=u,yield u;f.size!=null&&f.cid!=null&&r.push({Name:c,Tsize:Number(f.size),Hash:f.cid})}let n=new An({type:"directory",mtime:this.mtime,mode:this.mode}),i={Data:n.marshal(),Links:r},o=Zo(Ko(i)),s=await oa(o,e,this.options),a=o.length+i.Links.reduce((c,d)=>c+(d.Tsize==null?0:d.Tsize),0);this.cid=s,this.size=a,yield{cid:s,unixfs:n,path:this.path,size:BigInt(a)}}};p();p();p();p();function Of(t,e){let r=t.lo+e.lo>>>0,n=t.hi+e.hi+(r<t.lo?1:0)>>>0;return{lo:r,hi:n}}function Tse(t,e){return t+e>>>0}function Rs(t,e){let r=t.lo&65535,n=t.lo>>>16,i=e.lo&65535,o=e.lo>>>16,s=r*i,a=r*o,c=n*i,d=n*o,f=(s>>>16)+(a&65535)+(c&65535)>>>0,u=(f<<16|s&65535)>>>0,m=d+(a>>>16)+(c>>>16)+(f>>>16),_=Math.imul(t.lo,e.hi),v=Math.imul(t.hi,e.lo),A=m+_+v>>>0;return{lo:u,hi:A}}function Rl(t,e){return Math.imul(t,e)>>>0}function t0(t,e){if(e===0)return t;if(e===32)return{lo:t.hi,hi:t.lo};if(e<32){let i=(t.lo<<e|t.hi>>>32-e)>>>0,o=(t.hi<<e|t.lo>>>32-e)>>>0;return{lo:i,hi:o}}e-=32;let r=(t.hi<<e|t.lo>>>32-e)>>>0,n=(t.lo<<e|t.hi>>>32-e)>>>0;return{lo:r,hi:n}}function Hr(t,e){return{lo:(t.lo^e.lo)>>>0,hi:(t.hi^e.hi)>>>0}}function n4(t,e){if(e===0)return t;if(e<32){let r=(t.lo>>>e|t.hi<<32-e)>>>0,n=t.hi>>>e;return{lo:r,hi:n}}return{lo:t.hi>>>e-32,hi:0}}function yr(t,e){return{lo:t>>>0,hi:e>>>0}}function i4(t,e){return(t<<e|t>>>32-e)>>>0}function BB(t,e){let r=e*8,n=t[r]|t[r+1]<<8|t[r+2]<<16|t[r+3]<<24,i=t[r+4]|t[r+5]<<8|t[r+6]<<16|t[r+7]<<24;return{lo:n>>>0,hi:i>>>0}}function Pse(t,e){let r=e*4;return(t[r]|t[r+1]<<8|t[r+2]<<16|t[r+3]<<24)>>>0}function DB(t){return t=Hr(t,n4(t,33)),t=Rs(t,yr(3981806797,4283543511)),t=Hr(t,n4(t,33)),t=Rs(t,yr(444984403,3301882366)),t=Hr(t,n4(t,33)),t}function Ise(t){return t^=t>>>16,t=Rl(t,2246822507),t^=t>>>13,t=Rl(t,3266489909),t^=t>>>16,t}function o4(t,e=0){let r=yr(e,0),n=yr(e,0),i=t.length,o=Math.floor(i/16),s=yr(289559509,2277735313),a=yr(658871167,1291169091);for(let m=0;m<o;m++){let _=BB(t,m*2),v=BB(t,m*2+1);_=Rs(_,s),_=t0(_,31),_=Rs(_,a),r=Hr(r,_),r=t0(r,27),r=Of(r,n),r=Of(Rs(r,yr(5,0)),yr(1390208809,0)),v=Rs(v,a),v=t0(v,33),v=Rs(v,s),n=Hr(n,v),n=t0(n,31),n=Of(n,r),n=Of(Rs(n,yr(5,0)),yr(944331445,0))}let c=yr(0,0),d=yr(0,0),f=t.slice(o*16);switch(f.length){case 15:d=Hr(d,yr(0,f[14]<<16));case 14:d=Hr(d,yr(0,f[13]<<8));case 13:d=Hr(d,yr(0,f[12]));case 12:d=Hr(d,yr(f[11]<<24,0));case 11:d=Hr(d,yr(f[10]<<16,0));case 10:d=Hr(d,yr(f[9]<<8,0));case 9:d=Hr(d,yr(f[8],0)),d=Rs(d,a),d=t0(d,33),d=Rs(d,s),n=Hr(n,d);case 8:c=Hr(c,yr(0,f[7]<<24));case 7:c=Hr(c,yr(0,f[6]<<16));case 6:c=Hr(c,yr(0,f[5]<<8));case 5:c=Hr(c,yr(0,f[4]));case 4:c=Hr(c,yr(f[3]<<24,0));case 3:c=Hr(c,yr(f[2]<<16,0));case 2:c=Hr(c,yr(f[1]<<8,0));case 1:c=Hr(c,yr(f[0],0)),c=Rs(c,s),c=t0(c,31),c=Rs(c,a),r=Hr(r,c)}let u=yr(i,0);return r=Hr(r,u),n=Hr(n,u),r=Of(r,n),n=Of(n,r),r=DB(r),n=DB(n),r=Of(r,n),n=Of(n,r),new Uint8Array([r.hi>>>24&255,r.hi>>>16&255,r.hi>>>8&255,r.hi&255,r.lo>>>24&255,r.lo>>>16&255,r.lo>>>8&255,r.lo&255,n.hi>>>24&255,n.hi>>>16&255,n.hi>>>8&255,n.hi&255,n.lo>>>24&255,n.lo>>>16&255,n.lo>>>8&255,n.lo&255])}function CB(t,e=0){let r=e>>>0,n=t.length,i=Math.floor(n/4),o=3432918353,s=461845907;for(let d=0;d<i;d++){let f=Pse(t,d);f=Rl(f,o),f=i4(f,15),f=Rl(f,s),r^=f,r=i4(r,13),r=Tse(Rl(r,5),3864292196)}let a=t.slice(i*4),c=0;switch(a.length){case 3:c^=a[2]<<16;case 2:c^=a[1]<<8;case 1:c^=a[0],c=Rl(c,o),c=i4(c,15),c=Rl(c,s),r^=c}return r^=n,r=Ise(r),r}function Mse(t){let e=new Array(4);for(let r=0;r<4;r++)e[r]=t&255,t=t>>8;return new Uint8Array(e)}var TBe=Al({name:"murmur3-32",code:35,encode:t=>Mse(CB(t))}),gw=Al({name:"murmur3-128",code:34,encode:t=>o4(t)}),PBe=Al({name:"murmur3-x64-64",code:34,encode:t=>o4(t).subarray(0,8)});p();p();var qB=mr(NB(),1);var Gn=class{_options;_popCount;_parent;_posAtParent;_children;key;constructor(e,r,n=0){this._options=e,this._popCount=0,this._parent=r,this._posAtParent=n,this._children=new qB.default,this.key=null}async put(e,r){let n=await this._findNewBucketAndPos(e);n.bucket._putAt(n,e,r)}async get(e){let r=await this._findChild(e);if(r!=null)return r.value}async del(e){let r=await this._findPlace(e),n=r.bucket._at(r.pos);n!=null&&n.key===e&&r.bucket._delAt(r.pos)}leafCount(){return this._children.compactArray().reduce((r,n)=>n instanceof Gn?r+n.leafCount():r+1,0)}childrenCount(){return this._children.length}onlyChild(){return this._children.get(0)}*eachLeafSeries(){let e=this._children.compactArray();for(let r of e)r instanceof Gn?yield*r.eachLeafSeries():yield r}serialize(e,r){let n=[];return r(this._children.reduce((i,o,s)=>(o!=null&&(o instanceof Gn?i.push(o.serialize(e,r)):i.push(e(o,s))),i),n))}async asyncTransform(e,r){return LB(this,e,r)}toJSON(){return this.serialize(Ose,jse)}prettyPrint(){return JSON.stringify(this.toJSON(),null," ")}tableSize(){return Math.pow(2,this._options.bits)}async _findChild(e){let r=await this._findPlace(e),n=r.bucket._at(r.pos);if(!(n instanceof Gn)&&n!=null&&n.key===e)return n}async _findPlace(e){let r=this._options.hash(typeof e=="string"?lw(e):e),n=await r.take(this._options.bits),i=this._children.get(n);return i instanceof Gn?i._findPlace(r):{bucket:this,pos:n,hash:r,existingChild:i}}async _findNewBucketAndPos(e){let r=await this._findPlace(e);if(r.existingChild!=null&&r.existingChild.key!==e){let n=new Gn(this._options,r.bucket,r.pos);r.bucket._putObjectAt(r.pos,n);let i=await n._findPlace(r.existingChild.hash);return i.bucket._putAt(i,r.existingChild.key,r.existingChild.value),n._findNewBucketAndPos(r.hash)}return r}_putAt(e,r,n){this._putObjectAt(e.pos,{key:r,value:n,hash:e.hash})}_putObjectAt(e,r){this._children.get(e)==null&&this._popCount++,this._children.set(e,r)}_delAt(e){if(e===-1)throw new Error("Invalid position");this._children.get(e)!=null&&this._popCount--,this._children.unset(e),this._level()}_level(){if(this._parent!=null&&this._popCount<=1)if(this._popCount===1){let e=this._children.find(Cse);if(e!=null&&!(e instanceof Gn)){let r=e.hash;r.untake(this._options.bits);let n={pos:this._posAtParent,hash:r,bucket:this._parent};this._parent._putAt(n,e.key,e.value)}}else this._parent._delAt(this._posAtParent)}_at(e){return this._children.get(e)}};function Cse(t){return Boolean(t)}function Ose(t,e){return t.key}function jse(t){return t}async function LB(t,e,r){let n=[];for(let i of t._children.compactArray())if(i instanceof Gn)await LB(i,e,r);else{let o=await e(i);n.push({bitField:t._children.bitField(),children:o})}return r(n)}p();p();var Nse=[255,254,252,248,240,224,192,128],qse=[1,3,7,15,31,63,127,255],bw=class{_value;_currentBytePos;_currentBitPos;constructor(e){this._value=e,this._currentBytePos=e.length-1,this._currentBitPos=7}availableBits(){return this._currentBitPos+1+this._currentBytePos*8}totalBits(){return this._value.length*8}take(e){let r=e,n=0;for(;r>0&&this._haveBits();){let i=this._value[this._currentBytePos],o=this._currentBitPos+1,s=Math.min(o,r),a=Lse(i,o-s,s);n=(n<<s)+a,r-=s,this._currentBitPos-=s,this._currentBitPos<0&&(this._currentBitPos=7,this._currentBytePos--)}return n}untake(e){for(this._currentBitPos+=e;this._currentBitPos>7;)this._currentBitPos-=8,this._currentBytePos+=1}_haveBits(){return this._currentBytePos>=0}};function Lse(t,e,r){let n=Use(e,r);return(t&n)>>>e}function Use(t,e){return Nse[t]&qse[Math.min(e+t-1,7)]}function UB(t){function e(r){return r instanceof vw?r:new vw(r,t)}return e}var vw=class{_value;_hashFn;_depth;_availableBits;_currentBufferIndex;_buffers;constructor(e,r){if(!(e instanceof Uint8Array))throw new Error("can only hash Uint8Arrays");this._value=e,this._hashFn=r,this._depth=-1,this._availableBits=0,this._currentBufferIndex=0,this._buffers=[]}async take(e){let r=e;for(;this._availableBits<r;)await this._produceMoreBits();let n=0;for(;r>0;){let i=this._buffers[this._currentBufferIndex],o=Math.min(i.availableBits(),r),s=i.take(o);n=(n<<o)+s,r-=o,this._availableBits-=o,i.availableBits()===0&&this._currentBufferIndex++}return n}untake(e){let r=e;for(;r>0;){let n=this._buffers[this._currentBufferIndex],i=Math.min(n.totalBits()-n.availableBits(),r);n.untake(i),r-=i,this._availableBits+=i,this._currentBufferIndex>0&&n.totalBits()===n.availableBits()&&(this._depth--,this._currentBufferIndex--)}}async _produceMoreBits(){this._depth++;let e=this._depth>0?lg([this._value,Uint8Array.from([this._depth])]):this._value,r=await this._hashFn(e),n=new bw(r);this._buffers.push(n),this._availableBits+=n.availableBits()}};function ww(t){if(t==null||t.hashFn==null)throw new Error("please define an options.hashFn");let e={bits:t.bits??8,hash:UB(t.hashFn)};return new Gn(e)}async function Fse(t){return(await gw.encode(t)).slice(0,8).reverse()}var FB=BigInt(34),s4=class extends ec{_bucket;constructor(e,r){super(e,r),this._bucket=ww({hashFn:Fse,bits:8})}async put(e,r){this.cid=void 0,this.size=void 0,this.nodeSize=void 0,await this._bucket.put(e,r)}async get(e){return this._bucket.get(e)}childCount(){return this._bucket.leafCount()}directChildrenCount(){return this._bucket.childrenCount()}onlyChild(){return this._bucket.onlyChild()}async*eachChildSeries(){for await(let{key:e,value:r}of this._bucket.eachLeafSeries())yield{key:e,child:r}}estimateNodeSize(){return this.nodeSize!==void 0?this.nodeSize:(this.nodeSize=GB(this._bucket,this,this.options),this.nodeSize)}async*flush(e){for await(let r of $B(this._bucket,e,this,this.options))yield{...r,path:this.path}}},zB=s4;async function*$B(t,e,r,n){let i=t._children,o=[],s=0n;for(let _=0;_<i.length;_++){let v=i.get(_);if(v==null)continue;let A=_.toString(16).toUpperCase().padStart(2,"0");if(v instanceof Gn){let T;for await(let M of $B(v,e,null,n))T=M;if(T==null)throw new Error("Could not flush sharded directory, no subshard found");o.push({Name:A,Tsize:Number(T.size),Hash:T.cid}),s+=T.size}else if(zse(v.value)){let T=v.value,M;for await(let O of T.flush(e))M=O,yield M;if(M==null)throw new Error("Did not flush dir");let D=A+v.key;o.push({Name:D,Tsize:Number(M.size),Hash:M.cid}),s+=M.size}else{let T=v.value;if(T.cid==null)continue;let M=A+v.key,D=T.size;o.push({Name:M,Tsize:Number(D),Hash:T.cid}),s+=BigInt(D??0)}}let a=Uint8Array.from(i.bitField().reverse()),c=new An({type:"hamt-sharded-directory",data:a,fanout:BigInt(t.tableSize()),hashType:FB,mtime:r?.mtime,mode:r?.mode}),d={Data:c.marshal(),Links:o},f=Zo(Ko(d)),u=await oa(f,e,n),m=BigInt(f.byteLength)+s;yield{cid:u,unixfs:c,size:m}}function zse(t){return typeof t.flush=="function"}function GB(t,e,r){let n=t._children,i=[];for(let c=0;c<n.length;c++){let d=n.get(c);if(d==null)continue;let f=c.toString(16).toUpperCase().padStart(2,"0");if(d instanceof Gn){let u=GB(d,null,r);i.push({Name:f,Tsize:Number(u),Hash:r.cidVersion===0?Tg:Pg})}else if(typeof d.value.flush=="function"){let m=d.value.nodeSize();i.push({Name:f+d.key,Tsize:Number(m),Hash:r.cidVersion===0?Tg:Pg})}else{let u=d.value;if(u.cid==null)continue;let m=f+d.key,_=u.size;i.push({Name:m,Tsize:Number(_),Hash:u.cid})}}let o=Uint8Array.from(n.bitField().reverse()),s=new An({type:"hamt-sharded-directory",data:o,fanout:BigInt(t.tableSize()),hashType:FB,mtime:e?.mtime,mode:e?.mode});return Zo(Ko({Data:s.marshal(),Links:i})).length}async function a4(t,e,r,n){let i=e;e instanceof Il&&e.estimateNodeSize()>r&&(i=await $se(e,n));let o=i.parent;if(o!=null){if(i!==e){if(t!=null&&(t.parent=i),i.parentKey==null)throw new Error("No parent key found");await o.put(i.parentKey,i)}return a4(i,o,r,n)}return i}async function $se(t,e){let r=new zB({root:t.root,dir:!0,parent:t.parent,parentKey:t.parentKey,path:t.path,dirty:t.dirty,flat:!1,mtime:t.mtime,mode:t.mode},e);for await(let{key:n,child:i}of t.eachChildSeries())await r.put(n,i);return r}p();var HB=(t="")=>(t.trim().match(/([^\\/]|\\\/)+/g)??[]).filter(Boolean);async function Gse(t,e,r){let n=HB(t.path??""),i=n.length-1,o=e,s="";for(let a=0;a<n.length;a++){let c=n[a];s+=`${s!==""?"/":""}${c}`;let d=a===i;if(o.dirty=!0,o.cid=void 0,o.size=void 0,d)await o.put(c,t),e=await a4(null,o,r.shardSplitThresholdBytes,r);else{let f=await o.get(c);(f==null||!(f instanceof ec))&&(f=new Il({root:!1,dir:!0,parent:o,parentKey:c,path:s,dirty:!0,flat:!0,mtime:f?.unixfs?.mtime,mode:f?.unixfs?.mode},r)),await o.put(c,f),o=f}}return e}async function*WB(t,e){if(!(t instanceof ec)){t.unixfs?.isDirectory()===!0&&(yield t);return}yield*t.flush(e)}function VB(t){return async function*(r,n){let i=new Il({root:!0,dir:!0,path:"",dirty:!0,flat:!0},t),o,s=!1;for await(let a of r){if(a==null)continue;let c=`${a.originalPath??""}`.split("/")[0];c!=null&&c!==""&&(o==null?(o=c,s=!0):o!==c&&(s=!1)),i=await Gse(a,i,t),(a.unixfs==null||!a.unixfs.isDirectory())&&(yield a)}if(t.wrapWithDirectory||s&&i.childCount()>1)yield*WB(i,n);else for await(let a of i.eachChildSeries())a!=null&&(yield*WB(a.child,n))}}async function*Ig(t,e,r={}){let n;Symbol.asyncIterator in t||Symbol.iterator in t?n=t:n=[t];let i=r.wrapWithDirectory??!1,o=r.shardSplitThresholdBytes??262144,s=r.cidVersion??1,a=r.rawLeaves??!0,c=r.leafType??"file",d=r.fileImportConcurrency??50,f=r.blockWriteConcurrency??10,u=r.reduceSingleLeafToSelf??!0,m=r.chunker??mk(),_=r.chunkValidator??kB(),v=r.dagBuilder??wB({chunker:m,chunkValidator:_,wrapWithDirectory:i,layout:r.layout??r4(),bufferImporter:r.bufferImporter??yB({cidVersion:s,rawLeaves:a,leafType:c,onProgress:r.onProgress}),blockWriteConcurrency:f,reduceSingleLeafToSelf:u,cidVersion:s,onProgress:r.onProgress}),A=r.treeBuilder??VB({wrapWithDirectory:i,shardSplitThresholdBytes:o,cidVersion:s,onProgress:r.onProgress});for await(let T of A(ug(v(n,e),d),e))yield{cid:T.cid,path:T.path,unixfs:T.unixfs,size:T.size}}p();var _w={};dr(_w,{abortedError:()=>Xse,closeFailedError:()=>Vse,deleteFailedError:()=>Yse,getFailedError:()=>Zse,hasFailedError:()=>Jse,notFoundError:()=>c4,openFailedError:()=>Wse,putFailedError:()=>Kse});p();var ld=mr(Wo(),1);function Wse(t){return t=t??new Error("Open failed"),(0,ld.default)(t,"ERR_OPEN_FAILED")}function Vse(t){return t=t??new Error("Close failed"),(0,ld.default)(t,"ERR_CLOSE_FAILED")}function Kse(t){return t=t??new Error("Put failed"),(0,ld.default)(t,"ERR_PUT_FAILED")}function Zse(t){return t=t??new Error("Get failed"),(0,ld.default)(t,"ERR_GET_FAILED")}function Yse(t){return t=t??new Error("Delete failed"),(0,ld.default)(t,"ERR_DELETE_FAILED")}function Jse(t){return t=t??new Error("Has failed"),(0,ld.default)(t,"ERR_HAS_FAILED")}function c4(t){return t=t??new Error("Not Found"),(0,ld.default)(t,"ERR_NOT_FOUND")}function Xse(t){return t=t??new Error("Aborted"),(0,ld.default)(t,"ERR_ABORTED")}p();var Rg=class{has(e,r){return Promise.reject(new Error(".has is not implemented"))}put(e,r,n){return Promise.reject(new Error(".put is not implemented"))}async*putMany(e,r){for await(let{cid:n,block:i}of e)await this.put(n,i,r),yield n}get(e,r){return Promise.reject(new Error(".get is not implemented"))}async*getMany(e,r){for await(let n of e)yield{cid:n,block:await this.get(n,r)}}async delete(e,r){await Promise.reject(new Error(".delete is not implemented"))}async*deleteMany(e,r){for await(let n of e)await this.delete(n,r),yield n}async*getAll(e){throw new Error(".getAll is not implemented")}};p();var r0=class extends Rg{data;constructor(){super(),this.data=new Map}put(e,r){return this.data.set(ra.encode(e.multihash.bytes),r),e}get(e){let r=this.data.get(ra.encode(e.multihash.bytes));if(r==null)throw c4();return r}has(e){return this.data.has(ra.encode(e.multihash.bytes))}async delete(e){this.data.delete(ra.encode(e.multihash.bytes))}async*getAll(){for(let[e,r]of this.data.entries())yield{cid:qe.createV1(Qa,Gp(ra.decode(e))),block:r}}};var kDe={..._w};p();var Q=class extends Error{constructor(r,n){super(`${r}: ${n}`);this.code=r;this.name="DwnError"}},sr=(re=>(re.AuthenticateJwsMissing="AuthenticateJwsMissing",re.AuthenticateDescriptorCidMismatch="AuthenticateDescriptorCidMismatch",re.AuthenticationMoreThanOneSignatureNotSupported="AuthenticationMoreThanOneSignatureNotSupported",re.AuthorizationUnknownAuthor="AuthorizationUnknownAuthor",re.AuthorizationNotGrantedToAuthor="AuthorizationNotGrantedToAuthor",re.ComputeCidCodecNotSupported="ComputeCidCodecNotSupported",re.ComputeCidMultihashNotSupported="ComputeCidMultihashNotSupported",re.DidMethodNotSupported="DidMethodNotSupported",re.DidNotString="DidNotString",re.DidNotValid="DidNotValid",re.DidResolutionFailed="DidResolutionFailed",re.Ed25519InvalidJwk="Ed25519InvalidJwk",re.GeneralJwsVerifierGetPublicKeyNotFound="GeneralJwsVerifierGetPublicKeyNotFound",re.GeneralJwsVerifierInvalidSignature="GeneralJwsVerifierInvalidSignature",re.GrantAuthorizationGrantExpired="GrantAuthorizationGrantExpired",re.GrantAuthorizationGrantMissing="GrantAuthorizationGrantMissing",re.GrantAuthorizationGrantRevoked="GrantAuthorizationGrantRevoked",re.GrantAuthorizationInterfaceMismatch="GrantAuthorizationInterfaceMismatch",re.GrantAuthorizationMethodMismatch="GrantAuthorizationMethodMismatch",re.GrantAuthorizationNotGrantedForTenant="GrantAuthorizationNotGrantedForTenant",re.GrantAuthorizationNotGrantedToAuthor="GrantAuthorizationNotGrantedToAuthor",re.GrantAuthorizationGrantNotYetActive="GrantAuthorizationGrantNotYetActive",re.HdKeyDerivationPathInvalid="HdKeyDerivationPathInvalid",re.JwsVerifySignatureUnsupportedCrv="JwsVerifySignatureUnsupportedCrv",re.JwsDecodePlainObjectPayloadInvalid="JwsDecodePlainObjectPayloadInvalid",re.MessageGetInvalidCid="MessageGetInvalidCid",re.ParseCidCodecNotSupported="ParseCidCodecNotSupported",re.ParseCidMultihashNotSupported="ParseCidMultihashNotSupported",re.PermissionsGrantGrantedByMismatch="PermissionsGrantGrantedByMismatch",re.PermissionsGrantNotADelegatedGrant="PermissionsGrantNotADelegatedGrant",re.PermissionsGrantScopeContextIdAndProtocolPath="PermissionsGrantScopeContextIdAndProtocolPath",re.PermissionsGrantScopeSchemaProhibitedFields="PermissionsGrantScopeSchemaProhibitedFields",re.PermissionsGrantUnauthorizedGrant="PermissionsGrantUnauthorizedGrant",re.PermissionsRevokeMissingPermissionsGrant="PermissionsRevokeMissingPermissionsGrant",re.PermissionsRevokeUnauthorizedRevoke="PermissionsRevokeUnauthorizedRevoke",re.PrivateKeySignerUnableToDeduceAlgorithm="PrivateKeySignerUnableToDeduceAlgorithm",re.PrivateKeySignerUnableToDeduceKeyId="PrivateKeySignerUnableToDeduceKeyId",re.PrivateKeySignerUnsupportedCurve="PrivateKeySignerUnsupportedCurve",re.ProtocolAuthorizationActionNotAllowed="ProtocolAuthorizationActionNotAllowed",re.ProtocolAuthorizationActionRulesNotFound="ProtocolAuthorizationActionRulesNotFound",re.ProtocolAuthorizationDuplicateContextRoleRecipient="ProtocolAuthorizationDuplicateContextRoleRecipient",re.ProtocolAuthorizationDuplicateGlobalRoleRecipient="ProtocolAuthorizationDuplicateGlobalRoleRecipient",re.ProtocolAuthorizationIncorrectDataFormat="ProtocolAuthorizationIncorrectDataFormat",re.ProtocolAuthorizationIncorrectProtocolPath="ProtocolAuthorizationIncorrectProtocolPath",re.ProtocolAuthorizationInvalidSchema="ProtocolAuthorizationInvalidSchema",re.ProtocolAuthorizationInvalidType="ProtocolAuthorizationInvalidType",re.ProtocolAuthorizationMissingContextId="ProtocolAuthorizationMissingContextId",re.ProtocolAuthorizationMissingRole="ProtocolAuthorizationMissingRole",re.ProtocolAuthorizationMissingRuleSet="ProtocolAuthorizationMissingRuleSet",re.ProtocolAuthorizationParentlessIncorrectProtocolPath="ProtocolAuthorizationParentlessIncorrectProtocolPath",re.ProtocolAuthorizationNotARole="ProtocolAuthorizationNotARole",re.ProtocolAuthorizationParentNotFound="ProtocolAuthorizationParentNotFound",re.ProtocolAuthorizationProtocolNotFound="ProtocolAuthorizationProtocolNotFound",re.ProtocolAuthorizationQueryWithoutRole="ProtocolAuthorizationQueryWithoutRole",re.ProtocolAuthorizationRoleMissingRecipient="ProtocolAuthorizationRoleMissingRecipient",re.ProtocolsConfigureContextRoleAtProhibitedProtocolPath="ProtocolsConfigureContextRoleAtProhibitedProtocolPath",re.ProtocolsConfigureGlobalRoleAtProhibitedProtocolPath="ProtocolsConfigureGlobalRoleAtProhibitedProtocolPath",re.ProtocolsConfigureInvalidRole="ProtocolsConfigureInvalidRole",re.ProtocolsConfigureInvalidActionMissingOf="ProtocolsConfigureInvalidActionMissingOf",re.ProtocolsConfigureInvalidActionOfNotAllowed="ProtocolsConfigureInvalidActionOfNotAllowed",re.ProtocolsConfigureInvalidRecipientOfAction="ProtocolsConfigureInvalidRecipientOfAction",re.ProtocolsConfigureQueryNotAllowed="ProtocolsConfigureQueryNotAllowed",re.ProtocolsConfigureUnauthorized="ProtocolsConfigureUnauthorized",re.ProtocolsQueryUnauthorized="ProtocolsQueryUnauthorized",re.RecordsDecryptNoMatchingKeyEncryptedFound="RecordsDecryptNoMatchingKeyEncryptedFound",re.RecordsDeleteAuthorizationFailed="RecordsDeleteAuthorizationFailed",re.RecordsGrantAuthorizationConditionPublicationProhibited="RecordsGrantAuthorizationConditionPublicationProhibited",re.RecordsGrantAuthorizationConditionPublicationRequired="RecordsGrantAuthorizationConditionPublicationRequired",re.RecordsGrantAuthorizationScopeContextIdMismatch="RecordsGrantAuthorizationScopeContextIdMismatch",re.RecordsGrantAuthorizationScopeNotProtocol="RecordsGrantAuthorizationScopeNotProtocol",re.RecordsGrantAuthorizationScopeProtocolMismatch="RecordsGrantAuthorizationScopeProtocolMismatch",re.RecordsGrantAuthorizationScopeProtocolPathMismatch="RecordsGrantAuthorizationScopeProtocolPathMismatch",re.RecordsGrantAuthorizationScopeSchema="RecordsGrantAuthorizationScopeSchema",re.RecordsDerivePrivateKeyUnSupportedCurve="RecordsDerivePrivateKeyUnSupportedCurve",re.RecordsInvalidAncestorKeyDerivationSegment="RecordsInvalidAncestorKeyDerivationSegment",re.RecordsProtocolContextDerivationSchemeMissingContextId="RecordsProtocolContextDerivationSchemeMissingContextId",re.RecordsProtocolPathDerivationSchemeMissingProtocol="RecordsProtocolPathDerivationSchemeMissingProtocol",re.RecordsQueryFilterMissingRequiredProperties="RecordsQueryFilterMissingRequiredProperties",re.RecordsReadReturnedMultiple="RecordsReadReturnedMultiple",re.RecordsReadAuthorizationFailed="RecordsReadAuthorizationFailed",re.RecordsSchemasDerivationSchemeMissingSchema="RecordsSchemasDerivationSchemeMissingSchema",re.RecordsValidateIntegrityDelegatedGrantAndIdExistenceMismatch="RecordsValidateIntegrityDelegatedGrantAndIdExistenceMismatch",re.RecordsValidateIntegrityGrantedToAndSignerMismatch="RecordsValidateIntegrityGrantedToAndSignerMismatch",re.RecordsWriteAttestationIntegrityMoreThanOneSignature="RecordsWriteAttestationIntegrityMoreThanOneSignature",re.RecordsWriteAttestationIntegrityDescriptorCidMismatch="RecordsWriteAttestationIntegrityDescriptorCidMismatch",re.RecordsWriteAttestationIntegrityInvalidPayloadProperty="RecordsWriteAttestationIntegrityInvalidPayloadProperty",re.RecordsWriteAuthorizationFailed="RecordsWriteAuthorizationFailed",re.RecordsWriteCreateMissingSigner="RecordsWriteCreateMissingSigner",re.RecordsWriteCreateContextIdAndParentIdMutuallyInclusive="RecordsWriteCreateContextIdAndParentIdMutuallyInclusive",re.RecordsWriteCreateDataAndDataCidMutuallyExclusive="RecordsWriteCreateDataAndDataCidMutuallyExclusive",re.RecordsWriteCreateDataCidAndDataSizeMutuallyInclusive="RecordsWriteCreateDataCidAndDataSizeMutuallyInclusive",re.RecordsWriteCreateProtocolAndProtocolPathMutuallyInclusive="RecordsWriteCreateProtocolAndProtocolPathMutuallyInclusive",re.RecordsWriteDataCidMismatch="RecordsWriteDataCidMismatch",re.RecordsWriteDataSizeMismatch="RecordsWriteDataSizeMismatch",re.RecordsWriteGetEntryIdUndefinedAuthor="RecordsWriteGetEntryIdUndefinedAuthor",re.RecordsWriteGetInitialWriteNotFound="RecordsWriteGetInitialWriteNotFound",re.RecordsWriteImmutablePropertyChanged="RecordsWriteImmutablePropertyChanged",re.RecordsWriteMissingAuthorizationSigner="RecordsWriteMissingAuthorizationSigner",re.RecordsWriteMissingSigner="RecordsWriteMissingSigner",re.RecordsWriteMissingDataInPrevious="RecordsWriteMissingDataInPrevious",re.RecordsWriteMissingDataAssociation="RecordsWriteMissingDataAssociation",re.RecordsWriteMissingDataStream="RecordsWriteMissingDataStream",re.RecordsWriteMissingProtocol="RecordsWriteMissingProtocol",re.RecordsWriteMissingSchema="RecordsWriteMissingSchema",re.RecordsWriteOwnerAndTenantMismatch="RecordsWriteOwnerAndTenantMismatch",re.RecordsWriteSignAsOwnerUnknownAuthor="RecordsWriteSignAsOwnerUnknownAuthor",re.RecordsWriteValidateIntegrityAttestationMismatch="RecordsWriteValidateIntegrityAttestationMismatch",re.RecordsWriteValidateIntegrityContextIdMismatch="RecordsWriteValidateIntegrityContextIdMismatch",re.RecordsWriteValidateIntegrityContextIdNotInSignerSignaturePayload="RecordsWriteValidateIntegrityContextIdNotInSignerSignaturePayload",re.RecordsWriteValidateIntegrityDateCreatedMismatch="RecordsWriteValidateIntegrityDateCreatedMismatch",re.RecordsWriteValidateIntegrityEncryptionCidMismatch="RecordsWriteValidateIntegrityEncryptionCidMismatch",re.RecordsWriteValidateIntegrityRecordIdUnauthorized="RecordsWriteValidateIntegrityRecordIdUnauthorized",re.SchemaValidatorSchemaNotFound="SchemaValidatorSchemaNotFound",re.SchemaValidationFailure="SchemaValidationFailure",re.Secp256k1KeyNotValid="Secp256k1KeyNotValid",re.TimestampInvalid="TimestampInvalid",re.UrlProtocolNotNormalized="UrlProtocolNotNormalized",re.UrlProtocolNotNormalizable="UrlProtocolNotNormalizable",re.UrlSchemaNotNormalized="UrlSchemaNotNormalized",re.UrlSchemaNotNormalizable="UrlSchemaNotNormalizable",re))(sr||{});var KB={[Eo.code]:Eo},ZB={[ow]:Up},Wr=class{static async computeCid(e,r=ow,n=Eo.code){let i=ZB[r];if(!i)throw new Q("ComputeCidCodecNotSupported",`codec [${r}] not supported`);let o=KB[n];if(!o)throw new Q("ComputeCidMultihashNotSupported",`multihash code [${n}] not supported`);let s=i.encode(e),a=await o.digest(s);return(await qe.createV1(i.code,a)).toString()}static parseCid(e){let r=qe.parse(e).toV1();if(!ZB[r.code])throw new Q("ParseCidCodecNotSupported",`codec [${r.code}] not supported`);if(!KB[r.multihash.code])throw new Q("ParseCidMultihashNotSupported",`multihash code [${r.multihash.code}] not supported`);return r}static async computeDagPbCidFromBytes(e){let r=Ig([{content:e}],new r0,{cidVersion:1}),n;for await(n of r);return n?n.cid.toString():""}static async computeDagPbCidFromStream(e){let r=Ig([{content:e}],new r0,{cidVersion:1}),n;for await(n of r);return n?n.cid.toString():""}};p();p();p();var QD=mr(vD(),1);p();p();var lCe=Xi({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),hCe=Xi({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),kg=Xi({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),pCe=Xi({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});var f4=new TextEncoder,Rae=new TextDecoder,Be=class{static base64UrlToBytes(e){return kg.baseDecode(e)}static base64UrlToObject(e){let r=kg.baseDecode(e);return Be.bytesToObject(r)}static bytesToBase64Url(e){return kg.baseEncode(e)}static bytesToString(e){return Rae.decode(e)}static bytesToObject(e){let r=Be.bytesToString(e);return JSON.parse(r)}static objectToBytes(e){let r=JSON.stringify(e);return f4.encode(r)}static stringToBase64Url(e){let r=f4.encode(e);return kg.baseEncode(r)}static stringToBytes(e){return f4.encode(e)}};p();p();p();p();var di=2n**255n-19n,n0=2n**252n+27742317777372353535851937790883648493n,u4=0x216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51an,l4=0x6666666666666666666666666666666666666666666666666666666666666658n,xw={a:-1n,d:37095705934669439343138083508754565189542113879843219016388785533085940283555n,p:di,n:n0,h:8,Gx:u4,Gy:l4},eo=(t="")=>{throw new Error(t)},SD=t=>typeof t=="string",Aw=(t,e)=>!(t instanceof Uint8Array)||typeof e=="number"&&e>0&&t.length!==e?eo("Uint8Array expected"):t,i0=t=>new Uint8Array(t),o0=(t,e)=>Aw(SD(t)?p4(t):i0(t),e),De=(t,e=di)=>{let r=t%e;return r>=0n?r:e+r},wD=t=>t instanceof Ci?t:eo("Point expected"),_D,Ci=class{constructor(e,r,n,i){this.ex=e,this.ey=r,this.ez=n,this.et=i}static fromAffine(e){return new Ci(e.x,e.y,1n,De(e.x*e.y))}static fromHex(e,r=!0){let{d:n}=xw;e=o0(e,32);let i=e.slice();i[31]=e[31]&-129;let o=m4(i);o===0n||(r&&!(0n<o&&o<di)&&eo("bad y coord 1"),!r&&!(0n<o&&o<2n**256n)&&eo("bad y coord 2"));let s=De(o*o),a=De(s-1n),c=De(n*s+1n),{isValid:d,value:f}=kae(a,c);d||eo("bad y coordinate 3");let u=(f&1n)===1n;return(e[31]&128)!==0!==u&&(f=De(-f)),new Ci(f,o,1n,De(f*o))}get x(){return this.toAffine().x}get y(){return this.toAffine().y}equals(e){let{ex:r,ey:n,ez:i}=this,{ex:o,ey:s,ez:a}=wD(e),c=De(r*a),d=De(o*i),f=De(n*a),u=De(s*i);return c===d&&f===u}is0(){return this.equals(Ew)}negate(){return new Ci(De(-this.ex),this.ey,this.ez,De(-this.et))}double(){let{ex:e,ey:r,ez:n}=this,{a:i}=xw,o=De(e*e),s=De(r*r),a=De(2n*De(n*n)),c=De(i*o),d=e+r,f=De(De(d*d)-o-s),u=c+s,m=u-a,_=c-s,v=De(f*m),A=De(u*_),T=De(f*_),M=De(m*u);return new Ci(v,A,M,T)}add(e){let{ex:r,ey:n,ez:i,et:o}=this,{ex:s,ey:a,ez:c,et:d}=wD(e),{a:f,d:u}=xw,m=De(r*s),_=De(n*a),v=De(o*u*d),A=De(i*c),T=De((r+n)*(s+a)-m-_),M=De(A-v),D=De(A+v),O=De(_-f*m),U=De(T*M),L=De(D*O),F=De(T*O),$=De(M*D);return new Ci(U,L,$,F)}mul(e,r=!0){if(e===0n)return r===!0?eo("cannot multiply by 0"):Ew;if(typeof e=="bigint"&&0n<e&&e<n0||eo("invalid scalar, must be < L"),!r&&this.is0()||e===1n)return this;if(this.equals(jf))return jae(e).p;let n=Ew,i=jf;for(let o=this;e>0n;o=o.double(),e>>=1n)e&1n?n=n.add(o):r&&(i=i.add(o));return n}multiply(e){return this.mul(e)}clearCofactor(){return this.mul(BigInt(xw.h),!1)}isSmallOrder(){return this.clearCofactor().is0()}isTorsionFree(){let e=this.mul(n0/2n,!1).double();return n0%2n&&(e=e.add(this)),e.is0()}toAffine(){let{ex:e,ey:r,ez:n}=this;if(this.is0())return{x:0n,y:0n};let i=PD(n);return De(n*i)!==1n&&eo("invalid inverse"),{x:De(e*i),y:De(r*i)}}toRawBytes(){let{x:e,y:r}=this.toAffine(),n=TD(r);return n[31]|=e&1n?128:0,n}toHex(){return h4(this.toRawBytes())}};Ci.BASE=new Ci(u4,l4,1n,De(u4*l4));Ci.ZERO=new Ci(0n,1n,1n,0n);var{BASE:jf,ZERO:Ew}=Ci,AD=(t,e)=>t.toString(16).padStart(e,"0"),h4=t=>Array.from(t).map(e=>AD(e,2)).join(""),p4=t=>{let e=t.length;(!SD(t)||e%2)&&eo("hex invalid 1");let r=i0(e/2);for(let n=0;n<r.length;n++){let i=n*2,o=t.slice(i,i+2),s=Number.parseInt(o,16);(Number.isNaN(s)||s<0)&&eo("hex invalid 2"),r[n]=s}return r},TD=t=>p4(AD(t,32*2)).reverse(),m4=t=>BigInt("0x"+h4(i0(Aw(t)).reverse())),Dg=(...t)=>{let e=i0(t.reduce((n,i)=>n+Aw(i).length,0)),r=0;return t.forEach(n=>{e.set(n,r),r+=n.length}),e},PD=(t,e=di)=>{(t===0n||e<=0n)&&eo("no inverse n="+t+" mod="+e);let r=De(t,e),n=e,i=0n,o=1n,s=1n,a=0n;for(;r!==0n;){let c=n/r,d=n%r,f=i-s*c,u=o-a*c;n=r,r=d,i=s,o=a,s=f,a=u}return n===1n?De(i,e):eo("no inverse")},tc=(t,e)=>{let r=t;for(;e-- >0n;)r*=r,r%=di;return r},Mae=t=>{let r=t*t%di*t%di,n=tc(r,2n)*r%di,i=tc(n,1n)*t%di,o=tc(i,5n)*i%di,s=tc(o,10n)*o%di,a=tc(s,20n)*s%di,c=tc(a,40n)*a%di,d=tc(c,80n)*c%di,f=tc(d,80n)*c%di,u=tc(f,10n)*o%di;return{pow_p_5_8:tc(u,2n)*t%di,b2:r}},xD=19681161376707505956807079304988542015446066515923890162744021073123829784752n,kae=(t,e)=>{let r=De(e*e*e),n=De(r*r*e),i=Mae(t*n).pow_p_5_8,o=De(t*r*i),s=De(e*o*o),a=o,c=De(o*xD),d=s===t,f=s===De(-t),u=s===De(-t*xD);return d&&(o=a),(f||u)&&(o=c),(De(o)&1n)===1n&&(o=De(-o)),{isValid:d||f,value:o}},Sw=t=>De(m4(t),n0),Bg,y4=(...t)=>kl.sha512Async(...t),ID=(...t)=>typeof Bg=="function"?Bg(...t):eo("etc.sha512Sync not set"),RD=t=>{let e=t.slice(0,32);e[0]&=248,e[31]&=127,e[31]|=64;let r=t.slice(32,64),n=Sw(e),i=jf.mul(n),o=i.toRawBytes();return{head:e,prefix:r,scalar:n,point:i,pointBytes:o}},g4=t=>y4(o0(t,32)).then(RD),Bae=t=>RD(ID(o0(t,32))),MD=t=>g4(t).then(e=>e.pointBytes);function kD(t,e){return t?y4(e.hashable).then(e.finish):e.finish(ID(e.hashable))}var Dae=(t,e,r)=>{let{pointBytes:n,scalar:i}=t,o=Sw(e),s=jf.mul(o).toRawBytes();return{hashable:Dg(s,n,r),finish:d=>{let f=De(o+Sw(d)*i,n0);return Aw(Dg(s,TD(f)),64)}}},BD=async(t,e)=>{let r=o0(t),n=await g4(e),i=await y4(n.prefix,r);return kD(!0,Dae(n,i,r))};var Cae=(t,e,r)=>{e=o0(e),t=o0(t,64);let n=Ci.fromHex(r,!1),i=Ci.fromHex(t.slice(0,32),!1),o=m4(t.slice(32,64)),s=jf.mul(o,!1);return{hashable:Dg(i.toRawBytes(),n.toRawBytes(),e),finish:d=>{let f=Sw(d);return i.add(n.mul(f,!1)).add(s.negate()).clearCofactor().is0()}}},DD=async(t,e,r)=>kD(!0,Cae(t,e,r));var ED=()=>typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0,kl={bytesToHex:h4,hexToBytes:p4,concatBytes:Dg,mod:De,invert:PD,randomBytes:t=>{let e=ED();return e||eo("crypto.getRandomValues must be defined"),e.getRandomValues(i0(t))},sha512Async:async(...t)=>{let e=ED();e||eo("crypto.subtle or etc.sha512Async must be defined");let r=Dg(...t);return i0(await e.subtle.digest("SHA-512",r.buffer))},sha512Sync:void 0};Object.defineProperties(kl,{sha512Sync:{configurable:!1,get(){return Bg},set(t){Bg||(Bg=t)}}});var CD={getExtendedPublicKeyAsync:g4,getExtendedPublicKey:Bae,randomPrivateKey:()=>kl.randomBytes(32),precompute(t=8,e=jf){return e.multiply(3n),e}},Ml=8,Oae=()=>{let t=[],e=256/Ml+1,r=jf,n=r;for(let i=0;i<e;i++){n=r,t.push(n);for(let o=1;o<2**(Ml-1);o++)n=n.add(r),t.push(n);r=n.double()}return t},jae=t=>{let e=_D||(_D=Oae()),r=(f,u)=>{let m=u.negate();return f?m:u},n=Ew,i=jf,o=1+256/Ml,s=2**(Ml-1),a=BigInt(2**Ml-1),c=2**Ml,d=BigInt(Ml);for(let f=0;f<o;f++){let u=f*s,m=Number(t&a);t>>=d,m>s&&(m-=c,t+=1n);let _=u,v=u+Math.abs(m)-1,A=f%2!==0,T=m<0;m===0?i=i.add(r(A,e[_])):n=n.add(r(T,e[v]))}return{p:n,f:i}};function OD(t){if(t.kty!=="OKP"||t.crv!=="Ed25519")throw new Q("Ed25519InvalidJwk","invalid jwk. kty MUST be OKP. crv MUST be Ed25519")}function jD(t){return{alg:"EdDSA",kty:"OKP",crv:"Ed25519",x:Be.bytesToBase64Url(t)}}var Bl={sign:async(t,e)=>{OD(e);let r=kl.bytesToHex(t),n=Be.base64UrlToBytes(e.d),i=kl.bytesToHex(n);return BD(r,i)},verify:async(t,e,r)=>{OD(r);let n=Be.base64UrlToBytes(r.x);return DD(e,t,n)},generateKeyPair:async()=>{let t=CD.randomPrivateKey(),e=kl.bytesToHex(t),r=await MD(e),n=Be.bytesToBase64Url(t),i=jD(r),o={...i,d:n};return{publicJwk:i,privateJwk:o}},publicKeyToJwk:async t=>jD(t)};p();p();var w4=2n**256n,Nf=w4-0x1000003d1n,Dn=w4-0x14551231950b75fc4402da1732fc9bebfn,zD=0x79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798n,$D=0x483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8n,GD={p:Nf,n:Dn,a:0n,b:7n,Gx:zD,Gy:$D},Oi=32,ND=t=>we(we(t*t)*t+GD.b),gr=(t="")=>{throw new Error(t)},Rw=t=>typeof t=="bigint",HD=t=>typeof t=="string",b4=t=>Rw(t)&&0n<t&&t<Nf,jg=t=>Rw(t)&&0n<t&&t<Dn,WD=(t,e)=>!(t instanceof Uint8Array)||typeof e=="number"&&e>0&&t.length!==e?gr("Uint8Array expected"):t,Yo=t=>new Uint8Array(t),pd=(t,e)=>WD(HD(t)?Ng(t):Yo(t),e),we=(t,e=Nf)=>{let r=t%e;return r>=0n?r:e+r},qD=t=>t instanceof mn?t:gr("Point expected"),LD,mn=class{constructor(e,r,n){this.px=e,this.py=r,this.pz=n}static fromAffine(e){return new mn(e.x,e.y,1n)}static fromHex(e){e=pd(e);let r,n=e[0],i=e.subarray(1),o=Pw(i,0,Oi),s=e.length;if(s===33&&[2,3].includes(n)){b4(o)||gr("Point hex invalid: x not FE");let a=qae(ND(o)),c=(a&1n)===1n;(n&1)===1!==c&&(a=we(-a)),r=new mn(o,a,1n)}return s===65&&n===4&&(r=new mn(o,Pw(i,Oi,2*Oi),1n)),r?r.ok():gr("Point is not on curve")}static fromPrivateKey(e){return hd.mul(Iw(e))}get x(){return this.aff().x}get y(){return this.aff().y}equals(e){let{px:r,py:n,pz:i}=this,{px:o,py:s,pz:a}=qD(e),c=we(r*a),d=we(o*i),f=we(n*a),u=we(s*i);return c===d&&f===u}negate(){return new mn(this.px,we(-this.py),this.pz)}double(){return this.add(this)}add(e){let{px:r,py:n,pz:i}=this,{px:o,py:s,pz:a}=qD(e),{a:c,b:d}=GD,f=0n,u=0n,m=0n,_=we(d*3n),v=we(r*o),A=we(n*s),T=we(i*a),M=we(r+n),D=we(o+s);M=we(M*D),D=we(v+A),M=we(M-D),D=we(r+i);let O=we(o+a);return D=we(D*O),O=we(v+T),D=we(D-O),O=we(n+i),f=we(s+a),O=we(O*f),f=we(A+T),O=we(O-f),m=we(c*D),f=we(_*T),m=we(f+m),f=we(A-m),m=we(A+m),u=we(f*m),A=we(v+v),A=we(A+v),T=we(c*T),D=we(_*D),A=we(A+T),T=we(v-T),T=we(c*T),D=we(D+T),v=we(A*D),u=we(u+v),v=we(O*D),f=we(M*f),f=we(f-v),v=we(M*A),m=we(O*m),m=we(m+v),new mn(f,u,m)}mul(e,r=!0){if(!r&&e===0n)return Tw;if(jg(e)||gr("invalid scalar"),this.equals(hd))return $ae(e).p;let n=Tw,i=hd;for(let o=this;e>0n;o=o.double(),e>>=1n)e&1n?n=n.add(o):r&&(i=i.add(o));return n}mulAddQUns(e,r,n){return this.mul(r,!1).add(e.mul(n,!1)).ok()}toAffine(){let{px:e,py:r,pz:n}=this;if(this.equals(Tw))return{x:0n,y:0n};if(n===1n)return{x:e,y:r};let i=Lg(n);return we(n*i)!==1n&&gr("invalid inverse"),{x:we(e*i),y:we(r*i)}}assertValidity(){let{x:e,y:r}=this.aff();return(!b4(e)||!b4(r))&&gr("Point invalid: x or y"),we(r*r)===ND(e)?this:gr("Point invalid: not on curve")}multiply(e){return this.mul(e)}aff(){return this.toAffine()}ok(){return this.assertValidity()}toHex(e=!0){let{x:r,y:n}=this.aff();return(e?(n&1n)===0n?"02":"03":"04")+Cg(r)+(e?"":Cg(n))}toRawBytes(e=!0){return Ng(this.toHex(e))}};mn.BASE=new mn(zD,$D,1n);mn.ZERO=new mn(0n,1n,0n);var{BASE:hd,ZERO:Tw}=mn,VD=(t,e)=>t.toString(16).padStart(e,"0"),_4=t=>Array.from(t).map(e=>VD(e,2)).join(""),Ng=t=>{let e=t.length;(!HD(t)||e%2)&&gr("hex invalid 1");let r=Yo(e/2);for(let n=0;n<r.length;n++){let i=n*2,o=t.slice(i,i+2),s=Number.parseInt(o,16);(Number.isNaN(s)||s<0)&&gr("hex invalid 2"),r[n]=s}return r},qg=t=>BigInt("0x"+(_4(t)||"0")),Pw=(t,e,r)=>qg(t.slice(e,r)),Mw=t=>Rw(t)&&t>=0n&&t<w4?Ng(VD(t,2*Oi)):gr("bigint expected"),Cg=t=>_4(Mw(t)),v4=(...t)=>{let e=Yo(t.reduce((n,i)=>n+WD(i).length,0)),r=0;return t.forEach(n=>{e.set(n,r),r+=n.length}),e},Lg=(t,e=Nf)=>{(t===0n||e<=0n)&&gr("no inverse n="+t+" mod="+e);let r=we(t,e),n=e,i=0n,o=1n,s=1n,a=0n;for(;r!==0n;){let c=n/r,d=n%r,f=i-s*c,u=o-a*c;n=r,r=d,i=s,o=a,s=f,a=u}return n===1n?we(i,e):gr("no inverse")},qae=t=>{let e=1n;for(let r=t,n=(Nf+1n)/4n;n>0n;n>>=1n)n&1n&&(e=e*r%Nf),r=r*r%Nf;return we(e*e)===t?e:gr("sqrt invalid")},Iw=t=>(Rw(t)||(t=qg(pd(t,Oi))),jg(t)?t:gr("private key out of range")),x4=t=>t>Dn>>1n;function kw(t,e=!0){return mn.fromPrivateKey(t).toRawBytes(e)}var qf=class{constructor(e,r,n){this.r=e,this.s=r,this.recovery=n,this.assertValidity()}static fromCompact(e){return e=pd(e,64),new qf(Pw(e,0,Oi),Pw(e,Oi,2*Oi))}assertValidity(){return jg(this.r)&&jg(this.s)?this:gr()}addRecoveryBit(e){return new qf(this.r,this.s,e)}hasHighS(){return x4(this.s)}recoverPublicKey(e){let{r,s:n,recovery:i}=this;[0,1,2,3].includes(i)||gr("recovery id invalid");let o=E4(pd(e,32)),s=i===2||i===3?r+Dn:r;s>=Nf&&gr("q.x invalid");let a=i&1?"03":"02",c=mn.fromHex(a+Cg(s)),d=Lg(s,Dn),f=we(-o*d,Dn),u=we(n*d,Dn);return hd.mulAddQUns(c,f,u)}toCompactRawBytes(){return Ng(this.toCompactHex())}toCompactHex(){return Cg(this.r)+Cg(this.s)}},KD=t=>{let e=t.length*8-256,r=qg(t);return e>0?r>>BigInt(e):r},E4=t=>we(KD(t),Dn),UD=t=>Mw(t),FD=()=>typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0,Og,ZD={lowS:!0},Lae={lowS:!0};function Uae(t,e,r=ZD){["der","recovered","canonical"].some(u=>u in r)&&gr("sign() legacy options not supported");let{lowS:n}=r;n==null&&(n=!0);let i=E4(pd(t)),o=UD(i),s=Iw(e),a=[UD(s),o],c=r.extraEntropy;if(c){c===!0&&(c=Ms.randomBytes(Oi));let u=pd(c);u.length!==Oi&&gr(),a.push(u)}let d=i,f=u=>{let m=KD(u);if(!jg(m))return;let _=Lg(m,Dn),v=hd.mul(m).aff(),A=we(v.x,Dn);if(A===0n)return;let T=we(_*we(d+we(s*A,Dn),Dn),Dn);if(T===0n)return;let M=T,D=(v.x===A?0:2)|Number(v.y&1n);return n&&x4(T)&&(M=we(-T,Dn),D^=1),new qf(A,M,D)};return{seed:v4(...a),k2sig:f}}function Fae(t){let e=Yo(Oi),r=Yo(Oi),n=0,i=()=>{e.fill(1),r.fill(0),n=0},o="drbg: tried 1000 values";if(t){let s=(...d)=>Ms.hmacSha256Async(r,e,...d),a=async(d=Yo())=>{r=await s(Yo([0]),d),e=await s(),d.length!==0&&(r=await s(Yo([1]),d),e=await s())},c=async()=>(n++>=1e3&&gr(o),e=await s(),e);return async(d,f)=>{i(),await a(d);let u;for(;!(u=f(await c()));)await a();return i(),u}}else{let s=(...d)=>{let f=Og;return f||gr("etc.hmacSha256Sync not set"),f(r,e,...d)},a=(d=Yo())=>{r=s(Yo([0]),d),e=s(),d.length!==0&&(r=s(Yo([1]),d),e=s())},c=()=>(n++>=1e3&&gr(o),e=s(),e);return(d,f)=>{i(),a(d);let u;for(;!(u=f(c()));)a();return i(),u}}}async function YD(t,e,r=ZD){let{seed:n,k2sig:i}=Uae(t,e,r);return Fae(!0)(n,i)}function JD(t,e,r,n=Lae){let{lowS:i}=n;i==null&&(i=!0),"strict"in n&&gr("verify() legacy options not supported");let o,s,a,c=t&&typeof t=="object"&&"r"in t;!c&&pd(t).length!==2*Oi&&gr("signature must be 64 bytes");try{o=c?new qf(t.r,t.s).assertValidity():qf.fromCompact(t),s=E4(pd(e,Oi)),a=r instanceof mn?r.ok():mn.fromHex(r)}catch{return!1}if(!o)return!1;let{r:d,s:f}=o;if(i&&x4(f))return!1;let u;try{let _=Lg(f,Dn),v=we(s*_,Dn),A=we(d*_,Dn);u=hd.mulAddQUns(a,v,A).aff()}catch{return!1}return u?we(u.x,Dn)===d:!1}function XD(t){t=pd(t);let e=Oi+8;(t.length<e||t.length>1024)&&gr("expected proper params");let r=we(qg(t),Dn-1n)+1n;return Mw(r)}var Ms={hexToBytes:Ng,bytesToHex:_4,concatBytes:v4,bytesToNumberBE:qg,numberToBytesBE:Mw,mod:we,invert:Lg,hmacSha256Async:async(t,...e)=>{let r=FD();if(!r)return gr("etc.hmacSha256Async not set");let n=r.subtle,i=await n.importKey("raw",t,{name:"HMAC",hash:{name:"SHA-256"}},!1,["sign"]);return Yo(await n.sign("HMAC",i,v4(...e)))},hmacSha256Sync:Og,hashToPrivateKey:XD,randomBytes:t=>{let e=FD();return e||gr("crypto.getRandomValues must be defined"),e.getRandomValues(Yo(t))}},S4={normPrivateKeyToScalar:Iw,isValidPrivateKey:t=>{try{return!!Iw(t)}catch{return!1}},randomPrivateKey:()=>XD(Ms.randomBytes(Oi+8)),precompute(t=8,e=hd){return e.multiply(3n),e}};Object.defineProperties(Ms,{hmacSha256Sync:{configurable:!1,get(){return Og},set(t){Og||(Og=t)}}});var Dl=8,zae=()=>{let t=[],e=256/Dl+1,r=hd,n=r;for(let i=0;i<e;i++){n=r,t.push(n);for(let o=1;o<2**(Dl-1);o++)n=n.add(r),t.push(n);r=n.double()}return t},$ae=t=>{let e=LD||(LD=zae()),r=(f,u)=>{let m=u.negate();return f?m:u},n=Tw,i=hd,o=1+256/Dl,s=2**(Dl-1),a=BigInt(2**Dl-1),c=2**Dl,d=BigInt(Dl);for(let f=0;f<o;f++){let u=f*s,m=Number(t&a);t>>=d,m>s&&(m-=c,t+=1n);let _=u,v=u+Math.abs(m)-1,A=f%2!==0,T=m<0;m===0?i=i.add(r(A,e[_])):n=n.add(r(T,e[v]))}return{p:n,f:i}};var qt=class{static validateKey(e){if(e.kty!=="EC"||e.crv!=="secp256k1")throw new Q("Secp256k1KeyNotValid","Invalid SECP256K1 JWK: `kty` MUST be `EC`. `crv` MUST be `secp256k1`")}static async publicKeyToJwk(e){let r;if(e.byteLength===33){let s=Ms.bytesToHex(e);r=mn.fromHex(s).toRawBytes(!1)}else r=e;let n=Be.bytesToBase64Url(r.subarray(1,33)),i=Be.bytesToBase64Url(r.subarray(33,65));return{alg:"ES256K",kty:"EC",crv:"secp256k1",x:n,y:i}}static async privateKeyToJwk(e){let r=await qt.getPublicKey(e),n=await qt.publicKeyToJwk(r);return n.d=Be.bytesToBase64Url(e),n}static publicJwkToBytes(e){let r=Be.base64UrlToBytes(e.x),n=Be.base64UrlToBytes(e.y);return mn.fromAffine({x:Ms.bytesToNumberBE(r),y:Ms.bytesToNumberBE(n)}).toRawBytes(!0)}static privateJwkToBytes(e){return Be.base64UrlToBytes(e.d)}static async sign(e,r){qt.validateKey(r);let n=await Eo.encode(e),i=Ms.bytesToHex(n),o=qt.privateJwkToBytes(r),s=Ms.bytesToHex(o);return(await YD(i,s)).toCompactRawBytes()}static async verify(e,r,n){qt.validateKey(n);let i=qt.publicJwkToBytes(n),o=await Eo.encode(e);return JD(r,o,i)}static async generateKeyPair(){let e=S4.randomPrivateKey(),r=kw(e,!1),n=Be.bytesToBase64Url(e),i=await qt.publicKeyToJwk(r),o={...i,d:n};return{publicJwk:i,privateJwk:o}}static async generateKeyPairRaw(){let e=S4.randomPrivateKey();return{publicKey:kw(e,!0),privateKey:e}}static async getPublicKey(e){return kw(e,!0)}static async getPublicJwk(e){let{d:r,...n}=e;return n}static async derivePublicKey(e,r){qt.validateKeyDerivationPath(r);let n=await qt.derivePrivateKey(e,r);return await qt.getPublicKey(n)}static async derivePrivateKey(e,r){qt.validateKeyDerivationPath(r);let n=e;for(let i of r){let o=Be.stringToBytes(i);n=await qt.deriveChildPrivateKey(n,o)}return n}static async deriveChildPrivateKey(e,r){let n=await Eo.encode(e),i=await Eo.encode(r),o=Ms.concatBytes(n,i);return Ms.hashToPrivateKey(o)}static validateKeyDerivationPath(e){if(e.includes(""))throw new Q("HdKeyDerivationPathInvalid",`Invalid key derivation path: ${e}`)}};var s0={Ed25519:Bl,secp256k1:{sign:qt.sign,verify:qt.verify,generateKeyPair:qt.generateKeyPair,publicKeyToJwk:qt.publicKeyToJwk}};var Ug=class{constructor(e){if(e.keyId===void 0&&e.privateJwk.kid===void 0)throw new Q("PrivateKeySignerUnableToDeduceKeyId","Unable to deduce the key ID");if(e.algorithm===void 0&&e.privateJwk.alg===void 0)throw new Q("PrivateKeySignerUnableToDeduceAlgorithm","Unable to deduce the signature algorithm");if(this.keyId=e.keyId??e.privateJwk.kid,this.algorithm=e.algorithm??e.privateJwk.alg,this.privateJwk=e.privateJwk,this.signatureAlgorithm=s0[e.privateJwk.crv],!this.signatureAlgorithm)throw new Q("PrivateKeySignerUnsupportedCurve",`Unsupported crv ${e.privateJwk.crv}, crv must be one of ${Object.keys(s0)}`)}async sign(e){return await this.signatureAlgorithm.sign(e,this.privateJwk)}};var fr=class{static getKid(e){let{kid:r}=Be.base64UrlToObject(e.protected);return r}static getSignerDid(e){let r=fr.getKid(e);return fr.extractDid(r)}static async verifySignature(e,r,n){let i=s0[n.crv];if(!i)throw new Q("JwsVerifySignatureUnsupportedCrv",`unsupported crv. crv must be one of ${Object.keys(s0)}`);let o=Be.stringToBytes(`${r.protected}.${e}`),s=Be.base64UrlToBytes(r.signature);return await i.verify(o,s,n)}static decodePlainObjectPayload(e){let r;try{r=Be.base64UrlToObject(e.payload)}catch{throw new Q("JwsDecodePlainObjectPayloadInvalid","payload is not a JSON object")}if(!(0,QD.default)(r))throw new Q("JwsDecodePlainObjectPayloadInvalid","signed payload must be a plain object");return r}static extractDid(e){let[r]=e.split("#");return r}static createSigners(e){return e.map(n=>fr.createSigner(n))}static createSigner(e){let r=e.keyPair.privateJwk,n=e.keyId;return new Ug({privateJwk:r,keyId:n})}};p();p();var md=class{constructor(e){this.jws=e}static async create(e,r=[]){let n={payload:Be.bytesToBase64Url(e),signatures:[]},i=new md(n);for(let o of r)await i.addSignature(o);return i}async addSignature(e){let r={kid:e.keyId,alg:e.algorithm},n=JSON.stringify(r),i=Be.stringToBase64Url(n),o=`${i}.${this.jws.payload}`,s=Be.stringToBytes(o),a=await e.sign(s),c=Be.bytesToBase64Url(a);this.jws.signatures.push({protected:i,signature:c})}getJws(){return this.jws}};p();function eC(t,e){return t>e?1:t<e?-1:0}p();var sC=mr(oC(),1);function aC(t){let e=sC.default.flatten(t);return cC(e),e}function Hae(t){if(typeof t!="object")return!1;for(let e in t)return!1;return!0}function cC(t){Object.keys(t).forEach(e=>{typeof t[e]=="object"&&cC(t[e]),Hae(t[e])&&delete t[e]})}function Hn(t){Object.keys(t).forEach(e=>{t[e]===void 0?delete t[e]:typeof t[e]=="object"&&Hn(t[e])})}p();var D4={};dr(D4,{Authorization:()=>Wae,AuthorizationDelegatedGrant:()=>Vae,AuthorizationOwner:()=>Kae,Definitions:()=>tce,EventsGet:()=>ece,GeneralJwk:()=>rce,GeneralJws:()=>nce,GenericSignaturePayload:()=>vce,JwkVerificationMethod:()=>ice,MessagesGet:()=>oce,NumberRangeFilter:()=>sce,PermissionsDefinitions:()=>ace,PermissionsGrant:()=>cce,PermissionsRequest:()=>dce,PermissionsRevoke:()=>fce,PermissionsScopes:()=>uce,ProtocolDefinition:()=>lce,ProtocolRuleSet:()=>hce,ProtocolsConfigure:()=>pce,ProtocolsQuery:()=>mce,PublicJwk:()=>bce,RecordsDelete:()=>Zae,RecordsFilter:()=>gce,RecordsQuery:()=>Yae,RecordsRead:()=>yce,RecordsWrite:()=>Jae,RecordsWriteSignaturePayload:()=>wce,RecordsWriteUnidentified:()=>Qae});p();var Wae=qr;var Cl=new RegExp("^[A-Za-z0-9_-]+$","u");function vr(t,{instancePath:e="",parentData:r,parentDataProperty:n,rootData:i=t}={}){let o=null,s=0;if(s===0)if(t&&typeof t=="object"&&!Array.isArray(t)){let f=s;for(let u in t)if(!(u==="payload"||u==="signatures")){return vr.errors=[{instancePath:e,schemaPath:"#/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:u},message:"must NOT have additional properties"}],!1;break}if(f===s){if(t.payload!==void 0){let u=t.payload,m=s;if(s===s)if(typeof u=="string"){if(!Cl.test(u))return vr.errors=[{instancePath:e+"/payload",schemaPath:"https://identity.foundation/dwn/json-schemas/defs.json#/definitions/base64url/pattern",keyword:"pattern",params:{pattern:"^[A-Za-z0-9_-]+$"},message:'must match pattern "^[A-Za-z0-9_-]+$"'}],!1}else return vr.errors=[{instancePath:e+"/payload",schemaPath:"https://identity.foundation/dwn/json-schemas/defs.json#/definitions/base64url/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var a=m===s}else var a=!0;if(a)if(t.signatures!==void 0){let u=t.signatures,m=s;if(s===m)if(Array.isArray(u)){if(u.length<1)return vr.errors=[{instancePath:e+"/signatures",schemaPath:"#/properties/signatures/minItems",keyword:"minItems",params:{limit:1},message:"must NOT have fewer than 1 items"}],!1;{var c=!0;let v=u.length;for(let A=0;A<v;A++){let T=u[A],M=s;if(s===M)if(T&&typeof T=="object"&&!Array.isArray(T)){if(T.protected!==void 0){let O=T.protected,U=s;if(s===s)if(typeof O=="string"){if(!Cl.test(O))return vr.errors=[{instancePath:e+"/signatures/"+A+"/protected",schemaPath:"https://identity.foundation/dwn/json-schemas/defs.json#/definitions/base64url/pattern",keyword:"pattern",params:{pattern:"^[A-Za-z0-9_-]+$"},message:'must match pattern "^[A-Za-z0-9_-]+$"'}],!1}else return vr.errors=[{instancePath:e+"/signatures/"+A+"/protected",schemaPath:"https://identity.foundation/dwn/json-schemas/defs.json#/definitions/base64url/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var d=U===s}else var d=!0;if(d)if(T.signature!==void 0){let O=T.signature,U=s;if(s===s)if(typeof O=="string"){if(!Cl.test(O))return vr.errors=[{instancePath:e+"/signatures/"+A+"/signature",schemaPath:"https://identity.foundation/dwn/json-schemas/defs.json#/definitions/base64url/pattern",keyword:"pattern",params:{pattern:"^[A-Za-z0-9_-]+$"},message:'must match pattern "^[A-Za-z0-9_-]+$"'}],!1}else return vr.errors=[{instancePath:e+"/signatures/"+A+"/signature",schemaPath:"https://identity.foundation/dwn/json-schemas/defs.json#/definitions/base64url/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var d=U===s}else var d=!0}else return vr.errors=[{instancePath:e+"/signatures/"+A,schemaPath:"#/properties/signatures/items/type",keyword:"type",params:{type:"object"},message:"must be object"}],!1;var c=M===s;if(!c)break}}}else return vr.errors=[{instancePath:e+"/signatures",schemaPath:"#/properties/signatures/type",keyword:"type",params:{type:"array"},message:"must be array"}],!1;var a=m===s}else var a=!0}}else return vr.errors=[{instancePath:e,schemaPath:"#/type",keyword:"type",params:{type:"object"},message:"must be object"}],!1;return vr.errors=o,s===0}function qr(t,{instancePath:e="",parentData:r,parentDataProperty:n,rootData:i=t}={}){let o=null,s=0;if(s===0)if(t&&typeof t=="object"&&!Array.isArray(t)){let a=s;for(let c in t)if(c!=="signature"){return qr.errors=[{instancePath:e,schemaPath:"#/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:c},message:"must NOT have additional properties"}],!1;break}a===s&&t.signature!==void 0&&(vr(t.signature,{instancePath:e+"/signature",parentData:t,parentDataProperty:"signature",rootData:i})||(o=o===null?vr.errors:o.concat(vr.errors),s=o.length))}else return qr.errors=[{instancePath:e,schemaPath:"#/type",keyword:"type",params:{type:"object"},message:"must be object"}],!1;return qr.errors=o,s===0}var Vae=Qo;var A4={$schema:"http://json-schema.org/draft-07/schema#",$id:"https://identity.foundation/dwn/json-schemas/permissions-grant.json",type:"object",required:["authorization","descriptor"],additionalProperties:!1,properties:{authorization:{$ref:"https://identity.foundation/dwn/json-schemas/authorization.json"},delegationChain:{description:"the parent grant",$ref:"#"},descriptor:{type:"object",additionalProperties:!1,required:["interface","method","messageTimestamp","dateExpires"],properties:{messageTimestamp:{$ref:"https://identity.foundation/dwn/json-schemas/defs.json#/definitions/date-time"},dateExpires:{$ref:"https://identity.foundation/dwn/json-schemas/defs.json#/definitions/date-time"},description:{type:"string"},delegated:{type:"boolean"},grantedTo:{description:"DID of the grantee",$ref:"https://identity.foundation/dwn/json-schemas/permissions/defs.json#/definitions/grantedTo"},grantedBy:{description:"DID of the grantor",$ref:"https://identity.foundation/dwn/json-schemas/permissions/defs.json#/definitions/grantedBy"},grantedFor:{description:"DID of the DWN to which the grantee is given access",$ref:"https://identity.foundation/dwn/json-schemas/permissions/defs.json#/definitions/grantedFor"},permissionsRequestId:{description:"CID of an associated PermissionsRequest message",type:"string"},interface:{enum:["Permissions"],type:"string"},method:{enum:["Grant"],type:"string"},scope:{$ref:"https://identity.foundation/dwn/json-schemas/permissions/defs.json#/definitions/scope"},conditions:{$ref:"https://identity.foundation/dwn/json-schemas/permissions/defs.json#/definitions/conditions"}}}}};var vC={type:"object",additionalProperties:!1,properties:{publication:{enum:["Required","Prohibited"],type:"string"}}};function zg(t,{instancePath:e="",parentData:r,parentDataProperty:n,rootData:i=t}={}){let o=null,s=0,a=s,c=!1,d=null,f=s;if(s===s)if(t&&typeof t=="object"&&!Array.isArray(t)){if(t.interface!==void 0){let O=s;if(t.interface!=="Protocols"){let U={instancePath:e+"/interface",schemaPath:"https://identity.foundation/dwn/json-schemas/permissions/scopes.json#/definitions/protocols-query-scope/properties/interface/const",keyword:"const",params:{allowedValue:"Protocols"},message:"must be equal to constant"};o===null?o=[U]:o.push(U),s++}var m=O===s}else var m=!0;if(m)if(t.method!==void 0){let O=s;if(t.method!=="Query"){let L={instancePath:e+"/method",schemaPath:"https://identity.foundation/dwn/json-schemas/permissions/scopes.json#/definitions/protocols-query-scope/properties/method/const",keyword:"const",params:{allowedValue:"Query"},message:"must be equal to constant"};o===null?o=[L]:o.push(L),s++}var m=O===s}else var m=!0}else{let O={instancePath:e,schemaPath:"https://identity.foundation/dwn/json-schemas/permissions/scopes.json#/definitions/protocols-query-scope/type",keyword:"type",params:{type:"object"},message:"must be object"};o===null?o=[O]:o.push(O),s++}var T=f===s;T&&(c=!0,d=0);let _=s;if(s===s)if(t&&typeof t=="object"&&!Array.isArray(t)){let O;if(t.interface===void 0&&(O="interface")||t.method===void 0&&(O="method")){let U={instancePath:e,schemaPath:"https://identity.foundation/dwn/json-schemas/permissions/scopes.json#/definitions/records-read-scope/required",keyword:"required",params:{missingProperty:O},message:"must have required property '"+O+"'"};o===null?o=[U]:o.push(U),s++}else{if(t.interface!==void 0){let U=s;if(t.interface!=="Records"){let L={instancePath:e+"/interface",schemaPath:"https://identity.foundation/dwn/json-schemas/permissions/scopes.json#/definitions/records-read-scope/properties/interface/const",keyword:"const",params:{allowedValue:"Records"},message:"must be equal to constant"};o===null?o=[L]:o.push(L),s++}var A=U===s}else var A=!0;if(A){if(t.method!==void 0){let U=s;if(t.method!=="Read"){let F={instancePath:e+"/method",schemaPath:"https://identity.foundation/dwn/json-schemas/permissions/scopes.json#/definitions/records-read-scope/properties/method/const",keyword:"const",params:{allowedValue:"Read"},message:"must be equal to constant"};o===null?o=[F]:o.push(F),s++}var A=U===s}else var A=!0;if(A){if(t.schema!==void 0){let U=s;if(typeof t.schema!="string"){let F={instancePath:e+"/schema",schemaPath:"https://identity.foundation/dwn/json-schemas/permissions/scopes.json#/definitions/records-read-scope/properties/schema/type",keyword:"type",params:{type:"string"},message:"must be string"};o===null?o=[F]:o.push(F),s++}var A=U===s}else var A=!0;if(A){if(t.protocol!==void 0){let U=s;if(typeof t.protocol!="string"){let F={instancePath:e+"/protocol",schemaPath:"https://identity.foundation/dwn/json-schemas/permissions/scopes.json#/definitions/records-read-scope/properties/protocol/type",keyword:"type",params:{type:"string"},message:"must be string"};o===null?o=[F]:o.push(F),s++}var A=U===s}else var A=!0;if(A){if(t.contextId!==void 0){let U=s;if(typeof t.contextId!="string"){let F={instancePath:e+"/contextId",schemaPath:"https://identity.foundation/dwn/json-schemas/permissions/scopes.json#/definitions/records-read-scope/properties/contextId/type",keyword:"type",params:{type:"string"},message:"must be string"};o===null?o=[F]:o.push(F),s++}var A=U===s}else var A=!0;if(A)if(t.protocolPath!==void 0){let U=s;if(typeof t.protocolPath!="string"){let F={instancePath:e+"/protocolPath",schemaPath:"https://identity.foundation/dwn/json-schemas/permissions/scopes.json#/definitions/records-read-scope/properties/protocolPath/type",keyword:"type",params:{type:"string"},message:"must be string"};o===null?o=[F]:o.push(F),s++}var A=U===s}else var A=!0}}}}}}else{let O={instancePath:e,schemaPath:"https://identity.foundation/dwn/json-schemas/permissions/scopes.json#/definitions/records-read-scope/type",keyword:"type",params:{type:"object"},message:"must be object"};o===null?o=[O]:o.push(O),s++}var T=_===s;if(T&&c)c=!1,d=[d,1];else{T&&(c=!0,d=1);let O=s;if(s===s)if(t&&typeof t=="object"&&!Array.isArray(t)){let F;if(t.interface===void 0&&(F="interface")||t.method===void 0&&(F="method")){let $={instancePath:e,schemaPath:"https://identity.foundation/dwn/json-schemas/permissions/scopes.json#/definitions/records-delete-scope/required",keyword:"required",params:{missingProperty:F},message:"must have required property '"+F+"'"};o===null?o=[$]:o.push($),s++}else{if(t.interface!==void 0){let $=s;if(t.interface!=="Records"){let H={instancePath:e+"/interface",schemaPath:"https://identity.foundation/dwn/json-schemas/permissions/scopes.json#/definitions/records-delete-scope/properties/interface/const",keyword:"const",params:{allowedValue:"Records"},message:"must be equal to constant"};o===null?o=[H]:o.push(H),s++}var M=$===s}else var M=!0;if(M){if(t.method!==void 0){let $=s;if(t.method!=="Delete"){let z={instancePath:e+"/method",schemaPath:"https://identity.foundation/dwn/json-schemas/permissions/scopes.json#/definitions/records-delete-scope/properties/method/const",keyword:"const",params:{allowedValue:"Delete"},message:"must be equal to constant"};o===null?o=[z]:o.push(z),s++}var M=$===s}else var M=!0;if(M)if(t.schema!==void 0){let $=s;if(typeof t.schema!="string"){let z={instancePath:e+"/schema",schemaPath:"https://identity.foundation/dwn/json-schemas/permissions/scopes.json#/definitions/records-delete-scope/properties/schema/type",keyword:"type",params:{type:"string"},message:"must be string"};o===null?o=[z]:o.push(z),s++}var M=$===s}else var M=!0}}}else{let F={instancePath:e,schemaPath:"https://identity.foundation/dwn/json-schemas/permissions/scopes.json#/definitions/records-delete-scope/type",keyword:"type",params:{type:"object"},message:"must be object"};o===null?o=[F]:o.push(F),s++}var T=O===s;if(T&&c)c=!1,d=[d,2];else{T&&(c=!0,d=2);let F=s;if(s===s)if(t&&typeof t=="object"&&!Array.isArray(t)){let z;if(t.interface===void 0&&(z="interface")||t.method===void 0&&(z="method")){let j={instancePath:e,schemaPath:"https://identity.foundation/dwn/json-schemas/permissions/scopes.json#/definitions/records-write-scope/required",keyword:"required",params:{missingProperty:z},message:"must have required property '"+z+"'"};o===null?o=[j]:o.push(j),s++}else{if(t.interface!==void 0){let j=s;if(t.interface!=="Records"){let y={instancePath:e+"/interface",schemaPath:"https://identity.foundation/dwn/json-schemas/permissions/scopes.json#/definitions/records-write-scope/properties/interface/const",keyword:"const",params:{allowedValue:"Records"},message:"must be equal to constant"};o===null?o=[y]:o.push(y),s++}var D=j===s}else var D=!0;if(D){if(t.method!==void 0){let j=s;if(t.method!=="Write"){let P={instancePath:e+"/method",schemaPath:"https://identity.foundation/dwn/json-schemas/permissions/scopes.json#/definitions/records-write-scope/properties/method/const",keyword:"const",params:{allowedValue:"Write"},message:"must be equal to constant"};o===null?o=[P]:o.push(P),s++}var D=j===s}else var D=!0;if(D){if(t.schema!==void 0){let j=s;if(typeof t.schema!="string"){let P={instancePath:e+"/schema",schemaPath:"https://identity.foundation/dwn/json-schemas/permissions/scopes.json#/definitions/records-write-scope/properties/schema/type",keyword:"type",params:{type:"string"},message:"must be string"};o===null?o=[P]:o.push(P),s++}var D=j===s}else var D=!0;if(D){if(t.protocol!==void 0){let j=s;if(typeof t.protocol!="string"){let P={instancePath:e+"/protocol",schemaPath:"https://identity.foundation/dwn/json-schemas/permissions/scopes.json#/definitions/records-write-scope/properties/protocol/type",keyword:"type",params:{type:"string"},message:"must be string"};o===null?o=[P]:o.push(P),s++}var D=j===s}else var D=!0;if(D){if(t.contextId!==void 0){let j=s;if(typeof t.contextId!="string"){let P={instancePath:e+"/contextId",schemaPath:"https://identity.foundation/dwn/json-schemas/permissions/scopes.json#/definitions/records-write-scope/properties/contextId/type",keyword:"type",params:{type:"string"},message:"must be string"};o===null?o=[P]:o.push(P),s++}var D=j===s}else var D=!0;if(D)if(t.protocolPath!==void 0){let j=s;if(typeof t.protocolPath!="string"){let P={instancePath:e+"/protocolPath",schemaPath:"https://identity.foundation/dwn/json-schemas/permissions/scopes.json#/definitions/records-write-scope/properties/protocolPath/type",keyword:"type",params:{type:"string"},message:"must be string"};o===null?o=[P]:o.push(P),s++}var D=j===s}else var D=!0}}}}}}else{let z={instancePath:e,schemaPath:"https://identity.foundation/dwn/json-schemas/permissions/scopes.json#/definitions/records-write-scope/type",keyword:"type",params:{type:"object"},message:"must be object"};o===null?o=[z]:o.push(z),s++}var T=F===s;T&&c?(c=!1,d=[d,3]):T&&(c=!0,d=3)}}if(c)s=a,o!==null&&(a?o.length=a:o=null);else{let O={instancePath:e,schemaPath:"#/oneOf",keyword:"oneOf",params:{passingSchemas:d},message:"must match exactly one schema in oneOf"};return o===null?o=[O]:o.push(O),s++,zg.errors=o,!1}return zg.errors=o,s===0}var Dw=Object.prototype.hasOwnProperty,Cn=new RegExp("^\\d{4}-[0-1]\\d-[0-3]\\dT(?:[0-2]\\d:[0-5]\\d:[0-5]\\d|23:59:60)\\.\\d{6}Z$","u"),ks=new RegExp("^did:([a-z0-9]+):((?:(?:[a-zA-Z0-9._-]|(?:%[0-9a-fA-F]{2}))*:)*((?:[a-zA-Z0-9._-]|(?:%[0-9a-fA-F]{2}))+))((;[a-zA-Z0-9_.:%-]+=[a-zA-Z0-9_.:%-]*)*)(/[^#?]*)?([?][^#]*)?(#.*)?$","u");function zt(t,{instancePath:e="",parentData:r,parentDataProperty:n,rootData:i=t}={}){let o=null,s=0;if(s===0)if(t&&typeof t=="object"&&!Array.isArray(t)){let d;if(t.authorization===void 0&&(d="authorization")||t.descriptor===void 0&&(d="descriptor"))return zt.errors=[{instancePath:e,schemaPath:"#/required",keyword:"required",params:{missingProperty:d},message:"must have required property '"+d+"'"}],!1;{let f=s;for(let u in t)if(!(u==="authorization"||u==="delegationChain"||u==="descriptor")){return zt.errors=[{instancePath:e,schemaPath:"#/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:u},message:"must NOT have additional properties"}],!1;break}if(f===s){if(t.authorization!==void 0){let u=s;qr(t.authorization,{instancePath:e+"/authorization",parentData:t,parentDataProperty:"authorization",rootData:i})||(o=o===null?qr.errors:o.concat(qr.errors),s=o.length);var a=u===s}else var a=!0;if(a){if(t.delegationChain!==void 0){let u=s;zt(t.delegationChain,{instancePath:e+"/delegationChain",parentData:t,parentDataProperty:"delegationChain",rootData:i})||(o=o===null?zt.errors:o.concat(zt.errors),s=o.length);var a=u===s}else var a=!0;if(a)if(t.descriptor!==void 0){let u=t.descriptor,m=s;if(s===m)if(u&&typeof u=="object"&&!Array.isArray(u)){let v;if(u.interface===void 0&&(v="interface")||u.method===void 0&&(v="method")||u.messageTimestamp===void 0&&(v="messageTimestamp")||u.dateExpires===void 0&&(v="dateExpires"))return zt.errors=[{instancePath:e+"/descriptor",schemaPath:"#/properties/descriptor/required",keyword:"required",params:{missingProperty:v},message:"must have required property '"+v+"'"}],!1;{let A=s;for(let T in u)if(!Dw.call(A4.properties.descriptor.properties,T)){return zt.errors=[{instancePath:e+"/descriptor",schemaPath:"#/properties/descriptor/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:T},message:"must NOT have additional properties"}],!1;break}if(A===s){if(u.messageTimestamp!==void 0){let T=u.messageTimestamp,M=s;if(s===s)if(typeof T=="string"){if(!Cn.test(T))return zt.errors=[{instancePath:e+"/descriptor/messageTimestamp",schemaPath:"https://identity.foundation/dwn/json-schemas/defs.json#/definitions/date-time/pattern",keyword:"pattern",params:{pattern:"^\\d{4}-[0-1]\\d-[0-3]\\dT(?:[0-2]\\d:[0-5]\\d:[0-5]\\d|23:59:60)\\.\\d{6}Z$"},message:'must match pattern "^\\d{4}-[0-1]\\d-[0-3]\\dT(?:[0-2]\\d:[0-5]\\d:[0-5]\\d|23:59:60)\\.\\d{6}Z$"'}],!1}else return zt.errors=[{instancePath:e+"/descriptor/messageTimestamp",schemaPath:"https://identity.foundation/dwn/json-schemas/defs.json#/definitions/date-time/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var c=M===s}else var c=!0;if(c){if(u.dateExpires!==void 0){let T=u.dateExpires,M=s;if(s===s)if(typeof T=="string"){if(!Cn.test(T))return zt.errors=[{instancePath:e+"/descriptor/dateExpires",schemaPath:"https://identity.foundation/dwn/json-schemas/defs.json#/definitions/date-time/pattern",keyword:"pattern",params:{pattern:"^\\d{4}-[0-1]\\d-[0-3]\\dT(?:[0-2]\\d:[0-5]\\d:[0-5]\\d|23:59:60)\\.\\d{6}Z$"},message:'must match pattern "^\\d{4}-[0-1]\\d-[0-3]\\dT(?:[0-2]\\d:[0-5]\\d:[0-5]\\d|23:59:60)\\.\\d{6}Z$"'}],!1}else return zt.errors=[{instancePath:e+"/descriptor/dateExpires",schemaPath:"https://identity.foundation/dwn/json-schemas/defs.json#/definitions/date-time/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var c=M===s}else var c=!0;if(c){if(u.description!==void 0){let T=s;if(typeof u.description!="string")return zt.errors=[{instancePath:e+"/descriptor/description",schemaPath:"#/properties/descriptor/properties/description/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var c=T===s}else var c=!0;if(c){if(u.delegated!==void 0){let T=s;if(typeof u.delegated!="boolean")return zt.errors=[{instancePath:e+"/descriptor/delegated",schemaPath:"#/properties/descriptor/properties/delegated/type",keyword:"type",params:{type:"boolean"},message:"must be boolean"}],!1;var c=T===s}else var c=!0;if(c){if(u.grantedTo!==void 0){let T=u.grantedTo,M=s;if(s===s)if(typeof T=="string"){if(!ks.test(T))return zt.errors=[{instancePath:e+"/descriptor/grantedTo",schemaPath:"https://identity.foundation/dwn/json-schemas/permissions/defs.json#/definitions/grantedTo/pattern",keyword:"pattern",params:{pattern:"^did:([a-z0-9]+):((?:(?:[a-zA-Z0-9._-]|(?:%[0-9a-fA-F]{2}))*:)*((?:[a-zA-Z0-9._-]|(?:%[0-9a-fA-F]{2}))+))((;[a-zA-Z0-9_.:%-]+=[a-zA-Z0-9_.:%-]*)*)(/[^#?]*)?([?][^#]*)?(#.*)?$"},message:'must match pattern "^did:([a-z0-9]+):((?:(?:[a-zA-Z0-9._-]|(?:%[0-9a-fA-F]{2}))*:)*((?:[a-zA-Z0-9._-]|(?:%[0-9a-fA-F]{2}))+))((;[a-zA-Z0-9_.:%-]+=[a-zA-Z0-9_.:%-]*)*)(/[^#?]*)?([?][^#]*)?(#.*)?$"'}],!1}else return zt.errors=[{instancePath:e+"/descriptor/grantedTo",schemaPath:"https://identity.foundation/dwn/json-schemas/permissions/defs.json#/definitions/grantedTo/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var c=M===s}else var c=!0;if(c){if(u.grantedBy!==void 0){let T=u.grantedBy,M=s;if(s===s)if(typeof T=="string"){if(!ks.test(T))return zt.errors=[{instancePath:e+"/descriptor/grantedBy",schemaPath:"https://identity.foundation/dwn/json-schemas/permissions/defs.json#/definitions/grantedBy/pattern",keyword:"pattern",params:{pattern:"^did:([a-z0-9]+):((?:(?:[a-zA-Z0-9._-]|(?:%[0-9a-fA-F]{2}))*:)*((?:[a-zA-Z0-9._-]|(?:%[0-9a-fA-F]{2}))+))((;[a-zA-Z0-9_.:%-]+=[a-zA-Z0-9_.:%-]*)*)(/[^#?]*)?([?][^#]*)?(#.*)?$"},message:'must match pattern "^did:([a-z0-9]+):((?:(?:[a-zA-Z0-9._-]|(?:%[0-9a-fA-F]{2}))*:)*((?:[a-zA-Z0-9._-]|(?:%[0-9a-fA-F]{2}))+))((;[a-zA-Z0-9_.:%-]+=[a-zA-Z0-9_.:%-]*)*)(/[^#?]*)?([?][^#]*)?(#.*)?$"'}],!1}else return zt.errors=[{instancePath:e+"/descriptor/grantedBy",schemaPath:"https://identity.foundation/dwn/json-schemas/permissions/defs.json#/definitions/grantedBy/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var c=M===s}else var c=!0;if(c){if(u.grantedFor!==void 0){let T=u.grantedFor,M=s;if(s===s)if(typeof T=="string"){if(!ks.test(T))return zt.errors=[{instancePath:e+"/descriptor/grantedFor",schemaPath:"https://identity.foundation/dwn/json-schemas/permissions/defs.json#/definitions/grantedFor/pattern",keyword:"pattern",params:{pattern:"^did:([a-z0-9]+):((?:(?:[a-zA-Z0-9._-]|(?:%[0-9a-fA-F]{2}))*:)*((?:[a-zA-Z0-9._-]|(?:%[0-9a-fA-F]{2}))+))((;[a-zA-Z0-9_.:%-]+=[a-zA-Z0-9_.:%-]*)*)(/[^#?]*)?([?][^#]*)?(#.*)?$"},message:'must match pattern "^did:([a-z0-9]+):((?:(?:[a-zA-Z0-9._-]|(?:%[0-9a-fA-F]{2}))*:)*((?:[a-zA-Z0-9._-]|(?:%[0-9a-fA-F]{2}))+))((;[a-zA-Z0-9_.:%-]+=[a-zA-Z0-9_.:%-]*)*)(/[^#?]*)?([?][^#]*)?(#.*)?$"'}],!1}else return zt.errors=[{instancePath:e+"/descriptor/grantedFor",schemaPath:"https://identity.foundation/dwn/json-schemas/permissions/defs.json#/definitions/grantedFor/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var c=M===s}else var c=!0;if(c){if(u.permissionsRequestId!==void 0){let T=s;if(typeof u.permissionsRequestId!="string")return zt.errors=[{instancePath:e+"/descriptor/permissionsRequestId",schemaPath:"#/properties/descriptor/properties/permissionsRequestId/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var c=T===s}else var c=!0;if(c){if(u.interface!==void 0){let T=u.interface,M=s;if(typeof T!="string")return zt.errors=[{instancePath:e+"/descriptor/interface",schemaPath:"#/properties/descriptor/properties/interface/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;if(T!=="Permissions")return zt.errors=[{instancePath:e+"/descriptor/interface",schemaPath:"#/properties/descriptor/properties/interface/enum",keyword:"enum",params:{allowedValues:A4.properties.descriptor.properties.interface.enum},message:"must be equal to one of the allowed values"}],!1;var c=M===s}else var c=!0;if(c){if(u.method!==void 0){let T=u.method,M=s;if(typeof T!="string")return zt.errors=[{instancePath:e+"/descriptor/method",schemaPath:"#/properties/descriptor/properties/method/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;if(T!=="Grant")return zt.errors=[{instancePath:e+"/descriptor/method",schemaPath:"#/properties/descriptor/properties/method/enum",keyword:"enum",params:{allowedValues:A4.properties.descriptor.properties.method.enum},message:"must be equal to one of the allowed values"}],!1;var c=M===s}else var c=!0;if(c){if(u.scope!==void 0){let T=s;zg(u.scope,{instancePath:e+"/descriptor/scope",parentData:u,parentDataProperty:"scope",rootData:i})||(o=o===null?zg.errors:o.concat(zg.errors),s=o.length);var c=T===s}else var c=!0;if(c)if(u.conditions!==void 0){let T=u.conditions,M=s;if(s===s)if(T&&typeof T=="object"&&!Array.isArray(T)){let U=s;for(let L in T)if(L!=="publication"){return zt.errors=[{instancePath:e+"/descriptor/conditions",schemaPath:"https://identity.foundation/dwn/json-schemas/permissions/defs.json#/definitions/conditions/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:L},message:"must NOT have additional properties"}],!1;break}if(U===s&&T.publication!==void 0){let L=T.publication;if(typeof L!="string")return zt.errors=[{instancePath:e+"/descriptor/conditions/publication",schemaPath:"https://identity.foundation/dwn/json-schemas/permissions/defs.json#/definitions/conditions/properties/publication/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;if(!(L==="Required"||L==="Prohibited"))return zt.errors=[{instancePath:e+"/descriptor/conditions/publication",schemaPath:"https://identity.foundation/dwn/json-schemas/permissions/defs.json#/definitions/conditions/properties/publication/enum",keyword:"enum",params:{allowedValues:vC.properties.publication.enum},message:"must be equal to one of the allowed values"}],!1}}else return zt.errors=[{instancePath:e+"/descriptor/conditions",schemaPath:"https://identity.foundation/dwn/json-schemas/permissions/defs.json#/definitions/conditions/type",keyword:"type",params:{type:"object"},message:"must be object"}],!1;var c=M===s}else var c=!0}}}}}}}}}}}}}else return zt.errors=[{instancePath:e+"/descriptor",schemaPath:"#/properties/descriptor/type",keyword:"type",params:{type:"object"},message:"must be object"}],!1;var a=m===s}else var a=!0}}}}else return zt.errors=[{instancePath:e,schemaPath:"#/type",keyword:"type",params:{type:"object"},message:"must be object"}],!1;return zt.errors=o,s===0}function Qo(t,{instancePath:e="",parentData:r,parentDataProperty:n,rootData:i=t}={}){let o=null,s=0;if(s===0)if(t&&typeof t=="object"&&!Array.isArray(t)){let c=s;for(let d in t)if(!(d==="signature"||d==="authorDelegatedGrant")){return Qo.errors=[{instancePath:e,schemaPath:"#/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:d},message:"must NOT have additional properties"}],!1;break}if(c===s){if(t.signature!==void 0){let d=s;vr(t.signature,{instancePath:e+"/signature",parentData:t,parentDataProperty:"signature",rootData:i})||(o=o===null?vr.errors:o.concat(vr.errors),s=o.length);var a=d===s}else var a=!0;if(a)if(t.authorDelegatedGrant!==void 0){let d=s;zt(t.authorDelegatedGrant,{instancePath:e+"/authorDelegatedGrant",parentData:t,parentDataProperty:"authorDelegatedGrant",rootData:i})||(o=o===null?zt.errors:o.concat(zt.errors),s=o.length);var a=d===s}else var a=!0}}else return Qo.errors=[{instancePath:e,schemaPath:"#/type",keyword:"type",params:{type:"object"},message:"must be object"}],!1;return Qo.errors=o,s===0}var Kae=Uf;function Uf(t,{instancePath:e="",parentData:r,parentDataProperty:n,rootData:i=t}={}){let o=null,s=0;if(s===0)if(t&&typeof t=="object"&&!Array.isArray(t)){let c=s;for(let d in t)if(!(d==="signature"||d==="authorDelegatedGrant"||d==="ownerSignature")){return Uf.errors=[{instancePath:e,schemaPath:"#/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:d},message:"must NOT have additional properties"}],!1;break}if(c===s){let d;if(t.ownerSignature!==void 0&&t.signature===void 0&&(d="signature"))return Uf.errors=[{instancePath:e,schemaPath:"#/dependencies",keyword:"dependencies",params:{property:"ownerSignature",missingProperty:d,depsCount:1,deps:"signature"},message:"must have property signature when property ownerSignature is present"}],!1;if(t.signature!==void 0){let f=s;vr(t.signature,{instancePath:e+"/signature",parentData:t,parentDataProperty:"signature",rootData:i})||(o=o===null?vr.errors:o.concat(vr.errors),s=o.length);var a=f===s}else var a=!0;if(a){if(t.authorDelegatedGrant!==void 0){let f=s;zt(t.authorDelegatedGrant,{instancePath:e+"/authorDelegatedGrant",parentData:t,parentDataProperty:"authorDelegatedGrant",rootData:i})||(o=o===null?zt.errors:o.concat(zt.errors),s=o.length);var a=f===s}else var a=!0;if(a)if(t.ownerSignature!==void 0){let f=s;vr(t.ownerSignature,{instancePath:e+"/ownerSignature",parentData:t,parentDataProperty:"ownerSignature",rootData:i})||(o=o===null?vr.errors:o.concat(vr.errors),s=o.length);var a=f===s}else var a=!0}}}else return Uf.errors=[{instancePath:e,schemaPath:"#/type",keyword:"type",params:{type:"object"},message:"must be object"}],!1;return Uf.errors=o,s===0}var Zae=to,dC={$schema:"http://json-schema.org/draft-07/schema#",$id:"https://identity.foundation/dwn/json-schemas/records-delete.json",type:"object",additionalProperties:!1,required:["authorization","descriptor"],properties:{authorization:{$ref:"https://identity.foundation/dwn/json-schemas/authorization-delegated-grant.json"},descriptor:{type:"object",additionalProperties:!1,required:["interface","method","messageTimestamp","recordId"],properties:{interface:{enum:["Records"],type:"string"},method:{enum:["Delete"],type:"string"},messageTimestamp:{$ref:"https://identity.foundation/dwn/json-schemas/defs.json#/definitions/date-time"},recordId:{type:"string"}}}}};function to(t,{instancePath:e="",parentData:r,parentDataProperty:n,rootData:i=t}={}){let o=null,s=0;if(s===0)if(t&&typeof t=="object"&&!Array.isArray(t)){let d;if(t.authorization===void 0&&(d="authorization")||t.descriptor===void 0&&(d="descriptor"))return to.errors=[{instancePath:e,schemaPath:"#/required",keyword:"required",params:{missingProperty:d},message:"must have required property '"+d+"'"}],!1;{let f=s;for(let u in t)if(!(u==="authorization"||u==="descriptor")){return to.errors=[{instancePath:e,schemaPath:"#/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:u},message:"must NOT have additional properties"}],!1;break}if(f===s){if(t.authorization!==void 0){let u=s;Qo(t.authorization,{instancePath:e+"/authorization",parentData:t,parentDataProperty:"authorization",rootData:i})||(o=o===null?Qo.errors:o.concat(Qo.errors),s=o.length);var a=u===s}else var a=!0;if(a)if(t.descriptor!==void 0){let u=t.descriptor,m=s;if(s===m)if(u&&typeof u=="object"&&!Array.isArray(u)){let v;if(u.interface===void 0&&(v="interface")||u.method===void 0&&(v="method")||u.messageTimestamp===void 0&&(v="messageTimestamp")||u.recordId===void 0&&(v="recordId"))return to.errors=[{instancePath:e+"/descriptor",schemaPath:"#/properties/descriptor/required",keyword:"required",params:{missingProperty:v},message:"must have required property '"+v+"'"}],!1;{let A=s;for(let T in u)if(!(T==="interface"||T==="method"||T==="messageTimestamp"||T==="recordId")){return to.errors=[{instancePath:e+"/descriptor",schemaPath:"#/properties/descriptor/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:T},message:"must NOT have additional properties"}],!1;break}if(A===s){if(u.interface!==void 0){let T=u.interface,M=s;if(typeof T!="string")return to.errors=[{instancePath:e+"/descriptor/interface",schemaPath:"#/properties/descriptor/properties/interface/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;if(T!=="Records")return to.errors=[{instancePath:e+"/descriptor/interface",schemaPath:"#/properties/descriptor/properties/interface/enum",keyword:"enum",params:{allowedValues:dC.properties.descriptor.properties.interface.enum},message:"must be equal to one of the allowed values"}],!1;var c=M===s}else var c=!0;if(c){if(u.method!==void 0){let T=u.method,M=s;if(typeof T!="string")return to.errors=[{instancePath:e+"/descriptor/method",schemaPath:"#/properties/descriptor/properties/method/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;if(T!=="Delete")return to.errors=[{instancePath:e+"/descriptor/method",schemaPath:"#/properties/descriptor/properties/method/enum",keyword:"enum",params:{allowedValues:dC.properties.descriptor.properties.method.enum},message:"must be equal to one of the allowed values"}],!1;var c=M===s}else var c=!0;if(c){if(u.messageTimestamp!==void 0){let T=u.messageTimestamp,M=s;if(s===s)if(typeof T=="string"){if(!Cn.test(T))return to.errors=[{instancePath:e+"/descriptor/messageTimestamp",schemaPath:"https://identity.foundation/dwn/json-schemas/defs.json#/definitions/date-time/pattern",keyword:"pattern",params:{pattern:"^\\d{4}-[0-1]\\d-[0-3]\\dT(?:[0-2]\\d:[0-5]\\d:[0-5]\\d|23:59:60)\\.\\d{6}Z$"},message:'must match pattern "^\\d{4}-[0-1]\\d-[0-3]\\dT(?:[0-2]\\d:[0-5]\\d:[0-5]\\d|23:59:60)\\.\\d{6}Z$"'}],!1}else return to.errors=[{instancePath:e+"/descriptor/messageTimestamp",schemaPath:"https://identity.foundation/dwn/json-schemas/defs.json#/definitions/date-time/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var c=M===s}else var c=!0;if(c)if(u.recordId!==void 0){let T=s;if(typeof u.recordId!="string")return to.errors=[{instancePath:e+"/descriptor/recordId",schemaPath:"#/properties/descriptor/properties/recordId/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var c=T===s}else var c=!0}}}}}else return to.errors=[{instancePath:e+"/descriptor",schemaPath:"#/properties/descriptor/type",keyword:"type",params:{type:"object"},message:"must be object"}],!1;var a=m===s}else var a=!0}}}else return to.errors=[{instancePath:e,schemaPath:"#/type",keyword:"type",params:{type:"object"},message:"must be object"}],!1;return to.errors=o,s===0}var Yae=yn,T4={$schema:"http://json-schema.org/draft-07/schema#",$id:"https://identity.foundation/dwn/json-schemas/records-query.json",type:"object",additionalProperties:!1,required:["descriptor"],properties:{authorization:{$ref:"https://identity.foundation/dwn/json-schemas/authorization-delegated-grant.json"},descriptor:{type:"object",additionalProperties:!1,required:["interface","method","messageTimestamp","filter"],properties:{interface:{enum:["Records"],type:"string"},method:{enum:["Query"],type:"string"},messageTimestamp:{$ref:"https://identity.foundation/dwn/json-schemas/defs.json#/definitions/date-time"},filter:{$ref:"https://identity.foundation/dwn/json-schemas/records-filter.json"},pagination:{type:"object",additionalProperties:!1,properties:{limit:{type:"number",minimum:1},cursor:{type:"string"}}},dateSort:{enum:["createdAscending","createdDescending","publishedAscending","publishedDescending"],type:"string"}}}}},fC={$schema:"http://json-schema.org/draft-07/schema#",$id:"https://identity.foundation/dwn/json-schemas/records-filter.json",type:"object",minProperties:1,additionalProperties:!1,properties:{protocol:{type:"string"},protocolPath:{type:"string"},author:{$ref:"https://identity.foundation/dwn/json-schemas/defs.json#/definitions/did"},attester:{$ref:"https://identity.foundation/dwn/json-schemas/defs.json#/definitions/did"},recipient:{$ref:"https://identity.foundation/dwn/json-schemas/defs.json#/definitions/did"},contextId:{type:"string"},schema:{type:"string"},recordId:{type:"string"},parentId:{type:"string"},published:{type:"boolean"},dataFormat:{type:"string"},dataSize:{$ref:"https://identity.foundation/dwn/json-schemas/number-range-filter.json"},dataCid:{type:"string"},dateCreated:{type:"object",minProperties:1,additionalProperties:!1,properties:{from:{$ref:"https://identity.foundation/dwn/json-schemas/defs.json#/definitions/date-time"},to:{$ref:"https://identity.foundation/dwn/json-schemas/defs.json#/definitions/date-time"}}},datePublished:{type:"object",minProperties:1,additionalProperties:!1,properties:{from:{$ref:"https://identity.foundation/dwn/json-schemas/defs.json#/definitions/date-time"},to:{$ref:"https://identity.foundation/dwn/json-schemas/defs.json#/definitions/date-time"}}},dateUpdated:{type:"object",minProperties:1,additionalProperties:!1,properties:{from:{$ref:"https://identity.foundation/dwn/json-schemas/defs.json#/definitions/date-time"},to:{$ref:"https://identity.foundation/dwn/json-schemas/defs.json#/definitions/date-time"}}}},dependencies:{datePublished:{oneOf:[{properties:{published:{enum:[!0]}},required:["published"]},{not:{required:["published"]}}]}}};function Pe(t,{instancePath:e="",parentData:r,parentDataProperty:n,rootData:i=t}={}){let o=null,s=0;if(s===0)if(t&&typeof t=="object"&&!Array.isArray(t)){if(Object.keys(t).length<1)return Pe.errors=[{instancePath:e,schemaPath:"#/minProperties",keyword:"minProperties",params:{limit:1},message:"must NOT have fewer than 1 properties"}],!1;{let U=s;for(let L in t)if(!Dw.call(fC.properties,L)){return Pe.errors=[{instancePath:e,schemaPath:"#/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:L},message:"must NOT have additional properties"}],!1;break}if(U===s){if(t.datePublished!==void 0){let L=s,F=s,$=!1,H=null,z=s;if(t&&typeof t=="object"&&!Array.isArray(t)){let x;if(t.published===void 0&&(x="published")){let l={instancePath:e,schemaPath:"#/dependencies/datePublished/oneOf/0/required",keyword:"required",params:{missingProperty:x},message:"must have required property '"+x+"'"};o===null?o=[l]:o.push(l),s++}else if(t.published!==void 0&&t.published!==!0){let l={instancePath:e+"/published",schemaPath:"#/dependencies/datePublished/oneOf/0/properties/published/enum",keyword:"enum",params:{allowedValues:fC.dependencies.datePublished.oneOf[0].properties.published.enum},message:"must be equal to one of the allowed values"};o===null?o=[l]:o.push(l),s++}}var c=z===s;c&&($=!0,H=0);let j=s,y=s,P=s;if(t&&typeof t=="object"&&!Array.isArray(t)){let x;if(t.published===void 0&&(x="published")){let l={};o===null?o=[l]:o.push(l),s++}}var a=P===s;if(a){let x={instancePath:e,schemaPath:"#/dependencies/datePublished/oneOf/1/not",keyword:"not",params:{},message:"must NOT be valid"};o===null?o=[x]:o.push(x),s++}else s=y,o!==null&&(y?o.length=y:o=null);var c=j===s;if(c&&$?($=!1,H=[H,1]):c&&($=!0,H=1),$)s=F,o!==null&&(F?o.length=F:o=null);else{let x={instancePath:e,schemaPath:"#/dependencies/datePublished/oneOf",keyword:"oneOf",params:{passingSchemas:H},message:"must match exactly one schema in oneOf"};return o===null?o=[x]:o.push(x),s++,Pe.errors=o,!1}var d=L===s}else var d=!0;if(d){if(t.protocol!==void 0){let L=s;if(typeof t.protocol!="string")return Pe.errors=[{instancePath:e+"/protocol",schemaPath:"#/properties/protocol/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var f=L===s}else var f=!0;if(f){if(t.protocolPath!==void 0){let L=s;if(typeof t.protocolPath!="string")return Pe.errors=[{instancePath:e+"/protocolPath",schemaPath:"#/properties/protocolPath/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var f=L===s}else var f=!0;if(f){if(t.author!==void 0){let L=t.author,F=s;if(s===s)if(typeof L=="string"){if(!ks.test(L))return Pe.errors=[{instancePath:e+"/author",schemaPath:"https://identity.foundation/dwn/json-schemas/defs.json#/definitions/did/pattern",keyword:"pattern",params:{pattern:"^did:([a-z0-9]+):((?:(?:[a-zA-Z0-9._-]|(?:%[0-9a-fA-F]{2}))*:)*((?:[a-zA-Z0-9._-]|(?:%[0-9a-fA-F]{2}))+))((;[a-zA-Z0-9_.:%-]+=[a-zA-Z0-9_.:%-]*)*)(/[^#?]*)?([?][^#]*)?(#.*)?$"},message:'must match pattern "^did:([a-z0-9]+):((?:(?:[a-zA-Z0-9._-]|(?:%[0-9a-fA-F]{2}))*:)*((?:[a-zA-Z0-9._-]|(?:%[0-9a-fA-F]{2}))+))((;[a-zA-Z0-9_.:%-]+=[a-zA-Z0-9_.:%-]*)*)(/[^#?]*)?([?][^#]*)?(#.*)?$"'}],!1}else return Pe.errors=[{instancePath:e+"/author",schemaPath:"https://identity.foundation/dwn/json-schemas/defs.json#/definitions/did/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var f=F===s}else var f=!0;if(f){if(t.attester!==void 0){let L=t.attester,F=s;if(s===s)if(typeof L=="string"){if(!ks.test(L))return Pe.errors=[{instancePath:e+"/attester",schemaPath:"https://identity.foundation/dwn/json-schemas/defs.json#/definitions/did/pattern",keyword:"pattern",params:{pattern:"^did:([a-z0-9]+):((?:(?:[a-zA-Z0-9._-]|(?:%[0-9a-fA-F]{2}))*:)*((?:[a-zA-Z0-9._-]|(?:%[0-9a-fA-F]{2}))+))((;[a-zA-Z0-9_.:%-]+=[a-zA-Z0-9_.:%-]*)*)(/[^#?]*)?([?][^#]*)?(#.*)?$"},message:'must match pattern "^did:([a-z0-9]+):((?:(?:[a-zA-Z0-9._-]|(?:%[0-9a-fA-F]{2}))*:)*((?:[a-zA-Z0-9._-]|(?:%[0-9a-fA-F]{2}))+))((;[a-zA-Z0-9_.:%-]+=[a-zA-Z0-9_.:%-]*)*)(/[^#?]*)?([?][^#]*)?(#.*)?$"'}],!1}else return Pe.errors=[{instancePath:e+"/attester",schemaPath:"https://identity.foundation/dwn/json-schemas/defs.json#/definitions/did/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var f=F===s}else var f=!0;if(f){if(t.recipient!==void 0){let L=t.recipient,F=s;if(s===s)if(typeof L=="string"){if(!ks.test(L))return Pe.errors=[{instancePath:e+"/recipient",schemaPath:"https://identity.foundation/dwn/json-schemas/defs.json#/definitions/did/pattern",keyword:"pattern",params:{pattern:"^did:([a-z0-9]+):((?:(?:[a-zA-Z0-9._-]|(?:%[0-9a-fA-F]{2}))*:)*((?:[a-zA-Z0-9._-]|(?:%[0-9a-fA-F]{2}))+))((;[a-zA-Z0-9_.:%-]+=[a-zA-Z0-9_.:%-]*)*)(/[^#?]*)?([?][^#]*)?(#.*)?$"},message:'must match pattern "^did:([a-z0-9]+):((?:(?:[a-zA-Z0-9._-]|(?:%[0-9a-fA-F]{2}))*:)*((?:[a-zA-Z0-9._-]|(?:%[0-9a-fA-F]{2}))+))((;[a-zA-Z0-9_.:%-]+=[a-zA-Z0-9_.:%-]*)*)(/[^#?]*)?([?][^#]*)?(#.*)?$"'}],!1}else return Pe.errors=[{instancePath:e+"/recipient",schemaPath:"https://identity.foundation/dwn/json-schemas/defs.json#/definitions/did/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var f=F===s}else var f=!0;if(f){if(t.contextId!==void 0){let L=s;if(typeof t.contextId!="string")return Pe.errors=[{instancePath:e+"/contextId",schemaPath:"#/properties/contextId/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var f=L===s}else var f=!0;if(f){if(t.schema!==void 0){let L=s;if(typeof t.schema!="string")return Pe.errors=[{instancePath:e+"/schema",schemaPath:"#/properties/schema/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var f=L===s}else var f=!0;if(f){if(t.recordId!==void 0){let L=s;if(typeof t.recordId!="string")return Pe.errors=[{instancePath:e+"/recordId",schemaPath:"#/properties/recordId/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var f=L===s}else var f=!0;if(f){if(t.parentId!==void 0){let L=s;if(typeof t.parentId!="string")return Pe.errors=[{instancePath:e+"/parentId",schemaPath:"#/properties/parentId/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var f=L===s}else var f=!0;if(f){if(t.published!==void 0){let L=s;if(typeof t.published!="boolean")return Pe.errors=[{instancePath:e+"/published",schemaPath:"#/properties/published/type",keyword:"type",params:{type:"boolean"},message:"must be boolean"}],!1;var f=L===s}else var f=!0;if(f){if(t.dataFormat!==void 0){let L=s;if(typeof t.dataFormat!="string")return Pe.errors=[{instancePath:e+"/dataFormat",schemaPath:"#/properties/dataFormat/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var f=L===s}else var f=!0;if(f){if(t.dataSize!==void 0){let L=t.dataSize,F=s;if(s===s)if(L&&typeof L=="object"&&!Array.isArray(L)){if(Object.keys(L).length<1)return Pe.errors=[{instancePath:e+"/dataSize",schemaPath:"https://identity.foundation/dwn/json-schemas/number-range-filter.json/minProperties",keyword:"minProperties",params:{limit:1},message:"must NOT have fewer than 1 properties"}],!1;{let z=s;for(let j in L)if(!(j==="gt"||j==="gte"||j==="lt"||j==="lte")){return Pe.errors=[{instancePath:e+"/dataSize",schemaPath:"https://identity.foundation/dwn/json-schemas/number-range-filter.json/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:j},message:"must NOT have additional properties"}],!1;break}if(z===s){if(L.gt!==void 0){let j=s,y=s,P=s;if(L&&typeof L=="object"&&!Array.isArray(L)){let x;if(L.gte===void 0&&(x="gte")){let l={};o===null?o=[l]:o.push(l),s++}}var u=P===s;if(u)return Pe.errors=[{instancePath:e+"/dataSize",schemaPath:"https://identity.foundation/dwn/json-schemas/number-range-filter.json/dependencies/gt/not",keyword:"not",params:{},message:"must NOT be valid"}],!1;s=y,o!==null&&(y?o.length=y:o=null);var m=j===s}else var m=!0;if(m){if(L.gte!==void 0){let j=s,y=s,P=s;if(L&&typeof L=="object"&&!Array.isArray(L)){let l;if(L.gt===void 0&&(l="gt")){let b={};o===null?o=[b]:o.push(b),s++}}var _=P===s;if(_)return Pe.errors=[{instancePath:e+"/dataSize",schemaPath:"https://identity.foundation/dwn/json-schemas/number-range-filter.json/dependencies/gte/not",keyword:"not",params:{},message:"must NOT be valid"}],!1;s=y,o!==null&&(y?o.length=y:o=null);var m=j===s}else var m=!0;if(m){if(L.lt!==void 0){let j=s,y=s,P=s;if(L&&typeof L=="object"&&!Array.isArray(L)){let l;if(L.lte===void 0&&(l="lte")){let b={};o===null?o=[b]:o.push(b),s++}}var v=P===s;if(v)return Pe.errors=[{instancePath:e+"/dataSize",schemaPath:"https://identity.foundation/dwn/json-schemas/number-range-filter.json/dependencies/lt/not",keyword:"not",params:{},message:"must NOT be valid"}],!1;s=y,o!==null&&(y?o.length=y:o=null);var m=j===s}else var m=!0;if(m){if(L.lte!==void 0){let j=s,y=s,P=s;if(L&&typeof L=="object"&&!Array.isArray(L)){let l;if(L.lt===void 0&&(l="lt")){let b={};o===null?o=[b]:o.push(b),s++}}var A=P===s;if(A)return Pe.errors=[{instancePath:e+"/dataSize",schemaPath:"https://identity.foundation/dwn/json-schemas/number-range-filter.json/dependencies/lte/not",keyword:"not",params:{},message:"must NOT be valid"}],!1;s=y,o!==null&&(y?o.length=y:o=null);var m=j===s}else var m=!0;if(m){if(L.gt!==void 0){let j=L.gt,y=s;if(!(typeof j=="number"&&isFinite(j)))return Pe.errors=[{instancePath:e+"/dataSize/gt",schemaPath:"https://identity.foundation/dwn/json-schemas/number-range-filter.json/properties/gt/type",keyword:"type",params:{type:"number"},message:"must be number"}],!1;var T=y===s}else var T=!0;if(T){if(L.gte!==void 0){let j=L.gte,y=s;if(!(typeof j=="number"&&isFinite(j)))return Pe.errors=[{instancePath:e+"/dataSize/gte",schemaPath:"https://identity.foundation/dwn/json-schemas/number-range-filter.json/properties/gte/type",keyword:"type",params:{type:"number"},message:"must be number"}],!1;var T=y===s}else var T=!0;if(T){if(L.lt!==void 0){let j=L.lt,y=s;if(!(typeof j=="number"&&isFinite(j)))return Pe.errors=[{instancePath:e+"/dataSize/lt",schemaPath:"https://identity.foundation/dwn/json-schemas/number-range-filter.json/properties/lt/type",keyword:"type",params:{type:"number"},message:"must be number"}],!1;var T=y===s}else var T=!0;if(T)if(L.lte!==void 0){let j=L.lte,y=s;if(!(typeof j=="number"&&isFinite(j)))return Pe.errors=[{instancePath:e+"/dataSize/lte",schemaPath:"https://identity.foundation/dwn/json-schemas/number-range-filter.json/properties/lte/type",keyword:"type",params:{type:"number"},message:"must be number"}],!1;var T=y===s}else var T=!0}}}}}}}}}else return Pe.errors=[{instancePath:e+"/dataSize",schemaPath:"https://identity.foundation/dwn/json-schemas/number-range-filter.json/type",keyword:"type",params:{type:"object"},message:"must be object"}],!1;var f=F===s}else var f=!0;if(f){if(t.dataCid!==void 0){let L=s;if(typeof t.dataCid!="string")return Pe.errors=[{instancePath:e+"/dataCid",schemaPath:"#/properties/dataCid/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var f=L===s}else var f=!0;if(f){if(t.dateCreated!==void 0){let L=t.dateCreated,F=s;if(s===F)if(L&&typeof L=="object"&&!Array.isArray(L)){if(Object.keys(L).length<1)return Pe.errors=[{instancePath:e+"/dateCreated",schemaPath:"#/properties/dateCreated/minProperties",keyword:"minProperties",params:{limit:1},message:"must NOT have fewer than 1 properties"}],!1;{let H=s;for(let z in L)if(!(z==="from"||z==="to")){return Pe.errors=[{instancePath:e+"/dateCreated",schemaPath:"#/properties/dateCreated/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:z},message:"must NOT have additional properties"}],!1;break}if(H===s){if(L.from!==void 0){let z=L.from,j=s;if(s===s)if(typeof z=="string"){if(!Cn.test(z))return Pe.errors=[{instancePath:e+"/dateCreated/from",schemaPath:"https://identity.foundation/dwn/json-schemas/defs.json#/definitions/date-time/pattern",keyword:"pattern",params:{pattern:"^\\d{4}-[0-1]\\d-[0-3]\\dT(?:[0-2]\\d:[0-5]\\d:[0-5]\\d|23:59:60)\\.\\d{6}Z$"},message:'must match pattern "^\\d{4}-[0-1]\\d-[0-3]\\dT(?:[0-2]\\d:[0-5]\\d:[0-5]\\d|23:59:60)\\.\\d{6}Z$"'}],!1}else return Pe.errors=[{instancePath:e+"/dateCreated/from",schemaPath:"https://identity.foundation/dwn/json-schemas/defs.json#/definitions/date-time/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var M=j===s}else var M=!0;if(M)if(L.to!==void 0){let z=L.to,j=s;if(s===s)if(typeof z=="string"){if(!Cn.test(z))return Pe.errors=[{instancePath:e+"/dateCreated/to",schemaPath:"https://identity.foundation/dwn/json-schemas/defs.json#/definitions/date-time/pattern",keyword:"pattern",params:{pattern:"^\\d{4}-[0-1]\\d-[0-3]\\dT(?:[0-2]\\d:[0-5]\\d:[0-5]\\d|23:59:60)\\.\\d{6}Z$"},message:'must match pattern "^\\d{4}-[0-1]\\d-[0-3]\\dT(?:[0-2]\\d:[0-5]\\d:[0-5]\\d|23:59:60)\\.\\d{6}Z$"'}],!1}else return Pe.errors=[{instancePath:e+"/dateCreated/to",schemaPath:"https://identity.foundation/dwn/json-schemas/defs.json#/definitions/date-time/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var M=j===s}else var M=!0}}}else return Pe.errors=[{instancePath:e+"/dateCreated",schemaPath:"#/properties/dateCreated/type",keyword:"type",params:{type:"object"},message:"must be object"}],!1;var f=F===s}else var f=!0;if(f){if(t.datePublished!==void 0){let L=t.datePublished,F=s;if(s===F)if(L&&typeof L=="object"&&!Array.isArray(L)){if(Object.keys(L).length<1)return Pe.errors=[{instancePath:e+"/datePublished",schemaPath:"#/properties/datePublished/minProperties",keyword:"minProperties",params:{limit:1},message:"must NOT have fewer than 1 properties"}],!1;{let H=s;for(let z in L)if(!(z==="from"||z==="to")){return Pe.errors=[{instancePath:e+"/datePublished",schemaPath:"#/properties/datePublished/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:z},message:"must NOT have additional properties"}],!1;break}if(H===s){if(L.from!==void 0){let z=L.from,j=s;if(s===s)if(typeof z=="string"){if(!Cn.test(z))return Pe.errors=[{instancePath:e+"/datePublished/from",schemaPath:"https://identity.foundation/dwn/json-schemas/defs.json#/definitions/date-time/pattern",keyword:"pattern",params:{pattern:"^\\d{4}-[0-1]\\d-[0-3]\\dT(?:[0-2]\\d:[0-5]\\d:[0-5]\\d|23:59:60)\\.\\d{6}Z$"},message:'must match pattern "^\\d{4}-[0-1]\\d-[0-3]\\dT(?:[0-2]\\d:[0-5]\\d:[0-5]\\d|23:59:60)\\.\\d{6}Z$"'}],!1}else return Pe.errors=[{instancePath:e+"/datePublished/from",schemaPath:"https://identity.foundation/dwn/json-schemas/defs.json#/definitions/date-time/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var D=j===s}else var D=!0;if(D)if(L.to!==void 0){let z=L.to,j=s;if(s===s)if(typeof z=="string"){if(!Cn.test(z))return Pe.errors=[{instancePath:e+"/datePublished/to",schemaPath:"https://identity.foundation/dwn/json-schemas/defs.json#/definitions/date-time/pattern",keyword:"pattern",params:{pattern:"^\\d{4}-[0-1]\\d-[0-3]\\dT(?:[0-2]\\d:[0-5]\\d:[0-5]\\d|23:59:60)\\.\\d{6}Z$"},message:'must match pattern "^\\d{4}-[0-1]\\d-[0-3]\\dT(?:[0-2]\\d:[0-5]\\d:[0-5]\\d|23:59:60)\\.\\d{6}Z$"'}],!1}else return Pe.errors=[{instancePath:e+"/datePublished/to",schemaPath:"https://identity.foundation/dwn/json-schemas/defs.json#/definitions/date-time/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var D=j===s}else var D=!0}}}else return Pe.errors=[{instancePath:e+"/datePublished",schemaPath:"#/properties/datePublished/type",keyword:"type",params:{type:"object"},message:"must be object"}],!1;var f=F===s}else var f=!0;if(f)if(t.dateUpdated!==void 0){let L=t.dateUpdated,F=s;if(s===F)if(L&&typeof L=="object"&&!Array.isArray(L)){if(Object.keys(L).length<1)return Pe.errors=[{instancePath:e+"/dateUpdated",schemaPath:"#/properties/dateUpdated/minProperties",keyword:"minProperties",params:{limit:1},message:"must NOT have fewer than 1 properties"}],!1;{let H=s;for(let z in L)if(!(z==="from"||z==="to")){return Pe.errors=[{instancePath:e+"/dateUpdated",schemaPath:"#/properties/dateUpdated/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:z},message:"must NOT have additional properties"}],!1;break}if(H===s){if(L.from!==void 0){let z=L.from,j=s;if(s===s)if(typeof z=="string"){if(!Cn.test(z))return Pe.errors=[{instancePath:e+"/dateUpdated/from",schemaPath:"https://identity.foundation/dwn/json-schemas/defs.json#/definitions/date-time/pattern",keyword:"pattern",params:{pattern:"^\\d{4}-[0-1]\\d-[0-3]\\dT(?:[0-2]\\d:[0-5]\\d:[0-5]\\d|23:59:60)\\.\\d{6}Z$"},message:'must match pattern "^\\d{4}-[0-1]\\d-[0-3]\\dT(?:[0-2]\\d:[0-5]\\d:[0-5]\\d|23:59:60)\\.\\d{6}Z$"'}],!1}else return Pe.errors=[{instancePath:e+"/dateUpdated/from",schemaPath:"https://identity.foundation/dwn/json-schemas/defs.json#/definitions/date-time/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var O=j===s}else var O=!0;if(O)if(L.to!==void 0){let z=L.to,j=s;if(s===s)if(typeof z=="string"){if(!Cn.test(z))return Pe.errors=[{instancePath:e+"/dateUpdated/to",schemaPath:"https://identity.foundation/dwn/json-schemas/defs.json#/definitions/date-time/pattern",keyword:"pattern",params:{pattern:"^\\d{4}-[0-1]\\d-[0-3]\\dT(?:[0-2]\\d:[0-5]\\d:[0-5]\\d|23:59:60)\\.\\d{6}Z$"},message:'must match pattern "^\\d{4}-[0-1]\\d-[0-3]\\dT(?:[0-2]\\d:[0-5]\\d:[0-5]\\d|23:59:60)\\.\\d{6}Z$"'}],!1}else return Pe.errors=[{instancePath:e+"/dateUpdated/to",schemaPath:"https://identity.foundation/dwn/json-schemas/defs.json#/definitions/date-time/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var O=j===s}else var O=!0}}}else return Pe.errors=[{instancePath:e+"/dateUpdated",schemaPath:"#/properties/dateUpdated/type",keyword:"type",params:{type:"object"},message:"must be object"}],!1;var f=F===s}else var f=!0}}}}}}}}}}}}}}}}}}else return Pe.errors=[{instancePath:e,schemaPath:"#/type",keyword:"type",params:{type:"object"},message:"must be object"}],!1;return Pe.errors=o,s===0}function yn(t,{instancePath:e="",parentData:r,parentDataProperty:n,rootData:i=t}={}){let o=null,s=0;if(s===0)if(t&&typeof t=="object"&&!Array.isArray(t)){let f;if(t.descriptor===void 0&&(f="descriptor"))return yn.errors=[{instancePath:e,schemaPath:"#/required",keyword:"required",params:{missingProperty:f},message:"must have required property '"+f+"'"}],!1;{let u=s;for(let m in t)if(!(m==="authorization"||m==="descriptor")){return yn.errors=[{instancePath:e,schemaPath:"#/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:m},message:"must NOT have additional properties"}],!1;break}if(u===s){if(t.authorization!==void 0){let m=s;Qo(t.authorization,{instancePath:e+"/authorization",parentData:t,parentDataProperty:"authorization",rootData:i})||(o=o===null?Qo.errors:o.concat(Qo.errors),s=o.length);var a=m===s}else var a=!0;if(a)if(t.descriptor!==void 0){let m=t.descriptor,_=s;if(s===_)if(m&&typeof m=="object"&&!Array.isArray(m)){let A;if(m.interface===void 0&&(A="interface")||m.method===void 0&&(A="method")||m.messageTimestamp===void 0&&(A="messageTimestamp")||m.filter===void 0&&(A="filter"))return yn.errors=[{instancePath:e+"/descriptor",schemaPath:"#/properties/descriptor/required",keyword:"required",params:{missingProperty:A},message:"must have required property '"+A+"'"}],!1;{let T=s;for(let M in m)if(!(M==="interface"||M==="method"||M==="messageTimestamp"||M==="filter"||M==="pagination"||M==="dateSort")){return yn.errors=[{instancePath:e+"/descriptor",schemaPath:"#/properties/descriptor/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:M},message:"must NOT have additional properties"}],!1;break}if(T===s){if(m.interface!==void 0){let M=m.interface,D=s;if(typeof M!="string")return yn.errors=[{instancePath:e+"/descriptor/interface",schemaPath:"#/properties/descriptor/properties/interface/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;if(M!=="Records")return yn.errors=[{instancePath:e+"/descriptor/interface",schemaPath:"#/properties/descriptor/properties/interface/enum",keyword:"enum",params:{allowedValues:T4.properties.descriptor.properties.interface.enum},message:"must be equal to one of the allowed values"}],!1;var c=D===s}else var c=!0;if(c){if(m.method!==void 0){let M=m.method,D=s;if(typeof M!="string")return yn.errors=[{instancePath:e+"/descriptor/method",schemaPath:"#/properties/descriptor/properties/method/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;if(M!=="Query")return yn.errors=[{instancePath:e+"/descriptor/method",schemaPath:"#/properties/descriptor/properties/method/enum",keyword:"enum",params:{allowedValues:T4.properties.descriptor.properties.method.enum},message:"must be equal to one of the allowed values"}],!1;var c=D===s}else var c=!0;if(c){if(m.messageTimestamp!==void 0){let M=m.messageTimestamp,D=s;if(s===s)if(typeof M=="string"){if(!Cn.test(M))return yn.errors=[{instancePath:e+"/descriptor/messageTimestamp",schemaPath:"https://identity.foundation/dwn/json-schemas/defs.json#/definitions/date-time/pattern",keyword:"pattern",params:{pattern:"^\\d{4}-[0-1]\\d-[0-3]\\dT(?:[0-2]\\d:[0-5]\\d:[0-5]\\d|23:59:60)\\.\\d{6}Z$"},message:'must match pattern "^\\d{4}-[0-1]\\d-[0-3]\\dT(?:[0-2]\\d:[0-5]\\d:[0-5]\\d|23:59:60)\\.\\d{6}Z$"'}],!1}else return yn.errors=[{instancePath:e+"/descriptor/messageTimestamp",schemaPath:"https://identity.foundation/dwn/json-schemas/defs.json#/definitions/date-time/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var c=D===s}else var c=!0;if(c){if(m.filter!==void 0){let M=s;Pe(m.filter,{instancePath:e+"/descriptor/filter",parentData:m,parentDataProperty:"filter",rootData:i})||(o=o===null?Pe.errors:o.concat(Pe.errors),s=o.length);var c=M===s}else var c=!0;if(c){if(m.pagination!==void 0){let M=m.pagination,D=s;if(s===D)if(M&&typeof M=="object"&&!Array.isArray(M)){let U=s;for(let L in M)if(!(L==="limit"||L==="cursor")){return yn.errors=[{instancePath:e+"/descriptor/pagination",schemaPath:"#/properties/descriptor/properties/pagination/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:L},message:"must NOT have additional properties"}],!1;break}if(U===s){if(M.limit!==void 0){let L=M.limit,F=s;if(s===F)if(typeof L=="number"&&isFinite(L)){if(L<1||isNaN(L))return yn.errors=[{instancePath:e+"/descriptor/pagination/limit",schemaPath:"#/properties/descriptor/properties/pagination/properties/limit/minimum",keyword:"minimum",params:{comparison:">=",limit:1},message:"must be >= 1"}],!1}else return yn.errors=[{instancePath:e+"/descriptor/pagination/limit",schemaPath:"#/properties/descriptor/properties/pagination/properties/limit/type",keyword:"type",params:{type:"number"},message:"must be number"}],!1;var d=F===s}else var d=!0;if(d)if(M.cursor!==void 0){let L=s;if(typeof M.cursor!="string")return yn.errors=[{instancePath:e+"/descriptor/pagination/cursor",schemaPath:"#/properties/descriptor/properties/pagination/properties/cursor/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var d=L===s}else var d=!0}}else return yn.errors=[{instancePath:e+"/descriptor/pagination",schemaPath:"#/properties/descriptor/properties/pagination/type",keyword:"type",params:{type:"object"},message:"must be object"}],!1;var c=D===s}else var c=!0;if(c)if(m.dateSort!==void 0){let M=m.dateSort,D=s;if(typeof M!="string")return yn.errors=[{instancePath:e+"/descriptor/dateSort",schemaPath:"#/properties/descriptor/properties/dateSort/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;if(!(M==="createdAscending"||M==="createdDescending"||M==="publishedAscending"||M==="publishedDescending"))return yn.errors=[{instancePath:e+"/descriptor/dateSort",schemaPath:"#/properties/descriptor/properties/dateSort/enum",keyword:"enum",params:{allowedValues:T4.properties.descriptor.properties.dateSort.enum},message:"must be equal to one of the allowed values"}],!1;var c=D===s}else var c=!0}}}}}}}else return yn.errors=[{instancePath:e+"/descriptor",schemaPath:"#/properties/descriptor/type",keyword:"type",params:{type:"object"},message:"must be object"}],!1;var a=_===s}else var a=!0}}}else return yn.errors=[{instancePath:e,schemaPath:"#/type",keyword:"type",params:{type:"object"},message:"must be object"}],!1;return yn.errors=o,s===0}var Jae=Bw;var Lf={$schema:"http://json-schema.org/draft-07/schema#",$id:"https://identity.foundation/dwn/json-schemas/records-write-unidentified.json",type:"object",additionalProperties:!1,required:["descriptor"],properties:{recordId:{type:"string"},contextId:{type:"string"},attestation:{$ref:"https://identity.foundation/dwn/json-schemas/general-jws.json"},authorization:{$ref:"https://identity.foundation/dwn/json-schemas/authorization-owner.json"},encryption:{type:"object",properties:{algorithm:{type:"string",enum:["A256CTR"]},initializationVector:{$ref:"https://identity.foundation/dwn/json-schemas/defs.json#/definitions/base64url"},keyEncryption:{type:"array",minItems:1,items:{type:"object",properties:{rootKeyId:{type:"string"},derivationScheme:{type:"string",enum:["dataFormats","protocolContext","protocolPath","schemas"]},derivedPublicKey:{$ref:"https://identity.foundation/dwn/json-schemas/public-jwk.json"},algorithm:{type:"string",enum:["ECIES-ES256K"]},encryptedKey:{$ref:"https://identity.foundation/dwn/json-schemas/defs.json#/definitions/base64url"},initializationVector:{$ref:"https://identity.foundation/dwn/json-schemas/defs.json#/definitions/base64url"},ephemeralPublicKey:{$ref:"https://identity.foundation/dwn/json-schemas/public-jwk.json"},messageAuthenticationCode:{$ref:"https://identity.foundation/dwn/json-schemas/defs.json#/definitions/base64url"}},additionalProperties:!1,required:["rootKeyId","derivationScheme","algorithm","encryptedKey","initializationVector","ephemeralPublicKey","messageAuthenticationCode"]}}},additionalProperties:!1,required:["algorithm","initializationVector","keyEncryption"]},descriptor:{type:"object",properties:{interface:{enum:["Records"],type:"string"},method:{enum:["Write"],type:"string"},recipient:{$ref:"https://identity.foundation/dwn/json-schemas/defs.json#/definitions/did"},protocol:{type:"string"},protocolPath:{type:"string",pattern:"^[a-zA-Z]+(/[a-zA-Z]+)*$"},schema:{type:"string"},parentId:{type:"string"},dataCid:{type:"string"},dataSize:{type:"number"},dateCreated:{$ref:"https://identity.foundation/dwn/json-schemas/defs.json#/definitions/date-time"},messageTimestamp:{$ref:"https://identity.foundation/dwn/json-schemas/defs.json#/definitions/date-time"},published:{type:"boolean"},datePublished:{$ref:"https://identity.foundation/dwn/json-schemas/defs.json#/definitions/date-time"},dataFormat:{type:"string"}},additionalProperties:!1,required:["interface","method","dataCid","dataSize","dateCreated","messageTimestamp","dataFormat"],dependencies:{parentId:["protocol"]},allOf:[{$comment:"rule defining `published` and `datePublished` relationship",anyOf:[{properties:{published:{type:"boolean",enum:[!0]}},required:["published","datePublished"]},{properties:{published:{type:"boolean",enum:[!1]}},not:{required:["datePublished"]}},{allOf:[{not:{required:["published"]}},{not:{required:["datePublished"]}}]}]}]}},$comment:"rule defining `protocol` and `contextId` relationship",anyOf:[{properties:{descriptor:{type:"object",required:["protocol","protocolPath"]}},required:["contextId"]},{allOf:[{not:{required:["contextId"]}},{properties:{descriptor:{type:"object",not:{required:["protocol"]}}}},{properties:{descriptor:{type:"object",not:{required:["protocolPath"]}}}}]}]};var wC={$id:"https://identity.foundation/dwn/json-schemas/general-jwk.json",$schema:"http://json-schema.org/draft-07/schema#",type:"object",required:["kty"],properties:{alg:{type:"string"},kid:{type:"string"},kty:{enum:["EC","RSA","oct","OKP"]},crv:{type:"string"},use:{type:"string"},key_ops:{type:"string"},x5u:{type:"string"},x5c:{type:"string"},x5t:{type:"string"},"x5t#S256":{type:"string"}},oneOf:[{properties:{kty:{const:"EC"},crv:{type:"string"},x:{type:"string"},y:{type:"string"},d:{type:"string"}},required:["crv","x"]},{properties:{kty:{const:"OKP"},crv:{type:"string"},x:{type:"string"},d:{type:"string"}},required:["crv","x"]},{properties:{kty:{const:"RSA"},n:{type:"string"},e:{type:"string"},d:{type:"string"},p:{type:"string"},q:{type:"string"},dp:{type:"string"},dq:{type:"string"},qi:{type:"string"},oth:{type:"object"}},required:["n","e"]},{properties:{kty:{const:"oct"},k:{type:"string"}},required:["k"]}]};function br(t,{instancePath:e="",parentData:r,parentDataProperty:n,rootData:i=t}={}){let o=null,s=0,a=s,c=s,d=!1,f=null,u=s;if(t&&typeof t=="object"&&!Array.isArray(t)){let j;if(t.crv===void 0&&(j="crv")||t.x===void 0&&(j="x")){let y={instancePath:e,schemaPath:"https://identity.foundation/dwn/json-schemas/general-jwk.json/oneOf/0/required",keyword:"required",params:{missingProperty:j},message:"must have required property '"+j+"'"};o===null?o=[y]:o.push(y),s++}else{if(t.kty!==void 0){let y=s;if(t.kty!=="EC"){let P={instancePath:e+"/kty",schemaPath:"https://identity.foundation/dwn/json-schemas/general-jwk.json/oneOf/0/properties/kty/const",keyword:"const",params:{allowedValue:"EC"},message:"must be equal to constant"};o===null?o=[P]:o.push(P),s++}var m=y===s}else var m=!0;if(m){if(t.crv!==void 0){let y=s;if(typeof t.crv!="string"){let x={instancePath:e+"/crv",schemaPath:"https://identity.foundation/dwn/json-schemas/general-jwk.json/oneOf/0/properties/crv/type",keyword:"type",params:{type:"string"},message:"must be string"};o===null?o=[x]:o.push(x),s++}var m=y===s}else var m=!0;if(m){if(t.x!==void 0){let y=s;if(typeof t.x!="string"){let x={instancePath:e+"/x",schemaPath:"https://identity.foundation/dwn/json-schemas/general-jwk.json/oneOf/0/properties/x/type",keyword:"type",params:{type:"string"},message:"must be string"};o===null?o=[x]:o.push(x),s++}var m=y===s}else var m=!0;if(m){if(t.y!==void 0){let y=s;if(typeof t.y!="string"){let x={instancePath:e+"/y",schemaPath:"https://identity.foundation/dwn/json-schemas/general-jwk.json/oneOf/0/properties/y/type",keyword:"type",params:{type:"string"},message:"must be string"};o===null?o=[x]:o.push(x),s++}var m=y===s}else var m=!0;if(m)if(t.d!==void 0){let y=s;if(typeof t.d!="string"){let x={instancePath:e+"/d",schemaPath:"https://identity.foundation/dwn/json-schemas/general-jwk.json/oneOf/0/properties/d/type",keyword:"type",params:{type:"string"},message:"must be string"};o===null?o=[x]:o.push(x),s++}var m=y===s}else var m=!0}}}}}var A=u===s;A&&(d=!0,f=0);let _=s;if(t&&typeof t=="object"&&!Array.isArray(t)){let j;if(t.crv===void 0&&(j="crv")||t.x===void 0&&(j="x")){let y={instancePath:e,schemaPath:"https://identity.foundation/dwn/json-schemas/general-jwk.json/oneOf/1/required",keyword:"required",params:{missingProperty:j},message:"must have required property '"+j+"'"};o===null?o=[y]:o.push(y),s++}else{if(t.kty!==void 0){let y=s;if(t.kty!=="OKP"){let P={instancePath:e+"/kty",schemaPath:"https://identity.foundation/dwn/json-schemas/general-jwk.json/oneOf/1/properties/kty/const",keyword:"const",params:{allowedValue:"OKP"},message:"must be equal to constant"};o===null?o=[P]:o.push(P),s++}var v=y===s}else var v=!0;if(v){if(t.crv!==void 0){let y=s;if(typeof t.crv!="string"){let x={instancePath:e+"/crv",schemaPath:"https://identity.foundation/dwn/json-schemas/general-jwk.json/oneOf/1/properties/crv/type",keyword:"type",params:{type:"string"},message:"must be string"};o===null?o=[x]:o.push(x),s++}var v=y===s}else var v=!0;if(v){if(t.x!==void 0){let y=s;if(typeof t.x!="string"){let x={instancePath:e+"/x",schemaPath:"https://identity.foundation/dwn/json-schemas/general-jwk.json/oneOf/1/properties/x/type",keyword:"type",params:{type:"string"},message:"must be string"};o===null?o=[x]:o.push(x),s++}var v=y===s}else var v=!0;if(v)if(t.d!==void 0){let y=s;if(typeof t.d!="string"){let x={instancePath:e+"/d",schemaPath:"https://identity.foundation/dwn/json-schemas/general-jwk.json/oneOf/1/properties/d/type",keyword:"type",params:{type:"string"},message:"must be string"};o===null?o=[x]:o.push(x),s++}var v=y===s}else var v=!0}}}}var A=_===s;if(A&&d)d=!1,f=[f,1];else{A&&(d=!0,f=1);let j=s;if(t&&typeof t=="object"&&!Array.isArray(t)){let P;if(t.n===void 0&&(P="n")||t.e===void 0&&(P="e")){let x={instancePath:e,schemaPath:"https://identity.foundation/dwn/json-schemas/general-jwk.json/oneOf/2/required",keyword:"required",params:{missingProperty:P},message:"must have required property '"+P+"'"};o===null?o=[x]:o.push(x),s++}else{if(t.kty!==void 0){let x=s;if(t.kty!=="RSA"){let l={instancePath:e+"/kty",schemaPath:"https://identity.foundation/dwn/json-schemas/general-jwk.json/oneOf/2/properties/kty/const",keyword:"const",params:{allowedValue:"RSA"},message:"must be equal to constant"};o===null?o=[l]:o.push(l),s++}var T=x===s}else var T=!0;if(T){if(t.n!==void 0){let x=s;if(typeof t.n!="string"){let b={instancePath:e+"/n",schemaPath:"https://identity.foundation/dwn/json-schemas/general-jwk.json/oneOf/2/properties/n/type",keyword:"type",params:{type:"string"},message:"must be string"};o===null?o=[b]:o.push(b),s++}var T=x===s}else var T=!0;if(T){if(t.e!==void 0){let x=s;if(typeof t.e!="string"){let b={instancePath:e+"/e",schemaPath:"https://identity.foundation/dwn/json-schemas/general-jwk.json/oneOf/2/properties/e/type",keyword:"type",params:{type:"string"},message:"must be string"};o===null?o=[b]:o.push(b),s++}var T=x===s}else var T=!0;if(T){if(t.d!==void 0){let x=s;if(typeof t.d!="string"){let b={instancePath:e+"/d",schemaPath:"https://identity.foundation/dwn/json-schemas/general-jwk.json/oneOf/2/properties/d/type",keyword:"type",params:{type:"string"},message:"must be string"};o===null?o=[b]:o.push(b),s++}var T=x===s}else var T=!0;if(T){if(t.p!==void 0){let x=s;if(typeof t.p!="string"){let b={instancePath:e+"/p",schemaPath:"https://identity.foundation/dwn/json-schemas/general-jwk.json/oneOf/2/properties/p/type",keyword:"type",params:{type:"string"},message:"must be string"};o===null?o=[b]:o.push(b),s++}var T=x===s}else var T=!0;if(T){if(t.q!==void 0){let x=s;if(typeof t.q!="string"){let b={instancePath:e+"/q",schemaPath:"https://identity.foundation/dwn/json-schemas/general-jwk.json/oneOf/2/properties/q/type",keyword:"type",params:{type:"string"},message:"must be string"};o===null?o=[b]:o.push(b),s++}var T=x===s}else var T=!0;if(T){if(t.dp!==void 0){let x=s;if(typeof t.dp!="string"){let b={instancePath:e+"/dp",schemaPath:"https://identity.foundation/dwn/json-schemas/general-jwk.json/oneOf/2/properties/dp/type",keyword:"type",params:{type:"string"},message:"must be string"};o===null?o=[b]:o.push(b),s++}var T=x===s}else var T=!0;if(T){if(t.dq!==void 0){let x=s;if(typeof t.dq!="string"){let b={instancePath:e+"/dq",schemaPath:"https://identity.foundation/dwn/json-schemas/general-jwk.json/oneOf/2/properties/dq/type",keyword:"type",params:{type:"string"},message:"must be string"};o===null?o=[b]:o.push(b),s++}var T=x===s}else var T=!0;if(T){if(t.qi!==void 0){let x=s;if(typeof t.qi!="string"){let b={instancePath:e+"/qi",schemaPath:"https://identity.foundation/dwn/json-schemas/general-jwk.json/oneOf/2/properties/qi/type",keyword:"type",params:{type:"string"},message:"must be string"};o===null?o=[b]:o.push(b),s++}var T=x===s}else var T=!0;if(T)if(t.oth!==void 0){let x=t.oth,l=s;if(!(x&&typeof x=="object"&&!Array.isArray(x))){let h={instancePath:e+"/oth",schemaPath:"https://identity.foundation/dwn/json-schemas/general-jwk.json/oneOf/2/properties/oth/type",keyword:"type",params:{type:"object"},message:"must be object"};o===null?o=[h]:o.push(h),s++}var T=l===s}else var T=!0}}}}}}}}}}var A=j===s;if(A&&d)d=!1,f=[f,2];else{A&&(d=!0,f=2);let P=s;if(t&&typeof t=="object"&&!Array.isArray(t)){let l;if(t.k===void 0&&(l="k")){let b={instancePath:e,schemaPath:"https://identity.foundation/dwn/json-schemas/general-jwk.json/oneOf/3/required",keyword:"required",params:{missingProperty:l},message:"must have required property '"+l+"'"};o===null?o=[b]:o.push(b),s++}else{if(t.kty!==void 0){let b=s;if(t.kty!=="oct"){let h={instancePath:e+"/kty",schemaPath:"https://identity.foundation/dwn/json-schemas/general-jwk.json/oneOf/3/properties/kty/const",keyword:"const",params:{allowedValue:"oct"},message:"must be equal to constant"};o===null?o=[h]:o.push(h),s++}var M=b===s}else var M=!0;if(M)if(t.k!==void 0){let b=s;if(typeof t.k!="string"){let w={instancePath:e+"/k",schemaPath:"https://identity.foundation/dwn/json-schemas/general-jwk.json/oneOf/3/properties/k/type",keyword:"type",params:{type:"string"},message:"must be string"};o===null?o=[w]:o.push(w),s++}var M=b===s}else var M=!0}}var A=P===s;A&&d?(d=!1,f=[f,3]):A&&(d=!0,f=3)}}if(d)s=c,o!==null&&(c?o.length=c:o=null);else{let j={instancePath:e,schemaPath:"https://identity.foundation/dwn/json-schemas/general-jwk.json/oneOf",keyword:"oneOf",params:{passingSchemas:f},message:"must match exactly one schema in oneOf"};return o===null?o=[j]:o.push(j),s++,br.errors=o,!1}if(s===a)if(t&&typeof t=="object"&&!Array.isArray(t)){let j;if(t.kty===void 0&&(j="kty"))return br.errors=[{instancePath:e,schemaPath:"https://identity.foundation/dwn/json-schemas/general-jwk.json/required",keyword:"required",params:{missingProperty:j},message:"must have required property '"+j+"'"}],!1;if(t.alg!==void 0){let y=s;if(typeof t.alg!="string")return br.errors=[{instancePath:e+"/alg",schemaPath:"https://identity.foundation/dwn/json-schemas/general-jwk.json/properties/alg/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var D=y===s}else var D=!0;if(D){if(t.kid!==void 0){let y=s;if(typeof t.kid!="string")return br.errors=[{instancePath:e+"/kid",schemaPath:"https://identity.foundation/dwn/json-schemas/general-jwk.json/properties/kid/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var D=y===s}else var D=!0;if(D){if(t.kty!==void 0){let y=t.kty,P=s;if(!(y==="EC"||y==="RSA"||y==="oct"||y==="OKP"))return br.errors=[{instancePath:e+"/kty",schemaPath:"https://identity.foundation/dwn/json-schemas/general-jwk.json/properties/kty/enum",keyword:"enum",params:{allowedValues:wC.properties.kty.enum},message:"must be equal to one of the allowed values"}],!1;var D=P===s}else var D=!0;if(D){if(t.crv!==void 0){let y=s;if(typeof t.crv!="string")return br.errors=[{instancePath:e+"/crv",schemaPath:"https://identity.foundation/dwn/json-schemas/general-jwk.json/properties/crv/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var D=y===s}else var D=!0;if(D){if(t.use!==void 0){let y=s;if(typeof t.use!="string")return br.errors=[{instancePath:e+"/use",schemaPath:"https://identity.foundation/dwn/json-schemas/general-jwk.json/properties/use/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var D=y===s}else var D=!0;if(D){if(t.key_ops!==void 0){let y=s;if(typeof t.key_ops!="string")return br.errors=[{instancePath:e+"/key_ops",schemaPath:"https://identity.foundation/dwn/json-schemas/general-jwk.json/properties/key_ops/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var D=y===s}else var D=!0;if(D){if(t.x5u!==void 0){let y=s;if(typeof t.x5u!="string")return br.errors=[{instancePath:e+"/x5u",schemaPath:"https://identity.foundation/dwn/json-schemas/general-jwk.json/properties/x5u/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var D=y===s}else var D=!0;if(D){if(t.x5c!==void 0){let y=s;if(typeof t.x5c!="string")return br.errors=[{instancePath:e+"/x5c",schemaPath:"https://identity.foundation/dwn/json-schemas/general-jwk.json/properties/x5c/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var D=y===s}else var D=!0;if(D){if(t.x5t!==void 0){let y=s;if(typeof t.x5t!="string")return br.errors=[{instancePath:e+"/x5t",schemaPath:"https://identity.foundation/dwn/json-schemas/general-jwk.json/properties/x5t/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var D=y===s}else var D=!0;if(D)if(t["x5t#S256"]!==void 0){let y=s;if(typeof t["x5t#S256"]!="string")return br.errors=[{instancePath:e+"/x5t#S256",schemaPath:"https://identity.foundation/dwn/json-schemas/general-jwk.json/properties/x5t%23S256/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var D=y===s}else var D=!0}}}}}}}}}else return br.errors=[{instancePath:e,schemaPath:"https://identity.foundation/dwn/json-schemas/general-jwk.json/type",keyword:"type",params:{type:"object"},message:"must be object"}],!1;var O=a===s;if(O){let j=s,y=s,P=s,x=!1,l=s,b=s,h=!1,w=s;if(t&&typeof t=="object"&&!Array.isArray(t)){let E;if(t.d===void 0&&(E="d")){let g={};o===null?o=[g]:o.push(g),s++}}var U=w===s;if(h=h||U,h)s=b,o!==null&&(b?o.length=b:o=null);else{let E={};o===null?o=[E]:o.push(E),s++}if(s===l)if(t&&typeof t=="object"&&!Array.isArray(t)){if(t.kty!==void 0&&t.kty!=="EC"){let E={};o===null?o=[E]:o.push(E),s++}}else{let E={};o===null?o=[E]:o.push(E),s++}var L=l===s;if(x=x||L,!x){let E=s,g=s,I=!1,B=s;if(t&&typeof t=="object"&&!Array.isArray(t)){let q;if(t.d===void 0&&(q="d")){let V={};o===null?o=[V]:o.push(V),s++}}var F=B===s;if(I=I||F,I)s=g,o!==null&&(g?o.length=g:o=null);else{let q={};o===null?o=[q]:o.push(q),s++}if(s===E)if(t&&typeof t=="object"&&!Array.isArray(t)){if(t.kty!==void 0&&t.kty!=="OKP"){let q={};o===null?o=[q]:o.push(q),s++}}else{let q={};o===null?o=[q]:o.push(q),s++}var L=E===s;if(x=x||L,!x){let q=s,V=s,W=!1,K=s;if(t&&typeof t=="object"&&!Array.isArray(t)){let J;if(t.d===void 0&&(J="d")){let Z={};o===null?o=[Z]:o.push(Z),s++}}var $=K===s;if(W=W||$,!W){let J=s;if(t&&typeof t=="object"&&!Array.isArray(t)){let ce;if(t.p===void 0&&(ce="p")){let oe={};o===null?o=[oe]:o.push(oe),s++}}var $=J===s;if(W=W||$,!W){let ce=s;if(t&&typeof t=="object"&&!Array.isArray(t)){let ae;if(t.q===void 0&&(ae="q")){let He={};o===null?o=[He]:o.push(He),s++}}var $=ce===s;if(W=W||$,!W){let ae=s;if(t&&typeof t=="object"&&!Array.isArray(t)){let ye;if(t.dp===void 0&&(ye="dp")){let xe={};o===null?o=[xe]:o.push(xe),s++}}var $=ae===s;if(W=W||$,!W){let ye=s;if(t&&typeof t=="object"&&!Array.isArray(t)){let zr;if(t.dq===void 0&&(zr="dq")){let ke={};o===null?o=[ke]:o.push(ke),s++}}var $=ye===s;if(W=W||$,!W){let zr=s;if(t&&typeof t=="object"&&!Array.isArray(t)){let Ne;if(t.qi===void 0&&(Ne="qi")){let Ss={};o===null?o=[Ss]:o.push(Ss),s++}}var $=zr===s;if(W=W||$,!W){let Ne=s;if(t&&typeof t=="object"&&!Array.isArray(t)){let Ke;if(t.oth===void 0&&(Ke="oth")){let Ze={};o===null?o=[Ze]:o.push(Ze),s++}}var $=Ne===s;W=W||$}}}}}}if(W)s=V,o!==null&&(V?o.length=V:o=null);else{let J={};o===null?o=[J]:o.push(J),s++}if(s===q)if(t&&typeof t=="object"&&!Array.isArray(t)){if(t.kty!==void 0){let J=s;if(t.kty!=="RSA"){let Z={};o===null?o=[Z]:o.push(Z),s++}var H=J===s}else var H=!0;if(H)if(t.oth!==void 0){let J=t.oth,Z=s;if(!(J&&typeof J=="object"&&!Array.isArray(J))){let oe={};o===null?o=[oe]:o.push(oe),s++}var H=Z===s}else var H=!0}else{let J={};o===null?o=[J]:o.push(J),s++}var L=q===s;x=x||L}}if(x)s=P,o!==null&&(P?o.length=P:o=null);else{let E={};o===null?o=[E]:o.push(E),s++}var z=y===s;if(z)return br.errors=[{instancePath:e,schemaPath:"#/not",keyword:"not",params:{},message:"must NOT be valid"}],!1;s=j,o!==null&&(j?o.length=j:o=null)}return br.errors=o,s===0}var Xae=new RegExp("^[a-zA-Z]+(/[a-zA-Z]+)*$","u");function Te(t,{instancePath:e="",parentData:r,parentDataProperty:n,rootData:i=t}={}){let o=null,s=0,a=s,c=!1,d=s;if(t&&typeof t=="object"&&!Array.isArray(t)){let z;if(t.contextId===void 0&&(z="contextId")){let j={instancePath:e,schemaPath:"#/anyOf/0/required",keyword:"required",params:{missingProperty:z},message:"must have required property '"+z+"'"};o===null?o=[j]:o.push(j),s++}else if(t.descriptor!==void 0){let j=t.descriptor;if(s===s)if(j&&typeof j=="object"&&!Array.isArray(j)){let P;if(j.protocol===void 0&&(P="protocol")||j.protocolPath===void 0&&(P="protocolPath")){let x={instancePath:e+"/descriptor",schemaPath:"#/anyOf/0/properties/descriptor/required",keyword:"required",params:{missingProperty:P},message:"must have required property '"+P+"'"};o===null?o=[x]:o.push(x),s++}}else{let P={instancePath:e+"/descriptor",schemaPath:"#/anyOf/0/properties/descriptor/type",keyword:"type",params:{type:"object"},message:"must be object"};o===null?o=[P]:o.push(P),s++}}}var f=d===s;if(c=c||f,!c){let z=s,j=s,y=s,P=s;if(t&&typeof t=="object"&&!Array.isArray(t)){let l;if(t.contextId===void 0&&(l="contextId")){let b={};o===null?o=[b]:o.push(b),s++}}var u=P===s;if(u){let l={instancePath:e,schemaPath:"#/anyOf/1/allOf/0/not",keyword:"not",params:{},message:"must NOT be valid"};o===null?o=[l]:o.push(l),s++}else s=y,o!==null&&(y?o.length=y:o=null);var m=j===s;if(m){let l=s;if(t&&typeof t=="object"&&!Array.isArray(t)&&t.descriptor!==void 0){let h=t.descriptor;if(!(h&&typeof h=="object"&&!Array.isArray(h))){let g={instancePath:e+"/descriptor",schemaPath:"#/anyOf/1/allOf/1/properties/descriptor/type",keyword:"type",params:{type:"object"},message:"must be object"};o===null?o=[g]:o.push(g),s++}let w=s,E=s;if(h&&typeof h=="object"&&!Array.isArray(h)){let g;if(h.protocol===void 0&&(g="protocol")){let I={};o===null?o=[I]:o.push(I),s++}}var _=E===s;if(_){let g={instancePath:e+"/descriptor",schemaPath:"#/anyOf/1/allOf/1/properties/descriptor/not",keyword:"not",params:{},message:"must NOT be valid"};o===null?o=[g]:o.push(g),s++}else s=w,o!==null&&(w?o.length=w:o=null)}var m=l===s;if(m){let h=s;if(t&&typeof t=="object"&&!Array.isArray(t)&&t.descriptor!==void 0){let E=t.descriptor;if(!(E&&typeof E=="object"&&!Array.isArray(E))){let B={instancePath:e+"/descriptor",schemaPath:"#/anyOf/1/allOf/2/properties/descriptor/type",keyword:"type",params:{type:"object"},message:"must be object"};o===null?o=[B]:o.push(B),s++}let g=s,I=s;if(E&&typeof E=="object"&&!Array.isArray(E)){let B;if(E.protocolPath===void 0&&(B="protocolPath")){let R={};o===null?o=[R]:o.push(R),s++}}var v=I===s;if(v){let B={instancePath:e+"/descriptor",schemaPath:"#/anyOf/1/allOf/2/properties/descriptor/not",keyword:"not",params:{},message:"must NOT be valid"};o===null?o=[B]:o.push(B),s++}else s=g,o!==null&&(g?o.length=g:o=null)}var m=h===s}}var f=z===s;c=c||f}if(c)s=a,o!==null&&(a?o.length=a:o=null);else{let z={instancePath:e,schemaPath:"#/anyOf",keyword:"anyOf",params:{},message:"must match a schema in anyOf"};return o===null?o=[z]:o.push(z),s++,Te.errors=o,!1}if(s===0)if(t&&typeof t=="object"&&!Array.isArray(t)){let z;if(t.descriptor===void 0&&(z="descriptor"))return Te.errors=[{instancePath:e,schemaPath:"#/required",keyword:"required",params:{missingProperty:z},message:"must have required property '"+z+"'"}],!1;{let j=s;for(let y in t)if(!(y==="recordId"||y==="contextId"||y==="attestation"||y==="authorization"||y==="encryption"||y==="descriptor")){return Te.errors=[{instancePath:e,schemaPath:"#/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:y},message:"must NOT have additional properties"}],!1;break}if(j===s){if(t.recordId!==void 0){let y=s;if(typeof t.recordId!="string")return Te.errors=[{instancePath:e+"/recordId",schemaPath:"#/properties/recordId/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var A=y===s}else var A=!0;if(A){if(t.contextId!==void 0){let y=s;if(typeof t.contextId!="string")return Te.errors=[{instancePath:e+"/contextId",schemaPath:"#/properties/contextId/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var A=y===s}else var A=!0;if(A){if(t.attestation!==void 0){let y=s;vr(t.attestation,{instancePath:e+"/attestation",parentData:t,parentDataProperty:"attestation",rootData:i})||(o=o===null?vr.errors:o.concat(vr.errors),s=o.length);var A=y===s}else var A=!0;if(A){if(t.authorization!==void 0){let y=s;Uf(t.authorization,{instancePath:e+"/authorization",parentData:t,parentDataProperty:"authorization",rootData:i})||(o=o===null?Uf.errors:o.concat(Uf.errors),s=o.length);var A=y===s}else var A=!0;if(A){if(t.encryption!==void 0){let y=t.encryption,P=s;if(s===P)if(y&&typeof y=="object"&&!Array.isArray(y)){let l;if(y.algorithm===void 0&&(l="algorithm")||y.initializationVector===void 0&&(l="initializationVector")||y.keyEncryption===void 0&&(l="keyEncryption"))return Te.errors=[{instancePath:e+"/encryption",schemaPath:"#/properties/encryption/required",keyword:"required",params:{missingProperty:l},message:"must have required property '"+l+"'"}],!1;{let b=s;for(let h in y)if(!(h==="algorithm"||h==="initializationVector"||h==="keyEncryption")){return Te.errors=[{instancePath:e+"/encryption",schemaPath:"#/properties/encryption/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:h},message:"must NOT have additional properties"}],!1;break}if(b===s){if(y.algorithm!==void 0){let h=y.algorithm,w=s;if(typeof h!="string")return Te.errors=[{instancePath:e+"/encryption/algorithm",schemaPath:"#/properties/encryption/properties/algorithm/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;if(h!=="A256CTR")return Te.errors=[{instancePath:e+"/encryption/algorithm",schemaPath:"#/properties/encryption/properties/algorithm/enum",keyword:"enum",params:{allowedValues:Lf.properties.encryption.properties.algorithm.enum},message:"must be equal to one of the allowed values"}],!1;var T=w===s}else var T=!0;if(T){if(y.initializationVector!==void 0){let h=y.initializationVector,w=s;if(s===s)if(typeof h=="string"){if(!Cl.test(h))return Te.errors=[{instancePath:e+"/encryption/initializationVector",schemaPath:"https://identity.foundation/dwn/json-schemas/defs.json#/definitions/base64url/pattern",keyword:"pattern",params:{pattern:"^[A-Za-z0-9_-]+$"},message:'must match pattern "^[A-Za-z0-9_-]+$"'}],!1}else return Te.errors=[{instancePath:e+"/encryption/initializationVector",schemaPath:"https://identity.foundation/dwn/json-schemas/defs.json#/definitions/base64url/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var T=w===s}else var T=!0;if(T)if(y.keyEncryption!==void 0){let h=y.keyEncryption,w=s;if(s===w)if(Array.isArray(h)){if(h.length<1)return Te.errors=[{instancePath:e+"/encryption/keyEncryption",schemaPath:"#/properties/encryption/properties/keyEncryption/minItems",keyword:"minItems",params:{limit:1},message:"must NOT have fewer than 1 items"}],!1;{var M=!0;let g=h.length;for(let I=0;I<g;I++){let B=h[I],R=s;if(s===R)if(B&&typeof B=="object"&&!Array.isArray(B)){let V;if(B.rootKeyId===void 0&&(V="rootKeyId")||B.derivationScheme===void 0&&(V="derivationScheme")||B.algorithm===void 0&&(V="algorithm")||B.encryptedKey===void 0&&(V="encryptedKey")||B.initializationVector===void 0&&(V="initializationVector")||B.ephemeralPublicKey===void 0&&(V="ephemeralPublicKey")||B.messageAuthenticationCode===void 0&&(V="messageAuthenticationCode"))return Te.errors=[{instancePath:e+"/encryption/keyEncryption/"+I,schemaPath:"#/properties/encryption/properties/keyEncryption/items/required",keyword:"required",params:{missingProperty:V},message:"must have required property '"+V+"'"}],!1;{let W=s;for(let K in B)if(!(K==="rootKeyId"||K==="derivationScheme"||K==="derivedPublicKey"||K==="algorithm"||K==="encryptedKey"||K==="initializationVector"||K==="ephemeralPublicKey"||K==="messageAuthenticationCode")){return Te.errors=[{instancePath:e+"/encryption/keyEncryption/"+I,schemaPath:"#/properties/encryption/properties/keyEncryption/items/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:K},message:"must NOT have additional properties"}],!1;break}if(W===s){if(B.rootKeyId!==void 0){let K=s;if(typeof B.rootKeyId!="string")return Te.errors=[{instancePath:e+"/encryption/keyEncryption/"+I+"/rootKeyId",schemaPath:"#/properties/encryption/properties/keyEncryption/items/properties/rootKeyId/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var D=K===s}else var D=!0;if(D){if(B.derivationScheme!==void 0){let K=B.derivationScheme,Y=s;if(typeof K!="string")return Te.errors=[{instancePath:e+"/encryption/keyEncryption/"+I+"/derivationScheme",schemaPath:"#/properties/encryption/properties/keyEncryption/items/properties/derivationScheme/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;if(!(K==="dataFormats"||K==="protocolContext"||K==="protocolPath"||K==="schemas"))return Te.errors=[{instancePath:e+"/encryption/keyEncryption/"+I+"/derivationScheme",schemaPath:"#/properties/encryption/properties/keyEncryption/items/properties/derivationScheme/enum",keyword:"enum",params:{allowedValues:Lf.properties.encryption.properties.keyEncryption.items.properties.derivationScheme.enum},message:"must be equal to one of the allowed values"}],!1;var D=Y===s}else var D=!0;if(D){if(B.derivedPublicKey!==void 0){let K=s;br(B.derivedPublicKey,{instancePath:e+"/encryption/keyEncryption/"+I+"/derivedPublicKey",parentData:B,parentDataProperty:"derivedPublicKey",rootData:i})||(o=o===null?br.errors:o.concat(br.errors),s=o.length);var D=K===s}else var D=!0;if(D){if(B.algorithm!==void 0){let K=B.algorithm,Y=s;if(typeof K!="string")return Te.errors=[{instancePath:e+"/encryption/keyEncryption/"+I+"/algorithm",schemaPath:"#/properties/encryption/properties/keyEncryption/items/properties/algorithm/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;if(K!=="ECIES-ES256K")return Te.errors=[{instancePath:e+"/encryption/keyEncryption/"+I+"/algorithm",schemaPath:"#/properties/encryption/properties/keyEncryption/items/properties/algorithm/enum",keyword:"enum",params:{allowedValues:Lf.properties.encryption.properties.keyEncryption.items.properties.algorithm.enum},message:"must be equal to one of the allowed values"}],!1;var D=Y===s}else var D=!0;if(D){if(B.encryptedKey!==void 0){let K=B.encryptedKey,Y=s;if(s===s)if(typeof K=="string"){if(!Cl.test(K))return Te.errors=[{instancePath:e+"/encryption/keyEncryption/"+I+"/encryptedKey",schemaPath:"https://identity.foundation/dwn/json-schemas/defs.json#/definitions/base64url/pattern",keyword:"pattern",params:{pattern:"^[A-Za-z0-9_-]+$"},message:'must match pattern "^[A-Za-z0-9_-]+$"'}],!1}else return Te.errors=[{instancePath:e+"/encryption/keyEncryption/"+I+"/encryptedKey",schemaPath:"https://identity.foundation/dwn/json-schemas/defs.json#/definitions/base64url/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var D=Y===s}else var D=!0;if(D){if(B.initializationVector!==void 0){let K=B.initializationVector,Y=s;if(s===s)if(typeof K=="string"){if(!Cl.test(K))return Te.errors=[{instancePath:e+"/encryption/keyEncryption/"+I+"/initializationVector",schemaPath:"https://identity.foundation/dwn/json-schemas/defs.json#/definitions/base64url/pattern",keyword:"pattern",params:{pattern:"^[A-Za-z0-9_-]+$"},message:'must match pattern "^[A-Za-z0-9_-]+$"'}],!1}else return Te.errors=[{instancePath:e+"/encryption/keyEncryption/"+I+"/initializationVector",schemaPath:"https://identity.foundation/dwn/json-schemas/defs.json#/definitions/base64url/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var D=Y===s}else var D=!0;if(D){if(B.ephemeralPublicKey!==void 0){let K=s;br(B.ephemeralPublicKey,{instancePath:e+"/encryption/keyEncryption/"+I+"/ephemeralPublicKey",parentData:B,parentDataProperty:"ephemeralPublicKey",rootData:i})||(o=o===null?br.errors:o.concat(br.errors),s=o.length);var D=K===s}else var D=!0;if(D)if(B.messageAuthenticationCode!==void 0){let K=B.messageAuthenticationCode,Y=s;if(s===s)if(typeof K=="string"){if(!Cl.test(K))return Te.errors=[{instancePath:e+"/encryption/keyEncryption/"+I+"/messageAuthenticationCode",schemaPath:"https://identity.foundation/dwn/json-schemas/defs.json#/definitions/base64url/pattern",keyword:"pattern",params:{pattern:"^[A-Za-z0-9_-]+$"},message:'must match pattern "^[A-Za-z0-9_-]+$"'}],!1}else return Te.errors=[{instancePath:e+"/encryption/keyEncryption/"+I+"/messageAuthenticationCode",schemaPath:"https://identity.foundation/dwn/json-schemas/defs.json#/definitions/base64url/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var D=Y===s}else var D=!0}}}}}}}}}else return Te.errors=[{instancePath:e+"/encryption/keyEncryption/"+I,schemaPath:"#/properties/encryption/properties/keyEncryption/items/type",keyword:"type",params:{type:"object"},message:"must be object"}],!1;var M=R===s;if(!M)break}}}else return Te.errors=[{instancePath:e+"/encryption/keyEncryption",schemaPath:"#/properties/encryption/properties/keyEncryption/type",keyword:"type",params:{type:"array"},message:"must be array"}],!1;var T=w===s}else var T=!0}}}}else return Te.errors=[{instancePath:e+"/encryption",schemaPath:"#/properties/encryption/type",keyword:"type",params:{type:"object"},message:"must be object"}],!1;var A=P===s}else var A=!0;if(A)if(t.descriptor!==void 0){let y=t.descriptor,P=s,x=s,l=!1,b=s;if(y&&typeof y=="object"&&!Array.isArray(y)){let w;if(y.published===void 0&&(w="published")||y.datePublished===void 0&&(w="datePublished")){let E={instancePath:e+"/descriptor",schemaPath:"#/properties/descriptor/allOf/0/anyOf/0/required",keyword:"required",params:{missingProperty:w},message:"must have required property '"+w+"'"};o===null?o=[E]:o.push(E),s++}else if(y.published!==void 0){let E=y.published;if(typeof E!="boolean"){let g={instancePath:e+"/descriptor/published",schemaPath:"#/properties/descriptor/allOf/0/anyOf/0/properties/published/type",keyword:"type",params:{type:"boolean"},message:"must be boolean"};o===null?o=[g]:o.push(g),s++}if(E!==!0){let g={instancePath:e+"/descriptor/published",schemaPath:"#/properties/descriptor/allOf/0/anyOf/0/properties/published/enum",keyword:"enum",params:{allowedValues:Lf.properties.descriptor.allOf[0].anyOf[0].properties.published.enum},message:"must be equal to one of the allowed values"};o===null?o=[g]:o.push(g),s++}}}var O=b===s;if(l=l||O,!l){let w=s,E=s,g=s;if(y&&typeof y=="object"&&!Array.isArray(y)){let B;if(y.datePublished===void 0&&(B="datePublished")){let R={};o===null?o=[R]:o.push(R),s++}}var U=g===s;if(U){let B={instancePath:e+"/descriptor",schemaPath:"#/properties/descriptor/allOf/0/anyOf/1/not",keyword:"not",params:{},message:"must NOT be valid"};o===null?o=[B]:o.push(B),s++}else s=E,o!==null&&(E?o.length=E:o=null);if(s===w&&y&&typeof y=="object"&&!Array.isArray(y)&&y.published!==void 0){let B=y.published;if(typeof B!="boolean"){let R={instancePath:e+"/descriptor/published",schemaPath:"#/properties/descriptor/allOf/0/anyOf/1/properties/published/type",keyword:"type",params:{type:"boolean"},message:"must be boolean"};o===null?o=[R]:o.push(R),s++}if(B!==!1){let R={instancePath:e+"/descriptor/published",schemaPath:"#/properties/descriptor/allOf/0/anyOf/1/properties/published/enum",keyword:"enum",params:{allowedValues:Lf.properties.descriptor.allOf[0].anyOf[1].properties.published.enum},message:"must be equal to one of the allowed values"};o===null?o=[R]:o.push(R),s++}}var O=w===s;if(l=l||O,!l){let B=s,R=s,q=s,V=s;if(y&&typeof y=="object"&&!Array.isArray(y)){let K;if(y.published===void 0&&(K="published")){let Y={};o===null?o=[Y]:o.push(Y),s++}}var L=V===s;if(L){let K={instancePath:e+"/descriptor",schemaPath:"#/properties/descriptor/allOf/0/anyOf/2/allOf/0/not",keyword:"not",params:{},message:"must NOT be valid"};o===null?o=[K]:o.push(K),s++}else s=q,o!==null&&(q?o.length=q:o=null);var F=R===s;if(F){let K=s,Y=s,J=s;if(y&&typeof y=="object"&&!Array.isArray(y)){let ce;if(y.datePublished===void 0&&(ce="datePublished")){let oe={};o===null?o=[oe]:o.push(oe),s++}}var $=J===s;if($){let ce={instancePath:e+"/descriptor",schemaPath:"#/properties/descriptor/allOf/0/anyOf/2/allOf/1/not",keyword:"not",params:{},message:"must NOT be valid"};o===null?o=[ce]:o.push(ce),s++}else s=Y,o!==null&&(Y?o.length=Y:o=null);var F=K===s}var O=B===s;l=l||O}}if(l)s=x,o!==null&&(x?o.length=x:o=null);else{let w={instancePath:e+"/descriptor",schemaPath:"#/properties/descriptor/allOf/0/anyOf",keyword:"anyOf",params:{},message:"must match a schema in anyOf"};return o===null?o=[w]:o.push(w),s++,Te.errors=o,!1}if(s===P)if(y&&typeof y=="object"&&!Array.isArray(y)){let w;if(y.interface===void 0&&(w="interface")||y.method===void 0&&(w="method")||y.dataCid===void 0&&(w="dataCid")||y.dataSize===void 0&&(w="dataSize")||y.dateCreated===void 0&&(w="dateCreated")||y.messageTimestamp===void 0&&(w="messageTimestamp")||y.dataFormat===void 0&&(w="dataFormat"))return Te.errors=[{instancePath:e+"/descriptor",schemaPath:"#/properties/descriptor/required",keyword:"required",params:{missingProperty:w},message:"must have required property '"+w+"'"}],!1;{let E=s;for(let g in y)if(!Dw.call(Lf.properties.descriptor.properties,g)){return Te.errors=[{instancePath:e+"/descriptor",schemaPath:"#/properties/descriptor/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:g},message:"must NOT have additional properties"}],!1;break}if(E===s){let g;if(y.parentId!==void 0&&y.protocol===void 0&&(g="protocol"))return Te.errors=[{instancePath:e+"/descriptor",schemaPath:"#/properties/descriptor/dependencies",keyword:"dependencies",params:{property:"parentId",missingProperty:g,depsCount:1,deps:"protocol"},message:"must have property protocol when property parentId is present"}],!1;if(y.interface!==void 0){let I=y.interface,B=s;if(typeof I!="string")return Te.errors=[{instancePath:e+"/descriptor/interface",schemaPath:"#/properties/descriptor/properties/interface/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;if(I!=="Records")return Te.errors=[{instancePath:e+"/descriptor/interface",schemaPath:"#/properties/descriptor/properties/interface/enum",keyword:"enum",params:{allowedValues:Lf.properties.descriptor.properties.interface.enum},message:"must be equal to one of the allowed values"}],!1;var H=B===s}else var H=!0;if(H){if(y.method!==void 0){let I=y.method,B=s;if(typeof I!="string")return Te.errors=[{instancePath:e+"/descriptor/method",schemaPath:"#/properties/descriptor/properties/method/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;if(I!=="Write")return Te.errors=[{instancePath:e+"/descriptor/method",schemaPath:"#/properties/descriptor/properties/method/enum",keyword:"enum",params:{allowedValues:Lf.properties.descriptor.properties.method.enum},message:"must be equal to one of the allowed values"}],!1;var H=B===s}else var H=!0;if(H){if(y.recipient!==void 0){let I=y.recipient,B=s;if(s===s)if(typeof I=="string"){if(!ks.test(I))return Te.errors=[{instancePath:e+"/descriptor/recipient",schemaPath:"https://identity.foundation/dwn/json-schemas/defs.json#/definitions/did/pattern",keyword:"pattern",params:{pattern:"^did:([a-z0-9]+):((?:(?:[a-zA-Z0-9._-]|(?:%[0-9a-fA-F]{2}))*:)*((?:[a-zA-Z0-9._-]|(?:%[0-9a-fA-F]{2}))+))((;[a-zA-Z0-9_.:%-]+=[a-zA-Z0-9_.:%-]*)*)(/[^#?]*)?([?][^#]*)?(#.*)?$"},message:'must match pattern "^did:([a-z0-9]+):((?:(?:[a-zA-Z0-9._-]|(?:%[0-9a-fA-F]{2}))*:)*((?:[a-zA-Z0-9._-]|(?:%[0-9a-fA-F]{2}))+))((;[a-zA-Z0-9_.:%-]+=[a-zA-Z0-9_.:%-]*)*)(/[^#?]*)?([?][^#]*)?(#.*)?$"'}],!1}else return Te.errors=[{instancePath:e+"/descriptor/recipient",schemaPath:"https://identity.foundation/dwn/json-schemas/defs.json#/definitions/did/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var H=B===s}else var H=!0;if(H){if(y.protocol!==void 0){let I=s;if(typeof y.protocol!="string")return Te.errors=[{instancePath:e+"/descriptor/protocol",schemaPath:"#/properties/descriptor/properties/protocol/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var H=I===s}else var H=!0;if(H){if(y.protocolPath!==void 0){let I=y.protocolPath,B=s;if(s===B)if(typeof I=="string"){if(!Xae.test(I))return Te.errors=[{instancePath:e+"/descriptor/protocolPath",schemaPath:"#/properties/descriptor/properties/protocolPath/pattern",keyword:"pattern",params:{pattern:"^[a-zA-Z]+(/[a-zA-Z]+)*$"},message:'must match pattern "^[a-zA-Z]+(/[a-zA-Z]+)*$"'}],!1}else return Te.errors=[{instancePath:e+"/descriptor/protocolPath",schemaPath:"#/properties/descriptor/properties/protocolPath/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var H=B===s}else var H=!0;if(H){if(y.schema!==void 0){let I=s;if(typeof y.schema!="string")return Te.errors=[{instancePath:e+"/descriptor/schema",schemaPath:"#/properties/descriptor/properties/schema/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var H=I===s}else var H=!0;if(H){if(y.parentId!==void 0){let I=s;if(typeof y.parentId!="string")return Te.errors=[{instancePath:e+"/descriptor/parentId",schemaPath:"#/properties/descriptor/properties/parentId/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var H=I===s}else var H=!0;if(H){if(y.dataCid!==void 0){let I=s;if(typeof y.dataCid!="string")return Te.errors=[{instancePath:e+"/descriptor/dataCid",schemaPath:"#/properties/descriptor/properties/dataCid/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var H=I===s}else var H=!0;if(H){if(y.dataSize!==void 0){let I=y.dataSize,B=s;if(!(typeof I=="number"&&isFinite(I)))return Te.errors=[{instancePath:e+"/descriptor/dataSize",schemaPath:"#/properties/descriptor/properties/dataSize/type",keyword:"type",params:{type:"number"},message:"must be number"}],!1;var H=B===s}else var H=!0;if(H){if(y.dateCreated!==void 0){let I=y.dateCreated,B=s;if(s===s)if(typeof I=="string"){if(!Cn.test(I))return Te.errors=[{instancePath:e+"/descriptor/dateCreated",schemaPath:"https://identity.foundation/dwn/json-schemas/defs.json#/definitions/date-time/pattern",keyword:"pattern",params:{pattern:"^\\d{4}-[0-1]\\d-[0-3]\\dT(?:[0-2]\\d:[0-5]\\d:[0-5]\\d|23:59:60)\\.\\d{6}Z$"},message:'must match pattern "^\\d{4}-[0-1]\\d-[0-3]\\dT(?:[0-2]\\d:[0-5]\\d:[0-5]\\d|23:59:60)\\.\\d{6}Z$"'}],!1}else return Te.errors=[{instancePath:e+"/descriptor/dateCreated",schemaPath:"https://identity.foundation/dwn/json-schemas/defs.json#/definitions/date-time/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var H=B===s}else var H=!0;if(H){if(y.messageTimestamp!==void 0){let I=y.messageTimestamp,B=s;if(s===s)if(typeof I=="string"){if(!Cn.test(I))return Te.errors=[{instancePath:e+"/descriptor/messageTimestamp",schemaPath:"https://identity.foundation/dwn/json-schemas/defs.json#/definitions/date-time/pattern",keyword:"pattern",params:{pattern:"^\\d{4}-[0-1]\\d-[0-3]\\dT(?:[0-2]\\d:[0-5]\\d:[0-5]\\d|23:59:60)\\.\\d{6}Z$"},message:'must match pattern "^\\d{4}-[0-1]\\d-[0-3]\\dT(?:[0-2]\\d:[0-5]\\d:[0-5]\\d|23:59:60)\\.\\d{6}Z$"'}],!1}else return Te.errors=[{instancePath:e+"/descriptor/messageTimestamp",schemaPath:"https://identity.foundation/dwn/json-schemas/defs.json#/definitions/date-time/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var H=B===s}else var H=!0;if(H){if(y.published!==void 0){let I=s;if(typeof y.published!="boolean")return Te.errors=[{instancePath:e+"/descriptor/published",schemaPath:"#/properties/descriptor/properties/published/type",keyword:"type",params:{type:"boolean"},message:"must be boolean"}],!1;var H=I===s}else var H=!0;if(H){if(y.datePublished!==void 0){let I=y.datePublished,B=s;if(s===s)if(typeof I=="string"){if(!Cn.test(I))return Te.errors=[{instancePath:e+"/descriptor/datePublished",schemaPath:"https://identity.foundation/dwn/json-schemas/defs.json#/definitions/date-time/pattern",keyword:"pattern",params:{pattern:"^\\d{4}-[0-1]\\d-[0-3]\\dT(?:[0-2]\\d:[0-5]\\d:[0-5]\\d|23:59:60)\\.\\d{6}Z$"},message:'must match pattern "^\\d{4}-[0-1]\\d-[0-3]\\dT(?:[0-2]\\d:[0-5]\\d:[0-5]\\d|23:59:60)\\.\\d{6}Z$"'}],!1}else return Te.errors=[{instancePath:e+"/descriptor/datePublished",schemaPath:"https://identity.foundation/dwn/json-schemas/defs.json#/definitions/date-time/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var H=B===s}else var H=!0;if(H)if(y.dataFormat!==void 0){let I=s;if(typeof y.dataFormat!="string")return Te.errors=[{instancePath:e+"/descriptor/dataFormat",schemaPath:"#/properties/descriptor/properties/dataFormat/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var H=I===s}else var H=!0}}}}}}}}}}}}}}}else return Te.errors=[{instancePath:e+"/descriptor",schemaPath:"#/properties/descriptor/type",keyword:"type",params:{type:"object"},message:"must be object"}],!1;var A=P===s}else var A=!0}}}}}}}else return Te.errors=[{instancePath:e,schemaPath:"#/type",keyword:"type",params:{type:"object"},message:"must be object"}],!1;return Te.errors=o,s===0}function Bw(t,{instancePath:e="",parentData:r,parentDataProperty:n,rootData:i=t}={}){let o=null,s=0;if(!Te(t,{instancePath:e,parentData:r,parentDataProperty:n,rootData:i}))o=o===null?Te.errors:o.concat(Te.errors),s=o.length;else if(s===s)if(t&&typeof t=="object"&&!Array.isArray(t)){let c;if(t.recordId===void 0&&(c="recordId")||t.authorization===void 0&&(c="authorization"))return Bw.errors=[{instancePath:e,schemaPath:"#/allOf/0/required",keyword:"required",params:{missingProperty:c},message:"must have required property '"+c+"'"}],!1}else return Bw.errors=[{instancePath:e,schemaPath:"#/allOf/0/type",keyword:"type",params:{type:"object"},message:"must be object"}],!1;return Bw.errors=o,s===0}var Qae=Te,ece=So,uC={$schema:"http://json-schema.org/draft-07/schema#",$id:"https://identity.foundation/dwn/json-schemas/events-get.json",type:"object",additionalProperties:!1,required:["authorization","descriptor"],properties:{authorization:{$ref:"https://identity.foundation/dwn/json-schemas/authorization.json"},descriptor:{type:"object",additionalProperties:!1,required:["interface","method","messageTimestamp"],properties:{interface:{enum:["Events"],type:"string"},method:{enum:["Get"],type:"string"},messageTimestamp:{type:"string"},watermark:{type:"string"}}}}};function So(t,{instancePath:e="",parentData:r,parentDataProperty:n,rootData:i=t}={}){let o=null,s=0;if(s===0)if(t&&typeof t=="object"&&!Array.isArray(t)){let d;if(t.authorization===void 0&&(d="authorization")||t.descriptor===void 0&&(d="descriptor"))return So.errors=[{instancePath:e,schemaPath:"#/required",keyword:"required",params:{missingProperty:d},message:"must have required property '"+d+"'"}],!1;{let f=s;for(let u in t)if(!(u==="authorization"||u==="descriptor")){return So.errors=[{instancePath:e,schemaPath:"#/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:u},message:"must NOT have additional properties"}],!1;break}if(f===s){if(t.authorization!==void 0){let u=s;qr(t.authorization,{instancePath:e+"/authorization",parentData:t,parentDataProperty:"authorization",rootData:i})||(o=o===null?qr.errors:o.concat(qr.errors),s=o.length);var a=u===s}else var a=!0;if(a)if(t.descriptor!==void 0){let u=t.descriptor,m=s;if(s===m)if(u&&typeof u=="object"&&!Array.isArray(u)){let v;if(u.interface===void 0&&(v="interface")||u.method===void 0&&(v="method")||u.messageTimestamp===void 0&&(v="messageTimestamp"))return So.errors=[{instancePath:e+"/descriptor",schemaPath:"#/properties/descriptor/required",keyword:"required",params:{missingProperty:v},message:"must have required property '"+v+"'"}],!1;{let A=s;for(let T in u)if(!(T==="interface"||T==="method"||T==="messageTimestamp"||T==="watermark")){return So.errors=[{instancePath:e+"/descriptor",schemaPath:"#/properties/descriptor/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:T},message:"must NOT have additional properties"}],!1;break}if(A===s){if(u.interface!==void 0){let T=u.interface,M=s;if(typeof T!="string")return So.errors=[{instancePath:e+"/descriptor/interface",schemaPath:"#/properties/descriptor/properties/interface/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;if(T!=="Events")return So.errors=[{instancePath:e+"/descriptor/interface",schemaPath:"#/properties/descriptor/properties/interface/enum",keyword:"enum",params:{allowedValues:uC.properties.descriptor.properties.interface.enum},message:"must be equal to one of the allowed values"}],!1;var c=M===s}else var c=!0;if(c){if(u.method!==void 0){let T=u.method,M=s;if(typeof T!="string")return So.errors=[{instancePath:e+"/descriptor/method",schemaPath:"#/properties/descriptor/properties/method/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;if(T!=="Get")return So.errors=[{instancePath:e+"/descriptor/method",schemaPath:"#/properties/descriptor/properties/method/enum",keyword:"enum",params:{allowedValues:uC.properties.descriptor.properties.method.enum},message:"must be equal to one of the allowed values"}],!1;var c=M===s}else var c=!0;if(c){if(u.messageTimestamp!==void 0){let T=s;if(typeof u.messageTimestamp!="string")return So.errors=[{instancePath:e+"/descriptor/messageTimestamp",schemaPath:"#/properties/descriptor/properties/messageTimestamp/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var c=T===s}else var c=!0;if(c)if(u.watermark!==void 0){let T=s;if(typeof u.watermark!="string")return So.errors=[{instancePath:e+"/descriptor/watermark",schemaPath:"#/properties/descriptor/properties/watermark/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var c=T===s}else var c=!0}}}}}else return So.errors=[{instancePath:e+"/descriptor",schemaPath:"#/properties/descriptor/type",keyword:"type",params:{type:"object"},message:"must be object"}],!1;var a=m===s}else var a=!0}}}else return So.errors=[{instancePath:e,schemaPath:"#/type",keyword:"type",params:{type:"object"},message:"must be object"}],!1;return So.errors=o,s===0}var tce=M4;function M4(t,{instancePath:e="",parentData:r,parentDataProperty:n,rootData:i=t}={}){let o=null,s=0;return t&&typeof t=="object"&&!Array.isArray(t)?(M4.errors=o,s===0):(M4.errors=[{instancePath:e,schemaPath:"#/type",keyword:"type",params:{type:"object"},message:"must be object"}],!1)}var rce=ro;function ro(t,{instancePath:e="",parentData:r,parentDataProperty:n,rootData:i=t}={}){let o=null,s=0,a=s,c=!1,d=null,f=s;if(t&&typeof t=="object"&&!Array.isArray(t)){let D;if(t.crv===void 0&&(D="crv")||t.x===void 0&&(D="x")){let O={instancePath:e,schemaPath:"#/oneOf/0/required",keyword:"required",params:{missingProperty:D},message:"must have required property '"+D+"'"};o===null?o=[O]:o.push(O),s++}else{if(t.kty!==void 0){let O=s;if(t.kty!=="EC"){let U={instancePath:e+"/kty",schemaPath:"#/oneOf/0/properties/kty/const",keyword:"const",params:{allowedValue:"EC"},message:"must be equal to constant"};o===null?o=[U]:o.push(U),s++}var u=O===s}else var u=!0;if(u){if(t.crv!==void 0){let O=s;if(typeof t.crv!="string"){let L={instancePath:e+"/crv",schemaPath:"#/oneOf/0/properties/crv/type",keyword:"type",params:{type:"string"},message:"must be string"};o===null?o=[L]:o.push(L),s++}var u=O===s}else var u=!0;if(u){if(t.x!==void 0){let O=s;if(typeof t.x!="string"){let L={instancePath:e+"/x",schemaPath:"#/oneOf/0/properties/x/type",keyword:"type",params:{type:"string"},message:"must be string"};o===null?o=[L]:o.push(L),s++}var u=O===s}else var u=!0;if(u){if(t.y!==void 0){let O=s;if(typeof t.y!="string"){let L={instancePath:e+"/y",schemaPath:"#/oneOf/0/properties/y/type",keyword:"type",params:{type:"string"},message:"must be string"};o===null?o=[L]:o.push(L),s++}var u=O===s}else var u=!0;if(u)if(t.d!==void 0){let O=s;if(typeof t.d!="string"){let L={instancePath:e+"/d",schemaPath:"#/oneOf/0/properties/d/type",keyword:"type",params:{type:"string"},message:"must be string"};o===null?o=[L]:o.push(L),s++}var u=O===s}else var u=!0}}}}}var v=f===s;v&&(c=!0,d=0);let m=s;if(t&&typeof t=="object"&&!Array.isArray(t)){let D;if(t.crv===void 0&&(D="crv")||t.x===void 0&&(D="x")){let O={instancePath:e,schemaPath:"#/oneOf/1/required",keyword:"required",params:{missingProperty:D},message:"must have required property '"+D+"'"};o===null?o=[O]:o.push(O),s++}else{if(t.kty!==void 0){let O=s;if(t.kty!=="OKP"){let U={instancePath:e+"/kty",schemaPath:"#/oneOf/1/properties/kty/const",keyword:"const",params:{allowedValue:"OKP"},message:"must be equal to constant"};o===null?o=[U]:o.push(U),s++}var _=O===s}else var _=!0;if(_){if(t.crv!==void 0){let O=s;if(typeof t.crv!="string"){let L={instancePath:e+"/crv",schemaPath:"#/oneOf/1/properties/crv/type",keyword:"type",params:{type:"string"},message:"must be string"};o===null?o=[L]:o.push(L),s++}var _=O===s}else var _=!0;if(_){if(t.x!==void 0){let O=s;if(typeof t.x!="string"){let L={instancePath:e+"/x",schemaPath:"#/oneOf/1/properties/x/type",keyword:"type",params:{type:"string"},message:"must be string"};o===null?o=[L]:o.push(L),s++}var _=O===s}else var _=!0;if(_)if(t.d!==void 0){let O=s;if(typeof t.d!="string"){let L={instancePath:e+"/d",schemaPath:"#/oneOf/1/properties/d/type",keyword:"type",params:{type:"string"},message:"must be string"};o===null?o=[L]:o.push(L),s++}var _=O===s}else var _=!0}}}}var v=m===s;if(v&&c)c=!1,d=[d,1];else{v&&(c=!0,d=1);let D=s;if(t&&typeof t=="object"&&!Array.isArray(t)){let U;if(t.n===void 0&&(U="n")||t.e===void 0&&(U="e")){let L={instancePath:e,schemaPath:"#/oneOf/2/required",keyword:"required",params:{missingProperty:U},message:"must have required property '"+U+"'"};o===null?o=[L]:o.push(L),s++}else{if(t.kty!==void 0){let L=s;if(t.kty!=="RSA"){let F={instancePath:e+"/kty",schemaPath:"#/oneOf/2/properties/kty/const",keyword:"const",params:{allowedValue:"RSA"},message:"must be equal to constant"};o===null?o=[F]:o.push(F),s++}var A=L===s}else var A=!0;if(A){if(t.n!==void 0){let L=s;if(typeof t.n!="string"){let $={instancePath:e+"/n",schemaPath:"#/oneOf/2/properties/n/type",keyword:"type",params:{type:"string"},message:"must be string"};o===null?o=[$]:o.push($),s++}var A=L===s}else var A=!0;if(A){if(t.e!==void 0){let L=s;if(typeof t.e!="string"){let $={instancePath:e+"/e",schemaPath:"#/oneOf/2/properties/e/type",keyword:"type",params:{type:"string"},message:"must be string"};o===null?o=[$]:o.push($),s++}var A=L===s}else var A=!0;if(A){if(t.d!==void 0){let L=s;if(typeof t.d!="string"){let $={instancePath:e+"/d",schemaPath:"#/oneOf/2/properties/d/type",keyword:"type",params:{type:"string"},message:"must be string"};o===null?o=[$]:o.push($),s++}var A=L===s}else var A=!0;if(A){if(t.p!==void 0){let L=s;if(typeof t.p!="string"){let $={instancePath:e+"/p",schemaPath:"#/oneOf/2/properties/p/type",keyword:"type",params:{type:"string"},message:"must be string"};o===null?o=[$]:o.push($),s++}var A=L===s}else var A=!0;if(A){if(t.q!==void 0){let L=s;if(typeof t.q!="string"){let $={instancePath:e+"/q",schemaPath:"#/oneOf/2/properties/q/type",keyword:"type",params:{type:"string"},message:"must be string"};o===null?o=[$]:o.push($),s++}var A=L===s}else var A=!0;if(A){if(t.dp!==void 0){let L=s;if(typeof t.dp!="string"){let $={instancePath:e+"/dp",schemaPath:"#/oneOf/2/properties/dp/type",keyword:"type",params:{type:"string"},message:"must be string"};o===null?o=[$]:o.push($),s++}var A=L===s}else var A=!0;if(A){if(t.dq!==void 0){let L=s;if(typeof t.dq!="string"){let $={instancePath:e+"/dq",schemaPath:"#/oneOf/2/properties/dq/type",keyword:"type",params:{type:"string"},message:"must be string"};o===null?o=[$]:o.push($),s++}var A=L===s}else var A=!0;if(A){if(t.qi!==void 0){let L=s;if(typeof t.qi!="string"){let $={instancePath:e+"/qi",schemaPath:"#/oneOf/2/properties/qi/type",keyword:"type",params:{type:"string"},message:"must be string"};o===null?o=[$]:o.push($),s++}var A=L===s}else var A=!0;if(A)if(t.oth!==void 0){let L=t.oth,F=s;if(!(L&&typeof L=="object"&&!Array.isArray(L))){let H={instancePath:e+"/oth",schemaPath:"#/oneOf/2/properties/oth/type",keyword:"type",params:{type:"object"},message:"must be object"};o===null?o=[H]:o.push(H),s++}var A=F===s}else var A=!0}}}}}}}}}}var v=D===s;if(v&&c)c=!1,d=[d,2];else{v&&(c=!0,d=2);let U=s;if(t&&typeof t=="object"&&!Array.isArray(t)){let F;if(t.k===void 0&&(F="k")){let $={instancePath:e,schemaPath:"#/oneOf/3/required",keyword:"required",params:{missingProperty:F},message:"must have required property '"+F+"'"};o===null?o=[$]:o.push($),s++}else{if(t.kty!==void 0){let $=s;if(t.kty!=="oct"){let H={instancePath:e+"/kty",schemaPath:"#/oneOf/3/properties/kty/const",keyword:"const",params:{allowedValue:"oct"},message:"must be equal to constant"};o===null?o=[H]:o.push(H),s++}var T=$===s}else var T=!0;if(T)if(t.k!==void 0){let $=s;if(typeof t.k!="string"){let z={instancePath:e+"/k",schemaPath:"#/oneOf/3/properties/k/type",keyword:"type",params:{type:"string"},message:"must be string"};o===null?o=[z]:o.push(z),s++}var T=$===s}else var T=!0}}var v=U===s;v&&c?(c=!1,d=[d,3]):v&&(c=!0,d=3)}}if(c)s=a,o!==null&&(a?o.length=a:o=null);else{let D={instancePath:e,schemaPath:"#/oneOf",keyword:"oneOf",params:{passingSchemas:d},message:"must match exactly one schema in oneOf"};return o===null?o=[D]:o.push(D),s++,ro.errors=o,!1}if(s===0)if(t&&typeof t=="object"&&!Array.isArray(t)){let D;if(t.kty===void 0&&(D="kty"))return ro.errors=[{instancePath:e,schemaPath:"#/required",keyword:"required",params:{missingProperty:D},message:"must have required property '"+D+"'"}],!1;if(t.alg!==void 0){let O=s;if(typeof t.alg!="string")return ro.errors=[{instancePath:e+"/alg",schemaPath:"#/properties/alg/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var M=O===s}else var M=!0;if(M){if(t.kid!==void 0){let O=s;if(typeof t.kid!="string")return ro.errors=[{instancePath:e+"/kid",schemaPath:"#/properties/kid/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var M=O===s}else var M=!0;if(M){if(t.kty!==void 0){let O=t.kty,U=s;if(!(O==="EC"||O==="RSA"||O==="oct"||O==="OKP"))return ro.errors=[{instancePath:e+"/kty",schemaPath:"#/properties/kty/enum",keyword:"enum",params:{allowedValues:wC.properties.kty.enum},message:"must be equal to one of the allowed values"}],!1;var M=U===s}else var M=!0;if(M){if(t.crv!==void 0){let O=s;if(typeof t.crv!="string")return ro.errors=[{instancePath:e+"/crv",schemaPath:"#/properties/crv/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var M=O===s}else var M=!0;if(M){if(t.use!==void 0){let O=s;if(typeof t.use!="string")return ro.errors=[{instancePath:e+"/use",schemaPath:"#/properties/use/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var M=O===s}else var M=!0;if(M){if(t.key_ops!==void 0){let O=s;if(typeof t.key_ops!="string")return ro.errors=[{instancePath:e+"/key_ops",schemaPath:"#/properties/key_ops/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var M=O===s}else var M=!0;if(M){if(t.x5u!==void 0){let O=s;if(typeof t.x5u!="string")return ro.errors=[{instancePath:e+"/x5u",schemaPath:"#/properties/x5u/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var M=O===s}else var M=!0;if(M){if(t.x5c!==void 0){let O=s;if(typeof t.x5c!="string")return ro.errors=[{instancePath:e+"/x5c",schemaPath:"#/properties/x5c/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var M=O===s}else var M=!0;if(M){if(t.x5t!==void 0){let O=s;if(typeof t.x5t!="string")return ro.errors=[{instancePath:e+"/x5t",schemaPath:"#/properties/x5t/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var M=O===s}else var M=!0;if(M)if(t["x5t#S256"]!==void 0){let O=s;if(typeof t["x5t#S256"]!="string")return ro.errors=[{instancePath:e+"/x5t#S256",schemaPath:"#/properties/x5t%23S256/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var M=O===s}else var M=!0}}}}}}}}}else return ro.errors=[{instancePath:e,schemaPath:"#/type",keyword:"type",params:{type:"object"},message:"must be object"}],!1;return ro.errors=o,s===0}var nce=vr,ice=yd;function yd(t,{instancePath:e="",parentData:r,parentDataProperty:n,rootData:i=t}={}){let o=null,s=0;if(s===0)if(t&&typeof t=="object"&&!Array.isArray(t)){let c;if(t.id===void 0&&(c="id")||t.type===void 0&&(c="type")||t.controller===void 0&&(c="controller")||t.publicKeyJwk===void 0&&(c="publicKeyJwk"))return yd.errors=[{instancePath:e,schemaPath:"#/required",keyword:"required",params:{missingProperty:c},message:"must have required property '"+c+"'"}],!1;{let d=s;for(let f in t)if(!(f==="id"||f==="type"||f==="controller"||f==="publicKeyJwk")){return yd.errors=[{instancePath:e,schemaPath:"#/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:f},message:"must NOT have additional properties"}],!1;break}if(d===s){if(t.id!==void 0){let f=s;if(typeof t.id!="string")return yd.errors=[{instancePath:e+"/id",schemaPath:"#/properties/id/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var a=f===s}else var a=!0;if(a){if(t.type!==void 0){let f=s;if(t.type!=="JsonWebKey2020")return yd.errors=[{instancePath:e+"/type",schemaPath:"#/properties/type/const",keyword:"const",params:{allowedValue:"JsonWebKey2020"},message:"must be equal to constant"}],!1;var a=f===s}else var a=!0;if(a){if(t.controller!==void 0){let f=t.controller,u=s;if(s===s)if(typeof f=="string"){if(!ks.test(f))return yd.errors=[{instancePath:e+"/controller",schemaPath:"https://identity.foundation/dwn/json-schemas/defs.json#/definitions/did/pattern",keyword:"pattern",params:{pattern:"^did:([a-z0-9]+):((?:(?:[a-zA-Z0-9._-]|(?:%[0-9a-fA-F]{2}))*:)*((?:[a-zA-Z0-9._-]|(?:%[0-9a-fA-F]{2}))+))((;[a-zA-Z0-9_.:%-]+=[a-zA-Z0-9_.:%-]*)*)(/[^#?]*)?([?][^#]*)?(#.*)?$"},message:'must match pattern "^did:([a-z0-9]+):((?:(?:[a-zA-Z0-9._-]|(?:%[0-9a-fA-F]{2}))*:)*((?:[a-zA-Z0-9._-]|(?:%[0-9a-fA-F]{2}))+))((;[a-zA-Z0-9_.:%-]+=[a-zA-Z0-9_.:%-]*)*)(/[^#?]*)?([?][^#]*)?(#.*)?$"'}],!1}else return yd.errors=[{instancePath:e+"/controller",schemaPath:"https://identity.foundation/dwn/json-schemas/defs.json#/definitions/did/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var a=u===s}else var a=!0;if(a)if(t.publicKeyJwk!==void 0){let f=s;br(t.publicKeyJwk,{instancePath:e+"/publicKeyJwk",parentData:t,parentDataProperty:"publicKeyJwk",rootData:i})||(o=o===null?br.errors:o.concat(br.errors),s=o.length);var a=f===s}else var a=!0}}}}}else return yd.errors=[{instancePath:e,schemaPath:"#/type",keyword:"type",params:{type:"object"},message:"must be object"}],!1;return yd.errors=o,s===0}var oce=fi,lC={$schema:"http://json-schema.org/draft-07/schema#",$id:"https://identity.foundation/dwn/json-schemas/messages-get.json",type:"object",additionalProperties:!1,required:["authorization","descriptor"],properties:{authorization:{$ref:"https://identity.foundation/dwn/json-schemas/authorization.json"},descriptor:{type:"object",additionalProperties:!1,required:["interface","method","messageTimestamp"],properties:{interface:{enum:["Messages"],type:"string"},method:{enum:["Get"],type:"string"},messageTimestamp:{$ref:"https://identity.foundation/dwn/json-schemas/defs.json#/definitions/date-time"},messageCids:{type:"array",items:{type:"string"},minItems:1}}}}};function fi(t,{instancePath:e="",parentData:r,parentDataProperty:n,rootData:i=t}={}){let o=null,s=0;if(s===0)if(t&&typeof t=="object"&&!Array.isArray(t)){let f;if(t.authorization===void 0&&(f="authorization")||t.descriptor===void 0&&(f="descriptor"))return fi.errors=[{instancePath:e,schemaPath:"#/required",keyword:"required",params:{missingProperty:f},message:"must have required property '"+f+"'"}],!1;{let u=s;for(let m in t)if(!(m==="authorization"||m==="descriptor")){return fi.errors=[{instancePath:e,schemaPath:"#/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:m},message:"must NOT have additional properties"}],!1;break}if(u===s){if(t.authorization!==void 0){let m=s;qr(t.authorization,{instancePath:e+"/authorization",parentData:t,parentDataProperty:"authorization",rootData:i})||(o=o===null?qr.errors:o.concat(qr.errors),s=o.length);var a=m===s}else var a=!0;if(a)if(t.descriptor!==void 0){let m=t.descriptor,_=s;if(s===_)if(m&&typeof m=="object"&&!Array.isArray(m)){let A;if(m.interface===void 0&&(A="interface")||m.method===void 0&&(A="method")||m.messageTimestamp===void 0&&(A="messageTimestamp"))return fi.errors=[{instancePath:e+"/descriptor",schemaPath:"#/properties/descriptor/required",keyword:"required",params:{missingProperty:A},message:"must have required property '"+A+"'"}],!1;{let T=s;for(let M in m)if(!(M==="interface"||M==="method"||M==="messageTimestamp"||M==="messageCids")){return fi.errors=[{instancePath:e+"/descriptor",schemaPath:"#/properties/descriptor/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:M},message:"must NOT have additional properties"}],!1;break}if(T===s){if(m.interface!==void 0){let M=m.interface,D=s;if(typeof M!="string")return fi.errors=[{instancePath:e+"/descriptor/interface",schemaPath:"#/properties/descriptor/properties/interface/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;if(M!=="Messages")return fi.errors=[{instancePath:e+"/descriptor/interface",schemaPath:"#/properties/descriptor/properties/interface/enum",keyword:"enum",params:{allowedValues:lC.properties.descriptor.properties.interface.enum},message:"must be equal to one of the allowed values"}],!1;var c=D===s}else var c=!0;if(c){if(m.method!==void 0){let M=m.method,D=s;if(typeof M!="string")return fi.errors=[{instancePath:e+"/descriptor/method",schemaPath:"#/properties/descriptor/properties/method/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;if(M!=="Get")return fi.errors=[{instancePath:e+"/descriptor/method",schemaPath:"#/properties/descriptor/properties/method/enum",keyword:"enum",params:{allowedValues:lC.properties.descriptor.properties.method.enum},message:"must be equal to one of the allowed values"}],!1;var c=D===s}else var c=!0;if(c){if(m.messageTimestamp!==void 0){let M=m.messageTimestamp,D=s;if(s===s)if(typeof M=="string"){if(!Cn.test(M))return fi.errors=[{instancePath:e+"/descriptor/messageTimestamp",schemaPath:"https://identity.foundation/dwn/json-schemas/defs.json#/definitions/date-time/pattern",keyword:"pattern",params:{pattern:"^\\d{4}-[0-1]\\d-[0-3]\\dT(?:[0-2]\\d:[0-5]\\d:[0-5]\\d|23:59:60)\\.\\d{6}Z$"},message:'must match pattern "^\\d{4}-[0-1]\\d-[0-3]\\dT(?:[0-2]\\d:[0-5]\\d:[0-5]\\d|23:59:60)\\.\\d{6}Z$"'}],!1}else return fi.errors=[{instancePath:e+"/descriptor/messageTimestamp",schemaPath:"https://identity.foundation/dwn/json-schemas/defs.json#/definitions/date-time/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var c=D===s}else var c=!0;if(c)if(m.messageCids!==void 0){let M=m.messageCids,D=s;if(s===D)if(Array.isArray(M)){if(M.length<1)return fi.errors=[{instancePath:e+"/descriptor/messageCids",schemaPath:"#/properties/descriptor/properties/messageCids/minItems",keyword:"minItems",params:{limit:1},message:"must NOT have fewer than 1 items"}],!1;{var d=!0;let U=M.length;for(let L=0;L<U;L++){let F=s;if(typeof M[L]!="string")return fi.errors=[{instancePath:e+"/descriptor/messageCids/"+L,schemaPath:"#/properties/descriptor/properties/messageCids/items/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var d=F===s;if(!d)break}}}else return fi.errors=[{instancePath:e+"/descriptor/messageCids",schemaPath:"#/properties/descriptor/properties/messageCids/type",keyword:"type",params:{type:"array"},message:"must be array"}],!1;var c=D===s}else var c=!0}}}}}else return fi.errors=[{instancePath:e+"/descriptor",schemaPath:"#/properties/descriptor/type",keyword:"type",params:{type:"object"},message:"must be object"}],!1;var a=_===s}else var a=!0}}}else return fi.errors=[{instancePath:e,schemaPath:"#/type",keyword:"type",params:{type:"object"},message:"must be object"}],!1;return fi.errors=o,s===0}var sce=Jo;function Jo(t,{instancePath:e="",parentData:r,parentDataProperty:n,rootData:i=t}={}){let o=null,s=0;if(s===0)if(t&&typeof t=="object"&&!Array.isArray(t)){if(Object.keys(t).length<1)return Jo.errors=[{instancePath:e,schemaPath:"#/minProperties",keyword:"minProperties",params:{limit:1},message:"must NOT have fewer than 1 properties"}],!1;{let _=s;for(let v in t)if(!(v==="gt"||v==="gte"||v==="lt"||v==="lte")){return Jo.errors=[{instancePath:e,schemaPath:"#/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:v},message:"must NOT have additional properties"}],!1;break}if(_===s){if(t.gt!==void 0){let v=s,A=s,T=s;if(t&&typeof t=="object"&&!Array.isArray(t)){let M;if(t.gte===void 0&&(M="gte")){let D={};o===null?o=[D]:o.push(D),s++}}var a=T===s;if(a)return Jo.errors=[{instancePath:e,schemaPath:"#/dependencies/gt/not",keyword:"not",params:{},message:"must NOT be valid"}],!1;s=A,o!==null&&(A?o.length=A:o=null);var c=v===s}else var c=!0;if(c){if(t.gte!==void 0){let v=s,A=s,T=s;if(t&&typeof t=="object"&&!Array.isArray(t)){let D;if(t.gt===void 0&&(D="gt")){let O={};o===null?o=[O]:o.push(O),s++}}var d=T===s;if(d)return Jo.errors=[{instancePath:e,schemaPath:"#/dependencies/gte/not",keyword:"not",params:{},message:"must NOT be valid"}],!1;s=A,o!==null&&(A?o.length=A:o=null);var c=v===s}else var c=!0;if(c){if(t.lt!==void 0){let v=s,A=s,T=s;if(t&&typeof t=="object"&&!Array.isArray(t)){let D;if(t.lte===void 0&&(D="lte")){let O={};o===null?o=[O]:o.push(O),s++}}var f=T===s;if(f)return Jo.errors=[{instancePath:e,schemaPath:"#/dependencies/lt/not",keyword:"not",params:{},message:"must NOT be valid"}],!1;s=A,o!==null&&(A?o.length=A:o=null);var c=v===s}else var c=!0;if(c){if(t.lte!==void 0){let v=s,A=s,T=s;if(t&&typeof t=="object"&&!Array.isArray(t)){let D;if(t.lt===void 0&&(D="lt")){let O={};o===null?o=[O]:o.push(O),s++}}var u=T===s;if(u)return Jo.errors=[{instancePath:e,schemaPath:"#/dependencies/lte/not",keyword:"not",params:{},message:"must NOT be valid"}],!1;s=A,o!==null&&(A?o.length=A:o=null);var c=v===s}else var c=!0;if(c){if(t.gt!==void 0){let v=t.gt,A=s;if(!(typeof v=="number"&&isFinite(v)))return Jo.errors=[{instancePath:e+"/gt",schemaPath:"#/properties/gt/type",keyword:"type",params:{type:"number"},message:"must be number"}],!1;var m=A===s}else var m=!0;if(m){if(t.gte!==void 0){let v=t.gte,A=s;if(!(typeof v=="number"&&isFinite(v)))return Jo.errors=[{instancePath:e+"/gte",schemaPath:"#/properties/gte/type",keyword:"type",params:{type:"number"},message:"must be number"}],!1;var m=A===s}else var m=!0;if(m){if(t.lt!==void 0){let v=t.lt,A=s;if(!(typeof v=="number"&&isFinite(v)))return Jo.errors=[{instancePath:e+"/lt",schemaPath:"#/properties/lt/type",keyword:"type",params:{type:"number"},message:"must be number"}],!1;var m=A===s}else var m=!0;if(m)if(t.lte!==void 0){let v=t.lte,A=s;if(!(typeof v=="number"&&isFinite(v)))return Jo.errors=[{instancePath:e+"/lte",schemaPath:"#/properties/lte/type",keyword:"type",params:{type:"number"},message:"must be number"}],!1;var m=A===s}else var m=!0}}}}}}}}}else return Jo.errors=[{instancePath:e,schemaPath:"#/type",keyword:"type",params:{type:"object"},message:"must be object"}],!1;return Jo.errors=o,s===0}var ace=k4;function k4(t,{instancePath:e="",parentData:r,parentDataProperty:n,rootData:i=t}={}){let o=null,s=0;return t&&typeof t=="object"&&!Array.isArray(t)?(k4.errors=o,s===0):(k4.errors=[{instancePath:e,schemaPath:"#/type",keyword:"type",params:{type:"object"},message:"must be object"}],!1)}var cce=zt,dce=Nr,P4={$schema:"http://json-schema.org/draft-07/schema#",$id:"https://identity.foundation/dwn/json-schemas/permissions-request.json",additionalProperties:!1,type:"object",required:["authorization","descriptor"],properties:{authorization:{$ref:"https://identity.foundation/dwn/json-schemas/authorization.json"},descriptor:{type:"object",additionalProperties:!1,required:["interface","method","messageTimestamp","grantedBy","grantedTo","grantedFor","scope"],properties:{interface:{enum:["Permissions"],type:"string"},method:{enum:["Request"],type:"string"},messageTimestamp:{$ref:"https://identity.foundation/dwn/json-schemas/defs.json#/definitions/date-time"},description:{type:"string"},grantedTo:{description:"DID of the grantee",$ref:"https://identity.foundation/dwn/json-schemas/permissions/defs.json#/definitions/grantedTo"},grantedBy:{description:"DID of the grantor",$ref:"https://identity.foundation/dwn/json-schemas/permissions/defs.json#/definitions/grantedBy"},grantedFor:{description:"DID of the DWN to which the grantee is given access",$ref:"https://identity.foundation/dwn/json-schemas/permissions/defs.json#/definitions/grantedFor"},scope:{$ref:"https://identity.foundation/dwn/json-schemas/permissions/defs.json#/definitions/scope"},conditions:{$ref:"https://identity.foundation/dwn/json-schemas/permissions/defs.json#/definitions/conditions"}}}}};function $g(t,{instancePath:e="",parentData:r,parentDataProperty:n,rootData:i=t}={}){let o=null,s=0,a=s,c=!1,d=null,f=s;if(s===s)if(t&&typeof t=="object"&&!Array.isArray(t)){if(t.interface!==void 0){let O=s;if(t.interface!=="Protocols"){let U={instancePath:e+"/interface",schemaPath:"https://identity.foundation/dwn/json-schemas/permissions/scopes.json#/definitions/protocols-query-scope/properties/interface/const",keyword:"const",params:{allowedValue:"Protocols"},message:"must be equal to constant"};o===null?o=[U]:o.push(U),s++}var m=O===s}else var m=!0;if(m)if(t.method!==void 0){let O=s;if(t.method!=="Query"){let L={instancePath:e+"/method",schemaPath:"https://identity.foundation/dwn/json-schemas/permissions/scopes.json#/definitions/protocols-query-scope/properties/method/const",keyword:"const",params:{allowedValue:"Query"},message:"must be equal to constant"};o===null?o=[L]:o.push(L),s++}var m=O===s}else var m=!0}else{let O={instancePath:e,schemaPath:"https://identity.foundation/dwn/json-schemas/permissions/scopes.json#/definitions/protocols-query-scope/type",keyword:"type",params:{type:"object"},message:"must be object"};o===null?o=[O]:o.push(O),s++}var T=f===s;T&&(c=!0,d=0);let _=s;if(s===s)if(t&&typeof t=="object"&&!Array.isArray(t)){let O;if(t.interface===void 0&&(O="interface")||t.method===void 0&&(O="method")){let U={instancePath:e,schemaPath:"https://identity.foundation/dwn/json-schemas/permissions/scopes.json#/definitions/records-read-scope/required",keyword:"required",params:{missingProperty:O},message:"must have required property '"+O+"'"};o===null?o=[U]:o.push(U),s++}else{if(t.interface!==void 0){let U=s;if(t.interface!=="Records"){let L={instancePath:e+"/interface",schemaPath:"https://identity.foundation/dwn/json-schemas/permissions/scopes.json#/definitions/records-read-scope/properties/interface/const",keyword:"const",params:{allowedValue:"Records"},message:"must be equal to constant"};o===null?o=[L]:o.push(L),s++}var A=U===s}else var A=!0;if(A){if(t.method!==void 0){let U=s;if(t.method!=="Read"){let F={instancePath:e+"/method",schemaPath:"https://identity.foundation/dwn/json-schemas/permissions/scopes.json#/definitions/records-read-scope/properties/method/const",keyword:"const",params:{allowedValue:"Read"},message:"must be equal to constant"};o===null?o=[F]:o.push(F),s++}var A=U===s}else var A=!0;if(A){if(t.schema!==void 0){let U=s;if(typeof t.schema!="string"){let F={instancePath:e+"/schema",schemaPath:"https://identity.foundation/dwn/json-schemas/permissions/scopes.json#/definitions/records-read-scope/properties/schema/type",keyword:"type",params:{type:"string"},message:"must be string"};o===null?o=[F]:o.push(F),s++}var A=U===s}else var A=!0;if(A){if(t.protocol!==void 0){let U=s;if(typeof t.protocol!="string"){let F={instancePath:e+"/protocol",schemaPath:"https://identity.foundation/dwn/json-schemas/permissions/scopes.json#/definitions/records-read-scope/properties/protocol/type",keyword:"type",params:{type:"string"},message:"must be string"};o===null?o=[F]:o.push(F),s++}var A=U===s}else var A=!0;if(A){if(t.contextId!==void 0){let U=s;if(typeof t.contextId!="string"){let F={instancePath:e+"/contextId",schemaPath:"https://identity.foundation/dwn/json-schemas/permissions/scopes.json#/definitions/records-read-scope/properties/contextId/type",keyword:"type",params:{type:"string"},message:"must be string"};o===null?o=[F]:o.push(F),s++}var A=U===s}else var A=!0;if(A)if(t.protocolPath!==void 0){let U=s;if(typeof t.protocolPath!="string"){let F={instancePath:e+"/protocolPath",schemaPath:"https://identity.foundation/dwn/json-schemas/permissions/scopes.json#/definitions/records-read-scope/properties/protocolPath/type",keyword:"type",params:{type:"string"},message:"must be string"};o===null?o=[F]:o.push(F),s++}var A=U===s}else var A=!0}}}}}}else{let O={instancePath:e,schemaPath:"https://identity.foundation/dwn/json-schemas/permissions/scopes.json#/definitions/records-read-scope/type",keyword:"type",params:{type:"object"},message:"must be object"};o===null?o=[O]:o.push(O),s++}var T=_===s;if(T&&c)c=!1,d=[d,1];else{T&&(c=!0,d=1);let O=s;if(s===s)if(t&&typeof t=="object"&&!Array.isArray(t)){let F;if(t.interface===void 0&&(F="interface")||t.method===void 0&&(F="method")){let $={instancePath:e,schemaPath:"https://identity.foundation/dwn/json-schemas/permissions/scopes.json#/definitions/records-delete-scope/required",keyword:"required",params:{missingProperty:F},message:"must have required property '"+F+"'"};o===null?o=[$]:o.push($),s++}else{if(t.interface!==void 0){let $=s;if(t.interface!=="Records"){let H={instancePath:e+"/interface",schemaPath:"https://identity.foundation/dwn/json-schemas/permissions/scopes.json#/definitions/records-delete-scope/properties/interface/const",keyword:"const",params:{allowedValue:"Records"},message:"must be equal to constant"};o===null?o=[H]:o.push(H),s++}var M=$===s}else var M=!0;if(M){if(t.method!==void 0){let $=s;if(t.method!=="Delete"){let z={instancePath:e+"/method",schemaPath:"https://identity.foundation/dwn/json-schemas/permissions/scopes.json#/definitions/records-delete-scope/properties/method/const",keyword:"const",params:{allowedValue:"Delete"},message:"must be equal to constant"};o===null?o=[z]:o.push(z),s++}var M=$===s}else var M=!0;if(M)if(t.schema!==void 0){let $=s;if(typeof t.schema!="string"){let z={instancePath:e+"/schema",schemaPath:"https://identity.foundation/dwn/json-schemas/permissions/scopes.json#/definitions/records-delete-scope/properties/schema/type",keyword:"type",params:{type:"string"},message:"must be string"};o===null?o=[z]:o.push(z),s++}var M=$===s}else var M=!0}}}else{let F={instancePath:e,schemaPath:"https://identity.foundation/dwn/json-schemas/permissions/scopes.json#/definitions/records-delete-scope/type",keyword:"type",params:{type:"object"},message:"must be object"};o===null?o=[F]:o.push(F),s++}var T=O===s;if(T&&c)c=!1,d=[d,2];else{T&&(c=!0,d=2);let F=s;if(s===s)if(t&&typeof t=="object"&&!Array.isArray(t)){let z;if(t.interface===void 0&&(z="interface")||t.method===void 0&&(z="method")){let j={instancePath:e,schemaPath:"https://identity.foundation/dwn/json-schemas/permissions/scopes.json#/definitions/records-write-scope/required",keyword:"required",params:{missingProperty:z},message:"must have required property '"+z+"'"};o===null?o=[j]:o.push(j),s++}else{if(t.interface!==void 0){let j=s;if(t.interface!=="Records"){let y={instancePath:e+"/interface",schemaPath:"https://identity.foundation/dwn/json-schemas/permissions/scopes.json#/definitions/records-write-scope/properties/interface/const",keyword:"const",params:{allowedValue:"Records"},message:"must be equal to constant"};o===null?o=[y]:o.push(y),s++}var D=j===s}else var D=!0;if(D){if(t.method!==void 0){let j=s;if(t.method!=="Write"){let P={instancePath:e+"/method",schemaPath:"https://identity.foundation/dwn/json-schemas/permissions/scopes.json#/definitions/records-write-scope/properties/method/const",keyword:"const",params:{allowedValue:"Write"},message:"must be equal to constant"};o===null?o=[P]:o.push(P),s++}var D=j===s}else var D=!0;if(D){if(t.schema!==void 0){let j=s;if(typeof t.schema!="string"){let P={instancePath:e+"/schema",schemaPath:"https://identity.foundation/dwn/json-schemas/permissions/scopes.json#/definitions/records-write-scope/properties/schema/type",keyword:"type",params:{type:"string"},message:"must be string"};o===null?o=[P]:o.push(P),s++}var D=j===s}else var D=!0;if(D){if(t.protocol!==void 0){let j=s;if(typeof t.protocol!="string"){let P={instancePath:e+"/protocol",schemaPath:"https://identity.foundation/dwn/json-schemas/permissions/scopes.json#/definitions/records-write-scope/properties/protocol/type",keyword:"type",params:{type:"string"},message:"must be string"};o===null?o=[P]:o.push(P),s++}var D=j===s}else var D=!0;if(D){if(t.contextId!==void 0){let j=s;if(typeof t.contextId!="string"){let P={instancePath:e+"/contextId",schemaPath:"https://identity.foundation/dwn/json-schemas/permissions/scopes.json#/definitions/records-write-scope/properties/contextId/type",keyword:"type",params:{type:"string"},message:"must be string"};o===null?o=[P]:o.push(P),s++}var D=j===s}else var D=!0;if(D)if(t.protocolPath!==void 0){let j=s;if(typeof t.protocolPath!="string"){let P={instancePath:e+"/protocolPath",schemaPath:"https://identity.foundation/dwn/json-schemas/permissions/scopes.json#/definitions/records-write-scope/properties/protocolPath/type",keyword:"type",params:{type:"string"},message:"must be string"};o===null?o=[P]:o.push(P),s++}var D=j===s}else var D=!0}}}}}}else{let z={instancePath:e,schemaPath:"https://identity.foundation/dwn/json-schemas/permissions/scopes.json#/definitions/records-write-scope/type",keyword:"type",params:{type:"object"},message:"must be object"};o===null?o=[z]:o.push(z),s++}var T=F===s;T&&c?(c=!1,d=[d,3]):T&&(c=!0,d=3)}}if(c)s=a,o!==null&&(a?o.length=a:o=null);else{let O={instancePath:e,schemaPath:"#/oneOf",keyword:"oneOf",params:{passingSchemas:d},message:"must match exactly one schema in oneOf"};return o===null?o=[O]:o.push(O),s++,$g.errors=o,!1}return $g.errors=o,s===0}function Nr(t,{instancePath:e="",parentData:r,parentDataProperty:n,rootData:i=t}={}){let o=null,s=0;if(s===0)if(t&&typeof t=="object"&&!Array.isArray(t)){let d;if(t.authorization===void 0&&(d="authorization")||t.descriptor===void 0&&(d="descriptor"))return Nr.errors=[{instancePath:e,schemaPath:"#/required",keyword:"required",params:{missingProperty:d},message:"must have required property '"+d+"'"}],!1;{let f=s;for(let u in t)if(!(u==="authorization"||u==="descriptor")){return Nr.errors=[{instancePath:e,schemaPath:"#/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:u},message:"must NOT have additional properties"}],!1;break}if(f===s){if(t.authorization!==void 0){let u=s;qr(t.authorization,{instancePath:e+"/authorization",parentData:t,parentDataProperty:"authorization",rootData:i})||(o=o===null?qr.errors:o.concat(qr.errors),s=o.length);var a=u===s}else var a=!0;if(a)if(t.descriptor!==void 0){let u=t.descriptor,m=s;if(s===m)if(u&&typeof u=="object"&&!Array.isArray(u)){let v;if(u.interface===void 0&&(v="interface")||u.method===void 0&&(v="method")||u.messageTimestamp===void 0&&(v="messageTimestamp")||u.grantedBy===void 0&&(v="grantedBy")||u.grantedTo===void 0&&(v="grantedTo")||u.grantedFor===void 0&&(v="grantedFor")||u.scope===void 0&&(v="scope"))return Nr.errors=[{instancePath:e+"/descriptor",schemaPath:"#/properties/descriptor/required",keyword:"required",params:{missingProperty:v},message:"must have required property '"+v+"'"}],!1;{let A=s;for(let T in u)if(!Dw.call(P4.properties.descriptor.properties,T)){return Nr.errors=[{instancePath:e+"/descriptor",schemaPath:"#/properties/descriptor/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:T},message:"must NOT have additional properties"}],!1;break}if(A===s){if(u.interface!==void 0){let T=u.interface,M=s;if(typeof T!="string")return Nr.errors=[{instancePath:e+"/descriptor/interface",schemaPath:"#/properties/descriptor/properties/interface/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;if(T!=="Permissions")return Nr.errors=[{instancePath:e+"/descriptor/interface",schemaPath:"#/properties/descriptor/properties/interface/enum",keyword:"enum",params:{allowedValues:P4.properties.descriptor.properties.interface.enum},message:"must be equal to one of the allowed values"}],!1;var c=M===s}else var c=!0;if(c){if(u.method!==void 0){let T=u.method,M=s;if(typeof T!="string")return Nr.errors=[{instancePath:e+"/descriptor/method",schemaPath:"#/properties/descriptor/properties/method/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;if(T!=="Request")return Nr.errors=[{instancePath:e+"/descriptor/method",schemaPath:"#/properties/descriptor/properties/method/enum",keyword:"enum",params:{allowedValues:P4.properties.descriptor.properties.method.enum},message:"must be equal to one of the allowed values"}],!1;var c=M===s}else var c=!0;if(c){if(u.messageTimestamp!==void 0){let T=u.messageTimestamp,M=s;if(s===s)if(typeof T=="string"){if(!Cn.test(T))return Nr.errors=[{instancePath:e+"/descriptor/messageTimestamp",schemaPath:"https://identity.foundation/dwn/json-schemas/defs.json#/definitions/date-time/pattern",keyword:"pattern",params:{pattern:"^\\d{4}-[0-1]\\d-[0-3]\\dT(?:[0-2]\\d:[0-5]\\d:[0-5]\\d|23:59:60)\\.\\d{6}Z$"},message:'must match pattern "^\\d{4}-[0-1]\\d-[0-3]\\dT(?:[0-2]\\d:[0-5]\\d:[0-5]\\d|23:59:60)\\.\\d{6}Z$"'}],!1}else return Nr.errors=[{instancePath:e+"/descriptor/messageTimestamp",schemaPath:"https://identity.foundation/dwn/json-schemas/defs.json#/definitions/date-time/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var c=M===s}else var c=!0;if(c){if(u.description!==void 0){let T=s;if(typeof u.description!="string")return Nr.errors=[{instancePath:e+"/descriptor/description",schemaPath:"#/properties/descriptor/properties/description/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var c=T===s}else var c=!0;if(c){if(u.grantedTo!==void 0){let T=u.grantedTo,M=s;if(s===s)if(typeof T=="string"){if(!ks.test(T))return Nr.errors=[{instancePath:e+"/descriptor/grantedTo",schemaPath:"https://identity.foundation/dwn/json-schemas/permissions/defs.json#/definitions/grantedTo/pattern",keyword:"pattern",params:{pattern:"^did:([a-z0-9]+):((?:(?:[a-zA-Z0-9._-]|(?:%[0-9a-fA-F]{2}))*:)*((?:[a-zA-Z0-9._-]|(?:%[0-9a-fA-F]{2}))+))((;[a-zA-Z0-9_.:%-]+=[a-zA-Z0-9_.:%-]*)*)(/[^#?]*)?([?][^#]*)?(#.*)?$"},message:'must match pattern "^did:([a-z0-9]+):((?:(?:[a-zA-Z0-9._-]|(?:%[0-9a-fA-F]{2}))*:)*((?:[a-zA-Z0-9._-]|(?:%[0-9a-fA-F]{2}))+))((;[a-zA-Z0-9_.:%-]+=[a-zA-Z0-9_.:%-]*)*)(/[^#?]*)?([?][^#]*)?(#.*)?$"'}],!1}else return Nr.errors=[{instancePath:e+"/descriptor/grantedTo",schemaPath:"https://identity.foundation/dwn/json-schemas/permissions/defs.json#/definitions/grantedTo/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var c=M===s}else var c=!0;if(c){if(u.grantedBy!==void 0){let T=u.grantedBy,M=s;if(s===s)if(typeof T=="string"){if(!ks.test(T))return Nr.errors=[{instancePath:e+"/descriptor/grantedBy",schemaPath:"https://identity.foundation/dwn/json-schemas/permissions/defs.json#/definitions/grantedBy/pattern",keyword:"pattern",params:{pattern:"^did:([a-z0-9]+):((?:(?:[a-zA-Z0-9._-]|(?:%[0-9a-fA-F]{2}))*:)*((?:[a-zA-Z0-9._-]|(?:%[0-9a-fA-F]{2}))+))((;[a-zA-Z0-9_.:%-]+=[a-zA-Z0-9_.:%-]*)*)(/[^#?]*)?([?][^#]*)?(#.*)?$"},message:'must match pattern "^did:([a-z0-9]+):((?:(?:[a-zA-Z0-9._-]|(?:%[0-9a-fA-F]{2}))*:)*((?:[a-zA-Z0-9._-]|(?:%[0-9a-fA-F]{2}))+))((;[a-zA-Z0-9_.:%-]+=[a-zA-Z0-9_.:%-]*)*)(/[^#?]*)?([?][^#]*)?(#.*)?$"'}],!1}else return Nr.errors=[{instancePath:e+"/descriptor/grantedBy",schemaPath:"https://identity.foundation/dwn/json-schemas/permissions/defs.json#/definitions/grantedBy/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var c=M===s}else var c=!0;if(c){if(u.grantedFor!==void 0){let T=u.grantedFor,M=s;if(s===s)if(typeof T=="string"){if(!ks.test(T))return Nr.errors=[{instancePath:e+"/descriptor/grantedFor",schemaPath:"https://identity.foundation/dwn/json-schemas/permissions/defs.json#/definitions/grantedFor/pattern",keyword:"pattern",params:{pattern:"^did:([a-z0-9]+):((?:(?:[a-zA-Z0-9._-]|(?:%[0-9a-fA-F]{2}))*:)*((?:[a-zA-Z0-9._-]|(?:%[0-9a-fA-F]{2}))+))((;[a-zA-Z0-9_.:%-]+=[a-zA-Z0-9_.:%-]*)*)(/[^#?]*)?([?][^#]*)?(#.*)?$"},message:'must match pattern "^did:([a-z0-9]+):((?:(?:[a-zA-Z0-9._-]|(?:%[0-9a-fA-F]{2}))*:)*((?:[a-zA-Z0-9._-]|(?:%[0-9a-fA-F]{2}))+))((;[a-zA-Z0-9_.:%-]+=[a-zA-Z0-9_.:%-]*)*)(/[^#?]*)?([?][^#]*)?(#.*)?$"'}],!1}else return Nr.errors=[{instancePath:e+"/descriptor/grantedFor",schemaPath:"https://identity.foundation/dwn/json-schemas/permissions/defs.json#/definitions/grantedFor/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var c=M===s}else var c=!0;if(c){if(u.scope!==void 0){let T=s;$g(u.scope,{instancePath:e+"/descriptor/scope",parentData:u,parentDataProperty:"scope",rootData:i})||(o=o===null?$g.errors:o.concat($g.errors),s=o.length);var c=T===s}else var c=!0;if(c)if(u.conditions!==void 0){let T=u.conditions,M=s;if(s===s)if(T&&typeof T=="object"&&!Array.isArray(T)){let U=s;for(let L in T)if(L!=="publication"){return Nr.errors=[{instancePath:e+"/descriptor/conditions",schemaPath:"https://identity.foundation/dwn/json-schemas/permissions/defs.json#/definitions/conditions/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:L},message:"must NOT have additional properties"}],!1;break}if(U===s&&T.publication!==void 0){let L=T.publication;if(typeof L!="string")return Nr.errors=[{instancePath:e+"/descriptor/conditions/publication",schemaPath:"https://identity.foundation/dwn/json-schemas/permissions/defs.json#/definitions/conditions/properties/publication/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;if(!(L==="Required"||L==="Prohibited"))return Nr.errors=[{instancePath:e+"/descriptor/conditions/publication",schemaPath:"https://identity.foundation/dwn/json-schemas/permissions/defs.json#/definitions/conditions/properties/publication/enum",keyword:"enum",params:{allowedValues:vC.properties.publication.enum},message:"must be equal to one of the allowed values"}],!1}}else return Nr.errors=[{instancePath:e+"/descriptor/conditions",schemaPath:"https://identity.foundation/dwn/json-schemas/permissions/defs.json#/definitions/conditions/type",keyword:"type",params:{type:"object"},message:"must be object"}],!1;var c=M===s}else var c=!0}}}}}}}}}}else return Nr.errors=[{instancePath:e+"/descriptor",schemaPath:"#/properties/descriptor/type",keyword:"type",params:{type:"object"},message:"must be object"}],!1;var a=m===s}else var a=!0}}}else return Nr.errors=[{instancePath:e,schemaPath:"#/type",keyword:"type",params:{type:"object"},message:"must be object"}],!1;return Nr.errors=o,s===0}var fce=no,hC={$schema:"http://json-schema.org/draft-07/schema#",$id:"https://identity.foundation/dwn/json-schemas/permissions-revoke.json",type:"object",required:["authorization","descriptor"],additionalProperties:!1,properties:{authorization:{$ref:"https://identity.foundation/dwn/json-schemas/authorization.json"},descriptor:{type:"object",additionalProperties:!1,required:["interface","method","messageTimestamp","permissionsGrantId"],properties:{messageTimestamp:{$ref:"https://identity.foundation/dwn/json-schemas/defs.json#/definitions/date-time"},permissionsGrantId:{type:"string"},interface:{enum:["Permissions"],type:"string"},method:{enum:["Revoke"],type:"string"}}}}};function no(t,{instancePath:e="",parentData:r,parentDataProperty:n,rootData:i=t}={}){let o=null,s=0;if(s===0)if(t&&typeof t=="object"&&!Array.isArray(t)){let d;if(t.authorization===void 0&&(d="authorization")||t.descriptor===void 0&&(d="descriptor"))return no.errors=[{instancePath:e,schemaPath:"#/required",keyword:"required",params:{missingProperty:d},message:"must have required property '"+d+"'"}],!1;{let f=s;for(let u in t)if(!(u==="authorization"||u==="descriptor")){return no.errors=[{instancePath:e,schemaPath:"#/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:u},message:"must NOT have additional properties"}],!1;break}if(f===s){if(t.authorization!==void 0){let u=s;qr(t.authorization,{instancePath:e+"/authorization",parentData:t,parentDataProperty:"authorization",rootData:i})||(o=o===null?qr.errors:o.concat(qr.errors),s=o.length);var a=u===s}else var a=!0;if(a)if(t.descriptor!==void 0){let u=t.descriptor,m=s;if(s===m)if(u&&typeof u=="object"&&!Array.isArray(u)){let v;if(u.interface===void 0&&(v="interface")||u.method===void 0&&(v="method")||u.messageTimestamp===void 0&&(v="messageTimestamp")||u.permissionsGrantId===void 0&&(v="permissionsGrantId"))return no.errors=[{instancePath:e+"/descriptor",schemaPath:"#/properties/descriptor/required",keyword:"required",params:{missingProperty:v},message:"must have required property '"+v+"'"}],!1;{let A=s;for(let T in u)if(!(T==="messageTimestamp"||T==="permissionsGrantId"||T==="interface"||T==="method")){return no.errors=[{instancePath:e+"/descriptor",schemaPath:"#/properties/descriptor/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:T},message:"must NOT have additional properties"}],!1;break}if(A===s){if(u.messageTimestamp!==void 0){let T=u.messageTimestamp,M=s;if(s===s)if(typeof T=="string"){if(!Cn.test(T))return no.errors=[{instancePath:e+"/descriptor/messageTimestamp",schemaPath:"https://identity.foundation/dwn/json-schemas/defs.json#/definitions/date-time/pattern",keyword:"pattern",params:{pattern:"^\\d{4}-[0-1]\\d-[0-3]\\dT(?:[0-2]\\d:[0-5]\\d:[0-5]\\d|23:59:60)\\.\\d{6}Z$"},message:'must match pattern "^\\d{4}-[0-1]\\d-[0-3]\\dT(?:[0-2]\\d:[0-5]\\d:[0-5]\\d|23:59:60)\\.\\d{6}Z$"'}],!1}else return no.errors=[{instancePath:e+"/descriptor/messageTimestamp",schemaPath:"https://identity.foundation/dwn/json-schemas/defs.json#/definitions/date-time/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var c=M===s}else var c=!0;if(c){if(u.permissionsGrantId!==void 0){let T=s;if(typeof u.permissionsGrantId!="string")return no.errors=[{instancePath:e+"/descriptor/permissionsGrantId",schemaPath:"#/properties/descriptor/properties/permissionsGrantId/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var c=T===s}else var c=!0;if(c){if(u.interface!==void 0){let T=u.interface,M=s;if(typeof T!="string")return no.errors=[{instancePath:e+"/descriptor/interface",schemaPath:"#/properties/descriptor/properties/interface/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;if(T!=="Permissions")return no.errors=[{instancePath:e+"/descriptor/interface",schemaPath:"#/properties/descriptor/properties/interface/enum",keyword:"enum",params:{allowedValues:hC.properties.descriptor.properties.interface.enum},message:"must be equal to one of the allowed values"}],!1;var c=M===s}else var c=!0;if(c)if(u.method!==void 0){let T=u.method,M=s;if(typeof T!="string")return no.errors=[{instancePath:e+"/descriptor/method",schemaPath:"#/properties/descriptor/properties/method/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;if(T!=="Revoke")return no.errors=[{instancePath:e+"/descriptor/method",schemaPath:"#/properties/descriptor/properties/method/enum",keyword:"enum",params:{allowedValues:hC.properties.descriptor.properties.method.enum},message:"must be equal to one of the allowed values"}],!1;var c=M===s}else var c=!0}}}}}else return no.errors=[{instancePath:e+"/descriptor",schemaPath:"#/properties/descriptor/type",keyword:"type",params:{type:"object"},message:"must be object"}],!1;var a=m===s}else var a=!0}}}else return no.errors=[{instancePath:e,schemaPath:"#/type",keyword:"type",params:{type:"object"},message:"must be object"}],!1;return no.errors=o,s===0}var uce=B4;function B4(t,{instancePath:e="",parentData:r,parentDataProperty:n,rootData:i=t}={}){let o=null,s=0;return t&&typeof t=="object"&&!Array.isArray(t)?(B4.errors=o,s===0):(B4.errors=[{instancePath:e,schemaPath:"#/type",keyword:"type",params:{type:"object"},message:"must be object"}],!1)}var lce=Wn;var pC=new RegExp(".*","u"),I4={$id:"https://identity.foundation/dwn/json-schemas/protocol-rule-set.json",$schema:"http://json-schema.org/draft-07/schema#",type:"object",additionalProperties:!1,properties:{$encryption:{type:"object",additionalProperties:!1,properties:{rootKeyId:{type:"string"},publicKeyJwk:{$ref:"https://identity.foundation/dwn/json-schemas/public-jwk.json"}}},$actions:{type:"array",minItems:1,items:{type:"object",oneOf:[{required:["who","can"],additionalProperties:!1,properties:{who:{type:"string",enum:["anyone","author","recipient"]},of:{type:"string"},can:{type:"string",enum:["delete","read","update","write"]}}},{required:["role","can"],properties:{role:{$comment:"Must be the protocol path of a record with either $globalRole or $contextRole set to true",type:"string"},can:{type:"string",enum:["delete","query","read","update","write"]}}}]}},$globalRole:{$comment:"When `true`, this turns a record into `role` that may be used across contexts",type:"boolean"},$contextRole:{$comment:"When `true`, this turns a record into `role` that may be used within a context",type:"boolean"}},patternProperties:{"^[^$].*":{$ref:"https://identity.foundation/dwn/json-schemas/protocol-rule-set.json"}}},mC=new RegExp("^[^$].*","u"),R4={validate:ui};function ui(t,{instancePath:e="",parentData:r,parentDataProperty:n,rootData:i=t}={}){let o=null,s=0;if(s===0)if(t&&typeof t=="object"&&!Array.isArray(t)){let v=s;for(let A in t)if(!(A==="$encryption"||A==="$actions"||A==="$globalRole"||A==="$contextRole"||mC.test(A))){return ui.errors=[{instancePath:e,schemaPath:"#/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:A},message:"must NOT have additional properties"}],!1;break}if(v===s){if(t.$encryption!==void 0){let A=t.$encryption,T=s;if(s===T)if(A&&typeof A=="object"&&!Array.isArray(A)){let M=s;for(let D in A)if(!(D==="rootKeyId"||D==="publicKeyJwk")){return ui.errors=[{instancePath:e+"/$encryption",schemaPath:"#/properties/%24encryption/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:D},message:"must NOT have additional properties"}],!1;break}if(M===s){if(A.rootKeyId!==void 0){let D=s;if(typeof A.rootKeyId!="string")return ui.errors=[{instancePath:e+"/$encryption/rootKeyId",schemaPath:"#/properties/%24encryption/properties/rootKeyId/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var a=D===s}else var a=!0;if(a)if(A.publicKeyJwk!==void 0){let D=s;br(A.publicKeyJwk,{instancePath:e+"/$encryption/publicKeyJwk",parentData:A,parentDataProperty:"publicKeyJwk",rootData:i})||(o=o===null?br.errors:o.concat(br.errors),s=o.length);var a=D===s}else var a=!0}}else return ui.errors=[{instancePath:e+"/$encryption",schemaPath:"#/properties/%24encryption/type",keyword:"type",params:{type:"object"},message:"must be object"}],!1;var c=T===s}else var c=!0;if(c){if(t.$actions!==void 0){let A=t.$actions,T=s;if(s===T)if(Array.isArray(A)){if(A.length<1)return ui.errors=[{instancePath:e+"/$actions",schemaPath:"#/properties/%24actions/minItems",keyword:"minItems",params:{limit:1},message:"must NOT have fewer than 1 items"}],!1;{var d=!0;let D=A.length;for(let O=0;O<D;O++){let U=A[O],L=s;if(!(U&&typeof U=="object"&&!Array.isArray(U)))return ui.errors=[{instancePath:e+"/$actions/"+O,schemaPath:"#/properties/%24actions/items/type",keyword:"type",params:{type:"object"},message:"must be object"}],!1;let F=s,$=!1,H=null,z=s;if(U&&typeof U=="object"&&!Array.isArray(U)){let P;if(U.who===void 0&&(P="who")||U.can===void 0&&(P="can")){let x={instancePath:e+"/$actions/"+O,schemaPath:"#/properties/%24actions/items/oneOf/0/required",keyword:"required",params:{missingProperty:P},message:"must have required property '"+P+"'"};o===null?o=[x]:o.push(x),s++}else{let x=s;for(let l in U)if(!(l==="who"||l==="of"||l==="can")){let b={instancePath:e+"/$actions/"+O,schemaPath:"#/properties/%24actions/items/oneOf/0/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:l},message:"must NOT have additional properties"};o===null?o=[b]:o.push(b),s++;break}if(x===s){if(U.who!==void 0){let l=U.who,b=s;if(typeof l!="string"){let h={instancePath:e+"/$actions/"+O+"/who",schemaPath:"#/properties/%24actions/items/oneOf/0/properties/who/type",keyword:"type",params:{type:"string"},message:"must be string"};o===null?o=[h]:o.push(h),s++}if(!(l==="anyone"||l==="author"||l==="recipient")){let h={instancePath:e+"/$actions/"+O+"/who",schemaPath:"#/properties/%24actions/items/oneOf/0/properties/who/enum",keyword:"enum",params:{allowedValues:I4.properties.$actions.items.oneOf[0].properties.who.enum},message:"must be equal to one of the allowed values"};o===null?o=[h]:o.push(h),s++}var f=b===s}else var f=!0;if(f){if(U.of!==void 0){let l=s;if(typeof U.of!="string"){let h={instancePath:e+"/$actions/"+O+"/of",schemaPath:"#/properties/%24actions/items/oneOf/0/properties/of/type",keyword:"type",params:{type:"string"},message:"must be string"};o===null?o=[h]:o.push(h),s++}var f=l===s}else var f=!0;if(f)if(U.can!==void 0){let l=U.can,b=s;if(typeof l!="string"){let w={instancePath:e+"/$actions/"+O+"/can",schemaPath:"#/properties/%24actions/items/oneOf/0/properties/can/type",keyword:"type",params:{type:"string"},message:"must be string"};o===null?o=[w]:o.push(w),s++}if(!(l==="delete"||l==="read"||l==="update"||l==="write")){let w={instancePath:e+"/$actions/"+O+"/can",schemaPath:"#/properties/%24actions/items/oneOf/0/properties/can/enum",keyword:"enum",params:{allowedValues:I4.properties.$actions.items.oneOf[0].properties.can.enum},message:"must be equal to one of the allowed values"};o===null?o=[w]:o.push(w),s++}var f=b===s}else var f=!0}}}}var m=z===s;m&&($=!0,H=0);let j=s;if(U&&typeof U=="object"&&!Array.isArray(U)){let P;if(U.role===void 0&&(P="role")||U.can===void 0&&(P="can")){let x={instancePath:e+"/$actions/"+O,schemaPath:"#/properties/%24actions/items/oneOf/1/required",keyword:"required",params:{missingProperty:P},message:"must have required property '"+P+"'"};o===null?o=[x]:o.push(x),s++}else{if(U.role!==void 0){let x=s;if(typeof U.role!="string"){let l={instancePath:e+"/$actions/"+O+"/role",schemaPath:"#/properties/%24actions/items/oneOf/1/properties/role/type",keyword:"type",params:{type:"string"},message:"must be string"};o===null?o=[l]:o.push(l),s++}var u=x===s}else var u=!0;if(u)if(U.can!==void 0){let x=U.can,l=s;if(typeof x!="string"){let h={instancePath:e+"/$actions/"+O+"/can",schemaPath:"#/properties/%24actions/items/oneOf/1/properties/can/type",keyword:"type",params:{type:"string"},message:"must be string"};o===null?o=[h]:o.push(h),s++}if(!(x==="delete"||x==="query"||x==="read"||x==="update"||x==="write")){let h={instancePath:e+"/$actions/"+O+"/can",schemaPath:"#/properties/%24actions/items/oneOf/1/properties/can/enum",keyword:"enum",params:{allowedValues:I4.properties.$actions.items.oneOf[1].properties.can.enum},message:"must be equal to one of the allowed values"};o===null?o=[h]:o.push(h),s++}var u=l===s}else var u=!0}}var m=j===s;if(m&&$?($=!1,H=[H,1]):m&&($=!0,H=1),$)s=F,o!==null&&(F?o.length=F:o=null);else{let P={instancePath:e+"/$actions/"+O,schemaPath:"#/properties/%24actions/items/oneOf",keyword:"oneOf",params:{passingSchemas:H},message:"must match exactly one schema in oneOf"};return o===null?o=[P]:o.push(P),s++,ui.errors=o,!1}var d=L===s;if(!d)break}}}else return ui.errors=[{instancePath:e+"/$actions",schemaPath:"#/properties/%24actions/type",keyword:"type",params:{type:"array"},message:"must be array"}],!1;var c=T===s}else var c=!0;if(c){if(t.$globalRole!==void 0){let A=s;if(typeof t.$globalRole!="boolean")return ui.errors=[{instancePath:e+"/$globalRole",schemaPath:"#/properties/%24globalRole/type",keyword:"type",params:{type:"boolean"},message:"must be boolean"}],!1;var c=A===s}else var c=!0;if(c){if(t.$contextRole!==void 0){let A=s;if(typeof t.$contextRole!="boolean")return ui.errors=[{instancePath:e+"/$contextRole",schemaPath:"#/properties/%24contextRole/type",keyword:"type",params:{type:"boolean"},message:"must be boolean"}],!1;var c=A===s}else var c=!0;if(c){var _=!0;for(let A in t)if(mC.test(A)){let T=s;R4.validate(t[A],{instancePath:e+"/"+A.replace(/~/g,"~0").replace(/\//g,"~1"),parentData:t,parentDataProperty:A,rootData:i})||(o=o===null?R4.validate.errors:o.concat(R4.validate.errors),s=o.length);var _=T===s;if(!_)break}}}}}}}else return ui.errors=[{instancePath:e,schemaPath:"#/type",keyword:"type",params:{type:"object"},message:"must be object"}],!1;return ui.errors=o,s===0}function Wn(t,{instancePath:e="",parentData:r,parentDataProperty:n,rootData:i=t}={}){let o=null,s=0;if(s===0)if(t&&typeof t=="object"&&!Array.isArray(t)){let m;if(t.protocol===void 0&&(m="protocol")||t.published===void 0&&(m="published")||t.types===void 0&&(m="types")||t.structure===void 0&&(m="structure"))return Wn.errors=[{instancePath:e,schemaPath:"#/required",keyword:"required",params:{missingProperty:m},message:"must have required property '"+m+"'"}],!1;{let _=s;for(let v in t)if(!(v==="protocol"||v==="published"||v==="types"||v==="structure")){return Wn.errors=[{instancePath:e,schemaPath:"#/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:v},message:"must NOT have additional properties"}],!1;break}if(_===s){if(t.protocol!==void 0){let v=s;if(typeof t.protocol!="string")return Wn.errors=[{instancePath:e+"/protocol",schemaPath:"#/properties/protocol/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var a=v===s}else var a=!0;if(a){if(t.published!==void 0){let v=s;if(typeof t.published!="boolean")return Wn.errors=[{instancePath:e+"/published",schemaPath:"#/properties/published/type",keyword:"type",params:{type:"boolean"},message:"must be boolean"}],!1;var a=v===s}else var a=!0;if(a){if(t.types!==void 0){let v=t.types,A=s;if(s===A)if(v&&typeof v=="object"&&!Array.isArray(v)){var c=!0;for(let M in v)if(pC.test(M)){let D=v[M],O=s;if(s===O)if(D&&typeof D=="object"&&!Array.isArray(D)){let L=s;for(let F in D)if(!(F==="schema"||F==="dataFormats")){return Wn.errors=[{instancePath:e+"/types/"+M.replace(/~/g,"~0").replace(/\//g,"~1"),schemaPath:"#/properties/types/patternProperties/.*/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:F},message:"must NOT have additional properties"}],!1;break}if(L===s){if(D.schema!==void 0){let F=s;if(typeof D.schema!="string")return Wn.errors=[{instancePath:e+"/types/"+M.replace(/~/g,"~0").replace(/\//g,"~1")+"/schema",schemaPath:"#/properties/types/patternProperties/.*/properties/schema/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var d=F===s}else var d=!0;if(d)if(D.dataFormats!==void 0){let F=D.dataFormats,$=s;if(s===$)if(Array.isArray(F)){if(F.length<1)return Wn.errors=[{instancePath:e+"/types/"+M.replace(/~/g,"~0").replace(/\//g,"~1")+"/dataFormats",schemaPath:"#/properties/types/patternProperties/.*/properties/dataFormats/minItems",keyword:"minItems",params:{limit:1},message:"must NOT have fewer than 1 items"}],!1;{var f=!0;let z=F.length;for(let j=0;j<z;j++){let y=s;if(typeof F[j]!="string")return Wn.errors=[{instancePath:e+"/types/"+M.replace(/~/g,"~0").replace(/\//g,"~1")+"/dataFormats/"+j,schemaPath:"#/properties/types/patternProperties/.*/properties/dataFormats/items/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var f=y===s;if(!f)break}}}else return Wn.errors=[{instancePath:e+"/types/"+M.replace(/~/g,"~0").replace(/\//g,"~1")+"/dataFormats",schemaPath:"#/properties/types/patternProperties/.*/properties/dataFormats/type",keyword:"type",params:{type:"array"},message:"must be array"}],!1;var d=$===s}else var d=!0}}else return Wn.errors=[{instancePath:e+"/types/"+M.replace(/~/g,"~0").replace(/\//g,"~1"),schemaPath:"#/properties/types/patternProperties/.*/type",keyword:"type",params:{type:"object"},message:"must be object"}],!1;var c=O===s;if(!c)break}}else return Wn.errors=[{instancePath:e+"/types",schemaPath:"#/properties/types/type",keyword:"type",params:{type:"object"},message:"must be object"}],!1;var a=A===s}else var a=!0;if(a)if(t.structure!==void 0){let v=t.structure,A=s;if(s===A)if(v&&typeof v=="object"&&!Array.isArray(v)){var u=!0;for(let M in v)if(pC.test(M)){let D=s;ui(v[M],{instancePath:e+"/structure/"+M.replace(/~/g,"~0").replace(/\//g,"~1"),parentData:v,parentDataProperty:M,rootData:i})||(o=o===null?ui.errors:o.concat(ui.errors),s=o.length);var u=D===s;if(!u)break}}else return Wn.errors=[{instancePath:e+"/structure",schemaPath:"#/properties/structure/type",keyword:"type",params:{type:"object"},message:"must be object"}],!1;var a=A===s}else var a=!0}}}}}else return Wn.errors=[{instancePath:e,schemaPath:"#/type",keyword:"type",params:{type:"object"},message:"must be object"}],!1;return Wn.errors=o,s===0}var hce=ui,pce=Ao,yC={$schema:"http://json-schema.org/draft-07/schema#",$id:"https://identity.foundation/dwn/json-schemas/protocols-configure.json",type:"object",additionalProperties:!1,required:["authorization","descriptor"],properties:{authorization:{$ref:"https://identity.foundation/dwn/json-schemas/authorization.json"},descriptor:{type:"object",additionalProperties:!1,required:["interface","method","messageTimestamp","definition"],properties:{interface:{enum:["Protocols"],type:"string"},method:{enum:["Configure"],type:"string"},messageTimestamp:{$ref:"https://identity.foundation/dwn/json-schemas/defs.json#/definitions/date-time"},definition:{$ref:"https://identity.foundation/dwn/json-schemas/protocol-definition.json"}}}}};function Ao(t,{instancePath:e="",parentData:r,parentDataProperty:n,rootData:i=t}={}){let o=null,s=0;if(s===0)if(t&&typeof t=="object"&&!Array.isArray(t)){let d;if(t.authorization===void 0&&(d="authorization")||t.descriptor===void 0&&(d="descriptor"))return Ao.errors=[{instancePath:e,schemaPath:"#/required",keyword:"required",params:{missingProperty:d},message:"must have required property '"+d+"'"}],!1;{let f=s;for(let u in t)if(!(u==="authorization"||u==="descriptor")){return Ao.errors=[{instancePath:e,schemaPath:"#/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:u},message:"must NOT have additional properties"}],!1;break}if(f===s){if(t.authorization!==void 0){let u=s;qr(t.authorization,{instancePath:e+"/authorization",parentData:t,parentDataProperty:"authorization",rootData:i})||(o=o===null?qr.errors:o.concat(qr.errors),s=o.length);var a=u===s}else var a=!0;if(a)if(t.descriptor!==void 0){let u=t.descriptor,m=s;if(s===m)if(u&&typeof u=="object"&&!Array.isArray(u)){let v;if(u.interface===void 0&&(v="interface")||u.method===void 0&&(v="method")||u.messageTimestamp===void 0&&(v="messageTimestamp")||u.definition===void 0&&(v="definition"))return Ao.errors=[{instancePath:e+"/descriptor",schemaPath:"#/properties/descriptor/required",keyword:"required",params:{missingProperty:v},message:"must have required property '"+v+"'"}],!1;{let A=s;for(let T in u)if(!(T==="interface"||T==="method"||T==="messageTimestamp"||T==="definition")){return Ao.errors=[{instancePath:e+"/descriptor",schemaPath:"#/properties/descriptor/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:T},message:"must NOT have additional properties"}],!1;break}if(A===s){if(u.interface!==void 0){let T=u.interface,M=s;if(typeof T!="string")return Ao.errors=[{instancePath:e+"/descriptor/interface",schemaPath:"#/properties/descriptor/properties/interface/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;if(T!=="Protocols")return Ao.errors=[{instancePath:e+"/descriptor/interface",schemaPath:"#/properties/descriptor/properties/interface/enum",keyword:"enum",params:{allowedValues:yC.properties.descriptor.properties.interface.enum},message:"must be equal to one of the allowed values"}],!1;var c=M===s}else var c=!0;if(c){if(u.method!==void 0){let T=u.method,M=s;if(typeof T!="string")return Ao.errors=[{instancePath:e+"/descriptor/method",schemaPath:"#/properties/descriptor/properties/method/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;if(T!=="Configure")return Ao.errors=[{instancePath:e+"/descriptor/method",schemaPath:"#/properties/descriptor/properties/method/enum",keyword:"enum",params:{allowedValues:yC.properties.descriptor.properties.method.enum},message:"must be equal to one of the allowed values"}],!1;var c=M===s}else var c=!0;if(c){if(u.messageTimestamp!==void 0){let T=u.messageTimestamp,M=s;if(s===s)if(typeof T=="string"){if(!Cn.test(T))return Ao.errors=[{instancePath:e+"/descriptor/messageTimestamp",schemaPath:"https://identity.foundation/dwn/json-schemas/defs.json#/definitions/date-time/pattern",keyword:"pattern",params:{pattern:"^\\d{4}-[0-1]\\d-[0-3]\\dT(?:[0-2]\\d:[0-5]\\d:[0-5]\\d|23:59:60)\\.\\d{6}Z$"},message:'must match pattern "^\\d{4}-[0-1]\\d-[0-3]\\dT(?:[0-2]\\d:[0-5]\\d:[0-5]\\d|23:59:60)\\.\\d{6}Z$"'}],!1}else return Ao.errors=[{instancePath:e+"/descriptor/messageTimestamp",schemaPath:"https://identity.foundation/dwn/json-schemas/defs.json#/definitions/date-time/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var c=M===s}else var c=!0;if(c)if(u.definition!==void 0){let T=s;Wn(u.definition,{instancePath:e+"/descriptor/definition",parentData:u,parentDataProperty:"definition",rootData:i})||(o=o===null?Wn.errors:o.concat(Wn.errors),s=o.length);var c=T===s}else var c=!0}}}}}else return Ao.errors=[{instancePath:e+"/descriptor",schemaPath:"#/properties/descriptor/type",keyword:"type",params:{type:"object"},message:"must be object"}],!1;var a=m===s}else var a=!0}}}else return Ao.errors=[{instancePath:e,schemaPath:"#/type",keyword:"type",params:{type:"object"},message:"must be object"}],!1;return Ao.errors=o,s===0}var mce=Tn,gC={$schema:"http://json-schema.org/draft-07/schema#",$id:"https://identity.foundation/dwn/json-schemas/protocols-query.json",type:"object",additionalProperties:!1,required:["descriptor"],properties:{authorization:{$ref:"https://identity.foundation/dwn/json-schemas/authorization.json"},descriptor:{type:"object",additionalProperties:!1,required:["interface","method","messageTimestamp"],properties:{interface:{enum:["Protocols"],type:"string"},method:{enum:["Query"],type:"string"},messageTimestamp:{$ref:"https://identity.foundation/dwn/json-schemas/defs.json#/definitions/date-time"},filter:{type:"object",minProperties:1,additionalProperties:!1,properties:{protocol:{type:"string"},recipient:{$ref:"https://identity.foundation/dwn/json-schemas/defs.json#/definitions/did"}}}}}}};function Tn(t,{instancePath:e="",parentData:r,parentDataProperty:n,rootData:i=t}={}){let o=null,s=0;if(s===0)if(t&&typeof t=="object"&&!Array.isArray(t)){let f;if(t.descriptor===void 0&&(f="descriptor"))return Tn.errors=[{instancePath:e,schemaPath:"#/required",keyword:"required",params:{missingProperty:f},message:"must have required property '"+f+"'"}],!1;{let u=s;for(let m in t)if(!(m==="authorization"||m==="descriptor")){return Tn.errors=[{instancePath:e,schemaPath:"#/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:m},message:"must NOT have additional properties"}],!1;break}if(u===s){if(t.authorization!==void 0){let m=s;qr(t.authorization,{instancePath:e+"/authorization",parentData:t,parentDataProperty:"authorization",rootData:i})||(o=o===null?qr.errors:o.concat(qr.errors),s=o.length);var a=m===s}else var a=!0;if(a)if(t.descriptor!==void 0){let m=t.descriptor,_=s;if(s===_)if(m&&typeof m=="object"&&!Array.isArray(m)){let A;if(m.interface===void 0&&(A="interface")||m.method===void 0&&(A="method")||m.messageTimestamp===void 0&&(A="messageTimestamp"))return Tn.errors=[{instancePath:e+"/descriptor",schemaPath:"#/properties/descriptor/required",keyword:"required",params:{missingProperty:A},message:"must have required property '"+A+"'"}],!1;{let T=s;for(let M in m)if(!(M==="interface"||M==="method"||M==="messageTimestamp"||M==="filter")){return Tn.errors=[{instancePath:e+"/descriptor",schemaPath:"#/properties/descriptor/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:M},message:"must NOT have additional properties"}],!1;break}if(T===s){if(m.interface!==void 0){let M=m.interface,D=s;if(typeof M!="string")return Tn.errors=[{instancePath:e+"/descriptor/interface",schemaPath:"#/properties/descriptor/properties/interface/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;if(M!=="Protocols")return Tn.errors=[{instancePath:e+"/descriptor/interface",schemaPath:"#/properties/descriptor/properties/interface/enum",keyword:"enum",params:{allowedValues:gC.properties.descriptor.properties.interface.enum},message:"must be equal to one of the allowed values"}],!1;var c=D===s}else var c=!0;if(c){if(m.method!==void 0){let M=m.method,D=s;if(typeof M!="string")return Tn.errors=[{instancePath:e+"/descriptor/method",schemaPath:"#/properties/descriptor/properties/method/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;if(M!=="Query")return Tn.errors=[{instancePath:e+"/descriptor/method",schemaPath:"#/properties/descriptor/properties/method/enum",keyword:"enum",params:{allowedValues:gC.properties.descriptor.properties.method.enum},message:"must be equal to one of the allowed values"}],!1;var c=D===s}else var c=!0;if(c){if(m.messageTimestamp!==void 0){let M=m.messageTimestamp,D=s;if(s===s)if(typeof M=="string"){if(!Cn.test(M))return Tn.errors=[{instancePath:e+"/descriptor/messageTimestamp",schemaPath:"https://identity.foundation/dwn/json-schemas/defs.json#/definitions/date-time/pattern",keyword:"pattern",params:{pattern:"^\\d{4}-[0-1]\\d-[0-3]\\dT(?:[0-2]\\d:[0-5]\\d:[0-5]\\d|23:59:60)\\.\\d{6}Z$"},message:'must match pattern "^\\d{4}-[0-1]\\d-[0-3]\\dT(?:[0-2]\\d:[0-5]\\d:[0-5]\\d|23:59:60)\\.\\d{6}Z$"'}],!1}else return Tn.errors=[{instancePath:e+"/descriptor/messageTimestamp",schemaPath:"https://identity.foundation/dwn/json-schemas/defs.json#/definitions/date-time/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var c=D===s}else var c=!0;if(c)if(m.filter!==void 0){let M=m.filter,D=s;if(s===D)if(M&&typeof M=="object"&&!Array.isArray(M)){if(Object.keys(M).length<1)return Tn.errors=[{instancePath:e+"/descriptor/filter",schemaPath:"#/properties/descriptor/properties/filter/minProperties",keyword:"minProperties",params:{limit:1},message:"must NOT have fewer than 1 properties"}],!1;{let U=s;for(let L in M)if(!(L==="protocol"||L==="recipient")){return Tn.errors=[{instancePath:e+"/descriptor/filter",schemaPath:"#/properties/descriptor/properties/filter/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:L},message:"must NOT have additional properties"}],!1;break}if(U===s){if(M.protocol!==void 0){let L=s;if(typeof M.protocol!="string")return Tn.errors=[{instancePath:e+"/descriptor/filter/protocol",schemaPath:"#/properties/descriptor/properties/filter/properties/protocol/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var d=L===s}else var d=!0;if(d)if(M.recipient!==void 0){let L=M.recipient,F=s;if(s===s)if(typeof L=="string"){if(!ks.test(L))return Tn.errors=[{instancePath:e+"/descriptor/filter/recipient",schemaPath:"https://identity.foundation/dwn/json-schemas/defs.json#/definitions/did/pattern",keyword:"pattern",params:{pattern:"^did:([a-z0-9]+):((?:(?:[a-zA-Z0-9._-]|(?:%[0-9a-fA-F]{2}))*:)*((?:[a-zA-Z0-9._-]|(?:%[0-9a-fA-F]{2}))+))((;[a-zA-Z0-9_.:%-]+=[a-zA-Z0-9_.:%-]*)*)(/[^#?]*)?([?][^#]*)?(#.*)?$"},message:'must match pattern "^did:([a-z0-9]+):((?:(?:[a-zA-Z0-9._-]|(?:%[0-9a-fA-F]{2}))*:)*((?:[a-zA-Z0-9._-]|(?:%[0-9a-fA-F]{2}))+))((;[a-zA-Z0-9_.:%-]+=[a-zA-Z0-9_.:%-]*)*)(/[^#?]*)?([?][^#]*)?(#.*)?$"'}],!1}else return Tn.errors=[{instancePath:e+"/descriptor/filter/recipient",schemaPath:"https://identity.foundation/dwn/json-schemas/defs.json#/definitions/did/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var d=F===s}else var d=!0}}}else return Tn.errors=[{instancePath:e+"/descriptor/filter",schemaPath:"#/properties/descriptor/properties/filter/type",keyword:"type",params:{type:"object"},message:"must be object"}],!1;var c=D===s}else var c=!0}}}}}else return Tn.errors=[{instancePath:e+"/descriptor",schemaPath:"#/properties/descriptor/type",keyword:"type",params:{type:"object"},message:"must be object"}],!1;var a=_===s}else var a=!0}}}else return Tn.errors=[{instancePath:e,schemaPath:"#/type",keyword:"type",params:{type:"object"},message:"must be object"}],!1;return Tn.errors=o,s===0}var yce=To,bC={$schema:"http://json-schema.org/draft-07/schema#",$id:"https://identity.foundation/dwn/json-schemas/records-read.json",type:"object",additionalProperties:!1,required:["descriptor"],properties:{authorization:{$ref:"https://identity.foundation/dwn/json-schemas/authorization-delegated-grant.json"},descriptor:{type:"object",additionalProperties:!1,required:["interface","method","messageTimestamp","filter"],properties:{interface:{enum:["Records"],type:"string"},method:{enum:["Read"],type:"string"},messageTimestamp:{$ref:"https://identity.foundation/dwn/json-schemas/defs.json#/definitions/date-time"},filter:{$ref:"https://identity.foundation/dwn/json-schemas/records-filter.json"}}}}};function To(t,{instancePath:e="",parentData:r,parentDataProperty:n,rootData:i=t}={}){let o=null,s=0;if(s===0)if(t&&typeof t=="object"&&!Array.isArray(t)){let d;if(t.descriptor===void 0&&(d="descriptor"))return To.errors=[{instancePath:e,schemaPath:"#/required",keyword:"required",params:{missingProperty:d},message:"must have required property '"+d+"'"}],!1;{let f=s;for(let u in t)if(!(u==="authorization"||u==="descriptor")){return To.errors=[{instancePath:e,schemaPath:"#/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:u},message:"must NOT have additional properties"}],!1;break}if(f===s){if(t.authorization!==void 0){let u=s;Qo(t.authorization,{instancePath:e+"/authorization",parentData:t,parentDataProperty:"authorization",rootData:i})||(o=o===null?Qo.errors:o.concat(Qo.errors),s=o.length);var a=u===s}else var a=!0;if(a)if(t.descriptor!==void 0){let u=t.descriptor,m=s;if(s===m)if(u&&typeof u=="object"&&!Array.isArray(u)){let v;if(u.interface===void 0&&(v="interface")||u.method===void 0&&(v="method")||u.messageTimestamp===void 0&&(v="messageTimestamp")||u.filter===void 0&&(v="filter"))return To.errors=[{instancePath:e+"/descriptor",schemaPath:"#/properties/descriptor/required",keyword:"required",params:{missingProperty:v},message:"must have required property '"+v+"'"}],!1;{let A=s;for(let T in u)if(!(T==="interface"||T==="method"||T==="messageTimestamp"||T==="filter")){return To.errors=[{instancePath:e+"/descriptor",schemaPath:"#/properties/descriptor/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:T},message:"must NOT have additional properties"}],!1;break}if(A===s){if(u.interface!==void 0){let T=u.interface,M=s;if(typeof T!="string")return To.errors=[{instancePath:e+"/descriptor/interface",schemaPath:"#/properties/descriptor/properties/interface/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;if(T!=="Records")return To.errors=[{instancePath:e+"/descriptor/interface",schemaPath:"#/properties/descriptor/properties/interface/enum",keyword:"enum",params:{allowedValues:bC.properties.descriptor.properties.interface.enum},message:"must be equal to one of the allowed values"}],!1;var c=M===s}else var c=!0;if(c){if(u.method!==void 0){let T=u.method,M=s;if(typeof T!="string")return To.errors=[{instancePath:e+"/descriptor/method",schemaPath:"#/properties/descriptor/properties/method/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;if(T!=="Read")return To.errors=[{instancePath:e+"/descriptor/method",schemaPath:"#/properties/descriptor/properties/method/enum",keyword:"enum",params:{allowedValues:bC.properties.descriptor.properties.method.enum},message:"must be equal to one of the allowed values"}],!1;var c=M===s}else var c=!0;if(c){if(u.messageTimestamp!==void 0){let T=u.messageTimestamp,M=s;if(s===s)if(typeof T=="string"){if(!Cn.test(T))return To.errors=[{instancePath:e+"/descriptor/messageTimestamp",schemaPath:"https://identity.foundation/dwn/json-schemas/defs.json#/definitions/date-time/pattern",keyword:"pattern",params:{pattern:"^\\d{4}-[0-1]\\d-[0-3]\\dT(?:[0-2]\\d:[0-5]\\d:[0-5]\\d|23:59:60)\\.\\d{6}Z$"},message:'must match pattern "^\\d{4}-[0-1]\\d-[0-3]\\dT(?:[0-2]\\d:[0-5]\\d:[0-5]\\d|23:59:60)\\.\\d{6}Z$"'}],!1}else return To.errors=[{instancePath:e+"/descriptor/messageTimestamp",schemaPath:"https://identity.foundation/dwn/json-schemas/defs.json#/definitions/date-time/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var c=M===s}else var c=!0;if(c)if(u.filter!==void 0){let T=s;Pe(u.filter,{instancePath:e+"/descriptor/filter",parentData:u,parentDataProperty:"filter",rootData:i})||(o=o===null?Pe.errors:o.concat(Pe.errors),s=o.length);var c=T===s}else var c=!0}}}}}else return To.errors=[{instancePath:e+"/descriptor",schemaPath:"#/properties/descriptor/type",keyword:"type",params:{type:"object"},message:"must be object"}],!1;var a=m===s}else var a=!0}}}else return To.errors=[{instancePath:e,schemaPath:"#/type",keyword:"type",params:{type:"object"},message:"must be object"}],!1;return To.errors=o,s===0}var gce=Pe,bce=br,vce=gd;function gd(t,{instancePath:e="",parentData:r,parentDataProperty:n,rootData:i=t}={}){let o=null,s=0;if(s===0)if(t&&typeof t=="object"&&!Array.isArray(t)){let c;if(t.descriptorCid===void 0&&(c="descriptorCid"))return gd.errors=[{instancePath:e,schemaPath:"#/required",keyword:"required",params:{missingProperty:c},message:"must have required property '"+c+"'"}],!1;{let d=s;for(let f in t)if(!(f==="descriptorCid"||f==="delegatedGrantId"||f==="permissionsGrantId"||f==="protocolRole")){return gd.errors=[{instancePath:e,schemaPath:"#/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:f},message:"must NOT have additional properties"}],!1;break}if(d===s){if(t.descriptorCid!==void 0){let f=s;if(typeof t.descriptorCid!="string")return gd.errors=[{instancePath:e+"/descriptorCid",schemaPath:"#/properties/descriptorCid/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var a=f===s}else var a=!0;if(a){if(t.delegatedGrantId!==void 0){let f=s;if(typeof t.delegatedGrantId!="string")return gd.errors=[{instancePath:e+"/delegatedGrantId",schemaPath:"#/properties/delegatedGrantId/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var a=f===s}else var a=!0;if(a){if(t.permissionsGrantId!==void 0){let f=s;if(typeof t.permissionsGrantId!="string")return gd.errors=[{instancePath:e+"/permissionsGrantId",schemaPath:"#/properties/permissionsGrantId/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var a=f===s}else var a=!0;if(a)if(t.protocolRole!==void 0){let f=s;if(typeof t.protocolRole!="string")return gd.errors=[{instancePath:e+"/protocolRole",schemaPath:"#/properties/protocolRole/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var a=f===s}else var a=!0}}}}}else return gd.errors=[{instancePath:e,schemaPath:"#/type",keyword:"type",params:{type:"object"},message:"must be object"}],!1;return gd.errors=o,s===0}var wce=Xo;function Xo(t,{instancePath:e="",parentData:r,parentDataProperty:n,rootData:i=t}={}){let o=null,s=0;if(s===0)if(t&&typeof t=="object"&&!Array.isArray(t)){let c;if(t.descriptorCid===void 0&&(c="descriptorCid")||t.recordId===void 0&&(c="recordId"))return Xo.errors=[{instancePath:e,schemaPath:"#/required",keyword:"required",params:{missingProperty:c},message:"must have required property '"+c+"'"}],!1;{let d=s;for(let f in t)if(!(f==="descriptorCid"||f==="recordId"||f==="contextId"||f==="attestationCid"||f==="encryptionCid"||f==="delegatedGrantId"||f==="permissionsGrantId"||f==="protocolRole")){return Xo.errors=[{instancePath:e,schemaPath:"#/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:f},message:"must NOT have additional properties"}],!1;break}if(d===s){if(t.descriptorCid!==void 0){let f=s;if(typeof t.descriptorCid!="string")return Xo.errors=[{instancePath:e+"/descriptorCid",schemaPath:"#/properties/descriptorCid/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var a=f===s}else var a=!0;if(a){if(t.recordId!==void 0){let f=s;if(typeof t.recordId!="string")return Xo.errors=[{instancePath:e+"/recordId",schemaPath:"#/properties/recordId/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var a=f===s}else var a=!0;if(a){if(t.contextId!==void 0){let f=s;if(typeof t.contextId!="string")return Xo.errors=[{instancePath:e+"/contextId",schemaPath:"#/properties/contextId/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var a=f===s}else var a=!0;if(a){if(t.attestationCid!==void 0){let f=s;if(typeof t.attestationCid!="string")return Xo.errors=[{instancePath:e+"/attestationCid",schemaPath:"#/properties/attestationCid/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var a=f===s}else var a=!0;if(a){if(t.encryptionCid!==void 0){let f=s;if(typeof t.encryptionCid!="string")return Xo.errors=[{instancePath:e+"/encryptionCid",schemaPath:"#/properties/encryptionCid/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var a=f===s}else var a=!0;if(a){if(t.delegatedGrantId!==void 0){let f=s;if(typeof t.delegatedGrantId!="string")return Xo.errors=[{instancePath:e+"/delegatedGrantId",schemaPath:"#/properties/delegatedGrantId/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var a=f===s}else var a=!0;if(a){if(t.permissionsGrantId!==void 0){let f=s;if(typeof t.permissionsGrantId!="string")return Xo.errors=[{instancePath:e+"/permissionsGrantId",schemaPath:"#/properties/permissionsGrantId/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var a=f===s}else var a=!0;if(a)if(t.protocolRole!==void 0){let f=s;if(typeof t.protocolRole!="string")return Xo.errors=[{instancePath:e+"/protocolRole",schemaPath:"#/properties/protocolRole/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var a=f===s}else var a=!0}}}}}}}}}else return Xo.errors=[{instancePath:e,schemaPath:"#/type",keyword:"type",params:{type:"object"},message:"must be object"}],!1;return Xo.errors=o,s===0}function a0(t,e){let r=D4[t];if(!r)throw new Q("SchemaValidatorSchemaNotFound",`schema for ${t} not found.`);if(r(e),!r.errors)return;let[n]=r.errors,{instancePath:i,message:o}=n;throw i||(i=t),new Q("SchemaValidationFailure",`${i}: ${o}`)}var ie=class{static validateJsonSchema(e){let r=e.descriptor.interface,n=e.descriptor.method,i=r+n;a0(i,e)}static getSigner(e){return e.authorization===void 0?void 0:fr.getSignerDid(e.authorization.signature.signatures[0])}static async getCid(e){let r={...e};return r.encodedData&&delete r.encodedData,await Wr.computeCid(r)}static async compareCid(e,r){let n=await ie.getCid(e),i=await ie.getCid(r);return eC(n,i)}static async createAuthorization(e){let{descriptor:r,signer:n,delegatedGrant:i,permissionsGrantId:o,protocolRole:s}=e,a;i!==void 0&&(a=await ie.getCid(i));let d={signature:await ie.createSignature(r,n,{delegatedGrantId:a,permissionsGrantId:o,protocolRole:s})};return i!==void 0&&(d.authorDelegatedGrant=i),d}static async createSignature(e,r,n){let o={descriptorCid:await Wr.computeCid(e),...n};Hn(o);let s=Be.objectToBytes(o);return(await md.create(s,[r])).getJws()}static async getNewestMessage(e){let r;for(let n of e)(r===void 0||await ie.isNewer(n,r))&&(r=n);return r}static async getOldestMessage(e){let r;for(let n of e)(r===void 0||await ie.isOlder(n,r))&&(r=n);return r}static async isNewer(e,r){return await ie.compareMessageTimestamp(e,r)>0}static async isOlder(e,r){return await ie.compareMessageTimestamp(e,r)<0}static async compareMessageTimestamp(e,r){return e.descriptor.messageTimestamp>r.descriptor.messageTimestamp?1:e.descriptor.messageTimestamp<r.descriptor.messageTimestamp?-1:ie.compareCid(e,r)}static async validateMessageSignatureIntegrity(e,r,n="GenericSignaturePayload"){if(e.signatures.length!==1)throw new Q("AuthenticationMoreThanOneSignatureNotSupported","expected no more than 1 signature for authorization purpose");let i=fr.decodePlainObjectPayload(e);a0(n,i);let{descriptorCid:o}=i,s=await Wr.computeCid(r);if(o!==s)throw new Q("AuthenticateDescriptorCidMismatch",`provided descriptorCid ${o} does not match expected CID ${s}`);return i}};var dn=class{get message(){return this._message}get author(){return this._author}get signaturePayload(){return this._signaturePayload}constructor(e){this._message=e,e.authorization!==void 0&&(e.authorization.authorDelegatedGrant!==void 0?this._author=ie.getSigner(e.authorization.authorDelegatedGrant):this._author=ie.getSigner(e),this._signaturePayload=fr.decodePlainObjectPayload(e.authorization.signature))}toJSON(){return this.message}};p();p();var tx=mr(f_(),1),uu=mr(tV(),1),o9=mr(ex(),1);uu.ECIES_CONFIG.isEphemeralKeyCompressed=!0;var Bc=class{static async aes256CtrEncrypt(e,r,n){let i=tx.createCipheriv("aes-256-ctr",e,r),o=new o9.Readable({read(){}});return n.on("data",s=>{let a=i.update(s);o.push(a)}),n.on("end",()=>{let s=i.final();o.push(s),o.push(null)}),n.on("error",s=>{o.emit("error",s)}),o}static async aes256CtrDecrypt(e,r,n){let i=tx.createDecipheriv("aes-256-ctr",e,r),o=new o9.Readable({read(){}});return n.on("data",s=>{let a=i.update(s);o.push(a)}),n.on("end",()=>{let s=i.final();o.push(s),o.push(null)}),n.on("error",s=>{o.emit("error",s)}),o}static async eciesSecp256k1Encrypt(e,r){let n=C.Buffer.from(e),i=C.Buffer.from(r),o=uu.encrypt(n,i),s=0,a=Bc.isEphemeralKeyCompressed?33:65,c=o.subarray(s,a);s=a,a+=uu.ECIES_CONFIG.symmetricNonceLength;let d=o.subarray(s,a);s=a,a+=16;let f=o.subarray(s,a);return{ciphertext:o.subarray(a),ephemeralPublicKey:c,initializationVector:d,messageAuthenticationCode:f}}static async eciesSecp256k1Decrypt(e){let r=C.Buffer.from(e.privateKey),n=C.Buffer.concat([e.ephemeralPublicKey,e.initializationVector,e.messageAuthenticationCode,e.ciphertext]);return uu.decrypt(r,n)}static get isEphemeralKeyCompressed(){return uu.ECIES_CONFIG.isEphemeralKeyCompressed}},s9=(r=>(r.Aes256Ctr="A256CTR",r.EciesSecp256k1="ECIES-ES256K",r))(s9||{});p();var vv=(i=>(i.DataFormats="dataFormats",i.ProtocolContext="protocolContext",i.ProtocolPath="protocolPath",i.Schemas="schemas",i))(vv||{}),lu=class{static async derivePrivateKey(e,r){let n=qt.privateJwkToBytes(e.derivedPrivateKey),i=e.derivationPath??[],o=await qt.derivePrivateKey(n,r),s=await qt.privateKeyToJwk(o);return{rootKeyId:e.rootKeyId,derivationScheme:e.derivationScheme,derivationPath:[...i,...r],derivedPrivateKey:s}}static async derivePublicKey(e,r){let n=await lu.derivePrivateKey(e,r);return await qt.getPublicJwk(n.derivedPrivateKey)}};p();function hu(t){let e;try{e=Pa(t)}catch{e=void 0}if(t!==e)throw new Q("UrlProtocolNotNormalized",`Protocol URI ${t} must be normalized.`)}function Pa(t){return kZ(t)}function xm(t){let e;try{e=Hd(t)}catch{e=void 0}if(t!==e)throw new Q("UrlSchemaNotNormalized",`Schema URI ${t} must be normalized.`)}function Hd(t){return kZ(t)}function kZ(t){let e;/^[^:]+:(\/{2})?[^\/].*/.test(t)?e=t:e=`http://${t}`;try{let r=new URL(e);return r.search="",r.hash="",OEe(r.href)}catch{throw new Q("UrlProtocolNotNormalizable","Could not normalize protocol URI")}}function OEe(t){return t.endsWith("/")?t.slice(0,-1):t}var ur=class{static async decrypt(e,r,n){let{encryption:i}=e,o=i.keyEncryption.find(A=>A.rootKeyId===r.rootKeyId&&A.derivationScheme===r.derivationScheme);if(o===void 0)throw new Q("RecordsDecryptNoMatchingKeyEncryptedFound",`Unable to find a symmetric key encrypted using key with ID '${r.rootKeyId}' and '${r.derivationScheme}' derivation scheme.`);let s=ur.constructKeyDerivationPath(o.derivationScheme,e),a=await ur.derivePrivateKey(r,s),c=Be.base64UrlToBytes(o.encryptedKey),d=qt.publicJwkToBytes(o.ephemeralPublicKey),f=Be.base64UrlToBytes(o.initializationVector),u=Be.base64UrlToBytes(o.messageAuthenticationCode),m=await Bc.eciesSecp256k1Decrypt({ciphertext:c,ephemeralPublicKey:d,initializationVector:f,messageAuthenticationCode:u,privateKey:a}),_=Be.base64UrlToBytes(i.initializationVector);return await Bc.aes256CtrDecrypt(m,_,n)}static constructKeyDerivationPath(e,r){let n=r.descriptor,i=r.contextId,o;return e==="dataFormats"?o=ur.constructKeyDerivationPathUsingDataFormatsScheme(n.schema,n.dataFormat):e==="protocolPath"?o=ur.constructKeyDerivationPathUsingProtocolPathScheme(n):e==="protocolContext"?o=ur.constructKeyDerivationPathUsingProtocolContextScheme(i):o=ur.constructKeyDerivationPathUsingSchemasScheme(n.schema),o}static constructKeyDerivationPathUsingDataFormatsScheme(e,r){return e!==void 0?["dataFormats",e,r]:["dataFormats",r]}static constructKeyDerivationPathUsingProtocolPathScheme(e){if(e.protocol===void 0)throw new Q("RecordsProtocolPathDerivationSchemeMissingProtocol","Unable to construct key derivation path using `protocols` scheme because `protocol` is missing.");let r=e.protocolPath.split("/");return["protocolPath",e.protocol,...r]}static constructKeyDerivationPathUsingProtocolContextScheme(e){if(e===void 0)throw new Q("RecordsProtocolContextDerivationSchemeMissingContextId","Unable to construct key derivation path using `protocolContext` scheme because `contextId` is missing.");return["protocolContext",e]}static constructKeyDerivationPathUsingSchemasScheme(e){if(e===void 0)throw new Q("RecordsSchemasDerivationSchemeMissingSchema","Unable to construct key derivation path using `schemas` scheme because `schema` is missing.");return["schemas",e]}static async derivePrivateKey(e,r){if(e.derivedPrivateKey.crv!=="secp256k1")throw new Q("RecordsDerivePrivateKeyUnSupportedCurve",`Curve ${e.derivedPrivateKey.crv} is not supported.`);let n=e.derivationPath??[];ur.validateAncestorKeyAndDescentKeyDerivationPathsMatch(n,r);let i=r.slice(n.length),o=qt.privateJwkToBytes(e.derivedPrivateKey);return await qt.derivePrivateKey(o,i)}static validateAncestorKeyAndDescentKeyDerivationPathsMatch(e,r){for(let n=0;n<e.length;n++){let i=e[n],o=r[n];if(i!==o)throw new Q("RecordsInvalidAncestorKeyDerivationSegment",`Ancestor key derivation segment '${i}' mismatches against the descendant key derivation segment '${o}'.`)}}static normalizeFilter(e){let r;e.protocol===void 0?r=void 0:r=Pa(e.protocol);let n;return e.schema===void 0?n=void 0:n=Hd(e.schema),{...e,protocol:r,schema:n}}static convertFilter(e){let r={...e},{dateCreated:n,datePublished:i,dateUpdated:o}=e,s=n?this.convertRangeCriterion(n):void 0;s&&(r.dateCreated=s);let a=i?this.convertRangeCriterion(i):void 0;a&&(r.published=!0,r.datePublished=a);let c=o?this.convertRangeCriterion(o):void 0;return c&&(r.messageTimestamp=c,delete r.dateUpdated),r}static convertRangeCriterion(e){let r;return e.to!==void 0&&e.from!==void 0?r={gte:e.from,lt:e.to}:e.to!==void 0?r={lt:e.to}:e.from!==void 0&&(r={gte:e.from}),r}static validateDelegatedGrantReferentialIntegrity(e,r){let n=r?.delegatedGrantId!==void 0,i=e.authorization?.authorDelegatedGrant!==void 0;if(n!==i)throw new Q("RecordsValidateIntegrityDelegatedGrantAndIdExistenceMismatch",`delegatedGrantId and authorDelegatedGrant must both exist or be undefined. delegatedGrantId defined: ${n}, authorDelegatedGrant defined: ${i}`);if(i){let s=e.authorization.authorDelegatedGrant.descriptor.grantedTo,a=ie.getSigner(e);if(s!==a)throw new Q("RecordsValidateIntegrityGrantedToAndSignerMismatch",`grantedTo ${s} must be the same as the signer ${a} of the message`)}}};p();p();var N=mr(BZ(),1),m9={};function zc(t,e){Object.defineProperty(t.prototype,Symbol.toStringTag,{value:e,writable:!1,enumerable:!1,configurable:!0});for(let r of Object.getOwnPropertyNames(t)){let n=Object.getOwnPropertyDescriptor(t,r);n.configurable&&n.enumerable&&(n.enumerable=!1,Object.defineProperty(t,r,n))}for(let r of Object.getOwnPropertyNames(t.prototype)){let n=Object.getOwnPropertyDescriptor(t.prototype,r);n.configurable&&n.enumerable&&(n.enumerable=!1,Object.defineProperty(t.prototype,r,n))}Ir(e,t),Ir(`${e}.prototype`,t.prototype)}function Ir(t,e){let r=`%${t}%`;if(m9[r]!==void 0)throw new Error(`intrinsic ${t} already exists`);m9[r]=e}function se(t){return m9[t]}var DZ,CZ,Ae="slot-epochNanoSeconds",Cc="slot-timezone-identifier",de="slot-year",fe="slot-month",he="slot-day",Le="slot-hour",Ue="slot-minute",Fe="slot-second",ze="slot-millisecond",$e="slot-microsecond",Ge="slot-nanosecond",X="slot-calendar",mY="slot-date-brand",yY="slot-year-month-brand",gY="slot-month-day-brand",ri="slot-cached-instant",Xt="slot-time-zone",wi="slot-years",Bn="slot-months",Vi="slot-weeks",_i="slot-days",xi="slot-hours",Ei="slot-minutes",Si="slot-seconds",Ai="slot-milliseconds",Ti="slot-microseconds",Pi="slot-nanoseconds",Pr="slot-calendar-identifier",bY=new WeakMap,y9=Symbol.for("@@Temporal__GetSlots");(DZ=globalThis)[y9]||(DZ[y9]=function(e){return bY.get(e)});var H9=globalThis[y9],g9=Symbol.for("@@Temporal__CreateSlots");(CZ=globalThis)[g9]||(CZ[g9]=function(e){bY.set(e,Object.create(null))});var $c=globalThis[g9];function _n(t,...e){if(!t||typeof t!="object")return!1;let r=H9(t);return!!r&&e.every(n=>n in r)}function S(t,e){let r=H9(t)?.[e];if(r===void 0)throw new TypeError(`Missing internal slot ${e}`);return r}function Ve(t,e,r){let n=H9(t);if(n===void 0)throw new TypeError("Missing slots for the given container");if(n[e])throw new TypeError(`${e} already has set`);n[e]=r}var OZ=/\.[-A-Za-z_]|\.\.[-A-Za-z._]{1,12}|\.[-A-Za-z_][-A-Za-z._]{0,12}|[A-Za-z_][-A-Za-z._]{0,13}/,Bv=new RegExp("(?:"+[`(?:${OZ.source})(?:\\/(?:${OZ.source}))*`,"Etc/GMT(?:0|[-+]\\d{1,2})","GMT[-+]?0","EST5EDT","CST6CDT","MST7MDT","PST8PDT",/(?:[+\u2212-][0-2][0-9](?::?[0-5][0-9](?::?[0-5][0-9](?:[.,]\d{1,9})?)?)?)/.source].join("|")+")"),vY=/(?:[+\u2212-]\d{6}|\d{4})/,ax=/(?:0[1-9]|1[0-2])/,b9=/(?:0[1-9]|[12]\d|3[01])/,jEe=new RegExp(`(${vY.source})(?:-(${ax.source})-(${b9.source})|(${ax.source})(${b9.source}))`),wY=/(\d{2})(?::(\d{2})(?::(\d{2})(?:[.,](\d{1,9}))?)?|(\d{2})(?:(\d{2})(?:[.,](\d{1,9}))?)?)?/,_Y=/([+\u2212-])([01][0-9]|2[0-3])(?::?([0-5][0-9])(?::?([0-5][0-9])(?:[.,](\d{1,9}))?)?)?/,xY=new RegExp(`([zZ])|${_Y.source}?`),Eu=/\[(!)?([a-z_][a-z0-9_-]*)=([A-Za-z0-9]+(?:-[A-Za-z0-9]+)*)\]/g,NEe=new RegExp([`^${jEe.source}`,`(?:(?:T|\\s+)${wY.source}(?:${xY.source})?)?`,`(?:\\[!?(${Bv.source})\\])?`,`((?:${Eu.source})*)$`].join(""),"i"),qEe=new RegExp([`^T?${wY.source}`,`(?:${xY.source})?`,`(?:\\[!?${Bv.source}\\])?`,`((?:${Eu.source})*)$`].join(""),"i"),LEe=new RegExp(`^(${vY.source})-?(${ax.source})(?:\\[!?${Bv.source}\\])?((?:${Eu.source})*)$`),UEe=new RegExp(`^(?:--)?(${ax.source})-?(${b9.source})(?:\\[!?${Bv.source}\\])?((?:${Eu.source})*)$`),d9=/(\d+)(?:[.,](\d{1,9}))?/,FEe=new RegExp(`(?:${d9.source}H)?(?:${d9.source}M)?(?:${d9.source}S)?`),zEe=new RegExp(`^([+\u2212-])?P${/(?:(\d+)Y)?(?:(\d+)M)?(?:(\d+)W)?(?:(\d+)D)?/.source}(?:T(?!$)${FEe.source})?$`,"i"),$Ee=Array.prototype.includes,EY=Array.prototype.push,SY=globalThis.Intl.DateTimeFormat,GEe=Math.min,HEe=Math.max,hr=Math.abs,po=Math.floor,Dm=Math.sign,Fh=Math.trunc,Ex=Number.isNaN,Ii=Number.isFinite,WEe=Number,Dv=String,VEe=Number.MAX_SAFE_INTEGER,ii=Object.create,KEe=Object.getOwnPropertyDescriptor,Sx=Reflect.apply,ZEe=Reflect.ownKeys,Or=N.default.BigInt(0),zm=N.default.BigInt(1),jc=N.default.BigInt(60),AY=N.default.BigInt(24),Ht=N.default.BigInt(1e3),cs=N.default.BigInt(1e6),Nc=N.default.BigInt(1e9),YEe=N.default.BigInt(-1),TY=N.default.multiply(N.default.BigInt(3600),Nc),PY=N.default.multiply(jc,Nc),Lc=N.default.multiply(TY,AY),Sv=N.default.multiply(N.default.BigInt(-86400),N.default.BigInt(1e17)),Cm=N.default.multiply(N.default.BigInt(86400),N.default.BigInt(1e17)),cx=-271821,dx=275760,Tm=N.default.multiply(N.default.BigInt(-388152),N.default.BigInt(1e13)),JEe=N.default.multiply(Lc,N.default.BigInt(3660)),IY=N.default.multiply(Lc,N.default.BigInt(366)),RY=N.default.multiply(Lc,N.default.BigInt(14)),XEe=["iso8601","hebrew","islamic","islamic-umalqura","islamic-tbla","islamic-civil","islamic-rgsa","islamicc","persian","ethiopic","ethioaa","coptic","chinese","dangi","roc","indian","buddhist","japanese","gregory"];function ss(t){return N.default.equal(t,Or)}function Zt(t,e){let r=t[e];if(r!==void 0)return r}function _e(t,e,r){let n=arguments.length>2?r:[];return Sx(t,e,n)}function pr(t){return typeof t=="object"&&t!==null||typeof t=="function"}function Om(t){if(typeof t=="bigint")throw new TypeError("Cannot convert BigInt to number");return WEe(t)}function rn(t){let e=Om(t);if(Ex(e)||e===0)return 0;if(!Ii(e))return e;let r=po(hr(e));return r===0?0:Dm(e)*r}function jo(t){if(typeof t!="number"||Ex(t)||!Ii(t))return!1;let e=hr(t);return po(e)===e}function Mi(t){if(typeof t=="symbol")throw new TypeError("Cannot convert a Symbol value to a String");return Dv(t)}function Ut(t){let e=Om(t);if(e===0)return 0;if(Ex(e)||!Ii(e))throw new RangeError("invalid number value");let r=Fh(e);return r===0?0:r}function jZ(t,e){let r=Ut(t);if(r<=0)throw e!==void 0?new RangeError(`property '${e}' cannot be a a number less than one`):new RangeError("Cannot convert a number less than one to a positive integer");return r}function wn(t){let e=Om(t);if(!Ii(e))throw new RangeError("infinity is out of range");if(!jo(e))throw new RangeError(`unsupported fractional value ${t}`);return e===0?0:e}function Yr(t,e){return{quotient:N.default.divide(t,e),remainder:N.default.remainder(t,e)}}function fx(t){return N.default.lessThan(t,Or)}function NZ(t){return ss(t)?0:fx(t)?-1:1}function Ia(t){return N.default.lessThan(t,Or)?N.default.multiply(t,YEe):t}var qZ=new Map([["year",Ut],["month",jZ],["monthCode",Mi],["day",jZ],["hour",Ut],["minute",Ut],["second",Ut],["millisecond",Ut],["microsecond",Ut],["nanosecond",Ut],["years",wn],["months",wn],["weeks",wn],["days",wn],["hours",wn],["minutes",wn],["seconds",wn],["milliseconds",wn],["microseconds",wn],["nanoseconds",wn],["era",Mi],["eraYear",rn],["offset",Mi]]),QEe=new Map([["hour",0],["minute",0],["second",0],["millisecond",0],["microsecond",0],["nanosecond",0]]),Cv=[["years","year","date"],["months","month","date"],["weeks","week","date"],["days","day","date"],["hours","hour","time"],["minutes","minute","time"],["seconds","second","time"],["milliseconds","millisecond","time"],["microseconds","microsecond","time"],["nanoseconds","nanosecond","time"]],ux=new Map(Cv.map(t=>[t[0],t[1]])),e4e=new Map(Cv.map(([t,e])=>[e,t])),LZ=Cv.map(([,t])=>t),UZ=Array.from(ux.keys()).sort(),FZ=new Map;function MY(t){let e=FZ.get(t);return e===void 0&&(e=new SY("en-us",{timeZone:Dv(t),hour12:!1,era:"short",year:"numeric",month:"numeric",day:"numeric",hour:"numeric",minute:"numeric",second:"numeric"}),FZ.set(t,e)),e}function zZ(t){if(t==null)throw new TypeError(`Expected object not ${t}`);return Object(t)}function Pm(t,e,r,n){if(e==null)return;let i=ZEe(e);for(let o of i)if(!r.some(s=>Object.is(s,o))&&Object.prototype.propertyIsEnumerable.call(e,o)){let s=e[o];if(n&&n.some(a=>Object.is(a,s)))continue;t[o]=s}}function ln(t){return _n(t,Ae)&&!_n(t,Xt,X)}function os(t){return _n(t,Cc)}function Br(t){return _n(t,Pr)}function Dr(t){return _n(t,wi,Bn,_i,xi,Ei,Si,Ai,Ti,Pi)}function rt(t){return _n(t,mY)}function Cr(t){return _n(t,Le,Ue,Fe,ze,$e,Ge)&&!_n(t,de,fe,he)}function je(t){return _n(t,de,fe,he,Le,Ue,Fe,ze,$e,Ge)}function Gt(t){return _n(t,yY)}function vn(t){return _n(t,gY)}function ge(t){return _n(t,Ae,Xt,X)}function $m(t){if(_n(t,X)||_n(t,Xt))throw new TypeError("with() does not support a calendar or timeZone property");if(Cr(t))throw new TypeError("with() does not accept Temporal.PlainTime, use withPlainTime() instead");if(t.calendar!==void 0)throw new TypeError("with() does not support a calendar property");if(t.timeZone!==void 0)throw new TypeError("with() does not support a timeZone property")}function t4e(t){let{ianaName:e,offset:r,z:n}=function(o){if(new RegExp(`^${Bv.source}$`,"i").test(o))return{ianaName:o};try{let s=Gc(o);if(s.z||s.offset||s.ianaName)return s}catch{}throw new RangeError(`Invalid time zone: ${o}`)}(t);return e?r7(e):n?"UTC":jx(gu(r))}function W9(t,e){return e==="never"?"":V9(Fn(t),e)}function V9(t,e){return e==="never"||e==="auto"&&t==="iso8601"?"":`[${e==="critical"?"!":""}u-ca=${t}]`}function Gc(t){let e=NEe.exec(t);if(!e)throw new RangeError(`invalid ISO 8601 string: ${t}`);let r=e[1];if(r[0]==="\u2212"&&(r=`-${r.slice(1)}`),r==="-000000")throw new RangeError(`invalid ISO 8601 string: ${t}`);let n=rn(r),i=rn(e[2]||e[4]),o=rn(e[3]||e[5]),s=rn(e[6]),a=e[6]!==void 0,c=rn(e[7]||e[10]),d=rn(e[8]||e[11]);d===60&&(d=59);let f=(e[9]||e[12])+"000000000",u=rn(f.slice(0,3)),m=rn(f.slice(3,6)),_=rn(f.slice(6,9)),v,A=!1;if(e[13])v=void 0,A=!0;else if(e[14]&&e[15]){let O=e[14]==="-"||e[14]==="\u2212"?"-":"+",U=e[15]||"00",L=e[16]||"00",F=e[17]||"00",$=e[18]||"0";if(v=`${O}${U}:${L}`,+$){for(;$.endsWith("0");)$=$.slice(0,-1);v+=`:${F}.${$}`}else+F&&(v+=`:${F}`);v==="-00:00"&&(v="+00:00")}let T=e[19],M=e[20],D;for(let[,O,U,L]of M.matchAll(Eu))if(U==="u-ca")D===void 0&&(D=L);else if(O==="!")throw new RangeError(`Unrecognized annotation: !${U}=${L}`);return o7(n,i,o,s,c,d,u,m,_),{year:n,month:i,day:o,hasTime:a,hour:s,minute:c,second:d,millisecond:u,microsecond:m,nanosecond:_,ianaName:T,offset:v,z:A,calendar:D}}function K9(t){let e=LEe.exec(t),r,n,i,o;if(e){let s=e[1];if(s[0]==="\u2212"&&(s=`-${s.slice(1)}`),s==="-000000")throw new RangeError(`invalid ISO 8601 string: ${t}`);r=rn(s),n=rn(e[2]);let a=e[3];for(let[,c,d,f]of a.matchAll(Eu))if(d==="u-ca")i===void 0&&(i=f);else if(c==="!")throw new RangeError(`Unrecognized annotation: !${d}=${f}`);if(i!==void 0&&i!=="iso8601")throw new RangeError("YYYY-MM format is only valid with iso8601 calendar")}else{let s;if({year:r,month:n,calendar:i,day:o,z:s}=Gc(t),s)throw new RangeError("Z designator not supported for PlainYearMonth")}return{year:r,month:n,calendar:i,referenceISODay:o}}function Z9(t){let e=UEe.exec(t),r,n,i,o;if(e){r=rn(e[1]),n=rn(e[2]);let s=e[3];for(let[,a,c,d]of s.matchAll(Eu))if(c==="u-ca")i===void 0&&(i=d);else if(a==="!")throw new RangeError(`Unrecognized annotation: !${c}=${d}`);if(i!==void 0&&i!=="iso8601")throw new RangeError("MM-DD format is only valid with iso8601 calendar")}else{let s;if({month:r,day:n,calendar:i,year:o,z:s}=Gc(t),s)throw new RangeError("Z designator not supported for PlainMonthDay")}return{month:r,day:n,calendar:i,referenceISOYear:o}}function r4e(t){let{year:e,month:r,day:n,hour:i,minute:o,second:s,millisecond:a,microsecond:c,nanosecond:d,offset:f,z:u}=function(A){let T=Gc(A);if(!T.z&&!T.offset)throw new RangeError("Temporal.Instant requires a time zone offset");return T}(t);if(!u&&!f)throw new RangeError("Temporal.Instant requires a time zone offset");let m=u?0:gu(f);({year:e,month:r,day:n,hour:i,minute:o,second:s,millisecond:a,microsecond:c,nanosecond:d}=n7(e,r,n,i,o,s,a,c,d-m));let _=bu(e,r,n,i,o,s,a,c,d);if(_===null)throw new RangeError("DateTime outside of supported range");return _}function lx(t,e,r,n){let i=t,o=e,s=r;switch(n){case"reject":Uc(i,o,s);break;case"constrain":({year:i,month:o,day:s}=VY(i,o,s))}return{year:i,month:o,day:s}}function Ax(t,e,r,n,i,o,s){let a=t,c=e,d=r,f=n,u=i,m=o;switch(s){case"reject":qx(a,c,d,f,u,m);break;case"constrain":({hour:a,minute:c,second:d,millisecond:f,microsecond:u,nanosecond:m}=function(v,A,T,M,D,O){let U=ho(v,0,23),L=ho(A,0,59),F=ho(T,0,59),$=ho(M,0,999),H=ho(D,0,999),z=ho(O,0,999);return{hour:U,minute:L,second:F,millisecond:$,microsecond:H,nanosecond:z}}(a,c,d,f,u,m))}return{hour:a,minute:c,second:d,millisecond:f,microsecond:u,nanosecond:m}}function ep(t){if(!pr(t))return function(v){let A=zEe.exec(v);if(!A)throw new RangeError(`invalid duration: ${v}`);if(A.slice(2).every(w=>w===void 0))throw new RangeError(`invalid duration: ${v}`);let T=A[1]==="-"||A[1]==="\u2212"?-1:1,M=A[2]===void 0?0:Ut(A[2])*T,D=A[3]===void 0?0:Ut(A[3])*T,O=A[4]===void 0?0:Ut(A[4])*T,U=A[5]===void 0?0:Ut(A[5])*T,L=A[6]===void 0?0:Ut(A[6])*T,F=A[7],$=A[8],H=A[9],z=A[10],j=A[11],y=0,P=0,x=0;if(F!==void 0){if($??H??z??j)throw new RangeError("only the smallest unit can be fractional");x=3600*rn((F+"000000000").slice(0,9))*T}else if(y=$===void 0?0:Ut($)*T,H!==void 0){if(z??j)throw new RangeError("only the smallest unit can be fractional");x=60*rn((H+"000000000").slice(0,9))*T}else P=z===void 0?0:Ut(z)*T,j!==void 0&&(x=rn((j+"000000000").slice(0,9))*T);let l=x%1e3,b=Fh(x/1e3)%1e3,h=Fh(x/1e6)%1e3;return P+=Fh(x/1e9)%60,y+=Fh(x/6e10),bx(M,D,O,U,L,y,P,h,b,l),{years:M,months:D,weeks:O,days:U,hours:L,minutes:y,seconds:P,milliseconds:h,microseconds:b,nanoseconds:l}}(Mi(t));if(Dr(t))return{years:S(t,wi),months:S(t,Bn),weeks:S(t,Vi),days:S(t,_i),hours:S(t,xi),minutes:S(t,Ei),seconds:S(t,Si),milliseconds:S(t,Ai),microseconds:S(t,Ti),nanoseconds:S(t,Pi)};let e={years:0,months:0,weeks:0,days:0,hours:0,minutes:0,seconds:0,milliseconds:0,microseconds:0,nanoseconds:0},r=function(v){if(!pr(v))throw new TypeError("invalid duration-like");let A={years:void 0,months:void 0,weeks:void 0,days:void 0,hours:void 0,minutes:void 0,seconds:void 0,milliseconds:void 0,microseconds:void 0,nanoseconds:void 0},T=!1;for(let M of UZ){let D=v[M];D!==void 0&&(T=!0,A[M]=wn(D))}if(!T)throw new TypeError("invalid duration-like");return A}(t);for(let _ of UZ){let v=r[_];v!==void 0&&(e[_]=v)}let{years:n,months:i,weeks:o,days:s,hours:a,minutes:c,seconds:d,milliseconds:f,microseconds:u,nanoseconds:m}=e;return bx(n,i,o,s,a,c,d,f,u,m),{years:n,months:i,weeks:o,days:s,hours:a,minutes:c,seconds:d,milliseconds:f,microseconds:u,nanoseconds:m}}function Jr(t){return t===void 0?"constrain":wu(t,"overflow",["constrain","reject"],"constrain")}function jm(t){return t===void 0?"compatible":wu(t,"disambiguation",["compatible","earlier","later","reject"],"compatible")}function Ma(t,e){return wu(t,"roundingMode",["ceil","floor","expand","trunc","halfCeil","halfFloor","halfExpand","halfTrunc","halfEven"],e)}function hx(t,e){return t===void 0?e:wu(t,"offset",["prefer","use","ignore","reject"],e)}function Ov(t){return wu(t,"calendarName",["auto","always","never","critical"],"auto")}function Gm(t){let e=t.roundingIncrement;if(e===void 0)return 1;if(e=Om(e),!Ii(e))throw new RangeError("roundingIncrement must be finite");let r=Fh(e);if(r<1||r>1e9)throw new RangeError(`roundingIncrement must be at least 1 and at most 1e9, not ${e}`);return r}function Hm(t,e,r){let n=r?e:e-1;if(t>n)throw new RangeError(`roundingIncrement must be at least 1 and less than ${n}, not ${t}`);if(e%t!=0)throw new RangeError(`Rounding increment must divide evenly into ${e}`)}function jv(t){let e=t.fractionalSecondDigits;if(e===void 0)return"auto";if(typeof e!="number"){if(Mi(e)!=="auto")throw new RangeError(`fractionalSecondDigits must be 'auto' or 0 through 9, not ${e}`);return"auto"}let r=po(e);if(!Ii(r)||r<0||r>9)throw new RangeError(`fractionalSecondDigits must be 'auto' or 0 through 9, not ${e}`);return r}function Nv(t,e){switch(t){case"minute":return{precision:"minute",unit:"minute",increment:1};case"second":return{precision:0,unit:"second",increment:1};case"millisecond":return{precision:3,unit:"millisecond",increment:1};case"microsecond":return{precision:6,unit:"microsecond",increment:1};case"nanosecond":return{precision:9,unit:"nanosecond",increment:1}}switch(e){case"auto":return{precision:e,unit:"nanosecond",increment:1};case 0:return{precision:e,unit:"second",increment:1};case 1:case 2:case 3:return{precision:e,unit:"millisecond",increment:10**(3-e)};case 4:case 5:case 6:return{precision:e,unit:"microsecond",increment:10**(6-e)};case 7:case 8:case 9:return{precision:e,unit:"nanosecond",increment:10**(9-e)};default:throw new RangeError(`fractionalSecondDigits must be 'auto' or 0 through 9, not ${e}`)}}var Wh=Symbol("~required~");function mo(t,e,r,n,i=[]){let o=[];for(let[,d,f]of Cv)r!=="datetime"&&r!==f||o.push(d);o.push(...i);let s=n;s===Wh?s=void 0:s!==void 0&&o.push(s);let a=[...o];for(let d of o){let f=e4e.get(d);f!==void 0&&a.push(f)}let c=wu(t,e,a,s);if(c===void 0&&n===Wh)throw new RangeError(`${e} is required`);return ux.has(c)?ux.get(c):c}function nx(t){let e=t.relativeTo;if(e===void 0)return e;let r,n,i,o,s,a,c,d,f,u,m,_,v="option",A=!1;if(pr(e)){if(ge(e)||rt(e))return e;if(je(e))return qm(e);u=Fv(e);let T=nn(u,["day","hour","microsecond","millisecond","minute","month","monthCode","nanosecond","second","year"]);T.push("timeZone","offset");let M=Ye(e,T,[]),D=ii(null);D.overflow="constrain",{year:r,month:n,day:i,hour:o,minute:s,second:a,millisecond:c,microsecond:d,nanosecond:f}=qv(u,M,D),_=M.offset,_===void 0&&(v="wall"),m=M.timeZone,m!==void 0&&(m=ni(m))}else{let T,M;if({year:r,month:n,day:i,hour:o,minute:s,second:a,millisecond:c,microsecond:d,nanosecond:f,calendar:u,ianaName:T,offset:_,z:M}=Gc(Mi(e)),T)m=ni(T),M?v="exact":_||(v="wall"),A=!0;else if(M)throw new RangeError("Z designator not supported for PlainDate relativeTo; either remove the Z or add a bracketed time zone");if(u||(u="iso8601"),!ef(u))throw new RangeError(`invalid calendar identifier ${u}`);u=Fc(u)}return m===void 0?fs(r,n,i,u):qn(mx(r,n,i,o,s,a,c,d,f,v,v==="option"?gu(_):0,m,"compatible","reject",A),m,u)}function v9(t,e,r,n,i,o,s,a,c,d){for(let[f,u]of[["years",t],["months",e],["weeks",r],["days",n],["hours",i],["minutes",o],["seconds",s],["milliseconds",a],["microseconds",c],["nanoseconds",d]])if(u!==0)return ux.get(f);return"nanosecond"}function Vh(t,e){return LZ.indexOf(t)>LZ.indexOf(e)?e:t}function Ye(t,e,r,{emptySourceErrorMessage:n}={emptySourceErrorMessage:"no supported properties found"}){let i=ii(null),o=!1;e.sort();for(let s of e){let a=t[s];if(a!==void 0)o=!0,qZ.has(s)&&(a=qZ.get(s)(a)),i[s]=a;else if(r!=="partial"){if($Ee.call(r,s))throw new TypeError(`required property '${s}' missing or undefined`);a=QEe.get(s),i[s]=a}}if(r==="partial"&&!o)throw new TypeError(n);return i}function px(t,e="complete"){let r=["hour","microsecond","millisecond","minute","nanosecond","second"],n=Ye(t,r,"partial",{emptySourceErrorMessage:"invalid time-like"}),i={};for(let o of r){let s=KEe(n,o);s!==void 0?i[o]=s.value:e==="complete"&&(i[o]=0)}return i}function er(t,e){let r=t;if(pr(r)){if(rt(r))return r;if(ge(r)&&(Jr(e),r=Oo(S(r,Xt),S(r,ri),S(r,X))),je(r))return Jr(e),fs(S(r,de),S(r,fe),S(r,he),S(r,X));let c=Fv(r);return Xd(c,Ye(r,nn(c,["day","month","monthCode","year"]),[]),e)}Jr(e);let{year:n,month:i,day:o,calendar:s,z:a}=function(d){return Gc(d)}(Mi(r));if(a)throw new RangeError("Z designator not supported for PlainDate");if(s||(s="iso8601"),!ef(s))throw new RangeError(`invalid calendar identifier ${s}`);return s=Fc(s),fs(n,i,o,s)}function qv(t,e,r){let{hour:n,minute:i,second:o,millisecond:s,microsecond:a,nanosecond:c}=px(e),d=Jr(r),f=Xd(t,e,r),u=S(f,de),m=S(f,fe),_=S(f,he);return{hour:n,minute:i,second:o,millisecond:s,microsecond:a,nanosecond:c}=Ax(n,i,o,s,a,c,d),{year:u,month:m,day:_,hour:n,minute:i,second:o,millisecond:s,microsecond:a,nanosecond:c}}function zh(t,e){let r,n,i,o,s,a,c,d,f,u;if(pr(t)){if(je(t))return t;if(ge(t))return Jr(e),Oo(S(t,Xt),S(t,ri),S(t,X));if(rt(t))return Jr(e),lo(S(t,de),S(t,fe),S(t,he),0,0,0,0,0,0,S(t,X));u=Fv(t);let m=Ye(t,nn(u,["day","hour","microsecond","millisecond","minute","month","monthCode","nanosecond","second","year"]),[]);({year:r,month:n,day:i,hour:o,minute:s,second:a,millisecond:c,microsecond:d,nanosecond:f}=qv(u,m,e))}else{let m;if(Jr(e),{year:r,month:n,day:i,hour:o,minute:s,second:a,millisecond:c,microsecond:d,nanosecond:f,calendar:u,z:m}=function(v){return Gc(v)}(Mi(t)),m)throw new RangeError("Z designator not supported for PlainDateTime");if(o7(r,n,i,o,s,a,c,d,f),u||(u="iso8601"),!ef(u))throw new RangeError(`invalid calendar identifier ${u}`);u=Fc(u)}return lo(r,n,i,o,s,a,c,d,f,u)}function Im(t){if(Dr(t))return t;let{years:e,months:r,weeks:n,days:i,hours:o,minutes:s,seconds:a,milliseconds:c,microseconds:d,nanoseconds:f}=ep(t);return new(se("%Temporal.Duration%"))(e,r,n,i,o,s,a,c,d,f)}function Ra(t){if(ln(t))return t;if(ge(t))return new(se("%Temporal.Instant%"))(S(t,Ae));let e=r4e(Mi(t));return new(se("%Temporal.Instant%"))(e)}function $Z(t,e){let r=t;if(pr(r)){if(vn(r))return r;let a,c;if(_n(r,X))a=S(r,X),c=!1;else{let f=r.calendar;c=f===void 0,f===void 0&&(f="iso8601"),a=yo(f)}let d=Ye(r,nn(a,["day","month","monthCode","year"]),[]);return c&&d.month!==void 0&&d.monthCode===void 0&&d.year===void 0&&(d.year=1972),Nm(a,d,e)}Jr(e);let{month:n,day:i,referenceISOYear:o,calendar:s}=Z9(Mi(r));if(s===void 0&&(s="iso8601"),!ef(s))throw new RangeError(`invalid calendar identifier ${s}`);return s=Fc(s),o===void 0?(Uc(1972,n,i),Av(n,i,s)):Nm(s,Av(n,i,s,o))}function Vd(t,e="constrain"){let r,n,i,o,s,a,c=t;if(pr(c)){if(Cr(c))return c;if(ge(c)&&(c=Oo(S(c,Xt),S(c,ri),S(c,X))),je(c))return new(se("%Temporal.PlainTime%"))(S(c,Le),S(c,Ue),S(c,Fe),S(c,ze),S(c,$e),S(c,Ge));({hour:r,minute:n,second:i,millisecond:o,microsecond:s,nanosecond:a}=px(c)),{hour:r,minute:n,second:i,millisecond:o,microsecond:s,nanosecond:a}=Ax(r,n,i,o,s,a,e)}else({hour:r,minute:n,second:i,millisecond:o,microsecond:s,nanosecond:a}=function(f){let u=qEe.exec(f),m,_,v,A,T,M,D;if(u){m=rn(u[1]),_=rn(u[2]||u[5]),v=rn(u[3]||u[6]),v===60&&(v=59);let O=(u[4]||u[7])+"000000000";A=rn(O.slice(0,3)),T=rn(O.slice(3,6)),M=rn(O.slice(6,9)),D=u[14];for(let[,U,L,F]of D.matchAll(Eu))if(L!=="u-ca"&&U==="!")throw new RangeError(`Unrecognized annotation: !${L}=${F}`);if(u[8])throw new RangeError("Z designator not supported for PlainTime")}else{let O,U;if({hasTime:U,hour:m,minute:_,second:v,millisecond:A,microsecond:T,nanosecond:M,z:O}=Gc(f),!U)throw new RangeError(`time is missing in string: ${f}`);if(O)throw new RangeError("Z designator not supported for PlainTime")}if(/[tT ][0-9][0-9]/.test(f))return{hour:m,minute:_,second:v,millisecond:A,microsecond:T,nanosecond:M};try{let{month:O,day:U}=Z9(f);Uc(1972,O,U)}catch{try{let{year:O,month:U}=K9(f);Uc(O,U,1)}catch{return{hour:m,minute:_,second:v,millisecond:A,microsecond:T,nanosecond:M}}}throw new RangeError(`invalid ISO 8601 time-only string ${f}; may need a T prefix`)}(Mi(c))),qx(r,n,i,o,s,a);return new(se("%Temporal.PlainTime%"))(r,n,i,o,s,a)}function wv(t,e){if(pr(t)){if(Gt(t))return t;let s=Fv(t);return Zh(s,Ye(t,nn(s,["month","monthCode","year"]),[]),e)}Jr(e);let{year:r,month:n,referenceISODay:i,calendar:o}=K9(Mi(t));if(o===void 0&&(o="iso8601"),!ef(o))throw new RangeError(`invalid calendar identifier ${o}`);return o=Fc(o),i===void 0?(Uc(r,n,1),Tv(r,n,o)):Zh(o,Tv(r,n,o,i))}function mx(t,e,r,n,i,o,s,a,c,d,f,u,m,_,v){let A=new(se("%Temporal.PlainDateTime%"))(t,e,r,n,i,o,s,a,c);if(d==="wall"||_==="ignore")return S(Ri(u,A,m),Ae);if(d==="exact"||_==="use"){let M=bu(t,e,r,n,i,o,s,a,c);if(M===null)throw new RangeError("ZonedDateTime outside of supported range");return N.default.subtract(M,N.default.BigInt(f))}let T=yx(u,A);for(let M of T){let D=ka(u,M),O=N.default.toNumber(Co(N.default.BigInt(D),PY,"halfExpand"));if(D===f||v&&O===f)return S(M,Ae)}if(_==="reject"){let M=jx(f),D=os(u)?S(u,Cc):"time zone";throw new RangeError(`Offset ${M} is invalid for ${A.toString()} in ${D}`)}return S(LY(T,u,A,m),Ae)}function _v(t,e){let r,n,i,o,s,a,c,d,f,u,m,_,v,A,T=!1,M="option";if(pr(t)){if(ge(t))return t;_=Fv(t);let O=nn(_,["day","hour","microsecond","millisecond","minute","month","monthCode","nanosecond","second","year"]);O.push("timeZone","offset");let U=Ye(t,O,["timeZone"]);u=ni(U.timeZone),m=U.offset,m===void 0&&(M="wall"),v=jm(e),A=hx(e,"reject"),{year:r,month:n,day:i,hour:o,minute:s,second:a,millisecond:c,microsecond:d,nanosecond:f}=qv(_,U,e)}else{let O,U;if({year:r,month:n,day:i,hour:o,minute:s,second:a,millisecond:c,microsecond:d,nanosecond:f,ianaName:O,offset:m,z:U,calendar:_}=function(F){let $=Gc(F);if(!$.ianaName)throw new RangeError("Temporal.ZonedDateTime requires a time zone ID in brackets");return $}(Mi(t)),u=ni(O),U?M="exact":m||(M="wall"),_||(_="iso8601"),!ef(_))throw new RangeError(`invalid calendar identifier ${_}`);_=Fc(_),T=!0,v=jm(e),A=hx(e,"reject"),Jr(e)}let D=0;return M==="option"&&(D=gu(m)),qn(mx(r,n,i,o,s,a,c,d,f,M,D,u,v,A,T),u,_)}function kY(t,e,r,n,i){Uc(e,r,n),KY(e,r,n),$c(t),Ve(t,de,e),Ve(t,fe,r),Ve(t,he,n),Ve(t,X,i),Ve(t,mY,!0)}function fs(t,e,r,n="iso8601"){let i=se("%Temporal.PlainDate%"),o=ii(i.prototype);return kY(o,t,e,r,n),o}function BY(t,e,r,n,i,o,s,a,c,d,f){o7(e,r,n,i,o,s,a,c,d),ZY(e,r,n,i,o,s,a,c,d),$c(t),Ve(t,de,e),Ve(t,fe,r),Ve(t,he,n),Ve(t,Le,i),Ve(t,Ue,o),Ve(t,Fe,s),Ve(t,ze,a),Ve(t,$e,c),Ve(t,Ge,d),Ve(t,X,f)}function lo(t,e,r,n,i,o,s,a,c,d="iso8601"){let f=se("%Temporal.PlainDateTime%"),u=ii(f.prototype);return BY(u,t,e,r,n,i,o,s,a,c,d),u}function DY(t,e,r,n,i){Uc(i,e,r),KY(i,e,r),$c(t),Ve(t,fe,e),Ve(t,he,r),Ve(t,de,i),Ve(t,X,n),Ve(t,gY,!0)}function Av(t,e,r="iso8601",n=1972){let i=se("%Temporal.PlainMonthDay%"),o=ii(i.prototype);return DY(o,t,e,r,n),o}function CY(t,e,r,n,i){Uc(e,r,i),function(s,a){Un(s,cx,dx),s===cx?Un(a,4,12):s===dx&&Un(a,1,9)}(e,r),$c(t),Ve(t,de,e),Ve(t,fe,r),Ve(t,he,i),Ve(t,X,n),Ve(t,yY,!0)}function Tv(t,e,r="iso8601",n=1){let i=se("%Temporal.PlainYearMonth%"),o=ii(i.prototype);return CY(o,t,e,r,n),o}function OY(t,e,r,n){Uh(e),$c(t),Ve(t,Ae,e),Ve(t,Xt,r),Ve(t,X,n);let i=new(se("%Temporal.Instant%"))(S(t,Ae));Ve(t,ri,i)}function qn(t,e,r="iso8601"){let n=se("%Temporal.ZonedDateTime%"),i=ii(n.prototype);return OY(i,t,e,r),i}function nn(t,e){if(typeof t=="string"){let i=new(se("%Temporal.Calendar%"))(t);return _e(se("%Temporal.Calendar.prototype.fields%"),i,[e])}let r=_e(Zt(t,"fields"),t,[e]),n=[];for(let i of r){if(typeof i!="string")throw new TypeError("bad return from calendar.fields()");EY.call(n,i)}return n}function Kh(t,e,r){if(typeof t=="string"){let i=new(se("%Temporal.Calendar%"))(t);return _e(se("%Temporal.Calendar.prototype.mergeFields%"),i,[e,r])}let n=_e(Zt(t,"mergeFields"),t,[e,r]);if(!pr(n))throw new TypeError("bad return from calendar.mergeFields()");return n}function Ln(t,e,r,n,i){let o=i;if(typeof t=="string"){let a=new(se("%Temporal.Calendar%"))(t);return _e(se("%Temporal.Calendar.prototype.dateAdd%"),a,[e,r,n])}o===void 0&&(o=Zt(t,"dateAdd"));let s=Sx(o,t,[e,r,n]);if(!rt(s))throw new TypeError("invalid result");return s}function yu(t,e,r,n,i){let o=i;if(typeof t=="string"){let a=new(se("%Temporal.Calendar%"))(t);return _e(se("%Temporal.Calendar.prototype.dateUntil%"),a,[e,r,n])}o===void 0&&(o=Zt(t,"dateUntil"));let s=Sx(o,t,[e,r,n]);if(!Dr(s))throw new TypeError("invalid result");return s}function Tx(t,e){if(typeof t=="string"){let n=new(se("%Temporal.Calendar%"))(t);return _e(se("%Temporal.Calendar.prototype.year%"),n,[e])}let r=_e(Zt(t,"year"),t,[e]);if(typeof r!="number")throw new TypeError("calendar year result must be an integer");if(!jo(r))throw new RangeError("calendar year result must be an integer");return r}function Px(t,e){if(typeof t=="string"){let n=new(se("%Temporal.Calendar%"))(t);return _e(se("%Temporal.Calendar.prototype.month%"),n,[e])}let r=_e(Zt(t,"month"),t,[e]);if(typeof r!="number")throw new TypeError("calendar month result must be a positive integer");if(!jo(r)||r<1)throw new RangeError("calendar month result must be a positive integer");return r}function Lv(t,e){if(typeof t=="string"){let n=new(se("%Temporal.Calendar%"))(t);return _e(se("%Temporal.Calendar.prototype.monthCode%"),n,[e])}let r=_e(Zt(t,"monthCode"),t,[e]);if(typeof r!="string")throw new TypeError("calendar monthCode result must be a string");return r}function Uv(t,e){if(typeof t=="string"){let n=new(se("%Temporal.Calendar%"))(t);return _e(se("%Temporal.Calendar.prototype.day%"),n,[e])}let r=_e(Zt(t,"day"),t,[e]);if(typeof r!="number")throw new TypeError("calendar day result must be a positive integer");if(!jo(r)||r<1)throw new RangeError("calendar day result must be a positive integer");return r}function Ix(t,e){if(typeof t=="string"){let n=new(se("%Temporal.Calendar%"))(t);return _e(se("%Temporal.Calendar.prototype.era%"),n,[e])}let r=_e(Zt(t,"era"),t,[e]);if(r===void 0)return r;if(typeof r!="string")throw new TypeError("calendar era result must be a string or undefined");return r}function Rx(t,e){if(typeof t=="string"){let n=new(se("%Temporal.Calendar%"))(t);return _e(se("%Temporal.Calendar.prototype.eraYear%"),n,[e])}let r=_e(Zt(t,"eraYear"),t,[e]);if(r===void 0)return r;if(typeof r!="number")throw new TypeError("calendar eraYear result must be an integer or undefined");if(!jo(r))throw new RangeError("calendar eraYear result must be an integer or undefined");return r}function Y9(t,e){if(typeof t=="string"){let n=new(se("%Temporal.Calendar%"))(t);return _e(se("%Temporal.Calendar.prototype.dayOfWeek%"),n,[e])}let r=_e(Zt(t,"dayOfWeek"),t,[e]);if(typeof r!="number")throw new TypeError("calendar dayOfWeek result must be a positive integer");if(!jo(r)||r<1)throw new RangeError("calendar dayOfWeek result must be a positive integer");return r}function J9(t,e){if(typeof t=="string"){let n=new(se("%Temporal.Calendar%"))(t);return _e(se("%Temporal.Calendar.prototype.dayOfYear%"),n,[e])}let r=_e(Zt(t,"dayOfYear"),t,[e]);if(typeof r!="number")throw new TypeError("calendar dayOfYear result must be a positive integer");if(!jo(r)||r<1)throw new RangeError("calendar dayOfYear result must be a positive integer");return r}function X9(t,e){if(typeof t=="string"){let n=new(se("%Temporal.Calendar%"))(t);return _e(se("%Temporal.Calendar.prototype.weekOfYear%"),n,[e])}let r=_e(Zt(t,"weekOfYear"),t,[e]);if(typeof r!="number")throw new TypeError("calendar weekOfYear result must be a positive integer");if(!jo(r)||r<1)throw new RangeError("calendar weekOfYear result must be a positive integer");return r}function Q9(t,e){if(typeof t=="string"){let n=new(se("%Temporal.Calendar%"))(t);return _e(se("%Temporal.Calendar.prototype.yearOfWeek%"),n,[e])}let r=_e(Zt(t,"yearOfWeek"),t,[e]);if(typeof r!="number")throw new TypeError("calendar yearOfWeek result must be an integer");if(!jo(r))throw new RangeError("calendar yearOfWeek result must be an integer");return r}function e7(t,e){if(typeof t=="string"){let n=new(se("%Temporal.Calendar%"))(t);return _e(se("%Temporal.Calendar.prototype.daysInWeek%"),n,[e])}let r=_e(Zt(t,"daysInWeek"),t,[e]);if(typeof r!="number")throw new TypeError("calendar daysInWeek result must be a positive integer");if(!jo(r)||r<1)throw new RangeError("calendar daysInWeek result must be a positive integer");return r}function Mx(t,e){if(typeof t=="string"){let n=new(se("%Temporal.Calendar%"))(t);return _e(se("%Temporal.Calendar.prototype.daysInMonth%"),n,[e])}let r=_e(Zt(t,"daysInMonth"),t,[e]);if(typeof r!="number")throw new TypeError("calendar daysInMonth result must be a positive integer");if(!jo(r)||r<1)throw new RangeError("calendar daysInMonth result must be a positive integer");return r}function kx(t,e){if(typeof t=="string"){let n=new(se("%Temporal.Calendar%"))(t);return _e(se("%Temporal.Calendar.prototype.daysInYear%"),n,[e])}let r=_e(Zt(t,"daysInYear"),t,[e]);if(typeof r!="number")throw new TypeError("calendar daysInYear result must be a positive integer");if(!jo(r)||r<1)throw new RangeError("calendar daysInYear result must be a positive integer");return r}function Bx(t,e){if(typeof t=="string"){let n=new(se("%Temporal.Calendar%"))(t);return _e(se("%Temporal.Calendar.prototype.monthsInYear%"),n,[e])}let r=_e(Zt(t,"monthsInYear"),t,[e]);if(typeof r!="number")throw new TypeError("calendar monthsInYear result must be a positive integer");if(!jo(r)||r<1)throw new RangeError("calendar monthsInYear result must be a positive integer");return r}function Dx(t,e){if(typeof t=="string"){let n=new(se("%Temporal.Calendar%"))(t);return _e(se("%Temporal.Calendar.prototype.inLeapYear%"),n,[e])}let r=_e(Zt(t,"inLeapYear"),t,[e]);if(typeof r!="boolean")throw new TypeError("calendar inLeapYear result must be a boolean");return r}function yo(t){if(pr(t)){if(_n(t,X))return S(t,X);if(!function(i){return!!Br(i)||"dateAdd"in i&&"dateFromFields"in i&&"dateUntil"in i&&"day"in i&&"dayOfWeek"in i&&"dayOfYear"in i&&"daysInMonth"in i&&"daysInWeek"in i&&"daysInYear"in i&&"fields"in i&&"id"in i&&"inLeapYear"in i&&"mergeFields"in i&&"month"in i&&"monthCode"in i&&"monthDayFromFields"in i&&"monthsInYear"in i&&"weekOfYear"in i&&"year"in i&&"yearMonthFromFields"in i&&"yearOfWeek"in i}(t))throw new TypeError("expected a Temporal.Calendar or object implementing the Temporal.Calendar protocol");return t}let e=Mi(t);if(ef(e))return Fc(e);let r;try{({calendar:r}=Gc(e))}catch{try{({calendar:r}=K9(e))}catch{({calendar:r}=Z9(e))}}if(r||(r="iso8601"),!ef(r))throw new RangeError(`invalid calendar identifier ${r}`);return Fc(r)}function Fv(t){if(_n(t,X))return S(t,X);let{calendar:e}=t;return e===void 0?"iso8601":yo(e)}function Fn(t){if(typeof t=="string")return t;let e=t.id;if(typeof e!="string")throw new TypeError("calendar.id should be a string");return e}function Wm(t){return pr(t)?t:new(se("%Temporal.Calendar%"))(t)}function zv(t,e){return t===e?!0:Fn(t)===Fn(e)}function Cx(t,e,r){if(t===e)return;let n=Fn(t),i=Fn(e);if(n!==i)throw new RangeError(`cannot ${r} of ${n} and ${i} calendars`)}function jY(t,e){if(t===e)return e;let r=Fn(t),n=Fn(e);if(r===n||r==="iso8601")return e;if(n==="iso8601")return t;throw new RangeError("irreconcilable calendars")}function Xd(t,e,r,n){if(typeof t=="string"){let o=new(se("%Temporal.Calendar%"))(t);return _e(se("%Temporal.Calendar.prototype.dateFromFields%"),o,[e,r])}let i=_e(n??Zt(t,"dateFromFields"),t,[e,r]);if(!rt(i))throw new TypeError("invalid result");return i}function Zh(t,e,r){if(typeof t=="string"){let i=new(se("%Temporal.Calendar%"))(t);return _e(se("%Temporal.Calendar.prototype.yearMonthFromFields%"),i,[e,r])}let n=_e(Zt(t,"yearMonthFromFields"),t,[e,r]);if(!Gt(n))throw new TypeError("invalid result");return n}function Nm(t,e,r){if(typeof t=="string"){let i=new(se("%Temporal.Calendar%"))(t);return _e(se("%Temporal.Calendar.prototype.monthDayFromFields%"),i,[e,r])}let n=_e(Zt(t,"monthDayFromFields"),t,[e,r]);if(!vn(n))throw new TypeError("invalid result");return n}function ni(t){if(pr(t)){if(ge(t))return S(t,Xt);if(!function(r){return!!os(r)||"getOffsetNanosecondsFor"in r&&"getPossibleInstantsFor"in r&&"id"in r}(t))throw new TypeError("expected a Temporal.TimeZone or object implementing the Temporal.TimeZone protocol");return t}return t4e(Mi(t))}function Pv(t){if(typeof t=="string")return t;let e=t.id;if(typeof e!="string")throw new TypeError("timeZone.id should be a string");return e}function NY(t){return pr(t)?t:new(se("%Temporal.TimeZone%"))(t)}function qY(t,e){return t===e?!0:Pv(t)===Pv(e)}function qm(t){return fs(S(t,de),S(t,fe),S(t,he),S(t,X))}function t7(t){return new(se("%Temporal.PlainTime%"))(S(t,Le),S(t,Ue),S(t,Fe),S(t,ze),S(t,$e),S(t,Ge))}function ka(t,e,r){if(typeof t=="string"){let i=new(se("%Temporal.TimeZone%"))(t);return _e(se("%Temporal.TimeZone.prototype.getOffsetNanosecondsFor%"),i,[e])}let n=_e(r??Zt(t,"getOffsetNanosecondsFor"),t,[e]);if(typeof n!="number")throw new TypeError("bad return from getOffsetNanosecondsFor");if(!jo(n)||hr(n)>=864e11)throw new RangeError("out-of-range return from getOffsetNanosecondsFor");return n}function w9(t,e){return jx(ka(t,e))}function Oo(t,e,r){let n=S(e,Ae),i=ka(t,e),{year:o,month:s,day:a,hour:c,minute:d,second:f,millisecond:u,microsecond:m,nanosecond:_}=FY(n);return{year:o,month:s,day:a,hour:c,minute:d,second:f,millisecond:u,microsecond:m,nanosecond:_}=n7(o,s,a,c,d,f,u,m,_+i),lo(o,s,a,c,d,f,u,m,_,r)}function Ri(t,e,r){return LY(yx(t,e),t,e,r)}function LY(t,e,r,n){let i=se("%Temporal.Instant%"),o=t.length;if(o===1)return t[0];if(o)switch(n){case"compatible":case"earlier":return t[0];case"later":return t[o-1];case"reject":throw new RangeError("multiple instants found")}let s=S(r,de),a=S(r,fe),c=S(r,he),d=S(r,Le),f=S(r,Ue),u=S(r,Fe),m=S(r,ze),_=S(r,$e),v=S(r,Ge),A=bu(s,a,c,d,f,u,m,_,v);if(A===null)throw new RangeError("DateTime outside of supported range");let T=new i(N.default.subtract(A,Lc)),M=new i(N.default.add(A,Lc)),D=ka(e,T),O=ka(e,M)-D;switch(n){case"earlier":{let U=S(r,X),L=se("%Temporal.PlainDateTime%"),F=S9(s,a,c,d,f,u,m,_,v,U,0,0,0,0,0,0,0,0,0,-O,void 0);return yx(e,new L(F.year,F.month,F.day,F.hour,F.minute,F.second,F.millisecond,F.microsecond,F.nanosecond,U))[0]}case"compatible":case"later":{let U=S(r,X),L=se("%Temporal.PlainDateTime%"),F=S9(s,a,c,d,f,u,m,_,v,U,0,0,0,0,0,0,0,0,0,O,void 0),$=yx(e,new L(F.year,F.month,F.day,F.hour,F.minute,F.second,F.millisecond,F.microsecond,F.nanosecond,U));return $[$.length-1]}case"reject":throw new RangeError("no such instant found")}}function yx(t,e,r){if(typeof t=="string"){let o=new(se("%Temporal.TimeZone%"))(t);return _e(se("%Temporal.TimeZone.prototype.getPossibleInstantsFor%"),o,[e])}let n=_e(r??Zt(t,"getPossibleInstantsFor"),t,[e]),i=[];for(let o of n){if(!ln(o))throw new TypeError("bad return from getPossibleInstantsFor");EY.call(i,o)}return i}function tp(t){let e;return t<0||t>9999?e=(t<0?"-":"+")+`000000${hr(t)}`.slice(-6):e=`0000${t}`.slice(-4),e}function Sr(t){return`00${t}`.slice(-2)}function Ox(t,e,r,n,i){if(i==="minute")return"";let o=`:${Sr(t)}`,s,a=1e6*e+1e3*r+n;if(i==="auto"){if(a===0)return o;for(s=`${a}`.padStart(9,"0");s[s.length-1]==="0";)s=s.slice(0,-1)}else{if(i===0)return o;s=`${a}`.padStart(9,"0").slice(0,i)}return`${o}.${s}`}function GZ(t,e,r){let n=e;n===void 0&&(n="UTC");let i=Oo(n,t,"iso8601"),o=tp(S(i,de)),s=Sr(S(i,fe)),a=Sr(S(i,he)),c=Sr(S(i,Le)),d=Sr(S(i,Ue)),f=Ox(S(i,Fe),S(i,ze),S(i,$e),S(i,Ge),r),u="Z";return e!==void 0&&(u=UY(ka(n,t))),`${o}-${s}-${a}T${c}:${d}${f}${u}`}function f9(t,e="auto",r){function n(z){return z<=VEe?z.toString(10):N.default.BigInt(z).toString(10)}let i=S(t,wi),o=S(t,Bn),s=S(t,Vi),a=S(t,_i),c=S(t,xi),d=S(t,Ei),f=S(t,Si),u=S(t,Ai),m=S(t,Ti),_=S(t,Pi),v=qc(i,o,s,a,c,d,f,u,m,_);if(r){let{unit:z,increment:j,roundingMode:y}=r;({seconds:f,milliseconds:u,microseconds:m,nanoseconds:_}=Qd(0,0,0,0,0,0,f,u,m,_,j,z,y))}let A=[];i&&A.push(`${n(hr(i))}Y`),o&&A.push(`${n(hr(o))}M`),s&&A.push(`${n(hr(s))}W`),a&&A.push(`${n(hr(a))}D`);let T=[];c&&T.push(`${n(hr(c))}H`),d&&T.push(`${n(hr(d))}M`);let M=[],D,O,U,L,F=Lm(0,0,0,f,u,m,_,0);({quotient:F,remainder:D}=Yr(F,Ht)),{quotient:F,remainder:O}=Yr(F,Ht),{quotient:L,remainder:U}=Yr(F,Ht);let $=1e6*hr(N.default.toNumber(U))+1e3*hr(N.default.toNumber(O))+hr(N.default.toNumber(D)),H;if(e==="auto"){if($!==0)for(H=`${$}`.padStart(9,"0");H[H.length-1]==="0";)H=H.slice(0,-1)}else e!==0&&(H=`${$}`.padStart(9,"0").slice(0,e));return H&&M.unshift(".",H),N.default.equal(L,Or)&&!M.length&&e==="auto"||M.unshift(Ia(L).toString()),M.length&&T.push(`${M.join("")}S`),T.length&&T.unshift("T"),A.length||T.length?`${v<0?"-":""}P${A.join("")}${T.join("")}`:"PT0S"}function HZ(t,e="auto"){return`${tp(S(t,de))}-${Sr(S(t,fe))}-${Sr(S(t,he))}${W9(S(t,X),e)}`}function WZ(t,e,r="auto",n){let i=S(t,de),o=S(t,fe),s=S(t,he),a=S(t,Le),c=S(t,Ue),d=S(t,Fe),f=S(t,ze),u=S(t,$e),m=S(t,Ge);if(n){let{unit:_,increment:v,roundingMode:A}=n;({year:i,month:o,day:s,hour:a,minute:c,second:d,millisecond:f,microsecond:u,nanosecond:m}=d7(i,o,s,a,c,d,f,u,m,v,_,A))}return`${tp(i)}-${Sr(o)}-${Sr(s)}T${Sr(a)}:${Sr(c)}${Ox(d,f,u,m,e)}${W9(S(t,X),r)}`}function VZ(t,e="auto"){let r=`${Sr(S(t,fe))}-${Sr(S(t,he))}`,n=Fn(S(t,X));(e==="always"||e==="critical"||n!=="iso8601")&&(r=`${tp(S(t,de))}-${r}`);let i=V9(n,e);return i&&(r+=i),r}function KZ(t,e="auto"){let r=`${tp(S(t,de))}-${Sr(S(t,fe))}`,n=Fn(S(t,X));(e==="always"||e==="critical"||n!=="iso8601")&&(r+=`-${Sr(S(t,he))}`);let i=V9(n,e);return i&&(r+=i),r}function ZZ(t,e,r="auto",n="auto",i="auto",o){let s=S(t,ri);if(o){let{unit:f,increment:u,roundingMode:m}=o,_=vx(S(t,Ae),u,f,m);s=new(se("%Temporal.Instant%"))(_)}let a=S(t,Xt),c=Oo(a,s,"iso8601"),d=`${tp(S(c,de))}-${Sr(S(c,fe))}-${Sr(S(c,he))}T${Sr(S(c,Le))}:${Sr(S(c,Ue))}${Ox(S(c,Fe),S(c,ze),S(c,$e),S(c,Ge),e)}`;return i!=="never"&&(d+=UY(ka(a,s))),n!=="never"&&(d+=`[${n==="critical"?"!":""}${Pv(a)}]`),d+=W9(S(t,X),r),d}function Am(t){return rJ.test(Dv(t))}function gu(t){let e=rJ.exec(Dv(t));if(!e)throw new RangeError(`invalid time zone offset: ${t}`);return(e[1]==="-"||e[1]==="\u2212"?-1:1)*(1e9*(60*(60*+e[2]+ +(e[3]||0))+ +(e[4]||0))+ +((e[5]||0)+"000000000").slice(0,9))}function r7(t){return Am(t)?jx(gu(t)):MY(Dv(t)).resolvedOptions().timeZone}function Kd(t,e){let{year:r,month:n,day:i,hour:o,minute:s,second:a,millisecond:c,microsecond:d,nanosecond:f}=zY(t,e),u=r%400,m=(r-u)/400,_=N.default.multiply(N.default.BigInt(146097),Lc),v=bu(u,n,i,o,s,a,c,d,f),A=N.default.add(v,N.default.multiply(_,N.default.BigInt(m)));return N.default.toNumber(N.default.subtract(A,e))}function jx(t){let e=t<0?"-":"+",r=hr(t),n=r%1e9,i=po(r/1e9)%60,o=po(r/6e10)%60,s=Sr(po(r/36e11)),a=Sr(o),c=Sr(i),d="";if(n){let f=`${n}`.padStart(9,"0");for(;f[f.length-1]==="0";)f=f.slice(0,-1);d=`:${c}.${f}`}else i&&(d=`:${c}`);return`${e}${s}:${a}${d}`}function UY(t){let e=N.default.toNumber(Co(N.default.BigInt(t),PY,"halfExpand")),r=e<0?"-":"+";e=hr(e);let n=e/6e10%60;return`${r}${Sr(po(e/36e11))}:${Sr(n)}`}function bu(t,e,r,n,i,o,s,a,c){let d=new Date;d.setUTCHours(n,i,o,s),d.setUTCFullYear(t,e-1,r);let f=d.getTime();if(Ex(f))return null;let u=N.default.multiply(N.default.BigInt(f),cs);return u=N.default.add(u,N.default.multiply(N.default.BigInt(a),Ht)),u=N.default.add(u,N.default.BigInt(c)),N.default.lessThan(u,Sv)||N.default.greaterThan(u,Cm)?null:u}function FY(t){let{quotient:e,remainder:r}=Yr(t,cs),n=N.default.toNumber(e),i=N.default.toNumber(r);i<0&&(i+=1e6,n-=1);let o=po(i/1e3)%1e3,s=i%1e3,a=new Date(n);return{epochMilliseconds:n,year:a.getUTCFullYear(),month:a.getUTCMonth()+1,day:a.getUTCDate(),hour:a.getUTCHours(),minute:a.getUTCMinutes(),second:a.getUTCSeconds(),millisecond:a.getUTCMilliseconds(),microsecond:o,nanosecond:s}}function zY(t,e){let{epochMilliseconds:r,millisecond:n,microsecond:i,nanosecond:o}=FY(e),{year:s,month:a,day:c,hour:d,minute:f,second:u}=function(_,v){let A=MY(_).format(new Date(v));return function(M){let D=M.split(/[^\w]+/);if(D.length!==7)throw new RangeError(`expected 7 parts in "${M}`);let O=+D[0],U=+D[1],L=+D[2],F=D[3].toUpperCase();if(F==="B"||F==="BC")L=1-L;else if(F!=="A"&&F!=="AD")throw new RangeError(`Unknown era ${F} in "${M}`);let $=+D[4];$===24&&($=0);let H=+D[5],z=+D[6];if(!(Ii(L)&&Ii(O)&&Ii(U)&&Ii($)&&Ii(H)&&Ii(z)))throw new RangeError(`Invalid number in "${M}`);return{year:L,month:O,day:U,hour:$,minute:H,second:z}}(A)}(t,r);return n7(s,a,c,d,f,u,n,i,o)}function YZ(t,e){return N.default.lessThan(t,e)?e:t}function $Y(){return N.default.add(u7(),JEe)}function GY(t,e){if(N.default.lessThan(e,Tm))return GY(t,Tm);let r=N.default.add(e,IY),n=YZ($Y(),r),i=YZ(Tm,e),o=Kd(t,i),s=i,a=o;for(;o===a&&N.default.lessThan(N.default.BigInt(i),n);){if(s=N.default.add(i,RY),N.default.greaterThan(s,Cm))return null;a=Kd(t,s),o===a&&(i=s)}return o===a?null:nJ(c=>Kd(t,c),i,s,o,a)}function _9(t,e){let r=$Y(),n=N.default.greaterThan(e,r),i=n?N.default.subtract(e,IY):Tm;if(t==="Africa/Casablanca"||t==="Africa/El_Aaiun"){let d=S(Ra("2088-01-01T00Z"),Ae);if(N.default.lessThan(d,e))return _9(t,d)}let o=N.default.subtract(e,zm);if(N.default.lessThan(o,Tm))return null;let s=Kd(t,o),a=o,c=s;for(;s===c&&N.default.greaterThan(o,i);){if(a=N.default.subtract(o,RY),N.default.lessThan(a,Tm))return null;c=Kd(t,a),s===c&&(o=a)}if(s===c){if(n){let d=N.default.subtract(r,Lc);return _9(t,d)}return null}return nJ(d=>Kd(t,d),a,o,c,s)}function vu(t){return t===void 0?!1:t%4==0&&(t%100!=0||t%400==0)}function Zd(t,e){return{standard:[31,28,31,30,31,30,31,31,30,31,30,31],leapyear:[31,29,31,30,31,30,31,31,30,31,30,31]}[vu(t)?"leapyear":"standard"][e-1]}function x9(t,e,r){let n=e+(e<3?10:-2),i=t-(e<3?1:0),o=po(i/100),s=i-100*o,a=(r+po(2.6*n-.2)+(s+po(s/4))+(po(o/4)-2*o))%7;return a+(a<=0?7:0)}function gx(t,e,r){let n=r;for(let i=e-1;i>0;i--)n+=Zd(t,i);return n}function JZ(t,e,r){let n=gx(t,e,r),i=x9(t,e,r)||7,o=x9(t,1,1),s=po((n-i+10)/7);return s<1?o===5||o===6&&vu(t-1)?{week:53,year:t-1}:{week:52,year:t-1}:s===53&&(vu(t)?366:365)-n<4-i?{week:1,year:t+1}:{week:s,year:t}}function qc(t,e,r,n,i,o,s,a,c,d){for(let f of[t,e,r,n,i,o,s,a,c,d])if(f!==0)return f<0?-1:1;return 0}function ix(t,e){let r=t,n=e;if(!Ii(r)||!Ii(n))throw new RangeError("infinity is out of range");return n-=1,r+=po(n/12),n%=12,n<0&&(n+=12),n+=1,{year:r,month:n}}function Nx(t,e,r){let n=t,i=e,o=r;if(!Ii(o))throw new RangeError("infinity is out of range");({year:n,month:i}=ix(n,i));let s=146097;if(hr(o)>s){let d=Fh(o/s);n+=400*d,o-=d*s}let a=0,c=i>2?n:n-1;for(;a=vu(c)?366:365,o<-a;)n-=1,c-=1,o+=a;for(c+=1;a=vu(c)?366:365,o>a;)n+=1,c+=1,o-=a;for(;o<1;)({year:n,month:i}=ix(n,i-1)),o+=Zd(n,i);for(;o>Zd(n,i);)o-=Zd(n,i),{year:n,month:i}=ix(n,i+1);return{year:n,month:i,day:o}}function n7(t,e,r,n,i,o,s,a,c){let{deltaDays:d,hour:f,minute:u,second:m,millisecond:_,microsecond:v,nanosecond:A}=Wd(n,i,o,s,a,c),{year:T,month:M,day:D}=Nx(t,e,r+d);return{year:T,month:M,day:D,hour:f,minute:u,second:m,millisecond:_,microsecond:v,nanosecond:A}}function Wd(t,e,r,n,i,o){let s,a=N.default.BigInt(t),c=N.default.BigInt(e),d=N.default.BigInt(r),f=N.default.BigInt(n),u=N.default.BigInt(i),m=N.default.BigInt(o);return{quotient:s,remainder:m}=Lh(m,Ht),u=N.default.add(u,s),{quotient:s,remainder:u}=Lh(u,Ht),f=N.default.add(f,s),{quotient:s,remainder:f}=Lh(f,Ht),d=N.default.add(d,s),{quotient:s,remainder:d}=Lh(d,jc),c=N.default.add(c,s),{quotient:s,remainder:c}=Lh(c,jc),a=N.default.add(a,s),{quotient:s,remainder:a}=Lh(a,AY),{deltaDays:N.default.toNumber(s),hour:N.default.toNumber(a),minute:N.default.toNumber(c),second:N.default.toNumber(d),millisecond:N.default.toNumber(f),microsecond:N.default.toNumber(u),nanosecond:N.default.toNumber(m)}}function Lm(t,e,r,n,i,o,s,a){let c=N.default.BigInt(t),d=N.default.BigInt(s);t!==0&&(d=N.default.subtract(N.default.BigInt(s),N.default.BigInt(a)));let f=N.default.add(N.default.BigInt(e),N.default.multiply(c,N.default.BigInt(24))),u=N.default.add(N.default.BigInt(r),N.default.multiply(f,jc)),m=N.default.add(N.default.BigInt(n),N.default.multiply(u,jc)),_=N.default.add(N.default.BigInt(i),N.default.multiply(m,Ht)),v=N.default.add(N.default.BigInt(o),N.default.multiply(_,Ht));return N.default.add(N.default.BigInt(d),N.default.multiply(v,Ht))}function i7(t,e){let r=se("%Temporal.Instant%"),n=Dm(N.default.toNumber(t)),i=N.default.BigInt(t),o=864e11;if(n===0)return{days:0,nanoseconds:Or,dayLengthNs:o};if(!ge(e)){let O;return{quotient:O,remainder:i}=Yr(i,N.default.BigInt(o)),{days:N.default.toNumber(O),nanoseconds:i,dayLengthNs:o}}let s=S(e,Ae),a=S(e,ri),c=N.default.add(s,i),d=new r(c),f=S(e,Xt),u=S(e,X),m=Oo(f,a,u),_=Oo(f,d,u),{days:v}=c7(S(m,de),S(m,fe),S(m,he),S(m,Le),S(m,Ue),S(m,Fe),S(m,ze),S(m,$e),S(m,Ge),S(_,de),S(_,fe),S(_,he),S(_,Le),S(_,Ue),S(_,Fe),S(_,ze),S(_,$e),S(_,Ge),u,"day",ii(null)),A=ds(a,f,u,0,0,0,v,0,0,0,0,0,0),T=N.default.BigInt(v);if(n===1)for(;N.default.greaterThan(T,Or)&&N.default.greaterThan(A,c);)T=N.default.subtract(T,zm),A=ds(a,f,u,0,0,0,N.default.toNumber(T),0,0,0,0,0,0);i=N.default.subtract(c,A);let M=!1,D=new r(A);do{let O=ds(D,f,u,0,0,0,n,0,0,0,0,0,0),U=S(D,Ae);o=N.default.toNumber(N.default.subtract(O,U)),M=N.default.greaterThanOrEqual(N.default.multiply(N.default.subtract(i,N.default.BigInt(o)),N.default.BigInt(n)),Or),M&&(i=N.default.subtract(i,N.default.BigInt(o)),D=new r(O),T=N.default.add(T,N.default.BigInt(n)))}while(M);if(!ss(T)&&NZ(T)!==n)throw new RangeError("Time zone or calendar converted nanoseconds into a number of days with the opposite sign");if(!ss(i)&&NZ(i)!==n)throw fx(i)&&n===1?new Error("assert not reached"):new RangeError("Time zone or calendar ended up with a remainder of nanoseconds with the opposite sign");if(N.default.greaterThanOrEqual(Ia(i),Ia(N.default.BigInt(o))))throw new Error("assert not reached");return{days:N.default.toNumber(T),nanoseconds:i,dayLengthNs:hr(o)}}function Vs(t,e,r,n,i,o,s,a,c){let d=HY(t,e,r,n,i,o,s,a,c);if(d==="positive overflow"||d==="negative overflow")throw new RangeError("Duration out of range");return d}function HY(t,e,r,n,i,o,s,a,c){let d,f,u,m,_,v,A=t;if(ge(c)){let $=ds(S(c,ri),S(c,Xt),S(c,X),0,0,0,A,e,r,n,i,o,s),H=S(c,Ae);d=N.default.subtract($,H)}else d=Lm(A,e,r,n,i,o,s,0);a==="year"||a==="month"||a==="week"||a==="day"?{days:A,nanoseconds:d}=i7(d,c):A=0;let T=N.default.lessThan(d,Or)?-1:1;switch(d=Ia(d),f=u=m=_=v=Or,a){case"year":case"month":case"week":case"day":case"hour":({quotient:f,remainder:d}=Yr(d,Ht)),{quotient:u,remainder:f}=Yr(f,Ht),{quotient:m,remainder:u}=Yr(u,Ht),{quotient:_,remainder:m}=Yr(m,jc),{quotient:v,remainder:_}=Yr(_,jc);break;case"minute":({quotient:f,remainder:d}=Yr(d,Ht)),{quotient:u,remainder:f}=Yr(f,Ht),{quotient:m,remainder:u}=Yr(u,Ht),{quotient:_,remainder:m}=Yr(m,jc);break;case"second":({quotient:f,remainder:d}=Yr(d,Ht)),{quotient:u,remainder:f}=Yr(f,Ht),{quotient:m,remainder:u}=Yr(u,Ht);break;case"millisecond":({quotient:f,remainder:d}=Yr(d,Ht)),{quotient:u,remainder:f}=Yr(f,Ht);break;case"microsecond":({quotient:f,remainder:d}=Yr(d,Ht));break;case"nanosecond":break;default:throw new Error("assert not reached")}let M=N.default.toNumber(v)*T,D=N.default.toNumber(_)*T,O=N.default.toNumber(m)*T,U=N.default.toNumber(u)*T,L=N.default.toNumber(f)*T,F=N.default.toNumber(d)*T;for(let $ of[A,M,D,O,U,L,F])if(!Ii($))return T===1?"positive overflow":"negative overflow";return{days:A,hours:M,minutes:D,seconds:O,milliseconds:U,microseconds:L,nanoseconds:F}}function rx(t,e,r,n,i,o){let s=se("%Temporal.Duration%"),a=qc(t,e,r,n,0,0,0,0,0,0);if(a===0)return{years:t,months:e,weeks:r,days:n};let c=N.default.BigInt(a),d,f,u=N.default.BigInt(t),m=N.default.BigInt(e),_=N.default.BigInt(r),v=N.default.BigInt(n);o&&(f=er(o),d=S(f,X));let A=new s(a),T=new s(0,a),M=new s(0,0,a);switch(i){case"year":break;case"month":{if(!d)throw new RangeError("a starting point is required for months balancing");let D,O;for(typeof d!="string"&&(D=Zt(d,"dateAdd"),O=Zt(d,"dateUntil"));!ss(u);){let U=Ln(d,f,A,void 0,D),L=ii(null);L.largestUnit="month";let F=yu(d,f,U,L,O),$=N.default.BigInt(S(F,Bn));f=U,m=N.default.add(m,$),u=N.default.subtract(u,c)}}break;case"week":{if(!d)throw new RangeError("a starting point is required for weeks balancing");let D=typeof d!="string"?Zt(d,"dateAdd"):void 0;for(;!ss(u);){let O;({relativeTo:f,days:O}=ti(d,f,A,D)),v=N.default.add(v,N.default.BigInt(O)),u=N.default.subtract(u,c)}for(;!ss(m);){let O;({relativeTo:f,days:O}=ti(d,f,T,D)),v=N.default.add(v,N.default.BigInt(O)),m=N.default.subtract(m,c)}break}default:{if(ss(u)&&ss(m)&&ss(_))break;if(!d)throw new RangeError("a starting point is required for balancing calendar units");let D=typeof d!="string"?Zt(d,"dateAdd"):void 0;for(;!ss(u);){let O;({relativeTo:f,days:O}=ti(d,f,A,D)),v=N.default.add(v,N.default.BigInt(O)),u=N.default.subtract(u,c)}for(;!ss(m);){let O;({relativeTo:f,days:O}=ti(d,f,T,D)),v=N.default.add(v,N.default.BigInt(O)),m=N.default.subtract(m,c)}for(;!ss(_);){let O;({relativeTo:f,days:O}=ti(d,f,M,D)),v=N.default.add(v,N.default.BigInt(O)),_=N.default.subtract(_,c)}break}}return{years:N.default.toNumber(u),months:N.default.toNumber(m),weeks:N.default.toNumber(_),days:N.default.toNumber(v)}}function XZ(t,e,r,n,i){if(ge(t)){let o=S(t,ri),s=S(t,Xt),a=S(t,X),c=ka(s,o),d=ds(o,s,a,e,r,n,i,0,0,0,0,0,0);return ka(s,new(se("%Temporal.Instant%"))(d))-c}return 0}function WY(t){return new(se("%Temporal.Duration%"))(-S(t,wi),-S(t,Bn),-S(t,Vi),-S(t,_i),-S(t,xi),-S(t,Ei),-S(t,Si),-S(t,Ai),-S(t,Ti),-S(t,Pi))}function ho(t,e,r){return GEe(r,HEe(e,t))}function VY(t,e,r){let n=ho(e,1,12);return{year:t,month:n,day:ho(r,1,Zd(t,n))}}function Un(t,e,r){if(t<e||t>r)throw new RangeError(`value out of range: ${e} <= ${t} <= ${r}`)}function Uc(t,e,r){Un(e,1,12),Un(r,1,Zd(t,e))}function KY(t,e,r){ZY(t,e,r,12,0,0,0,0,0)}function qx(t,e,r,n,i,o){Un(t,0,23),Un(e,0,59),Un(r,0,59),Un(n,0,999),Un(i,0,999),Un(o,0,999)}function o7(t,e,r,n,i,o,s,a,c){Uc(t,e,r),qx(n,i,o,s,a,c)}function ZY(t,e,r,n,i,o,s,a,c){if(Un(t,cx,dx),t===cx&&bu(t,e,r+1,n,i,o,s,a,c-1)==null||t===dx&&bu(t,e,r-1,n,i,o,s,a,c+1)==null)throw new RangeError("DateTime outside of supported range")}function Uh(t){if(N.default.lessThan(t,Sv)||N.default.greaterThan(t,Cm))throw new RangeError("Instant outside of supported range")}function bx(t,e,r,n,i,o,s,a,c,d){let f=qc(t,e,r,n,i,o,s,a,c,d);for(let u of[t,e,r,n,i,o,s,a,c,d]){if(!Ii(u))throw new RangeError("infinite values not allowed as duration fields");let m=Dm(u);if(m!==0&&m!==f)throw new RangeError("mixed-sign values not allowed as duration fields")}}function s7(t,e,r,n,i,o,s){switch(s){case"year":case"month":{let a=-mu(t,e,r,n,i,o);if(a===0)return{years:0,months:0,weeks:0,days:0};let c={year:t,month:e,day:r},d={year:n,month:i,day:o},f=d.year-c.year,u=$h(t,e,r,f,0,0,0,"constrain"),m=-mu(u.year,u.month,u.day,n,i,o);if(m===0)return s==="year"?{years:f,months:0,weeks:0,days:0}:{years:0,months:12*f,weeks:0,days:0};let _=d.month-c.month;if(m!==a&&(f-=a,_+=12*a),u=$h(t,e,r,f,_,0,0,"constrain"),m=-mu(u.year,u.month,u.day,n,i,o),m===0)return s==="year"?{years:f,months:_,weeks:0,days:0}:{years:0,months:_+12*f,weeks:0,days:0};m!==a&&(_-=a,_===-a&&(f-=a,_=11*a),u=$h(t,e,r,f,_,0,0,"constrain"));let v=0;return v=u.month===d.month?d.day-u.day:a<0?-u.day-(Zd(d.year,d.month)-d.day):d.day+(Zd(u.year,u.month)-u.day),s==="month"&&(_+=12*f,f=0),{years:f,months:_,weeks:0,days:v}}case"week":case"day":{let a,c,d;mu(t,e,r,n,i,o)<0?(c={year:t,month:e,day:r},a={year:n,month:i,day:o},d=1):(c={year:n,month:i,day:o},a={year:t,month:e,day:r},d=-1);let f=gx(a.year,a.month,a.day)-gx(c.year,c.month,c.day);for(let m=c.year;m<a.year;++m)f+=vu(m)?366:365;let u=0;return s==="week"&&(u=po(f/7),f%=7),u*=d,f*=d,{years:0,months:0,weeks:u,days:f}}default:throw new Error("assert not reached")}}function YY(t,e,r,n,i,o,s,a,c,d,f,u){let m=s-t,_=a-e,v=c-r,A=d-n,T=f-i,M=u-o,D=qc(0,0,0,0,m,_,v,A,T,M);m*=D,_*=D,v*=D,A*=D,T*=D,M*=D;let O=0;if({deltaDays:O,hour:m,minute:_,second:v,millisecond:A,microsecond:T,nanosecond:M}=Wd(m,_,v,A,T,M),O!=0)throw new Error("assertion failure in DifferenceTime: _bt_.[[Days]] should be 0");return m*=D,_*=D,v*=D,A*=D,T*=D,M*=D,{hours:m,minutes:_,seconds:v,milliseconds:A,microseconds:T,nanoseconds:M}}function a7(t,e,r,n,i,o){let s=N.default.subtract(e,t),a=0,c=0,d=N.default.toNumber(N.default.remainder(s,Ht)),f=N.default.toNumber(N.default.remainder(N.default.divide(s,Ht),Ht)),u=N.default.toNumber(N.default.remainder(N.default.divide(s,cs),Ht)),m=N.default.toNumber(N.default.divide(s,Nc));return{hours:a,minutes:c,seconds:m,milliseconds:u,microseconds:f,nanoseconds:d}=Qd(0,0,0,0,0,0,m,u,f,d,r,n,o),Vs(0,a,c,m,u,f,d,i)}function c7(t,e,r,n,i,o,s,a,c,d,f,u,m,_,v,A,T,M,D,O,U){let L=t,F=e,$=r,{hours:H,minutes:z,seconds:j,milliseconds:y,microseconds:P,nanoseconds:x}=YY(n,i,o,s,a,c,m,_,v,A,T,M),l=qc(0,0,0,0,H,z,j,y,P,x);mu(d,f,u,L,F,$)===-l&&({year:L,month:F,day:$}=Nx(L,F,$-l),{hours:H,minutes:z,seconds:j,milliseconds:y,microseconds:P,nanoseconds:x}=Vs(-l,H,z,j,y,P,x,O));let b=fs(L,F,$,D),h=fs(d,f,u,D),w=Vh("day",O),E=Su(U);E.largestUnit=w;let{years:g,months:I,weeks:B,days:R}=yu(D,b,h,E);return{days:R,hours:H,minutes:z,seconds:j,milliseconds:y,microseconds:P,nanoseconds:x}=Vs(R,H,z,j,y,P,x,O),{years:g,months:I,weeks:B,days:R,hours:H,minutes:z,seconds:j,milliseconds:y,microseconds:P,nanoseconds:x}}function JY(t,e,r,n,i,o){let s=N.default.subtract(e,t);if(N.default.equal(s,Or))return{years:0,months:0,weeks:0,days:0,hours:0,minutes:0,seconds:0,milliseconds:0,microseconds:0,nanoseconds:0};let a=se("%Temporal.Instant%"),c=new a(t),d=new a(e),f=Oo(r,c,n),u=Oo(r,d,n),{years:m,months:_,weeks:v,days:A}=c7(S(f,de),S(f,fe),S(f,he),S(f,Le),S(f,Ue),S(f,Fe),S(f,ze),S(f,$e),S(f,Ge),S(u,de),S(u,fe),S(u,he),S(u,Le),S(u,Ue),S(u,Fe),S(u,ze),S(u,$e),S(u,Ge),n,i,o),T=ds(c,r,n,m,_,v,0,0,0,0,0,0,0),M=N.default.subtract(e,T),D=qn(T,r,n);({nanoseconds:M,days:A}=i7(M,D));let{hours:O,minutes:U,seconds:L,milliseconds:F,microseconds:$,nanoseconds:H}=Vs(0,0,0,0,0,0,N.default.toNumber(M),"hour");return{years:m,months:_,weeks:v,days:A,hours:O,minutes:U,seconds:L,milliseconds:F,microseconds:$,nanoseconds:H}}function Vm(t,e,r,n,i,o){let s=Cv.reduce((_,v)=>{let A=v[0],T=v[1],M=v[2];return r!=="datetime"&&M!==r||n.includes(T)||_.push(T,A),_},[]),a=mo(e,"largestUnit",r,"auto");if(n.includes(a))throw new RangeError(`largestUnit must be one of ${s.join(", ")}, not ${a}`);let c=Gm(e),d=Ma(e,"trunc");t==="since"&&(d=function(v){switch(v){case"ceil":return"floor";case"floor":return"ceil";case"halfCeil":return"halfFloor";case"halfFloor":return"halfCeil";default:return v}}(d));let f=mo(e,"smallestUnit",r,i);if(n.includes(f))throw new RangeError(`smallestUnit must be one of ${s.join(", ")}, not ${f}`);let u=Vh(o,f);if(a==="auto"&&(a=u),Vh(a,f)!==a)throw new RangeError(`largestUnit ${a} cannot be smaller than smallestUnit ${f}`);let m={hour:24,minute:60,second:60,millisecond:1e3,microsecond:1e3,nanosecond:1e3}[f];return m!==void 0&&Hm(c,m,!1),{largestUnit:a,roundingIncrement:c,roundingMode:d,smallestUnit:f}}function QZ(t,e,r,n){let i=t==="since"?-1:1,o=Ra(r),s=Vm(t,Su(n),"time",[],"nanosecond","second"),a=S(e,Ae),c=S(o,Ae),{hours:d,minutes:f,seconds:u,milliseconds:m,microseconds:_,nanoseconds:v}=a7(a,c,s.roundingIncrement,s.smallestUnit,s.largestUnit,s.roundingMode);return new(se("%Temporal.Duration%"))(0,0,0,0,i*d,i*f,i*u,i*m,i*_,i*v)}function eY(t,e,r,n){let i=t==="since"?-1:1,o=er(r),s=S(e,X);Cx(s,S(o,X),"compute difference between dates");let a=Su(n),c=Vm(t,a,"date",[],"day","day");a.largestUnit=c.largestUnit;let{years:d,months:f,weeks:u,days:m}=yu(s,e,o,a);return c.smallestUnit==="day"&&c.roundingIncrement===1||({years:d,months:f,weeks:u,days:m}=Qd(d,f,u,m,0,0,0,0,0,0,c.roundingIncrement,c.smallestUnit,c.roundingMode,e)),new(se("%Temporal.Duration%"))(i*d,i*f,i*u,i*m,0,0,0,0,0,0)}function tY(t,e,r,n){let i=t==="since"?-1:1,o=zh(r),s=S(e,X);Cx(s,S(o,X),"compute difference between dates");let a=Su(n),c=Vm(t,a,"datetime",[],"nanosecond","day"),{years:d,months:f,weeks:u,days:m,hours:_,minutes:v,seconds:A,milliseconds:T,microseconds:M,nanoseconds:D}=c7(S(e,de),S(e,fe),S(e,he),S(e,Le),S(e,Ue),S(e,Fe),S(e,ze),S(e,$e),S(e,Ge),S(o,de),S(o,fe),S(o,he),S(o,Le),S(o,Ue),S(o,Fe),S(o,ze),S(o,$e),S(o,Ge),s,c.largestUnit,a),O=qm(e);return{years:d,months:f,weeks:u,days:m,hours:_,minutes:v,seconds:A,milliseconds:T,microseconds:M,nanoseconds:D}=Qd(d,f,u,m,_,v,A,T,M,D,c.roundingIncrement,c.smallestUnit,c.roundingMode,O),{days:m,hours:_,minutes:v,seconds:A,milliseconds:T,microseconds:M,nanoseconds:D}=Vs(m,_,v,A,T,M,D,c.largestUnit),new(se("%Temporal.Duration%"))(i*d,i*f,i*u,i*m,i*_,i*v,i*A,i*T,i*M,i*D)}function rY(t,e,r,n){let i=t==="since"?-1:1,o=Vd(r),s=Vm(t,Su(n),"time",[],"nanosecond","hour"),{hours:a,minutes:c,seconds:d,milliseconds:f,microseconds:u,nanoseconds:m}=YY(S(e,Le),S(e,Ue),S(e,Fe),S(e,ze),S(e,$e),S(e,Ge),S(o,Le),S(o,Ue),S(o,Fe),S(o,ze),S(o,$e),S(o,Ge));return{hours:a,minutes:c,seconds:d,milliseconds:f,microseconds:u,nanoseconds:m}=Qd(0,0,0,0,a,c,d,f,u,m,s.roundingIncrement,s.smallestUnit,s.roundingMode),{hours:a,minutes:c,seconds:d,milliseconds:f,microseconds:u,nanoseconds:m}=Vs(0,a,c,d,f,u,m,s.largestUnit),new(se("%Temporal.Duration%"))(0,0,0,0,i*a,i*c,i*d,i*f,i*u,i*m)}function nY(t,e,r,n){let i=t==="since"?-1:1,o=wv(r),s=S(e,X);Cx(s,S(o,X),"compute difference between months");let a=Su(n),c=Vm(t,a,"date",["week","day"],"month","year");a.largestUnit=c.largestUnit;let d=nn(s,["monthCode","year"]),f=Ye(e,d,[]);f.day=1;let u=Xd(s,f),m=Ye(o,d,[]);m.day=1;let _=Xd(s,m),{years:v,months:A}=yu(s,u,_,a);return c.smallestUnit==="month"&&c.roundingIncrement===1||({years:v,months:A}=Qd(v,A,0,0,0,0,0,0,0,0,c.roundingIncrement,c.smallestUnit,c.roundingMode,u)),new(se("%Temporal.Duration%"))(i*v,i*A,0,0,0,0,0,0,0,0)}function iY(t,e,r,n){let i=t==="since"?-1:1,o=_v(r),s=S(e,X);Cx(s,S(o,X),"compute difference between dates");let a=Su(n),c=Vm(t,a,"datetime",[],"nanosecond","hour");a.largestUnit=c.largestUnit;let d=S(e,Ae),f=S(o,Ae),u,m,_,v,A,T,M,D,O,U;if(c.largestUnit!=="year"&&c.largestUnit!=="month"&&c.largestUnit!=="week"&&c.largestUnit!=="day")u=0,m=0,_=0,v=0,{hours:A,minutes:T,seconds:M,milliseconds:D,microseconds:O,nanoseconds:U}=a7(d,f,c.roundingIncrement,c.smallestUnit,c.largestUnit,c.roundingMode);else{let L=S(e,Xt);if(!qY(L,S(o,Xt)))throw new RangeError("When calculating difference between time zones, largestUnit must be 'hours' or smaller because day lengths can vary between time zones due to DST or time zone offset changes.");({years:u,months:m,weeks:_,days:v,hours:A,minutes:T,seconds:M,milliseconds:D,microseconds:O,nanoseconds:U}=JY(d,f,L,s,c.largestUnit,a)),{years:u,months:m,weeks:_,days:v,hours:A,minutes:T,seconds:M,milliseconds:D,microseconds:O,nanoseconds:U}=Qd(u,m,_,v,A,T,M,D,O,U,c.roundingIncrement,c.smallestUnit,c.roundingMode,e),{years:u,months:m,weeks:_,days:v,hours:A,minutes:T,seconds:M,milliseconds:D,microseconds:O,nanoseconds:U}=tJ(u,m,_,v,A,T,M,D,O,U,c.roundingIncrement,c.smallestUnit,c.roundingMode,e)}return new(se("%Temporal.Duration%"))(i*u,i*m,i*_,i*v,i*A,i*T,i*M,i*D,i*O,i*U)}function $h(t,e,r,n,i,o,s,a){let c=t,d=e,f=r,u=o,m=s;return c+=n,d+=i,{year:c,month:d}=ix(c,d),{year:c,month:d,day:f}=lx(c,d,f,a),m+=7*u,f+=m,{year:c,month:d,day:f}=Nx(c,d,f),{year:c,month:d,day:f}}function XY(t,e,r,n,i,o,s,a,c,d,f,u){let m=t,_=e,v=r,A=n,T=i,M=o;m+=s,_+=a,v+=c,A+=d,T+=f,M+=u;let D=0;return{deltaDays:D,hour:m,minute:_,second:v,millisecond:A,microsecond:T,nanosecond:M}=Wd(m,_,v,A,T,M),{deltaDays:D,hour:m,minute:_,second:v,millisecond:A,microsecond:T,nanosecond:M}}function QY(t,e,r,n,i,o,s,a,c,d,f,u,m,_,v,A,T,M,D,O,U){let L=Vh(v9(t,e,r,n,i,o,s,a,c,d),v9(f,u,m,_,v,A,T,M,D,O)),F,$,H,z,j,y,P,x,l,b;if(U)if(rt(U)){let h=se("%Temporal.Duration%"),w=S(U,X),E=new h(t,e,r,n,0,0,0,0,0,0),g=new h(f,u,m,_,0,0,0,0,0,0),I=typeof w!="string"?Zt(w,"dateAdd"):void 0,B=Ln(w,U,E,void 0,I),R=Ln(w,B,g,void 0,I),q=Vh("day",L),V=ii(null);V.largestUnit=q,{years:F,months:$,weeks:H,days:z}=yu(w,U,R,V),{days:z,hours:j,minutes:y,seconds:P,milliseconds:x,microseconds:l,nanoseconds:b}=Vs(z,N.default.add(N.default.BigInt(i),N.default.BigInt(v)),N.default.add(N.default.BigInt(o),N.default.BigInt(A)),N.default.add(N.default.BigInt(s),N.default.BigInt(T)),N.default.add(N.default.BigInt(a),N.default.BigInt(M)),N.default.add(N.default.BigInt(c),N.default.BigInt(D)),N.default.add(N.default.BigInt(d),N.default.BigInt(O)),L)}else{let h=se("%Temporal.Instant%"),w=S(U,Xt),E=S(U,X),g=ds(S(U,ri),w,E,t,e,r,n,i,o,s,a,c,d),I=ds(new h(g),w,E,f,u,m,_,v,A,T,M,D,O);L!=="year"&&L!=="month"&&L!=="week"&&L!=="day"?(F=0,$=0,H=0,z=0,{hours:j,minutes:y,seconds:P,milliseconds:x,microseconds:l,nanoseconds:b}=a7(S(U,Ae),I,1,"nanosecond",L,"halfExpand")):{years:F,months:$,weeks:H,days:z,hours:j,minutes:y,seconds:P,milliseconds:x,microseconds:l,nanoseconds:b}=JY(S(U,Ae),I,w,E,L,ii(null))}else{if(L==="year"||L==="month"||L==="week")throw new RangeError("relativeTo is required for years, months, or weeks arithmetic");F=$=H=0,{days:z,hours:j,minutes:y,seconds:P,milliseconds:x,microseconds:l,nanoseconds:b}=Vs(n+_,N.default.add(N.default.BigInt(i),N.default.BigInt(v)),N.default.add(N.default.BigInt(o),N.default.BigInt(A)),N.default.add(N.default.BigInt(s),N.default.BigInt(T)),N.default.add(N.default.BigInt(a),N.default.BigInt(M)),N.default.add(N.default.BigInt(c),N.default.BigInt(D)),N.default.add(N.default.BigInt(d),N.default.BigInt(O)),L)}return bx(F,$,H,z,j,y,P,x,l,b),{years:F,months:$,weeks:H,days:z,hours:j,minutes:y,seconds:P,milliseconds:x,microseconds:l,nanoseconds:b}}function E9(t,e,r,n,i,o,s){let a=Or;a=N.default.add(a,N.default.BigInt(s)),a=N.default.add(a,N.default.multiply(N.default.BigInt(o),Ht)),a=N.default.add(a,N.default.multiply(N.default.BigInt(i),cs)),a=N.default.add(a,N.default.multiply(N.default.BigInt(n),Nc)),a=N.default.add(a,N.default.multiply(N.default.BigInt(r),N.default.BigInt(6e10))),a=N.default.add(a,N.default.multiply(N.default.BigInt(e),N.default.BigInt(36e11)));let c=N.default.add(t,a);return Uh(c),c}function S9(t,e,r,n,i,o,s,a,c,d,f,u,m,_,v,A,T,M,D,O,U){let L=_,{deltaDays:F,hour:$,minute:H,second:z,millisecond:j,microsecond:y,nanosecond:P}=XY(n,i,o,s,a,c,v,A,T,M,D,O);L+=F;let x=se("%Temporal.Duration%"),l=Ln(d,fs(t,e,r,d),new x(f,u,m,L,0,0,0,0,0,0),U);return{year:S(l,de),month:S(l,fe),day:S(l,he),hour:$,minute:H,second:z,millisecond:j,microsecond:y,nanosecond:P}}function ds(t,e,r,n,i,o,s,a,c,d,f,u,m,_){let v=se("%Temporal.Duration%");if(qc(n,i,o,s,0,0,0,0,0,0)===0)return E9(S(t,Ae),a,c,d,f,u,m);let A=Oo(e,t,r),T=Ln(r,fs(S(A,de),S(A,fe),S(A,he),r),new v(n,i,o,s,0,0,0,0,0,0),_),M=lo(S(T,de),S(T,fe),S(T,he),S(A,Le),S(A,Ue),S(A,Fe),S(A,ze),S(A,$e),S(A,Ge),r);return E9(S(Ri(e,M,"compatible"),Ae),a,c,d,f,u,m)}function oY(t,e,r,n){let i=t==="subtract"?-1:1,{years:o,months:s,weeks:a,days:c,hours:d,minutes:f,seconds:u,milliseconds:m,microseconds:_,nanoseconds:v}=ep(r),A=nx(ot(n));return{years:o,months:s,weeks:a,days:c,hours:d,minutes:f,seconds:u,milliseconds:m,microseconds:_,nanoseconds:v}=QY(S(e,wi),S(e,Bn),S(e,Vi),S(e,_i),S(e,xi),S(e,Ei),S(e,Si),S(e,Ai),S(e,Ti),S(e,Pi),i*o,i*s,i*a,i*c,i*d,i*f,i*u,i*m,i*_,i*v,A),new(se("%Temporal.Duration%"))(o,s,a,c,d,f,u,m,_,v)}function sY(t,e,r){let n=t==="subtract"?-1:1,{hours:i,minutes:o,seconds:s,milliseconds:a,microseconds:c,nanoseconds:d}=function(m,_){let v=ep(m);for(let A of _)if(v[A]!==0)throw new RangeError(`Duration field ${A} not supported by Temporal.Instant. Try Temporal.ZonedDateTime instead.`);return v}(r,["years","months","weeks","days"]),f=E9(S(e,Ae),n*i,n*o,n*s,n*a,n*c,n*d);return new(se("%Temporal.Instant%"))(f)}function aY(t,e,r,n){let i=t==="subtract"?-1:1,{years:o,months:s,weeks:a,days:c,hours:d,minutes:f,seconds:u,milliseconds:m,microseconds:_,nanoseconds:v}=ep(r),A=ot(n),T=S(e,X),{year:M,month:D,day:O,hour:U,minute:L,second:F,millisecond:$,microsecond:H,nanosecond:z}=S9(S(e,de),S(e,fe),S(e,he),S(e,Le),S(e,Ue),S(e,Fe),S(e,ze),S(e,$e),S(e,Ge),T,i*o,i*s,i*a,i*c,i*d,i*f,i*u,i*m,i*_,i*v,A);return lo(M,D,O,U,L,F,$,H,z,T)}function cY(t,e,r){let n=t==="subtract"?-1:1,{hours:i,minutes:o,seconds:s,milliseconds:a,microseconds:c,nanoseconds:d}=ep(r),{hour:f,minute:u,second:m,millisecond:_,microsecond:v,nanosecond:A}=XY(S(e,Le),S(e,Ue),S(e,Fe),S(e,ze),S(e,$e),S(e,Ge),n*i,n*o,n*s,n*a,n*c,n*d);return{hour:f,minute:u,second:m,millisecond:_,microsecond:v,nanosecond:A}=Ax(f,u,m,_,v,A,"reject"),new(se("%Temporal.PlainTime%"))(f,u,m,_,v,A)}function dY(t,e,r,n){let i=ep(r);t==="subtract"&&(i={years:-i.years,months:-i.months,weeks:-i.weeks,days:-i.days,hours:-i.hours,minutes:-i.minutes,seconds:-i.seconds,milliseconds:-i.milliseconds,microseconds:-i.microseconds,nanoseconds:-i.nanoseconds});let{years:o,months:s,weeks:a,days:c,hours:d,minutes:f,seconds:u,milliseconds:m,microseconds:_,nanoseconds:v}=i;({days:c}=Vs(c,d,f,u,m,_,v,"day"));let A=ot(n),T=S(e,X),M=nn(T,["monthCode","year"]),D=Ye(e,M,[]),O=ii(null);Pm(O,D,[]),D.day=1;let U=Xd(T,D),L=qc(o,s,a,c,0,0,0,0,0,0),F=Zt(T,"dateAdd"),$=se("%Temporal.Duration%");if(L<0){let j=Ln(T,U,new $(0,1,0,0,0,0,0,0,0,0),void 0,F),y=Ln(T,j,new $(0,0,0,-1,0,0,0,0,0,0),void 0,F);O.day=Uv(T,y),U=Xd(T,O)}let H=new $(o,s,a,c,0,0,0,0,0,0),z=Su(A);return Zh(T,Ye(Ln(T,U,H,A,F),M,[]),z)}function fY(t,e,r,n){let i=t==="subtract"?-1:1,{years:o,months:s,weeks:a,days:c,hours:d,minutes:f,seconds:u,milliseconds:m,microseconds:_,nanoseconds:v}=ep(r),A=ot(n),T=S(e,Xt),M=S(e,X);return qn(ds(S(e,ri),T,M,i*o,i*s,i*a,i*c,i*d,i*f,i*u,i*m,i*_,i*v,A),T,M)}function Co(t,e,r){if(N.default.equal(e,zm))return t;let{quotient:n,remainder:i}=Yr(t,e);if(N.default.equal(i,Or))return t;let o=N.default.lessThan(i,Or)?-1:1,s=Ia(N.default.multiply(i,N.default.BigInt(2))),a=N.default.equal(s,e),c=N.default.greaterThan(s,e);switch(r){case"ceil":o>0&&(n=N.default.add(n,N.default.BigInt(o)));break;case"floor":o<0&&(n=N.default.add(n,N.default.BigInt(o)));break;case"expand":n=N.default.add(n,N.default.BigInt(o));break;case"trunc":break;case"halfCeil":(c||a&&o>0)&&(n=N.default.add(n,N.default.BigInt(o)));break;case"halfFloor":(c||a&&o<0)&&(n=N.default.add(n,N.default.BigInt(o)));break;case"halfExpand":(c||a)&&(n=N.default.add(n,N.default.BigInt(o)));break;case"halfTrunc":c&&(n=N.default.add(n,N.default.BigInt(o)));break;case"halfEven":(c||a&&N.default.toNumber(N.default.remainder(Ia(n),N.default.BigInt(2)))===1)&&(n=N.default.add(n,N.default.BigInt(o)))}return N.default.multiply(n,e)}function vx(t,e,r,n){let{remainder:i}=Lh(t,Lc),o=N.default.subtract(t,i),s=Co(i,N.default.BigInt(iJ[r]*e),n);return N.default.add(o,s)}function d7(t,e,r,n,i,o,s,a,c,d,f,u,m=864e11){let{deltaDays:_,hour:v,minute:A,second:T,millisecond:M,microsecond:D,nanosecond:O}=f7(n,i,o,s,a,c,d,f,u,m),{year:U,month:L,day:F}=Nx(t,e,r+_);return{year:U,month:L,day:F,hour:v,minute:A,second:T,millisecond:M,microsecond:D,nanosecond:O}}function f7(t,e,r,n,i,o,s,a,c,d=864e11){let f=Or;switch(a){case"day":case"hour":f=N.default.BigInt(t);case"minute":f=N.default.add(N.default.multiply(f,jc),N.default.BigInt(e));case"second":f=N.default.add(N.default.multiply(f,jc),N.default.BigInt(r));case"millisecond":f=N.default.add(N.default.multiply(f,Ht),N.default.BigInt(n));case"microsecond":f=N.default.add(N.default.multiply(f,Ht),N.default.BigInt(i));case"nanosecond":f=N.default.add(N.default.multiply(f,Ht),N.default.BigInt(o))}let u=a==="day"?d:iJ[a],m=Co(f,N.default.BigInt(u*s),c),_=N.default.toNumber(N.default.divide(m,N.default.BigInt(u)));switch(a){case"day":return{deltaDays:_,hour:0,minute:0,second:0,millisecond:0,microsecond:0,nanosecond:0};case"hour":return Wd(_,0,0,0,0,0);case"minute":return Wd(t,_,0,0,0,0);case"second":return Wd(t,e,_,0,0,0);case"millisecond":return Wd(t,e,r,_,0,0);case"microsecond":return Wd(t,e,r,n,_,0);case"nanosecond":return Wd(t,e,r,n,i,_);default:throw new Error(`Invalid unit ${a}`)}}function ox(t,e){return s7(S(t,de),S(t,fe),S(t,he),S(e,de),S(e,fe),S(e,he),"day").days}function ti(t,e,r,n){let i=Ln(t,e,r,void 0,n);return{relativeTo:i,days:ox(e,i)}}function eJ(t,e,r,n,i){let o=S(t,Xt),s=S(t,X);return qn(ds(S(t,ri),o,s,e,r,n,i,0,0,0,0,0,0),o,s)}function tJ(t,e,r,n,i,o,s,a,c,d,f,u,m,_){let v=t,A=e,T=r,M=n,D=i,O=o,U=s,L=a,F=c,$=d;if(!ge(_)||u==="year"||u==="month"||u==="week"||u==="day"||u==="nanosecond"&&f===1)return{years:v,months:A,weeks:T,days:M,hours:D,minutes:O,seconds:U,milliseconds:L,microseconds:F,nanoseconds:$};let H=Lm(0,D,O,U,L,F,$,0),z=Dm(N.default.toNumber(H)),j=S(_,Xt),y=S(_,X),P=ds(S(_,ri),j,y,v,A,T,M,0,0,0,0,0,0),x=ds(new(se("%Temporal.Instant%"))(P),j,y,0,0,0,z,0,0,0,0,0,0),l=N.default.subtract(x,P);return N.default.greaterThanOrEqual(N.default.multiply(N.default.subtract(H,l),N.default.BigInt(z)),Or)&&({years:v,months:A,weeks:T,days:M}=QY(v,A,T,M,0,0,0,0,0,0,0,0,0,z,0,0,0,0,0,0,_),H=vx(N.default.subtract(H,l),f,u,m),{hours:D,minutes:O,seconds:U,milliseconds:L,microseconds:F,nanoseconds:$}=Vs(0,0,0,0,0,0,N.default.toNumber(H),"hour")),{years:v,months:A,weeks:T,days:M,hours:D,minutes:O,seconds:U,milliseconds:L,microseconds:F,nanoseconds:$}}function Qd(t,e,r,n,i,o,s,a,c,d,f,u,m,_){let v=t,A=e,T=r,M=n,D=i,O=o,U=s,L=a,F=c,$=N.default.BigInt(d),H=se("%Temporal.Duration%"),z,j,y,P,x=_;if(x){if(ge(x))j=x,x=er(x);else if(!rt(x))throw new TypeError("starting point must be PlainDate or ZonedDateTime");z=S(x,X)}if(u==="year"||u==="month"||u==="week"||u==="day"){let l,b,h;$=Lm(0,D,O,U,L,F,d,0),j&&(l=eJ(j,v,A,T,M)),{days:b,nanoseconds:$,dayLengthNs:h}=i7($,l),y=N.default.BigInt(h),M+=b,D=O=U=L=F=0}switch(u){case"year":{if(!z)throw new RangeError("A starting point is required for years rounding");let l=new H(v),b=typeof z!="string"?Zt(z,"dateAdd"):void 0,h=Ln(z,x,l,void 0,b),w=Ln(z,x,new H(v,A,T),void 0,b);x=h,M+=ox(h,w);let E=Ln(z,x,new H(0,0,0,M),void 0,b),g=ii(null);g.largestUnit="year";let I=yu(z,x,E,g).years;v+=I;let B=x;x=Ln(z,x,new H(I),void 0,b),M-=ox(B,x);let R=new H(M<0?-1:1),{days:q}=ti(z,x,R,b);q=hr(q);let V=N.default.multiply(N.default.BigInt(q),y);$=N.default.add(N.default.add(N.default.multiply(V,N.default.BigInt(v)),N.default.multiply(N.default.BigInt(M),y)),$);let W=Co($,N.default.multiply(V,N.default.BigInt(f)),m);P=Dc($,V),v=N.default.toNumber(N.default.divide(W,V)),$=Or,A=T=M=0;break}case"month":{if(!z)throw new RangeError("A starting point is required for months rounding");let l=new H(v,A),b=typeof z!="string"?Zt(z,"dateAdd"):void 0,h=Ln(z,x,l,void 0,b),w=Ln(z,x,new H(v,A,T),void 0,b);x=h,M+=ox(h,w);let E=Dm(M),g=new H(0,M<0?-1:1),I;for({relativeTo:x,days:I}=ti(z,x,g,b);hr(M)>=hr(I);)A+=E,M-=I,{relativeTo:x,days:I}=ti(z,x,g,b);I=hr(I);let B=N.default.multiply(N.default.BigInt(I),y);$=N.default.add(N.default.add(N.default.multiply(B,N.default.BigInt(A)),N.default.multiply(N.default.BigInt(M),y)),$);let R=Co($,N.default.multiply(B,N.default.BigInt(f)),m);P=Dc($,B),A=N.default.toNumber(N.default.divide(R,B)),$=Or,T=M=0;break}case"week":{if(!z)throw new RangeError("A starting point is required for weeks rounding");let l=Dm(M),b=new H(0,0,M<0?-1:1),h=typeof z!="string"?Zt(z,"dateAdd"):void 0,w;for({relativeTo:x,days:w}=ti(z,x,b,h);hr(M)>=hr(w);)T+=l,M-=w,{relativeTo:x,days:w}=ti(z,x,b,h);w=hr(w);let E=N.default.multiply(N.default.BigInt(w),y);$=N.default.add(N.default.add(N.default.multiply(E,N.default.BigInt(T)),N.default.multiply(N.default.BigInt(M),y)),$);let g=Co($,N.default.multiply(E,N.default.BigInt(f)),m);P=Dc($,E),T=N.default.toNumber(N.default.divide(g,E)),$=Or,M=0;break}case"day":{let l=y;$=N.default.add(N.default.multiply(l,N.default.BigInt(M)),$);let b=Co($,N.default.multiply(l,N.default.BigInt(f)),m);P=Dc($,l),M=N.default.toNumber(N.default.divide(b,l)),$=Or;break}case"hour":{let b=N.default.multiply(N.default.BigInt(D),N.default.BigInt(36e11));b=N.default.add(b,N.default.multiply(N.default.BigInt(O),N.default.BigInt(6e10))),b=N.default.add(b,N.default.multiply(N.default.BigInt(U),Nc)),b=N.default.add(b,N.default.multiply(N.default.BigInt(L),cs)),b=N.default.add(b,N.default.multiply(N.default.BigInt(F),Ht)),b=N.default.add(b,$),P=Dc(b,N.default.BigInt(36e11));let h=Co(b,N.default.BigInt(36e11*f),m);D=N.default.toNumber(N.default.divide(h,N.default.BigInt(36e11))),$=Or,O=U=L=F=0;break}case"minute":{let b=N.default.multiply(N.default.BigInt(O),N.default.BigInt(6e10));b=N.default.add(b,N.default.multiply(N.default.BigInt(U),Nc)),b=N.default.add(b,N.default.multiply(N.default.BigInt(L),cs)),b=N.default.add(b,N.default.multiply(N.default.BigInt(F),Ht)),b=N.default.add(b,$),P=Dc(b,N.default.BigInt(6e10));let h=Co(b,N.default.BigInt(6e10*f),m);O=N.default.toNumber(N.default.divide(h,N.default.BigInt(6e10))),$=Or,U=L=F=0;break}case"second":{let b=N.default.multiply(N.default.BigInt(U),Nc);b=N.default.add(b,N.default.multiply(N.default.BigInt(L),cs)),b=N.default.add(b,N.default.multiply(N.default.BigInt(F),Ht)),b=N.default.add(b,$),P=Dc(b,N.default.BigInt(1e9));let h=Co(b,N.default.BigInt(1e9*f),m);U=N.default.toNumber(N.default.divide(h,N.default.BigInt(1e9))),$=Or,L=F=0;break}case"millisecond":{let b=N.default.multiply(N.default.BigInt(L),cs);b=N.default.add(b,N.default.multiply(N.default.BigInt(F),Ht)),b=N.default.add(b,$),P=Dc(b,N.default.BigInt(1e6));let h=Co(b,N.default.BigInt(1e6*f),m);L=N.default.toNumber(N.default.divide(h,N.default.BigInt(1e6))),$=Or,F=0;break}case"microsecond":{let b=N.default.multiply(N.default.BigInt(F),Ht);b=N.default.add(b,$),P=Dc(b,N.default.BigInt(1e3));let h=Co(b,N.default.BigInt(1e3*f),m);F=N.default.toNumber(N.default.divide(h,N.default.BigInt(1e3))),$=Or;break}case"nanosecond":P=N.default.toNumber($),$=Co(N.default.BigInt($),N.default.BigInt(f),m)}return{years:v,months:A,weeks:T,days:M,hours:D,minutes:O,seconds:U,milliseconds:L,microseconds:F,nanoseconds:N.default.toNumber($),total:P}}function mu(t,e,r,n,i,o){for(let[s,a]of[[t,n],[e,i],[r,o]])if(s!==a)return Gh(s-a);return 0}function Lh(t,e){let{quotient:r,remainder:n}=Yr(t,e);return N.default.lessThan(n,Or)&&(r=N.default.subtract(r,zm),n=N.default.add(n,e)),{quotient:r,remainder:n}}function Rm(t,e){let{quotient:r,remainder:n}=Yr(t,e);return ss(n)||!fx(t)==!fx(e)?r:N.default.subtract(r,zm)}function Dc(t,e){let{quotient:r,remainder:n}=Yr(t,e);return N.default.toNumber(r)+N.default.toNumber(n)/N.default.toNumber(e)}function wx(t){let e=xv(t);return globalThis.BigInt!==void 0?globalThis.BigInt(e.toString(10)):e}function xv(t){let e=t;if(typeof t=="object"){let r=t[Symbol.toPrimitive];r&&typeof r=="function"&&(e=Sx(r,t,["number"]))}if(typeof e=="number")throw new TypeError("cannot convert number to bigint");return typeof e=="bigint"?N.default.BigInt(e.toString(10)):N.default.BigInt(e)}var u7=(()=>{let t=N.default.BigInt(Date.now()%1e6);return()=>{let e=N.default.BigInt(Date.now()),r=N.default.add(N.default.multiply(e,cs),t);return t=N.default.remainder(e,cs),N.default.greaterThan(r,Cm)?Cm:N.default.lessThan(r,Sv)?Sv:r}})();function pu(){return new SY().resolvedOptions().timeZone}function Gh(t){return t<0?-1:t>0?1:t}function ot(t){if(t===void 0)return ii(null);if(pr(t)&&t!==null)return t;throw new TypeError("Options parameter must be an object, not "+(t===null?"null":typeof t))}function Um(t,e){let r=ii(null);return r[t]=e,r}function Su(t){let e=ii(null);return Pm(e,ot(t),[]),e}function wu(t,e,r,n){let i=t[e];if(i!==void 0){if(i=Mi(i),!r.includes(i))throw new RangeError(`${e} must be one of ${r.join(", ")}, not ${i}`);return i}return n}function ef(t){return XEe.includes(Fc(t))}function Fc(t){return t.replace(/[A-Z]/g,e=>{let r=e.charCodeAt(0);return String.fromCharCode(r+32)})}var rJ=new RegExp(`^${_Y.source}$`);function nJ(t,e,r,n=t(e),i=t(r)){let o=N.default.BigInt(e),s=N.default.BigInt(r),a=n,c=i;for(;N.default.greaterThan(N.default.subtract(s,o),zm);){let d=N.default.divide(N.default.add(o,s),N.default.BigInt(2)),f=t(d);if(f===a)o=d,a=f;else{if(f!==c)throw new Error(`invalid state in bisection ${a} - ${f} - ${c}`);s=d,c=f}}return s}var iJ={hour:36e11,minute:6e10,second:1e9,millisecond:1e6,microsecond:1e3,nanosecond:1},oJ=Symbol("date"),sJ=Symbol("ym"),aJ=Symbol("md"),cJ=Symbol("time"),dJ=Symbol("datetime"),fJ=Symbol("instant"),Mm=Symbol("original"),Sm=Symbol("timezone"),Ws=Symbol("calendar-id"),uJ=Symbol("locale"),A9=Symbol("options"),Ev=t=>({value:t,enumerable:!0,writable:!1,configurable:!0}),km=globalThis.Intl.DateTimeFormat,tf=Object.assign,n4e=Object.prototype.hasOwnProperty,i4e=Reflect.apply;function Em(t,e){let r=t[e];return typeof r=="function"&&(r=new km(t[uJ],r(t[A9])),t[e]=r),r}function Yh(t,e={}){if(!(this instanceof Yh))return new Yh(t,e);let r=e!==void 0,n=r?tf({},e):{},i=new km(t,n),o=i.resolvedOptions();if(r){let s=tf({},o);for(let a in s)i4e(n4e,n,[a])||delete s[a];this[A9]=s}else this[A9]=n;this[uJ]=o.locale,this[Mm]=i,this[Sm]=o.timeZone,this[Ws]=o.calendar,this[oJ]=c4e,this[sJ]=s4e,this[aJ]=a4e,this[cJ]=o4e,this[dJ]=d4e,this[fJ]=f4e}Object.defineProperty(Yh,"name",{writable:!0,value:"DateTimeFormat"}),Yh.supportedLocalesOf=function(t,e){return km.supportedLocalesOf(t,e)};var u9={resolvedOptions:Ev(function(){return this[Mm].resolvedOptions()}),format:Ev(function(e,...r){let{instant:n,formatter:i}=Bm(e,this);return n&&i?i.format(n.epochMilliseconds):this[Mm].format(e,...r)}),formatRange:Ev(function(e,r){if(Fm(e)||Fm(r)){if(!lJ(e,r))throw new TypeError("Intl.DateTimeFormat.formatRange accepts two values of the same type");let{instant:n,formatter:i}=Bm(e,this),{instant:o,formatter:s}=Bm(r,this);if(n&&o&&i&&s&&i===s)return i.formatRange(n.epochMilliseconds,o.epochMilliseconds)}return this[Mm].formatRange(e,r)})};"formatToParts"in km.prototype&&(u9.formatToParts=Ev(function(e,...r){let{instant:n,formatter:i}=Bm(e,this);return n&&i?i.formatToParts(n.epochMilliseconds):this[Mm].formatToParts(e,...r)})),"formatRangeToParts"in km.prototype&&(u9.formatRangeToParts=Ev(function(e,r){if(Fm(e)||Fm(r)){if(!lJ(e,r))throw new TypeError("Intl.DateTimeFormat.formatRangeToParts accepts two values of the same type");let{instant:n,formatter:i}=Bm(e,this),{instant:o,formatter:s}=Bm(r,this);if(n&&o&&i&&s&&i===s)return i.formatRangeToParts(n.epochMilliseconds,o.epochMilliseconds)}return this[Mm].formatRangeToParts(e,r)})),Yh.prototype=Object.create(km.prototype,u9),Object.defineProperty(Yh,"prototype",{writable:!1,enumerable:!1,configurable:!1});var rf=Yh;function $v(t={},e={}){let r=tf({},t);for(let n of["year","month","day","hour","minute","second","weekday","dayPeriod","timeZoneName","dateStyle","timeStyle"])r[n]=n in e?e[n]:r[n],r[n]!==!1&&r[n]!==void 0||delete r[n];return r}function o4e(t){let e=$v(t,{year:!1,month:!1,day:!1,weekday:!1,timeZoneName:!1,dateStyle:!1});return h7(e)||(e=tf({},e,{hour:"numeric",minute:"numeric",second:"numeric"})),e}function s4e(t){let e=$v(t,{day:!1,hour:!1,minute:!1,second:!1,weekday:!1,dayPeriod:!1,timeZoneName:!1,dateStyle:!1,timeStyle:!1});return"year"in e||"month"in e||(e=tf(e,{year:"numeric",month:"numeric"})),e}function a4e(t){let e=$v(t,{year:!1,hour:!1,minute:!1,second:!1,weekday:!1,dayPeriod:!1,timeZoneName:!1,dateStyle:!1,timeStyle:!1});return"month"in e||"day"in e||(e=tf({},e,{month:"numeric",day:"numeric"})),e}function c4e(t){let e=$v(t,{hour:!1,minute:!1,second:!1,dayPeriod:!1,timeZoneName:!1,timeStyle:!1});return l7(e)||(e=tf({},e,{year:"numeric",month:"numeric",day:"numeric"})),e}function d4e(t){let e=$v(t,{timeZoneName:!1});return h7(e)||l7(e)||(e=tf({},e,{year:"numeric",month:"numeric",day:"numeric",hour:"numeric",minute:"numeric",second:"numeric"})),e}function f4e(t){let e=t;return h7(e)||l7(e)||(e=tf({},e,{year:"numeric",month:"numeric",day:"numeric",hour:"numeric",minute:"numeric",second:"numeric"})),e}function l7(t){return"year"in t||"month"in t||"day"in t||"weekday"in t||"dateStyle"in t}function h7(t){return"hour"in t||"minute"in t||"second"in t||"timeStyle"in t||"dayPeriod"in t}function Fm(t){return rt(t)||Cr(t)||je(t)||ge(t)||Gt(t)||vn(t)||ln(t)}function lJ(t,e){return!(!Fm(t)||!Fm(e))&&!(Cr(t)&&!Cr(e))&&!(rt(t)&&!rt(e))&&!(je(t)&&!je(e))&&!(ge(t)&&!ge(e))&&!(Gt(t)&&!Gt(e))&&!(vn(t)&&!vn(e))&&!(ln(t)&&!ln(e))}function Bm(t,e){let r=se("%Temporal.PlainDateTime%");if(Cr(t)){let n=new r(1970,1,1,S(t,Le),S(t,Ue),S(t,Fe),S(t,ze),S(t,$e),S(t,Ge),e[Ws]);return{instant:Ri(e[Sm],n,"compatible"),formatter:Em(e,cJ)}}if(Gt(t)){let n=S(t,de),i=S(t,fe),o=S(t,he),s=Fn(S(t,X));if(s!==e[Ws])throw new RangeError(`cannot format PlainYearMonth with calendar ${s} in locale with calendar ${e[Ws]}`);let a=new r(n,i,o,12,0,0,0,0,0,s);return{instant:Ri(e[Sm],a,"compatible"),formatter:Em(e,sJ)}}if(vn(t)){let n=S(t,de),i=S(t,fe),o=S(t,he),s=Fn(S(t,X));if(s!==e[Ws])throw new RangeError(`cannot format PlainMonthDay with calendar ${s} in locale with calendar ${e[Ws]}`);let a=new r(n,i,o,12,0,0,0,0,0,s);return{instant:Ri(e[Sm],a,"compatible"),formatter:Em(e,aJ)}}if(rt(t)){let n=S(t,de),i=S(t,fe),o=S(t,he),s=Fn(S(t,X));if(s!=="iso8601"&&s!==e[Ws])throw new RangeError(`cannot format PlainDate with calendar ${s} in locale with calendar ${e[Ws]}`);let a=new r(n,i,o,12,0,0,0,0,0,e[Ws]);return{instant:Ri(e[Sm],a,"compatible"),formatter:Em(e,oJ)}}if(je(t)){let n=S(t,de),i=S(t,fe),o=S(t,he),s=S(t,Le),a=S(t,Ue),c=S(t,Fe),d=S(t,ze),f=S(t,$e),u=S(t,Ge),m=Fn(S(t,X));if(m!=="iso8601"&&m!==e[Ws])throw new RangeError(`cannot format PlainDateTime with calendar ${m} in locale with calendar ${e[Ws]}`);let _=t;return m==="iso8601"&&(_=new r(n,i,o,s,a,c,d,f,u,e[Ws])),{instant:Ri(e[Sm],_,"compatible"),formatter:Em(e,dJ)}}if(ge(t))throw new TypeError("Temporal.ZonedDateTime not supported in DateTimeFormat methods. Use toLocaleString() instead.");return ln(t)?{instant:t,formatter:Em(e,fJ)}:{}}var JHe=Object.freeze({__proto__:null,DateTimeFormat:rf}),as=class{constructor(e){if(arguments.length<1)throw new TypeError("missing argument: epochNanoseconds is required");let r=xv(e);Uh(r),$c(this),Ve(this,Ae,r)}get epochSeconds(){if(!ln(this))throw new TypeError("invalid receiver");let e=S(this,Ae);return N.default.toNumber(Rm(e,Nc))}get epochMilliseconds(){if(!ln(this))throw new TypeError("invalid receiver");let e=N.default.BigInt(S(this,Ae));return N.default.toNumber(Rm(e,cs))}get epochMicroseconds(){if(!ln(this))throw new TypeError("invalid receiver");return wx(Rm(N.default.BigInt(S(this,Ae)),Ht))}get epochNanoseconds(){if(!ln(this))throw new TypeError("invalid receiver");return wx(N.default.BigInt(S(this,Ae)))}add(e){if(!ln(this))throw new TypeError("invalid receiver");return sY("add",this,e)}subtract(e){if(!ln(this))throw new TypeError("invalid receiver");return sY("subtract",this,e)}until(e,r){if(!ln(this))throw new TypeError("invalid receiver");return QZ("until",this,e,r)}since(e,r){if(!ln(this))throw new TypeError("invalid receiver");return QZ("since",this,e,r)}round(e){if(!ln(this))throw new TypeError("invalid receiver");if(e===void 0)throw new TypeError("options parameter is required");let r=typeof e=="string"?Um("smallestUnit",e):ot(e),n=Gm(r),i=Ma(r,"halfExpand"),o=mo(r,"smallestUnit","time",Wh);Hm(n,{hour:24,minute:1440,second:86400,millisecond:864e5,microsecond:864e8,nanosecond:864e11}[o],!0);let s=vx(S(this,Ae),n,o,i);return new as(s)}equals(e){if(!ln(this))throw new TypeError("invalid receiver");let r=Ra(e),n=S(this,Ae),i=S(r,Ae);return N.default.equal(N.default.BigInt(n),N.default.BigInt(i))}toString(e){if(!ln(this))throw new TypeError("invalid receiver");let r=ot(e),n=jv(r),i=Ma(r,"trunc"),o=mo(r,"smallestUnit","time",void 0);if(o==="hour")throw new RangeError('smallestUnit must be a time unit other than "hour"');let s=r.timeZone;s!==void 0&&(s=ni(s));let{precision:a,unit:c,increment:d}=Nv(o,n),f=vx(S(this,Ae),d,c,i);return GZ(new as(f),s,a)}toJSON(){if(!ln(this))throw new TypeError("invalid receiver");return GZ(this,void 0,"auto")}toLocaleString(e,r){if(!ln(this))throw new TypeError("invalid receiver");return new rf(e,r).format(this)}valueOf(){throw new TypeError("use compare() or equals() to compare Temporal.Instant")}toZonedDateTime(e){if(!ln(this))throw new TypeError("invalid receiver");if(!pr(e))throw new TypeError("invalid argument in toZonedDateTime");let r=e.calendar;if(r===void 0)throw new TypeError("missing calendar property in toZonedDateTime");let n=yo(r),i=e.timeZone;if(i===void 0)throw new TypeError("missing timeZone property in toZonedDateTime");let o=ni(i);return qn(S(this,Ae),o,n)}toZonedDateTimeISO(e){if(!ln(this))throw new TypeError("invalid receiver");let r=ni(e);return qn(S(this,Ae),r,"iso8601")}static fromEpochSeconds(e){let r=Om(e),n=N.default.multiply(N.default.BigInt(r),Nc);return Uh(n),new as(n)}static fromEpochMilliseconds(e){let r=Om(e),n=N.default.multiply(N.default.BigInt(r),cs);return Uh(n),new as(n)}static fromEpochMicroseconds(e){let r=xv(e),n=N.default.multiply(r,Ht);return Uh(n),new as(n)}static fromEpochNanoseconds(e){let r=xv(e);return Uh(r),new as(r)}static from(e){return ln(e)?new as(S(e,Ae)):Ra(e)}static compare(e,r){let n=Ra(e),i=Ra(r),o=S(n,Ae),s=S(i,Ae);return N.default.lessThan(o,s)?-1:N.default.greaterThan(o,s)?1:0}};zc(as,"Temporal.Instant");var hJ=Array.prototype.includes,u4e=Array.prototype.push,l4e=globalThis.Intl.DateTimeFormat,h4e=Array.prototype.sort,p4e=Math.abs,m4e=Math.floor,l9=Object.create,T9=Object.entries,pJ=Set,uY=Reflect.ownKeys,ei=Set.prototype.add,mJ=Set.prototype.values,Er={},xr=class{constructor(e){if(arguments.length<1)throw new RangeError("missing argument: id is required");let r=Mi(e);if(!ef(r))throw new RangeError(`invalid calendar identifier ${r}`);$c(this),Ve(this,Pr,Fc(r))}get id(){if(!Br(this))throw new TypeError("invalid receiver");return S(this,Pr)}dateFromFields(e,r){if(!Br(this))throw new TypeError("invalid receiver");if(!pr(e))throw new TypeError("invalid fields");let n=ot(r),i=S(this,Pr);return Er[i].dateFromFields(e,n,i)}yearMonthFromFields(e,r){if(!Br(this))throw new TypeError("invalid receiver");if(!pr(e))throw new TypeError("invalid fields");let n=ot(r),i=S(this,Pr);return Er[i].yearMonthFromFields(e,n,i)}monthDayFromFields(e,r){if(!Br(this))throw new TypeError("invalid receiver");if(!pr(e))throw new TypeError("invalid fields");let n=ot(r),i=S(this,Pr);return Er[i].monthDayFromFields(e,n,i)}fields(e){if(!Br(this))throw new TypeError("invalid receiver");let r=[],n=new Set(["year","month","monthCode","day","hour","minute","second","millisecond","microsecond","nanosecond"]);for(let i of e){if(typeof i!="string")throw new TypeError("invalid fields");if(!n.has(i))throw new RangeError(`invalid field name ${i}`);n.delete(i),u4e.call(r,i)}return Er[S(this,Pr)].fields(r)}mergeFields(e,r){if(!Br(this))throw new TypeError("invalid receiver");let n=zZ(e),i=l9(null);Pm(i,n,[],[void 0]);let o=zZ(r),s=l9(null);Pm(s,o,[],[void 0]);let a=uY(s),c=Er[S(this,Pr)].fieldKeysToIgnore(a),d=l9(null),f=uY(i);for(let u of f){let m;m=_e(hJ,c,[u])?s[u]:i[u],m!==void 0&&(d[u]=m)}return Pm(d,s,[]),d}dateAdd(e,r,n){if(!Br(this))throw new TypeError("invalid receiver");let i=er(e),o=Im(r),s=Jr(ot(n)),{days:a}=Vs(S(o,_i),S(o,xi),S(o,Ei),S(o,Si),S(o,Ai),S(o,Ti),S(o,Pi),"day"),c=S(this,Pr);return Er[c].dateAdd(i,S(o,wi),S(o,Bn),S(o,Vi),a,s,c)}dateUntil(e,r,n){if(!Br(this))throw new TypeError("invalid receiver");let i=er(e),o=er(r),s=mo(ot(n),"largestUnit","date","auto");s==="auto"&&(s="day");let{years:a,months:c,weeks:d,days:f}=Er[S(this,Pr)].dateUntil(i,o,s);return new(se("%Temporal.Duration%"))(a,c,d,f,0,0,0,0,0,0)}year(e){let r=e;if(!Br(this))throw new TypeError("invalid receiver");return Gt(r)||(r=er(r)),Er[S(this,Pr)].year(r)}month(e){let r=e;if(!Br(this))throw new TypeError("invalid receiver");if(vn(r))throw new TypeError("use monthCode on PlainMonthDay instead");return Gt(r)||(r=er(r)),Er[S(this,Pr)].month(r)}monthCode(e){let r=e;if(!Br(this))throw new TypeError("invalid receiver");return Gt(r)||vn(r)||(r=er(r)),Er[S(this,Pr)].monthCode(r)}day(e){let r=e;if(!Br(this))throw new TypeError("invalid receiver");return vn(r)||(r=er(r)),Er[S(this,Pr)].day(r)}era(e){let r=e;if(!Br(this))throw new TypeError("invalid receiver");return Gt(r)||(r=er(r)),Er[S(this,Pr)].era(r)}eraYear(e){let r=e;if(!Br(this))throw new TypeError("invalid receiver");return Gt(r)||(r=er(r)),Er[S(this,Pr)].eraYear(r)}dayOfWeek(e){if(!Br(this))throw new TypeError("invalid receiver");let r=er(e);return Er[S(this,Pr)].dayOfWeek(r)}dayOfYear(e){if(!Br(this))throw new TypeError("invalid receiver");let r=er(e);return Er[S(this,Pr)].dayOfYear(r)}weekOfYear(e){if(!Br(this))throw new TypeError("invalid receiver");let r=er(e);return Er[S(this,Pr)].weekOfYear(r)}yearOfWeek(e){if(!Br(this))throw new TypeError("invalid receiver");let r=er(e);return Er[S(this,Pr)].yearOfWeek(r)}daysInWeek(e){if(!Br(this))throw new TypeError("invalid receiver");let r=er(e);return Er[S(this,Pr)].daysInWeek(r)}daysInMonth(e){let r=e;if(!Br(this))throw new TypeError("invalid receiver");return Gt(r)||(r=er(r)),Er[S(this,Pr)].daysInMonth(r)}daysInYear(e){let r=e;if(!Br(this))throw new TypeError("invalid receiver");return Gt(r)||(r=er(r)),Er[S(this,Pr)].daysInYear(r)}monthsInYear(e){let r=e;if(!Br(this))throw new TypeError("invalid receiver");return Gt(r)||(r=er(r)),Er[S(this,Pr)].monthsInYear(r)}inLeapYear(e){let r=e;if(!Br(this))throw new TypeError("invalid receiver");return Gt(r)||(r=er(r)),Er[S(this,Pr)].inLeapYear(r)}toString(){if(!Br(this))throw new TypeError("invalid receiver");return S(this,Pr)}toJSON(){if(!Br(this))throw new TypeError("invalid receiver");return S(this,Pr)}static from(e){return Wm(yo(e))}};function p7(t){if(!t.startsWith("M"))throw new RangeError(`Invalid month code: ${t}. Month codes must start with M.`);let e=+t.slice(1);if(isNaN(e))throw new RangeError(`Invalid month code: ${t}`);return e}function Yd(t,e=!1){return`M${t.toString().padStart(2,"0")}${e?"L":""}`}function sx(t,e,r=12){let{month:n,monthCode:i}=t;if(i===void 0){if(n===void 0)throw new TypeError("Either month or monthCode are required");e==="reject"&&Un(n,1,r),e==="constrain"&&(n=ho(n,1,r)),i=Yd(n)}else{let o=p7(i);if(n!==void 0&&n!==o)throw new RangeError(`monthCode ${i} and month ${n} must match if both are present`);if(i!==Yd(o))throw new RangeError(`Invalid month code: ${i}`);if(n=o,n<1||n>r)throw new RangeError(`Invalid monthCode: ${i}`)}return{...t,month:n,monthCode:i}}zc(xr,"Temporal.Calendar"),Ir("Temporal.Calendar.from",xr.from),Ir("Temporal.Calendar.prototype.dateAdd",xr.prototype.dateAdd),Ir("Temporal.Calendar.prototype.dateFromFields",xr.prototype.dateFromFields),Ir("Temporal.Calendar.prototype.dateUntil",xr.prototype.dateUntil),Ir("Temporal.Calendar.prototype.day",xr.prototype.day),Ir("Temporal.Calendar.prototype.dayOfWeek",xr.prototype.dayOfWeek),Ir("Temporal.Calendar.prototype.dayOfYear",xr.prototype.dayOfYear),Ir("Temporal.Calendar.prototype.daysInMonth",xr.prototype.daysInMonth),Ir("Temporal.Calendar.prototype.daysInWeek",xr.prototype.daysInWeek),Ir("Temporal.Calendar.prototype.daysInYear",xr.prototype.daysInYear),Ir("Temporal.Calendar.prototype.era",xr.prototype.era),Ir("Temporal.Calendar.prototype.eraYear",xr.prototype.eraYear),Ir("Temporal.Calendar.prototype.fields",xr.prototype.fields),Ir("Temporal.Calendar.prototype.inLeapYear",xr.prototype.inLeapYear),Ir("Temporal.Calendar.prototype.mergeFields",xr.prototype.mergeFields),Ir("Temporal.Calendar.prototype.month",xr.prototype.month),Ir("Temporal.Calendar.prototype.monthCode",xr.prototype.monthCode),Ir("Temporal.Calendar.prototype.monthDayFromFields",xr.prototype.monthDayFromFields),Ir("Temporal.Calendar.prototype.monthsInYear",xr.prototype.monthsInYear),Ir("Temporal.Calendar.prototype.weekOfYear",xr.prototype.weekOfYear),Ir("Temporal.Calendar.prototype.year",xr.prototype.year),Ir("Temporal.Calendar.prototype.yearMonthFromFields",xr.prototype.yearMonthFromFields),Ir("Temporal.Calendar.prototype.yearOfWeek",xr.prototype.yearOfWeek),Er.iso8601={dateFromFields(t,e,r){let n=Ye(t,["day","month","monthCode","year"],["year","day"]),i=Jr(e);n=sx(n);let{year:o,month:s,day:a}=n;return{year:o,month:s,day:a}=lx(o,s,a,i),fs(o,s,a,r)},yearMonthFromFields(t,e,r){let n=Ye(t,["month","monthCode","year"],["year"]),i=Jr(e);n=sx(n);let{year:o,month:s}=n;return{year:o,month:s}=function(c,d,f){let u=c,m=d;switch(f){case"reject":Uc(u,m,1);break;case"constrain":({year:u,month:m}=VY(u,m))}return{year:u,month:m}}(o,s,i),Tv(o,s,r,1)},monthDayFromFields(t,e,r){let n=Ye(t,["day","month","monthCode","year"],["day"]),i=Jr(e);if(n.month!==void 0&&n.year===void 0&&n.monthCode===void 0)throw new TypeError("either year or monthCode required with month");let o=n.monthCode===void 0;n=sx(n);let{month:s,day:a,year:c}=n;return{month:s,day:a}=lx(o?c:1972,s,a,i),Av(s,a,r,1972)},fields:t=>t,fieldKeysToIgnore(t){let e=new pJ;for(let r=0;r<t.length;r++){let n=t[r];_e(ei,e,[n]),n==="month"?_e(ei,e,["monthCode"]):n==="monthCode"&&_e(ei,e,["month"])}return[..._e(mJ,e,[])]},dateAdd(t,e,r,n,i,o,s){let a=S(t,de),c=S(t,fe),d=S(t,he);return{year:a,month:c,day:d}=$h(a,c,d,e,r,n,i,o),fs(a,c,d,s)},dateUntil:(t,e,r)=>s7(S(t,de),S(t,fe),S(t,he),S(e,de),S(e,fe),S(e,he),r),year:t=>S(t,de),era(){},eraYear(){},month:t=>S(t,fe),monthCode:t=>Yd(S(t,fe)),day:t=>S(t,he),dayOfWeek:t=>x9(S(t,de),S(t,fe),S(t,he)),dayOfYear:t=>gx(S(t,de),S(t,fe),S(t,he)),weekOfYear:t=>JZ(S(t,de),S(t,fe),S(t,he)).week,yearOfWeek:t=>JZ(S(t,de),S(t,fe),S(t,he)).year,daysInWeek:()=>7,daysInMonth:t=>Zd(S(t,de),S(t,fe)),daysInYear(t){let e=t;return _n(e,de)||(e=er(e)),vu(S(e,de))?366:365},monthsInYear:()=>12,inLeapYear(t){let e=t;return _n(e,de)||(e=er(e)),vu(S(e,de))}};var lr=class{constructor(e){if(this.map=new Map,this.calls=0,this.hits=0,this.misses=0,this.now=globalThis.performance?globalThis.performance.now():Date.now(),e!==void 0){let r=0;for(let n of e.map.entries()){if(++r>lr.MAX_CACHE_ENTRIES)break;this.map.set(...n)}}}get(e){let r=this.map.get(e);return r&&(this.hits++,this.report()),this.calls++,r}set(e,r){this.map.set(e,r),this.misses++,this.report()}report(){}setObject(e){if(lr.objectMap.get(e))throw new RangeError("object already cached");lr.objectMap.set(e,this),this.report()}static getCacheForObject(e){let r=lr.objectMap.get(e);return r||(r=new lr,lr.objectMap.set(e,r)),r}};function yJ({isoYear:t,isoMonth:e,isoDay:r}){return`${tp(t)}-${Sr(e)}-${Sr(r)}T00:00Z`}function h9(t,e){return{years:t.year-e.year,months:t.month-e.month,days:t.day-e.day}}lr.objectMap=new WeakMap,lr.MAX_CACHE_ENTRIES=1e3;var _u=class{constructor(){this.eraLength="short",this.hasEra=!0,this.erasBeginMidYear=!1}getFormatter(){return this.formatter===void 0&&(this.formatter=new l4e(`en-US-u-ca-${this.id}`,{day:"numeric",month:"numeric",year:"numeric",era:this.eraLength,timeZone:"UTC"})),this.formatter}isoToCalendarDate(e,r){let{year:n,month:i,day:o}=e,s=JSON.stringify({func:"isoToCalendarDate",isoYear:n,isoMonth:i,isoDay:o,id:this.id}),a=r.get(s);if(a)return a;let c=this.getFormatter(),d,f;try{f=yJ({isoYear:n,isoMonth:i,isoDay:o}),d=c.formatToParts(new Date(f))}catch{throw new RangeError(`Invalid ISO date: ${JSON.stringify({isoYear:n,isoMonth:i,isoDay:o})}`)}let u={};for(let{type:_,value:v}of d){if(_==="year"&&(u.eraYear=+v),_==="relatedYear"&&(u.eraYear=+v),_==="month"){let A=/^([0-9]*)(.*?)$/.exec(v);if(!A||A.length!=3||!A[1]&&!A[2])throw new RangeError(`Unexpected month: ${v}`);if(u.month=A[1]?+A[1]:1,u.month<1)throw new RangeError(`Invalid month ${v} from ${f}[u-ca-${this.id}] (probably due to https://bugs.chromium.org/p/v8/issues/detail?id=10527)`);if(u.month>13)throw new RangeError(`Invalid month ${v} from ${f}[u-ca-${this.id}] (probably due to https://bugs.chromium.org/p/v8/issues/detail?id=10529)`);A[2]&&(u.monthExtra=A[2])}_==="day"&&(u.day=+v),this.hasEra&&_==="era"&&v!=null&&v!==""&&(v=v.split(" (")[0],u.era=v.normalize("NFD").replace(/[^-0-9 \p{L}]/gu,"").replace(" ","-").toLowerCase())}if(u.eraYear===void 0)throw new RangeError(`Intl.DateTimeFormat.formatToParts lacks relatedYear in ${this.id} calendar. Try Node 14+ or modern browsers.`);if(this.reviseIntlEra){let{era:_,eraYear:v}=this.reviseIntlEra(u,e);u.era=_,u.eraYear=v}this.checkIcuBugs&&this.checkIcuBugs(e);let m=this.adjustCalendarDate(u,r,"constrain",!0);if(m.year===void 0)throw new RangeError(`Missing year converting ${JSON.stringify(e)}`);if(m.month===void 0)throw new RangeError(`Missing month converting ${JSON.stringify(e)}`);if(m.day===void 0)throw new RangeError(`Missing day converting ${JSON.stringify(e)}`);return r.set(s,m),["constrain","reject"].forEach(_=>{let v=JSON.stringify({func:"calendarToIsoDate",year:m.year,month:m.month,day:m.day,overflow:_,id:this.id});r.set(v,e)}),m}validateCalendarDate(e){let{era:r,month:n,year:i,day:o,eraYear:s,monthCode:a,monthExtra:c}=e;if(c!==void 0)throw new RangeError("Unexpected `monthExtra` value");if(i===void 0&&s===void 0)throw new TypeError("year or eraYear is required");if(n===void 0&&a===void 0)throw new TypeError("month or monthCode is required");if(o===void 0)throw new RangeError("Missing day");if(a!==void 0){if(typeof a!="string")throw new RangeError("monthCode must be a string, not "+typeof a);if(!/^M([01]?\d)(L?)$/.test(a))throw new RangeError(`Invalid monthCode: ${a}`)}if(this.constantEra){if(r!==void 0&&r!==this.constantEra)throw new RangeError(`era must be ${this.constantEra}, not ${r}`);if(s!==void 0&&i!==void 0&&s!==i)throw new RangeError(`eraYear ${s} does not match year ${i}`)}if(this.hasEra&&e.era===void 0!=(e.eraYear===void 0))throw new RangeError("properties 'era' and 'eraYear' must be provided together")}adjustCalendarDate(e,r,n="constrain",i=!1){if(this.calendarType==="lunisolar")throw new RangeError("Override required for lunisolar calendars");let o=e;if(this.validateCalendarDate(o),this.constantEra){let{year:d,eraYear:f}=o;o={...o,era:this.constantEra,year:d!==void 0?d:f,eraYear:f!==void 0?f:d}}let s=this.monthsInYear(o,r),{month:a,monthCode:c}=o;return{month:a,monthCode:c}=sx(o,n,s),{...o,month:a,monthCode:c}}regulateMonthDayNaive(e,r,n){let i=this.monthsInYear(e,n),{month:o,day:s}=e;return r==="reject"?(Un(o,1,i),Un(s,1,this.maximumMonthLength(e))):(o=ho(o,1,i),s=ho(s,1,this.maximumMonthLength({...e,month:o}))),{...e,month:o,day:s}}calendarToIsoDate(e,r="constrain",n){let i=e,o=this.adjustCalendarDate(e,n,r,!1);o=this.regulateMonthDayNaive(o,r,n);let{year:s,month:a,day:c}=o,d=JSON.stringify({func:"calendarToIsoDate",year:s,month:a,day:c,overflow:r,id:this.id}),f,u=n.get(d);if(u||i.year!==void 0&&i.month!==void 0&&i.day!==void 0&&(i.year!==o.year||i.month!==o.month||i.day!==o.day)&&(f=JSON.stringify({func:"calendarToIsoDate",year:i.year,month:i.month,day:i.day,overflow:r,id:this.id}),u=n.get(f),u))return u;let m=this.estimateIsoDate({year:s,month:a,day:c}),_=D=>{let O=this.addDaysIso(m,D);if(o.day>this.minimumMonthLength(o)){let U=this.isoToCalendarDate(O,n);for(;U.month!==a||U.year!==s;){if(r==="reject")throw new RangeError(`day ${c} does not exist in month ${a} of year ${s}`);O=this.addDaysIso(O,-1),U=this.isoToCalendarDate(O,n)}}return O},v=0,A=this.isoToCalendarDate(m,n),T=h9(o,A);if(T.years!==0||T.months!==0||T.days!==0){let D=365*T.years+30*T.months+T.days;m=this.addDaysIso(m,D),A=this.isoToCalendarDate(m,n),T=h9(o,A),T.years===0&&T.months===0?m=_(T.days):v=this.compareCalendarDates(o,A)}let M=8;for(;v;){m=this.addDaysIso(m,v*M);let D=A;A=this.isoToCalendarDate(m,n);let O=v;if(v=this.compareCalendarDates(o,A),v){if(T=h9(o,A),T.years===0&&T.months===0)m=_(T.days),v=0;else if(O&&v!==O)if(M>1)M/=2;else{if(r==="reject")throw new RangeError(`Can't find ISO date from calendar date: ${JSON.stringify({...i})}`);this.compareCalendarDates(A,D)>0&&(m=this.addDaysIso(m,-1)),v=0}}}if(n.set(d,m),f&&n.set(f,m),o.year===void 0||o.month===void 0||o.day===void 0||o.monthCode===void 0||this.hasEra&&(o.era===void 0||o.eraYear===void 0))throw new RangeError("Unexpected missing property");return m}temporalToCalendarDate(e,r){let n={year:S(e,de),month:S(e,fe),day:S(e,he)};return this.isoToCalendarDate(n,r)}compareCalendarDates(e,r){let n=Ye(e,["day","month","year"],["day","month","year"]),i=Ye(r,["day","month","year"],["day","month","year"]);return n.year!==i.year?Gh(n.year-i.year):n.month!==i.month?Gh(n.month-i.month):n.day!==i.day?Gh(n.day-i.day):0}regulateDate(e,r="constrain",n){let i=this.calendarToIsoDate(e,r,n);return this.isoToCalendarDate(i,n)}addDaysIso(e,r){return $h(e.year,e.month,e.day,0,0,0,r,"constrain")}addDaysCalendar(e,r,n){let i=this.calendarToIsoDate(e,"constrain",n),o=this.addDaysIso(i,r);return this.isoToCalendarDate(o,n)}addMonthsCalendar(e,r,n,i){let o=e,{day:s}=o;for(let a=0,c=p4e(r);a<c;a++){let{month:d}=o,f=o,u=r<0?-Math.max(s,this.daysInPreviousMonth(o,i)):this.daysInMonth(o,i),m=this.calendarToIsoDate(o,"constrain",i),_=this.addDaysIso(m,u);if(o=this.isoToCalendarDate(_,i),r>0){let v=this.monthsInYear(f,i);for(;o.month-1!=d%v;)_=this.addDaysIso(_,-1),o=this.isoToCalendarDate(_,i)}o.day!==s&&(o=this.regulateDate({...o,day:s},"constrain",i))}if(n==="reject"&&o.day!==s)throw new RangeError(`Day ${s} does not exist in resulting calendar month`);return o}addCalendar(e,{years:r=0,months:n=0,weeks:i=0,days:o=0},s,a){let{year:c,day:d,monthCode:f}=e,u=this.adjustCalendarDate({year:c+r,monthCode:f,day:d},a),m=this.addMonthsCalendar(u,n,s,a),_=o+7*i;return this.addDaysCalendar(m,_,a)}untilCalendar(e,r,n,i){let o=0,s=0,a=0,c=0;switch(n){case"day":o=this.calendarDaysUntil(e,r,i);break;case"week":{let d=this.calendarDaysUntil(e,r,i);o=d%7,s=(d-o)/7;break}case"month":case"year":{let d=this.compareCalendarDates(r,e);if(!d)return{years:0,months:0,weeks:0,days:0};let f=r.year-e.year,u=r.day-e.day;if(n==="year"&&f){let v=0;r.monthCode>e.monthCode&&(v=1),r.monthCode<e.monthCode&&(v=-1),v||(v=Math.sign(u)),c=v*d<0?f-d:f}let m,_=c?this.addCalendar(e,{years:c},"constrain",i):e;do a+=d,m=_,_=this.addMonthsCalendar(m,d,"constrain",i),_.day!==e.day&&(_=this.regulateDate({..._,day:e.day},"constrain",i));while(this.compareCalendarDates(r,_)*d>=0);a-=d,o=this.calendarDaysUntil(m,r,i);break}}return{years:c,months:a,weeks:s,days:o}}daysInMonth(e,r){let{day:n}=e,i=this.maximumMonthLength(e),o=this.minimumMonthLength(e);if(o===i)return o;let s=n<=i-o?i:o,a=this.calendarToIsoDate(e,"constrain",r),c=this.addDaysIso(a,s),d=this.isoToCalendarDate(c,r),f=this.addDaysIso(c,-d.day);return this.isoToCalendarDate(f,r).day}daysInPreviousMonth(e,r){let{day:n,month:i,year:o}=e,s={year:i>1?o:o-1,month:i,day:1},a=i>1?i-1:this.monthsInYear(s,r);s={...s,month:a};let c=this.minimumMonthLength(s),d=this.maximumMonthLength(s);if(c===d)return d;let f=this.calendarToIsoDate(e,"constrain",r),u=this.addDaysIso(f,-n);return this.isoToCalendarDate(u,r).day}startOfCalendarYear(e){return{year:e.year,month:1,monthCode:"M01",day:1}}startOfCalendarMonth(e){return{year:e.year,month:e.month,day:1}}calendarDaysUntil(e,r,n){let i=this.calendarToIsoDate(e,"constrain",n),o=this.calendarToIsoDate(r,"constrain",n);return this.isoDaysUntil(i,o)}isoDaysUntil(e,r){return s7(e.year,e.month,e.day,r.year,r.month,r.day,"day").days}monthDayFromFields(e,r,n){let i,o,s,a,c,{monthCode:d,day:f}=e;if(d===void 0){let{year:_,era:v,eraYear:A}=e;if(_===void 0&&(v===void 0||A===void 0))throw new TypeError("when `monthCode` is omitted, `year` (or `era` and `eraYear`) and `month` are required");({monthCode:d,day:f}=this.isoToCalendarDate(this.calendarToIsoDate(e,r,n),n))}let u=this.isoToCalendarDate({year:1972,month:12,day:31},n),m=u.monthCode>d||u.monthCode===d&&u.day>=f?u.year:u.year-1;for(let _=0;_<100;_++){let v=this.adjustCalendarDate({day:f,monthCode:d,year:m-_},n),A=this.calendarToIsoDate(v,"constrain",n),T=this.isoToCalendarDate(A,n);if({year:i,month:o,day:s}=A,T.monthCode===d&&T.day===f)return{month:o,day:s,year:i};r==="constrain"&&(a===void 0||T.monthCode===a.monthCode&&T.day>a.day)&&(a=T,c=A)}if(r==="constrain"&&c!==void 0)return c;throw new RangeError(`No recent ${this.id} year with monthCode ${d} and day ${f}`)}},P9=class extends _u{constructor(){super(...arguments),this.id="hebrew",this.calendarType="lunisolar",this.months={Tishri:{leap:1,regular:1,monthCode:"M01",days:30},Heshvan:{leap:2,regular:2,monthCode:"M02",days:{min:29,max:30}},Kislev:{leap:3,regular:3,monthCode:"M03",days:{min:29,max:30}},Tevet:{leap:4,regular:4,monthCode:"M04",days:29},Shevat:{leap:5,regular:5,monthCode:"M05",days:30},Adar:{leap:void 0,regular:6,monthCode:"M06",days:29},"Adar I":{leap:6,regular:void 0,monthCode:"M05L",days:30},"Adar II":{leap:7,regular:void 0,monthCode:"M06",days:29},Nisan:{leap:8,regular:7,monthCode:"M07",days:30},Iyar:{leap:9,regular:8,monthCode:"M08",days:29},Sivan:{leap:10,regular:9,monthCode:"M09",days:30},Tamuz:{leap:11,regular:10,monthCode:"M10",days:29},Av:{leap:12,regular:11,monthCode:"M11",days:30},Elul:{leap:13,regular:12,monthCode:"M12",days:29}},this.hasEra=!1}inLeapYear(e){let{year:r}=e;return(7*r+1)%19<7}monthsInYear(e){return this.inLeapYear(e)?13:12}minimumMonthLength(e){return this.minMaxMonthLength(e,"min")}maximumMonthLength(e){return this.minMaxMonthLength(e,"max")}minMaxMonthLength(e,r){let{month:n,year:i}=e,o=this.getMonthCode(i,n),s=T9(this.months).find(c=>c[1].monthCode===o);if(s===void 0)throw new RangeError(`unmatched Hebrew month: ${n}`);let a=s[1].days;return typeof a=="number"?a:a[r]}estimateIsoDate(e){let{year:r}=e;return{year:r-3760,month:1,day:1}}getMonthCode(e,r){return this.inLeapYear({year:e})?r===6?Yd(5,!0):Yd(r<6?r:r-1):Yd(r)}adjustCalendarDate(e,r,n="constrain",i=!1){let{year:o,eraYear:s,month:a,monthCode:c,day:d,monthExtra:f}=e;if(o===void 0&&s!==void 0&&(o=s),s===void 0&&o!==void 0&&(s=o),i){if(f){let u=this.months[f];if(!u)throw new RangeError(`Unrecognized month from formatToParts: ${f}`);a=this.inLeapYear({year:o})?u.leap:u.regular}return c=this.getMonthCode(o,a),{year:o,month:a,day:d,era:void 0,eraYear:s,monthCode:c}}if(this.validateCalendarDate(e),a===void 0)if(c.endsWith("L")){if(c!=="M05L")throw new RangeError(`Hebrew leap month must have monthCode M05L, not ${c}`);if(a=6,!this.inLeapYear({year:o})){if(n==="reject")throw new RangeError(`Hebrew monthCode M05L is invalid in year ${o} which is not a leap year`);a=6,c="M06"}}else{a=p7(c),this.inLeapYear({year:o})&&a>=6&&a++;let u=this.monthsInYear({year:o});if(a<1||a>u)throw new RangeError(`Invalid monthCode: ${c}`)}else if(n==="reject"?(Un(a,1,this.monthsInYear({year:o})),Un(d,1,this.maximumMonthLength({year:o,month:a}))):(a=ho(a,1,this.monthsInYear({year:o})),d=ho(d,1,this.maximumMonthLength({year:o,month:a}))),c===void 0)c=this.getMonthCode(o,a);else if(this.getMonthCode(o,a)!==c)throw new RangeError(`monthCode ${c} doesn't correspond to month ${a} in Hebrew year ${o}`);return{...e,day:d,month:a,monthCode:c,year:o,eraYear:s}}},xu=class extends _u{constructor(){super(...arguments),this.calendarType="lunar",this.DAYS_PER_ISLAMIC_YEAR=354+11/30,this.DAYS_PER_ISO_YEAR=365.2425,this.constantEra="ah"}inLeapYear(e,r){return this.daysInMonth({year:e.year,month:12,day:1},r)===30}monthsInYear(){return 12}minimumMonthLength(){return 29}maximumMonthLength(){return 30}estimateIsoDate(e){let{year:r}=this.adjustCalendarDate(e);return{year:m4e(r*this.DAYS_PER_ISLAMIC_YEAR/this.DAYS_PER_ISO_YEAR)+622,month:1,day:1}}},_x=class extends xu{constructor(){super(...arguments),this.id="islamic"}},I9=class extends xu{constructor(){super(...arguments),this.id="islamic-umalqura"}},R9=class extends xu{constructor(){super(...arguments),this.id="islamic-tbla"}},M9=class extends xu{constructor(){super(...arguments),this.id="islamic-civil"}},k9=class extends xu{constructor(){super(...arguments),this.id="islamic-rgsa"}},B9=class extends xu{constructor(){super(...arguments),this.id="islamicc"}},D9=class extends _u{constructor(){super(...arguments),this.id="persian",this.calendarType="solar",this.constantEra="ap"}inLeapYear(e,r){return _x.prototype.inLeapYear.call(this,e,r)}monthsInYear(){return 12}minimumMonthLength(e){let{month:r}=e;return r===12?29:r<=6?31:30}maximumMonthLength(e){let{month:r}=e;return r===12?30:r<=6?31:30}estimateIsoDate(e){let{year:r}=this.adjustCalendarDate(e);return{year:r+621,month:1,day:1}}},C9=class extends _u{constructor(){super(...arguments),this.id="indian",this.calendarType="solar",this.constantEra="saka",this.months={1:{length:30,month:3,day:22,leap:{length:31,month:3,day:21}},2:{length:31,month:4,day:21},3:{length:31,month:5,day:22},4:{length:31,month:6,day:22},5:{length:31,month:7,day:23},6:{length:31,month:8,day:23},7:{length:30,month:9,day:23},8:{length:30,month:10,day:23},9:{length:30,month:11,day:22},10:{length:30,month:12,day:22},11:{length:30,month:1,nextYear:!0,day:21},12:{length:30,month:2,nextYear:!0,day:20}},this.vulnerableToBceBug=new Date("0000-01-01T00:00Z").toLocaleDateString("en-US-u-ca-indian",{timeZone:"UTC"})!=="10/11/-79 Saka"}inLeapYear(e){return gJ(e.year+78)}monthsInYear(){return 12}minimumMonthLength(e){return this.getMonthInfo(e).length}maximumMonthLength(e){return this.getMonthInfo(e).length}getMonthInfo(e){let{month:r}=e,n=this.months[r];if(n===void 0)throw new RangeError(`Invalid month: ${r}`);return this.inLeapYear(e)&&n.leap&&(n=n.leap),n}estimateIsoDate(e){let r=this.adjustCalendarDate(e),n=this.getMonthInfo(r);return $h(r.year+78+(n.nextYear?1:0),n.month,n.day,0,0,0,r.day-1,"constrain")}checkIcuBugs(e){if(this.vulnerableToBceBug&&e.year<1)throw new RangeError(`calendar '${this.id}' is broken for ISO dates before 0001-01-01 (see https://bugs.chromium.org/p/v8/issues/detail?id=10529)`)}};function gJ(t){return t%4==0&&(t%100!=0||t%400==0)}var Jh=class extends _u{constructor(e,r){super(),this.calendarType="solar",this.v8IsVulnerableToJulianBug=new Date("+001001-01-01T00:00Z").toLocaleDateString("en-US-u-ca-japanese",{timeZone:"UTC"}).startsWith("12"),this.calendarIsVulnerableToJulianBug=!1,this.id=e;let{eras:n,anchorEra:i}=function(s){let a,c=s;if(c.length===0)throw new RangeError("Invalid era data: eras are required");if(c.length===1&&c[0].reverseOf)throw new RangeError("Invalid era data: anchor era cannot count years backwards");if(c.length===1&&!c[0].name)throw new RangeError("Invalid era data: at least one named era is required");if(c.filter(f=>f.reverseOf!=null).length>1)throw new RangeError("Invalid era data: only one era can count years backwards");c.forEach(f=>{if(f.isAnchor||!f.anchorEpoch&&!f.reverseOf){if(a)throw new RangeError("Invalid era data: cannot have multiple anchor eras");a=f,f.anchorEpoch={year:f.hasYearZero?0:1}}else if(!f.name)throw new RangeError("If era name is blank, it must be the anchor era")}),c=c.filter(f=>f.name),c.forEach(f=>{let{reverseOf:u}=f;if(u){let m=c.find(_=>_.name===u);if(m===void 0)throw new RangeError(`Invalid era data: unmatched reverseOf era: ${u}`);f.reverseOf=m,f.anchorEpoch=m.anchorEpoch,f.isoEpoch=m.isoEpoch}f.anchorEpoch.month===void 0&&(f.anchorEpoch.month=1),f.anchorEpoch.day===void 0&&(f.anchorEpoch.day=1)}),h4e.call(c,(f,u)=>{if(f.reverseOf)return 1;if(u.reverseOf)return-1;if(!f.isoEpoch||!u.isoEpoch)throw new RangeError("Invalid era data: missing ISO epoch");return u.isoEpoch.year-f.isoEpoch.year});let d=c[c.length-1].reverseOf;if(d&&d!==c[c.length-2])throw new RangeError("Invalid era data: invalid reverse-sign era");return c.forEach((f,u)=>{f.genericName="era"+(c.length-1-u)}),{eras:c,anchorEra:a||c[0]}}(r);this.anchorEra=i,this.eras=n}inLeapYear(e){let{year:r}=this.estimateIsoDate({month:1,day:1,year:e.year});return gJ(r)}monthsInYear(){return 12}minimumMonthLength(e){let{month:r}=e;return r===2?this.inLeapYear(e)?29:28:[4,6,9,11].indexOf(r)>=0?30:31}maximumMonthLength(e){return this.minimumMonthLength(e)}completeEraYear(e){let r=(a,c)=>{let d=e[a];if(d!=null&&d!=c)throw new RangeError(`Input ${a} ${d} doesn't match calculated value ${c}`)},n=a=>{let c,d={...e,year:a},f=this.eras.find((u,m)=>{if(m===this.eras.length-1){if(u.reverseOf){if(a>0)throw new RangeError(`Signed year ${a} is invalid for era ${u.name}`);return c=u.anchorEpoch.year-a,!0}return c=a-u.anchorEpoch.year+(u.hasYearZero?0:1),!0}return this.compareCalendarDates(d,u.anchorEpoch)>=0&&(c=a-u.anchorEpoch.year+(u.hasYearZero?0:1),!0)});if(!f)throw new RangeError(`Year ${a} was not matched by any era`);return{eraYear:c,era:f.name}},{year:i,eraYear:o,era:s}=e;if(i!=null)({eraYear:o,era:s}=n(i)),r("era",s),r("eraYear",o);else{if(o==null)throw new RangeError("Either `year` or `eraYear` and `era` are required");{let a=s===void 0?void 0:this.eras.find(c=>c.name===s||c.genericName===s);if(!a)throw new RangeError(`Era ${s} (ISO year ${o}) was not matched by any era`);if(o<1&&a.reverseOf)throw new RangeError(`Years in ${s} era must be positive, not ${i}`);i=a.reverseOf?a.anchorEpoch.year-o:o+a.anchorEpoch.year-(a.hasYearZero?0:1),r("year",i),{eraYear:o,era:s}=n(i)}}return{...e,year:i,eraYear:o,era:s}}adjustCalendarDate(e,r,n="constrain"){let i=e,{month:o,monthCode:s}=i;return o===void 0&&(i={...i,month:p7(s)}),this.validateCalendarDate(i),i=this.completeEraYear(i),super.adjustCalendarDate(i,r,n)}estimateIsoDate(e){let r=this.adjustCalendarDate(e),{year:n,month:i,day:o}=r,{anchorEra:s}=this;return lx(n+s.isoEpoch.year-(s.hasYearZero?0:1),i,o,"constrain")}checkIcuBugs(e){if(this.calendarIsVulnerableToJulianBug&&this.v8IsVulnerableToJulianBug&&mu(e.year,e.month,e.day,1582,10,15)<0)throw new RangeError(`calendar '${this.id}' is broken for ISO dates before 1582-10-15 (see https://bugs.chromium.org/p/chromium/issues/detail?id=1173158)`)}},Iv=class extends Jh{constructor(e,r){super(e,r)}inLeapYear(e){let{year:r}=e;return(r+1)%4==0}monthsInYear(){return 13}minimumMonthLength(e){let{month:r}=e;return r===13?this.inLeapYear(e)?6:5:30}maximumMonthLength(e){return this.minimumMonthLength(e)}},O9=class extends Iv{constructor(){super("ethioaa",[{name:"era0",isoEpoch:{year:-5492,month:7,day:17}}])}},j9=class extends Iv{constructor(){super("coptic",[{name:"era1",isoEpoch:{year:284,month:8,day:29}},{name:"era0",reverseOf:"era1"}])}},N9=class extends Iv{constructor(){super("ethiopic",[{name:"era0",isoEpoch:{year:-5492,month:7,day:17}},{name:"era1",isoEpoch:{year:8,month:8,day:27},anchorEpoch:{year:5501}}])}},q9=class extends Jh{constructor(){super("roc",[{name:"minguo",isoEpoch:{year:1912,month:1,day:1}},{name:"before-roc",reverseOf:"minguo"}]),this.calendarIsVulnerableToJulianBug=!0}},L9=class extends Jh{constructor(){super("buddhist",[{name:"be",hasYearZero:!0,isoEpoch:{year:-543,month:1,day:1}}]),this.calendarIsVulnerableToJulianBug=!0}},U9=class extends Jh{constructor(){super("gregory",[{name:"ce",isoEpoch:{year:1,month:1,day:1}},{name:"bce",reverseOf:"ce"}])}reviseIntlEra(e){let{era:r,eraYear:n}=e;return r!=="bc"&&r!=="b"||(r="bce"),r!=="ad"&&r!=="a"||(r="ce"),{era:r,eraYear:n}}},F9=class extends Jh{constructor(){super("japanese",[{name:"reiwa",isoEpoch:{year:2019,month:5,day:1},anchorEpoch:{year:2019,month:5,day:1}},{name:"heisei",isoEpoch:{year:1989,month:1,day:8},anchorEpoch:{year:1989,month:1,day:8}},{name:"showa",isoEpoch:{year:1926,month:12,day:25},anchorEpoch:{year:1926,month:12,day:25}},{name:"taisho",isoEpoch:{year:1912,month:7,day:30},anchorEpoch:{year:1912,month:7,day:30}},{name:"meiji",isoEpoch:{year:1868,month:9,day:8},anchorEpoch:{year:1868,month:9,day:8}},{name:"ce",isoEpoch:{year:1,month:1,day:1}},{name:"bce",reverseOf:"ce"}]),this.calendarIsVulnerableToJulianBug=!0,this.eraLength="long",this.erasBeginMidYear=!0}reviseIntlEra(e,r){let{era:n,eraYear:i}=e,{year:o}=r;return this.eras.find(s=>s.name===n)?{era:n,eraYear:i}:o<1?{era:"bce",eraYear:1-o}:{era:"ce",eraYear:o}}},xx=class extends _u{constructor(){super(...arguments),this.calendarType="lunisolar",this.hasEra=!1}inLeapYear(e,r){let n=this.getMonthList(e.year,r);return T9(n).length===13}monthsInYear(e,r){return this.inLeapYear(e,r)?13:12}minimumMonthLength(){return 29}maximumMonthLength(){return 30}getMonthList(e,r){if(e===void 0)throw new TypeError("Missing year");let n=JSON.stringify({func:"getMonthList",calendarYear:e,id:this.id}),i=r.get(n);if(i)return i;let o=this.getFormatter(),s=(T,M)=>{let D=yJ({isoYear:T,isoMonth:2,isoDay:1}),O=new Date(D);O.setUTCDate(M+1);let U=o.formatToParts(O),L=U.find(H=>H.type==="month").value,F=+U.find(H=>H.type==="day").value,$=U.find(H=>H.type==="relatedYear");if($===void 0)throw new RangeError(`Intl.DateTimeFormat.formatToParts lacks relatedYear in ${this.id} calendar. Try Node 14+ or modern browsers.`);return $=+$.value,{calendarMonthString:L,calendarDay:F,calendarYearToVerify:$}},a=17,{calendarMonthString:c,calendarDay:d,calendarYearToVerify:f}=s(e,a);c!=="1"&&(a+=29,{calendarMonthString:c,calendarDay:d}=s(e,a)),a-=d-5;let u={},m,_,v=1,A=!1;do({calendarMonthString:c,calendarDay:d,calendarYearToVerify:f}=s(e,a)),m&&(u[_].daysInMonth=m+30-d),f!==e?A=!0:(u[c]={monthIndex:v++},a+=30),m=d,_=c;while(!A);return u[_].daysInMonth=m+30-d,r.set(n,u),u}estimateIsoDate(e){let{year:r,month:n}=e;return{year:r,month:n>=12?12:n+1,day:1}}adjustCalendarDate(e,r,n="constrain",i=!1){let{year:o,month:s,monthExtra:a,day:c,monthCode:d,eraYear:f}=e;if(i){if(o=f,a&&a!=="bis")throw new RangeError(`Unexpected leap month suffix: ${a}`);let u=Yd(s,a!==void 0),m=`${s}${a||""}`,_=this.getMonthList(o,r)[m];if(_===void 0)throw new RangeError(`Unmatched month ${m} in Chinese year ${o}`);return s=_.monthIndex,{year:o,month:s,day:c,era:void 0,eraYear:f,monthCode:u}}if(this.validateCalendarDate(e),o===void 0&&(o=f),f===void 0&&(f=o),s===void 0){let u=this.getMonthList(o,r),m=d.replace("L","bis").slice(1);m[0]==="0"&&(m=m.slice(1));let _=u[m];if(s=_&&_.monthIndex,s===void 0&&d.endsWith("L")&&d!="M13L"&&n==="constrain"){let v=d.slice(1,-1);v[0]==="0"&&(v=v.slice(1)),_=u[v],_&&(s=_.monthIndex,d=Yd(v))}if(s===void 0)throw new RangeError(`Unmatched month ${d} in Chinese year ${o}`)}else if(d===void 0){let u=this.getMonthList(o,r),m=T9(u),_=m.length;n==="reject"?(Un(s,1,_),Un(c,1,this.maximumMonthLength())):(s=ho(s,1,_),c=ho(c,1,this.maximumMonthLength()));let v=m.find(([,A])=>A.monthIndex===s);if(v===void 0)throw new RangeError(`Invalid month ${s} in Chinese year ${o}`);d=Yd(v[0].replace("bis",""),v[0].indexOf("bis")!==-1)}else{let u=this.getMonthList(o,r),m=d.replace("L","bis").slice(1);m[0]==="0"&&(m=m.slice(1));let _=u[m];if(!_)throw new RangeError(`Unmatched monthCode ${d} in Chinese year ${o}`);if(s!==_.monthIndex)throw new RangeError(`monthCode ${d} doesn't correspond to month ${s} in Chinese year ${o}`)}return{...e,year:o,eraYear:f,month:s,monthCode:d,day:c}}},z9=class extends xx{constructor(){super(...arguments),this.id="chinese"}},$9=class extends xx{constructor(){super(...arguments),this.id="dangi"}},G9=class{constructor(e){this.helper=e}dateFromFields(e,r,n){let i=new lr,o=Ye(e,this.fields(["day","month","monthCode","year"]),[]),s=Jr(r),{year:a,month:c,day:d}=this.helper.calendarToIsoDate(o,s,i),f=fs(a,c,d,n);return i.setObject(f),f}yearMonthFromFields(e,r,n){let i=new lr,o=Ye(e,this.fields(["month","monthCode","year"]),[]),s=Jr(r),{year:a,month:c,day:d}=this.helper.calendarToIsoDate({...o,day:1},s,i),f=Tv(a,c,n,d);return i.setObject(f),f}monthDayFromFields(e,r,n){let i=new lr,o=Ye(e,this.fields(["day","month","monthCode","year"]),[]),s=Jr(r),{year:a,month:c,day:d}=this.helper.monthDayFromFields(o,s,i),f=Av(c,d,n,a);return i.setObject(f),f}fields(e){let r=e;return hJ.call(r,"year")&&(r=[...r,"era","eraYear"]),r}fieldKeysToIgnore(e){let r=new pJ;for(let n=0;n<e.length;n++){let i=e[n];switch(_e(ei,r,[i]),i){case"era":_e(ei,r,["eraYear"]),_e(ei,r,["year"]);break;case"eraYear":_e(ei,r,["era"]),_e(ei,r,["year"]);break;case"year":_e(ei,r,["era"]),_e(ei,r,["eraYear"]);break;case"month":_e(ei,r,["monthCode"]),this.helper.erasBeginMidYear&&(_e(ei,r,["era"]),_e(ei,r,["eraYear"]));break;case"monthCode":_e(ei,r,["month"]),this.helper.erasBeginMidYear&&(_e(ei,r,["era"]),_e(ei,r,["eraYear"]));break;case"day":this.helper.erasBeginMidYear&&(_e(ei,r,["era"]),_e(ei,r,["eraYear"]))}}return[..._e(mJ,r,[])]}dateAdd(e,r,n,i,o,s,a){let c=lr.getCacheForObject(e),d=this.helper.temporalToCalendarDate(e,c),f=this.helper.addCalendar(d,{years:r,months:n,weeks:i,days:o},s,c),u=this.helper.calendarToIsoDate(f,"constrain",c),{year:m,month:_,day:v}=u,A=fs(m,_,v,a);return new lr(c).setObject(A),A}dateUntil(e,r,n){let i=lr.getCacheForObject(e),o=lr.getCacheForObject(r),s=this.helper.temporalToCalendarDate(e,i),a=this.helper.temporalToCalendarDate(r,o);return this.helper.untilCalendar(s,a,n,i)}year(e){let r=lr.getCacheForObject(e);return this.helper.temporalToCalendarDate(e,r).year}month(e){let r=lr.getCacheForObject(e);return this.helper.temporalToCalendarDate(e,r).month}day(e){let r=lr.getCacheForObject(e);return this.helper.temporalToCalendarDate(e,r).day}era(e){if(!this.helper.hasEra)return;let r=lr.getCacheForObject(e);return this.helper.temporalToCalendarDate(e,r).era}eraYear(e){if(!this.helper.hasEra)return;let r=lr.getCacheForObject(e);return this.helper.temporalToCalendarDate(e,r).eraYear}monthCode(e){let r=lr.getCacheForObject(e);return this.helper.temporalToCalendarDate(e,r).monthCode}dayOfWeek(e){return Er.iso8601.dayOfWeek(e)}dayOfYear(e){let r=lr.getCacheForObject(e),n=this.helper.isoToCalendarDate(e,r),i=this.helper.startOfCalendarYear(n);return this.helper.calendarDaysUntil(i,n,r)+1}weekOfYear(e){return Er.iso8601.weekOfYear(e)}yearOfWeek(e){return Er.iso8601.yearOfWeek(e)}daysInWeek(e){return Er.iso8601.daysInWeek(e)}daysInMonth(e){let r=lr.getCacheForObject(e),n=this.helper.temporalToCalendarDate(e,r),i=this.helper.maximumMonthLength(n);if(i===this.helper.minimumMonthLength(n))return i;let o=this.helper.startOfCalendarMonth(n),s=this.helper.addMonthsCalendar(o,1,"constrain",r);return this.helper.calendarDaysUntil(o,s,r)}daysInYear(e){let r=e;_n(r,de)||(r=er(r));let n=lr.getCacheForObject(r),i=this.helper.temporalToCalendarDate(r,n),o=this.helper.startOfCalendarYear(i),s=this.helper.addCalendar(o,{years:1},"constrain",n);return this.helper.calendarDaysUntil(o,s,n)}monthsInYear(e){let r=lr.getCacheForObject(e),n=this.helper.temporalToCalendarDate(e,r);return this.helper.monthsInYear(n,r)}inLeapYear(e){let r=e;_n(r,de)||(r=er(r));let n=lr.getCacheForObject(r),i=this.helper.temporalToCalendarDate(r,n);return this.helper.inLeapYear(i,n)}};for(let t of[P9,D9,N9,O9,j9,z9,$9,q9,C9,L9,U9,F9,_x,I9,R9,M9,k9,B9]){let e=new t;Er[e.id]=new G9(e)}var Xh=class{constructor(e,r,n,i="iso8601"){kY(this,Ut(e),Ut(r),Ut(n),yo(i))}get calendarId(){if(!rt(this))throw new TypeError("invalid receiver");return Fn(S(this,X))}get era(){if(!rt(this))throw new TypeError("invalid receiver");return Ix(S(this,X),this)}get eraYear(){if(!rt(this))throw new TypeError("invalid receiver");return Rx(S(this,X),this)}get year(){if(!rt(this))throw new TypeError("invalid receiver");return Tx(S(this,X),this)}get month(){if(!rt(this))throw new TypeError("invalid receiver");return Px(S(this,X),this)}get monthCode(){if(!rt(this))throw new TypeError("invalid receiver");return Lv(S(this,X),this)}get day(){if(!rt(this))throw new TypeError("invalid receiver");return Uv(S(this,X),this)}get dayOfWeek(){if(!rt(this))throw new TypeError("invalid receiver");return Y9(S(this,X),this)}get dayOfYear(){if(!rt(this))throw new TypeError("invalid receiver");return J9(S(this,X),this)}get weekOfYear(){if(!rt(this))throw new TypeError("invalid receiver");return X9(S(this,X),this)}get yearOfWeek(){if(!rt(this))throw new TypeError("invalid receiver");return Q9(S(this,X),this)}get daysInWeek(){if(!rt(this))throw new TypeError("invalid receiver");return e7(S(this,X),this)}get daysInMonth(){if(!rt(this))throw new TypeError("invalid receiver");return Mx(S(this,X),this)}get daysInYear(){if(!rt(this))throw new TypeError("invalid receiver");return kx(S(this,X),this)}get monthsInYear(){if(!rt(this))throw new TypeError("invalid receiver");return Bx(S(this,X),this)}get inLeapYear(){if(!rt(this))throw new TypeError("invalid receiver");return Dx(S(this,X),this)}with(e,r){if(!rt(this))throw new TypeError("invalid receiver");if(!pr(e))throw new TypeError("invalid argument");$m(e);let n=ot(r),i=S(this,X),o=nn(i,["day","month","monthCode","year"]),s=Ye(this,o,[]);return s=Kh(i,s,Ye(e,o,"partial")),s=Ye(s,o,[]),Xd(i,s,n)}withCalendar(e){if(!rt(this))throw new TypeError("invalid receiver");let r=yo(e);return new Xh(S(this,de),S(this,fe),S(this,he),r)}add(e,r){if(!rt(this))throw new TypeError("invalid receiver");let n=Im(e),i=ot(r);return Ln(S(this,X),this,n,i)}subtract(e,r){if(!rt(this))throw new TypeError("invalid receiver");let n=WY(Im(e)),i=ot(r);return Ln(S(this,X),this,n,i)}until(e,r){if(!rt(this))throw new TypeError("invalid receiver");return eY("until",this,e,r)}since(e,r){if(!rt(this))throw new TypeError("invalid receiver");return eY("since",this,e,r)}equals(e){if(!rt(this))throw new TypeError("invalid receiver");let r=er(e);for(let n of[de,fe,he])if(S(this,n)!==S(r,n))return!1;return zv(S(this,X),S(r,X))}toString(e){if(!rt(this))throw new TypeError("invalid receiver");return HZ(this,Ov(ot(e)))}toJSON(){if(!rt(this))throw new TypeError("invalid receiver");return HZ(this)}toLocaleString(e,r){if(!rt(this))throw new TypeError("invalid receiver");return new rf(e,r).format(this)}valueOf(){throw new TypeError("use compare() or equals() to compare Temporal.PlainDate")}toPlainDateTime(e){if(!rt(this))throw new TypeError("invalid receiver");let r=S(this,de),n=S(this,fe),i=S(this,he),o=S(this,X);if(e===void 0)return lo(r,n,i,0,0,0,0,0,0,o);let s=Vd(e);return lo(r,n,i,S(s,Le),S(s,Ue),S(s,Fe),S(s,ze),S(s,$e),S(s,Ge),o)}toZonedDateTime(e){if(!rt(this))throw new TypeError("invalid receiver");let r,n;if(pr(e))if(os(e))r=e;else{let v=e.timeZone;v===void 0?r=ni(e):(r=ni(v),n=e.plainTime)}else r=ni(e);let i=S(this,de),o=S(this,fe),s=S(this,he),a=S(this,X),c=0,d=0,f=0,u=0,m=0,_=0;return n!==void 0&&(n=Vd(n),c=S(n,Le),d=S(n,Ue),f=S(n,Fe),u=S(n,ze),m=S(n,$e),_=S(n,Ge)),qn(S(Ri(r,lo(i,o,s,c,d,f,u,m,_,a),"compatible"),Ae),r,a)}toPlainYearMonth(){if(!rt(this))throw new TypeError("invalid receiver");let e=S(this,X);return Zh(e,Ye(this,nn(e,["monthCode","year"]),[]))}toPlainMonthDay(){if(!rt(this))throw new TypeError("invalid receiver");let e=S(this,X);return Nm(e,Ye(this,nn(e,["day","monthCode"]),[]))}getISOFields(){if(!rt(this))throw new TypeError("invalid receiver");return{calendar:S(this,X),isoDay:S(this,he),isoMonth:S(this,fe),isoYear:S(this,de)}}getCalendar(){if(!rt(this))throw new TypeError("invalid receiver");return Wm(S(this,X))}static from(e,r){let n=ot(r);return rt(e)?(Jr(n),fs(S(e,de),S(e,fe),S(e,he),S(e,X))):er(e,n)}static compare(e,r){let n=er(e),i=er(r);return mu(S(n,de),S(n,fe),S(n,he),S(i,de),S(i,fe),S(i,he))}};zc(Xh,"Temporal.PlainDate");var Qh=class{constructor(e,r,n,i=0,o=0,s=0,a=0,c=0,d=0,f="iso8601"){BY(this,Ut(e),Ut(r),Ut(n),i===void 0?0:Ut(i),o===void 0?0:Ut(o),s===void 0?0:Ut(s),a===void 0?0:Ut(a),c===void 0?0:Ut(c),d===void 0?0:Ut(d),yo(f))}get calendarId(){if(!je(this))throw new TypeError("invalid receiver");return Fn(S(this,X))}get year(){if(!je(this))throw new TypeError("invalid receiver");return Tx(S(this,X),this)}get month(){if(!je(this))throw new TypeError("invalid receiver");return Px(S(this,X),this)}get monthCode(){if(!je(this))throw new TypeError("invalid receiver");return Lv(S(this,X),this)}get day(){if(!je(this))throw new TypeError("invalid receiver");return Uv(S(this,X),this)}get hour(){if(!je(this))throw new TypeError("invalid receiver");return S(this,Le)}get minute(){if(!je(this))throw new TypeError("invalid receiver");return S(this,Ue)}get second(){if(!je(this))throw new TypeError("invalid receiver");return S(this,Fe)}get millisecond(){if(!je(this))throw new TypeError("invalid receiver");return S(this,ze)}get microsecond(){if(!je(this))throw new TypeError("invalid receiver");return S(this,$e)}get nanosecond(){if(!je(this))throw new TypeError("invalid receiver");return S(this,Ge)}get era(){if(!je(this))throw new TypeError("invalid receiver");return Ix(S(this,X),this)}get eraYear(){if(!je(this))throw new TypeError("invalid receiver");return Rx(S(this,X),this)}get dayOfWeek(){if(!je(this))throw new TypeError("invalid receiver");return Y9(S(this,X),this)}get dayOfYear(){if(!je(this))throw new TypeError("invalid receiver");return J9(S(this,X),this)}get weekOfYear(){if(!je(this))throw new TypeError("invalid receiver");return X9(S(this,X),this)}get yearOfWeek(){if(!je(this))throw new TypeError("invalid receiver");return Q9(S(this,X),this)}get daysInWeek(){if(!je(this))throw new TypeError("invalid receiver");return e7(S(this,X),this)}get daysInYear(){if(!je(this))throw new TypeError("invalid receiver");return kx(S(this,X),this)}get daysInMonth(){if(!je(this))throw new TypeError("invalid receiver");return Mx(S(this,X),this)}get monthsInYear(){if(!je(this))throw new TypeError("invalid receiver");return Bx(S(this,X),this)}get inLeapYear(){if(!je(this))throw new TypeError("invalid receiver");return Dx(S(this,X),this)}with(e,r){if(!je(this))throw new TypeError("invalid receiver");if(!pr(e))throw new TypeError("invalid argument");$m(e);let n=ot(r),i=S(this,X),o=nn(i,["day","hour","microsecond","millisecond","minute","month","monthCode","nanosecond","second","year"]),s=Ye(this,o,[]);s=Kh(i,s,Ye(e,o,"partial")),s=Ye(s,o,[]);let{year:a,month:c,day:d,hour:f,minute:u,second:m,millisecond:_,microsecond:v,nanosecond:A}=qv(i,s,n);return lo(a,c,d,f,u,m,_,v,A,i)}withPlainTime(e){if(!je(this))throw new TypeError("invalid receiver");let r=S(this,de),n=S(this,fe),i=S(this,he),o=S(this,X);if(e===void 0)return lo(r,n,i,0,0,0,0,0,0,o);let s=Vd(e);return lo(r,n,i,S(s,Le),S(s,Ue),S(s,Fe),S(s,ze),S(s,$e),S(s,Ge),o)}withPlainDate(e){if(!je(this))throw new TypeError("invalid receiver");let r=er(e),n=S(r,de),i=S(r,fe),o=S(r,he),s=S(r,X),a=S(this,Le),c=S(this,Ue),d=S(this,Fe),f=S(this,ze),u=S(this,$e),m=S(this,Ge);return s=jY(S(this,X),s),lo(n,i,o,a,c,d,f,u,m,s)}withCalendar(e){if(!je(this))throw new TypeError("invalid receiver");let r=yo(e);return new Qh(S(this,de),S(this,fe),S(this,he),S(this,Le),S(this,Ue),S(this,Fe),S(this,ze),S(this,$e),S(this,Ge),r)}add(e,r){if(!je(this))throw new TypeError("invalid receiver");return aY("add",this,e,r)}subtract(e,r){if(!je(this))throw new TypeError("invalid receiver");return aY("subtract",this,e,r)}until(e,r){if(!je(this))throw new TypeError("invalid receiver");return tY("until",this,e,r)}since(e,r){if(!je(this))throw new TypeError("invalid receiver");return tY("since",this,e,r)}round(e){if(!je(this))throw new TypeError("invalid receiver");if(e===void 0)throw new TypeError("options parameter is required");let r=typeof e=="string"?Um("smallestUnit",e):ot(e),n=Gm(r),i=Ma(r,"halfExpand"),o=mo(r,"smallestUnit","time",Wh,["day"]),s={day:1,hour:24,minute:60,second:60,millisecond:1e3,microsecond:1e3,nanosecond:1e3}[o];Hm(n,s,s===1);let a=S(this,de),c=S(this,fe),d=S(this,he),f=S(this,Le),u=S(this,Ue),m=S(this,Fe),_=S(this,ze),v=S(this,$e),A=S(this,Ge);return{year:a,month:c,day:d,hour:f,minute:u,second:m,millisecond:_,microsecond:v,nanosecond:A}=d7(a,c,d,f,u,m,_,v,A,n,o,i),lo(a,c,d,f,u,m,_,v,A,S(this,X))}equals(e){if(!je(this))throw new TypeError("invalid receiver");let r=zh(e);for(let n of[de,fe,he,Le,Ue,Fe,ze,$e,Ge])if(S(this,n)!==S(r,n))return!1;return zv(S(this,X),S(r,X))}toString(e){if(!je(this))throw new TypeError("invalid receiver");let r=ot(e),n=Ov(r),i=jv(r),o=Ma(r,"trunc"),s=mo(r,"smallestUnit","time",void 0);if(s==="hour")throw new RangeError('smallestUnit must be a time unit other than "hour"');let{precision:a,unit:c,increment:d}=Nv(s,i);return WZ(this,a,n,{unit:c,increment:d,roundingMode:o})}toJSON(){if(!je(this))throw new TypeError("invalid receiver");return WZ(this,"auto")}toLocaleString(e,r){if(!je(this))throw new TypeError("invalid receiver");return new rf(e,r).format(this)}valueOf(){throw new TypeError("use compare() or equals() to compare Temporal.PlainDateTime")}toZonedDateTime(e,r){if(!je(this))throw new TypeError("invalid receiver");let n=ni(e);return qn(S(Ri(n,this,jm(ot(r))),Ae),n,S(this,X))}toPlainDate(){if(!je(this))throw new TypeError("invalid receiver");return qm(this)}toPlainYearMonth(){if(!je(this))throw new TypeError("invalid receiver");let e=S(this,X);return Zh(e,Ye(this,nn(e,["monthCode","year"]),[]))}toPlainMonthDay(){if(!je(this))throw new TypeError("invalid receiver");let e=S(this,X);return Nm(e,Ye(this,nn(e,["day","monthCode"]),[]))}toPlainTime(){if(!je(this))throw new TypeError("invalid receiver");return t7(this)}getISOFields(){if(!je(this))throw new TypeError("invalid receiver");return{calendar:S(this,X),isoDay:S(this,he),isoHour:S(this,Le),isoMicrosecond:S(this,$e),isoMillisecond:S(this,ze),isoMinute:S(this,Ue),isoMonth:S(this,fe),isoNanosecond:S(this,Ge),isoSecond:S(this,Fe),isoYear:S(this,de)}}getCalendar(){if(!je(this))throw new TypeError("invalid receiver");return Wm(S(this,X))}static from(e,r){let n=ot(r);return je(e)?(Jr(n),lo(S(e,de),S(e,fe),S(e,he),S(e,Le),S(e,Ue),S(e,Fe),S(e,ze),S(e,$e),S(e,Ge),S(e,X))):zh(e,n)}static compare(e,r){let n=zh(e),i=zh(r);for(let o of[de,fe,he,Le,Ue,Fe,ze,$e,Ge]){let s=S(n,o),a=S(i,o);if(s!==a)return Gh(s-a)}return 0}};zc(Qh,"Temporal.PlainDateTime");var Oc=class{constructor(e=0,r=0,n=0,i=0,o=0,s=0,a=0,c=0,d=0,f=0){let u=e===void 0?0:wn(e),m=r===void 0?0:wn(r),_=n===void 0?0:wn(n),v=i===void 0?0:wn(i),A=o===void 0?0:wn(o),T=s===void 0?0:wn(s),M=a===void 0?0:wn(a),D=c===void 0?0:wn(c),O=d===void 0?0:wn(d),U=f===void 0?0:wn(f);bx(u,m,_,v,A,T,M,D,O,U),$c(this),Ve(this,wi,u),Ve(this,Bn,m),Ve(this,Vi,_),Ve(this,_i,v),Ve(this,xi,A),Ve(this,Ei,T),Ve(this,Si,M),Ve(this,Ai,D),Ve(this,Ti,O),Ve(this,Pi,U)}get years(){if(!Dr(this))throw new TypeError("invalid receiver");return S(this,wi)}get months(){if(!Dr(this))throw new TypeError("invalid receiver");return S(this,Bn)}get weeks(){if(!Dr(this))throw new TypeError("invalid receiver");return S(this,Vi)}get days(){if(!Dr(this))throw new TypeError("invalid receiver");return S(this,_i)}get hours(){if(!Dr(this))throw new TypeError("invalid receiver");return S(this,xi)}get minutes(){if(!Dr(this))throw new TypeError("invalid receiver");return S(this,Ei)}get seconds(){if(!Dr(this))throw new TypeError("invalid receiver");return S(this,Si)}get milliseconds(){if(!Dr(this))throw new TypeError("invalid receiver");return S(this,Ai)}get microseconds(){if(!Dr(this))throw new TypeError("invalid receiver");return S(this,Ti)}get nanoseconds(){if(!Dr(this))throw new TypeError("invalid receiver");return S(this,Pi)}get sign(){if(!Dr(this))throw new TypeError("invalid receiver");return qc(S(this,wi),S(this,Bn),S(this,Vi),S(this,_i),S(this,xi),S(this,Ei),S(this,Si),S(this,Ai),S(this,Ti),S(this,Pi))}get blank(){if(!Dr(this))throw new TypeError("invalid receiver");return qc(S(this,wi),S(this,Bn),S(this,Vi),S(this,_i),S(this,xi),S(this,Ei),S(this,Si),S(this,Ai),S(this,Ti),S(this,Pi))===0}with(e){if(!Dr(this))throw new TypeError("invalid receiver");let r=Ye(e,["days","hours","microseconds","milliseconds","minutes","months","nanoseconds","seconds","weeks","years"],"partial"),{years:n=S(this,wi),months:i=S(this,Bn),weeks:o=S(this,Vi),days:s=S(this,_i),hours:a=S(this,xi),minutes:c=S(this,Ei),seconds:d=S(this,Si),milliseconds:f=S(this,Ai),microseconds:u=S(this,Ti),nanoseconds:m=S(this,Pi)}=r;return new Oc(n,i,o,s,a,c,d,f,u,m)}negated(){if(!Dr(this))throw new TypeError("invalid receiver");return WY(this)}abs(){if(!Dr(this))throw new TypeError("invalid receiver");return new Oc(Math.abs(S(this,wi)),Math.abs(S(this,Bn)),Math.abs(S(this,Vi)),Math.abs(S(this,_i)),Math.abs(S(this,xi)),Math.abs(S(this,Ei)),Math.abs(S(this,Si)),Math.abs(S(this,Ai)),Math.abs(S(this,Ti)),Math.abs(S(this,Pi)))}add(e,r){if(!Dr(this))throw new TypeError("invalid receiver");return oY("add",this,e,r)}subtract(e,r){if(!Dr(this))throw new TypeError("invalid receiver");return oY("subtract",this,e,r)}round(e){if(!Dr(this))throw new TypeError("invalid receiver");if(e===void 0)throw new TypeError("options parameter is required");let r=S(this,wi),n=S(this,Bn),i=S(this,Vi),o=S(this,_i),s=S(this,xi),a=S(this,Ei),c=S(this,Si),d=S(this,Ai),f=S(this,Ti),u=S(this,Pi),m=v9(r,n,i,o,s,a,c,d,f,u),_=typeof e=="string"?Um("smallestUnit",e):ot(e),v=mo(_,"largestUnit","datetime",void 0,["auto"]),A=nx(_),T=Gm(_),M=Ma(_,"halfExpand"),D=mo(_,"smallestUnit","datetime",void 0),O=!0;D||(O=!1,D="nanosecond"),m=Vh(m,D);let U=!0;if(v||(U=!1,v=m),v==="auto"&&(v=m),!O&&!U)throw new RangeError("at least one of smallestUnit or largestUnit is required");if(Vh(v,D)!==v)throw new RangeError(`largestUnit ${v} cannot be smaller than smallestUnit ${D}`);let L={hour:24,minute:60,second:60,millisecond:1e3,microsecond:1e3,nanosecond:1e3}[D];return L!==void 0&&Hm(T,L,!1),{years:r,months:n,weeks:i,days:o}=rx(r,n,i,o,v,A),{years:r,months:n,weeks:i,days:o,hours:s,minutes:a,seconds:c,milliseconds:d,microseconds:f,nanoseconds:u}=Qd(r,n,i,o,s,a,c,d,f,u,T,D,M,A),{years:r,months:n,weeks:i,days:o,hours:s,minutes:a,seconds:c,milliseconds:d,microseconds:f,nanoseconds:u}=tJ(r,n,i,o,s,a,c,d,f,u,T,D,M,A),{days:o,hours:s,minutes:a,seconds:c,milliseconds:d,microseconds:f,nanoseconds:u}=Vs(o,s,a,c,d,f,u,v,A),{years:r,months:n,weeks:i,days:o}=function($,H,z,j,y,P){let x=se("%Temporal.Duration%"),l=qc($,H,z,j,0,0,0,0,0,0);if(l===0)return{years:$,months:H,weeks:z,days:j};let b=N.default.BigInt(l),h,w,E=N.default.BigInt($),g=N.default.BigInt(H),I=N.default.BigInt(z),B=N.default.BigInt(j);P&&(w=er(P),h=S(w,X));let R=new x(l),q=new x(0,l),V=new x(0,0,l);switch(y){case"year":{if(!h)throw new RangeError("a starting point is required for years balancing");let W=typeof h!="string"?Zt(h,"dateAdd"):void 0,K,Y,J;for({relativeTo:K,days:Y}=ti(h,w,R,W);N.default.greaterThanOrEqual(Ia(B),N.default.BigInt(hr(Y)));)B=N.default.subtract(B,N.default.BigInt(Y)),E=N.default.add(E,b),w=K,{relativeTo:K,days:Y}=ti(h,w,R,W);for({relativeTo:K,days:J}=ti(h,w,q,W);N.default.greaterThanOrEqual(Ia(B),N.default.BigInt(hr(J)));)B=N.default.subtract(B,N.default.BigInt(J)),g=N.default.add(g,b),w=K,{relativeTo:K,days:J}=ti(h,w,q,W);K=Ln(h,w,R,void 0,W);let Z=typeof h!="string"?Zt(h,"dateUntil"):void 0,ce=ii(null);ce.largestUnit="month";let oe=yu(h,w,K,ce,Z),ae=S(oe,Bn);for(;N.default.greaterThanOrEqual(Ia(g),N.default.BigInt(hr(ae)));){g=N.default.subtract(g,N.default.BigInt(ae)),E=N.default.add(E,b),w=K,K=Ln(h,w,R,void 0,W);let He=ii(null);He.largestUnit="month",oe=yu(h,w,K,He,Z),ae=S(oe,Bn)}break}case"month":{if(!h)throw new RangeError("a starting point is required for months balancing");let W=typeof h!="string"?Zt(h,"dateAdd"):void 0,K,Y;for({relativeTo:K,days:Y}=ti(h,w,q,W);N.default.greaterThanOrEqual(Ia(B),N.default.BigInt(hr(Y)));)B=N.default.subtract(B,N.default.BigInt(Y)),g=N.default.add(g,b),w=K,{relativeTo:K,days:Y}=ti(h,w,q,W);break}case"week":{if(!h)throw new RangeError("a starting point is required for weeks balancing");let W=typeof h!="string"?Zt(h,"dateAdd"):void 0,K,Y;for({relativeTo:K,days:Y}=ti(h,w,V,W);N.default.greaterThanOrEqual(Ia(B),N.default.BigInt(hr(Y)));)B=N.default.subtract(B,N.default.BigInt(Y)),I=N.default.add(I,b),w=K,{relativeTo:K,days:Y}=ti(h,w,V,W);break}}return{years:N.default.toNumber(E),months:N.default.toNumber(g),weeks:N.default.toNumber(I),days:N.default.toNumber(B)}}(r,n,i,o,v,A),new Oc(r,n,i,o,s,a,c,d,f,u)}total(e){if(!Dr(this))throw new TypeError("invalid receiver");let r=S(this,wi),n=S(this,Bn),i=S(this,Vi),o=S(this,_i),s=S(this,xi),a=S(this,Ei),c=S(this,Si),d=S(this,Ai),f=S(this,Ti),u=S(this,Pi);if(e===void 0)throw new TypeError("options argument is required");let m=typeof e=="string"?Um("unit",e):ot(e),_=nx(m),v=mo(m,"unit","datetime",Wh),A;({years:r,months:n,weeks:i,days:o}=rx(r,n,i,o,v,_)),ge(_)&&(A=eJ(_,r,n,i,0));let T=HY(o,s,a,c,d,f,u,v,A);if(T==="positive overflow")return 1/0;if(T==="negative overflow")return-1/0;({days:o,hours:s,minutes:a,seconds:c,milliseconds:d,microseconds:f,nanoseconds:u}=T);let{total:M}=Qd(r,n,i,o,s,a,c,d,f,u,1,v,"trunc",_);return M}toString(e){if(!Dr(this))throw new TypeError("invalid receiver");let r=ot(e),n=jv(r),i=Ma(r,"trunc"),o=mo(r,"smallestUnit","time",void 0);if(o==="hour"||o==="minute")throw new RangeError('smallestUnit must be a time unit other than "hours" or "minutes"');let{precision:s,unit:a,increment:c}=Nv(o,n);return f9(this,s,{unit:a,increment:c,roundingMode:i})}toJSON(){if(!Dr(this))throw new TypeError("invalid receiver");return f9(this)}toLocaleString(e,r){if(!Dr(this))throw new TypeError("invalid receiver");return typeof Intl<"u"&&Intl.DurationFormat!==void 0?new Intl.DurationFormat(e,r).format(this):(console.warn("Temporal.Duration.prototype.toLocaleString() requires Intl.DurationFormat."),f9(this))}valueOf(){throw new TypeError("use compare() to compare Temporal.Duration")}static from(e){return Dr(e)?new Oc(S(e,wi),S(e,Bn),S(e,Vi),S(e,_i),S(e,xi),S(e,Ei),S(e,Si),S(e,Ai),S(e,Ti),S(e,Pi)):Im(e)}static compare(e,r,n){let i=Im(e),o=Im(r),s=nx(ot(n)),a=S(i,wi),c=S(i,Bn),d=S(i,Vi),f=S(i,_i),u=S(i,xi),m=S(i,Ei),_=S(i,Si),v=S(i,Ai),A=S(i,Ti),T=S(i,Pi),M=S(o,wi),D=S(o,Bn),O=S(o,Vi),U=S(o,_i),L=S(o,xi),F=S(o,Ei),$=S(o,Si),H=S(o,Ai),z=S(o,Ti),j=S(o,Pi),y=XZ(s,a,c,d,f),P=XZ(s,M,D,O,U);a===0&&M===0&&c===0&&D===0&&d===0&&O===0||({days:f}=rx(a,c,d,f,"day",s),{days:U}=rx(M,D,O,U,"day",s));let x=Lm(f,u,m,_,v,A,T,y),l=Lm(U,L,F,$,H,z,j,P);return Gh(N.default.toNumber(N.default.subtract(x,l)))}};zc(Oc,"Temporal.Duration");var y4e=Object.create,Rv=class{constructor(e,r,n="iso8601",i=1972){DY(this,Ut(e),Ut(r),yo(n),Ut(i))}get monthCode(){if(!vn(this))throw new TypeError("invalid receiver");return Lv(S(this,X),this)}get day(){if(!vn(this))throw new TypeError("invalid receiver");return Uv(S(this,X),this)}get calendarId(){if(!vn(this))throw new TypeError("invalid receiver");return Fn(S(this,X))}with(e,r){if(!vn(this))throw new TypeError("invalid receiver");if(!pr(e))throw new TypeError("invalid argument");$m(e);let n=ot(r),i=S(this,X),o=nn(i,["day","month","monthCode","year"]),s=Ye(this,o,[]);return s=Kh(i,s,Ye(e,o,"partial")),s=Ye(s,o,[]),Nm(i,s,n)}equals(e){if(!vn(this))throw new TypeError("invalid receiver");let r=$Z(e);for(let n of[fe,he,de])if(S(this,n)!==S(r,n))return!1;return zv(S(this,X),S(r,X))}toString(e){if(!vn(this))throw new TypeError("invalid receiver");return VZ(this,Ov(ot(e)))}toJSON(){if(!vn(this))throw new TypeError("invalid receiver");return VZ(this)}toLocaleString(e,r){if(!vn(this))throw new TypeError("invalid receiver");return new rf(e,r).format(this)}valueOf(){throw new TypeError("use equals() to compare Temporal.PlainMonthDay")}toPlainDate(e){if(!vn(this))throw new TypeError("invalid receiver");if(!pr(e))throw new TypeError("argument should be an object");let r=S(this,X),n=nn(r,["day","monthCode"]),i=Ye(this,n,[]),o=nn(r,["year"]),s=Kh(r,i,Ye(e,o,[]));s=Ye(s,[...new Set([...n,...o])],[]);let a=y4e(null);return a.overflow="reject",Xd(r,s,a)}getISOFields(){if(!vn(this))throw new TypeError("invalid receiver");return{calendar:S(this,X),isoDay:S(this,he),isoMonth:S(this,fe),isoYear:S(this,de)}}getCalendar(){if(!vn(this))throw new TypeError("invalid receiver");return Wm(S(this,X))}static from(e,r){let n=ot(r);return vn(e)?(Jr(n),Av(S(e,fe),S(e,he),S(e,X),S(e,de))):$Z(e,n)}};zc(Rv,"Temporal.PlainMonthDay");var m7=()=>new(se("%Temporal.Instant%"))(u7()),lY=(t,e=pu())=>{let r=ni(e),n=yo(t);return Oo(r,m7(),n)},p9=(t=pu())=>Oo(ni(t),m7(),"iso8601"),hY=(t,e=pu())=>{let r=ni(e),n=yo(t);return qn(u7(),r,n)},bJ={instant:m7,plainDateTime:lY,plainDateTimeISO:p9,plainDate:(t,e=pu())=>qm(lY(t,e)),plainDateISO:(t=pu())=>qm(p9(t)),plainTimeISO:(t=pu())=>t7(p9(t)),timeZoneId:()=>pu(),zonedDateTime:hY,zonedDateTimeISO:(t=pu())=>hY("iso8601",t),[Symbol.toStringTag]:"Temporal.Now"};Object.defineProperty(bJ,Symbol.toStringTag,{value:"Temporal.Now",writable:!1,enumerable:!1,configurable:!0});var g4e=Object.assign;function pY(t,e,r){let n=S(t,Le),i=S(t,Ue),o=S(t,Fe),s=S(t,ze),a=S(t,$e),c=S(t,Ge);if(r){let{unit:d,increment:f,roundingMode:u}=r;({hour:n,minute:i,second:o,millisecond:s,microsecond:a,nanosecond:c}=f7(n,i,o,s,a,c,f,d,u))}return`${Sr(n)}:${Sr(i)}${Ox(o,s,a,c,e)}`}var Jd=class{constructor(e=0,r=0,n=0,i=0,o=0,s=0){let a=e===void 0?0:Ut(e),c=r===void 0?0:Ut(r),d=n===void 0?0:Ut(n),f=i===void 0?0:Ut(i),u=o===void 0?0:Ut(o),m=s===void 0?0:Ut(s);qx(a,c,d,f,u,m),$c(this),Ve(this,Le,a),Ve(this,Ue,c),Ve(this,Fe,d),Ve(this,ze,f),Ve(this,$e,u),Ve(this,Ge,m)}get hour(){if(!Cr(this))throw new TypeError("invalid receiver");return S(this,Le)}get minute(){if(!Cr(this))throw new TypeError("invalid receiver");return S(this,Ue)}get second(){if(!Cr(this))throw new TypeError("invalid receiver");return S(this,Fe)}get millisecond(){if(!Cr(this))throw new TypeError("invalid receiver");return S(this,ze)}get microsecond(){if(!Cr(this))throw new TypeError("invalid receiver");return S(this,$e)}get nanosecond(){if(!Cr(this))throw new TypeError("invalid receiver");return S(this,Ge)}with(e,r){if(!Cr(this))throw new TypeError("invalid receiver");if(!pr(e))throw new TypeError("invalid argument");$m(e);let n=Jr(ot(r)),i=px(e,"partial"),o=px(this),{hour:s,minute:a,second:c,millisecond:d,microsecond:f,nanosecond:u}=g4e(o,i);return{hour:s,minute:a,second:c,millisecond:d,microsecond:f,nanosecond:u}=Ax(s,a,c,d,f,u,n),new Jd(s,a,c,d,f,u)}add(e){if(!Cr(this))throw new TypeError("invalid receiver");return cY("add",this,e)}subtract(e){if(!Cr(this))throw new TypeError("invalid receiver");return cY("subtract",this,e)}until(e,r){if(!Cr(this))throw new TypeError("invalid receiver");return rY("until",this,e,r)}since(e,r){if(!Cr(this))throw new TypeError("invalid receiver");return rY("since",this,e,r)}round(e){if(!Cr(this))throw new TypeError("invalid receiver");if(e===void 0)throw new TypeError("options parameter is required");let r=typeof e=="string"?Um("smallestUnit",e):ot(e),n=Gm(r),i=Ma(r,"halfExpand"),o=mo(r,"smallestUnit","time",Wh);Hm(n,{hour:24,minute:60,second:60,millisecond:1e3,microsecond:1e3,nanosecond:1e3}[o],!1);let s=S(this,Le),a=S(this,Ue),c=S(this,Fe),d=S(this,ze),f=S(this,$e),u=S(this,Ge);return{hour:s,minute:a,second:c,millisecond:d,microsecond:f,nanosecond:u}=f7(s,a,c,d,f,u,n,o,i),new Jd(s,a,c,d,f,u)}equals(e){if(!Cr(this))throw new TypeError("invalid receiver");let r=Vd(e);for(let n of[Le,Ue,Fe,ze,$e,Ge])if(S(this,n)!==S(r,n))return!1;return!0}toString(e){if(!Cr(this))throw new TypeError("invalid receiver");let r=ot(e),n=jv(r),i=Ma(r,"trunc"),o=mo(r,"smallestUnit","time",void 0);if(o==="hour")throw new RangeError('smallestUnit must be a time unit other than "hour"');let{precision:s,unit:a,increment:c}=Nv(o,n);return pY(this,s,{unit:a,increment:c,roundingMode:i})}toJSON(){if(!Cr(this))throw new TypeError("invalid receiver");return pY(this,"auto")}toLocaleString(e,r){if(!Cr(this))throw new TypeError("invalid receiver");return new rf(e,r).format(this)}valueOf(){throw new TypeError("use compare() or equals() to compare Temporal.PlainTime")}toPlainDateTime(e){if(!Cr(this))throw new TypeError("invalid receiver");let r=er(e),n=S(r,de),i=S(r,fe),o=S(r,he),s=S(r,X);return lo(n,i,o,S(this,Le),S(this,Ue),S(this,Fe),S(this,ze),S(this,$e),S(this,Ge),s)}toZonedDateTime(e){if(!Cr(this))throw new TypeError("invalid receiver");if(!pr(e))throw new TypeError("invalid argument");let r=e.plainDate;if(r===void 0)throw new TypeError("missing date property");let n=er(r),i=e.timeZone;if(i===void 0)throw new TypeError("missing timeZone property");let o=ni(i),s=S(n,de),a=S(n,fe),c=S(n,he),d=S(n,X),f=S(this,Le),u=S(this,Ue),m=S(this,Fe),_=S(this,ze),v=S(this,$e),A=S(this,Ge);return qn(S(Ri(o,new(se("%Temporal.PlainDateTime%"))(s,a,c,f,u,m,_,v,A,d),"compatible"),Ae),o,d)}getISOFields(){if(!Cr(this))throw new TypeError("invalid receiver");return{isoHour:S(this,Le),isoMicrosecond:S(this,$e),isoMillisecond:S(this,ze),isoMinute:S(this,Ue),isoNanosecond:S(this,Ge),isoSecond:S(this,Fe)}}static from(e,r){let n=Jr(ot(r));return Cr(e)?new Jd(S(e,Le),S(e,Ue),S(e,Fe),S(e,ze),S(e,$e),S(e,Ge)):Vd(e,n)}static compare(e,r){let n=Vd(e),i=Vd(r);for(let o of[Le,Ue,Fe,ze,$e,Ge]){let s=S(n,o),a=S(i,o);if(s!==a)return Gh(s-a)}return 0}};zc(Jd,"Temporal.PlainTime");var Hh=class{constructor(e){if(arguments.length<1)throw new RangeError("missing argument: identifier is required");let r=r7(e);$c(this),Ve(this,Cc,r)}get id(){if(!os(this))throw new TypeError("invalid receiver");return S(this,Cc)}getOffsetNanosecondsFor(e){if(!os(this))throw new TypeError("invalid receiver");let r=Ra(e),n=S(this,Cc);return Am(n)?gu(n):Kd(n,S(r,Ae))}getOffsetStringFor(e){if(!os(this))throw new TypeError("invalid receiver");return w9(this,Ra(e))}getPlainDateTimeFor(e,r="iso8601"){if(!os(this))throw new TypeError("invalid receiver");return Oo(this,Ra(e),yo(r))}getInstantFor(e,r){if(!os(this))throw new TypeError("invalid receiver");return Ri(this,zh(e),jm(ot(r)))}getPossibleInstantsFor(e){if(!os(this))throw new TypeError("invalid receiver");let r=zh(e),n=se("%Temporal.Instant%"),i=S(this,Cc);if(Am(i)){let s=bu(S(r,de),S(r,fe),S(r,he),S(r,Le),S(r,Ue),S(r,Fe),S(r,ze),S(r,$e),S(r,Ge));if(s===null)throw new RangeError("DateTime outside of supported range");let a=gu(i);return[new n(N.default.subtract(s,N.default.BigInt(a)))]}return function(a,c,d,f,u,m,_,v,A,T){let M=bu(c,d,f,u,m,_,v,A,T);if(M===null)throw new RangeError("DateTime outside of supported range");let D=N.default.subtract(M,Lc);N.default.lessThan(D,Sv)&&(D=M);let O=N.default.add(M,Lc);N.default.greaterThan(O,Cm)&&(O=M);let U=Kd(a,D),L=Kd(a,O);return(U===L?[U]:[U,L]).map(F=>{let $=N.default.subtract(M,N.default.BigInt(F)),H=zY(a,$);if(c===H.year&&d===H.month&&f===H.day&&u===H.hour&&m===H.minute&&_===H.second&&v===H.millisecond&&A===H.microsecond&&T===H.nanosecond)return $}).filter(F=>F!==void 0)}(i,S(r,de),S(r,fe),S(r,he),S(r,Le),S(r,Ue),S(r,Fe),S(r,ze),S(r,$e),S(r,Ge)).map(s=>new n(s))}getNextTransition(e){if(!os(this))throw new TypeError("invalid receiver");let r=Ra(e),n=S(this,Cc);if(Am(n)||n==="UTC")return null;let i=S(r,Ae),o=se("%Temporal.Instant%");return i=GY(n,i),i===null?null:new o(i)}getPreviousTransition(e){if(!os(this))throw new TypeError("invalid receiver");let r=Ra(e),n=S(this,Cc);if(Am(n)||n==="UTC")return null;let i=S(r,Ae),o=se("%Temporal.Instant%");return i=_9(n,i),i===null?null:new o(i)}toString(){if(!os(this))throw new TypeError("invalid receiver");return S(this,Cc)}toJSON(){if(!os(this))throw new TypeError("invalid receiver");return S(this,Cc)}static from(e){return NY(ni(e))}};zc(Hh,"Temporal.TimeZone"),Ir("Temporal.TimeZone.prototype.getOffsetNanosecondsFor",Hh.prototype.getOffsetNanosecondsFor),Ir("Temporal.TimeZone.prototype.getPossibleInstantsFor",Hh.prototype.getPossibleInstantsFor);var b4e=Object.create,Mv=class{constructor(e,r,n="iso8601",i=1){CY(this,Ut(e),Ut(r),yo(n),Ut(i))}get year(){if(!Gt(this))throw new TypeError("invalid receiver");return Tx(S(this,X),this)}get month(){if(!Gt(this))throw new TypeError("invalid receiver");return Px(S(this,X),this)}get monthCode(){if(!Gt(this))throw new TypeError("invalid receiver");return Lv(S(this,X),this)}get calendarId(){if(!Gt(this))throw new TypeError("invalid receiver");return Fn(S(this,X))}get era(){if(!Gt(this))throw new TypeError("invalid receiver");return Ix(S(this,X),this)}get eraYear(){if(!Gt(this))throw new TypeError("invalid receiver");return Rx(S(this,X),this)}get daysInMonth(){if(!Gt(this))throw new TypeError("invalid receiver");return Mx(S(this,X),this)}get daysInYear(){if(!Gt(this))throw new TypeError("invalid receiver");return kx(S(this,X),this)}get monthsInYear(){if(!Gt(this))throw new TypeError("invalid receiver");return Bx(S(this,X),this)}get inLeapYear(){if(!Gt(this))throw new TypeError("invalid receiver");return Dx(S(this,X),this)}with(e,r){if(!Gt(this))throw new TypeError("invalid receiver");if(!pr(e))throw new TypeError("invalid argument");$m(e);let n=ot(r),i=S(this,X),o=nn(i,["month","monthCode","year"]),s=Ye(this,o,[]);return s=Kh(i,s,Ye(e,o,"partial")),s=Ye(s,o,[]),Zh(i,s,n)}add(e,r){if(!Gt(this))throw new TypeError("invalid receiver");return dY("add",this,e,r)}subtract(e,r){if(!Gt(this))throw new TypeError("invalid receiver");return dY("subtract",this,e,r)}until(e,r){if(!Gt(this))throw new TypeError("invalid receiver");return nY("until",this,e,r)}since(e,r){if(!Gt(this))throw new TypeError("invalid receiver");return nY("since",this,e,r)}equals(e){if(!Gt(this))throw new TypeError("invalid receiver");let r=wv(e);for(let n of[de,fe,he])if(S(this,n)!==S(r,n))return!1;return zv(S(this,X),S(r,X))}toString(e){if(!Gt(this))throw new TypeError("invalid receiver");return KZ(this,Ov(ot(e)))}toJSON(){if(!Gt(this))throw new TypeError("invalid receiver");return KZ(this)}toLocaleString(e,r){if(!Gt(this))throw new TypeError("invalid receiver");return new rf(e,r).format(this)}valueOf(){throw new TypeError("use compare() or equals() to compare Temporal.PlainYearMonth")}toPlainDate(e){if(!Gt(this))throw new TypeError("invalid receiver");if(!pr(e))throw new TypeError("argument should be an object");let r=S(this,X),n=nn(r,["monthCode","year"]),i=Ye(this,n,[]),o=nn(r,["day"]),s=Kh(r,i,Ye(e,o,[]));s=Ye(s,[...new Set([...n,...o])],[]);let a=b4e(null);return a.overflow="reject",Xd(r,s,a)}getISOFields(){if(!Gt(this))throw new TypeError("invalid receiver");return{calendar:S(this,X),isoDay:S(this,he),isoMonth:S(this,fe),isoYear:S(this,de)}}getCalendar(){if(!Gt(this))throw new TypeError("invalid receiver");return Wm(S(this,X))}static from(e,r){let n=ot(r);return Gt(e)?(Jr(n),Tv(S(e,de),S(e,fe),S(e,X),S(e,he))):wv(e,n)}static compare(e,r){let n=wv(e),i=wv(r);return mu(S(n,de),S(n,fe),S(n,he),S(i,de),S(i,fe),S(i,he))}};zc(Mv,"Temporal.PlainYearMonth");var v4e=rf.prototype.resolvedOptions,w4e=Object.create,kv=class{constructor(e,r,n="iso8601"){if(arguments.length<1)throw new TypeError("missing argument: epochNanoseconds is required");OY(this,xv(e),ni(r),yo(n))}get calendarId(){if(!ge(this))throw new TypeError("invalid receiver");return Fn(S(this,X))}get timeZoneId(){if(!ge(this))throw new TypeError("invalid receiver");return Pv(S(this,Xt))}get year(){if(!ge(this))throw new TypeError("invalid receiver");return Tx(S(this,X),cr(this))}get month(){if(!ge(this))throw new TypeError("invalid receiver");return Px(S(this,X),cr(this))}get monthCode(){if(!ge(this))throw new TypeError("invalid receiver");return Lv(S(this,X),cr(this))}get day(){if(!ge(this))throw new TypeError("invalid receiver");return Uv(S(this,X),cr(this))}get hour(){if(!ge(this))throw new TypeError("invalid receiver");return S(cr(this),Le)}get minute(){if(!ge(this))throw new TypeError("invalid receiver");return S(cr(this),Ue)}get second(){if(!ge(this))throw new TypeError("invalid receiver");return S(cr(this),Fe)}get millisecond(){if(!ge(this))throw new TypeError("invalid receiver");return S(cr(this),ze)}get microsecond(){if(!ge(this))throw new TypeError("invalid receiver");return S(cr(this),$e)}get nanosecond(){if(!ge(this))throw new TypeError("invalid receiver");return S(cr(this),Ge)}get era(){if(!ge(this))throw new TypeError("invalid receiver");return Ix(S(this,X),cr(this))}get eraYear(){if(!ge(this))throw new TypeError("invalid receiver");return Rx(S(this,X),cr(this))}get epochSeconds(){if(!ge(this))throw new TypeError("invalid receiver");let e=S(this,Ae);return N.default.toNumber(Rm(e,Nc))}get epochMilliseconds(){if(!ge(this))throw new TypeError("invalid receiver");let e=S(this,Ae);return N.default.toNumber(Rm(e,cs))}get epochMicroseconds(){if(!ge(this))throw new TypeError("invalid receiver");return wx(Rm(S(this,Ae),Ht))}get epochNanoseconds(){if(!ge(this))throw new TypeError("invalid receiver");return wx(S(this,Ae))}get dayOfWeek(){if(!ge(this))throw new TypeError("invalid receiver");return Y9(S(this,X),cr(this))}get dayOfYear(){if(!ge(this))throw new TypeError("invalid receiver");return J9(S(this,X),cr(this))}get weekOfYear(){if(!ge(this))throw new TypeError("invalid receiver");return X9(S(this,X),cr(this))}get yearOfWeek(){if(!ge(this))throw new TypeError("invalid receiver");return Q9(S(this,X),cr(this))}get hoursInDay(){if(!ge(this))throw new TypeError("invalid receiver");let e=cr(this),r=se("%Temporal.PlainDateTime%"),n=S(e,de),i=S(e,fe),o=S(e,he),s=new r(n,i,o,0,0,0,0,0,0),a=$h(n,i,o,0,0,0,1,"reject"),c=new r(a.year,a.month,a.day,0,0,0,0,0,0),d=S(this,Xt),f=S(Ri(d,s,"compatible"),Ae),u=S(Ri(d,c,"compatible"),Ae);return Dc(N.default.subtract(u,f),TY)}get daysInWeek(){if(!ge(this))throw new TypeError("invalid receiver");return e7(S(this,X),cr(this))}get daysInMonth(){if(!ge(this))throw new TypeError("invalid receiver");return Mx(S(this,X),cr(this))}get daysInYear(){if(!ge(this))throw new TypeError("invalid receiver");return kx(S(this,X),cr(this))}get monthsInYear(){if(!ge(this))throw new TypeError("invalid receiver");return Bx(S(this,X),cr(this))}get inLeapYear(){if(!ge(this))throw new TypeError("invalid receiver");return Dx(S(this,X),cr(this))}get offset(){if(!ge(this))throw new TypeError("invalid receiver");return w9(S(this,Xt),S(this,ri))}get offsetNanoseconds(){if(!ge(this))throw new TypeError("invalid receiver");return ka(S(this,Xt),S(this,ri))}with(e,r){if(!ge(this))throw new TypeError("invalid receiver");if(!pr(e))throw new TypeError("invalid zoned-date-time-like");$m(e);let n=ot(r),i=S(this,X),o=nn(i,["day","hour","microsecond","millisecond","minute","month","monthCode","nanosecond","second","year"]);o.push("offset");let s=Ye(this,o,["offset"]);s=Kh(i,s,Ye(e,o,"partial")),s=Ye(s,o,["offset"]);let a=jm(n),c=hx(n,"prefer"),{year:d,month:f,day:u,hour:m,minute:_,second:v,millisecond:A,microsecond:T,nanosecond:M}=qv(i,s,n),D=gu(s.offset),O=S(this,Xt);return qn(mx(d,f,u,m,_,v,A,T,M,"option",D,O,a,c,!1),O,i)}withPlainDate(e){if(!ge(this))throw new TypeError("invalid receiver");let r=er(e),n=S(r,de),i=S(r,fe),o=S(r,he),s=S(r,X),a=cr(this),c=S(a,Le),d=S(a,Ue),f=S(a,Fe),u=S(a,ze),m=S(a,$e),_=S(a,Ge);s=jY(S(this,X),s);let v=S(this,Xt);return qn(S(Ri(v,new(se("%Temporal.PlainDateTime%"))(n,i,o,c,d,f,u,m,_,s),"compatible"),Ae),v,s)}withPlainTime(e){if(!ge(this))throw new TypeError("invalid receiver");let r=se("%Temporal.PlainTime%"),n=e===void 0?new r:Vd(e),i=cr(this),o=S(i,de),s=S(i,fe),a=S(i,he),c=S(this,X),d=S(n,Le),f=S(n,Ue),u=S(n,Fe),m=S(n,ze),_=S(n,$e),v=S(n,Ge),A=S(this,Xt);return qn(S(Ri(A,new(se("%Temporal.PlainDateTime%"))(o,s,a,d,f,u,m,_,v,c),"compatible"),Ae),A,c)}withTimeZone(e){if(!ge(this))throw new TypeError("invalid receiver");let r=ni(e);return qn(S(this,Ae),r,S(this,X))}withCalendar(e){if(!ge(this))throw new TypeError("invalid receiver");let r=yo(e);return qn(S(this,Ae),S(this,Xt),r)}add(e,r){if(!ge(this))throw new TypeError("invalid receiver");return fY("add",this,e,r)}subtract(e,r){if(!ge(this))throw new TypeError("invalid receiver");return fY("subtract",this,e,r)}until(e,r){if(!ge(this))throw new TypeError("invalid receiver");return iY("until",this,e,r)}since(e,r){if(!ge(this))throw new TypeError("invalid receiver");return iY("since",this,e,r)}round(e){if(!ge(this))throw new TypeError("invalid receiver");if(e===void 0)throw new TypeError("options parameter is required");let r=typeof e=="string"?Um("smallestUnit",e):ot(e),n=Gm(r),i=Ma(r,"halfExpand"),o=mo(r,"smallestUnit","time",Wh,["day"]),s={day:1,hour:24,minute:60,second:60,millisecond:1e3,microsecond:1e3,nanosecond:1e3}[o];Hm(n,s,s===1);let a=cr(this),c=S(a,de),d=S(a,fe),f=S(a,he),u=S(a,Le),m=S(a,Ue),_=S(a,Fe),v=S(a,ze),A=S(a,$e),T=S(a,Ge),M=se("%Temporal.PlainDateTime%"),D=S(this,Xt),O=S(this,X),U=Ri(D,new M(S(a,de),S(a,fe),S(a,he),0,0,0,0,0,0),"compatible"),L=ds(U,D,O,0,0,0,1,0,0,0,0,0,0),F=N.default.subtract(L,N.default.BigInt(S(U,Ae)));if(N.default.lessThanOrEqual(F,Or))throw new RangeError("cannot round a ZonedDateTime in a calendar with zero or negative length days");return{year:c,month:d,day:f,hour:u,minute:m,second:_,millisecond:v,microsecond:A,nanosecond:T}=d7(c,d,f,u,m,_,v,A,T,n,o,i,N.default.toNumber(F)),qn(mx(c,d,f,u,m,_,v,A,T,"option",ka(D,S(this,ri)),D,"compatible","prefer",!1),D,S(this,X))}equals(e){if(!ge(this))throw new TypeError("invalid receiver");let r=_v(e),n=S(this,Ae),i=S(r,Ae);return!!N.default.equal(N.default.BigInt(n),N.default.BigInt(i))&&!!qY(S(this,Xt),S(r,Xt))&&zv(S(this,X),S(r,X))}toString(e){if(!ge(this))throw new TypeError("invalid receiver");let r=ot(e),n=Ov(r),i=jv(r),o=function(_){return wu(_,"offset",["auto","never"],"auto")}(r),s=Ma(r,"trunc"),a=mo(r,"smallestUnit","time",void 0);if(a==="hour")throw new RangeError('smallestUnit must be a time unit other than "hour"');let c=function(_){return wu(_,"timeZoneName",["auto","never","critical"],"auto")}(r),{precision:d,unit:f,increment:u}=Nv(a,i);return ZZ(this,d,n,c,o,{unit:f,increment:u,roundingMode:s})}toLocaleString(e,r){if(!ge(this))throw new TypeError("invalid receiver");let n=ot(r),i=w4e(null);if(Pm(i,n,["timeZone"]),n.timeZone!==void 0)throw new TypeError("ZonedDateTime toLocaleString does not accept a timeZone option");i.year===void 0&&i.month===void 0&&i.day===void 0&&i.weekday===void 0&&i.dateStyle===void 0&&i.hour===void 0&&i.minute===void 0&&i.second===void 0&&i.timeStyle===void 0&&i.dayPeriod===void 0&&i.timeZoneName===void 0&&(i.timeZoneName="short");let o=Pv(S(this,Xt));if(Am(o))throw new RangeError("toLocaleString does not support offset string time zones");o=r7(o),i.timeZone=o;let s=new rf(e,i),a=_e(v4e,s,[]).calendar,c=Fn(S(this,X));if(c!=="iso8601"&&a!=="iso8601"&&a!==c)throw new RangeError(`cannot format ZonedDateTime with calendar ${c} in locale with calendar ${a}`);return s.format(S(this,ri))}toJSON(){if(!ge(this))throw new TypeError("invalid receiver");return ZZ(this,"auto")}valueOf(){throw new TypeError("use compare() or equals() to compare Temporal.ZonedDateTime")}startOfDay(){if(!ge(this))throw new TypeError("invalid receiver");let e=cr(this),r=se("%Temporal.PlainDateTime%"),n=S(this,X),i=new r(S(e,de),S(e,fe),S(e,he),0,0,0,0,0,0,n),o=S(this,Xt);return qn(S(Ri(o,i,"compatible"),Ae),o,n)}toInstant(){if(!ge(this))throw new TypeError("invalid receiver");return new(se("%Temporal.Instant%"))(S(this,Ae))}toPlainDate(){if(!ge(this))throw new TypeError("invalid receiver");return qm(cr(this))}toPlainTime(){if(!ge(this))throw new TypeError("invalid receiver");return t7(cr(this))}toPlainDateTime(){if(!ge(this))throw new TypeError("invalid receiver");return cr(this)}toPlainYearMonth(){if(!ge(this))throw new TypeError("invalid receiver");let e=S(this,X);return Zh(e,Ye(this,nn(e,["monthCode","year"]),[]))}toPlainMonthDay(){if(!ge(this))throw new TypeError("invalid receiver");let e=S(this,X);return Nm(e,Ye(this,nn(e,["day","monthCode"]),[]))}getISOFields(){if(!ge(this))throw new TypeError("invalid receiver");let e=cr(this),r=S(this,Xt);return{calendar:S(this,X),isoDay:S(e,he),isoHour:S(e,Le),isoMicrosecond:S(e,$e),isoMillisecond:S(e,ze),isoMinute:S(e,Ue),isoMonth:S(e,fe),isoNanosecond:S(e,Ge),isoSecond:S(e,Fe),isoYear:S(e,de),offset:w9(r,S(this,ri)),timeZone:r}}getCalendar(){if(!ge(this))throw new TypeError("invalid receiver");return Wm(S(this,X))}getTimeZone(){if(!ge(this))throw new TypeError("invalid receiver");return NY(S(this,Xt))}static from(e,r){let n=ot(r);return ge(e)?(jm(n),hx(n,"reject"),Jr(n),qn(S(e,Ae),S(e,Xt),S(e,X))):_v(e,n)}static compare(e,r){let n=_v(e),i=_v(r),o=S(n,Ae),s=S(i,Ae);return N.default.lessThan(N.default.BigInt(o),N.default.BigInt(s))?-1:N.default.greaterThan(N.default.BigInt(o),N.default.BigInt(s))?1:0}};function cr(t){return Oo(S(t,Xt),S(t,ri),S(t,X))}zc(kv,"Temporal.ZonedDateTime");var rp=Object.freeze({__proto__:null,Calendar:xr,Duration:Oc,Instant:as,Now:bJ,PlainDate:Xh,PlainDateTime:Qh,PlainMonthDay:Rv,PlainTime:Jd,PlainYearMonth:Mv,TimeZone:Hh,ZonedDateTime:kv});var _4e=[as,xr,Xh,Qh,Oc,Rv,Jd,Hh,Mv,kv];for(let t of _4e){let e=Object.getOwnPropertyDescriptor(t,"prototype");(e.configurable||e.enumerable||e.writable)&&(e.configurable=!1,e.enumerable=!1,e.writable=!1,Object.defineProperty(t,"prototype",e))}var st=class{static async sleep(e){return new Promise(r=>setTimeout(r,e))}static async minimalSleep(){await st.sleep(2)}static getCurrentTimestamp(){return rp.Now.instant().toString({smallestUnit:"microseconds"})}static createTimestamp(e){let{year:r,month:n,day:i,hour:o,minute:s,second:a,millisecond:c,microsecond:d}=e;return rp.ZonedDateTime.from({timeZone:"UTC",year:r,month:n,day:i,hour:o,minute:s,second:a,millisecond:c,microsecond:d}).toInstant().toString({smallestUnit:"microseconds"})}static createOffsetTimestamp(e,r){let n=r?rp.Instant.from(r):rp.Now.instant(),i=rp.Duration.from(e);return n.add(i).toString({smallestUnit:"microseconds"})}static validateTimestamp(e){try{rp.Instant.from(e)}catch{throw new Q("TimestampInvalid",`Invalid timestamp: ${e}`)}}};p();var Xr=(o=>(o.Events="Events",o.Messages="Messages",o.Permissions="Permissions",o.Protocols="Protocols",o.Records="Records",o))(Xr||{}),Qr=(f=>(f.Configure="Configure",f.Create="Create",f.Get="Get",f.Grant="Grant",f.Query="Query",f.Read="Read",f.Request="Request",f.Revoke="Revoke",f.Write="Write",f.Delete="Delete",f))(Qr||{});var Au=class extends dn{toJSON(){return this.message}static async parse(e){let r;if(e.authorization!==void 0&&(r=await ie.validateMessageSignatureIntegrity(e.authorization.signature,e.descriptor)),ur.validateDelegatedGrantReferentialIntegrity(e,r),r?.protocolRole!==void 0&&e.descriptor.filter.protocolPath===void 0)throw new Q("RecordsQueryFilterMissingRequiredProperties","Role-authorized queries must include `protocolPath` in the filter");return e.descriptor.filter.protocol!==void 0&&hu(e.descriptor.filter.protocol),e.descriptor.filter.schema!==void 0&&xm(e.descriptor.filter.schema),st.validateTimestamp(e.descriptor.messageTimestamp),new Au(e)}static async create(e){let r={interface:"Records",method:"Query",messageTimestamp:e.messageTimestamp??st.getCurrentTimestamp(),filter:ur.normalizeFilter(e.filter),dateSort:e.dateSort,pagination:e.pagination};Hn(r);let n=e.signer,i;n&&(i=await ie.createAuthorization({descriptor:r,signer:n,protocolRole:e.protocolRole,delegatedGrant:e.delegatedGrant}));let o={descriptor:r,authorization:i};return ie.validateJsonSchema(o),new Au(o)}};p();var vJ=mr(ex(),1),Ba=class{static async toBytes(e){return new Promise((r,n)=>{let i=[];e.on("data",o=>{i.push(o)}),e.on("end",()=>{let o=Ba.concatenateArrayOfBytes(i);r(o)}),e.on("error",n)})}static async toObject(e){let r=await Ba.toBytes(e);return Be.bytesToObject(r)}static concatenateArrayOfBytes(e){let r=e.reduce((o,s)=>o+s.length,0),n=new Uint8Array(r),i=0;for(let o of e)n.set(o,i),i+=o.length;return n}static fromBytes(e){let n=0;return new vJ.Readable({read(o){n+1e5>e.length?(this.push(e.subarray(n)),this.push(null)):(this.push(e.subarray(n,n+1e5)),n=n+1e5)}})}static fromObject(e){let r=Be.objectToBytes(e);return Ba.fromBytes(r)}};p();var y7=(i=>(i.CreatedAscending="createdAscending",i.CreatedDescending="createdDescending",i.PublishedAscending="publishedAscending",i.PublishedDescending="publishedDescending",i))(y7||{});p();var v7=mr(RJ(),1);p();var Km=class{static getMethodSpecificId(e){let r=e.indexOf(":",4);return e.substring(r+1)}static validate(e){if(typeof e!="string")throw new Q("DidNotString",`DID is not string: ${e}`);if(!/^did:([a-z0-9]+):((?:(?:[a-zA-Z0-9._-]|(?:%[0-9a-fA-F]{2}))*:)*((?:[a-zA-Z0-9._-]|(?:%[0-9a-fA-F]{2}))+))((;[a-zA-Z0-9_.:%-]+=[a-zA-Z0-9_.:%-]*)*)(\/[^#?]*)?([?][^#]*)?(#.*)?$/.test(e))throw new Q("DidNotValid",`DID is not a valid DID: ${e}`)}static getMethodName(e){let r=e.indexOf(":",4);return e.substring(4,r)}};var Tu=class{method(){return"key"}static getMulticodecSize(e){let r=0;for(;;){let n=e[r];if(r++,(n&128)!==128)break}return r}async resolve(e){let[r,n,i]=e.split(":",3);try{let o=Is.decode(i),s=v7.default.decode(o),a=Tu.getMulticodecSize(o),c=o.slice(a),d=[],f;if(s===237)d.push("https://w3id.org/security/suites/ed25519-2020/v1"),f=await Bl.publicKeyToJwk(c);else if(s===231)f=await qt.publicKeyToJwk(c);else throw Error(`key type of multicodec ${s} is not supported`);let u=`${e}#${i}`;return{"@context":"https://w3id.org/did-resolution/v1",didDocument:{"@context":["https://www.w3.org/ns/did/v1","https://w3id.org/security/suites/jws-2020/v1",...d],id:e,verificationMethod:[{id:u,type:"JsonWebKey2020",controller:e,publicKeyJwk:f}],authentication:[u],assertionMethod:[u],capabilityDelegation:[u],capabilityInvocation:[u]},didDocumentMetadata:{},didResolutionMetadata:{}}}catch{return{didDocument:void 0,didDocumentMetadata:{},didResolutionMetadata:{error:"invalidDid"}}}}static async generate(){let{publicJwk:e,privateJwk:r}=await Bl.generateKeyPair(),n=v7.default.encode(237),i=Be.base64UrlToBytes(e.x),o=new Uint8Array(n.length+i.byteLength);o.set(n,0),o.set(i,n.length);let a=`did:key:${Is.encode(o)}`,c=Tu.getKeyId(a);return{did:a,keyId:c,keyPair:{publicJwk:e,privateJwk:r}}}static getKeyId(e){let r=Km.getMethodSpecificId(e);return`${e}#${r}`}};p();var BJ=mr(kJ(),1),O4e=globalThis.fetch??BJ.default,Gv=class{constructor(e="https://discover.did.msidentity.com/1.0/identifiers/",r){this.resolutionEndpoint=e;this.fetchFn=r??O4e}method(){return"ion"}async resolve(e){let r=new URL("./"+e,this.resolutionEndpoint).toString(),n=await this.fetchFn(r);if(n.status!==200)throw new Q("DidResolutionFailed",`unable to resolve ${e}, got http status ${n.status}`);return await n.json()}};p();var GJ=mr($J(),1);var ip=class{constructor(e=ip.defaultRelayUrl()){this.pkarrRelay=e}method(){return"dht"}async resolve(e){let[r,n,i]=e.split(":",3);try{let o=await fetch(`${this.pkarrRelay}/${i}`);if(!o.ok)return{"@context":"https://w3id.org/did-resolution/v1",didDocument:void 0,didDocumentMetadata:{},didResolutionMetadata:{error:`DID ${e} not found in DHT`}};let s=new Uint8Array(await o.arrayBuffer());return{"@context":"https://w3id.org/did-resolution/v1",didDocument:await this.fromDnsPacket(e,s),didDocumentMetadata:{},didResolutionMetadata:{contentType:"application/did+json"}}}catch(o){return{"@context":"https://w3id.org/did-resolution/v1",didDocument:void 0,didDocumentMetadata:{},didResolutionMetadata:{error:`Error resolving DID ${e}: ${o.message}`}}}}async fromDnsPacket(e,r){let n=this.extractRawDnsPacket(r),i=GJ.default.decode(C.Buffer.from(n)),o=Array.isArray(i.answers)?i.answers:[],s={"@context":["https://www.w3.org/ns/did/v1","https://w3id.org/security/suites/jws-2020/v1"],id:e,verificationMethod:[]},a=new Map,c;for(let d of o){if(d.type!=="TXT")continue;let f=String(d.name||"").toLowerCase(),u=this.txtToString(d.data),m=this.recordHead(f);if(!(!u||!m)){if(m.type==="k"){let _=this.parseTxtRecord(u),v=_.id,A=_.t,T=_.k;if(!v||!A||!T)continue;let M=await this.keyMaterialToJwk(A,v,T);s.verificationMethod.push({id:`${e}#${v}`,type:"JsonWebKey2020",controller:e,publicKeyJwk:M}),a.set(m.identifier,`#${v}`);continue}if(m.type==="s"){let _=this.parseTxtRecord(u),v=_.id,A=_.t,T=_.uri;if(!v||!A||!T)continue;s.service??=[],s.service.push({id:`${e}#${v}`,type:A,serviceEndpoint:T});continue}m.type==="did"&&(c=u)}}if(c)for(let d of c.split(";")){let[f,u]=d.split("=");if(!f||!u)continue;let m=u.split(",").map(_=>a.get(_.trim())).filter(_=>Boolean(_));if(m.length)switch(f){case"auth":s.authentication=m;break;case"asm":s.assertionMethod=m;break;case"agm":s.keyAgreement=m;break;case"inv":s.capabilityInvocation=m;break;case"del":s.capabilityDelegation=m;break;default:break}}return s}extractRawDnsPacket(e){return e.length>72?e.slice(72):e}txtToString(e){return typeof e=="string"?e:Array.isArray(e)?e.map(r=>this.txtToString(r)).join(""):e instanceof Uint8Array?C.Buffer.from(e).toString("utf8"):""}parseTxtRecord(e){return e.split(",").reduce((r,n)=>{let[i,o]=n.split("=");return!i||o===void 0||(r[i.trim()]=o.trim()),r},{})}recordHead(e){let r=e.split(".")[0]??"";return r==="_did"?{type:"did",identifier:"did"}:r.startsWith("_k")?{type:"k",identifier:r.slice(1)}:r.startsWith("_s")?{type:"s",identifier:r.slice(1)}:null}async keyMaterialToJwk(e,r,n){let i=this.base64UrlToBytes(n);if(e==="0"){let o=await Bl.publicKeyToJwk(i);return o.kid=r,o}if(e==="1"){let o=await qt.publicKeyToJwk(i);return o.kid=r,o}throw new Error(`Unsupported did:dht key type: ${e}`)}base64UrlToBytes(e){let r=e.length%4===0?"":"=".repeat(4-e.length%4),n=e.replace(/-/g,"+").replace(/_/g,"/")+r;return new Uint8Array(C.Buffer.from(n,"base64"))}static defaultRelayUrl(){return(typeof k.default<"u"?k.default.env.DHT_RELAY_URL?.trim():void 0)||"http://localhost:8085/dht"}};p();p();p();var Wv=typeof performance=="object"&&performance&&typeof performance.now=="function"?performance:Date,WJ=new Set,R7=typeof k.default=="object"&&k.default?k.default:{},VJ=(t,e,r,n)=>{typeof R7.emitWarning=="function"?R7.emitWarning(t,e,r,n):console.error(`[${r}] ${e}: ${t}`)},Gx=globalThis.AbortController,HJ=globalThis.AbortSignal;if(typeof Gx>"u"){HJ=class{onabort;_onabort=[];reason;aborted=!1;addEventListener(n,i){this._onabort.push(i)}},Gx=class{constructor(){e()}signal=new HJ;abort(n){if(!this.signal.aborted){this.signal.reason=n,this.signal.aborted=!0;for(let i of this.signal._onabort)i(n);this.signal.onabort?.(n)}}};let t=R7.env?.LRU_CACHE_IGNORE_AC_WARNING!=="1",e=()=>{t&&(t=!1,VJ("AbortController is not defined. If using lru-cache in node 14, load an AbortController polyfill from the `node-abort-controller` package. A minimal polyfill is provided for use by LRUCache.fetch(), but it should not be relied upon in other contexts (eg, passing it to other APIs that use AbortController/AbortSignal might have undesirable effects). You may disable this with LRU_CACHE_IGNORE_AC_WARNING=1 in the env.","NO_ABORT_CONTROLLER","ENOTSUP",e))}}var $4e=t=>!WJ.has(t),cVe=Symbol("type"),Ru=t=>t&&t===Math.floor(t)&&t>0&&isFinite(t),KJ=t=>Ru(t)?t<=Math.pow(2,8)?Uint8Array:t<=Math.pow(2,16)?Uint16Array:t<=Math.pow(2,32)?Uint32Array:t<=Number.MAX_SAFE_INTEGER?Xm:null:null,Xm=class extends Array{constructor(e){super(e),this.fill(0)}},Qm,Jm=class{heap;length;static create(e){let r=KJ(e);if(!r)return[];b8(Jm,Qm,!0);let n=new Jm(e,r);return b8(Jm,Qm,!1),n}constructor(e,r){if(!fR(Jm,Qm))throw new TypeError("instantiate Stack using Stack.create(n)");this.heap=new r(e),this.length=0}push(e){this.heap[this.length++]=e}pop(){return this.heap[--this.length]}},$x=Jm;Qm=new WeakMap,uR($x,Qm,!1);var ey=class{#h;#f;#b;#p;#R;ttl;ttlResolution;ttlAutopurge;updateAgeOnGet;updateAgeOnHas;allowStale;noDisposeOnSet;noUpdateTTL;maxEntrySize;sizeCalculation;noDeleteOnFetchRejection;noDeleteOnStaleGet;allowStaleOnFetchAbort;allowStaleOnFetchRejection;ignoreFetchAbort;#n;#m;#i;#r;#e;#c;#u;#a;#o;#y;#s;#x;#E;#g;#v;#A;#d;static unsafeExposeInternals(e){return{starts:e.#E,ttls:e.#g,sizes:e.#x,keyMap:e.#i,keyList:e.#r,valList:e.#e,next:e.#c,prev:e.#u,get head(){return e.#a},get tail(){return e.#o},free:e.#y,isBackgroundFetch:r=>e.#t(r),backgroundFetch:(r,n,i,o)=>e.#B(r,n,i,o),moveToTail:r=>e.#I(r),indexes:r=>e.#w(r),rindexes:r=>e.#_(r),isStale:r=>e.#l(r)}}get max(){return this.#h}get maxSize(){return this.#f}get calculatedSize(){return this.#m}get size(){return this.#n}get fetchMethod(){return this.#R}get dispose(){return this.#b}get disposeAfter(){return this.#p}constructor(e){let{max:r=0,ttl:n,ttlResolution:i=1,ttlAutopurge:o,updateAgeOnGet:s,updateAgeOnHas:a,allowStale:c,dispose:d,disposeAfter:f,noDisposeOnSet:u,noUpdateTTL:m,maxSize:_=0,maxEntrySize:v=0,sizeCalculation:A,fetchMethod:T,noDeleteOnFetchRejection:M,noDeleteOnStaleGet:D,allowStaleOnFetchRejection:O,allowStaleOnFetchAbort:U,ignoreFetchAbort:L}=e;if(r!==0&&!Ru(r))throw new TypeError("max option must be a nonnegative integer");let F=r?KJ(r):Array;if(!F)throw new Error("invalid max value: "+r);if(this.#h=r,this.#f=_,this.maxEntrySize=v||this.#f,this.sizeCalculation=A,this.sizeCalculation){if(!this.#f&&!this.maxEntrySize)throw new TypeError("cannot set sizeCalculation without setting maxSize or maxEntrySize");if(typeof this.sizeCalculation!="function")throw new TypeError("sizeCalculation set to non-function")}if(T!==void 0&&typeof T!="function")throw new TypeError("fetchMethod must be a function if specified");if(this.#R=T,this.#A=!!T,this.#i=new Map,this.#r=new Array(r).fill(void 0),this.#e=new Array(r).fill(void 0),this.#c=new F(r),this.#u=new F(r),this.#a=0,this.#o=0,this.#y=$x.create(r),this.#n=0,this.#m=0,typeof d=="function"&&(this.#b=d),typeof f=="function"?(this.#p=f,this.#s=[]):(this.#p=void 0,this.#s=void 0),this.#v=!!this.#b,this.#d=!!this.#p,this.noDisposeOnSet=!!u,this.noUpdateTTL=!!m,this.noDeleteOnFetchRejection=!!M,this.allowStaleOnFetchRejection=!!O,this.allowStaleOnFetchAbort=!!U,this.ignoreFetchAbort=!!L,this.maxEntrySize!==0){if(this.#f!==0&&!Ru(this.#f))throw new TypeError("maxSize must be a positive integer if specified");if(!Ru(this.maxEntrySize))throw new TypeError("maxEntrySize must be a positive integer if specified");this.#q()}if(this.allowStale=!!c,this.noDeleteOnStaleGet=!!D,this.updateAgeOnGet=!!s,this.updateAgeOnHas=!!a,this.ttlResolution=Ru(i)||i===0?i:1,this.ttlAutopurge=!!o,this.ttl=n||0,this.ttl){if(!Ru(this.ttl))throw new TypeError("ttl must be a positive integer if specified");this.#D()}if(this.#h===0&&this.ttl===0&&this.#f===0)throw new TypeError("At least one of max, maxSize, or ttl is required");if(!this.ttlAutopurge&&!this.#h&&!this.#f){let $="LRU_CACHE_UNBOUNDED";$4e($)&&(WJ.add($),VJ("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning",$,ey))}}getRemainingTTL(e){return this.#i.has(e)?1/0:0}#D(){let e=new Xm(this.#h),r=new Xm(this.#h);this.#g=e,this.#E=r,this.#C=(o,s,a=Wv.now())=>{if(r[o]=s!==0?a:0,e[o]=s,s!==0&&this.ttlAutopurge){let c=setTimeout(()=>{this.#l(o)&&this.delete(this.#r[o])},s+1);c.unref&&c.unref()}},this.#T=o=>{r[o]=e[o]!==0?Wv.now():0},this.#S=(o,s)=>{if(e[s]){let a=e[s],c=r[s];o.ttl=a,o.start=c,o.now=n||i();let d=o.now-c;o.remainingTTL=a-d}};let n=0,i=()=>{let o=Wv.now();if(this.ttlResolution>0){n=o;let s=setTimeout(()=>n=0,this.ttlResolution);s.unref&&s.unref()}return o};this.getRemainingTTL=o=>{let s=this.#i.get(o);if(s===void 0)return 0;let a=e[s],c=r[s];if(a===0||c===0)return 1/0;let d=(n||i())-c;return a-d},this.#l=o=>e[o]!==0&&r[o]!==0&&(n||i())-r[o]>e[o]}#T=()=>{};#S=()=>{};#C=()=>{};#l=()=>!1;#q(){let e=new Xm(this.#h);this.#m=0,this.#x=e,this.#P=r=>{this.#m-=e[r],e[r]=0},this.#O=(r,n,i,o)=>{if(this.#t(n))return 0;if(!Ru(i))if(o){if(typeof o!="function")throw new TypeError("sizeCalculation must be a function");if(i=o(n,r),!Ru(i))throw new TypeError("sizeCalculation return invalid (expect positive integer)")}else throw new TypeError("invalid size value (must be positive integer). When maxSize or maxEntrySize is used, sizeCalculation or size must be set.");return i},this.#M=(r,n,i)=>{if(e[r]=n,this.#f){let o=this.#f-e[r];for(;this.#m>o;)this.#k(!0)}this.#m+=e[r],i&&(i.entrySize=n,i.totalCalculatedSize=this.#m)}}#P=e=>{};#M=(e,r,n)=>{};#O=(e,r,n,i)=>{if(n||i)throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");return 0};*#w({allowStale:e=this.allowStale}={}){if(this.#n)for(let r=this.#o;!(!this.#j(r)||((e||!this.#l(r))&&(yield r),r===this.#a));)r=this.#u[r]}*#_({allowStale:e=this.allowStale}={}){if(this.#n)for(let r=this.#a;!(!this.#j(r)||((e||!this.#l(r))&&(yield r),r===this.#o));)r=this.#c[r]}#j(e){return e!==void 0&&this.#i.get(this.#r[e])===e}*entries(){for(let e of this.#w())this.#e[e]!==void 0&&this.#r[e]!==void 0&&!this.#t(this.#e[e])&&(yield[this.#r[e],this.#e[e]])}*rentries(){for(let e of this.#_())this.#e[e]!==void 0&&this.#r[e]!==void 0&&!this.#t(this.#e[e])&&(yield[this.#r[e],this.#e[e]])}*keys(){for(let e of this.#w()){let r=this.#r[e];r!==void 0&&!this.#t(this.#e[e])&&(yield r)}}*rkeys(){for(let e of this.#_()){let r=this.#r[e];r!==void 0&&!this.#t(this.#e[e])&&(yield r)}}*values(){for(let e of this.#w())this.#e[e]!==void 0&&!this.#t(this.#e[e])&&(yield this.#e[e])}*rvalues(){for(let e of this.#_())this.#e[e]!==void 0&&!this.#t(this.#e[e])&&(yield this.#e[e])}[Symbol.iterator](){return this.entries()}find(e,r={}){for(let n of this.#w()){let i=this.#e[n],o=this.#t(i)?i.__staleWhileFetching:i;if(o!==void 0&&e(o,this.#r[n],this))return this.get(this.#r[n],r)}}forEach(e,r=this){for(let n of this.#w()){let i=this.#e[n],o=this.#t(i)?i.__staleWhileFetching:i;o!==void 0&&e.call(r,o,this.#r[n],this)}}rforEach(e,r=this){for(let n of this.#_()){let i=this.#e[n],o=this.#t(i)?i.__staleWhileFetching:i;o!==void 0&&e.call(r,o,this.#r[n],this)}}purgeStale(){let e=!1;for(let r of this.#_({allowStale:!0}))this.#l(r)&&(this.delete(this.#r[r]),e=!0);return e}dump(){let e=[];for(let r of this.#w({allowStale:!0})){let n=this.#r[r],i=this.#e[r],o=this.#t(i)?i.__staleWhileFetching:i;if(o===void 0||n===void 0)continue;let s={value:o};if(this.#g&&this.#E){s.ttl=this.#g[r];let a=Wv.now()-this.#E[r];s.start=Math.floor(Date.now()-a)}this.#x&&(s.size=this.#x[r]),e.unshift([n,s])}return e}load(e){this.clear();for(let[r,n]of e){if(n.start){let i=Date.now()-n.start;n.start=Wv.now()-i}this.set(r,n.value,n)}}set(e,r,n={}){if(r===void 0)return this.delete(e),this;let{ttl:i=this.ttl,start:o,noDisposeOnSet:s=this.noDisposeOnSet,sizeCalculation:a=this.sizeCalculation,status:c}=n,{noUpdateTTL:d=this.noUpdateTTL}=n,f=this.#O(e,r,n.size||0,a);if(this.maxEntrySize&&f>this.maxEntrySize)return c&&(c.set="miss",c.maxEntrySizeExceeded=!0),this.delete(e),this;let u=this.#n===0?void 0:this.#i.get(e);if(u===void 0)u=this.#n===0?this.#o:this.#y.length!==0?this.#y.pop():this.#n===this.#h?this.#k(!1):this.#n,this.#r[u]=e,this.#e[u]=r,this.#i.set(e,u),this.#c[this.#o]=u,this.#u[u]=this.#o,this.#o=u,this.#n++,this.#M(u,f,c),c&&(c.set="add"),d=!1;else{this.#I(u);let m=this.#e[u];if(r!==m){if(this.#A&&this.#t(m)?m.__abortController.abort(new Error("replaced")):s||(this.#v&&this.#b?.(m,e,"set"),this.#d&&this.#s?.push([m,e,"set"])),this.#P(u),this.#M(u,f,c),this.#e[u]=r,c){c.set="replace";let _=m&&this.#t(m)?m.__staleWhileFetching:m;_!==void 0&&(c.oldValue=_)}}else c&&(c.set="update")}if(i!==0&&!this.#g&&this.#D(),this.#g&&(d||this.#C(u,i,o),c&&this.#S(c,u)),!s&&this.#d&&this.#s){let m=this.#s,_;for(;_=m?.shift();)this.#p?.(..._)}return this}pop(){try{for(;this.#n;){let e=this.#e[this.#a];if(this.#k(!0),this.#t(e)){if(e.__staleWhileFetching)return e.__staleWhileFetching}else if(e!==void 0)return e}}finally{if(this.#d&&this.#s){let e=this.#s,r;for(;r=e?.shift();)this.#p?.(...r)}}}#k(e){let r=this.#a,n=this.#r[r],i=this.#e[r];return this.#A&&this.#t(i)?i.__abortController.abort(new Error("evicted")):(this.#v||this.#d)&&(this.#v&&this.#b?.(i,n,"evict"),this.#d&&this.#s?.push([i,n,"evict"])),this.#P(r),e&&(this.#r[r]=void 0,this.#e[r]=void 0,this.#y.push(r)),this.#n===1?(this.#a=this.#o=0,this.#y.length=0):this.#a=this.#c[r],this.#i.delete(n),this.#n--,r}has(e,r={}){let{updateAgeOnHas:n=this.updateAgeOnHas,status:i}=r,o=this.#i.get(e);if(o!==void 0){let s=this.#e[o];if(this.#t(s)&&s.__staleWhileFetching===void 0)return!1;if(this.#l(o))i&&(i.has="stale",this.#S(i,o));else return n&&this.#T(o),i&&(i.has="hit",this.#S(i,o)),!0}else i&&(i.has="miss");return!1}peek(e,r={}){let{allowStale:n=this.allowStale}=r,i=this.#i.get(e);if(i!==void 0&&(n||!this.#l(i))){let o=this.#e[i];return this.#t(o)?o.__staleWhileFetching:o}}#B(e,r,n,i){let o=r===void 0?void 0:this.#e[r];if(this.#t(o))return o;let s=new Gx,{signal:a}=n;a?.addEventListener("abort",()=>s.abort(a.reason),{signal:s.signal});let c={signal:s.signal,options:n,context:i},d=(A,T=!1)=>{let{aborted:M}=s.signal,D=n.ignoreFetchAbort&&A!==void 0;if(n.status&&(M&&!T?(n.status.fetchAborted=!0,n.status.fetchError=s.signal.reason,D&&(n.status.fetchAbortIgnored=!0)):n.status.fetchResolved=!0),M&&!D&&!T)return u(s.signal.reason);let O=_;return this.#e[r]===_&&(A===void 0?O.__staleWhileFetching?this.#e[r]=O.__staleWhileFetching:this.delete(e):(n.status&&(n.status.fetchUpdated=!0),this.set(e,A,c.options))),A},f=A=>(n.status&&(n.status.fetchRejected=!0,n.status.fetchError=A),u(A)),u=A=>{let{aborted:T}=s.signal,M=T&&n.allowStaleOnFetchAbort,D=M||n.allowStaleOnFetchRejection,O=D||n.noDeleteOnFetchRejection,U=_;if(this.#e[r]===_&&(!O||U.__staleWhileFetching===void 0?this.delete(e):M||(this.#e[r]=U.__staleWhileFetching)),D)return n.status&&U.__staleWhileFetching!==void 0&&(n.status.returnedStale=!0),U.__staleWhileFetching;if(U.__returned===U)throw A},m=(A,T)=>{let M=this.#R?.(e,o,c);M&&M instanceof Promise&&M.then(D=>A(D),T),s.signal.addEventListener("abort",()=>{(!n.ignoreFetchAbort||n.allowStaleOnFetchAbort)&&(A(),n.allowStaleOnFetchAbort&&(A=D=>d(D,!0)))})};n.status&&(n.status.fetchDispatched=!0);let _=new Promise(m).then(d,f),v=Object.assign(_,{__abortController:s,__staleWhileFetching:o,__returned:void 0});return r===void 0?(this.set(e,v,{...c.options,status:void 0}),r=this.#i.get(e)):this.#e[r]=v,v}#t(e){if(!this.#A)return!1;let r=e;return!!r&&r instanceof Promise&&r.hasOwnProperty("__staleWhileFetching")&&r.__abortController instanceof Gx}async fetch(e,r={}){let{allowStale:n=this.allowStale,updateAgeOnGet:i=this.updateAgeOnGet,noDeleteOnStaleGet:o=this.noDeleteOnStaleGet,ttl:s=this.ttl,noDisposeOnSet:a=this.noDisposeOnSet,size:c=0,sizeCalculation:d=this.sizeCalculation,noUpdateTTL:f=this.noUpdateTTL,noDeleteOnFetchRejection:u=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:m=this.allowStaleOnFetchRejection,ignoreFetchAbort:_=this.ignoreFetchAbort,allowStaleOnFetchAbort:v=this.allowStaleOnFetchAbort,context:A,forceRefresh:T=!1,status:M,signal:D}=r;if(!this.#A)return M&&(M.fetch="get"),this.get(e,{allowStale:n,updateAgeOnGet:i,noDeleteOnStaleGet:o,status:M});let O={allowStale:n,updateAgeOnGet:i,noDeleteOnStaleGet:o,ttl:s,noDisposeOnSet:a,size:c,sizeCalculation:d,noUpdateTTL:f,noDeleteOnFetchRejection:u,allowStaleOnFetchRejection:m,allowStaleOnFetchAbort:v,ignoreFetchAbort:_,status:M,signal:D},U=this.#i.get(e);if(U===void 0){M&&(M.fetch="miss");let L=this.#B(e,U,O,A);return L.__returned=L}else{let L=this.#e[U];if(this.#t(L)){let j=n&&L.__staleWhileFetching!==void 0;return M&&(M.fetch="inflight",j&&(M.returnedStale=!0)),j?L.__staleWhileFetching:L.__returned=L}let F=this.#l(U);if(!T&&!F)return M&&(M.fetch="hit"),this.#I(U),i&&this.#T(U),M&&this.#S(M,U),L;let $=this.#B(e,U,O,A),z=$.__staleWhileFetching!==void 0&&n;return M&&(M.fetch=F?"stale":"refresh",z&&F&&(M.returnedStale=!0)),z?$.__staleWhileFetching:$.__returned=$}}get(e,r={}){let{allowStale:n=this.allowStale,updateAgeOnGet:i=this.updateAgeOnGet,noDeleteOnStaleGet:o=this.noDeleteOnStaleGet,status:s}=r,a=this.#i.get(e);if(a!==void 0){let c=this.#e[a],d=this.#t(c);return s&&this.#S(s,a),this.#l(a)?(s&&(s.get="stale"),d?(s&&n&&c.__staleWhileFetching!==void 0&&(s.returnedStale=!0),n?c.__staleWhileFetching:void 0):(o||this.delete(e),s&&n&&(s.returnedStale=!0),n?c:void 0)):(s&&(s.get="hit"),d?c.__staleWhileFetching:(this.#I(a),i&&this.#T(a),c))}else s&&(s.get="miss")}#N(e,r){this.#u[r]=e,this.#c[e]=r}#I(e){e!==this.#o&&(e===this.#a?this.#a=this.#c[e]:this.#N(this.#u[e],this.#c[e]),this.#N(this.#o,e),this.#o=e)}delete(e){let r=!1;if(this.#n!==0){let n=this.#i.get(e);if(n!==void 0)if(r=!0,this.#n===1)this.clear();else{this.#P(n);let i=this.#e[n];this.#t(i)?i.__abortController.abort(new Error("deleted")):(this.#v||this.#d)&&(this.#v&&this.#b?.(i,e,"delete"),this.#d&&this.#s?.push([i,e,"delete"])),this.#i.delete(e),this.#r[n]=void 0,this.#e[n]=void 0,n===this.#o?this.#o=this.#u[n]:n===this.#a?this.#a=this.#c[n]:(this.#c[this.#u[n]]=this.#c[n],this.#u[this.#c[n]]=this.#u[n]),this.#n--,this.#y.push(n)}}if(this.#d&&this.#s?.length){let n=this.#s,i;for(;i=n?.shift();)this.#p?.(...i)}return r}clear(){for(let e of this.#_({allowStale:!0})){let r=this.#e[e];if(this.#t(r))r.__abortController.abort(new Error("deleted"));else{let n=this.#r[e];this.#v&&this.#b?.(r,n,"delete"),this.#d&&this.#s?.push([r,n,"delete"])}}if(this.#i.clear(),this.#e.fill(void 0),this.#r.fill(void 0),this.#g&&this.#E&&(this.#g.fill(0),this.#E.fill(0)),this.#x&&this.#x.fill(0),this.#a=0,this.#o=0,this.#y.length=0,this.#m=0,this.#n=0,this.#d&&this.#s){let e=this.#s,r;for(;r=e?.shift();)this.#p?.(...r)}}};var ty=class{constructor(e){this.timeToLiveInSeconds=e;this.cache=new ey({max:1e5,ttl:e*1e3})}async set(e,r){try{this.cache.set(e,r)}catch{}}async get(e){return this.cache.get(e)}};var Vv=class{constructor(e,r){this.cache=r||new ty(600),(e===void 0||e.length===0)&&(e=[new Gv,new Tu,new ip]),this.didResolvers=new Map;for(let n of e)this.didResolvers.set(n.method(),n)}async resolve(e){Km.validate(e);let n=e.split(":",3)[1],i=this.didResolvers.get(n);if(!i)throw new Q("DidMethodNotSupported",`${n} DID method not supported`);let o=await this.cache.get(e),s=o??await i.resolve(e);o===void 0&&await this.cache.set(e,s);let{didDocument:a,didResolutionMetadata:c}=s;if(!a||c?.error){let{error:d}=c,f=`Failed to resolve DID ${e}.`;throw f+=d?` Error: ${d}`:"",new Q("DidResolutionFailed",f)}return s}};p();p();p();var Mu=class extends dn{static async parse(e){return ie.validateJsonSchema(e),await ie.validateMessageSignatureIntegrity(e.authorization.signature,e.descriptor),st.validateTimestamp(e.descriptor.messageTimestamp),new Mu(e)}static async create(e){let r={interface:"Events",method:"Get",messageTimestamp:e.messageTimestamp??st.getCurrentTimestamp()};e.watermark&&(r.watermark=e.watermark);let n=await ie.createAuthorization({descriptor:r,signer:e.signer}),i={descriptor:r,authorization:n};return ie.validateJsonSchema(i),new Mu(i)}};p();function at(t,e){let r=t instanceof Error?t.message:"Error";return{status:{code:e,detail:r}}}p();p();var Ki=class{constructor(e){this.cache=e||new ty(600)}static get singleton(){return Ki._singleton===void 0&&(Ki._singleton=new Ki),Ki._singleton}static async verifySignatures(e,r){return await Ki.singleton.verifySignatures(e,r)}async verifySignatures(e,r){let n=[];for(let i of e.signatures){let o,s=fr.getKid(i),a=`${i.protected}.${e.payload}.${i.signature}`,c=await this.cache.get(a);if(c===void 0){let f=await Ki.getPublicKey(s,r);o=await fr.verifySignature(e.payload,i,f),await this.cache.set(a,o)}else o=c;let d=fr.extractDid(s);if(o)n.push(d);else throw new Q("GeneralJwsVerifierInvalidSignature",`Signature verification failed for ${d}`)}return{signers:n}}static async getPublicKey(e,r){let n=fr.extractDid(e),{didDocument:i}=await r.resolve(n),{verificationMethod:o=[]}=i||{},s;for(let c of o)if(e.endsWith(c.id)){s=c;break}if(!s)throw new Q("GeneralJwsVerifierGetPublicKeyNotFound","public key needed to verify signature not found in DID Document");a0("JwkVerificationMethod",s);let{publicKeyJwk:a}=s;return a}};p();var bo=class extends dn{static async parse(e){return await ie.validateMessageSignatureIntegrity(e.authorization.signature,e.descriptor),bo.validateScope(e),st.validateTimestamp(e.descriptor.messageTimestamp),st.validateTimestamp(e.descriptor.dateExpires),new bo(e)}static async create(e){let r={...e.scope};r.protocol=r.protocol!==void 0?Pa(r.protocol):void 0,r.schema=r.schema!==void 0?Hd(r.schema):void 0;let n={interface:"Permissions",method:"Grant",messageTimestamp:e.messageTimestamp??st.getCurrentTimestamp(),dateExpires:e.dateExpires,description:e.description,grantedTo:e.grantedTo,grantedBy:e.grantedBy,grantedFor:e.grantedFor,delegated:e.delegated,permissionsRequestId:e.permissionsRequestId,scope:r,conditions:e.conditions};Hn(n);let i=await ie.createAuthorization({descriptor:n,signer:e.signer}),o={descriptor:n,authorization:i};return ie.validateJsonSchema(o),bo.validateScope(o),new bo(o)}asDelegatedGrant(){return bo.asDelegatedGrant(this.message)}static asDelegatedGrant(e){if(!e.descriptor.delegated)throw new Q("PermissionsGrantNotADelegatedGrant",`PermissionsGrant given is not a delegated grant. Descriptor: ${e.descriptor}`);return e}static async createFromPermissionsRequest(e,r,n){let i=e.message.descriptor;return bo.create({dateExpires:n.dateExpires,description:n.description??i.description,grantedBy:n.grantedBy??i.grantedBy,grantedTo:n.grantedTo??i.grantedTo,grantedFor:n.grantedFor??i.grantedFor,permissionsRequestId:await ie.getCid(e.message),scope:n.scope??i.scope,conditions:n.conditions??i.conditions,signer:r})}authorize(){let{grantedBy:e,grantedFor:r}=this.message.descriptor;if(this.author!==e)throw new Q("PermissionsGrantGrantedByMismatch","Message author must match grantedBy property");if(e!==r)throw new Q("PermissionsGrantUnauthorizedGrant",`${e} is not authorized to give access to the DWN belonging to ${r}`)}static validateScope(e){let r=e.descriptor.scope;if(r.schema!==void 0&&(r.protocol!==void 0||r.contextId!==void 0||r.protocolPath))throw new Q("PermissionsGrantScopeSchemaProhibitedFields","PermissionsGrants for RecordsRead and RecordsWrite that have `schema` present may not also have protocol-related properties present");if(r.protocol!==void 0&&r.contextId!==void 0&&r.protocolPath!==void 0)throw new Q("PermissionsGrantScopeContextIdAndProtocolPath","PermissionsGrants for RecordsRead and RecordsWrite may not have both `contextId` and `protocolPath` present")}};var M7=class{static async authenticate(e,r){if(e===void 0)throw new Q("AuthenticateJwsMissing","Missing JWS.");if(await Ki.verifySignatures(e.signature,r),e.ownerSignature!==void 0&&await Ki.verifySignatures(e.ownerSignature,r),e.authorDelegatedGrant!==void 0){let n=await bo.parse(e.authorDelegatedGrant);await Ki.verifySignatures(n.message.authorization.signature,r)}}};async function hn(t,e){if(t===void 0)throw new Q("AuthenticateJwsMissing","Missing JWS.");if(await Ki.verifySignatures(t.signature,e),t.ownerSignature!==void 0&&await Ki.verifySignatures(t.ownerSignature,e),t.authorDelegatedGrant!==void 0){let r=await bo.parse(t.authorDelegatedGrant);await Ki.verifySignatures(r.message.authorization.signature,e)}}async function ry(t,e){if(e.author!==t)throw new Q("AuthorizationUnknownAuthor","message failed authorization, permission grant check not yet implemented")}var Hx=class{constructor(e,r){this.didResolver=e;this.eventLog=r}async handle({tenant:e,message:r}){let n;try{n=await Mu.parse(r)}catch(s){return at(s,400)}try{await hn(r.authorization,this.didResolver),await ry(e,n)}catch(s){return at(s,401)}let i;r.descriptor.watermark&&(i={gt:r.descriptor.watermark});let o=await this.eventLog.getEvents(e,i);return{status:{code:200,detail:"OK"},events:o}}};p();p();var pf=class extends dn{static async parse(e){return ie.validateJsonSchema(e),this.validateMessageCids(e.descriptor.messageCids),await ie.validateMessageSignatureIntegrity(e.authorization.signature,e.descriptor),st.validateTimestamp(e.descriptor.messageTimestamp),new pf(e)}static async create(e){let r={interface:"Messages",method:"Get",messageCids:e.messageCids,messageTimestamp:e?.messageTimestamp??st.getCurrentTimestamp()},n=await ie.createAuthorization({descriptor:r,signer:e.signer}),i={descriptor:r,authorization:n};return ie.validateJsonSchema(i),pf.validateMessageCids(e.messageCids),new pf(i)}static validateMessageCids(e){for(let r of e)try{Wr.parseCid(r)}catch{throw new Q("MessageGetInvalidCid",`${r} is not a valid CID`)}}};var Wx=class{constructor(e,r,n){this.didResolver=e;this.messageStore=r;this.dataStore=n}async handle({tenant:e,message:r}){let n;try{n=await pf.parse(r)}catch(a){return at(a,400)}try{await hn(r.authorization,this.didResolver),await ry(e,n)}catch(a){return at(a,401)}let i=[],o=new Set(r.descriptor.messageCids);for(let a of o){let c=this.messageStore.get(e,a).then(d=>({messageCid:a,message:d})).catch(d=>({messageCid:a,message:void 0,error:`Failed to get message ${a}`}));i.push(c)}let s=await Promise.all(i);for(let a of s){let{message:c}=a;if(!c)continue;let{interface:d,method:f}=c.descriptor;if(d!=="Records"||f!=="Write")continue;let u=c;u.encodedData!==void 0&&(a.encodedData=u.encodedData,delete u.encodedData)}return{status:{code:200,detail:"OK"},messages:s}}};p();var Vx=class{constructor(e,r,n){this.didResolver=e;this.messageStore=r;this.eventLog=n}async handle({tenant:e,message:r}){let n;try{n=await bo.parse(r)}catch(f){return at(f,400)}try{await hn(r.authorization,this.didResolver),await n.authorize()}catch(f){return at(f,401)}let{scope:i,conditions:o,...s}=r.descriptor,a={author:n.author,...s},c=await ie.getCid(r);return await this.messageStore.get(e,c)===void 0&&(await this.messageStore.put(e,r,a),await this.eventLog.append(e,c)),{status:{code:202,detail:"Accepted"}}}};p();p();var ku=class extends dn{static async parse(e){return await ie.validateMessageSignatureIntegrity(e.authorization.signature,e.descriptor),st.validateTimestamp(e.descriptor.messageTimestamp),new ku(e)}static async create(e){let r={interface:"Permissions",method:"Request",messageTimestamp:e.messageTimestamp??st.getCurrentTimestamp(),description:e.description,grantedTo:e.grantedTo,grantedBy:e.grantedBy,grantedFor:e.grantedFor,scope:e.scope,conditions:e.conditions};Hn(r);let n=await ie.createAuthorization({descriptor:r,signer:e.signer}),i={descriptor:r,authorization:n};return ie.validateJsonSchema(i),new ku(i)}};var Kx=class{constructor(e,r,n){this.didResolver=e;this.messageStore=r;this.eventLog=n}async handle({tenant:e,message:r}){let n;try{n=await ku.parse(r)}catch(f){return at(f,400)}try{await hn(r.authorization,this.didResolver)}catch(f){return at(f,401)}let{scope:i,conditions:o,...s}=r.descriptor,a={...s,author:n.author},c=await ie.getCid(r);return await this.messageStore.get(e,c)===void 0&&(await this.messageStore.put(e,r,a),await this.eventLog.append(e,c)),{status:{code:202,detail:"Accepted"}}}};p();p();var Bu=class extends dn{static async parse(e){return await ie.validateMessageSignatureIntegrity(e.authorization.signature,e.descriptor),st.validateTimestamp(e.descriptor.messageTimestamp),new Bu(e)}static async create(e){let r={interface:"Permissions",method:"Revoke",messageTimestamp:e.messageTimestamp??st.getCurrentTimestamp(),permissionsGrantId:e.permissionsGrantId},n=await ie.createAuthorization({descriptor:r,signer:e.signer}),i={descriptor:r,authorization:n};return ie.validateJsonSchema(i),new Bu(i)}async authorize(e){if(this.author!==e.descriptor.grantedFor)throw new Q("PermissionsRevokeUnauthorizedRevoke","Only the DWN owner may revoke a grant")}};var Zx=class{constructor(e,r,n){this.didResolver=e;this.messageStore=r;this.eventLog=n}async handle({tenant:e,message:r}){let n;try{n=await Bu.parse(r)}catch(v){return at(v,400)}try{await hn(r.authorization,this.didResolver)}catch(v){return at(v,401)}let i=r.descriptor.permissionsGrantId,o=await this.messageStore.get(e,i);if(o===void 0)return{status:{code:400,detail:`Could not find PermissionsGrant with CID ${i}`}};try{await n.authorize(o)}catch(v){return at(v,401)}if(r.descriptor.messageTimestamp<o.descriptor.messageTimestamp)return{status:{code:400,detail:"PermissionsRevoke has earlier date than associated PermissionsGrant"}};let s={interface:"Permissions",method:"Revoke",permissionsGrantId:i},{messages:a}=await this.messageStore.query(e,[s]),c=await ie.getOldestMessage(a);if(c!==void 0&&!await ie.isOlder(r,c))return{status:{code:409,detail:"Conflict"}};let d={interface:"Permissions",method:"Revoke",permissionsGrantId:r.descriptor.permissionsGrantId};await this.messageStore.put(e,r,d),await this.eventLog.append(e,await ie.getCid(r));let f=[];for(let v of a){let A=await ie.getCid(v);await this.messageStore.delete(e,A),f.push(A)}await this.eventLog.deleteEventsByCid(e,f);let u={permissionsGrantId:i,dateCreated:{gte:r.descriptor.messageTimestamp}},{messages:m}=await this.messageStore.query(e,[u]),_=[];for(let v of m){let A=await ie.getCid(v);await this.messageStore.delete(e,A)}return this.eventLog.deleteEventsByCid(e,_),{status:{code:202,detail:"Accepted"}}}};p();p();p();var qo=class extends dn{static async parse(e){return ie.validateJsonSchema(e),qo.validateProtocolDefinition(e.descriptor.definition),await ie.validateMessageSignatureIntegrity(e.authorization.signature,e.descriptor),st.validateTimestamp(e.descriptor.messageTimestamp),new qo(e)}static async create(e){let r={interface:"Protocols",method:"Configure",messageTimestamp:e.messageTimestamp??st.getCurrentTimestamp(),definition:qo.normalizeDefinition(e.definition)},n=await ie.createAuthorization({descriptor:r,signer:e.signer,permissionsGrantId:e.permissionsGrantId}),i={descriptor:r,authorization:n};return ie.validateJsonSchema(i),qo.validateProtocolDefinition(i.descriptor.definition),new qo(i)}static validateProtocolDefinition(e){let{protocol:r,types:n}=e;hu(r);for(let i in n){let o=n[i].schema;o!==void 0&&xm(o)}qo.validateStructure(e)}static validateStructure(e){let r=[];for(let n in e.structure)e.structure[n].$globalRole&&r.push(n);for(let n in e.structure){let i=e.structure[n],o=[];for(let s in i){if(s.startsWith("$"))continue;i[s].$contextRole&&o.push(`${n}/${s}`)}qo.validateRuleSet(i,n,[...r,...o])}}static validateRuleSet(e,r,n){let i=r.split("/").length;if(e.$globalRole&&i!==1)throw new Q("ProtocolsConfigureGlobalRoleAtProhibitedProtocolPath",`$globalRole is not allowed at protocol path (${r}). Only root records may set $globalRole true.`);if(e.$contextRole&&i!==2)throw new Q("ProtocolsConfigureContextRoleAtProhibitedProtocolPath",`$contextRole is not allowed at protocol path (${r}). Only second-level records may set $contextRole true.`);let o=e.$actions??[];for(let s of o){if(s.role!==void 0&&!n.includes(s.role))throw new Q("ProtocolsConfigureInvalidRole",`Invalid role '${s.role}' found at protocol path '${r}'`);if(s.who==="anyone"&&s.of)throw new Q("ProtocolsConfigureInvalidActionOfNotAllowed",`'of' is not allowed at protocol path (${r})`);if(s.who==="recipient"&&s.of===void 0&&!["update","delete"].includes(s.can))throw new Q("ProtocolsConfigureInvalidRecipientOfAction","Rules for `recipient` without `of` property must have `can` === `delete` or `update`");if(s.who==="author"&&!s.of)throw new Q("ProtocolsConfigureInvalidActionMissingOf","'of' is required when 'author' is specified as 'who'")}for(let s in e){if(s.startsWith("$"))continue;let a=e[s],c=`${r}/${s}`;qo.validateRuleSet(a,c,n)}}static normalizeDefinition(e){let r={...e.types};for(let n in r){let i=r[n].schema;i!==void 0&&(r[n].schema=Hd(i))}return{...e,protocol:Pa(e.protocol),types:r}}};var ny=class{constructor(e,r,n,i){this.didResolver=e;this.messageStore=r;this.dataStore=n;this.eventLog=i}async handle({tenant:e,message:r,dataStream:n}){let i;try{i=await qo.parse(r)}catch(u){return at(u,400)}try{await hn(r.authorization,this.didResolver),await ry(e,i)}catch(u){return at(u,401)}let o={interface:"Protocols",method:"Configure",protocol:r.descriptor.definition.protocol},{messages:s}=await this.messageStore.query(e,[o]),a=await ie.getNewestMessage(s),c=!1;(a===void 0||await ie.isNewer(r,a))&&(c=!0,a=r);let d;if(c){let u=ny.constructProtocolsConfigureIndexes(i),m=await ie.getCid(r);await this.messageStore.put(e,r,u),await this.eventLog.append(e,m),d={status:{code:202,detail:"Accepted"}}}else d={status:{code:409,detail:"Conflict"}};let f=[];for(let u of s)if(await ie.isNewer(a,u)){let m=await ie.getCid(u);f.push(m),await this.messageStore.delete(e,m)}return await this.eventLog.deleteEventsByCid(e,f),d}static constructProtocolsConfigureIndexes(e){let{definition:r,...n}=e.message.descriptor,{author:i}=e;return{...n,author:i,protocol:r.protocol,published:r.published}}};p();p();p();var Zi=class{static async authorizeGenericMessage(e,r,n,i,o){let s=r.descriptor,a=await ie.getCid(i);Zi.verifyGrantedToAndGrantedFor(n,e,i),await Zi.verifyGrantActive(e,s.messageTimestamp,i,a,o),await Zi.verifyGrantScopeInterfaceAndMethod(s.interface,s.method,i,a)}static async fetchGrant(e,r,n){let i=await r.get(e,n),o=i?.descriptor.interface,s=i?.descriptor.method;if(i===void 0||o!=="Permissions"||s!=="Grant")throw new Q("GrantAuthorizationGrantMissing",`Could not find PermissionsGrant with CID ${n}`);return i}static verifyGrantedToAndGrantedFor(e,r,n){let i=n.descriptor.grantedTo;if(i!==e)throw new Q("GrantAuthorizationNotGrantedToAuthor",`PermissionsGrant has grantedTo ${i}, but given ${e}`);let o=n.descriptor.grantedFor;if(o!==r)throw new Q("GrantAuthorizationNotGrantedForTenant",`PermissionsGrant has grantedFor ${o}, but given ${r}`)}static async verifyGrantActive(e,r,n,i,o){if(r<n.descriptor.messageTimestamp)throw new Q("GrantAuthorizationGrantNotYetActive","The message has a timestamp before the associated PermissionsGrant becomes active");if(r>=n.descriptor.dateExpires)throw new Q("GrantAuthorizationGrantExpired","The message has timestamp after the expiry of the associated PermissionsGrant");let s={interface:"Permissions",method:"Revoke",permissionsGrantId:i},{messages:a}=await o.query(e,[s]),c=await ie.getOldestMessage(a);if(c!==void 0&&c.descriptor.messageTimestamp<=r)throw new Q("GrantAuthorizationGrantRevoked",`PermissionsGrant with CID ${i} has been revoked`)}static async verifyGrantScopeInterfaceAndMethod(e,r,n,i){if(e!==n.descriptor.scope.interface)throw new Q("GrantAuthorizationInterfaceMismatch",`DWN Interface of incoming message is outside the scope of PermissionsGrant with CID ${i}`);if(r!==n.descriptor.scope.method)throw new Q("GrantAuthorizationMethodMismatch",`DWN Method of incoming message is outside the scope of PermissionsGrant with CID ${i}`)}};var mf=class extends dn{static async parse(e){return e.authorization!==void 0&&await ie.validateMessageSignatureIntegrity(e.authorization.signature,e.descriptor),e.descriptor.filter!==void 0&&hu(e.descriptor.filter.protocol),st.validateTimestamp(e.descriptor.messageTimestamp),new mf(e)}static async create(e){let r={interface:"Protocols",method:"Query",messageTimestamp:e.messageTimestamp??st.getCurrentTimestamp(),filter:mf.normalizeFilter(e.filter)};Hn(r);let n;e.signer!==void 0&&(n=await ie.createAuthorization({descriptor:r,signer:e.signer,permissionsGrantId:e.permissionsGrantId}));let i={descriptor:r,authorization:n};return ie.validateJsonSchema(i),new mf(i)}static normalizeFilter(e){if(e!==void 0)return{...e,protocol:Pa(e.protocol)}}async authorize(e,r){if(this.author!==e)if(this.author!==void 0&&this.signaturePayload.permissionsGrantId){let n=await Zi.fetchGrant(e,r,this.signaturePayload.permissionsGrantId);await Zi.authorizeGenericMessage(e,this.message,this.author,n,r)}else throw new Q("ProtocolsQueryUnauthorized","The ProtocolsQuery failed authorization")}};var Yx=class{constructor(e,r,n){this.didResolver=e;this.messageStore=r;this.dataStore=n}async handle({tenant:e,message:r}){let n;try{n=await mf.parse(r)}catch(s){return at(s,400)}try{await hn(r.authorization,this.didResolver),await n.authorize(e,this.messageStore)}catch(s){if(s.code==="AuthenticateJwsMissing"||s.code==="ProtocolsQueryUnauthorized"){let a=await this.fetchPublishedProtocolsConfigure(e,n);return{status:{code:200,detail:"OK"},entries:a}}else return at(s,401)}let i={...r.descriptor.filter,interface:"Protocols",method:"Configure"};Hn(i);let{messages:o}=await this.messageStore.query(e,[i]);return{status:{code:200,detail:"OK"},entries:o}}async fetchPublishedProtocolsConfigure(e,r){let n={...r.message.descriptor.filter,interface:"Protocols",method:"Configure",published:!0},{messages:i}=await this.messageStore.query(e,[n]);return i}};p();p();p();p();p();var vo=class{static async authorizeWrite(e,r,n,i,o){await Zi.authorizeGenericMessage(e,r,n,i,o),vo.verifyScope(r,i),vo.verifyConditions(r,i)}static async authorizeRead(e,r,n,i,o,s){await Zi.authorizeGenericMessage(e,r.message,i,o,s),vo.verifyScope(n,o)}static verifyScope(e,r){let n=r.descriptor.scope;vo.isUnrestrictedScope(n)||(e.descriptor.protocol!==void 0?vo.authorizeProtocolRecord(e,n):vo.authorizeFlatRecord(e,n))}static authorizeProtocolRecord(e,r){if(r.protocol===void 0)throw new Q("RecordsGrantAuthorizationScopeNotProtocol","Grant for protocol record must specify protocol in its scope");if(r.protocol!==e.descriptor.protocol)throw new Q("RecordsGrantAuthorizationScopeProtocolMismatch","Grant scope specifies different protocol than what appears in the record");if(r.contextId!==void 0&&r.contextId!==e.contextId)throw new Q("RecordsGrantAuthorizationScopeContextIdMismatch","Grant scope specifies different contextId than what appears in the record");if(r.protocolPath!==void 0&&r.protocolPath!==e.descriptor.protocolPath)throw new Q("RecordsGrantAuthorizationScopeProtocolPathMismatch","Grant scope specifies different protocolPath than what appears in the record")}static authorizeFlatRecord(e,r){if(r.schema!==void 0&&r.schema!==e.descriptor.schema)throw new Q("RecordsGrantAuthorizationScopeSchema",`Record does not have schema in PermissionsGrant scope with schema '${r.schema}'`)}static verifyConditions(e,r){let n=r.descriptor.conditions;if(n?.publication==="Required"&&!e.descriptor.published)throw new Q("RecordsGrantAuthorizationConditionPublicationRequired","PermissionsGrant requires message to be published");if(n?.publication==="Prohibited"&&e.descriptor.published)throw new Q("RecordsGrantAuthorizationConditionPublicationProhibited","PermissionsGrant prohibits message from being published")}static isUnrestrictedScope(e){return e.protocol===void 0&&e.schema===void 0}};var tr=class{get message(){if(this._message.authorization===void 0)throw new Q("RecordsWriteMissingSigner","This RecordsWrite is not yet signed, JSON message cannot be generated from an incomplete state.");return this._message}get author(){return this._author}get signaturePayload(){return this._signaturePayload}get owner(){return this._owner}get ownerSignaturePayload(){return this._ownerSignaturePayload}get isSignedByDelegatee(){return this._message.authorization?.authorDelegatedGrant!==void 0}get signer(){return ie.getSigner(this._message)}constructor(e){this._message=e,e.authorization!==void 0&&(e.authorization.authorDelegatedGrant!==void 0?this._author=ie.getSigner(e.authorization.authorDelegatedGrant):this._author=ie.getSigner(e),this._signaturePayload=fr.decodePlainObjectPayload(e.authorization.signature),e.authorization.ownerSignature!==void 0&&(this._owner=fr.getSignerDid(e.authorization.ownerSignature.signatures[0]),this._ownerSignaturePayload=fr.decodePlainObjectPayload(e.authorization.ownerSignature))),this.attesters=tr.getAttesters(e)}static async parse(e){await ie.validateMessageSignatureIntegrity(e.authorization.signature,e.descriptor,"RecordsWriteSignaturePayload"),e.authorization.ownerSignature!==void 0&&await ie.validateMessageSignatureIntegrity(e.authorization.ownerSignature,e.descriptor),await tr.validateAttestationIntegrity(e);let r=new tr(e);return await r.validateIntegrity(),r}static async create(e){if(e.protocol===void 0&&e.protocolPath!==void 0||e.protocol!==void 0&&e.protocolPath===void 0)throw new Q("RecordsWriteCreateProtocolAndProtocolPathMutuallyInclusive","`protocol` and `protocolPath` must both be defined or undefined at the same time");if(e.data===void 0&&e.dataCid===void 0||e.data!==void 0&&e.dataCid!==void 0)throw new Q("RecordsWriteCreateDataAndDataCidMutuallyExclusive","one and only one parameter between `data` and `dataCid` is allowed");if(e.dataCid===void 0&&e.dataSize!==void 0||e.dataCid!==void 0&&e.dataSize===void 0)throw new Q("RecordsWriteCreateDataCidAndDataSizeMutuallyInclusive","`dataCid` and `dataSize` must both be defined or undefined at the same time");if(e.parentId!==void 0&&e.contextId===void 0)throw new Q("RecordsWriteCreateContextIdAndParentIdMutuallyInclusive","`contextId` must also be given when `parentId` is specified");if(e.signer===void 0&&e.delegatedGrant!==void 0)throw new Q("RecordsWriteCreateMissingSigner","`signer` must be given when `delegatedGrant` is given");let r=e.dataCid??await Wr.computeDagPbCidFromBytes(e.data),n=e.dataSize??e.data.length,i=st.getCurrentTimestamp(),o={interface:"Records",method:"Write",protocol:e.protocol!==void 0?Pa(e.protocol):void 0,protocolPath:e.protocolPath,recipient:e.recipient,schema:e.schema!==void 0?Hd(e.schema):void 0,parentId:e.parentId,dataCid:r,dataSize:n,dateCreated:e.dateCreated??i,messageTimestamp:e.messageTimestamp??i,published:e.published,datePublished:e.datePublished,dataFormat:e.dataFormat};e.published===!0&&e.datePublished===void 0&&(o.datePublished=i),Hn(o);let s=e.recordId,a=e.contextId,c=await Wr.computeCid(o),d=await tr.createAttestation(c,e.attestationSigners),f=await tr.createEncryptionProperty(o,e.encryptionInput),u={recordId:s,descriptor:o};a!==void 0&&(u.contextId=a),d!==void 0&&(u.attestation=d),f!==void 0&&(u.encryption=f);let m=new tr(u);return e.signer!==void 0&&await m.sign({signer:e.signer,delegatedGrant:e.delegatedGrant,permissionsGrantId:e.permissionsGrantId,protocolRole:e.protocolRole}),m}static async createFrom(e){let r=e.recordsWriteMessage,n=st.getCurrentTimestamp(),i=e.published??(e.datePublished?!0:r.descriptor.published),o;e.datePublished?o=e.datePublished:i&&(r.descriptor.published?o=r.descriptor.datePublished:o=n);let s={recipient:r.descriptor.recipient,recordId:r.recordId,dateCreated:r.descriptor.dateCreated,contextId:r.contextId,protocol:r.descriptor.protocol,protocolPath:r.descriptor.protocolPath,parentId:r.descriptor.parentId,schema:r.descriptor.schema,dataFormat:r.descriptor.dataFormat,messageTimestamp:e.messageTimestamp??n,published:i,datePublished:o,data:e.data,dataCid:e.data?void 0:r.descriptor.dataCid,dataSize:e.data?void 0:r.descriptor.dataSize,protocolRole:e.protocolRole,delegatedGrant:e.delegatedGrant,signer:e.signer,attestationSigners:e.attestationSigners};return await tr.create(s)}toJSON(){return this.message}async encryptSymmetricEncryptionKey(e){this._message.encryption=await tr.createEncryptionProperty(this._message.descriptor,e),delete this._message.authorization,this._signaturePayload=void 0,this._author=void 0}async sign(e){let{signer:r,delegatedGrant:n,permissionsGrantId:i,protocolRole:o}=e,s,a;n!==void 0?(s=await ie.getCid(n),a=fr.getSignerDid(n.authorization.signature.signatures[0])):a=fr.extractDid(r.keyId);let c=this._message.descriptor,d=await Wr.computeCid(c);this._message.recordId=this._message.recordId??await tr.getEntryId(a,c),this._message.contextId===void 0&&this._message.descriptor.protocol!==void 0&&(this._message.contextId=await tr.getEntryId(a,c));let f=await tr.createSignerSignature({recordId:this._message.recordId,contextId:this._message.contextId,descriptorCid:d,attestation:this._message.attestation,encryption:this._message.encryption,signer:r,delegatedGrantId:s,permissionsGrantId:i,protocolRole:o});this._message.authorization={signature:f},n!==void 0&&(this._message.authorization.authorDelegatedGrant=n),this._signaturePayload=fr.decodePlainObjectPayload(f),this._author=a}async signAsOwner(e,r){if(this._author===void 0)throw new Q("RecordsWriteSignAsOwnerUnknownAuthor","Unable to sign as owner if without message signature because owner needs to sign over `recordId` which depends on author DID.");let n=this._message.descriptor,i=await ie.createSignature(n,e,{permissionsGrantId:r});this._message.authorization.ownerSignature=i,this._ownerSignaturePayload=fr.decodePlainObjectPayload(i),this._owner=fr.extractDid(e.keyId)}async validateIntegrity(){if(await this.isInitialWrite()){let n=this.message.descriptor.dateCreated,i=this.message.descriptor.messageTimestamp;if(i!==n)throw new Q("RecordsWriteValidateIntegrityDateCreatedMismatch",`messageTimestamp ${i} must match dateCreated ${n} for the initial write`);if(this.message.descriptor.protocol!==void 0&&this.message.descriptor.parentId===void 0){let o=await this.getEntryId();if(this.message.contextId!==o)throw new Q("RecordsWriteValidateIntegrityContextIdMismatch",`contextId in message: ${this.message.contextId} does not match deterministic contextId: ${o}`)}}let r=this.signaturePayload;if(this.message.recordId!==r.recordId)throw new Q("RecordsWriteValidateIntegrityRecordIdUnauthorized",`recordId in message ${this.message.recordId} does not match recordId in authorization: ${r.recordId}`);if(this.message.contextId!==r.contextId)throw new Q("RecordsWriteValidateIntegrityContextIdNotInSignerSignaturePayload",`contextId in message ${this.message.contextId} does not match contextId in authorization: ${r.contextId}`);if(ur.validateDelegatedGrantReferentialIntegrity(this.message,r),r.attestationCid!==void 0){let n=await Wr.computeCid(this.message.attestation),i=r.attestationCid;if(i!==n)throw new Q("RecordsWriteValidateIntegrityAttestationMismatch",`CID ${n} of attestation property in message does not match attestationCid in authorization: ${i}`)}if(r.encryptionCid!==void 0){let n=await Wr.computeCid(this.message.encryption),i=r.encryptionCid;if(i!==n)throw new Q("RecordsWriteValidateIntegrityEncryptionCidMismatch",`CID ${n} of encryption property in message does not match encryptionCid in authorization: ${i}`)}this.message.descriptor.protocol!==void 0&&hu(this.message.descriptor.protocol),this.message.descriptor.schema!==void 0&&xm(this.message.descriptor.schema),st.validateTimestamp(this.message.descriptor.messageTimestamp),st.validateTimestamp(this.message.descriptor.dateCreated),this.message.descriptor.datePublished&&st.validateTimestamp(this.message.descriptor.datePublished)}static async validateAttestationIntegrity(e){if(e.attestation===void 0)return;if(e.attestation.signatures.length!==1)throw new Q("RecordsWriteAttestationIntegrityMoreThanOneSignature",`Currently implementation only supports 1 attester, but got ${e.attestation.signatures.length}`);let r=fr.decodePlainObjectPayload(e.attestation),{descriptorCid:n}=r,i=await Wr.computeCid(e.descriptor);if(n!==i)throw new Q("RecordsWriteAttestationIntegrityDescriptorCidMismatch",`descriptorCid ${n} does not match expected descriptorCid ${i}`);let o=Object.keys(r).length;if(o>1)throw new Q("RecordsWriteAttestationIntegrityInvalidPayloadProperty",`Only 'descriptorCid' is allowed in attestation payload, but got ${o} properties.`)}async getEntryId(){return await tr.getEntryId(this.author,this.message.descriptor)}static async getEntryId(e,r){if(e===void 0)throw new Q("RecordsWriteGetEntryIdUndefinedAuthor","Property `author` is needed to compute entry ID.");let n={...r};return n.author=e,await Wr.computeCid(n)}async isInitialWrite(){return await this.getEntryId()===this.message.recordId}async isAuthoredByInitialRecordAuthor(e,r){let n={entryId:this.message.recordId},{messages:i}=await r.query(e,[n]);return(await tr.parse(i[0])).author===this.author}async constructRecordsWriteIndexes(e){let r=this.message,n={...r.descriptor};delete n.published;let i={...n,isLatestBaseState:e,published:!!r.descriptor.published,author:this.author,recordId:r.recordId,entryId:await tr.getEntryId(this.author,this.message.descriptor)};return this.attesters.length>0&&(i.attester=this.attesters[0]),r.contextId!==void 0&&(i.contextId=r.contextId),i}async authorizeDelegatee(e){let r=this.signer,n=this.author,i=this.message.authorization.authorDelegatedGrant;await vo.authorizeWrite(n,this.message,r,i,e)}static async isInitialWrite(e){if(e.descriptor.interface!=="Records"||e.descriptor.method!=="Write")return!1;let r=e,n=tr.getAuthor(r);return await tr.getEntryId(n,r.descriptor)===r.recordId}static getAuthor(e){let r;return e.authorization.authorDelegatedGrant!==void 0?r=ie.getSigner(e.authorization.authorDelegatedGrant):r=ie.getSigner(e),r}static async createEncryptionProperty(e,r){if(r===void 0)return;let n=[];for(let o of r.keyEncryptionInputs){if(o.derivationScheme==="protocolPath"&&e.protocol===void 0)throw new Q("RecordsWriteMissingProtocol","`protocols` encryption scheme cannot be applied to record without the `protocol` property.");if(o.derivationScheme==="schemas"&&e.schema===void 0)throw new Q("RecordsWriteMissingSchema","`schemas` encryption scheme cannot be applied to record without the `schema` property.");let s=qt.publicJwkToBytes(o.publicKey),a=await Bc.eciesSecp256k1Encrypt(s,r.key),c=Be.bytesToBase64Url(a.ciphertext),d=await qt.publicKeyToJwk(a.ephemeralPublicKey),f=Be.bytesToBase64Url(a.initializationVector),u=Be.bytesToBase64Url(a.messageAuthenticationCode),m={rootKeyId:o.publicKeyId,algorithm:o.algorithm??"ECIES-ES256K",derivationScheme:o.derivationScheme,ephemeralPublicKey:d,initializationVector:f,messageAuthenticationCode:u,encryptedKey:c};o.derivationScheme==="protocolContext"&&(m.derivedPublicKey=o.publicKey),n.push(m)}return{algorithm:r.algorithm??"A256CTR",initializationVector:Be.bytesToBase64Url(r.initializationVector),keyEncryption:n}}static async createAttestation(e,r){if(r===void 0||r.length===0)return;let n={descriptorCid:e},i=Be.objectToBytes(n);return(await md.create(i,r)).getJws()}static async createSignerSignature(e){let{recordId:r,contextId:n,descriptorCid:i,attestation:o,encryption:s,signer:a,delegatedGrantId:c,permissionsGrantId:d,protocolRole:f}=e,u=o?await Wr.computeCid(o):void 0,m=s?await Wr.computeCid(s):void 0,_={recordId:r,descriptorCid:i,contextId:n,attestationCid:u,encryptionCid:m,delegatedGrantId:c,permissionsGrantId:d,protocolRole:f};Hn(_);let v=Be.objectToBytes(_);return(await md.create(v,[a])).getJws()}static async getInitialWrite(e){for(let r of e)if(await tr.isInitialWrite(r))return r;throw new Q("RecordsWriteGetInitialWriteNotFound","initial write is not found")}static verifyEqualityOfImmutableProperties(e,r){let n=["dataCid","dataSize","datePublished","published","messageTimestamp"],i=[];i.push(...Object.keys(e.descriptor)),i.push(...Object.keys(r.descriptor)),i=[...new Set(i)];for(let o of i)if(n.indexOf(o)===-1){let s=e.descriptor[o],a=r.descriptor[o];if(a!==s)throw new Q("RecordsWriteImmutablePropertyChanged",`${o} is an immutable property: cannot change '${s}' to '${a}'`)}return!0}static getAttesters(e){return(e.attestation?.signatures??[]).map(i=>fr.getSignerDid(i))}};var nt=class{static async validateReferentialIntegrity(e,r,n){let i=await nt.fetchProtocolDefinition(e,r.message.descriptor.protocol,n);nt.verifyType(r.message,i.types),await nt.verifyProtocolPath(e,r,n);let o=nt.getRuleSet(r.message.descriptor.protocolPath,i);await nt.verifyUniqueRoleRecipient(e,r,o,n)}static async authorizeWrite(e,r,n){let i=await nt.constructAncestorMessageChain(e,r,r,n),o=await nt.fetchProtocolDefinition(e,r.message.descriptor.protocol,n),s=nt.getRuleSet(r.message.descriptor.protocolPath,o);await nt.verifyInvokedRole(e,r,r.message.descriptor.protocol,r.message.contextId,o,n),await nt.verifyAllowedActions(e,r,s,i,n)}static async authorizeRead(e,r,n,i){let o=await nt.constructAncestorMessageChain(e,r,n,i),s=await nt.fetchProtocolDefinition(e,n.message.descriptor.protocol,i),a=nt.getRuleSet(n.message.descriptor.protocolPath,s);await nt.verifyInvokedRole(e,r,n.message.descriptor.protocol,n.message.contextId,s,i),await nt.verifyAllowedActions(e,r,a,o,i)}static async authorizeQuery(e,r,n){let{protocol:i,protocolPath:o,contextId:s}=r.message.descriptor.filter,a=await nt.fetchProtocolDefinition(e,i,n),c=nt.getRuleSet(o,a);await nt.verifyInvokedRole(e,r,i,s,a,n),await nt.verifyAllowedActions(e,r,c,[],n)}static async authorizeDelete(e,r,n,i){let o=await nt.constructAncestorMessageChain(e,r,n,i),s=await nt.fetchProtocolDefinition(e,n.message.descriptor.protocol,i),a=nt.getRuleSet(n.message.descriptor.protocolPath,s);await nt.verifyInvokedRole(e,r,n.message.descriptor.protocol,n.message.contextId,s,i),await nt.verifyAllowedActions(e,r,a,o,i)}static async fetchProtocolDefinition(e,r,n){let i={interface:"Protocols",method:"Configure",protocol:r},{messages:o}=await n.query(e,[i]);if(o.length===0)throw new Q("ProtocolAuthorizationProtocolNotFound",`unable to find protocol definition for ${r}`);return o[0].descriptor.definition}static async constructAncestorMessageChain(e,r,n,i){let o=[];r.message.descriptor.method!=="Write"&&o.push(n.message);let s=n.message.descriptor.protocol,a=n.message.contextId,c=n.message.descriptor.parentId;for(;c!==void 0;){let d={interface:"Records",method:"Write",protocol:s,contextId:a,recordId:c},{messages:f}=await i.query(e,[d]);if(f.length===0)throw new Q("ProtocolAuthorizationParentNotFound",`no parent found with ID ${c}`);let u=f[0];o.push(u),c=u.descriptor.parentId}return o.reverse()}static getRuleSet(e,r){let n=nt.getRuleSetAtProtocolPath(e,r);if(n===void 0)throw new Q("ProtocolAuthorizationMissingRuleSet",`No rule set defined for protocolPath ${e}`);return n}static async verifyProtocolPath(e,r,n){let i=r.message.descriptor.protocolPath,o=nt.getTypeName(i),s=r.message.descriptor.parentId;if(s===void 0){if(i!==o)throw new Q("ProtocolAuthorizationParentlessIncorrectProtocolPath",`Declared protocol path '${i}' is not valid for records with no parentId'.`)}else{let a=r.message.descriptor.protocol,c=r.message.contextId,d={interface:"Records",method:"Write",protocol:a,contextId:c,recordId:s},{messages:f}=await n.query(e,[d]),u=f[0]?.descriptor?.protocolPath,m=`${u}/${o}`;if(u===void 0||m!==i)throw new Q("ProtocolAuthorizationIncorrectProtocolPath",`Could not find matching parent record to verify declared protocol path '${i}'.`)}}static verifyType(e,r){let n=Object.keys(r),i=e.descriptor.protocolPath,o=nt.getTypeName(i);if(!n.includes(o))throw new Q("ProtocolAuthorizationInvalidType",`record with type ${o} not allowed in protocol`);let s=e.descriptor.protocolPath,a=nt.getTypeName(s),c=r[a],{schema:d}=e.descriptor;if(c.schema!==void 0&&c.schema!==d)throw new Q("ProtocolAuthorizationInvalidSchema",`type '${a}' must have schema '${c.schema}', instead has '${d}'`);let{dataFormat:f}=e.descriptor;if(c.dataFormats!==void 0&&!c.dataFormats.includes(f))throw new Q("ProtocolAuthorizationIncorrectDataFormat",`type '${a}' must have data format in (${c.dataFormats}), instead has '${f}'`)}static async verifyInvokedRole(e,r,n,i,o,s){let a=r.signaturePayload?.protocolRole;if(a===void 0)return;let c=nt.getRuleSetAtProtocolPath(a,o);if(c===void 0||!c.$globalRole&&!c.$contextRole)throw new Q("ProtocolAuthorizationNotARole",`Protocol path ${a} is not a valid protocolRole`);let d={interface:"Records",method:"Write",protocol:n,protocolPath:a,recipient:r.author,isLatestBaseState:!0};if(c.$contextRole){if(i===void 0)throw new Q("ProtocolAuthorizationMissingContextId","Could not verify $contextRole because contextId is missing");d.contextId=i}let{messages:f}=await s.query(e,[d]);if(f.length===0)throw new Q("ProtocolAuthorizationMissingRole",`No matching role found for protocol path ${a}`)}static async getActionsSeekingARuleMatch(e,r,n){switch(r.message.descriptor.method){case"Delete":return["delete"];case"Query":return["query"];case"Read":return["read"];case"Write":let i=r;return await i.isInitialWrite()?["write"]:await i.isAuthoredByInitialRecordAuthor(e,n)?["write","update"]:["update"]}}static async verifyAllowedActions(e,r,n,i,o){let s=r.message.descriptor.method,a=await nt.getActionsSeekingARuleMatch(e,r,o),c=r.author,d=n.$actions;if(d===void 0)throw new Q("ProtocolAuthorizationActionRulesNotFound",`no action rule defined for ${s}, ${c} is unauthorized`);let f=r.signaturePayload?.protocolRole;for(let u of d){if(!a.includes(u.can))continue;if(f!==void 0){if(u.role===f)return;continue}else if(u.who==="recipient"&&u.of===void 0&&c!==void 0){let _;if(r.message.descriptor.method==="Write"?_=r.message:_=i[i.length-1],_.descriptor.recipient===c)return}else{if(u.who==="anyone")return;if(c===void 0)continue}if(await nt.checkActor(c,u,i))return}throw new Q("ProtocolAuthorizationActionNotAllowed","inbound message action not allowed for author")}static async verifyUniqueRoleRecipient(e,r,n,i){let o=r;if(!n.$globalRole&&!n.$contextRole)return;let s=o.message.descriptor.recipient;if(s===void 0)throw new Q("ProtocolAuthorizationRoleMissingRecipient","Role records must have a recipient");let a=o.message.descriptor.protocolPath,c={interface:"Records",method:"Write",isLatestBaseState:!0,protocol:o.message.descriptor.protocol,protocolPath:a,recipient:s};n.$contextRole&&(c.contextId=o.message.contextId);let{messages:d}=await i.query(e,[c]);if(d.filter(m=>m.recordId!==o.message.recordId).length>0)throw n.$globalRole?new Q("ProtocolAuthorizationDuplicateGlobalRoleRecipient",`DID '${s}' is already recipient of a $globalRole record at protocol path '${a}`):new Q("ProtocolAuthorizationDuplicateContextRoleRecipient",`DID '${s}' is already recipient of a $contextRole record at protocol path '${a} in the same context`)}static getRuleSetAtProtocolPath(e,r){let n=e.split("/"),i=r.structure,o=0;for(;o<n.length;){let s=n[o],a=i[s];if(a===void 0)return;i=a,o++}return i}static async checkActor(e,r,n){let i=n.find(o=>o.descriptor.protocolPath===r.of);if(i===void 0)return!1;if(r.who==="recipient")return e===i.descriptor.recipient;{let o=(await tr.parse(i)).author;return e===o}}static getTypeName(e){return e.split("/").slice(-1)[0]}};p();var Du=class extends dn{static async parse(e){let r;return e.authorization!==void 0&&(r=await ie.validateMessageSignatureIntegrity(e.authorization.signature,e.descriptor)),ur.validateDelegatedGrantReferentialIntegrity(e,r),st.validateTimestamp(e.descriptor.messageTimestamp),new Du(e)}static async create(e){let r=e.recordId,n=st.getCurrentTimestamp(),i={interface:"Records",method:"Delete",recordId:r,messageTimestamp:e.messageTimestamp??n},o=await ie.createAuthorization({descriptor:i,signer:e.signer,protocolRole:e.protocolRole,delegatedGrant:e.delegatedGrant}),s={descriptor:i,authorization:o};return ie.validateJsonSchema(s),new Du(s)}};p();p();var Cu=class{};Cu.maxDataSizeAllowedToBeEncoded=5e4;var Ou=class{static async delete(e,r,n,i){let o=await ie.getCid(i);if(i.descriptor.method==="Write"&&i.descriptor.dataSize>Cu.maxDataSizeAllowedToBeEncoded){let s=i;await r.delete(n,o,s.descriptor.dataCid)}await e.delete(n,o)}static async deleteAllOlderMessagesButKeepInitialWrite(e,r,n,i,o,s){let a=[];for(let c of r){if(await ie.isOlder(c,n))if(await Ou.delete(i,o,e,c),await tr.isInitialWrite(c)){let u=await tr.parse(c),m=!1,_=await u.constructRecordsWriteIndexes(m),v=c;delete v.encodedData,await i.put(e,v,_)}else{let u=await ie.getCid(c);a.push(u)}await s.deleteEventsByCid(e,a)}}};var iy=class{constructor(e,r,n,i){this.didResolver=e;this.messageStore=r;this.dataStore=n;this.eventLog=i}async handle({tenant:e,message:r}){let n;try{n=await Du.parse(r)}catch(m){return at(m,400)}try{await hn(r.authorization,this.didResolver)}catch(m){return at(m,401)}let i={interface:"Records",recordId:r.descriptor.recordId},{messages:o}=await this.messageStore.query(e,[i]),s=await ie.getNewestMessage(o),a=!1,c;if(s===void 0||await ie.isNewer(r,s)?(a=!0,c=r):c=s,!a)return{status:{code:409,detail:"Conflict"}};if(s===void 0||s.descriptor.method==="Delete")return{status:{code:404,detail:"Not Found"}};try{await iy.authorizeRecordsDelete(e,n,await tr.parse(s),this.messageStore)}catch(m){return at(m,401)}let d=await H4e(e,n);await this.messageStore.put(e,r,d);let f=await ie.getCid(r);return await this.eventLog.append(e,f),await Ou.deleteAllOlderMessagesButKeepInitialWrite(e,o,c,this.messageStore,this.dataStore,this.eventLog),{status:{code:202,detail:"Accepted"}}}static async authorizeRecordsDelete(e,r,n,i){if(r.author!==e)if(n.message.descriptor.protocol!==void 0)await nt.authorizeDelete(e,r,n,i);else throw new Q("RecordsDeleteAuthorizationFailed","RecordsDelete message failed authorization")}};async function H4e(t,e){let n={...e.message.descriptor};return{author:e.author,...n}}p();p();var Jx=(r=>(r[r.Descending=-1]="Descending",r[r.Ascending=1]="Ascending",r))(Jx||{});var wo=class{constructor(e,r,n){this.didResolver=e;this.messageStore=r;this.dataStore=n}async handle({tenant:e,message:r}){let n;try{n=await Au.parse(r)}catch(s){return at(s,400)}let i,o;if(wo.filterIncludesPublishedRecords(n)&&n.author===void 0){let s=await this.fetchPublishedRecords(e,n);i=s.messages,o=s.cursor}else{try{await hn(r.authorization,this.didResolver),wo.shouldProtocolAuthorizeQuery(n)&&await nt.authorizeQuery(e,n,this.messageStore)}catch(s){return at(s,401)}if(n.author===e){let s=await this.fetchRecordsAsOwner(e,n);i=s.messages,o=s.cursor}else{let s=await this.fetchRecordsAsNonOwner(e,n);i=s.messages,o=s.cursor}}return{status:{code:200,detail:"OK"},entries:i,cursor:o}}convertDateSort(e){switch(e){case"createdAscending":return{dateCreated:1};case"createdDescending":return{dateCreated:-1};case"publishedAscending":return{datePublished:1};case"publishedDescending":return{datePublished:-1};default:return{dateCreated:1}}}async fetchRecordsAsOwner(e,r){let{dateSort:n,filter:i,pagination:o}=r.message.descriptor,s={...ur.convertFilter(i),interface:"Records",method:"Write",isLatestBaseState:!0},a=this.convertDateSort(n);return this.messageStore.query(e,[s],a,o)}async fetchRecordsAsNonOwner(e,r){let{dateSort:n,pagination:i}=r.message.descriptor,o=[];if(wo.filterIncludesPublishedRecords(r)&&o.push(wo.buildPublishedRecordsFilter(r)),wo.filterIncludesUnpublishedRecords(r)){o.push(wo.buildUnpublishedRecordsByQueryAuthorFilter(r));let a=r.message.descriptor.filter.recipient;(a===void 0||a===r.author)&&o.push(wo.buildUnpublishedRecordsForQueryAuthorFilter(r)),wo.shouldProtocolAuthorizeQuery(r)&&o.push(wo.buildUnpublishedProtocolAuthorizedRecordsFilter(r))}let s=this.convertDateSort(n);return this.messageStore.query(e,o,s,i)}async fetchPublishedRecords(e,r){let{dateSort:n,pagination:i}=r.message.descriptor,o=wo.buildPublishedRecordsFilter(r),s=this.convertDateSort(n);return this.messageStore.query(e,[o],s,i)}static buildPublishedRecordsFilter(e){return{...ur.convertFilter(e.message.descriptor.filter),interface:"Records",method:"Write",published:!0,isLatestBaseState:!0}}static buildUnpublishedRecordsForQueryAuthorFilter(e){return{...ur.convertFilter(e.message.descriptor.filter),interface:"Records",method:"Write",recipient:e.author,isLatestBaseState:!0,published:!1}}static buildUnpublishedProtocolAuthorizedRecordsFilter(e){return{...ur.convertFilter(e.message.descriptor.filter),interface:"Records",method:"Write",isLatestBaseState:!0,published:!1}}static buildUnpublishedRecordsByQueryAuthorFilter(e){return{...ur.convertFilter(e.message.descriptor.filter),author:e.author,interface:"Records",method:"Write",isLatestBaseState:!0,published:!1}}static shouldProtocolAuthorizeQuery(e){return e.signaturePayload.protocolRole!==void 0}static filterIncludesPublishedRecords(e){let{filter:r}=e.message.descriptor;return r.datePublished!==void 0||r.published!==!1}static filterIncludesUnpublishedRecords(e){let{filter:r}=e.message.descriptor;return r.datePublished===void 0&&r.published===void 0?!0:r.published===!1}};p();p();var ju=class extends dn{static async parse(e){let r;return e.authorization!==void 0&&(r=await ie.validateMessageSignatureIntegrity(e.authorization.signature,e.descriptor)),ur.validateDelegatedGrantReferentialIntegrity(e,r),st.validateTimestamp(e.descriptor.messageTimestamp),new ju(e)}static async create(e){let{filter:r,signer:n,permissionsGrantId:i,protocolRole:o}=e,s=st.getCurrentTimestamp(),a={interface:"Records",method:"Read",filter:ur.normalizeFilter(r),messageTimestamp:e.messageTimestamp??s};Hn(a);let c;n!==void 0&&(c=await ie.createAuthorization({descriptor:a,signer:n,permissionsGrantId:i,protocolRole:o,delegatedGrant:e.delegatedGrant}));let d={descriptor:a,authorization:c};return ie.validateJsonSchema(d),new ju(d)}};var oy=class{constructor(e,r,n){this.didResolver=e;this.messageStore=r;this.dataStore=n}async handle({tenant:e,message:r}){let n;try{n=await ju.parse(r)}catch(d){return at(d,400)}try{n.author!==void 0&&await hn(r.authorization,this.didResolver)}catch(d){return at(d,401)}let i={interface:"Records",isLatestBaseState:!0,...ur.convertFilter(r.descriptor.filter)},{messages:o}=await this.messageStore.query(e,[i]);if(o.length===0)return{status:{code:404,detail:"Not Found"}};if(o.length>1)return at(new Q("RecordsReadReturnedMultiple","Multiple records exist for the RecordsRead filter"),400);let s=o[0];try{await oy.authorizeRecordsRead(e,n,await tr.parse(s),this.messageStore)}catch(d){return at(d,401)}let a;if(s.encodedData!==void 0){let d=Be.base64UrlToBytes(s.encodedData);a=Ba.fromBytes(d),delete s.encodedData}else{let d=await ie.getCid(s),f=await this.dataStore.get(e,d,s.descriptor.dataCid);if(f?.dataStream===void 0)return{status:{code:404,detail:"Not Found"}};a=f.dataStream}return{status:{code:200,detail:"OK"},record:{...s,data:a}}}static async authorizeRecordsRead(e,r,n,i){let{descriptor:o}=n.message;if(r.author!==e){if(o.published===!0)return;if(r.author!==void 0&&r.author===o.recipient)return;if(r.author!==void 0&&r.signaturePayload.permissionsGrantId!==void 0){let s=await Zi.fetchGrant(e,i,r.signaturePayload.permissionsGrantId);await vo.authorizeRead(e,r,n.message,r.author,s,i)}else if(o.protocol!==void 0)await nt.authorizeRead(e,r,n,i);else throw new Q("RecordsReadAuthorizationFailed","message failed authorization")}}};p();var yf=class{constructor(e,r,n,i){this.didResolver=e;this.messageStore=r;this.dataStore=n;this.eventLog=i}async handle({tenant:e,message:r,options:n,dataStream:i}){let o;try{o=await tr.parse(r),r.descriptor.protocol!==void 0&&await nt.validateReferentialIntegrity(e,o,this.messageStore)}catch(M){return at(M,400)}try{await hn(r.authorization,this.didResolver),await yf.authorizeRecordsWrite(e,o,this.messageStore)}catch(M){return at(M,401)}let s={interface:"Records",recordId:r.recordId},{messages:a}=await this.messageStore.query(e,[s]),c=await ie.getCid(r);for(let M of a)if(await ie.getCid(M)===c)return{status:{code:202,detail:"Accepted"}};if(!await o.isInitialWrite())try{let M=await tr.getInitialWrite(a);tr.verifyEqualityOfImmutableProperties(M,r)}catch(M){return at(M,400)}let f=await ie.getNewestMessage(a),u=!1,m;if(f===void 0||await ie.isNewer(r,f)?(u=!0,m=r):m=f,!u)return{status:{code:409,detail:"Conflict"}};let _=!0,v=await o.constructRecordsWriteIndexes(_),A=r;if(n===void 0||!n.skipDataStorage){if(i===void 0&&f?.descriptor.method==="Delete")return at(new Q("RecordsWriteMissingDataStream","No data stream was provided with the previous message being a delete"),400);try{r.descriptor.dataSize<=Cu.maxDataSizeAllowedToBeEncoded?A=await this.processEncodedData(r,i,f):await this.putData(e,r,i)}catch(M){let D=M;if(D.code==="RecordsWriteMissingDataInPrevious"||D.code==="RecordsWriteMissingDataAssociation"||D.code==="RecordsWriteDataCidMismatch"||D.code==="RecordsWriteDataSizeMismatch")return at(M,400);throw M}}await this.messageStore.put(e,A,v),await this.eventLog.append(e,await ie.getCid(r));let T={status:{code:202,detail:"Accepted"}};return await Ou.deleteAllOlderMessagesButKeepInitialWrite(e,a,m,this.messageStore,this.dataStore,this.eventLog),T}async processEncodedData(e,r,n){let i;if(r===void 0){let a=n;if(a?.encodedData===void 0)throw new Q("RecordsWriteMissingDataInPrevious","No dataStream was provided and unable to get data from previous message");i=Be.base64UrlToBytes(a.encodedData)}else i=await Ba.toBytes(r);let o=await Wr.computeDagPbCidFromBytes(i);yf.validateDataIntegrity(e.descriptor.dataCid,e.descriptor.dataSize,o,i.length);let s={...e};return s.encodedData=Be.bytesToBase64Url(i),s}async putData(e,r,n){let i,o=await ie.getCid(r);if(n===void 0){let s=await this.dataStore.associate(e,o,r.descriptor.dataCid);if(s===void 0)throw new Q("RecordsWriteMissingDataAssociation",`Unable to associate dataCid ${r.descriptor.dataCid} to messageCid ${o} because dataStream was not provided and data was not found in dataStore`);i=s}else i=await this.dataStore.put(e,o,r.descriptor.dataCid,n);try{yf.validateDataIntegrity(r.descriptor.dataCid,r.descriptor.dataSize,i.dataCid,i.dataSize)}catch(s){throw await this.dataStore.delete(e,o,r.descriptor.dataCid),s}}static validateDataIntegrity(e,r,n,i){if(e!==n)throw new Q("RecordsWriteDataCidMismatch",`actual data CID ${n} does not match dataCid in descriptor: ${e}`);if(r!==i)throw new Q("RecordsWriteDataSizeMismatch",`actual data size ${i} bytes does not match dataSize in descriptor: ${r}`)}static async authorizeRecordsWrite(e,r,n){if(r.owner!==void 0&&r.owner!==e)throw new Q("RecordsWriteOwnerAndTenantMismatch",`Owner ${r.owner} must be the same as tenant ${e} when specified.`);if(r.isSignedByDelegatee&&await r.authorizeDelegatee(n),r.owner===void 0){if(r.author===e)return;if(r.author!==void 0&&r.signaturePayload.permissionsGrantId!==void 0){let i=await Zi.fetchGrant(e,n,r.signaturePayload.permissionsGrantId);await vo.authorizeWrite(e,r.message,r.author,i,n)}else if(r.message.descriptor.protocol!==void 0)await nt.authorizeWrite(e,r,n);else throw new Q("RecordsWriteAuthorizationFailed","message failed authorization")}}};var Kv=class{constructor(e){this.didResolver=e.didResolver,this.tenantGate=e.tenantGate,this.messageStore=e.messageStore,this.dataStore=e.dataStore,this.eventLog=e.eventLog,this.methodHandlers={["Events"+"Get"]:new Hx(this.didResolver,this.eventLog),["Messages"+"Get"]:new Wx(this.didResolver,this.messageStore,this.dataStore),["Permissions"+"Grant"]:new Vx(this.didResolver,this.messageStore,this.eventLog),["Permissions"+"Request"]:new Kx(this.didResolver,this.messageStore,this.eventLog),["Permissions"+"Revoke"]:new Zx(this.didResolver,this.messageStore,this.eventLog),["Protocols"+"Configure"]:new ny(this.didResolver,this.messageStore,this.dataStore,this.eventLog),["Protocols"+"Query"]:new Yx(this.didResolver,this.messageStore,this.dataStore),["Records"+"Delete"]:new iy(this.didResolver,this.messageStore,this.dataStore,this.eventLog),["Records"+"Query"]:new wo(this.didResolver,this.messageStore,this.dataStore),["Records"+"Read"]:new oy(this.didResolver,this.messageStore,this.dataStore),["Records"+"Write"]:new yf(this.didResolver,this.messageStore,this.dataStore,this.eventLog)}}static async create(e){e.didResolver??=new Vv,e.tenantGate??=new Yy;let r=new Kv(e);return await r.open(),r}async open(){await this.messageStore.open(),await this.dataStore.open(),await this.eventLog.open()}async close(){this.messageStore.close(),this.dataStore.close(),this.eventLog.close()}async processMessage(e,r,n){let i=await this.validateTenant(e)??await this.validateMessageIntegrity(r);if(i!==void 0)return i;let o=r.descriptor.interface+r.descriptor.method;return await this.methodHandlers[o].handle({tenant:e,message:r,dataStream:n})}async synchronizePrunedInitialRecordsWrite(e,r){let n=await this.validateTenant(e)??await this.validateMessageIntegrity(r,"Records","Write");if(n!==void 0)return n;let i={skipDataStorage:!0};return await new yf(this.didResolver,this.messageStore,this.dataStore,this.eventLog).handle({tenant:e,message:r,options:i})}async validateTenant(e){if(!await this.tenantGate.isTenant(e))return{status:{code:401,detail:`${e} is not a tenant`}}}async validateMessageIntegrity(e,r,n){let i=e?.descriptor?.interface,o=e?.descriptor?.method;if(i===void 0||o===void 0)return{status:{code:400,detail:`Both interface and method must be present, interface: ${i}, method: ${o}`}};if(r!==void 0&&r!==i)return{status:{code:400,detail:`Expected interface ${r}, received ${i}`}};if(n!==void 0&&n!==o)return{status:{code:400,detail:`Expected method ${r}${n}, received ${i}${o}`}};try{ie.validateJsonSchema(e)}catch(s){return at(s,400)}}};p();function W4e(t){return new Promise((e,r)=>{if(t.aborted){r(t.reason);return}t.addEventListener("abort",()=>{r(t.reason)})})}async function Fr(t,e){return e?Promise.race([t,W4e(e)]):t}p();var k7=class{static async deriveAndInjectPublicEncryptionKeys(e,r,n){let i=JSON.parse(JSON.stringify(e));async function o(c,d){for(let f in c)if(!f.startsWith("$")){let u=await lu.derivePrivateKey(d,[f]),m=await qt.getPublicJwk(u.derivedPrivateKey);c[f].$encryption={rootKeyId:r,publicKeyJwk:m},await o(c[f],u)}}let s={derivationScheme:"protocolPath",derivedPrivateKey:n,rootKeyId:r},a=await lu.derivePrivateKey(s,["protocolPath",e.protocol]);return await o(i.structure,a),i}};p();p();p();p();p();var XX=mr(JX(),1);async function Ua(t,e){return new XX.Level(t,{...e,keyEncoding:"utf8"})}var La=class{constructor(e,r){this.config={createLevelDatabase:Ua,...e},this.db=r}async open(){switch(await this.createLevelDatabase(),this.db.status){case"open":return;case"opening":return new Promise(e=>{this.db.once("open",e)});case"closing":return new Promise((e,r)=>{let n=()=>{this.db.open().then(e).catch(r)};this.db.once("closed",n)});case"closed":return this.db.open()}}async close(){if(this.db)switch(this.db.status){case"open":return this.db.close();case"opening":return new Promise((e,r)=>{let n=()=>{this.db.close().then(e).catch(r)};this.db.once("open",n)});case"closing":return new Promise(e=>{this.db.once("closed",e)});case"closed":return}}async partition(e){return await this.createLevelDatabase(),new La(this.config,this.db.sublevel(e,{keyEncoding:"utf8",valueEncoding:this.config.valueEncoding}))}async get(e,r){r?.signal?.throwIfAborted(),await Fr(this.createLevelDatabase(),r?.signal);try{return await Fr(this.db.get(String(e)),r?.signal)}catch(n){if(n.code==="LEVEL_NOT_FOUND")return;throw n}}async has(e,r){return!!await this.get(e,r)}async*keys(e){e?.signal?.throwIfAborted(),await Fr(this.createLevelDatabase(),e?.signal);for await(let r of this.db.keys())e?.signal?.throwIfAborted(),yield r}async*iterator(e,r){r?.signal?.throwIfAborted(),await Fr(this.createLevelDatabase(),r?.signal);for await(let n of this.db.iterator(e))r?.signal?.throwIfAborted(),yield n}async put(e,r,n){return n?.signal?.throwIfAborted(),await Fr(this.createLevelDatabase(),n?.signal),Fr(this.db.put(String(e),r),n?.signal)}async delete(e,r){return r?.signal?.throwIfAborted(),await Fr(this.createLevelDatabase(),r?.signal),Fr(this.db.del(String(e)),r?.signal)}async isEmpty(e){for await(let r of this.keys(e))return!1;return!0}async clear(){await this.createLevelDatabase(),await this.db.clear(),await this.compactUnderlyingStorage()}async batch(e,r){return r?.signal?.throwIfAborted(),await Fr(this.createLevelDatabase(),r?.signal),Fr(this.db.batch(e),r?.signal)}async compactUnderlyingStorage(e){e?.signal?.throwIfAborted(),await Fr(this.createLevelDatabase(),e?.signal);let r=this.sublevelRange;if(!r)return;let n=this.root;if(n.db.supports.additionalMethods.compactRange)return Fr(n.db.compactRange?.(...r),e?.signal)}get sublevelRange(){let e=this.db.prefix;if(!e)return;let r=e.slice(0,-1)+String.fromCharCode(e.charCodeAt(e.length-1)+1);return[e,r]}get root(){let e=this.db;for(let r=e.db;r&&r!==e;)e=r;return new La(this.config,e)}async createLevelDatabase(){this.db??=await this.config.createLevelDatabase(this.config.location,{keyEncoding:"utf8",valueEncoding:this.config.valueEncoding})}};var Wu=class{constructor(e,r){this.config={createLevelDatabase:Ua,...e},this.db=r??new La({...this.config,valueEncoding:"binary"})}async open(){return this.db.open()}async close(){return this.db.close()}async partition(e){let r=await this.db.partition(e);return new Wu({...this.config,location:""},r)}async put(e,r,n){return await this.db.put(String(e),r,n),qe.parse(e.toString())}async get(e,r){return await this.db.get(String(e),r)}async has(e,r){return this.db.has(String(e),r)}async delete(e,r){return this.db.delete(String(e),r)}async isEmpty(e){return this.db.isEmpty(e)}async*putMany(e,r){for await(let n of e)await this.put(n.cid,n.block,r),yield n.cid}async*getMany(e,r){for await(let n of e)yield{cid:n,block:await this.get(n,r)}}async*getAll(e){let r=this.db.iterator({keys:!0,keyEncoding:"buffer"},e);for await(let[n,i]of r)yield{cid:qe.decode(n),block:i}}async*deleteMany(e,r){for await(let n of e)await this.delete(n,r),yield n}async clear(){return this.db.clear()}};p();var J3=mr(Wo(),1);p();function W5e(t){return t[Symbol.asyncIterator]!=null}function V5e(t){if(W5e(t))return(async()=>{let r;for await(let n of t)r=n;return r})();let e;for(let r of t)e=r;return e}var QX=V5e;p();p();p();p();p();var K5e=["Object","RegExp","Date","Error","Map","Set","WeakMap","WeakSet","ArrayBuffer","SharedArrayBuffer","DataView","Promise","URL","HTMLElement","Int8Array","Uint8ClampedArray","Int16Array","Uint16Array","Int32Array","Uint32Array","Float32Array","Float64Array","BigInt64Array","BigUint64Array"];function eQ(t){if(t===null)return"null";if(t===void 0)return"undefined";if(t===!0||t===!1)return"boolean";let e=typeof t;if(e==="string"||e==="number"||e==="bigint"||e==="symbol")return e;if(e==="function")return"Function";if(Array.isArray(t))return"Array";if(t instanceof Uint8Array)return"Uint8Array";if(t.constructor===Object)return"Object";let r=Z5e(t);return r||"Object"}function Z5e(t){let e=Object.prototype.toString.call(t).slice(8,-1);if(K5e.includes(e))return e}p();var ee=class{constructor(e,r,n){this.major=e,this.majorEncoded=e<<5,this.name=r,this.terminal=n}toString(){return`Type[${this.major}].${this.name}`}compare(e){return this.major<e.major?-1:this.major>e.major?1:0}static equals(e,r){return e===r||e.major===r.major&&e.name===r.name}};ee.uint=new ee(0,"uint",!0);ee.negint=new ee(1,"negint",!0);ee.bytes=new ee(2,"bytes",!0);ee.string=new ee(3,"string",!0);ee.array=new ee(4,"array",!1);ee.map=new ee(5,"map",!1);ee.tag=new ee(6,"tag",!1);ee.float=new ee(7,"float",!0);ee.false=new ee(7,"false",!0);ee.true=new ee(7,"true",!0);ee.null=new ee(7,"null",!0);ee.undefined=new ee(7,"undefined",!0);ee.break=new ee(7,"break",!0);var be=class{constructor(e,r,n){this.type=e,this.value=r,this.encodedLength=n,this.encodedBytes=void 0,this.byteValue=void 0}toString(){return`Token[${this.type}].${this.value}`}};p();p();var m1=globalThis.process&&!globalThis.process.browser&&globalThis.Buffer&&typeof globalThis.Buffer.isBuffer=="function",Y5e=new TextEncoder;function E3(t){return m1&&globalThis.Buffer.isBuffer(t)}function y1(t){return t instanceof Uint8Array?E3(t)?new Uint8Array(t.buffer,t.byteOffset,t.byteLength):t:Uint8Array.from(t)}var J5e=24,X5e=200,xI=m1?t=>t.length>=J5e?globalThis.Buffer.from(t):tQ(t):t=>t.length>=X5e?Y5e.encode(t):tQ(t),td=t=>Uint8Array.from(t),rQ=m1?(t,e,r)=>E3(t)?new Uint8Array(t.subarray(e,r)):t.slice(e,r):(t,e,r)=>t.slice(e,r),nQ=m1?(t,e)=>(t=t.map(r=>r instanceof Uint8Array?r:globalThis.Buffer.from(r)),y1(globalThis.Buffer.concat(t,e))):(t,e)=>{let r=new Uint8Array(e),n=0;for(let i of t)n+i.length>r.length&&(i=i.subarray(0,r.length-n)),r.set(i,n),n+=i.length;return r},iQ=m1?t=>globalThis.Buffer.allocUnsafe(t):t=>new Uint8Array(t);function S3(t,e){if(E3(t)&&E3(e))return t.compare(e);for(let r=0;r<t.length;r++)if(t[r]!==e[r])return t[r]<e[r]?-1:1;return 0}function tQ(t){let e=[],r=0;for(let n=0;n<t.length;n++){let i=t.charCodeAt(n);i<128?e[r++]=i:i<2048?(e[r++]=i>>6|192,e[r++]=i&63|128):(i&64512)===55296&&n+1<t.length&&(t.charCodeAt(n+1)&64512)===56320?(i=65536+((i&1023)<<10)+(t.charCodeAt(++n)&1023),e[r++]=i>>18|240,e[r++]=i>>12&63|128,e[r++]=i>>6&63|128,e[r++]=i&63|128):(i>=55296&&i<=57343&&(i=65533),e[r++]=i>>12|224,e[r++]=i>>6&63|128,e[r++]=i&63|128)}return e}var Q5e=256,g1=class{constructor(e=Q5e){this.chunkSize=e,this.cursor=0,this.maxCursor=-1,this.chunks=[],this._initReuseChunk=null}reset(){this.cursor=0,this.maxCursor=-1,this.chunks.length&&(this.chunks=[]),this._initReuseChunk!==null&&(this.chunks.push(this._initReuseChunk),this.maxCursor=this._initReuseChunk.length-1)}push(e){let r=this.chunks[this.chunks.length-1];if(this.cursor+e.length<=this.maxCursor+1){let i=r.length-(this.maxCursor-this.cursor)-1;r.set(e,i)}else{if(r){let i=r.length-(this.maxCursor-this.cursor)-1;i<r.length&&(this.chunks[this.chunks.length-1]=r.subarray(0,i),this.maxCursor=this.cursor-1)}e.length<64&&e.length<this.chunkSize?(r=iQ(this.chunkSize),this.chunks.push(r),this.maxCursor+=r.length,this._initReuseChunk===null&&(this._initReuseChunk=r),r.set(e,0)):(this.chunks.push(e),this.maxCursor+=e.length)}this.cursor+=e.length}toBytes(e=!1){let r;if(this.chunks.length===1){let n=this.chunks[0];e&&this.cursor>n.length/2?(r=this.cursor===n.length?n:n.subarray(0,this.cursor),this._initReuseChunk=null,this.chunks=[]):r=rQ(n,0,this.cursor)}else r=nQ(this.chunks,this.cursor);return e&&this.reset(),r}},A3=class{constructor(e){this.dest=e,this.cursor=0,this.chunks=[e]}reset(){this.cursor=0}push(e){if(this.cursor+e.length>this.dest.length)throw new Error("write out of bounds, destination buffer is too small");this.dest.set(e,this.cursor),this.cursor+=e.length}toBytes(e=!1){let r=this.dest.subarray(0,this.cursor);return e&&this.reset(),r}};p();var et="CBOR decode error:",EI="CBOR encode error:",b1=[];b1[23]=1;b1[24]=2;b1[25]=3;b1[26]=5;b1[27]=9;function Sf(t,e,r){if(t.length-e<r)throw new Error(`${et} not enough data for type`)}p();p();var si=[24,256,65536,4294967296,BigInt("18446744073709551616")];function gs(t,e,r){Sf(t,e,1);let n=t[e];if(r.strict===!0&&n<si[0])throw new Error(`${et} integer encoded in more bytes than necessary (strict decode)`);return n}function bs(t,e,r){Sf(t,e,2);let n=t[e]<<8|t[e+1];if(r.strict===!0&&n<si[1])throw new Error(`${et} integer encoded in more bytes than necessary (strict decode)`);return n}function vs(t,e,r){Sf(t,e,4);let n=t[e]*16777216+(t[e+1]<<16)+(t[e+2]<<8)+t[e+3];if(r.strict===!0&&n<si[2])throw new Error(`${et} integer encoded in more bytes than necessary (strict decode)`);return n}function ws(t,e,r){Sf(t,e,8);let n=t[e]*16777216+(t[e+1]<<16)+(t[e+2]<<8)+t[e+3],i=t[e+4]*16777216+(t[e+5]<<16)+(t[e+6]<<8)+t[e+7],o=(BigInt(n)<<BigInt(32))+BigInt(i);if(r.strict===!0&&o<si[3])throw new Error(`${et} integer encoded in more bytes than necessary (strict decode)`);if(o<=Number.MAX_SAFE_INTEGER)return Number(o);if(r.allowBigInt===!0)return o;throw new Error(`${et} integers outside of the safe integer range are not supported`)}function oQ(t,e,r,n){return new be(ee.uint,gs(t,e+1,n),2)}function sQ(t,e,r,n){return new be(ee.uint,bs(t,e+1,n),3)}function aQ(t,e,r,n){return new be(ee.uint,vs(t,e+1,n),5)}function cQ(t,e,r,n){return new be(ee.uint,ws(t,e+1,n),9)}function Ys(t,e){return ai(t,0,e.value)}function ai(t,e,r){if(r<si[0]){let n=Number(r);t.push([e|n])}else if(r<si[1]){let n=Number(r);t.push([e|24,n])}else if(r<si[2]){let n=Number(r);t.push([e|25,n>>>8,n&255])}else if(r<si[3]){let n=Number(r);t.push([e|26,n>>>24&255,n>>>16&255,n>>>8&255,n&255])}else{let n=BigInt(r);if(n<si[4]){let i=[e|27,0,0,0,0,0,0,0],o=Number(n&BigInt(4294967295)),s=Number(n>>BigInt(32)&BigInt(4294967295));i[8]=o&255,o=o>>8,i[7]=o&255,o=o>>8,i[6]=o&255,o=o>>8,i[5]=o&255,i[4]=s&255,s=s>>8,i[3]=s&255,s=s>>8,i[2]=s&255,s=s>>8,i[1]=s&255,t.push(i)}else throw new Error(`${et} encountered BigInt larger than allowable range`)}}Ys.encodedSize=function(e){return ai.encodedSize(e.value)};ai.encodedSize=function(e){return e<si[0]?1:e<si[1]?2:e<si[2]?3:e<si[3]?5:9};Ys.compareTokens=function(e,r){return e.value<r.value?-1:e.value>r.value?1:0};p();function dQ(t,e,r,n){return new be(ee.negint,-1-gs(t,e+1,n),2)}function fQ(t,e,r,n){return new be(ee.negint,-1-bs(t,e+1,n),3)}function uQ(t,e,r,n){return new be(ee.negint,-1-vs(t,e+1,n),5)}var SI=BigInt(-1),lQ=BigInt(1);function hQ(t,e,r,n){let i=ws(t,e+1,n);if(typeof i!="bigint"){let o=-1-i;if(o>=Number.MIN_SAFE_INTEGER)return new be(ee.negint,o,9)}if(n.allowBigInt!==!0)throw new Error(`${et} integers outside of the safe integer range are not supported`);return new be(ee.negint,SI-BigInt(i),9)}function T3(t,e){let r=e.value,n=typeof r=="bigint"?r*SI-lQ:r*-1-1;ai(t,e.type.majorEncoded,n)}T3.encodedSize=function(e){let r=e.value,n=typeof r=="bigint"?r*SI-lQ:r*-1-1;return n<si[0]?1:n<si[1]?2:n<si[2]?3:n<si[3]?5:9};T3.compareTokens=function(e,r){return e.value<r.value?1:e.value>r.value?-1:0};p();function v1(t,e,r,n){Sf(t,e,r+n);let i=t.slice(e+r,e+r+n);return new be(ee.bytes,i,r+n)}function pQ(t,e,r,n){return v1(t,e,1,r)}function mQ(t,e,r,n){return v1(t,e,2,gs(t,e+1,n))}function yQ(t,e,r,n){return v1(t,e,3,bs(t,e+1,n))}function gQ(t,e,r,n){return v1(t,e,5,vs(t,e+1,n))}function bQ(t,e,r,n){let i=ws(t,e+1,n);if(typeof i=="bigint")throw new Error(`${et} 64-bit integer bytes lengths not supported`);return v1(t,e,9,i)}function P3(t){return t.encodedBytes===void 0&&(t.encodedBytes=ee.equals(t.type,ee.string)?xI(t.value):t.value),t.encodedBytes}function yy(t,e){let r=P3(e);ai(t,e.type.majorEncoded,r.length),t.push(r)}yy.encodedSize=function(e){let r=P3(e);return ai.encodedSize(r.length)+r.length};yy.compareTokens=function(e,r){return tSe(P3(e),P3(r))};function tSe(t,e){return t.length<e.length?-1:t.length>e.length?1:S3(t,e)}p();var vQ=new TextDecoder,nSe=32;function iSe(t,e,r){if(r-e<nSe){let i="";for(let o=e;o<r;o++){let s=t[o];if(s&128)return vQ.decode(t.subarray(e,r));i+=String.fromCharCode(s)}return i}return vQ.decode(t.subarray(e,r))}function w1(t,e,r,n,i){let o=r+n;Sf(t,e,o);let s=new be(ee.string,iSe(t,e+r,e+o),o);return i.retainStringBytes===!0&&(s.byteValue=t.slice(e+r,e+o)),s}function wQ(t,e,r,n){return w1(t,e,1,r,n)}function _Q(t,e,r,n){return w1(t,e,2,gs(t,e+1,n),n)}function xQ(t,e,r,n){return w1(t,e,3,bs(t,e+1,n),n)}function EQ(t,e,r,n){return w1(t,e,5,vs(t,e+1,n),n)}function SQ(t,e,r,n){let i=ws(t,e+1,n);if(typeof i=="bigint")throw new Error(`${et} 64-bit integer string lengths not supported`);return w1(t,e,9,i,n)}var AQ=yy;p();function gy(t,e,r,n){return new be(ee.array,n,r)}function TQ(t,e,r,n){return gy(t,e,1,r)}function PQ(t,e,r,n){return gy(t,e,2,gs(t,e+1,n))}function IQ(t,e,r,n){return gy(t,e,3,bs(t,e+1,n))}function RQ(t,e,r,n){return gy(t,e,5,vs(t,e+1,n))}function MQ(t,e,r,n){let i=ws(t,e+1,n);if(typeof i=="bigint")throw new Error(`${et} 64-bit integer array lengths not supported`);return gy(t,e,9,i)}function kQ(t,e,r,n){if(n.allowIndefinite===!1)throw new Error(`${et} indefinite length items not allowed`);return gy(t,e,1,1/0)}function I3(t,e){ai(t,ee.array.majorEncoded,e.value)}I3.compareTokens=Ys.compareTokens;I3.encodedSize=function(e){return ai.encodedSize(e.value)};p();function by(t,e,r,n){return new be(ee.map,n,r)}function BQ(t,e,r,n){return by(t,e,1,r)}function DQ(t,e,r,n){return by(t,e,2,gs(t,e+1,n))}function CQ(t,e,r,n){return by(t,e,3,bs(t,e+1,n))}function OQ(t,e,r,n){return by(t,e,5,vs(t,e+1,n))}function jQ(t,e,r,n){let i=ws(t,e+1,n);if(typeof i=="bigint")throw new Error(`${et} 64-bit integer map lengths not supported`);return by(t,e,9,i)}function NQ(t,e,r,n){if(n.allowIndefinite===!1)throw new Error(`${et} indefinite length items not allowed`);return by(t,e,1,1/0)}function R3(t,e){ai(t,ee.map.majorEncoded,e.value)}R3.compareTokens=Ys.compareTokens;R3.encodedSize=function(e){return ai.encodedSize(e.value)};p();function qQ(t,e,r,n){return new be(ee.tag,r,1)}function LQ(t,e,r,n){return new be(ee.tag,gs(t,e+1,n),2)}function UQ(t,e,r,n){return new be(ee.tag,bs(t,e+1,n),3)}function FQ(t,e,r,n){return new be(ee.tag,vs(t,e+1,n),5)}function zQ(t,e,r,n){return new be(ee.tag,ws(t,e+1,n),9)}function M3(t,e){ai(t,ee.tag.majorEncoded,e.value)}M3.compareTokens=Ys.compareTokens;M3.encodedSize=function(e){return ai.encodedSize(e.value)};p();var AI=20,TI=21,PI=22,II=23;function $Q(t,e,r,n){if(n.allowUndefined===!1)throw new Error(`${et} undefined values are not supported`);return n.coerceUndefinedToNull===!0?new be(ee.null,null,1):new be(ee.undefined,void 0,1)}function GQ(t,e,r,n){if(n.allowIndefinite===!1)throw new Error(`${et} indefinite length items not allowed`);return new be(ee.break,void 0,1)}function RI(t,e,r){if(r){if(r.allowNaN===!1&&Number.isNaN(t))throw new Error(`${et} NaN values are not supported`);if(r.allowInfinity===!1&&(t===1/0||t===-1/0))throw new Error(`${et} Infinity values are not supported`)}return new be(ee.float,t,e)}function HQ(t,e,r,n){return RI(MI(t,e+1),3,n)}function WQ(t,e,r,n){return RI(kI(t,e+1),5,n)}function VQ(t,e,r,n){return RI(JQ(t,e+1),9,n)}function k3(t,e,r){let n=e.value;if(n===!1)t.push([ee.float.majorEncoded|AI]);else if(n===!0)t.push([ee.float.majorEncoded|TI]);else if(n===null)t.push([ee.float.majorEncoded|PI]);else if(n===void 0)t.push([ee.float.majorEncoded|II]);else{let i,o=!1;(!r||r.float64!==!0)&&(ZQ(n),i=MI(Fa,1),n===i||Number.isNaN(n)?(Fa[0]=249,t.push(Fa.slice(0,3)),o=!0):(YQ(n),i=kI(Fa,1),n===i&&(Fa[0]=250,t.push(Fa.slice(0,5)),o=!0))),o||(dSe(n),i=JQ(Fa,1),Fa[0]=251,t.push(Fa.slice(0,9)))}}k3.encodedSize=function(e,r){let n=e.value;if(n===!1||n===!0||n===null||n===void 0)return 1;if(!r||r.float64!==!0){ZQ(n);let i=MI(Fa,1);if(n===i||Number.isNaN(n))return 3;if(YQ(n),i=kI(Fa,1),n===i)return 5}return 9};var KQ=new ArrayBuffer(9),Js=new DataView(KQ,1),Fa=new Uint8Array(KQ,0);function ZQ(t){if(t===1/0)Js.setUint16(0,31744,!1);else if(t===-1/0)Js.setUint16(0,64512,!1);else if(Number.isNaN(t))Js.setUint16(0,32256,!1);else{Js.setFloat32(0,t);let e=Js.getUint32(0),r=(e&2139095040)>>23,n=e&8388607;if(r===255)Js.setUint16(0,31744,!1);else if(r===0)Js.setUint16(0,(t&2147483648)>>16|n>>13,!1);else{let i=r-127;i<-24?Js.setUint16(0,0):i<-14?Js.setUint16(0,(e&2147483648)>>16|1<<24+i,!1):Js.setUint16(0,(e&2147483648)>>16|i+15<<10|n>>13,!1)}}}function MI(t,e){if(t.length-e<2)throw new Error(`${et} not enough data for float16`);let r=(t[e]<<8)+t[e+1];if(r===31744)return 1/0;if(r===64512)return-1/0;if(r===32256)return NaN;let n=r>>10&31,i=r&1023,o;return n===0?o=i*2**-24:n!==31?o=(i+1024)*2**(n-25):o=i===0?1/0:NaN,r&32768?-o:o}function YQ(t){Js.setFloat32(0,t,!1)}function kI(t,e){if(t.length-e<4)throw new Error(`${et} not enough data for float32`);let r=(t.byteOffset||0)+e;return new DataView(t.buffer,r,4).getFloat32(0,!1)}function dSe(t){Js.setFloat64(0,t,!1)}function JQ(t,e){if(t.length-e<8)throw new Error(`${et} not enough data for float64`);let r=(t.byteOffset||0)+e;return new DataView(t.buffer,r,8).getFloat64(0,!1)}k3.compareTokens=Ys.compareTokens;function or(t,e,r){throw new Error(`${et} encountered invalid minor (${r}) for major ${t[e]>>>5}`)}function B3(t){return()=>{throw new Error(`${et} ${t}`)}}var le=[];for(let t=0;t<=23;t++)le[t]=or;le[24]=oQ;le[25]=sQ;le[26]=aQ;le[27]=cQ;le[28]=or;le[29]=or;le[30]=or;le[31]=or;for(let t=32;t<=55;t++)le[t]=or;le[56]=dQ;le[57]=fQ;le[58]=uQ;le[59]=hQ;le[60]=or;le[61]=or;le[62]=or;le[63]=or;for(let t=64;t<=87;t++)le[t]=pQ;le[88]=mQ;le[89]=yQ;le[90]=gQ;le[91]=bQ;le[92]=or;le[93]=or;le[94]=or;le[95]=B3("indefinite length bytes/strings are not supported");for(let t=96;t<=119;t++)le[t]=wQ;le[120]=_Q;le[121]=xQ;le[122]=EQ;le[123]=SQ;le[124]=or;le[125]=or;le[126]=or;le[127]=B3("indefinite length bytes/strings are not supported");for(let t=128;t<=151;t++)le[t]=TQ;le[152]=PQ;le[153]=IQ;le[154]=RQ;le[155]=MQ;le[156]=or;le[157]=or;le[158]=or;le[159]=kQ;for(let t=160;t<=183;t++)le[t]=BQ;le[184]=DQ;le[185]=CQ;le[186]=OQ;le[187]=jQ;le[188]=or;le[189]=or;le[190]=or;le[191]=NQ;for(let t=192;t<=215;t++)le[t]=qQ;le[216]=LQ;le[217]=UQ;le[218]=FQ;le[219]=zQ;le[220]=or;le[221]=or;le[222]=or;le[223]=or;for(let t=224;t<=243;t++)le[t]=B3("simple values are not supported");le[244]=or;le[245]=or;le[246]=or;le[247]=$Q;le[248]=B3("simple values are not supported");le[249]=HQ;le[250]=WQ;le[251]=VQ;le[252]=or;le[253]=or;le[254]=or;le[255]=GQ;var za=[];for(let t=0;t<24;t++)za[t]=new be(ee.uint,t,1);for(let t=-1;t>=-24;t--)za[31-t]=new be(ee.negint,t,1);za[64]=new be(ee.bytes,new Uint8Array(0),1);za[96]=new be(ee.string,"",1);za[128]=new be(ee.array,0,1);za[160]=new be(ee.map,0,1);za[244]=new be(ee.false,!1,1);za[245]=new be(ee.true,!0,1);za[246]=new be(ee.null,null,1);function XQ(t){switch(t.type){case ee.false:return td([244]);case ee.true:return td([245]);case ee.null:return td([246]);case ee.bytes:return t.value.length?void 0:td([64]);case ee.string:return t.value===""?td([96]):void 0;case ee.array:return t.value===0?td([128]):void 0;case ee.map:return t.value===0?td([160]):void 0;case ee.uint:return t.value<24?td([Number(t.value)]):void 0;case ee.negint:if(t.value>=-24)return td([31-Number(t.value)])}}var eee=Object.freeze({float64:!0,mapSorter:mSe,quickEncodeToken:XQ});function uSe(){let t=[];return t[ee.uint.major]=Ys,t[ee.negint.major]=T3,t[ee.bytes.major]=yy,t[ee.string.major]=AQ,t[ee.array.major]=I3,t[ee.map.major]=R3,t[ee.tag.major]=M3,t[ee.float.major]=k3,t}var lSe=uSe(),hSe=new g1,vy=class{constructor(e,r){this.obj=e,this.parent=r}includes(e){let r=this;do if(r.obj===e)return!0;while(r=r.parent);return!1}static createCheck(e,r){if(e&&e.includes(r))throw new Error(`${EI} object contains circular references`);return new vy(r,e)}},Vu={null:new be(ee.null,null),undefined:new be(ee.undefined,void 0),true:new be(ee.true,!0),false:new be(ee.false,!1),emptyArray:new be(ee.array,0),emptyMap:new be(ee.map,0)},Ku={number(t,e,r,n){return!Number.isInteger(t)||!Number.isSafeInteger(t)?new be(ee.float,t):t>=0?new be(ee.uint,t):new be(ee.negint,t)},bigint(t,e,r,n){return t>=BigInt(0)?new be(ee.uint,t):new be(ee.negint,t)},Uint8Array(t,e,r,n){return new be(ee.bytes,t)},string(t,e,r,n){return new be(ee.string,t)},boolean(t,e,r,n){return t?Vu.true:Vu.false},null(t,e,r,n){return Vu.null},undefined(t,e,r,n){return Vu.undefined},ArrayBuffer(t,e,r,n){return new be(ee.bytes,new Uint8Array(t))},DataView(t,e,r,n){return new be(ee.bytes,new Uint8Array(t.buffer,t.byteOffset,t.byteLength))},Array(t,e,r,n){if(!t.length)return r.addBreakTokens===!0?[Vu.emptyArray,new be(ee.break)]:Vu.emptyArray;n=vy.createCheck(n,t);let i=[],o=0;for(let s of t)i[o++]=D3(s,r,n);return r.addBreakTokens?[new be(ee.array,t.length),i,new be(ee.break)]:[new be(ee.array,t.length),i]},Object(t,e,r,n){let i=e!=="Object",o=i?t.keys():Object.keys(t),s=i?t.size:o.length,a;if(s){a=new Array(s),n=vy.createCheck(n,t);let c=!i&&r.ignoreUndefinedProperties,d=0;for(let f of o){let u=i?t.get(f):t[f];c&&u===void 0||(a[d++]=[D3(f,r,n),D3(u,r,n)])}d<s&&(a.length=d)}return a?.length?(pSe(a,r),r.addBreakTokens?[new be(ee.map,a.length),a,new be(ee.break)]:[new be(ee.map,a.length),a]):r.addBreakTokens===!0?[Vu.emptyMap,new be(ee.break)]:Vu.emptyMap}};Ku.Map=Ku.Object;Ku.Buffer=Ku.Uint8Array;for(let t of"Uint8Clamped Uint16 Uint32 Int8 Int16 Int32 BigUint64 BigInt64 Float32 Float64".split(" "))Ku[`${t}Array`]=Ku.DataView;function D3(t,e={},r){let n=eQ(t),i=e&&e.typeEncoders&&e.typeEncoders[n]||Ku[n];if(typeof i=="function"){let s=i(t,n,e,r);if(s!=null)return s}let o=Ku[n];if(!o)throw new Error(`${EI} unsupported type: ${n}`);return o(t,n,e,r)}function pSe(t,e){e.mapSorter&&t.sort(e.mapSorter)}function mSe(t,e){if(t[0]instanceof be&&e[0]instanceof be){let r=t[0],n=e[0];return r._keyBytes||(r._keyBytes=QQ(r.value)),n._keyBytes||(n._keyBytes=QQ(n.value)),S3(r._keyBytes,n._keyBytes)}throw new Error("rfc8949MapSorter: complex key types are not supported yet")}function QQ(t){return ySe(t,lSe,eee)}function tee(t,e,r,n){if(Array.isArray(e))for(let i of e)tee(t,i,r,n);else r[e.type.major](t,e,n)}var Cet=ee.uint.majorEncoded,Oet=ee.negint.majorEncoded,jet=ee.bytes.majorEncoded,Net=ee.string.majorEncoded,qet=ee.array.majorEncoded,Let=ee.float.majorEncoded|AI,Uet=ee.float.majorEncoded|TI,Fet=ee.float.majorEncoded|PI,zet=ee.float.majorEncoded|II,$et=BigInt(-1),Get=BigInt(1);function ySe(t,e,r,n){let i=n instanceof Uint8Array,o=i?new A3(n):hSe,s=D3(t,r);if(!Array.isArray(s)&&r.quickEncodeToken){let a=r.quickEncodeToken(s);if(a)return i?(o.push(a),o.toBytes()):a;let c=e[s.type.major];if(c.encodedSize){let d=c.encodedSize(s,r);if(i||(o=new g1(d)),c(o,s,r),o.chunks.length!==1)throw new Error(`Unexpected error: pre-calculated length for ${s} was wrong`);return i?o.toBytes():y1(o.chunks[0])}}return o.reset(),tee(o,s,e,r),o.toBytes(!0)}p();var gSe={strict:!1,allowIndefinite:!0,allowUndefined:!0,allowBigInt:!0},C3=class{constructor(e,r={}){this._pos=0,this.data=e,this.options=r}pos(){return this._pos}done(){return this._pos>=this.data.length}next(){let e=this.data[this._pos],r=za[e];if(r===void 0){let n=le[e];if(!n)throw new Error(`${et} no decoder for major type ${e>>>5} (byte 0x${e.toString(16).padStart(2,"0")})`);let i=e&31;r=n(this.data,this._pos,i,this.options)}return this._pos+=r.encodedLength,r}},_1=Symbol.for("DONE"),O3=Symbol.for("BREAK");function bSe(t,e,r){let n=[];for(let i=0;i<t.value;i++){let o=wy(e,r);if(o===O3){if(t.value===1/0)break;throw new Error(`${et} got unexpected break to lengthed array`)}if(o===_1)throw new Error(`${et} found array but not enough entries (got ${i}, expected ${t.value})`);n[i]=o}return n}function vSe(t,e,r){let n=r.useMaps===!0,i=r.rejectDuplicateMapKeys===!0,o=n?void 0:{},s=n?new Map:void 0;for(let a=0;a<t.value;a++){let c=wy(e,r);if(c===O3){if(t.value===1/0)break;throw new Error(`${et} got unexpected break to lengthed map`)}if(c===_1)throw new Error(`${et} found map but not enough entries (got ${a} [no key], expected ${t.value})`);if(!n&&typeof c!="string")throw new Error(`${et} non-string keys not supported (got ${typeof c})`);if(i&&(n&&s.has(c)||!n&&Object.hasOwn(o,c)))throw new Error(`${et} found repeat map key "${c}"`);let d=wy(e,r);if(d===_1)throw new Error(`${et} found map but not enough entries (got ${a} [no value], expected ${t.value})`);n?s.set(c,d):o[c]=d}return n?s:o}function wy(t,e){if(t.done())return _1;let r=t.next();if(ee.equals(r.type,ee.break))return O3;if(r.type.terminal)return r.value;if(ee.equals(r.type,ee.array))return bSe(r,t,e);if(ee.equals(r.type,ee.map))return vSe(r,t,e);if(ee.equals(r.type,ee.tag)){if(e.tags&&typeof e.tags[r.value]=="function"){let n=wy(t,e);return e.tags[r.value](n)}throw new Error(`${et} tag not supported (${r.value})`)}throw new Error("unsupported")}function ree(t,e){if(!(t instanceof Uint8Array))throw new Error(`${et} data to decode must be a Uint8Array`);e=Object.assign({},gSe,e);let r=y1(t),n=e.tokenizer||new C3(r,e),i=wy(n,e);if(i===_1)throw new Error(`${et} did not find any content to decode`);if(i===O3)throw new Error(`${et} got unexpected break`);return[i,t.subarray(n.pos())]}function BI(t,e){let[r,n]=ree(t,e);if(n.length>0)throw new Error(`${et} too many terminals, data makes no sense`);return r}p();p();p();p();var itt=new Uint8Array(0);function nee(t,e){if(t===e)return!0;if(t.byteLength!==e.byteLength)return!1;for(let r=0;r<t.byteLength;r++)if(t[r]!==e[r])return!1;return!0}function _y(t){if(t instanceof Uint8Array&&t.constructor.name==="Uint8Array")return t;if(t instanceof ArrayBuffer)return new Uint8Array(t);if(ArrayBuffer.isView(t))return new Uint8Array(t.buffer,t.byteOffset,t.byteLength);throw new Error("Unknown type, must be binary type")}p();function xSe(t,e){if(t.length>=255)throw new TypeError("Alphabet too long");for(var r=new Uint8Array(256),n=0;n<r.length;n++)r[n]=255;for(var i=0;i<t.length;i++){var o=t.charAt(i),s=o.charCodeAt(0);if(r[s]!==255)throw new TypeError(o+" is ambiguous");r[s]=i}var a=t.length,c=t.charAt(0),d=Math.log(a)/Math.log(256),f=Math.log(256)/Math.log(a);function u(v){if(v instanceof Uint8Array||(ArrayBuffer.isView(v)?v=new Uint8Array(v.buffer,v.byteOffset,v.byteLength):Array.isArray(v)&&(v=Uint8Array.from(v))),!(v instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(v.length===0)return"";for(var A=0,T=0,M=0,D=v.length;M!==D&&v[M]===0;)M++,A++;for(var O=(D-M)*f+1>>>0,U=new Uint8Array(O);M!==D;){for(var L=v[M],F=0,$=O-1;(L!==0||F<T)&&$!==-1;$--,F++)L+=256*U[$]>>>0,U[$]=L%a>>>0,L=L/a>>>0;if(L!==0)throw new Error("Non-zero carry");T=F,M++}for(var H=O-T;H!==O&&U[H]===0;)H++;for(var z=c.repeat(A);H<O;++H)z+=t.charAt(U[H]);return z}function m(v){if(typeof v!="string")throw new TypeError("Expected String");if(v.length===0)return new Uint8Array;var A=0;if(v[A]!==" "){for(var T=0,M=0;v[A]===c;)T++,A++;for(var D=(v.length-A)*d+1>>>0,O=new Uint8Array(D);v[A];){var U=r[v.charCodeAt(A)];if(U===255)return;for(var L=0,F=D-1;(U!==0||L<M)&&F!==-1;F--,L++)U+=a*O[F]>>>0,O[F]=U%256>>>0,U=U/256>>>0;if(U!==0)throw new Error("Non-zero carry");M=L,A++}if(v[A]!==" "){for(var $=D-M;$!==D&&O[$]===0;)$++;for(var H=new Uint8Array(T+(D-$)),z=T;$!==D;)H[z++]=O[$++];return H}}}function _(v){var A=m(v);if(A)return A;throw new Error(`Non-${e} character`)}return{encode:u,decodeUnsafe:m,decode:_}}var ESe=xSe,SSe=ESe,iee=SSe;var DI=class{name;prefix;baseEncode;constructor(e,r,n){this.name=e,this.prefix=r,this.baseEncode=n}encode(e){if(e instanceof Uint8Array)return`${this.prefix}${this.baseEncode(e)}`;throw Error("Unknown type, must be binary type")}},CI=class{name;prefix;baseDecode;prefixCodePoint;constructor(e,r,n){this.name=e,this.prefix=r;let i=r.codePointAt(0);if(i===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=i,this.baseDecode=n}decode(e){if(typeof e=="string"){if(e.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(e)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(e.slice(this.prefix.length))}else throw Error("Can only multibase decode strings")}or(e){return oee(this,e)}},OI=class{decoders;constructor(e){this.decoders=e}or(e){return oee(this,e)}decode(e){let r=e[0],n=this.decoders[r];if(n!=null)return n.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}};function oee(t,e){return new OI({...t.decoders??{[t.prefix]:t},...e.decoders??{[e.prefix]:e}})}var jI=class{name;prefix;baseEncode;baseDecode;encoder;decoder;constructor(e,r,n,i){this.name=e,this.prefix=r,this.baseEncode=n,this.baseDecode=i,this.encoder=new DI(e,r,n),this.decoder=new CI(e,r,i)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}};function see({name:t,prefix:e,encode:r,decode:n}){return new jI(t,e,r,n)}function xy({name:t,prefix:e,alphabet:r}){let{encode:n,decode:i}=iee(r,t);return see({prefix:e,name:t,encode:n,decode:o=>_y(i(o))})}function ASe(t,e,r,n){let i=t.length;for(;t[i-1]==="=";)--i;let o=new Uint8Array(i*r/8|0),s=0,a=0,c=0;for(let d=0;d<i;++d){let f=e[t[d]];if(f===void 0)throw new SyntaxError(`Non-${n} character`);a=a<<r|f,s+=r,s>=8&&(s-=8,o[c++]=255&a>>s)}if(s>=r||255&a<<8-s)throw new SyntaxError("Unexpected end of data");return o}function TSe(t,e,r){let n=e[e.length-1]==="=",i=(1<<r)-1,o="",s=0,a=0;for(let c=0;c<t.length;++c)for(a=a<<8|t[c],s+=8;s>r;)s-=r,o+=e[i&a>>s];if(s!==0&&(o+=e[i&a<<r-s]),n)for(;o.length*r&7;)o+="=";return o}function PSe(t){let e={};for(let r=0;r<t.length;++r)e[t[r]]=r;return e}function rd({name:t,prefix:e,bitsPerChar:r,alphabet:n}){let i=PSe(n);return see({prefix:e,name:t,encode(o){return TSe(o,n,r)},decode(o){return ASe(o,i,r,t)}})}var x1=rd({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),ptt=rd({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),mtt=rd({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),ytt=rd({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),gtt=rd({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),btt=rd({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),vtt=rd({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),wtt=rd({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),_tt=rd({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});p();var j3=xy({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),Att=xy({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"});p();var Af=xy({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),Rtt=xy({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});p();p();p();var ISe=dee,aee=128,RSe=127,MSe=~RSe,kSe=Math.pow(2,31);function dee(t,e,r){e=e||[],r=r||0;for(var n=r;t>=kSe;)e[r++]=t&255|aee,t/=128;for(;t&MSe;)e[r++]=t&255|aee,t>>>=7;return e[r]=t|0,dee.bytes=r-n+1,e}var BSe=NI,DSe=128,cee=127;function NI(t,n){var r=0,n=n||0,i=0,o=n,s,a=t.length;do{if(o>=a)throw NI.bytes=0,new RangeError("Could not decode varint");s=t[o++],r+=i<28?(s&cee)<<i:(s&cee)*Math.pow(2,i),i+=7}while(s>=DSe);return NI.bytes=o-n,r}var CSe=Math.pow(2,7),OSe=Math.pow(2,14),jSe=Math.pow(2,21),NSe=Math.pow(2,28),qSe=Math.pow(2,35),LSe=Math.pow(2,42),USe=Math.pow(2,49),FSe=Math.pow(2,56),zSe=Math.pow(2,63),$Se=function(t){return t<CSe?1:t<OSe?2:t<jSe?3:t<NSe?4:t<qSe?5:t<LSe?6:t<USe?7:t<FSe?8:t<zSe?9:10},GSe={encode:ISe,decode:BSe,encodingLength:$Se},HSe=GSe,E1=HSe;function S1(t,e=0){return[E1.decode(t,e),E1.decode.bytes]}function Ey(t,e,r=0){return E1.encode(t,e,r),e}function Sy(t){return E1.encodingLength(t)}function uee(t,e){let r=e.byteLength,n=Sy(t),i=n+Sy(r),o=new Uint8Array(i+r);return Ey(t,o,0),Ey(r,o,n),o.set(e,i),new Ay(t,r,e,o)}function lee(t){let e=_y(t),[r,n]=S1(e),[i,o]=S1(e.subarray(n)),s=e.subarray(n+o);if(s.byteLength!==i)throw new Error("Incorrect length");return new Ay(r,i,s,e)}function hee(t,e){if(t===e)return!0;{let r=e;return t.code===r.code&&t.size===r.size&&r.bytes instanceof Uint8Array&&nee(t.bytes,r.bytes)}}var Ay=class{code;size;digest;bytes;constructor(e,r,n,i){this.code=e,this.size=r,this.digest=n,this.bytes=i}};p();function pee(t,e){let{bytes:r,version:n}=t;switch(n){case 0:return KSe(r,qI(t),e??Af.encoder);default:return ZSe(r,qI(t),e??x1.encoder)}}var mee=new WeakMap;function qI(t){let e=mee.get(t);if(e==null){let r=new Map;return mee.set(t,r),r}return e}var xn=class{code;version;multihash;bytes;"/";constructor(e,r,n,i){this.code=r,this.version=e,this.multihash=n,this.bytes=i,this["/"]=i}get asCID(){return this}get byteOffset(){return this.bytes.byteOffset}get byteLength(){return this.bytes.byteLength}toV0(){switch(this.version){case 0:return this;case 1:{let{code:e,multihash:r}=this;if(e!==A1)throw new Error("Cannot convert a non dag-pb CID to CIDv0");if(r.code!==YSe)throw new Error("Cannot convert non sha2-256 multihash CID to CIDv0");return xn.createV0(r)}default:throw Error(`Can not convert CID version ${this.version} to version 0. This is a bug please report`)}}toV1(){switch(this.version){case 0:{let{code:e,digest:r}=this.multihash,n=uee(e,r);return xn.createV1(this.code,n)}case 1:return this;default:throw Error(`Can not convert CID version ${this.version} to version 1. This is a bug please report`)}}equals(e){return xn.equals(this,e)}static equals(e,r){let n=r;return n!=null&&e.code===n.code&&e.version===n.version&&hee(e.multihash,n.multihash)}toString(e){return pee(this,e)}toJSON(){return{"/":pee(this)}}link(){return this}[Symbol.toStringTag]="CID";[Symbol.for("nodejs.util.inspect.custom")](){return`CID(${this.toString()})`}static asCID(e){if(e==null)return null;let r=e;if(r instanceof xn)return r;if(r["/"]!=null&&r["/"]===r.bytes||r.asCID===r){let{version:n,code:i,multihash:o,bytes:s}=r;return new xn(n,i,o,s??yee(n,i,o.bytes))}else if(r[JSe]===!0){let{version:n,multihash:i,code:o}=r,s=lee(i);return xn.create(n,o,s)}else return null}static create(e,r,n){if(typeof r!="number")throw new Error("String codecs are no longer supported");if(!(n.bytes instanceof Uint8Array))throw new Error("Invalid digest");switch(e){case 0:{if(r!==A1)throw new Error(`Version 0 CID must use dag-pb (code: ${A1}) block encoding`);return new xn(e,r,n,n.bytes)}case 1:{let i=yee(e,r,n.bytes);return new xn(e,r,n,i)}default:throw new Error("Invalid version")}}static createV0(e){return xn.create(0,A1,e)}static createV1(e,r){return xn.create(1,e,r)}static decode(e){let[r,n]=xn.decodeFirst(e);if(n.length!==0)throw new Error("Incorrect length");return r}static decodeFirst(e){let r=xn.inspectBytes(e),n=r.size-r.multihashSize,i=_y(e.subarray(n,n+r.multihashSize));if(i.byteLength!==r.multihashSize)throw new Error("Incorrect length");let o=i.subarray(r.multihashSize-r.digestSize),s=new Ay(r.multihashCode,r.digestSize,o,i);return[r.version===0?xn.createV0(s):xn.createV1(r.codec,s),e.subarray(r.size)]}static inspectBytes(e){let r=0,n=()=>{let[u,m]=S1(e.subarray(r));return r+=m,u},i=n(),o=A1;if(i===18?(i=0,r=0):o=n(),i!==0&&i!==1)throw new RangeError(`Invalid CID version ${i}`);let s=r,a=n(),c=n(),d=r+c,f=d-s;return{version:i,codec:o,multihashCode:a,digestSize:c,multihashSize:f,size:d}}static parse(e,r){let[n,i]=VSe(e,r),o=xn.decode(i);if(o.version===0&&e[0]!=="Q")throw Error("Version 0 CID string must not include multibase prefix");return qI(o).set(n,e),o}};function VSe(t,e){switch(t[0]){case"Q":{let r=e??Af;return[Af.prefix,r.decode(`${Af.prefix}${t}`)]}case Af.prefix:{let r=e??Af;return[Af.prefix,r.decode(t)]}case x1.prefix:{let r=e??x1;return[x1.prefix,r.decode(t)]}case j3.prefix:{let r=e??j3;return[j3.prefix,r.decode(t)]}default:{if(e==null)throw Error("To parse non base32, base36 or base58btc encoded CID multibase decoder must be provided");return[t[0],e.decode(t)]}}}function KSe(t,e,r){let{prefix:n}=r;if(n!==Af.prefix)throw Error(`Cannot string encode V0 in ${r.name} encoding`);let i=e.get(n);if(i==null){let o=r.encode(t).slice(1);return e.set(n,o),o}else return i}function ZSe(t,e,r){let{prefix:n}=r,i=e.get(n);if(i==null){let o=r.encode(t);return e.set(n,o),o}else return i}var A1=112,YSe=18;function yee(t,e,r){let n=Sy(t),i=n+Sy(e),o=new Uint8Array(i+r.byteLength);return Ey(t,o,0),Ey(e,o,n),o.set(r,i),o}var JSe=Symbol.for("@ipld/js-cid/CID");var bee=42;function XSe(t){return t instanceof ArrayBuffer?new Uint8Array(t,0,t.byteLength):t}function QSe(t){if(t.asCID!==t&&t["/"]!==t.bytes)return null;let e=xn.asCID(t);if(!e)return null;let r=new Uint8Array(e.bytes.byteLength+1);return r.set(e.bytes,1),[new be(ee.tag,bee),new be(ee.bytes,r)]}function eAe(){throw new Error("`undefined` is not supported by the IPLD Data Model and cannot be encoded")}function tAe(t){if(Number.isNaN(t))throw new Error("`NaN` is not supported by the IPLD Data Model and cannot be encoded");if(t===1/0||t===-1/0)throw new Error("`Infinity` and `-Infinity` is not supported by the IPLD Data Model and cannot be encoded");return null}function rAe(t){for(let e of t.keys())if(typeof e!="string"||e.length===0)throw new Error("Non-string Map keys are not supported by the IPLD Data Model and cannot be encoded");return null}var gee={float64:!0,typeEncoders:{Map:rAe,Object:QSe,undefined:eAe,number:tAe}},Vtt={...gee,typeEncoders:{...gee.typeEncoders}};function nAe(t){if(t[0]!==0)throw new Error("Invalid CID for CBOR tag 42; expected leading 0x00");return xn.decode(t.subarray(1))}var N3={allowIndefinite:!1,coerceUndefinedToNull:!0,allowNaN:!1,allowInfinity:!1,allowBigInt:!0,strict:!0,useMaps:!1,rejectDuplicateMapKeys:!0,tags:[]};N3.tags[bee]=nAe;var Ktt={...N3,tags:N3.tags.slice()};var vee=113;var wee=t=>BI(XSe(t),N3);var nte=mr(Wo(),1);p();var xee=0,iAe="identity",Eee=ta,oAe=t=>_l(xee,Eee(t)),See={code:xee,name:iAe,encode:Eee,digest:oAe};p();var Aee=mr(Wo(),1);var sAe=async(t,e,r,n,i,o,s,a)=>{let c=await s.get(t,a),d=wee(c),f=d,u=r;for(;n.length>0;){let m=n[0];if(m in f){n.shift(),u=`${u}/${m}`;let _=qe.asCID(f[m]);if(_!=null)return{entry:{type:"object",name:e,path:r,cid:t,node:c,depth:o,size:BigInt(c.length),content:async function*(){yield d}},next:{cid:_,name:m,path:u,toResolve:n}};f=f[m]}else throw(0,Aee.default)(new Error(`No property named ${m} found in cbor node ${t}`),"ERR_NO_PROP")}return{entry:{type:"object",name:e,path:r,cid:t,node:c,depth:o,size:BigInt(c.length),content:async function*(){yield d}}}},Tee=sAe;p();var Pee=mr(Wo(),1);p();function aAe(t,e,r,n){let i=BigInt(t.length),o=BigInt(e+i);return r>=o||n<e?new Uint8Array(0):(n>=e&&n<o&&(t=t.subarray(0,Number(n-e))),r>=e&&r<o&&(t=t.subarray(Number(r-e))),t)}var wp=aAe;p();var T1=mr(Wo(),1),cAe=(t,e=0,r=t)=>{let n=BigInt(t),i=BigInt(e??0),o=BigInt(r);if(o!==n&&(o=i+o),o>n&&(o=n),i<0n)throw(0,T1.default)(new Error("Offset must be greater than or equal to 0"),"ERR_INVALID_PARAMS");if(i>n)throw(0,T1.default)(new Error("Offset must be less than the file size"),"ERR_INVALID_PARAMS");if(o<0n)throw(0,T1.default)(new Error("Length must be greater than or equal to 0"),"ERR_INVALID_PARAMS");if(o>n)throw(0,T1.default)(new Error("Length must be less than the file size"),"ERR_INVALID_PARAMS");return{start:i,end:o}},Ty=cAe;var dAe=t=>{async function*e(r={}){let{start:n,end:i}=Ty(t.length,r.offset,r.length),o=wp(t,0n,n,i);r.onProgress?.(new cn("unixfs:exporter:progress:identity",{bytesRead:BigInt(o.byteLength),totalBytes:i-n,fileSize:BigInt(t.byteLength)})),yield o}return e},fAe=async(t,e,r,n,i,o,s,a)=>{if(n.length>0)throw(0,Pee.default)(new Error(`No link named ${r} found in raw node ${t}`),"ERR_NOT_FOUND");let c=Gp(t.multihash.bytes);return{entry:{type:"identity",name:e,path:r,cid:t,content:dAe(c.digest),depth:o,size:BigInt(c.digest.length),node:c.digest}}},Iee=fAe;p();var Ree=mr(Wo(),1);var uAe=t=>{async function*e(r={}){let{start:n,end:i}=Ty(t.length,r.offset,r.length),o=wp(t,0n,n,i);r.onProgress?.(new cn("unixfs:exporter:progress:raw",{bytesRead:BigInt(o.byteLength),totalBytes:i-n,fileSize:BigInt(t.byteLength)})),yield o}return e},lAe=async(t,e,r,n,i,o,s,a)=>{if(n.length>0)throw(0,Ree.default)(new Error(`No link named ${r} found in raw node ${t}`),"ERR_NOT_FOUND");let c=await s.get(t,a);return{entry:{type:"raw",name:e,path:r,cid:t,content:uAe(c),depth:o,size:BigInt(c.length),node:c}}},Mee=lAe;p();var C1=mr(Wo(),1);p();var hAe=async function(t){return(await gw.encode(t)).slice(0,8).reverse()},pAe=async(t,e,r)=>{await Promise.all(t.map(async n=>{if(n.Name==null)throw new Error("Unexpected Link without a Name");if(n.Name.length===2){let i=parseInt(n.Name,16);e._putObjectAt(i,new Gn({hash:r._options.hash,bits:r._options.bits},e,i));return}await r.put(n.Name.substring(2),!0)}))},kee=t=>t.toString(16).toUpperCase().padStart(2,"0").substring(0,2),mAe=t=>{let e=t.bucket,r=[];for(;e._parent!=null;)r.push(e),e=e._parent;return r.push(e),r.reverse()},Bee=async(t,e,r,n,i)=>{if(n==null){let f=ww({hashFn:hAe});n={rootBucket:f,hamtDepth:1,lastBucket:f}}await pAe(t.Links,n.lastBucket,n.rootBucket);let o=await n.rootBucket._findNewBucketAndPos(e),s=kee(o.pos),a=mAe(o);a.length>n.hamtDepth&&(n.lastBucket=a[n.hamtDepth],s=kee(n.lastBucket._posAtParent));let c=t.Links.find(f=>{if(f.Name==null)return!1;let u=f.Name.substring(0,2),m=f.Name.substring(2);return!(u!==s||m!==""&&m!==e)});if(c==null)return;if(c.Name!=null&&c.Name.substring(2)===e)return c.Hash;n.hamtDepth++;let d=await r.get(c.Hash,i);return t=ud(d),Bee(t,e,r,n,i)},Dee=Bee;p();p();p();function yAe(t){let[e,r]=t[Symbol.asyncIterator]!=null?[t[Symbol.asyncIterator](),Symbol.asyncIterator]:[t[Symbol.iterator](),Symbol.iterator],n=[];return{peek:()=>e.next(),push:i=>{n.push(i)},next:()=>n.length>0?{done:!1,value:n.shift()}:e.next(),[r](){return this}}}var q3=yAe;function gAe(t){return t[Symbol.asyncIterator]!=null}function bAe(t,e){let r=0;if(gAe(t))return async function*(){for await(let c of t)await e(c,r++)&&(yield c)}();let n=q3(t),{value:i,done:o}=n.next();if(o===!0)return function*(){}();let s=e(i,r++);if(typeof s.then=="function")return async function*(){await s&&(yield i);for(let c of n)await e(c,r++)&&(yield c)}();let a=e;return function*(){s===!0&&(yield i);for(let c of n)a(c,r++)&&(yield c)}()}var Cee=bAe;p();function vAe(t){return t[Symbol.asyncIterator]!=null}function wAe(t,e){let r=0;if(vAe(t))return async function*(){for await(let c of t)yield e(c,r++)}();let n=q3(t),{value:i,done:o}=n.next();if(o===!0)return function*(){}();let s=e(i,r++);if(typeof s.then=="function")return async function*(){yield await s;for(let c of n)yield e(c,r++)}();let a=e;return function*(){yield s;for(let c of n)yield a(c,r++)}()}var Py=wAe;p();p();function Uo(){let t={};return t.promise=new Promise((e,r)=>{t.resolve=e,t.reject=r}),t}var L3=globalThis.CustomEvent??Event;async function*_p(t,e={}){let r=e.concurrency??1/0;r<1&&(r=1/0);let n=e.ordered??!1,i=new EventTarget,o=[],s=Uo(),a=Uo(),c=!1,d,f=!1;i.addEventListener("task-complete",()=>{a.resolve()}),Promise.resolve().then(async()=>{try{for await(let v of t){if(o.length===r&&(s=Uo(),await s.promise),f)break;let A={done:!1};o.push(A),v().then(T=>{A.done=!0,A.ok=!0,A.value=T,i.dispatchEvent(new L3("task-complete"))},T=>{A.done=!0,A.err=T,i.dispatchEvent(new L3("task-complete"))})}c=!0,i.dispatchEvent(new L3("task-complete"))}catch(v){d=v,i.dispatchEvent(new L3("task-complete"))}});function u(){return n?o[0]?.done:Boolean(o.find(v=>v.done))}function*m(){for(;o.length>0&&o[0].done;){let v=o[0];if(o.shift(),v.ok)yield v.value;else throw f=!0,s.resolve(),v.err;s.resolve()}}function*_(){for(;u();)for(let v=0;v<o.length;v++)if(o[v].done){let A=o[v];if(o.splice(v,1),v--,A.ok)yield A.value;else throw f=!0,s.resolve(),A.err;s.resolve()}}for(;;){if(u()||(a=Uo(),await a.promise),d!=null||(n?yield*m():yield*_(),d!=null))throw d;if(c&&o.length===0)break}}p();p();p();var U3=class{buffer;mask;top;btm;next;constructor(e){if(!(e>0)||e-1&e)throw new Error("Max size for a FixedFIFO should be a power of two");this.buffer=new Array(e),this.mask=e-1,this.top=0,this.btm=0,this.next=null}push(e){return this.buffer[this.top]!==void 0?!1:(this.buffer[this.top]=e,this.top=this.top+1&this.mask,!0)}shift(){let e=this.buffer[this.btm];if(e!==void 0)return this.buffer[this.btm]=void 0,this.btm=this.btm+1&this.mask,e}isEmpty(){return this.buffer[this.btm]===void 0}},Iy=class{size;hwm;head;tail;constructor(e={}){this.hwm=e.splitLimit??16,this.head=new U3(this.hwm),this.tail=this.head,this.size=0}calculateSize(e){return e?.byteLength!=null?e.byteLength:1}push(e){if(e?.value!=null&&(this.size+=this.calculateSize(e.value)),!this.head.push(e)){let r=this.head;this.head=r.next=new U3(2*this.head.buffer.length),this.head.push(e)}}shift(){let e=this.tail.shift();if(e===void 0&&this.tail.next!=null){let r=this.tail.next;this.tail.next=null,this.tail=r,e=this.tail.shift()}return e?.value!=null&&(this.size-=this.calculateSize(e.value)),e}isEmpty(){return this.head.isEmpty()}};var LI=class extends Error{type;code;constructor(e,r){super(e??"The operation was aborted"),this.type="aborted",this.code=r??"ABORT_ERR"}};function F3(t={}){return _Ae(r=>{let n=r.shift();if(n==null)return{done:!0};if(n.error!=null)throw n.error;return{done:n.done===!0,value:n.value}},t)}function _Ae(t,e){e=e??{};let r=e.onEnd,n=new Iy,i,o,s,a=Uo(),c=async()=>{try{return n.isEmpty()?s?{done:!0}:await new Promise((T,M)=>{o=D=>{o=null,n.push(D);try{T(t(n))}catch(O){M(O)}return i}}):t(n)}finally{n.isEmpty()&&queueMicrotask(()=>{a.resolve(),a=Uo()})}},d=T=>o!=null?o(T):(n.push(T),i),f=T=>(n=new Iy,o!=null?o({error:T}):(n.push({error:T}),i)),u=T=>{if(s)return i;if(e?.objectMode!==!0&&T?.byteLength==null)throw new Error("objectMode was not true but tried to push non-Uint8Array value");return d({done:!1,value:T})},m=T=>s?i:(s=!0,T!=null?f(T):d({done:!0})),_=()=>(n=new Iy,m(),{done:!0}),v=T=>(m(T),{done:!0});if(i={[Symbol.asyncIterator](){return this},next:c,return:_,throw:v,push:u,end:m,get readableLength(){return n.size},onEmpty:async T=>{let M=T?.signal;if(M?.throwIfAborted(),n.isEmpty())return;let D,O;M!=null&&(D=new Promise((U,L)=>{O=()=>{L(new LI)},M.addEventListener("abort",O)}));try{await Promise.race([a.promise,D])}finally{O!=null&&M!=null&&M?.removeEventListener("abort",O)}}},r==null)return i;let A=i;return i={[Symbol.asyncIterator](){return this},next(){return A.next()},throw(T){return A.throw(T),r!=null&&(r(T),r=void 0),{done:!0}},return(){return A.return(),r!=null&&(r(),r=void 0),{done:!0}},push:u,end(T){return A.end(T),r!=null&&(r(T),r=void 0),i},get readableLength(){return A.readableLength},onEmpty:T=>A.onEmpty(T)},i}p();p();p();function xAe(t){return t.reason}async function Oee(t,e,r){if(e==null)return t;let n=r?.translateError??xAe;if(e.aborted)return t.catch(()=>{}),Promise.reject(n(e));let i;try{return await Promise.race([t,new Promise((o,s)=>{i=()=>{s(n(e))},e.addEventListener("abort",i)})])}finally{i!=null&&e.removeEventListener("abort",i)}}var UI=class{readNext;haveNext;ended;nextResult;error;constructor(){this.ended=!1,this.readNext=Uo(),this.haveNext=Uo()}[Symbol.asyncIterator](){return this}async next(){if(this.nextResult==null&&await this.haveNext.promise,this.nextResult==null)throw new Error("HaveNext promise resolved but nextResult was undefined");let e=this.nextResult;return this.nextResult=void 0,this.readNext.resolve(),this.readNext=Uo(),e}async throw(e){return this.ended=!0,this.error=e,e!=null&&(this.haveNext.promise.catch(()=>{}),this.haveNext.reject(e)),{done:!0,value:void 0}}async return(){let e={done:!0,value:void 0};return this.ended=!0,this.nextResult=e,this.haveNext.resolve(),e}async push(e,r){await this._push(e,r)}async end(e,r){e!=null?await this.throw(e):await this._push(void 0,r)}async _push(e,r){if(e!=null&&this.ended)throw this.error??new Error("Cannot push value onto an ended pushable");for(;this.nextResult!=null;)await this.readNext.promise;e!=null?this.nextResult={done:!1,value:e}:(this.ended=!0,this.nextResult={done:!0,value:void 0}),this.haveNext.resolve(),this.haveNext=Uo(),await Oee(this.readNext.promise,r?.signal,r)}};function jee(){return new UI}function EAe(t){return t[Symbol.asyncIterator]!=null}async function SAe(t,e,r){try{await Promise.all(t.map(async n=>{for await(let i of n)await e.push(i,{signal:r}),r.throwIfAborted()})),await e.end(void 0,{signal:r})}catch(n){await e.end(n,{signal:r}).catch(()=>{})}}async function*AAe(t){let e=new AbortController,r=jee();SAe(t,r,e.signal).catch(()=>{});try{yield*r}finally{e.abort()}}function*TAe(t){for(let e of t)yield*e}function PAe(...t){let e=[];for(let r of t)EAe(r)||e.push(r);return e.length===t.length?TAe(e):AAe(t)}var Nee=PAe;function Ry(t,...e){if(t==null)throw new Error("Empty pipeline");if(FI(t)){let n=t;t=()=>n.source}else if(Lee(t)||qee(t)){let n=t;t=()=>n}let r=[t,...e];if(r.length>1&&FI(r[r.length-1])&&(r[r.length-1]=r[r.length-1].sink),r.length>2)for(let n=1;n<r.length-1;n++)FI(r[n])&&(r[n]=RAe(r[n]));return IAe(...r)}var IAe=(...t)=>{let e;for(;t.length>0;)e=t.shift()(e);return e},qee=t=>t?.[Symbol.asyncIterator]!=null,Lee=t=>t?.[Symbol.iterator]!=null,FI=t=>t==null?!1:t.sink!=null&&t.source!=null,RAe=t=>e=>{let r=t.sink(e);if(r?.then!=null){let n=F3({objectMode:!0});r.then(()=>{n.end()},s=>{n.end(s)});let i,o=t.source;if(qee(o))i=async function*(){yield*o,n.end()};else if(Lee(o))i=function*(){yield*o,n.end()};else throw new Error("Unknown duplex source type - must be Iterable or AsyncIterable");return Nee(n,i())}return t.source};var MAe=(t,e,r,n,i,o,s)=>{async function*a(c={}){let d=c.offset??0,f=c.length??e.Links.length,u=e.Links.slice(d,f);c.onProgress?.(new cn("unixfs:exporter:walk:directory",{cid:t})),yield*Ry(u,m=>Py(m,_=>async()=>{let v=_.Name??"",A=`${n}/${v}`;return(await i(_.Hash,v,A,[],o+1,s,c)).entry}),m=>_p(m,{ordered:!0}),m=>Cee(m,_=>_!=null))}return a},Uee=MAe;p();var Ep=mr(Wo(),1);p();p();var $I=mr(zee(),1);p();var I1=class extends Error{constructor(e){super(e),this.name="TimeoutError"}},GI=class extends Error{constructor(e){super(),this.name="AbortError",this.message=e}},$ee=t=>globalThis.DOMException===void 0?new GI(t):new DOMException(t),Gee=t=>{let e=t.reason===void 0?$ee("This operation was aborted."):t.reason;return e instanceof Error?e:$ee(e)};function HI(t,e,r,n){let i,o=new Promise((s,a)=>{if(typeof e!="number"||Math.sign(e)!==1)throw new TypeError(`Expected \`milliseconds\` to be a positive number, got \`${e}\``);if(e===Number.POSITIVE_INFINITY){s(t);return}if(n={customTimers:{setTimeout,clearTimeout},...n},n.signal){let{signal:c}=n;c.aborted&&a(Gee(c)),c.addEventListener("abort",()=>{a(Gee(c))})}i=n.customTimers.setTimeout.call(void 0,()=>{if(typeof r=="function"){try{s(r())}catch(f){a(f)}return}let c=typeof r=="string"?r:`Promise timed out after ${e} milliseconds`,d=r instanceof Error?r:new I1(c);typeof t.cancel=="function"&&t.cancel(),a(d)},e),(async()=>{try{s(await t)}catch(c){a(c)}finally{n.customTimers.clearTimeout.call(void 0,i)}})()});return o.clear=()=>{clearTimeout(i),i=void 0},o}p();p();function WI(t,e,r){let n=0,i=t.length;for(;i>0;){let o=Math.trunc(i/2),s=n+o;r(t[s],e)<=0?(n=++s,i-=o+1):i=o}return n}var xp=function(t,e,r,n){if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!n:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?n:r==="a"?n.call(t):n?n.value:e.get(t)},Tf,VI=class{constructor(){Tf.set(this,[])}enqueue(e,r){r={priority:0,...r};let n={priority:r.priority,run:e};if(this.size&&xp(this,Tf,"f")[this.size-1].priority>=r.priority){xp(this,Tf,"f").push(n);return}let i=WI(xp(this,Tf,"f"),n,(o,s)=>s.priority-o.priority);xp(this,Tf,"f").splice(i,0,n)}dequeue(){let e=xp(this,Tf,"f").shift();return e?.run}filter(e){return xp(this,Tf,"f").filter(r=>r.priority===e.priority).map(r=>r.run)}get size(){return xp(this,Tf,"f").length}};Tf=new WeakMap;var Hee=VI;var on=function(t,e,r,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?t!==e||!i:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(t,r):i?i.value=r:e.set(t,r),r},Se=function(t,e,r,n){if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!n:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?n:r==="a"?n.call(t):n?n.value:e.get(t)},En,M1,k1,Yu,K3,B1,$3,$a,R1,_s,G3,xs,D1,Zu,H3,Wee,Vee,Yee,Kee,Zee,W3,KI,ZI,Z3,Jee,V3,Y3=class extends Error{},YI=class extends $I.default{constructor(e){var r,n,i,o;if(super(),En.add(this),M1.set(this,void 0),k1.set(this,void 0),Yu.set(this,0),K3.set(this,void 0),B1.set(this,void 0),$3.set(this,0),$a.set(this,void 0),R1.set(this,void 0),_s.set(this,void 0),G3.set(this,void 0),xs.set(this,0),D1.set(this,void 0),Zu.set(this,void 0),H3.set(this,void 0),Object.defineProperty(this,"timeout",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),e={carryoverConcurrencyCount:!1,intervalCap:Number.POSITIVE_INFINITY,interval:0,concurrency:Number.POSITIVE_INFINITY,autoStart:!0,queueClass:Hee,...e},!(typeof e.intervalCap=="number"&&e.intervalCap>=1))throw new TypeError(`Expected \`intervalCap\` to be a number from 1 and up, got \`${(n=(r=e.intervalCap)===null||r===void 0?void 0:r.toString())!==null&&n!==void 0?n:""}\` (${typeof e.intervalCap})`);if(e.interval===void 0||!(Number.isFinite(e.interval)&&e.interval>=0))throw new TypeError(`Expected \`interval\` to be a finite number >= 0, got \`${(o=(i=e.interval)===null||i===void 0?void 0:i.toString())!==null&&o!==void 0?o:""}\` (${typeof e.interval})`);on(this,M1,e.carryoverConcurrencyCount,"f"),on(this,k1,e.intervalCap===Number.POSITIVE_INFINITY||e.interval===0,"f"),on(this,K3,e.intervalCap,"f"),on(this,B1,e.interval,"f"),on(this,_s,new e.queueClass,"f"),on(this,G3,e.queueClass,"f"),this.concurrency=e.concurrency,this.timeout=e.timeout,on(this,H3,e.throwOnTimeout===!0,"f"),on(this,Zu,e.autoStart===!1,"f")}get concurrency(){return Se(this,D1,"f")}set concurrency(e){if(!(typeof e=="number"&&e>=1))throw new TypeError(`Expected \`concurrency\` to be a number from 1 and up, got \`${e}\` (${typeof e})`);on(this,D1,e,"f"),Se(this,En,"m",Z3).call(this)}async add(e,r={}){return r={timeout:this.timeout,throwOnTimeout:Se(this,H3,"f"),...r},new Promise((n,i)=>{Se(this,_s,"f").enqueue(async()=>{var o,s,a;on(this,xs,(s=Se(this,xs,"f"),s++,s),"f"),on(this,Yu,(a=Se(this,Yu,"f"),a++,a),"f");try{if(!((o=r.signal)===null||o===void 0)&&o.aborted)throw new Y3("The task was aborted.");let c=e({signal:r.signal});r.timeout&&(c=HI(Promise.resolve(c),r.timeout)),r.signal&&(c=Promise.race([c,Se(this,En,"m",Jee).call(this,r.signal)]));let d=await c;n(d),this.emit("completed",d)}catch(c){if(c instanceof I1&&!r.throwOnTimeout){n();return}i(c),this.emit("error",c)}finally{Se(this,En,"m",Yee).call(this)}},r),this.emit("add"),Se(this,En,"m",W3).call(this)})}async addAll(e,r){return Promise.all(e.map(async n=>this.add(n,r)))}start(){return Se(this,Zu,"f")?(on(this,Zu,!1,"f"),Se(this,En,"m",Z3).call(this),this):this}pause(){on(this,Zu,!0,"f")}clear(){on(this,_s,new(Se(this,G3,"f")),"f")}async onEmpty(){Se(this,_s,"f").size!==0&&await Se(this,En,"m",V3).call(this,"empty")}async onSizeLessThan(e){Se(this,_s,"f").size<e||await Se(this,En,"m",V3).call(this,"next",()=>Se(this,_s,"f").size<e)}async onIdle(){Se(this,xs,"f")===0&&Se(this,_s,"f").size===0||await Se(this,En,"m",V3).call(this,"idle")}get size(){return Se(this,_s,"f").size}sizeBy(e){return Se(this,_s,"f").filter(e).length}get pending(){return Se(this,xs,"f")}get isPaused(){return Se(this,Zu,"f")}};M1=new WeakMap,k1=new WeakMap,Yu=new WeakMap,K3=new WeakMap,B1=new WeakMap,$3=new WeakMap,$a=new WeakMap,R1=new WeakMap,_s=new WeakMap,G3=new WeakMap,xs=new WeakMap,D1=new WeakMap,Zu=new WeakMap,H3=new WeakMap,En=new WeakSet,Wee=function(){return Se(this,k1,"f")||Se(this,Yu,"f")<Se(this,K3,"f")},Vee=function(){return Se(this,xs,"f")<Se(this,D1,"f")},Yee=function(){var e;on(this,xs,(e=Se(this,xs,"f"),e--,e),"f"),Se(this,En,"m",W3).call(this),this.emit("next")},Kee=function(){Se(this,En,"m",ZI).call(this),Se(this,En,"m",KI).call(this),on(this,R1,void 0,"f")},Zee=function(){let e=Date.now();if(Se(this,$a,"f")===void 0){let r=Se(this,$3,"f")-e;if(r<0)on(this,Yu,Se(this,M1,"f")?Se(this,xs,"f"):0,"f");else return Se(this,R1,"f")===void 0&&on(this,R1,setTimeout(()=>{Se(this,En,"m",Kee).call(this)},r),"f"),!0}return!1},W3=function(){if(Se(this,_s,"f").size===0)return Se(this,$a,"f")&&clearInterval(Se(this,$a,"f")),on(this,$a,void 0,"f"),this.emit("empty"),Se(this,xs,"f")===0&&this.emit("idle"),!1;if(!Se(this,Zu,"f")){let e=!Se(this,En,"a",Zee);if(Se(this,En,"a",Wee)&&Se(this,En,"a",Vee)){let r=Se(this,_s,"f").dequeue();return r?(this.emit("active"),r(),e&&Se(this,En,"m",KI).call(this),!0):!1}}return!1},KI=function(){Se(this,k1,"f")||Se(this,$a,"f")!==void 0||(on(this,$a,setInterval(()=>{Se(this,En,"m",ZI).call(this)},Se(this,B1,"f")),"f"),on(this,$3,Date.now()+Se(this,B1,"f"),"f"))},ZI=function(){Se(this,Yu,"f")===0&&Se(this,xs,"f")===0&&Se(this,$a,"f")&&(clearInterval(Se(this,$a,"f")),on(this,$a,void 0,"f")),on(this,Yu,Se(this,M1,"f")?Se(this,xs,"f"):0,"f"),Se(this,En,"m",Z3).call(this)},Z3=function(){for(;Se(this,En,"m",W3).call(this););},Jee=async function(e){return new Promise((r,n)=>{e.addEventListener("abort",()=>{n(new Y3("The task was aborted."))},{once:!0})})},V3=async function(e,r){return new Promise(n=>{let i=()=>{r&&!r()||(this.off(e,i),n())};this.on(e,i)})};var Xee=YI;async function Qee(t,e,r,n,i,o,s){if(e instanceof Uint8Array){let d=wp(e,n,i,o);r.push(d);return}if(e.Data==null)throw(0,Ep.default)(new Error("no data in PBNode"),"ERR_NOT_UNIXFS");let a;try{a=An.unmarshal(e.Data)}catch(d){throw(0,Ep.default)(d,"ERR_NOT_UNIXFS")}if(a.data!=null){let d=a.data,f=wp(d,n,i,o);r.push(f),n+=BigInt(f.byteLength)}let c=[];if(e.Links.length!==a.blockSizes.length)throw(0,Ep.default)(new Error("Inconsistent block sizes and dag links"),"ERR_NOT_UNIXFS");for(let d=0;d<e.Links.length;d++){let f=e.Links[d],u=n,m=u+a.blockSizes[d];if((i>=u&&i<m||o>=u&&o<=m||i<u&&o>m)&&c.push({link:f,blockStart:n}),n=m,n>o)break}await Ry(c,d=>Py(d,f=>async()=>{let u=await t.get(f.link.Hash,s);return{...f,block:u}}),d=>_p(d,{ordered:!0}),async d=>{for await(let{link:f,block:u,blockStart:m}of d){let _;switch(f.Hash.code){case vg:_=ud(u);break;case Qa:_=u;break;default:r.end((0,Ep.default)(new Error(`Unsupported codec: ${f.Hash.code}`),"ERR_NOT_UNIXFS"));return}let v=new Xee({concurrency:1});v.on("error",A=>{r.end(A)}),v.add(async()=>{s.onProgress?.(new cn("unixfs:exporter:walk:file",{cid:f.Hash})),await Qee(t,_,r,m,i,o,s)}),await v.onIdle()}}),n>=o&&r.end()}var DAe=(t,e,r,n,i,o,s)=>{async function*a(c={}){let d=r.fileSize();if(d===void 0)throw new Error("File was a directory");let{start:f,end:u}=Ty(d,c.offset,c.length);if(u===0n)return;let m=0n,_=u-f,v=F3();c.onProgress?.(new cn("unixfs:exporter:walk:file",{cid:t})),Qee(s,e,v,0n,f,u,c).catch(A=>{v.end(A)});for await(let A of v)if(A!=null){if(m+=BigInt(A.byteLength),m>_)throw v.end(),(0,Ep.default)(new Error("Read too many bytes - the file size reported by the UnixFS data in the root node may be incorrect"),"ERR_OVER_READ");m===_&&v.end(),c.onProgress?.(new cn("unixfs:exporter:progress:unixfs:file",{bytesRead:m,totalBytes:_,fileSize:d})),yield A}if(m<_)throw(0,Ep.default)(new Error("Traversed entire DAG but did not read enough bytes"),"ERR_UNDER_READ")}return a},JI=DAe;p();var CAe=(t,e,r,n,i,o,s)=>{function a(c={}){return c.onProgress?.(new cn("unixfs:exporter:walk:hamt-sharded-directory",{cid:t})),ete(e,n,i,o,s,c)}return a};async function*ete(t,e,r,n,i,o){let s=t.Links,a=Ry(s,c=>Py(c,d=>async()=>{let f=d.Name!=null?d.Name.substring(2):null;if(f!=null&&f!==""){let u=await r(d.Hash,f,`${e}/${f}`,[],n+1,i,o);return{entries:u.entry==null?[]:[u.entry]}}else{let u=await i.get(d.Hash,o);return t=ud(u),o.onProgress?.(new cn("unixfs:exporter:walk:hamt-sharded-directory",{cid:d.Hash})),{entries:ete(t,e,r,n,i,o)}}}),c=>_p(c,{ordered:!0}));for await(let{entries:c}of a)yield*c}var tte=CAe;var OAe=(t,e)=>t.Links.find(n=>n.Name===e)?.Hash,jAe={raw:JI,file:JI,directory:Uee,"hamt-sharded-directory":tte,metadata:(t,e,r,n,i,o,s)=>()=>[],symlink:(t,e,r,n,i,o,s)=>()=>[]},NAe=async(t,e,r,n,i,o,s,a)=>{let c=await s.get(t,a),d=ud(c),f,u;if(e==null&&(e=t.toString()),d.Data==null)throw(0,C1.default)(new Error("no data in PBNode"),"ERR_NOT_UNIXFS");try{f=An.unmarshal(d.Data)}catch(_){throw(0,C1.default)(_,"ERR_NOT_UNIXFS")}if(r==null&&(r=e),n.length>0){let _;if(f?.type==="hamt-sharded-directory"?_=await Dee(d,n[0],s):_=OAe(d,n[0]),_==null)throw(0,C1.default)(new Error("file does not exist"),"ERR_NOT_FOUND");let v=n.shift(),A=`${r}/${v}`;u={cid:_,toResolve:n,name:v??"",path:A}}let m=jAe[f.type](t,d,f,r,i,o,s);if(m==null)throw(0,C1.default)(new Error("could not find content exporter"),"ERR_NOT_FOUND");return f.isDirectory()?{entry:{type:"directory",name:e,path:r,cid:t,content:m,unixfs:f,depth:o,node:d,size:f.fileSize()},next:u}:{entry:{type:"file",name:e,path:r,cid:t,content:m,unixfs:f,depth:o,node:d,size:f.fileSize()},next:u}},rte=NAe;var qAe={[vg]:rte,[Qa]:Mee,[vee]:Tee,[See.code]:Iee},ite=async(t,e,r,n,i,o,s)=>{let a=qAe[t.code];if(a==null)throw(0,nte.default)(new Error(`No resolver for code ${t.code}`),"ERR_NO_RESOLVER");return a(t,e,r,n,ite,i,o,s)},ote=ite;var LAe=(t="")=>(t.trim().match(/([^\\^/]|\\\/)+/g)??[]).filter(Boolean),UAe=t=>{if(t instanceof Uint8Array)return{cid:qe.decode(t),toResolve:[]};let e=qe.asCID(t);if(e!=null)return{cid:e,toResolve:[]};if(typeof t=="string"){t.indexOf("/ipfs/")===0&&(t=t.substring(6));let r=LAe(t);return{cid:qe.parse(r[0]),toResolve:r.slice(1)}}throw(0,J3.default)(new Error(`Unknown path type ${t}`),"ERR_BAD_PATH")};async function*FAe(t,e,r={}){let{cid:n,toResolve:i}=UAe(t),o=n.toString(),s=o,a=i.length;for(;;){let c=await ote(n,o,s,i,a,e,r);if(c.entry==null&&c.next==null)throw(0,J3.default)(new Error(`Could not resolve ${t}`),"ERR_NOT_FOUND");if(c.entry!=null&&(yield c.entry),c.next==null)return;i=c.next.toResolve,n=c.next.cid,o=c.next.name,s=c.next.path}}async function XI(t,e,r={}){let n=await QX(FAe(t,e,r));if(n==null)throw(0,J3.default)(new Error(`Could not resolve ${t}`),"ERR_NOT_FOUND");return n}var ate=mr(ex(),1),ste=new Uint8Array,QI=class{constructor(e={}){this.config={blockstoreLocation:"data/DATASTORE",createLevelDatabase:Ua,...e},this.blockstore=new Wu({location:this.config.blockstoreLocation,createLevelDatabase:this.config.createLevelDatabase})}async open(){await this.blockstore.open()}async close(){await this.blockstore.close()}async put(e,r,n,i){await(await this.getBlockstoreForReferenceCounting(e,n)).put(r,ste);let s=await this.getBlockstoreForStoringData(e,n),a=Ig([{content:i}],s,{cidVersion:1}),c;for await(c of a);return{dataCid:String(c.cid),dataSize:Number(c.unixfs?.fileSize()??c.size)}}async get(e,r,n){if(!await(await this.getBlockstoreForReferenceCounting(e,n)).has(r))return;let s=await this.getBlockstoreForStoringData(e,n);if(!await s.has(n))return;let c=await XI(n,s),d=c.content(),f=new ate.Readable({async read(){let m=await d.next();m.done?this.push(null):this.push(m.value)}}),u=c.size;return(c.type==="file"||c.type==="directory")&&(u=c.unixfs.fileSize()),{dataCid:String(c.cid),dataSize:Number(u),dataStream:f}}async associate(e,r,n){let i=await this.getBlockstoreForReferenceCounting(e,n);if(await i.isEmpty())return;let s=await this.getBlockstoreForStoringData(e,n);if(!await s.has(n))return;await i.put(r,ste);let c=await XI(n,s),d=c.size;return(c.type==="file"||c.type==="directory")&&(d=c.unixfs.fileSize()),{dataCid:String(c.cid),dataSize:Number(d)}}async delete(e,r,n){let i=await this.getBlockstoreForReferenceCounting(e,n);if(await i.delete(r),!await i.isEmpty())return;await(await this.getBlockstoreForStoringData(e,n)).clear()}async clear(){await this.blockstore.clear()}async getBlockstoreForReferenceCounting(e,r){let n="references";return await(await(await this.blockstore.partition(n)).partition(e)).partition(r)}async getBlockstoreForStoringData(e,r){let n="data";return await(await(await this.blockstore.partition(n)).partition(e)).partition(r)}};p();p();p();p();p();function O1(t){if(!My(t))throw new Error("Parameter was not an error")}function My(t){return zAe(t)==="[object Error]"||t instanceof Error}function zAe(t){return Object.prototype.toString.call(t)}p();function cte(t){let e,r="";if(t.length===0)e={};else if(My(t[0]))e={cause:t[0]},r=t.slice(1).join(" ")||"";else if(t[0]&&typeof t[0]=="object")e=Object.assign({},t[0]),r=t.slice(1).join(" ")||"";else if(typeof t[0]=="string")e={},r=r=t.join(" ")||"";else throw new Error("Invalid arguments passed to Layerr");return{options:e,shortMessage:r}}var Bi=class extends Error{constructor(e,r){let n=[...arguments],{options:i,shortMessage:o}=cte(n),s=o;if(i.cause&&(s=`${s}: ${i.cause.message}`),super(s),this.message=s,i.name&&typeof i.name=="string"?this.name=i.name:this.name="Layerr",i.cause&&Object.defineProperty(this,"_cause",{value:i.cause}),Object.defineProperty(this,"_info",{value:{}}),i.info&&typeof i.info=="object"&&Object.assign(this._info,i.info),Error.captureStackTrace){let a=i.constructorOpt||this.constructor;Error.captureStackTrace(this,a)}}static cause(e){return O1(e),e._cause&&My(e._cause)?e._cause:null}static fullStack(e){O1(e);let r=Bi.cause(e);return r?`${e.stack}
22
+ caused by: ${Bi.fullStack(r)}`:e.stack}static info(e){O1(e);let r={},n=Bi.cause(e);return n&&Object.assign(r,Bi.info(n)),e._info&&Object.assign(r,e._info),r}cause(){return Bi.cause(this)}toString(){let e=this.name||this.constructor.name||this.constructor.prototype.name;return this.message&&(e=`${e}: ${this.message}`),e}};p();var j1="0123456789ABCDEFGHJKMNPQRSTVWXYZ",ky=32,dte=0xffffffffffff,fte=10,$Ae=16,Sp=Object.freeze({source:"ulid"});function GAe(t){let e=t||HAe(),r=e&&(e.crypto||e.msCrypto)||null;if(typeof r?.getRandomValues=="function")return()=>{let n=new Uint8Array(1);return r.getRandomValues(n),n[0]/255};if(typeof r?.randomBytes=="function")return()=>r.randomBytes(1).readUInt8()/255;throw new Bi({info:{code:"PRNG_DETECT",...Sp}},"Failed to find a reliable PRNG")}function HAe(){return KAe()?self:typeof window<"u"?window:typeof globalThis<"u"||typeof globalThis<"u"?globalThis:null}function WAe(t,e){let r="";for(;t>0;t--)r=ZAe(e)+r;return r}function ute(t,e){if(isNaN(t))throw new Bi({info:{code:"ENC_TIME_NAN",...Sp}},`Time must be a number: ${t}`);if(t>dte)throw new Bi({info:{code:"ENC_TIME_SIZE_EXCEED",...Sp}},`Cannot encode a time larger than ${dte}: ${t}`);if(t<0)throw new Bi({info:{code:"ENC_TIME_NEG",...Sp}},`Time must be positive: ${t}`);if(Number.isInteger(t)===!1)throw new Bi({info:{code:"ENC_TIME_TYPE",...Sp}},`Time must be an integer: ${t}`);let r,n="";for(let i=e;i>0;i--)r=t%ky,n=j1.charAt(r)+n,t=(t-r)/ky;return n}function VAe(t){let e,r=t.length,n,i,o=t,s=ky-1;for(;!e&&r-->=0;){if(n=o[r],i=j1.indexOf(n),i===-1)throw new Bi({info:{code:"B32_INC_ENC",...Sp}},"Incorrectly encoded string");if(i===s){o=lte(o,r,j1[0]);continue}e=lte(o,r,j1[i+1])}if(typeof e=="string")return e;throw new Bi({info:{code:"B32_INC_INVALID",...Sp}},"Failed incrementing string")}function KAe(){return typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope}function hte(t){let e=t||GAe(),r=0,n;return function(o){let s=isNaN(o)?Date.now():o;if(s<=r){let c=n=VAe(n);return ute(r,fte)+c}r=s;let a=n=WAe($Ae,e);return ute(s,fte)+a}}function ZAe(t){let e=Math.floor(t()*ky);return e===ky&&(e=ky-1),j1.charAt(e)}function lte(t,e,r){return e>t.length-1?t:t.substr(0,e)+r+t.substr(e+1)}var pte="watermarks",mte="cids",eR=class{constructor(e){this.config={location:"data/EVENTLOG",createLevelDatabase:Ua,...e},this.db=new La({location:this.config.location,createLevelDatabase:this.config.createLevelDatabase,valueEncoding:"utf8"}),this.ulidFactory=hte()}async open(){return this.db.open()}async close(){return this.db.close()}async clear(){return this.db.clear()}async append(e,r){let n=await this.db.partition(e),i=await n.partition(pte),o=await n.partition(mte),s=this.ulidFactory();return await i.put(s,r),await o.put(r,s),s}async getEvents(e,r){let i=await(await this.db.partition(e)).partition(pte),o=[];for await(let[s,a]of i.iterator(r)){let c={watermark:s,messageCid:a};o.push(c)}return o}async deleteEventsByCid(e,r){if(r.length===0)return 0;let n=await this.db.partition(e),i=await n.partition(mte),o=[],s=[];for(let f of r){o.push({type:"del",key:f});let u=i.get(f).catch(m=>m);s.push(u)}await i.batch(o),o=[];let a=0,c=await Promise.all(s);for(let f of c)f&&(o.push({type:"del",key:f}),a+=1);return await(await n.partition("watermarks")).batch(o),a}};p();p();function X3({enumerable:t=!0,configurable:e=!1}={}){return{enumerable:t,configurable:e,writable:!1}}function*YAe(t,e){if(e!=null&&typeof e=="object")if(Array.isArray(e))for(let[r,n]of e.entries()){let i=[...t,r],o=qe.asCID(n);o?yield[i.join("/"),o]:typeof n=="object"&&(yield*tR(n,i))}else{let r=qe.asCID(e);r?yield[t.join("/"),r]:yield*tR(e,t)}}function*tR(t,e){if(t==null||t instanceof Uint8Array)return;let r=qe.asCID(t);r&&(yield[e.join("/"),r]);for(let[n,i]of Object.entries(t)){let o=[...e,n];yield*YAe(o,i)}}function*JAe(t,e){if(Array.isArray(e))for(let[r,n]of e.entries()){let i=[...t,r];yield i.join("/"),typeof n=="object"&&!qe.asCID(n)&&(yield*rR(n,i))}else yield*rR(e,t)}function*rR(t,e){if(!(t==null||typeof t!="object"))for(let[r,n]of Object.entries(t)){let i=[...e,r];yield i.join("/"),n!=null&&!(n instanceof Uint8Array)&&typeof n=="object"&&!qe.asCID(n)&&(yield*JAe(i,n))}}function XAe(t,e){let r=t;for(let[n,i]of e.entries()){if(r=r[i],r==null)throw new Error(`Object has no property at ${e.slice(0,n+1).map(s=>`[${JSON.stringify(s)}]`).join("")}`);let o=qe.asCID(r);if(o)return{value:o,remaining:e.slice(n+1).join("/")}}return{value:r}}var Q3=class{constructor({cid:e,bytes:r,value:n}){if(!e||!r||typeof n>"u")throw new Error("Missing required argument");this.cid=e,this.bytes=r,this.value=n,this.asBlock=this,Object.defineProperties(this,{cid:X3(),bytes:X3(),value:X3(),asBlock:X3()})}links(){return tR(this.value,[])}tree(){return rR(this.value,[])}get(e="/"){return XAe(this.value,e.split("/").filter(Boolean))}};async function yte({value:t,codec:e,hasher:r}){if(typeof t>"u")throw new Error('Missing required argument "value"');if(!e||!r)throw new Error("Missing required argument: codec or hasher");let n=e.encode(t),i=await r.digest(n),o=qe.create(1,e.code,i);return new Q3({value:t,bytes:n,cid:o})}async function gte({bytes:t,codec:e,hasher:r}){if(!t)throw new Error('Missing required argument "bytes"');if(!e||!r)throw new Error("Missing required argument: codec or hasher");let n=e.decode(t),i=await r.digest(t),o=qe.create(1,e.code,i);return new Q3({value:n,bytes:t,cid:o})}p();var e8=class{static byteArraysEqual(e,r){return e.length===r.length&&e.every((i,o)=>i===r[o])}static async fromAsyncGenerator(e){let r=[];for await(let n of e)r.push(n);return r}static async asyncSort(e,r){for(let n=0;n<e.length;n++)for(let i=n+1;i<e.length;i++)await r(e[n],e[i])>0&&([e[n],e[i]]=[e[i],e[n]]);return e}};p();var q1=class{constructor(e){this.config={createLevelDatabase:Ua,...e},this.db=new La({...this.config,valueEncoding:"utf8"})}async open(){return this.db.open()}async close(){return this.db.close()}async put(e,r,n,i){let o=await Fr(this.db.partition(e),i?.signal);n=aC(n);let s=[];for(let a in n){let c=n[a],d=this.join(a,this.encodeValue(c),r);s.push({type:"put",key:d,value:r})}s.push({type:"put",key:`__${r}__indexes`,value:JSON.stringify(n)}),await o.batch(s,i)}async executeSingleFilterQuery(e,r,n,i){let o={};for(let a in r){let c=r[a];if(typeof c=="object")if(Array.isArray(c)){o[a]=[];for(let d of new Set(c)){let f=this.findExactMatches(e,a,d,i);o[a].push(f)}}else{let d=this.findRangeMatches(e,a,c,i);o[a]=[d]}else{let d=this.findExactMatches(e,a,c,i);o[a]=[d]}}let s={};for(let[a,c]of Object.entries(o))for(let d of c)for(let f of await d)n.has(f)||(s[f]??=new Set([...Object.keys(r)]),s[f].delete(a),s[f].size===0&&n.add(f))}async query(e,r,n){let i=new Set;for(let o of r)await this.executeSingleFilterQuery(e,o,i,n);return[...i]}async delete(e,r,n){let i=await Fr(this.db.partition(e),n?.signal),o=await i.get(`__${r}__indexes`,n);if(!o)return;let s=JSON.parse(o),a=[];for(let c in s){let d=s[c],f=this.join(c,this.encodeValue(d),r);a.push({type:"del",key:f})}a.push({type:"del",key:`__${r}__indexes`}),await i.batch(a,n)}async clear(){return this.db.clear()}async findExactMatches(e,r,n,i){let o=await Fr(this.db.partition(e),i?.signal),s=this.join(r,this.encodeValue(n),""),a={gt:s},c=[];for await(let[d,f]of o.iterator(a,i)){if(!d.startsWith(s))break;c.push(f)}return c}async findRangeMatches(e,r,n,i){let o=await Fr(this.db.partition(e),i?.signal),s={};for(let c in n){let d=c;s[d]=this.join(r,this.encodeValue(n[d]))}s.gt===void 0&&s.gte===void 0&&(s.reverse=!0);let a=[];for await(let[c,d]of o.iterator(s,i))if(!("gt"in n&&q1.extractValueFromKey(c)===this.encodeValue(n.gt))){if(!c.startsWith(r))break;a.push(d)}if("lte"in n)for(let c of await this.findExactMatches(e,r,n.lte,i))a.push(c);return a}encodeValue(e){switch(typeof e){case"string":return`"${e}"`;case"number":return q1.encodeNumberValue(e);default:return String(e)}}static encodeNumberValue(e){let r=Number.MAX_SAFE_INTEGER,n="!",i=String(Number.MAX_SAFE_INTEGER).length,o=e<0?n:"",s=e<0?r:0;return o+String(e+s).padStart(i,"0")}static extractValueFromKey(e){let[,r]=e.split(this.delimiter);return r}join(...e){return e.join(q1.delimiter)}},N1=q1;N1.delimiter="\0";var By=class{constructor(e={}){this.config={blockstoreLocation:"data/MESSAGESTORE",indexLocation:"data/INDEX",createLevelDatabase:Ua,...e},this.blockstore=new Wu({location:this.config.blockstoreLocation,createLevelDatabase:this.config.createLevelDatabase}),this.index=new N1({location:this.config.indexLocation,createLevelDatabase:this.config.createLevelDatabase})}async open(){await this.blockstore.open(),await this.index.open()}async close(){await this.blockstore.close(),await this.index.close()}async get(e,r,n){n?.signal?.throwIfAborted();let i=await Fr(this.blockstore.partition(e),n?.signal),o=qe.parse(r),s=await i.get(o,n);return s?(await Fr(gte({bytes:s,codec:Up,hasher:Eo}),n?.signal)).value:void 0}async query(e,r,n,i,o){o?.signal?.throwIfAborted();let s=[],a=await this.index.query(e,r.map(f=>({...f,tenant:e})),o),c;for(let f of a){let u=await this.get(e,f,o);u&&s.push(u),i?.cursor&&i.cursor===f&&(c=u)}if(i?.cursor!==void 0&&c===void 0)return{messages:[]};let d=await By.sortMessages(s,n);return this.paginateMessages(d,c,i)}async paginateMessages(e,r,n={}){let{limit:i}=n;if(r===void 0&&i===void 0)return{messages:e};let o=r?e.indexOf(r):void 0,s=o===void 0?0:o+1,a=i===void 0?void 0:s+i,c=e.slice(s,a),d=a!==void 0&&a<e.length,f;if(d){let u=c.at(-1);f=await ie.getCid(u)}return{messages:c,cursor:f}}static async lexicographicalCompare(e,r,n,i){let o=e.descriptor[n],s=r.descriptor[n];if(i===1){if(o>s)return 1;if(o<s)return-1}else{if(s>o)return 1;if(s<o)return-1}return await ie.compareCid(e,r)}static async sortMessages(e,r={}){let{dateCreated:n,datePublished:i,messageTimestamp:o}=r,s=1,a=e,c;n!==void 0?c="dateCreated":i!==void 0?(c="datePublished",a=e.filter(f=>f.descriptor.published)):o!==void 0&&(c="messageTimestamp"),c!==void 0?s=r[c]:c="messageTimestamp";let d=(f,u)=>By.lexicographicalCompare(f,u,c,s);return await e8.asyncSort(a,d)}async delete(e,r,n){n?.signal?.throwIfAborted();let i=await Fr(this.blockstore.partition(e),n?.signal),o=qe.parse(r);await i.delete(o,n),await this.index.delete(e,r,n)}async put(e,r,n,i){i?.signal?.throwIfAborted();let o=await Fr(this.blockstore.partition(e),i?.signal),s=await Fr(yte({value:r,codec:Up,hasher:Eo}),i?.signal),a=Wr.parseCid(await ie.getCid(r));await o.put(a,s.bytes,i);let c=a.toString(),d={...n,tenant:e};await this.index.put(e,c,d,i)}async clear(){await this.blockstore.clear(),await this.index.clear()}};p();p();p();p();p();var Dy=crypto,t8=t=>t instanceof CryptoKey;var Fo=new TextEncoder,Ga=new TextDecoder,iot=2**32;function r8(...t){let e=t.reduce((i,{length:o})=>i+o,0),r=new Uint8Array(e),n=0;return t.forEach(i=>{r.set(i,n),n+=i.length}),r}var eTe=t=>{let e=t;typeof e=="string"&&(e=Fo.encode(e));let r=32768,n=[];for(let i=0;i<e.length;i+=r)n.push(String.fromCharCode.apply(null,e.subarray(i,i+r)));return btoa(n.join(""))},n8=t=>eTe(t).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_"),tTe=t=>{let e=atob(t),r=new Uint8Array(e.length);for(let n=0;n<e.length;n++)r[n]=e.charCodeAt(n);return r},i8=t=>{let e=t;e instanceof Uint8Array&&(e=Ga.decode(e)),e=e.replace(/-/g,"+").replace(/_/g,"/").replace(/\s/g,"");try{return tTe(e)}catch{throw new TypeError("The input to be decoded is not correctly encoded.")}};p();var Pf=class extends Error{static get code(){return"ERR_JOSE_GENERIC"}constructor(e){var r;super(e),this.code="ERR_JOSE_GENERIC",this.name=this.constructor.name,(r=Error.captureStackTrace)===null||r===void 0||r.call(Error,this,this.constructor)}},Es=class extends Pf{static get code(){return"ERR_JWT_CLAIM_VALIDATION_FAILED"}constructor(e,r="unspecified",n="unspecified"){super(e),this.code="ERR_JWT_CLAIM_VALIDATION_FAILED",this.claim=r,this.reason=n}},L1=class extends Pf{static get code(){return"ERR_JWT_EXPIRED"}constructor(e,r="unspecified",n="unspecified"){super(e),this.code="ERR_JWT_EXPIRED",this.claim=r,this.reason=n}},o8=class extends Pf{constructor(){super(...arguments),this.code="ERR_JOSE_ALG_NOT_ALLOWED"}static get code(){return"ERR_JOSE_ALG_NOT_ALLOWED"}},Cy=class extends Pf{constructor(){super(...arguments),this.code="ERR_JOSE_NOT_SUPPORTED"}static get code(){return"ERR_JOSE_NOT_SUPPORTED"}};var Rr=class extends Pf{constructor(){super(...arguments),this.code="ERR_JWS_INVALID"}static get code(){return"ERR_JWS_INVALID"}},Ju=class extends Pf{constructor(){super(...arguments),this.code="ERR_JWT_INVALID"}static get code(){return"ERR_JWT_INVALID"}};var s8=class extends Pf{constructor(){super(...arguments),this.code="ERR_JWS_SIGNATURE_VERIFICATION_FAILED",this.message="signature verification failed"}static get code(){return"ERR_JWS_SIGNATURE_VERIFICATION_FAILED"}};p();function If(t,e="algorithm.name"){return new TypeError(`CryptoKey does not support this operation, its ${e} must be ${t}`)}function a8(t,e){return t.name===e}function nR(t){return parseInt(t.name.slice(4),10)}function rTe(t){switch(t){case"ES256":return"P-256";case"ES384":return"P-384";case"ES512":return"P-521";default:throw new Error("unreachable")}}function nTe(t,e){if(e.length&&!e.some(r=>t.usages.includes(r))){let r="CryptoKey does not support this operation, its usages must include ";if(e.length>2){let n=e.pop();r+=`one of ${e.join(", ")}, or ${n}.`}else e.length===2?r+=`one of ${e[0]} or ${e[1]}.`:r+=`${e[0]}.`;throw new TypeError(r)}}function bte(t,e,...r){switch(e){case"HS256":case"HS384":case"HS512":{if(!a8(t.algorithm,"HMAC"))throw If("HMAC");let n=parseInt(e.slice(2),10);if(nR(t.algorithm.hash)!==n)throw If(`SHA-${n}`,"algorithm.hash");break}case"RS256":case"RS384":case"RS512":{if(!a8(t.algorithm,"RSASSA-PKCS1-v1_5"))throw If("RSASSA-PKCS1-v1_5");let n=parseInt(e.slice(2),10);if(nR(t.algorithm.hash)!==n)throw If(`SHA-${n}`,"algorithm.hash");break}case"PS256":case"PS384":case"PS512":{if(!a8(t.algorithm,"RSA-PSS"))throw If("RSA-PSS");let n=parseInt(e.slice(2),10);if(nR(t.algorithm.hash)!==n)throw If(`SHA-${n}`,"algorithm.hash");break}case"EdDSA":{if(t.algorithm.name!=="Ed25519"&&t.algorithm.name!=="Ed448")throw If("Ed25519 or Ed448");break}case"ES256":case"ES384":case"ES512":{if(!a8(t.algorithm,"ECDSA"))throw If("ECDSA");let n=rTe(e);if(t.algorithm.namedCurve!==n)throw If(n,"algorithm.namedCurve");break}default:throw new TypeError("CryptoKey does not support this operation")}nTe(t,r)}p();function vte(t,e,...r){if(r.length>2){let n=r.pop();t+=`one of type ${r.join(", ")}, or ${n}.`}else r.length===2?t+=`one of type ${r[0]} or ${r[1]}.`:t+=`of type ${r[0]}.`;return e==null?t+=` Received ${e}`:typeof e=="function"&&e.name?t+=` Received function ${e.name}`:typeof e=="object"&&e!=null&&e.constructor&&e.constructor.name&&(t+=` Received an instance of ${e.constructor.name}`),t}var iR=(t,...e)=>vte("Key must be ",t,...e);function oR(t,e,...r){return vte(`Key for the ${t} algorithm must be `,e,...r)}p();var sR=t=>t8(t),Xs=["CryptoKey"];p();var iTe=(...t)=>{let e=t.filter(Boolean);if(e.length===0||e.length===1)return!0;let r;for(let n of e){let i=Object.keys(n);if(!r||r.size===0){r=new Set(i);continue}for(let o of i){if(r.has(o))return!1;r.add(o)}}return!0},c8=iTe;p();function oTe(t){return typeof t=="object"&&t!==null}function Xu(t){if(!oTe(t)||Object.prototype.toString.call(t)!=="[object Object]")return!1;if(Object.getPrototypeOf(t)===null)return!0;let e=t;for(;Object.getPrototypeOf(e)!==null;)e=Object.getPrototypeOf(e);return Object.getPrototypeOf(t)===e}p();var d8=(t,e)=>{if(t.startsWith("RS")||t.startsWith("PS")){let{modulusLength:r}=e.algorithm;if(typeof r!="number"||r<2048)throw new TypeError(`${t} requires key modulusLength to be 2048 bits or larger`)}};p();var sTe=(t,e)=>{if(!(e instanceof Uint8Array)){if(!sR(e))throw new TypeError(oR(t,e,...Xs,"Uint8Array"));if(e.type!=="secret")throw new TypeError(`${Xs.join(" or ")} instances for symmetric algorithms must be of type "secret"`)}},aTe=(t,e,r)=>{if(!sR(e))throw new TypeError(oR(t,e,...Xs));if(e.type==="secret")throw new TypeError(`${Xs.join(" or ")} instances for asymmetric algorithms must not be of type "secret"`);if(r==="sign"&&e.type==="public")throw new TypeError(`${Xs.join(" or ")} instances for asymmetric algorithm signing must be of type "private"`);if(r==="decrypt"&&e.type==="public")throw new TypeError(`${Xs.join(" or ")} instances for asymmetric algorithm decryption must be of type "private"`);if(e.algorithm&&r==="verify"&&e.type==="private")throw new TypeError(`${Xs.join(" or ")} instances for asymmetric algorithm verifying must be of type "public"`);if(e.algorithm&&r==="encrypt"&&e.type==="private")throw new TypeError(`${Xs.join(" or ")} instances for asymmetric algorithm encryption must be of type "public"`)},cTe=(t,e,r)=>{t.startsWith("HS")||t==="dir"||t.startsWith("PBES2")||/^A\d{3}(?:GCM)?KW$/.test(t)?sTe(t,e):aTe(t,e,r)},f8=cTe;p();function dTe(t,e,r,n,i){if(i.crit!==void 0&&n.crit===void 0)throw new t('"crit" (Critical) Header Parameter MUST be integrity protected');if(!n||n.crit===void 0)return new Set;if(!Array.isArray(n.crit)||n.crit.length===0||n.crit.some(s=>typeof s!="string"||s.length===0))throw new t('"crit" (Critical) Header Parameter MUST be an array of non-empty strings when present');let o;r!==void 0?o=new Map([...Object.entries(r),...e.entries()]):o=e;for(let s of n.crit){if(!o.has(s))throw new Cy(`Extension Header Parameter "${s}" is not recognized`);if(i[s]===void 0)throw new t(`Extension Header Parameter "${s}" is missing`);if(o.get(s)&&n[s]===void 0)throw new t(`Extension Header Parameter "${s}" MUST be integrity protected`)}return new Set(n.crit)}var u8=dTe;p();var fTe=(t,e)=>{if(e!==void 0&&(!Array.isArray(e)||e.some(r=>typeof r!="string")))throw new TypeError(`"${t}" option must be an array of strings`);if(e)return new Set(e)},wte=fTe;p();p();p();p();function U1(t,e){let r=`SHA-${t.slice(-3)}`;switch(t){case"HS256":case"HS384":case"HS512":return{hash:r,name:"HMAC"};case"PS256":case"PS384":case"PS512":return{hash:r,name:"RSA-PSS",saltLength:t.slice(-3)>>3};case"RS256":case"RS384":case"RS512":return{hash:r,name:"RSASSA-PKCS1-v1_5"};case"ES256":case"ES384":case"ES512":return{hash:r,name:"ECDSA",namedCurve:e.namedCurve};case"EdDSA":return{name:e.name};default:throw new Cy(`alg ${t} is not supported either by JOSE or your javascript runtime`)}}p();function F1(t,e,r){if(t8(e))return bte(e,t,r),e;if(e instanceof Uint8Array){if(!t.startsWith("HS"))throw new TypeError(iR(e,...Xs));return Dy.subtle.importKey("raw",e,{hash:`SHA-${t.slice(-3)}`,name:"HMAC"},!1,[r])}throw new TypeError(iR(e,...Xs,"Uint8Array"))}var uTe=async(t,e,r,n)=>{let i=await F1(t,e,"verify");d8(t,i);let o=U1(t,i.algorithm);try{return await Dy.subtle.verify(o,i,r,n)}catch{return!1}},_te=uTe;async function xte(t,e,r){var n;if(!Xu(t))throw new Rr("Flattened JWS must be an object");if(t.protected===void 0&&t.header===void 0)throw new Rr('Flattened JWS must have either of the "protected" or "header" members');if(t.protected!==void 0&&typeof t.protected!="string")throw new Rr("JWS Protected Header incorrect type");if(t.payload===void 0)throw new Rr("JWS Payload missing");if(typeof t.signature!="string")throw new Rr("JWS Signature missing or incorrect type");if(t.header!==void 0&&!Xu(t.header))throw new Rr("JWS Unprotected Header incorrect type");let i={};if(t.protected)try{let T=i8(t.protected);i=JSON.parse(Ga.decode(T))}catch{throw new Rr("JWS Protected Header is invalid")}if(!c8(i,t.header))throw new Rr("JWS Protected and JWS Unprotected Header Parameter names must be disjoint");let o={...i,...t.header},s=u8(Rr,new Map([["b64",!0]]),r?.crit,i,o),a=!0;if(s.has("b64")&&(a=i.b64,typeof a!="boolean"))throw new Rr('The "b64" (base64url-encode payload) Header Parameter must be a boolean');let{alg:c}=o;if(typeof c!="string"||!c)throw new Rr('JWS "alg" (Algorithm) Header Parameter missing or invalid');let d=r&&wte("algorithms",r.algorithms);if(d&&!d.has(c))throw new o8('"alg" (Algorithm) Header Parameter not allowed');if(a){if(typeof t.payload!="string")throw new Rr("JWS Payload must be a string")}else if(typeof t.payload!="string"&&!(t.payload instanceof Uint8Array))throw new Rr("JWS Payload must be a string or an Uint8Array instance");let f=!1;typeof e=="function"&&(e=await e(i,t),f=!0),f8(c,e,"verify");let u=r8(Fo.encode((n=t.protected)!==null&&n!==void 0?n:""),Fo.encode("."),typeof t.payload=="string"?Fo.encode(t.payload):t.payload),m;try{m=i8(t.signature)}catch{throw new Rr("Failed to base64url decode the signature")}if(!await _te(c,e,m,u))throw new s8;let v;if(a)try{v=i8(t.payload)}catch{throw new Rr("Failed to base64url decode the payload")}else typeof t.payload=="string"?v=Fo.encode(t.payload):v=t.payload;let A={payload:v};return t.protected!==void 0&&(A.protectedHeader=i),t.header!==void 0&&(A.unprotectedHeader=t.header),f?{...A,key:e}:A}async function Ete(t,e,r){if(t instanceof Uint8Array&&(t=Ga.decode(t)),typeof t!="string")throw new Rr("Compact JWS must be a string or Uint8Array");let{0:n,1:i,2:o,length:s}=t.split(".");if(s!==3)throw new Rr("Invalid Compact JWS");let a=await xte({payload:i,protected:n,signature:o},e,r),c={payload:a.payload,protectedHeader:a.protectedHeader};return typeof e=="function"?{...c,key:a.key}:c}p();p();p();var Oy=t=>Math.floor(t.getTime()/1e3);p();var lTe=/^(\d+|\d+\.\d+) ?(seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)$/i,jy=t=>{let e=lTe.exec(t);if(!e)throw new TypeError("Invalid time period format");let r=parseFloat(e[1]);switch(e[2].toLowerCase()){case"sec":case"secs":case"second":case"seconds":case"s":return Math.round(r);case"minute":case"minutes":case"min":case"mins":case"m":return Math.round(r*60);case"hour":case"hours":case"hr":case"hrs":case"h":return Math.round(r*3600);case"day":case"days":case"d":return Math.round(r*86400);case"week":case"weeks":case"w":return Math.round(r*604800);default:return Math.round(r*31557600)}};var Ste=t=>t.toLowerCase().replace(/^application\//,""),hTe=(t,e)=>typeof t=="string"?e.includes(t):Array.isArray(t)?e.some(Set.prototype.has.bind(new Set(t))):!1,Ate=(t,e,r={})=>{let{typ:n}=r;if(n&&(typeof t.typ!="string"||Ste(t.typ)!==Ste(n)))throw new Es('unexpected "typ" JWT header value',"typ","check_failed");let i;try{i=JSON.parse(Ga.decode(e))}catch{}if(!Xu(i))throw new Ju("JWT Claims Set must be a top-level JSON object");let{requiredClaims:o=[],issuer:s,subject:a,audience:c,maxTokenAge:d}=r;d!==void 0&&o.push("iat"),c!==void 0&&o.push("aud"),a!==void 0&&o.push("sub"),s!==void 0&&o.push("iss");for(let _ of new Set(o.reverse()))if(!(_ in i))throw new Es(`missing required "${_}" claim`,_,"missing");if(s&&!(Array.isArray(s)?s:[s]).includes(i.iss))throw new Es('unexpected "iss" claim value',"iss","check_failed");if(a&&i.sub!==a)throw new Es('unexpected "sub" claim value',"sub","check_failed");if(c&&!hTe(i.aud,typeof c=="string"?[c]:c))throw new Es('unexpected "aud" claim value',"aud","check_failed");let f;switch(typeof r.clockTolerance){case"string":f=jy(r.clockTolerance);break;case"number":f=r.clockTolerance;break;case"undefined":f=0;break;default:throw new TypeError("Invalid clockTolerance option type")}let{currentDate:u}=r,m=Oy(u||new Date);if((i.iat!==void 0||d)&&typeof i.iat!="number")throw new Es('"iat" claim must be a number',"iat","invalid");if(i.nbf!==void 0){if(typeof i.nbf!="number")throw new Es('"nbf" claim must be a number',"nbf","invalid");if(i.nbf>m+f)throw new Es('"nbf" claim timestamp check failed',"nbf","check_failed")}if(i.exp!==void 0){if(typeof i.exp!="number")throw new Es('"exp" claim must be a number',"exp","invalid");if(i.exp<=m-f)throw new L1('"exp" claim timestamp check failed',"exp","check_failed")}if(d){let _=m-i.iat,v=typeof d=="number"?d:jy(d);if(_-f>v)throw new L1('"iat" claim timestamp check failed (too far in the past)',"iat","check_failed");if(_<0-f)throw new Es('"iat" claim timestamp check failed (it should be in the past)',"iat","check_failed")}return i};async function aR(t,e,r){var n;let i=await Ete(t,e,r);if(!((n=i.protectedHeader.crit)===null||n===void 0)&&n.includes("b64")&&i.protectedHeader.b64===!1)throw new Ju("JWTs MUST NOT use unencoded payload");let s={payload:Ate(i.protectedHeader,i.payload,r),protectedHeader:i.protectedHeader};return typeof e=="function"?{...s,key:i.key}:s}p();p();p();var pTe=async(t,e,r)=>{let n=await F1(t,e,"sign");d8(t,n);let i=await Dy.subtle.sign(U1(t,n.algorithm),n,r);return new Uint8Array(i)},Tte=pTe;var l8=class{constructor(e){if(!(e instanceof Uint8Array))throw new TypeError("payload must be an instance of Uint8Array");this._payload=e}setProtectedHeader(e){if(this._protectedHeader)throw new TypeError("setProtectedHeader can only be called once");return this._protectedHeader=e,this}setUnprotectedHeader(e){if(this._unprotectedHeader)throw new TypeError("setUnprotectedHeader can only be called once");return this._unprotectedHeader=e,this}async sign(e,r){if(!this._protectedHeader&&!this._unprotectedHeader)throw new Rr("either setProtectedHeader or setUnprotectedHeader must be called before #sign()");if(!c8(this._protectedHeader,this._unprotectedHeader))throw new Rr("JWS Protected and JWS Unprotected Header Parameter names must be disjoint");let n={...this._protectedHeader,...this._unprotectedHeader},i=u8(Rr,new Map([["b64",!0]]),r?.crit,this._protectedHeader,n),o=!0;if(i.has("b64")&&(o=this._protectedHeader.b64,typeof o!="boolean"))throw new Rr('The "b64" (base64url-encode payload) Header Parameter must be a boolean');let{alg:s}=n;if(typeof s!="string"||!s)throw new Rr('JWS "alg" (Algorithm) Header Parameter missing or invalid');f8(s,e,"sign");let a=this._payload;o&&(a=Fo.encode(n8(a)));let c;this._protectedHeader?c=Fo.encode(n8(JSON.stringify(this._protectedHeader))):c=Fo.encode("");let d=r8(c,Fo.encode("."),a),f=await Tte(s,e,d),u={signature:n8(f),payload:""};return o&&(u.payload=Ga.decode(a)),this._unprotectedHeader&&(u.header=this._unprotectedHeader),this._protectedHeader&&(u.protected=Ga.decode(c)),u}};var h8=class{constructor(e){this._flattened=new l8(e)}setProtectedHeader(e){return this._flattened.setProtectedHeader(e),this}async sign(e,r){let n=await this._flattened.sign(e,r);if(n.payload===void 0)throw new TypeError("use the flattened module for creating JWS with b64: false");return`${n.protected}.${n.payload}.${n.signature}`}};p();p();var p8=class{constructor(e){if(!Xu(e))throw new TypeError("JWT Claims Set MUST be an object");this._payload=e}setIssuer(e){return this._payload={...this._payload,iss:e},this}setSubject(e){return this._payload={...this._payload,sub:e},this}setAudience(e){return this._payload={...this._payload,aud:e},this}setJti(e){return this._payload={...this._payload,jti:e},this}setNotBefore(e){return typeof e=="number"?this._payload={...this._payload,nbf:e}:this._payload={...this._payload,nbf:Oy(new Date)+jy(e)},this}setExpirationTime(e){return typeof e=="number"?this._payload={...this._payload,exp:e}:this._payload={...this._payload,exp:Oy(new Date)+jy(e)},this}setIssuedAt(e){return typeof e>"u"?this._payload={...this._payload,iat:Oy(new Date)}:this._payload={...this._payload,iat:e},this}};var z1=class extends p8{setProtectedHeader(e){return this._protectedHeader=e,this}async sign(e,r){var n;let i=new h8(Fo.encode(JSON.stringify(this._payload)));if(i.setProtectedHeader(this._protectedHeader),Array.isArray((n=this._protectedHeader)===null||n===void 0?void 0:n.crit)&&this._protectedHeader.crit.includes("b64")&&this._protectedHeader.b64===!1)throw new Ju("JWTs MUST NOT use unencoded payload");return i.sign(e,r)}};var cR=class{constructor(e){this.jws=e}static async signJWT(e){let r=new TextEncoder().encode("XaA6JrXR1G0"),n="HS256";return await new z1(e).setProtectedHeader({alg:n}).setIssuedAt().setIssuer(e.iss).setSubject(e.sub).setAudience(e.aud||"verifier").setExpirationTime("24h").sign(r)}static async verifyJWT(e){let r=new TextEncoder().encode("XaA6JrXR1G0");return aR(e,r)}};export{Yy as AllowAllTenantGate,M7 as Authenticate,Wr as Cid,QI as DataStoreLevel,Ba as DataStream,y7 as DateSort,ip as DidDhtResolver,Gv as DidIonResolver,Tu as DidKeyResolver,Vv as DidResolver,Kv as Dwn,Cu as DwnConstant,Q as DwnError,sr as DwnErrorCode,Xr as DwnInterfaceName,Qr as DwnMethodName,Be as Encoder,Bc as Encryption,s9 as EncryptionAlgorithm,eR as EventLogLevel,Mu as EventsGet,cR as GeneralJwsSigner,lu as HdKey,fr as Jws,vv as KeyDerivationScheme,ie as Message,By as MessageStoreLevel,pf as MessagesGet,bo as PermissionsGrant,ku as PermissionsRequest,Bu as PermissionsRevoke,Ug as PrivateKeySigner,k7 as Protocols,qo as ProtocolsConfigure,mf as ProtocolsQuery,ur as Records,Du as RecordsDelete,Au as RecordsQuery,ju as RecordsRead,tr as RecordsWrite,qt as Secp256k1,Jx as SortOrder,st as Time,Fr as executeUnlessAborted};
23
+ /*! Bundled license information:
24
+
25
+ ieee754/index.js:
26
+ (*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> *)
27
+
28
+ buffer/index.js:
29
+ (*!
30
+ * The buffer module from node.js, for the browser.
31
+ *
32
+ * @author Feross Aboukhadijeh <https://feross.org>
33
+ * @license MIT
34
+ *)
35
+
36
+ safe-buffer/index.js:
37
+ (*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> *)
38
+
39
+ @noble/ciphers/utils.js:
40
+ (*! noble-ciphers - MIT License (c) 2023 Paul Miller (paulmillr.com) *)
41
+
42
+ @noble/hashes/utils.js:
43
+ (*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) *)
44
+
45
+ @noble/curves/utils.js:
46
+ (*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) *)
47
+
48
+ @noble/curves/abstract/modular.js:
49
+ (*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) *)
50
+
51
+ @noble/curves/abstract/curve.js:
52
+ (*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) *)
53
+
54
+ @noble/curves/abstract/edwards.js:
55
+ (*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) *)
56
+
57
+ @noble/curves/abstract/montgomery.js:
58
+ (*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) *)
59
+
60
+ @noble/curves/ed25519.js:
61
+ (*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) *)
62
+
63
+ @noble/curves/abstract/weierstrass.js:
64
+ (*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) *)
65
+
66
+ @noble/curves/_shortw_utils.js:
67
+ (*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) *)
68
+
69
+ @noble/curves/secp256k1.js:
70
+ (*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) *)
71
+
72
+ queue-microtask/index.js:
73
+ (*! queue-microtask. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> *)
74
+
75
+ run-parallel-limit/index.js:
76
+ (*! run-parallel-limit. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> *)
77
+
78
+ @noble/ed25519/index.js:
79
+ (*! noble-ed25519 - MIT License (c) 2019 Paul Miller (paulmillr.com) *)
80
+
81
+ @noble/secp256k1/index.js:
82
+ (*! noble-secp256k1 - MIT License (c) 2019 Paul Miller (paulmillr.com) *)
83
+ */