constellai 0.3.6 → 0.3.8

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 (477) hide show
  1. package/.next/BUILD_ID +1 -1
  2. package/.next/app-path-routes-manifest.json +3 -3
  3. package/.next/build-manifest.json +6 -6
  4. package/.next/next-minimal-server.js.nft.json +1 -1
  5. package/.next/next-server.js.nft.json +1 -1
  6. package/.next/prerender-manifest.json +3 -3
  7. package/.next/react-loadable-manifest.json +6 -6
  8. package/.next/server/app/(app)/activity/page.js +2 -2
  9. package/.next/server/app/(app)/activity/page.js.nft.json +1 -1
  10. package/.next/server/app/(app)/activity/page_client-reference-manifest.js +1 -1
  11. package/.next/server/app/(app)/agents/[handle]/page.js +3 -3
  12. package/.next/server/app/(app)/agents/[handle]/page.js.nft.json +1 -1
  13. package/.next/server/app/(app)/agents/[handle]/page_client-reference-manifest.js +1 -1
  14. package/.next/server/app/(app)/code/page.js +2 -2
  15. package/.next/server/app/(app)/code/page.js.nft.json +1 -1
  16. package/.next/server/app/(app)/code/page_client-reference-manifest.js +1 -1
  17. package/.next/server/app/(app)/config/page.js +2 -2
  18. package/.next/server/app/(app)/config/page.js.nft.json +1 -1
  19. package/.next/server/app/(app)/config/page_client-reference-manifest.js +1 -1
  20. package/.next/server/app/(app)/costs/page.js +2 -2
  21. package/.next/server/app/(app)/costs/page.js.nft.json +1 -1
  22. package/.next/server/app/(app)/costs/page_client-reference-manifest.js +1 -1
  23. package/.next/server/app/(app)/cron/page.js +2 -2
  24. package/.next/server/app/(app)/cron/page.js.nft.json +1 -1
  25. package/.next/server/app/(app)/cron/page_client-reference-manifest.js +1 -1
  26. package/.next/server/app/(app)/dashboard/page.js +2 -2
  27. package/.next/server/app/(app)/dashboard/page.js.nft.json +1 -1
  28. package/.next/server/app/(app)/dashboard/page_client-reference-manifest.js +1 -1
  29. package/.next/server/app/(app)/design/page.js +53 -53
  30. package/.next/server/app/(app)/design/page.js.nft.json +1 -1
  31. package/.next/server/app/(app)/design/page_client-reference-manifest.js +1 -1
  32. package/.next/server/app/(app)/docs/[id]/page.js +2 -2
  33. package/.next/server/app/(app)/docs/[id]/page.js.nft.json +1 -1
  34. package/.next/server/app/(app)/docs/[id]/page_client-reference-manifest.js +1 -1
  35. package/.next/server/app/(app)/docs/page.js +2 -2
  36. package/.next/server/app/(app)/docs/page.js.nft.json +1 -1
  37. package/.next/server/app/(app)/docs/page_client-reference-manifest.js +1 -1
  38. package/.next/server/app/(app)/github/page.js +2 -2
  39. package/.next/server/app/(app)/github/page.js.nft.json +1 -1
  40. package/.next/server/app/(app)/github/page_client-reference-manifest.js +1 -1
  41. package/.next/server/app/(app)/goals/page.js +2 -2
  42. package/.next/server/app/(app)/goals/page.js.nft.json +1 -1
  43. package/.next/server/app/(app)/goals/page_client-reference-manifest.js +1 -1
  44. package/.next/server/app/(app)/inbox/page.js +2 -2
  45. package/.next/server/app/(app)/inbox/page.js.nft.json +1 -1
  46. package/.next/server/app/(app)/inbox/page_client-reference-manifest.js +1 -1
  47. package/.next/server/app/(app)/knowledge/page.js +3 -3
  48. package/.next/server/app/(app)/knowledge/page.js.nft.json +1 -1
  49. package/.next/server/app/(app)/knowledge/page_client-reference-manifest.js +1 -1
  50. package/.next/server/app/(app)/models/page.js +2 -2
  51. package/.next/server/app/(app)/models/page.js.nft.json +1 -1
  52. package/.next/server/app/(app)/models/page_client-reference-manifest.js +1 -1
  53. package/.next/server/app/(app)/notifications/page.js +2 -2
  54. package/.next/server/app/(app)/notifications/page.js.nft.json +1 -1
  55. package/.next/server/app/(app)/notifications/page_client-reference-manifest.js +1 -1
  56. package/.next/server/app/(app)/org/page.js +4 -4
  57. package/.next/server/app/(app)/org/page.js.nft.json +1 -1
  58. package/.next/server/app/(app)/org/page_client-reference-manifest.js +1 -1
  59. package/.next/server/app/(app)/organizations/page.js +2 -2
  60. package/.next/server/app/(app)/organizations/page.js.nft.json +1 -1
  61. package/.next/server/app/(app)/organizations/page_client-reference-manifest.js +1 -1
  62. package/.next/server/app/(app)/page.js +3 -3
  63. package/.next/server/app/(app)/page.js.nft.json +1 -1
  64. package/.next/server/app/(app)/page_client-reference-manifest.js +1 -1
  65. package/.next/server/app/(app)/planner/page.js +3 -3
  66. package/.next/server/app/(app)/planner/page.js.nft.json +1 -1
  67. package/.next/server/app/(app)/planner/page_client-reference-manifest.js +1 -1
  68. package/.next/server/app/(app)/plugins/page.js +2 -2
  69. package/.next/server/app/(app)/plugins/page.js.nft.json +1 -1
  70. package/.next/server/app/(app)/plugins/page_client-reference-manifest.js +1 -1
  71. package/.next/server/app/(app)/pm/page.js +2 -2
  72. package/.next/server/app/(app)/pm/page.js.nft.json +1 -1
  73. package/.next/server/app/(app)/pm/page_client-reference-manifest.js +1 -1
  74. package/.next/server/app/(app)/prepare-deploy/page.js +3 -3
  75. package/.next/server/app/(app)/prepare-deploy/page.js.nft.json +1 -1
  76. package/.next/server/app/(app)/prepare-deploy/page_client-reference-manifest.js +1 -1
  77. package/.next/server/app/(app)/profile/page.js +2 -2
  78. package/.next/server/app/(app)/profile/page.js.nft.json +1 -1
  79. package/.next/server/app/(app)/profile/page_client-reference-manifest.js +1 -1
  80. package/.next/server/app/(app)/pulse/page.js +2 -2
  81. package/.next/server/app/(app)/pulse/page.js.nft.json +1 -1
  82. package/.next/server/app/(app)/pulse/page_client-reference-manifest.js +1 -1
  83. package/.next/server/app/(app)/reports/[id]/page.js +3 -3
  84. package/.next/server/app/(app)/reports/[id]/page.js.nft.json +1 -1
  85. package/.next/server/app/(app)/reports/[id]/page_client-reference-manifest.js +1 -1
  86. package/.next/server/app/(app)/reports/page.js +3 -3
  87. package/.next/server/app/(app)/reports/page.js.nft.json +1 -1
  88. package/.next/server/app/(app)/reports/page_client-reference-manifest.js +1 -1
  89. package/.next/server/app/(app)/routines/page.js +2 -2
  90. package/.next/server/app/(app)/routines/page.js.nft.json +1 -1
  91. package/.next/server/app/(app)/routines/page_client-reference-manifest.js +1 -1
  92. package/.next/server/app/(app)/search/page.js +2 -2
  93. package/.next/server/app/(app)/search/page.js.nft.json +1 -1
  94. package/.next/server/app/(app)/search/page_client-reference-manifest.js +1 -1
  95. package/.next/server/app/(app)/security/page.js +2 -2
  96. package/.next/server/app/(app)/security/page.js.nft.json +1 -1
  97. package/.next/server/app/(app)/security/page_client-reference-manifest.js +1 -1
  98. package/.next/server/app/(app)/skills/page.js +3 -3
  99. package/.next/server/app/(app)/skills/page.js.nft.json +1 -1
  100. package/.next/server/app/(app)/skills/page_client-reference-manifest.js +1 -1
  101. package/.next/server/app/(app)/tasks/page.js +2 -2
  102. package/.next/server/app/(app)/tasks/page.js.nft.json +1 -1
  103. package/.next/server/app/(app)/tasks/page_client-reference-manifest.js +1 -1
  104. package/.next/server/app/(app)/test-dev/page.js +2 -2
  105. package/.next/server/app/(app)/test-dev/page.js.nft.json +1 -1
  106. package/.next/server/app/(app)/test-dev/page_client-reference-manifest.js +1 -1
  107. package/.next/server/app/(app)/update/page.js +3 -3
  108. package/.next/server/app/(app)/update/page.js.nft.json +1 -1
  109. package/.next/server/app/(app)/update/page_client-reference-manifest.js +1 -1
  110. package/.next/server/app/(auth)/login/page.js +2 -2
  111. package/.next/server/app/(auth)/login/page.js.nft.json +1 -1
  112. package/.next/server/app/(auth)/login/page_client-reference-manifest.js +1 -1
  113. package/.next/server/app/(auth)/onboarding/page.js +2 -2
  114. package/.next/server/app/(auth)/onboarding/page.js.nft.json +1 -1
  115. package/.next/server/app/(auth)/onboarding/page_client-reference-manifest.js +1 -1
  116. package/.next/server/app/_global-error/page.js +3 -3
  117. package/.next/server/app/_global-error/page.js.nft.json +1 -1
  118. package/.next/server/app/_global-error/page_client-reference-manifest.js +1 -1
  119. package/.next/server/app/_global-error.html +1 -1
  120. package/.next/server/app/_global-error.rsc +8 -8
  121. package/.next/server/app/_global-error.segments/_full.segment.rsc +8 -8
  122. package/.next/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +2 -2
  123. package/.next/server/app/_global-error.segments/_global-error.segment.rsc +3 -3
  124. package/.next/server/app/_global-error.segments/_head.segment.rsc +3 -3
  125. package/.next/server/app/_global-error.segments/_index.segment.rsc +4 -4
  126. package/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  127. package/.next/server/app/_not-found/page.js +2 -2
  128. package/.next/server/app/_not-found/page.js.nft.json +1 -1
  129. package/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  130. package/.next/server/app/api/auth/[...all]/route.js +1 -1
  131. package/.next/server/app/api/auth/[...all]/route.js.nft.json +1 -1
  132. package/.next/server/app/api/cron/tick/route.js +5 -5
  133. package/.next/server/app/api/cron/tick/route.js.nft.json +1 -1
  134. package/.next/server/app/api/health/route.js +1 -1
  135. package/.next/server/app/api/health/route.js.nft.json +1 -1
  136. package/.next/server/app/api/locks/acquire/route.js +1 -1
  137. package/.next/server/app/api/locks/acquire/route.js.nft.json +1 -1
  138. package/.next/server/app/api/models/progress/route.js +1 -1
  139. package/.next/server/app/api/models/progress/route.js.nft.json +1 -1
  140. package/.next/server/app/api/passkey/authenticate/options/route.js +1 -1
  141. package/.next/server/app/api/passkey/authenticate/options/route.js.nft.json +1 -1
  142. package/.next/server/app/api/passkey/authenticate/verify/route.js +1 -1
  143. package/.next/server/app/api/passkey/authenticate/verify/route.js.nft.json +1 -1
  144. package/.next/server/app/api/passkey/register/options/route.js +1 -1
  145. package/.next/server/app/api/passkey/register/options/route.js.nft.json +1 -1
  146. package/.next/server/app/api/passkey/register/verify/route.js +1 -1
  147. package/.next/server/app/api/passkey/register/verify/route.js.nft.json +1 -1
  148. package/.next/server/app/api/stream/route.js +2 -2
  149. package/.next/server/app/api/stream/route.js.nft.json +1 -1
  150. package/.next/server/app/api/sync/file/route.js +2 -2
  151. package/.next/server/app/api/sync/file/route.js.nft.json +1 -1
  152. package/.next/server/app/api/telegram/poll/route.js +19 -19
  153. package/.next/server/app/api/telegram/poll/route.js.nft.json +1 -1
  154. package/.next/server/app/api/upload/route.js +1 -1
  155. package/.next/server/app/api/upload/route.js.nft.json +1 -1
  156. package/.next/server/app/api/v1/[[...path]]/route.js +1 -1
  157. package/.next/server/app/api/v1/[[...path]]/route.js.nft.json +1 -1
  158. package/.next/server/app-paths-manifest.json +3 -3
  159. package/.next/server/chunks/1033.js +14 -0
  160. package/.next/server/chunks/1243.js +1 -0
  161. package/.next/server/chunks/{6719.js → 1304.js} +1 -1
  162. package/.next/server/chunks/1678.js +417 -0
  163. package/.next/server/chunks/1952.js +1 -0
  164. package/.next/server/chunks/{8561.js → 1986.js} +2 -2
  165. package/.next/server/chunks/2118.js +869 -0
  166. package/.next/server/chunks/2323.js +1 -0
  167. package/.next/server/chunks/{7336.js → 2392.js} +1 -1
  168. package/.next/server/chunks/2559.js +479 -0
  169. package/.next/server/chunks/26.js +1 -0
  170. package/.next/server/chunks/{5278.js → 3140.js} +1 -1
  171. package/.next/server/chunks/{6479.js → 3172.js} +1 -1
  172. package/.next/server/chunks/3205.js +1 -0
  173. package/.next/server/chunks/3392.js +1 -0
  174. package/.next/server/chunks/{4979.js → 3987.js} +5 -5
  175. package/.next/server/chunks/404.js +1 -0
  176. package/.next/server/chunks/415.js +1 -0
  177. package/.next/server/chunks/4288.js +1 -0
  178. package/.next/server/chunks/{2599.js → 4411.js} +1 -1
  179. package/.next/server/chunks/{7912.js → 4561.js} +1 -1
  180. package/.next/server/chunks/4587.js +1 -0
  181. package/.next/server/chunks/4679.js +462 -1
  182. package/.next/server/chunks/4769.js +1 -0
  183. package/.next/server/chunks/4882.js +2 -0
  184. package/.next/server/chunks/4897.js +15 -0
  185. package/.next/server/chunks/5015.js +15 -0
  186. package/.next/server/chunks/{658.js → 5361.js} +3 -3
  187. package/.next/server/chunks/5557.js +1 -0
  188. package/.next/server/chunks/{2517.js → 5593.js} +1 -1
  189. package/.next/server/chunks/5661.js +1 -0
  190. package/.next/server/chunks/5802.js +1 -0
  191. package/.next/server/chunks/5878.js +1 -0
  192. package/.next/server/chunks/5911.js +18 -0
  193. package/.next/server/chunks/6083.js +1 -0
  194. package/.next/server/chunks/{4302.js → 6121.js} +13 -13
  195. package/.next/server/chunks/6309.js +1 -0
  196. package/.next/server/chunks/6538.js +4 -0
  197. package/.next/server/chunks/6585.js +1 -0
  198. package/.next/server/chunks/{3243.js → 6778.js} +2 -2
  199. package/.next/server/chunks/6807.js +1 -0
  200. package/.next/server/chunks/{1388.js → 6948.js} +1 -1
  201. package/.next/server/chunks/{1591.js → 699.js} +2 -2
  202. package/.next/server/chunks/7109.js +1 -0
  203. package/.next/server/chunks/714.js +1 -0
  204. package/.next/server/chunks/7474.js +1 -0
  205. package/.next/server/chunks/{7037.js → 7677.js} +1 -1
  206. package/.next/server/chunks/77.js +3 -0
  207. package/.next/server/chunks/7727.js +1 -0
  208. package/.next/server/chunks/7867.js +22 -0
  209. package/.next/server/chunks/{259.js → 7905.js} +5 -5
  210. package/.next/server/chunks/{3609.js → 7911.js} +1 -1
  211. package/.next/server/chunks/{2867.js → 8134.js} +2 -2
  212. package/.next/server/chunks/{9783.js → 8211.js} +2 -2
  213. package/.next/server/chunks/8224.js +1 -0
  214. package/.next/server/chunks/8237.js +12 -0
  215. package/.next/server/chunks/8498.js +1 -0
  216. package/.next/server/chunks/{8823.js → 907.js} +10 -10
  217. package/.next/server/chunks/{7778.js → 9099.js} +1 -1
  218. package/.next/server/chunks/912.js +1 -0
  219. package/.next/server/chunks/9180.js +1 -0
  220. package/.next/server/chunks/9344.js +910 -0
  221. package/.next/server/chunks/9374.js +1 -0
  222. package/.next/server/chunks/939.js +1 -0
  223. package/.next/server/chunks/9419.js +1 -0
  224. package/.next/server/chunks/9426.js +188 -0
  225. package/.next/server/chunks/9677.js +17 -0
  226. package/.next/server/chunks/978.js +1 -0
  227. package/.next/server/chunks/9795.js +21 -0
  228. package/.next/server/instrumentation.js +1 -1
  229. package/.next/server/instrumentation.js.nft.json +1 -1
  230. package/.next/server/middleware-build-manifest.js +1 -1
  231. package/.next/server/middleware-react-loadable-manifest.js +1 -1
  232. package/.next/server/middleware.js +6 -6
  233. package/.next/server/middleware.js.nft.json +1 -1
  234. package/.next/server/pages/500.html +1 -1
  235. package/.next/server/server-reference-manifest.js +1 -1
  236. package/.next/server/server-reference-manifest.json +1 -1
  237. package/.next/static/chunks/171-2a8b8f61f7ab0828.js +1 -0
  238. package/.next/static/chunks/{23550918-ff694f70f4b0648c.js → 1ceccf25-731706dbe95504b9.js} +1 -1
  239. package/.next/static/chunks/3556-dbb9200143640484.js +1 -0
  240. package/.next/static/chunks/{2320-fc8b39380e69d465.js → 3703-b09be945970ea475.js} +1 -1
  241. package/.next/static/chunks/5452-d0ce3b51601a5815.js +1 -0
  242. package/.next/static/chunks/5523-9c369c915ee6d9c9.js +1 -0
  243. package/.next/static/chunks/7066-c10959874b2315bf.js +32 -0
  244. package/.next/static/chunks/717-1d1163010e3b541d.js +1 -0
  245. package/.next/static/chunks/7218-21f40f9caef5d658.js +12 -0
  246. package/.next/static/chunks/7363-b9ebe28fed23b997.js +1 -0
  247. package/.next/static/chunks/7621-87d8d0d0568de3ca.js +4 -0
  248. package/.next/static/chunks/{5920.6451a68b63918988.js → 7790.b648690cf25f29eb.js} +1 -1
  249. package/.next/static/chunks/{7509.721cd47a931c5518.js → 8251.6fedb7dc4d720bab.js} +1 -1
  250. package/.next/static/chunks/9279-467412113ad55642.js +1 -0
  251. package/.next/static/chunks/928-6dec8198101bc3e6.js +1 -0
  252. package/.next/static/chunks/9874-dc2fbf114916382b.js +1 -0
  253. package/.next/static/chunks/app/(app)/activity/page-ce3fc6003368f592.js +1 -0
  254. package/.next/static/chunks/app/(app)/agents/[handle]/page-236e13b8edadd480.js +1 -0
  255. package/.next/static/chunks/app/(app)/code/page-18ae765c81a2c709.js +1 -0
  256. package/.next/static/chunks/app/(app)/config/page-8a6fcf6c04337210.js +1 -0
  257. package/.next/static/chunks/app/(app)/costs/page-230b0ef03a2024b0.js +1 -0
  258. package/.next/static/chunks/app/(app)/cron/page-ca89769e2522191d.js +1 -0
  259. package/.next/static/chunks/app/(app)/dashboard/page-6237c3a35cce55ce.js +1 -0
  260. package/.next/static/chunks/app/(app)/design/{page-f48c0487d240248e.js → page-5997054187e59e74.js} +3 -3
  261. package/.next/static/chunks/app/(app)/docs/[id]/page-3362d323e0f4dada.js +1 -0
  262. package/.next/static/chunks/app/(app)/docs/page-d7d8018a7884a4b4.js +1 -0
  263. package/.next/static/chunks/app/(app)/error-f9a3caa63e064a7e.js +1 -0
  264. package/.next/static/chunks/app/(app)/github/page-f5c1cae725d080fb.js +1 -0
  265. package/.next/static/chunks/app/(app)/goals/page-95e85ce115ed9ff3.js +1 -0
  266. package/.next/static/chunks/app/(app)/inbox/page-474c3f0a181bbbd3.js +12 -0
  267. package/.next/static/chunks/app/(app)/knowledge/page-08596428ca34b620.js +1 -0
  268. package/.next/static/chunks/app/(app)/layout-720a1171f7152d86.js +1 -0
  269. package/.next/static/chunks/app/(app)/models/page-fa1eb257e6911c9a.js +1 -0
  270. package/.next/static/chunks/app/(app)/notifications/page-31f2a041bdb497b9.js +12 -0
  271. package/.next/static/chunks/app/(app)/org/page-666438930ddc4639.js +12 -0
  272. package/.next/static/chunks/app/(app)/organizations/page-0de7da829c9b2249.js +1 -0
  273. package/.next/static/chunks/app/(app)/page-bfcf3d25f468240f.js +1 -0
  274. package/.next/static/chunks/app/(app)/planner/page-0fc0ebe2d338769a.js +1 -0
  275. package/.next/static/chunks/app/(app)/plugins/page-ad369fbfec6f3d1c.js +1 -0
  276. package/.next/static/chunks/app/(app)/pm/page-bb39c9d9a4f0d597.js +1 -0
  277. package/.next/static/chunks/app/(app)/prepare-deploy/page-f182991e68b159c1.js +1 -0
  278. package/.next/static/chunks/app/(app)/profile/page-cf5fe16bfad2a7ba.js +1 -0
  279. package/.next/static/chunks/app/(app)/pulse/page-03877c467c491e8a.js +1 -0
  280. package/.next/static/chunks/app/(app)/reports/[id]/page-ca89769e2522191d.js +1 -0
  281. package/.next/static/chunks/app/(app)/reports/page-7741b6a25e582791.js +1 -0
  282. package/.next/static/chunks/app/(app)/routines/page-ea83e6337e7502c2.js +1 -0
  283. package/.next/static/chunks/app/(app)/search/page-5e7f7cf0cc51b76f.js +1 -0
  284. package/.next/static/chunks/app/(app)/security/page-410144cdc35e19cc.js +1 -0
  285. package/.next/static/chunks/app/(app)/skills/page-90e5d8a24920c275.js +1 -0
  286. package/.next/static/chunks/app/(app)/tasks/page-4d535f34ae9c44ca.js +1 -0
  287. package/.next/static/chunks/app/(app)/test-dev/page-782c8cadd8a10feb.js +1 -0
  288. package/.next/static/chunks/app/(app)/update/page-decdb0ece526b50f.js +1 -0
  289. package/.next/static/chunks/app/(auth)/login/page-147a9be880c44d42.js +1 -0
  290. package/.next/static/chunks/app/(auth)/onboarding/page-8548be7e3ab3659e.js +1 -0
  291. package/.next/static/chunks/app/_global-error/{page-eacef2b697bd0982.js → page-ffc45e65538b6024.js} +1 -1
  292. package/.next/static/chunks/app/_not-found/page-405e53afca481eab.js +1 -0
  293. package/.next/static/chunks/app/api/auth/[...all]/{route-eacef2b697bd0982.js → route-ffc45e65538b6024.js} +1 -1
  294. package/.next/static/chunks/app/api/cron/tick/{route-eacef2b697bd0982.js → route-ffc45e65538b6024.js} +1 -1
  295. package/.next/static/chunks/app/api/health/{route-eacef2b697bd0982.js → route-ffc45e65538b6024.js} +1 -1
  296. package/.next/static/chunks/app/api/locks/acquire/route-ffc45e65538b6024.js +1 -0
  297. package/.next/static/chunks/app/api/models/progress/route-ffc45e65538b6024.js +1 -0
  298. package/.next/static/chunks/app/api/passkey/authenticate/options/route-ffc45e65538b6024.js +1 -0
  299. package/.next/static/chunks/app/api/passkey/authenticate/verify/route-ffc45e65538b6024.js +1 -0
  300. package/.next/static/chunks/app/api/passkey/register/options/route-ffc45e65538b6024.js +1 -0
  301. package/.next/static/chunks/app/api/passkey/register/verify/route-ffc45e65538b6024.js +1 -0
  302. package/.next/static/chunks/app/api/stream/route-ffc45e65538b6024.js +1 -0
  303. package/.next/static/chunks/app/api/sync/file/route-ffc45e65538b6024.js +1 -0
  304. package/.next/static/chunks/app/api/telegram/poll/route-ffc45e65538b6024.js +1 -0
  305. package/.next/static/chunks/app/api/upload/route-ffc45e65538b6024.js +1 -0
  306. package/.next/static/chunks/app/api/v1/[[...path]]/route-ffc45e65538b6024.js +1 -0
  307. package/.next/static/chunks/app/error-e128df085a794b38.js +1 -0
  308. package/.next/static/chunks/app/global-error-339c61c4184d384a.js +1 -0
  309. package/.next/static/chunks/app/layout-c717657a60a7f62c.js +1 -0
  310. package/.next/static/chunks/main-143b6dbf9c5dc129.js +5 -0
  311. package/.next/static/chunks/main-app-8ce4eaae11d4f233.js +1 -0
  312. package/.next/static/chunks/next/dist/client/components/builtin/app-error-ffc45e65538b6024.js +1 -0
  313. package/.next/static/chunks/next/dist/client/components/builtin/forbidden-ffc45e65538b6024.js +1 -0
  314. package/.next/static/chunks/next/dist/client/components/builtin/not-found-ffc45e65538b6024.js +1 -0
  315. package/.next/static/chunks/next/dist/client/components/builtin/unauthorized-ffc45e65538b6024.js +1 -0
  316. package/.next/static/chunks/webpack-0e63b9ea83aeb0a2.js +1 -0
  317. package/.next/trace-build +1 -1
  318. package/CHANGELOG.md +45 -1
  319. package/README.md +1 -1
  320. package/README.pt-BR.md +1 -1
  321. package/THIRD_PARTY_LICENSES.md +64 -0
  322. package/docs/UPDATE.md +17 -3
  323. package/docs/en/AI_ARCHITECTURE.md +2 -2
  324. package/docs/en/CHAT_COMMANDS.md +1 -1
  325. package/docs/en/CONFIGURATION.md +1 -1
  326. package/docs/en/DESIGN.md +1 -1
  327. package/docs/en/FAQ.md +3 -3
  328. package/docs/en/GOALS_SPECS_ISSUES.md +1 -1
  329. package/docs/en/MCP.md +2 -2
  330. package/docs/en/PLUGINS.md +2 -2
  331. package/docs/en/PORTABLE_MODE.md +1 -1
  332. package/docs/en/PUBLISHING.md +14 -15
  333. package/docs/en/README.md +1 -1
  334. package/docs/en/SECURITY.md +3 -3
  335. package/docs/en/START_MODE.md +1 -1
  336. package/docs/en/TELEGRAM.md +1 -1
  337. package/docs/en/TROUBLESHOOTING.md +1 -1
  338. package/docs/en/VPS_MODE.md +2 -2
  339. package/docs/pt/AI_ARCHITECTURE.md +2 -2
  340. package/docs/pt/CHAT_COMMANDS.md +1 -1
  341. package/docs/pt/CONFIGURATION.md +1 -1
  342. package/docs/pt/DESIGN.md +1 -1
  343. package/docs/pt/FAQ.md +3 -3
  344. package/docs/pt/GOALS_SPECS_ISSUES.md +1 -1
  345. package/docs/pt/MCP.md +1 -1
  346. package/docs/pt/PLUGINS.md +2 -2
  347. package/docs/pt/PORTABLE_MODE.md +1 -1
  348. package/docs/pt/PUBLISHING.md +6 -7
  349. package/docs/pt/README.md +1 -1
  350. package/docs/pt/SECURITY.md +3 -3
  351. package/docs/pt/START_MODE.md +1 -1
  352. package/docs/pt/TELEGRAM.md +1 -1
  353. package/docs/pt/TROUBLESHOOTING.md +2 -2
  354. package/docs/pt/VPS_MODE.md +1 -1
  355. package/package.json +10 -9
  356. package/scripts/publish-public.mjs +21 -16
  357. package/.next/server/chunks/1249.js +0 -910
  358. package/.next/server/chunks/1572.js +0 -1
  359. package/.next/server/chunks/158.js +0 -21
  360. package/.next/server/chunks/1619.js +0 -188
  361. package/.next/server/chunks/162.js +0 -1
  362. package/.next/server/chunks/1765.js +0 -1
  363. package/.next/server/chunks/1845.js +0 -462
  364. package/.next/server/chunks/2341.js +0 -1
  365. package/.next/server/chunks/2495.js +0 -1
  366. package/.next/server/chunks/260.js +0 -1
  367. package/.next/server/chunks/288.js +0 -1
  368. package/.next/server/chunks/2960.js +0 -14
  369. package/.next/server/chunks/3050.js +0 -18
  370. package/.next/server/chunks/3056.js +0 -1
  371. package/.next/server/chunks/3131.js +0 -1
  372. package/.next/server/chunks/3234.js +0 -869
  373. package/.next/server/chunks/3266.js +0 -15
  374. package/.next/server/chunks/3550.js +0 -1
  375. package/.next/server/chunks/4467.js +0 -12
  376. package/.next/server/chunks/4616.js +0 -479
  377. package/.next/server/chunks/4619.js +0 -1
  378. package/.next/server/chunks/4804.js +0 -1
  379. package/.next/server/chunks/4832.js +0 -2
  380. package/.next/server/chunks/5060.js +0 -1
  381. package/.next/server/chunks/535.js +0 -1
  382. package/.next/server/chunks/5614.js +0 -1
  383. package/.next/server/chunks/6431.js +0 -1
  384. package/.next/server/chunks/6658.js +0 -1
  385. package/.next/server/chunks/6706.js +0 -1
  386. package/.next/server/chunks/683.js +0 -1
  387. package/.next/server/chunks/6873.js +0 -1
  388. package/.next/server/chunks/7225.js +0 -4
  389. package/.next/server/chunks/73.js +0 -17
  390. package/.next/server/chunks/7514.js +0 -1
  391. package/.next/server/chunks/7589.js +0 -22
  392. package/.next/server/chunks/7622.js +0 -1
  393. package/.next/server/chunks/7949.js +0 -1
  394. package/.next/server/chunks/7971.js +0 -1
  395. package/.next/server/chunks/7989.js +0 -1
  396. package/.next/server/chunks/8497.js +0 -1
  397. package/.next/server/chunks/850.js +0 -1
  398. package/.next/server/chunks/8623.js +0 -1
  399. package/.next/server/chunks/8719.js +0 -417
  400. package/.next/server/chunks/8762.js +0 -15
  401. package/.next/server/chunks/9676.js +0 -1
  402. package/.next/server/chunks/9680.js +0 -1
  403. package/.next/server/chunks/9969.js +0 -3
  404. package/.next/static/chunks/2831-d7f6495bf43f4f9d.js +0 -4
  405. package/.next/static/chunks/3219-486bddbf87074d04.js +0 -1
  406. package/.next/static/chunks/3775-82dcdf23109aa5bf.js +0 -1
  407. package/.next/static/chunks/4263-adecb5b466380b6e.js +0 -1
  408. package/.next/static/chunks/6834-4759af1ce7d95fb6.js +0 -32
  409. package/.next/static/chunks/6836-341614c5418e2aa4.js +0 -1
  410. package/.next/static/chunks/7555-d2209e697b0a798e.js +0 -1
  411. package/.next/static/chunks/8306-7418693cd7fd5861.js +0 -1
  412. package/.next/static/chunks/8370-8b3e7106703024ce.js +0 -12
  413. package/.next/static/chunks/9219-4a39a98b5502d9d1.js +0 -1
  414. package/.next/static/chunks/9562-4b50b4e408bc0a42.js +0 -1
  415. package/.next/static/chunks/9690-ea874aec65263b9d.js +0 -1
  416. package/.next/static/chunks/app/(app)/activity/page-cf8d67941440bdce.js +0 -1
  417. package/.next/static/chunks/app/(app)/agents/[handle]/page-7baa24f1ae8bc400.js +0 -1
  418. package/.next/static/chunks/app/(app)/code/page-b342d74807e8b914.js +0 -1
  419. package/.next/static/chunks/app/(app)/config/page-1e68ba8d20215d67.js +0 -1
  420. package/.next/static/chunks/app/(app)/costs/page-a58d759eec6048df.js +0 -1
  421. package/.next/static/chunks/app/(app)/cron/page-cc7f4e3d8ab5618f.js +0 -1
  422. package/.next/static/chunks/app/(app)/dashboard/page-7757c33acf751c4c.js +0 -1
  423. package/.next/static/chunks/app/(app)/docs/[id]/page-95c52cf457d869ef.js +0 -1
  424. package/.next/static/chunks/app/(app)/docs/page-fbc50cd357d5e2ca.js +0 -1
  425. package/.next/static/chunks/app/(app)/error-988cd28480809861.js +0 -1
  426. package/.next/static/chunks/app/(app)/github/page-dac138256ed91e65.js +0 -1
  427. package/.next/static/chunks/app/(app)/goals/page-f87d40f6832d63b3.js +0 -1
  428. package/.next/static/chunks/app/(app)/inbox/page-49c1293e0d98874f.js +0 -12
  429. package/.next/static/chunks/app/(app)/knowledge/page-18fca436883ed5cc.js +0 -1
  430. package/.next/static/chunks/app/(app)/layout-c9778f98c0103f74.js +0 -1
  431. package/.next/static/chunks/app/(app)/models/page-030c085cd7767495.js +0 -1
  432. package/.next/static/chunks/app/(app)/notifications/page-12af3fee8b36a00e.js +0 -12
  433. package/.next/static/chunks/app/(app)/org/page-576001ff4a820744.js +0 -12
  434. package/.next/static/chunks/app/(app)/organizations/page-b973e1eee6e56baf.js +0 -1
  435. package/.next/static/chunks/app/(app)/page-cef52fc5f4fd4418.js +0 -1
  436. package/.next/static/chunks/app/(app)/planner/page-da2db56914346192.js +0 -1
  437. package/.next/static/chunks/app/(app)/plugins/page-3b78b76ecb21d616.js +0 -1
  438. package/.next/static/chunks/app/(app)/pm/page-78303379c1ea5dc5.js +0 -1
  439. package/.next/static/chunks/app/(app)/prepare-deploy/page-98b1bd3bf712bb60.js +0 -1
  440. package/.next/static/chunks/app/(app)/profile/page-de24af53de0ef2b2.js +0 -1
  441. package/.next/static/chunks/app/(app)/pulse/page-db7fd63369c01fa2.js +0 -1
  442. package/.next/static/chunks/app/(app)/reports/[id]/page-cc7f4e3d8ab5618f.js +0 -1
  443. package/.next/static/chunks/app/(app)/reports/page-97ab95e6f8b77b62.js +0 -1
  444. package/.next/static/chunks/app/(app)/routines/page-cf6a3331775ca11b.js +0 -1
  445. package/.next/static/chunks/app/(app)/search/page-3960825f66b05606.js +0 -1
  446. package/.next/static/chunks/app/(app)/security/page-53b0770355cf7aa4.js +0 -1
  447. package/.next/static/chunks/app/(app)/skills/page-809a73b94861f8b8.js +0 -1
  448. package/.next/static/chunks/app/(app)/tasks/page-b2497927d127f7aa.js +0 -1
  449. package/.next/static/chunks/app/(app)/test-dev/page-93ec5d89e2afb612.js +0 -1
  450. package/.next/static/chunks/app/(app)/update/page-a23322af4e59a93c.js +0 -1
  451. package/.next/static/chunks/app/(auth)/login/page-446681bfb762cb05.js +0 -1
  452. package/.next/static/chunks/app/(auth)/onboarding/page-2b8cb3e0b024c995.js +0 -1
  453. package/.next/static/chunks/app/_not-found/page-dc38b02aebeab535.js +0 -1
  454. package/.next/static/chunks/app/api/locks/acquire/route-eacef2b697bd0982.js +0 -1
  455. package/.next/static/chunks/app/api/models/progress/route-eacef2b697bd0982.js +0 -1
  456. package/.next/static/chunks/app/api/passkey/authenticate/options/route-eacef2b697bd0982.js +0 -1
  457. package/.next/static/chunks/app/api/passkey/authenticate/verify/route-eacef2b697bd0982.js +0 -1
  458. package/.next/static/chunks/app/api/passkey/register/options/route-eacef2b697bd0982.js +0 -1
  459. package/.next/static/chunks/app/api/passkey/register/verify/route-eacef2b697bd0982.js +0 -1
  460. package/.next/static/chunks/app/api/stream/route-eacef2b697bd0982.js +0 -1
  461. package/.next/static/chunks/app/api/sync/file/route-eacef2b697bd0982.js +0 -1
  462. package/.next/static/chunks/app/api/telegram/poll/route-eacef2b697bd0982.js +0 -1
  463. package/.next/static/chunks/app/api/upload/route-eacef2b697bd0982.js +0 -1
  464. package/.next/static/chunks/app/api/v1/[[...path]]/route-eacef2b697bd0982.js +0 -1
  465. package/.next/static/chunks/app/error-09899a13c38b6e89.js +0 -1
  466. package/.next/static/chunks/app/global-error-c2ea8fef715f226d.js +0 -1
  467. package/.next/static/chunks/app/layout-e6008e66aea1a849.js +0 -1
  468. package/.next/static/chunks/main-722e16032e7764d1.js +0 -5
  469. package/.next/static/chunks/main-app-761880af2b6f1962.js +0 -1
  470. package/.next/static/chunks/next/dist/client/components/builtin/app-error-eacef2b697bd0982.js +0 -1
  471. package/.next/static/chunks/next/dist/client/components/builtin/forbidden-eacef2b697bd0982.js +0 -1
  472. package/.next/static/chunks/next/dist/client/components/builtin/not-found-eacef2b697bd0982.js +0 -1
  473. package/.next/static/chunks/next/dist/client/components/builtin/unauthorized-eacef2b697bd0982.js +0 -1
  474. package/.next/static/chunks/webpack-222e3894b78c67db.js +0 -1
  475. package/docs/assets/blackhole.svg +0 -37
  476. /package/.next/static/{fb-rRThu8P8AXEQQBbLgT → ehoxBsPzAtE_FyZ2VpMF0}/_buildManifest.js +0 -0
  477. /package/.next/static/{fb-rRThu8P8AXEQQBbLgT → ehoxBsPzAtE_FyZ2VpMF0}/_ssgManifest.js +0 -0
@@ -0,0 +1,188 @@
1
+ exports.id=9426,exports.ids=[9426],exports.modules={29426:(a,b,c)=>{"use strict";let d;c.d(b,{YH:()=>lz,DW:()=>k$,R$:()=>lA,Ay:()=>ly});var e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,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,$,_,aa,ab,ac,ad,ae,af,ag,ah,ai,aj,ak,al,am,an,ao,ap,aq,ar,as,at,au,av,aw,ax,ay,az,aA,aB,aC,aD,aE,aF,aG,aH,aI,aJ,aK,aL,aM,aN,aO,aP,aQ,aR,aS,aT,aU,aV,aW,aX,aY,aZ,a$,a_,a0,a1,a2,a3,a4,a5,a6,a7,a8,a9,ba,bb,bc,bd,be,bf,bg,bh,bi,bj,bk,bl,bm={};c.r(bm),c.d(bm,{Any:()=>dz,BaseBlock:()=>cD,BaseStringBlock:()=>cE,BitString:()=>cY,BmpString:()=>df,Boolean:()=>cU,CharacterString:()=>dr,Choice:()=>dA,Constructed:()=>cP,DATE:()=>du,DEFAULT_MAX_CONTENT_LENGTH:()=>cJ,DEFAULT_MAX_DEPTH:()=>cH,DEFAULT_MAX_NODES:()=>cI,DateTime:()=>dw,Duration:()=>dx,EndOfContent:()=>cR,Enumerated:()=>c0,GeneralString:()=>dq,GeneralizedTime:()=>dt,GraphicString:()=>dn,HexBlock:()=>cx,IA5String:()=>dm,Integer:()=>c_,Null:()=>cS,NumericString:()=>di,ObjectIdentifier:()=>c3,OctetString:()=>cW,Primitive:()=>cG,PrintableString:()=>dj,RawData:()=>dC,RelativeObjectIdentifier:()=>c6,Repeated:()=>dB,Sequence:()=>c7,Set:()=>c8,TIME:()=>dy,TeletexString:()=>dk,TimeOfDay:()=>dv,UTCTime:()=>ds,UniversalString:()=>dh,Utf8String:()=>dd,ValueBlock:()=>cz,VideotexString:()=>dl,ViewWriter:()=>cn,VisibleString:()=>dp,compareSchema:()=>dD,fromBER:()=>cN,verifySchema:()=>dE});let bn="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bo="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bp=a=>{let b="u"<typeof Uint8Array?[]:new Uint8Array(256),c=bn.length;for(let d=0;d<c;d++)b[a.charCodeAt(d)]=d;return b},bq=bp(bn),br=bp(bo),bs=/^[-A-Za-z0-9\-_]*$/,bt=/^[-A-Za-z0-9+/]*={0,3}$/,bu={};function bv(a,b="base64url"){return new Uint8Array(bu.toArrayBuffer(a,"base64url"===b))}function bw(a,b="base64url"){let c=new Uint8Array(a);return bu.fromArrayBuffer(c.buffer,"base64url"===b)}function bx(a){return bu.toString(a,!0)}function by(a){return a=bz(a),bu.validate(a,!0)}function bz(a){return a.replace(/=/g,"")}function bA(a,b,c){let d;if(b<24)return[b,1];let e=a.byteLength-c-1,f=new DataView(a.buffer,c+1),g=0;switch(b){case 24:e>0&&(d=f.getUint8(0),g=2);break;case 25:e>1&&(d=f.getUint16(0,!1),g=3);break;case 26:e>3&&(d=f.getUint32(0,!1),g=5);break;case 27:if(e>7){let a=f.getBigUint64(0,!1);if(a>=24n&&a<=Number.MAX_SAFE_INTEGER)return[Number(a),9]}}if(d&&d>=24)return[d,g];throw Error("Length not supported or not well formed")}function bB(a,b){let c,d=a<<5;if(b<0)throw Error("CBOR Data Item argument must not be negative");if("number"==typeof b){if(!Number.isInteger(b))throw Error("CBOR Data Item argument must be an integer");c=BigInt(b)}else c=b;if(1==a){if(0n==c)throw Error("CBOR Data Item argument cannot be zero when negative");c-=1n}if(c>0xffffffffffffffffn)throw Error("CBOR number out of range");let e=new Uint8Array(8);return(new DataView(e.buffer).setBigUint64(0,c,!1),c<=23)?[d|e[7]]:c<=255?[24|d,e[7]]:c<=65535?[25|d,...e.slice(6)]:c<=0xffffffff?[26|d,...e.slice(4)]:[27|d,...e]}bu.toArrayBuffer=(a,b)=>{let c=a.length,d=.75*a.length,e,f=0,g,h,i,j;"="===a[a.length-1]&&(d--,"="===a[a.length-2]&&d--);let k=new ArrayBuffer(d),l=new Uint8Array(k),m=b?br:bq;for(e=0;e<c;e+=4)g=m[a.charCodeAt(e)],h=m[a.charCodeAt(e+1)],i=m[a.charCodeAt(e+2)],j=m[a.charCodeAt(e+3)],l[f++]=g<<2|h>>4,l[f++]=(15&h)<<4|i>>2,l[f++]=(3&i)<<6|63&j;return k},bu.fromArrayBuffer=(a,b)=>{let c=new Uint8Array(a),d,e="",f=c.length,g=b?bo:bn;for(d=0;d<f;d+=3)e+=g[c[d]>>2],e+=g[(3&c[d])<<4|c[d+1]>>4],e+=g[(15&c[d+1])<<2|c[d+2]>>6],e+=g[63&c[d+2]];let h=f%3;return 2===h?e=e.substring(0,e.length-1)+(b?"":"="):1===h&&(e=e.substring(0,e.length-2)+(b?"":"==")),e},bu.toString=(a,b)=>new TextDecoder().decode(bu.toArrayBuffer(a,b)),bu.fromString=(a,b)=>bu.fromArrayBuffer(new TextEncoder().encode(a),b),bu.validate=(a,b)=>{if(!("string"==typeof a||a instanceof String))return!1;try{return b?bs.test(a):bt.test(a)}catch(a){return!1}},bu.base64=bu;class bC{constructor(a,b){Object.defineProperty(this,"tagId",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"tagValue",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.tagId=a,this.tagValue=b}get tag(){return this.tagId}get value(){return this.tagValue}}function bD(a,b,c){let[d,e]=bA(a,b,c),f=c+e;return[new Uint8Array(a.buffer.slice(f,f+d)),e+d]}let bE=new TextDecoder,bF="Map is not supported or well formed";function bG(a,b){if(b>=a.byteLength)throw Error("CBOR stream ended before tag value");let c=a.getUint8(b),d=31&c;switch(c>>5){case 0:return bA(a,d,b);case 1:return function(a,b,c){let[d,e]=bA(a,b,c);return[-d-1,e]}(a,d,b);case 2:return bD(a,d,b);case 3:return function(a,b,c){let[d,e]=bD(a,b,c);return[bE.decode(d),e]}(a,d,b);case 4:return function(a,b,c){if(0===b)return[[],1];let[d,e]=bA(a,b,c),f=e,g=[];for(let b=0;b<d;b++){if(a.byteLength-c-f<=0)throw Error("array is not supported or well formed");let[b,d]=bG(a,c+f);g.push(b),f+=d}return[g,f]}(a,d,b);case 5:return function(a,b,c){if(0===b)return[new Map,1];let[d,e]=bA(a,b,c),f=e,g=new Map;for(let b=0;b<d;b++){let b=a.byteLength-c-f;if(b<=0)throw Error(bF);let[d,e]=bG(a,c+f);if(f+=e,(b-=e)<=0||"string"!=typeof d&&"number"!=typeof d||g.has(d))throw Error(bF);let[h,i]=bG(a,c+f);f+=i,g.set(d,h)}return[g,f]}(a,d,b);case 6:return function(a,b,c){let[d,e]=bA(a,b,c),[f,g]=bG(a,c+e);return[new bC(d,f),e+g]}(a,d,b);case 7:switch(d){case 20:return[!1,1];case 21:return[!0,1];case 22:return[null,1];case 23:return[void 0,1];case 25:if(b+3>a.byteLength)throw Error("CBOR stream ended before end of Float 16");let e=a.getUint16(b+1,!1);if(31744==e)return[1/0,3];if(32256==e)return[NaN,3];if(64512==e)return[-1/0,3];throw Error("Float16 data is unsupported");case 26:if(b+5>a.byteLength)throw Error("CBOR stream ended before end of Float 32");return[a.getFloat32(b+1,!1),5];case 27:if(b+9>a.byteLength)throw Error("CBOR stream ended before end of Float 64");return[a.getFloat64(b+1,!1),9]}}throw Error(`Unsupported or not well formed at ${b}`)}let bH=new TextEncoder;function bI(a){let[b]=function(a){if(0===a.byteLength||a.byteLength<=0)throw Error("No data");return a instanceof Uint8Array?bG(new DataView(a.buffer),0):a instanceof ArrayBuffer?bG(new DataView(a),0):bG(a,0)}(new Uint8Array(a));return b}function bJ(a){let b=[];!function a(b,c){if("boolean"==typeof b||null===b||void 0==b){var d;return void c.push(!0===(d=b)?245:!1===d?244:null===d?246:247)}if("number"==typeof b||"bigint"==typeof b)return void c.push(...function(a){if("number"==typeof a){if(Number.isSafeInteger(a))if(a<0)return bB(1,Math.abs(a));else return bB(0,a);return[function(a){if(Math.fround(a)==a||!Number.isFinite(a)||Number.isNaN(a)){let b=new Uint8Array(5);return b[0]=250,new DataView(b.buffer).setFloat32(1,a,!1),b}{let b=new Uint8Array(9);return b[0]=251,new DataView(b.buffer).setFloat64(1,a,!1),b}}(a)]}return a<0n?bB(1,-(1n*a)):bB(0,a)}(b));if("string"==typeof b)return void(c.push(...bB(3,b.length)),c.push(bH.encode(b)));if(b instanceof Uint8Array)return void(c.push(...bB(2,b.length)),c.push(b));if(Array.isArray(b))return void function(b,c){for(let d of(c.push(...bB(4,b.length)),b))a(d,c)}(b,c);if(b instanceof Map)return void function(b,c){for(let[d,e]of(c.push(new Uint8Array(bB(5,b.size))),b.entries()))a(d,c),a(e,c)}(b,c);if(b instanceof bC)return void(c.push(...bB(6,b.tag)),a(b.value,c));throw Error("Not implemented")}(a,b);let c=0;for(let a of b)"number"==typeof a?c+=1:c+=a.length;let d=new Uint8Array(c),e=0;for(let a of b)"number"==typeof a?(d[e]=a,e+=1):(d.set(a,e),e+=a.length);return d}function bK(a){let b=a.get(D.kty);return bM(b)&&b===E.EC2}function bL(a){let b=a.get(D.kty);return bM(b)&&b===E.RSA}function bM(a){return Object.values(E).indexOf(a)>=0}function bN(a){return Object.values(G).indexOf(a)>=0}function bO(a){if([G.RS1].indexOf(a)>=0)return"SHA-1";if([G.ES256,G.PS256,G.RS256].indexOf(a)>=0)return"SHA-256";if([G.ES384,G.PS384,G.RS384].indexOf(a)>=0)return"SHA-384";if([G.ES512,G.PS512,G.RS512,G.EdDSA].indexOf(a)>=0)return"SHA-512";throw Error(`Could not map COSE alg value of ${a} to a WebCrypto alg`)}function bP(){return new Promise((a,b)=>{if(d)return a(d);let c=bR.stubThisGlobalThisCrypto();return c?a(d=c):b(new bQ)})}(e=D||(D={}))[e.kty=1]="kty",e[e.alg=3]="alg",e[e.crv=-1]="crv",e[e.x=-2]="x",e[e.y=-3]="y",e[e.n=-1]="n",e[e.e=-2]="e",(f=E||(E={}))[f.OKP=1]="OKP",f[f.EC2=2]="EC2",f[f.RSA=3]="RSA",(g=F||(F={}))[g.P256=1]="P256",g[g.P384=2]="P384",g[g.P521=3]="P521",g[g.ED25519=6]="ED25519",g[g.SECP256K1=8]="SECP256K1",(h=G||(G={}))[h.ES256=-7]="ES256",h[h.EdDSA=-8]="EdDSA",h[h.ES384=-35]="ES384",h[h.ES512=-36]="ES512",h[h.PS256=-37]="PS256",h[h.PS384=-38]="PS384",h[h.PS512=-39]="PS512",h[h.ES256K=-47]="ES256K",h[h.RS256=-257]="RS256",h[h.RS384=-258]="RS384",h[h.RS512=-259]="RS512",h[h.RS1=-65535]="RS1";class bQ extends Error{constructor(){super("An instance of the Crypto API could not be located"),this.name="MissingWebCrypto"}}let bR={stubThisGlobalThisCrypto:()=>globalThis.crypto};async function bS(a,b){let c=await bP(),d=bO(b);return new Uint8Array(await c.subtle.digest(d,a))}async function bT(a){return(await bP()).getRandomValues(a),a}async function bU(a){let b=await bP(),{keyData:c,algorithm:d}=a;return b.subtle.importKey("jwk",c,d,!1,["verify"])}async function bV(a){let b,{cosePublicKey:c,signature:d,data:e,shaHashOverride:f}=a,g=await bP(),h=c.get(D.alg),i=c.get(D.crv),j=c.get(D.x),k=c.get(D.y);if(!h)throw Error("Public key was missing alg (EC2)");if(!i)throw Error("Public key was missing crv (EC2)");if(!j)throw Error("Public key was missing x (EC2)");if(!k)throw Error("Public key was missing y (EC2)");if(i===F.P256)b="P-256";else if(i===F.P384)b="P-384";else if(i===F.P521)b="P-521";else throw Error(`Unexpected COSE crv value of ${i} (EC2)`);let l={kty:"EC",crv:b,x:bw(j),y:bw(k),ext:!1},m={name:"ECDSA",namedCurve:b},n=await bU({keyData:l,algorithm:m}),o=bO(h);f&&(o=bO(f));let p={name:"ECDSA",hash:{name:o}};return g.subtle.verify(p,n,d,e)}function bW(a){if([G.EdDSA].indexOf(a)>=0)return"Ed25519";if([G.ES256,G.ES384,G.ES512,G.ES256K].indexOf(a)>=0)return"ECDSA";if([G.RS256,G.RS384,G.RS512,G.RS1].indexOf(a)>=0)return"RSASSA-PKCS1-v1_5";if([G.PS256,G.PS384,G.PS512].indexOf(a)>=0)return"RSA-PSS";throw Error(`Could not map COSE alg value of ${a} to a WebCrypto key alg name`)}async function bX(a){let{cosePublicKey:b,signature:c,data:d,shaHashOverride:e}=a,f=await bP(),g=b.get(D.alg),h=b.get(D.n),i=b.get(D.e);if(!g)throw Error("Public key was missing alg (RSA)");if(!bN(g))throw Error(`Public key had invalid alg ${g} (RSA)`);if(!h)throw Error("Public key was missing n (RSA)");if(!i)throw Error("Public key was missing e (RSA)");let j={kty:"RSA",alg:"",n:bw(h),e:bw(i),ext:!1},k={name:bW(g),hash:{name:bO(g)}},l={name:bW(g)};if(e&&(k.hash.name=bO(e)),"RSASSA-PKCS1-v1_5"===k.name)"SHA-256"===k.hash.name?j.alg="RS256":"SHA-384"===k.hash.name?j.alg="RS384":"SHA-512"===k.hash.name?j.alg="RS512":"SHA-1"===k.hash.name&&(j.alg="RS1");else if("RSA-PSS"===k.name){let a=0;"SHA-256"===k.hash.name?(j.alg="PS256",a=32):"SHA-384"===k.hash.name?(j.alg="PS384",a=48):"SHA-512"===k.hash.name&&(j.alg="PS512",a=64),l.saltLength=a}else throw Error(`Unexpected RSA key algorithm ${g} (${k.name})`);let m=await bU({keyData:j,algorithm:k});return f.subtle.verify(l,m,c,d)}function bY(a){let b=kR(a);return[b.slice(0,8),b.slice(8,12),b.slice(12,16),b.slice(16,20),b.slice(20,32)].join("-")}function bZ(a){let b;if("string"==typeof a)if(by(a)){let c;c=bu.toArrayBuffer(a,!0),b=bu.fromArrayBuffer(c)}else if(bu.validate(a,!1))b=a;else throw Error("Certificate is not a valid base64 or base64url string");else b=bw(a,"base64");let c="";for(let a=0;a<Math.ceil(b.length/64);a+=1){let d=64*a;c+=`${b.substr(d,64)}
2
+ `}return`-----BEGIN CERTIFICATE-----
3
+ ${c}-----END CERTIFICATE-----
4
+ `}function b$(a){let b=bI(a),c=Uint8Array.from([4]),d=b.get(D.x),e=b.get(D.y);if(!d)throw Error("COSE public key was missing x");return e?kS([c,d,e]):kS([c,d])}let b_=a=>a;function b0(a){let b=JSON.parse(bx(a));return b1.stubThis(b)}let b1={stubThis:a=>a};function b2(a){return b3.stubThis(bI(a))}let b3={stubThis:a=>a};async function b4(){let a=new Uint8Array(32);return await bT(a),b5.stubThis(a)}let b5={stubThis:a=>a};class b6{static isArrayBuffer(a){return"[object ArrayBuffer]"===Object.prototype.toString.call(a)}static toArrayBuffer(a){return this.isArrayBuffer(a)?a:a.byteLength===a.buffer.byteLength||0===a.byteOffset&&a.byteLength===a.buffer.byteLength?a.buffer:this.toUint8Array(a.buffer).slice(a.byteOffset,a.byteOffset+a.byteLength).buffer}static toUint8Array(a){return this.toView(a,Uint8Array)}static toView(a,b){if(a.constructor===b)return a;if(this.isArrayBuffer(a))return new b(a);if(this.isArrayBufferView(a))return new b(a.buffer,a.byteOffset,a.byteLength);throw TypeError("The provided value is not of type '(ArrayBuffer or ArrayBufferView)'")}static isBufferSource(a){return this.isArrayBufferView(a)||this.isArrayBuffer(a)}static isArrayBufferView(a){return ArrayBuffer.isView(a)||a&&this.isArrayBuffer(a.buffer)}static isEqual(a,b){let c=b6.toUint8Array(a),d=b6.toUint8Array(b);if(c.length!==d.byteLength)return!1;for(let a=0;a<c.length;a++)if(c[a]!==d[a])return!1;return!0}static concat(...a){let b;b=!Array.isArray(a[0])||a[1]instanceof Function?Array.isArray(a[0])&&a[1]instanceof Function?a[0]:a[a.length-1]instanceof Function?a.slice(0,a.length-1):a:a[0];let c=0;for(let a of b)c+=a.byteLength;let d=new Uint8Array(c),e=0;for(let a of b){let b=this.toUint8Array(a);d.set(b,e),e+=b.length}return a[a.length-1]instanceof Function?this.toView(d,a[a.length-1]):d.buffer}}let b7="string",b8=/^[0-9a-f\s]+$/i,b9=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/,ca=/^[a-zA-Z0-9-_]+$/;class cb{static fromString(a){let b=unescape(encodeURIComponent(a)),c=new Uint8Array(b.length);for(let a=0;a<b.length;a++)c[a]=b.charCodeAt(a);return c.buffer}static toString(a){let b=b6.toUint8Array(a),c="";for(let a=0;a<b.length;a++)c+=String.fromCharCode(b[a]);return decodeURIComponent(escape(c))}}class cc{static toString(a,b=!1){let c=b6.toArrayBuffer(a),d=new DataView(c),e="";for(let a=0;a<c.byteLength;a+=2)e+=String.fromCharCode(d.getUint16(a,b));return e}static fromString(a,b=!1){let c=new ArrayBuffer(2*a.length),d=new DataView(c);for(let c=0;c<a.length;c++)d.setUint16(2*c,a.charCodeAt(c),b);return c}}class cd{static isHex(a){return typeof a===b7&&b8.test(a)}static isBase64(a){return typeof a===b7&&b9.test(a)}static isBase64Url(a){return typeof a===b7&&ca.test(a)}static ToString(a,b="utf8"){let c=b6.toUint8Array(a);switch(b.toLowerCase()){case"utf8":return this.ToUtf8String(c);case"binary":return this.ToBinary(c);case"hex":return this.ToHex(c);case"base64":return this.ToBase64(c);case"base64url":return this.ToBase64Url(c);case"utf16le":return cc.toString(c,!0);case"utf16":case"utf16be":return cc.toString(c);default:throw Error(`Unknown type of encoding '${b}'`)}}static FromString(a,b="utf8"){if(!a)return new ArrayBuffer(0);switch(b.toLowerCase()){case"utf8":return this.FromUtf8String(a);case"binary":return this.FromBinary(a);case"hex":return this.FromHex(a);case"base64":return this.FromBase64(a);case"base64url":return this.FromBase64Url(a);case"utf16le":return cc.fromString(a,!0);case"utf16":case"utf16be":return cc.fromString(a);default:throw Error(`Unknown type of encoding '${b}'`)}}static ToBase64(a){let b=b6.toUint8Array(a);return"u">typeof btoa?btoa(this.ToString(b,"binary")):Buffer.from(b).toString("base64")}static FromBase64(a){let b=this.formatString(a);if(!b)return new ArrayBuffer(0);if(!cd.isBase64(b))throw TypeError("Argument 'base64Text' is not Base64 encoded");return"u">typeof atob?this.FromBinary(atob(b)):new Uint8Array(Buffer.from(b,"base64")).buffer}static FromBase64Url(a){let b=this.formatString(a);if(!b)return new ArrayBuffer(0);if(!cd.isBase64Url(b))throw TypeError("Argument 'base64url' is not Base64Url encoded");return this.FromBase64(this.Base64Padding(b.replace(/\-/g,"+").replace(/\_/g,"/")))}static ToBase64Url(a){return this.ToBase64(a).replace(/\+/g,"-").replace(/\//g,"_").replace(/\=/g,"")}static FromUtf8String(a,b=cd.DEFAULT_UTF8_ENCODING){switch(b){case"ascii":return this.FromBinary(a);case"utf8":return cb.fromString(a);case"utf16":case"utf16be":return cc.fromString(a);case"utf16le":case"usc2":return cc.fromString(a,!0);default:throw Error(`Unknown type of encoding '${b}'`)}}static ToUtf8String(a,b=cd.DEFAULT_UTF8_ENCODING){switch(b){case"ascii":return this.ToBinary(a);case"utf8":return cb.toString(a);case"utf16":case"utf16be":return cc.toString(a);case"utf16le":case"usc2":return cc.toString(a,!0);default:throw Error(`Unknown type of encoding '${b}'`)}}static FromBinary(a){let b=a.length,c=new Uint8Array(b);for(let d=0;d<b;d++)c[d]=a.charCodeAt(d);return c.buffer}static ToBinary(a){let b=b6.toUint8Array(a),c="";for(let a=0;a<b.length;a++)c+=String.fromCharCode(b[a]);return c}static ToHex(a){let b=b6.toUint8Array(a),c="",d=b.length;for(let a=0;a<d;a++){let d=b[a];d<16&&(c+="0"),c+=d.toString(16)}return c}static FromHex(a){let b=this.formatString(a);if(!b)return new ArrayBuffer(0);if(!cd.isHex(b))throw TypeError("Argument 'hexString' is not HEX encoded");b.length%2&&(b=`0${b}`);let c=new Uint8Array(b.length/2);for(let a=0;a<b.length;a+=2){let d=b.slice(a,a+2);c[a/2]=parseInt(d,16)}return c.buffer}static ToUtf16String(a,b=!1){return cc.toString(a,b)}static FromUtf16String(a,b=!1){return cc.fromString(a,b)}static Base64Padding(a){let b=4-a.length%4;if(b<4)for(let c=0;c<b;c++)a+="=";return a}static formatString(a){return(null==a?void 0:a.replace(/[\n\r\t ]/g,""))||""}}function ce(a,b){if(!(a&&b)||a.byteLength!==b.byteLength)return!1;let c=new Uint8Array(a),d=new Uint8Array(b);for(let b=0;b<a.byteLength;b++)if(c[b]!==d[b])return!1;return!0}function cf(a,b){let c=0;if(1===a.length)return a[0];for(let d=a.length-1;d>=0;d--)c+=a[a.length-1-d]*Math.pow(2,b*d);return c}function cg(a,b,c=-1){let d=a,e=0,f=Math.pow(2,b);for(let g=1;g<8;g++){if(a<f){let a;if(c<0)a=new ArrayBuffer(g),e=g;else{if(c<g)return new ArrayBuffer(0);a=new ArrayBuffer(c),e=c}let f=new Uint8Array(a);for(let a=g-1;a>=0;a--){let c=Math.pow(2,a*b);f[e-a-1]=Math.floor(d/c),d-=f[e-a-1]*c}return a}f*=Math.pow(2,b)}return new ArrayBuffer(0)}function ch(...a){let b=0,c=0;for(let c of a)b+=c.length;let d=new Uint8Array(new ArrayBuffer(b));for(let b of a)d.set(b,c),c+=b.length;return d}function ci(){let a=new Uint8Array(this.valueHex);if(this.valueHex.byteLength>=2){let b=255===a[0]&&128&a[1],c=0===a[0]&&(128&a[1])==0;(b||c)&&this.warnings.push("Needlessly long format")}let b=new Uint8Array(new ArrayBuffer(this.valueHex.byteLength));for(let a=0;a<this.valueHex.byteLength;a++)b[a]=0;b[0]=128&a[0];let c=cf(b,8),d=new Uint8Array(new ArrayBuffer(this.valueHex.byteLength));for(let b=0;b<this.valueHex.byteLength;b++)d[b]=a[b];return d[0]&=127,cf(d,8)-c}function cj(a,b){let c=a.toString(10);if(b<c.length)return"";let d=b-c.length,e=Array(d);for(let a=0;a<d;a++)e[a]="0";return e.join("").concat(c)}function ck(){if("u"<typeof BigInt)throw Error("BigInt is not defined. Your environment doesn't implement BigInt.")}function cl(a){let b=0,c=0;for(let c=0;c<a.length;c++)b+=a[c].byteLength;let d=new Uint8Array(b);for(let b=0;b<a.length;b++){let e=a[b];d.set(new Uint8Array(e),c),c+=e.byteLength}return d.buffer}function cm(a,b,c,d){return b instanceof Uint8Array?b.byteLength?c<0?(a.error="Wrong parameter: inputOffset less than zero",!1):d<0?(a.error="Wrong parameter: inputLength less than zero",!1):!(b.byteLength-c-d<0)||(a.error="End of input reached before message was fully decoded (inconsistent offset and length values)",!1):(a.error="Wrong parameter: inputBuffer has zero length",!1):(a.error="Wrong parameter: inputBuffer must be 'Uint8Array'",!1)}cd.DEFAULT_UTF8_ENCODING="utf8";class cn{constructor(){this.items=[]}write(a){this.items.push(a)}final(){return cl(this.items)}}let co=[new Uint8Array([1])],cp="0123456789",cq="name",cr="valueHexView",cs=new ArrayBuffer(0),ct=new Uint8Array(0),cu="EndOfContent",cv="OCTET STRING",cw="BIT STRING";function cx(a){var b;return(b=class extends a{get valueHex(){return this.valueHexView.slice().buffer}set valueHex(a){this.valueHexView=new Uint8Array(a)}constructor(...a){var b;super(...a);const c=a[0]||{};this.isHexOnly=null!=(b=c.isHexOnly)&&b,this.valueHexView=c.valueHex?b6.toUint8Array(c.valueHex):ct}fromBER(a,b,c,d){let e=a instanceof ArrayBuffer?new Uint8Array(a):a;if(!cm(this,e,b,c))return -1;let f=b+c;return(this.valueHexView=e.subarray(b,f),this.valueHexView.length)?(this.blockLength=c,f):(this.warnings.push("Zero buffer length"),b)}toBER(a=!1){return this.isHexOnly?a?new ArrayBuffer(this.valueHexView.byteLength):this.valueHexView.byteLength===this.valueHexView.buffer.byteLength?this.valueHexView.buffer:this.valueHexView.slice().buffer:(this.error="Flag 'isHexOnly' is not set, abort",cs)}toJSON(){return{...super.toJSON(),isHexOnly:this.isHexOnly,valueHex:cd.ToHex(this.valueHexView)}}}).NAME="hexBlock",b}class cy{static blockName(){return this.NAME}get valueBeforeDecode(){return this.valueBeforeDecodeView.slice().buffer}set valueBeforeDecode(a){this.valueBeforeDecodeView=new Uint8Array(a)}constructor({blockLength:a=0,error:b="",warnings:c=[],valueBeforeDecode:d=ct}={}){this.blockLength=a,this.error=b,this.warnings=c,this.valueBeforeDecodeView=b6.toUint8Array(d)}toJSON(){return{blockName:this.constructor.NAME,blockLength:this.blockLength,error:this.error,warnings:this.warnings,valueBeforeDecode:cd.ToHex(this.valueBeforeDecodeView)}}}cy.NAME="baseBlock";class cz extends cy{fromBER(a,b,c,d){throw TypeError("User need to make a specific function in a class which extends 'ValueBlock'")}toBER(a,b){throw TypeError("User need to make a specific function in a class which extends 'ValueBlock'")}}cz.NAME="valueBlock";class cA extends cx(cy){constructor({idBlock:a={}}={}){var b,c,d,e;super(),a?(this.isHexOnly=null!=(b=a.isHexOnly)&&b,this.valueHexView=a.valueHex?b6.toUint8Array(a.valueHex):ct,this.tagClass=null!=(c=a.tagClass)?c:-1,this.tagNumber=null!=(d=a.tagNumber)?d:-1,this.isConstructed=null!=(e=a.isConstructed)&&e):(this.tagClass=-1,this.tagNumber=-1,this.isConstructed=!1)}toBER(a=!1){let b=0;switch(this.tagClass){case 1:b|=0;break;case 2:b|=64;break;case 3:b|=128;break;case 4:b|=192;break;default:return this.error="Unknown tag class",cs}if(this.isConstructed&&(b|=32),this.tagNumber<31&&!this.isHexOnly){let c=new Uint8Array(1);if(!a){let a=this.tagNumber;a&=31,b|=a,c[0]=b}return c.buffer}if(!this.isHexOnly){let c=cg(this.tagNumber,7),d=new Uint8Array(c),e=c.byteLength,f=new Uint8Array(e+1);if(f[0]=31|b,!a){for(let a=0;a<e-1;a++)f[a+1]=128|d[a];f[e]=d[e-1]}return f.buffer}let c=new Uint8Array(this.valueHexView.byteLength+1);if(c[0]=31|b,!a){let a=this.valueHexView;for(let b=0;b<a.length-1;b++)c[b+1]=128|a[b];c[this.valueHexView.byteLength]=a[a.length-1]}return c.buffer}fromBER(a,b,c){let d=b6.toUint8Array(a);if(!cm(this,d,b,c))return -1;let e=d.subarray(b,b+c);if(0===e.length)return this.error="Zero buffer length",-1;switch(192&e[0]){case 0:this.tagClass=1;break;case 64:this.tagClass=2;break;case 128:this.tagClass=3;break;case 192:this.tagClass=4;break;default:return this.error="Unknown tag class",-1}this.isConstructed=(32&e[0])==32,this.isHexOnly=!1;let f=31&e[0];if(31!==f)this.tagNumber=f,this.blockLength=1;else{let a=0;for(;;){let b=a+1;if(b>=e.length)return this.error="End of input reached before message was fully decoded",-1;if(a++,(128&e[b])==0)break}this.blockLength=a+1;let b=this.valueHexView=new Uint8Array(a);for(let c=0;c<a;c++)b[c]=127&e[c+1];this.blockLength<=9?this.tagNumber=cf(b,7):(this.isHexOnly=!0,this.warnings.push("Tag too long, represented as hex-coded"))}if(1===this.tagClass&&this.isConstructed)switch(this.tagNumber){case 1:case 2:case 5:case 6:case 9:case 13:case 14:case 23:case 24:case 31:case 32:case 33:case 34:return this.error="Constructed encoding used for primitive type",-1}return b+this.blockLength}toJSON(){return{...super.toJSON(),tagClass:this.tagClass,tagNumber:this.tagNumber,isConstructed:this.isConstructed}}}cA.NAME="identificationBlock";class cB extends cy{constructor({lenBlock:a={}}={}){var b,c,d;super(),this.isIndefiniteForm=null!=(b=a.isIndefiniteForm)&&b,this.longFormUsed=null!=(c=a.longFormUsed)&&c,this.length=null!=(d=a.length)?d:0}fromBER(a,b,c){let d=b6.toUint8Array(a);if(!cm(this,d,b,c))return -1;let e=d.subarray(b,b+c);if(0===e.length)return this.error="Zero buffer length",-1;if(255===e[0])return this.error="Length block 0xFF is reserved by standard",-1;if(this.isIndefiniteForm=128===e[0],this.isIndefiniteForm)return this.blockLength=1,b+this.blockLength;if(this.longFormUsed=!!(128&e[0]),!1===this.longFormUsed)return this.length=e[0],this.blockLength=1,b+this.blockLength;let f=127&e[0];if(f>8)return this.error="Too big integer",-1;if(f+1>e.length)return this.error="End of input reached before message was fully decoded",-1;let g=b+1,h=d.subarray(g,g+f);return 0===h[f-1]&&this.warnings.push("Needlessly long encoded length"),this.length=cf(h,8),this.longFormUsed&&this.length<=127&&this.warnings.push("Unnecessary usage of long length form"),this.blockLength=f+1,b+this.blockLength}toBER(a=!1){let b,c;if(this.length>127&&(this.longFormUsed=!0),this.isIndefiniteForm)return b=new ArrayBuffer(1),!1===a&&((c=new Uint8Array(b))[0]=128),b;if(this.longFormUsed){let d=cg(this.length,8);if(d.byteLength>127)return this.error="Too big length",cs;if(b=new ArrayBuffer(d.byteLength+1),a)return b;let e=new Uint8Array(d);(c=new Uint8Array(b))[0]=128|d.byteLength;for(let a=0;a<d.byteLength;a++)c[a+1]=e[a];return b}return b=new ArrayBuffer(1),!1===a&&((c=new Uint8Array(b))[0]=this.length),b}toJSON(){return{...super.toJSON(),isIndefiniteForm:this.isIndefiniteForm,longFormUsed:this.longFormUsed,length:this.length}}}cB.NAME="lengthBlock";let cC={};class cD extends cy{constructor({name:a="",optional:b=!1,primitiveSchema:c,...d}={},e){super(d),this.name=a,this.optional=b,c&&(this.primitiveSchema=c),this.idBlock=new cA(d),this.lenBlock=new cB(d),this.valueBlock=e?new e(d):new cz(d)}fromBER(a,b,c,d){let e=this.valueBlock.fromBER(a,b,this.lenBlock.isIndefiniteForm?c:this.lenBlock.length,d);return -1===e?this.error=this.valueBlock.error:(this.idBlock.error.length||(this.blockLength+=this.idBlock.blockLength),this.lenBlock.error.length||(this.blockLength+=this.lenBlock.blockLength),this.valueBlock.error.length||(this.blockLength+=this.valueBlock.blockLength)),e}toBER(a,b){let c=b||new cn;b||function a(b){var c;if(b instanceof cC.Constructed)for(let c of b.valueBlock.value)a(c)&&(b.lenBlock.isIndefiniteForm=!0);return!!(null==(c=b.lenBlock)?void 0:c.isIndefiniteForm)}(this);let d=this.idBlock.toBER(a);if(c.write(d),this.lenBlock.isIndefiniteForm)c.write(new Uint8Array([128]).buffer),this.valueBlock.toBER(a,c),c.write(new ArrayBuffer(2));else{let b=this.valueBlock.toBER(a);this.lenBlock.length=b.byteLength;let d=this.lenBlock.toBER(a);c.write(d),c.write(b)}return b?cs:c.final()}toJSON(){let a={...super.toJSON(),idBlock:this.idBlock.toJSON(),lenBlock:this.lenBlock.toJSON(),valueBlock:this.valueBlock.toJSON(),name:this.name,optional:this.optional};return this.primitiveSchema&&(a.primitiveSchema=this.primitiveSchema.toJSON()),a}toString(a="ascii"){return"ascii"===a?this.onAsciiEncoding():cd.ToHex(this.toBER())}onAsciiEncoding(){let a=this.constructor.NAME,b=cd.ToHex(this.valueBlock.valueBeforeDecodeView);return`${a} : ${b}`}isEqual(a){if(this===a)return!0;if(!(a instanceof this.constructor))return!1;let b=this.toBER(),c=a.toBER();if(b.byteLength!==c.byteLength)return!1;let d=new Uint8Array(b),e=new Uint8Array(c);for(let a=0;a<d.length;a++)if(d[a]!==e[a])return!1;return!0}}cD.NAME="BaseBlock";class cE extends cD{getValue(){return this.valueBlock.value}setValue(a){this.valueBlock.value=a}constructor({value:a="",...b}={},c){super(b,c),a&&this.fromString(a)}fromBER(a,b,c){let d=this.valueBlock.fromBER(a,b,this.lenBlock.isIndefiniteForm?c:this.lenBlock.length);return -1===d?this.error=this.valueBlock.error:(this.fromBuffer(this.valueBlock.valueHexView),this.idBlock.error.length||(this.blockLength+=this.idBlock.blockLength),this.lenBlock.error.length||(this.blockLength+=this.lenBlock.blockLength),this.valueBlock.error.length||(this.blockLength+=this.valueBlock.blockLength)),d}onAsciiEncoding(){return`${this.constructor.NAME} : '${this.valueBlock.value}'`}}cE.NAME="BaseStringBlock";class cF extends cx(cz){constructor({isHexOnly:a=!0,...b}={}){super(b),this.isHexOnly=a}}cF.NAME="PrimitiveValueBlock";class cG extends cD{constructor(a={}){super(a,cF),this.idBlock.isConstructed=!1}}cC.Primitive=cG,cG.NAME="PRIMITIVE";let cH=100,cI=1e4,cJ=0x1000000;function cK(a={}){var b,c,d;return{depth:0,maxDepth:null!=(b=a.maxDepth)?b:cH,nodesCount:0,maxNodes:null!=(c=a.maxNodes)?c:cI,maxContentLength:null!=(d=a.maxContentLength)?d:cJ}}function cL(a,b,c,d){let e=d.depth+1;if(e>d.maxDepth){let a;return(a=new cD({},cz)).error="Maximum ASN.1 nesting depth exceeded",{offset:-1,result:a}}d.depth=e;try{return cM(a,b,c,d)}finally{d.depth-=1}}function cM(a,b=0,c=a.length,d=cK()){let e=b,f=new cD({},cz),g=new cy;if(!cm(g,a,b,c))return f.error=g.error,{offset:-1,result:f};if(!a.subarray(b,b+c).length)return f.error="Zero buffer length",{offset:-1,result:f};let h=function(a){if(a.nodesCount+=1,a.nodesCount>a.maxNodes)return"Maximum ASN.1 node count exceeded"}(d);if(h)return f.error=h,{offset:-1,result:f};let i=f.idBlock.fromBER(a,b,c);if(f.idBlock.warnings.length&&f.warnings.concat(f.idBlock.warnings),-1===i)return f.error=f.idBlock.error,{offset:-1,result:f};if(b=i,c-=f.idBlock.blockLength,i=f.lenBlock.fromBER(a,b,c),f.lenBlock.warnings.length&&f.warnings.concat(f.lenBlock.warnings),-1===i)return f.error=f.lenBlock.error,{offset:-1,result:f};b=i,c-=f.lenBlock.blockLength;let j=f.lenBlock.isIndefiniteForm?c:f.lenBlock.length,k=function(a,b){if(a>b.maxContentLength)return"Maximum ASN.1 content length exceeded"}(j,d);if(k)return f.error=k,{offset:-1,result:f};if(!f.idBlock.isConstructed&&f.lenBlock.isIndefiniteForm)return f.error="Indefinite length form used for primitive encoding form",{offset:-1,result:f};let l=cD;if(1===f.idBlock.tagClass){if(f.idBlock.tagNumber>=37&&!1===f.idBlock.isHexOnly)return f.error="UNIVERSAL 37 and upper tags are reserved by ASN.1 standard",{offset:-1,result:f};switch(f.idBlock.tagNumber){case 0:if(f.idBlock.isConstructed&&f.lenBlock.length>0)return f.error="Type [UNIVERSAL 0] is reserved",{offset:-1,result:f};l=cC.EndOfContent;break;case 1:l=cC.Boolean;break;case 2:l=cC.Integer;break;case 3:l=cC.BitString;break;case 4:l=cC.OctetString;break;case 5:l=cC.Null;break;case 6:l=cC.ObjectIdentifier;break;case 10:l=cC.Enumerated;break;case 12:l=cC.Utf8String;break;case 13:l=cC.RelativeObjectIdentifier;break;case 14:l=cC.TIME;break;case 15:return f.error="[UNIVERSAL 15] is reserved by ASN.1 standard",{offset:-1,result:f};case 16:l=cC.Sequence;break;case 17:l=cC.Set;break;case 18:l=cC.NumericString;break;case 19:l=cC.PrintableString;break;case 20:l=cC.TeletexString;break;case 21:l=cC.VideotexString;break;case 22:l=cC.IA5String;break;case 23:l=cC.UTCTime;break;case 24:l=cC.GeneralizedTime;break;case 25:l=cC.GraphicString;break;case 26:l=cC.VisibleString;break;case 27:l=cC.GeneralString;break;case 28:l=cC.UniversalString;break;case 29:l=cC.CharacterString;break;case 30:l=cC.BmpString;break;case 31:l=cC.DATE;break;case 32:l=cC.TimeOfDay;break;case 33:l=cC.DateTime;break;case 34:l=cC.Duration;break;default:{let a=f.idBlock.isConstructed?new cC.Constructed:new cC.Primitive;a.idBlock=f.idBlock,a.lenBlock=f.lenBlock,a.warnings=f.warnings,f=a}}}else l=f.idBlock.isConstructed?cC.Constructed:cC.Primitive;return i=(f=function(a,b){if(a instanceof b)return a;let c=new b;return c.idBlock=a.idBlock,c.lenBlock=a.lenBlock,c.warnings=a.warnings,c.valueBeforeDecodeView=a.valueBeforeDecodeView,c}(f,l)).fromBER(a,b,j,d),f.valueBeforeDecodeView=a.subarray(e,e+f.blockLength),{offset:i,result:f}}function cN(a,b={}){if(!a.byteLength){let a=new cD({},cz);return a.error="Input buffer has zero length",{offset:-1,result:a}}return cM(b6.toUint8Array(a).slice(),0,a.byteLength,cK(b))}class cO extends cz{constructor({value:a=[],isIndefiniteForm:b=!1,...c}={}){super(c),this.value=a,this.isIndefiniteForm=b}fromBER(a,b,c,d){var e,f;let g=b6.toUint8Array(a),h=null!=d?d:cK();if(!cm(this,g,b,c))return -1;if(this.valueBeforeDecodeView=g.subarray(b,b+c),0===this.valueBeforeDecodeView.length)return this.warnings.push("Zero buffer length"),b;let i=b;for(;e=this.isIndefiniteForm,f=c,(e?1:f)>0;){let a=cL(g,i,c,h);if(-1===a.offset)return this.error=a.result.error,this.warnings.concat(a.result.warnings),-1;if(i=a.offset,this.blockLength+=a.result.blockLength,c-=a.result.blockLength,this.value.push(a.result),this.isIndefiniteForm&&a.result.constructor.NAME===cu)break}return this.isIndefiniteForm&&(this.value[this.value.length-1].constructor.NAME===cu?this.value.pop():this.warnings.push("No EndOfContent block encoded")),i}toBER(a,b){let c=b||new cn;for(let b=0;b<this.value.length;b++)this.value[b].toBER(a,c);return b?cs:c.final()}toJSON(){let a={...super.toJSON(),isIndefiniteForm:this.isIndefiniteForm,value:[]};for(let b of this.value)a.value.push(b.toJSON());return a}}cO.NAME="ConstructedValueBlock";class cP extends cD{constructor(a={}){super(a,cO),this.idBlock.isConstructed=!0}fromBER(a,b,c,d){this.valueBlock.isIndefiniteForm=this.lenBlock.isIndefiniteForm;let e=this.valueBlock.fromBER(a,b,this.lenBlock.isIndefiniteForm?c:this.lenBlock.length,d);return -1===e?this.error=this.valueBlock.error:(this.idBlock.error.length||(this.blockLength+=this.idBlock.blockLength),this.lenBlock.error.length||(this.blockLength+=this.lenBlock.blockLength),this.valueBlock.error.length||(this.blockLength+=this.valueBlock.blockLength)),e}onAsciiEncoding(){let a=[];for(let b of this.valueBlock.value)a.push(b.toString("ascii").split("\n").map(a=>` ${a}`).join("\n"));let b=3===this.idBlock.tagClass?`[${this.idBlock.tagNumber}]`:this.constructor.NAME;return a.length?`${b} :
5
+ ${a.join("\n")}`:`${b} :`}}cC.Constructed=cP,cP.NAME="CONSTRUCTED";class cQ extends cz{fromBER(a,b,c){return b}toBER(a){return cs}}cQ.override="EndOfContentValueBlock";class cR extends cD{constructor(a={}){super(a,cQ),this.idBlock.tagClass=1,this.idBlock.tagNumber=0}}cC.EndOfContent=cR,cR.NAME=cu;class cS extends cD{constructor(a={}){super(a,cz),this.idBlock.tagClass=1,this.idBlock.tagNumber=5}fromBER(a,b,c){return(this.lenBlock.length>0&&this.warnings.push("Non-zero length of value block for Null type"),this.idBlock.error.length||(this.blockLength+=this.idBlock.blockLength),this.lenBlock.error.length||(this.blockLength+=this.lenBlock.blockLength),this.blockLength+=c,b+c>a.byteLength)?(this.error="End of input reached before message was fully decoded (inconsistent offset and length values)",-1):b+c}toBER(a,b){let c=new ArrayBuffer(2);if(!a){let a=new Uint8Array(c);a[0]=5,a[1]=0}return b&&b.write(c),c}onAsciiEncoding(){return`${this.constructor.NAME}`}}cC.Null=cS,cS.NAME="NULL";class cT extends cx(cz){get value(){for(let a of this.valueHexView)if(a>0)return!0;return!1}set value(a){this.valueHexView[0]=255*!!a}constructor({value:a,...b}={}){super(b),b.valueHex?this.valueHexView=b6.toUint8Array(b.valueHex):this.valueHexView=new Uint8Array(1),a&&(this.value=a)}fromBER(a,b,c){let d=b6.toUint8Array(a);return cm(this,d,b,c)?(this.valueHexView=d.subarray(b,b+c),c>1&&this.warnings.push("Boolean value encoded in more then 1 octet"),this.isHexOnly=!0,ci.call(this),this.blockLength=c,b+c):-1}toBER(){return this.valueHexView.slice()}toJSON(){return{...super.toJSON(),value:this.value}}}cT.NAME="BooleanValueBlock";class cU extends cD{getValue(){return this.valueBlock.value}setValue(a){this.valueBlock.value=a}constructor(a={}){super(a,cT),this.idBlock.tagClass=1,this.idBlock.tagNumber=1}onAsciiEncoding(){return`${this.constructor.NAME} : ${this.getValue}`}}cC.Boolean=cU,cU.NAME="BOOLEAN";class cV extends cx(cO){constructor({isConstructed:a=!1,...b}={}){super(b),this.isConstructed=a}fromBER(a,b,c,d){let e=0;if(this.isConstructed){if(this.isHexOnly=!1,-1===(e=cO.prototype.fromBER.call(this,a,b,c,d)))return e;for(let a=0;a<this.value.length;a++){let b=this.value[a].constructor.NAME;if(b===cu)if(!this.isIndefiniteForm)return this.error="EndOfContent is unexpected, OCTET STRING may consists of OCTET STRINGs only",-1;else break;if(b!==cv)return this.error="OCTET STRING may consists of OCTET STRINGs only",-1}}else this.isHexOnly=!0,e=super.fromBER(a,b,c),this.blockLength=c;return e}toBER(a,b){return this.isConstructed?cO.prototype.toBER.call(this,a,b):a?new ArrayBuffer(this.valueHexView.byteLength):this.valueHexView.slice().buffer}toJSON(){return{...super.toJSON(),isConstructed:this.isConstructed}}}cV.NAME="OctetStringValueBlock";class cW extends cD{constructor({idBlock:a={},lenBlock:b={},...c}={}){var d;null!=c.isConstructed||(c.isConstructed=!!(null==(d=c.value)?void 0:d.length)),super({idBlock:{isConstructed:c.isConstructed,...a},lenBlock:{...b,isIndefiniteForm:!!c.isIndefiniteForm},...c},cV),this.idBlock.tagClass=1,this.idBlock.tagNumber=4}fromBER(a,b,c,d){if(this.valueBlock.isConstructed=this.idBlock.isConstructed,this.valueBlock.isIndefiniteForm=this.lenBlock.isIndefiniteForm,0===c)return 0===this.idBlock.error.length&&(this.blockLength+=this.idBlock.blockLength),0===this.lenBlock.error.length&&(this.blockLength+=this.lenBlock.blockLength),b;if(!this.valueBlock.isConstructed){let e=(a instanceof ArrayBuffer?new Uint8Array(a):a).subarray(b,b+c);try{if(e.byteLength){let a=null!=d?d:cK(),b=cL(e,0,e.byteLength,a);-1!==b.offset&&b.offset===c&&(this.valueBlock.value=[b.result])}}catch{}}return super.fromBER(a,b,c,d)}onAsciiEncoding(){if(this.valueBlock.isConstructed||this.valueBlock.value&&this.valueBlock.value.length)return cP.prototype.onAsciiEncoding.call(this);let a=this.constructor.NAME,b=cd.ToHex(this.valueBlock.valueHexView);return`${a} : ${b}`}getValue(){if(!this.idBlock.isConstructed)return this.valueBlock.valueHexView.slice().buffer;let a=[];for(let b of this.valueBlock.value)b instanceof H&&a.push(b.valueBlock.valueHexView);return b6.concat(a)}}cC.OctetString=H=cW,cW.NAME=cv;class cX extends cx(cO){constructor({unusedBits:a=0,isConstructed:b=!1,...c}={}){super(c),this.unusedBits=a,this.isConstructed=b,this.blockLength=this.valueHexView.byteLength}fromBER(a,b,c,d){if(!c)return b;let e=-1;if(this.isConstructed){if(-1===(e=cO.prototype.fromBER.call(this,a,b,c,d)))return e;for(let a of this.value){let b=a.constructor.NAME;if(b===cu)if(!this.isIndefiniteForm)return this.error="EndOfContent is unexpected, BIT STRING may consists of BIT STRINGs only",-1;else break;if(b!==cw)return this.error="BIT STRING may consists of BIT STRINGs only",-1;let c=a.valueBlock;if(this.unusedBits>0&&c.unusedBits>0)return this.error='Using of "unused bits" inside constructive BIT STRING allowed for least one only',-1;this.unusedBits=c.unusedBits}return e}let f=b6.toUint8Array(a);if(!cm(this,f,b,c))return -1;let g=f.subarray(b,b+c);if(this.unusedBits=g[0],this.unusedBits>7)return this.error="Unused bits for BitString must be in range 0-7",-1;if(!this.unusedBits){let a=g.subarray(1);try{if(a.byteLength){let b=null!=d?d:cK(),e=cL(a,0,a.byteLength,b);-1!==e.offset&&e.offset===c-1&&(this.value=[e.result])}}catch{}}return this.valueHexView=g.subarray(1),this.blockLength=g.length,b+c}toBER(a,b){if(this.isConstructed)return cO.prototype.toBER.call(this,a,b);if(a)return new ArrayBuffer(this.valueHexView.byteLength+1);if(!this.valueHexView.byteLength){let a=new Uint8Array(1);return a[0]=0,a.buffer}let c=new Uint8Array(this.valueHexView.length+1);return c[0]=this.unusedBits,c.set(this.valueHexView,1),c.buffer}toJSON(){return{...super.toJSON(),unusedBits:this.unusedBits,isConstructed:this.isConstructed}}}cX.NAME="BitStringValueBlock";class cY extends cD{constructor({idBlock:a={},lenBlock:b={},...c}={}){var d;null!=c.isConstructed||(c.isConstructed=!!(null==(d=c.value)?void 0:d.length)),super({idBlock:{isConstructed:c.isConstructed,...a},lenBlock:{...b,isIndefiniteForm:!!c.isIndefiniteForm},...c},cX),this.idBlock.tagClass=1,this.idBlock.tagNumber=3}fromBER(a,b,c,d){return this.valueBlock.isConstructed=this.idBlock.isConstructed,this.valueBlock.isIndefiniteForm=this.lenBlock.isIndefiniteForm,super.fromBER(a,b,c,d)}onAsciiEncoding(){if(this.valueBlock.isConstructed||this.valueBlock.value&&this.valueBlock.value.length)return cP.prototype.onAsciiEncoding.call(this);{let a=[];for(let b of this.valueBlock.valueHexView)a.push(b.toString(2).padStart(8,"0"));let b=a.join(""),c=this.constructor.NAME,d=b.substring(0,b.length-this.valueBlock.unusedBits);return`${c} : ${d}`}}}function cZ(a){if(a>=co.length)for(let b=co.length;b<=a;b++){let a=new Uint8Array([0]),c=co[b-1].slice(0);for(let b=c.length-1;b>=0;b--){let d=new Uint8Array([(c[b]<<1)+a[0]]);a[0]=d[0]/10,c[b]=d[0]%10}a[0]>0&&(c=ch(a,c)),co.push(c)}return co[a]}cC.BitString=cY,cY.NAME=cw;class c$ extends cx(cz){setValueHex(){this.valueHexView.length>=4?(this.warnings.push("Too big Integer for decoding, hex only"),this.isHexOnly=!0,this._valueDec=0):(this.isHexOnly=!1,this.valueHexView.length>0&&(this._valueDec=ci.call(this)))}constructor({value:a,...b}={}){super(b),this._valueDec=0,b.valueHex&&this.setValueHex(),void 0!==a&&(this.valueDec=a)}set valueDec(a){this._valueDec=a,this.isHexOnly=!1,this.valueHexView=new Uint8Array(function(a){let b=a<0?-1*a:a,c=128;for(let d=1;d<8;d++){if(b<=c){if(a<0){let a=cg(c-b,8,d),e=new Uint8Array(a);return e[0]|=128,a}let e=cg(b,8,d),f=new Uint8Array(e);if(128&f[0]){let a=e.slice(0),b=new Uint8Array(a);f=new Uint8Array(e=new ArrayBuffer(e.byteLength+1));for(let c=0;c<a.byteLength;c++)f[c+1]=b[c];f[0]=0}return e}c*=256}return new ArrayBuffer(0)}(a))}get valueDec(){return this._valueDec}fromDER(a,b,c,d=0){let e=this.fromBER(a,b,c);if(-1===e)return e;let f=this.valueHexView;return 0===f[0]&&(128&f[1])!=0?this.valueHexView=f.subarray(1):0!==d&&f.length<d&&(d-f.length>1&&(d=f.length+1),this.valueHexView=f.subarray(d-f.length)),e}toDER(a=!1){let b=this.valueHexView;switch(!0){case(128&b[0])!=0:{let a=new Uint8Array(this.valueHexView.length+1);a[0]=0,a.set(b,1),this.valueHexView=a}break;case 0===b[0]&&(128&b[1])==0:this.valueHexView=this.valueHexView.subarray(1)}return this.toBER(a)}fromBER(a,b,c){let d=super.fromBER(a,b,c);return -1===d||this.setValueHex(),d}toBER(a){return a?new ArrayBuffer(this.valueHexView.length):this.valueHexView.slice().buffer}toJSON(){return{...super.toJSON(),valueDec:this.valueDec}}toString(){let a,b=8*this.valueHexView.length-1,c=new Uint8Array(8*this.valueHexView.length/3),d=0,e=this.valueHexView,f="",g=!1;for(let g=e.byteLength-1;g>=0;g--){a=e[g];for(let e=0;e<8;e++)(1&a)==1&&(d===b?(c=function(a,b){let c,d=0,e=new Uint8Array(a),f=new Uint8Array(b),g=e.slice(0),h=g.length-1,i=f.slice(0),j=i.length-1,k=0;for(let a=j;a>=0;a--,k++)!0==(c=g[h-k]-i[j-k]-d)<0?(d=1,g[h-k]=c+10):(d=0,g[h-k]=c);if(d>0)for(let a=h-j+1;a>=0;a--,k++)if((c=g[h-k]-d)<0)d=1,g[h-k]=c+10;else{d=0,g[h-k]=c;break}return g.slice()}(cZ(d),c),f="-"):c=function(a,b){let c=new Uint8Array([0]),d=new Uint8Array(a),e=new Uint8Array(b),f=d.slice(0),g=f.length-1,h=e.slice(0),i=h.length-1,j=0,k=i<g?g:i,l=0;for(let a=k;a>=0;a--,l++)j=!0==l<h.length?f[g-l]+h[i-l]+c[0]:f[g-l]+c[0],c[0]=j/10,!0==l>=f.length?f=ch(new Uint8Array([j%10]),f):f[g-l]=j%10;return c[0]>0&&(f=ch(c,f)),f}(c,cZ(d))),d++,a>>=1}for(let a=0;a<c.length;a++)c[a]&&(g=!0),g&&(f+=cp.charAt(c[a]));return!1===g&&(f+=cp.charAt(0)),f}}c$.NAME="IntegerValueBlock",Object.defineProperty(c$.prototype,"valueHex",{set:function(a){this.valueHexView=new Uint8Array(a),this.setValueHex()},get:function(){return this.valueHexView.slice().buffer}});class c_ extends cD{constructor(a={}){super(a,c$),this.idBlock.tagClass=1,this.idBlock.tagNumber=2}toBigInt(){return ck(),BigInt(this.valueBlock.toString())}static fromBigInt(a){ck();let b=BigInt(a),c=new cn,d=b.toString(16).replace(/^-/,""),e=new Uint8Array(cd.FromHex(d));if(b<0){let a=new Uint8Array(e.length+(128&e[0]?1:0));a[0]|=128;let d=BigInt(`0x${cd.ToHex(a)}`)+b,f=b6.toUint8Array(cd.FromHex(d.toString(16)));f[0]|=128,c.write(f)}else 128&e[0]&&c.write(new Uint8Array([0])),c.write(e);return new I({valueHex:c.final()})}convertToDER(){let a=new I({valueHex:this.valueBlock.valueHexView});return a.valueBlock.toDER(),a}convertFromDER(){return new I({valueHex:0===this.valueBlock.valueHexView[0]?this.valueBlock.valueHexView.subarray(1):this.valueBlock.valueHexView})}onAsciiEncoding(){return`${this.constructor.NAME} : ${this.valueBlock.toString()}`}}cC.Integer=I=c_,c_.NAME="INTEGER";class c0 extends c_{constructor(a={}){super(a),this.idBlock.tagClass=1,this.idBlock.tagNumber=10}}cC.Enumerated=c0,c0.NAME="ENUMERATED";class c1 extends cx(cz){constructor({valueDec:a=-1,isFirstSid:b=!1,...c}={}){super(c),this.valueDec=a,this.isFirstSid=b}fromBER(a,b,c){if(!c)return b;let d=b6.toUint8Array(a);if(!cm(this,d,b,c))return -1;let e=d.subarray(b,b+c);this.valueHexView=new Uint8Array(c);for(let a=0;a<c&&(this.valueHexView[a]=127&e[a],this.blockLength++,(128&e[a])!=0);a++);let f=new Uint8Array(this.blockLength);for(let a=0;a<this.blockLength;a++)f[a]=this.valueHexView[a];return(this.valueHexView=f,(128&e[this.blockLength-1])!=0)?(this.error="End of input reached before message was fully decoded",-1):(0===this.valueHexView[0]&&this.warnings.push("Needlessly long format of SID encoding"),this.blockLength<=8?this.valueDec=cf(this.valueHexView,7):(this.isHexOnly=!0,this.warnings.push("Too big SID for decoding, hex only")),b+this.blockLength)}set valueBigInt(a){ck();let b=BigInt(a).toString(2);for(;b.length%7;)b="0"+b;let c=new Uint8Array(b.length/7);for(let a=0;a<c.length;a++)c[a]=parseInt(b.slice(7*a,7*a+7),2)+128*(a+1<c.length);this.fromBER(c.buffer,0,c.length)}toBER(a){if(this.isHexOnly){if(a)return new ArrayBuffer(this.valueHexView.byteLength);let b=this.valueHexView,c=new Uint8Array(this.blockLength);for(let a=0;a<this.blockLength-1;a++)c[a]=128|b[a];return c[this.blockLength-1]=b[this.blockLength-1],c.buffer}let b=cg(this.valueDec,7);if(0===b.byteLength)return this.error="Error during encoding SID value",cs;let c=new Uint8Array(b.byteLength);if(!a){let a=new Uint8Array(b),d=b.byteLength-1;for(let b=0;b<d;b++)c[b]=128|a[b];c[d]=a[d]}return c}toString(){let a="";if(this.isHexOnly)a=cd.ToHex(this.valueHexView);else if(this.isFirstSid){let b=this.valueDec;this.valueDec<=39?a="0.":this.valueDec<=79?(a="1.",b-=40):(a="2.",b-=80),a+=b.toString()}else a=this.valueDec.toString();return a}toJSON(){return{...super.toJSON(),valueDec:this.valueDec,isFirstSid:this.isFirstSid}}}c1.NAME="sidBlock";class c2 extends cz{constructor({value:a="",...b}={}){super(b),this.value=[],a&&this.fromString(a)}fromBER(a,b,c){let d=b;for(;c>0;){let b=new c1;if(-1===(d=b.fromBER(a,d,c))){this.blockLength=0,this.error=b.error;break}0===this.value.length&&(b.isFirstSid=!0),this.blockLength+=b.blockLength,c-=b.blockLength,this.value.push(b)}return d}toBER(a){let b=[];for(let c=0;c<this.value.length;c++){let d=this.value[c].toBER(a);if(0===d.byteLength)return this.error=this.value[c].error,cs;b.push(d)}return cl(b)}fromString(a){this.value=[];let b=0,c=0,d="",e=!1;do if(d=-1===(c=a.indexOf(".",b))?a.substring(b):a.substring(b,c),b=c+1,e){let a=this.value[0],b=0;switch(a.valueDec){case 0:break;case 1:b=40;break;case 2:b=80;break;default:this.value=[];return}let c=parseInt(d,10);if(isNaN(c))return;a.valueDec=c+b,e=!1}else{let a=new c1;if(d>Number.MAX_SAFE_INTEGER)ck(),a.valueBigInt=BigInt(d);else if(a.valueDec=parseInt(d,10),isNaN(a.valueDec))return;this.value.length||(a.isFirstSid=!0,e=!0),this.value.push(a)}while(-1!==c)}toString(){let a="",b=!1;for(let c=0;c<this.value.length;c++){b=this.value[c].isHexOnly;let d=this.value[c].toString();0!==c&&(a=`${a}.`),b?(d=`{${d}}`,this.value[c].isFirstSid?a=`2.{${d} - 80}`:a+=d):a+=d}return a}toJSON(){let a={...super.toJSON(),value:this.toString(),sidArray:[]};for(let b=0;b<this.value.length;b++)a.sidArray.push(this.value[b].toJSON());return a}}c2.NAME="ObjectIdentifierValueBlock";class c3 extends cD{getValue(){return this.valueBlock.toString()}setValue(a){this.valueBlock.fromString(a)}constructor(a={}){super(a,c2),this.idBlock.tagClass=1,this.idBlock.tagNumber=6}onAsciiEncoding(){return`${this.constructor.NAME} : ${this.valueBlock.toString()||"empty"}`}toJSON(){return{...super.toJSON(),value:this.getValue()}}}cC.ObjectIdentifier=c3,c3.NAME="OBJECT IDENTIFIER";class c4 extends cx(cy){constructor({valueDec:a=0,...b}={}){super(b),this.valueDec=a}fromBER(a,b,c){if(0===c)return b;let d=b6.toUint8Array(a);if(!cm(this,d,b,c))return -1;let e=d.subarray(b,b+c);this.valueHexView=new Uint8Array(c);for(let a=0;a<c&&(this.valueHexView[a]=127&e[a],this.blockLength++,(128&e[a])!=0);a++);let f=new Uint8Array(this.blockLength);for(let a=0;a<this.blockLength;a++)f[a]=this.valueHexView[a];return(this.valueHexView=f,(128&e[this.blockLength-1])!=0)?(this.error="End of input reached before message was fully decoded",-1):(0===this.valueHexView[0]&&this.warnings.push("Needlessly long format of SID encoding"),this.blockLength<=8?this.valueDec=cf(this.valueHexView,7):(this.isHexOnly=!0,this.warnings.push("Too big SID for decoding, hex only")),b+this.blockLength)}toBER(a){if(this.isHexOnly){if(a)return new ArrayBuffer(this.valueHexView.byteLength);let b=this.valueHexView,c=new Uint8Array(this.blockLength);for(let a=0;a<this.blockLength-1;a++)c[a]=128|b[a];return c[this.blockLength-1]=b[this.blockLength-1],c.buffer}let b=cg(this.valueDec,7);if(0===b.byteLength)return this.error="Error during encoding SID value",cs;let c=new Uint8Array(b.byteLength);if(!a){let a=new Uint8Array(b),d=b.byteLength-1;for(let b=0;b<d;b++)c[b]=128|a[b];c[d]=a[d]}return c.buffer}toString(){return this.isHexOnly?cd.ToHex(this.valueHexView):this.valueDec.toString()}toJSON(){return{...super.toJSON(),valueDec:this.valueDec}}}c4.NAME="relativeSidBlock";class c5 extends cz{constructor({value:a="",...b}={}){super(b),this.value=[],a&&this.fromString(a)}fromBER(a,b,c){let d=b;for(;c>0;){let b=new c4;if(-1===(d=b.fromBER(a,d,c))){this.blockLength=0,this.error=b.error;break}this.blockLength+=b.blockLength,c-=b.blockLength,this.value.push(b)}return d}toBER(a,b){let c=[];for(let b=0;b<this.value.length;b++){let d=this.value[b].toBER(a);if(0===d.byteLength)return this.error=this.value[b].error,cs;c.push(d)}return cl(c)}fromString(a){this.value=[];let b=0,c=0,d="";do{d=-1===(c=a.indexOf(".",b))?a.substring(b):a.substring(b,c),b=c+1;let e=new c4;if(e.valueDec=parseInt(d,10),isNaN(e.valueDec))break;this.value.push(e)}while(-1!==c);return!0}toString(){let a="",b=!1;for(let c=0;c<this.value.length;c++){b=this.value[c].isHexOnly;let d=this.value[c].toString();0!==c&&(a=`${a}.`),b?a+=d=`{${d}}`:a+=d}return a}toJSON(){let a={...super.toJSON(),value:this.toString(),sidArray:[]};for(let b=0;b<this.value.length;b++)a.sidArray.push(this.value[b].toJSON());return a}}c5.NAME="RelativeObjectIdentifierValueBlock";class c6 extends cD{getValue(){return this.valueBlock.toString()}setValue(a){this.valueBlock.fromString(a)}constructor(a={}){super(a,c5),this.idBlock.tagClass=1,this.idBlock.tagNumber=13}onAsciiEncoding(){return`${this.constructor.NAME} : ${this.valueBlock.toString()||"empty"}`}toJSON(){return{...super.toJSON(),value:this.getValue()}}}cC.RelativeObjectIdentifier=c6,c6.NAME="RelativeObjectIdentifier";class c7 extends cP{constructor(a={}){super(a),this.idBlock.tagClass=1,this.idBlock.tagNumber=16}}cC.Sequence=c7,c7.NAME="SEQUENCE";class c8 extends cP{constructor(a={}){super(a),this.idBlock.tagClass=1,this.idBlock.tagNumber=17}}cC.Set=c8,c8.NAME="SET";class c9 extends cx(cz){constructor({...a}={}){super(a),this.isHexOnly=!0,this.value=""}toJSON(){return{...super.toJSON(),value:this.value}}}c9.NAME="StringValueBlock";class da extends c9{}da.NAME="SimpleStringValueBlock";class db extends cE{constructor({...a}={}){super(a,da)}fromBuffer(a){this.valueBlock.value=String.fromCharCode.apply(null,b6.toUint8Array(a))}fromString(a){let b=a.length,c=this.valueBlock.valueHexView=new Uint8Array(b);for(let d=0;d<b;d++)c[d]=a.charCodeAt(d);this.valueBlock.value=a}}db.NAME="SIMPLE STRING";class dc extends db{fromBuffer(a){this.valueBlock.valueHexView=b6.toUint8Array(a);try{this.valueBlock.value=cd.ToUtf8String(a)}catch(b){this.warnings.push(`Error during "decodeURIComponent": ${b}, using raw string`),this.valueBlock.value=cd.ToBinary(a)}}fromString(a){this.valueBlock.valueHexView=new Uint8Array(cd.FromUtf8String(a)),this.valueBlock.value=a}}dc.NAME="Utf8StringValueBlock";class dd extends dc{constructor(a={}){super(a),this.idBlock.tagClass=1,this.idBlock.tagNumber=12}}cC.Utf8String=dd,dd.NAME="UTF8String";class de extends db{fromBuffer(a){this.valueBlock.value=cd.ToUtf16String(a),this.valueBlock.valueHexView=b6.toUint8Array(a)}fromString(a){this.valueBlock.value=a,this.valueBlock.valueHexView=new Uint8Array(cd.FromUtf16String(a))}}de.NAME="BmpStringValueBlock";class df extends de{constructor({...a}={}){super(a),this.idBlock.tagClass=1,this.idBlock.tagNumber=30}}cC.BmpString=df,df.NAME="BMPString";class dg extends db{fromBuffer(a){let b=ArrayBuffer.isView(a)?a.slice().buffer:a.slice(0),c=new Uint8Array(b);for(let a=0;a<c.length;a+=4)c[a]=c[a+3],c[a+1]=c[a+2],c[a+2]=0,c[a+3]=0;this.valueBlock.value=String.fromCharCode.apply(null,new Uint32Array(b))}fromString(a){let b=a.length,c=this.valueBlock.valueHexView=new Uint8Array(4*b);for(let d=0;d<b;d++){let b=new Uint8Array(cg(a.charCodeAt(d),8));if(b.length>4)continue;let e=4-b.length;for(let a=b.length-1;a>=0;a--)c[4*d+a+e]=b[a]}this.valueBlock.value=a}}dg.NAME="UniversalStringValueBlock";class dh extends dg{constructor({...a}={}){super(a),this.idBlock.tagClass=1,this.idBlock.tagNumber=28}}cC.UniversalString=dh,dh.NAME="UniversalString";class di extends db{constructor(a={}){super(a),this.idBlock.tagClass=1,this.idBlock.tagNumber=18}}cC.NumericString=di,di.NAME="NumericString";class dj extends db{constructor(a={}){super(a),this.idBlock.tagClass=1,this.idBlock.tagNumber=19}}cC.PrintableString=dj,dj.NAME="PrintableString";class dk extends db{constructor(a={}){super(a),this.idBlock.tagClass=1,this.idBlock.tagNumber=20}}cC.TeletexString=dk,dk.NAME="TeletexString";class dl extends db{constructor(a={}){super(a),this.idBlock.tagClass=1,this.idBlock.tagNumber=21}}cC.VideotexString=dl,dl.NAME="VideotexString";class dm extends db{constructor(a={}){super(a),this.idBlock.tagClass=1,this.idBlock.tagNumber=22}}cC.IA5String=dm,dm.NAME="IA5String";class dn extends db{constructor(a={}){super(a),this.idBlock.tagClass=1,this.idBlock.tagNumber=25}}cC.GraphicString=dn,dn.NAME="GraphicString";class dp extends db{constructor(a={}){super(a),this.idBlock.tagClass=1,this.idBlock.tagNumber=26}}cC.VisibleString=dp,dp.NAME="VisibleString";class dq extends db{constructor(a={}){super(a),this.idBlock.tagClass=1,this.idBlock.tagNumber=27}}cC.GeneralString=dq,dq.NAME="GeneralString";class dr extends db{constructor(a={}){super(a),this.idBlock.tagClass=1,this.idBlock.tagNumber=29}}cC.CharacterString=dr,dr.NAME="CharacterString";class ds extends dp{constructor({value:a,valueDate:b,...c}={}){if(super(c),this.year=0,this.month=0,this.day=0,this.hour=0,this.minute=0,this.second=0,a){this.fromString(a),this.valueBlock.valueHexView=new Uint8Array(a.length);for(let b=0;b<a.length;b++)this.valueBlock.valueHexView[b]=a.charCodeAt(b)}b&&(this.fromDate(b),this.valueBlock.valueHexView=new Uint8Array(this.toBuffer())),this.idBlock.tagClass=1,this.idBlock.tagNumber=23}fromBuffer(a){this.fromString(String.fromCharCode.apply(null,b6.toUint8Array(a)))}toBuffer(){let a=this.toString(),b=new ArrayBuffer(a.length),c=new Uint8Array(b);for(let b=0;b<a.length;b++)c[b]=a.charCodeAt(b);return b}fromDate(a){this.year=a.getUTCFullYear(),this.month=a.getUTCMonth()+1,this.day=a.getUTCDate(),this.hour=a.getUTCHours(),this.minute=a.getUTCMinutes(),this.second=a.getUTCSeconds()}toDate(){return new Date(Date.UTC(this.year,this.month-1,this.day,this.hour,this.minute,this.second))}fromString(a){let b=/(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})Z/ig.exec(a);if(null===b){this.error="Wrong input string for conversion";return}let c=parseInt(b[1],10);c>=50?this.year=1900+c:this.year=2e3+c,this.month=parseInt(b[2],10),this.day=parseInt(b[3],10),this.hour=parseInt(b[4],10),this.minute=parseInt(b[5],10),this.second=parseInt(b[6],10)}toString(a="iso"){if("iso"===a){let a=Array(7);return a[0]=cj(this.year<2e3?this.year-1900:this.year-2e3,2),a[1]=cj(this.month,2),a[2]=cj(this.day,2),a[3]=cj(this.hour,2),a[4]=cj(this.minute,2),a[5]=cj(this.second,2),a[6]="Z",a.join("")}return super.toString(a)}onAsciiEncoding(){return`${this.constructor.NAME} : ${this.toDate().toISOString()}`}toJSON(){return{...super.toJSON(),year:this.year,month:this.month,day:this.day,hour:this.hour,minute:this.minute,second:this.second}}}cC.UTCTime=ds,ds.NAME="UTCTime";class dt extends ds{constructor(a={}){super(a),null!=this.millisecond||(this.millisecond=0),this.idBlock.tagClass=1,this.idBlock.tagNumber=24}fromDate(a){super.fromDate(a),this.millisecond=a.getUTCMilliseconds()}toDate(){return new Date(Date.UTC(this.year,this.month-1,this.day,this.hour,this.minute,this.second,this.millisecond))}fromString(a){let b,c=!1,d="",e="",f=0,g=0,h=0;if("Z"===a[a.length-1])d=a.substring(0,a.length-1),c=!0;else{if(isNaN(new Number(a[a.length-1]).valueOf()))throw Error("Wrong input string for conversion");d=a}if(c){if(-1!==d.indexOf("+")||-1!==d.indexOf("-"))throw Error("Wrong input string for conversion")}else{let a=1,b=d.indexOf("+"),c="";if(-1===b&&(b=d.indexOf("-"),a=-1),-1!==b){if(c=d.substring(b+1),d=d.substring(0,b),2!==c.length&&4!==c.length)throw Error("Wrong input string for conversion");let e=parseInt(c.substring(0,2),10);if(isNaN(e.valueOf()))throw Error("Wrong input string for conversion");if(g=a*e,4===c.length){if(isNaN((e=parseInt(c.substring(2,4),10)).valueOf()))throw Error("Wrong input string for conversion");h=a*e}}}let i=d.indexOf(".");if(-1===i&&(i=d.indexOf(",")),-1!==i){let a=new Number(`0${d.substring(i)}`);if(isNaN(a.valueOf()))throw Error("Wrong input string for conversion");f=a.valueOf(),e=d.substring(0,i)}else e=d;switch(!0){case 8===e.length:if(b=/(\d{4})(\d{2})(\d{2})/ig,-1!==i)throw Error("Wrong input string for conversion");break;case 10===e.length:if(b=/(\d{4})(\d{2})(\d{2})(\d{2})/ig,-1!==i){let a=60*f;this.minute=Math.floor(a),a=60*(a-this.minute),this.second=Math.floor(a),a=1e3*(a-this.second),this.millisecond=Math.floor(a)}break;case 12===e.length:if(b=/(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})/ig,-1!==i){let a=60*f;this.second=Math.floor(a),a=1e3*(a-this.second),this.millisecond=Math.floor(a)}break;case 14===e.length:if(b=/(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})/ig,-1!==i){let a=1e3*f;this.millisecond=Math.floor(a)}break;default:throw Error("Wrong input string for conversion")}let j=b.exec(e);if(null===j)throw Error("Wrong input string for conversion");for(let a=1;a<j.length;a++)switch(a){case 1:this.year=parseInt(j[a],10);break;case 2:this.month=parseInt(j[a],10);break;case 3:this.day=parseInt(j[a],10);break;case 4:this.hour=parseInt(j[a],10)+g;break;case 5:this.minute=parseInt(j[a],10)+h;break;case 6:this.second=parseInt(j[a],10);break;default:throw Error("Wrong input string for conversion")}if(!1===c){let a=new Date(this.year,this.month,this.day,this.hour,this.minute,this.second,this.millisecond);this.year=a.getUTCFullYear(),this.month=a.getUTCMonth(),this.day=a.getUTCDay(),this.hour=a.getUTCHours(),this.minute=a.getUTCMinutes(),this.second=a.getUTCSeconds(),this.millisecond=a.getUTCMilliseconds()}}toString(a="iso"){if("iso"===a){let a=[];return a.push(cj(this.year,4)),a.push(cj(this.month,2)),a.push(cj(this.day,2)),a.push(cj(this.hour,2)),a.push(cj(this.minute,2)),a.push(cj(this.second,2)),0!==this.millisecond&&(a.push("."),a.push(cj(this.millisecond,3))),a.push("Z"),a.join("")}return super.toString(a)}toJSON(){return{...super.toJSON(),millisecond:this.millisecond}}}cC.GeneralizedTime=dt,dt.NAME="GeneralizedTime";class du extends dd{constructor(a={}){super(a),this.idBlock.tagClass=1,this.idBlock.tagNumber=31}}cC.DATE=du,du.NAME="DATE";class dv extends dd{constructor(a={}){super(a),this.idBlock.tagClass=1,this.idBlock.tagNumber=32}}cC.TimeOfDay=dv,dv.NAME="TimeOfDay";class dw extends dd{constructor(a={}){super(a),this.idBlock.tagClass=1,this.idBlock.tagNumber=33}}cC.DateTime=dw,dw.NAME="DateTime";class dx extends dd{constructor(a={}){super(a),this.idBlock.tagClass=1,this.idBlock.tagNumber=34}}cC.Duration=dx,dx.NAME="Duration";class dy extends dd{constructor(a={}){super(a),this.idBlock.tagClass=1,this.idBlock.tagNumber=14}}cC.TIME=dy,dy.NAME="TIME";class dz{constructor({name:a="",optional:b=!1}={}){this.name=a,this.optional=b}}class dA extends dz{constructor({value:a=[],...b}={}){super(b),this.value=a}}class dB extends dz{constructor({value:a=new dz,local:b=!1,...c}={}){super(c),this.value=a,this.local=b}}class dC{get data(){return this.dataView.slice().buffer}set data(a){this.dataView=b6.toUint8Array(a)}constructor({data:a=ct}={}){this.dataView=b6.toUint8Array(a)}fromBER(a,b,c){let d=b+c;return this.dataView=b6.toUint8Array(a).subarray(b,d),d}toBER(a){return this.dataView.slice().buffer}}function dD(a,b,c){if(c instanceof dA){for(let d of c.value)if(dD(a,b,d).verified)return{verified:!0,result:a};{let a={verified:!1,result:{error:"Wrong values for Choice type"}};return c.hasOwnProperty(cq)&&(a.name=c.name),a}}if(c instanceof dz)return c.hasOwnProperty(cq)&&(a[c.name]=b),{verified:!0,result:a};if(a instanceof Object==!1)return{verified:!1,result:{error:"Wrong root object"}};if(b instanceof Object==!1)return{verified:!1,result:{error:"Wrong ASN.1 data"}};if(c instanceof Object==!1||"idBlock"in c==!1||"fromBER"in c.idBlock==!1||"toBER"in c.idBlock==!1)return{verified:!1,result:{error:"Wrong ASN.1 schema"}};let d=c.idBlock.toBER(!1);if(0===d.byteLength)return{verified:!1,result:{error:"Error encoding idBlock for ASN.1 schema"}};if(-1===c.idBlock.fromBER(d,0,d.byteLength))return{verified:!1,result:{error:"Error decoding idBlock for ASN.1 schema"}};if(!1===c.idBlock.hasOwnProperty("tagClass"))return{verified:!1,result:{error:"Wrong ASN.1 schema"}};if(c.idBlock.tagClass!==b.idBlock.tagClass)return{verified:!1,result:a};if(!1===c.idBlock.hasOwnProperty("tagNumber"))return{verified:!1,result:{error:"Wrong ASN.1 schema"}};if(c.idBlock.tagNumber!==b.idBlock.tagNumber)return{verified:!1,result:a};if(!1===c.idBlock.hasOwnProperty("isConstructed"))return{verified:!1,result:{error:"Wrong ASN.1 schema"}};if(c.idBlock.isConstructed!==b.idBlock.isConstructed)return{verified:!1,result:a};if(!("isHexOnly"in c.idBlock))return{verified:!1,result:{error:"Wrong ASN.1 schema"}};if(c.idBlock.isHexOnly!==b.idBlock.isHexOnly)return{verified:!1,result:a};if(c.idBlock.isHexOnly){if(cr in c.idBlock==!1)return{verified:!1,result:{error:"Wrong ASN.1 schema"}};let d=c.idBlock.valueHexView,e=b.idBlock.valueHexView;if(d.length!==e.length)return{verified:!1,result:a};for(let b=0;b<d.length;b++)if(d[b]!==e[1])return{verified:!1,result:a}}if(c.name&&(c.name=c.name.replace(/^\s+|\s+$/g,""),c.name&&(a[c.name]=b)),c instanceof cC.Constructed){let d=0,e={verified:!1,result:{error:"Unknown error"}},f=c.valueBlock.value.length;if(f>0&&c.valueBlock.value[0]instanceof dB&&(f=b.valueBlock.value.length),0===f)return{verified:!0,result:a};if(0===b.valueBlock.value.length&&0!==c.valueBlock.value.length){let b=!0;for(let a=0;a<c.valueBlock.value.length;a++)b=b&&(c.valueBlock.value[a].optional||!1);return b?{verified:!0,result:a}:(c.name&&(c.name=c.name.replace(/^\s+|\s+$/g,""),c.name&&delete a[c.name]),a.error="Inconsistent object length",{verified:!1,result:a})}for(let g=0;g<f;g++)if(g-d>=b.valueBlock.value.length){if(!1===c.valueBlock.value[g].optional){let b={verified:!1,result:a};return a.error="Inconsistent length between ASN.1 data and schema",c.name&&(c.name=c.name.replace(/^\s+|\s+$/g,""),c.name&&(delete a[c.name],b.name=c.name)),b}}else if(c.valueBlock.value[0]instanceof dB){if(!1===(e=dD(a,b.valueBlock.value[g],c.valueBlock.value[0].value)).verified)if(!c.valueBlock.value[0].optional)return c.name&&(c.name=c.name.replace(/^\s+|\s+$/g,""),c.name&&delete a[c.name]),e;else d++;if(cq in c.valueBlock.value[0]&&c.valueBlock.value[0].name.length>0){let d={};void 0===(d="local"in c.valueBlock.value[0]&&c.valueBlock.value[0].local?b:a)[c.valueBlock.value[0].name]&&(d[c.valueBlock.value[0].name]=[]),d[c.valueBlock.value[0].name].push(b.valueBlock.value[g])}}else if(!1===(e=dD(a,b.valueBlock.value[g-d],c.valueBlock.value[g])).verified)if(!c.valueBlock.value[g].optional)return c.name&&(c.name=c.name.replace(/^\s+|\s+$/g,""),c.name&&delete a[c.name]),e;else d++;if(!1===e.verified){let b={verified:!1,result:a};return c.name&&(c.name=c.name.replace(/^\s+|\s+$/g,""),c.name&&(delete a[c.name],b.name=c.name)),b}return{verified:!0,result:a}}if(c.primitiveSchema&&cr in b.valueBlock){let d=cM(b.valueBlock.valueHexView);if(-1===d.offset){let b={verified:!1,result:d.result};return c.name&&(c.name=c.name.replace(/^\s+|\s+$/g,""),c.name&&(delete a[c.name],b.name=c.name)),b}return dD(a,d.result,c.primitiveSchema)}return{verified:!0,result:a}}function dE(a,b){if(b instanceof Object==!1)return{verified:!1,result:{error:"Wrong ASN.1 schema type"}};let c=cM(b6.toUint8Array(a));return -1===c.offset?{verified:!1,result:c.result}:dD(c.result,c.result,b)}function dF(a){return Object.prototype.toString.call(a)}function dG(a){return"[object ArrayBuffer]"===dF(a)}function dH(a){return dG(a)||"u">typeof SharedArrayBuffer&&"[object SharedArrayBuffer]"===dF(a)}function dI(a){return dH(a)||!!ArrayBuffer.isView(a)||!!a&&"object"==typeof a&&"number"==typeof a.byteOffset&&"number"==typeof a.byteLength&&dH(a.buffer)}function dJ(a){if(!dI(a))throw TypeError("Expected ArrayBuffer, SharedArrayBuffer, or ArrayBufferView")}function dK(a){return(dJ(a),dH(a))?new Uint8Array(a):new Uint8Array(a.buffer,a.byteOffset,a.byteLength)}function dL(a){if(dJ(a),dG(a))return a;let b=new ArrayBuffer(a.byteLength);return new Uint8Array(b).set(dK(a)),b}(i=J||(J={}))[i.Sequence=0]="Sequence",i[i.Set=1]="Set",i[i.Choice=2]="Choice",(j=K||(K={}))[j.Any=1]="Any",j[j.Boolean=2]="Boolean",j[j.OctetString=3]="OctetString",j[j.BitString=4]="BitString",j[j.Integer=5]="Integer",j[j.Enumerated=6]="Enumerated",j[j.ObjectIdentifier=7]="ObjectIdentifier",j[j.Utf8String=8]="Utf8String",j[j.BmpString=9]="BmpString",j[j.UniversalString=10]="UniversalString",j[j.NumericString=11]="NumericString",j[j.PrintableString=12]="PrintableString",j[j.TeletexString=13]="TeletexString",j[j.VideotexString=14]="VideotexString",j[j.IA5String=15]="IA5String",j[j.GraphicString=16]="GraphicString",j[j.VisibleString=17]="VisibleString",j[j.GeneralString=18]="GeneralString",j[j.CharacterString=19]="CharacterString",j[j.UTCTime=20]="UTCTime",j[j.GeneralizedTime=21]="GeneralizedTime",j[j.DATE=22]="DATE",j[j.TimeOfDay=23]="TimeOfDay",j[j.DateTime=24]="DateTime",j[j.Duration=25]="Duration",j[j.TIME=26]="TIME",j[j.Null=27]="Null";class dM{unusedBits=0;value=new ArrayBuffer(0);constructor(a,b=0){if(a)if("number"==typeof a)this.fromNumber(a);else if(dI(a))this.unusedBits=b,this.value=dL(a);else throw TypeError("Unsupported type of 'params' argument for BitString")}fromASN(a){if(!(a instanceof cY))throw TypeError("Argument 'asn' is not instance of ASN.1 BitString");return this.unusedBits=a.valueBlock.unusedBits,this.value=dL(a.valueBlock.valueHex),this}toASN(){return new cY({unusedBits:this.unusedBits,valueHex:this.value})}toSchema(a){return new cY({name:a})}toNumber(){let a="";for(let b of new Uint8Array(this.value))a+=b.toString(2).padStart(8,"0");return a=a.split("").reverse().join(""),this.unusedBits&&(a=a.slice(this.unusedBits).padStart(this.unusedBits,"0")),parseInt(a,2)}fromNumber(a){let b=a.toString(2),c=b.length+7>>3;this.unusedBits=(c<<3)-b.length;let d=new Uint8Array(c);b=b.padStart(c<<3,"0").split("").reverse().join("");let e=0;for(;e<c;)d[e]=parseInt(b.slice(e<<3,(e<<3)+8),2),e++;this.value=d.buffer}}class dN{buffer;get byteLength(){return this.buffer.byteLength}get byteOffset(){return 0}constructor(a){"number"==typeof a?this.buffer=new ArrayBuffer(a):dI(a)?this.buffer=dL(a):Array.isArray(a)?this.buffer=new Uint8Array(a).buffer:this.buffer=new ArrayBuffer(0)}fromASN(a){if(!(a instanceof cW))throw TypeError("Argument 'asn' is not instance of ASN.1 OctetString");return this.buffer=dL(a.valueBlock.valueHex),this}toASN(){return new cW({valueHex:this.buffer})}toSchema(a){return new cW({name:a})}}let dO={fromASN:a=>a instanceof cS?null:dL(a.valueBeforeDecodeView),toASN:a=>{if(null===a)return new cS;let b=cN(a);if(b.result.error)throw Error(b.result.error);return b.result}},dP={fromASN:a=>a.valueBlock.valueHexView.byteLength>=4?a.valueBlock.toString():a.valueBlock.valueDec,toASN:a=>new c_({value:+a})},dQ={fromASN:a=>a.valueBlock.valueDec,toASN:a=>new c0({value:a})},dR={fromASN:a=>dL(a.valueBlock.valueHexView),toASN:a=>new c_({valueHex:a})},dS={fromASN:a=>dL(a.valueBlock.valueHexView),toASN:a=>new cY({valueHex:a})},dT={fromASN:a=>a.valueBlock.toString(),toASN:a=>new c3({value:a})},dU={fromASN:a=>a.valueBlock.value,toASN:a=>new cU({value:a})},dV={fromASN:a=>dL(a.valueBlock.valueHexView),toASN:a=>new cW({valueHex:a})};function dW(a){return{fromASN:a=>a.valueBlock.value,toASN:b=>new a({value:b})}}let dX=dW(dd),dY=dW(df),dZ=dW(dh),d$=dW(di),d_=dW(dj),d0=dW(dk),d1=dW(dl),d2=dW(dm),d3=dW(dn),d4=dW(dp),d5=dW(dq),d6=dW(dr),d7={fromASN:a=>a.toDate(),toASN:a=>new ds({valueDate:a})},d8={fromASN:a=>a.toDate(),toASN:a=>new dt({valueDate:a})},d9={fromASN:()=>null,toASN:()=>new cS};function ea(a){switch(a){case K.Any:return dO;case K.BitString:return dS;case K.BmpString:return dY;case K.Boolean:return dU;case K.CharacterString:return d6;case K.Enumerated:return dQ;case K.GeneralString:return d5;case K.GeneralizedTime:return d8;case K.GraphicString:return d3;case K.IA5String:return d2;case K.Integer:return dP;case K.Null:return d9;case K.NumericString:return d$;case K.ObjectIdentifier:return dT;case K.OctetString:return dV;case K.PrintableString:return d_;case K.TeletexString:return d0;case K.UTCTime:return d7;case K.UniversalString:return dZ;case K.Utf8String:return dX;case K.VideotexString:return d1;case K.VisibleString:return d4;default:return null}}function eb(a){return"function"==typeof a&&a.prototype?!!a.prototype.toASN&&!!a.prototype.fromASN||eb(a.prototype):!!(a&&"object"==typeof a&&"toASN"in a&&"fromASN"in a)}class ec{items=new WeakMap;has(a){return this.items.has(a)}get(a,b=!1){let c=this.items.get(a);if(!c)throw Error(`Cannot get schema for '${a.prototype.constructor.name}' target`);if(b&&!c.schema)throw Error(`Schema '${a.prototype.constructor.name}' doesn't contain ASN.1 schema. Call 'AsnSchemaStorage.cache'.`);return c}cache(a){let b=this.get(a);b.schema||(b.schema=this.create(a,!0))}createDefault(a){let b={type:J.Sequence,items:{}},c=this.findParentSchema(a);return c&&(Object.assign(b,c),b.items=Object.assign({},b.items,c.items)),b}create(a,b){let c=this.items.get(a)||this.createDefault(a),d=[];for(let a in c.items){let e,f=c.items[a],g=b?a:"";if("number"==typeof f.type){let a=K[f.type],b=bm[a];if(!b)throw Error(`Cannot get ASN1 class by name '${a}'`);e=new b({name:g})}else eb(f.type)?e=new f.type().toSchema(g):f.optional?this.get(f.type).type===J.Choice?e=new dz({name:g}):(e=this.create(f.type,!1)).name=g:e=new dz({name:g});let h=!!f.optional||void 0!==f.defaultValue;if(f.repeated&&(e.name="",e=new("set"===f.repeated?c8:c7)({name:"",value:[new dB({name:g,value:e})]})),null!==f.context&&void 0!==f.context)if(f.implicit)if("number"==typeof f.type||eb(f.type)){let a=f.repeated?cP:cG;d.push(new a({name:g,optional:h,idBlock:{tagClass:3,tagNumber:f.context}}))}else{this.cache(f.type);let a=!!f.repeated,b=a?e:this.get(f.type,!0).schema;b="valueBlock"in b?b.valueBlock.value:b.value,d.push(new cP({name:a?"":g,optional:h,idBlock:{tagClass:3,tagNumber:f.context},value:b}))}else d.push(new cP({optional:h,idBlock:{tagClass:3,tagNumber:f.context},value:[e]}));else e.optional=h,d.push(e)}switch(c.type){case J.Sequence:return new c7({value:d,name:""});case J.Set:return new c8({value:d,name:""});case J.Choice:return new dA({value:d,name:""});default:throw Error("Unsupported ASN1 type in use")}}set(a,b){return this.items.set(a,b),this}findParentSchema(a){let b=Object.getPrototypeOf(a);return b?this.items.get(b)||this.findParentSchema(b):null}}let ed=new ec,ee=a=>b=>{let c;ed.has(b)?c=ed.get(b):(c=ed.createDefault(b),ed.set(b,c)),Object.assign(c,a)},ef=a=>(b,c)=>{let d;ed.has(b.constructor)?d=ed.get(b.constructor):(d=ed.createDefault(b.constructor),ed.set(b.constructor,d));let e=Object.assign({},a);if("number"==typeof e.type&&!e.converter){let d=ea(a.type);if(!d)throw Error(`Cannot get default converter for property '${c}' of ${b.constructor.name}`);e.converter=d}e.raw=a.raw,d.items[c]=e};class eg extends Error{schemas=[]}class eh{static parse(a,b,c){let d=cN(dL(a),c?.berOptions);if(d.result.error)throw Error(d.result.error);return this.fromASN(d.result,b,c)}static fromASN(a,b,c){try{if(eb(b))return new b().fromASN(a);let d=ed.get(b);ed.cache(b);let e=d.schema,f=this.handleChoiceTypes(a,d,b,e,c);if(f?.result)return f.result;f?.targetSchema&&(e=f.targetSchema);let g=this.handleSequenceTypes(a,d,b,e),h=new b;if(function a(b){if(b){let c=Object.getPrototypeOf(b);return c?.prototype?.constructor===Array||a(c)}return!1}(b))return this.handleArrayTypes(a,d,b,c);return this.processSchemaItems(d,g,h,c),h}catch(a){throw a instanceof eg&&a.schemas.push(b.name),a}}static handleChoiceTypes(a,b,c,d,e){if(a.constructor===cP&&b.type===J.Choice&&3===a.idBlock.tagClass)for(let d in b.items){let f=b.items[d];if(f.context===a.idBlock.tagNumber&&f.implicit&&"function"==typeof f.type&&ed.has(f.type)){let b=ed.get(f.type);if(b&&b.type===J.Sequence){let b=new c7;if("value"in a.valueBlock&&Array.isArray(a.valueBlock.value)&&"value"in b.valueBlock){b.valueBlock.value=a.valueBlock.value;let g=this.fromASN(b,f.type,e),h=new c;return h[d]=g,{result:h}}}}}else if(a.constructor===cP&&b.type!==J.Choice){let c=new cP({idBlock:{tagClass:3,tagNumber:a.idBlock.tagNumber},value:b.schema.valueBlock.value});for(let c in b.items)delete a[c];return{targetSchema:c}}return null}static handleSequenceTypes(a,b,c,d){if(b.type===J.Sequence){let b=dD({},a,d);if(!b.verified)throw new eg(`Data does not match to ${c.name} ASN1 schema.${b.result.error?` ${b.result.error}`:""}`);return b}{let b=dD({},a,d);if(!b.verified)throw new eg(`Data does not match to ${c.name} ASN1 schema.${b.result.error?` ${b.result.error}`:""}`);return b}}static processRepeatedField(a,b,c){let d=a.slice(b);if(1===d.length&&"Sequence"===d[0].constructor.name){let a=d[0];a.valueBlock&&a.valueBlock.value&&Array.isArray(a.valueBlock.value)&&(d=a.valueBlock.value)}if("number"!=typeof c.type)return d.filter(a=>a&&a.valueBlock).map(a=>{try{return this.fromASN(a,c.type)}catch{return}}).filter(a=>void 0!==a);{let a=ea(c.type);if(!a)throw Error(`No converter for ASN.1 type ${c.type}`);return d.filter(a=>a&&a.valueBlock).map(b=>{try{return a.fromASN(b)}catch{return}}).filter(a=>void 0!==a)}}static processPrimitiveField(a,b){let c=ea(b.type);if(!c)throw Error(`No converter for ASN.1 type ${b.type}`);return c.fromASN(a)}static isOptionalChoiceField(a){return a.optional&&"function"==typeof a.type&&ed.has(a.type)&&ed.get(a.type).type===J.Choice}static processOptionalChoiceField(a,b){try{let c=this.fromASN(a,b.type);return{processed:!0,value:c}}catch(a){if(a instanceof eg&&/Wrong values for Choice type/.test(a.message))return{processed:!1};throw a}}static handleArrayTypes(a,b,c,d){if(!("value"in a.valueBlock&&Array.isArray(a.valueBlock.value)))throw Error("Cannot get items from the ASN.1 parsed value. ASN.1 object is not constructed.");let e=b.itemType;if("number"!=typeof e)return c.from(a.valueBlock.value,a=>this.fromASN(a,e,d));{let b=ea(e);if(!b)throw Error(`Cannot get default converter for array item of ${c.name} ASN1 schema`);return c.from(a.valueBlock.value,a=>b.fromASN(a))}}static processSchemaItems(a,b,c,d){for(let e in a.items){let f,g=b.result[e];if(!g)continue;let h=a.items[e],i=h.type;(f="number"==typeof i||eb(i)?this.processPrimitiveSchemaItem(g,h,i,d):this.processComplexSchemaItem(g,h,i,d))&&"object"==typeof f&&"value"in f&&"raw"in f?(c[e]=f.value,c[`${e}Raw`]=f.raw):c[e]=f}}static processPrimitiveSchemaItem(a,b,c,d){let e=b.converter??(eb(c)?new c:null);if(!e)throw Error("Converter is empty");return b.repeated?this.processRepeatedPrimitiveItem(a,b,e,d):this.processSinglePrimitiveItem(a,b,c,e,d)}static processRepeatedPrimitiveItem(a,b,c,d){if(!b.implicit)return Array.from(a,a=>c.fromASN(a));{let e=new("sequence"===b.repeated?c7:c8);e.valueBlock=a.valueBlock;let f=cN(e.toBER(!1),d?.berOptions);if(-1===f.offset)throw Error(`Cannot parse the child item. ${f.result.error}`);if(!("value"in f.result.valueBlock&&Array.isArray(f.result.valueBlock.value)))throw Error("Cannot get items from the ASN.1 parsed value. ASN.1 object is not constructed.");return Array.from(f.result.valueBlock.value,a=>c.fromASN(a))}}static processSinglePrimitiveItem(a,b,c,d,e){let f=a;if(b.implicit){let a;if(eb(c))a=new c().toSchema("");else{let b=K[c],d=bm[b];if(!d)throw Error(`Cannot get '${b}' class from asn1js module`);a=new d}a.valueBlock=f.valueBlock,f=cN(a.toBER(!1),e?.berOptions).result}return d.fromASN(f)}static processComplexSchemaItem(a,b,c,d){if(b.repeated){if(!Array.isArray(a))throw Error("Cannot get list of items from the ASN.1 parsed value. ASN.1 value should be iterable.");return Array.from(a,a=>this.fromASN(a,c,d))}{let e=this.handleImplicitTagging(a,b,c);if(this.isOptionalChoiceField(b))try{return this.fromASN(e,c,d)}catch(a){if(a instanceof eg&&/Wrong values for Choice type/.test(a.message))return;throw a}{let f=this.fromASN(e,c,d);return b.raw?{value:f,raw:a.valueBeforeDecodeView}:f}}}static handleImplicitTagging(a,b,c){if(b.implicit&&"number"==typeof b.context){let b=ed.get(c);if(b.type===J.Sequence){let b=new c7;if("value"in a.valueBlock&&Array.isArray(a.valueBlock.value)&&"value"in b.valueBlock)return b.valueBlock.value=a.valueBlock.value,b}else if(b.type===J.Set){let b=new c8;if("value"in a.valueBlock&&Array.isArray(a.valueBlock.value)&&"value"in b.valueBlock)return b.valueBlock.value=a.valueBlock.value,b}}return a}}class ei{static serialize(a){return a instanceof cD?a.toBER(!1):this.toASN(a).toBER(!1)}static toASN(a){let b;if(a&&"object"==typeof a&&eb(a))return a.toASN();if(!(a&&"object"==typeof a))throw TypeError("Parameter 1 should be type of Object.");let c=a.constructor,d=ed.get(c);ed.cache(c);let e=[];if(d.itemType){if(!Array.isArray(a))throw TypeError("Parameter 1 should be type of Array.");if("number"==typeof d.itemType){let b=ea(d.itemType);if(!b)throw Error(`Cannot get default converter for array item of ${c.name} ASN1 schema`);e=a.map(a=>b.toASN(a))}else e=a.map(a=>this.toAsnItem({type:d.itemType},"[]",c,a))}else for(let b in d.items){let f=d.items[b],g=a[b];if(void 0===g||f.defaultValue===g||"object"==typeof f.defaultValue&&"object"==typeof g&&function(a,b){if(!(a&&b)||a.byteLength!==b.byteLength)return!1;let c=new Uint8Array(a),d=new Uint8Array(b);for(let b=0;b<a.byteLength;b++)if(c[b]!==d[b])return!1;return!0}(this.serialize(f.defaultValue),this.serialize(g)))continue;let h=ei.toAsnItem(f,b,c,g);if("number"==typeof f.context)if(f.implicit)if(!f.repeated&&("number"==typeof f.type||eb(f.type))){let a={};a.valueHex=h instanceof cS?dL(h.valueBeforeDecodeView):h.valueBlock.toBER(),e.push(new cG({optional:f.optional,idBlock:{tagClass:3,tagNumber:f.context},...a}))}else e.push(new cP({optional:f.optional,idBlock:{tagClass:3,tagNumber:f.context},value:h.valueBlock.value}));else e.push(new cP({optional:f.optional,idBlock:{tagClass:3,tagNumber:f.context},value:[h]}));else f.repeated?e=e.concat(h):e.push(h)}switch(d.type){case J.Sequence:b=new c7({value:e});break;case J.Set:b=new c8({value:e});break;case J.Choice:if(!e[0])throw Error(`Schema '${c.name}' has wrong data. Choice cannot be empty.`);b=e[0]}return b}static toAsnItem(a,b,c,d){let e;if("number"==typeof a.type){let f=a.converter;if(!f)throw Error(`Property '${b}' doesn't have converter for type ${K[a.type]} in schema '${c.name}'`);if(a.repeated){if(!Array.isArray(d))throw TypeError("Parameter 'objProp' should be type of Array.");let b=Array.from(d,a=>f.toASN(a));e=new("sequence"===a.repeated?c7:c8)({value:b})}else e=f.toASN(d)}else if(a.repeated){if(!Array.isArray(d))throw TypeError("Parameter 'objProp' should be type of Array.");let b=Array.from(d,a=>this.toASN(a));e=new("sequence"===a.repeated?c7:c8)({value:b})}else e=this.toASN(d);return e}}class ej extends Array{constructor(a=[]){if("number"==typeof a)super(a);else for(const b of(super(),a))this.push(b)}}class ek{static serialize(a){return ei.serialize(a)}static parse(a,b,c){return eh.parse(a,b,c)}static toString(a,b){let c=cN(dI(a)?dL(a):ek.serialize(a),b?.berOptions);if(-1===c.offset)throw Error(`Cannot decode ASN.1 data. ${c.result.error}`);return c.result.toString()}}function el(a,b,c,d){var e,f=arguments.length,g=f<3?b:null===d?d=Object.getOwnPropertyDescriptor(b,c):d;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)g=Reflect.decorate(a,b,c,d);else for(var h=a.length-1;h>=0;h--)(e=a[h])&&(g=(f<3?e(g):f>3?e(b,c,g):e(b,c))||g);return f>3&&g&&Object.defineProperty(b,c,g),g}function em(a,b,c,d){if("a"===c&&!d)throw TypeError("Private accessor was defined without a getter");if("function"==typeof b?a!==b||!d:!b.has(a))throw TypeError("Cannot read private member from an object whose class did not declare it");return"m"===c?d:"a"===c?d.call(a):d?d.value:b.get(a)}function en(a,b,c,d,e){if("m"===d)throw TypeError("Private method is not writable");if("a"===d&&!e)throw TypeError("Private accessor was defined without a setter");if("function"==typeof b?a!==b||!e:!b.has(a))throw TypeError("Cannot write private member to an object whose class did not declare it");return"a"===d?e.call(a,c):e?e.value=c:b.set(a,c),c}"function"==typeof SuppressedError&&SuppressedError;function eo(a,b){if(!b)return a.join("");if(!Number.isInteger(b.size)||b.size<1)throw RangeError("Hex group size must be a positive integer");let c=[];for(let d=0;d<a.length;d+=b.size)c.push(a.slice(d,d+b.size).join(""));return c.join(b.separator)}function ep(a,b={}){let c=dK(a),d=b.case??"lower",e=Array.from(c,a=>{let b=a.toString(16).padStart(2,"0");return"upper"===d?b.toUpperCase():b}),f="";if(b.line){let a=b.line.bytesPerLine;if(!Number.isInteger(a)||a<1)throw RangeError("Hex bytesPerLine must be a positive integer");let c=b.line.separator??"\n",d=[];for(let c=0;c<e.length;c+=a)d.push(eo(e.slice(c,c+a),b.group));f=d.join(c)}else f=eo(e,b.group);return`${b.prefix??""}${f}`}Object.freeze({}),Object.freeze({case:"upper"}),Object.freeze({group:{size:1,separator:":"}}),Object.freeze({case:"upper",group:{size:1,separator:":"}}),Object.freeze({group:{size:4,separator:" "}}),Object.freeze({prefix:"0x"});class eq{static isIPv4(a){return/^(\d{1,3}\.){3}\d{1,3}$/.test(a)}static parseIPv4(a){let b=a.split(".");if(4!==b.length)throw Error("Invalid IPv4 address");return b.map(a=>{let b=parseInt(a,10);if(isNaN(b)||b<0||b>255)throw Error("Invalid IPv4 address part");return b})}static parseIPv6(a){let b=this.expandIPv6(a).split(":");if(8!==b.length)throw Error("Invalid IPv6 address");return b.reduce((a,b)=>{let c=parseInt(b,16);if(isNaN(c)||c<0||c>65535)throw Error("Invalid IPv6 address part");return a.push(c>>8&255),a.push(255&c),a},[])}static expandIPv6(a){if(!a.includes("::"))return a;let b=a.split("::");if(b.length>2)throw Error("Invalid IPv6 address");let c=b[0]?b[0].split(":"):[],d=b[1]?b[1].split(":"):[],e=8-(c.length+d.length);if(e<0)throw Error("Invalid IPv6 address");return[...c,...Array(e).fill("0"),...d].join(":")}static formatIPv6(a){let b=[];for(let c=0;c<16;c+=2)b.push((a[c]<<8|a[c+1]).toString(16));return this.compressIPv6(b.join(":"))}static compressIPv6(a){let b=a.split(":"),c=-1,d=0,e=-1,f=0;for(let a=0;a<b.length;a++)"0"===b[a]?(-1===e&&(e=a),f++):(f>d&&(c=e,d=f),e=-1,f=0);if(f>d&&(c=e,d=f),d>1){let a=b.slice(0,c).join(":"),e=b.slice(c+d).join(":");return`${a}::${e}`}return a}static parseCIDR(a){let[b,c]=a.split("/"),d=parseInt(c,10);if(this.isIPv4(b)){if(d<0||d>32)throw Error("Invalid IPv4 prefix length");return[this.parseIPv4(b),d]}if(d<0||d>128)throw Error("Invalid IPv6 prefix length");return[this.parseIPv6(b),d]}static decodeIP(a){if(64===a.length&&0===parseInt(a,16))return"::/0";if(16!==a.length)return a;let b=parseInt(a.slice(8),16).toString(2).split("").reduce((a,b)=>a+ +b,0),c=a.slice(0,8).replace(/(.{2})/g,a=>`${parseInt(a,16)}.`);return c=c.slice(0,-1),`${c}/${b}`}static toString(a){let b=new Uint8Array(a);if(4===b.length)return Array.from(b).join(".");if(16===b.length)return this.formatIPv6(b);if(8===b.length||32===b.length){let a=b.length/2,c=b.slice(0,a),d=b.slice(a);if(b.every(a=>0===a))return 8===b.length?"0.0.0.0/0":"::/0";let e=d.reduce((a,b)=>a+(b.toString(2).match(/1/g)||[]).length,0);if(8===b.length){let a=Array.from(c).join(".");return`${a}/${e}`}{let a=this.formatIPv6(c);return`${a}/${e}`}}return this.decodeIP(ep(a))}static fromString(a){if(a.includes("/")){let[b,c]=this.parseCIDR(a),d=new Uint8Array(b.length),e=c;for(let a=0;a<d.length;a++)e>=8?(d[a]=255,e-=8):e>0&&(d[a]=255<<8-e,e=0);let f=new Uint8Array(2*b.length);return f.set(b,0),f.set(d,b.length),f.buffer}return new Uint8Array(this.isIPv4(a)?this.parseIPv4(a):this.parseIPv6(a)).buffer}}let er=class{teletexString;printableString;universalString;utf8String;bmpString;constructor(a={}){Object.assign(this,a)}toString(){return this.bmpString||this.printableString||this.teletexString||this.universalString||this.utf8String||""}};el([ef({type:K.TeletexString})],er.prototype,"teletexString",void 0),el([ef({type:K.PrintableString})],er.prototype,"printableString",void 0),el([ef({type:K.UniversalString})],er.prototype,"universalString",void 0),el([ef({type:K.Utf8String})],er.prototype,"utf8String",void 0),el([ef({type:K.BmpString})],er.prototype,"bmpString",void 0),er=el([ee({type:J.Choice})],er);let es=class extends er{ia5String;anyValue;constructor(a={}){super(a),Object.assign(this,a)}toString(){return this.ia5String||(this.anyValue?ep(this.anyValue):super.toString())}};el([ef({type:K.IA5String})],es.prototype,"ia5String",void 0),el([ef({type:K.Any})],es.prototype,"anyValue",void 0),es=el([ee({type:J.Choice})],es);class et{type="";value=new es;constructor(a={}){Object.assign(this,a)}}el([ef({type:K.ObjectIdentifier})],et.prototype,"type",void 0),el([ef({type:es})],et.prototype,"value",void 0);let eu=L=class extends ej{constructor(a){super(a),Object.setPrototypeOf(this,L.prototype)}};eu=L=el([ee({type:J.Set,itemType:et})],eu);let ev=M=class extends ej{constructor(a){super(a),Object.setPrototypeOf(this,M.prototype)}};ev=M=el([ee({type:J.Sequence,itemType:eu})],ev);let ew=N=class extends ev{constructor(a){super(a),Object.setPrototypeOf(this,N.prototype)}};ew=N=el([ee({type:J.Sequence})],ew);class ex{typeId="";value=new ArrayBuffer(0);constructor(a={}){Object.assign(this,a)}}el([ef({type:K.ObjectIdentifier})],ex.prototype,"typeId",void 0),el([ef({type:K.Any,context:0})],ex.prototype,"value",void 0);class ey{nameAssigner;partyName=new er;constructor(a={}){Object.assign(this,a)}}el([ef({type:er,optional:!0,context:0,implicit:!0})],ey.prototype,"nameAssigner",void 0),el([ef({type:er,context:1,implicit:!0})],ey.prototype,"partyName",void 0);let ez=class{otherName;rfc822Name;dNSName;x400Address;directoryName;ediPartyName;uniformResourceIdentifier;iPAddress;registeredID;constructor(a={}){Object.assign(this,a)}};el([ef({type:ex,context:0,implicit:!0})],ez.prototype,"otherName",void 0),el([ef({type:K.IA5String,context:1,implicit:!0})],ez.prototype,"rfc822Name",void 0),el([ef({type:K.IA5String,context:2,implicit:!0})],ez.prototype,"dNSName",void 0),el([ef({type:K.Any,context:3,implicit:!0})],ez.prototype,"x400Address",void 0),el([ef({type:ew,context:4,implicit:!1})],ez.prototype,"directoryName",void 0),el([ef({type:ey,context:5})],ez.prototype,"ediPartyName",void 0),el([ef({type:K.IA5String,context:6,implicit:!0})],ez.prototype,"uniformResourceIdentifier",void 0),el([ef({type:K.OctetString,context:7,implicit:!0,converter:{fromASN:a=>eq.toString(dV.fromASN(a)),toASN:a=>dV.toASN(eq.fromString(a))}})],ez.prototype,"iPAddress",void 0),el([ef({type:K.ObjectIdentifier,context:8,implicit:!0})],ez.prototype,"registeredID",void 0),ez=el([ee({type:J.Choice})],ez);let eA="1.3.6.1.5.5.7",eB=`${eA}.1`,eC=`${eA}.3`,eD=`${eA}.48`,eE=`${eD}.1`,eF=`${eD}.2`,eG=`${eD}.3`,eH=`${eD}.5`,eI="2.5.29",eJ=`${eB}.1`;class eK{accessMethod="";accessLocation=new ez;constructor(a={}){Object.assign(this,a)}}el([ef({type:K.ObjectIdentifier})],eK.prototype,"accessMethod",void 0),el([ef({type:ez})],eK.prototype,"accessLocation",void 0);let eL=O=class extends ej{constructor(a){super(a),Object.setPrototypeOf(this,O.prototype)}};eL=O=el([ee({type:J.Sequence,itemType:eK})],eL);let eM=`${eI}.35`;class eN extends dN{}class eO{keyIdentifier;authorityCertIssuer;authorityCertSerialNumber;constructor(a={}){a&&Object.assign(this,a)}}el([ef({type:eN,context:0,optional:!0,implicit:!0})],eO.prototype,"keyIdentifier",void 0),el([ef({type:ez,context:1,optional:!0,implicit:!0,repeated:"sequence"})],eO.prototype,"authorityCertIssuer",void 0),el([ef({type:K.Integer,context:2,optional:!0,implicit:!0,converter:dR})],eO.prototype,"authorityCertSerialNumber",void 0);let eP=`${eI}.19`;class eQ{cA=!1;pathLenConstraint;constructor(a={}){Object.assign(this,a)}}el([ef({type:K.Boolean,defaultValue:!1})],eQ.prototype,"cA",void 0),el([ef({type:K.Integer,optional:!0})],eQ.prototype,"pathLenConstraint",void 0);let eR=P=class extends ej{constructor(a){super(a),Object.setPrototypeOf(this,P.prototype)}};eR=P=el([ee({type:J.Sequence,itemType:ez})],eR);let eS=Q=class extends eR{constructor(a){super(a),Object.setPrototypeOf(this,Q.prototype)}};eS=Q=el([ee({type:J.Sequence})],eS);let eT=`${eI}.32`,eU=class{ia5String;visibleString;bmpString;utf8String;constructor(a={}){Object.assign(this,a)}toString(){return this.ia5String||this.visibleString||this.bmpString||this.utf8String||""}};el([ef({type:K.IA5String})],eU.prototype,"ia5String",void 0),el([ef({type:K.VisibleString})],eU.prototype,"visibleString",void 0),el([ef({type:K.BmpString})],eU.prototype,"bmpString",void 0),el([ef({type:K.Utf8String})],eU.prototype,"utf8String",void 0),eU=el([ee({type:J.Choice})],eU);class eV{organization=new eU;noticeNumbers=[];constructor(a={}){Object.assign(this,a)}}el([ef({type:eU})],eV.prototype,"organization",void 0),el([ef({type:K.Integer,repeated:"sequence"})],eV.prototype,"noticeNumbers",void 0);class eW{noticeRef;explicitText;constructor(a={}){Object.assign(this,a)}}el([ef({type:eV,optional:!0})],eW.prototype,"noticeRef",void 0),el([ef({type:eU,optional:!0})],eW.prototype,"explicitText",void 0);let eX=class{cPSuri;userNotice;constructor(a={}){Object.assign(this,a)}};el([ef({type:K.IA5String})],eX.prototype,"cPSuri",void 0),el([ef({type:eW})],eX.prototype,"userNotice",void 0),eX=el([ee({type:J.Choice})],eX);class eY{policyQualifierId="";qualifier=new ArrayBuffer(0);constructor(a={}){Object.assign(this,a)}}el([ef({type:K.ObjectIdentifier})],eY.prototype,"policyQualifierId",void 0),el([ef({type:K.Any})],eY.prototype,"qualifier",void 0);class eZ{policyIdentifier="";policyQualifiers;constructor(a={}){Object.assign(this,a)}}el([ef({type:K.ObjectIdentifier})],eZ.prototype,"policyIdentifier",void 0),el([ef({type:eY,repeated:"sequence",optional:!0})],eZ.prototype,"policyQualifiers",void 0);let e$=R=class extends ej{constructor(a){super(a),Object.setPrototypeOf(this,R.prototype)}};e$=R=el([ee({type:J.Sequence,itemType:eZ})],e$);let e_=class{value;constructor(a=0){this.value=a}};el([ef({type:K.Integer})],e_.prototype,"value",void 0),e_=el([ee({type:J.Choice})],e_);let e0=class extends e_{};e0=el([ee({type:J.Choice})],e0);let e1=`${eI}.31`;(k=T||(T={}))[k.unused=1]="unused",k[k.keyCompromise=2]="keyCompromise",k[k.cACompromise=4]="cACompromise",k[k.affiliationChanged=8]="affiliationChanged",k[k.superseded=16]="superseded",k[k.cessationOfOperation=32]="cessationOfOperation",k[k.certificateHold=64]="certificateHold",k[k.privilegeWithdrawn=128]="privilegeWithdrawn",k[k.aACompromise=256]="aACompromise";class e2 extends dM{toJSON(){let a=[],b=this.toNumber();return b&T.aACompromise&&a.push("aACompromise"),b&T.affiliationChanged&&a.push("affiliationChanged"),b&T.cACompromise&&a.push("cACompromise"),b&T.certificateHold&&a.push("certificateHold"),b&T.cessationOfOperation&&a.push("cessationOfOperation"),b&T.keyCompromise&&a.push("keyCompromise"),b&T.privilegeWithdrawn&&a.push("privilegeWithdrawn"),b&T.superseded&&a.push("superseded"),b&T.unused&&a.push("unused"),a}toString(){return`[${this.toJSON().join(", ")}]`}}let e3=class{fullName;nameRelativeToCRLIssuer;constructor(a={}){Object.assign(this,a)}};el([ef({type:ez,context:0,repeated:"sequence",implicit:!0})],e3.prototype,"fullName",void 0),el([ef({type:eu,context:1,implicit:!0})],e3.prototype,"nameRelativeToCRLIssuer",void 0),e3=el([ee({type:J.Choice})],e3);class e4{distributionPoint;reasons;cRLIssuer;constructor(a={}){Object.assign(this,a)}}el([ef({type:e3,context:0,optional:!0})],e4.prototype,"distributionPoint",void 0),el([ef({type:e2,context:1,optional:!0,implicit:!0})],e4.prototype,"reasons",void 0),el([ef({type:ez,context:2,optional:!0,repeated:"sequence",implicit:!0})],e4.prototype,"cRLIssuer",void 0);let e5=S=class extends ej{constructor(a){super(a),Object.setPrototypeOf(this,S.prototype)}};e5=S=el([ee({type:J.Sequence,itemType:e4})],e5);let e6=U=class extends e5{constructor(a){super(a),Object.setPrototypeOf(this,U.prototype)}};e6=U=el([ee({type:J.Sequence,itemType:e4})],e6);class e7{static ONLY=!1;distributionPoint;onlyContainsUserCerts=e7.ONLY;onlyContainsCACerts=e7.ONLY;onlySomeReasons;indirectCRL=e7.ONLY;onlyContainsAttributeCerts=e7.ONLY;constructor(a={}){Object.assign(this,a)}}el([ef({type:e3,context:0,optional:!0})],e7.prototype,"distributionPoint",void 0),el([ef({type:K.Boolean,context:1,defaultValue:e7.ONLY,implicit:!0})],e7.prototype,"onlyContainsUserCerts",void 0),el([ef({type:K.Boolean,context:2,defaultValue:e7.ONLY,implicit:!0})],e7.prototype,"onlyContainsCACerts",void 0),el([ef({type:e2,context:3,optional:!0,implicit:!0})],e7.prototype,"onlySomeReasons",void 0),el([ef({type:K.Boolean,context:4,defaultValue:e7.ONLY,implicit:!0})],e7.prototype,"indirectCRL",void 0),el([ef({type:K.Boolean,context:5,defaultValue:e7.ONLY,implicit:!0})],e7.prototype,"onlyContainsAttributeCerts",void 0);let e8=`${eI}.21`;(l=V||(V={}))[l.unspecified=0]="unspecified",l[l.keyCompromise=1]="keyCompromise",l[l.cACompromise=2]="cACompromise",l[l.affiliationChanged=3]="affiliationChanged",l[l.superseded=4]="superseded",l[l.cessationOfOperation=5]="cessationOfOperation",l[l.certificateHold=6]="certificateHold",l[l.removeFromCRL=8]="removeFromCRL",l[l.privilegeWithdrawn=9]="privilegeWithdrawn",l[l.aACompromise=10]="aACompromise";let e9=class{reason=V.unspecified;constructor(a=V.unspecified){this.reason=a}toJSON(){return V[this.reason]}toString(){return this.toJSON()}};el([ef({type:K.Enumerated})],e9.prototype,"reason",void 0),e9=el([ee({type:J.Choice})],e9);let fa=`${eI}.37`,fb=W=class extends ej{constructor(a){super(a),Object.setPrototypeOf(this,W.prototype)}};fb=W=el([ee({type:J.Sequence,itemType:K.ObjectIdentifier})],fb);let fc=`${eC}.1`,fd=`${eC}.2`,fe=`${eC}.3`,ff=`${eC}.4`,fg=`${eC}.8`,fh=`${eC}.9`,fi=class{value;constructor(a=new ArrayBuffer(0)){this.value=a}};el([ef({type:K.Integer,converter:dR})],fi.prototype,"value",void 0),fi=el([ee({type:J.Choice})],fi);let fj=`${eI}.24`,fk=class{value=new Date;constructor(a){a&&(this.value=a)}};el([ef({type:K.GeneralizedTime})],fk.prototype,"value",void 0),fk=el([ee({type:J.Choice})],fk);let fl=`${eI}.18`,fm=X=class extends eR{constructor(a){super(a),Object.setPrototypeOf(this,X.prototype)}};fm=X=el([ee({type:J.Sequence})],fm);let fn=`${eI}.15`;(m=Y||(Y={}))[m.digitalSignature=1]="digitalSignature",m[m.nonRepudiation=2]="nonRepudiation",m[m.keyEncipherment=4]="keyEncipherment",m[m.dataEncipherment=8]="dataEncipherment",m[m.keyAgreement=16]="keyAgreement",m[m.keyCertSign=32]="keyCertSign",m[m.cRLSign=64]="cRLSign",m[m.encipherOnly=128]="encipherOnly",m[m.decipherOnly=256]="decipherOnly";class fo extends dM{toJSON(){let a=this.toNumber(),b=[];return a&Y.cRLSign&&b.push("crlSign"),a&Y.dataEncipherment&&b.push("dataEncipherment"),a&Y.decipherOnly&&b.push("decipherOnly"),a&Y.digitalSignature&&b.push("digitalSignature"),a&Y.encipherOnly&&b.push("encipherOnly"),a&Y.keyAgreement&&b.push("keyAgreement"),a&Y.keyCertSign&&b.push("keyCertSign"),a&Y.keyEncipherment&&b.push("keyEncipherment"),a&Y.nonRepudiation&&b.push("nonRepudiation"),b}toString(){return`[${this.toJSON().join(", ")}]`}}class fp{base=new ez;minimum=0;maximum;constructor(a={}){Object.assign(this,a)}}el([ef({type:ez})],fp.prototype,"base",void 0),el([ef({type:K.Integer,context:0,defaultValue:0,implicit:!0})],fp.prototype,"minimum",void 0),el([ef({type:K.Integer,context:1,optional:!0,implicit:!0})],fp.prototype,"maximum",void 0);let fq=Z=class extends ej{constructor(a){super(a),Object.setPrototypeOf(this,Z.prototype)}};fq=Z=el([ee({type:J.Sequence,itemType:fp})],fq);class fr{permittedSubtrees;excludedSubtrees;constructor(a={}){Object.assign(this,a)}}el([ef({type:fq,context:0,optional:!0,implicit:!0})],fr.prototype,"permittedSubtrees",void 0),el([ef({type:fq,context:1,optional:!0,implicit:!0})],fr.prototype,"excludedSubtrees",void 0);class fs{requireExplicitPolicy;inhibitPolicyMapping;constructor(a={}){Object.assign(this,a)}}el([ef({type:K.Integer,context:0,implicit:!0,optional:!0,converter:dR})],fs.prototype,"requireExplicitPolicy",void 0),el([ef({type:K.Integer,context:1,implicit:!0,optional:!0,converter:dR})],fs.prototype,"inhibitPolicyMapping",void 0);class ft{issuerDomainPolicy="";subjectDomainPolicy="";constructor(a={}){Object.assign(this,a)}}el([ef({type:K.ObjectIdentifier})],ft.prototype,"issuerDomainPolicy",void 0),el([ef({type:K.ObjectIdentifier})],ft.prototype,"subjectDomainPolicy",void 0);let fu=$=class extends ej{constructor(a){super(a),Object.setPrototypeOf(this,$.prototype)}};fu=$=el([ee({type:J.Sequence,itemType:ft})],fu);let fv=`${eI}.17`,fw=_=class extends eR{constructor(a){super(a),Object.setPrototypeOf(this,_.prototype)}};fw=_=el([ee({type:J.Sequence})],fw);class fx{type="";values=[];constructor(a={}){Object.assign(this,a)}}el([ef({type:K.ObjectIdentifier})],fx.prototype,"type",void 0),el([ef({type:K.Any,repeated:"set"})],fx.prototype,"values",void 0);let fy=aa=class extends ej{constructor(a){super(a),Object.setPrototypeOf(this,aa.prototype)}};fy=aa=el([ee({type:J.Sequence,itemType:fx})],fy);let fz=`${eI}.14`;class fA extends eN{}class fB{notBefore;notAfter;constructor(a={}){Object.assign(this,a)}}el([ef({type:K.GeneralizedTime,context:0,implicit:!0,optional:!0})],fB.prototype,"notBefore",void 0),el([ef({type:K.GeneralizedTime,context:1,implicit:!0,optional:!0})],fB.prototype,"notAfter",void 0),(n=ab||(ab={}))[n.keyUpdateAllowed=1]="keyUpdateAllowed",n[n.newExtensions=2]="newExtensions",n[n.pKIXCertificate=4]="pKIXCertificate";class fC extends dM{toJSON(){let a=[],b=this.toNumber();return b&ab.pKIXCertificate&&a.push("pKIXCertificate"),b&ab.newExtensions&&a.push("newExtensions"),b&ab.keyUpdateAllowed&&a.push("keyUpdateAllowed"),a}toString(){return`[${this.toJSON().join(", ")}]`}}class fD{entrustVers="";entrustInfoFlags=new fC;constructor(a={}){Object.assign(this,a)}}el([ef({type:K.GeneralString})],fD.prototype,"entrustVers",void 0),el([ef({type:fC})],fD.prototype,"entrustInfoFlags",void 0);let fE=ac=class extends ej{constructor(a){super(a),Object.setPrototypeOf(this,ac.prototype)}};fE=ac=el([ee({type:J.Sequence,itemType:eK})],fE);class fF{algorithm="";parameters;constructor(a={}){Object.assign(this,a)}isEqual(a){return a instanceof fF&&a.algorithm==this.algorithm&&(a.parameters&&this.parameters&&function(a,b,c={}){let d=dK(a),e=dK(b);if(!c.constantTime&&d.byteLength!==e.byteLength)return!1;let f=Math.max(d.byteLength,e.byteLength),g=d.byteLength^e.byteLength;for(let a=0;a<f;a++)g|=(d[a]??0)^(e[a]??0);return 0===g}(a.parameters,this.parameters)||a.parameters===this.parameters)}}el([ef({type:K.ObjectIdentifier})],fF.prototype,"algorithm",void 0),el([ef({type:K.Any,optional:!0})],fF.prototype,"parameters",void 0);class fG{algorithm=new fF;subjectPublicKey=new ArrayBuffer(0);constructor(a={}){Object.assign(this,a)}}el([ef({type:fF})],fG.prototype,"algorithm",void 0),el([ef({type:K.BitString})],fG.prototype,"subjectPublicKey",void 0);let fH=class{utcTime;generalTime;constructor(a){if(a)if("string"==typeof a||"number"==typeof a||a instanceof Date){const b=new Date(a);b.setMilliseconds(0),b.getUTCFullYear()>2049?this.generalTime=b:this.utcTime=b}else Object.assign(this,a)}getTime(){let a=this.utcTime||this.generalTime;if(!a)throw Error("Cannot get time from CHOICE object");return a}};el([ef({type:K.UTCTime})],fH.prototype,"utcTime",void 0),el([ef({type:K.GeneralizedTime})],fH.prototype,"generalTime",void 0),fH=el([ee({type:J.Choice})],fH);class fI{notBefore=new fH(new Date);notAfter=new fH(new Date);constructor(a){a&&(this.notBefore=new fH(a.notBefore),this.notAfter=new fH(a.notAfter))}}el([ef({type:fH})],fI.prototype,"notBefore",void 0),el([ef({type:fH})],fI.prototype,"notAfter",void 0);class fJ{static CRITICAL=!1;extnID="";critical=fJ.CRITICAL;extnValue=new dN;constructor(a={}){Object.assign(this,a)}}el([ef({type:K.ObjectIdentifier})],fJ.prototype,"extnID",void 0),el([ef({type:K.Boolean,defaultValue:fJ.CRITICAL})],fJ.prototype,"critical",void 0),el([ef({type:dN})],fJ.prototype,"extnValue",void 0);let fK=ad=class extends ej{constructor(a){super(a),Object.setPrototypeOf(this,ad.prototype)}};fK=ad=el([ee({type:J.Sequence,itemType:fJ})],fK),(o=ae||(ae={}))[o.v1=0]="v1",o[o.v2=1]="v2",o[o.v3=2]="v3";class fL{version=ae.v1;serialNumber=new ArrayBuffer(0);signature=new fF;issuer=new ew;validity=new fI;subject=new ew;subjectPublicKeyInfo=new fG;issuerUniqueID;subjectUniqueID;extensions;constructor(a={}){Object.assign(this,a)}}el([ef({type:K.Integer,context:0,defaultValue:ae.v1})],fL.prototype,"version",void 0),el([ef({type:K.Integer,converter:dR})],fL.prototype,"serialNumber",void 0),el([ef({type:fF})],fL.prototype,"signature",void 0),el([ef({type:ew})],fL.prototype,"issuer",void 0),el([ef({type:fI})],fL.prototype,"validity",void 0),el([ef({type:ew})],fL.prototype,"subject",void 0),el([ef({type:fG})],fL.prototype,"subjectPublicKeyInfo",void 0),el([ef({type:K.BitString,context:1,implicit:!0,optional:!0})],fL.prototype,"issuerUniqueID",void 0),el([ef({type:K.BitString,context:2,implicit:!0,optional:!0})],fL.prototype,"subjectUniqueID",void 0),el([ef({type:fK,context:3,optional:!0})],fL.prototype,"extensions",void 0);class fM{tbsCertificate=new fL;tbsCertificateRaw;signatureAlgorithm=new fF;signatureValue=new ArrayBuffer(0);constructor(a={}){Object.assign(this,a)}}el([ef({type:fL,raw:!0})],fM.prototype,"tbsCertificate",void 0),el([ef({type:fF})],fM.prototype,"signatureAlgorithm",void 0),el([ef({type:K.BitString})],fM.prototype,"signatureValue",void 0);class fN{userCertificate=new ArrayBuffer(0);revocationDate=new fH;crlEntryExtensions;constructor(a={}){Object.assign(this,a)}}el([ef({type:K.Integer,converter:dR})],fN.prototype,"userCertificate",void 0),el([ef({type:fH})],fN.prototype,"revocationDate",void 0),el([ef({type:fJ,optional:!0,repeated:"sequence"})],fN.prototype,"crlEntryExtensions",void 0);class fO{version;signature=new fF;issuer=new ew;thisUpdate=new fH;nextUpdate;revokedCertificates;crlExtensions;constructor(a={}){Object.assign(this,a)}}el([ef({type:K.Integer,optional:!0})],fO.prototype,"version",void 0),el([ef({type:fF})],fO.prototype,"signature",void 0),el([ef({type:ew})],fO.prototype,"issuer",void 0),el([ef({type:fH})],fO.prototype,"thisUpdate",void 0),el([ef({type:fH,optional:!0})],fO.prototype,"nextUpdate",void 0),el([ef({type:fN,repeated:"sequence",optional:!0})],fO.prototype,"revokedCertificates",void 0),el([ef({type:fJ,optional:!0,context:0,repeated:"sequence"})],fO.prototype,"crlExtensions",void 0);class fP{tbsCertList=new fO;tbsCertListRaw;signatureAlgorithm=new fF;signature=new ArrayBuffer(0);constructor(a={}){Object.assign(this,a)}}el([ef({type:fO,raw:!0})],fP.prototype,"tbsCertList",void 0),el([ef({type:fF})],fP.prototype,"signatureAlgorithm",void 0),el([ef({type:K.BitString})],fP.prototype,"signature",void 0);let fQ={"2.5.4.6":"C","2.5.4.10":"O","2.5.4.11":"OU","2.5.4.3":"CN"};function fR(a){let b=eh.parse(a,fM),c=b.tbsCertificate,d={combined:""};c.issuer.forEach(([a])=>{let b=fQ[a.type];b&&(d[b]=a.value.toString())}),d.combined=fS(d);let e={combined:""};c.subject.forEach(([a])=>{let b=fQ[a.type];b&&(e[b]=a.value.toString())}),e.combined=fS(e);let f=!1;if(c.extensions)for(let a of c.extensions)a.extnID===eP&&(f=eh.parse(a.extnValue,eQ).cA);return{issuer:d,subject:e,version:c.version,basicConstraintsCA:f,notBefore:c.validity.notBefore.getTime(),notAfter:c.validity.notAfter.getTime(),parsedCertificate:b}}function fS(a){let b=[];return a.C&&b.push(a.C),a.O&&b.push(a.O),a.OU&&b.push(a.OU),a.CN&&b.push(a.CN),b.join(" : ")}c(91607);class fT{issuer=new ew;serialNumber=new ArrayBuffer(0);constructor(a={}){Object.assign(this,a)}}el([ef({type:ew})],fT.prototype,"issuer",void 0),el([ef({type:K.Integer,converter:dR})],fT.prototype,"serialNumber",void 0);let fU=class{subjectKeyIdentifier;issuerAndSerialNumber;constructor(a={}){Object.assign(this,a)}};el([ef({type:fA,context:0,implicit:!0})],fU.prototype,"subjectKeyIdentifier",void 0),el([ef({type:fT})],fU.prototype,"issuerAndSerialNumber",void 0),fU=el([ee({type:J.Choice})],fU),(p=af||(af={}))[p.v0=0]="v0",p[p.v1=1]="v1",p[p.v2=2]="v2",p[p.v3=3]="v3",p[p.v4=4]="v4",p[p.v5=5]="v5";let fV=class extends fF{};fV=el([ee({type:J.Sequence})],fV);let fW=class extends fF{};fW=el([ee({type:J.Sequence})],fW);let fX=class extends fF{};fX=el([ee({type:J.Sequence})],fX);let fY=class extends fF{};fY=el([ee({type:J.Sequence})],fY);let fZ=class extends fF{};fZ=el([ee({type:J.Sequence})],fZ);let f$=class extends fF{};f$=el([ee({type:J.Sequence})],f$);class f_{attrType="";attrValues=[];constructor(a={}){Object.assign(this,a)}}el([ef({type:K.ObjectIdentifier})],f_.prototype,"attrType",void 0),el([ef({type:K.Any,repeated:"set"})],f_.prototype,"attrValues",void 0);class f0{version=af.v0;sid=new fU;digestAlgorithm=new fV;signedAttrs;signedAttrsRaw;signatureAlgorithm=new fW;signature=new dN;unsignedAttrs;constructor(a={}){Object.assign(this,a)}}el([ef({type:K.Integer})],f0.prototype,"version",void 0),el([ef({type:fU})],f0.prototype,"sid",void 0),el([ef({type:fV})],f0.prototype,"digestAlgorithm",void 0),el([ef({type:f_,repeated:"set",context:0,implicit:!0,optional:!0,raw:!0})],f0.prototype,"signedAttrs",void 0),el([ef({type:fW})],f0.prototype,"signatureAlgorithm",void 0),el([ef({type:dN})],f0.prototype,"signature",void 0),el([ef({type:f_,repeated:"set",context:1,implicit:!0,optional:!0})],f0.prototype,"unsignedAttrs",void 0);let f1=ag=class extends ej{constructor(a){super(a),Object.setPrototypeOf(this,ag.prototype)}};f1=ag=el([ee({type:J.Set,itemType:f0})],f1);let f2=class extends f0{};f2=el([ee({type:J.Sequence})],f2);let f3=class extends fH{};f3=el([ee({type:J.Choice})],f3);class f4{acIssuer=new ez;acSerial=0;attrs=[];constructor(a={}){Object.assign(this,a)}}el([ef({type:ez})],f4.prototype,"acIssuer",void 0),el([ef({type:K.Integer})],f4.prototype,"acSerial",void 0),el([ef({type:fx,repeated:"sequence"})],f4.prototype,"attrs",void 0);let f5=ah=class extends ej{constructor(a){super(a),Object.setPrototypeOf(this,ah.prototype)}};f5=ah=el([ee({type:J.Sequence,itemType:K.ObjectIdentifier})],f5);class f6{pathLenConstraint;permittedAttrs;excludedAttrs;permitUnSpecified=!0;constructor(a={}){Object.assign(this,a)}}el([ef({type:K.Integer,optional:!0})],f6.prototype,"pathLenConstraint",void 0),el([ef({type:f5,implicit:!0,context:0,optional:!0})],f6.prototype,"permittedAttrs",void 0),el([ef({type:f5,implicit:!0,context:1,optional:!0})],f6.prototype,"excludedAttrs",void 0),el([ef({type:K.Boolean,defaultValue:!0})],f6.prototype,"permitUnSpecified",void 0);class f7{issuer=new eR;serial=new ArrayBuffer(0);issuerUID=new ArrayBuffer(0);constructor(a={}){Object.assign(this,a)}}el([ef({type:eR})],f7.prototype,"issuer",void 0),el([ef({type:K.Integer,converter:dR})],f7.prototype,"serial",void 0),el([ef({type:K.BitString,optional:!0})],f7.prototype,"issuerUID",void 0),(q=ai||(ai={}))[q.publicKey=0]="publicKey",q[q.publicKeyCert=1]="publicKeyCert",q[q.otherObjectTypes=2]="otherObjectTypes";class f8{digestedObjectType=ai.publicKey;otherObjectTypeID;digestAlgorithm=new fF;objectDigest=new ArrayBuffer(0);constructor(a={}){Object.assign(this,a)}}el([ef({type:K.Enumerated})],f8.prototype,"digestedObjectType",void 0),el([ef({type:K.ObjectIdentifier,optional:!0})],f8.prototype,"otherObjectTypeID",void 0),el([ef({type:fF})],f8.prototype,"digestAlgorithm",void 0),el([ef({type:K.BitString})],f8.prototype,"objectDigest",void 0);class f9{issuerName;baseCertificateID;objectDigestInfo;constructor(a={}){Object.assign(this,a)}}el([ef({type:eR,optional:!0})],f9.prototype,"issuerName",void 0),el([ef({type:f7,context:0,implicit:!0,optional:!0})],f9.prototype,"baseCertificateID",void 0),el([ef({type:f8,context:1,implicit:!0,optional:!0})],f9.prototype,"objectDigestInfo",void 0);let ga=class{v1Form;v2Form;constructor(a={}){Object.assign(this,a)}};el([ef({type:ez,repeated:"sequence"})],ga.prototype,"v1Form",void 0),el([ef({type:f9,context:0,implicit:!0})],ga.prototype,"v2Form",void 0),ga=el([ee({type:J.Choice})],ga);class gb{notBeforeTime=new Date;notAfterTime=new Date;constructor(a={}){Object.assign(this,a)}}el([ef({type:K.GeneralizedTime})],gb.prototype,"notBeforeTime",void 0),el([ef({type:K.GeneralizedTime})],gb.prototype,"notAfterTime",void 0);class gc{baseCertificateID;entityName;objectDigestInfo;constructor(a={}){Object.assign(this,a)}}el([ef({type:f7,implicit:!0,context:0,optional:!0})],gc.prototype,"baseCertificateID",void 0),el([ef({type:eR,implicit:!0,context:1,optional:!0})],gc.prototype,"entityName",void 0),el([ef({type:f8,implicit:!0,context:2,optional:!0})],gc.prototype,"objectDigestInfo",void 0),(r=aj||(aj={}))[r.v2=1]="v2";class gd{version=aj.v2;holder=new gc;issuer=new ga;signature=new fF;serialNumber=new ArrayBuffer(0);attrCertValidityPeriod=new gb;attributes=[];issuerUniqueID;extensions;constructor(a={}){Object.assign(this,a)}}el([ef({type:K.Integer})],gd.prototype,"version",void 0),el([ef({type:gc})],gd.prototype,"holder",void 0),el([ef({type:ga})],gd.prototype,"issuer",void 0),el([ef({type:fF})],gd.prototype,"signature",void 0),el([ef({type:K.Integer,converter:dR})],gd.prototype,"serialNumber",void 0),el([ef({type:gb})],gd.prototype,"attrCertValidityPeriod",void 0),el([ef({type:fx,repeated:"sequence"})],gd.prototype,"attributes",void 0),el([ef({type:K.BitString,optional:!0})],gd.prototype,"issuerUniqueID",void 0),el([ef({type:fK,optional:!0})],gd.prototype,"extensions",void 0);class ge{acinfo=new gd;signatureAlgorithm=new fF;signatureValue=new ArrayBuffer(0);constructor(a={}){Object.assign(this,a)}}el([ef({type:gd})],ge.prototype,"acinfo",void 0),el([ef({type:fF})],ge.prototype,"signatureAlgorithm",void 0),el([ef({type:K.BitString})],ge.prototype,"signatureValue",void 0),(s=ak||(ak={}))[s.unmarked=1]="unmarked",s[s.unclassified=2]="unclassified",s[s.restricted=4]="restricted",s[s.confidential=8]="confidential",s[s.secret=16]="secret",s[s.topSecret=32]="topSecret";class gf extends dM{}class gg{type="";value=new ArrayBuffer(0);constructor(a={}){Object.assign(this,a)}}el([ef({type:K.ObjectIdentifier,implicit:!0,context:0})],gg.prototype,"type",void 0),el([ef({type:K.Any,implicit:!0,context:1})],gg.prototype,"value",void 0);class gh{policyId="";classList=new gf(ak.unclassified);securityCategories;constructor(a={}){Object.assign(this,a)}}el([ef({type:K.ObjectIdentifier})],gh.prototype,"policyId",void 0),el([ef({type:gf,defaultValue:new gf(ak.unclassified)})],gh.prototype,"classList",void 0),el([ef({type:gg,repeated:"set"})],gh.prototype,"securityCategories",void 0);class gi{cotets;oid;string;constructor(a={}){Object.assign(this,a)}}el([ef({type:dN})],gi.prototype,"cotets",void 0),el([ef({type:K.ObjectIdentifier})],gi.prototype,"oid",void 0),el([ef({type:K.Utf8String})],gi.prototype,"string",void 0);class gj{policyAuthority;values=[];constructor(a={}){Object.assign(this,a)}}el([ef({type:eR,implicit:!0,context:0,optional:!0})],gj.prototype,"policyAuthority",void 0),el([ef({type:gi,repeated:"sequence"})],gj.prototype,"values",void 0);class gk{targetCertificate=new f7;targetName;certDigestInfo;constructor(a={}){Object.assign(this,a)}}el([ef({type:f7})],gk.prototype,"targetCertificate",void 0),el([ef({type:ez,optional:!0})],gk.prototype,"targetName",void 0),el([ef({type:f8,optional:!0})],gk.prototype,"certDigestInfo",void 0);let gl=class{targetName;targetGroup;targetCert;constructor(a={}){Object.assign(this,a)}};el([ef({type:ez,context:0,implicit:!0})],gl.prototype,"targetName",void 0),el([ef({type:ez,context:1,implicit:!0})],gl.prototype,"targetGroup",void 0),el([ef({type:gk,context:2,implicit:!0})],gl.prototype,"targetCert",void 0),gl=el([ee({type:J.Choice})],gl);let gm=al=class extends ej{constructor(a){super(a),Object.setPrototypeOf(this,al.prototype)}};gm=al=el([ee({type:J.Sequence,itemType:gl})],gm);let gn=am=class extends ej{constructor(a){super(a),Object.setPrototypeOf(this,am.prototype)}};gn=am=el([ee({type:J.Sequence,itemType:gm})],gn);class go{roleAuthority;roleName;constructor(a={}){Object.assign(this,a)}}el([ef({type:eR,implicit:!0,context:0,optional:!0})],go.prototype,"roleAuthority",void 0),el([ef({type:ez,implicit:!0,context:1})],go.prototype,"roleName",void 0);class gp{service=new ez;ident=new ez;authInfo;constructor(a={}){Object.assign(this,a)}}el([ef({type:ez})],gp.prototype,"service",void 0),el([ef({type:ez})],gp.prototype,"ident",void 0),el([ef({type:dN,optional:!0})],gp.prototype,"authInfo",void 0);class gq{otherCertFormat="";otherCert=new ArrayBuffer(0);constructor(a={}){Object.assign(this,a)}}el([ef({type:K.ObjectIdentifier})],gq.prototype,"otherCertFormat",void 0),el([ef({type:K.Any})],gq.prototype,"otherCert",void 0);let gr=class{certificate;v2AttrCert;other;constructor(a={}){Object.assign(this,a)}};el([ef({type:fM})],gr.prototype,"certificate",void 0),el([ef({type:ge,context:2,implicit:!0})],gr.prototype,"v2AttrCert",void 0),el([ef({type:gq,context:3,implicit:!0})],gr.prototype,"other",void 0),gr=el([ee({type:J.Choice})],gr);let gs=an=class extends ej{constructor(a){super(a),Object.setPrototypeOf(this,an.prototype)}};gs=an=el([ee({type:J.Set,itemType:gr})],gs);class gt{contentType="";content=new ArrayBuffer(0);constructor(a={}){Object.assign(this,a)}}el([ef({type:K.ObjectIdentifier})],gt.prototype,"contentType",void 0),el([ef({type:K.Any,context:0})],gt.prototype,"content",void 0);let gu=class{single;any;constructor(a={}){Object.assign(this,a)}};el([ef({type:dN})],gu.prototype,"single",void 0),el([ef({type:K.Any})],gu.prototype,"any",void 0),gu=el([ee({type:J.Choice})],gu);class gv{eContentType="";eContent;constructor(a={}){Object.assign(this,a)}}el([ef({type:K.ObjectIdentifier})],gv.prototype,"eContentType",void 0),el([ef({type:gu,context:0,optional:!0})],gv.prototype,"eContent",void 0);let gw=class{value;constructedValue;constructor(a={}){Object.assign(this,a)}};el([ef({type:dN,context:0,implicit:!0,optional:!0})],gw.prototype,"value",void 0),el([ef({type:dN,converter:{fromASN:a=>new dN(a.getValue()),toASN:a=>a.toASN()},context:0,implicit:!0,optional:!0,repeated:"sequence"})],gw.prototype,"constructedValue",void 0),gw=el([ee({type:J.Choice})],gw);class gx{contentType="";contentEncryptionAlgorithm=new fY;encryptedContent;constructor(a={}){Object.assign(this,a)}}el([ef({type:K.ObjectIdentifier})],gx.prototype,"contentType",void 0),el([ef({type:fY})],gx.prototype,"contentEncryptionAlgorithm",void 0),el([ef({type:gw,optional:!0})],gx.prototype,"encryptedContent",void 0);class gy{keyAttrId="";keyAttr;constructor(a={}){Object.assign(this,a)}}el([ef({type:K.ObjectIdentifier})],gy.prototype,"keyAttrId",void 0),el([ef({type:K.Any,optional:!0})],gy.prototype,"keyAttr",void 0);class gz{subjectKeyIdentifier=new fA;date;other;constructor(a={}){Object.assign(this,a)}}el([ef({type:fA})],gz.prototype,"subjectKeyIdentifier",void 0),el([ef({type:K.GeneralizedTime,optional:!0})],gz.prototype,"date",void 0),el([ef({type:gy,optional:!0})],gz.prototype,"other",void 0);let gA=class{rKeyId;issuerAndSerialNumber;constructor(a={}){Object.assign(this,a)}};el([ef({type:gz,context:0,implicit:!0,optional:!0})],gA.prototype,"rKeyId",void 0),el([ef({type:fT,optional:!0})],gA.prototype,"issuerAndSerialNumber",void 0),gA=el([ee({type:J.Choice})],gA);class gB{rid=new gA;encryptedKey=new dN;constructor(a={}){Object.assign(this,a)}}el([ef({type:gA})],gB.prototype,"rid",void 0),el([ef({type:dN})],gB.prototype,"encryptedKey",void 0);let gC=ao=class extends ej{constructor(a){super(a),Object.setPrototypeOf(this,ao.prototype)}};gC=ao=el([ee({type:J.Sequence,itemType:gB})],gC);class gD{algorithm=new fF;publicKey=new ArrayBuffer(0);constructor(a={}){Object.assign(this,a)}}el([ef({type:fF})],gD.prototype,"algorithm",void 0),el([ef({type:K.BitString})],gD.prototype,"publicKey",void 0);let gE=class{subjectKeyIdentifier;originatorKey;issuerAndSerialNumber;constructor(a={}){Object.assign(this,a)}};el([ef({type:fA,context:0,implicit:!0,optional:!0})],gE.prototype,"subjectKeyIdentifier",void 0),el([ef({type:gD,context:1,implicit:!0,optional:!0})],gE.prototype,"originatorKey",void 0),el([ef({type:fT,optional:!0})],gE.prototype,"issuerAndSerialNumber",void 0),gE=el([ee({type:J.Choice})],gE);class gF{version=af.v3;originator=new gE;ukm;keyEncryptionAlgorithm=new fX;recipientEncryptedKeys=new gC;constructor(a={}){Object.assign(this,a)}}el([ef({type:K.Integer})],gF.prototype,"version",void 0),el([ef({type:gE,context:0})],gF.prototype,"originator",void 0),el([ef({type:dN,context:1,optional:!0})],gF.prototype,"ukm",void 0),el([ef({type:fX})],gF.prototype,"keyEncryptionAlgorithm",void 0),el([ef({type:gC})],gF.prototype,"recipientEncryptedKeys",void 0);let gG=class{subjectKeyIdentifier;issuerAndSerialNumber;constructor(a={}){Object.assign(this,a)}};el([ef({type:fA,context:0,implicit:!0})],gG.prototype,"subjectKeyIdentifier",void 0),el([ef({type:fT})],gG.prototype,"issuerAndSerialNumber",void 0),gG=el([ee({type:J.Choice})],gG);class gH{version=af.v0;rid=new gG;keyEncryptionAlgorithm=new fX;encryptedKey=new dN;constructor(a={}){Object.assign(this,a)}}el([ef({type:K.Integer})],gH.prototype,"version",void 0),el([ef({type:gG})],gH.prototype,"rid",void 0),el([ef({type:fX})],gH.prototype,"keyEncryptionAlgorithm",void 0),el([ef({type:dN})],gH.prototype,"encryptedKey",void 0);class gI{keyIdentifier=new dN;date;other;constructor(a={}){Object.assign(this,a)}}el([ef({type:dN})],gI.prototype,"keyIdentifier",void 0),el([ef({type:K.GeneralizedTime,optional:!0})],gI.prototype,"date",void 0),el([ef({type:gy,optional:!0})],gI.prototype,"other",void 0);class gJ{version=af.v4;kekid=new gI;keyEncryptionAlgorithm=new fX;encryptedKey=new dN;constructor(a={}){Object.assign(this,a)}}el([ef({type:K.Integer})],gJ.prototype,"version",void 0),el([ef({type:gI})],gJ.prototype,"kekid",void 0),el([ef({type:fX})],gJ.prototype,"keyEncryptionAlgorithm",void 0),el([ef({type:dN})],gJ.prototype,"encryptedKey",void 0);class gK{version=af.v0;keyDerivationAlgorithm;keyEncryptionAlgorithm=new fX;encryptedKey=new dN;constructor(a={}){Object.assign(this,a)}}el([ef({type:K.Integer})],gK.prototype,"version",void 0),el([ef({type:f$,context:0,optional:!0})],gK.prototype,"keyDerivationAlgorithm",void 0),el([ef({type:fX})],gK.prototype,"keyEncryptionAlgorithm",void 0),el([ef({type:dN})],gK.prototype,"encryptedKey",void 0);class gL{oriType="";oriValue=new ArrayBuffer(0);constructor(a={}){Object.assign(this,a)}}el([ef({type:K.ObjectIdentifier})],gL.prototype,"oriType",void 0),el([ef({type:K.Any})],gL.prototype,"oriValue",void 0);let gM=class{ktri;kari;kekri;pwri;ori;constructor(a={}){Object.assign(this,a)}};el([ef({type:gH,optional:!0})],gM.prototype,"ktri",void 0),el([ef({type:gF,context:1,implicit:!0,optional:!0})],gM.prototype,"kari",void 0),el([ef({type:gJ,context:2,implicit:!0,optional:!0})],gM.prototype,"kekri",void 0),el([ef({type:gK,context:3,implicit:!0,optional:!0})],gM.prototype,"pwri",void 0),el([ef({type:gL,context:4,implicit:!0,optional:!0})],gM.prototype,"ori",void 0),gM=el([ee({type:J.Choice})],gM);let gN=ap=class extends ej{constructor(a){super(a),Object.setPrototypeOf(this,ap.prototype)}};gN=ap=el([ee({type:J.Set,itemType:gM})],gN);class gO{otherRevInfoFormat="";otherRevInfo=new ArrayBuffer(0);constructor(a={}){Object.assign(this,a)}}el([ef({type:K.ObjectIdentifier})],gO.prototype,"otherRevInfoFormat",void 0),el([ef({type:K.Any})],gO.prototype,"otherRevInfo",void 0);let gP=class{other=new gO;constructor(a={}){Object.assign(this,a)}};el([ef({type:gO,context:1,implicit:!0})],gP.prototype,"other",void 0),gP=el([ee({type:J.Choice})],gP);let gQ=aq=class extends ej{constructor(a){super(a),Object.setPrototypeOf(this,aq.prototype)}};gQ=aq=el([ee({type:J.Set,itemType:gP})],gQ);class gR{certs;crls;constructor(a={}){Object.assign(this,a)}}el([ef({type:gs,context:0,implicit:!0,optional:!0})],gR.prototype,"certs",void 0),el([ef({type:gQ,context:1,implicit:!0,optional:!0})],gR.prototype,"crls",void 0);let gS=ar=class extends ej{constructor(a){super(a),Object.setPrototypeOf(this,ar.prototype)}};gS=ar=el([ee({type:J.Set,itemType:f_})],gS);class gT{version=af.v0;originatorInfo;recipientInfos=new gN;encryptedContentInfo=new gx;unprotectedAttrs;constructor(a={}){Object.assign(this,a)}}el([ef({type:K.Integer})],gT.prototype,"version",void 0),el([ef({type:gR,context:0,implicit:!0,optional:!0})],gT.prototype,"originatorInfo",void 0),el([ef({type:gN})],gT.prototype,"recipientInfos",void 0),el([ef({type:gx})],gT.prototype,"encryptedContentInfo",void 0),el([ef({type:gS,context:1,implicit:!0,optional:!0})],gT.prototype,"unprotectedAttrs",void 0);let gU="1.2.840.113549.1.7.2",gV=as=class extends ej{constructor(a){super(a),Object.setPrototypeOf(this,as.prototype)}};gV=as=el([ee({type:J.Set,itemType:fV})],gV);class gW{version=af.v0;digestAlgorithms=new gV;encapContentInfo=new gv;certificates;crls;signerInfos=new f1;constructor(a={}){Object.assign(this,a)}}el([ef({type:K.Integer})],gW.prototype,"version",void 0),el([ef({type:gV})],gW.prototype,"digestAlgorithms",void 0),el([ef({type:gv})],gW.prototype,"encapContentInfo",void 0),el([ef({type:gs,context:0,implicit:!0,optional:!0})],gW.prototype,"certificates",void 0),el([ef({type:gQ,context:1,implicit:!0,optional:!0})],gW.prototype,"crls",void 0),el([ef({type:f1})],gW.prototype,"signerInfos",void 0);let gX="1.2.840.10045.2.1",gY="1.2.840.10045.4.1",gZ="1.2.840.10045.4.3.1",g$="1.2.840.10045.4.3.2",g_="1.2.840.10045.4.3.3",g0="1.2.840.10045.4.3.4",g1="1.2.840.10045.3.1.7",g2="1.3.132.0.34",g3="1.3.132.0.35";function g4(a){return new fF({algorithm:a})}let g5=g4(gY);g4(gZ);let g6=g4(g$),g7=g4(g_),g8=g4(g0),g9=class{fieldType;parameters;constructor(a={}){Object.assign(this,a)}};el([ef({type:K.ObjectIdentifier})],g9.prototype,"fieldType",void 0),el([ef({type:K.Any})],g9.prototype,"parameters",void 0),g9=el([ee({type:J.Sequence})],g9);class ha extends dN{}let hb=class{a;b;seed;constructor(a={}){Object.assign(this,a)}};el([ef({type:K.OctetString})],hb.prototype,"a",void 0),el([ef({type:K.OctetString})],hb.prototype,"b",void 0),el([ef({type:K.BitString,optional:!0})],hb.prototype,"seed",void 0),hb=el([ee({type:J.Sequence})],hb),(t=at||(at={}))[t.ecpVer1=1]="ecpVer1";let hc=class{version=at.ecpVer1;fieldID;curve;base;order;cofactor;constructor(a={}){Object.assign(this,a)}};el([ef({type:K.Integer})],hc.prototype,"version",void 0),el([ef({type:g9})],hc.prototype,"fieldID",void 0),el([ef({type:hb})],hc.prototype,"curve",void 0),el([ef({type:ha})],hc.prototype,"base",void 0),el([ef({type:K.Integer,converter:dR})],hc.prototype,"order",void 0),el([ef({type:K.Integer,optional:!0})],hc.prototype,"cofactor",void 0),hc=el([ee({type:J.Sequence})],hc);let hd=class{namedCurve;implicitCurve;specifiedCurve;constructor(a={}){Object.assign(this,a)}};el([ef({type:K.ObjectIdentifier})],hd.prototype,"namedCurve",void 0),el([ef({type:K.Null})],hd.prototype,"implicitCurve",void 0),el([ef({type:hc})],hd.prototype,"specifiedCurve",void 0),hd=el([ee({type:J.Choice})],hd);class he{version=1;privateKey=new dN;parameters;publicKey;constructor(a={}){Object.assign(this,a)}}el([ef({type:K.Integer})],he.prototype,"version",void 0),el([ef({type:dN})],he.prototype,"privateKey",void 0),el([ef({type:hd,context:0,optional:!0})],he.prototype,"parameters",void 0),el([ef({type:K.BitString,context:1,optional:!0})],he.prototype,"publicKey",void 0);class hf{r=new ArrayBuffer(0);s=new ArrayBuffer(0);constructor(a={}){Object.assign(this,a)}}el([ef({type:K.Integer,converter:dR})],hf.prototype,"r",void 0),el([ef({type:K.Integer,converter:dR})],hf.prototype,"s",void 0);let hg="1.2.840.113549.1.1",hh=`${hg}.1`,hi=`${hg}.7`,hj=`${hg}.9`,hk=`${hg}.10`,hl=`${hg}.2`,hm=`${hg}.4`,hn=`${hg}.5`,ho=`${hg}.14`,hp=`${hg}.11`,hq=`${hg}.12`,hr=`${hg}.13`,hs=`${hg}.15`,ht=`${hg}.16`,hu="1.3.14.3.2.26",hv="2.16.840.1.101.3.4.2.4",hw="2.16.840.1.101.3.4.2.1",hx="2.16.840.1.101.3.4.2.2",hy="2.16.840.1.101.3.4.2.3",hz=`${hg}.8`;function hA(a){return new fF({algorithm:a,parameters:null})}hA("1.2.840.113549.2.2"),hA("1.2.840.113549.2.5");let hB=hA(hu);hA(hv),hA(hw),hA(hx),hA(hy),hA("2.16.840.1.101.3.4.2.5"),hA("2.16.840.1.101.3.4.2.6");let hC=new fF({algorithm:hz,parameters:ek.serialize(hB)}),hD=new fF({algorithm:hj,parameters:ek.serialize(dV.toASN(new Uint8Array([218,57,163,238,94,107,75,13,50,85,191,239,149,96,24,144,175,216,7,9]).buffer))});hA(hh),hA(hl),hA(hm),hA(hn),hA(hs),hA(ht),hA(hq),hA(hr),hA(hs),hA(ht);class hE{hashAlgorithm=new fF(hB);maskGenAlgorithm=new fF({algorithm:hz,parameters:ek.serialize(hB)});pSourceAlgorithm=new fF(hD);constructor(a={}){Object.assign(this,a)}}el([ef({type:fF,context:0,defaultValue:hB})],hE.prototype,"hashAlgorithm",void 0),el([ef({type:fF,context:1,defaultValue:hC})],hE.prototype,"maskGenAlgorithm",void 0),el([ef({type:fF,context:2,defaultValue:hD})],hE.prototype,"pSourceAlgorithm",void 0),new fF({algorithm:hi,parameters:ek.serialize(new hE)});class hF{hashAlgorithm=new fF(hB);maskGenAlgorithm=new fF({algorithm:hz,parameters:ek.serialize(hB)});saltLength=20;trailerField=1;constructor(a={}){Object.assign(this,a)}}el([ef({type:fF,context:0,defaultValue:hB})],hF.prototype,"hashAlgorithm",void 0),el([ef({type:fF,context:1,defaultValue:hC})],hF.prototype,"maskGenAlgorithm",void 0),el([ef({type:K.Integer,context:2,defaultValue:20})],hF.prototype,"saltLength",void 0),el([ef({type:K.Integer,context:3,defaultValue:1})],hF.prototype,"trailerField",void 0),new fF({algorithm:hk,parameters:ek.serialize(new hF)});class hG{digestAlgorithm=new fF;digest=new dN;constructor(a={}){Object.assign(this,a)}}el([ef({type:fF})],hG.prototype,"digestAlgorithm",void 0),el([ef({type:dN})],hG.prototype,"digest",void 0);class hH{prime=new ArrayBuffer(0);exponent=new ArrayBuffer(0);coefficient=new ArrayBuffer(0);constructor(a={}){Object.assign(this,a)}}el([ef({type:K.Integer,converter:dR})],hH.prototype,"prime",void 0),el([ef({type:K.Integer,converter:dR})],hH.prototype,"exponent",void 0),el([ef({type:K.Integer,converter:dR})],hH.prototype,"coefficient",void 0);let hI=au=class extends ej{constructor(a){super(a),Object.setPrototypeOf(this,au.prototype)}};hI=au=el([ee({type:J.Sequence,itemType:hH})],hI);class hJ{version=0;modulus=new ArrayBuffer(0);publicExponent=new ArrayBuffer(0);privateExponent=new ArrayBuffer(0);prime1=new ArrayBuffer(0);prime2=new ArrayBuffer(0);exponent1=new ArrayBuffer(0);exponent2=new ArrayBuffer(0);coefficient=new ArrayBuffer(0);otherPrimeInfos;constructor(a={}){Object.assign(this,a)}}el([ef({type:K.Integer})],hJ.prototype,"version",void 0),el([ef({type:K.Integer,converter:dR})],hJ.prototype,"modulus",void 0),el([ef({type:K.Integer,converter:dR})],hJ.prototype,"publicExponent",void 0),el([ef({type:K.Integer,converter:dR})],hJ.prototype,"privateExponent",void 0),el([ef({type:K.Integer,converter:dR})],hJ.prototype,"prime1",void 0),el([ef({type:K.Integer,converter:dR})],hJ.prototype,"prime2",void 0),el([ef({type:K.Integer,converter:dR})],hJ.prototype,"exponent1",void 0),el([ef({type:K.Integer,converter:dR})],hJ.prototype,"exponent2",void 0),el([ef({type:K.Integer,converter:dR})],hJ.prototype,"coefficient",void 0),el([ef({type:hI,optional:!0})],hJ.prototype,"otherPrimeInfos",void 0);class hK{modulus=new ArrayBuffer(0);publicExponent=new ArrayBuffer(0);constructor(a={}){Object.assign(this,a)}}el([ef({type:K.Integer,converter:dR})],hK.prototype,"modulus",void 0),el([ef({type:K.Integer,converter:dR})],hK.prototype,"publicExponent",void 0),(u=av||(av={}))[u.Transient=0]="Transient",u[u.Singleton=1]="Singleton",u[u.ResolutionScoped=2]="ResolutionScoped",u[u.ContainerScoped=3]="ContainerScoped";let hL=av;var hM=function(a,b){return(hM=Object.setPrototypeOf||({__proto__:[]})instanceof Array&&function(a,b){a.__proto__=b}||function(a,b){for(var c in b)b.hasOwnProperty(c)&&(a[c]=b[c])})(a,b)};function hN(a,b){function c(){this.constructor=a}hM(a,b),a.prototype=null===b?Object.create(b):(c.prototype=b.prototype,new c)}function hO(a){var b="function"==typeof Symbol&&Symbol.iterator,c=b&&a[b],d=0;if(c)return c.call(a);if(a&&"number"==typeof a.length)return{next:function(){return a&&d>=a.length&&(a=void 0),{value:a&&a[d++],done:!a}}};throw TypeError(b?"Object is not iterable.":"Symbol.iterator is not defined.")}function hP(a,b){var c="function"==typeof Symbol&&a[Symbol.iterator];if(!c)return a;var d,e,f=c.call(a),g=[];try{for(;(void 0===b||b-- >0)&&!(d=f.next()).done;)g.push(d.value)}catch(a){e={error:a}}finally{try{d&&!d.done&&(c=f.return)&&c.call(f)}finally{if(e)throw e.error}}return g}function hQ(){for(var a=[],b=0;b<arguments.length;b++)a=a.concat(hP(arguments[b]));return a}function hR(a){return!!a.useClass}function hS(a){return!!a.useFactory}var hT=function(){function a(a){this.wrap=a,this.reflectMethods=["get","getPrototypeOf","setPrototypeOf","getOwnPropertyDescriptor","defineProperty","has","set","deleteProperty","apply","construct","ownKeys"]}return a.prototype.createProxy=function(a){var b,c=this,d=!1;return new Proxy({},this.createHandler(function(){return d||(b=a(c.wrap()),d=!0),b}))},a.prototype.createHandler=function(a){var b={};return this.reflectMethods.forEach(function(c){b[c]=function(){for(var b=[],d=0;d<arguments.length;d++)b[d]=arguments[d];return b[0]=a(),Reflect[c].apply(void 0,hQ(b))}}),b},a}();function hU(a){return"string"==typeof a||"symbol"==typeof a}function hV(a){return"object"==typeof a&&"token"in a&&"transform"in a}function hW(a){return!!a.useToken}function hX(a){return void 0!=a.useValue}var hY=function(){function a(){this._registryMap=new Map}return a.prototype.entries=function(){return this._registryMap.entries()},a.prototype.getAll=function(a){return this.ensure(a),this._registryMap.get(a)},a.prototype.get=function(a){this.ensure(a);var b=this._registryMap.get(a);return b[b.length-1]||null},a.prototype.set=function(a,b){this.ensure(a),this._registryMap.get(a).push(b)},a.prototype.setAll=function(a,b){this._registryMap.set(a,b)},a.prototype.has=function(a){return this.ensure(a),this._registryMap.get(a).length>0},a.prototype.clear=function(){this._registryMap.clear()},a.prototype.ensure=function(a){this._registryMap.has(a)||this._registryMap.set(a,[])},a}(),hZ=function(a){function b(){return null!==a&&a.apply(this,arguments)||this}return hN(b,a),b}(hY);let h$=function(){this.scopedResolutions=new Map};var h_=function(a){function b(){return null!==a&&a.apply(this,arguments)||this}return hN(b,a),b}(hY),h0=function(a){function b(){return null!==a&&a.apply(this,arguments)||this}return hN(b,a),b}(hY);let h1=function(){this.preResolution=new h_,this.postResolution=new h0};var h2=new Map,h3=new(function(){function a(a){this.parent=a,this._registry=new hZ,this.interceptors=new h1,this.disposed=!1,this.disposables=new Set}return a.prototype.register=function(a,b,c){if(void 0===c&&(c={lifecycle:hL.Transient}),this.ensureNotDisposed(),d=hR(b)||hX(b)||hW(b)||hS(b)?b:{useClass:b},hW(d))for(var d,e=[a],f=d;null!=f;){var g=f.useToken;if(e.includes(g))throw Error("Token registration cycle detected! "+hQ(e,[g]).join(" -> "));e.push(g);var h=this._registry.get(g);f=h&&hW(h.provider)?h.provider:null}if((c.lifecycle===hL.Singleton||c.lifecycle==hL.ContainerScoped||c.lifecycle==hL.ResolutionScoped)&&(hX(d)||hS(d)))throw Error('Cannot use lifecycle "'+hL[c.lifecycle]+'" with ValueProviders or FactoryProviders');return this._registry.set(a,{provider:d,options:c}),this},a.prototype.registerType=function(a,b){return(this.ensureNotDisposed(),hU(b))?this.register(a,{useToken:b}):this.register(a,{useClass:b})},a.prototype.registerInstance=function(a,b){return this.ensureNotDisposed(),this.register(a,{useValue:b})},a.prototype.registerSingleton=function(a,b){if(this.ensureNotDisposed(),hU(a)){if(hU(b))return this.register(a,{useToken:b},{lifecycle:hL.Singleton});if(b)return this.register(a,{useClass:b},{lifecycle:hL.Singleton});throw Error('Cannot register a type name as a singleton without a "to" token')}var c=a;return b&&!hU(b)&&(c=b),this.register(a,{useClass:c},{lifecycle:hL.Singleton})},a.prototype.resolve=function(a,b,c){void 0===b&&(b=new h$),void 0===c&&(c=!1),this.ensureNotDisposed();var d=this.getRegistration(a);if(!d&&hU(a)){if(c)return;throw Error('Attempted to resolve unregistered dependency token: "'+a.toString()+'"')}if(this.executePreResolutionInterceptor(a,"Single"),d){var e=this.resolveRegistration(d,b);return this.executePostResolutionInterceptor(a,e,"Single"),e}if("function"==typeof a||a instanceof hT){var e=this.construct(a,b);return this.executePostResolutionInterceptor(a,e,"Single"),e}throw Error("Attempted to construct an undefined constructor. Could mean a circular dependency problem. Try using `delay` function.")},a.prototype.executePreResolutionInterceptor=function(a,b){var c,d;if(this.interceptors.preResolution.has(a)){var e=[];try{for(var f=hO(this.interceptors.preResolution.getAll(a)),g=f.next();!g.done;g=f.next()){var h=g.value;"Once"!=h.options.frequency&&e.push(h),h.callback(a,b)}}catch(a){c={error:a}}finally{try{g&&!g.done&&(d=f.return)&&d.call(f)}finally{if(c)throw c.error}}this.interceptors.preResolution.setAll(a,e)}},a.prototype.executePostResolutionInterceptor=function(a,b,c){var d,e;if(this.interceptors.postResolution.has(a)){var f=[];try{for(var g=hO(this.interceptors.postResolution.getAll(a)),h=g.next();!h.done;h=g.next()){var i=h.value;"Once"!=i.options.frequency&&f.push(i),i.callback(a,b,c)}}catch(a){d={error:a}}finally{try{h&&!h.done&&(e=g.return)&&e.call(g)}finally{if(d)throw d.error}}this.interceptors.postResolution.setAll(a,f)}},a.prototype.resolveRegistration=function(a,b){if(this.ensureNotDisposed(),a.options.lifecycle===hL.ResolutionScoped&&b.scopedResolutions.has(a))return b.scopedResolutions.get(a);var c,d=a.options.lifecycle===hL.Singleton,e=a.options.lifecycle===hL.ContainerScoped,f=d||e;return c=hX(a.provider)?a.provider.useValue:hW(a.provider)?f?a.instance||(a.instance=this.resolve(a.provider.useToken,b)):this.resolve(a.provider.useToken,b):hR(a.provider)?f?a.instance||(a.instance=this.construct(a.provider.useClass,b)):this.construct(a.provider.useClass,b):hS(a.provider)?a.provider.useFactory(this):this.construct(a.provider,b),a.options.lifecycle===hL.ResolutionScoped&&b.scopedResolutions.set(a,c),c},a.prototype.resolveAll=function(a,b,c){var d=this;void 0===b&&(b=new h$),void 0===c&&(c=!1),this.ensureNotDisposed();var e=this.getAllRegistrations(a);if(!e&&hU(a)){if(c)return[];throw Error('Attempted to resolve unregistered dependency token: "'+a.toString()+'"')}if(this.executePreResolutionInterceptor(a,"All"),e){var f=e.map(function(a){return d.resolveRegistration(a,b)});return this.executePostResolutionInterceptor(a,f,"All"),f}var g=[this.construct(a,b)];return this.executePostResolutionInterceptor(a,g,"All"),g},a.prototype.isRegistered=function(a,b){return void 0===b&&(b=!1),this.ensureNotDisposed(),this._registry.has(a)||b&&(this.parent||!1)&&this.parent.isRegistered(a,!0)},a.prototype.reset=function(){this.ensureNotDisposed(),this._registry.clear(),this.interceptors.preResolution.clear(),this.interceptors.postResolution.clear()},a.prototype.clearInstances=function(){var a,b;this.ensureNotDisposed();try{for(var c=hO(this._registry.entries()),d=c.next();!d.done;d=c.next()){var e=hP(d.value,2),f=e[0],g=e[1];this._registry.setAll(f,g.filter(function(a){return!hX(a.provider)}).map(function(a){return a.instance=void 0,a}))}}catch(b){a={error:b}}finally{try{d&&!d.done&&(b=c.return)&&b.call(c)}finally{if(a)throw a.error}}},a.prototype.createChildContainer=function(){this.ensureNotDisposed();var b,c,d=new a(this);try{for(var e=hO(this._registry.entries()),f=e.next();!f.done;f=e.next()){var g=hP(f.value,2),h=g[0],i=g[1];i.some(function(a){return a.options.lifecycle===hL.ContainerScoped})&&d._registry.setAll(h,i.map(function(a){return a.options.lifecycle===hL.ContainerScoped?{provider:a.provider,options:a.options}:a}))}}catch(a){b={error:a}}finally{try{f&&!f.done&&(c=e.return)&&c.call(e)}finally{if(b)throw b.error}}return d},a.prototype.beforeResolution=function(a,b,c){void 0===c&&(c={frequency:"Always"}),this.interceptors.preResolution.set(a,{callback:b,options:c})},a.prototype.afterResolution=function(a,b,c){void 0===c&&(c={frequency:"Always"}),this.interceptors.postResolution.set(a,{callback:b,options:c})},a.prototype.dispose=function(){var a,b,c,d;return a=this,b=void 0,c=void 0,d=function(){var a;return function(a,b){var c,d,e,f,g={label:0,sent:function(){if(1&e[0])throw e[1];return e[1]},trys:[],ops:[]};return f={next:h(0),throw:h(1),return:h(2)},"function"==typeof Symbol&&(f[Symbol.iterator]=function(){return this}),f;function h(f){return function(h){var i=[f,h];if(c)throw TypeError("Generator is already executing.");for(;g;)try{if(c=1,d&&(e=2&i[0]?d.return:i[0]?d.throw||((e=d.return)&&e.call(d),0):d.next)&&!(e=e.call(d,i[1])).done)return e;switch(d=0,e&&(i=[2&i[0],e.value]),i[0]){case 0:case 1:e=i;break;case 4:return g.label++,{value:i[1],done:!1};case 5:g.label++,d=i[1],i=[0];continue;case 7:i=g.ops.pop(),g.trys.pop();continue;default:if(!(e=(e=g.trys).length>0&&e[e.length-1])&&(6===i[0]||2===i[0])){g=0;continue}if(3===i[0]&&(!e||i[1]>e[0]&&i[1]<e[3])){g.label=i[1];break}if(6===i[0]&&g.label<e[1]){g.label=e[1],e=i;break}if(e&&g.label<e[2]){g.label=e[2],g.ops.push(i);break}e[2]&&g.ops.pop(),g.trys.pop();continue}i=b.call(a,g)}catch(a){i=[6,a],d=0}finally{c=e=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}}}(this,function(b){switch(b.label){case 0:return this.disposed=!0,a=[],this.disposables.forEach(function(b){var c=b.dispose();c&&a.push(c)}),[4,Promise.all(a)];case 1:return b.sent(),[2]}})},new(c||(c=Promise))(function(e,f){function g(a){try{i(d.next(a))}catch(a){f(a)}}function h(a){try{i(d.throw(a))}catch(a){f(a)}}function i(a){var b;a.done?e(a.value):((b=a.value)instanceof c?b:new c(function(a){a(b)})).then(g,h)}i((d=d.apply(a,b||[])).next())})},a.prototype.getRegistration=function(a){return this.isRegistered(a)?this._registry.get(a):this.parent?this.parent.getRegistration(a):null},a.prototype.getAllRegistrations=function(a){return this.isRegistered(a)?this._registry.getAll(a):this.parent?this.parent.getAllRegistrations(a):null},a.prototype.construct=function(a,b){var c=this;if(a instanceof hT)return a.createProxy(function(a){return c.resolve(a,b)});var d=function(){var d=h2.get(a);if(!d||0===d.length)if(0===a.length)return new a;else throw Error('TypeInfo not known for "'+a.name+'"');var e=d.map(c.resolveParams(b,a));return new(a.bind.apply(a,hQ([void 0],e)))}();return"function"!=typeof d.dispose||d.dispose.length>0||this.disposables.add(d),d},a.prototype.resolveParams=function(a,b){var c=this;return function(d,e){var f,g,h,i,j,k,l;try{if("object"==typeof d&&"token"in d&&"multiple"in d)if(hV(d))return d.multiple?(f=c.resolve(d.transform)).transform.apply(f,hQ([c.resolveAll(d.token,new h$,d.isOptional)],d.transformArgs)):(g=c.resolve(d.transform)).transform.apply(g,hQ([c.resolve(d.token,a,d.isOptional)],d.transformArgs));else return d.multiple?c.resolveAll(d.token,new h$,d.isOptional):c.resolve(d.token,a,d.isOptional);if(hV(d))return(h=c.resolve(d.transform,a)).transform.apply(h,hQ([c.resolve(d.token,a)],d.transformArgs));return c.resolve(d,a)}catch(a){throw Error((k="Cannot inject the dependency "+(j=void 0===(i=hP(b.toString().match(/constructor\(([\w, ]+)\)/)||[],2)[1])?null:i,null===j?"at position #"+e:'"'+j.split(",")[e].trim()+'" at position #'+e)+' of "'+b.name+'" constructor. Reason:',void 0===l&&(l=" "),hQ([k],a.message.split("\n").map(function(a){return l+a})).join("\n")))}}},a.prototype.ensureNotDisposed=function(){if(this.disposed)throw Error("This container has been disposed, you cannot interact with a disposed container")},a}());let h4=function(a){return function(b){var c,d;h2.set(b,(c=Reflect.getMetadata("design:paramtypes",b)||[],Object.keys(d=Reflect.getOwnMetadata("injectionTokens",b)||{}).forEach(function(a){c[+a]=d[a]}),c)),a&&a.token&&(Array.isArray(a.token)?a.token.forEach(function(a){h3.register(a,b)}):h3.register(a.token,b))}};if("u"<typeof Reflect||!Reflect.getMetadata)throw Error("tsyringe requires a reflect polyfill. Please add 'import \"reflect-metadata\"' to the top of your entry point.");class h5{attrId="";attrValues=[];constructor(a={}){Object.assign(a)}}el([ef({type:K.ObjectIdentifier})],h5.prototype,"attrId",void 0),el([ef({type:K.Any,repeated:"set"})],h5.prototype,"attrValues",void 0);let h6=aw=class extends ej{constructor(a){super(a),Object.setPrototypeOf(this,aw.prototype)}};h6=aw=el([ee({type:J.Sequence,itemType:h5})],h6);let h7=ax=class extends ej{constructor(a){super(a),Object.setPrototypeOf(this,ax.prototype)}};h7=ax=el([ee({type:J.Sequence,itemType:gt})],h7);class h8{certId="";certValue=new ArrayBuffer(0);constructor(a={}){Object.assign(this,a)}}el([ef({type:K.ObjectIdentifier})],h8.prototype,"certId",void 0),el([ef({type:K.Any,context:0})],h8.prototype,"certValue",void 0);class h9{crlId="";crltValue=new ArrayBuffer(0);constructor(a={}){Object.assign(this,a)}}el([ef({type:K.ObjectIdentifier})],h9.prototype,"crlId",void 0),el([ef({type:K.Any,context:0})],h9.prototype,"crltValue",void 0);class ia extends dN{}class ib{encryptionAlgorithm=new fF;encryptedData=new ia;constructor(a={}){Object.assign(this,a)}}el([ef({type:fF})],ib.prototype,"encryptionAlgorithm",void 0),el([ef({type:ia})],ib.prototype,"encryptedData",void 0),(v=az||(az={}))[v.v1=0]="v1";class ic extends dN{}let id=ay=class extends ej{constructor(a){super(a),Object.setPrototypeOf(this,ay.prototype)}};id=ay=el([ee({type:J.Sequence,itemType:fx})],id);class ie{version=az.v1;privateKeyAlgorithm=new fF;privateKey=new ic;attributes;constructor(a={}){Object.assign(this,a)}}el([ef({type:K.Integer})],ie.prototype,"version",void 0),el([ef({type:fF})],ie.prototype,"privateKeyAlgorithm",void 0),el([ef({type:ic})],ie.prototype,"privateKey",void 0),el([ef({type:id,implicit:!0,context:0,optional:!0})],ie.prototype,"attributes",void 0);let ig=class extends ie{};ig=el([ee({type:J.Sequence})],ig);let ih=class extends ib{};ih=el([ee({type:J.Sequence})],ih);class ii{secretTypeId="";secretValue=new ArrayBuffer(0);constructor(a={}){Object.assign(this,a)}}el([ef({type:K.ObjectIdentifier})],ii.prototype,"secretTypeId",void 0),el([ef({type:K.Any,context:0})],ii.prototype,"secretValue",void 0);class ij{mac=new hG;macSalt=new dN;iterations=1;constructor(a={}){Object.assign(this,a)}}el([ef({type:hG})],ij.prototype,"mac",void 0),el([ef({type:dN})],ij.prototype,"macSalt",void 0),el([ef({type:K.Integer,defaultValue:1})],ij.prototype,"iterations",void 0);class ik{version=3;authSafe=new gt;macData=new ij;constructor(a={}){Object.assign(this,a)}}el([ef({type:K.Integer})],ik.prototype,"version",void 0),el([ef({type:gt})],ik.prototype,"authSafe",void 0),el([ef({type:ij,optional:!0})],ik.prototype,"macData",void 0);class il{bagId="";bagValue=new ArrayBuffer(0);bagAttributes;constructor(a={}){Object.assign(this,a)}}el([ef({type:K.ObjectIdentifier})],il.prototype,"bagId",void 0),el([ef({type:K.Any,context:0})],il.prototype,"bagValue",void 0),el([ef({type:h5,repeated:"set",optional:!0})],il.prototype,"bagAttributes",void 0);let im=aA=class extends ej{constructor(a){super(a),Object.setPrototypeOf(this,aA.prototype)}};im=aA=el([ee({type:J.Sequence,itemType:il})],im);let io="1.2.840.113549.1.9",ip=`${io}.7`,iq=`${io}.14`,ir=class extends er{ia5String;constructor(a={}){super(a)}toString(){return({}).toString(),this.ia5String||super.toString()}};el([ef({type:K.IA5String})],ir.prototype,"ia5String",void 0),ir=el([ee({type:J.Choice})],ir);let is=class extends gt{};is=el([ee({type:J.Sequence})],is);let it=class extends ik{};it=el([ee({type:J.Sequence})],it);let iu=class extends ib{};iu=el([ee({type:J.Sequence})],iu);let iv=class{value;constructor(a=""){this.value=a}toString(){return this.value}};el([ef({type:K.IA5String})],iv.prototype,"value",void 0),iv=el([ee({type:J.Choice})],iv);let iw=class extends ir{};iw=el([ee({type:J.Choice})],iw);let ix=class extends er{};ix=el([ee({type:J.Choice})],ix);let iy=class{value;constructor(a=new Date){this.value=a}};el([ef({type:K.GeneralizedTime})],iy.prototype,"value",void 0),iy=el([ee({type:J.Choice})],iy);let iz=class extends er{};iz=el([ee({type:J.Choice})],iz);let iA=class{value;constructor(a="M"){this.value=a}toString(){return this.value}};el([ef({type:K.PrintableString})],iA.prototype,"value",void 0),iA=el([ee({type:J.Choice})],iA);let iB=class{value;constructor(a=""){this.value=a}toString(){return this.value}};el([ef({type:K.PrintableString})],iB.prototype,"value",void 0),iB=el([ee({type:J.Choice})],iB);let iC=class extends iB{};iC=el([ee({type:J.Choice})],iC);let iD=class extends er{};iD=el([ee({type:J.Choice})],iD);let iE=class{value;constructor(a=""){this.value=a}toString(){return this.value}};el([ef({type:K.ObjectIdentifier})],iE.prototype,"value",void 0),iE=el([ee({type:J.Choice})],iE);let iF=class extends fH{};iF=el([ee({type:J.Choice})],iF);let iG=class{value;constructor(a=0){this.value=a}toString(){return this.value.toString()}};el([ef({type:K.Integer})],iG.prototype,"value",void 0),iG=el([ee({type:J.Choice})],iG);let iH=class extends f0{};iH=el([ee({type:J.Sequence})],iH);let iI=class extends er{};iI=el([ee({type:J.Choice})],iI);let iJ=aB=class extends fK{constructor(a){super(a),Object.setPrototypeOf(this,aB.prototype)}};iJ=aB=el([ee({type:J.Sequence})],iJ);let iK=aC=class extends ej{constructor(a){super(a),Object.setPrototypeOf(this,aC.prototype)}};iK=aC=el([ee({type:J.Set,itemType:f_})],iK);let iL=class{value;constructor(a=""){this.value=a}toString(){return this.value}};el([ef({type:K.BmpString})],iL.prototype,"value",void 0),iL=el([ee({type:J.Choice})],iL);let iM=class extends fF{};iM=el([ee({type:J.Sequence})],iM);let iN=aD=class extends ej{constructor(a){super(a),Object.setPrototypeOf(this,aD.prototype)}};iN=aD=el([ee({type:J.Sequence,itemType:iM})],iN);let iO=aE=class extends ej{constructor(a){super(a),Object.setPrototypeOf(this,aE.prototype)}};iO=aE=el([ee({type:J.Sequence,itemType:fx})],iO);class iP{version=0;subject=new ew;subjectPKInfo=new fG;attributes=new iO;constructor(a={}){Object.assign(this,a)}}el([ef({type:K.Integer})],iP.prototype,"version",void 0),el([ef({type:ew})],iP.prototype,"subject",void 0),el([ef({type:fG})],iP.prototype,"subjectPKInfo",void 0),el([ef({type:iO,implicit:!0,context:0,optional:!0})],iP.prototype,"attributes",void 0);class iQ{certificationRequestInfo=new iP;certificationRequestInfoRaw;signatureAlgorithm=new fF;signature=new ArrayBuffer(0);constructor(a={}){Object.assign(this,a)}}el([ef({type:iP,raw:!0})],iQ.prototype,"certificationRequestInfo",void 0),el([ef({type:fF})],iQ.prototype,"signatureAlgorithm",void 0),el([ef({type:K.BitString})],iQ.prototype,"signature",void 0);let iR="crypto.algorithm";class iS{getAlgorithms(){return h3.resolveAll(iR)}toAsnAlgorithm(a){for(let b of({...a},this.getAlgorithms())){let c=b.toAsnAlgorithm(a);if(c)return c}if(/^[0-9.]+$/.test(a.name)){let b=new fF({algorithm:a.name});return"parameters"in a&&(b.parameters=a.parameters),b}throw Error("Cannot convert WebCrypto algorithm to ASN.1 algorithm")}toWebAlgorithm(a){for(let b of this.getAlgorithms()){let c=b.toWebAlgorithm(a);if(c)return c}return{name:a.algorithm,parameters:a.parameters}}}let iT="crypto.algorithmProvider";h3.registerSingleton(iT,iS);let iU="1.3.36.3.3.2.8.1.1",iV=`${iU}.1`,iW=`${iU}.2`,iX=`${iU}.3`,iY=`${iU}.4`,iZ=`${iU}.5`,i$=`${iU}.6`,i_=`${iU}.7`,i0=`${iU}.8`,i1=`${iU}.9`,i2=`${iU}.10`,i3=`${iU}.11`,i4=`${iU}.12`,i5=`${iU}.13`,i6=`${iU}.14`,i7="brainpoolP160r1",i8="brainpoolP160t1",i9="brainpoolP192r1",ja="brainpoolP192t1",jb="brainpoolP224r1",jc="brainpoolP224t1",jd="brainpoolP256r1",je="brainpoolP256t1",jf="brainpoolP320r1",jg="brainpoolP320t1",jh="brainpoolP384r1",ji="brainpoolP384t1",jj="brainpoolP512r1",jk="brainpoolP512t1",jl="ECDSA",jm=aF=class{toAsnAlgorithm(a){if(a.name.toLowerCase()===jl.toLowerCase()){if("hash"in a)switch(("string"==typeof a.hash?a.hash:a.hash.name).toLowerCase()){case"sha-1":return g5;case"sha-256":return g6;case"sha-384":return g7;case"sha-512":return g8}else if("namedCurve"in a){let b="";switch(a.namedCurve){case"P-256":b=g1;break;case"K-256":b=aF.SECP256K1;break;case"P-384":b=g2;break;case"P-521":b=g3;break;case i7:b=iV;break;case i8:b=iW;break;case i9:b=iX;break;case ja:b=iY;break;case jb:b=iZ;break;case jc:b=i$;break;case jd:b=i_;break;case je:b=i0;break;case jf:b=i1;break;case jg:b=i2;break;case jh:b=i3;break;case ji:b=i4;break;case jj:b=i5;break;case jk:b=i6}if(b)return new fF({algorithm:gX,parameters:ek.serialize(new hd({namedCurve:b}))})}}return null}toWebAlgorithm(a){switch(a.algorithm){case gY:return{name:jl,hash:{name:"SHA-1"}};case g$:return{name:jl,hash:{name:"SHA-256"}};case g_:return{name:jl,hash:{name:"SHA-384"}};case g0:return{name:jl,hash:{name:"SHA-512"}};case gX:if(!a.parameters)throw TypeError("Cannot get required parameters from EC algorithm");switch(ek.parse(a.parameters,hd).namedCurve){case g1:return{name:jl,namedCurve:"P-256"};case aF.SECP256K1:return{name:jl,namedCurve:"K-256"};case g2:return{name:jl,namedCurve:"P-384"};case g3:return{name:jl,namedCurve:"P-521"};case iV:return{name:jl,namedCurve:i7};case iW:return{name:jl,namedCurve:i8};case iX:return{name:jl,namedCurve:i9};case iY:return{name:jl,namedCurve:ja};case iZ:return{name:jl,namedCurve:jb};case i$:return{name:jl,namedCurve:jc};case i_:return{name:jl,namedCurve:jd};case i0:return{name:jl,namedCurve:je};case i1:return{name:jl,namedCurve:jf};case i2:return{name:jl,namedCurve:jg};case i3:return{name:jl,namedCurve:jh};case i4:return{name:jl,namedCurve:ji};case i5:return{name:jl,namedCurve:jj};case i6:return{name:jl,namedCurve:jk}}}return null}};jm.SECP256K1="1.3.132.0.10",jm=aF=el([h4()],jm),h3.registerSingleton(iR,jm);let jn=Symbol("name"),jo=Symbol("value");class jp{constructor(a,b={},c=""){for(const d in this[jn]=a,this[jo]=c,b)this[d]=b[d]}}jp.NAME=jn,jp.VALUE=jo;class jq{static toTextObject(a){let b=new jp("Algorithm Identifier",{},jr.toString(a.algorithm));if(a.parameters)if(a.algorithm===gX){let c=new jm().toWebAlgorithm(a);c&&"namedCurve"in c?b["Named Curve"]=c.namedCurve:b.Parameters=a.parameters}else b.Parameters=a.parameters;return b}}class jr{static toString(a){let b=this.items[a];return b||a}}jr.items={[hu]:"sha1",[hv]:"sha224",[hw]:"sha256",[hx]:"sha384",[hy]:"sha512",[hh]:"rsaEncryption",[hn]:"sha1WithRSAEncryption",[ho]:"sha224WithRSAEncryption",[hp]:"sha256WithRSAEncryption",[hq]:"sha384WithRSAEncryption",[hr]:"sha512WithRSAEncryption",[gX]:"ecPublicKey",[gY]:"ecdsaWithSHA1",[gZ]:"ecdsaWithSHA224",[g$]:"ecdsaWithSHA256",[g_]:"ecdsaWithSHA384",[g0]:"ecdsaWithSHA512",[fc]:"TLS WWW server authentication",[fd]:"TLS WWW client authentication",[fe]:"Code Signing",[ff]:"E-mail Protection",[fg]:"Time Stamping",[fh]:"OCSP Signing",[gU]:"Signed Data"};class js{static serialize(a){return this.serializeObj(a).join("\n")}static pad(a=0){return"".padStart(2*a," ")}static serializeObj(a,b=0){let c=[],d=this.pad(b++),e="",f=a[jp.VALUE];for(let g in f&&(e=` ${f}`),c.push(`${d}${a[jp.NAME]}:${e}`),d=this.pad(b),a){if("symbol"==typeof g)continue;let e=a[g],f=g?`${g}: `:"";if("string"==typeof e||"number"==typeof e||"boolean"==typeof e)c.push(`${d}${f}${e}`);else if(e instanceof Date)c.push(`${d}${f}${e.toUTCString()}`);else if(Array.isArray(e))for(let a of e)a[jp.NAME]=g,c.push(...this.serializeObj(a,b));else if(e instanceof jp)e[jp.NAME]=g,c.push(...this.serializeObj(e,b));else if(b6.isBufferSource(e))g?(c.push(`${d}${f}`),c.push(...this.serializeBufferSource(e,b+1))):c.push(...this.serializeBufferSource(e,b));else if("toTextObject"in e){let a=e.toTextObject();a[jp.NAME]=g,c.push(...this.serializeObj(a,b))}else throw TypeError("Cannot serialize data in text format. Unsupported type.")}return c}static serializeBufferSource(a,b=0){let c=this.pad(b),d=b6.toUint8Array(a),e=[];for(let a=0;a<d.length;){let b=[];for(let c=0;c<16&&a<d.length;c++){8===c&&b.push("");let e=d[a++].toString(16).padStart(2,"0");b.push(e)}e.push(`${c}${b.join(" ")}`)}return e}static serializeAlgorithm(a){return this.algorithmSerializer.toTextObject(a)}}js.oidSerializer=jr,js.algorithmSerializer=jq;class jt{get rawData(){return em(this,aG,"f")||en(this,aG,ek.serialize(this.asn),"f"),em(this,aG,"f")}constructor(...a){aG.set(this,void 0),b6.isBufferSource(a[0])?(this.asn=ek.parse(a[0],a[1]),en(this,aG,b6.toArrayBuffer(a[0]),"f")):this.asn=a[0],this.onInit(this.asn)}equal(a){return a instanceof jt&&ce(a.rawData,this.rawData)}toString(a="text"){switch(a){case"asn":return ek.toString(this.rawData);case"text":return js.serialize(this.toTextObject());case"hex":return cd.ToHex(this.rawData);case"base64":return cd.ToBase64(this.rawData);case"base64url":return cd.ToBase64Url(this.rawData);default:throw TypeError("Argument 'format' is unsupported value")}}getTextName(){return this.constructor.NAME}toTextObject(){let a=this.toTextObjectEmpty();return a[""]=this.rawData,a}toTextObjectEmpty(a){return new jp(this.getTextName(),{},a)}}aG=new WeakMap,jt.NAME="ASN";class ju extends jt{constructor(...a){super(b6.isBufferSource(a[0])?b6.toArrayBuffer(a[0]):ek.serialize(new fJ({extnID:a[0],critical:a[1],extnValue:new dN(b6.toArrayBuffer(a[2]))})),fJ)}onInit(a){this.type=a.extnID,this.critical=a.critical,this.value=a.extnValue.buffer}toTextObject(){let a=this.toTextObjectWithoutValue();return a[""]=this.value,a}toTextObjectWithoutValue(){let a=this.toTextObjectEmpty(this.critical?"critical":void 0);return a[jp.NAME]===ju.NAME&&(a[jp.NAME]=jr.toString(this.type)),a}}class jv{static isCryptoKeyPair(a){return a&&a.privateKey&&a.publicKey}static isCryptoKey(a){return a&&a.usages&&a.type&&a.algorithm&&void 0!==a.extractable}constructor(){this.items=new Map,this[aH]="CryptoProvider","u">typeof self&&"u">typeof crypto?this.set(jv.DEFAULT,crypto):"u">typeof global&&global.crypto&&global.crypto.subtle&&this.set(jv.DEFAULT,global.crypto)}clear(){this.items.clear()}delete(a){return this.items.delete(a)}forEach(a,b){return this.items.forEach(a,b)}has(a){return this.items.has(a)}get size(){return this.items.size}entries(){return this.items.entries()}keys(){return this.items.keys()}values(){return this.items.values()}[Symbol.iterator](){return this.items[Symbol.iterator]()}get(a=jv.DEFAULT){let b=this.items.get(a.toLowerCase());if(!b)throw Error(`Cannot get Crypto by name '${a}'`);return b}set(a,b){if("string"==typeof a){if(!b)throw TypeError("Argument 'value' is required");this.items.set(a.toLowerCase(),b)}else this.items.set(jv.DEFAULT,a);return this}}aH=Symbol.toStringTag,jv.DEFAULT="default";let jw=new jv,jx=/^[0-2](?:\.[1-9][0-9]*)+$/;class jy{constructor(a={}){for(const b in this.items={},a)this.register(b,a[b])}get(a){return this.items[a]||null}findId(a){return new RegExp(jx).test(a)?a:this.get(a)}register(a,b){this.items[a]=b,this.items[b]=a}}let jz=new jy;function jA(a,b){return`\\${cd.ToHex(cd.FromUtf8String(b)).toUpperCase()}`}jz.register("CN","2.5.4.3"),jz.register("L","2.5.4.7"),jz.register("ST","2.5.4.8"),jz.register("O","2.5.4.10"),jz.register("OU","2.5.4.11"),jz.register("C","2.5.4.6"),jz.register("DC","0.9.2342.19200300.100.1.25"),jz.register("E","1.2.840.113549.1.9.1"),jz.register("G","2.5.4.42"),jz.register("I","2.5.4.43"),jz.register("SN","2.5.4.4"),jz.register("T","2.5.4.12");class jB{static isASCII(a){for(let b=0;b<a.length;b++)if(a.charCodeAt(b)>255)return!1;return!0}static isPrintableString(a){return/^[A-Za-z0-9 '()+,-./:=?]*$/g.test(a)}constructor(a,b={}){for(const a in this.extraNames=new jy,this.asn=new ew,b)if(Object.prototype.hasOwnProperty.call(b,a)){const c=b[a];this.extraNames.register(a,c)}"string"==typeof a?this.asn=this.fromString(a):a instanceof ew?this.asn=a:b6.isBufferSource(a)?this.asn=ek.parse(a,ew):this.asn=this.fromJSON(a)}getField(a){let b=this.extraNames.findId(a)||jz.findId(a),c=[];for(let a of this.asn)for(let d of a)d.type===b&&c.push(d.value.toString());return c}getName(a){return this.extraNames.get(a)||jz.get(a)}toString(){return this.asn.map(a=>a.map(a=>{let b=this.getName(a.type)||a.type,c=a.value.anyValue?`#${cd.ToHex(a.value.anyValue)}`:a.value.toString().replace(/([,+"\\<>;])/g,"\\$1").replace(/^([ #])/,"\\$1").replace(/([ ]$)/,"\\$1").replace(/([\r\n\t])/,jA);return`${b}=${c}`}).join("+")).join(", ")}toJSON(){let a=[];for(let b of this.asn){let c={};for(let a of b){let b=this.getName(a.type)||a.type;null!=c[b]||(c[b]=[]),c[b].push(a.value.anyValue?`#${cd.ToHex(a.value.anyValue)}`:a.value.toString())}a.push(c)}return a}fromString(a){let b=new ew,c=/(\d\.[\d.]*\d|[A-Za-z]+)=((?:"")|(?:".*?[^\\]")|(?:[^,+"\\](?=[,+]|$))|(?:[^,+].*?(?:[^\\][,+]))|(?:))([,+])?/g,d=null,e=",";for(;d=c.exec(`${a},`);){let[,a,c]=d,f=c[c.length-1];(","===f||"+"===f)&&(c=c.slice(0,c.length-1),d[3]=f);let g=d[3];a=this.getTypeOid(a);let h=this.createAttribute(a,c);"+"===e?b[b.length-1].push(h):b.push(new eu([h])),e=g}return b}fromJSON(a){let b=new ew;for(let c of a){let a=new eu;for(let b in c){let d=this.getTypeOid(b);for(let e of c[b]){let b=this.createAttribute(d,e);a.push(b)}}b.push(a)}return b}getTypeOid(a){if(/[\d.]+/.test(a)||(a=this.getName(a)||""),!a)throw Error(`Cannot get OID for name type '${a}'`);return a}createAttribute(a,b){let c=new et({type:a});if("object"==typeof b)for(let a in b)switch(a){case"ia5String":c.value.ia5String=b[a];break;case"utf8String":c.value.utf8String=b[a];break;case"universalString":c.value.universalString=b[a];break;case"bmpString":c.value.bmpString=b[a];break;case"printableString":c.value.printableString=b[a]}else if("#"===b[0])c.value.anyValue=cd.FromHex(b.slice(1));else{let d=this.processStringValue(b);a===this.getName("E")||a===this.getName("DC")?c.value.ia5String=d:jB.isPrintableString(d)?c.value.printableString=d:c.value.utf8String=d}return c}processStringValue(a){let b=/"(.*?[^\\])?"/.exec(a);return b&&(a=b[1]),a.replace(/\\0a/ig,"\n").replace(/\\0d/ig,"\r").replace(/\\0g/ig," ").replace(/\\(.)/g,"$1")}toArrayBuffer(){return ek.serialize(this.asn)}async getThumbprint(...a){var b;let c,d="SHA-1";return!(a.length>=1)||(null==(b=a[0])?void 0:b.subtle)?c=a[0]||jw.get():(d=a[0]||d,c=a[1]||jw.get()),await c.subtle.digest(d,this.toArrayBuffer())}}let jC="Cannot initialize GeneralName from ASN.1 data.",jD=`${jC} Unsupported string format in use.`,jE=`${jC} Value doesn't match to GUID regular expression.`,jF=/^([0-9a-f]{8})-?([0-9a-f]{4})-?([0-9a-f]{4})-?([0-9a-f]{4})-?([0-9a-f]{12})$/i,jG="1.3.6.1.4.1.311.25.1",jH="1.3.6.1.4.1.311.20.2.3",jI="email",jJ="guid";class jK extends jt{constructor(...a){let b;if(2===a.length)switch(a[0]){case"dn":{const c=new jB(a[1]).toArrayBuffer(),d=ek.parse(c,ew);b=new ez({directoryName:d});break}case"dns":b=new ez({dNSName:a[1]});break;case jI:b=new ez({rfc822Name:a[1]});break;case jJ:{const c=RegExp(jF,"i").exec(a[1]);if(!c)throw Error("Cannot parse GUID value. Value doesn't match to regular expression");const d=c.slice(1).map((a,b)=>b<3?cd.ToHex(new Uint8Array(cd.FromHex(a)).reverse()):a).join("");b=new ez({otherName:new ex({typeId:jG,value:ek.serialize(new dN(cd.FromHex(d)))})});break}case"ip":b=new ez({iPAddress:a[1]});break;case"id":b=new ez({registeredID:a[1]});break;case"upn":b=new ez({otherName:new ex({typeId:jH,value:ek.serialize(dX.toASN(a[1]))})});break;case"url":b=new ez({uniformResourceIdentifier:a[1]});break;default:throw Error("Cannot create GeneralName. Unsupported type of the name")}else b=b6.isBufferSource(a[0])?ek.parse(a[0],ez):a[0];super(b)}onInit(a){if(void 0!=a.dNSName)this.type="dns",this.value=a.dNSName;else if(void 0!=a.rfc822Name)this.type=jI,this.value=a.rfc822Name;else if(void 0!=a.iPAddress)this.type="ip",this.value=a.iPAddress;else if(void 0!=a.uniformResourceIdentifier)this.type="url",this.value=a.uniformResourceIdentifier;else if(void 0!=a.registeredID)this.type="id",this.value=a.registeredID;else if(void 0!=a.directoryName)this.type="dn",this.value=new jB(a.directoryName).toString();else if(void 0!=a.otherName)if(a.otherName.typeId===jG){this.type=jJ;let b=ek.parse(a.otherName.value,dN),c=RegExp(jF,"i").exec(cd.ToHex(b));if(!c)throw Error(jE);this.value=c.slice(1).map((a,b)=>b<3?cd.ToHex(new Uint8Array(cd.FromHex(a)).reverse()):a).join("-")}else if(a.otherName.typeId===jH)this.type="upn",this.value=ek.parse(a.otherName.value,er).toString();else throw Error(jD);else throw Error(jD)}toJSON(){return{type:this.type,value:this.value}}toTextObject(){let a;switch(this.type){case"dn":case"dns":case jJ:case"ip":case"id":case"upn":case"url":a=this.type.toUpperCase();break;case jI:a="Email";break;default:throw Error("Unsupported GeneralName type")}let b=this.value;return"id"===this.type&&(b=jr.toString(b)),new jp(a,void 0,b)}}class jL extends jt{constructor(a){let b;if(a instanceof eR)b=a;else if(Array.isArray(a)){const c=[];for(const b of a)if(b instanceof ez)c.push(b);else{const a=ek.parse(new jK(b.type,b.value).rawData,ez);c.push(a)}b=new eR(c)}else if(b6.isBufferSource(a))b=ek.parse(a,eR);else throw Error("Cannot initialize GeneralNames. Incorrect incoming arguments");super(b)}onInit(a){let b=[];for(let c of a){let a=null;try{a=new jK(c)}catch{continue}b.push(a)}this.items=b}toJSON(){return this.items.map(a=>a.toJSON())}toTextObject(){let a=super.toTextObjectEmpty();for(let b of this.items){let c=b.toTextObject(),d=a[c[jp.NAME]];Array.isArray(d)||(d=[],a[c[jp.NAME]]=d),d.push(c)}return a}}jL.NAME="GeneralNames";let jM="-{5}",jN=`${jM}BEGIN ([^\\n]+(?=${jM}))${jM}`,jO=`${jM}END \\1${jM}`,jP=`${jN}\\n(?:((?:[^:\\n]+: (?:[^\\n]+\\n(?: +[^\\n]+\\n)*))+))?\\n?((?:[a-zA-Z0-9=+/]+\\n)+)${jO}`;class jQ{static isPem(a){return"string"==typeof a&&RegExp(jP,"g").test(a.replace(/\r/g,""))}static decodeWithHeaders(a){a=a.replace(/\r/g,"");let b=RegExp(jP,"g"),c=[],d=null;for(;d=b.exec(a);){let a=d[3].replace(RegExp("[\\n]+","g"),""),b={type:d[1],headers:[],rawData:cd.FromBase64(a)},e=d[2];if(e){let a=e.split(RegExp("\\n","g")),c=null;for(let d of a){let[a,e]=d.split(/:(.*)/);if(void 0===e){if(!c)throw Error("Cannot parse PEM string. Incorrect header value");c.value+=a.trim()}else c&&b.headers.push(c),c={key:a,value:e.trim()}}c&&b.headers.push(c)}c.push(b)}return c}static decode(a){return this.decodeWithHeaders(a).map(a=>a.rawData)}static decodeFirst(a){let b=this.decode(a);if(!b.length)throw RangeError("PEM string doesn't contain any objects");return b[0]}static encode(a,b){if(Array.isArray(a)){let c=[];return b?a.forEach(a=>{if(!b6.isBufferSource(a))throw TypeError("Cannot encode array of BufferSource in PEM format. Not all items of the array are BufferSource");c.push(this.encodeStruct({type:b,rawData:b6.toArrayBuffer(a)}))}):a.forEach(a=>{if(!("type"in a))throw TypeError("Cannot encode array of PemStruct in PEM format. Not all items of the array are PemStrut");c.push(this.encodeStruct(a))}),c.join("\n")}if(!b)throw Error("Required argument 'tag' is missed");return this.encodeStruct({type:b,rawData:b6.toArrayBuffer(a)})}static encodeStruct(a){var b;let c,d=a.type.toLocaleUpperCase(),e=[];if(e.push(`-----BEGIN ${d}-----`),null==(b=a.headers)?void 0:b.length){for(let b of a.headers)e.push(`${b.key}: ${b.value}`);e.push("")}let f=cd.ToBase64(a.rawData),g=0,h=[];for(;g<f.length;)if(f.length-g<64?c=f.substring(g):(c=f.substring(g,g+64),g+=64),0!==c.length){if(h.push(c),c.length<64)break}else break;return e.push(...h),e.push(`-----END ${d}-----`),e.join("\n")}}jQ.CertificateTag="CERTIFICATE",jQ.CrlTag="CRL",jQ.CertificateRequestTag="CERTIFICATE REQUEST",jQ.PublicKeyTag="PUBLIC KEY",jQ.PrivateKeyTag="PRIVATE KEY";class jR extends jt{static isAsnEncoded(a){return b6.isBufferSource(a)||"string"==typeof a}static toArrayBuffer(a){if("string"==typeof a)if(jQ.isPem(a))return jQ.decode(a)[0];else if(cd.isHex(a))return cd.FromHex(a);else if(cd.isBase64(a))return cd.FromBase64(a);else if(cd.isBase64Url(a))return cd.FromBase64Url(a);else throw TypeError("Unsupported format of 'raw' argument. Must be one of DER, PEM, HEX, Base64, or Base4Url");{let b=b6.toUint8Array(a);if(b.length>0&&48===b[0])return b6.toArrayBuffer(a);let c=cd.ToBinary(a);if(jQ.isPem(c))return jQ.decode(c)[0];if(cd.isHex(c))return cd.FromHex(c);if(cd.isBase64(c))return cd.FromBase64(c);else if(cd.isBase64Url(c))return cd.FromBase64Url(c);throw TypeError("Unsupported format of 'raw' argument. Must be one of DER, PEM, HEX, Base64, or Base4Url")}}constructor(...a){jR.isAsnEncoded(a[0])?super(jR.toArrayBuffer(a[0]),a[1]):super(a[0])}toString(a="pem"){return"pem"===a?jQ.encode(this.rawData,this.tag):super.toString(a)}}class jS extends jR{static async create(a,b=jw.get()){if(a instanceof jS)return a;if(jv.isCryptoKey(a)){if("public"!==a.type)throw TypeError("Public key is required");return new jS(await b.subtle.exportKey("spki",a))}if(a.publicKey)return a.publicKey;if(b6.isBufferSource(a))return new jS(a);throw TypeError("Unsupported PublicKeyType")}constructor(a){jR.isAsnEncoded(a)?super(a,fG):super(a),this.tag=jQ.PublicKeyTag}async export(...a){var b;let c,d=["verify"],e={hash:"SHA-256",...this.algorithm};a.length>1?(e=a[0]||e,d=a[1]||d,c=a[2]||jw.get()):c=a[0]||jw.get();let f=this.rawData,g=ek.parse(this.rawData,fG);return g.algorithm.algorithm===hk&&(b=g,b.algorithm=new fF({algorithm:hh,parameters:null}),f=ek.serialize(b)),c.subtle.importKey("spki",f,e,!0,d)}onInit(a){let b=h3.resolve(iT),c=this.algorithm=b.toWebAlgorithm(a.algorithm);if(a.algorithm.algorithm===hh){let b=ek.parse(a.subjectPublicKey,hK),d=b6.toUint8Array(b.modulus);c.publicExponent=b6.toUint8Array(b.publicExponent),c.modulusLength=(!d[0]?d.slice(1):d).byteLength<<3}}async getThumbprint(...a){var b;let c,d="SHA-1";return!(a.length>=1)||(null==(b=a[0])?void 0:b.subtle)?c=a[0]||jw.get():(d=a[0]||d,c=a[1]||jw.get()),await c.subtle.digest(d,this.rawData)}async getKeyIdentifier(...a){let b,c="SHA-1";1===a.length?"string"==typeof a[0]?(c=a[0],b=jw.get()):b=a[0]:2===a.length?(c=a[0],b=a[1]):b=jw.get();let d=ek.parse(this.rawData,fG);return await b.subtle.digest(c,d.subjectPublicKey)}toTextObject(){let a=this.toTextObjectEmpty(),b=ek.parse(this.rawData,fG);return a.Algorithm=js.serializeAlgorithm(b.algorithm),b.algorithm.algorithm===gX?a["EC Point"]=b.subjectPublicKey:a["Raw Data"]=b.subjectPublicKey,a}}class jT extends ju{static async create(a,b=!1,c=jw.get()){if("name"in a&&"serialNumber"in a)return new jT(a,b);let d=await jS.create(a,c),e=await d.getKeyIdentifier(c);return new jT(cd.ToHex(e),b)}constructor(...a){if(b6.isBufferSource(a[0]))super(a[0]);else if("string"==typeof a[0]){const b=new eO({keyIdentifier:new eN(cd.FromHex(a[0]))});super(eM,a[1],ek.serialize(b))}else{const b=a[0],c=new eO({authorityCertIssuer:b.name instanceof jL?ek.parse(b.name.rawData,eR):b.name,authorityCertSerialNumber:cd.FromHex(b.serialNumber)});super(eM,a[1],ek.serialize(c))}}onInit(a){super.onInit(a);let b=ek.parse(a.extnValue,eO);b.keyIdentifier&&(this.keyId=cd.ToHex(b.keyIdentifier)),(b.authorityCertIssuer||b.authorityCertSerialNumber)&&(this.certId={name:b.authorityCertIssuer||[],serialNumber:b.authorityCertSerialNumber?cd.ToHex(b.authorityCertSerialNumber):""})}toTextObject(){let a=this.toTextObjectWithoutValue(),b=ek.parse(this.value,eO);return b.authorityCertIssuer&&(a["Authority Issuer"]=new jL(b.authorityCertIssuer).toTextObject()),b.authorityCertSerialNumber&&(a["Authority Serial Number"]=b.authorityCertSerialNumber),b.keyIdentifier&&(a[""]=b.keyIdentifier),a}}jT.NAME="Authority Key Identifier";class jU extends ju{constructor(...a){if(b6.isBufferSource(a[0])){super(a[0]);const b=ek.parse(this.value,eQ);this.ca=b.cA,this.pathLength=b.pathLenConstraint}else{const b=new eQ({cA:a[0],pathLenConstraint:a[1]});super(eP,a[2],ek.serialize(b)),this.ca=a[0],this.pathLength=a[1]}}toTextObject(){let a=this.toTextObjectWithoutValue();return this.ca&&(a.CA=this.ca),void 0!==this.pathLength&&(a["Path Length"]=this.pathLength),a}}jU.NAME="Basic Constraints",(w=aI||(aI={})).serverAuth="1.3.6.1.5.5.7.3.1",w.clientAuth="1.3.6.1.5.5.7.3.2",w.codeSigning="1.3.6.1.5.5.7.3.3",w.emailProtection="1.3.6.1.5.5.7.3.4",w.timeStamping="1.3.6.1.5.5.7.3.8",w.ocspSigning="1.3.6.1.5.5.7.3.9";class jV extends ju{constructor(...a){if(b6.isBufferSource(a[0])){super(a[0]);const b=ek.parse(this.value,fb);this.usages=b.map(a=>a)}else{const b=new fb(a[0]);super(fa,a[1],ek.serialize(b)),this.usages=a[0]}}toTextObject(){let a=this.toTextObjectWithoutValue();return a[""]=this.usages.map(a=>jr.toString(a)).join(", "),a}}jV.NAME="Extended Key Usages",(x=aJ||(aJ={}))[x.digitalSignature=1]="digitalSignature",x[x.nonRepudiation=2]="nonRepudiation",x[x.keyEncipherment=4]="keyEncipherment",x[x.dataEncipherment=8]="dataEncipherment",x[x.keyAgreement=16]="keyAgreement",x[x.keyCertSign=32]="keyCertSign",x[x.cRLSign=64]="cRLSign",x[x.encipherOnly=128]="encipherOnly",x[x.decipherOnly=256]="decipherOnly";class jW extends ju{constructor(...a){if(b6.isBufferSource(a[0])){super(a[0]);const b=ek.parse(this.value,fo);this.usages=b.toNumber()}else{const b=new fo(a[0]);super(fn,a[1],ek.serialize(b)),this.usages=a[0]}}toTextObject(){let a=this.toTextObjectWithoutValue(),b=ek.parse(this.value,fo);return a[""]=b.toJSON().join(", "),a}}jW.NAME="Key Usages";class jX extends ju{static async create(a,b=!1,c=jw.get()){let d=await jS.create(a,c),e=await d.getKeyIdentifier(c);return new jX(cd.ToHex(e),b)}constructor(...a){if(b6.isBufferSource(a[0])){super(a[0]);const b=ek.parse(this.value,fA);this.keyId=cd.ToHex(b)}else{const b="string"==typeof a[0]?cd.FromHex(a[0]):a[0],c=new fA(b);super(fz,a[1],ek.serialize(c)),this.keyId=cd.ToHex(b)}}toTextObject(){let a=this.toTextObjectWithoutValue(),b=ek.parse(this.value,fA);return a[""]=b,a}}jX.NAME="Subject Key Identifier";class jY extends ju{constructor(...a){b6.isBufferSource(a[0])?super(a[0]):super(fv,a[1],new jL(a[0]||[]).rawData)}onInit(a){super.onInit(a);let b=ek.parse(a.extnValue,fw);this.names=new jL(b)}toTextObject(){let a=this.toTextObjectWithoutValue(),b=this.names.toTextObject();for(let c in b)a[c]=b[c];return a}}jY.NAME="Subject Alternative Name";class jZ{static register(a,b){this.items.set(a,b)}static create(a){let b=new ju(a),c=this.items.get(b.type);return c?new c(a):b}}jZ.items=new Map;class j$ extends ju{constructor(...a){var b;if(b6.isBufferSource(a[0])){super(a[0]);const b=ek.parse(this.value,e$);this.policies=b.map(a=>a.policyIdentifier)}else{const c=a[0],d=null!=(b=a[1])&&b,e=new e$(c.map(a=>new eZ({policyIdentifier:a})));super(eT,d,ek.serialize(e)),this.policies=c}}toTextObject(){let a=this.toTextObjectWithoutValue();return a.Policy=this.policies.map(a=>new jp("",{},jr.toString(a))),a}}j$.NAME="Certificate Policies",jZ.register(eT,j$);class j_ extends ju{constructor(...a){if(b6.isBufferSource(a[0]))super(a[0]);else if(Array.isArray(a[0])&&"string"==typeof a[0][0]){const b=a[0].map(a=>new e4({distributionPoint:new e3({fullName:[new ez({uniformResourceIdentifier:a})]})})),c=new e5(b);super(e1,a[1],ek.serialize(c))}else{const b=new e5(a[0]);super(e1,a[1],ek.serialize(b))}null!=this.distributionPoints||(this.distributionPoints=[])}onInit(a){super.onInit(a);let b=ek.parse(a.extnValue,e5);this.distributionPoints=b}toTextObject(){let a=this.toTextObjectWithoutValue();return a["Distribution Point"]=this.distributionPoints.map(a=>{var b;let c={};return a.distributionPoint&&(c[""]=null==(b=a.distributionPoint.fullName)?void 0:b.map(a=>new jK(a).toString()).join(", ")),a.reasons&&(c.Reasons=a.reasons.toString()),a.cRLIssuer&&(c["CRL Issuer"]=a.cRLIssuer.map(a=>a.toString()).join(", ")),c}),a}}j_.NAME="CRL Distribution Points";class j0 extends ju{constructor(...a){if(b6.isBufferSource(a[0]))super(a[0]);else if(a[0]instanceof eL){const b=new eL(a[0]);super(eJ,a[1],ek.serialize(b))}else{const b=a[0],c=new eL;j2(c,b,eE,"ocsp"),j2(c,b,eF,"caIssuers"),j2(c,b,eG,"timeStamping"),j2(c,b,eH,"caRepository"),super(eJ,a[1],ek.serialize(c))}null!=this.ocsp||(this.ocsp=[]),null!=this.caIssuers||(this.caIssuers=[]),null!=this.timeStamping||(this.timeStamping=[]),null!=this.caRepository||(this.caRepository=[])}onInit(a){super.onInit(a),this.ocsp=[],this.caIssuers=[],this.timeStamping=[],this.caRepository=[],ek.parse(a.extnValue,eL).forEach(a=>{switch(a.accessMethod){case eE:this.ocsp.push(new jK(a.accessLocation));break;case eF:this.caIssuers.push(new jK(a.accessLocation));break;case eG:this.timeStamping.push(new jK(a.accessLocation));break;case eH:this.caRepository.push(new jK(a.accessLocation))}})}toTextObject(){let a=this.toTextObjectWithoutValue();return this.ocsp.length&&j1(a,"OCSP",this.ocsp),this.caIssuers.length&&j1(a,"CA Issuers",this.caIssuers),this.timeStamping.length&&j1(a,"Time Stamping",this.timeStamping),this.caRepository.length&&j1(a,"CA Repository",this.caRepository),a}}function j1(a,b,c){if(1===c.length)a[b]=c[0].toTextObject();else{let d=new jp("");c.forEach((a,b)=>{let c=a.toTextObject(),e=`${c[jp.NAME]} ${b+1}`,f=d[e];Array.isArray(f)||(f=[],d[e]=f),f.push(c)}),a[b]=d}}function j2(a,b,c,d){let e=b[d];e&&(Array.isArray(e)?e:[e]).forEach(b=>{"string"==typeof b&&(b=new jK("url",b)),a.push(new eK({accessMethod:c,accessLocation:ek.parse(b.rawData,ez)}))})}j0.NAME="Authority Info Access";class j3 extends ju{constructor(...a){b6.isBufferSource(a[0])?super(a[0]):super(fl,a[1],new jL(a[0]||[]).rawData)}onInit(a){super.onInit(a);let b=ek.parse(a.extnValue,eR);this.names=new jL(b)}toTextObject(){let a=this.toTextObjectWithoutValue(),b=this.names.toTextObject();for(let c in b)a[c]=b[c];return a}}j3.NAME="Issuer Alternative Name";class j4 extends jt{constructor(...a){let b;if(b6.isBufferSource(a[0]))b=b6.toArrayBuffer(a[0]);else{const c=a[0],d=Array.isArray(a[1])?a[1].map(a=>b6.toArrayBuffer(a)):[];b=ek.serialize(new fx({type:c,values:d}))}super(b,fx)}onInit(a){this.type=a.type,this.values=a.values}toTextObject(){let a=this.toTextObjectWithoutValue();return a.Value=this.values.map(a=>new jp("",{"":a})),a}toTextObjectWithoutValue(){let a=this.toTextObjectEmpty();return a[jp.NAME]===j4.NAME&&(a[jp.NAME]=jr.toString(this.type)),a}}j4.NAME="Attribute";class j5 extends j4{constructor(...a){if(b6.isBufferSource(a[0]))super(a[0]);else{const b=new iI({printableString:a[0]});super(ip,[ek.serialize(b)])}null!=this.password||(this.password="")}onInit(a){if(super.onInit(a),this.values[0]){let a=ek.parse(this.values[0],iI);this.password=a.toString()}}toTextObject(){let a=this.toTextObjectWithoutValue();return a[jp.VALUE]=this.password,a}}j5.NAME="Challenge Password";class j6 extends j4{constructor(...a){if(b6.isBufferSource(a[0]))super(a[0]);else{const b=a[0],c=new fK;for(const a of b)c.push(ek.parse(a.rawData,fJ));super(iq,[ek.serialize(c)])}null!=this.items||(this.items=[])}onInit(a){if(super.onInit(a),this.values[0]){let a=ek.parse(this.values[0],fK);this.items=a.map(a=>jZ.create(ek.serialize(a)))}}toTextObject(){let a=this.toTextObjectWithoutValue();for(let b of this.items.map(a=>a.toTextObject()))a[b[jp.NAME]]=b;return a}}j6.NAME="Extensions";class j7{static register(a,b){this.items.set(a,b)}static create(a){let b=new j4(a),c=this.items.get(b.type);return c?new c(a):b}}j7.items=new Map;let j8="crypto.signatureFormatter";class j9{toAsnSignature(a,b){return b6.toArrayBuffer(b)}toWebSignature(a,b){return b6.toArrayBuffer(b)}}let ka=aK=class{static createPssParams(a,b){let c=aK.getHashAlgorithm(a);return c?new hF({hashAlgorithm:c,maskGenAlgorithm:new fF({algorithm:hz,parameters:ek.serialize(c)}),saltLength:b}):null}static getHashAlgorithm(a){let b=h3.resolve(iT);return"string"==typeof a?b.toAsnAlgorithm({name:a}):"object"==typeof a&&a&&"name"in a?b.toAsnAlgorithm(a):null}toAsnAlgorithm(a){switch(a.name.toLowerCase()){case"rsassa-pkcs1-v1_5":if(!("hash"in a))return new fF({algorithm:hh,parameters:null});{let b;if("string"==typeof a.hash)b=a.hash;else if(a.hash&&"object"==typeof a.hash&&"name"in a.hash&&"string"==typeof a.hash.name)b=a.hash.name.toUpperCase();else throw Error("Cannot get hash algorithm name");switch(b.toLowerCase()){case"sha-1":return new fF({algorithm:hn,parameters:null});case"sha-256":return new fF({algorithm:hp,parameters:null});case"sha-384":return new fF({algorithm:hq,parameters:null});case"sha-512":return new fF({algorithm:hr,parameters:null})}}break;case"rsa-pss":if(!("hash"in a))return new fF({algorithm:hk,parameters:null});{if(!("saltLength"in a&&"number"==typeof a.saltLength))throw Error("Cannot get 'saltLength' from 'alg' argument");let b=aK.createPssParams(a.hash,a.saltLength);if(!b)throw Error("Cannot create PSS parameters");return new fF({algorithm:hk,parameters:ek.serialize(b)})}}return null}toWebAlgorithm(a){switch(a.algorithm){case hh:return{name:"RSASSA-PKCS1-v1_5"};case hn:return{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-1"}};case hp:return{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-256"}};case hq:return{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-384"}};case hr:return{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-512"}};case hk:if(!a.parameters)return{name:"RSA-PSS"};{let b=ek.parse(a.parameters,hF);return{name:"RSA-PSS",hash:h3.resolve(iT).toWebAlgorithm(b.hashAlgorithm),saltLength:b.saltLength}}}return null}};ka=aK=el([h4()],ka),h3.registerSingleton(iR,ka);let kb=class{toAsnAlgorithm(a){switch(a.name.toLowerCase()){case"sha-1":return new fF({algorithm:hu});case"sha-256":return new fF({algorithm:hw});case"sha-384":return new fF({algorithm:hx});case"sha-512":return new fF({algorithm:hy})}return null}toWebAlgorithm(a){switch(a.algorithm){case hu:return{name:"SHA-1"};case hw:return{name:"SHA-256"};case hx:return{name:"SHA-384"};case hy:return{name:"SHA-512"}}return null}};kb=el([h4()],kb),h3.registerSingleton(iR,kb);class kc{addPadding(a,b){let c=b6.toUint8Array(b),d=new Uint8Array(a);return d.set(c,a-c.length),d.buffer}removePadding(a,b=!1){let c=b6.toUint8Array(a);for(let a=0;a<c.length;a++)if(c[a]){c=c.slice(a);break}if(b&&c[0]>127){let a=new Uint8Array(c.length+1);return a.set(c,1),a.buffer}return c.buffer}toAsnSignature(a,b){if("ECDSA"===a.name){let c=a.namedCurve,d=kc.namedCurveSize.get(c)||kc.defaultNamedCurveSize,e=new hf,f=b6.toUint8Array(b);return e.r=this.removePadding(f.slice(0,d),!0),e.s=this.removePadding(f.slice(d,d+d),!0),ek.serialize(e)}return null}toWebSignature(a,b){if("ECDSA"===a.name){let c=ek.parse(b,hf),d=a.namedCurve,e=kc.namedCurveSize.get(d)||kc.defaultNamedCurveSize;return function(...a){let b=new Uint8Array(a.map(a=>a.byteLength).reduce((a,b)=>a+b)),c=0;return a.map(a=>new Uint8Array(a)).forEach(a=>{for(let d of a)b[c++]=d}),b.buffer}(this.addPadding(e,this.removePadding(c.r)),this.addPadding(e,this.removePadding(c.s)))}return null}}kc.namedCurveSize=new Map,kc.defaultNamedCurveSize=32;let kd="1.3.101.110",ke="1.3.101.111",kf="1.3.101.112",kg="1.3.101.113",kh=class{toAsnAlgorithm(a){let b=null;switch(a.name.toLowerCase()){case"ed25519":b=kf;break;case"x25519":b=kd;break;case"eddsa":switch(a.namedCurve.toLowerCase()){case"ed25519":b=kf;break;case"ed448":b=kg}break;case"ecdh-es":switch(a.namedCurve.toLowerCase()){case"x25519":b=kd;break;case"x448":b=ke}}return b?new fF({algorithm:b}):null}toWebAlgorithm(a){switch(a.algorithm){case kf:return{name:"Ed25519"};case kg:return{name:"EdDSA",namedCurve:"Ed448"};case kd:return{name:"X25519"};case ke:return{name:"ECDH-ES",namedCurve:"X448"}}return null}};kh=el([h4()],kh),h3.registerSingleton(iR,kh);class ki extends jR{get subjectName(){return em(this,aM,"f")||en(this,aM,new jB(this.asn.certificationRequestInfo.subject),"f"),em(this,aM,"f")}get subject(){return em(this,aN,"f")||en(this,aN,this.subjectName.toString(),"f"),em(this,aN,"f")}get signatureAlgorithm(){if(!em(this,aO,"f")){let a=h3.resolve(iT);en(this,aO,a.toWebAlgorithm(this.asn.signatureAlgorithm),"f")}return em(this,aO,"f")}get signature(){return em(this,aP,"f")||en(this,aP,this.asn.signature,"f"),em(this,aP,"f")}get publicKey(){return em(this,aQ,"f")||en(this,aQ,new jS(this.asn.certificationRequestInfo.subjectPKInfo),"f"),em(this,aQ,"f")}get attributes(){return em(this,aR,"f")||en(this,aR,this.asn.certificationRequestInfo.attributes.map(a=>j7.create(ek.serialize(a))),"f"),em(this,aR,"f")}get extensions(){if(!em(this,aS,"f")){en(this,aS,[],"f");let a=this.getAttribute(iq);a instanceof j6&&en(this,aS,a.items,"f")}return em(this,aS,"f")}get tbs(){return em(this,aL,"f")||en(this,aL,this.asn.certificationRequestInfoRaw||ek.serialize(this.asn.certificationRequestInfo),"f"),em(this,aL,"f")}constructor(a){const b=jR.isAsnEncoded(a)?[a,iQ]:[a];super(b[0],b[1]),aL.set(this,void 0),aM.set(this,void 0),aN.set(this,void 0),aO.set(this,void 0),aP.set(this,void 0),aQ.set(this,void 0),aR.set(this,void 0),aS.set(this,void 0),this.tag=jQ.CertificateRequestTag}onInit(a){}getAttribute(a){for(let b of this.attributes)if(b.type===a)return b;return null}getAttributes(a){return this.attributes.filter(b=>b.type===a)}getExtension(a){for(let b of this.extensions)if(b.type===a)return b;return null}getExtensions(a){return this.extensions.filter(b=>b.type===a)}async verify(a=jw.get()){let b={...this.publicKey.algorithm,...this.signatureAlgorithm},c=await this.publicKey.export(b,["verify"],a),d=h3.resolveAll(j8).reverse(),e=null;for(let a of d)if(e=a.toWebSignature(b,this.signature))break;if(!e)throw Error("Cannot convert WebCrypto signature value to ASN.1 format");return await a.subtle.verify(this.signatureAlgorithm,c,e,this.tbs)}toTextObject(){let a=this.toTextObjectEmpty(),b=ek.parse(this.rawData,iQ),c=b.certificationRequestInfo,d=new jp("",{Version:`${ae[c.version]} (${c.version})`,Subject:this.subject,"Subject Public Key Info":this.publicKey});if(this.attributes.length){let a=new jp("");for(let b of this.attributes){let c=b.toTextObject();a[c[jp.NAME]]=c}d.Attributes=a}return a.Data=d,a.Signature=new jp("",{Algorithm:js.serializeAlgorithm(b.signatureAlgorithm),"":b.signature}),a}}aL=new WeakMap,aM=new WeakMap,aN=new WeakMap,aO=new WeakMap,aP=new WeakMap,aQ=new WeakMap,aR=new WeakMap,aS=new WeakMap,ki.NAME="PKCS#10 Certificate Request";class kj extends jR{get publicKey(){return em(this,a2,"f")||en(this,a2,new jS(this.asn.tbsCertificate.subjectPublicKeyInfo),"f"),em(this,a2,"f")}get serialNumber(){if(!em(this,aU,"f")){let a=new Uint8Array(this.asn.tbsCertificate.serialNumber);a.length>1&&0===a[0]&&a[1]>127&&(a=a.slice(1)),en(this,aU,cd.ToHex(a),"f")}return em(this,aU,"f")}get subjectName(){return em(this,aV,"f")||en(this,aV,new jB(this.asn.tbsCertificate.subject),"f"),em(this,aV,"f")}get subject(){return em(this,aW,"f")||en(this,aW,this.subjectName.toString(),"f"),em(this,aW,"f")}get issuerName(){return em(this,aX,"f")||en(this,aX,new jB(this.asn.tbsCertificate.issuer),"f"),em(this,aX,"f")}get issuer(){return em(this,aY,"f")||en(this,aY,this.issuerName.toString(),"f"),em(this,aY,"f")}get notBefore(){if(!em(this,aZ,"f")){let a=this.asn.tbsCertificate.validity.notBefore.utcTime||this.asn.tbsCertificate.validity.notBefore.generalTime;if(!a)throw Error("Cannot get 'notBefore' value");en(this,aZ,a,"f")}return em(this,aZ,"f")}get notAfter(){if(!em(this,a$,"f")){let a=this.asn.tbsCertificate.validity.notAfter.utcTime||this.asn.tbsCertificate.validity.notAfter.generalTime;if(!a)throw Error("Cannot get 'notAfter' value");en(this,a$,a,"f")}return em(this,a$,"f")}get signatureAlgorithm(){if(!em(this,a_,"f")){let a=h3.resolve(iT);en(this,a_,a.toWebAlgorithm(this.asn.signatureAlgorithm),"f")}return em(this,a_,"f")}get signature(){return em(this,a0,"f")||en(this,a0,this.asn.signatureValue,"f"),em(this,a0,"f")}get extensions(){return!em(this,a1,"f")&&(en(this,a1,[],"f"),this.asn.tbsCertificate.extensions&&en(this,a1,this.asn.tbsCertificate.extensions.map(a=>jZ.create(ek.serialize(a))),"f")),em(this,a1,"f")}get tbs(){return em(this,aT,"f")||en(this,aT,this.asn.tbsCertificateRaw||ek.serialize(this.asn.tbsCertificate),"f"),em(this,aT,"f")}constructor(a){const b=jR.isAsnEncoded(a)?[a,fM]:[a];super(b[0],b[1]),aT.set(this,void 0),aU.set(this,void 0),aV.set(this,void 0),aW.set(this,void 0),aX.set(this,void 0),aY.set(this,void 0),aZ.set(this,void 0),a$.set(this,void 0),a_.set(this,void 0),a0.set(this,void 0),a1.set(this,void 0),a2.set(this,void 0),this.tag=jQ.CertificateTag}onInit(a){}getExtension(a){for(let b of this.extensions)if("string"==typeof a){if(b.type===a)return b}else if(b instanceof a)return b;return null}getExtensions(a){return this.extensions.filter(b=>"string"==typeof a?b.type===a:b instanceof a)}async verify(a={},b=jw.get()){let c,d,e=a.publicKey;try{if(e)if("publicKey"in e)c={...e.publicKey.algorithm,...this.signatureAlgorithm},d=await e.publicKey.export(c,["verify"],b);else if(e instanceof jS)c={...e.algorithm,...this.signatureAlgorithm},d=await e.export(c,["verify"],b);else if(b6.isBufferSource(e)){let a=new jS(e);c={...a.algorithm,...this.signatureAlgorithm},d=await a.export(c,["verify"],b)}else c={...e.algorithm,...this.signatureAlgorithm},d=e;else c={...this.publicKey.algorithm,...this.signatureAlgorithm},d=await this.publicKey.export(c,["verify"],b)}catch{return!1}let f=h3.resolveAll(j8).reverse(),g=null;for(let a of f)if(g=a.toWebSignature(c,this.signature))break;if(!g)throw Error("Cannot convert ASN.1 signature value to WebCrypto format");let h=await b.subtle.verify(this.signatureAlgorithm,d,g,this.tbs);if(a.signatureOnly)return h;{let b=(a.date||new Date).getTime();return h&&this.notBefore.getTime()<b&&b<this.notAfter.getTime()}}async getThumbprint(...a){let b,c="SHA-1";return a[0]&&(a[0].subtle?b=a[0]:(c=a[0]||c,b=a[1])),null!=b||(b=jw.get()),await b.subtle.digest(c,this.rawData)}async isSelfSigned(a=jw.get()){return this.subject===this.issuer&&await this.verify({signatureOnly:!0},a)}toTextObject(){let a=this.toTextObjectEmpty(),b=ek.parse(this.rawData,fM),c=b.tbsCertificate,d=new jp("",{Version:`${ae[c.version]} (${c.version})`,"Serial Number":c.serialNumber,"Signature Algorithm":js.serializeAlgorithm(c.signature),Issuer:this.issuer,Validity:new jp("",{"Not Before":c.validity.notBefore.getTime(),"Not After":c.validity.notAfter.getTime()}),Subject:this.subject,"Subject Public Key Info":this.publicKey});if(c.issuerUniqueID&&(d["Issuer Unique ID"]=c.issuerUniqueID),c.subjectUniqueID&&(d["Subject Unique ID"]=c.subjectUniqueID),this.extensions.length){let a=new jp("");for(let b of this.extensions){let c=b.toTextObject();a[c[jp.NAME]]=c}d.Extensions=a}return a.Data=d,a.Signature=new jp("",{Algorithm:js.serializeAlgorithm(b.signatureAlgorithm),"":b.signatureValue}),a}}aT=new WeakMap,aU=new WeakMap,aV=new WeakMap,aW=new WeakMap,aX=new WeakMap,aY=new WeakMap,aZ=new WeakMap,a$=new WeakMap,a_=new WeakMap,a0=new WeakMap,a1=new WeakMap,a2=new WeakMap,kj.NAME="Certificate";class kk extends Array{constructor(a){if(super(),jR.isAsnEncoded(a))this.import(a);else if(a instanceof kj)this.push(a);else if(Array.isArray(a))for(const b of a)this.push(b)}export(a){let b=new gW;b.version=1,b.encapContentInfo.eContentType="1.2.840.113549.1.7.1",b.encapContentInfo.eContent=new gu({single:new dN}),b.certificates=new gs(this.map(a=>new gr({certificate:ek.parse(a.rawData,fM)})));let c=new gt({contentType:gU,content:ek.serialize(b)}),d=ek.serialize(c);return"raw"===a?d:this.toString(a)}import(a){let b=jR.toArrayBuffer(a),c=ek.parse(b,gt);if(c.contentType!==gU)throw TypeError("Cannot parse CMS package. Incoming data is not a SignedData object.");let d=ek.parse(c.content,gW);for(let a of(this.clear(),d.certificates||[]))a.certificate&&this.push(new kj(a.certificate))}clear(){for(;this.pop(););}toString(a="pem"){let b=this.export("raw");switch(a){case"pem":return jQ.encode(b,"CMS");case"pem-chain":return this.map(a=>a.toString("pem")).join("\n");case"asn":return ek.toString(b);case"hex":return cd.ToHex(b);case"base64":return cd.ToBase64(b);case"base64url":return cd.ToBase64Url(b);case"text":return js.serialize(this.toTextObject());default:throw TypeError("Argument 'format' is unsupported value")}}toTextObject(){let a=ek.parse(this.export("raw"),gt),b=ek.parse(a.content,gW);return new jp("X509Certificates",{"Content Type":jr.toString(a.contentType),Content:new jp("",{Version:`${af[b.version]} (${b.version})`,Certificates:new jp("",{Certificate:this.map(a=>a.toTextObject())})})})}}class kl{constructor(a={}){this.certificates=[],a.certificates&&(this.certificates=a.certificates)}async build(a,b=jw.get()){let c=new kk(a),d=a;for(;d=await this.findIssuer(d,b);){let a=await d.getThumbprint(b);for(let d of c)if(ce(a,await d.getThumbprint(b)))throw Error("Cannot build a certificate chain. Circular dependency.");c.push(d)}return c}async findIssuer(a,b=jw.get()){if(!await a.isSelfSigned(b)){let c=a.getExtension(eM);for(let d of this.certificates)if(d.subject===a.issuer){if(c){if(c.keyId){let a=d.getExtension(fz);if(a&&a.keyId!==c.keyId)continue}else if(c.certId){let a=d.getExtension(fv);if(a&&!(c.certId.serialNumber===d.serialNumber&&ce(ek.serialize(c.certId.name),ek.serialize(a))))continue}}try{let c={...d.publicKey.algorithm,...a.signatureAlgorithm},e=await d.publicKey.export(c,["verify"],b);if(!await a.verify({publicKey:e,signatureOnly:!0},b))continue}catch{continue}return d}}return null}}function km(a,b=jw.get()){let c=b6.toUint8Array(cd.FromHex(a||"")),d=c&&c.length&&c.some(a=>a>0)?new Uint8Array(c):void 0;d||(d=b.getRandomValues(new Uint8Array(16)));let e=0;for(;e<d.length-1&&0===d[e];)e++;if((d=d.slice(e))[0]>127){let a=new Uint8Array(d.length+1);a[0]=0,a.set(d,1),d=a}return d.buffer}(y=a8||(a8={}))[y.unspecified=0]="unspecified",y[y.keyCompromise=1]="keyCompromise",y[y.cACompromise=2]="cACompromise",y[y.affiliationChanged=3]="affiliationChanged",y[y.superseded=4]="superseded",y[y.cessationOfOperation=5]="cessationOfOperation",y[y.certificateHold=6]="certificateHold",y[y.removeFromCRL=8]="removeFromCRL",y[y.privilegeWithdrawn=9]="privilegeWithdrawn",y[y.aACompromise=10]="aACompromise";class kn extends jt{get serialNumber(){return em(this,a3,"f")||en(this,a3,cd.ToHex(this.asn.userCertificate),"f"),em(this,a3,"f")}get revocationDate(){return em(this,a4,"f")||en(this,a4,this.asn.revocationDate.getTime(),"f"),em(this,a4,"f")}get reason(){return void 0===em(this,a5,"f")&&this.extensions,em(this,a5,"f")}get invalidity(){return void 0===em(this,a6,"f")&&this.extensions,em(this,a6,"f")}get extensions(){return!em(this,a7,"f")&&(en(this,a7,[],"f"),this.asn.crlEntryExtensions&&en(this,a7,this.asn.crlEntryExtensions.map(a=>{let b=jZ.create(ek.serialize(a));switch(b.type){case e8:void 0===em(this,a5,"f")&&en(this,a5,ek.parse(b.value,e9).reason,"f");break;case fj:void 0===em(this,a6,"f")&&en(this,a6,ek.parse(b.value,fk).value,"f")}return b}),"f")),em(this,a7,"f")}constructor(...a){let b;if(b6.isBufferSource(a[0])?b=b6.toArrayBuffer(a[0]):"string"==typeof a[0]?b=ek.serialize(new fN({userCertificate:km(a[0]),revocationDate:new fH(a[1]),crlEntryExtensions:a[2]})):a[0]instanceof fN&&(b=a[0]),!b)throw TypeError("Cannot create X509CrlEntry instance. Wrong constructor arguments.");super(b,fN),a3.set(this,void 0),a4.set(this,void 0),a5.set(this,void 0),a6.set(this,void 0),a7.set(this,void 0)}onInit(a){}}a3=new WeakMap,a4=new WeakMap,a5=new WeakMap,a6=new WeakMap,a7=new WeakMap;class ko extends jR{get version(){return this.asn.tbsCertList.version}get signatureAlgorithm(){if(!em(this,ba,"f")){let a=h3.resolve(iT);en(this,ba,a.toWebAlgorithm(this.asn.signatureAlgorithm),"f")}return em(this,ba,"f")}get signature(){return this.asn.signature}get issuer(){return this.issuerName.toString()}get issuerName(){return em(this,bb,"f")||en(this,bb,new jB(this.asn.tbsCertList.issuer),"f"),em(this,bb,"f")}get thisUpdate(){if(!em(this,bc,"f")){let a=this.asn.tbsCertList.thisUpdate.getTime();if(!a)throw Error("Cannot get 'thisUpdate' value");en(this,bc,a,"f")}return em(this,bc,"f")}get nextUpdate(){var a;return void 0===em(this,bd,"f")&&en(this,bd,(null==(a=this.asn.tbsCertList.nextUpdate)?void 0:a.getTime())||void 0,"f"),em(this,bd,"f")}get entries(){var a;return em(this,be,"f")||en(this,be,(null==(a=this.asn.tbsCertList.revokedCertificates)?void 0:a.map(a=>new kn(a)))||[],"f"),em(this,be,"f")}get extensions(){return!em(this,bf,"f")&&(en(this,bf,[],"f"),this.asn.tbsCertList.crlExtensions&&en(this,bf,this.asn.tbsCertList.crlExtensions.map(a=>jZ.create(ek.serialize(a))),"f")),em(this,bf,"f")}get tbs(){return em(this,a9,"f")||en(this,a9,this.asn.tbsCertListRaw||ek.serialize(this.asn.tbsCertList),"f"),em(this,a9,"f")}get tbsCertListSignatureAlgorithm(){return this.asn.tbsCertList.signature}get certListSignatureAlgorithm(){return this.asn.signatureAlgorithm}constructor(a){super(a,jR.isAsnEncoded(a)?fP:void 0),this.tag=jQ.CrlTag,a9.set(this,void 0),ba.set(this,void 0),bb.set(this,void 0),bc.set(this,void 0),bd.set(this,void 0),be.set(this,void 0),bf.set(this,void 0)}onInit(a){}getExtension(a){for(let b of this.extensions)if("string"==typeof a){if(b.type===a)return b}else if(b instanceof a)return b;return null}getExtensions(a){return this.extensions.filter(b=>"string"==typeof a?b.type===a:b instanceof a)}async verify(a,b=jw.get()){let c,d;if(!this.certListSignatureAlgorithm.isEqual(this.tbsCertListSignatureAlgorithm))throw Error("algorithm identifier in the sequence tbsCertList and CertificateList mismatch");let e=a.publicKey;try{e instanceof kj?(c={...e.publicKey.algorithm,...e.signatureAlgorithm},d=await e.publicKey.export(c,["verify"])):e instanceof jS?(c={...e.algorithm,...this.signatureAlgorithm},d=await e.export(c,["verify"])):(c={...e.algorithm,...this.signatureAlgorithm},d=e)}catch{return!1}let f=h3.resolveAll(j8).reverse(),g=null;for(let a of f)if(g=a.toWebSignature(c,this.signature))break;if(!g)throw Error("Cannot convert ASN.1 signature value to WebCrypto format");return await b.subtle.verify(this.signatureAlgorithm,d,g,this.tbs)}async getThumbprint(...a){let b,c="SHA-1";return a[0]&&(a[0].subtle?b=a[0]:(c=a[0]||c,b=a[1])),null!=b||(b=jw.get()),await b.subtle.digest(c,this.rawData)}findRevoked(a){let b=km("string"==typeof a?a:a.serialNumber);for(let a of this.asn.tbsCertList.revokedCertificates||[])if(b6.isEqual(a.userCertificate,b))return new kn(ek.serialize(a));return null}}function kp(a){return kq.stubThis(a)}a9=new WeakMap,ba=new WeakMap,bb=new WeakMap,bc=new WeakMap,bd=new WeakMap,be=new WeakMap,bf=new WeakMap,jZ.register(eP,jU),jZ.register(fa,jV),jZ.register(fn,jW),jZ.register(fz,jX),jZ.register(eM,jT),jZ.register(fv,jY),jZ.register(e1,j_),jZ.register(eJ,j0),jZ.register(fl,j3),j7.register(ip,j5),j7.register(iq,j6),h3.registerSingleton(j8,j9),h3.registerSingleton(j8,kc),kc.namedCurveSize.set("P-256",32),kc.namedCurveSize.set("K-256",32),kc.namedCurveSize.set("P-384",48),kc.namedCurveSize.set("P-521",66);let kq={stubThis:a=>globalThis.fetch(a)},kr={};async function ks(a){let b,c,d,e,f,g,{extensions:h}=a;if(!h)return!1;if(h.forEach(a=>{a instanceof jT?b=a:a instanceof jX?c=a:a instanceof j_&&(d=a)}),b&&b.keyId?g=b.keyId:c&&(g=c.keyId),g){let b=kr[g];if(b){let c=new Date;if(!b.nextUpdate||b.nextUpdate>c)return b.revokedCerts.indexOf(a.serialNumber)>=0}}let i=d?.distributionPoints?.[0].distributionPoint?.fullName?.[0].uniformResourceIdentifier;if(!i)return!1;try{let a=await kp(i);e=await a.arrayBuffer()}catch(a){return!1}try{f=new ko(e)}catch(a){return!1}let j={revokedCerts:[],nextUpdate:void 0};f.nextUpdate&&(j.nextUpdate=f.nextUpdate);let k=f.entries;if(k){for(let a of k){let b=a.serialNumber;j.revokedCerts.push(b)}return g&&(kr[g]=j),j.revokedCerts.indexOf(a.serialNumber)>=0}return!1}function kt(a){let b,c,d,e,f;if(a.byteLength<37)throw Error(`Authenticator data was ${a.byteLength} bytes, expected at least 37 bytes`);let g=0,h=kU(a),i=a.slice(g,g+=32),j=a.slice(g,g+=1),k=j[0],l={up:!!(1&k),uv:!!(4&k),be:!!(8&k),bs:!!(16&k),at:!!(64&k),ed:!!(128&k),flagsInt:k},m=a.slice(g,g+4),n=h.getUint32(g,!1);if(g+=4,l.at){b=a.slice(g,g+=16);let e=h.getUint16(g);g+=2,c=a.slice(g,g+=e);let f=function(a){if(!a)return Uint8Array.from([]);if(!(0!==a.length&&a.length%2==0&&!/[^a-fA-F0-9]/u.test(a)))throw Error("Invalid hex string");let b=a.match(/.{1,2}/g)??[];return Uint8Array.from(b.map(a=>parseInt(a,16)))}("a301634f4b500327206745643235353139"),i=a.slice(g,g+f.byteLength),j=!1;kQ(f,i)&&(j=!0,a[g]=164);let k=bI(a.slice(g)),l=Uint8Array.from(bJ(k));j&&(a[g]=163),d=l,g+=l.byteLength}if(l.ed){let b=bI(a.slice(g));e=function(a){let b;try{b=bI(a)}catch(a){throw Error(`Error decoding authenticator extensions: ${a.message}`)}return function a(b){let c={};for(let[d,e]of b)e instanceof Map?c[d]=a(e):c[d]=e;return c}(b)}(f=Uint8Array.from(bJ(b))),g+=f.byteLength}if(a.byteLength>g)throw Error("Leftover bytes detected while parsing authenticator data");return ku.stubThis({rpIdHash:i,flagsBuf:j,flags:l,counter:n,counterBuf:m,aaguid:b,credentialID:c,credentialPublicKey:d,extensionsData:e,extensionsDataBuffer:f})}let ku={stubThis:a=>a};function kv(a,b=-7){return"string"==typeof a&&(a=kT(a)),bS(a,b)}async function kw(a,b=[]){if(0===b.length)return!0;let c=a.map(a=>new kj(a));for(let b=0;b<c.length;b++){let d=c[b],e=a[b];try{await kx(d)}catch(a){throw Error(`Found revoked certificate in x5c:
6
+ ${e}`)}try{ky(d.notBefore,d.notAfter)}catch(a){throw Error(`Found certificate out of validity period in x5c:
7
+ ${e}`)}}let d=b.map(a=>{try{return new kj(a)}catch(b){throw Error(`Could not parse trust anchor certificate:
8
+ ${a}`,{cause:b})}}),e=[];for(let a=0;a<d.length;a++){let b=d[a];try{await kx(b)}catch(a){continue}try{ky(b.notBefore,b.notAfter)}catch(a){continue}e.push(b)}if(0===e.length)throw Error("No specified trust anchor was valid for verifying x5c");let f=!0;for(let a of e)try{let b=c.concat([a]),d=new Set(b.map(a=>a.toString("pem"))).size;if(d!==b.length)throw Error("Invalid certificate path: found duplicate certificates");let e=c[0],g=[];c.length>1&&(g=c.slice(1));let h=new kl({certificates:[...g,a]}),i=await h.build(e);if(i.length<d||i[i.length-1].subject!==a.subject)continue;f=!1;break}catch(a){throw Error("Unexpected error while validating certificate path",{cause:a})}if(f)throw new kz;return!0}async function kx(a){if(await ks(a))throw Error("Found revoked certificate in certificate path")}function ky(a,b){let c=new Date(Date.now());if(a>c||b<c)throw Error("Certificate is not yet valid or expired")}class kz extends Error{constructor(){super("x5c could not be chained to any specified trust anchor"),this.name="InvalidX5CChain"}}function kA(a){let b;if("1.2.840.10045.4.3.2"===a)b=G.ES256;else if("1.2.840.10045.4.3.3"===a)b=G.ES384;else if("1.2.840.10045.4.3.4"===a)b=G.ES512;else if("1.2.840.113549.1.1.11"===a)b=G.RS256;else if("1.2.840.113549.1.1.12"===a)b=G.RS384;else if("1.2.840.113549.1.1.13"===a)b=G.RS512;else if("1.2.840.113549.1.1.5"===a)b=G.RS1;else throw Error(`Unable to map X.509 signature algorithm ${a} to a COSE algorithm`);return b}function kB(a){let b=new Map,{tbsCertificate:c}=eh.parse(a,fM),{subjectPublicKeyInfo:d,signature:e}=c,f=e.algorithm,g=d.algorithm.algorithm;if(g===gX){let a,c;if(!d.algorithm.parameters)throw Error("Certificate public key was missing parameters (EC2)");let e=eh.parse(new Uint8Array(d.algorithm.parameters),hd),g=-999,{namedCurve:h}=e;if(h===g1)g=F.P256;else if(h===g2)g=F.P384;else throw Error(`Certificate public key contained unexpected namedCurve ${h} (EC2)`);let i=new Uint8Array(d.subjectPublicKey);if(4===i[0]){let b=1,d=(i.length-1)/2;a=i.slice(b,b+=d),c=i.slice(b)}else throw Error('TODO: Figure out how to handle public keys in "compressed form"');let j=new Map;j.set(D.kty,E.EC2),j.set(D.alg,kA(f)),j.set(D.crv,g),j.set(D.x,a),j.set(D.y,c),b=j}else if(g===hh){let a=eh.parse(d.subjectPublicKey,hK),c=new Map;c.set(D.kty,E.RSA),c.set(D.alg,kA(f)),c.set(D.n,new Uint8Array(a.modulus)),c.set(D.e,new Uint8Array(a.publicExponent)),b=c}else throw Error(`Certificate public key contained unexpected algorithm ID ${g}`);return b}function kC(a){let{signature:b,data:c,credentialPublicKey:d,x509Certificate:e,hashAlgorithm:f}=a;if(!e&&!d)throw Error('Must declare either "leafCert" or "credentialPublicKey"');if(e&&d)throw Error('Must not declare both "leafCert" and "credentialPublicKey"');let g=new Map;return d?g=b2(d):e&&(g=kB(e)),kD.stubThis(function(a){let b,{cosePublicKey:c,signature:d,data:e,shaHashOverride:f}=a;if(bK(c)){let a,b,g,h,i=c.get(D.crv);if(!(Object.values(F).indexOf(i)>=0))throw Error(`unknown COSE curve ${i}`);return bV({cosePublicKey:c,signature:(b=new Uint8Array((a=eh.parse(d,hf)).r),g=new Uint8Array(a.s),kS([kP(b,h=function(a){switch(a){case F.P256:return 32;case F.P384:return 48;case F.P521:return 66;default:throw Error(`Unexpected COSE crv value of ${a} (EC2)`)}}(i)),kP(g,h)])),data:e,shaHashOverride:f})}if(bL(c))return bX({cosePublicKey:c,signature:d,data:e,shaHashOverride:f});if(bM(b=c.get(D.kty))&&b===E.OKP)return kO({cosePublicKey:c,signature:d,data:e});let g=c.get(D.kty);throw Error(`Signature verification with public key of kty ${g} is not supported by this method`)}({cosePublicKey:g,signature:b,data:c,shaHashOverride:f}))}let kD={stubThis:a=>a},kE=`-----BEGIN CERTIFICATE-----
9
+ MIIDdTCCAl2gAwIBAgILBAAAAAABFUtaw5QwDQYJKoZIhvcNAQEFBQAwVzELMAkG
10
+ A1UEBhMCQkUxGTAXBgNVBAoTEEdsb2JhbFNpZ24gbnYtc2ExEDAOBgNVBAsTB1Jv
11
+ b3QgQ0ExGzAZBgNVBAMTEkdsb2JhbFNpZ24gUm9vdCBDQTAeFw05ODA5MDExMjAw
12
+ MDBaFw0yODAxMjgxMjAwMDBaMFcxCzAJBgNVBAYTAkJFMRkwFwYDVQQKExBHbG9i
13
+ YWxTaWduIG52LXNhMRAwDgYDVQQLEwdSb290IENBMRswGQYDVQQDExJHbG9iYWxT
14
+ aWduIFJvb3QgQ0EwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDaDuaZ
15
+ jc6j40+Kfvvxi4Mla+pIH/EqsLmVEQS98GPR4mdmzxzdzxtIK+6NiY6arymAZavp
16
+ xy0Sy6scTHAHoT0KMM0VjU/43dSMUBUc71DuxC73/OlS8pF94G3VNTCOXkNz8kHp
17
+ 1Wrjsok6Vjk4bwY8iGlbKk3Fp1S4bInMm/k8yuX9ifUSPJJ4ltbcdG6TRGHRjcdG
18
+ snUOhugZitVtbNV4FpWi6cgKOOvyJBNPc1STE4U6G7weNLWLBYy5d4ux2x8gkasJ
19
+ U26Qzns3dLlwR5EiUWMWea6xrkEmCMgZK9FGqkjWZCrXgzT/LCrBbBlDSgeF59N8
20
+ 9iFo7+ryUp9/k5DPAgMBAAGjQjBAMA4GA1UdDwEB/wQEAwIBBjAPBgNVHRMBAf8E
21
+ BTADAQH/MB0GA1UdDgQWBBRge2YaRQ2XyolQL30EzTSo//z9SzANBgkqhkiG9w0B
22
+ AQUFAAOCAQEA1nPnfE920I2/7LqivjTFKDK1fPxsnCwrvQmeU79rXqoRSLblCKOz
23
+ yj1hTdNGCbM+w6DjY1Ub8rrvrTnhQ7k4o+YviiY776BQVvnGCv04zcQLcFGUl5gE
24
+ 38NflNUVyRRBnMRddWQVDf9VMOyGj/8N7yy5Y0b2qvzfvGn9LhJIZJrglfCm7ymP
25
+ AbEVtQwdpf5pLGkkeB6zpxxxYu7KyJesF12KwvhHhm4qxFYxldBniYUr+WymXUad
26
+ DKqC5JlR3XC321Y9YeRq4VzW9v493kHMB65jUr9TU/Qr6cf9tveCX4XSQRjbgbME
27
+ HMUfpIBvFSDJ3gyICh3WZlXi/EjJKSZp4A==
28
+ -----END CERTIFICATE-----
29
+ `,kF=`-----BEGIN CERTIFICATE-----
30
+ MIIFYDCCA0igAwIBAgIJAOj6GWMU0voYMA0GCSqGSIb3DQEBCwUAMBsxGTAXBgNV
31
+ BAUTEGY5MjAwOWU4NTNiNmIwNDUwHhcNMTYwNTI2MTYyODUyWhcNMjYwNTI0MTYy
32
+ ODUyWjAbMRkwFwYDVQQFExBmOTIwMDllODUzYjZiMDQ1MIICIjANBgkqhkiG9w0B
33
+ AQEFAAOCAg8AMIICCgKCAgEAr7bHgiuxpwHsK7Qui8xUFmOr75gvMsd/dTEDDJdS
34
+ Sxtf6An7xyqpRR90PL2abxM1dEqlXnf2tqw1Ne4Xwl5jlRfdnJLmN0pTy/4lj4/7
35
+ tv0Sk3iiKkypnEUtR6WfMgH0QZfKHM1+di+y9TFRtv6y//0rb+T+W8a9nsNL/ggj
36
+ nar86461qO0rOs2cXjp3kOG1FEJ5MVmFmBGtnrKpa73XpXyTqRxB/M0n1n/W9nGq
37
+ C4FSYa04T6N5RIZGBN2z2MT5IKGbFlbC8UrW0DxW7AYImQQcHtGl/m00QLVWutHQ
38
+ oVJYnFPlXTcHYvASLu+RhhsbDmxMgJJ0mcDpvsC4PjvB+TxywElgS70vE0XmLD+O
39
+ JtvsBslHZvPBKCOdT0MS+tgSOIfga+z1Z1g7+DVagf7quvmag8jfPioyKvxnK/Eg
40
+ sTUVi2ghzq8wm27ud/mIM7AY2qEORR8Go3TVB4HzWQgpZrt3i5MIlCaY504LzSRi
41
+ igHCzAPlHws+W0rB5N+er5/2pJKnfBSDiCiFAVtCLOZ7gLiMm0jhO2B6tUXHI/+M
42
+ RPjy02i59lINMRRev56GKtcd9qO/0kUJWdZTdA2XoS82ixPvZtXQpUpuL12ab+9E
43
+ aDK8Z4RHJYYfCT3Q5vNAXaiWQ+8PTWm2QgBR/bkwSWc+NpUFgNPN9PvQi8WEg5Um
44
+ AGMCAwEAAaOBpjCBozAdBgNVHQ4EFgQUNmHhAHyIBQlRi0RsR/8aTMnqTxIwHwYD
45
+ VR0jBBgwFoAUNmHhAHyIBQlRi0RsR/8aTMnqTxIwDwYDVR0TAQH/BAUwAwEB/zAO
46
+ BgNVHQ8BAf8EBAMCAYYwQAYDVR0fBDkwNzA1oDOgMYYvaHR0cHM6Ly9hbmRyb2lk
47
+ Lmdvb2dsZWFwaXMuY29tL2F0dGVzdGF0aW9uL2NybC8wDQYJKoZIhvcNAQELBQAD
48
+ ggIBACDIw41L3KlXG0aMiS//cqrG+EShHUGo8HNsw30W1kJtjn6UBwRM6jnmiwfB
49
+ Pb8VA91chb2vssAtX2zbTvqBJ9+LBPGCdw/E53Rbf86qhxKaiAHOjpvAy5Y3m00m
50
+ qC0w/Zwvju1twb4vhLaJ5NkUJYsUS7rmJKHHBnETLi8GFqiEsqTWpG/6ibYCv7rY
51
+ DBJDcR9W62BW9jfIoBQcxUCUJouMPH25lLNcDc1ssqvC2v7iUgI9LeoM1sNovqPm
52
+ QUiG9rHli1vXxzCyaMTjwftkJLkf6724DFhuKug2jITV0QkXvaJWF4nUaHOTNA4u
53
+ JU9WDvZLI1j83A+/xnAJUucIv/zGJ1AMH2boHqF8CY16LpsYgBt6tKxxWH00XcyD
54
+ CdW2KlBCeqbQPcsFmWyWugxdcekhYsAWyoSf818NUsZdBWBaR/OukXrNLfkQ79Iy
55
+ ZohZbvabO/X+MVT3rriAoKc8oE2Uws6DF+60PV7/WIPjNvXySdqspImSN78mflxD
56
+ qwLqRBYkA3I75qppLGG9rp7UCdRjxMl8ZDBld+7yvHVgt1cVzJx9xnyGCC23Uaic
57
+ MDSXYrB4I4WHXPGjxhZuCuPBLTdOLU8YRvMYdEvYebWHMpvwGCF6bAx3JBpIeOQ1
58
+ wDB5y0USicV3YgYGmi+NZfhA4URSh77Yd6uuJOJENRaNVTzk
59
+ -----END CERTIFICATE-----
60
+ `,kG=`-----BEGIN CERTIFICATE-----
61
+ MIIFHDCCAwSgAwIBAgIJANUP8luj8tazMA0GCSqGSIb3DQEBCwUAMBsxGTAXBgNV
62
+ BAUTEGY5MjAwOWU4NTNiNmIwNDUwHhcNMTkxMTIyMjAzNzU4WhcNMzQxMTE4MjAz
63
+ NzU4WjAbMRkwFwYDVQQFExBmOTIwMDllODUzYjZiMDQ1MIICIjANBgkqhkiG9w0B
64
+ AQEFAAOCAg8AMIICCgKCAgEAr7bHgiuxpwHsK7Qui8xUFmOr75gvMsd/dTEDDJdS
65
+ Sxtf6An7xyqpRR90PL2abxM1dEqlXnf2tqw1Ne4Xwl5jlRfdnJLmN0pTy/4lj4/7
66
+ tv0Sk3iiKkypnEUtR6WfMgH0QZfKHM1+di+y9TFRtv6y//0rb+T+W8a9nsNL/ggj
67
+ nar86461qO0rOs2cXjp3kOG1FEJ5MVmFmBGtnrKpa73XpXyTqRxB/M0n1n/W9nGq
68
+ C4FSYa04T6N5RIZGBN2z2MT5IKGbFlbC8UrW0DxW7AYImQQcHtGl/m00QLVWutHQ
69
+ oVJYnFPlXTcHYvASLu+RhhsbDmxMgJJ0mcDpvsC4PjvB+TxywElgS70vE0XmLD+O
70
+ JtvsBslHZvPBKCOdT0MS+tgSOIfga+z1Z1g7+DVagf7quvmag8jfPioyKvxnK/Eg
71
+ sTUVi2ghzq8wm27ud/mIM7AY2qEORR8Go3TVB4HzWQgpZrt3i5MIlCaY504LzSRi
72
+ igHCzAPlHws+W0rB5N+er5/2pJKnfBSDiCiFAVtCLOZ7gLiMm0jhO2B6tUXHI/+M
73
+ RPjy02i59lINMRRev56GKtcd9qO/0kUJWdZTdA2XoS82ixPvZtXQpUpuL12ab+9E
74
+ aDK8Z4RHJYYfCT3Q5vNAXaiWQ+8PTWm2QgBR/bkwSWc+NpUFgNPN9PvQi8WEg5Um
75
+ AGMCAwEAAaNjMGEwHQYDVR0OBBYEFDZh4QB8iAUJUYtEbEf/GkzJ6k8SMB8GA1Ud
76
+ IwQYMBaAFDZh4QB8iAUJUYtEbEf/GkzJ6k8SMA8GA1UdEwEB/wQFMAMBAf8wDgYD
77
+ VR0PAQH/BAQDAgIEMA0GCSqGSIb3DQEBCwUAA4ICAQBOMaBc8oumXb2voc7XCWnu
78
+ XKhBBK3e2KMGz39t7lA3XXRe2ZLLAkLM5y3J7tURkf5a1SutfdOyXAmeE6SRo83U
79
+ h6WszodmMkxK5GM4JGrnt4pBisu5igXEydaW7qq2CdC6DOGjG+mEkN8/TA6p3cno
80
+ L/sPyz6evdjLlSeJ8rFBH6xWyIZCbrcpYEJzXaUOEaxxXxgYz5/cTiVKN2M1G2ok
81
+ QBUIYSY6bjEL4aUN5cfo7ogP3UvliEo3Eo0YgwuzR2v0KR6C1cZqZJSTnghIC/vA
82
+ D32KdNQ+c3N+vl2OTsUVMC1GiWkngNx1OO1+kXW+YTnnTUOtOIswUP/Vqd5SYgAI
83
+ mMAfY8U9/iIgkQj6T2W6FsScy94IN9fFhE1UtzmLoBIuUFsVXJMTz+Jucth+IqoW
84
+ Fua9v1R93/k98p41pjtFX+H8DslVgfP097vju4KDlqN64xV1grw3ZLl4CiOe/A91
85
+ oeLm2UHOq6wn3esB4r2EIQKb6jTVGu5sYCcdWpXr0AUVqcABPdgL+H7qJguBw09o
86
+ jm6xNIrw2OocrDKsudk/okr/AwqEyPKw9WnMlQgLIKw1rODG2NvU9oR3GVGdMkUB
87
+ ZutL8VuFkERQGt6vQ2OCw0sV47VMkuYbacK/xyZFiRcrPJPb41zgbQj9XAEyLKCH
88
+ ex0SdDrx+tWUDqG8At2JHA==
89
+ -----END CERTIFICATE-----
90
+ `,kH=`
91
+ -----BEGIN CERTIFICATE-----
92
+ MIIFHDCCAwSgAwIBAgIJAMNrfES5rhgxMA0GCSqGSIb3DQEBCwUAMBsxGTAXBgNV
93
+ BAUTEGY5MjAwOWU4NTNiNmIwNDUwHhcNMjExMTE3MjMxMDQyWhcNMzYxMTEzMjMx
94
+ MDQyWjAbMRkwFwYDVQQFExBmOTIwMDllODUzYjZiMDQ1MIICIjANBgkqhkiG9w0B
95
+ AQEFAAOCAg8AMIICCgKCAgEAr7bHgiuxpwHsK7Qui8xUFmOr75gvMsd/dTEDDJdS
96
+ Sxtf6An7xyqpRR90PL2abxM1dEqlXnf2tqw1Ne4Xwl5jlRfdnJLmN0pTy/4lj4/7
97
+ tv0Sk3iiKkypnEUtR6WfMgH0QZfKHM1+di+y9TFRtv6y//0rb+T+W8a9nsNL/ggj
98
+ nar86461qO0rOs2cXjp3kOG1FEJ5MVmFmBGtnrKpa73XpXyTqRxB/M0n1n/W9nGq
99
+ C4FSYa04T6N5RIZGBN2z2MT5IKGbFlbC8UrW0DxW7AYImQQcHtGl/m00QLVWutHQ
100
+ oVJYnFPlXTcHYvASLu+RhhsbDmxMgJJ0mcDpvsC4PjvB+TxywElgS70vE0XmLD+O
101
+ JtvsBslHZvPBKCOdT0MS+tgSOIfga+z1Z1g7+DVagf7quvmag8jfPioyKvxnK/Eg
102
+ sTUVi2ghzq8wm27ud/mIM7AY2qEORR8Go3TVB4HzWQgpZrt3i5MIlCaY504LzSRi
103
+ igHCzAPlHws+W0rB5N+er5/2pJKnfBSDiCiFAVtCLOZ7gLiMm0jhO2B6tUXHI/+M
104
+ RPjy02i59lINMRRev56GKtcd9qO/0kUJWdZTdA2XoS82ixPvZtXQpUpuL12ab+9E
105
+ aDK8Z4RHJYYfCT3Q5vNAXaiWQ+8PTWm2QgBR/bkwSWc+NpUFgNPN9PvQi8WEg5Um
106
+ AGMCAwEAAaNjMGEwHQYDVR0OBBYEFDZh4QB8iAUJUYtEbEf/GkzJ6k8SMB8GA1Ud
107
+ IwQYMBaAFDZh4QB8iAUJUYtEbEf/GkzJ6k8SMA8GA1UdEwEB/wQFMAMBAf8wDgYD
108
+ VR0PAQH/BAQDAgIEMA0GCSqGSIb3DQEBCwUAA4ICAQBTNNZe5cuf8oiq+jV0itTG
109
+ zWVhSTjOBEk2FQvh11J3o3lna0o7rd8RFHnN00q4hi6TapFhh4qaw/iG6Xg+xOan
110
+ 63niLWIC5GOPFgPeYXM9+nBb3zZzC8ABypYuCusWCmt6Tn3+Pjbz3MTVhRGXuT/T
111
+ QH4KGFY4PhvzAyXwdjTOCXID+aHud4RLcSySr0Fq/L+R8TWalvM1wJJPhyRjqRCJ
112
+ erGtfBagiALzvhnmY7U1qFcS0NCnKjoO7oFedKdWlZz0YAfu3aGCJd4KHT0MsGiL
113
+ Zez9WP81xYSrKMNEsDK+zK5fVzw6jA7cxmpXcARTnmAuGUeI7VVDhDzKeVOctf3a
114
+ 0qQLwC+d0+xrETZ4r2fRGNw2YEs2W8Qj6oDcfPvq9JySe7pJ6wcHnl5EZ0lwc4xH
115
+ 7Y4Dx9RA1JlfooLMw3tOdJZH0enxPXaydfAD3YifeZpFaUzicHeLzVJLt9dvGB0b
116
+ HQLE4+EqKFgOZv2EoP686DQqbVS1u+9k0p2xbMA105TBIk7npraa8VM0fnrRKi7w
117
+ lZKwdH+aNAyhbXRW9xsnODJ+g8eF452zvbiKKngEKirK5LGieoXBX7tZ9D1GNBH2
118
+ Ob3bKOwwIWdEFle/YF/h6zWgdeoaNGDqVBrLr2+0DtWoiB1aDEjLWl9FmyIUyUm7
119
+ mD/vFDkzF+wm7cyWpQpCVQ==
120
+ -----END CERTIFICATE-----
121
+ `,kI=`
122
+ -----BEGIN CERTIFICATE-----
123
+ MIIFHDCCAwSgAwIBAgIJAPHBcqaZ6vUdMA0GCSqGSIb3DQEBCwUAMBsxGTAXBgNV
124
+ BAUTEGY5MjAwOWU4NTNiNmIwNDUwHhcNMjIwMzIwMTgwNzQ4WhcNNDIwMzE1MTgw
125
+ NzQ4WjAbMRkwFwYDVQQFExBmOTIwMDllODUzYjZiMDQ1MIICIjANBgkqhkiG9w0B
126
+ AQEFAAOCAg8AMIICCgKCAgEAr7bHgiuxpwHsK7Qui8xUFmOr75gvMsd/dTEDDJdS
127
+ Sxtf6An7xyqpRR90PL2abxM1dEqlXnf2tqw1Ne4Xwl5jlRfdnJLmN0pTy/4lj4/7
128
+ tv0Sk3iiKkypnEUtR6WfMgH0QZfKHM1+di+y9TFRtv6y//0rb+T+W8a9nsNL/ggj
129
+ nar86461qO0rOs2cXjp3kOG1FEJ5MVmFmBGtnrKpa73XpXyTqRxB/M0n1n/W9nGq
130
+ C4FSYa04T6N5RIZGBN2z2MT5IKGbFlbC8UrW0DxW7AYImQQcHtGl/m00QLVWutHQ
131
+ oVJYnFPlXTcHYvASLu+RhhsbDmxMgJJ0mcDpvsC4PjvB+TxywElgS70vE0XmLD+O
132
+ JtvsBslHZvPBKCOdT0MS+tgSOIfga+z1Z1g7+DVagf7quvmag8jfPioyKvxnK/Eg
133
+ sTUVi2ghzq8wm27ud/mIM7AY2qEORR8Go3TVB4HzWQgpZrt3i5MIlCaY504LzSRi
134
+ igHCzAPlHws+W0rB5N+er5/2pJKnfBSDiCiFAVtCLOZ7gLiMm0jhO2B6tUXHI/+M
135
+ RPjy02i59lINMRRev56GKtcd9qO/0kUJWdZTdA2XoS82ixPvZtXQpUpuL12ab+9E
136
+ aDK8Z4RHJYYfCT3Q5vNAXaiWQ+8PTWm2QgBR/bkwSWc+NpUFgNPN9PvQi8WEg5Um
137
+ AGMCAwEAAaNjMGEwHQYDVR0OBBYEFDZh4QB8iAUJUYtEbEf/GkzJ6k8SMB8GA1Ud
138
+ IwQYMBaAFDZh4QB8iAUJUYtEbEf/GkzJ6k8SMA8GA1UdEwEB/wQFMAMBAf8wDgYD
139
+ VR0PAQH/BAQDAgIEMA0GCSqGSIb3DQEBCwUAA4ICAQB8cMqTllHc8U+qCrOlg3H7
140
+ 174lmaCsbo/bJ0C17JEgMLb4kvrqsXZs01U3mB/qABg/1t5Pd5AORHARs1hhqGIC
141
+ W/nKMav574f9rZN4PC2ZlufGXb7sIdJpGiO9ctRhiLuYuly10JccUZGEHpHSYM2G
142
+ tkgYbZba6lsCPYAAP83cyDV+1aOkTf1RCp/lM0PKvmxYN10RYsK631jrleGdcdkx
143
+ oSK//mSQbgcWnmAEZrzHoF1/0gso1HZgIn0YLzVhLSA/iXCX4QT2h3J5z3znluKG
144
+ 1nv8NQdxei2DIIhASWfu804CA96cQKTTlaae2fweqXjdN1/v2nqOhngNyz1361mF
145
+ mr4XmaKH/ItTwOe72NI9ZcwS1lVaCvsIkTDCEXdm9rCNPAY10iTunIHFXRh+7KPz
146
+ lHGewCq/8TOohBRn0/NNfh7uRslOSZ/xKbN9tMBtw37Z8d2vvnXq/YWdsm1+JLVw
147
+ n6yYD/yacNJBlwpddla8eaVMjsF6nBnIgQOf9zKSe06nSTqvgwUHosgOECZJZ1Eu
148
+ zbH4yswbt02tKtKEFhx+v+OTge/06V+jGsqTWLsfrOCNLuA8H++z+pUENmpqnnHo
149
+ vaI47gC+TNpkgYGkkBT6B/m/U01BuOBBTzhIlMEZq9qkDWuM2cA5kW5V3FJUcfHn
150
+ w1IdYIg2Wxg7yHcQZemFQg==
151
+ -----END CERTIFICATE-----
152
+ `,kJ=`-----BEGIN CERTIFICATE-----
153
+ MIICEjCCAZmgAwIBAgIQaB0BbHo84wIlpQGUKEdXcTAKBggqhkjOPQQDAzBLMR8w
154
+ HQYDVQQDDBZBcHBsZSBXZWJBdXRobiBSb290IENBMRMwEQYDVQQKDApBcHBsZSBJ
155
+ bmMuMRMwEQYDVQQIDApDYWxpZm9ybmlhMB4XDTIwMDMxODE4MjEzMloXDTQ1MDMx
156
+ NTAwMDAwMFowSzEfMB0GA1UEAwwWQXBwbGUgV2ViQXV0aG4gUm9vdCBDQTETMBEG
157
+ A1UECgwKQXBwbGUgSW5jLjETMBEGA1UECAwKQ2FsaWZvcm5pYTB2MBAGByqGSM49
158
+ AgEGBSuBBAAiA2IABCJCQ2pTVhzjl4Wo6IhHtMSAzO2cv+H9DQKev3//fG59G11k
159
+ xu9eI0/7o6V5uShBpe1u6l6mS19S1FEh6yGljnZAJ+2GNP1mi/YK2kSXIuTHjxA/
160
+ pcoRf7XkOtO4o1qlcaNCMEAwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQUJtdk
161
+ 2cV4wlpn0afeaxLQG2PxxtcwDgYDVR0PAQH/BAQDAgEGMAoGCCqGSM49BAMDA2cA
162
+ MGQCMFrZ+9DsJ1PW9hfNdBywZDsWDbWFp28it1d/5w2RPkRX3Bbn/UbDTNLx7Jr3
163
+ jAGGiQIwHFj+dJZYUJR786osByBelJYsVZd2GbHQu209b5RCmGQ21gpSAk9QZW4B
164
+ 1bWeT0vT
165
+ -----END CERTIFICATE-----
166
+ `,kK=`-----BEGIN CERTIFICATE-----
167
+ MIIDXzCCAkegAwIBAgILBAAAAAABIVhTCKIwDQYJKoZIhvcNAQELBQAwTDEgMB4G
168
+ A1UECxMXR2xvYmFsU2lnbiBSb290IENBIC0gUjMxEzARBgNVBAoTCkdsb2JhbFNp
169
+ Z24xEzARBgNVBAMTCkdsb2JhbFNpZ24wHhcNMDkwMzE4MTAwMDAwWhcNMjkwMzE4
170
+ MTAwMDAwWjBMMSAwHgYDVQQLExdHbG9iYWxTaWduIFJvb3QgQ0EgLSBSMzETMBEG
171
+ A1UEChMKR2xvYmFsU2lnbjETMBEGA1UEAxMKR2xvYmFsU2lnbjCCASIwDQYJKoZI
172
+ hvcNAQEBBQADggEPADCCAQoCggEBAMwldpB5BngiFvXAg7aEyiie/QV2EcWtiHL8
173
+ RgJDx7KKnQRfJMsuS+FggkbhUqsMgUdwbN1k0ev1LKMPgj0MK66X17YUhhB5uzsT
174
+ gHeMCOFJ0mpiLx9e+pZo34knlTifBtc+ycsmWQ1z3rDI6SYOgxXG71uL0gRgykmm
175
+ KPZpO/bLyCiR5Z2KYVc3rHQU3HTgOu5yLy6c+9C7v/U9AOEGM+iCK65TpjoWc4zd
176
+ QQ4gOsC0p6Hpsk+QLjJg6VfLuQSSaGjlOCZgdbKfd/+RFO+uIEn8rUAVSNECMWEZ
177
+ XriX7613t2Saer9fwRPvm2L7DWzgVGkWqQPabumDk3F2xmmFghcCAwEAAaNCMEAw
178
+ DgYDVR0PAQH/BAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYEFI/wS3+o
179
+ LkUkrk1Q+mOai97i3Ru8MA0GCSqGSIb3DQEBCwUAA4IBAQBLQNvAUKr+yAzv95ZU
180
+ RUm7lgAJQayzE4aGKAczymvmdLm6AC2upArT9fHxD4q/c2dKg8dEe3jgr25sbwMp
181
+ jjM5RcOO5LlXbKr8EpbsU8Yt5CRsuZRj+9xTaGdWPoO4zzUhw8lo/s7awlOqzJCK
182
+ 6fBdRoyV3XpYKBovHd7NADdBj+1EbddTKJd+82cEHhXXipa0095MJ6RMG3NzdvQX
183
+ mcIfeg7jLQitChws/zyrVQ4PkX4268NXSb7hLi18YIvDQVETI53O9zJrlAGomecs
184
+ Mx86OyXShkDOOyyGeMlhLxS67ttVb9+E7gUJTb0o2HLO02JQZR7rkpeDMdmztcpH
185
+ WD9f
186
+ -----END CERTIFICATE-----
187
+ `;class kL{constructor(){Object.defineProperty(this,"pemCertificates",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.pemCertificates=new Map}setRootCertificates(a){let{identifier:b,certificates:c}=a,d=[];for(let a of c)a instanceof Uint8Array?d.push(bZ(a)):d.push(a);this.pemCertificates.set(b,d)}getRootCertificates(a){let{identifier:b}=a;return this.pemCertificates.get(b)??[]}}let kM=new kL;async function kN(a){let b,c=[JSON.parse(bx((b=a.split("."))[0])),JSON.parse(bx(b[1])),b[2]],d=c[0],e=c[1],f=d.x5c.map(bZ);try{let a=kM.getRootCertificates({identifier:"mds"});await kw(f,a)}catch(a){throw Error("BLOB certificate path could not be validated",{cause:a})}let g=f[0];if(!await function(a,b){let[c,d,e]=a.split("."),f=kB(b),g=kT(`${c}.${d}`),h=bv(e);if(bK(f))return bV({data:g,signature:h,cosePublicKey:f,shaHashOverride:G.ES256});if(bL(f))return bX({data:g,signature:h,cosePublicKey:f});let i=f.get(D.kty);throw Error(`JWT verification with public key of kty ${i} is not supported by this method`)}(a,bv(g.replace("-----BEGIN CERTIFICATE-----","").replace("-----END CERTIFICATE-----","").replace(/[\n ]/g,""),"base64")))throw Error("BLOB signature could not be verified");let h=[];for(let a of e.entries)a.aaguid&&a.metadataStatement&&h.push(a.metadataStatement);let[i,j,k]=e.nextUpdate.split("-");return{statements:h,parsedNextUpdate:new Date(parseInt(i,10),parseInt(j,10)-1,parseInt(k,10)),payload:e}}async function kO(a){let b,{cosePublicKey:c,signature:d,data:e}=a,f=await bP(),g=c.get(D.alg),h=c.get(D.crv),i=c.get(D.x);if(!g)throw Error("Public key was missing alg (OKP)");if(!bN(g))throw Error(`Public key had invalid alg ${g} (OKP)`);if(!h)throw Error("Public key was missing crv (OKP)");if(!i)throw Error("Public key was missing x (OKP)");if(h===F.ED25519)b="Ed25519";else throw Error(`Unexpected COSE crv value of ${h} (OKP)`);let j={kty:"OKP",crv:b,alg:"EdDSA",x:bw(i),ext:!1},k={name:b,namedCurve:b},l=await bU({keyData:j,algorithm:k}),m={name:b};return f.subtle.verify(m,l,d,e)}function kP(a,b){let c;if(a.length<b)(c=new Uint8Array(b)).set(a,b-a.length);else if(a.length===b)c=a;else if(a.length===b+1&&0===a[0]&&(128&a[1])==128)c=a.subarray(1);else throw Error(`Invalid signature component length ${a.length}, expected ${b}`);return c}function kQ(a,b){return a.length==b.length&&a.every((a,c)=>a===b[c])}function kR(a){return Array.from(a,a=>a.toString(16).padStart(2,"0")).join("")}function kS(a){let b=0,c=new Uint8Array(a.reduce((a,b)=>a+b.length,0));return a.forEach(a=>{c.set(a,b),b+=a.length}),c}function kT(a){return new globalThis.TextEncoder().encode(a)}function kU(a){return new DataView(a.buffer,a.byteOffset,a.length)}async function kV(){let a=new Uint8Array(32);return await bT(a),kW.stubThis(a)}kM.setRootCertificates({identifier:"android-key",certificates:[kF,kG,kH,kI]}),kM.setRootCertificates({identifier:"android-safetynet",certificates:[kE]}),kM.setRootCertificates({identifier:"apple",certificates:[kJ]}),kM.setRootCertificates({identifier:"mds",certificates:[kK]});let kW={stubThis:a=>a},kX=[-8,-7,-36,-37,-38,-39,-257,-258,-259,-65535],kY={residentKey:"preferred",userVerification:"preferred"},kZ=[-8,-7,-257];async function k$(a){let{rpName:b,rpID:c,userName:d,userID:e,challenge:f=await kV(),userDisplayName:g="",timeout:h=6e4,attestationType:i="none",excludeCredentials:j=[],authenticatorSelection:k=kY,extensions:l,supportedAlgorithmIDs:m=kZ,preferredAuthenticatorType:n}=a,o=m.map(a=>({alg:a,type:"public-key"}));void 0===k.residentKey?k.requireResidentKey&&(k.residentKey="required"):k.requireResidentKey="required"===k.residentKey;let p=f;if("string"==typeof p&&(p=kT(p)),"string"==typeof e)throw Error("String values for `userID` are no longer supported. See https://simplewebauthn.dev/docs/advanced/server/custom-user-ids");let q=e;q||(q=await b4());let r=[];return n&&("securityKey"===n?(r.push("security-key"),k.authenticatorAttachment="cross-platform"):"localDevice"===n?(r.push("client-device"),k.authenticatorAttachment="platform"):"remoteDevice"===n&&(r.push("hybrid"),k.authenticatorAttachment="cross-platform")),{challenge:bw(p),rp:{name:b,id:c},user:{id:bw(q),name:d,displayName:g},pubKeyCredParams:o,timeout:h,attestation:i,excludeCredentials:j.map(a=>{if(!by(a.id))throw Error(`excludeCredential id "${a.id}" is not a valid base64url string`);return{...a,id:bz(a.id),type:"public-key"}}),authenticatorSelection:k,extensions:{...l,credProps:!0},hints:r}}function k_({be:a,bs:b}){let c="singleDevice";if(a&&(c="multiDevice"),"singleDevice"===c&&b)throw new k0("Single-device credential indicated that it was backed up, which should be impossible.");return{credentialDeviceType:c,credentialBackedUp:b}}class k0 extends Error{constructor(a){super(a),this.name="InvalidBackupFlags"}}async function k1(a,b){try{return await Promise.any(b.map(b=>new Promise((c,d)=>{kv(Uint8Array.from(b.split("").map(a=>a.charCodeAt(0)))).then(e=>{kQ(a,e)?c(b):d()})})))}catch(a){if("AggregateError"===a.name)throw new k2;throw a}}class k2 extends Error{constructor(){super("Unexpected RP ID hash"),this.name="UnexpectedRPIDHash"}}async function k3(a){let{attStmt:b,clientDataHash:c,rpIdHash:d,credentialID:e,credentialPublicKey:f,aaguid:g,rootCertificates:h}=a,i=kS([Uint8Array.from([0]),d,c,e,b$(f)]),j=b.get("sig"),k=b.get("x5c");if(!k)throw Error("No attestation certificate provided in attestation statement (FIDOU2F)");if(!j)throw Error("No attestation signature provided in attestation statement (FIDOU2F)");let l=Number.parseInt(kR(g),16);if(0!==l)throw Error(`AAGUID "${l}" was not expected value`);try{await kw(k.map(bZ),h)}catch(a){throw Error(`${a.message} (FIDOU2F)`)}return kC({signature:j,data:i,x509Certificate:k[0],hashAlgorithm:G.ES256})}let k4="1.3.6.1.4.1.45724.1.1.4";function k5(a,b){if(!a)return!0;let c=a.find(a=>a.extnID===k4);if(!c)return!0;let d=new Uint8Array(eh.parse(c.extnValue,dN).buffer);if(!kQ(b,d)){let a=kR(d),c=kR(b);throw Error(`Certificate extension id-fido-gen-ce-aaguid (${k4}) value of "${a}" was present but not equal to attestation statement AAGUID value of "${c}"`)}return!0}let k6={url:"",no:0,nextUpdate:new Date(0)};(z=bg||(bg={}))[z.DISABLED=0]="DISABLED",z[z.REFRESHING=1]="REFRESHING",z[z.READY=2]="READY";let k7=(a,...b)=>{};class k8{constructor(){Object.defineProperty(this,"mdsCache",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(this,"statementCache",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(this,"state",{enumerable:!0,configurable:!0,writable:!0,value:bg.DISABLED}),Object.defineProperty(this,"verificationMode",{enumerable:!0,configurable:!0,writable:!0,value:"strict"})}async initialize(a={}){this.statementCache={};let{mdsServers:b=["https://mds.fidoalliance.org/"],statements:c,verificationMode:d}=a;if(this.setState(bg.REFRESHING),c?.length){let a=0;c.forEach(b=>{b.aaguid&&(this.statementCache[b.aaguid]={entry:{metadataStatement:b,statusReports:[],timeOfLastStatusChange:"1970-01-01"},url:k6.url},a+=1)}),k7(`Cached ${a} local statements`)}if(b?.length){let a=Object.keys(this.statementCache).length,c=b.length;for(let a of b)try{let b={url:a,no:0,nextUpdate:new Date(0)},c=await this.downloadBlob(b);await this.verifyBlob(c,b)}catch(b){k7(`Could not download BLOB from ${a}:`,b),c-=1}let d=Object.keys(this.statementCache).length;k7(`Cached ${d-a} statements from ${c} metadata server(s)`)}d&&(this.verificationMode=d),this.setState(bg.READY)}async getStatement(a){if(this.state===bg.DISABLED||!a)return;a instanceof Uint8Array&&(a=bY(a)),await this.pauseUntilReady();let b=this.statementCache[a];if(!b){if("strict"===this.verificationMode)throw Error(`No metadata statement found for aaguid "${a}"`);return}if(b.url){let a=this.mdsCache[b.url];if(new Date>a.nextUpdate)try{this.setState(bg.REFRESHING);let b=await this.downloadBlob(a);await this.verifyBlob(b,a)}finally{this.setState(bg.READY)}}let{entry:c}=b;for(let b of c.statusReports){let{status:c}=b;if("USER_VERIFICATION_BYPASS"===c||"ATTESTATION_KEY_COMPROMISE"===c||"USER_KEY_REMOTE_COMPROMISE"===c||"USER_KEY_PHYSICAL_COMPROMISE"===c)throw Error(`Detected compromised aaguid "${a}"`)}return c.metadataStatement}async downloadBlob(a){let{url:b}=a,c=await kp(b);return await c.text()}async verifyBlob(a,b){let{url:c,no:d}=b,{payload:e,parsedNextUpdate:f}=await kN(a);if(e.no<=d)throw Error(`Latest BLOB no. ${e.no} is not greater than previous no. ${d}`);for(let a of e.entries)a.aaguid&&(this.statementCache[a.aaguid]={entry:a,url:c});c?this.mdsCache[c]={...b,no:e.no,nextUpdate:f}:f<new Date&&k7(`⚠️ This MDS blob (serial: ${e.no}) contains stale data as of ${f.toISOString()}. Please consider re-initializing MetadataService with a newer MDS blob.`)}pauseUntilReady(){return new Promise(this.state===bg.READY?a=>{a()}:(a,b)=>{let c=700,d=globalThis.setInterval(()=>{c<1?(clearInterval(d),b("State did not become ready in 70 seconds")):this.state===bg.READY&&(clearInterval(d),a()),c-=1},100)})}setState(a){this.state=a,a===bg.DISABLED?k7("MetadataService is DISABLED"):a===bg.REFRESHING?k7("MetadataService is REFRESHING"):a===bg.READY&&k7("MetadataService is READY")}}let k9=new k8;async function la({statement:a,credentialPublicKey:b,x5c:c,attestationStatementAlg:d}){let{authenticationAlgorithms:e,authenticatorGetInfo:f,attestationRootCertificates:g}=a,h=new Set;e.forEach(a=>{let b=lb[a];b&&h.add(b)});let i=b2(b),j=i.get(D.kty),k=i.get(D.alg);if(!j)throw Error("Credential public key was missing kty");if(!k)throw Error("Credential public key was missing alg");if(!j)throw Error("Credential public key was missing kty");let l={kty:j,alg:k};bK(i)&&(l.crv=i.get(D.crv));let m=!1;for(let a of h)if(a.alg===l.alg&&a.kty===l.kty&&((a.kty===E.EC2||a.kty===E.OKP)&&a.crv===l.crv,m=!0),m)break;if(!m){let a=JSON.stringify(e.map(a=>`'${a}' (COSE info: ${lc(lb[a])})`),null,2).replace(/"/g,""),b=lc(l);throw Error(`Public key parameters ${b} did not match any of the following metadata algorithms:
188
+ ${a}`)}if(void 0!==d&&f?.algorithms!==void 0){let a=f.algorithms.map(a=>a.alg);if(0>a.indexOf(d))throw Error(`Attestation statement alg ${d} did not match one of ${a}`)}let n=c.map(bZ),o=g.map(bZ),p=!1;if(1===n.length&&o.indexOf(n[0])>=0&&(p=!0),!p)try{await kw(n,o)}catch(a){throw Error(`Could not validate certificate path with any metadata root certificates: ${a.message}`)}return!0}let lb={secp256r1_ecdsa_sha256_raw:{kty:2,alg:-7,crv:1},secp256r1_ecdsa_sha256_der:{kty:2,alg:-7,crv:1},rsassa_pss_sha256_raw:{kty:3,alg:-37},rsassa_pss_sha256_der:{kty:3,alg:-37},secp256k1_ecdsa_sha256_raw:{kty:2,alg:-47,crv:8},secp256k1_ecdsa_sha256_der:{kty:2,alg:-47,crv:8},rsassa_pss_sha384_raw:{kty:3,alg:-38},rsassa_pkcsv15_sha256_raw:{kty:3,alg:-257},rsassa_pkcsv15_sha384_raw:{kty:3,alg:-258},rsassa_pkcsv15_sha512_raw:{kty:3,alg:-259},rsassa_pkcsv15_sha1_raw:{kty:3,alg:-65535},secp384r1_ecdsa_sha384_raw:{kty:2,alg:-35,crv:2},secp512r1_ecdsa_sha256_raw:{kty:2,alg:-36,crv:3},ed25519_eddsa_sha512_raw:{kty:1,alg:-8,crv:6}};function lc(a){let{kty:b,alg:c,crv:d}=a;return b!==E.RSA?`{ kty: ${b}, alg: ${c}, crv: ${d} }`:`{ kty: ${b}, alg: ${c} }`}async function ld(a){let{attStmt:b,clientDataHash:c,authData:d,credentialPublicKey:e,aaguid:f,rootCertificates:g}=a,h=b.get("sig"),i=b.get("x5c"),j=b.get("alg");if(!h)throw Error("No attestation signature provided in attestation statement (Packed)");if(!j)throw Error("Attestation statement did not contain alg (Packed)");if(!bN(j))throw Error(`Attestation statement contained invalid alg ${j} (Packed)`);let k=kS([d,c]),l=!1;if(i){let{subject:a,basicConstraintsCA:b,version:c,notBefore:d,notAfter:m,parsedCertificate:n}=fR(i[0]),{OU:o,CN:p,O:q,C:r}=a;if("Authenticator Attestation"!==o)throw Error('Certificate OU was not "Authenticator Attestation" (Packed|Full)');if(!p)throw Error("Certificate CN was empty (Packed|Full)");if(!q)throw Error("Certificate O was empty (Packed|Full)");if(!r||2!==r.length)throw Error("Certificate C was not two-character ISO 3166 code (Packed|Full)");if(b)throw Error("Certificate basic constraints CA was not `false` (Packed|Full)");if(2!==c)throw Error("Certificate version was not `3` (ASN.1 value of 2) (Packed|Full)");let s=new Date;if(d>s)throw Error(`Certificate not good before "${d.toString()}" (Packed|Full)`);if(m<(s=new Date))throw Error(`Certificate not good after "${m.toString()}" (Packed|Full)`);try{await k5(n.tbsCertificate.extensions,f)}catch(a){throw Error(`${a.message} (Packed|Full)`)}let t=await k9.getStatement(f);if(t){if(0>t.attestationTypes.indexOf("basic_full"))throw Error("Metadata does not indicate support for full attestations (Packed|Full)");try{await la({statement:t,credentialPublicKey:e,x5c:i,attestationStatementAlg:j})}catch(a){throw Error(`${a.message} (Packed|Full)`)}}else try{await kw(i.map(bZ),g)}catch(a){throw Error(`${a.message} (Packed|Full)`)}l=await kC({signature:h,data:k,x509Certificate:i[0],hashAlgorithm:j})}else l=await kC({signature:h,data:k,credentialPublicKey:e,hashAlgorithm:j});return l}async function le(a){let{attStmt:b,clientDataHash:c,authData:d,aaguid:e,rootCertificates:f,verifyTimestampMS:g=!0,credentialPublicKey:h,attestationSafetyNetEnforceCTSCheck:i}=a,j=b.get("alg"),k=b.get("response");if(!b.get("ver"))throw Error("No ver value in attestation (SafetyNet)");if(!k)throw Error("No response was included in attStmt by authenticator (SafetyNet)");let l=new globalThis.TextDecoder("utf-8").decode(k).split("."),m=JSON.parse(bx(l[0])),n=JSON.parse(bx(l[1])),o=l[2],{nonce:p,ctsProfileMatch:q,timestampMs:r}=n;if(g){let a=Date.now();if(r>Date.now())throw Error(`Payload timestamp "${r}" was later than "${a}" (SafetyNet)`);let b=r+6e4;if(b<(a=Date.now()))throw Error(`Payload timestamp "${b}" has expired (SafetyNet)`)}let s=kS([d,c]);if(p!==bw(await kv(s),"base64"))throw Error("Could not verify payload nonce (SafetyNet)");if(i&&!q)throw Error("Could not verify device integrity (SafetyNet)");let t=bv(m.x5c[0],"base64"),{subject:u}=fR(t);if("attest.android.com"!==u.CN)throw Error('Certificate common name was not "attest.android.com" (SafetyNet)');let v=await k9.getStatement(e);if(v)try{await la({statement:v,credentialPublicKey:h,x5c:m.x5c,attestationStatementAlg:j})}catch(a){throw Error(`${a.message} (SafetyNet)`)}else try{await kw(m.x5c.map(bZ),f)}catch(a){throw Error(`${a.message} (SafetyNet)`)}let w=kT(`${l[0]}.${l[1]}`),x=bv(o);return await kC({signature:x,data:w,x509Certificate:t,hashAlgorithm:j})}let lf={196:"TPM_ST_RSP_COMMAND",32768:"TPM_ST_NULL",32769:"TPM_ST_NO_SESSIONS",32770:"TPM_ST_SESSIONS",32788:"TPM_ST_ATTEST_NV",32789:"TPM_ST_ATTEST_COMMAND_AUDIT",32790:"TPM_ST_ATTEST_SESSION_AUDIT",32791:"TPM_ST_ATTEST_CERTIFY",32792:"TPM_ST_ATTEST_QUOTE",32793:"TPM_ST_ATTEST_TIME",32794:"TPM_ST_ATTEST_CREATION",32801:"TPM_ST_CREATION",32802:"TPM_ST_VERIFIED",32803:"TPM_ST_AUTH_SECRET",32804:"TPM_ST_HASHCHECK",32805:"TPM_ST_AUTH_SIGNED",32809:"TPM_ST_FU_MANIFEST"},lg={0:"TPM_ALG_ERROR",1:"TPM_ALG_RSA",4:"TPM_ALG_SHA",4:"TPM_ALG_SHA1",5:"TPM_ALG_HMAC",6:"TPM_ALG_AES",7:"TPM_ALG_MGF1",8:"TPM_ALG_KEYEDHASH",10:"TPM_ALG_XOR",11:"TPM_ALG_SHA256",12:"TPM_ALG_SHA384",13:"TPM_ALG_SHA512",16:"TPM_ALG_NULL",18:"TPM_ALG_SM3_256",19:"TPM_ALG_SM4",20:"TPM_ALG_RSASSA",21:"TPM_ALG_RSAES",22:"TPM_ALG_RSAPSS",23:"TPM_ALG_OAEP",24:"TPM_ALG_ECDSA",25:"TPM_ALG_ECDH",26:"TPM_ALG_ECDAA",27:"TPM_ALG_SM2",28:"TPM_ALG_ECSCHNORR",29:"TPM_ALG_ECMQV",32:"TPM_ALG_KDF1_SP800_56A",33:"TPM_ALG_KDF2",34:"TPM_ALG_KDF1_SP800_108",35:"TPM_ALG_ECC",37:"TPM_ALG_SYMCIPHER",38:"TPM_ALG_CAMELLIA",64:"TPM_ALG_CTR",65:"TPM_ALG_OFB",66:"TPM_ALG_CBC",67:"TPM_ALG_CFB",68:"TPM_ALG_ECB"},lh={0:"TPM_ECC_NONE",1:"TPM_ECC_NIST_P192",2:"TPM_ECC_NIST_P224",3:"TPM_ECC_NIST_P256",4:"TPM_ECC_NIST_P384",5:"TPM_ECC_NIST_P521",16:"TPM_ECC_BN_P256",17:"TPM_ECC_BN_P638",32:"TPM_ECC_SM2_P256"},li={"id:414D4400":{name:"AMD",id:"AMD"},"id:414E5400":{name:"Ant Group",id:"ANT"},"id:41544D4C":{name:"Atmel",id:"ATML"},"id:4252434D":{name:"Broadcom",id:"BRCM"},"id:4353434F":{name:"Cisco",id:"CSCO"},"id:464C5953":{name:"Flyslice Technologies",id:"FLYS"},"id:524F4343":{name:"Fuzhou Rockchip",id:"ROCC"},"id:474F4F47":{name:"Google",id:"GOOG"},"id:48504900":{name:"HPI",id:"HPI"},"id:48504500":{name:"HPE",id:"HPE"},"id:48495349":{name:"Huawei",id:"HISI"},"id:49424d00":{name:"IBM",id:"IBM"},"id:49424D00":{name:"IBM",id:"IBM"},"id:49465800":{name:"Infineon",id:"IFX"},"id:494E5443":{name:"Intel",id:"INTC"},"id:4C454E00":{name:"Lenovo",id:"LEN"},"id:4D534654":{name:"Microsoft",id:"MSFT"},"id:4E534D20":{name:"National Semiconductor",id:"NSM"},"id:4E545A00":{name:"Nationz",id:"NTZ"},"id:4E534700":{name:"NSING",id:"NSG"},"id:4E544300":{name:"Nuvoton Technology",id:"NTC"},"id:51434F4D":{name:"Qualcomm",id:"QCOM"},"id:534D534E":{name:"Samsung",id:"SMSN"},"id:53454345":{name:"SecEdge",id:"SECE"},"id:534E5300":{name:"Sinosun",id:"SNS"},"id:534D5343":{name:"SMSC",id:"SMSC"},"id:53544D20":{name:"STMicroelectronics",id:"STM"},"id:54584E00":{name:"Texas Instruments",id:"TXN"},"id:57454300":{name:"Winbond",id:"WEC"},"id:5345414C":{name:"Wisekey",id:"SEAL"},"id:FFFFF1D0":{name:"FIDO Alliance",id:"FIDO"}},lj={TPM_ECC_NIST_P256:1,TPM_ECC_NIST_P384:2,TPM_ECC_NIST_P521:3,TPM_ECC_BN_P256:1,TPM_ECC_SM2_P256:1};async function lk(a){let b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,{aaguid:z,attStmt:A,authData:B,credentialPublicKey:C,clientDataHash:E,rootCertificates:F}=a,H=A.get("ver"),I=A.get("sig"),J=A.get("alg"),K=A.get("x5c"),L=A.get("pubArea"),M=A.get("certInfo");if("2.0"!==H)throw Error(`Unexpected ver "${H}", expected "2.0" (TPM)`);if(!I)throw Error("No attestation signature provided in attestation statement (TPM)");if(!J)throw Error("Attestation statement did not contain alg (TPM)");if(!bN(J))throw Error(`Attestation statement contained invalid alg ${J} (TPM)`);if(!K)throw Error("No attestation certificate provided in attestation statement (TPM)");if(!L)throw Error("Attestation statement did not contain pubArea (TPM)");if(!M)throw Error("Attestation statement did not contain certInfo (TPM)");let{unique:N,type:O,parameters:P}=function(a){let b=0,c=kU(a),d=lg[c.getUint16(b)];b+=2;let e=lg[c.getUint16(b)];b+=2;let f=c.getUint32(b);b+=4;let g=c.getUint16(b);b+=2;let h=a.slice(b,b+=g),i={},j=Uint8Array.from([]);if("TPM_ALG_RSA"===d){let d=lg[c.getUint16(b)];b+=2;let e=lg[c.getUint16(b)];b+=2;let f=c.getUint16(b);b+=2;let g=c.getUint32(b);b+=4,i.rsa={symmetric:d,scheme:e,keyBits:f,exponent:g};let h=c.getUint16(b);b+=2,j=a.slice(b,b+=h)}else if("TPM_ALG_ECC"===d){let d=lg[c.getUint16(b)];b+=2;let e=lg[c.getUint16(b)];b+=2;let f=lh[c.getUint16(b)];b+=2;let g=lg[c.getUint16(b)];b+=2,i.ecc={symmetric:d,scheme:e,curveID:f,kdf:g};let h=c.getUint16(b);b+=2;let k=a.slice(b,b+=h),l=c.getUint16(b);b+=2,j=kS([k,a.slice(b,b+=l)])}else throw Error(`Unexpected type "${d}" (TPM)`);return{type:d,nameAlg:e,objectAttributes:{fixedTPM:!!(1&f),stClear:!!(2&f),fixedParent:!!(8&f),sensitiveDataOrigin:!!(16&f),userWithAuth:!!(32&f),adminWithPolicy:!!(64&f),noDA:!!(512&f),encryptedDuplication:!!(1024&f),restricted:!!(32768&f),decrypt:!!(65536&f),signOrEncrypt:!!(131072&f)},authPolicy:h,parameters:i,unique:j}}(L),Q=b2(C);if("TPM_ALG_RSA"===O){if(!bL(Q))throw Error(`Credential public key with kty ${Q.get(D.kty)} did not match ${O}`);let a=Q.get(D.n),b=Q.get(D.e);if(!a)throw Error("COSE public key missing n (TPM|RSA)");if(!b)throw Error("COSE public key missing e (TPM|RSA)");if(!kQ(N,a))throw Error("PubArea unique is not same as credentialPublicKey (TPM|RSA)");if(!P.rsa)throw Error("Parsed pubArea type is RSA, but missing parameters.rsa (TPM|RSA)");let c=P.rsa.exponent||65537,d=b[0]+(b[1]<<8)+(b[2]<<16);if(c!==d)throw Error(`Unexpected public key exp ${d}, expected ${c} (TPM|RSA)`)}else if("TPM_ALG_ECC"===O){if(!bK(Q))throw Error(`Credential public key with kty ${Q.get(D.kty)} did not match ${O}`);let a=Q.get(D.crv),b=Q.get(D.x),c=Q.get(D.y);if(!a)throw Error("COSE public key missing crv (TPM|ECC)");if(!b)throw Error("COSE public key missing x (TPM|ECC)");if(!c)throw Error("COSE public key missing y (TPM|ECC)");if(!kQ(N,kS([b,c])))throw Error("PubArea unique is not same as public key x and y (TPM|ECC)");if(!P.ecc)throw Error("Parsed pubArea type is ECC, but missing parameters.ecc (TPM|ECC)");let d=P.ecc.curveID,e=lj[d];if(e!==a)throw Error(`Public area key curve ID "${d}" mapped to "${e}" which did not match public key crv of "${a}" (TPM|ECC)`)}else throw Error(`Unsupported pubArea.type "${O}"`);let{magic:R,type:S,attested:T,extraData:U}=(g=0,i=(h=kU(M)).getUint32(g),g+=4,j=h.getUint16(g),g+=2,k=lf[j],l=h.getUint16(g),g+=2,m=M.slice(g,g+=l),n=h.getUint16(g),g+=2,o=M.slice(g,g+=n),p=M.slice(g,g+=8),q=h.getUint32(g),g+=4,r=h.getUint32(g),g+=4,s=!!M.slice(g,g+=1),t=M.slice(g,g+=8),u=h.getUint16(g),g+=2,w=kU(v=M.slice(g,g+=u)),x=h.getUint16(g),g+=2,y=M.slice(g,g+=x),{magic:i,type:k,qualifiedSigner:m,extraData:o,clockInfo:{clock:p,resetCount:q,restartCount:r,safe:s},firmwareVersion:t,attested:{nameAlg:lg[w.getUint16(0)],nameAlgBuffer:v.slice(0,2),name:v,qualifiedName:y}});if(0xff544347!==R)throw Error(`Unexpected magic value "${R}", expected "0xff544347" (TPM)`);if("TPM_ST_ATTEST_CERTIFY"!==S)throw Error(`Unexpected type "${S}", expected "TPM_ST_ATTEST_CERTIFY" (TPM)`);let V=await kv(L,function(a){if("TPM_ALG_SHA256"===a)return G.ES256;if("TPM_ALG_SHA384"===a)return G.ES384;if("TPM_ALG_SHA512"===a)return G.ES512;throw Error(`Unexpected TPM attested name alg ${a}`)}(T.nameAlg)),W=kS([T.nameAlgBuffer,V]);if(!kQ(T.name,W))throw Error("Attested name comparison failed (TPM)");let X=kS([B,E]);if(!kQ(U,await kv(X,J)))throw Error("CertInfo extra data did not equal hashed attestation (TPM)");if(K.length<1)throw Error("No certificates present in x5c array (TPM)");let{basicConstraintsCA:Y,version:Z,subject:$,notAfter:_,notBefore:aa}=fR(K[0]);if(Y)throw Error("Certificate basic constraints CA was not `false` (TPM)");if(2!==Z)throw Error("Certificate version was not `3` (ASN.1 value of 2) (TPM)");if($.combined.length>0)throw Error("Certificate subject was not empty (TPM)");let ab=new Date;if(aa>ab)throw Error(`Certificate not good before "${aa.toString()}" (TPM)`);if(_<(ab=new Date))throw Error(`Certificate not good after "${_.toString()}" (TPM)`);let ac=eh.parse(K[0],fM);if(!ac.tbsCertificate.extensions)throw Error("Certificate was missing extensions (TPM)");if(ac.tbsCertificate.extensions.forEach(a=>{a.extnID===fv?e=eh.parse(a.extnValue,fw):a.extnID===fa&&(f=eh.parse(a.extnValue,fb))}),!e)throw Error("Certificate did not contain subjectAltName extension (TPM)");if(!e[0].directoryName?.[0].length)throw Error("Certificate subjectAltName extension directoryName was empty (TPM)");let{tcgAtTpmManufacturer:ad,tcgAtTpmModel:ae,tcgAtTpmVersion:af}=(e[0].directoryName.forEach(a=>{a.forEach(a=>{"2.23.133.2.1"===a.type?b=a.value.toString():"2.23.133.2.2"===a.type?c=a.value.toString():"2.23.133.2.3"===a.type&&(d=a.value.toString())})}),{tcgAtTpmManufacturer:b,tcgAtTpmModel:c,tcgAtTpmVersion:d});if(!ad||!ae||!af)throw Error("Certificate contained incomplete subjectAltName data (TPM)");if(!f)throw Error("Certificate did not contain ExtendedKeyUsage extension (TPM)");if(!li[ad])throw Error(`Could not match TPM manufacturer "${ad}" (TPM)`);if("2.23.133.8.3"!==f[0])throw Error(`Unexpected extKeyUsage "${f[0]}", expected "2.23.133.8.3" (TPM)`);try{await k5(ac.tbsCertificate.extensions,z)}catch(a){throw Error(`${a.message} (TPM)`)}let ag=await k9.getStatement(z);if(ag)try{await la({statement:ag,credentialPublicKey:C,x5c:K,attestationStatementAlg:J})}catch(a){throw Error(`${a.message} (TPM)`)}else try{await kw(K.map(bZ),F)}catch(a){throw Error(`${a.message} (TPM)`)}return kC({signature:I,data:M,x509Certificate:K[0],hashAlgorithm:J})}(A=bi||(bi={}))[A.verified=0]="verified",A[A.selfSigned=1]="selfSigned",A[A.unverified=2]="unverified",A[A.failed=3]="failed";class ll{verifiedBootKey=new dN;deviceLocked=!1;verifiedBootState=bi.verified;verifiedBootHash;constructor(a={}){Object.assign(this,a)}}el([ef({type:dN})],ll.prototype,"verifiedBootKey",void 0),el([ef({type:K.Boolean})],ll.prototype,"deviceLocked",void 0),el([ef({type:K.Enumerated})],ll.prototype,"verifiedBootState",void 0),el([ef({type:dN,optional:!0})],ll.prototype,"verifiedBootHash",void 0);let lm=bh=class extends ej{constructor(a){super(a),Object.setPrototypeOf(this,bh.prototype)}};lm=bh=el([ee({type:J.Set,itemType:K.Integer})],lm);class ln{purpose;algorithm;keySize;digest;padding;ecCurve;rsaPublicExponent;mgfDigest;rollbackResistance;earlyBootOnly;activeDateTime;originationExpireDateTime;usageExpireDateTime;usageCountLimit;noAuthRequired;userAuthType;authTimeout;allowWhileOnBody;trustedUserPresenceRequired;trustedConfirmationRequired;unlockedDeviceRequired;allApplications;applicationId;creationDateTime;origin;rollbackResistant;rootOfTrust;osVersion;osPatchLevel;attestationApplicationId;attestationIdBrand;attestationIdDevice;attestationIdProduct;attestationIdSerial;attestationIdImei;attestationIdMeid;attestationIdManufacturer;attestationIdModel;vendorPatchLevel;bootPatchLevel;deviceUniqueAttestation;attestationIdSecondImei;moduleHash;constructor(a={}){Object.assign(this,a)}}el([ef({context:1,type:lm,optional:!0})],ln.prototype,"purpose",void 0),el([ef({context:2,type:K.Integer,optional:!0})],ln.prototype,"algorithm",void 0),el([ef({context:3,type:K.Integer,optional:!0})],ln.prototype,"keySize",void 0),el([ef({context:5,type:lm,optional:!0})],ln.prototype,"digest",void 0),el([ef({context:6,type:lm,optional:!0})],ln.prototype,"padding",void 0),el([ef({context:10,type:K.Integer,optional:!0})],ln.prototype,"ecCurve",void 0),el([ef({context:200,type:K.Integer,optional:!0})],ln.prototype,"rsaPublicExponent",void 0),el([ef({context:203,type:lm,optional:!0})],ln.prototype,"mgfDigest",void 0),el([ef({context:303,type:K.Null,optional:!0})],ln.prototype,"rollbackResistance",void 0),el([ef({context:305,type:K.Null,optional:!0})],ln.prototype,"earlyBootOnly",void 0),el([ef({context:400,type:K.Integer,optional:!0})],ln.prototype,"activeDateTime",void 0),el([ef({context:401,type:K.Integer,optional:!0})],ln.prototype,"originationExpireDateTime",void 0),el([ef({context:402,type:K.Integer,optional:!0})],ln.prototype,"usageExpireDateTime",void 0),el([ef({context:405,type:K.Integer,optional:!0})],ln.prototype,"usageCountLimit",void 0),el([ef({context:503,type:K.Null,optional:!0})],ln.prototype,"noAuthRequired",void 0),el([ef({context:504,type:K.Integer,optional:!0})],ln.prototype,"userAuthType",void 0),el([ef({context:505,type:K.Integer,optional:!0})],ln.prototype,"authTimeout",void 0),el([ef({context:506,type:K.Null,optional:!0})],ln.prototype,"allowWhileOnBody",void 0),el([ef({context:507,type:K.Null,optional:!0})],ln.prototype,"trustedUserPresenceRequired",void 0),el([ef({context:508,type:K.Null,optional:!0})],ln.prototype,"trustedConfirmationRequired",void 0),el([ef({context:509,type:K.Null,optional:!0})],ln.prototype,"unlockedDeviceRequired",void 0),el([ef({context:600,type:K.Null,optional:!0})],ln.prototype,"allApplications",void 0),el([ef({context:601,type:dN,optional:!0})],ln.prototype,"applicationId",void 0),el([ef({context:701,type:K.Integer,optional:!0})],ln.prototype,"creationDateTime",void 0),el([ef({context:702,type:K.Integer,optional:!0})],ln.prototype,"origin",void 0),el([ef({context:703,type:K.Null,optional:!0})],ln.prototype,"rollbackResistant",void 0),el([ef({context:704,type:ll,optional:!0})],ln.prototype,"rootOfTrust",void 0),el([ef({context:705,type:K.Integer,optional:!0})],ln.prototype,"osVersion",void 0),el([ef({context:706,type:K.Integer,optional:!0})],ln.prototype,"osPatchLevel",void 0),el([ef({context:709,type:dN,optional:!0})],ln.prototype,"attestationApplicationId",void 0),el([ef({context:710,type:dN,optional:!0})],ln.prototype,"attestationIdBrand",void 0),el([ef({context:711,type:dN,optional:!0})],ln.prototype,"attestationIdDevice",void 0),el([ef({context:712,type:dN,optional:!0})],ln.prototype,"attestationIdProduct",void 0),el([ef({context:713,type:dN,optional:!0})],ln.prototype,"attestationIdSerial",void 0),el([ef({context:714,type:dN,optional:!0})],ln.prototype,"attestationIdImei",void 0),el([ef({context:715,type:dN,optional:!0})],ln.prototype,"attestationIdMeid",void 0),el([ef({context:716,type:dN,optional:!0})],ln.prototype,"attestationIdManufacturer",void 0),el([ef({context:717,type:dN,optional:!0})],ln.prototype,"attestationIdModel",void 0),el([ef({context:718,type:K.Integer,optional:!0})],ln.prototype,"vendorPatchLevel",void 0),el([ef({context:719,type:K.Integer,optional:!0})],ln.prototype,"bootPatchLevel",void 0),el([ef({context:720,type:K.Null,optional:!0})],ln.prototype,"deviceUniqueAttestation",void 0),el([ef({context:723,type:dN,optional:!0})],ln.prototype,"attestationIdSecondImei",void 0),el([ef({context:724,type:dN,optional:!0})],ln.prototype,"moduleHash",void 0),(B=bj||(bj={}))[B.software=0]="software",B[B.trustedEnvironment=1]="trustedEnvironment",B[B.strongBox=2]="strongBox",(C=bk||(bk={}))[C.KM2=1]="KM2",C[C.KM3=2]="KM3",C[C.KM4=3]="KM4",C[C.KM4_1=4]="KM4_1",C[C.keyMint1=100]="keyMint1",C[C.keyMint2=200]="keyMint2",C[C.keyMint3=300]="keyMint3",C[C.keyMint4=400]="keyMint4";class lo{attestationVersion=bk.KM4;attestationSecurityLevel=bj.software;keymasterVersion=0;keymasterSecurityLevel=bj.software;attestationChallenge=new dN;uniqueId=new dN;softwareEnforced=new ln;teeEnforced=new ln;constructor(a={}){Object.assign(this,a)}}el([ef({type:K.Integer})],lo.prototype,"attestationVersion",void 0),el([ef({type:K.Enumerated})],lo.prototype,"attestationSecurityLevel",void 0),el([ef({type:K.Integer})],lo.prototype,"keymasterVersion",void 0),el([ef({type:K.Enumerated})],lo.prototype,"keymasterSecurityLevel",void 0),el([ef({type:dN})],lo.prototype,"attestationChallenge",void 0),el([ef({type:dN})],lo.prototype,"uniqueId",void 0),el([ef({type:ln})],lo.prototype,"softwareEnforced",void 0),el([ef({type:ln})],lo.prototype,"teeEnforced",void 0);class lp{attestationVersion=bk.keyMint4;attestationSecurityLevel=bj.software;keyMintVersion=0;keyMintSecurityLevel=bj.software;attestationChallenge=new dN;uniqueId=new dN;softwareEnforced=new ln;hardwareEnforced=new ln;constructor(a={}){Object.assign(this,a)}toLegacyKeyDescription(){return new lo({attestationVersion:this.attestationVersion,attestationSecurityLevel:this.attestationSecurityLevel,keymasterVersion:this.keyMintVersion,keymasterSecurityLevel:this.keyMintSecurityLevel,attestationChallenge:this.attestationChallenge,uniqueId:this.uniqueId,softwareEnforced:this.softwareEnforced,teeEnforced:this.hardwareEnforced})}static fromLegacyKeyDescription(a){return new lp({attestationVersion:a.attestationVersion,attestationSecurityLevel:a.attestationSecurityLevel,keyMintVersion:a.keymasterVersion,keyMintSecurityLevel:a.keymasterSecurityLevel,attestationChallenge:a.attestationChallenge,uniqueId:a.uniqueId,softwareEnforced:a.softwareEnforced,hardwareEnforced:a.teeEnforced})}}el([ef({type:K.Integer})],lp.prototype,"attestationVersion",void 0),el([ef({type:K.Enumerated})],lp.prototype,"attestationSecurityLevel",void 0),el([ef({type:K.Integer})],lp.prototype,"keyMintVersion",void 0),el([ef({type:K.Enumerated})],lp.prototype,"keyMintSecurityLevel",void 0),el([ef({type:dN})],lp.prototype,"attestationChallenge",void 0),el([ef({type:dN})],lp.prototype,"uniqueId",void 0),el([ef({type:ln})],lp.prototype,"softwareEnforced",void 0),el([ef({type:ln})],lp.prototype,"hardwareEnforced",void 0);let lq=class extends ln{};lq=el([ee({type:J.Choice})],lq);let lr=bl=class extends ej{constructor(a){super(a),Object.setPrototypeOf(this,bl.prototype)}findProperty(a){let b=this.find(b=>void 0!==b[a]);if(b)return b[a]}};lr=bl=el([ee({type:J.Sequence,itemType:lq})],lr);class ls{attestationVersion=bk.KM4;attestationSecurityLevel=bj.software;keymasterVersion=0;keymasterSecurityLevel=bj.software;attestationChallenge=new dN;uniqueId=new dN;softwareEnforced=new lr;teeEnforced=new lr;get keyMintVersion(){return this.keymasterVersion}set keyMintVersion(a){this.keymasterVersion=a}get keyMintSecurityLevel(){return this.keymasterSecurityLevel}set keyMintSecurityLevel(a){this.keymasterSecurityLevel=a}get hardwareEnforced(){return this.teeEnforced}set hardwareEnforced(a){this.teeEnforced=a}constructor(a={}){Object.assign(this,a)}}el([ef({type:K.Integer})],ls.prototype,"attestationVersion",void 0),el([ef({type:K.Enumerated})],ls.prototype,"attestationSecurityLevel",void 0),el([ef({type:K.Integer})],ls.prototype,"keymasterVersion",void 0),el([ef({type:K.Enumerated})],ls.prototype,"keymasterSecurityLevel",void 0),el([ef({type:dN})],ls.prototype,"attestationChallenge",void 0),el([ef({type:dN})],ls.prototype,"uniqueId",void 0),el([ef({type:lr})],ls.prototype,"softwareEnforced",void 0),el([ef({type:lr})],ls.prototype,"teeEnforced",void 0);let lt=class extends ls{constructor(a={}){"keymasterVersion"in a&&!("keyMintVersion"in a)&&(a.keyMintVersion=a.keymasterVersion),"keymasterSecurityLevel"in a&&!("keyMintSecurityLevel"in a)&&(a.keyMintSecurityLevel=a.keymasterSecurityLevel),"teeEnforced"in a&&!("hardwareEnforced"in a)&&(a.hardwareEnforced=a.teeEnforced),super(a)}};lt=el([ee({type:J.Sequence})],lt);class lu{packageName;version;constructor(a={}){Object.assign(this,a)}}el([ef({type:K.OctetString})],lu.prototype,"packageName",void 0),el([ef({type:K.Integer})],lu.prototype,"version",void 0);class lv{packageInfos;signatureDigests;constructor(a={}){Object.assign(this,a)}}async function lw(a){let{authData:b,clientDataHash:c,attStmt:d,credentialPublicKey:e,aaguid:f,rootCertificates:g}=a,h=d.get("x5c"),i=d.get("sig"),j=d.get("alg");if(!h)throw Error("No attestation certificate provided in attestation statement (Android Key)");if(!i)throw Error("No attestation signature provided in attestation statement (Android Key)");if(!j)throw Error("Attestation statement did not contain alg (Android Key)");if(!bN(j))throw Error(`Attestation statement contained invalid alg ${j} (Android Key)`);let k=eh.parse(h[0],fM),l=new Uint8Array(k.tbsCertificate.subjectPublicKeyInfo.subjectPublicKey);if(!kQ(b$(e),l))throw Error("Credential public key does not equal leaf cert public key (Android Key)");let m=k.tbsCertificate.extensions?.find(a=>"1.3.6.1.4.1.11129.2.1.17"===a.extnID);if(!m)throw Error("Certificate did not contain extKeyStore (Android Key)");let{attestationChallenge:n,teeEnforced:o,softwareEnforced:p}=eh.parse(m.extnValue,lo);if(!kQ(new Uint8Array(n.buffer),c))throw Error("Attestation challenge was not equal to client data hash (Android Key)");if(void 0!==o.allApplications||void 0!==p.allApplications)throw Error('teeEnforced contained "allApplications [600]" tag (Android Key)');let q=await k9.getStatement(f);if(q)try{await la({statement:q,credentialPublicKey:e,x5c:h,attestationStatementAlg:j})}catch(a){throw Error(`${a.message} (Android Key)`,{cause:a})}else{let a=h.slice(0,-1).map(bZ),b=h.slice(-1).map(bZ);try{await kw(a,b)}catch(a){throw Error(`${a.message} (Android Key)`,{cause:a})}if(g.length>0&&0>g.indexOf(b[0]))throw Error("x5c root certificate was not a known root certificate (Android Key)")}return kC({signature:i,data:kS([b,c]),x509Certificate:h[0],hashAlgorithm:j})}async function lx(a){let{attStmt:b,authData:c,clientDataHash:d,credentialPublicKey:e,rootCertificates:f}=a,g=b.get("x5c");if(!g)throw Error("No attestation certificate provided in attestation statement (Apple)");try{await kw(g.map(bZ),f)}catch(a){throw Error(`${a.message} (Apple)`)}let{extensions:h,subjectPublicKeyInfo:i}=eh.parse(g[0],fM).tbsCertificate;if(!h)throw Error("credCert missing extensions (Apple)");let j=h.find(a=>"1.2.840.113635.100.8.2"===a.extnID);if(!j)throw Error('credCert missing "1.2.840.113635.100.8.2" extension (Apple)');let k=kS([c,d]);if(!kQ(await kv(k),new Uint8Array(j.extnValue.buffer).slice(6)))throw Error("credCert nonce was not expected value (Apple)");if(!kQ(b$(e),new Uint8Array(i.subjectPublicKey)))throw Error("Credential public key does not equal credCert public key (Apple)");return!0}async function ly(a){let b,{response:c,expectedChallenge:d,expectedOrigin:e,expectedRPID:f,expectedType:g,requireUserPresence:h=!0,requireUserVerification:i=!0,supportedAlgorithmIDs:j=kX,attestationSafetyNetEnforceCTSCheck:k=!0}=a,{id:l,rawId:m,type:n,response:o}=c;if(!l)throw Error("Missing credential ID");if(l!==m)throw Error("Credential ID was not base64url-encoded");if("public-key"!==n)throw Error(`Unexpected credential type ${n}, expected "public-key"`);let p=b0(o.clientDataJSON),{type:q,origin:r,challenge:s,tokenBinding:t}=p;if(Array.isArray(g)){if(!g.includes(q)){let a=g.join(", ");throw Error(`Unexpected registration response type "${q}", expected one of: ${a}`)}}else if(g){if(q!==g)throw Error(`Unexpected registration response type "${q}", expected "${g}"`)}else if("webauthn.create"!==q)throw Error(`Unexpected registration response type: ${q}`);if("function"==typeof d){if(!await d(s))throw Error(`Custom challenge verifier returned false for registration response challenge "${s}"`)}else if(s!==d)throw Error(`Unexpected registration response challenge "${s}", expected "${d}"`);if(Array.isArray(e)){if(!e.includes(r))throw Error(`Unexpected registration response origin "${r}", expected one of: ${e.join(", ")}`)}else if(r!==e)throw Error(`Unexpected registration response origin "${r}", expected "${e}"`);if(t){if("object"!=typeof t)throw Error(`Unexpected value for TokenBinding "${t}"`);if(0>["present","supported","not-supported"].indexOf(t.status))throw Error(`Unexpected tokenBinding.status value of "${t.status}"`)}let u=bv(o.attestationObject),v=b_(bI(u)),w=v.get("fmt"),x=v.get("authData"),y=v.get("attStmt"),{aaguid:z,rpIdHash:A,flags:B,credentialID:C,counter:E,credentialPublicKey:F,extensionsData:G}=kt(x);if(f){let a=[];a="string"==typeof f?[f]:f,b=await k1(A,a)}if(h&&!B.up)throw Error("User presence was required, but user was not present");if(i&&!B.uv)throw Error("User verification was required, but user could not be verified");if(!C)throw Error("No credential ID was provided by authenticator");if(!F)throw Error("No public key was provided by authenticator");if(!z)throw Error("No AAGUID was present during registration");let H=b2(F).get(D.alg);if("number"!=typeof H)throw Error("Credential public key was missing numeric alg");if(!j.includes(H)){let a=j.join(", ");throw Error(`Unexpected public key alg "${H}", expected one of "${a}"`)}let I={aaguid:z,attStmt:y,authData:x,clientDataHash:await kv(bv(o.clientDataJSON)),credentialID:C,credentialPublicKey:F,rootCertificates:kM.getRootCertificates({identifier:w}),rpIdHash:A,attestationSafetyNetEnforceCTSCheck:k},J=!1;if("fido-u2f"===w)J=await k3(I);else if("packed"===w)J=await ld(I);else if("android-safetynet"===w)J=await le(I);else if("android-key"===w)J=await lw(I);else if("tpm"===w)J=await lk(I);else if("apple"===w)J=await lx(I);else if("none"===w){if(y.size>0)throw Error("None attestation had unexpected attestation statement");J=!0}else throw Error(`Unsupported Attestation Format: ${w}`);if(!J)return{verified:!1};let{credentialDeviceType:K,credentialBackedUp:L}=k_(B);return{verified:!0,registrationInfo:{fmt:w,aaguid:bY(z),credentialType:n,credential:{id:bw(C),publicKey:F,counter:E,transports:c.response.transports},attestationObject:u,userVerified:B.uv,credentialDeviceType:K,credentialBackedUp:L,origin:p.origin,rpID:b,authenticatorExtensionResults:G}}}async function lz(a){let{allowCredentials:b,challenge:c=await kV(),timeout:d=6e4,userVerification:e="preferred",extensions:f,rpID:g}=a,h=c;return"string"==typeof h&&(h=kT(h)),{rpId:g,challenge:bw(h),allowCredentials:b?.map(a=>{if(!by(a.id))throw Error(`allowCredential id "${a.id}" is not a valid base64url string`);return{...a,id:bz(a.id),type:"public-key"}}),timeout:d,userVerification:e,extensions:f}}async function lA(a){let{response:b,expectedChallenge:c,expectedOrigin:d,expectedRPID:e,expectedType:f,credential:g,requireUserVerification:h=!0,advancedFIDOConfig:i}=a,{id:j,rawId:k,type:l,response:m}=b;if(!j)throw Error("Missing credential ID");if(j!==k)throw Error("Credential ID was not base64url-encoded");if("public-key"!==l)throw Error(`Unexpected credential type ${l}, expected "public-key"`);if(!b)throw Error("Credential missing response");if("string"!=typeof m?.clientDataJSON)throw Error("Credential response clientDataJSON was not a string");let n=b0(m.clientDataJSON),{type:o,origin:p,challenge:q,tokenBinding:r}=n;if(Array.isArray(f)){if(!f.includes(o)){let a=f.join(", ");throw Error(`Unexpected authentication response type "${o}", expected one of: ${a}`)}}else if(f){if(o!==f)throw Error(`Unexpected authentication response type "${o}", expected "${f}"`)}else if("webauthn.get"!==o)throw Error(`Unexpected authentication response type: ${o}`);if("function"==typeof c){if(!await c(q))throw Error(`Custom challenge verifier returned false for registration response challenge "${q}"`)}else if(q!==c)throw Error(`Unexpected authentication response challenge "${q}", expected "${c}"`);if(Array.isArray(d)){if(!d.includes(p)){let a=d.join(", ");throw Error(`Unexpected authentication response origin "${p}", expected one of: ${a}`)}}else if(p!==d)throw Error(`Unexpected authentication response origin "${p}", expected "${d}"`);if(!by(m.authenticatorData))throw Error("Credential response authenticatorData was not a base64url string");if(!by(m.signature))throw Error("Credential response signature was not a base64url string");if(m.userHandle&&"string"!=typeof m.userHandle)throw Error("Credential response userHandle was not a string");if(r){if("object"!=typeof r)throw Error("ClientDataJSON tokenBinding was not an object");if(0>["present","supported","notSupported"].indexOf(r.status))throw Error(`Unexpected tokenBinding status ${r.status}`)}let s=bv(m.authenticatorData),{rpIdHash:t,flags:u,counter:v,extensionsData:w}=kt(s),x=[];x="string"==typeof e?[e]:e;let y=await k1(t,x);if(void 0!==i){let{userVerification:a}=i;if("required"===a&&!u.uv)throw Error("User verification required, but user could not be verified")}else{if(!u.up)throw Error("User not present during authentication");if(h&&!u.uv)throw Error("User verification required, but user could not be verified")}let z=kS([s,await kv(bv(m.clientDataJSON))]),A=bv(m.signature);if((v>0||g.counter>0)&&v<=g.counter)throw Error(`Response counter value ${v} was lower than expected ${g.counter}`);let{credentialDeviceType:B,credentialBackedUp:C}=k_(u);return{verified:await kC({signature:A,data:z,credentialPublicKey:g.publicKey}),authenticationInfo:{newCounter:v,credentialID:g.id,userVerified:u.uv,credentialDeviceType:B,credentialBackedUp:C,authenticatorExtensionResults:w,origin:n.origin,rpID:y}}}el([ef({type:lu,repeated:"set"})],lv.prototype,"packageInfos",void 0),el([ef({type:K.OctetString,repeated:"set"})],lv.prototype,"signatureDigests",void 0)},91607:()=>{var a,b;b=a||(a={}),function(a){var c="object"==typeof globalThis?globalThis:"object"==typeof global?global:"object"==typeof self?self:"object"==typeof this?this:function(){try{return Function("return this;")()}catch(a){}}()||function(){try{return(0,eval)("(function() { return this; })()")}catch(a){}}(),d=e(b);function e(a,b){return function(c,d){Object.defineProperty(a,c,{configurable:!0,writable:!0,value:d}),b&&b(c,d)}}void 0!==c.Reflect&&(d=e(c.Reflect,d)),a(d,c),void 0===c.Reflect&&(c.Reflect=b)}(function(a,b){var c,d=Object.prototype.hasOwnProperty,e="function"==typeof Symbol,f=e&&void 0!==Symbol.toPrimitive?Symbol.toPrimitive:"@@toPrimitive",g=e&&void 0!==Symbol.iterator?Symbol.iterator:"@@iterator",h="function"==typeof Object.create,i=({__proto__:[]})instanceof Array,j=!h&&!i,k={create:h?function(){return L(Object.create(null))}:i?function(){return L({__proto__:null})}:function(){return L({})},has:j?function(a,b){return d.call(a,b)}:function(a,b){return b in a},get:j?function(a,b){return d.call(a,b)?a[b]:void 0}:function(a,b){return a[b]}},l=Object.getPrototypeOf(Function),m="function"==typeof Map&&"function"==typeof Map.prototype.entries?Map:function(){var a={},b=[],c=function(){function a(a,b,c){this._index=0,this._keys=a,this._values=b,this._selector=c}return a.prototype["@@iterator"]=function(){return this},a.prototype[g]=function(){return this},a.prototype.next=function(){var a=this._index;if(a>=0&&a<this._keys.length){var c=this._selector(this._keys[a],this._values[a]);return a+1>=this._keys.length?(this._index=-1,this._keys=b,this._values=b):this._index++,{value:c,done:!1}}return{value:void 0,done:!0}},a.prototype.throw=function(a){throw this._index>=0&&(this._index=-1,this._keys=b,this._values=b),a},a.prototype.return=function(a){return this._index>=0&&(this._index=-1,this._keys=b,this._values=b),{value:a,done:!0}},a}();function d(){this._keys=[],this._values=[],this._cacheKey=a,this._cacheIndex=-2}return Object.defineProperty(d.prototype,"size",{get:function(){return this._keys.length},enumerable:!0,configurable:!0}),d.prototype.has=function(a){return this._find(a,!1)>=0},d.prototype.get=function(a){var b=this._find(a,!1);return b>=0?this._values[b]:void 0},d.prototype.set=function(a,b){var c=this._find(a,!0);return this._values[c]=b,this},d.prototype.delete=function(b){var c=this._find(b,!1);if(c>=0){for(var d=this._keys.length,e=c+1;e<d;e++)this._keys[e-1]=this._keys[e],this._values[e-1]=this._values[e];return this._keys.length--,this._values.length--,E(b,this._cacheKey)&&(this._cacheKey=a,this._cacheIndex=-2),!0}return!1},d.prototype.clear=function(){this._keys.length=0,this._values.length=0,this._cacheKey=a,this._cacheIndex=-2},d.prototype.keys=function(){return new c(this._keys,this._values,e)},d.prototype.values=function(){return new c(this._keys,this._values,f)},d.prototype.entries=function(){return new c(this._keys,this._values,h)},d.prototype["@@iterator"]=function(){return this.entries()},d.prototype[g]=function(){return this.entries()},d.prototype._find=function(a,b){if(!E(this._cacheKey,a)){this._cacheIndex=-1;for(var c=0;c<this._keys.length;c++)if(E(this._keys[c],a)){this._cacheIndex=c;break}}return this._cacheIndex<0&&b&&(this._cacheIndex=this._keys.length,this._keys.push(a),this._values.push(void 0)),this._cacheIndex},d;function e(a,b){return a}function f(a,b){return b}function h(a,b){return[a,b]}}(),n="function"==typeof Set&&"function"==typeof Set.prototype.entries?Set:function(){function a(){this._map=new m}return Object.defineProperty(a.prototype,"size",{get:function(){return this._map.size},enumerable:!0,configurable:!0}),a.prototype.has=function(a){return this._map.has(a)},a.prototype.add=function(a){return this._map.set(a,a),this},a.prototype.delete=function(a){return this._map.delete(a)},a.prototype.clear=function(){this._map.clear()},a.prototype.keys=function(){return this._map.keys()},a.prototype.values=function(){return this._map.keys()},a.prototype.entries=function(){return this._map.entries()},a.prototype["@@iterator"]=function(){return this.keys()},a.prototype[g]=function(){return this.keys()},a}(),o="function"==typeof WeakMap?WeakMap:function(){var a=k.create(),b=e();function c(){this._key=e()}return c.prototype.has=function(a){var b=f(a,!1);return void 0!==b&&k.has(b,this._key)},c.prototype.get=function(a){var b=f(a,!1);return void 0!==b?k.get(b,this._key):void 0},c.prototype.set=function(a,b){return f(a,!0)[this._key]=b,this},c.prototype.delete=function(a){var b=f(a,!1);return void 0!==b&&delete b[this._key]},c.prototype.clear=function(){this._key=e()},c;function e(){var b;do b="@@WeakMap@@"+function(){var a=function(){if("function"==typeof Uint8Array){var a=new Uint8Array(16);return"u">typeof crypto?crypto.getRandomValues(a):"u">typeof msCrypto?msCrypto.getRandomValues(a):g(a,16),a}return g(Array(16),16)}();a[6]=79&a[6]|64,a[8]=191&a[8]|128;for(var b="",c=0;c<16;++c){var d=a[c];(4===c||6===c||8===c)&&(b+="-"),d<16&&(b+="0"),b+=d.toString(16).toLowerCase()}return b}();while(k.has(a,b));return a[b]=!0,b}function f(a,c){if(!d.call(a,b)){if(!c)return;Object.defineProperty(a,b,{value:k.create()})}return a[b]}function g(a,b){for(var c=0;c<b;++c)a[c]=255*Math.random()|0;return a}}(),p=e?Symbol.for("@reflect-metadata:registry"):void 0,q=(!x(p)&&z(b.Reflect)&&Object.isExtensible(b.Reflect)&&(c=b.Reflect[p]),x(c)&&(c=function(){x(p)||void 0===b.Reflect||p in b.Reflect||"function"!=typeof b.Reflect.defineMetadata||(c=(a=b.Reflect).defineMetadata,d=a.hasOwnMetadata,e=a.getOwnMetadata,f=a.getOwnMetadataKeys,g=a.deleteMetadata,h=new o,i={isProviderFor:function(a,b){var c=h.get(a);return!!(!x(c)&&c.has(b))||!!f(a,b).length&&(x(c)&&(c=new n,h.set(a,c)),c.add(b),!0)},OrdinaryDefineOwnMetadata:c,OrdinaryHasOwnMetadata:d,OrdinaryGetOwnMetadata:e,OrdinaryOwnMetadataKeys:f,OrdinaryDeleteMetadata:g});var a,c,d,e,f,g,h,i,j,k,l,q=new o,r={registerProvider:function(a){if(!Object.isExtensible(r))throw Error("Cannot add provider to a frozen registry.");switch(!0){case i===a:break;case x(j):j=a;break;case j===a:break;case x(k):k=a;break;case k===a:break;default:void 0===l&&(l=new n),l.add(a)}},getProvider:s,setProvider:function(a,b,c){if(!function(a){if(x(a))throw TypeError();return j===a||k===a||!x(l)&&l.has(a)}(c))throw Error("Metadata provider not registered.");var d=s(a,b);if(d!==c){if(!x(d))return!1;var e=q.get(a);x(e)&&(e=new m,q.set(a,e)),e.set(b,c)}return!0}};return r;function s(a,b){var c,d=q.get(a);return x(d)||(c=d.get(b)),x(c)&&(c=function(a,b){if(!x(j)){if(j.isProviderFor(a,b))return j;if(!x(k)){if(k.isProviderFor(a,b))return j;if(!x(l))for(var c=G(l);;){var d=H(c);if(!d)return;var e=d.value;if(e.isProviderFor(a,b))return I(c),e}}}if(!x(i)&&i.isProviderFor(a,b))return i}(a,b),x(c)||(x(d)&&(d=new m,q.set(a,d)),d.set(b,c))),c}}()),!x(p)&&z(b.Reflect)&&Object.isExtensible(b.Reflect)&&Object.defineProperty(b.Reflect,p,{enumerable:!1,configurable:!1,writable:!1,value:c}),c),r=function(a){var b=new o,c={isProviderFor:function(a,c){var d=b.get(a);return!x(d)&&d.has(c)},OrdinaryDefineOwnMetadata:function(a,b,c,e){d(c,e,!0).set(a,b)},OrdinaryHasOwnMetadata:function(a,b,c){var e=d(b,c,!1);return!x(e)&&!!e.has(a)},OrdinaryGetOwnMetadata:function(a,b,c){var e=d(b,c,!1);if(!x(e))return e.get(a)},OrdinaryOwnMetadataKeys:function(a,b){var c=[],e=d(a,b,!1);if(x(e))return c;for(var f=G(e.keys()),g=0;;){var h=H(f);if(!h)return c.length=g,c;var i=h.value;try{c[g]=i}catch(a){try{I(f)}finally{throw a}}g++}},OrdinaryDeleteMetadata:function(a,c,e){var f=d(c,e,!1);if(x(f)||!f.delete(a))return!1;if(0===f.size){var g=b.get(c);x(g)||(g.delete(e),0===g.size&&b.delete(g))}return!0}};return q.registerProvider(c),c;function d(d,e,f){var g=b.get(d),h=!1;if(x(g)){if(!f)return;g=new m,b.set(d,g),h=!0}var i=g.get(e);if(x(i)){if(!f)return;if(i=new m,g.set(e,i),!a.setProvider(d,e,c))throw g.delete(e),h&&b.delete(d),Error("Wrong provider for target.")}return i}}(q);function s(a,b,c){var d=K(b,c,!1);return!x(d)&&!!d.OrdinaryHasOwnMetadata(a,b,c)}function t(a,b,c){var d=K(b,c,!1);if(!x(d))return d.OrdinaryGetOwnMetadata(a,b,c)}function u(a,b,c,d){K(c,d,!0).OrdinaryDefineOwnMetadata(a,b,c,d)}function v(a,b){var c=K(a,b,!1);return c?c.OrdinaryOwnMetadataKeys(a,b):[]}function w(a){if(null===a)return 1;switch(typeof a){case"undefined":return 0;case"boolean":return 2;case"string":return 3;case"symbol":return 4;case"number":return 5;case"object":return null===a?1:6;default:return 6}}function x(a){return void 0===a}function y(a){return null===a}function z(a){return"object"==typeof a?null!==a:"function"==typeof a}a("decorate",function(a,b,c,d){if(x(c)){if(!B(a)||!D(b))throw TypeError();for(var e=a,f=b,g=e.length-1;g>=0;--g){var h=(0,e[g])(f);if(!x(h)&&!y(h)){if(!D(h))throw TypeError();f=h}}return f}if(!B(a)||!z(b)||!z(d)&&!x(d)&&!y(d))throw TypeError();return y(d)&&(d=void 0),function(a,b,c,d){for(var e=a.length-1;e>=0;--e){var f=(0,a[e])(b,c,d);if(!x(f)&&!y(f)){if(!z(f))throw TypeError();d=f}}return d}(a,b,c=A(c),d)}),a("metadata",function(a,b){return function(c,d){if(!z(c)||!x(d)&&!function(a){switch(w(a)){case 3:case 4:return!0;default:return!1}}(d))throw TypeError();u(a,b,c,d)}}),a("defineMetadata",function(a,b,c,d){if(!z(c))throw TypeError();return x(d)||(d=A(d)),u(a,b,c,d)}),a("hasMetadata",function(a,b,c){if(!z(b))throw TypeError();return x(c)||(c=A(c)),function a(b,c,d){if(s(b,c,d))return!0;var e=J(c);return!y(e)&&a(b,e,d)}(a,b,c)}),a("hasOwnMetadata",function(a,b,c){if(!z(b))throw TypeError();return x(c)||(c=A(c)),s(a,b,c)}),a("getMetadata",function(a,b,c){if(!z(b))throw TypeError();return x(c)||(c=A(c)),function a(b,c,d){if(s(b,c,d))return t(b,c,d);var e=J(c);if(!y(e))return a(b,e,d)}(a,b,c)}),a("getOwnMetadata",function(a,b,c){if(!z(b))throw TypeError();return x(c)||(c=A(c)),t(a,b,c)}),a("getMetadataKeys",function(a,b){if(!z(a))throw TypeError();return x(b)||(b=A(b)),function a(b,c){var d=v(b,c),e=J(b);if(null===e)return d;var f=a(e,c);if(f.length<=0)return d;if(d.length<=0)return f;for(var g=new n,h=[],i=0;i<d.length;i++){var j=d[i],k=g.has(j);k||(g.add(j),h.push(j))}for(var l=0;l<f.length;l++){var j=f[l],k=g.has(j);k||(g.add(j),h.push(j))}return h}(a,b)}),a("getOwnMetadataKeys",function(a,b){if(!z(a))throw TypeError();return x(b)||(b=A(b)),v(a,b)}),a("deleteMetadata",function(a,b,c){if(!z(b)||(x(c)||(c=A(c)),!z(b)))throw TypeError();x(c)||(c=A(c));var d=K(b,c,!1);return!x(d)&&d.OrdinaryDeleteMetadata(a,b,c)});function A(a){var b=function(a){switch(w(a)){case 0:case 1:case 2:case 3:case 4:case 5:return a}var b="string",c=F(a,f);if(void 0!==c){var d=c.call(a,b);if(z(d))throw TypeError();return d}return function(a,b){if("string"===b){var c=a.toString;if(C(c)){var d=c.call(a);if(!z(d))return d}var e=a.valueOf;if(C(e)){var d=e.call(a);if(!z(d))return d}}else{var e=a.valueOf;if(C(e)){var d=e.call(a);if(!z(d))return d}var f=a.toString;if(C(f)){var d=f.call(a);if(!z(d))return d}}throw TypeError()}(a,b)}(a);return"symbol"==typeof b?b:""+b}function B(a){return Array.isArray?Array.isArray(a):a instanceof Object?a instanceof Array:"[object Array]"===Object.prototype.toString.call(a)}function C(a){return"function"==typeof a}function D(a){return"function"==typeof a}function E(a,b){return a===b||a!=a&&b!=b}function F(a,b){var c=a[b];if(null!=c){if(!C(c))throw TypeError();return c}}function G(a){var b=F(a,g);if(!C(b))throw TypeError();var c=b.call(a);if(!z(c))throw TypeError();return c}function H(a){var b=a.next();return!b.done&&b}function I(a){var b=a.return;b&&b.call(a)}function J(a){var b=Object.getPrototypeOf(a);if("function"!=typeof a||a===l||b!==l)return b;var c=a.prototype,d=c&&Object.getPrototypeOf(c);if(null==d||d===Object.prototype)return b;var e=d.constructor;return"function"!=typeof e||e===a?b:e}function K(a,b,c){var d=q.getProvider(a,b);if(!x(d))return d;if(c){if(q.setProvider(a,b,r))return r;throw Error("Illegal state.")}}function L(a){return a.__=void 0,delete a.__,a}})}};