9router 0.3.98 → 0.3.99

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 (232) hide show
  1. package/app/.next/BUILD_ID +1 -1
  2. package/app/.next/app-path-routes-manifest.json +7 -7
  3. package/app/.next/build-manifest.json +2 -2
  4. package/app/.next/server/app/(dashboard)/dashboard/basic-chat/page_client-reference-manifest.js +1 -1
  5. package/app/.next/server/app/(dashboard)/dashboard/cli-tools/page_client-reference-manifest.js +1 -1
  6. package/app/.next/server/app/(dashboard)/dashboard/combos/page_client-reference-manifest.js +1 -1
  7. package/app/.next/server/app/(dashboard)/dashboard/console-log/page_client-reference-manifest.js +1 -1
  8. package/app/.next/server/app/(dashboard)/dashboard/endpoint/page_client-reference-manifest.js +1 -1
  9. package/app/.next/server/app/(dashboard)/dashboard/media-providers/[kind]/[id]/page_client-reference-manifest.js +1 -1
  10. package/app/.next/server/app/(dashboard)/dashboard/media-providers/[kind]/page_client-reference-manifest.js +1 -1
  11. package/app/.next/server/app/(dashboard)/dashboard/mitm/page_client-reference-manifest.js +1 -1
  12. package/app/.next/server/app/(dashboard)/dashboard/page_client-reference-manifest.js +1 -1
  13. package/app/.next/server/app/(dashboard)/dashboard/profile/page_client-reference-manifest.js +1 -1
  14. package/app/.next/server/app/(dashboard)/dashboard/providers/[id]/page_client-reference-manifest.js +1 -1
  15. package/app/.next/server/app/(dashboard)/dashboard/providers/new/page_client-reference-manifest.js +1 -1
  16. package/app/.next/server/app/(dashboard)/dashboard/providers/page_client-reference-manifest.js +1 -1
  17. package/app/.next/server/app/(dashboard)/dashboard/proxy-pools/page_client-reference-manifest.js +1 -1
  18. package/app/.next/server/app/(dashboard)/dashboard/quota/page_client-reference-manifest.js +1 -1
  19. package/app/.next/server/app/(dashboard)/dashboard/translator/page_client-reference-manifest.js +1 -1
  20. package/app/.next/server/app/(dashboard)/dashboard/usage/page_client-reference-manifest.js +1 -1
  21. package/app/.next/server/app/_global-error/page_client-reference-manifest.js +1 -1
  22. package/app/.next/server/app/_global-error.html +1 -1
  23. package/app/.next/server/app/_global-error.rsc +1 -1
  24. package/app/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
  25. package/app/.next/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +1 -1
  26. package/app/.next/server/app/_global-error.segments/_global-error.segment.rsc +1 -1
  27. package/app/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
  28. package/app/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
  29. package/app/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  30. package/app/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  31. package/app/.next/server/app/_not-found.html +1 -1
  32. package/app/.next/server/app/_not-found.rsc +3 -3
  33. package/app/.next/server/app/_not-found.segments/_full.segment.rsc +3 -3
  34. package/app/.next/server/app/_not-found.segments/_head.segment.rsc +1 -1
  35. package/app/.next/server/app/_not-found.segments/_index.segment.rsc +3 -3
  36. package/app/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
  37. package/app/.next/server/app/_not-found.segments/_not-found.segment.rsc +1 -1
  38. package/app/.next/server/app/_not-found.segments/_tree.segment.rsc +1 -1
  39. package/app/.next/server/app/api/models/route.js +1 -1
  40. package/app/.next/server/app/api/providers/route.js +1 -1
  41. package/app/.next/server/app/api/translator/console-logs/route.js +1 -1
  42. package/app/.next/server/app/api/translator/console-logs/stream/route.js +1 -1
  43. package/app/.next/server/app/api/version/route.js +1 -1
  44. package/app/.next/server/app/callback/page_client-reference-manifest.js +1 -1
  45. package/app/.next/server/app/callback.html +1 -1
  46. package/app/.next/server/app/callback.rsc +3 -3
  47. package/app/.next/server/app/callback.segments/_full.segment.rsc +3 -3
  48. package/app/.next/server/app/callback.segments/_head.segment.rsc +1 -1
  49. package/app/.next/server/app/callback.segments/_index.segment.rsc +3 -3
  50. package/app/.next/server/app/callback.segments/_tree.segment.rsc +1 -1
  51. package/app/.next/server/app/callback.segments/callback/__PAGE__.segment.rsc +1 -1
  52. package/app/.next/server/app/callback.segments/callback.segment.rsc +1 -1
  53. package/app/.next/server/app/dashboard/basic-chat.html +1 -1
  54. package/app/.next/server/app/dashboard/basic-chat.rsc +5 -5
  55. package/app/.next/server/app/dashboard/basic-chat.segments/!KGRhc2hib2FyZCk/dashboard/basic-chat/__PAGE__.segment.rsc +2 -2
  56. package/app/.next/server/app/dashboard/basic-chat.segments/!KGRhc2hib2FyZCk/dashboard/basic-chat.segment.rsc +1 -1
  57. package/app/.next/server/app/dashboard/basic-chat.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  58. package/app/.next/server/app/dashboard/basic-chat.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  59. package/app/.next/server/app/dashboard/basic-chat.segments/_full.segment.rsc +5 -5
  60. package/app/.next/server/app/dashboard/basic-chat.segments/_head.segment.rsc +1 -1
  61. package/app/.next/server/app/dashboard/basic-chat.segments/_index.segment.rsc +3 -3
  62. package/app/.next/server/app/dashboard/basic-chat.segments/_tree.segment.rsc +1 -1
  63. package/app/.next/server/app/dashboard/cli-tools.html +1 -1
  64. package/app/.next/server/app/dashboard/cli-tools.rsc +5 -5
  65. package/app/.next/server/app/dashboard/cli-tools.segments/!KGRhc2hib2FyZCk/dashboard/cli-tools/__PAGE__.segment.rsc +2 -2
  66. package/app/.next/server/app/dashboard/cli-tools.segments/!KGRhc2hib2FyZCk/dashboard/cli-tools.segment.rsc +1 -1
  67. package/app/.next/server/app/dashboard/cli-tools.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  68. package/app/.next/server/app/dashboard/cli-tools.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  69. package/app/.next/server/app/dashboard/cli-tools.segments/_full.segment.rsc +5 -5
  70. package/app/.next/server/app/dashboard/cli-tools.segments/_head.segment.rsc +1 -1
  71. package/app/.next/server/app/dashboard/cli-tools.segments/_index.segment.rsc +3 -3
  72. package/app/.next/server/app/dashboard/cli-tools.segments/_tree.segment.rsc +1 -1
  73. package/app/.next/server/app/dashboard/combos.html +1 -1
  74. package/app/.next/server/app/dashboard/combos.rsc +5 -5
  75. package/app/.next/server/app/dashboard/combos.segments/!KGRhc2hib2FyZCk/dashboard/combos/__PAGE__.segment.rsc +2 -2
  76. package/app/.next/server/app/dashboard/combos.segments/!KGRhc2hib2FyZCk/dashboard/combos.segment.rsc +1 -1
  77. package/app/.next/server/app/dashboard/combos.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  78. package/app/.next/server/app/dashboard/combos.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  79. package/app/.next/server/app/dashboard/combos.segments/_full.segment.rsc +5 -5
  80. package/app/.next/server/app/dashboard/combos.segments/_head.segment.rsc +1 -1
  81. package/app/.next/server/app/dashboard/combos.segments/_index.segment.rsc +3 -3
  82. package/app/.next/server/app/dashboard/combos.segments/_tree.segment.rsc +1 -1
  83. package/app/.next/server/app/dashboard/endpoint.html +1 -1
  84. package/app/.next/server/app/dashboard/endpoint.rsc +5 -5
  85. package/app/.next/server/app/dashboard/endpoint.segments/!KGRhc2hib2FyZCk/dashboard/endpoint/__PAGE__.segment.rsc +2 -2
  86. package/app/.next/server/app/dashboard/endpoint.segments/!KGRhc2hib2FyZCk/dashboard/endpoint.segment.rsc +1 -1
  87. package/app/.next/server/app/dashboard/endpoint.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  88. package/app/.next/server/app/dashboard/endpoint.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  89. package/app/.next/server/app/dashboard/endpoint.segments/_full.segment.rsc +5 -5
  90. package/app/.next/server/app/dashboard/endpoint.segments/_head.segment.rsc +1 -1
  91. package/app/.next/server/app/dashboard/endpoint.segments/_index.segment.rsc +3 -3
  92. package/app/.next/server/app/dashboard/endpoint.segments/_tree.segment.rsc +1 -1
  93. package/app/.next/server/app/dashboard/mitm.html +1 -1
  94. package/app/.next/server/app/dashboard/mitm.rsc +5 -5
  95. package/app/.next/server/app/dashboard/mitm.segments/!KGRhc2hib2FyZCk/dashboard/mitm/__PAGE__.segment.rsc +2 -2
  96. package/app/.next/server/app/dashboard/mitm.segments/!KGRhc2hib2FyZCk/dashboard/mitm.segment.rsc +1 -1
  97. package/app/.next/server/app/dashboard/mitm.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  98. package/app/.next/server/app/dashboard/mitm.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  99. package/app/.next/server/app/dashboard/mitm.segments/_full.segment.rsc +5 -5
  100. package/app/.next/server/app/dashboard/mitm.segments/_head.segment.rsc +1 -1
  101. package/app/.next/server/app/dashboard/mitm.segments/_index.segment.rsc +3 -3
  102. package/app/.next/server/app/dashboard/mitm.segments/_tree.segment.rsc +1 -1
  103. package/app/.next/server/app/dashboard/profile.html +1 -1
  104. package/app/.next/server/app/dashboard/profile.rsc +5 -5
  105. package/app/.next/server/app/dashboard/profile.segments/!KGRhc2hib2FyZCk/dashboard/profile/__PAGE__.segment.rsc +2 -2
  106. package/app/.next/server/app/dashboard/profile.segments/!KGRhc2hib2FyZCk/dashboard/profile.segment.rsc +1 -1
  107. package/app/.next/server/app/dashboard/profile.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  108. package/app/.next/server/app/dashboard/profile.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  109. package/app/.next/server/app/dashboard/profile.segments/_full.segment.rsc +5 -5
  110. package/app/.next/server/app/dashboard/profile.segments/_head.segment.rsc +1 -1
  111. package/app/.next/server/app/dashboard/profile.segments/_index.segment.rsc +3 -3
  112. package/app/.next/server/app/dashboard/profile.segments/_tree.segment.rsc +1 -1
  113. package/app/.next/server/app/dashboard/providers/new.html +1 -1
  114. package/app/.next/server/app/dashboard/providers/new.rsc +5 -5
  115. package/app/.next/server/app/dashboard/providers/new.segments/!KGRhc2hib2FyZCk/dashboard/providers/new/__PAGE__.segment.rsc +2 -2
  116. package/app/.next/server/app/dashboard/providers/new.segments/!KGRhc2hib2FyZCk/dashboard/providers/new.segment.rsc +1 -1
  117. package/app/.next/server/app/dashboard/providers/new.segments/!KGRhc2hib2FyZCk/dashboard/providers.segment.rsc +1 -1
  118. package/app/.next/server/app/dashboard/providers/new.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  119. package/app/.next/server/app/dashboard/providers/new.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  120. package/app/.next/server/app/dashboard/providers/new.segments/_full.segment.rsc +5 -5
  121. package/app/.next/server/app/dashboard/providers/new.segments/_head.segment.rsc +1 -1
  122. package/app/.next/server/app/dashboard/providers/new.segments/_index.segment.rsc +3 -3
  123. package/app/.next/server/app/dashboard/providers/new.segments/_tree.segment.rsc +1 -1
  124. package/app/.next/server/app/dashboard/providers.html +1 -1
  125. package/app/.next/server/app/dashboard/providers.rsc +5 -5
  126. package/app/.next/server/app/dashboard/providers.segments/!KGRhc2hib2FyZCk/dashboard/providers/__PAGE__.segment.rsc +2 -2
  127. package/app/.next/server/app/dashboard/providers.segments/!KGRhc2hib2FyZCk/dashboard/providers.segment.rsc +1 -1
  128. package/app/.next/server/app/dashboard/providers.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  129. package/app/.next/server/app/dashboard/providers.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  130. package/app/.next/server/app/dashboard/providers.segments/_full.segment.rsc +5 -5
  131. package/app/.next/server/app/dashboard/providers.segments/_head.segment.rsc +1 -1
  132. package/app/.next/server/app/dashboard/providers.segments/_index.segment.rsc +3 -3
  133. package/app/.next/server/app/dashboard/providers.segments/_tree.segment.rsc +1 -1
  134. package/app/.next/server/app/dashboard/proxy-pools.html +1 -1
  135. package/app/.next/server/app/dashboard/proxy-pools.rsc +5 -5
  136. package/app/.next/server/app/dashboard/proxy-pools.segments/!KGRhc2hib2FyZCk/dashboard/proxy-pools/__PAGE__.segment.rsc +2 -2
  137. package/app/.next/server/app/dashboard/proxy-pools.segments/!KGRhc2hib2FyZCk/dashboard/proxy-pools.segment.rsc +1 -1
  138. package/app/.next/server/app/dashboard/proxy-pools.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  139. package/app/.next/server/app/dashboard/proxy-pools.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  140. package/app/.next/server/app/dashboard/proxy-pools.segments/_full.segment.rsc +5 -5
  141. package/app/.next/server/app/dashboard/proxy-pools.segments/_head.segment.rsc +1 -1
  142. package/app/.next/server/app/dashboard/proxy-pools.segments/_index.segment.rsc +3 -3
  143. package/app/.next/server/app/dashboard/proxy-pools.segments/_tree.segment.rsc +1 -1
  144. package/app/.next/server/app/dashboard/quota.html +2 -2
  145. package/app/.next/server/app/dashboard/quota.rsc +6 -6
  146. package/app/.next/server/app/dashboard/quota.segments/!KGRhc2hib2FyZCk/dashboard/quota/__PAGE__.segment.rsc +3 -3
  147. package/app/.next/server/app/dashboard/quota.segments/!KGRhc2hib2FyZCk/dashboard/quota.segment.rsc +1 -1
  148. package/app/.next/server/app/dashboard/quota.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  149. package/app/.next/server/app/dashboard/quota.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  150. package/app/.next/server/app/dashboard/quota.segments/_full.segment.rsc +6 -6
  151. package/app/.next/server/app/dashboard/quota.segments/_head.segment.rsc +1 -1
  152. package/app/.next/server/app/dashboard/quota.segments/_index.segment.rsc +3 -3
  153. package/app/.next/server/app/dashboard/quota.segments/_tree.segment.rsc +1 -1
  154. package/app/.next/server/app/dashboard/settings/pricing/page_client-reference-manifest.js +1 -1
  155. package/app/.next/server/app/dashboard/settings/pricing.html +1 -1
  156. package/app/.next/server/app/dashboard/settings/pricing.rsc +3 -3
  157. package/app/.next/server/app/dashboard/settings/pricing.segments/_full.segment.rsc +3 -3
  158. package/app/.next/server/app/dashboard/settings/pricing.segments/_head.segment.rsc +1 -1
  159. package/app/.next/server/app/dashboard/settings/pricing.segments/_index.segment.rsc +3 -3
  160. package/app/.next/server/app/dashboard/settings/pricing.segments/_tree.segment.rsc +1 -1
  161. package/app/.next/server/app/dashboard/settings/pricing.segments/dashboard/settings/pricing/__PAGE__.segment.rsc +1 -1
  162. package/app/.next/server/app/dashboard/settings/pricing.segments/dashboard/settings/pricing.segment.rsc +1 -1
  163. package/app/.next/server/app/dashboard/settings/pricing.segments/dashboard/settings.segment.rsc +1 -1
  164. package/app/.next/server/app/dashboard/settings/pricing.segments/dashboard.segment.rsc +1 -1
  165. package/app/.next/server/app/dashboard/translator.html +1 -1
  166. package/app/.next/server/app/dashboard/translator.rsc +5 -5
  167. package/app/.next/server/app/dashboard/translator.segments/!KGRhc2hib2FyZCk/dashboard/translator/__PAGE__.segment.rsc +2 -2
  168. package/app/.next/server/app/dashboard/translator.segments/!KGRhc2hib2FyZCk/dashboard/translator.segment.rsc +1 -1
  169. package/app/.next/server/app/dashboard/translator.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  170. package/app/.next/server/app/dashboard/translator.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  171. package/app/.next/server/app/dashboard/translator.segments/_full.segment.rsc +5 -5
  172. package/app/.next/server/app/dashboard/translator.segments/_head.segment.rsc +1 -1
  173. package/app/.next/server/app/dashboard/translator.segments/_index.segment.rsc +3 -3
  174. package/app/.next/server/app/dashboard/translator.segments/_tree.segment.rsc +1 -1
  175. package/app/.next/server/app/dashboard/usage.html +1 -1
  176. package/app/.next/server/app/dashboard/usage.rsc +5 -5
  177. package/app/.next/server/app/dashboard/usage.segments/!KGRhc2hib2FyZCk/dashboard/usage/__PAGE__.segment.rsc +2 -2
  178. package/app/.next/server/app/dashboard/usage.segments/!KGRhc2hib2FyZCk/dashboard/usage.segment.rsc +1 -1
  179. package/app/.next/server/app/dashboard/usage.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  180. package/app/.next/server/app/dashboard/usage.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  181. package/app/.next/server/app/dashboard/usage.segments/_full.segment.rsc +5 -5
  182. package/app/.next/server/app/dashboard/usage.segments/_head.segment.rsc +1 -1
  183. package/app/.next/server/app/dashboard/usage.segments/_index.segment.rsc +3 -3
  184. package/app/.next/server/app/dashboard/usage.segments/_tree.segment.rsc +1 -1
  185. package/app/.next/server/app/dashboard.html +1 -1
  186. package/app/.next/server/app/dashboard.rsc +5 -5
  187. package/app/.next/server/app/dashboard.segments/!KGRhc2hib2FyZCk/dashboard/__PAGE__.segment.rsc +2 -2
  188. package/app/.next/server/app/dashboard.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  189. package/app/.next/server/app/dashboard.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  190. package/app/.next/server/app/dashboard.segments/_full.segment.rsc +5 -5
  191. package/app/.next/server/app/dashboard.segments/_head.segment.rsc +1 -1
  192. package/app/.next/server/app/dashboard.segments/_index.segment.rsc +3 -3
  193. package/app/.next/server/app/dashboard.segments/_tree.segment.rsc +1 -1
  194. package/app/.next/server/app/index.html +1 -1
  195. package/app/.next/server/app/index.rsc +3 -3
  196. package/app/.next/server/app/index.segments/__PAGE__.segment.rsc +1 -1
  197. package/app/.next/server/app/index.segments/_full.segment.rsc +3 -3
  198. package/app/.next/server/app/index.segments/_head.segment.rsc +1 -1
  199. package/app/.next/server/app/index.segments/_index.segment.rsc +3 -3
  200. package/app/.next/server/app/index.segments/_tree.segment.rsc +1 -1
  201. package/app/.next/server/app/landing/page_client-reference-manifest.js +1 -1
  202. package/app/.next/server/app/landing.html +1 -1
  203. package/app/.next/server/app/landing.rsc +3 -3
  204. package/app/.next/server/app/landing.segments/_full.segment.rsc +3 -3
  205. package/app/.next/server/app/landing.segments/_head.segment.rsc +1 -1
  206. package/app/.next/server/app/landing.segments/_index.segment.rsc +3 -3
  207. package/app/.next/server/app/landing.segments/_tree.segment.rsc +1 -1
  208. package/app/.next/server/app/landing.segments/landing/__PAGE__.segment.rsc +1 -1
  209. package/app/.next/server/app/landing.segments/landing.segment.rsc +1 -1
  210. package/app/.next/server/app/login/page_client-reference-manifest.js +1 -1
  211. package/app/.next/server/app/login.html +1 -1
  212. package/app/.next/server/app/login.rsc +4 -4
  213. package/app/.next/server/app/login.segments/_full.segment.rsc +4 -4
  214. package/app/.next/server/app/login.segments/_head.segment.rsc +1 -1
  215. package/app/.next/server/app/login.segments/_index.segment.rsc +3 -3
  216. package/app/.next/server/app/login.segments/_tree.segment.rsc +1 -1
  217. package/app/.next/server/app/login.segments/login/__PAGE__.segment.rsc +2 -2
  218. package/app/.next/server/app/login.segments/login.segment.rsc +1 -1
  219. package/app/.next/server/app/page_client-reference-manifest.js +1 -1
  220. package/app/.next/server/app-paths-manifest.json +7 -7
  221. package/app/.next/server/chunks/253.js +1 -1
  222. package/app/.next/server/chunks/5290.js +1 -1
  223. package/app/.next/server/chunks/8202.js +1 -1
  224. package/app/.next/server/middleware-build-manifest.js +1 -1
  225. package/app/.next/server/pages/404.html +1 -1
  226. package/app/.next/server/pages/500.html +1 -1
  227. package/app/.next/static/chunks/{505-fa396bcc874792f7.js → 505-dbb305de05d5bac4.js} +1 -1
  228. package/app/package.json +1 -1
  229. package/app/src/mitm/server.js +11 -11
  230. package/package.json +1 -1
  231. /package/app/.next/static/{Tfe6XfGp2k5TPg1_OB0mp → ltSRtUE4u7o8Utcy63HC4}/_buildManifest.js +0 -0
  232. /package/app/.next/static/{Tfe6XfGp2k5TPg1_OB0mp → ltSRtUE4u7o8Utcy63HC4}/_ssgManifest.js +0 -0
@@ -1,17 +1,17 @@
1
- var M=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var Wt=M(($f,Tn)=>{function Sn(){return new Date().toLocaleTimeString("en-US",{hour12:!1})}var go=e=>console.log(`[${Sn()}] [MITM] ${e}`),mo=e=>console.error(`[${Sn()}] \u274C [MITM] ${e}`);Tn.exports={log:go,err:mo}});var An=M((Zf,In)=>{var Co=["daily-cloudcode-pa.googleapis.com","cloudcode-pa.googleapis.com","api.individual.githubcopilot.com","q.us-east-1.amazonaws.com","api2.cursor.sh"],Eo={antigravity:[":generateContent",":streamGenerateContent"],copilot:["/chat/completions","/v1/messages","/responses"],kiro:["/generateAssistantResponse"],cursor:["/BidiAppend","/RunSSE","/RunPoll","/Run"]};function xo(e){let t=(e||"").split(":")[0];return t==="api.individual.githubcopilot.com"?"copilot":t==="daily-cloudcode-pa.googleapis.com"||t==="cloudcode-pa.googleapis.com"?"antigravity":t==="q.us-east-1.amazonaws.com"?"kiro":t==="api2.cursor.sh"?"cursor":null}In.exports={TARGET_HOSTS:Co,URL_PATTERNS:Eo,getToolForHost:xo}});var kr=M((Jf,_n)=>{var Lr=require("path"),Bn=require("os");function So(){return process.env.DATA_DIR?process.env.DATA_DIR:process.platform==="win32"?Lr.join(process.env.APPDATA||Lr.join(Bn.homedir(),"AppData","Roaming"),"9router"):Lr.join(Bn.homedir(),".9router")}var bn=So(),To=Lr.join(bn,"mitm");_n.exports={DATA_DIR:bn,MITM_DIR:To}});var X=M((ec,Nn)=>{Nn.exports={options:{usePureJavaScript:!1}}});var Ln=M((tc,wn)=>{var pa={};wn.exports=pa;var Rn={};pa.encode=function(e,t,a){if(typeof t!="string")throw new TypeError('"alphabet" must be a string.');if(a!==void 0&&typeof a!="number")throw new TypeError('"maxline" must be a number.');var r="";if(!(e instanceof Uint8Array))r=Io(e,t);else{var n=0,s=t.length,i=t.charAt(0),o=[0];for(n=0;n<e.length;++n){for(var l=0,u=e[n];l<o.length;++l)u+=o[l]<<8,o[l]=u%s,u=u/s|0;for(;u>0;)o.push(u%s),u=u/s|0}for(n=0;e[n]===0&&n<e.length-1;++n)r+=i;for(n=o.length-1;n>=0;--n)r+=t[o[n]]}if(a){var f=new RegExp(".{1,"+a+"}","g");r=r.match(f).join(`\r
2
- `)}return r};pa.decode=function(e,t){if(typeof e!="string")throw new TypeError('"input" must be a string.');if(typeof t!="string")throw new TypeError('"alphabet" must be a string.');var a=Rn[t];if(!a){a=Rn[t]=[];for(var r=0;r<t.length;++r)a[t.charCodeAt(r)]=r}e=e.replace(/\s/g,"");for(var n=t.length,s=t.charAt(0),i=[0],r=0;r<e.length;r++){var o=a[e.charCodeAt(r)];if(o===void 0)return;for(var l=0,u=o;l<i.length;++l)u+=i[l]*n,i[l]=u&255,u>>=8;for(;u>0;)i.push(u&255),u>>=8}for(var f=0;e[f]===s&&f<e.length-1;++f)i.push(0);return typeof Buffer<"u"?Buffer.from(i.reverse()):new Uint8Array(i.reverse())};function Io(e,t){var a=0,r=t.length,n=t.charAt(0),s=[0];for(a=0;a<e.length();++a){for(var i=0,o=e.at(a);i<s.length;++i)o+=s[i]<<8,s[i]=o%r,o=o/r|0;for(;o>0;)s.push(o%r),o=o/r|0}var l="";for(a=0;e.at(a)===0&&a<e.length()-1;++a)l+=n;for(a=s.length-1;a>=0;--a)l+=t[s[a]];return l}});var ne=M((rc,Pn)=>{var kn=X(),Dn=Ln(),E=Pn.exports=kn.util=kn.util||{};(function(){if(typeof process<"u"&&process.nextTick&&!process.browser){E.nextTick=process.nextTick,typeof setImmediate=="function"?E.setImmediate=setImmediate:E.setImmediate=E.nextTick;return}if(typeof setImmediate=="function"){E.setImmediate=function(){return setImmediate.apply(void 0,arguments)},E.nextTick=function(o){return setImmediate(o)};return}if(E.setImmediate=function(o){setTimeout(o,0)},typeof window<"u"&&typeof window.postMessage=="function"){let o=function(l){if(l.source===window&&l.data===e){l.stopPropagation();var u=t.slice();t.length=0,u.forEach(function(f){f()})}};var i=o,e="forge.setImmediate",t=[];E.setImmediate=function(l){t.push(l),t.length===1&&window.postMessage(e,"*")},window.addEventListener("message",o,!0)}if(typeof MutationObserver<"u"){var a=Date.now(),r=!0,n=document.createElement("div"),t=[];new MutationObserver(function(){var l=t.slice();t.length=0,l.forEach(function(u){u()})}).observe(n,{attributes:!0});var s=E.setImmediate;E.setImmediate=function(l){Date.now()-a>15?(a=Date.now(),s(l)):(t.push(l),t.length===1&&n.setAttribute("a",r=!r))}}E.nextTick=E.setImmediate})();E.isNodejs=typeof process<"u"&&process.versions&&process.versions.node;E.globalScope=(function(){return E.isNodejs?global:typeof self>"u"?window:self})();E.isArray=Array.isArray||function(e){return Object.prototype.toString.call(e)==="[object Array]"};E.isArrayBuffer=function(e){return typeof ArrayBuffer<"u"&&e instanceof ArrayBuffer};E.isArrayBufferView=function(e){return e&&E.isArrayBuffer(e.buffer)&&e.byteLength!==void 0};function pr(e){if(!(e===8||e===16||e===24||e===32))throw new Error("Only 8, 16, 24, or 32 bits supported: "+e)}E.ByteBuffer=va;function va(e){if(this.data="",this.read=0,typeof e=="string")this.data=e;else if(E.isArrayBuffer(e)||E.isArrayBufferView(e))if(typeof Buffer<"u"&&e instanceof Buffer)this.data=e.toString("binary");else{var t=new Uint8Array(e);try{this.data=String.fromCharCode.apply(null,t)}catch{for(var a=0;a<t.length;++a)this.putByte(t[a])}}else(e instanceof va||typeof e=="object"&&typeof e.data=="string"&&typeof e.read=="number")&&(this.data=e.data,this.read=e.read);this._constructedStringLength=0}E.ByteStringBuffer=va;var Ao=4096;E.ByteStringBuffer.prototype._optimizeConstructedString=function(e){this._constructedStringLength+=e,this._constructedStringLength>Ao&&(this.data.substr(0,1),this._constructedStringLength=0)};E.ByteStringBuffer.prototype.length=function(){return this.data.length-this.read};E.ByteStringBuffer.prototype.isEmpty=function(){return this.length()<=0};E.ByteStringBuffer.prototype.putByte=function(e){return this.putBytes(String.fromCharCode(e))};E.ByteStringBuffer.prototype.fillWithByte=function(e,t){e=String.fromCharCode(e);for(var a=this.data;t>0;)t&1&&(a+=e),t>>>=1,t>0&&(e+=e);return this.data=a,this._optimizeConstructedString(t),this};E.ByteStringBuffer.prototype.putBytes=function(e){return this.data+=e,this._optimizeConstructedString(e.length),this};E.ByteStringBuffer.prototype.putString=function(e){return this.putBytes(E.encodeUtf8(e))};E.ByteStringBuffer.prototype.putInt16=function(e){return this.putBytes(String.fromCharCode(e>>8&255)+String.fromCharCode(e&255))};E.ByteStringBuffer.prototype.putInt24=function(e){return this.putBytes(String.fromCharCode(e>>16&255)+String.fromCharCode(e>>8&255)+String.fromCharCode(e&255))};E.ByteStringBuffer.prototype.putInt32=function(e){return this.putBytes(String.fromCharCode(e>>24&255)+String.fromCharCode(e>>16&255)+String.fromCharCode(e>>8&255)+String.fromCharCode(e&255))};E.ByteStringBuffer.prototype.putInt16Le=function(e){return this.putBytes(String.fromCharCode(e&255)+String.fromCharCode(e>>8&255))};E.ByteStringBuffer.prototype.putInt24Le=function(e){return this.putBytes(String.fromCharCode(e&255)+String.fromCharCode(e>>8&255)+String.fromCharCode(e>>16&255))};E.ByteStringBuffer.prototype.putInt32Le=function(e){return this.putBytes(String.fromCharCode(e&255)+String.fromCharCode(e>>8&255)+String.fromCharCode(e>>16&255)+String.fromCharCode(e>>24&255))};E.ByteStringBuffer.prototype.putInt=function(e,t){pr(t);var a="";do t-=8,a+=String.fromCharCode(e>>t&255);while(t>0);return this.putBytes(a)};E.ByteStringBuffer.prototype.putSignedInt=function(e,t){return e<0&&(e+=2<<t-1),this.putInt(e,t)};E.ByteStringBuffer.prototype.putBuffer=function(e){return this.putBytes(e.getBytes())};E.ByteStringBuffer.prototype.getByte=function(){return this.data.charCodeAt(this.read++)};E.ByteStringBuffer.prototype.getInt16=function(){var e=this.data.charCodeAt(this.read)<<8^this.data.charCodeAt(this.read+1);return this.read+=2,e};E.ByteStringBuffer.prototype.getInt24=function(){var e=this.data.charCodeAt(this.read)<<16^this.data.charCodeAt(this.read+1)<<8^this.data.charCodeAt(this.read+2);return this.read+=3,e};E.ByteStringBuffer.prototype.getInt32=function(){var e=this.data.charCodeAt(this.read)<<24^this.data.charCodeAt(this.read+1)<<16^this.data.charCodeAt(this.read+2)<<8^this.data.charCodeAt(this.read+3);return this.read+=4,e};E.ByteStringBuffer.prototype.getInt16Le=function(){var e=this.data.charCodeAt(this.read)^this.data.charCodeAt(this.read+1)<<8;return this.read+=2,e};E.ByteStringBuffer.prototype.getInt24Le=function(){var e=this.data.charCodeAt(this.read)^this.data.charCodeAt(this.read+1)<<8^this.data.charCodeAt(this.read+2)<<16;return this.read+=3,e};E.ByteStringBuffer.prototype.getInt32Le=function(){var e=this.data.charCodeAt(this.read)^this.data.charCodeAt(this.read+1)<<8^this.data.charCodeAt(this.read+2)<<16^this.data.charCodeAt(this.read+3)<<24;return this.read+=4,e};E.ByteStringBuffer.prototype.getInt=function(e){pr(e);var t=0;do t=(t<<8)+this.data.charCodeAt(this.read++),e-=8;while(e>0);return t};E.ByteStringBuffer.prototype.getSignedInt=function(e){var t=this.getInt(e),a=2<<e-2;return t>=a&&(t-=a<<1),t};E.ByteStringBuffer.prototype.getBytes=function(e){var t;return e?(e=Math.min(this.length(),e),t=this.data.slice(this.read,this.read+e),this.read+=e):e===0?t="":(t=this.read===0?this.data:this.data.slice(this.read),this.clear()),t};E.ByteStringBuffer.prototype.bytes=function(e){return typeof e>"u"?this.data.slice(this.read):this.data.slice(this.read,this.read+e)};E.ByteStringBuffer.prototype.at=function(e){return this.data.charCodeAt(this.read+e)};E.ByteStringBuffer.prototype.setAt=function(e,t){return this.data=this.data.substr(0,this.read+e)+String.fromCharCode(t)+this.data.substr(this.read+e+1),this};E.ByteStringBuffer.prototype.last=function(){return this.data.charCodeAt(this.data.length-1)};E.ByteStringBuffer.prototype.copy=function(){var e=E.createBuffer(this.data);return e.read=this.read,e};E.ByteStringBuffer.prototype.compact=function(){return this.read>0&&(this.data=this.data.slice(this.read),this.read=0),this};E.ByteStringBuffer.prototype.clear=function(){return this.data="",this.read=0,this};E.ByteStringBuffer.prototype.truncate=function(e){var t=Math.max(0,this.length()-e);return this.data=this.data.substr(this.read,t),this.read=0,this};E.ByteStringBuffer.prototype.toHex=function(){for(var e="",t=this.read;t<this.data.length;++t){var a=this.data.charCodeAt(t);a<16&&(e+="0"),e+=a.toString(16)}return e};E.ByteStringBuffer.prototype.toString=function(){return E.decodeUtf8(this.bytes())};function Bo(e,t){t=t||{},this.read=t.readOffset||0,this.growSize=t.growSize||1024;var a=E.isArrayBuffer(e),r=E.isArrayBufferView(e);if(a||r){a?this.data=new DataView(e):this.data=new DataView(e.buffer,e.byteOffset,e.byteLength),this.write="writeOffset"in t?t.writeOffset:this.data.byteLength;return}this.data=new DataView(new ArrayBuffer(0)),this.write=0,e!=null&&this.putBytes(e),"writeOffset"in t&&(this.write=t.writeOffset)}E.DataBuffer=Bo;E.DataBuffer.prototype.length=function(){return this.write-this.read};E.DataBuffer.prototype.isEmpty=function(){return this.length()<=0};E.DataBuffer.prototype.accommodate=function(e,t){if(this.length()>=e)return this;t=Math.max(t||this.growSize,e);var a=new Uint8Array(this.data.buffer,this.data.byteOffset,this.data.byteLength),r=new Uint8Array(this.length()+t);return r.set(a),this.data=new DataView(r.buffer),this};E.DataBuffer.prototype.putByte=function(e){return this.accommodate(1),this.data.setUint8(this.write++,e),this};E.DataBuffer.prototype.fillWithByte=function(e,t){this.accommodate(t);for(var a=0;a<t;++a)this.data.setUint8(e);return this};E.DataBuffer.prototype.putBytes=function(e,t){if(E.isArrayBufferView(e)){var a=new Uint8Array(e.buffer,e.byteOffset,e.byteLength),r=a.byteLength-a.byteOffset;this.accommodate(r);var n=new Uint8Array(this.data.buffer,this.write);return n.set(a),this.write+=r,this}if(E.isArrayBuffer(e)){var a=new Uint8Array(e);this.accommodate(a.byteLength);var n=new Uint8Array(this.data.buffer);return n.set(a,this.write),this.write+=a.byteLength,this}if(e instanceof E.DataBuffer||typeof e=="object"&&typeof e.read=="number"&&typeof e.write=="number"&&E.isArrayBufferView(e.data)){var a=new Uint8Array(e.data.byteLength,e.read,e.length());this.accommodate(a.byteLength);var n=new Uint8Array(e.data.byteLength,this.write);return n.set(a),this.write+=a.byteLength,this}if(e instanceof E.ByteStringBuffer&&(e=e.data,t="binary"),t=t||"binary",typeof e=="string"){var s;if(t==="hex")return this.accommodate(Math.ceil(e.length/2)),s=new Uint8Array(this.data.buffer,this.write),this.write+=E.binary.hex.decode(e,s,this.write),this;if(t==="base64")return this.accommodate(Math.ceil(e.length/4)*3),s=new Uint8Array(this.data.buffer,this.write),this.write+=E.binary.base64.decode(e,s,this.write),this;if(t==="utf8"&&(e=E.encodeUtf8(e),t="binary"),t==="binary"||t==="raw")return this.accommodate(e.length),s=new Uint8Array(this.data.buffer,this.write),this.write+=E.binary.raw.decode(s),this;if(t==="utf16")return this.accommodate(e.length*2),s=new Uint16Array(this.data.buffer,this.write),this.write+=E.text.utf16.encode(s),this;throw new Error("Invalid encoding: "+t)}throw Error("Invalid parameter: "+e)};E.DataBuffer.prototype.putBuffer=function(e){return this.putBytes(e),e.clear(),this};E.DataBuffer.prototype.putString=function(e){return this.putBytes(e,"utf16")};E.DataBuffer.prototype.putInt16=function(e){return this.accommodate(2),this.data.setInt16(this.write,e),this.write+=2,this};E.DataBuffer.prototype.putInt24=function(e){return this.accommodate(3),this.data.setInt16(this.write,e>>8&65535),this.data.setInt8(this.write,e>>16&255),this.write+=3,this};E.DataBuffer.prototype.putInt32=function(e){return this.accommodate(4),this.data.setInt32(this.write,e),this.write+=4,this};E.DataBuffer.prototype.putInt16Le=function(e){return this.accommodate(2),this.data.setInt16(this.write,e,!0),this.write+=2,this};E.DataBuffer.prototype.putInt24Le=function(e){return this.accommodate(3),this.data.setInt8(this.write,e>>16&255),this.data.setInt16(this.write,e>>8&65535,!0),this.write+=3,this};E.DataBuffer.prototype.putInt32Le=function(e){return this.accommodate(4),this.data.setInt32(this.write,e,!0),this.write+=4,this};E.DataBuffer.prototype.putInt=function(e,t){pr(t),this.accommodate(t/8);do t-=8,this.data.setInt8(this.write++,e>>t&255);while(t>0);return this};E.DataBuffer.prototype.putSignedInt=function(e,t){return pr(t),this.accommodate(t/8),e<0&&(e+=2<<t-1),this.putInt(e,t)};E.DataBuffer.prototype.getByte=function(){return this.data.getInt8(this.read++)};E.DataBuffer.prototype.getInt16=function(){var e=this.data.getInt16(this.read);return this.read+=2,e};E.DataBuffer.prototype.getInt24=function(){var e=this.data.getInt16(this.read)<<8^this.data.getInt8(this.read+2);return this.read+=3,e};E.DataBuffer.prototype.getInt32=function(){var e=this.data.getInt32(this.read);return this.read+=4,e};E.DataBuffer.prototype.getInt16Le=function(){var e=this.data.getInt16(this.read,!0);return this.read+=2,e};E.DataBuffer.prototype.getInt24Le=function(){var e=this.data.getInt8(this.read)^this.data.getInt16(this.read+1,!0)<<8;return this.read+=3,e};E.DataBuffer.prototype.getInt32Le=function(){var e=this.data.getInt32(this.read,!0);return this.read+=4,e};E.DataBuffer.prototype.getInt=function(e){pr(e);var t=0;do t=(t<<8)+this.data.getInt8(this.read++),e-=8;while(e>0);return t};E.DataBuffer.prototype.getSignedInt=function(e){var t=this.getInt(e),a=2<<e-2;return t>=a&&(t-=a<<1),t};E.DataBuffer.prototype.getBytes=function(e){var t;return e?(e=Math.min(this.length(),e),t=this.data.slice(this.read,this.read+e),this.read+=e):e===0?t="":(t=this.read===0?this.data:this.data.slice(this.read),this.clear()),t};E.DataBuffer.prototype.bytes=function(e){return typeof e>"u"?this.data.slice(this.read):this.data.slice(this.read,this.read+e)};E.DataBuffer.prototype.at=function(e){return this.data.getUint8(this.read+e)};E.DataBuffer.prototype.setAt=function(e,t){return this.data.setUint8(e,t),this};E.DataBuffer.prototype.last=function(){return this.data.getUint8(this.write-1)};E.DataBuffer.prototype.copy=function(){return new E.DataBuffer(this)};E.DataBuffer.prototype.compact=function(){if(this.read>0){var e=new Uint8Array(this.data.buffer,this.read),t=new Uint8Array(e.byteLength);t.set(e),this.data=new DataView(t),this.write-=this.read,this.read=0}return this};E.DataBuffer.prototype.clear=function(){return this.data=new DataView(new ArrayBuffer(0)),this.read=this.write=0,this};E.DataBuffer.prototype.truncate=function(e){return this.write=Math.max(0,this.length()-e),this.read=Math.min(this.read,this.write),this};E.DataBuffer.prototype.toHex=function(){for(var e="",t=this.read;t<this.data.byteLength;++t){var a=this.data.getUint8(t);a<16&&(e+="0"),e+=a.toString(16)}return e};E.DataBuffer.prototype.toString=function(e){var t=new Uint8Array(this.data,this.read,this.length());if(e=e||"utf8",e==="binary"||e==="raw")return E.binary.raw.encode(t);if(e==="hex")return E.binary.hex.encode(t);if(e==="base64")return E.binary.base64.encode(t);if(e==="utf8")return E.text.utf8.decode(t);if(e==="utf16")return E.text.utf16.decode(t);throw new Error("Invalid encoding: "+e)};E.createBuffer=function(e,t){return t=t||"raw",e!==void 0&&t==="utf8"&&(e=E.encodeUtf8(e)),new E.ByteBuffer(e)};E.fillString=function(e,t){for(var a="";t>0;)t&1&&(a+=e),t>>>=1,t>0&&(e+=e);return a};E.xorBytes=function(e,t,a){for(var r="",n="",s="",i=0,o=0;a>0;--a,++i)n=e.charCodeAt(i)^t.charCodeAt(i),o>=10&&(r+=s,s="",o=0),s+=String.fromCharCode(n),++o;return r+=s,r};E.hexToBytes=function(e){var t="",a=0;for(e.length&!0&&(a=1,t+=String.fromCharCode(parseInt(e[0],16)));a<e.length;a+=2)t+=String.fromCharCode(parseInt(e.substr(a,2),16));return t};E.bytesToHex=function(e){return E.createBuffer(e).toHex()};E.int32ToBytes=function(e){return String.fromCharCode(e>>24&255)+String.fromCharCode(e>>16&255)+String.fromCharCode(e>>8&255)+String.fromCharCode(e&255)};var It="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",At=[62,-1,-1,-1,63,52,53,54,55,56,57,58,59,60,61,-1,-1,-1,64,-1,-1,-1,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,-1,-1,-1,-1,-1,-1,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51],Un="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";E.encode64=function(e,t){for(var a="",r="",n,s,i,o=0;o<e.length;)n=e.charCodeAt(o++),s=e.charCodeAt(o++),i=e.charCodeAt(o++),a+=It.charAt(n>>2),a+=It.charAt((n&3)<<4|s>>4),isNaN(s)?a+="==":(a+=It.charAt((s&15)<<2|i>>6),a+=isNaN(i)?"=":It.charAt(i&63)),t&&a.length>t&&(r+=a.substr(0,t)+`\r
3
- `,a=a.substr(t));return r+=a,r};E.decode64=function(e){e=e.replace(/[^A-Za-z0-9\+\/\=]/g,"");for(var t="",a,r,n,s,i=0;i<e.length;)a=At[e.charCodeAt(i++)-43],r=At[e.charCodeAt(i++)-43],n=At[e.charCodeAt(i++)-43],s=At[e.charCodeAt(i++)-43],t+=String.fromCharCode(a<<2|r>>4),n!==64&&(t+=String.fromCharCode((r&15)<<4|n>>2),s!==64&&(t+=String.fromCharCode((n&3)<<6|s)));return t};E.encodeUtf8=function(e){return unescape(encodeURIComponent(e))};E.decodeUtf8=function(e){return decodeURIComponent(escape(e))};E.binary={raw:{},hex:{},base64:{},base58:{},baseN:{encode:Dn.encode,decode:Dn.decode}};E.binary.raw.encode=function(e){return String.fromCharCode.apply(null,e)};E.binary.raw.decode=function(e,t,a){var r=t;r||(r=new Uint8Array(e.length)),a=a||0;for(var n=a,s=0;s<e.length;++s)r[n++]=e.charCodeAt(s);return t?n-a:r};E.binary.hex.encode=E.bytesToHex;E.binary.hex.decode=function(e,t,a){var r=t;r||(r=new Uint8Array(Math.ceil(e.length/2))),a=a||0;var n=0,s=a;for(e.length&1&&(n=1,r[s++]=parseInt(e[0],16));n<e.length;n+=2)r[s++]=parseInt(e.substr(n,2),16);return t?s-a:r};E.binary.base64.encode=function(e,t){for(var a="",r="",n,s,i,o=0;o<e.byteLength;)n=e[o++],s=e[o++],i=e[o++],a+=It.charAt(n>>2),a+=It.charAt((n&3)<<4|s>>4),isNaN(s)?a+="==":(a+=It.charAt((s&15)<<2|i>>6),a+=isNaN(i)?"=":It.charAt(i&63)),t&&a.length>t&&(r+=a.substr(0,t)+`\r
4
- `,a=a.substr(t));return r+=a,r};E.binary.base64.decode=function(e,t,a){var r=t;r||(r=new Uint8Array(Math.ceil(e.length/4)*3)),e=e.replace(/[^A-Za-z0-9\+\/\=]/g,""),a=a||0;for(var n,s,i,o,l=0,u=a;l<e.length;)n=At[e.charCodeAt(l++)-43],s=At[e.charCodeAt(l++)-43],i=At[e.charCodeAt(l++)-43],o=At[e.charCodeAt(l++)-43],r[u++]=n<<2|s>>4,i!==64&&(r[u++]=(s&15)<<4|i>>2,o!==64&&(r[u++]=(i&3)<<6|o));return t?u-a:r.subarray(0,u)};E.binary.base58.encode=function(e,t){return E.binary.baseN.encode(e,Un,t)};E.binary.base58.decode=function(e,t){return E.binary.baseN.decode(e,Un,t)};E.text={utf8:{},utf16:{}};E.text.utf8.encode=function(e,t,a){e=E.encodeUtf8(e);var r=t;r||(r=new Uint8Array(e.length)),a=a||0;for(var n=a,s=0;s<e.length;++s)r[n++]=e.charCodeAt(s);return t?n-a:r};E.text.utf8.decode=function(e){return E.decodeUtf8(String.fromCharCode.apply(null,e))};E.text.utf16.encode=function(e,t,a){var r=t;r||(r=new Uint8Array(e.length*2));var n=new Uint16Array(r.buffer);a=a||0;for(var s=a,i=a,o=0;o<e.length;++o)n[i++]=e.charCodeAt(o),s+=2;return t?s-a:r};E.text.utf16.decode=function(e){return String.fromCharCode.apply(null,new Uint16Array(e.buffer))};E.deflate=function(e,t,a){if(t=E.decode64(e.deflate(E.encode64(t)).rval),a){var r=2,n=t.charCodeAt(1);n&32&&(r=6),t=t.substring(r,t.length-4)}return t};E.inflate=function(e,t,a){var r=e.inflate(E.encode64(t)).rval;return r===null?null:E.decode64(r)};var ya=function(e,t,a){if(!e)throw new Error("WebStorage not available.");var r;if(a===null?r=e.removeItem(t):(a=E.encode64(JSON.stringify(a)),r=e.setItem(t,a)),typeof r<"u"&&r.rval!==!0){var n=new Error(r.error.message);throw n.id=r.error.id,n.name=r.error.name,n}},ga=function(e,t){if(!e)throw new Error("WebStorage not available.");var a=e.getItem(t);if(e.init)if(a.rval===null){if(a.error){var r=new Error(a.error.message);throw r.id=a.error.id,r.name=a.error.name,r}a=null}else a=a.rval;return a!==null&&(a=JSON.parse(E.decode64(a))),a},bo=function(e,t,a,r){var n=ga(e,t);n===null&&(n={}),n[a]=r,ya(e,t,n)},_o=function(e,t,a){var r=ga(e,t);return r!==null&&(r=a in r?r[a]:null),r},No=function(e,t,a){var r=ga(e,t);if(r!==null&&a in r){delete r[a];var n=!0;for(var s in r){n=!1;break}n&&(r=null),ya(e,t,r)}},Ro=function(e,t){ya(e,t,null)},Dr=function(e,t,a){var r=null;typeof a>"u"&&(a=["web","flash"]);var n,s=!1,i=null;for(var o in a){n=a[o];try{if(n==="flash"||n==="both"){if(t[0]===null)throw new Error("Flash local storage not available.");r=e.apply(this,t),s=n==="flash"}(n==="web"||n==="both")&&(t[0]=localStorage,r=e.apply(this,t),s=!0)}catch(l){i=l}if(s)break}if(!s)throw i;return r};E.setItem=function(e,t,a,r,n){Dr(bo,arguments,n)};E.getItem=function(e,t,a,r){return Dr(_o,arguments,r)};E.removeItem=function(e,t,a,r){Dr(No,arguments,r)};E.clearItems=function(e,t,a){Dr(Ro,arguments,a)};E.isEmpty=function(e){for(var t in e)if(e.hasOwnProperty(t))return!1;return!0};E.format=function(e){for(var t=/%./g,a,r,n=0,s=[],i=0;a=t.exec(e);){r=e.substring(i,t.lastIndex-2),r.length>0&&s.push(r),i=t.lastIndex;var o=a[0][1];switch(o){case"s":case"o":n<arguments.length?s.push(arguments[n+++1]):s.push("<?>");break;case"%":s.push("%");break;default:s.push("<%"+o+"?>")}}return s.push(e.substring(i)),s.join("")};E.formatNumber=function(e,t,a,r){var n=e,s=isNaN(t=Math.abs(t))?2:t,i=a===void 0?",":a,o=r===void 0?".":r,l=n<0?"-":"",u=parseInt(n=Math.abs(+n||0).toFixed(s),10)+"",f=u.length>3?u.length%3:0;return l+(f?u.substr(0,f)+o:"")+u.substr(f).replace(/(\d{3})(?=\d)/g,"$1"+o)+(s?i+Math.abs(n-u).toFixed(s).slice(2):"")};E.formatSize=function(e){return e>=1073741824?e=E.formatNumber(e/1073741824,2,".","")+" GiB":e>=1048576?e=E.formatNumber(e/1048576,2,".","")+" MiB":e>=1024?e=E.formatNumber(e/1024,0)+" KiB":e=E.formatNumber(e,0)+" bytes",e};E.bytesFromIP=function(e){return e.indexOf(".")!==-1?E.bytesFromIPv4(e):e.indexOf(":")!==-1?E.bytesFromIPv6(e):null};E.bytesFromIPv4=function(e){if(e=e.split("."),e.length!==4)return null;for(var t=E.createBuffer(),a=0;a<e.length;++a){var r=parseInt(e[a],10);if(isNaN(r))return null;t.putByte(r)}return t.getBytes()};E.bytesFromIPv6=function(e){var t=0;e=e.split(":").filter(function(i){return i.length===0&&++t,!0});for(var a=(8-e.length+t)*2,r=E.createBuffer(),n=0;n<8;++n){if(!e[n]||e[n].length===0){r.fillWithByte(0,a),a=0;continue}var s=E.hexToBytes(e[n]);s.length<2&&r.putByte(0),r.putBytes(s)}return r.getBytes()};E.bytesToIP=function(e){return e.length===4?E.bytesToIPv4(e):e.length===16?E.bytesToIPv6(e):null};E.bytesToIPv4=function(e){if(e.length!==4)return null;for(var t=[],a=0;a<e.length;++a)t.push(e.charCodeAt(a));return t.join(".")};E.bytesToIPv6=function(e){if(e.length!==16)return null;for(var t=[],a=[],r=0,n=0;n<e.length;n+=2){for(var s=E.bytesToHex(e[n]+e[n+1]);s[0]==="0"&&s!=="0";)s=s.substr(1);if(s==="0"){var i=a[a.length-1],o=t.length;!i||o!==i.end+1?a.push({start:o,end:o}):(i.end=o,i.end-i.start>a[r].end-a[r].start&&(r=a.length-1))}t.push(s)}if(a.length>0){var l=a[r];l.end-l.start>0&&(t.splice(l.start,l.end-l.start+1,""),l.start===0&&t.unshift(""),l.end===7&&t.push(""))}return t.join(":")};E.estimateCores=function(e,t){if(typeof e=="function"&&(t=e,e={}),e=e||{},"cores"in E&&!e.update)return t(null,E.cores);if(typeof navigator<"u"&&"hardwareConcurrency"in navigator&&navigator.hardwareConcurrency>0)return E.cores=navigator.hardwareConcurrency,t(null,E.cores);if(typeof Worker>"u")return E.cores=1,t(null,E.cores);if(typeof Blob>"u")return E.cores=2,t(null,E.cores);var a=URL.createObjectURL(new Blob(["(",function(){self.addEventListener("message",function(i){for(var o=Date.now(),l=o+4;Date.now()<l;);self.postMessage({st:o,et:l})})}.toString(),")()"],{type:"application/javascript"}));r([],5,16);function r(i,o,l){if(o===0){var u=Math.floor(i.reduce(function(f,c){return f+c},0)/i.length);return E.cores=Math.max(1,u),URL.revokeObjectURL(a),t(null,E.cores)}n(l,function(f,c){i.push(s(l,c)),r(i,o-1,l)})}function n(i,o){for(var l=[],u=[],f=0;f<i;++f){var c=new Worker(a);c.addEventListener("message",function(v){if(u.push(v.data),u.length===i){for(var g=0;g<i;++g)l[g].terminate();o(null,u)}}),l.push(c)}for(var f=0;f<i;++f)l[f].postMessage(f)}function s(i,o){for(var l=[],u=0;u<i;++u)for(var f=o[u],c=l[u]=[],v=0;v<i;++v)if(u!==v){var g=o[v];(f.st>g.st&&f.st<g.et||g.st>f.st&&g.st<f.et)&&c.push(v)}return l.reduce(function(y,x){return Math.max(y,x.length)},0)}}});var Ur=M((ac,Vn)=>{var Se=X();ne();Vn.exports=Se.cipher=Se.cipher||{};Se.cipher.algorithms=Se.cipher.algorithms||{};Se.cipher.createCipher=function(e,t){var a=e;if(typeof a=="string"&&(a=Se.cipher.getAlgorithm(a),a&&(a=a())),!a)throw new Error("Unsupported algorithm: "+e);return new Se.cipher.BlockCipher({algorithm:a,key:t,decrypt:!1})};Se.cipher.createDecipher=function(e,t){var a=e;if(typeof a=="string"&&(a=Se.cipher.getAlgorithm(a),a&&(a=a())),!a)throw new Error("Unsupported algorithm: "+e);return new Se.cipher.BlockCipher({algorithm:a,key:t,decrypt:!0})};Se.cipher.registerAlgorithm=function(e,t){e=e.toUpperCase(),Se.cipher.algorithms[e]=t};Se.cipher.getAlgorithm=function(e){return e=e.toUpperCase(),e in Se.cipher.algorithms?Se.cipher.algorithms[e]:null};var ma=Se.cipher.BlockCipher=function(e){this.algorithm=e.algorithm,this.mode=this.algorithm.mode,this.blockSize=this.mode.blockSize,this._finish=!1,this._input=null,this.output=null,this._op=e.decrypt?this.mode.decrypt:this.mode.encrypt,this._decrypt=e.decrypt,this.algorithm.initialize(e)};ma.prototype.start=function(e){e=e||{};var t={};for(var a in e)t[a]=e[a];t.decrypt=this._decrypt,this._finish=!1,this._input=Se.util.createBuffer(),this.output=e.output||Se.util.createBuffer(),this.mode.start(t)};ma.prototype.update=function(e){for(e&&this._input.putBuffer(e);!this._op.call(this.mode,this._input,this.output,this._finish)&&!this._finish;);this._input.compact()};ma.prototype.finish=function(e){e&&(this.mode.name==="ECB"||this.mode.name==="CBC")&&(this.mode.pad=function(a){return e(this.blockSize,a,!1)},this.mode.unpad=function(a){return e(this.blockSize,a,!0)});var t={};return t.decrypt=this._decrypt,t.overflow=this._input.length()%this.blockSize,!(!this._decrypt&&this.mode.pad&&!this.mode.pad(this._input,t)||(this._finish=!0,this.update(),this._decrypt&&this.mode.unpad&&!this.mode.unpad(this.output,t))||this.mode.afterFinish&&!this.mode.afterFinish(this.output,t))}});var Ea=M((nc,On)=>{var Te=X();ne();Te.cipher=Te.cipher||{};var W=On.exports=Te.cipher.modes=Te.cipher.modes||{};W.ecb=function(e){e=e||{},this.name="ECB",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=new Array(this._ints),this._outBlock=new Array(this._ints)};W.ecb.prototype.start=function(e){};W.ecb.prototype.encrypt=function(e,t,a){if(e.length()<this.blockSize&&!(a&&e.length()>0))return!0;for(var r=0;r<this._ints;++r)this._inBlock[r]=e.getInt32();this.cipher.encrypt(this._inBlock,this._outBlock);for(var r=0;r<this._ints;++r)t.putInt32(this._outBlock[r])};W.ecb.prototype.decrypt=function(e,t,a){if(e.length()<this.blockSize&&!(a&&e.length()>0))return!0;for(var r=0;r<this._ints;++r)this._inBlock[r]=e.getInt32();this.cipher.decrypt(this._inBlock,this._outBlock);for(var r=0;r<this._ints;++r)t.putInt32(this._outBlock[r])};W.ecb.prototype.pad=function(e,t){var a=e.length()===this.blockSize?this.blockSize:this.blockSize-e.length();return e.fillWithByte(a,a),!0};W.ecb.prototype.unpad=function(e,t){if(t.overflow>0)return!1;var a=e.length(),r=e.at(a-1);return r>this.blockSize<<2?!1:(e.truncate(r),!0)};W.cbc=function(e){e=e||{},this.name="CBC",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=new Array(this._ints),this._outBlock=new Array(this._ints)};W.cbc.prototype.start=function(e){if(e.iv===null){if(!this._prev)throw new Error("Invalid IV parameter.");this._iv=this._prev.slice(0)}else if("iv"in e)this._iv=Pr(e.iv,this.blockSize),this._prev=this._iv.slice(0);else throw new Error("Invalid IV parameter.")};W.cbc.prototype.encrypt=function(e,t,a){if(e.length()<this.blockSize&&!(a&&e.length()>0))return!0;for(var r=0;r<this._ints;++r)this._inBlock[r]=this._prev[r]^e.getInt32();this.cipher.encrypt(this._inBlock,this._outBlock);for(var r=0;r<this._ints;++r)t.putInt32(this._outBlock[r]);this._prev=this._outBlock};W.cbc.prototype.decrypt=function(e,t,a){if(e.length()<this.blockSize&&!(a&&e.length()>0))return!0;for(var r=0;r<this._ints;++r)this._inBlock[r]=e.getInt32();this.cipher.decrypt(this._inBlock,this._outBlock);for(var r=0;r<this._ints;++r)t.putInt32(this._prev[r]^this._outBlock[r]);this._prev=this._inBlock.slice(0)};W.cbc.prototype.pad=function(e,t){var a=e.length()===this.blockSize?this.blockSize:this.blockSize-e.length();return e.fillWithByte(a,a),!0};W.cbc.prototype.unpad=function(e,t){if(t.overflow>0)return!1;var a=e.length(),r=e.at(a-1);return r>this.blockSize<<2?!1:(e.truncate(r),!0)};W.cfb=function(e){e=e||{},this.name="CFB",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=null,this._outBlock=new Array(this._ints),this._partialBlock=new Array(this._ints),this._partialOutput=Te.util.createBuffer(),this._partialBytes=0};W.cfb.prototype.start=function(e){if(!("iv"in e))throw new Error("Invalid IV parameter.");this._iv=Pr(e.iv,this.blockSize),this._inBlock=this._iv.slice(0),this._partialBytes=0};W.cfb.prototype.encrypt=function(e,t,a){var r=e.length();if(r===0)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),this._partialBytes===0&&r>=this.blockSize){for(var n=0;n<this._ints;++n)this._inBlock[n]=e.getInt32()^this._outBlock[n],t.putInt32(this._inBlock[n]);return}var s=(this.blockSize-r)%this.blockSize;s>0&&(s=this.blockSize-s),this._partialOutput.clear();for(var n=0;n<this._ints;++n)this._partialBlock[n]=e.getInt32()^this._outBlock[n],this._partialOutput.putInt32(this._partialBlock[n]);if(s>0)e.read-=this.blockSize;else for(var n=0;n<this._ints;++n)this._inBlock[n]=this._partialBlock[n];if(this._partialBytes>0&&this._partialOutput.getBytes(this._partialBytes),s>0&&!a)return t.putBytes(this._partialOutput.getBytes(s-this._partialBytes)),this._partialBytes=s,!0;t.putBytes(this._partialOutput.getBytes(r-this._partialBytes)),this._partialBytes=0};W.cfb.prototype.decrypt=function(e,t,a){var r=e.length();if(r===0)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),this._partialBytes===0&&r>=this.blockSize){for(var n=0;n<this._ints;++n)this._inBlock[n]=e.getInt32(),t.putInt32(this._inBlock[n]^this._outBlock[n]);return}var s=(this.blockSize-r)%this.blockSize;s>0&&(s=this.blockSize-s),this._partialOutput.clear();for(var n=0;n<this._ints;++n)this._partialBlock[n]=e.getInt32(),this._partialOutput.putInt32(this._partialBlock[n]^this._outBlock[n]);if(s>0)e.read-=this.blockSize;else for(var n=0;n<this._ints;++n)this._inBlock[n]=this._partialBlock[n];if(this._partialBytes>0&&this._partialOutput.getBytes(this._partialBytes),s>0&&!a)return t.putBytes(this._partialOutput.getBytes(s-this._partialBytes)),this._partialBytes=s,!0;t.putBytes(this._partialOutput.getBytes(r-this._partialBytes)),this._partialBytes=0};W.ofb=function(e){e=e||{},this.name="OFB",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=null,this._outBlock=new Array(this._ints),this._partialOutput=Te.util.createBuffer(),this._partialBytes=0};W.ofb.prototype.start=function(e){if(!("iv"in e))throw new Error("Invalid IV parameter.");this._iv=Pr(e.iv,this.blockSize),this._inBlock=this._iv.slice(0),this._partialBytes=0};W.ofb.prototype.encrypt=function(e,t,a){var r=e.length();if(e.length()===0)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),this._partialBytes===0&&r>=this.blockSize){for(var n=0;n<this._ints;++n)t.putInt32(e.getInt32()^this._outBlock[n]),this._inBlock[n]=this._outBlock[n];return}var s=(this.blockSize-r)%this.blockSize;s>0&&(s=this.blockSize-s),this._partialOutput.clear();for(var n=0;n<this._ints;++n)this._partialOutput.putInt32(e.getInt32()^this._outBlock[n]);if(s>0)e.read-=this.blockSize;else for(var n=0;n<this._ints;++n)this._inBlock[n]=this._outBlock[n];if(this._partialBytes>0&&this._partialOutput.getBytes(this._partialBytes),s>0&&!a)return t.putBytes(this._partialOutput.getBytes(s-this._partialBytes)),this._partialBytes=s,!0;t.putBytes(this._partialOutput.getBytes(r-this._partialBytes)),this._partialBytes=0};W.ofb.prototype.decrypt=W.ofb.prototype.encrypt;W.ctr=function(e){e=e||{},this.name="CTR",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=null,this._outBlock=new Array(this._ints),this._partialOutput=Te.util.createBuffer(),this._partialBytes=0};W.ctr.prototype.start=function(e){if(!("iv"in e))throw new Error("Invalid IV parameter.");this._iv=Pr(e.iv,this.blockSize),this._inBlock=this._iv.slice(0),this._partialBytes=0};W.ctr.prototype.encrypt=function(e,t,a){var r=e.length();if(r===0)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),this._partialBytes===0&&r>=this.blockSize)for(var n=0;n<this._ints;++n)t.putInt32(e.getInt32()^this._outBlock[n]);else{var s=(this.blockSize-r)%this.blockSize;s>0&&(s=this.blockSize-s),this._partialOutput.clear();for(var n=0;n<this._ints;++n)this._partialOutput.putInt32(e.getInt32()^this._outBlock[n]);if(s>0&&(e.read-=this.blockSize),this._partialBytes>0&&this._partialOutput.getBytes(this._partialBytes),s>0&&!a)return t.putBytes(this._partialOutput.getBytes(s-this._partialBytes)),this._partialBytes=s,!0;t.putBytes(this._partialOutput.getBytes(r-this._partialBytes)),this._partialBytes=0}Vr(this._inBlock)};W.ctr.prototype.decrypt=W.ctr.prototype.encrypt;W.gcm=function(e){e=e||{},this.name="GCM",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=new Array(this._ints),this._outBlock=new Array(this._ints),this._partialOutput=Te.util.createBuffer(),this._partialBytes=0,this._R=3774873600};W.gcm.prototype.start=function(e){if(!("iv"in e))throw new Error("Invalid IV parameter.");var t=Te.util.createBuffer(e.iv);this._cipherLength=0;var a;if("additionalData"in e?a=Te.util.createBuffer(e.additionalData):a=Te.util.createBuffer(),"tagLength"in e?this._tagLength=e.tagLength:this._tagLength=128,this._tag=null,e.decrypt&&(this._tag=Te.util.createBuffer(e.tag).getBytes(),this._tag.length!==this._tagLength/8))throw new Error("Authentication tag does not match tag length.");this._hashBlock=new Array(this._ints),this.tag=null,this._hashSubkey=new Array(this._ints),this.cipher.encrypt([0,0,0,0],this._hashSubkey),this.componentBits=4,this._m=this.generateHashTable(this._hashSubkey,this.componentBits);var r=t.length();if(r===12)this._j0=[t.getInt32(),t.getInt32(),t.getInt32(),1];else{for(this._j0=[0,0,0,0];t.length()>0;)this._j0=this.ghash(this._hashSubkey,this._j0,[t.getInt32(),t.getInt32(),t.getInt32(),t.getInt32()]);this._j0=this.ghash(this._hashSubkey,this._j0,[0,0].concat(Ca(r*8)))}this._inBlock=this._j0.slice(0),Vr(this._inBlock),this._partialBytes=0,a=Te.util.createBuffer(a),this._aDataLength=Ca(a.length()*8);var n=a.length()%this.blockSize;for(n&&a.fillWithByte(0,this.blockSize-n),this._s=[0,0,0,0];a.length()>0;)this._s=this.ghash(this._hashSubkey,this._s,[a.getInt32(),a.getInt32(),a.getInt32(),a.getInt32()])};W.gcm.prototype.encrypt=function(e,t,a){var r=e.length();if(r===0)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),this._partialBytes===0&&r>=this.blockSize){for(var n=0;n<this._ints;++n)t.putInt32(this._outBlock[n]^=e.getInt32());this._cipherLength+=this.blockSize}else{var s=(this.blockSize-r)%this.blockSize;s>0&&(s=this.blockSize-s),this._partialOutput.clear();for(var n=0;n<this._ints;++n)this._partialOutput.putInt32(e.getInt32()^this._outBlock[n]);if(s<=0||a){if(a){var i=r%this.blockSize;this._cipherLength+=i,this._partialOutput.truncate(this.blockSize-i)}else this._cipherLength+=this.blockSize;for(var n=0;n<this._ints;++n)this._outBlock[n]=this._partialOutput.getInt32();this._partialOutput.read-=this.blockSize}if(this._partialBytes>0&&this._partialOutput.getBytes(this._partialBytes),s>0&&!a)return e.read-=this.blockSize,t.putBytes(this._partialOutput.getBytes(s-this._partialBytes)),this._partialBytes=s,!0;t.putBytes(this._partialOutput.getBytes(r-this._partialBytes)),this._partialBytes=0}this._s=this.ghash(this._hashSubkey,this._s,this._outBlock),Vr(this._inBlock)};W.gcm.prototype.decrypt=function(e,t,a){var r=e.length();if(r<this.blockSize&&!(a&&r>0))return!0;this.cipher.encrypt(this._inBlock,this._outBlock),Vr(this._inBlock),this._hashBlock[0]=e.getInt32(),this._hashBlock[1]=e.getInt32(),this._hashBlock[2]=e.getInt32(),this._hashBlock[3]=e.getInt32(),this._s=this.ghash(this._hashSubkey,this._s,this._hashBlock);for(var n=0;n<this._ints;++n)t.putInt32(this._outBlock[n]^this._hashBlock[n]);r<this.blockSize?this._cipherLength+=r%this.blockSize:this._cipherLength+=this.blockSize};W.gcm.prototype.afterFinish=function(e,t){var a=!0;t.decrypt&&t.overflow&&e.truncate(this.blockSize-t.overflow),this.tag=Te.util.createBuffer();var r=this._aDataLength.concat(Ca(this._cipherLength*8));this._s=this.ghash(this._hashSubkey,this._s,r);var n=[];this.cipher.encrypt(this._j0,n);for(var s=0;s<this._ints;++s)this.tag.putInt32(this._s[s]^n[s]);return this.tag.truncate(this.tag.length()%(this._tagLength/8)),t.decrypt&&this.tag.bytes()!==this._tag&&(a=!1),a};W.gcm.prototype.multiply=function(e,t){for(var a=[0,0,0,0],r=t.slice(0),n=0;n<128;++n){var s=e[n/32|0]&1<<31-n%32;s&&(a[0]^=r[0],a[1]^=r[1],a[2]^=r[2],a[3]^=r[3]),this.pow(r,r)}return a};W.gcm.prototype.pow=function(e,t){for(var a=e[3]&1,r=3;r>0;--r)t[r]=e[r]>>>1|(e[r-1]&1)<<31;t[0]=e[0]>>>1,a&&(t[0]^=this._R)};W.gcm.prototype.tableMultiply=function(e){for(var t=[0,0,0,0],a=0;a<32;++a){var r=a/8|0,n=e[r]>>>(7-a%8)*4&15,s=this._m[a][n];t[0]^=s[0],t[1]^=s[1],t[2]^=s[2],t[3]^=s[3]}return t};W.gcm.prototype.ghash=function(e,t,a){return t[0]^=a[0],t[1]^=a[1],t[2]^=a[2],t[3]^=a[3],this.tableMultiply(t)};W.gcm.prototype.generateHashTable=function(e,t){for(var a=8/t,r=4*a,n=16*a,s=new Array(n),i=0;i<n;++i){var o=[0,0,0,0],l=i/r|0,u=(r-1-i%r)*t;o[l]=1<<t-1<<u,s[i]=this.generateSubHashTable(this.multiply(o,e),t)}return s};W.gcm.prototype.generateSubHashTable=function(e,t){var a=1<<t,r=a>>>1,n=new Array(a);n[r]=e.slice(0);for(var s=r>>>1;s>0;)this.pow(n[2*s],n[s]=[]),s>>=1;for(s=2;s<r;){for(var i=1;i<s;++i){var o=n[s],l=n[i];n[s+i]=[o[0]^l[0],o[1]^l[1],o[2]^l[2],o[3]^l[3]]}s*=2}for(n[0]=[0,0,0,0],s=r+1;s<a;++s){var u=n[s^r];n[s]=[e[0]^u[0],e[1]^u[1],e[2]^u[2],e[3]^u[3]]}return n};function Pr(e,t){if(typeof e=="string"&&(e=Te.util.createBuffer(e)),Te.util.isArray(e)&&e.length>4){var a=e;e=Te.util.createBuffer();for(var r=0;r<a.length;++r)e.putByte(a[r])}if(e.length()<t)throw new Error("Invalid IV length; got "+e.length()+" bytes and expected "+t+" bytes.");if(!Te.util.isArray(e)){for(var n=[],s=t/4,r=0;r<s;++r)n.push(e.getInt32());e=n}return e}function Vr(e){e[e.length-1]=e[e.length-1]+1&4294967295}function Ca(e){return[e/4294967296|0,e&4294967295]}});var Bt=M((ic,Mn)=>{var fe=X();Ur();Ea();ne();Mn.exports=fe.aes=fe.aes||{};fe.aes.startEncrypting=function(e,t,a,r){var n=Or({key:e,output:a,decrypt:!1,mode:r});return n.start(t),n};fe.aes.createEncryptionCipher=function(e,t){return Or({key:e,output:null,decrypt:!1,mode:t})};fe.aes.startDecrypting=function(e,t,a,r){var n=Or({key:e,output:a,decrypt:!0,mode:r});return n.start(t),n};fe.aes.createDecryptionCipher=function(e,t){return Or({key:e,output:null,decrypt:!0,mode:t})};fe.aes.Algorithm=function(e,t){Ta||Fn();var a=this;a.name=e,a.mode=new t({blockSize:16,cipher:{encrypt:function(r,n){return Sa(a._w,r,n,!1)},decrypt:function(r,n){return Sa(a._w,r,n,!0)}}}),a._init=!1};fe.aes.Algorithm.prototype.initialize=function(e){if(!this._init){var t=e.key,a;if(typeof t=="string"&&(t.length===16||t.length===24||t.length===32))t=fe.util.createBuffer(t);else if(fe.util.isArray(t)&&(t.length===16||t.length===24||t.length===32)){a=t,t=fe.util.createBuffer();for(var r=0;r<a.length;++r)t.putByte(a[r])}if(!fe.util.isArray(t)){a=t,t=[];var n=a.length();if(n===16||n===24||n===32){n=n>>>2;for(var r=0;r<n;++r)t.push(a.getInt32())}}if(!fe.util.isArray(t)||!(t.length===4||t.length===6||t.length===8))throw new Error("Invalid key parameter.");var s=this.mode.name,i=["CFB","OFB","CTR","GCM"].indexOf(s)!==-1;this._w=qn(t,e.decrypt&&!i),this._init=!0}};fe.aes._expandKey=function(e,t){return Ta||Fn(),qn(e,t)};fe.aes._updateBlock=Sa;Zt("AES-ECB",fe.cipher.modes.ecb);Zt("AES-CBC",fe.cipher.modes.cbc);Zt("AES-CFB",fe.cipher.modes.cfb);Zt("AES-OFB",fe.cipher.modes.ofb);Zt("AES-CTR",fe.cipher.modes.ctr);Zt("AES-GCM",fe.cipher.modes.gcm);function Zt(e,t){var a=function(){return new fe.aes.Algorithm(e,t)};fe.cipher.registerAlgorithm(e,a)}var Ta=!1,$t=4,He,xa,Kn,Ot,it;function Fn(){Ta=!0,Kn=[0,1,2,4,8,16,32,64,128,27,54];for(var e=new Array(256),t=0;t<128;++t)e[t]=t<<1,e[t+128]=t+128<<1^283;He=new Array(256),xa=new Array(256),Ot=new Array(4),it=new Array(4);for(var t=0;t<4;++t)Ot[t]=new Array(256),it[t]=new Array(256);for(var a=0,r=0,n,s,i,o,l,u,f,t=0;t<256;++t){o=r^r<<1^r<<2^r<<3^r<<4,o=o>>8^o&255^99,He[a]=o,xa[o]=a,l=e[o],n=e[a],s=e[n],i=e[s],u=l<<24^o<<16^o<<8^(o^l),f=(n^s^i)<<24^(a^i)<<16^(a^s^i)<<8^(a^n^i);for(var c=0;c<4;++c)Ot[c][a]=u,it[c][o]=f,u=u<<24|u>>>8,f=f<<24|f>>>8;a===0?a=r=1:(a=n^e[e[e[n^i]]],r^=e[e[r]])}}function qn(e,t){for(var a=e.slice(0),r,n=1,s=a.length,i=s+6+1,o=$t*i,l=s;l<o;++l)r=a[l-1],l%s===0?(r=He[r>>>16&255]<<24^He[r>>>8&255]<<16^He[r&255]<<8^He[r>>>24]^Kn[n]<<24,n++):s>6&&l%s===4&&(r=He[r>>>24]<<24^He[r>>>16&255]<<16^He[r>>>8&255]<<8^He[r&255]),a[l]=a[l-s]^r;if(t){var u,f=it[0],c=it[1],v=it[2],g=it[3],y=a.slice(0);o=a.length;for(var l=0,x=o-$t;l<o;l+=$t,x-=$t)if(l===0||l===o-$t)y[l]=a[x],y[l+1]=a[x+3],y[l+2]=a[x+2],y[l+3]=a[x+1];else for(var S=0;S<$t;++S)u=a[x+S],y[l+(3&-S)]=f[He[u>>>24]]^c[He[u>>>16&255]]^v[He[u>>>8&255]]^g[He[u&255]];a=y}return a}function Sa(e,t,a,r){var n=e.length/4-1,s,i,o,l,u;r?(s=it[0],i=it[1],o=it[2],l=it[3],u=xa):(s=Ot[0],i=Ot[1],o=Ot[2],l=Ot[3],u=He);var f,c,v,g,y,x,S;f=t[0]^e[0],c=t[r?3:1]^e[1],v=t[2]^e[2],g=t[r?1:3]^e[3];for(var I=3,B=1;B<n;++B)y=s[f>>>24]^i[c>>>16&255]^o[v>>>8&255]^l[g&255]^e[++I],x=s[c>>>24]^i[v>>>16&255]^o[g>>>8&255]^l[f&255]^e[++I],S=s[v>>>24]^i[g>>>16&255]^o[f>>>8&255]^l[c&255]^e[++I],g=s[g>>>24]^i[f>>>16&255]^o[c>>>8&255]^l[v&255]^e[++I],f=y,c=x,v=S;a[0]=u[f>>>24]<<24^u[c>>>16&255]<<16^u[v>>>8&255]<<8^u[g&255]^e[++I],a[r?3:1]=u[c>>>24]<<24^u[v>>>16&255]<<16^u[g>>>8&255]<<8^u[f&255]^e[++I],a[2]=u[v>>>24]<<24^u[g>>>16&255]<<16^u[f>>>8&255]<<8^u[c&255]^e[++I],a[r?1:3]=u[g>>>24]<<24^u[f>>>16&255]<<16^u[c>>>8&255]<<8^u[v&255]^e[++I]}function Or(e){e=e||{};var t=(e.mode||"CBC").toUpperCase(),a="AES-"+t,r;e.decrypt?r=fe.cipher.createDecipher(a,e.key):r=fe.cipher.createCipher(a,e.key);var n=r.start;return r.start=function(s,i){var o=null;i instanceof fe.util.ByteBuffer&&(o=i,i={}),i=i||{},i.output=o,i.iv=s,n.call(r,i)},r}});var bt=M((sc,Hn)=>{var vr=X();vr.pki=vr.pki||{};var Ia=Hn.exports=vr.pki.oids=vr.oids=vr.oids||{};function R(e,t){Ia[e]=t,Ia[t]=e}function se(e,t){Ia[e]=t}R("1.2.840.113549.1.1.1","rsaEncryption");R("1.2.840.113549.1.1.4","md5WithRSAEncryption");R("1.2.840.113549.1.1.5","sha1WithRSAEncryption");R("1.2.840.113549.1.1.7","RSAES-OAEP");R("1.2.840.113549.1.1.8","mgf1");R("1.2.840.113549.1.1.9","pSpecified");R("1.2.840.113549.1.1.10","RSASSA-PSS");R("1.2.840.113549.1.1.11","sha256WithRSAEncryption");R("1.2.840.113549.1.1.12","sha384WithRSAEncryption");R("1.2.840.113549.1.1.13","sha512WithRSAEncryption");R("1.3.101.112","EdDSA25519");R("1.2.840.10040.4.3","dsa-with-sha1");R("1.3.14.3.2.7","desCBC");R("1.3.14.3.2.26","sha1");R("1.3.14.3.2.29","sha1WithRSASignature");R("2.16.840.1.101.3.4.2.1","sha256");R("2.16.840.1.101.3.4.2.2","sha384");R("2.16.840.1.101.3.4.2.3","sha512");R("2.16.840.1.101.3.4.2.4","sha224");R("2.16.840.1.101.3.4.2.5","sha512-224");R("2.16.840.1.101.3.4.2.6","sha512-256");R("1.2.840.113549.2.2","md2");R("1.2.840.113549.2.5","md5");R("1.2.840.113549.1.7.1","data");R("1.2.840.113549.1.7.2","signedData");R("1.2.840.113549.1.7.3","envelopedData");R("1.2.840.113549.1.7.4","signedAndEnvelopedData");R("1.2.840.113549.1.7.5","digestedData");R("1.2.840.113549.1.7.6","encryptedData");R("1.2.840.113549.1.9.1","emailAddress");R("1.2.840.113549.1.9.2","unstructuredName");R("1.2.840.113549.1.9.3","contentType");R("1.2.840.113549.1.9.4","messageDigest");R("1.2.840.113549.1.9.5","signingTime");R("1.2.840.113549.1.9.6","counterSignature");R("1.2.840.113549.1.9.7","challengePassword");R("1.2.840.113549.1.9.8","unstructuredAddress");R("1.2.840.113549.1.9.14","extensionRequest");R("1.2.840.113549.1.9.20","friendlyName");R("1.2.840.113549.1.9.21","localKeyId");R("1.2.840.113549.1.9.22.1","x509Certificate");R("1.2.840.113549.1.12.10.1.1","keyBag");R("1.2.840.113549.1.12.10.1.2","pkcs8ShroudedKeyBag");R("1.2.840.113549.1.12.10.1.3","certBag");R("1.2.840.113549.1.12.10.1.4","crlBag");R("1.2.840.113549.1.12.10.1.5","secretBag");R("1.2.840.113549.1.12.10.1.6","safeContentsBag");R("1.2.840.113549.1.5.13","pkcs5PBES2");R("1.2.840.113549.1.5.12","pkcs5PBKDF2");R("1.2.840.113549.1.12.1.1","pbeWithSHAAnd128BitRC4");R("1.2.840.113549.1.12.1.2","pbeWithSHAAnd40BitRC4");R("1.2.840.113549.1.12.1.3","pbeWithSHAAnd3-KeyTripleDES-CBC");R("1.2.840.113549.1.12.1.4","pbeWithSHAAnd2-KeyTripleDES-CBC");R("1.2.840.113549.1.12.1.5","pbeWithSHAAnd128BitRC2-CBC");R("1.2.840.113549.1.12.1.6","pbewithSHAAnd40BitRC2-CBC");R("1.2.840.113549.2.7","hmacWithSHA1");R("1.2.840.113549.2.8","hmacWithSHA224");R("1.2.840.113549.2.9","hmacWithSHA256");R("1.2.840.113549.2.10","hmacWithSHA384");R("1.2.840.113549.2.11","hmacWithSHA512");R("1.2.840.113549.3.7","des-EDE3-CBC");R("2.16.840.1.101.3.4.1.2","aes128-CBC");R("2.16.840.1.101.3.4.1.22","aes192-CBC");R("2.16.840.1.101.3.4.1.42","aes256-CBC");R("2.5.4.3","commonName");R("2.5.4.4","surname");R("2.5.4.5","serialNumber");R("2.5.4.6","countryName");R("2.5.4.7","localityName");R("2.5.4.8","stateOrProvinceName");R("2.5.4.9","streetAddress");R("2.5.4.10","organizationName");R("2.5.4.11","organizationalUnitName");R("2.5.4.12","title");R("2.5.4.13","description");R("2.5.4.15","businessCategory");R("2.5.4.17","postalCode");R("2.5.4.42","givenName");R("2.5.4.65","pseudonym");R("1.3.6.1.4.1.311.60.2.1.2","jurisdictionOfIncorporationStateOrProvinceName");R("1.3.6.1.4.1.311.60.2.1.3","jurisdictionOfIncorporationCountryName");R("2.16.840.1.113730.1.1","nsCertType");R("2.16.840.1.113730.1.13","nsComment");se("2.5.29.1","authorityKeyIdentifier");se("2.5.29.2","keyAttributes");se("2.5.29.3","certificatePolicies");se("2.5.29.4","keyUsageRestriction");se("2.5.29.5","policyMapping");se("2.5.29.6","subtreesConstraint");se("2.5.29.7","subjectAltName");se("2.5.29.8","issuerAltName");se("2.5.29.9","subjectDirectoryAttributes");se("2.5.29.10","basicConstraints");se("2.5.29.11","nameConstraints");se("2.5.29.12","policyConstraints");se("2.5.29.13","basicConstraints");R("2.5.29.14","subjectKeyIdentifier");R("2.5.29.15","keyUsage");se("2.5.29.16","privateKeyUsagePeriod");R("2.5.29.17","subjectAltName");R("2.5.29.18","issuerAltName");R("2.5.29.19","basicConstraints");se("2.5.29.20","cRLNumber");se("2.5.29.21","cRLReason");se("2.5.29.22","expirationDate");se("2.5.29.23","instructionCode");se("2.5.29.24","invalidityDate");se("2.5.29.25","cRLDistributionPoints");se("2.5.29.26","issuingDistributionPoint");se("2.5.29.27","deltaCRLIndicator");se("2.5.29.28","issuingDistributionPoint");se("2.5.29.29","certificateIssuer");se("2.5.29.30","nameConstraints");R("2.5.29.31","cRLDistributionPoints");R("2.5.29.32","certificatePolicies");se("2.5.29.33","policyMappings");se("2.5.29.34","policyConstraints");R("2.5.29.35","authorityKeyIdentifier");se("2.5.29.36","policyConstraints");R("2.5.29.37","extKeyUsage");se("2.5.29.46","freshestCRL");se("2.5.29.54","inhibitAnyPolicy");R("1.3.6.1.4.1.11129.2.4.2","timestampList");R("1.3.6.1.5.5.7.1.1","authorityInfoAccess");R("1.3.6.1.5.5.7.3.1","serverAuth");R("1.3.6.1.5.5.7.3.2","clientAuth");R("1.3.6.1.5.5.7.3.3","codeSigning");R("1.3.6.1.5.5.7.3.4","emailProtection");R("1.3.6.1.5.5.7.3.8","timeStamping")});var st=M((oc,zn)=>{var he=X();ne();bt();var P=zn.exports=he.asn1=he.asn1||{};P.Class={UNIVERSAL:0,APPLICATION:64,CONTEXT_SPECIFIC:128,PRIVATE:192};P.Type={NONE:0,BOOLEAN:1,INTEGER:2,BITSTRING:3,OCTETSTRING:4,NULL:5,OID:6,ODESC:7,EXTERNAL:8,REAL:9,ENUMERATED:10,EMBEDDED:11,UTF8:12,ROID:13,SEQUENCE:16,SET:17,PRINTABLESTRING:19,IA5STRING:22,UTCTIME:23,GENERALIZEDTIME:24,BMPSTRING:30};P.maxDepth=256;P.create=function(e,t,a,r,n){if(he.util.isArray(r)){for(var s=[],i=0;i<r.length;++i)r[i]!==void 0&&s.push(r[i]);r=s}var o={tagClass:e,type:t,constructed:a,composed:a||he.util.isArray(r),value:r};return n&&"bitStringContents"in n&&(o.bitStringContents=n.bitStringContents,o.original=P.copy(o)),o};P.copy=function(e,t){var a;if(he.util.isArray(e)){a=[];for(var r=0;r<e.length;++r)a.push(P.copy(e[r],t));return a}return typeof e=="string"?e:(a={tagClass:e.tagClass,type:e.type,constructed:e.constructed,composed:e.composed,value:P.copy(e.value,t)},t&&!t.excludeBitStringContents&&(a.bitStringContents=e.bitStringContents),a)};P.equals=function(e,t,a){if(he.util.isArray(e)){if(!he.util.isArray(t)||e.length!==t.length)return!1;for(var r=0;r<e.length;++r)if(!P.equals(e[r],t[r]))return!1;return!0}if(typeof e!=typeof t)return!1;if(typeof e=="string")return e===t;var n=e.tagClass===t.tagClass&&e.type===t.type&&e.constructed===t.constructed&&e.composed===t.composed&&P.equals(e.value,t.value);return a&&a.includeBitStringContents&&(n=n&&e.bitStringContents===t.bitStringContents),n};P.getBerValueLength=function(e){var t=e.getByte();if(t!==128){var a,r=t&128;return r?a=e.getInt((t&127)<<3):a=t,a}};function yr(e,t,a){if(a>t){var r=new Error("Too few bytes to parse DER.");throw r.available=e.length(),r.remaining=t,r.requested=a,r}}var wo=function(e,t){var a=e.getByte();if(t--,a!==128){var r,n=a&128;if(!n)r=a;else{var s=a&127;yr(e,t,s),r=e.getInt(s<<3)}if(r<0)throw new Error("Negative length: "+r);return r}};P.fromDer=function(e,t){t===void 0&&(t={strict:!0,parseAllBytes:!0,decodeBitStrings:!0}),typeof t=="boolean"&&(t={strict:t,parseAllBytes:!0,decodeBitStrings:!0}),"strict"in t||(t.strict=!0),"parseAllBytes"in t||(t.parseAllBytes=!0),"decodeBitStrings"in t||(t.decodeBitStrings=!0),"maxDepth"in t||(t.maxDepth=P.maxDepth),typeof e=="string"&&(e=he.util.createBuffer(e));var a=e.length(),r=Kr(e,e.length(),0,t);if(t.parseAllBytes&&e.length()!==0){var n=new Error("Unparsed DER bytes remain after ASN.1 parsing.");throw n.byteCount=a,n.remaining=e.length(),n}return r};function Kr(e,t,a,r){if(a>=r.maxDepth)throw new Error("ASN.1 parsing error: Max depth exceeded.");var n;yr(e,t,2);var s=e.getByte();t--;var i=s&192,o=s&31;n=e.length();var l=wo(e,t);if(t-=n-e.length(),l!==void 0&&l>t){if(r.strict){var u=new Error("Too few bytes to read ASN.1 value.");throw u.available=e.length(),u.remaining=t,u.requested=l,u}l=t}var f,c,v=(s&32)===32;if(v)if(f=[],l===void 0)for(;;){if(yr(e,t,2),e.bytes(2)==="\0\0"){e.getBytes(2),t-=2;break}n=e.length(),f.push(Kr(e,t,a+1,r)),t-=n-e.length()}else for(;l>0;)n=e.length(),f.push(Kr(e,l,a+1,r)),t-=n-e.length(),l-=n-e.length();if(f===void 0&&i===P.Class.UNIVERSAL&&o===P.Type.BITSTRING&&(c=e.bytes(l)),f===void 0&&r.decodeBitStrings&&i===P.Class.UNIVERSAL&&o===P.Type.BITSTRING&&l>1){var g=e.read,y=t,x=0;if(o===P.Type.BITSTRING&&(yr(e,t,1),x=e.getByte(),t--),x===0)try{n=e.length();var S={strict:!0,decodeBitStrings:!0},I=Kr(e,t,a+1,S),B=n-e.length();t-=B,o==P.Type.BITSTRING&&B++;var b=I.tagClass;B===l&&(b===P.Class.UNIVERSAL||b===P.Class.CONTEXT_SPECIFIC)&&(f=[I])}catch{}f===void 0&&(e.read=g,t=y)}if(f===void 0){if(l===void 0){if(r.strict)throw new Error("Non-constructed ASN.1 object of indefinite length.");l=t}if(o===P.Type.BMPSTRING)for(f="";l>0;l-=2)yr(e,t,2),f+=String.fromCharCode(e.getInt16()),t-=2;else f=e.getBytes(l),t-=l}var U=c===void 0?null:{bitStringContents:c};return P.create(i,o,v,f,U)}P.toDer=function(e){var t=he.util.createBuffer(),a=e.tagClass|e.type,r=he.util.createBuffer(),n=!1;if("bitStringContents"in e&&(n=!0,e.original&&(n=P.equals(e,e.original))),n)r.putBytes(e.bitStringContents);else if(e.composed){e.constructed?a|=32:r.putByte(0);for(var s=0;s<e.value.length;++s)e.value[s]!==void 0&&r.putBuffer(P.toDer(e.value[s]))}else if(e.type===P.Type.BMPSTRING)for(var s=0;s<e.value.length;++s)r.putInt16(e.value.charCodeAt(s));else e.type===P.Type.INTEGER&&e.value.length>1&&(e.value.charCodeAt(0)===0&&(e.value.charCodeAt(1)&128)===0||e.value.charCodeAt(0)===255&&(e.value.charCodeAt(1)&128)===128)?r.putBytes(e.value.substr(1)):r.putBytes(e.value);if(t.putByte(a),r.length()<=127)t.putByte(r.length()&127);else{var i=r.length(),o="";do o+=String.fromCharCode(i&255),i=i>>>8;while(i>0);t.putByte(o.length|128);for(var s=o.length-1;s>=0;--s)t.putByte(o.charCodeAt(s))}return t.putBuffer(r),t};P.oidToDer=function(e){var t=e.split("."),a=he.util.createBuffer();a.putByte(40*parseInt(t[0],10)+parseInt(t[1],10));for(var r,n,s,i,o=2;o<t.length;++o){if(r=!0,n=[],s=parseInt(t[o],10),s>4294967295)throw new Error("OID value too large; max is 32-bits.");do i=s&127,s=s>>>7,r||(i|=128),n.push(i),r=!1;while(s>0);for(var l=n.length-1;l>=0;--l)a.putByte(n[l])}return a};P.derToOid=function(e){var t;typeof e=="string"&&(e=he.util.createBuffer(e));var a=e.getByte();t=Math.floor(a/40)+"."+a%40;for(var r=0;e.length()>0;){if(r>70368744177663)throw new Error("OID value too large; max is 53-bits.");a=e.getByte(),r=r*128,a&128?r+=a&127:(t+="."+(r+a),r=0)}return t};P.utcTimeToDate=function(e){var t=new Date,a=parseInt(e.substr(0,2),10);a=a>=50?1900+a:2e3+a;var r=parseInt(e.substr(2,2),10)-1,n=parseInt(e.substr(4,2),10),s=parseInt(e.substr(6,2),10),i=parseInt(e.substr(8,2),10),o=0;if(e.length>11){var l=e.charAt(10),u=10;l!=="+"&&l!=="-"&&(o=parseInt(e.substr(10,2),10),u+=2)}if(t.setUTCFullYear(a,r,n),t.setUTCHours(s,i,o,0),u&&(l=e.charAt(u),l==="+"||l==="-")){var f=parseInt(e.substr(u+1,2),10),c=parseInt(e.substr(u+4,2),10),v=f*60+c;v*=6e4,l==="+"?t.setTime(+t-v):t.setTime(+t+v)}return t};P.generalizedTimeToDate=function(e){var t=new Date,a=parseInt(e.substr(0,4),10),r=parseInt(e.substr(4,2),10)-1,n=parseInt(e.substr(6,2),10),s=parseInt(e.substr(8,2),10),i=parseInt(e.substr(10,2),10),o=parseInt(e.substr(12,2),10),l=0,u=0,f=!1;e.charAt(e.length-1)==="Z"&&(f=!0);var c=e.length-5,v=e.charAt(c);if(v==="+"||v==="-"){var g=parseInt(e.substr(c+1,2),10),y=parseInt(e.substr(c+4,2),10);u=g*60+y,u*=6e4,v==="+"&&(u*=-1),f=!0}return e.charAt(14)==="."&&(l=parseFloat(e.substr(14),10)*1e3),f?(t.setUTCFullYear(a,r,n),t.setUTCHours(s,i,o,l),t.setTime(+t+u)):(t.setFullYear(a,r,n),t.setHours(s,i,o,l)),t};P.dateToUtcTime=function(e){if(typeof e=="string")return e;var t="",a=[];a.push((""+e.getUTCFullYear()).substr(2)),a.push(""+(e.getUTCMonth()+1)),a.push(""+e.getUTCDate()),a.push(""+e.getUTCHours()),a.push(""+e.getUTCMinutes()),a.push(""+e.getUTCSeconds());for(var r=0;r<a.length;++r)a[r].length<2&&(t+="0"),t+=a[r];return t+="Z",t};P.dateToGeneralizedTime=function(e){if(typeof e=="string")return e;var t="",a=[];a.push(""+e.getUTCFullYear()),a.push(""+(e.getUTCMonth()+1)),a.push(""+e.getUTCDate()),a.push(""+e.getUTCHours()),a.push(""+e.getUTCMinutes()),a.push(""+e.getUTCSeconds());for(var r=0;r<a.length;++r)a[r].length<2&&(t+="0"),t+=a[r];return t+="Z",t};P.integerToDer=function(e){var t=he.util.createBuffer();if(e>=-128&&e<128)return t.putSignedInt(e,8);if(e>=-32768&&e<32768)return t.putSignedInt(e,16);if(e>=-8388608&&e<8388608)return t.putSignedInt(e,24);if(e>=-2147483648&&e<2147483648)return t.putSignedInt(e,32);var a=new Error("Integer too large; max is 32-bits.");throw a.integer=e,a};P.derToInteger=function(e){typeof e=="string"&&(e=he.util.createBuffer(e));var t=e.length()*8;if(t>32)throw new Error("Integer too large; max is 32-bits.");return e.getSignedInt(t)};P.validate=function(e,t,a,r){var n=!1;if((e.tagClass===t.tagClass||typeof t.tagClass>"u")&&(e.type===t.type||typeof t.type>"u"))if(e.constructed===t.constructed||typeof t.constructed>"u"){if(n=!0,t.value&&he.util.isArray(t.value))for(var s=0,i=0;n&&i<t.value.length;++i){var o=t.value[i];n=!!o.optional;var l=e.value[s];if(!l){o.optional||(n=!1,r&&r.push("["+t.name+'] Missing required element. Expected tag class "'+o.tagClass+'", type "'+o.type+'"'));continue}var u=typeof o.tagClass<"u"&&typeof o.type<"u";if(u&&(l.tagClass!==o.tagClass||l.type!==o.type))if(o.optional){n=!0;continue}else{n=!1,r&&r.push("["+t.name+"] Tag mismatch. Expected ("+o.tagClass+","+o.type+"), got ("+l.tagClass+","+l.type+")");break}var f=P.validate(l,o,a,r);if(f)++s,n=!0;else if(o.optional)n=!0;else{n=!1;break}}if(n&&a&&(t.capture&&(a[t.capture]=e.value),t.captureAsn1&&(a[t.captureAsn1]=e),t.captureBitStringContents&&"bitStringContents"in e&&(a[t.captureBitStringContents]=e.bitStringContents),t.captureBitStringValue&&"bitStringContents"in e)){var c;if(e.bitStringContents.length<2)a[t.captureBitStringValue]="";else{var v=e.bitStringContents.charCodeAt(0);if(v!==0)throw new Error("captureBitStringValue only supported for zero unused bits");a[t.captureBitStringValue]=e.bitStringContents.slice(1)}}}else r&&r.push("["+t.name+'] Expected constructed "'+t.constructed+'", got "'+e.constructed+'"');else r&&(e.tagClass!==t.tagClass&&r.push("["+t.name+'] Expected tag class "'+t.tagClass+'", got "'+e.tagClass+'"'),e.type!==t.type&&r.push("["+t.name+'] Expected type "'+t.type+'", got "'+e.type+'"'));return n};var Gn=/[^\\u0000-\\u00ff]/;P.prettyPrint=function(e,t,a){var r="";t=t||0,a=a||2,t>0&&(r+=`
1
+ var M=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var jt=M((Zf,In)=>{function Tn(){return new Date().toLocaleTimeString("en-US",{hour12:!1})}var Co=e=>console.log(`[${Tn()}] [MITM] ${e}`),Eo=e=>console.error(`[${Tn()}] \u274C [MITM] ${e}`);In.exports={log:Co,err:Eo}});var Bn=M((Jf,An)=>{var xo=["daily-cloudcode-pa.googleapis.com","cloudcode-pa.googleapis.com","api.individual.githubcopilot.com","q.us-east-1.amazonaws.com","api2.cursor.sh"],So={antigravity:[":generateContent",":streamGenerateContent"],copilot:["/chat/completions","/v1/messages","/responses"],kiro:["/generateAssistantResponse"],cursor:["/BidiAppend","/RunSSE","/RunPoll","/Run"]};function To(e){let t=(e||"").split(":")[0];return t==="api.individual.githubcopilot.com"?"copilot":t==="daily-cloudcode-pa.googleapis.com"||t==="cloudcode-pa.googleapis.com"?"antigravity":t==="q.us-east-1.amazonaws.com"?"kiro":t==="api2.cursor.sh"?"cursor":null}An.exports={TARGET_HOSTS:xo,URL_PATTERNS:So,getToolForHost:To}});var kr=M((ec,Nn)=>{var Lr=require("path"),bn=require("os");function Io(){return process.env.DATA_DIR?process.env.DATA_DIR:process.platform==="win32"?Lr.join(process.env.APPDATA||Lr.join(bn.homedir(),"AppData","Roaming"),"9router"):Lr.join(bn.homedir(),".9router")}var _n=Io(),Ao=Lr.join(_n,"mitm");Nn.exports={DATA_DIR:_n,MITM_DIR:Ao}});var X=M((tc,Rn)=>{Rn.exports={options:{usePureJavaScript:!1}}});var kn=M((rc,Ln)=>{var pa={};Ln.exports=pa;var wn={};pa.encode=function(e,t,a){if(typeof t!="string")throw new TypeError('"alphabet" must be a string.');if(a!==void 0&&typeof a!="number")throw new TypeError('"maxline" must be a number.');var r="";if(!(e instanceof Uint8Array))r=Bo(e,t);else{var n=0,s=t.length,i=t.charAt(0),o=[0];for(n=0;n<e.length;++n){for(var l=0,u=e[n];l<o.length;++l)u+=o[l]<<8,o[l]=u%s,u=u/s|0;for(;u>0;)o.push(u%s),u=u/s|0}for(n=0;e[n]===0&&n<e.length-1;++n)r+=i;for(n=o.length-1;n>=0;--n)r+=t[o[n]]}if(a){var f=new RegExp(".{1,"+a+"}","g");r=r.match(f).join(`\r
2
+ `)}return r};pa.decode=function(e,t){if(typeof e!="string")throw new TypeError('"input" must be a string.');if(typeof t!="string")throw new TypeError('"alphabet" must be a string.');var a=wn[t];if(!a){a=wn[t]=[];for(var r=0;r<t.length;++r)a[t.charCodeAt(r)]=r}e=e.replace(/\s/g,"");for(var n=t.length,s=t.charAt(0),i=[0],r=0;r<e.length;r++){var o=a[e.charCodeAt(r)];if(o===void 0)return;for(var l=0,u=o;l<i.length;++l)u+=i[l]*n,i[l]=u&255,u>>=8;for(;u>0;)i.push(u&255),u>>=8}for(var f=0;e[f]===s&&f<e.length-1;++f)i.push(0);return typeof Buffer<"u"?Buffer.from(i.reverse()):new Uint8Array(i.reverse())};function Bo(e,t){var a=0,r=t.length,n=t.charAt(0),s=[0];for(a=0;a<e.length();++a){for(var i=0,o=e.at(a);i<s.length;++i)o+=s[i]<<8,s[i]=o%r,o=o/r|0;for(;o>0;)s.push(o%r),o=o/r|0}var l="";for(a=0;e.at(a)===0&&a<e.length()-1;++a)l+=n;for(a=s.length-1;a>=0;--a)l+=t[s[a]];return l}});var ne=M((ac,Vn)=>{var Dn=X(),Un=kn(),E=Vn.exports=Dn.util=Dn.util||{};(function(){if(typeof process<"u"&&process.nextTick&&!process.browser){E.nextTick=process.nextTick,typeof setImmediate=="function"?E.setImmediate=setImmediate:E.setImmediate=E.nextTick;return}if(typeof setImmediate=="function"){E.setImmediate=function(){return setImmediate.apply(void 0,arguments)},E.nextTick=function(o){return setImmediate(o)};return}if(E.setImmediate=function(o){setTimeout(o,0)},typeof window<"u"&&typeof window.postMessage=="function"){let o=function(l){if(l.source===window&&l.data===e){l.stopPropagation();var u=t.slice();t.length=0,u.forEach(function(f){f()})}};var i=o,e="forge.setImmediate",t=[];E.setImmediate=function(l){t.push(l),t.length===1&&window.postMessage(e,"*")},window.addEventListener("message",o,!0)}if(typeof MutationObserver<"u"){var a=Date.now(),r=!0,n=document.createElement("div"),t=[];new MutationObserver(function(){var l=t.slice();t.length=0,l.forEach(function(u){u()})}).observe(n,{attributes:!0});var s=E.setImmediate;E.setImmediate=function(l){Date.now()-a>15?(a=Date.now(),s(l)):(t.push(l),t.length===1&&n.setAttribute("a",r=!r))}}E.nextTick=E.setImmediate})();E.isNodejs=typeof process<"u"&&process.versions&&process.versions.node;E.globalScope=(function(){return E.isNodejs?global:typeof self>"u"?window:self})();E.isArray=Array.isArray||function(e){return Object.prototype.toString.call(e)==="[object Array]"};E.isArrayBuffer=function(e){return typeof ArrayBuffer<"u"&&e instanceof ArrayBuffer};E.isArrayBufferView=function(e){return e&&E.isArrayBuffer(e.buffer)&&e.byteLength!==void 0};function pr(e){if(!(e===8||e===16||e===24||e===32))throw new Error("Only 8, 16, 24, or 32 bits supported: "+e)}E.ByteBuffer=va;function va(e){if(this.data="",this.read=0,typeof e=="string")this.data=e;else if(E.isArrayBuffer(e)||E.isArrayBufferView(e))if(typeof Buffer<"u"&&e instanceof Buffer)this.data=e.toString("binary");else{var t=new Uint8Array(e);try{this.data=String.fromCharCode.apply(null,t)}catch{for(var a=0;a<t.length;++a)this.putByte(t[a])}}else(e instanceof va||typeof e=="object"&&typeof e.data=="string"&&typeof e.read=="number")&&(this.data=e.data,this.read=e.read);this._constructedStringLength=0}E.ByteStringBuffer=va;var bo=4096;E.ByteStringBuffer.prototype._optimizeConstructedString=function(e){this._constructedStringLength+=e,this._constructedStringLength>bo&&(this.data.substr(0,1),this._constructedStringLength=0)};E.ByteStringBuffer.prototype.length=function(){return this.data.length-this.read};E.ByteStringBuffer.prototype.isEmpty=function(){return this.length()<=0};E.ByteStringBuffer.prototype.putByte=function(e){return this.putBytes(String.fromCharCode(e))};E.ByteStringBuffer.prototype.fillWithByte=function(e,t){e=String.fromCharCode(e);for(var a=this.data;t>0;)t&1&&(a+=e),t>>>=1,t>0&&(e+=e);return this.data=a,this._optimizeConstructedString(t),this};E.ByteStringBuffer.prototype.putBytes=function(e){return this.data+=e,this._optimizeConstructedString(e.length),this};E.ByteStringBuffer.prototype.putString=function(e){return this.putBytes(E.encodeUtf8(e))};E.ByteStringBuffer.prototype.putInt16=function(e){return this.putBytes(String.fromCharCode(e>>8&255)+String.fromCharCode(e&255))};E.ByteStringBuffer.prototype.putInt24=function(e){return this.putBytes(String.fromCharCode(e>>16&255)+String.fromCharCode(e>>8&255)+String.fromCharCode(e&255))};E.ByteStringBuffer.prototype.putInt32=function(e){return this.putBytes(String.fromCharCode(e>>24&255)+String.fromCharCode(e>>16&255)+String.fromCharCode(e>>8&255)+String.fromCharCode(e&255))};E.ByteStringBuffer.prototype.putInt16Le=function(e){return this.putBytes(String.fromCharCode(e&255)+String.fromCharCode(e>>8&255))};E.ByteStringBuffer.prototype.putInt24Le=function(e){return this.putBytes(String.fromCharCode(e&255)+String.fromCharCode(e>>8&255)+String.fromCharCode(e>>16&255))};E.ByteStringBuffer.prototype.putInt32Le=function(e){return this.putBytes(String.fromCharCode(e&255)+String.fromCharCode(e>>8&255)+String.fromCharCode(e>>16&255)+String.fromCharCode(e>>24&255))};E.ByteStringBuffer.prototype.putInt=function(e,t){pr(t);var a="";do t-=8,a+=String.fromCharCode(e>>t&255);while(t>0);return this.putBytes(a)};E.ByteStringBuffer.prototype.putSignedInt=function(e,t){return e<0&&(e+=2<<t-1),this.putInt(e,t)};E.ByteStringBuffer.prototype.putBuffer=function(e){return this.putBytes(e.getBytes())};E.ByteStringBuffer.prototype.getByte=function(){return this.data.charCodeAt(this.read++)};E.ByteStringBuffer.prototype.getInt16=function(){var e=this.data.charCodeAt(this.read)<<8^this.data.charCodeAt(this.read+1);return this.read+=2,e};E.ByteStringBuffer.prototype.getInt24=function(){var e=this.data.charCodeAt(this.read)<<16^this.data.charCodeAt(this.read+1)<<8^this.data.charCodeAt(this.read+2);return this.read+=3,e};E.ByteStringBuffer.prototype.getInt32=function(){var e=this.data.charCodeAt(this.read)<<24^this.data.charCodeAt(this.read+1)<<16^this.data.charCodeAt(this.read+2)<<8^this.data.charCodeAt(this.read+3);return this.read+=4,e};E.ByteStringBuffer.prototype.getInt16Le=function(){var e=this.data.charCodeAt(this.read)^this.data.charCodeAt(this.read+1)<<8;return this.read+=2,e};E.ByteStringBuffer.prototype.getInt24Le=function(){var e=this.data.charCodeAt(this.read)^this.data.charCodeAt(this.read+1)<<8^this.data.charCodeAt(this.read+2)<<16;return this.read+=3,e};E.ByteStringBuffer.prototype.getInt32Le=function(){var e=this.data.charCodeAt(this.read)^this.data.charCodeAt(this.read+1)<<8^this.data.charCodeAt(this.read+2)<<16^this.data.charCodeAt(this.read+3)<<24;return this.read+=4,e};E.ByteStringBuffer.prototype.getInt=function(e){pr(e);var t=0;do t=(t<<8)+this.data.charCodeAt(this.read++),e-=8;while(e>0);return t};E.ByteStringBuffer.prototype.getSignedInt=function(e){var t=this.getInt(e),a=2<<e-2;return t>=a&&(t-=a<<1),t};E.ByteStringBuffer.prototype.getBytes=function(e){var t;return e?(e=Math.min(this.length(),e),t=this.data.slice(this.read,this.read+e),this.read+=e):e===0?t="":(t=this.read===0?this.data:this.data.slice(this.read),this.clear()),t};E.ByteStringBuffer.prototype.bytes=function(e){return typeof e>"u"?this.data.slice(this.read):this.data.slice(this.read,this.read+e)};E.ByteStringBuffer.prototype.at=function(e){return this.data.charCodeAt(this.read+e)};E.ByteStringBuffer.prototype.setAt=function(e,t){return this.data=this.data.substr(0,this.read+e)+String.fromCharCode(t)+this.data.substr(this.read+e+1),this};E.ByteStringBuffer.prototype.last=function(){return this.data.charCodeAt(this.data.length-1)};E.ByteStringBuffer.prototype.copy=function(){var e=E.createBuffer(this.data);return e.read=this.read,e};E.ByteStringBuffer.prototype.compact=function(){return this.read>0&&(this.data=this.data.slice(this.read),this.read=0),this};E.ByteStringBuffer.prototype.clear=function(){return this.data="",this.read=0,this};E.ByteStringBuffer.prototype.truncate=function(e){var t=Math.max(0,this.length()-e);return this.data=this.data.substr(this.read,t),this.read=0,this};E.ByteStringBuffer.prototype.toHex=function(){for(var e="",t=this.read;t<this.data.length;++t){var a=this.data.charCodeAt(t);a<16&&(e+="0"),e+=a.toString(16)}return e};E.ByteStringBuffer.prototype.toString=function(){return E.decodeUtf8(this.bytes())};function _o(e,t){t=t||{},this.read=t.readOffset||0,this.growSize=t.growSize||1024;var a=E.isArrayBuffer(e),r=E.isArrayBufferView(e);if(a||r){a?this.data=new DataView(e):this.data=new DataView(e.buffer,e.byteOffset,e.byteLength),this.write="writeOffset"in t?t.writeOffset:this.data.byteLength;return}this.data=new DataView(new ArrayBuffer(0)),this.write=0,e!=null&&this.putBytes(e),"writeOffset"in t&&(this.write=t.writeOffset)}E.DataBuffer=_o;E.DataBuffer.prototype.length=function(){return this.write-this.read};E.DataBuffer.prototype.isEmpty=function(){return this.length()<=0};E.DataBuffer.prototype.accommodate=function(e,t){if(this.length()>=e)return this;t=Math.max(t||this.growSize,e);var a=new Uint8Array(this.data.buffer,this.data.byteOffset,this.data.byteLength),r=new Uint8Array(this.length()+t);return r.set(a),this.data=new DataView(r.buffer),this};E.DataBuffer.prototype.putByte=function(e){return this.accommodate(1),this.data.setUint8(this.write++,e),this};E.DataBuffer.prototype.fillWithByte=function(e,t){this.accommodate(t);for(var a=0;a<t;++a)this.data.setUint8(e);return this};E.DataBuffer.prototype.putBytes=function(e,t){if(E.isArrayBufferView(e)){var a=new Uint8Array(e.buffer,e.byteOffset,e.byteLength),r=a.byteLength-a.byteOffset;this.accommodate(r);var n=new Uint8Array(this.data.buffer,this.write);return n.set(a),this.write+=r,this}if(E.isArrayBuffer(e)){var a=new Uint8Array(e);this.accommodate(a.byteLength);var n=new Uint8Array(this.data.buffer);return n.set(a,this.write),this.write+=a.byteLength,this}if(e instanceof E.DataBuffer||typeof e=="object"&&typeof e.read=="number"&&typeof e.write=="number"&&E.isArrayBufferView(e.data)){var a=new Uint8Array(e.data.byteLength,e.read,e.length());this.accommodate(a.byteLength);var n=new Uint8Array(e.data.byteLength,this.write);return n.set(a),this.write+=a.byteLength,this}if(e instanceof E.ByteStringBuffer&&(e=e.data,t="binary"),t=t||"binary",typeof e=="string"){var s;if(t==="hex")return this.accommodate(Math.ceil(e.length/2)),s=new Uint8Array(this.data.buffer,this.write),this.write+=E.binary.hex.decode(e,s,this.write),this;if(t==="base64")return this.accommodate(Math.ceil(e.length/4)*3),s=new Uint8Array(this.data.buffer,this.write),this.write+=E.binary.base64.decode(e,s,this.write),this;if(t==="utf8"&&(e=E.encodeUtf8(e),t="binary"),t==="binary"||t==="raw")return this.accommodate(e.length),s=new Uint8Array(this.data.buffer,this.write),this.write+=E.binary.raw.decode(s),this;if(t==="utf16")return this.accommodate(e.length*2),s=new Uint16Array(this.data.buffer,this.write),this.write+=E.text.utf16.encode(s),this;throw new Error("Invalid encoding: "+t)}throw Error("Invalid parameter: "+e)};E.DataBuffer.prototype.putBuffer=function(e){return this.putBytes(e),e.clear(),this};E.DataBuffer.prototype.putString=function(e){return this.putBytes(e,"utf16")};E.DataBuffer.prototype.putInt16=function(e){return this.accommodate(2),this.data.setInt16(this.write,e),this.write+=2,this};E.DataBuffer.prototype.putInt24=function(e){return this.accommodate(3),this.data.setInt16(this.write,e>>8&65535),this.data.setInt8(this.write,e>>16&255),this.write+=3,this};E.DataBuffer.prototype.putInt32=function(e){return this.accommodate(4),this.data.setInt32(this.write,e),this.write+=4,this};E.DataBuffer.prototype.putInt16Le=function(e){return this.accommodate(2),this.data.setInt16(this.write,e,!0),this.write+=2,this};E.DataBuffer.prototype.putInt24Le=function(e){return this.accommodate(3),this.data.setInt8(this.write,e>>16&255),this.data.setInt16(this.write,e>>8&65535,!0),this.write+=3,this};E.DataBuffer.prototype.putInt32Le=function(e){return this.accommodate(4),this.data.setInt32(this.write,e,!0),this.write+=4,this};E.DataBuffer.prototype.putInt=function(e,t){pr(t),this.accommodate(t/8);do t-=8,this.data.setInt8(this.write++,e>>t&255);while(t>0);return this};E.DataBuffer.prototype.putSignedInt=function(e,t){return pr(t),this.accommodate(t/8),e<0&&(e+=2<<t-1),this.putInt(e,t)};E.DataBuffer.prototype.getByte=function(){return this.data.getInt8(this.read++)};E.DataBuffer.prototype.getInt16=function(){var e=this.data.getInt16(this.read);return this.read+=2,e};E.DataBuffer.prototype.getInt24=function(){var e=this.data.getInt16(this.read)<<8^this.data.getInt8(this.read+2);return this.read+=3,e};E.DataBuffer.prototype.getInt32=function(){var e=this.data.getInt32(this.read);return this.read+=4,e};E.DataBuffer.prototype.getInt16Le=function(){var e=this.data.getInt16(this.read,!0);return this.read+=2,e};E.DataBuffer.prototype.getInt24Le=function(){var e=this.data.getInt8(this.read)^this.data.getInt16(this.read+1,!0)<<8;return this.read+=3,e};E.DataBuffer.prototype.getInt32Le=function(){var e=this.data.getInt32(this.read,!0);return this.read+=4,e};E.DataBuffer.prototype.getInt=function(e){pr(e);var t=0;do t=(t<<8)+this.data.getInt8(this.read++),e-=8;while(e>0);return t};E.DataBuffer.prototype.getSignedInt=function(e){var t=this.getInt(e),a=2<<e-2;return t>=a&&(t-=a<<1),t};E.DataBuffer.prototype.getBytes=function(e){var t;return e?(e=Math.min(this.length(),e),t=this.data.slice(this.read,this.read+e),this.read+=e):e===0?t="":(t=this.read===0?this.data:this.data.slice(this.read),this.clear()),t};E.DataBuffer.prototype.bytes=function(e){return typeof e>"u"?this.data.slice(this.read):this.data.slice(this.read,this.read+e)};E.DataBuffer.prototype.at=function(e){return this.data.getUint8(this.read+e)};E.DataBuffer.prototype.setAt=function(e,t){return this.data.setUint8(e,t),this};E.DataBuffer.prototype.last=function(){return this.data.getUint8(this.write-1)};E.DataBuffer.prototype.copy=function(){return new E.DataBuffer(this)};E.DataBuffer.prototype.compact=function(){if(this.read>0){var e=new Uint8Array(this.data.buffer,this.read),t=new Uint8Array(e.byteLength);t.set(e),this.data=new DataView(t),this.write-=this.read,this.read=0}return this};E.DataBuffer.prototype.clear=function(){return this.data=new DataView(new ArrayBuffer(0)),this.read=this.write=0,this};E.DataBuffer.prototype.truncate=function(e){return this.write=Math.max(0,this.length()-e),this.read=Math.min(this.read,this.write),this};E.DataBuffer.prototype.toHex=function(){for(var e="",t=this.read;t<this.data.byteLength;++t){var a=this.data.getUint8(t);a<16&&(e+="0"),e+=a.toString(16)}return e};E.DataBuffer.prototype.toString=function(e){var t=new Uint8Array(this.data,this.read,this.length());if(e=e||"utf8",e==="binary"||e==="raw")return E.binary.raw.encode(t);if(e==="hex")return E.binary.hex.encode(t);if(e==="base64")return E.binary.base64.encode(t);if(e==="utf8")return E.text.utf8.decode(t);if(e==="utf16")return E.text.utf16.decode(t);throw new Error("Invalid encoding: "+e)};E.createBuffer=function(e,t){return t=t||"raw",e!==void 0&&t==="utf8"&&(e=E.encodeUtf8(e)),new E.ByteBuffer(e)};E.fillString=function(e,t){for(var a="";t>0;)t&1&&(a+=e),t>>>=1,t>0&&(e+=e);return a};E.xorBytes=function(e,t,a){for(var r="",n="",s="",i=0,o=0;a>0;--a,++i)n=e.charCodeAt(i)^t.charCodeAt(i),o>=10&&(r+=s,s="",o=0),s+=String.fromCharCode(n),++o;return r+=s,r};E.hexToBytes=function(e){var t="",a=0;for(e.length&!0&&(a=1,t+=String.fromCharCode(parseInt(e[0],16)));a<e.length;a+=2)t+=String.fromCharCode(parseInt(e.substr(a,2),16));return t};E.bytesToHex=function(e){return E.createBuffer(e).toHex()};E.int32ToBytes=function(e){return String.fromCharCode(e>>24&255)+String.fromCharCode(e>>16&255)+String.fromCharCode(e>>8&255)+String.fromCharCode(e&255)};var It="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",At=[62,-1,-1,-1,63,52,53,54,55,56,57,58,59,60,61,-1,-1,-1,64,-1,-1,-1,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,-1,-1,-1,-1,-1,-1,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51],Pn="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";E.encode64=function(e,t){for(var a="",r="",n,s,i,o=0;o<e.length;)n=e.charCodeAt(o++),s=e.charCodeAt(o++),i=e.charCodeAt(o++),a+=It.charAt(n>>2),a+=It.charAt((n&3)<<4|s>>4),isNaN(s)?a+="==":(a+=It.charAt((s&15)<<2|i>>6),a+=isNaN(i)?"=":It.charAt(i&63)),t&&a.length>t&&(r+=a.substr(0,t)+`\r
3
+ `,a=a.substr(t));return r+=a,r};E.decode64=function(e){e=e.replace(/[^A-Za-z0-9\+\/\=]/g,"");for(var t="",a,r,n,s,i=0;i<e.length;)a=At[e.charCodeAt(i++)-43],r=At[e.charCodeAt(i++)-43],n=At[e.charCodeAt(i++)-43],s=At[e.charCodeAt(i++)-43],t+=String.fromCharCode(a<<2|r>>4),n!==64&&(t+=String.fromCharCode((r&15)<<4|n>>2),s!==64&&(t+=String.fromCharCode((n&3)<<6|s)));return t};E.encodeUtf8=function(e){return unescape(encodeURIComponent(e))};E.decodeUtf8=function(e){return decodeURIComponent(escape(e))};E.binary={raw:{},hex:{},base64:{},base58:{},baseN:{encode:Un.encode,decode:Un.decode}};E.binary.raw.encode=function(e){return String.fromCharCode.apply(null,e)};E.binary.raw.decode=function(e,t,a){var r=t;r||(r=new Uint8Array(e.length)),a=a||0;for(var n=a,s=0;s<e.length;++s)r[n++]=e.charCodeAt(s);return t?n-a:r};E.binary.hex.encode=E.bytesToHex;E.binary.hex.decode=function(e,t,a){var r=t;r||(r=new Uint8Array(Math.ceil(e.length/2))),a=a||0;var n=0,s=a;for(e.length&1&&(n=1,r[s++]=parseInt(e[0],16));n<e.length;n+=2)r[s++]=parseInt(e.substr(n,2),16);return t?s-a:r};E.binary.base64.encode=function(e,t){for(var a="",r="",n,s,i,o=0;o<e.byteLength;)n=e[o++],s=e[o++],i=e[o++],a+=It.charAt(n>>2),a+=It.charAt((n&3)<<4|s>>4),isNaN(s)?a+="==":(a+=It.charAt((s&15)<<2|i>>6),a+=isNaN(i)?"=":It.charAt(i&63)),t&&a.length>t&&(r+=a.substr(0,t)+`\r
4
+ `,a=a.substr(t));return r+=a,r};E.binary.base64.decode=function(e,t,a){var r=t;r||(r=new Uint8Array(Math.ceil(e.length/4)*3)),e=e.replace(/[^A-Za-z0-9\+\/\=]/g,""),a=a||0;for(var n,s,i,o,l=0,u=a;l<e.length;)n=At[e.charCodeAt(l++)-43],s=At[e.charCodeAt(l++)-43],i=At[e.charCodeAt(l++)-43],o=At[e.charCodeAt(l++)-43],r[u++]=n<<2|s>>4,i!==64&&(r[u++]=(s&15)<<4|i>>2,o!==64&&(r[u++]=(i&3)<<6|o));return t?u-a:r.subarray(0,u)};E.binary.base58.encode=function(e,t){return E.binary.baseN.encode(e,Pn,t)};E.binary.base58.decode=function(e,t){return E.binary.baseN.decode(e,Pn,t)};E.text={utf8:{},utf16:{}};E.text.utf8.encode=function(e,t,a){e=E.encodeUtf8(e);var r=t;r||(r=new Uint8Array(e.length)),a=a||0;for(var n=a,s=0;s<e.length;++s)r[n++]=e.charCodeAt(s);return t?n-a:r};E.text.utf8.decode=function(e){return E.decodeUtf8(String.fromCharCode.apply(null,e))};E.text.utf16.encode=function(e,t,a){var r=t;r||(r=new Uint8Array(e.length*2));var n=new Uint16Array(r.buffer);a=a||0;for(var s=a,i=a,o=0;o<e.length;++o)n[i++]=e.charCodeAt(o),s+=2;return t?s-a:r};E.text.utf16.decode=function(e){return String.fromCharCode.apply(null,new Uint16Array(e.buffer))};E.deflate=function(e,t,a){if(t=E.decode64(e.deflate(E.encode64(t)).rval),a){var r=2,n=t.charCodeAt(1);n&32&&(r=6),t=t.substring(r,t.length-4)}return t};E.inflate=function(e,t,a){var r=e.inflate(E.encode64(t)).rval;return r===null?null:E.decode64(r)};var ya=function(e,t,a){if(!e)throw new Error("WebStorage not available.");var r;if(a===null?r=e.removeItem(t):(a=E.encode64(JSON.stringify(a)),r=e.setItem(t,a)),typeof r<"u"&&r.rval!==!0){var n=new Error(r.error.message);throw n.id=r.error.id,n.name=r.error.name,n}},ga=function(e,t){if(!e)throw new Error("WebStorage not available.");var a=e.getItem(t);if(e.init)if(a.rval===null){if(a.error){var r=new Error(a.error.message);throw r.id=a.error.id,r.name=a.error.name,r}a=null}else a=a.rval;return a!==null&&(a=JSON.parse(E.decode64(a))),a},No=function(e,t,a,r){var n=ga(e,t);n===null&&(n={}),n[a]=r,ya(e,t,n)},Ro=function(e,t,a){var r=ga(e,t);return r!==null&&(r=a in r?r[a]:null),r},wo=function(e,t,a){var r=ga(e,t);if(r!==null&&a in r){delete r[a];var n=!0;for(var s in r){n=!1;break}n&&(r=null),ya(e,t,r)}},Lo=function(e,t){ya(e,t,null)},Dr=function(e,t,a){var r=null;typeof a>"u"&&(a=["web","flash"]);var n,s=!1,i=null;for(var o in a){n=a[o];try{if(n==="flash"||n==="both"){if(t[0]===null)throw new Error("Flash local storage not available.");r=e.apply(this,t),s=n==="flash"}(n==="web"||n==="both")&&(t[0]=localStorage,r=e.apply(this,t),s=!0)}catch(l){i=l}if(s)break}if(!s)throw i;return r};E.setItem=function(e,t,a,r,n){Dr(No,arguments,n)};E.getItem=function(e,t,a,r){return Dr(Ro,arguments,r)};E.removeItem=function(e,t,a,r){Dr(wo,arguments,r)};E.clearItems=function(e,t,a){Dr(Lo,arguments,a)};E.isEmpty=function(e){for(var t in e)if(e.hasOwnProperty(t))return!1;return!0};E.format=function(e){for(var t=/%./g,a,r,n=0,s=[],i=0;a=t.exec(e);){r=e.substring(i,t.lastIndex-2),r.length>0&&s.push(r),i=t.lastIndex;var o=a[0][1];switch(o){case"s":case"o":n<arguments.length?s.push(arguments[n+++1]):s.push("<?>");break;case"%":s.push("%");break;default:s.push("<%"+o+"?>")}}return s.push(e.substring(i)),s.join("")};E.formatNumber=function(e,t,a,r){var n=e,s=isNaN(t=Math.abs(t))?2:t,i=a===void 0?",":a,o=r===void 0?".":r,l=n<0?"-":"",u=parseInt(n=Math.abs(+n||0).toFixed(s),10)+"",f=u.length>3?u.length%3:0;return l+(f?u.substr(0,f)+o:"")+u.substr(f).replace(/(\d{3})(?=\d)/g,"$1"+o)+(s?i+Math.abs(n-u).toFixed(s).slice(2):"")};E.formatSize=function(e){return e>=1073741824?e=E.formatNumber(e/1073741824,2,".","")+" GiB":e>=1048576?e=E.formatNumber(e/1048576,2,".","")+" MiB":e>=1024?e=E.formatNumber(e/1024,0)+" KiB":e=E.formatNumber(e,0)+" bytes",e};E.bytesFromIP=function(e){return e.indexOf(".")!==-1?E.bytesFromIPv4(e):e.indexOf(":")!==-1?E.bytesFromIPv6(e):null};E.bytesFromIPv4=function(e){if(e=e.split("."),e.length!==4)return null;for(var t=E.createBuffer(),a=0;a<e.length;++a){var r=parseInt(e[a],10);if(isNaN(r))return null;t.putByte(r)}return t.getBytes()};E.bytesFromIPv6=function(e){var t=0;e=e.split(":").filter(function(i){return i.length===0&&++t,!0});for(var a=(8-e.length+t)*2,r=E.createBuffer(),n=0;n<8;++n){if(!e[n]||e[n].length===0){r.fillWithByte(0,a),a=0;continue}var s=E.hexToBytes(e[n]);s.length<2&&r.putByte(0),r.putBytes(s)}return r.getBytes()};E.bytesToIP=function(e){return e.length===4?E.bytesToIPv4(e):e.length===16?E.bytesToIPv6(e):null};E.bytesToIPv4=function(e){if(e.length!==4)return null;for(var t=[],a=0;a<e.length;++a)t.push(e.charCodeAt(a));return t.join(".")};E.bytesToIPv6=function(e){if(e.length!==16)return null;for(var t=[],a=[],r=0,n=0;n<e.length;n+=2){for(var s=E.bytesToHex(e[n]+e[n+1]);s[0]==="0"&&s!=="0";)s=s.substr(1);if(s==="0"){var i=a[a.length-1],o=t.length;!i||o!==i.end+1?a.push({start:o,end:o}):(i.end=o,i.end-i.start>a[r].end-a[r].start&&(r=a.length-1))}t.push(s)}if(a.length>0){var l=a[r];l.end-l.start>0&&(t.splice(l.start,l.end-l.start+1,""),l.start===0&&t.unshift(""),l.end===7&&t.push(""))}return t.join(":")};E.estimateCores=function(e,t){if(typeof e=="function"&&(t=e,e={}),e=e||{},"cores"in E&&!e.update)return t(null,E.cores);if(typeof navigator<"u"&&"hardwareConcurrency"in navigator&&navigator.hardwareConcurrency>0)return E.cores=navigator.hardwareConcurrency,t(null,E.cores);if(typeof Worker>"u")return E.cores=1,t(null,E.cores);if(typeof Blob>"u")return E.cores=2,t(null,E.cores);var a=URL.createObjectURL(new Blob(["(",function(){self.addEventListener("message",function(i){for(var o=Date.now(),l=o+4;Date.now()<l;);self.postMessage({st:o,et:l})})}.toString(),")()"],{type:"application/javascript"}));r([],5,16);function r(i,o,l){if(o===0){var u=Math.floor(i.reduce(function(f,c){return f+c},0)/i.length);return E.cores=Math.max(1,u),URL.revokeObjectURL(a),t(null,E.cores)}n(l,function(f,c){i.push(s(l,c)),r(i,o-1,l)})}function n(i,o){for(var l=[],u=[],f=0;f<i;++f){var c=new Worker(a);c.addEventListener("message",function(v){if(u.push(v.data),u.length===i){for(var g=0;g<i;++g)l[g].terminate();o(null,u)}}),l.push(c)}for(var f=0;f<i;++f)l[f].postMessage(f)}function s(i,o){for(var l=[],u=0;u<i;++u)for(var f=o[u],c=l[u]=[],v=0;v<i;++v)if(u!==v){var g=o[v];(f.st>g.st&&f.st<g.et||g.st>f.st&&g.st<f.et)&&c.push(v)}return l.reduce(function(y,x){return Math.max(y,x.length)},0)}}});var Ur=M((nc,On)=>{var Se=X();ne();On.exports=Se.cipher=Se.cipher||{};Se.cipher.algorithms=Se.cipher.algorithms||{};Se.cipher.createCipher=function(e,t){var a=e;if(typeof a=="string"&&(a=Se.cipher.getAlgorithm(a),a&&(a=a())),!a)throw new Error("Unsupported algorithm: "+e);return new Se.cipher.BlockCipher({algorithm:a,key:t,decrypt:!1})};Se.cipher.createDecipher=function(e,t){var a=e;if(typeof a=="string"&&(a=Se.cipher.getAlgorithm(a),a&&(a=a())),!a)throw new Error("Unsupported algorithm: "+e);return new Se.cipher.BlockCipher({algorithm:a,key:t,decrypt:!0})};Se.cipher.registerAlgorithm=function(e,t){e=e.toUpperCase(),Se.cipher.algorithms[e]=t};Se.cipher.getAlgorithm=function(e){return e=e.toUpperCase(),e in Se.cipher.algorithms?Se.cipher.algorithms[e]:null};var ma=Se.cipher.BlockCipher=function(e){this.algorithm=e.algorithm,this.mode=this.algorithm.mode,this.blockSize=this.mode.blockSize,this._finish=!1,this._input=null,this.output=null,this._op=e.decrypt?this.mode.decrypt:this.mode.encrypt,this._decrypt=e.decrypt,this.algorithm.initialize(e)};ma.prototype.start=function(e){e=e||{};var t={};for(var a in e)t[a]=e[a];t.decrypt=this._decrypt,this._finish=!1,this._input=Se.util.createBuffer(),this.output=e.output||Se.util.createBuffer(),this.mode.start(t)};ma.prototype.update=function(e){for(e&&this._input.putBuffer(e);!this._op.call(this.mode,this._input,this.output,this._finish)&&!this._finish;);this._input.compact()};ma.prototype.finish=function(e){e&&(this.mode.name==="ECB"||this.mode.name==="CBC")&&(this.mode.pad=function(a){return e(this.blockSize,a,!1)},this.mode.unpad=function(a){return e(this.blockSize,a,!0)});var t={};return t.decrypt=this._decrypt,t.overflow=this._input.length()%this.blockSize,!(!this._decrypt&&this.mode.pad&&!this.mode.pad(this._input,t)||(this._finish=!0,this.update(),this._decrypt&&this.mode.unpad&&!this.mode.unpad(this.output,t))||this.mode.afterFinish&&!this.mode.afterFinish(this.output,t))}});var Ea=M((ic,Kn)=>{var Te=X();ne();Te.cipher=Te.cipher||{};var j=Kn.exports=Te.cipher.modes=Te.cipher.modes||{};j.ecb=function(e){e=e||{},this.name="ECB",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=new Array(this._ints),this._outBlock=new Array(this._ints)};j.ecb.prototype.start=function(e){};j.ecb.prototype.encrypt=function(e,t,a){if(e.length()<this.blockSize&&!(a&&e.length()>0))return!0;for(var r=0;r<this._ints;++r)this._inBlock[r]=e.getInt32();this.cipher.encrypt(this._inBlock,this._outBlock);for(var r=0;r<this._ints;++r)t.putInt32(this._outBlock[r])};j.ecb.prototype.decrypt=function(e,t,a){if(e.length()<this.blockSize&&!(a&&e.length()>0))return!0;for(var r=0;r<this._ints;++r)this._inBlock[r]=e.getInt32();this.cipher.decrypt(this._inBlock,this._outBlock);for(var r=0;r<this._ints;++r)t.putInt32(this._outBlock[r])};j.ecb.prototype.pad=function(e,t){var a=e.length()===this.blockSize?this.blockSize:this.blockSize-e.length();return e.fillWithByte(a,a),!0};j.ecb.prototype.unpad=function(e,t){if(t.overflow>0)return!1;var a=e.length(),r=e.at(a-1);return r>this.blockSize<<2?!1:(e.truncate(r),!0)};j.cbc=function(e){e=e||{},this.name="CBC",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=new Array(this._ints),this._outBlock=new Array(this._ints)};j.cbc.prototype.start=function(e){if(e.iv===null){if(!this._prev)throw new Error("Invalid IV parameter.");this._iv=this._prev.slice(0)}else if("iv"in e)this._iv=Pr(e.iv,this.blockSize),this._prev=this._iv.slice(0);else throw new Error("Invalid IV parameter.")};j.cbc.prototype.encrypt=function(e,t,a){if(e.length()<this.blockSize&&!(a&&e.length()>0))return!0;for(var r=0;r<this._ints;++r)this._inBlock[r]=this._prev[r]^e.getInt32();this.cipher.encrypt(this._inBlock,this._outBlock);for(var r=0;r<this._ints;++r)t.putInt32(this._outBlock[r]);this._prev=this._outBlock};j.cbc.prototype.decrypt=function(e,t,a){if(e.length()<this.blockSize&&!(a&&e.length()>0))return!0;for(var r=0;r<this._ints;++r)this._inBlock[r]=e.getInt32();this.cipher.decrypt(this._inBlock,this._outBlock);for(var r=0;r<this._ints;++r)t.putInt32(this._prev[r]^this._outBlock[r]);this._prev=this._inBlock.slice(0)};j.cbc.prototype.pad=function(e,t){var a=e.length()===this.blockSize?this.blockSize:this.blockSize-e.length();return e.fillWithByte(a,a),!0};j.cbc.prototype.unpad=function(e,t){if(t.overflow>0)return!1;var a=e.length(),r=e.at(a-1);return r>this.blockSize<<2?!1:(e.truncate(r),!0)};j.cfb=function(e){e=e||{},this.name="CFB",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=null,this._outBlock=new Array(this._ints),this._partialBlock=new Array(this._ints),this._partialOutput=Te.util.createBuffer(),this._partialBytes=0};j.cfb.prototype.start=function(e){if(!("iv"in e))throw new Error("Invalid IV parameter.");this._iv=Pr(e.iv,this.blockSize),this._inBlock=this._iv.slice(0),this._partialBytes=0};j.cfb.prototype.encrypt=function(e,t,a){var r=e.length();if(r===0)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),this._partialBytes===0&&r>=this.blockSize){for(var n=0;n<this._ints;++n)this._inBlock[n]=e.getInt32()^this._outBlock[n],t.putInt32(this._inBlock[n]);return}var s=(this.blockSize-r)%this.blockSize;s>0&&(s=this.blockSize-s),this._partialOutput.clear();for(var n=0;n<this._ints;++n)this._partialBlock[n]=e.getInt32()^this._outBlock[n],this._partialOutput.putInt32(this._partialBlock[n]);if(s>0)e.read-=this.blockSize;else for(var n=0;n<this._ints;++n)this._inBlock[n]=this._partialBlock[n];if(this._partialBytes>0&&this._partialOutput.getBytes(this._partialBytes),s>0&&!a)return t.putBytes(this._partialOutput.getBytes(s-this._partialBytes)),this._partialBytes=s,!0;t.putBytes(this._partialOutput.getBytes(r-this._partialBytes)),this._partialBytes=0};j.cfb.prototype.decrypt=function(e,t,a){var r=e.length();if(r===0)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),this._partialBytes===0&&r>=this.blockSize){for(var n=0;n<this._ints;++n)this._inBlock[n]=e.getInt32(),t.putInt32(this._inBlock[n]^this._outBlock[n]);return}var s=(this.blockSize-r)%this.blockSize;s>0&&(s=this.blockSize-s),this._partialOutput.clear();for(var n=0;n<this._ints;++n)this._partialBlock[n]=e.getInt32(),this._partialOutput.putInt32(this._partialBlock[n]^this._outBlock[n]);if(s>0)e.read-=this.blockSize;else for(var n=0;n<this._ints;++n)this._inBlock[n]=this._partialBlock[n];if(this._partialBytes>0&&this._partialOutput.getBytes(this._partialBytes),s>0&&!a)return t.putBytes(this._partialOutput.getBytes(s-this._partialBytes)),this._partialBytes=s,!0;t.putBytes(this._partialOutput.getBytes(r-this._partialBytes)),this._partialBytes=0};j.ofb=function(e){e=e||{},this.name="OFB",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=null,this._outBlock=new Array(this._ints),this._partialOutput=Te.util.createBuffer(),this._partialBytes=0};j.ofb.prototype.start=function(e){if(!("iv"in e))throw new Error("Invalid IV parameter.");this._iv=Pr(e.iv,this.blockSize),this._inBlock=this._iv.slice(0),this._partialBytes=0};j.ofb.prototype.encrypt=function(e,t,a){var r=e.length();if(e.length()===0)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),this._partialBytes===0&&r>=this.blockSize){for(var n=0;n<this._ints;++n)t.putInt32(e.getInt32()^this._outBlock[n]),this._inBlock[n]=this._outBlock[n];return}var s=(this.blockSize-r)%this.blockSize;s>0&&(s=this.blockSize-s),this._partialOutput.clear();for(var n=0;n<this._ints;++n)this._partialOutput.putInt32(e.getInt32()^this._outBlock[n]);if(s>0)e.read-=this.blockSize;else for(var n=0;n<this._ints;++n)this._inBlock[n]=this._outBlock[n];if(this._partialBytes>0&&this._partialOutput.getBytes(this._partialBytes),s>0&&!a)return t.putBytes(this._partialOutput.getBytes(s-this._partialBytes)),this._partialBytes=s,!0;t.putBytes(this._partialOutput.getBytes(r-this._partialBytes)),this._partialBytes=0};j.ofb.prototype.decrypt=j.ofb.prototype.encrypt;j.ctr=function(e){e=e||{},this.name="CTR",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=null,this._outBlock=new Array(this._ints),this._partialOutput=Te.util.createBuffer(),this._partialBytes=0};j.ctr.prototype.start=function(e){if(!("iv"in e))throw new Error("Invalid IV parameter.");this._iv=Pr(e.iv,this.blockSize),this._inBlock=this._iv.slice(0),this._partialBytes=0};j.ctr.prototype.encrypt=function(e,t,a){var r=e.length();if(r===0)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),this._partialBytes===0&&r>=this.blockSize)for(var n=0;n<this._ints;++n)t.putInt32(e.getInt32()^this._outBlock[n]);else{var s=(this.blockSize-r)%this.blockSize;s>0&&(s=this.blockSize-s),this._partialOutput.clear();for(var n=0;n<this._ints;++n)this._partialOutput.putInt32(e.getInt32()^this._outBlock[n]);if(s>0&&(e.read-=this.blockSize),this._partialBytes>0&&this._partialOutput.getBytes(this._partialBytes),s>0&&!a)return t.putBytes(this._partialOutput.getBytes(s-this._partialBytes)),this._partialBytes=s,!0;t.putBytes(this._partialOutput.getBytes(r-this._partialBytes)),this._partialBytes=0}Vr(this._inBlock)};j.ctr.prototype.decrypt=j.ctr.prototype.encrypt;j.gcm=function(e){e=e||{},this.name="GCM",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=new Array(this._ints),this._outBlock=new Array(this._ints),this._partialOutput=Te.util.createBuffer(),this._partialBytes=0,this._R=3774873600};j.gcm.prototype.start=function(e){if(!("iv"in e))throw new Error("Invalid IV parameter.");var t=Te.util.createBuffer(e.iv);this._cipherLength=0;var a;if("additionalData"in e?a=Te.util.createBuffer(e.additionalData):a=Te.util.createBuffer(),"tagLength"in e?this._tagLength=e.tagLength:this._tagLength=128,this._tag=null,e.decrypt&&(this._tag=Te.util.createBuffer(e.tag).getBytes(),this._tag.length!==this._tagLength/8))throw new Error("Authentication tag does not match tag length.");this._hashBlock=new Array(this._ints),this.tag=null,this._hashSubkey=new Array(this._ints),this.cipher.encrypt([0,0,0,0],this._hashSubkey),this.componentBits=4,this._m=this.generateHashTable(this._hashSubkey,this.componentBits);var r=t.length();if(r===12)this._j0=[t.getInt32(),t.getInt32(),t.getInt32(),1];else{for(this._j0=[0,0,0,0];t.length()>0;)this._j0=this.ghash(this._hashSubkey,this._j0,[t.getInt32(),t.getInt32(),t.getInt32(),t.getInt32()]);this._j0=this.ghash(this._hashSubkey,this._j0,[0,0].concat(Ca(r*8)))}this._inBlock=this._j0.slice(0),Vr(this._inBlock),this._partialBytes=0,a=Te.util.createBuffer(a),this._aDataLength=Ca(a.length()*8);var n=a.length()%this.blockSize;for(n&&a.fillWithByte(0,this.blockSize-n),this._s=[0,0,0,0];a.length()>0;)this._s=this.ghash(this._hashSubkey,this._s,[a.getInt32(),a.getInt32(),a.getInt32(),a.getInt32()])};j.gcm.prototype.encrypt=function(e,t,a){var r=e.length();if(r===0)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),this._partialBytes===0&&r>=this.blockSize){for(var n=0;n<this._ints;++n)t.putInt32(this._outBlock[n]^=e.getInt32());this._cipherLength+=this.blockSize}else{var s=(this.blockSize-r)%this.blockSize;s>0&&(s=this.blockSize-s),this._partialOutput.clear();for(var n=0;n<this._ints;++n)this._partialOutput.putInt32(e.getInt32()^this._outBlock[n]);if(s<=0||a){if(a){var i=r%this.blockSize;this._cipherLength+=i,this._partialOutput.truncate(this.blockSize-i)}else this._cipherLength+=this.blockSize;for(var n=0;n<this._ints;++n)this._outBlock[n]=this._partialOutput.getInt32();this._partialOutput.read-=this.blockSize}if(this._partialBytes>0&&this._partialOutput.getBytes(this._partialBytes),s>0&&!a)return e.read-=this.blockSize,t.putBytes(this._partialOutput.getBytes(s-this._partialBytes)),this._partialBytes=s,!0;t.putBytes(this._partialOutput.getBytes(r-this._partialBytes)),this._partialBytes=0}this._s=this.ghash(this._hashSubkey,this._s,this._outBlock),Vr(this._inBlock)};j.gcm.prototype.decrypt=function(e,t,a){var r=e.length();if(r<this.blockSize&&!(a&&r>0))return!0;this.cipher.encrypt(this._inBlock,this._outBlock),Vr(this._inBlock),this._hashBlock[0]=e.getInt32(),this._hashBlock[1]=e.getInt32(),this._hashBlock[2]=e.getInt32(),this._hashBlock[3]=e.getInt32(),this._s=this.ghash(this._hashSubkey,this._s,this._hashBlock);for(var n=0;n<this._ints;++n)t.putInt32(this._outBlock[n]^this._hashBlock[n]);r<this.blockSize?this._cipherLength+=r%this.blockSize:this._cipherLength+=this.blockSize};j.gcm.prototype.afterFinish=function(e,t){var a=!0;t.decrypt&&t.overflow&&e.truncate(this.blockSize-t.overflow),this.tag=Te.util.createBuffer();var r=this._aDataLength.concat(Ca(this._cipherLength*8));this._s=this.ghash(this._hashSubkey,this._s,r);var n=[];this.cipher.encrypt(this._j0,n);for(var s=0;s<this._ints;++s)this.tag.putInt32(this._s[s]^n[s]);return this.tag.truncate(this.tag.length()%(this._tagLength/8)),t.decrypt&&this.tag.bytes()!==this._tag&&(a=!1),a};j.gcm.prototype.multiply=function(e,t){for(var a=[0,0,0,0],r=t.slice(0),n=0;n<128;++n){var s=e[n/32|0]&1<<31-n%32;s&&(a[0]^=r[0],a[1]^=r[1],a[2]^=r[2],a[3]^=r[3]),this.pow(r,r)}return a};j.gcm.prototype.pow=function(e,t){for(var a=e[3]&1,r=3;r>0;--r)t[r]=e[r]>>>1|(e[r-1]&1)<<31;t[0]=e[0]>>>1,a&&(t[0]^=this._R)};j.gcm.prototype.tableMultiply=function(e){for(var t=[0,0,0,0],a=0;a<32;++a){var r=a/8|0,n=e[r]>>>(7-a%8)*4&15,s=this._m[a][n];t[0]^=s[0],t[1]^=s[1],t[2]^=s[2],t[3]^=s[3]}return t};j.gcm.prototype.ghash=function(e,t,a){return t[0]^=a[0],t[1]^=a[1],t[2]^=a[2],t[3]^=a[3],this.tableMultiply(t)};j.gcm.prototype.generateHashTable=function(e,t){for(var a=8/t,r=4*a,n=16*a,s=new Array(n),i=0;i<n;++i){var o=[0,0,0,0],l=i/r|0,u=(r-1-i%r)*t;o[l]=1<<t-1<<u,s[i]=this.generateSubHashTable(this.multiply(o,e),t)}return s};j.gcm.prototype.generateSubHashTable=function(e,t){var a=1<<t,r=a>>>1,n=new Array(a);n[r]=e.slice(0);for(var s=r>>>1;s>0;)this.pow(n[2*s],n[s]=[]),s>>=1;for(s=2;s<r;){for(var i=1;i<s;++i){var o=n[s],l=n[i];n[s+i]=[o[0]^l[0],o[1]^l[1],o[2]^l[2],o[3]^l[3]]}s*=2}for(n[0]=[0,0,0,0],s=r+1;s<a;++s){var u=n[s^r];n[s]=[e[0]^u[0],e[1]^u[1],e[2]^u[2],e[3]^u[3]]}return n};function Pr(e,t){if(typeof e=="string"&&(e=Te.util.createBuffer(e)),Te.util.isArray(e)&&e.length>4){var a=e;e=Te.util.createBuffer();for(var r=0;r<a.length;++r)e.putByte(a[r])}if(e.length()<t)throw new Error("Invalid IV length; got "+e.length()+" bytes and expected "+t+" bytes.");if(!Te.util.isArray(e)){for(var n=[],s=t/4,r=0;r<s;++r)n.push(e.getInt32());e=n}return e}function Vr(e){e[e.length-1]=e[e.length-1]+1&4294967295}function Ca(e){return[e/4294967296|0,e&4294967295]}});var Bt=M((sc,Hn)=>{var fe=X();Ur();Ea();ne();Hn.exports=fe.aes=fe.aes||{};fe.aes.startEncrypting=function(e,t,a,r){var n=Or({key:e,output:a,decrypt:!1,mode:r});return n.start(t),n};fe.aes.createEncryptionCipher=function(e,t){return Or({key:e,output:null,decrypt:!1,mode:t})};fe.aes.startDecrypting=function(e,t,a,r){var n=Or({key:e,output:a,decrypt:!0,mode:r});return n.start(t),n};fe.aes.createDecryptionCipher=function(e,t){return Or({key:e,output:null,decrypt:!0,mode:t})};fe.aes.Algorithm=function(e,t){Ta||qn();var a=this;a.name=e,a.mode=new t({blockSize:16,cipher:{encrypt:function(r,n){return Sa(a._w,r,n,!1)},decrypt:function(r,n){return Sa(a._w,r,n,!0)}}}),a._init=!1};fe.aes.Algorithm.prototype.initialize=function(e){if(!this._init){var t=e.key,a;if(typeof t=="string"&&(t.length===16||t.length===24||t.length===32))t=fe.util.createBuffer(t);else if(fe.util.isArray(t)&&(t.length===16||t.length===24||t.length===32)){a=t,t=fe.util.createBuffer();for(var r=0;r<a.length;++r)t.putByte(a[r])}if(!fe.util.isArray(t)){a=t,t=[];var n=a.length();if(n===16||n===24||n===32){n=n>>>2;for(var r=0;r<n;++r)t.push(a.getInt32())}}if(!fe.util.isArray(t)||!(t.length===4||t.length===6||t.length===8))throw new Error("Invalid key parameter.");var s=this.mode.name,i=["CFB","OFB","CTR","GCM"].indexOf(s)!==-1;this._w=Mn(t,e.decrypt&&!i),this._init=!0}};fe.aes._expandKey=function(e,t){return Ta||qn(),Mn(e,t)};fe.aes._updateBlock=Sa;Zt("AES-ECB",fe.cipher.modes.ecb);Zt("AES-CBC",fe.cipher.modes.cbc);Zt("AES-CFB",fe.cipher.modes.cfb);Zt("AES-OFB",fe.cipher.modes.ofb);Zt("AES-CTR",fe.cipher.modes.ctr);Zt("AES-GCM",fe.cipher.modes.gcm);function Zt(e,t){var a=function(){return new fe.aes.Algorithm(e,t)};fe.cipher.registerAlgorithm(e,a)}var Ta=!1,$t=4,He,xa,Fn,Ot,it;function qn(){Ta=!0,Fn=[0,1,2,4,8,16,32,64,128,27,54];for(var e=new Array(256),t=0;t<128;++t)e[t]=t<<1,e[t+128]=t+128<<1^283;He=new Array(256),xa=new Array(256),Ot=new Array(4),it=new Array(4);for(var t=0;t<4;++t)Ot[t]=new Array(256),it[t]=new Array(256);for(var a=0,r=0,n,s,i,o,l,u,f,t=0;t<256;++t){o=r^r<<1^r<<2^r<<3^r<<4,o=o>>8^o&255^99,He[a]=o,xa[o]=a,l=e[o],n=e[a],s=e[n],i=e[s],u=l<<24^o<<16^o<<8^(o^l),f=(n^s^i)<<24^(a^i)<<16^(a^s^i)<<8^(a^n^i);for(var c=0;c<4;++c)Ot[c][a]=u,it[c][o]=f,u=u<<24|u>>>8,f=f<<24|f>>>8;a===0?a=r=1:(a=n^e[e[e[n^i]]],r^=e[e[r]])}}function Mn(e,t){for(var a=e.slice(0),r,n=1,s=a.length,i=s+6+1,o=$t*i,l=s;l<o;++l)r=a[l-1],l%s===0?(r=He[r>>>16&255]<<24^He[r>>>8&255]<<16^He[r&255]<<8^He[r>>>24]^Fn[n]<<24,n++):s>6&&l%s===4&&(r=He[r>>>24]<<24^He[r>>>16&255]<<16^He[r>>>8&255]<<8^He[r&255]),a[l]=a[l-s]^r;if(t){var u,f=it[0],c=it[1],v=it[2],g=it[3],y=a.slice(0);o=a.length;for(var l=0,x=o-$t;l<o;l+=$t,x-=$t)if(l===0||l===o-$t)y[l]=a[x],y[l+1]=a[x+3],y[l+2]=a[x+2],y[l+3]=a[x+1];else for(var S=0;S<$t;++S)u=a[x+S],y[l+(3&-S)]=f[He[u>>>24]]^c[He[u>>>16&255]]^v[He[u>>>8&255]]^g[He[u&255]];a=y}return a}function Sa(e,t,a,r){var n=e.length/4-1,s,i,o,l,u;r?(s=it[0],i=it[1],o=it[2],l=it[3],u=xa):(s=Ot[0],i=Ot[1],o=Ot[2],l=Ot[3],u=He);var f,c,v,g,y,x,S;f=t[0]^e[0],c=t[r?3:1]^e[1],v=t[2]^e[2],g=t[r?1:3]^e[3];for(var I=3,B=1;B<n;++B)y=s[f>>>24]^i[c>>>16&255]^o[v>>>8&255]^l[g&255]^e[++I],x=s[c>>>24]^i[v>>>16&255]^o[g>>>8&255]^l[f&255]^e[++I],S=s[v>>>24]^i[g>>>16&255]^o[f>>>8&255]^l[c&255]^e[++I],g=s[g>>>24]^i[f>>>16&255]^o[c>>>8&255]^l[v&255]^e[++I],f=y,c=x,v=S;a[0]=u[f>>>24]<<24^u[c>>>16&255]<<16^u[v>>>8&255]<<8^u[g&255]^e[++I],a[r?3:1]=u[c>>>24]<<24^u[v>>>16&255]<<16^u[g>>>8&255]<<8^u[f&255]^e[++I],a[2]=u[v>>>24]<<24^u[g>>>16&255]<<16^u[f>>>8&255]<<8^u[c&255]^e[++I],a[r?1:3]=u[g>>>24]<<24^u[f>>>16&255]<<16^u[c>>>8&255]<<8^u[v&255]^e[++I]}function Or(e){e=e||{};var t=(e.mode||"CBC").toUpperCase(),a="AES-"+t,r;e.decrypt?r=fe.cipher.createDecipher(a,e.key):r=fe.cipher.createCipher(a,e.key);var n=r.start;return r.start=function(s,i){var o=null;i instanceof fe.util.ByteBuffer&&(o=i,i={}),i=i||{},i.output=o,i.iv=s,n.call(r,i)},r}});var bt=M((oc,Gn)=>{var vr=X();vr.pki=vr.pki||{};var Ia=Gn.exports=vr.pki.oids=vr.oids=vr.oids||{};function R(e,t){Ia[e]=t,Ia[t]=e}function se(e,t){Ia[e]=t}R("1.2.840.113549.1.1.1","rsaEncryption");R("1.2.840.113549.1.1.4","md5WithRSAEncryption");R("1.2.840.113549.1.1.5","sha1WithRSAEncryption");R("1.2.840.113549.1.1.7","RSAES-OAEP");R("1.2.840.113549.1.1.8","mgf1");R("1.2.840.113549.1.1.9","pSpecified");R("1.2.840.113549.1.1.10","RSASSA-PSS");R("1.2.840.113549.1.1.11","sha256WithRSAEncryption");R("1.2.840.113549.1.1.12","sha384WithRSAEncryption");R("1.2.840.113549.1.1.13","sha512WithRSAEncryption");R("1.3.101.112","EdDSA25519");R("1.2.840.10040.4.3","dsa-with-sha1");R("1.3.14.3.2.7","desCBC");R("1.3.14.3.2.26","sha1");R("1.3.14.3.2.29","sha1WithRSASignature");R("2.16.840.1.101.3.4.2.1","sha256");R("2.16.840.1.101.3.4.2.2","sha384");R("2.16.840.1.101.3.4.2.3","sha512");R("2.16.840.1.101.3.4.2.4","sha224");R("2.16.840.1.101.3.4.2.5","sha512-224");R("2.16.840.1.101.3.4.2.6","sha512-256");R("1.2.840.113549.2.2","md2");R("1.2.840.113549.2.5","md5");R("1.2.840.113549.1.7.1","data");R("1.2.840.113549.1.7.2","signedData");R("1.2.840.113549.1.7.3","envelopedData");R("1.2.840.113549.1.7.4","signedAndEnvelopedData");R("1.2.840.113549.1.7.5","digestedData");R("1.2.840.113549.1.7.6","encryptedData");R("1.2.840.113549.1.9.1","emailAddress");R("1.2.840.113549.1.9.2","unstructuredName");R("1.2.840.113549.1.9.3","contentType");R("1.2.840.113549.1.9.4","messageDigest");R("1.2.840.113549.1.9.5","signingTime");R("1.2.840.113549.1.9.6","counterSignature");R("1.2.840.113549.1.9.7","challengePassword");R("1.2.840.113549.1.9.8","unstructuredAddress");R("1.2.840.113549.1.9.14","extensionRequest");R("1.2.840.113549.1.9.20","friendlyName");R("1.2.840.113549.1.9.21","localKeyId");R("1.2.840.113549.1.9.22.1","x509Certificate");R("1.2.840.113549.1.12.10.1.1","keyBag");R("1.2.840.113549.1.12.10.1.2","pkcs8ShroudedKeyBag");R("1.2.840.113549.1.12.10.1.3","certBag");R("1.2.840.113549.1.12.10.1.4","crlBag");R("1.2.840.113549.1.12.10.1.5","secretBag");R("1.2.840.113549.1.12.10.1.6","safeContentsBag");R("1.2.840.113549.1.5.13","pkcs5PBES2");R("1.2.840.113549.1.5.12","pkcs5PBKDF2");R("1.2.840.113549.1.12.1.1","pbeWithSHAAnd128BitRC4");R("1.2.840.113549.1.12.1.2","pbeWithSHAAnd40BitRC4");R("1.2.840.113549.1.12.1.3","pbeWithSHAAnd3-KeyTripleDES-CBC");R("1.2.840.113549.1.12.1.4","pbeWithSHAAnd2-KeyTripleDES-CBC");R("1.2.840.113549.1.12.1.5","pbeWithSHAAnd128BitRC2-CBC");R("1.2.840.113549.1.12.1.6","pbewithSHAAnd40BitRC2-CBC");R("1.2.840.113549.2.7","hmacWithSHA1");R("1.2.840.113549.2.8","hmacWithSHA224");R("1.2.840.113549.2.9","hmacWithSHA256");R("1.2.840.113549.2.10","hmacWithSHA384");R("1.2.840.113549.2.11","hmacWithSHA512");R("1.2.840.113549.3.7","des-EDE3-CBC");R("2.16.840.1.101.3.4.1.2","aes128-CBC");R("2.16.840.1.101.3.4.1.22","aes192-CBC");R("2.16.840.1.101.3.4.1.42","aes256-CBC");R("2.5.4.3","commonName");R("2.5.4.4","surname");R("2.5.4.5","serialNumber");R("2.5.4.6","countryName");R("2.5.4.7","localityName");R("2.5.4.8","stateOrProvinceName");R("2.5.4.9","streetAddress");R("2.5.4.10","organizationName");R("2.5.4.11","organizationalUnitName");R("2.5.4.12","title");R("2.5.4.13","description");R("2.5.4.15","businessCategory");R("2.5.4.17","postalCode");R("2.5.4.42","givenName");R("2.5.4.65","pseudonym");R("1.3.6.1.4.1.311.60.2.1.2","jurisdictionOfIncorporationStateOrProvinceName");R("1.3.6.1.4.1.311.60.2.1.3","jurisdictionOfIncorporationCountryName");R("2.16.840.1.113730.1.1","nsCertType");R("2.16.840.1.113730.1.13","nsComment");se("2.5.29.1","authorityKeyIdentifier");se("2.5.29.2","keyAttributes");se("2.5.29.3","certificatePolicies");se("2.5.29.4","keyUsageRestriction");se("2.5.29.5","policyMapping");se("2.5.29.6","subtreesConstraint");se("2.5.29.7","subjectAltName");se("2.5.29.8","issuerAltName");se("2.5.29.9","subjectDirectoryAttributes");se("2.5.29.10","basicConstraints");se("2.5.29.11","nameConstraints");se("2.5.29.12","policyConstraints");se("2.5.29.13","basicConstraints");R("2.5.29.14","subjectKeyIdentifier");R("2.5.29.15","keyUsage");se("2.5.29.16","privateKeyUsagePeriod");R("2.5.29.17","subjectAltName");R("2.5.29.18","issuerAltName");R("2.5.29.19","basicConstraints");se("2.5.29.20","cRLNumber");se("2.5.29.21","cRLReason");se("2.5.29.22","expirationDate");se("2.5.29.23","instructionCode");se("2.5.29.24","invalidityDate");se("2.5.29.25","cRLDistributionPoints");se("2.5.29.26","issuingDistributionPoint");se("2.5.29.27","deltaCRLIndicator");se("2.5.29.28","issuingDistributionPoint");se("2.5.29.29","certificateIssuer");se("2.5.29.30","nameConstraints");R("2.5.29.31","cRLDistributionPoints");R("2.5.29.32","certificatePolicies");se("2.5.29.33","policyMappings");se("2.5.29.34","policyConstraints");R("2.5.29.35","authorityKeyIdentifier");se("2.5.29.36","policyConstraints");R("2.5.29.37","extKeyUsage");se("2.5.29.46","freshestCRL");se("2.5.29.54","inhibitAnyPolicy");R("1.3.6.1.4.1.11129.2.4.2","timestampList");R("1.3.6.1.5.5.7.1.1","authorityInfoAccess");R("1.3.6.1.5.5.7.3.1","serverAuth");R("1.3.6.1.5.5.7.3.2","clientAuth");R("1.3.6.1.5.5.7.3.3","codeSigning");R("1.3.6.1.5.5.7.3.4","emailProtection");R("1.3.6.1.5.5.7.3.8","timeStamping")});var st=M((uc,Qn)=>{var he=X();ne();bt();var P=Qn.exports=he.asn1=he.asn1||{};P.Class={UNIVERSAL:0,APPLICATION:64,CONTEXT_SPECIFIC:128,PRIVATE:192};P.Type={NONE:0,BOOLEAN:1,INTEGER:2,BITSTRING:3,OCTETSTRING:4,NULL:5,OID:6,ODESC:7,EXTERNAL:8,REAL:9,ENUMERATED:10,EMBEDDED:11,UTF8:12,ROID:13,SEQUENCE:16,SET:17,PRINTABLESTRING:19,IA5STRING:22,UTCTIME:23,GENERALIZEDTIME:24,BMPSTRING:30};P.maxDepth=256;P.create=function(e,t,a,r,n){if(he.util.isArray(r)){for(var s=[],i=0;i<r.length;++i)r[i]!==void 0&&s.push(r[i]);r=s}var o={tagClass:e,type:t,constructed:a,composed:a||he.util.isArray(r),value:r};return n&&"bitStringContents"in n&&(o.bitStringContents=n.bitStringContents,o.original=P.copy(o)),o};P.copy=function(e,t){var a;if(he.util.isArray(e)){a=[];for(var r=0;r<e.length;++r)a.push(P.copy(e[r],t));return a}return typeof e=="string"?e:(a={tagClass:e.tagClass,type:e.type,constructed:e.constructed,composed:e.composed,value:P.copy(e.value,t)},t&&!t.excludeBitStringContents&&(a.bitStringContents=e.bitStringContents),a)};P.equals=function(e,t,a){if(he.util.isArray(e)){if(!he.util.isArray(t)||e.length!==t.length)return!1;for(var r=0;r<e.length;++r)if(!P.equals(e[r],t[r]))return!1;return!0}if(typeof e!=typeof t)return!1;if(typeof e=="string")return e===t;var n=e.tagClass===t.tagClass&&e.type===t.type&&e.constructed===t.constructed&&e.composed===t.composed&&P.equals(e.value,t.value);return a&&a.includeBitStringContents&&(n=n&&e.bitStringContents===t.bitStringContents),n};P.getBerValueLength=function(e){var t=e.getByte();if(t!==128){var a,r=t&128;return r?a=e.getInt((t&127)<<3):a=t,a}};function yr(e,t,a){if(a>t){var r=new Error("Too few bytes to parse DER.");throw r.available=e.length(),r.remaining=t,r.requested=a,r}}var ko=function(e,t){var a=e.getByte();if(t--,a!==128){var r,n=a&128;if(!n)r=a;else{var s=a&127;yr(e,t,s),r=e.getInt(s<<3)}if(r<0)throw new Error("Negative length: "+r);return r}};P.fromDer=function(e,t){t===void 0&&(t={strict:!0,parseAllBytes:!0,decodeBitStrings:!0}),typeof t=="boolean"&&(t={strict:t,parseAllBytes:!0,decodeBitStrings:!0}),"strict"in t||(t.strict=!0),"parseAllBytes"in t||(t.parseAllBytes=!0),"decodeBitStrings"in t||(t.decodeBitStrings=!0),"maxDepth"in t||(t.maxDepth=P.maxDepth),typeof e=="string"&&(e=he.util.createBuffer(e));var a=e.length(),r=Kr(e,e.length(),0,t);if(t.parseAllBytes&&e.length()!==0){var n=new Error("Unparsed DER bytes remain after ASN.1 parsing.");throw n.byteCount=a,n.remaining=e.length(),n}return r};function Kr(e,t,a,r){if(a>=r.maxDepth)throw new Error("ASN.1 parsing error: Max depth exceeded.");var n;yr(e,t,2);var s=e.getByte();t--;var i=s&192,o=s&31;n=e.length();var l=ko(e,t);if(t-=n-e.length(),l!==void 0&&l>t){if(r.strict){var u=new Error("Too few bytes to read ASN.1 value.");throw u.available=e.length(),u.remaining=t,u.requested=l,u}l=t}var f,c,v=(s&32)===32;if(v)if(f=[],l===void 0)for(;;){if(yr(e,t,2),e.bytes(2)==="\0\0"){e.getBytes(2),t-=2;break}n=e.length(),f.push(Kr(e,t,a+1,r)),t-=n-e.length()}else for(;l>0;)n=e.length(),f.push(Kr(e,l,a+1,r)),t-=n-e.length(),l-=n-e.length();if(f===void 0&&i===P.Class.UNIVERSAL&&o===P.Type.BITSTRING&&(c=e.bytes(l)),f===void 0&&r.decodeBitStrings&&i===P.Class.UNIVERSAL&&o===P.Type.BITSTRING&&l>1){var g=e.read,y=t,x=0;if(o===P.Type.BITSTRING&&(yr(e,t,1),x=e.getByte(),t--),x===0)try{n=e.length();var S={strict:!0,decodeBitStrings:!0},I=Kr(e,t,a+1,S),B=n-e.length();t-=B,o==P.Type.BITSTRING&&B++;var b=I.tagClass;B===l&&(b===P.Class.UNIVERSAL||b===P.Class.CONTEXT_SPECIFIC)&&(f=[I])}catch{}f===void 0&&(e.read=g,t=y)}if(f===void 0){if(l===void 0){if(r.strict)throw new Error("Non-constructed ASN.1 object of indefinite length.");l=t}if(o===P.Type.BMPSTRING)for(f="";l>0;l-=2)yr(e,t,2),f+=String.fromCharCode(e.getInt16()),t-=2;else f=e.getBytes(l),t-=l}var U=c===void 0?null:{bitStringContents:c};return P.create(i,o,v,f,U)}P.toDer=function(e){var t=he.util.createBuffer(),a=e.tagClass|e.type,r=he.util.createBuffer(),n=!1;if("bitStringContents"in e&&(n=!0,e.original&&(n=P.equals(e,e.original))),n)r.putBytes(e.bitStringContents);else if(e.composed){e.constructed?a|=32:r.putByte(0);for(var s=0;s<e.value.length;++s)e.value[s]!==void 0&&r.putBuffer(P.toDer(e.value[s]))}else if(e.type===P.Type.BMPSTRING)for(var s=0;s<e.value.length;++s)r.putInt16(e.value.charCodeAt(s));else e.type===P.Type.INTEGER&&e.value.length>1&&(e.value.charCodeAt(0)===0&&(e.value.charCodeAt(1)&128)===0||e.value.charCodeAt(0)===255&&(e.value.charCodeAt(1)&128)===128)?r.putBytes(e.value.substr(1)):r.putBytes(e.value);if(t.putByte(a),r.length()<=127)t.putByte(r.length()&127);else{var i=r.length(),o="";do o+=String.fromCharCode(i&255),i=i>>>8;while(i>0);t.putByte(o.length|128);for(var s=o.length-1;s>=0;--s)t.putByte(o.charCodeAt(s))}return t.putBuffer(r),t};P.oidToDer=function(e){var t=e.split("."),a=he.util.createBuffer();a.putByte(40*parseInt(t[0],10)+parseInt(t[1],10));for(var r,n,s,i,o=2;o<t.length;++o){if(r=!0,n=[],s=parseInt(t[o],10),s>4294967295)throw new Error("OID value too large; max is 32-bits.");do i=s&127,s=s>>>7,r||(i|=128),n.push(i),r=!1;while(s>0);for(var l=n.length-1;l>=0;--l)a.putByte(n[l])}return a};P.derToOid=function(e){var t;typeof e=="string"&&(e=he.util.createBuffer(e));var a=e.getByte();t=Math.floor(a/40)+"."+a%40;for(var r=0;e.length()>0;){if(r>70368744177663)throw new Error("OID value too large; max is 53-bits.");a=e.getByte(),r=r*128,a&128?r+=a&127:(t+="."+(r+a),r=0)}return t};P.utcTimeToDate=function(e){var t=new Date,a=parseInt(e.substr(0,2),10);a=a>=50?1900+a:2e3+a;var r=parseInt(e.substr(2,2),10)-1,n=parseInt(e.substr(4,2),10),s=parseInt(e.substr(6,2),10),i=parseInt(e.substr(8,2),10),o=0;if(e.length>11){var l=e.charAt(10),u=10;l!=="+"&&l!=="-"&&(o=parseInt(e.substr(10,2),10),u+=2)}if(t.setUTCFullYear(a,r,n),t.setUTCHours(s,i,o,0),u&&(l=e.charAt(u),l==="+"||l==="-")){var f=parseInt(e.substr(u+1,2),10),c=parseInt(e.substr(u+4,2),10),v=f*60+c;v*=6e4,l==="+"?t.setTime(+t-v):t.setTime(+t+v)}return t};P.generalizedTimeToDate=function(e){var t=new Date,a=parseInt(e.substr(0,4),10),r=parseInt(e.substr(4,2),10)-1,n=parseInt(e.substr(6,2),10),s=parseInt(e.substr(8,2),10),i=parseInt(e.substr(10,2),10),o=parseInt(e.substr(12,2),10),l=0,u=0,f=!1;e.charAt(e.length-1)==="Z"&&(f=!0);var c=e.length-5,v=e.charAt(c);if(v==="+"||v==="-"){var g=parseInt(e.substr(c+1,2),10),y=parseInt(e.substr(c+4,2),10);u=g*60+y,u*=6e4,v==="+"&&(u*=-1),f=!0}return e.charAt(14)==="."&&(l=parseFloat(e.substr(14),10)*1e3),f?(t.setUTCFullYear(a,r,n),t.setUTCHours(s,i,o,l),t.setTime(+t+u)):(t.setFullYear(a,r,n),t.setHours(s,i,o,l)),t};P.dateToUtcTime=function(e){if(typeof e=="string")return e;var t="",a=[];a.push((""+e.getUTCFullYear()).substr(2)),a.push(""+(e.getUTCMonth()+1)),a.push(""+e.getUTCDate()),a.push(""+e.getUTCHours()),a.push(""+e.getUTCMinutes()),a.push(""+e.getUTCSeconds());for(var r=0;r<a.length;++r)a[r].length<2&&(t+="0"),t+=a[r];return t+="Z",t};P.dateToGeneralizedTime=function(e){if(typeof e=="string")return e;var t="",a=[];a.push(""+e.getUTCFullYear()),a.push(""+(e.getUTCMonth()+1)),a.push(""+e.getUTCDate()),a.push(""+e.getUTCHours()),a.push(""+e.getUTCMinutes()),a.push(""+e.getUTCSeconds());for(var r=0;r<a.length;++r)a[r].length<2&&(t+="0"),t+=a[r];return t+="Z",t};P.integerToDer=function(e){var t=he.util.createBuffer();if(e>=-128&&e<128)return t.putSignedInt(e,8);if(e>=-32768&&e<32768)return t.putSignedInt(e,16);if(e>=-8388608&&e<8388608)return t.putSignedInt(e,24);if(e>=-2147483648&&e<2147483648)return t.putSignedInt(e,32);var a=new Error("Integer too large; max is 32-bits.");throw a.integer=e,a};P.derToInteger=function(e){typeof e=="string"&&(e=he.util.createBuffer(e));var t=e.length()*8;if(t>32)throw new Error("Integer too large; max is 32-bits.");return e.getSignedInt(t)};P.validate=function(e,t,a,r){var n=!1;if((e.tagClass===t.tagClass||typeof t.tagClass>"u")&&(e.type===t.type||typeof t.type>"u"))if(e.constructed===t.constructed||typeof t.constructed>"u"){if(n=!0,t.value&&he.util.isArray(t.value))for(var s=0,i=0;n&&i<t.value.length;++i){var o=t.value[i];n=!!o.optional;var l=e.value[s];if(!l){o.optional||(n=!1,r&&r.push("["+t.name+'] Missing required element. Expected tag class "'+o.tagClass+'", type "'+o.type+'"'));continue}var u=typeof o.tagClass<"u"&&typeof o.type<"u";if(u&&(l.tagClass!==o.tagClass||l.type!==o.type))if(o.optional){n=!0;continue}else{n=!1,r&&r.push("["+t.name+"] Tag mismatch. Expected ("+o.tagClass+","+o.type+"), got ("+l.tagClass+","+l.type+")");break}var f=P.validate(l,o,a,r);if(f)++s,n=!0;else if(o.optional)n=!0;else{n=!1;break}}if(n&&a&&(t.capture&&(a[t.capture]=e.value),t.captureAsn1&&(a[t.captureAsn1]=e),t.captureBitStringContents&&"bitStringContents"in e&&(a[t.captureBitStringContents]=e.bitStringContents),t.captureBitStringValue&&"bitStringContents"in e)){var c;if(e.bitStringContents.length<2)a[t.captureBitStringValue]="";else{var v=e.bitStringContents.charCodeAt(0);if(v!==0)throw new Error("captureBitStringValue only supported for zero unused bits");a[t.captureBitStringValue]=e.bitStringContents.slice(1)}}}else r&&r.push("["+t.name+'] Expected constructed "'+t.constructed+'", got "'+e.constructed+'"');else r&&(e.tagClass!==t.tagClass&&r.push("["+t.name+'] Expected tag class "'+t.tagClass+'", got "'+e.tagClass+'"'),e.type!==t.type&&r.push("["+t.name+'] Expected type "'+t.type+'", got "'+e.type+'"'));return n};var zn=/[^\\u0000-\\u00ff]/;P.prettyPrint=function(e,t,a){var r="";t=t||0,a=a||2,t>0&&(r+=`
5
5
  `);for(var n="",s=0;s<t*a;++s)n+=" ";switch(r+=n+"Tag: ",e.tagClass){case P.Class.UNIVERSAL:r+="Universal:";break;case P.Class.APPLICATION:r+="Application:";break;case P.Class.CONTEXT_SPECIFIC:r+="Context-Specific:";break;case P.Class.PRIVATE:r+="Private:";break}if(e.tagClass===P.Class.UNIVERSAL)switch(r+=e.type,e.type){case P.Type.NONE:r+=" (None)";break;case P.Type.BOOLEAN:r+=" (Boolean)";break;case P.Type.INTEGER:r+=" (Integer)";break;case P.Type.BITSTRING:r+=" (Bit string)";break;case P.Type.OCTETSTRING:r+=" (Octet string)";break;case P.Type.NULL:r+=" (Null)";break;case P.Type.OID:r+=" (Object Identifier)";break;case P.Type.ODESC:r+=" (Object Descriptor)";break;case P.Type.EXTERNAL:r+=" (External or Instance of)";break;case P.Type.REAL:r+=" (Real)";break;case P.Type.ENUMERATED:r+=" (Enumerated)";break;case P.Type.EMBEDDED:r+=" (Embedded PDV)";break;case P.Type.UTF8:r+=" (UTF8)";break;case P.Type.ROID:r+=" (Relative Object Identifier)";break;case P.Type.SEQUENCE:r+=" (Sequence)";break;case P.Type.SET:r+=" (Set)";break;case P.Type.PRINTABLESTRING:r+=" (Printable String)";break;case P.Type.IA5String:r+=" (IA5String (ASCII))";break;case P.Type.UTCTIME:r+=" (UTC time)";break;case P.Type.GENERALIZEDTIME:r+=" (Generalized time)";break;case P.Type.BMPSTRING:r+=" (BMP String)";break}else r+=e.type;if(r+=`
6
6
  `,r+=n+"Constructed: "+e.constructed+`
7
- `,e.composed){for(var i=0,o="",s=0;s<e.value.length;++s)e.value[s]!==void 0&&(i+=1,o+=P.prettyPrint(e.value[s],t+1,a),s+1<e.value.length&&(o+=","));r+=n+"Sub values: "+i+o}else{if(r+=n+"Value: ",e.type===P.Type.OID){var l=P.derToOid(e.value);r+=l,he.pki&&he.pki.oids&&l in he.pki.oids&&(r+=" ("+he.pki.oids[l]+") ")}if(e.type===P.Type.INTEGER)try{r+=P.derToInteger(e.value)}catch{r+="0x"+he.util.bytesToHex(e.value)}else if(e.type===P.Type.BITSTRING){if(e.value.length>1?r+="0x"+he.util.bytesToHex(e.value.slice(1)):r+="(none)",e.value.length>0){var u=e.value.charCodeAt(0);u==1?r+=" (1 unused bit shown)":u>1&&(r+=" ("+u+" unused bits shown)")}}else if(e.type===P.Type.OCTETSTRING)Gn.test(e.value)||(r+="("+e.value+") "),r+="0x"+he.util.bytesToHex(e.value);else if(e.type===P.Type.UTF8)try{r+=he.util.decodeUtf8(e.value)}catch(f){if(f.message==="URI malformed")r+="0x"+he.util.bytesToHex(e.value)+" (malformed UTF8)";else throw f}else e.type===P.Type.PRINTABLESTRING||e.type===P.Type.IA5String?r+=e.value:Gn.test(e.value)?r+="0x"+he.util.bytesToHex(e.value):e.value.length===0?r+="[null]":r+=e.value}return r}});var ut=M((uc,Qn)=>{var Fr=X();Qn.exports=Fr.md=Fr.md||{};Fr.md.algorithms=Fr.md.algorithms||{}});var Jt=M((lc,Yn)=>{var mt=X();ut();ne();var Lo=Yn.exports=mt.hmac=mt.hmac||{};Lo.create=function(){var e=null,t=null,a=null,r=null,n={};return n.start=function(s,i){if(s!==null)if(typeof s=="string")if(s=s.toLowerCase(),s in mt.md.algorithms)t=mt.md.algorithms[s].create();else throw new Error('Unknown hash algorithm "'+s+'"');else t=s;if(i===null)i=e;else{if(typeof i=="string")i=mt.util.createBuffer(i);else if(mt.util.isArray(i)){var o=i;i=mt.util.createBuffer();for(var l=0;l<o.length;++l)i.putByte(o[l])}var u=i.length();u>t.blockLength&&(t.start(),t.update(i.bytes()),i=t.digest()),a=mt.util.createBuffer(),r=mt.util.createBuffer(),u=i.length();for(var l=0;l<u;++l){var o=i.at(l);a.putByte(54^o),r.putByte(92^o)}if(u<t.blockLength)for(var o=t.blockLength-u,l=0;l<o;++l)a.putByte(54),r.putByte(92);e=i,a=a.bytes(),r=r.bytes()}t.start(),t.update(a)},n.update=function(s){t.update(s)},n.getMac=function(){var s=t.digest().bytes();return t.start(),t.update(r),t.update(s),t.digest()},n.digest=n.getMac,n}});var Mr=M((fc,$n)=>{var lt=X();ut();ne();var jn=$n.exports=lt.md5=lt.md5||{};lt.md.md5=lt.md.algorithms.md5=jn;jn.create=function(){Wn||ko();var e=null,t=lt.util.createBuffer(),a=new Array(16),r={algorithm:"md5",blockLength:64,digestLength:16,messageLength:0,fullMessageLength:null,messageLengthSize:8};return r.start=function(){r.messageLength=0,r.fullMessageLength=r.messageLength64=[];for(var n=r.messageLengthSize/4,s=0;s<n;++s)r.fullMessageLength.push(0);return t=lt.util.createBuffer(),e={h0:1732584193,h1:4023233417,h2:2562383102,h3:271733878},r},r.start(),r.update=function(n,s){s==="utf8"&&(n=lt.util.encodeUtf8(n));var i=n.length;r.messageLength+=i,i=[i/4294967296>>>0,i>>>0];for(var o=r.fullMessageLength.length-1;o>=0;--o)r.fullMessageLength[o]+=i[1],i[1]=i[0]+(r.fullMessageLength[o]/4294967296>>>0),r.fullMessageLength[o]=r.fullMessageLength[o]>>>0,i[0]=i[1]/4294967296>>>0;return t.putBytes(n),Xn(e,a,t),(t.read>2048||t.length()===0)&&t.compact(),r},r.digest=function(){var n=lt.util.createBuffer();n.putBytes(t.bytes());var s=r.fullMessageLength[r.fullMessageLength.length-1]+r.messageLengthSize,i=s&r.blockLength-1;n.putBytes(Aa.substr(0,r.blockLength-i));for(var o,l=0,u=r.fullMessageLength.length-1;u>=0;--u)o=r.fullMessageLength[u]*8+l,l=o/4294967296>>>0,n.putInt32Le(o>>>0);var f={h0:e.h0,h1:e.h1,h2:e.h2,h3:e.h3};Xn(f,a,n);var c=lt.util.createBuffer();return c.putInt32Le(f.h0),c.putInt32Le(f.h1),c.putInt32Le(f.h2),c.putInt32Le(f.h3),c},r};var Aa=null,qr=null,gr=null,er=null,Wn=!1;function ko(){Aa="\x80",Aa+=lt.util.fillString("\0",64),qr=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,1,6,11,0,5,10,15,4,9,14,3,8,13,2,7,12,5,8,11,14,1,4,7,10,13,0,3,6,9,12,15,2,0,7,14,5,12,3,10,1,8,15,6,13,4,11,2,9],gr=[7,12,17,22,7,12,17,22,7,12,17,22,7,12,17,22,5,9,14,20,5,9,14,20,5,9,14,20,5,9,14,20,4,11,16,23,4,11,16,23,4,11,16,23,4,11,16,23,6,10,15,21,6,10,15,21,6,10,15,21,6,10,15,21],er=new Array(64);for(var e=0;e<64;++e)er[e]=Math.floor(Math.abs(Math.sin(e+1))*4294967296);Wn=!0}function Xn(e,t,a){for(var r,n,s,i,o,l,u,f,c=a.length();c>=64;){for(n=e.h0,s=e.h1,i=e.h2,o=e.h3,f=0;f<16;++f)t[f]=a.getInt32Le(),l=o^s&(i^o),r=n+l+er[f]+t[f],u=gr[f],n=o,o=i,i=s,s+=r<<u|r>>>32-u;for(;f<32;++f)l=i^o&(s^i),r=n+l+er[f]+t[qr[f]],u=gr[f],n=o,o=i,i=s,s+=r<<u|r>>>32-u;for(;f<48;++f)l=s^i^o,r=n+l+er[f]+t[qr[f]],u=gr[f],n=o,o=i,i=s,s+=r<<u|r>>>32-u;for(;f<64;++f)l=i^(s|~o),r=n+l+er[f]+t[qr[f]],u=gr[f],n=o,o=i,i=s,s+=r<<u|r>>>32-u;e.h0=e.h0+n|0,e.h1=e.h1+s|0,e.h2=e.h2+i|0,e.h3=e.h3+o|0,c-=64}}});var Kt=M((cc,Jn)=>{var Gr=X();ne();var Zn=Jn.exports=Gr.pem=Gr.pem||{};Zn.encode=function(e,t){t=t||{};var a="-----BEGIN "+e.type+`-----\r
7
+ `,e.composed){for(var i=0,o="",s=0;s<e.value.length;++s)e.value[s]!==void 0&&(i+=1,o+=P.prettyPrint(e.value[s],t+1,a),s+1<e.value.length&&(o+=","));r+=n+"Sub values: "+i+o}else{if(r+=n+"Value: ",e.type===P.Type.OID){var l=P.derToOid(e.value);r+=l,he.pki&&he.pki.oids&&l in he.pki.oids&&(r+=" ("+he.pki.oids[l]+") ")}if(e.type===P.Type.INTEGER)try{r+=P.derToInteger(e.value)}catch{r+="0x"+he.util.bytesToHex(e.value)}else if(e.type===P.Type.BITSTRING){if(e.value.length>1?r+="0x"+he.util.bytesToHex(e.value.slice(1)):r+="(none)",e.value.length>0){var u=e.value.charCodeAt(0);u==1?r+=" (1 unused bit shown)":u>1&&(r+=" ("+u+" unused bits shown)")}}else if(e.type===P.Type.OCTETSTRING)zn.test(e.value)||(r+="("+e.value+") "),r+="0x"+he.util.bytesToHex(e.value);else if(e.type===P.Type.UTF8)try{r+=he.util.decodeUtf8(e.value)}catch(f){if(f.message==="URI malformed")r+="0x"+he.util.bytesToHex(e.value)+" (malformed UTF8)";else throw f}else e.type===P.Type.PRINTABLESTRING||e.type===P.Type.IA5String?r+=e.value:zn.test(e.value)?r+="0x"+he.util.bytesToHex(e.value):e.value.length===0?r+="[null]":r+=e.value}return r}});var ut=M((lc,Yn)=>{var Fr=X();Yn.exports=Fr.md=Fr.md||{};Fr.md.algorithms=Fr.md.algorithms||{}});var Jt=M((fc,Xn)=>{var mt=X();ut();ne();var Do=Xn.exports=mt.hmac=mt.hmac||{};Do.create=function(){var e=null,t=null,a=null,r=null,n={};return n.start=function(s,i){if(s!==null)if(typeof s=="string")if(s=s.toLowerCase(),s in mt.md.algorithms)t=mt.md.algorithms[s].create();else throw new Error('Unknown hash algorithm "'+s+'"');else t=s;if(i===null)i=e;else{if(typeof i=="string")i=mt.util.createBuffer(i);else if(mt.util.isArray(i)){var o=i;i=mt.util.createBuffer();for(var l=0;l<o.length;++l)i.putByte(o[l])}var u=i.length();u>t.blockLength&&(t.start(),t.update(i.bytes()),i=t.digest()),a=mt.util.createBuffer(),r=mt.util.createBuffer(),u=i.length();for(var l=0;l<u;++l){var o=i.at(l);a.putByte(54^o),r.putByte(92^o)}if(u<t.blockLength)for(var o=t.blockLength-u,l=0;l<o;++l)a.putByte(54),r.putByte(92);e=i,a=a.bytes(),r=r.bytes()}t.start(),t.update(a)},n.update=function(s){t.update(s)},n.getMac=function(){var s=t.digest().bytes();return t.start(),t.update(r),t.update(s),t.digest()},n.digest=n.getMac,n}});var Mr=M((cc,Zn)=>{var lt=X();ut();ne();var jn=Zn.exports=lt.md5=lt.md5||{};lt.md.md5=lt.md.algorithms.md5=jn;jn.create=function(){$n||Uo();var e=null,t=lt.util.createBuffer(),a=new Array(16),r={algorithm:"md5",blockLength:64,digestLength:16,messageLength:0,fullMessageLength:null,messageLengthSize:8};return r.start=function(){r.messageLength=0,r.fullMessageLength=r.messageLength64=[];for(var n=r.messageLengthSize/4,s=0;s<n;++s)r.fullMessageLength.push(0);return t=lt.util.createBuffer(),e={h0:1732584193,h1:4023233417,h2:2562383102,h3:271733878},r},r.start(),r.update=function(n,s){s==="utf8"&&(n=lt.util.encodeUtf8(n));var i=n.length;r.messageLength+=i,i=[i/4294967296>>>0,i>>>0];for(var o=r.fullMessageLength.length-1;o>=0;--o)r.fullMessageLength[o]+=i[1],i[1]=i[0]+(r.fullMessageLength[o]/4294967296>>>0),r.fullMessageLength[o]=r.fullMessageLength[o]>>>0,i[0]=i[1]/4294967296>>>0;return t.putBytes(n),Wn(e,a,t),(t.read>2048||t.length()===0)&&t.compact(),r},r.digest=function(){var n=lt.util.createBuffer();n.putBytes(t.bytes());var s=r.fullMessageLength[r.fullMessageLength.length-1]+r.messageLengthSize,i=s&r.blockLength-1;n.putBytes(Aa.substr(0,r.blockLength-i));for(var o,l=0,u=r.fullMessageLength.length-1;u>=0;--u)o=r.fullMessageLength[u]*8+l,l=o/4294967296>>>0,n.putInt32Le(o>>>0);var f={h0:e.h0,h1:e.h1,h2:e.h2,h3:e.h3};Wn(f,a,n);var c=lt.util.createBuffer();return c.putInt32Le(f.h0),c.putInt32Le(f.h1),c.putInt32Le(f.h2),c.putInt32Le(f.h3),c},r};var Aa=null,qr=null,gr=null,er=null,$n=!1;function Uo(){Aa="\x80",Aa+=lt.util.fillString("\0",64),qr=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,1,6,11,0,5,10,15,4,9,14,3,8,13,2,7,12,5,8,11,14,1,4,7,10,13,0,3,6,9,12,15,2,0,7,14,5,12,3,10,1,8,15,6,13,4,11,2,9],gr=[7,12,17,22,7,12,17,22,7,12,17,22,7,12,17,22,5,9,14,20,5,9,14,20,5,9,14,20,5,9,14,20,4,11,16,23,4,11,16,23,4,11,16,23,4,11,16,23,6,10,15,21,6,10,15,21,6,10,15,21,6,10,15,21],er=new Array(64);for(var e=0;e<64;++e)er[e]=Math.floor(Math.abs(Math.sin(e+1))*4294967296);$n=!0}function Wn(e,t,a){for(var r,n,s,i,o,l,u,f,c=a.length();c>=64;){for(n=e.h0,s=e.h1,i=e.h2,o=e.h3,f=0;f<16;++f)t[f]=a.getInt32Le(),l=o^s&(i^o),r=n+l+er[f]+t[f],u=gr[f],n=o,o=i,i=s,s+=r<<u|r>>>32-u;for(;f<32;++f)l=i^o&(s^i),r=n+l+er[f]+t[qr[f]],u=gr[f],n=o,o=i,i=s,s+=r<<u|r>>>32-u;for(;f<48;++f)l=s^i^o,r=n+l+er[f]+t[qr[f]],u=gr[f],n=o,o=i,i=s,s+=r<<u|r>>>32-u;for(;f<64;++f)l=i^(s|~o),r=n+l+er[f]+t[qr[f]],u=gr[f],n=o,o=i,i=s,s+=r<<u|r>>>32-u;e.h0=e.h0+n|0,e.h1=e.h1+s|0,e.h2=e.h2+i|0,e.h3=e.h3+o|0,c-=64}}});var Kt=M((hc,ei)=>{var Gr=X();ne();var Jn=ei.exports=Gr.pem=Gr.pem||{};Jn.encode=function(e,t){t=t||{};var a="-----BEGIN "+e.type+`-----\r
8
8
  `,r;if(e.procType&&(r={name:"Proc-Type",values:[String(e.procType.version),e.procType.type]},a+=Hr(r)),e.contentDomain&&(r={name:"Content-Domain",values:[e.contentDomain]},a+=Hr(r)),e.dekInfo&&(r={name:"DEK-Info",values:[e.dekInfo.algorithm]},e.dekInfo.parameters&&r.values.push(e.dekInfo.parameters),a+=Hr(r)),e.headers)for(var n=0;n<e.headers.length;++n)a+=Hr(e.headers[n]);return e.procType&&(a+=`\r
9
9
  `),a+=Gr.util.encode64(e.body,t.maxline||64)+`\r
10
10
  `,a+="-----END "+e.type+`-----\r
11
- `,a};Zn.decode=function(e){for(var t=[],a=/\s*-----BEGIN ([A-Z0-9- ]+)-----\r?\n?([\x21-\x7e\s]+?(?:\r?\n\r?\n))?([:A-Za-z0-9+\/=\s]+?)-----END \1-----/g,r=/([\x21-\x7e]+):\s*([\x21-\x7e\s^:]+)/,n=/\r?\n/,s;s=a.exec(e),!!s;){var i=s[1];i==="NEW CERTIFICATE REQUEST"&&(i="CERTIFICATE REQUEST");var o={type:i,procType:null,contentDomain:null,dekInfo:null,headers:[],body:Gr.util.decode64(s[3])};if(t.push(o),!!s[2]){for(var l=s[2].split(n),u=0;s&&u<l.length;){for(var f=l[u].replace(/\s+$/,""),c=u+1;c<l.length;++c){var v=l[c];if(!/\s/.test(v[0]))break;f+=v,u=c}if(s=f.match(r),s){for(var g={name:s[1],values:[]},y=s[2].split(","),x=0;x<y.length;++x)g.values.push(Do(y[x]));if(o.procType)if(!o.contentDomain&&g.name==="Content-Domain")o.contentDomain=y[0]||"";else if(!o.dekInfo&&g.name==="DEK-Info"){if(g.values.length===0)throw new Error('Invalid PEM formatted message. The "DEK-Info" header must have at least one subfield.');o.dekInfo={algorithm:y[0],parameters:y[1]||null}}else o.headers.push(g);else{if(g.name!=="Proc-Type")throw new Error('Invalid PEM formatted message. The first encapsulated header must be "Proc-Type".');if(g.values.length!==2)throw new Error('Invalid PEM formatted message. The "Proc-Type" header must have two subfields.');o.procType={version:y[0],type:y[1]}}}++u}if(o.procType==="ENCRYPTED"&&!o.dekInfo)throw new Error('Invalid PEM formatted message. The "DEK-Info" header must be present if "Proc-Type" is "ENCRYPTED".')}}if(t.length===0)throw new Error("Invalid PEM formatted message.");return t};function Hr(e){for(var t=e.name+": ",a=[],r=function(l,u){return" "+u},n=0;n<e.values.length;++n)a.push(e.values[n].replace(/^(\S+\r\n)/,r));t+=a.join(",")+`\r
11
+ `,a};Jn.decode=function(e){for(var t=[],a=/\s*-----BEGIN ([A-Z0-9- ]+)-----\r?\n?([\x21-\x7e\s]+?(?:\r?\n\r?\n))?([:A-Za-z0-9+\/=\s]+?)-----END \1-----/g,r=/([\x21-\x7e]+):\s*([\x21-\x7e\s^:]+)/,n=/\r?\n/,s;s=a.exec(e),!!s;){var i=s[1];i==="NEW CERTIFICATE REQUEST"&&(i="CERTIFICATE REQUEST");var o={type:i,procType:null,contentDomain:null,dekInfo:null,headers:[],body:Gr.util.decode64(s[3])};if(t.push(o),!!s[2]){for(var l=s[2].split(n),u=0;s&&u<l.length;){for(var f=l[u].replace(/\s+$/,""),c=u+1;c<l.length;++c){var v=l[c];if(!/\s/.test(v[0]))break;f+=v,u=c}if(s=f.match(r),s){for(var g={name:s[1],values:[]},y=s[2].split(","),x=0;x<y.length;++x)g.values.push(Po(y[x]));if(o.procType)if(!o.contentDomain&&g.name==="Content-Domain")o.contentDomain=y[0]||"";else if(!o.dekInfo&&g.name==="DEK-Info"){if(g.values.length===0)throw new Error('Invalid PEM formatted message. The "DEK-Info" header must have at least one subfield.');o.dekInfo={algorithm:y[0],parameters:y[1]||null}}else o.headers.push(g);else{if(g.name!=="Proc-Type")throw new Error('Invalid PEM formatted message. The first encapsulated header must be "Proc-Type".');if(g.values.length!==2)throw new Error('Invalid PEM formatted message. The "Proc-Type" header must have two subfields.');o.procType={version:y[0],type:y[1]}}}++u}if(o.procType==="ENCRYPTED"&&!o.dekInfo)throw new Error('Invalid PEM formatted message. The "DEK-Info" header must be present if "Proc-Type" is "ENCRYPTED".')}}if(t.length===0)throw new Error("Invalid PEM formatted message.");return t};function Hr(e){for(var t=e.name+": ",a=[],r=function(l,u){return" "+u},n=0;n<e.values.length;++n)a.push(e.values[n].replace(/^(\S+\r\n)/,r));t+=a.join(",")+`\r
12
12
  `;for(var s=0,i=-1,n=0;n<t.length;++n,++s)if(s>65&&i!==-1){var o=t[i];o===","?(++i,t=t.substr(0,i)+`\r
13
13
  `+t.substr(i)):t=t.substr(0,i)+`\r
14
- `+o+t.substr(i+1),s=n-i-1,i=-1,++n}else(t[n]===" "||t[n]===" "||t[n]===",")&&(i=n);return t}function Do(e){return e.replace(/^\s+/,"")}});var mr=M((hc,ti)=>{var pe=X();Ur();Ea();ne();ti.exports=pe.des=pe.des||{};pe.des.startEncrypting=function(e,t,a,r){var n=zr({key:e,output:a,decrypt:!1,mode:r||(t===null?"ECB":"CBC")});return n.start(t),n};pe.des.createEncryptionCipher=function(e,t){return zr({key:e,output:null,decrypt:!1,mode:t})};pe.des.startDecrypting=function(e,t,a,r){var n=zr({key:e,output:a,decrypt:!0,mode:r||(t===null?"ECB":"CBC")});return n.start(t),n};pe.des.createDecryptionCipher=function(e,t){return zr({key:e,output:null,decrypt:!0,mode:t})};pe.des.Algorithm=function(e,t){var a=this;a.name=e,a.mode=new t({blockSize:8,cipher:{encrypt:function(r,n){return ei(a._keys,r,n,!1)},decrypt:function(r,n){return ei(a._keys,r,n,!0)}}}),a._init=!1};pe.des.Algorithm.prototype.initialize=function(e){if(!this._init){var t=pe.util.createBuffer(e.key);if(this.name.indexOf("3DES")===0&&t.length()!==24)throw new Error("Invalid Triple-DES key size: "+t.length()*8);this._keys=Ho(t),this._init=!0}};ft("DES-ECB",pe.cipher.modes.ecb);ft("DES-CBC",pe.cipher.modes.cbc);ft("DES-CFB",pe.cipher.modes.cfb);ft("DES-OFB",pe.cipher.modes.ofb);ft("DES-CTR",pe.cipher.modes.ctr);ft("3DES-ECB",pe.cipher.modes.ecb);ft("3DES-CBC",pe.cipher.modes.cbc);ft("3DES-CFB",pe.cipher.modes.cfb);ft("3DES-OFB",pe.cipher.modes.ofb);ft("3DES-CTR",pe.cipher.modes.ctr);function ft(e,t){var a=function(){return new pe.des.Algorithm(e,t)};pe.cipher.registerAlgorithm(e,a)}var Uo=[16843776,0,65536,16843780,16842756,66564,4,65536,1024,16843776,16843780,1024,16778244,16842756,16777216,4,1028,16778240,16778240,66560,66560,16842752,16842752,16778244,65540,16777220,16777220,65540,0,1028,66564,16777216,65536,16843780,4,16842752,16843776,16777216,16777216,1024,16842756,65536,66560,16777220,1024,4,16778244,66564,16843780,65540,16842752,16778244,16777220,1028,66564,16843776,1028,16778240,16778240,0,65540,66560,0,16842756],Po=[-2146402272,-2147450880,32768,1081376,1048576,32,-2146435040,-2147450848,-2147483616,-2146402272,-2146402304,-2147483648,-2147450880,1048576,32,-2146435040,1081344,1048608,-2147450848,0,-2147483648,32768,1081376,-2146435072,1048608,-2147483616,0,1081344,32800,-2146402304,-2146435072,32800,0,1081376,-2146435040,1048576,-2147450848,-2146435072,-2146402304,32768,-2146435072,-2147450880,32,-2146402272,1081376,32,32768,-2147483648,32800,-2146402304,1048576,-2147483616,1048608,-2147450848,-2147483616,1048608,1081344,0,-2147450880,32800,-2147483648,-2146435040,-2146402272,1081344],Vo=[520,134349312,0,134348808,134218240,0,131592,134218240,131080,134217736,134217736,131072,134349320,131080,134348800,520,134217728,8,134349312,512,131584,134348800,134348808,131592,134218248,131584,131072,134218248,8,134349320,512,134217728,134349312,134217728,131080,520,131072,134349312,134218240,0,512,131080,134349320,134218240,134217736,512,0,134348808,134218248,131072,134217728,134349320,8,131592,131584,134217736,134348800,134218248,520,134348800,131592,8,134348808,131584],Oo=[8396801,8321,8321,128,8396928,8388737,8388609,8193,0,8396800,8396800,8396929,129,0,8388736,8388609,1,8192,8388608,8396801,128,8388608,8193,8320,8388737,1,8320,8388736,8192,8396928,8396929,129,8388736,8388609,8396800,8396929,129,0,0,8396800,8320,8388736,8388737,1,8396801,8321,8321,128,8396929,129,1,8192,8388609,8193,8396928,8388737,8193,8320,8388608,8396801,128,8388608,8192,8396928],Ko=[256,34078976,34078720,1107296512,524288,256,1073741824,34078720,1074266368,524288,33554688,1074266368,1107296512,1107820544,524544,1073741824,33554432,1074266112,1074266112,0,1073742080,1107820800,1107820800,33554688,1107820544,1073742080,0,1107296256,34078976,33554432,1107296256,524544,524288,1107296512,256,33554432,1073741824,34078720,1107296512,1074266368,33554688,1073741824,1107820544,34078976,1074266368,256,33554432,1107820544,1107820800,524544,1107296256,1107820800,34078720,0,1074266112,1107296256,524544,33554688,1073742080,524288,0,1074266112,34078976,1073742080],Fo=[536870928,541065216,16384,541081616,541065216,16,541081616,4194304,536887296,4210704,4194304,536870928,4194320,536887296,536870912,16400,0,4194320,536887312,16384,4210688,536887312,16,541065232,541065232,0,4210704,541081600,16400,4210688,541081600,536870912,536887296,16,541065232,4210688,541081616,4194304,16400,536870928,4194304,536887296,536870912,16400,536870928,541081616,4210688,541065216,4210704,541081600,0,541065232,16,16384,541065216,4210704,16384,4194320,536887312,0,541081600,536870912,4194320,536887312],qo=[2097152,69206018,67110914,0,2048,67110914,2099202,69208064,69208066,2097152,0,67108866,2,67108864,69206018,2050,67110912,2099202,2097154,67110912,67108866,69206016,69208064,2097154,69206016,2048,2050,69208066,2099200,2,67108864,2099200,67108864,2099200,2097152,67110914,67110914,69206018,69206018,2,2097154,67108864,67110912,2097152,69208064,2050,2099202,69208064,2050,67108866,69208066,69206016,2099200,0,2,69208066,0,2099202,69206016,2048,67108866,67110912,2048,2097154],Mo=[268439616,4096,262144,268701760,268435456,268439616,64,268435456,262208,268697600,268701760,266240,268701696,266304,4096,64,268697600,268435520,268439552,4160,266240,262208,268697664,268701696,4160,0,0,268697664,268435520,268439552,266304,262144,266304,262144,268701696,4096,64,268697664,4096,266304,268439552,64,268435520,268697600,268697664,268435456,262144,268439616,0,268701760,262208,268435520,268697600,268439552,268439616,0,268701760,266240,266240,4160,4160,262208,268435456,268701696];function Ho(e){for(var t=[0,4,536870912,536870916,65536,65540,536936448,536936452,512,516,536871424,536871428,66048,66052,536936960,536936964],a=[0,1,1048576,1048577,67108864,67108865,68157440,68157441,256,257,1048832,1048833,67109120,67109121,68157696,68157697],r=[0,8,2048,2056,16777216,16777224,16779264,16779272,0,8,2048,2056,16777216,16777224,16779264,16779272],n=[0,2097152,134217728,136314880,8192,2105344,134225920,136323072,131072,2228224,134348800,136445952,139264,2236416,134356992,136454144],s=[0,262144,16,262160,0,262144,16,262160,4096,266240,4112,266256,4096,266240,4112,266256],i=[0,1024,32,1056,0,1024,32,1056,33554432,33555456,33554464,33555488,33554432,33555456,33554464,33555488],o=[0,268435456,524288,268959744,2,268435458,524290,268959746,0,268435456,524288,268959744,2,268435458,524290,268959746],l=[0,65536,2048,67584,536870912,536936448,536872960,536938496,131072,196608,133120,198656,537001984,537067520,537004032,537069568],u=[0,262144,0,262144,2,262146,2,262146,33554432,33816576,33554432,33816576,33554434,33816578,33554434,33816578],f=[0,268435456,8,268435464,0,268435456,8,268435464,1024,268436480,1032,268436488,1024,268436480,1032,268436488],c=[0,32,0,32,1048576,1048608,1048576,1048608,8192,8224,8192,8224,1056768,1056800,1056768,1056800],v=[0,16777216,512,16777728,2097152,18874368,2097664,18874880,67108864,83886080,67109376,83886592,69206016,85983232,69206528,85983744],g=[0,4096,134217728,134221824,524288,528384,134742016,134746112,16,4112,134217744,134221840,524304,528400,134742032,134746128],y=[0,4,256,260,0,4,256,260,1,5,257,261,1,5,257,261],x=e.length()>8?3:1,S=[],I=[0,0,1,1,1,1,1,1,0,1,1,1,1,1,1,0],B=0,b,U=0;U<x;U++){var L=e.getInt32(),w=e.getInt32();b=(L>>>4^w)&252645135,w^=b,L^=b<<4,b=(w>>>-16^L)&65535,L^=b,w^=b<<-16,b=(L>>>2^w)&858993459,w^=b,L^=b<<2,b=(w>>>-16^L)&65535,L^=b,w^=b<<-16,b=(L>>>1^w)&1431655765,w^=b,L^=b<<1,b=(w>>>8^L)&16711935,L^=b,w^=b<<8,b=(L>>>1^w)&1431655765,w^=b,L^=b<<1,b=L<<8|w>>>20&240,L=w<<24|w<<8&16711680|w>>>8&65280|w>>>24&240,w=b;for(var z=0;z<I.length;++z){I[z]?(L=L<<2|L>>>26,w=w<<2|w>>>26):(L=L<<1|L>>>27,w=w<<1|w>>>27),L&=-15,w&=-15;var G=t[L>>>28]|a[L>>>24&15]|r[L>>>20&15]|n[L>>>16&15]|s[L>>>12&15]|i[L>>>8&15]|o[L>>>4&15],j=l[w>>>28]|u[w>>>24&15]|f[w>>>20&15]|c[w>>>16&15]|v[w>>>12&15]|g[w>>>8&15]|y[w>>>4&15];b=(j>>>16^G)&65535,S[B++]=G^b,S[B++]=j^b<<16}}return S}function ei(e,t,a,r){var n=e.length===32?3:9,s;n===3?s=r?[30,-2,-2]:[0,32,2]:s=r?[94,62,-2,32,64,2,30,-2,-2]:[0,32,2,62,30,-2,64,96,2];var i,o=t[0],l=t[1];i=(o>>>4^l)&252645135,l^=i,o^=i<<4,i=(o>>>16^l)&65535,l^=i,o^=i<<16,i=(l>>>2^o)&858993459,o^=i,l^=i<<2,i=(l>>>8^o)&16711935,o^=i,l^=i<<8,i=(o>>>1^l)&1431655765,l^=i,o^=i<<1,o=o<<1|o>>>31,l=l<<1|l>>>31;for(var u=0;u<n;u+=3){for(var f=s[u+1],c=s[u+2],v=s[u];v!=f;v+=c){var g=l^e[v],y=(l>>>4|l<<28)^e[v+1];i=o,o=l,l=i^(Po[g>>>24&63]|Oo[g>>>16&63]|Fo[g>>>8&63]|Mo[g&63]|Uo[y>>>24&63]|Vo[y>>>16&63]|Ko[y>>>8&63]|qo[y&63])}i=o,o=l,l=i}o=o>>>1|o<<31,l=l>>>1|l<<31,i=(o>>>1^l)&1431655765,l^=i,o^=i<<1,i=(l>>>8^o)&16711935,o^=i,l^=i<<8,i=(l>>>2^o)&858993459,o^=i,l^=i<<2,i=(o>>>16^l)&65535,l^=i,o^=i<<16,i=(o>>>4^l)&252645135,l^=i,o^=i<<4,a[0]=o,a[1]=l}function zr(e){e=e||{};var t=(e.mode||"CBC").toUpperCase(),a="DES-"+t,r;e.decrypt?r=pe.cipher.createDecipher(a,e.key):r=pe.cipher.createCipher(a,e.key);var n=r.start;return r.start=function(s,i){var o=null;i instanceof pe.util.ByteBuffer&&(o=i,i={}),i=i||{},i.output=o,i.iv=s,n.call(r,i)},r}});var Qr=M((dc,ri)=>{var Ge=X();Jt();ut();ne();var Go=Ge.pkcs5=Ge.pkcs5||{},Ct;Ge.util.isNodejs&&!Ge.options.usePureJavaScript&&(Ct=require("crypto"));ri.exports=Ge.pbkdf2=Go.pbkdf2=function(e,t,a,r,n,s){if(typeof n=="function"&&(s=n,n=null),Ge.util.isNodejs&&!Ge.options.usePureJavaScript&&Ct.pbkdf2&&(n===null||typeof n!="object")&&(Ct.pbkdf2Sync.length>4||!n||n==="sha1"))return typeof n!="string"&&(n="sha1"),e=Buffer.from(e,"binary"),t=Buffer.from(t,"binary"),s?Ct.pbkdf2Sync.length===4?Ct.pbkdf2(e,t,a,r,function(b,U){if(b)return s(b);s(null,U.toString("binary"))}):Ct.pbkdf2(e,t,a,r,n,function(b,U){if(b)return s(b);s(null,U.toString("binary"))}):Ct.pbkdf2Sync.length===4?Ct.pbkdf2Sync(e,t,a,r).toString("binary"):Ct.pbkdf2Sync(e,t,a,r,n).toString("binary");if((typeof n>"u"||n===null)&&(n="sha1"),typeof n=="string"){if(!(n in Ge.md.algorithms))throw new Error("Unknown hash algorithm: "+n);n=Ge.md[n].create()}var i=n.digestLength;if(r>4294967295*i){var o=new Error("Derived key is too long.");if(s)return s(o);throw o}var l=Math.ceil(r/i),u=r-(l-1)*i,f=Ge.hmac.create();f.start(n,e);var c="",v,g,y;if(!s){for(var x=1;x<=l;++x){f.start(null,null),f.update(t),f.update(Ge.util.int32ToBytes(x)),v=y=f.digest().getBytes();for(var S=2;S<=a;++S)f.start(null,null),f.update(y),g=f.digest().getBytes(),v=Ge.util.xorBytes(v,g,i),y=g;c+=x<l?v:v.substr(0,u)}return c}var x=1,S;function I(){if(x>l)return s(null,c);f.start(null,null),f.update(t),f.update(Ge.util.int32ToBytes(x)),v=y=f.digest().getBytes(),S=2,B()}function B(){if(S<=a)return f.start(null,null),f.update(y),g=f.digest().getBytes(),v=Ge.util.xorBytes(v,g,i),y=g,++S,Ge.util.setImmediate(B);c+=x<l?v:v.substr(0,u),++x,I()}I()}});var ba=M((pc,oi)=>{var ct=X();ut();ne();var ni=oi.exports=ct.sha256=ct.sha256||{};ct.md.sha256=ct.md.algorithms.sha256=ni;ni.create=function(){ii||zo();var e=null,t=ct.util.createBuffer(),a=new Array(64),r={algorithm:"sha256",blockLength:64,digestLength:32,messageLength:0,fullMessageLength:null,messageLengthSize:8};return r.start=function(){r.messageLength=0,r.fullMessageLength=r.messageLength64=[];for(var n=r.messageLengthSize/4,s=0;s<n;++s)r.fullMessageLength.push(0);return t=ct.util.createBuffer(),e={h0:1779033703,h1:3144134277,h2:1013904242,h3:2773480762,h4:1359893119,h5:2600822924,h6:528734635,h7:1541459225},r},r.start(),r.update=function(n,s){s==="utf8"&&(n=ct.util.encodeUtf8(n));var i=n.length;r.messageLength+=i,i=[i/4294967296>>>0,i>>>0];for(var o=r.fullMessageLength.length-1;o>=0;--o)r.fullMessageLength[o]+=i[1],i[1]=i[0]+(r.fullMessageLength[o]/4294967296>>>0),r.fullMessageLength[o]=r.fullMessageLength[o]>>>0,i[0]=i[1]/4294967296>>>0;return t.putBytes(n),ai(e,a,t),(t.read>2048||t.length()===0)&&t.compact(),r},r.digest=function(){var n=ct.util.createBuffer();n.putBytes(t.bytes());var s=r.fullMessageLength[r.fullMessageLength.length-1]+r.messageLengthSize,i=s&r.blockLength-1;n.putBytes(Ba.substr(0,r.blockLength-i));for(var o,l,u=r.fullMessageLength[0]*8,f=0;f<r.fullMessageLength.length-1;++f)o=r.fullMessageLength[f+1]*8,l=o/4294967296>>>0,u+=l,n.putInt32(u>>>0),u=o>>>0;n.putInt32(u);var c={h0:e.h0,h1:e.h1,h2:e.h2,h3:e.h3,h4:e.h4,h5:e.h5,h6:e.h6,h7:e.h7};ai(c,a,n);var v=ct.util.createBuffer();return v.putInt32(c.h0),v.putInt32(c.h1),v.putInt32(c.h2),v.putInt32(c.h3),v.putInt32(c.h4),v.putInt32(c.h5),v.putInt32(c.h6),v.putInt32(c.h7),v},r};var Ba=null,ii=!1,si=null;function zo(){Ba="\x80",Ba+=ct.util.fillString("\0",64),si=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298],ii=!0}function ai(e,t,a){for(var r,n,s,i,o,l,u,f,c,v,g,y,x,S,I,B=a.length();B>=64;){for(u=0;u<16;++u)t[u]=a.getInt32();for(;u<64;++u)r=t[u-2],r=(r>>>17|r<<15)^(r>>>19|r<<13)^r>>>10,n=t[u-15],n=(n>>>7|n<<25)^(n>>>18|n<<14)^n>>>3,t[u]=r+t[u-7]+n+t[u-16]|0;for(f=e.h0,c=e.h1,v=e.h2,g=e.h3,y=e.h4,x=e.h5,S=e.h6,I=e.h7,u=0;u<64;++u)i=(y>>>6|y<<26)^(y>>>11|y<<21)^(y>>>25|y<<7),o=S^y&(x^S),s=(f>>>2|f<<30)^(f>>>13|f<<19)^(f>>>22|f<<10),l=f&c|v&(f^c),r=I+i+o+si[u]+t[u],n=s+l,I=S,S=x,x=y,y=g+r>>>0,g=v,v=c,c=f,f=r+n>>>0;e.h0=e.h0+f|0,e.h1=e.h1+c|0,e.h2=e.h2+v|0,e.h3=e.h3+g|0,e.h4=e.h4+y|0,e.h5=e.h5+x|0,e.h6=e.h6+S|0,e.h7=e.h7+I|0,B-=64}}});var _a=M((vc,ui)=>{var ht=X();ne();var Yr=null;ht.util.isNodejs&&!ht.options.usePureJavaScript&&!process.versions["node-webkit"]&&(Yr=require("crypto"));var Qo=ui.exports=ht.prng=ht.prng||{};Qo.create=function(e){for(var t={plugin:e,key:null,seed:null,time:null,reseeds:0,generated:0,keyBytes:""},a=e.md,r=new Array(32),n=0;n<32;++n)r[n]=a.create();t.pools=r,t.pool=0,t.generate=function(u,f){if(!f)return t.generateSync(u);var c=t.plugin.cipher,v=t.plugin.increment,g=t.plugin.formatKey,y=t.plugin.formatSeed,x=ht.util.createBuffer();t.key=null,S();function S(I){if(I)return f(I);if(x.length()>=u)return f(null,x.getBytes(u));if(t.generated>1048575&&(t.key=null),t.key===null)return ht.util.nextTick(function(){s(S)});var B=c(t.key,t.seed);t.generated+=B.length,x.putBytes(B),t.key=g(c(t.key,v(t.seed))),t.seed=y(c(t.key,t.seed)),ht.util.setImmediate(S)}},t.generateSync=function(u){var f=t.plugin.cipher,c=t.plugin.increment,v=t.plugin.formatKey,g=t.plugin.formatSeed;t.key=null;for(var y=ht.util.createBuffer();y.length()<u;){t.generated>1048575&&(t.key=null),t.key===null&&i();var x=f(t.key,t.seed);t.generated+=x.length,y.putBytes(x),t.key=v(f(t.key,c(t.seed))),t.seed=g(f(t.key,t.seed))}return y.getBytes(u)};function s(u){if(t.pools[0].messageLength>=32)return o(),u();var f=32-t.pools[0].messageLength<<5;t.seedFile(f,function(c,v){if(c)return u(c);t.collect(v),o(),u()})}function i(){if(t.pools[0].messageLength>=32)return o();var u=32-t.pools[0].messageLength<<5;t.collect(t.seedFileSync(u)),o()}function o(){t.reseeds=t.reseeds===4294967295?0:t.reseeds+1;var u=t.plugin.md.create();u.update(t.keyBytes);for(var f=1,c=0;c<32;++c)t.reseeds%f===0&&(u.update(t.pools[c].digest().getBytes()),t.pools[c].start()),f=f<<1;t.keyBytes=u.digest().getBytes(),u.start(),u.update(t.keyBytes);var v=u.digest().getBytes();t.key=t.plugin.formatKey(t.keyBytes),t.seed=t.plugin.formatSeed(v),t.generated=0}function l(u){var f=null,c=ht.util.globalScope,v=c.crypto||c.msCrypto;v&&v.getRandomValues&&(f=function(L){return v.getRandomValues(L)});var g=ht.util.createBuffer();if(f)for(;g.length()<u;){var y=Math.max(1,Math.min(u-g.length(),65536)/4),x=new Uint32Array(Math.floor(y));try{f(x);for(var S=0;S<x.length;++S)g.putInt32(x[S])}catch(L){if(!(typeof QuotaExceededError<"u"&&L instanceof QuotaExceededError))throw L}}if(g.length()<u)for(var I,B,b,U=Math.floor(Math.random()*65536);g.length()<u;){B=16807*(U&65535),I=16807*(U>>16),B+=(I&32767)<<16,B+=I>>15,B=(B&2147483647)+(B>>31),U=B&4294967295;for(var S=0;S<3;++S)b=U>>>(S<<3),b^=Math.floor(Math.random()*256),g.putByte(b&255)}return g.getBytes(u)}return Yr?(t.seedFile=function(u,f){Yr.randomBytes(u,function(c,v){if(c)return f(c);f(null,v.toString())})},t.seedFileSync=function(u){return Yr.randomBytes(u).toString()}):(t.seedFile=function(u,f){try{f(null,l(u))}catch(c){f(c)}},t.seedFileSync=l),t.collect=function(u){for(var f=u.length,c=0;c<f;++c)t.pools[t.pool].update(u.substr(c,1)),t.pool=t.pool===31?0:t.pool+1},t.collectInt=function(u,f){for(var c="",v=0;v<f;v+=8)c+=String.fromCharCode(u>>v&255);t.collect(c)},t.registerWorker=function(u){if(u===self)t.seedFile=function(c,v){function g(y){var x=y.data;x.forge&&x.forge.prng&&(self.removeEventListener("message",g),v(x.forge.prng.err,x.forge.prng.bytes))}self.addEventListener("message",g),self.postMessage({forge:{prng:{needed:c}}})};else{var f=function(c){var v=c.data;v.forge&&v.forge.prng&&t.seedFile(v.forge.prng.needed,function(g,y){u.postMessage({forge:{prng:{err:g,bytes:y}}})})};u.addEventListener("message",f)}},t}});var Je=M((yc,Na)=>{var Ie=X();Bt();ba();_a();ne();(function(){if(Ie.random&&Ie.random.getBytes){Na.exports=Ie.random;return}(function(e){var t={},a=new Array(4),r=Ie.util.createBuffer();t.formatKey=function(c){var v=Ie.util.createBuffer(c);return c=new Array(4),c[0]=v.getInt32(),c[1]=v.getInt32(),c[2]=v.getInt32(),c[3]=v.getInt32(),Ie.aes._expandKey(c,!1)},t.formatSeed=function(c){var v=Ie.util.createBuffer(c);return c=new Array(4),c[0]=v.getInt32(),c[1]=v.getInt32(),c[2]=v.getInt32(),c[3]=v.getInt32(),c},t.cipher=function(c,v){return Ie.aes._updateBlock(c,v,a,!1),r.putInt32(a[0]),r.putInt32(a[1]),r.putInt32(a[2]),r.putInt32(a[3]),r.getBytes()},t.increment=function(c){return++c[3],c},t.md=Ie.md.sha256;function n(){var c=Ie.prng.create(t);return c.getBytes=function(v,g){return c.generate(v,g)},c.getBytesSync=function(v){return c.generate(v)},c}var s=n(),i=null,o=Ie.util.globalScope,l=o.crypto||o.msCrypto;if(l&&l.getRandomValues&&(i=function(c){return l.getRandomValues(c)}),Ie.options.usePureJavaScript||!Ie.util.isNodejs&&!i){if(typeof window>"u"||window.document,s.collectInt(+new Date,32),typeof navigator<"u"){var u="";for(var f in navigator)try{typeof navigator[f]=="string"&&(u+=navigator[f])}catch{}s.collect(u),u=null}e&&(e().mousemove(function(c){s.collectInt(c.clientX,16),s.collectInt(c.clientY,16)}),e().keypress(function(c){s.collectInt(c.charCode,8)}))}if(!Ie.random)Ie.random=s;else for(var f in s)Ie.random[f]=s[f];Ie.random.createInstance=n,Na.exports=Ie.random})(typeof jQuery<"u"?jQuery:null)})()});var wa=M((gc,ci)=>{var Ye=X();ne();var Ra=[217,120,249,196,25,221,181,237,40,233,253,121,74,160,216,157,198,126,55,131,43,118,83,142,98,76,100,136,68,139,251,162,23,154,89,245,135,179,79,19,97,69,109,141,9,129,125,50,189,143,64,235,134,183,123,11,240,149,33,34,92,107,78,130,84,214,101,147,206,96,178,28,115,86,192,20,167,140,241,220,18,117,202,31,59,190,228,209,66,61,212,48,163,60,182,38,111,191,14,218,70,105,7,87,39,242,29,155,188,148,67,3,248,17,199,246,144,239,62,231,6,195,213,47,200,102,30,215,8,232,234,222,128,82,238,247,132,170,114,172,53,77,106,42,150,26,210,113,90,21,73,116,75,159,208,94,4,24,164,236,194,224,65,110,15,81,203,204,36,145,175,80,161,244,112,57,153,124,58,133,35,184,180,122,252,2,54,91,37,85,151,49,45,93,250,152,227,138,146,174,5,223,41,16,103,108,186,201,211,0,230,207,225,158,168,44,99,22,1,63,88,226,137,169,13,56,52,27,171,51,255,176,187,72,12,95,185,177,205,46,197,243,219,71,229,165,156,119,10,166,32,104,254,127,193,173],li=[1,2,3,5],Yo=function(e,t){return e<<t&65535|(e&65535)>>16-t},Xo=function(e,t){return(e&65535)>>t|e<<16-t&65535};ci.exports=Ye.rc2=Ye.rc2||{};Ye.rc2.expandKey=function(e,t){typeof e=="string"&&(e=Ye.util.createBuffer(e)),t=t||128;var a=e,r=e.length(),n=t,s=Math.ceil(n/8),i=255>>(n&7),o;for(o=r;o<128;o++)a.putByte(Ra[a.at(o-1)+a.at(o-r)&255]);for(a.setAt(128-s,Ra[a.at(128-s)&i]),o=127-s;o>=0;o--)a.setAt(o,Ra[a.at(o+1)^a.at(o+s)]);return a};var fi=function(e,t,a){var r=!1,n=null,s=null,i=null,o,l,u,f,c=[];for(e=Ye.rc2.expandKey(e,t),u=0;u<64;u++)c.push(e.getInt16Le());a?(o=function(y){for(u=0;u<4;u++)y[u]+=c[f]+(y[(u+3)%4]&y[(u+2)%4])+(~y[(u+3)%4]&y[(u+1)%4]),y[u]=Yo(y[u],li[u]),f++},l=function(y){for(u=0;u<4;u++)y[u]+=c[y[(u+3)%4]&63]}):(o=function(y){for(u=3;u>=0;u--)y[u]=Xo(y[u],li[u]),y[u]-=c[f]+(y[(u+3)%4]&y[(u+2)%4])+(~y[(u+3)%4]&y[(u+1)%4]),f--},l=function(y){for(u=3;u>=0;u--)y[u]-=c[y[(u+3)%4]&63]});var v=function(y){var x=[];for(u=0;u<4;u++){var S=n.getInt16Le();i!==null&&(a?S^=i.getInt16Le():i.putInt16Le(S)),x.push(S&65535)}f=a?0:63;for(var I=0;I<y.length;I++)for(var B=0;B<y[I][0];B++)y[I][1](x);for(u=0;u<4;u++)i!==null&&(a?i.putInt16Le(x[u]):x[u]^=i.getInt16Le()),s.putInt16Le(x[u])},g=null;return g={start:function(y,x){y&&typeof y=="string"&&(y=Ye.util.createBuffer(y)),r=!1,n=Ye.util.createBuffer(),s=x||new Ye.util.createBuffer,i=y,g.output=s},update:function(y){for(r||n.putBuffer(y);n.length()>=8;)v([[5,o],[1,l],[6,o],[1,l],[5,o]])},finish:function(y){var x=!0;if(a)if(y)x=y(8,n,!a);else{var S=n.length()===8?8:8-n.length();n.fillWithByte(S,S)}if(x&&(r=!0,g.update()),!a&&(x=n.length()===0,x))if(y)x=y(8,s,!a);else{var I=s.length(),B=s.at(I-1);B>I?x=!1:s.truncate(B)}return x}},g};Ye.rc2.startEncrypting=function(e,t,a){var r=Ye.rc2.createEncryptionCipher(e,128);return r.start(t,a),r};Ye.rc2.createEncryptionCipher=function(e,t){return fi(e,t,!0)};Ye.rc2.startDecrypting=function(e,t,a){var r=Ye.rc2.createDecryptionCipher(e,128);return r.start(t,a),r};Ye.rc2.createDecryptionCipher=function(e,t){return fi(e,t,!1)}});var Er=M((mc,Ci)=>{var La=X();Ci.exports=La.jsbn=La.jsbn||{};var Et,jo=0xdeadbeefcafe,hi=(jo&16777215)==15715070;function _(e,t,a){this.data=[],e!=null&&(typeof e=="number"?this.fromNumber(e,t,a):t==null&&typeof e!="string"?this.fromString(e,256):this.fromString(e,t))}La.jsbn.BigInteger=_;function te(){return new _(null)}function Wo(e,t,a,r,n,s){for(;--s>=0;){var i=t*this.data[e++]+a.data[r]+n;n=Math.floor(i/67108864),a.data[r++]=i&67108863}return n}function $o(e,t,a,r,n,s){for(var i=t&32767,o=t>>15;--s>=0;){var l=this.data[e]&32767,u=this.data[e++]>>15,f=o*l+u*i;l=i*l+((f&32767)<<15)+a.data[r]+(n&1073741823),n=(l>>>30)+(f>>>15)+o*u+(n>>>30),a.data[r++]=l&1073741823}return n}function di(e,t,a,r,n,s){for(var i=t&16383,o=t>>14;--s>=0;){var l=this.data[e]&16383,u=this.data[e++]>>14,f=o*l+u*i;l=i*l+((f&16383)<<14)+a.data[r]+n,n=(l>>28)+(f>>14)+o*u,a.data[r++]=l&268435455}return n}typeof navigator>"u"?(_.prototype.am=di,Et=28):hi&&navigator.appName=="Microsoft Internet Explorer"?(_.prototype.am=$o,Et=30):hi&&navigator.appName!="Netscape"?(_.prototype.am=Wo,Et=26):(_.prototype.am=di,Et=28);_.prototype.DB=Et;_.prototype.DM=(1<<Et)-1;_.prototype.DV=1<<Et;var ka=52;_.prototype.FV=Math.pow(2,ka);_.prototype.F1=ka-Et;_.prototype.F2=2*Et-ka;var Zo="0123456789abcdefghijklmnopqrstuvwxyz",Xr=new Array,tr,et;tr=48;for(et=0;et<=9;++et)Xr[tr++]=et;tr=97;for(et=10;et<36;++et)Xr[tr++]=et;tr=65;for(et=10;et<36;++et)Xr[tr++]=et;function pi(e){return Zo.charAt(e)}function vi(e,t){var a=Xr[e.charCodeAt(t)];return a??-1}function Jo(e){for(var t=this.t-1;t>=0;--t)e.data[t]=this.data[t];e.t=this.t,e.s=this.s}function e0(e){this.t=1,this.s=e<0?-1:0,e>0?this.data[0]=e:e<-1?this.data[0]=e+this.DV:this.t=0}function _t(e){var t=te();return t.fromInt(e),t}function t0(e,t){var a;if(t==16)a=4;else if(t==8)a=3;else if(t==256)a=8;else if(t==2)a=1;else if(t==32)a=5;else if(t==4)a=2;else{this.fromRadix(e,t);return}this.t=0,this.s=0;for(var r=e.length,n=!1,s=0;--r>=0;){var i=a==8?e[r]&255:vi(e,r);if(i<0){e.charAt(r)=="-"&&(n=!0);continue}n=!1,s==0?this.data[this.t++]=i:s+a>this.DB?(this.data[this.t-1]|=(i&(1<<this.DB-s)-1)<<s,this.data[this.t++]=i>>this.DB-s):this.data[this.t-1]|=i<<s,s+=a,s>=this.DB&&(s-=this.DB)}a==8&&(e[0]&128)!=0&&(this.s=-1,s>0&&(this.data[this.t-1]|=(1<<this.DB-s)-1<<s)),this.clamp(),n&&_.ZERO.subTo(this,this)}function r0(){for(var e=this.s&this.DM;this.t>0&&this.data[this.t-1]==e;)--this.t}function a0(e){if(this.s<0)return"-"+this.negate().toString(e);var t;if(e==16)t=4;else if(e==8)t=3;else if(e==2)t=1;else if(e==32)t=5;else if(e==4)t=2;else return this.toRadix(e);var a=(1<<t)-1,r,n=!1,s="",i=this.t,o=this.DB-i*this.DB%t;if(i-- >0)for(o<this.DB&&(r=this.data[i]>>o)>0&&(n=!0,s=pi(r));i>=0;)o<t?(r=(this.data[i]&(1<<o)-1)<<t-o,r|=this.data[--i]>>(o+=this.DB-t)):(r=this.data[i]>>(o-=t)&a,o<=0&&(o+=this.DB,--i)),r>0&&(n=!0),n&&(s+=pi(r));return n?s:"0"}function n0(){var e=te();return _.ZERO.subTo(this,e),e}function i0(){return this.s<0?this.negate():this}function s0(e){var t=this.s-e.s;if(t!=0)return t;var a=this.t;if(t=a-e.t,t!=0)return this.s<0?-t:t;for(;--a>=0;)if((t=this.data[a]-e.data[a])!=0)return t;return 0}function jr(e){var t=1,a;return(a=e>>>16)!=0&&(e=a,t+=16),(a=e>>8)!=0&&(e=a,t+=8),(a=e>>4)!=0&&(e=a,t+=4),(a=e>>2)!=0&&(e=a,t+=2),(a=e>>1)!=0&&(e=a,t+=1),t}function o0(){return this.t<=0?0:this.DB*(this.t-1)+jr(this.data[this.t-1]^this.s&this.DM)}function u0(e,t){var a;for(a=this.t-1;a>=0;--a)t.data[a+e]=this.data[a];for(a=e-1;a>=0;--a)t.data[a]=0;t.t=this.t+e,t.s=this.s}function l0(e,t){for(var a=e;a<this.t;++a)t.data[a-e]=this.data[a];t.t=Math.max(this.t-e,0),t.s=this.s}function f0(e,t){var a=e%this.DB,r=this.DB-a,n=(1<<r)-1,s=Math.floor(e/this.DB),i=this.s<<a&this.DM,o;for(o=this.t-1;o>=0;--o)t.data[o+s+1]=this.data[o]>>r|i,i=(this.data[o]&n)<<a;for(o=s-1;o>=0;--o)t.data[o]=0;t.data[s]=i,t.t=this.t+s+1,t.s=this.s,t.clamp()}function c0(e,t){t.s=this.s;var a=Math.floor(e/this.DB);if(a>=this.t){t.t=0;return}var r=e%this.DB,n=this.DB-r,s=(1<<r)-1;t.data[0]=this.data[a]>>r;for(var i=a+1;i<this.t;++i)t.data[i-a-1]|=(this.data[i]&s)<<n,t.data[i-a]=this.data[i]>>r;r>0&&(t.data[this.t-a-1]|=(this.s&s)<<n),t.t=this.t-a,t.clamp()}function h0(e,t){for(var a=0,r=0,n=Math.min(e.t,this.t);a<n;)r+=this.data[a]-e.data[a],t.data[a++]=r&this.DM,r>>=this.DB;if(e.t<this.t){for(r-=e.s;a<this.t;)r+=this.data[a],t.data[a++]=r&this.DM,r>>=this.DB;r+=this.s}else{for(r+=this.s;a<e.t;)r-=e.data[a],t.data[a++]=r&this.DM,r>>=this.DB;r-=e.s}t.s=r<0?-1:0,r<-1?t.data[a++]=this.DV+r:r>0&&(t.data[a++]=r),t.t=a,t.clamp()}function d0(e,t){var a=this.abs(),r=e.abs(),n=a.t;for(t.t=n+r.t;--n>=0;)t.data[n]=0;for(n=0;n<r.t;++n)t.data[n+a.t]=a.am(0,r.data[n],t,n,0,a.t);t.s=0,t.clamp(),this.s!=e.s&&_.ZERO.subTo(t,t)}function p0(e){for(var t=this.abs(),a=e.t=2*t.t;--a>=0;)e.data[a]=0;for(a=0;a<t.t-1;++a){var r=t.am(a,t.data[a],e,2*a,0,1);(e.data[a+t.t]+=t.am(a+1,2*t.data[a],e,2*a+1,r,t.t-a-1))>=t.DV&&(e.data[a+t.t]-=t.DV,e.data[a+t.t+1]=1)}e.t>0&&(e.data[e.t-1]+=t.am(a,t.data[a],e,2*a,0,1)),e.s=0,e.clamp()}function v0(e,t,a){var r=e.abs();if(!(r.t<=0)){var n=this.abs();if(n.t<r.t){t?.fromInt(0),a!=null&&this.copyTo(a);return}a==null&&(a=te());var s=te(),i=this.s,o=e.s,l=this.DB-jr(r.data[r.t-1]);l>0?(r.lShiftTo(l,s),n.lShiftTo(l,a)):(r.copyTo(s),n.copyTo(a));var u=s.t,f=s.data[u-1];if(f!=0){var c=f*(1<<this.F1)+(u>1?s.data[u-2]>>this.F2:0),v=this.FV/c,g=(1<<this.F1)/c,y=1<<this.F2,x=a.t,S=x-u,I=t??te();for(s.dlShiftTo(S,I),a.compareTo(I)>=0&&(a.data[a.t++]=1,a.subTo(I,a)),_.ONE.dlShiftTo(u,I),I.subTo(s,s);s.t<u;)s.data[s.t++]=0;for(;--S>=0;){var B=a.data[--x]==f?this.DM:Math.floor(a.data[x]*v+(a.data[x-1]+y)*g);if((a.data[x]+=s.am(0,B,a,S,0,u))<B)for(s.dlShiftTo(S,I),a.subTo(I,a);a.data[x]<--B;)a.subTo(I,a)}t!=null&&(a.drShiftTo(u,t),i!=o&&_.ZERO.subTo(t,t)),a.t=u,a.clamp(),l>0&&a.rShiftTo(l,a),i<0&&_.ZERO.subTo(a,a)}}}function y0(e){var t=te();return this.abs().divRemTo(e,null,t),this.s<0&&t.compareTo(_.ZERO)>0&&e.subTo(t,t),t}function Ft(e){this.m=e}function g0(e){return e.s<0||e.compareTo(this.m)>=0?e.mod(this.m):e}function m0(e){return e}function C0(e){e.divRemTo(this.m,null,e)}function E0(e,t,a){e.multiplyTo(t,a),this.reduce(a)}function x0(e,t){e.squareTo(t),this.reduce(t)}Ft.prototype.convert=g0;Ft.prototype.revert=m0;Ft.prototype.reduce=C0;Ft.prototype.mulTo=E0;Ft.prototype.sqrTo=x0;function S0(){if(this.t<1)return 0;var e=this.data[0];if((e&1)==0)return 0;var t=e&3;return t=t*(2-(e&15)*t)&15,t=t*(2-(e&255)*t)&255,t=t*(2-((e&65535)*t&65535))&65535,t=t*(2-e*t%this.DV)%this.DV,t>0?this.DV-t:-t}function qt(e){this.m=e,this.mp=e.invDigit(),this.mpl=this.mp&32767,this.mph=this.mp>>15,this.um=(1<<e.DB-15)-1,this.mt2=2*e.t}function T0(e){var t=te();return e.abs().dlShiftTo(this.m.t,t),t.divRemTo(this.m,null,t),e.s<0&&t.compareTo(_.ZERO)>0&&this.m.subTo(t,t),t}function I0(e){var t=te();return e.copyTo(t),this.reduce(t),t}function A0(e){for(;e.t<=this.mt2;)e.data[e.t++]=0;for(var t=0;t<this.m.t;++t){var a=e.data[t]&32767,r=a*this.mpl+((a*this.mph+(e.data[t]>>15)*this.mpl&this.um)<<15)&e.DM;for(a=t+this.m.t,e.data[a]+=this.m.am(0,r,e,t,0,this.m.t);e.data[a]>=e.DV;)e.data[a]-=e.DV,e.data[++a]++}e.clamp(),e.drShiftTo(this.m.t,e),e.compareTo(this.m)>=0&&e.subTo(this.m,e)}function B0(e,t){e.squareTo(t),this.reduce(t)}function b0(e,t,a){e.multiplyTo(t,a),this.reduce(a)}qt.prototype.convert=T0;qt.prototype.revert=I0;qt.prototype.reduce=A0;qt.prototype.mulTo=b0;qt.prototype.sqrTo=B0;function _0(){return(this.t>0?this.data[0]&1:this.s)==0}function N0(e,t){if(e>4294967295||e<1)return _.ONE;var a=te(),r=te(),n=t.convert(this),s=jr(e)-1;for(n.copyTo(a);--s>=0;)if(t.sqrTo(a,r),(e&1<<s)>0)t.mulTo(r,n,a);else{var i=a;a=r,r=i}return t.revert(a)}function R0(e,t){var a;return e<256||t.isEven()?a=new Ft(t):a=new qt(t),this.exp(e,a)}_.prototype.copyTo=Jo;_.prototype.fromInt=e0;_.prototype.fromString=t0;_.prototype.clamp=r0;_.prototype.dlShiftTo=u0;_.prototype.drShiftTo=l0;_.prototype.lShiftTo=f0;_.prototype.rShiftTo=c0;_.prototype.subTo=h0;_.prototype.multiplyTo=d0;_.prototype.squareTo=p0;_.prototype.divRemTo=v0;_.prototype.invDigit=S0;_.prototype.isEven=_0;_.prototype.exp=N0;_.prototype.toString=a0;_.prototype.negate=n0;_.prototype.abs=i0;_.prototype.compareTo=s0;_.prototype.bitLength=o0;_.prototype.mod=y0;_.prototype.modPowInt=R0;_.ZERO=_t(0);_.ONE=_t(1);function w0(){var e=te();return this.copyTo(e),e}function L0(){if(this.s<0){if(this.t==1)return this.data[0]-this.DV;if(this.t==0)return-1}else{if(this.t==1)return this.data[0];if(this.t==0)return 0}return(this.data[1]&(1<<32-this.DB)-1)<<this.DB|this.data[0]}function k0(){return this.t==0?this.s:this.data[0]<<24>>24}function D0(){return this.t==0?this.s:this.data[0]<<16>>16}function U0(e){return Math.floor(Math.LN2*this.DB/Math.log(e))}function P0(){return this.s<0?-1:this.t<=0||this.t==1&&this.data[0]<=0?0:1}function V0(e){if(e==null&&(e=10),this.signum()==0||e<2||e>36)return"0";var t=this.chunkSize(e),a=Math.pow(e,t),r=_t(a),n=te(),s=te(),i="";for(this.divRemTo(r,n,s);n.signum()>0;)i=(a+s.intValue()).toString(e).substr(1)+i,n.divRemTo(r,n,s);return s.intValue().toString(e)+i}function O0(e,t){this.fromInt(0),t==null&&(t=10);for(var a=this.chunkSize(t),r=Math.pow(t,a),n=!1,s=0,i=0,o=0;o<e.length;++o){var l=vi(e,o);if(l<0){e.charAt(o)=="-"&&this.signum()==0&&(n=!0);continue}i=t*i+l,++s>=a&&(this.dMultiply(r),this.dAddOffset(i,0),s=0,i=0)}s>0&&(this.dMultiply(Math.pow(t,s)),this.dAddOffset(i,0)),n&&_.ZERO.subTo(this,this)}function K0(e,t,a){if(typeof t=="number")if(e<2)this.fromInt(1);else for(this.fromNumber(e,a),this.testBit(e-1)||this.bitwiseTo(_.ONE.shiftLeft(e-1),Da,this),this.isEven()&&this.dAddOffset(1,0);!this.isProbablePrime(t);)this.dAddOffset(2,0),this.bitLength()>e&&this.subTo(_.ONE.shiftLeft(e-1),this);else{var r=new Array,n=e&7;r.length=(e>>3)+1,t.nextBytes(r),n>0?r[0]&=(1<<n)-1:r[0]=0,this.fromString(r,256)}}function F0(){var e=this.t,t=new Array;t[0]=this.s;var a=this.DB-e*this.DB%8,r,n=0;if(e-- >0)for(a<this.DB&&(r=this.data[e]>>a)!=(this.s&this.DM)>>a&&(t[n++]=r|this.s<<this.DB-a);e>=0;)a<8?(r=(this.data[e]&(1<<a)-1)<<8-a,r|=this.data[--e]>>(a+=this.DB-8)):(r=this.data[e]>>(a-=8)&255,a<=0&&(a+=this.DB,--e)),(r&128)!=0&&(r|=-256),n==0&&(this.s&128)!=(r&128)&&++n,(n>0||r!=this.s)&&(t[n++]=r);return t}function q0(e){return this.compareTo(e)==0}function M0(e){return this.compareTo(e)<0?this:e}function H0(e){return this.compareTo(e)>0?this:e}function G0(e,t,a){var r,n,s=Math.min(e.t,this.t);for(r=0;r<s;++r)a.data[r]=t(this.data[r],e.data[r]);if(e.t<this.t){for(n=e.s&this.DM,r=s;r<this.t;++r)a.data[r]=t(this.data[r],n);a.t=this.t}else{for(n=this.s&this.DM,r=s;r<e.t;++r)a.data[r]=t(n,e.data[r]);a.t=e.t}a.s=t(this.s,e.s),a.clamp()}function z0(e,t){return e&t}function Q0(e){var t=te();return this.bitwiseTo(e,z0,t),t}function Da(e,t){return e|t}function Y0(e){var t=te();return this.bitwiseTo(e,Da,t),t}function yi(e,t){return e^t}function X0(e){var t=te();return this.bitwiseTo(e,yi,t),t}function gi(e,t){return e&~t}function j0(e){var t=te();return this.bitwiseTo(e,gi,t),t}function W0(){for(var e=te(),t=0;t<this.t;++t)e.data[t]=this.DM&~this.data[t];return e.t=this.t,e.s=~this.s,e}function $0(e){var t=te();return e<0?this.rShiftTo(-e,t):this.lShiftTo(e,t),t}function Z0(e){var t=te();return e<0?this.lShiftTo(-e,t):this.rShiftTo(e,t),t}function J0(e){if(e==0)return-1;var t=0;return(e&65535)==0&&(e>>=16,t+=16),(e&255)==0&&(e>>=8,t+=8),(e&15)==0&&(e>>=4,t+=4),(e&3)==0&&(e>>=2,t+=2),(e&1)==0&&++t,t}function eu(){for(var e=0;e<this.t;++e)if(this.data[e]!=0)return e*this.DB+J0(this.data[e]);return this.s<0?this.t*this.DB:-1}function tu(e){for(var t=0;e!=0;)e&=e-1,++t;return t}function ru(){for(var e=0,t=this.s&this.DM,a=0;a<this.t;++a)e+=tu(this.data[a]^t);return e}function au(e){var t=Math.floor(e/this.DB);return t>=this.t?this.s!=0:(this.data[t]&1<<e%this.DB)!=0}function nu(e,t){var a=_.ONE.shiftLeft(e);return this.bitwiseTo(a,t,a),a}function iu(e){return this.changeBit(e,Da)}function su(e){return this.changeBit(e,gi)}function ou(e){return this.changeBit(e,yi)}function uu(e,t){for(var a=0,r=0,n=Math.min(e.t,this.t);a<n;)r+=this.data[a]+e.data[a],t.data[a++]=r&this.DM,r>>=this.DB;if(e.t<this.t){for(r+=e.s;a<this.t;)r+=this.data[a],t.data[a++]=r&this.DM,r>>=this.DB;r+=this.s}else{for(r+=this.s;a<e.t;)r+=e.data[a],t.data[a++]=r&this.DM,r>>=this.DB;r+=e.s}t.s=r<0?-1:0,r>0?t.data[a++]=r:r<-1&&(t.data[a++]=this.DV+r),t.t=a,t.clamp()}function lu(e){var t=te();return this.addTo(e,t),t}function fu(e){var t=te();return this.subTo(e,t),t}function cu(e){var t=te();return this.multiplyTo(e,t),t}function hu(){var e=te();return this.squareTo(e),e}function du(e){var t=te();return this.divRemTo(e,t,null),t}function pu(e){var t=te();return this.divRemTo(e,null,t),t}function vu(e){var t=te(),a=te();return this.divRemTo(e,t,a),new Array(t,a)}function yu(e){this.data[this.t]=this.am(0,e-1,this,0,0,this.t),++this.t,this.clamp()}function gu(e,t){if(e!=0){for(;this.t<=t;)this.data[this.t++]=0;for(this.data[t]+=e;this.data[t]>=this.DV;)this.data[t]-=this.DV,++t>=this.t&&(this.data[this.t++]=0),++this.data[t]}}function Cr(){}function mi(e){return e}function mu(e,t,a){e.multiplyTo(t,a)}function Cu(e,t){e.squareTo(t)}Cr.prototype.convert=mi;Cr.prototype.revert=mi;Cr.prototype.mulTo=mu;Cr.prototype.sqrTo=Cu;function Eu(e){return this.exp(e,new Cr)}function xu(e,t,a){var r=Math.min(this.t+e.t,t);for(a.s=0,a.t=r;r>0;)a.data[--r]=0;var n;for(n=a.t-this.t;r<n;++r)a.data[r+this.t]=this.am(0,e.data[r],a,r,0,this.t);for(n=Math.min(e.t,t);r<n;++r)this.am(0,e.data[r],a,r,0,t-r);a.clamp()}function Su(e,t,a){--t;var r=a.t=this.t+e.t-t;for(a.s=0;--r>=0;)a.data[r]=0;for(r=Math.max(t-this.t,0);r<e.t;++r)a.data[this.t+r-t]=this.am(t-r,e.data[r],a,0,0,this.t+r-t);a.clamp(),a.drShiftTo(1,a)}function rr(e){this.r2=te(),this.q3=te(),_.ONE.dlShiftTo(2*e.t,this.r2),this.mu=this.r2.divide(e),this.m=e}function Tu(e){if(e.s<0||e.t>2*this.m.t)return e.mod(this.m);if(e.compareTo(this.m)<0)return e;var t=te();return e.copyTo(t),this.reduce(t),t}function Iu(e){return e}function Au(e){for(e.drShiftTo(this.m.t-1,this.r2),e.t>this.m.t+1&&(e.t=this.m.t+1,e.clamp()),this.mu.multiplyUpperTo(this.r2,this.m.t+1,this.q3),this.m.multiplyLowerTo(this.q3,this.m.t+1,this.r2);e.compareTo(this.r2)<0;)e.dAddOffset(1,this.m.t+1);for(e.subTo(this.r2,e);e.compareTo(this.m)>=0;)e.subTo(this.m,e)}function Bu(e,t){e.squareTo(t),this.reduce(t)}function bu(e,t,a){e.multiplyTo(t,a),this.reduce(a)}rr.prototype.convert=Tu;rr.prototype.revert=Iu;rr.prototype.reduce=Au;rr.prototype.mulTo=bu;rr.prototype.sqrTo=Bu;function _u(e,t){var a=e.bitLength(),r,n=_t(1),s;if(a<=0)return n;a<18?r=1:a<48?r=3:a<144?r=4:a<768?r=5:r=6,a<8?s=new Ft(t):t.isEven()?s=new rr(t):s=new qt(t);var i=new Array,o=3,l=r-1,u=(1<<r)-1;if(i[1]=s.convert(this),r>1){var f=te();for(s.sqrTo(i[1],f);o<=u;)i[o]=te(),s.mulTo(f,i[o-2],i[o]),o+=2}var c=e.t-1,v,g=!0,y=te(),x;for(a=jr(e.data[c])-1;c>=0;){for(a>=l?v=e.data[c]>>a-l&u:(v=(e.data[c]&(1<<a+1)-1)<<l-a,c>0&&(v|=e.data[c-1]>>this.DB+a-l)),o=r;(v&1)==0;)v>>=1,--o;if((a-=o)<0&&(a+=this.DB,--c),g)i[v].copyTo(n),g=!1;else{for(;o>1;)s.sqrTo(n,y),s.sqrTo(y,n),o-=2;o>0?s.sqrTo(n,y):(x=n,n=y,y=x),s.mulTo(y,i[v],n)}for(;c>=0&&(e.data[c]&1<<a)==0;)s.sqrTo(n,y),x=n,n=y,y=x,--a<0&&(a=this.DB-1,--c)}return s.revert(n)}function Nu(e){var t=this.s<0?this.negate():this.clone(),a=e.s<0?e.negate():e.clone();if(t.compareTo(a)<0){var r=t;t=a,a=r}var n=t.getLowestSetBit(),s=a.getLowestSetBit();if(s<0)return t;for(n<s&&(s=n),s>0&&(t.rShiftTo(s,t),a.rShiftTo(s,a));t.signum()>0;)(n=t.getLowestSetBit())>0&&t.rShiftTo(n,t),(n=a.getLowestSetBit())>0&&a.rShiftTo(n,a),t.compareTo(a)>=0?(t.subTo(a,t),t.rShiftTo(1,t)):(a.subTo(t,a),a.rShiftTo(1,a));return s>0&&a.lShiftTo(s,a),a}function Ru(e){if(e<=0)return 0;var t=this.DV%e,a=this.s<0?e-1:0;if(this.t>0)if(t==0)a=this.data[0]%e;else for(var r=this.t-1;r>=0;--r)a=(t*a+this.data[r])%e;return a}function wu(e){if(this.signum()==0)return _.ZERO;var t=e.isEven();if(this.isEven()&&t||e.signum()==0)return _.ZERO;for(var a=e.clone(),r=this.clone(),n=_t(1),s=_t(0),i=_t(0),o=_t(1);a.signum()!=0;){for(;a.isEven();)a.rShiftTo(1,a),t?((!n.isEven()||!s.isEven())&&(n.addTo(this,n),s.subTo(e,s)),n.rShiftTo(1,n)):s.isEven()||s.subTo(e,s),s.rShiftTo(1,s);for(;r.isEven();)r.rShiftTo(1,r),t?((!i.isEven()||!o.isEven())&&(i.addTo(this,i),o.subTo(e,o)),i.rShiftTo(1,i)):o.isEven()||o.subTo(e,o),o.rShiftTo(1,o);a.compareTo(r)>=0?(a.subTo(r,a),t&&n.subTo(i,n),s.subTo(o,s)):(r.subTo(a,r),t&&i.subTo(n,i),o.subTo(s,o))}if(r.compareTo(_.ONE)!=0)return _.ZERO;if(o.compareTo(e)>=0)return o.subtract(e);if(o.signum()<0)o.addTo(e,o);else return o;return o.signum()<0?o.add(e):o}var ot=[2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103,107,109,113,127,131,137,139,149,151,157,163,167,173,179,181,191,193,197,199,211,223,227,229,233,239,241,251,257,263,269,271,277,281,283,293,307,311,313,317,331,337,347,349,353,359,367,373,379,383,389,397,401,409,419,421,431,433,439,443,449,457,461,463,467,479,487,491,499,503,509,521,523,541,547,557,563,569,571,577,587,593,599,601,607,613,617,619,631,641,643,647,653,659,661,673,677,683,691,701,709,719,727,733,739,743,751,757,761,769,773,787,797,809,811,821,823,827,829,839,853,857,859,863,877,881,883,887,907,911,919,929,937,941,947,953,967,971,977,983,991,997],Lu=(1<<26)/ot[ot.length-1];function ku(e){var t,a=this.abs();if(a.t==1&&a.data[0]<=ot[ot.length-1]){for(t=0;t<ot.length;++t)if(a.data[0]==ot[t])return!0;return!1}if(a.isEven())return!1;for(t=1;t<ot.length;){for(var r=ot[t],n=t+1;n<ot.length&&r<Lu;)r*=ot[n++];for(r=a.modInt(r);t<n;)if(r%ot[t++]==0)return!1}return a.millerRabin(e)}function Du(e){var t=this.subtract(_.ONE),a=t.getLowestSetBit();if(a<=0)return!1;for(var r=t.shiftRight(a),n=Uu(),s,i=0;i<e;++i){do s=new _(this.bitLength(),n);while(s.compareTo(_.ONE)<=0||s.compareTo(t)>=0);var o=s.modPow(r,this);if(o.compareTo(_.ONE)!=0&&o.compareTo(t)!=0){for(var l=1;l++<a&&o.compareTo(t)!=0;)if(o=o.modPowInt(2,this),o.compareTo(_.ONE)==0)return!1;if(o.compareTo(t)!=0)return!1}}return!0}function Uu(){return{nextBytes:function(e){for(var t=0;t<e.length;++t)e[t]=Math.floor(Math.random()*256)}}}_.prototype.chunkSize=U0;_.prototype.toRadix=V0;_.prototype.fromRadix=O0;_.prototype.fromNumber=K0;_.prototype.bitwiseTo=G0;_.prototype.changeBit=nu;_.prototype.addTo=uu;_.prototype.dMultiply=yu;_.prototype.dAddOffset=gu;_.prototype.multiplyLowerTo=xu;_.prototype.multiplyUpperTo=Su;_.prototype.modInt=Ru;_.prototype.millerRabin=Du;_.prototype.clone=w0;_.prototype.intValue=L0;_.prototype.byteValue=k0;_.prototype.shortValue=D0;_.prototype.signum=P0;_.prototype.toByteArray=F0;_.prototype.equals=q0;_.prototype.min=M0;_.prototype.max=H0;_.prototype.and=Q0;_.prototype.or=Y0;_.prototype.xor=X0;_.prototype.andNot=j0;_.prototype.not=W0;_.prototype.shiftLeft=$0;_.prototype.shiftRight=Z0;_.prototype.getLowestSetBit=eu;_.prototype.bitCount=ru;_.prototype.testBit=au;_.prototype.setBit=iu;_.prototype.clearBit=su;_.prototype.flipBit=ou;_.prototype.add=lu;_.prototype.subtract=fu;_.prototype.multiply=cu;_.prototype.divide=du;_.prototype.remainder=pu;_.prototype.divideAndRemainder=vu;_.prototype.modPow=_u;_.prototype.modInverse=wu;_.prototype.pow=Eu;_.prototype.gcd=Nu;_.prototype.isProbablePrime=ku;_.prototype.square=hu});var ar=M((Cc,Ti)=>{var dt=X();ut();ne();var xi=Ti.exports=dt.sha1=dt.sha1||{};dt.md.sha1=dt.md.algorithms.sha1=xi;xi.create=function(){Si||Pu();var e=null,t=dt.util.createBuffer(),a=new Array(80),r={algorithm:"sha1",blockLength:64,digestLength:20,messageLength:0,fullMessageLength:null,messageLengthSize:8};return r.start=function(){r.messageLength=0,r.fullMessageLength=r.messageLength64=[];for(var n=r.messageLengthSize/4,s=0;s<n;++s)r.fullMessageLength.push(0);return t=dt.util.createBuffer(),e={h0:1732584193,h1:4023233417,h2:2562383102,h3:271733878,h4:3285377520},r},r.start(),r.update=function(n,s){s==="utf8"&&(n=dt.util.encodeUtf8(n));var i=n.length;r.messageLength+=i,i=[i/4294967296>>>0,i>>>0];for(var o=r.fullMessageLength.length-1;o>=0;--o)r.fullMessageLength[o]+=i[1],i[1]=i[0]+(r.fullMessageLength[o]/4294967296>>>0),r.fullMessageLength[o]=r.fullMessageLength[o]>>>0,i[0]=i[1]/4294967296>>>0;return t.putBytes(n),Ei(e,a,t),(t.read>2048||t.length()===0)&&t.compact(),r},r.digest=function(){var n=dt.util.createBuffer();n.putBytes(t.bytes());var s=r.fullMessageLength[r.fullMessageLength.length-1]+r.messageLengthSize,i=s&r.blockLength-1;n.putBytes(Ua.substr(0,r.blockLength-i));for(var o,l,u=r.fullMessageLength[0]*8,f=0;f<r.fullMessageLength.length-1;++f)o=r.fullMessageLength[f+1]*8,l=o/4294967296>>>0,u+=l,n.putInt32(u>>>0),u=o>>>0;n.putInt32(u);var c={h0:e.h0,h1:e.h1,h2:e.h2,h3:e.h3,h4:e.h4};Ei(c,a,n);var v=dt.util.createBuffer();return v.putInt32(c.h0),v.putInt32(c.h1),v.putInt32(c.h2),v.putInt32(c.h3),v.putInt32(c.h4),v},r};var Ua=null,Si=!1;function Pu(){Ua="\x80",Ua+=dt.util.fillString("\0",64),Si=!0}function Ei(e,t,a){for(var r,n,s,i,o,l,u,f,c=a.length();c>=64;){for(n=e.h0,s=e.h1,i=e.h2,o=e.h3,l=e.h4,f=0;f<16;++f)r=a.getInt32(),t[f]=r,u=o^s&(i^o),r=(n<<5|n>>>27)+u+l+1518500249+r,l=o,o=i,i=(s<<30|s>>>2)>>>0,s=n,n=r;for(;f<20;++f)r=t[f-3]^t[f-8]^t[f-14]^t[f-16],r=r<<1|r>>>31,t[f]=r,u=o^s&(i^o),r=(n<<5|n>>>27)+u+l+1518500249+r,l=o,o=i,i=(s<<30|s>>>2)>>>0,s=n,n=r;for(;f<32;++f)r=t[f-3]^t[f-8]^t[f-14]^t[f-16],r=r<<1|r>>>31,t[f]=r,u=s^i^o,r=(n<<5|n>>>27)+u+l+1859775393+r,l=o,o=i,i=(s<<30|s>>>2)>>>0,s=n,n=r;for(;f<40;++f)r=t[f-6]^t[f-16]^t[f-28]^t[f-32],r=r<<2|r>>>30,t[f]=r,u=s^i^o,r=(n<<5|n>>>27)+u+l+1859775393+r,l=o,o=i,i=(s<<30|s>>>2)>>>0,s=n,n=r;for(;f<60;++f)r=t[f-6]^t[f-16]^t[f-28]^t[f-32],r=r<<2|r>>>30,t[f]=r,u=s&i|o&(s^i),r=(n<<5|n>>>27)+u+l+2400959708+r,l=o,o=i,i=(s<<30|s>>>2)>>>0,s=n,n=r;for(;f<80;++f)r=t[f-6]^t[f-16]^t[f-28]^t[f-32],r=r<<2|r>>>30,t[f]=r,u=s^i^o,r=(n<<5|n>>>27)+u+l+3395469782+r,l=o,o=i,i=(s<<30|s>>>2)>>>0,s=n,n=r;e.h0=e.h0+n|0,e.h1=e.h1+s|0,e.h2=e.h2+i|0,e.h3=e.h3+o|0,e.h4=e.h4+l|0,c-=64}}});var Pa=M((Ec,Ai)=>{var pt=X();ne();Je();ar();var Ii=Ai.exports=pt.pkcs1=pt.pkcs1||{};Ii.encode_rsa_oaep=function(e,t,a){var r,n,s,i;typeof a=="string"?(r=a,n=arguments[3]||void 0,s=arguments[4]||void 0):a&&(r=a.label||void 0,n=a.seed||void 0,s=a.md||void 0,a.mgf1&&a.mgf1.md&&(i=a.mgf1.md)),s?s.start():s=pt.md.sha1.create(),i||(i=s);var o=Math.ceil(e.n.bitLength()/8),l=o-2*s.digestLength-2;if(t.length>l){var u=new Error("RSAES-OAEP input message length is too long.");throw u.length=t.length,u.maxLength=l,u}r||(r=""),s.update(r,"raw");for(var f=s.digest(),c="",v=l-t.length,g=0;g<v;g++)c+="\0";var y=f.getBytes()+c+""+t;if(!n)n=pt.random.getBytes(s.digestLength);else if(n.length!==s.digestLength){var u=new Error("Invalid RSAES-OAEP seed. The seed length must match the digest length.");throw u.seedLength=n.length,u.digestLength=s.digestLength,u}var x=Wr(n,o-s.digestLength-1,i),S=pt.util.xorBytes(y,x,y.length),I=Wr(S,s.digestLength,i),B=pt.util.xorBytes(n,I,n.length);return"\0"+B+S};Ii.decode_rsa_oaep=function(e,t,a){var r,n,s;typeof a=="string"?(r=a,n=arguments[3]||void 0):a&&(r=a.label||void 0,n=a.md||void 0,a.mgf1&&a.mgf1.md&&(s=a.mgf1.md));var i=Math.ceil(e.n.bitLength()/8);if(t.length!==i){var S=new Error("RSAES-OAEP encoded message length is invalid.");throw S.length=t.length,S.expectedLength=i,S}if(n===void 0?n=pt.md.sha1.create():n.start(),s||(s=n),i<2*n.digestLength+2)throw new Error("RSAES-OAEP key is too short for the hash function.");r||(r=""),n.update(r,"raw");for(var o=n.digest().getBytes(),l=t.charAt(0),u=t.substring(1,n.digestLength+1),f=t.substring(1+n.digestLength),c=Wr(f,n.digestLength,s),v=pt.util.xorBytes(u,c,u.length),g=Wr(v,i-n.digestLength-1,s),y=pt.util.xorBytes(f,g,f.length),x=y.substring(0,n.digestLength),S=l!=="\0",I=0;I<n.digestLength;++I)S|=o.charAt(I)!==x.charAt(I);for(var B=1,b=n.digestLength,U=n.digestLength;U<y.length;U++){var L=y.charCodeAt(U),w=L&1^1,z=B?65534:0;S|=L&z,B=B&w,b+=B}if(S||y.charCodeAt(b)!==1)throw new Error("Invalid RSAES-OAEP padding.");return y.substring(b+1)};function Wr(e,t,a){a||(a=pt.md.sha1.create());for(var r="",n=Math.ceil(t/a.digestLength),s=0;s<n;++s){var i=String.fromCharCode(s>>24&255,s>>16&255,s>>8&255,s&255);a.start(),a.update(e+i),r+=a.digest().getBytes()}return r.substring(0,t)}});var Oa=M((xc,Va)=>{var Nt=X();ne();Er();Je();(function(){if(Nt.prime){Va.exports=Nt.prime;return}var e=Va.exports=Nt.prime=Nt.prime||{},t=Nt.jsbn.BigInteger,a=[6,4,2,4,2,4,6,2],r=new t(null);r.fromInt(30);var n=function(c,v){return c|v};e.generateProbablePrime=function(c,v,g){typeof v=="function"&&(g=v,v={}),v=v||{};var y=v.algorithm||"PRIMEINC";typeof y=="string"&&(y={name:y}),y.options=y.options||{};var x=v.prng||Nt.random,S={nextBytes:function(I){for(var B=x.getBytesSync(I.length),b=0;b<I.length;++b)I[b]=B.charCodeAt(b)}};if(y.name==="PRIMEINC")return s(c,S,y.options,g);throw new Error("Invalid prime generation algorithm: "+y.name)};function s(c,v,g,y){return"workers"in g?l(c,v,g,y):i(c,v,g,y)}function i(c,v,g,y){var x=u(c,v),S=0,I=f(x.bitLength());"millerRabinTests"in g&&(I=g.millerRabinTests);var B=10;"maxBlockTime"in g&&(B=g.maxBlockTime),o(x,c,v,S,I,B,y)}function o(c,v,g,y,x,S,I){var B=+new Date;do{if(c.bitLength()>v&&(c=u(v,g)),c.isProbablePrime(x))return I(null,c);c.dAddOffset(a[y++%8],0)}while(S<0||+new Date-B<S);Nt.util.setImmediate(function(){o(c,v,g,y,x,S,I)})}function l(c,v,g,y){if(typeof Worker>"u")return i(c,v,g,y);var x=u(c,v),S=g.workers,I=g.workLoad||100,B=I*30/8,b=g.workerScript||"forge/prime.worker.js";if(S===-1)return Nt.util.estimateCores(function(L,w){L&&(w=2),S=w-1,U()});U();function U(){S=Math.max(1,S);for(var L=[],w=0;w<S;++w)L[w]=new Worker(b);for(var z=S,w=0;w<S;++w)L[w].addEventListener("message",j);var G=!1;function j(oe){if(!G){--z;var ue=oe.data;if(ue.found){for(var ee=0;ee<L.length;++ee)L[ee].terminate();return G=!0,y(null,new t(ue.prime,16))}x.bitLength()>c&&(x=u(c,v));var xe=x.toString(16);oe.target.postMessage({hex:xe,workLoad:I}),x.dAddOffset(B,0)}}}}function u(c,v){var g=new t(c,v),y=c-1;return g.testBit(y)||g.bitwiseTo(t.ONE.shiftLeft(y),n,g),g.dAddOffset(31-g.mod(r).byteValue(),0),g}function f(c){return c<=100?27:c<=150?18:c<=200?15:c<=250?12:c<=300?9:c<=350?8:c<=400?7:c<=500?6:c<=600?5:c<=800?4:c<=1250?3:2}})()});var xr=M((Sc,Li)=>{var F=X();st();Er();bt();Pa();Oa();Je();ne();typeof re>"u"&&(re=F.jsbn.BigInteger);var re,Ka=F.util.isNodejs?require("crypto"):null,T=F.asn1,tt=F.util;F.pki=F.pki||{};Li.exports=F.pki.rsa=F.rsa=F.rsa||{};var Q=F.pki,Vu=[6,4,2,4,2,4,6,2],Ou={name:"PrivateKeyInfo",tagClass:T.Class.UNIVERSAL,type:T.Type.SEQUENCE,constructed:!0,value:[{name:"PrivateKeyInfo.version",tagClass:T.Class.UNIVERSAL,type:T.Type.INTEGER,constructed:!1,capture:"privateKeyVersion"},{name:"PrivateKeyInfo.privateKeyAlgorithm",tagClass:T.Class.UNIVERSAL,type:T.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:T.Class.UNIVERSAL,type:T.Type.OID,constructed:!1,capture:"privateKeyOid"}]},{name:"PrivateKeyInfo",tagClass:T.Class.UNIVERSAL,type:T.Type.OCTETSTRING,constructed:!1,capture:"privateKey"}]},Ku={name:"RSAPrivateKey",tagClass:T.Class.UNIVERSAL,type:T.Type.SEQUENCE,constructed:!0,value:[{name:"RSAPrivateKey.version",tagClass:T.Class.UNIVERSAL,type:T.Type.INTEGER,constructed:!1,capture:"privateKeyVersion"},{name:"RSAPrivateKey.modulus",tagClass:T.Class.UNIVERSAL,type:T.Type.INTEGER,constructed:!1,capture:"privateKeyModulus"},{name:"RSAPrivateKey.publicExponent",tagClass:T.Class.UNIVERSAL,type:T.Type.INTEGER,constructed:!1,capture:"privateKeyPublicExponent"},{name:"RSAPrivateKey.privateExponent",tagClass:T.Class.UNIVERSAL,type:T.Type.INTEGER,constructed:!1,capture:"privateKeyPrivateExponent"},{name:"RSAPrivateKey.prime1",tagClass:T.Class.UNIVERSAL,type:T.Type.INTEGER,constructed:!1,capture:"privateKeyPrime1"},{name:"RSAPrivateKey.prime2",tagClass:T.Class.UNIVERSAL,type:T.Type.INTEGER,constructed:!1,capture:"privateKeyPrime2"},{name:"RSAPrivateKey.exponent1",tagClass:T.Class.UNIVERSAL,type:T.Type.INTEGER,constructed:!1,capture:"privateKeyExponent1"},{name:"RSAPrivateKey.exponent2",tagClass:T.Class.UNIVERSAL,type:T.Type.INTEGER,constructed:!1,capture:"privateKeyExponent2"},{name:"RSAPrivateKey.coefficient",tagClass:T.Class.UNIVERSAL,type:T.Type.INTEGER,constructed:!1,capture:"privateKeyCoefficient"}]},Fu={name:"RSAPublicKey",tagClass:T.Class.UNIVERSAL,type:T.Type.SEQUENCE,constructed:!0,value:[{name:"RSAPublicKey.modulus",tagClass:T.Class.UNIVERSAL,type:T.Type.INTEGER,constructed:!1,capture:"publicKeyModulus"},{name:"RSAPublicKey.exponent",tagClass:T.Class.UNIVERSAL,type:T.Type.INTEGER,constructed:!1,capture:"publicKeyExponent"}]},qu=F.pki.rsa.publicKeyValidator={name:"SubjectPublicKeyInfo",tagClass:T.Class.UNIVERSAL,type:T.Type.SEQUENCE,constructed:!0,captureAsn1:"subjectPublicKeyInfo",value:[{name:"SubjectPublicKeyInfo.AlgorithmIdentifier",tagClass:T.Class.UNIVERSAL,type:T.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:T.Class.UNIVERSAL,type:T.Type.OID,constructed:!1,capture:"publicKeyOid"}]},{name:"SubjectPublicKeyInfo.subjectPublicKey",tagClass:T.Class.UNIVERSAL,type:T.Type.BITSTRING,constructed:!1,value:[{name:"SubjectPublicKeyInfo.subjectPublicKey.RSAPublicKey",tagClass:T.Class.UNIVERSAL,type:T.Type.SEQUENCE,constructed:!0,optional:!0,captureAsn1:"rsaPublicKey"}]}]},Mu={name:"DigestInfo",tagClass:T.Class.UNIVERSAL,type:T.Type.SEQUENCE,constructed:!0,value:[{name:"DigestInfo.DigestAlgorithm",tagClass:T.Class.UNIVERSAL,type:T.Type.SEQUENCE,constructed:!0,value:[{name:"DigestInfo.DigestAlgorithm.algorithmIdentifier",tagClass:T.Class.UNIVERSAL,type:T.Type.OID,constructed:!1,capture:"algorithmIdentifier"},{name:"DigestInfo.DigestAlgorithm.parameters",tagClass:T.Class.UNIVERSAL,type:T.Type.NULL,capture:"parameters",optional:!0,constructed:!1}]},{name:"DigestInfo.digest",tagClass:T.Class.UNIVERSAL,type:T.Type.OCTETSTRING,constructed:!1,capture:"digest"}]},Hu=function(e){var t;if(e.algorithm in Q.oids)t=Q.oids[e.algorithm];else{var a=new Error("Unknown message digest algorithm.");throw a.algorithm=e.algorithm,a}var r=T.oidToDer(t).getBytes(),n=T.create(T.Class.UNIVERSAL,T.Type.SEQUENCE,!0,[]),s=T.create(T.Class.UNIVERSAL,T.Type.SEQUENCE,!0,[]);s.value.push(T.create(T.Class.UNIVERSAL,T.Type.OID,!1,r)),s.value.push(T.create(T.Class.UNIVERSAL,T.Type.NULL,!1,""));var i=T.create(T.Class.UNIVERSAL,T.Type.OCTETSTRING,!1,e.digest().getBytes());return n.value.push(s),n.value.push(i),T.toDer(n).getBytes()},Ri=function(e,t,a){if(a)return e.modPow(t.e,t.n);if(!t.p||!t.q)return e.modPow(t.d,t.n);t.dP||(t.dP=t.d.mod(t.p.subtract(re.ONE))),t.dQ||(t.dQ=t.d.mod(t.q.subtract(re.ONE))),t.qInv||(t.qInv=t.q.modInverse(t.p));var r;do r=new re(F.util.bytesToHex(F.random.getBytes(t.n.bitLength()/8)),16);while(r.compareTo(t.n)>=0||!r.gcd(t.n).equals(re.ONE));e=e.multiply(r.modPow(t.e,t.n)).mod(t.n);for(var n=e.mod(t.p).modPow(t.dP,t.p),s=e.mod(t.q).modPow(t.dQ,t.q);n.compareTo(s)<0;)n=n.add(t.p);var i=n.subtract(s).multiply(t.qInv).mod(t.p).multiply(t.q).add(s);return i=i.multiply(r.modInverse(t.n)).mod(t.n),i};Q.rsa.encrypt=function(e,t,a){var r=a,n,s=Math.ceil(t.n.bitLength()/8);a!==!1&&a!==!0?(r=a===2,n=wi(e,t,a)):(n=F.util.createBuffer(),n.putBytes(e));for(var i=new re(n.toHex(),16),o=Ri(i,t,r),l=o.toString(16),u=F.util.createBuffer(),f=s-Math.ceil(l.length/2);f>0;)u.putByte(0),--f;return u.putBytes(F.util.hexToBytes(l)),u.getBytes()};Q.rsa.decrypt=function(e,t,a,r){var n=Math.ceil(t.n.bitLength()/8);if(e.length!==n){var s=new Error("Encrypted message length is invalid.");throw s.length=e.length,s.expected=n,s}var i=new re(F.util.createBuffer(e).toHex(),16);if(i.compareTo(t.n)>=0)throw new Error("Encrypted message is invalid.");for(var o=Ri(i,t,a),l=o.toString(16),u=F.util.createBuffer(),f=n-Math.ceil(l.length/2);f>0;)u.putByte(0),--f;return u.putBytes(F.util.hexToBytes(l)),r!==!1?$r(u.getBytes(),t,a):u.getBytes()};Q.rsa.createKeyPairGenerationState=function(e,t,a){typeof e=="string"&&(e=parseInt(e,10)),e=e||2048,a=a||{};var r=a.prng||F.random,n={nextBytes:function(o){for(var l=r.getBytesSync(o.length),u=0;u<o.length;++u)o[u]=l.charCodeAt(u)}},s=a.algorithm||"PRIMEINC",i;if(s==="PRIMEINC")i={algorithm:s,state:0,bits:e,rng:n,eInt:t||65537,e:new re(null),p:null,q:null,qBits:e>>1,pBits:e-(e>>1),pqState:0,num:null,keys:null},i.e.fromInt(i.eInt);else throw new Error("Invalid key generation algorithm: "+s);return i};Q.rsa.stepKeyPairGenerationState=function(e,t){"algorithm"in e||(e.algorithm="PRIMEINC");var a=new re(null);a.fromInt(30);for(var r=0,n=function(c,v){return c|v},s=+new Date,i,o=0;e.keys===null&&(t<=0||o<t);){if(e.state===0){var l=e.p===null?e.pBits:e.qBits,u=l-1;e.pqState===0?(e.num=new re(l,e.rng),e.num.testBit(u)||e.num.bitwiseTo(re.ONE.shiftLeft(u),n,e.num),e.num.dAddOffset(31-e.num.mod(a).byteValue(),0),r=0,++e.pqState):e.pqState===1?e.num.bitLength()>l?e.pqState=0:e.num.isProbablePrime(zu(e.num.bitLength()))?++e.pqState:e.num.dAddOffset(Vu[r++%8],0):e.pqState===2?e.pqState=e.num.subtract(re.ONE).gcd(e.e).compareTo(re.ONE)===0?3:0:e.pqState===3&&(e.pqState=0,e.p===null?e.p=e.num:e.q=e.num,e.p!==null&&e.q!==null&&++e.state,e.num=null)}else if(e.state===1)e.p.compareTo(e.q)<0&&(e.num=e.p,e.p=e.q,e.q=e.num),++e.state;else if(e.state===2)e.p1=e.p.subtract(re.ONE),e.q1=e.q.subtract(re.ONE),e.phi=e.p1.multiply(e.q1),++e.state;else if(e.state===3)e.phi.gcd(e.e).compareTo(re.ONE)===0?++e.state:(e.p=null,e.q=null,e.state=0);else if(e.state===4)e.n=e.p.multiply(e.q),e.n.bitLength()===e.bits?++e.state:(e.q=null,e.state=0);else if(e.state===5){var f=e.e.modInverse(e.phi);e.keys={privateKey:Q.rsa.setPrivateKey(e.n,e.e,f,e.p,e.q,f.mod(e.p1),f.mod(e.q1),e.q.modInverse(e.p)),publicKey:Q.rsa.setPublicKey(e.n,e.e)}}i=+new Date,o+=i-s,s=i}return e.keys!==null};Q.rsa.generateKeyPair=function(e,t,a,r){if(arguments.length===1?typeof e=="object"?(a=e,e=void 0):typeof e=="function"&&(r=e,e=void 0):arguments.length===2?typeof e=="number"?typeof t=="function"?(r=t,t=void 0):typeof t!="number"&&(a=t,t=void 0):(a=e,r=t,e=void 0,t=void 0):arguments.length===3&&(typeof t=="number"?typeof a=="function"&&(r=a,a=void 0):(r=a,a=t,t=void 0)),a=a||{},e===void 0&&(e=a.bits||2048),t===void 0&&(t=a.e||65537),!F.options.usePureJavaScript&&!a.prng&&e>=256&&e<=16384&&(t===65537||t===3)){if(r){if(Bi("generateKeyPair"))return Ka.generateKeyPair("rsa",{modulusLength:e,publicExponent:t,publicKeyEncoding:{type:"spki",format:"pem"},privateKeyEncoding:{type:"pkcs8",format:"pem"}},function(o,l,u){if(o)return r(o);r(null,{privateKey:Q.privateKeyFromPem(u),publicKey:Q.publicKeyFromPem(l)})});if(bi("generateKey")&&bi("exportKey"))return tt.globalScope.crypto.subtle.generateKey({name:"RSASSA-PKCS1-v1_5",modulusLength:e,publicExponent:Ni(t),hash:{name:"SHA-256"}},!0,["sign","verify"]).then(function(o){return tt.globalScope.crypto.subtle.exportKey("pkcs8",o.privateKey)}).then(void 0,function(o){r(o)}).then(function(o){if(o){var l=Q.privateKeyFromAsn1(T.fromDer(F.util.createBuffer(o)));r(null,{privateKey:l,publicKey:Q.setRsaPublicKey(l.n,l.e)})}});if(_i("generateKey")&&_i("exportKey")){var n=tt.globalScope.msCrypto.subtle.generateKey({name:"RSASSA-PKCS1-v1_5",modulusLength:e,publicExponent:Ni(t),hash:{name:"SHA-256"}},!0,["sign","verify"]);n.oncomplete=function(o){var l=o.target.result,u=tt.globalScope.msCrypto.subtle.exportKey("pkcs8",l.privateKey);u.oncomplete=function(f){var c=f.target.result,v=Q.privateKeyFromAsn1(T.fromDer(F.util.createBuffer(c)));r(null,{privateKey:v,publicKey:Q.setRsaPublicKey(v.n,v.e)})},u.onerror=function(f){r(f)}},n.onerror=function(o){r(o)};return}}else if(Bi("generateKeyPairSync")){var s=Ka.generateKeyPairSync("rsa",{modulusLength:e,publicExponent:t,publicKeyEncoding:{type:"spki",format:"pem"},privateKeyEncoding:{type:"pkcs8",format:"pem"}});return{privateKey:Q.privateKeyFromPem(s.privateKey),publicKey:Q.publicKeyFromPem(s.publicKey)}}}var i=Q.rsa.createKeyPairGenerationState(e,t,a);if(!r)return Q.rsa.stepKeyPairGenerationState(i,0),i.keys;Gu(i,a,r)};Q.setRsaPublicKey=Q.rsa.setPublicKey=function(e,t){var a={n:e,e:t};return a.encrypt=function(r,n,s){if(typeof n=="string"?n=n.toUpperCase():n===void 0&&(n="RSAES-PKCS1-V1_5"),n==="RSAES-PKCS1-V1_5")n={encode:function(o,l,u){return wi(o,l,2).getBytes()}};else if(n==="RSA-OAEP"||n==="RSAES-OAEP")n={encode:function(o,l){return F.pkcs1.encode_rsa_oaep(l,o,s)}};else if(["RAW","NONE","NULL",null].indexOf(n)!==-1)n={encode:function(o){return o}};else if(typeof n=="string")throw new Error('Unsupported encryption scheme: "'+n+'".');var i=n.encode(r,a,!0);return Q.rsa.encrypt(i,a,!0)},a.verify=function(r,n,s,i){typeof s=="string"?s=s.toUpperCase():s===void 0&&(s="RSASSA-PKCS1-V1_5"),i===void 0&&(i={_parseAllDigestBytes:!0,_skipPaddingChecks:!1}),"_parseAllDigestBytes"in i||(i._parseAllDigestBytes=!0),"_skipPaddingChecks"in i||(i._skipPaddingChecks=!1),s==="RSASSA-PKCS1-V1_5"?s={verify:function(l,u){u=$r(u,a,!0,void 0,i);var f=T.fromDer(u,{parseAllBytes:i._parseAllDigestBytes}),c={},v=[];if(!T.validate(f,Mu,c,v)||f.value.length!==2){var g=new Error("ASN.1 object does not contain a valid RSASSA-PKCS1-v1_5 DigestInfo value.");throw g.errors=v,g}var y=T.derToOid(c.algorithmIdentifier);if(!(y===F.oids.md2||y===F.oids.md5||y===F.oids.sha1||y===F.oids.sha224||y===F.oids.sha256||y===F.oids.sha384||y===F.oids.sha512||y===F.oids["sha512-224"]||y===F.oids["sha512-256"])){var g=new Error("Unknown RSASSA-PKCS1-v1_5 DigestAlgorithm identifier.");throw g.oid=y,g}if((y===F.oids.md2||y===F.oids.md5)&&!("parameters"in c))throw new Error("ASN.1 object does not contain a valid RSASSA-PKCS1-v1_5 DigestInfo value. Missing algorithm identifier NULL parameters.");return l===c.digest}}:(s==="NONE"||s==="NULL"||s===null)&&(s={verify:function(l,u){return u=$r(u,a,!0,void 0,i),l===u}});var o=Q.rsa.decrypt(n,a,!0,!1);return s.verify(r,o,a.n.bitLength())},a};Q.setRsaPrivateKey=Q.rsa.setPrivateKey=function(e,t,a,r,n,s,i,o){var l={n:e,e:t,d:a,p:r,q:n,dP:s,dQ:i,qInv:o};return l.decrypt=function(u,f,c){typeof f=="string"?f=f.toUpperCase():f===void 0&&(f="RSAES-PKCS1-V1_5");var v=Q.rsa.decrypt(u,l,!1,!1);if(f==="RSAES-PKCS1-V1_5")f={decode:$r};else if(f==="RSA-OAEP"||f==="RSAES-OAEP")f={decode:function(g,y){return F.pkcs1.decode_rsa_oaep(y,g,c)}};else if(["RAW","NONE","NULL",null].indexOf(f)!==-1)f={decode:function(g){return g}};else throw new Error('Unsupported encryption scheme: "'+f+'".');return f.decode(v,l,!1)},l.sign=function(u,f){var c=!1;typeof f=="string"&&(f=f.toUpperCase()),f===void 0||f==="RSASSA-PKCS1-V1_5"?(f={encode:Hu},c=1):(f==="NONE"||f==="NULL"||f===null)&&(f={encode:function(){return u}},c=1);var v=f.encode(u,l.n.bitLength());return Q.rsa.encrypt(v,l,c)},l};Q.wrapRsaPrivateKey=function(e){return T.create(T.Class.UNIVERSAL,T.Type.SEQUENCE,!0,[T.create(T.Class.UNIVERSAL,T.Type.INTEGER,!1,T.integerToDer(0).getBytes()),T.create(T.Class.UNIVERSAL,T.Type.SEQUENCE,!0,[T.create(T.Class.UNIVERSAL,T.Type.OID,!1,T.oidToDer(Q.oids.rsaEncryption).getBytes()),T.create(T.Class.UNIVERSAL,T.Type.NULL,!1,"")]),T.create(T.Class.UNIVERSAL,T.Type.OCTETSTRING,!1,T.toDer(e).getBytes())])};Q.privateKeyFromAsn1=function(e){var t={},a=[];if(T.validate(e,Ou,t,a)&&(e=T.fromDer(F.util.createBuffer(t.privateKey))),t={},a=[],!T.validate(e,Ku,t,a)){var r=new Error("Cannot read private key. ASN.1 object does not contain an RSAPrivateKey.");throw r.errors=a,r}var n,s,i,o,l,u,f,c;return n=F.util.createBuffer(t.privateKeyModulus).toHex(),s=F.util.createBuffer(t.privateKeyPublicExponent).toHex(),i=F.util.createBuffer(t.privateKeyPrivateExponent).toHex(),o=F.util.createBuffer(t.privateKeyPrime1).toHex(),l=F.util.createBuffer(t.privateKeyPrime2).toHex(),u=F.util.createBuffer(t.privateKeyExponent1).toHex(),f=F.util.createBuffer(t.privateKeyExponent2).toHex(),c=F.util.createBuffer(t.privateKeyCoefficient).toHex(),Q.setRsaPrivateKey(new re(n,16),new re(s,16),new re(i,16),new re(o,16),new re(l,16),new re(u,16),new re(f,16),new re(c,16))};Q.privateKeyToAsn1=Q.privateKeyToRSAPrivateKey=function(e){return T.create(T.Class.UNIVERSAL,T.Type.SEQUENCE,!0,[T.create(T.Class.UNIVERSAL,T.Type.INTEGER,!1,T.integerToDer(0).getBytes()),T.create(T.Class.UNIVERSAL,T.Type.INTEGER,!1,vt(e.n)),T.create(T.Class.UNIVERSAL,T.Type.INTEGER,!1,vt(e.e)),T.create(T.Class.UNIVERSAL,T.Type.INTEGER,!1,vt(e.d)),T.create(T.Class.UNIVERSAL,T.Type.INTEGER,!1,vt(e.p)),T.create(T.Class.UNIVERSAL,T.Type.INTEGER,!1,vt(e.q)),T.create(T.Class.UNIVERSAL,T.Type.INTEGER,!1,vt(e.dP)),T.create(T.Class.UNIVERSAL,T.Type.INTEGER,!1,vt(e.dQ)),T.create(T.Class.UNIVERSAL,T.Type.INTEGER,!1,vt(e.qInv))])};Q.publicKeyFromAsn1=function(e){var t={},a=[];if(T.validate(e,qu,t,a)){var r=T.derToOid(t.publicKeyOid);if(r!==Q.oids.rsaEncryption){var n=new Error("Cannot read public key. Unknown OID.");throw n.oid=r,n}e=t.rsaPublicKey}if(a=[],!T.validate(e,Fu,t,a)){var n=new Error("Cannot read public key. ASN.1 object does not contain an RSAPublicKey.");throw n.errors=a,n}var s=F.util.createBuffer(t.publicKeyModulus).toHex(),i=F.util.createBuffer(t.publicKeyExponent).toHex();return Q.setRsaPublicKey(new re(s,16),new re(i,16))};Q.publicKeyToAsn1=Q.publicKeyToSubjectPublicKeyInfo=function(e){return T.create(T.Class.UNIVERSAL,T.Type.SEQUENCE,!0,[T.create(T.Class.UNIVERSAL,T.Type.SEQUENCE,!0,[T.create(T.Class.UNIVERSAL,T.Type.OID,!1,T.oidToDer(Q.oids.rsaEncryption).getBytes()),T.create(T.Class.UNIVERSAL,T.Type.NULL,!1,"")]),T.create(T.Class.UNIVERSAL,T.Type.BITSTRING,!1,[Q.publicKeyToRSAPublicKey(e)])])};Q.publicKeyToRSAPublicKey=function(e){return T.create(T.Class.UNIVERSAL,T.Type.SEQUENCE,!0,[T.create(T.Class.UNIVERSAL,T.Type.INTEGER,!1,vt(e.n)),T.create(T.Class.UNIVERSAL,T.Type.INTEGER,!1,vt(e.e))])};function wi(e,t,a){var r=F.util.createBuffer(),n=Math.ceil(t.n.bitLength()/8);if(e.length>n-11){var s=new Error("Message is too long for PKCS#1 v1.5 padding.");throw s.length=e.length,s.max=n-11,s}r.putByte(0),r.putByte(a);var i=n-3-e.length,o;if(a===0||a===1){o=a===0?0:255;for(var l=0;l<i;++l)r.putByte(o)}else for(;i>0;){for(var u=0,f=F.random.getBytes(i),l=0;l<i;++l)o=f.charCodeAt(l),o===0?++u:r.putByte(o);i=u}return r.putByte(0),r.putBytes(e),r}function $r(e,t,a,r,n){var s=Math.ceil(t.n.bitLength()/8),i=F.util.createBuffer(e),o=i.getByte(),l=i.getByte();if(o!==0||a&&l!==0&&l!==1||!a&&l!==2||a&&l===0&&typeof r>"u")throw new Error("Encryption block is invalid.");var u=0;if(l===0){u=s-3-r;for(var f=0;f<u;++f)if(i.getByte()!==0)throw new Error("Encryption block is invalid.")}else if(l===1){for(u=0;i.length()>1;){if(i.getByte()!==255){--i.read;break}++u}if(u<8&&!(n&&n._skipPaddingChecks))throw new Error("Encryption block is invalid.")}else if(l===2){for(u=0;i.length()>1;){if(i.getByte()===0){--i.read;break}++u}if(u<8&&!(n&&n._skipPaddingChecks))throw new Error("Encryption block is invalid.")}var c=i.getByte();if(c!==0||u!==s-3-i.length())throw new Error("Encryption block is invalid.");return i.getBytes()}function Gu(e,t,a){typeof t=="function"&&(a=t,t={}),t=t||{};var r={algorithm:{name:t.algorithm||"PRIMEINC",options:{workers:t.workers||2,workLoad:t.workLoad||100,workerScript:t.workerScript}}};"prng"in t&&(r.prng=t.prng),n();function n(){s(e.pBits,function(o,l){if(o)return a(o);if(e.p=l,e.q!==null)return i(o,e.q);s(e.qBits,i)})}function s(o,l){F.prime.generateProbablePrime(o,r,l)}function i(o,l){if(o)return a(o);if(e.q=l,e.p.compareTo(e.q)<0){var u=e.p;e.p=e.q,e.q=u}if(e.p.subtract(re.ONE).gcd(e.e).compareTo(re.ONE)!==0){e.p=null,n();return}if(e.q.subtract(re.ONE).gcd(e.e).compareTo(re.ONE)!==0){e.q=null,s(e.qBits,i);return}if(e.p1=e.p.subtract(re.ONE),e.q1=e.q.subtract(re.ONE),e.phi=e.p1.multiply(e.q1),e.phi.gcd(e.e).compareTo(re.ONE)!==0){e.p=e.q=null,n();return}if(e.n=e.p.multiply(e.q),e.n.bitLength()!==e.bits){e.q=null,s(e.qBits,i);return}var f=e.e.modInverse(e.phi);e.keys={privateKey:Q.rsa.setPrivateKey(e.n,e.e,f,e.p,e.q,f.mod(e.p1),f.mod(e.q1),e.q.modInverse(e.p)),publicKey:Q.rsa.setPublicKey(e.n,e.e)},a(null,e.keys)}}function vt(e){var t=e.toString(16);t[0]>="8"&&(t="00"+t);var a=F.util.hexToBytes(t);return a.length>1&&(a.charCodeAt(0)===0&&(a.charCodeAt(1)&128)===0||a.charCodeAt(0)===255&&(a.charCodeAt(1)&128)===128)?a.substr(1):a}function zu(e){return e<=100?27:e<=150?18:e<=200?15:e<=250?12:e<=300?9:e<=350?8:e<=400?7:e<=500?6:e<=600?5:e<=800?4:e<=1250?3:2}function Bi(e){return F.util.isNodejs&&typeof Ka[e]=="function"}function bi(e){return typeof tt.globalScope<"u"&&typeof tt.globalScope.crypto=="object"&&typeof tt.globalScope.crypto.subtle=="object"&&typeof tt.globalScope.crypto.subtle[e]=="function"}function _i(e){return typeof tt.globalScope<"u"&&typeof tt.globalScope.msCrypto=="object"&&typeof tt.globalScope.msCrypto.subtle=="object"&&typeof tt.globalScope.msCrypto.subtle[e]=="function"}function Ni(e){for(var t=F.util.hexToBytes(e.toString(16)),a=new Uint8Array(t.length),r=0;r<t.length;++r)a[r]=t.charCodeAt(r);return a}});var Fa=M((Tc,Vi)=>{var O=X();Bt();st();mr();ut();bt();Qr();Kt();Je();wa();xr();ne();typeof ki>"u"&&(ki=O.jsbn.BigInteger);var ki,A=O.asn1,Y=O.pki=O.pki||{};Vi.exports=Y.pbe=O.pbe=O.pbe||{};var Mt=Y.oids,Qu={name:"EncryptedPrivateKeyInfo",tagClass:A.Class.UNIVERSAL,type:A.Type.SEQUENCE,constructed:!0,value:[{name:"EncryptedPrivateKeyInfo.encryptionAlgorithm",tagClass:A.Class.UNIVERSAL,type:A.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:A.Class.UNIVERSAL,type:A.Type.OID,constructed:!1,capture:"encryptionOid"},{name:"AlgorithmIdentifier.parameters",tagClass:A.Class.UNIVERSAL,type:A.Type.SEQUENCE,constructed:!0,captureAsn1:"encryptionParams"}]},{name:"EncryptedPrivateKeyInfo.encryptedData",tagClass:A.Class.UNIVERSAL,type:A.Type.OCTETSTRING,constructed:!1,capture:"encryptedData"}]},Yu={name:"PBES2Algorithms",tagClass:A.Class.UNIVERSAL,type:A.Type.SEQUENCE,constructed:!0,value:[{name:"PBES2Algorithms.keyDerivationFunc",tagClass:A.Class.UNIVERSAL,type:A.Type.SEQUENCE,constructed:!0,value:[{name:"PBES2Algorithms.keyDerivationFunc.oid",tagClass:A.Class.UNIVERSAL,type:A.Type.OID,constructed:!1,capture:"kdfOid"},{name:"PBES2Algorithms.params",tagClass:A.Class.UNIVERSAL,type:A.Type.SEQUENCE,constructed:!0,value:[{name:"PBES2Algorithms.params.salt",tagClass:A.Class.UNIVERSAL,type:A.Type.OCTETSTRING,constructed:!1,capture:"kdfSalt"},{name:"PBES2Algorithms.params.iterationCount",tagClass:A.Class.UNIVERSAL,type:A.Type.INTEGER,constructed:!1,capture:"kdfIterationCount"},{name:"PBES2Algorithms.params.keyLength",tagClass:A.Class.UNIVERSAL,type:A.Type.INTEGER,constructed:!1,optional:!0,capture:"keyLength"},{name:"PBES2Algorithms.params.prf",tagClass:A.Class.UNIVERSAL,type:A.Type.SEQUENCE,constructed:!0,optional:!0,value:[{name:"PBES2Algorithms.params.prf.algorithm",tagClass:A.Class.UNIVERSAL,type:A.Type.OID,constructed:!1,capture:"prfOid"}]}]}]},{name:"PBES2Algorithms.encryptionScheme",tagClass:A.Class.UNIVERSAL,type:A.Type.SEQUENCE,constructed:!0,value:[{name:"PBES2Algorithms.encryptionScheme.oid",tagClass:A.Class.UNIVERSAL,type:A.Type.OID,constructed:!1,capture:"encOid"},{name:"PBES2Algorithms.encryptionScheme.iv",tagClass:A.Class.UNIVERSAL,type:A.Type.OCTETSTRING,constructed:!1,capture:"encIv"}]}]},Xu={name:"pkcs-12PbeParams",tagClass:A.Class.UNIVERSAL,type:A.Type.SEQUENCE,constructed:!0,value:[{name:"pkcs-12PbeParams.salt",tagClass:A.Class.UNIVERSAL,type:A.Type.OCTETSTRING,constructed:!1,capture:"salt"},{name:"pkcs-12PbeParams.iterations",tagClass:A.Class.UNIVERSAL,type:A.Type.INTEGER,constructed:!1,capture:"iterations"}]};Y.encryptPrivateKeyInfo=function(e,t,a){a=a||{},a.saltSize=a.saltSize||8,a.count=a.count||2048,a.algorithm=a.algorithm||"aes128",a.prfAlgorithm=a.prfAlgorithm||"sha1";var r=O.random.getBytesSync(a.saltSize),n=a.count,s=A.integerToDer(n),i,o,l;if(a.algorithm.indexOf("aes")===0||a.algorithm==="des"){var u,f,c;switch(a.algorithm){case"aes128":i=16,u=16,f=Mt["aes128-CBC"],c=O.aes.createEncryptionCipher;break;case"aes192":i=24,u=16,f=Mt["aes192-CBC"],c=O.aes.createEncryptionCipher;break;case"aes256":i=32,u=16,f=Mt["aes256-CBC"],c=O.aes.createEncryptionCipher;break;case"des":i=8,u=8,f=Mt.desCBC,c=O.des.createEncryptionCipher;break;default:var v=new Error("Cannot encrypt private key. Unknown encryption algorithm.");throw v.algorithm=a.algorithm,v}var g="hmacWith"+a.prfAlgorithm.toUpperCase(),y=Pi(g),x=O.pkcs5.pbkdf2(t,r,n,i,y),S=O.random.getBytesSync(u),I=c(x);I.start(S),I.update(A.toDer(e)),I.finish(),l=I.output.getBytes();var B=ju(r,s,i,g);o=A.create(A.Class.UNIVERSAL,A.Type.SEQUENCE,!0,[A.create(A.Class.UNIVERSAL,A.Type.OID,!1,A.oidToDer(Mt.pkcs5PBES2).getBytes()),A.create(A.Class.UNIVERSAL,A.Type.SEQUENCE,!0,[A.create(A.Class.UNIVERSAL,A.Type.SEQUENCE,!0,[A.create(A.Class.UNIVERSAL,A.Type.OID,!1,A.oidToDer(Mt.pkcs5PBKDF2).getBytes()),B]),A.create(A.Class.UNIVERSAL,A.Type.SEQUENCE,!0,[A.create(A.Class.UNIVERSAL,A.Type.OID,!1,A.oidToDer(f).getBytes()),A.create(A.Class.UNIVERSAL,A.Type.OCTETSTRING,!1,S)])])])}else if(a.algorithm==="3des"){i=24;var b=new O.util.ByteBuffer(r),x=Y.pbe.generatePkcs12Key(t,b,1,n,i),S=Y.pbe.generatePkcs12Key(t,b,2,n,i),I=O.des.createEncryptionCipher(x);I.start(S),I.update(A.toDer(e)),I.finish(),l=I.output.getBytes(),o=A.create(A.Class.UNIVERSAL,A.Type.SEQUENCE,!0,[A.create(A.Class.UNIVERSAL,A.Type.OID,!1,A.oidToDer(Mt["pbeWithSHAAnd3-KeyTripleDES-CBC"]).getBytes()),A.create(A.Class.UNIVERSAL,A.Type.SEQUENCE,!0,[A.create(A.Class.UNIVERSAL,A.Type.OCTETSTRING,!1,r),A.create(A.Class.UNIVERSAL,A.Type.INTEGER,!1,s.getBytes())])])}else{var v=new Error("Cannot encrypt private key. Unknown encryption algorithm.");throw v.algorithm=a.algorithm,v}var U=A.create(A.Class.UNIVERSAL,A.Type.SEQUENCE,!0,[o,A.create(A.Class.UNIVERSAL,A.Type.OCTETSTRING,!1,l)]);return U};Y.decryptPrivateKeyInfo=function(e,t){var a=null,r={},n=[];if(!A.validate(e,Qu,r,n)){var s=new Error("Cannot read encrypted private key. ASN.1 object is not a supported EncryptedPrivateKeyInfo.");throw s.errors=n,s}var i=A.derToOid(r.encryptionOid),o=Y.pbe.getCipher(i,r.encryptionParams,t),l=O.util.createBuffer(r.encryptedData);return o.update(l),o.finish()&&(a=A.fromDer(o.output)),a};Y.encryptedPrivateKeyToPem=function(e,t){var a={type:"ENCRYPTED PRIVATE KEY",body:A.toDer(e).getBytes()};return O.pem.encode(a,{maxline:t})};Y.encryptedPrivateKeyFromPem=function(e){var t=O.pem.decode(e)[0];if(t.type!=="ENCRYPTED PRIVATE KEY"){var a=new Error('Could not convert encrypted private key from PEM; PEM header type is "ENCRYPTED PRIVATE KEY".');throw a.headerType=t.type,a}if(t.procType&&t.procType.type==="ENCRYPTED")throw new Error("Could not convert encrypted private key from PEM; PEM is encrypted.");return A.fromDer(t.body)};Y.encryptRsaPrivateKey=function(e,t,a){if(a=a||{},!a.legacy){var r=Y.wrapRsaPrivateKey(Y.privateKeyToAsn1(e));return r=Y.encryptPrivateKeyInfo(r,t,a),Y.encryptedPrivateKeyToPem(r)}var n,s,i,o;switch(a.algorithm){case"aes128":n="AES-128-CBC",i=16,s=O.random.getBytesSync(16),o=O.aes.createEncryptionCipher;break;case"aes192":n="AES-192-CBC",i=24,s=O.random.getBytesSync(16),o=O.aes.createEncryptionCipher;break;case"aes256":n="AES-256-CBC",i=32,s=O.random.getBytesSync(16),o=O.aes.createEncryptionCipher;break;case"3des":n="DES-EDE3-CBC",i=24,s=O.random.getBytesSync(8),o=O.des.createEncryptionCipher;break;case"des":n="DES-CBC",i=8,s=O.random.getBytesSync(8),o=O.des.createEncryptionCipher;break;default:var l=new Error('Could not encrypt RSA private key; unsupported encryption algorithm "'+a.algorithm+'".');throw l.algorithm=a.algorithm,l}var u=O.pbe.opensslDeriveBytes(t,s.substr(0,8),i),f=o(u);f.start(s),f.update(A.toDer(Y.privateKeyToAsn1(e))),f.finish();var c={type:"RSA PRIVATE KEY",procType:{version:"4",type:"ENCRYPTED"},dekInfo:{algorithm:n,parameters:O.util.bytesToHex(s).toUpperCase()},body:f.output.getBytes()};return O.pem.encode(c)};Y.decryptRsaPrivateKey=function(e,t){var a=null,r=O.pem.decode(e)[0];if(r.type!=="ENCRYPTED PRIVATE KEY"&&r.type!=="PRIVATE KEY"&&r.type!=="RSA PRIVATE KEY"){var n=new Error('Could not convert private key from PEM; PEM header type is not "ENCRYPTED PRIVATE KEY", "PRIVATE KEY", or "RSA PRIVATE KEY".');throw n.headerType=n,n}if(r.procType&&r.procType.type==="ENCRYPTED"){var s,i;switch(r.dekInfo.algorithm){case"DES-CBC":s=8,i=O.des.createDecryptionCipher;break;case"DES-EDE3-CBC":s=24,i=O.des.createDecryptionCipher;break;case"AES-128-CBC":s=16,i=O.aes.createDecryptionCipher;break;case"AES-192-CBC":s=24,i=O.aes.createDecryptionCipher;break;case"AES-256-CBC":s=32,i=O.aes.createDecryptionCipher;break;case"RC2-40-CBC":s=5,i=function(c){return O.rc2.createDecryptionCipher(c,40)};break;case"RC2-64-CBC":s=8,i=function(c){return O.rc2.createDecryptionCipher(c,64)};break;case"RC2-128-CBC":s=16,i=function(c){return O.rc2.createDecryptionCipher(c,128)};break;default:var n=new Error('Could not decrypt private key; unsupported encryption algorithm "'+r.dekInfo.algorithm+'".');throw n.algorithm=r.dekInfo.algorithm,n}var o=O.util.hexToBytes(r.dekInfo.parameters),l=O.pbe.opensslDeriveBytes(t,o.substr(0,8),s),u=i(l);if(u.start(o),u.update(O.util.createBuffer(r.body)),u.finish())a=u.output.getBytes();else return a}else a=r.body;return r.type==="ENCRYPTED PRIVATE KEY"?a=Y.decryptPrivateKeyInfo(A.fromDer(a),t):a=A.fromDer(a),a!==null&&(a=Y.privateKeyFromAsn1(a)),a};Y.pbe.generatePkcs12Key=function(e,t,a,r,n,s){var i,o;if(typeof s>"u"||s===null){if(!("sha1"in O.md))throw new Error('"sha1" hash algorithm unavailable.');s=O.md.sha1.create()}var l=s.digestLength,u=s.blockLength,f=new O.util.ByteBuffer,c=new O.util.ByteBuffer;if(e!=null){for(o=0;o<e.length;o++)c.putInt16(e.charCodeAt(o));c.putInt16(0)}var v=c.length(),g=t.length(),y=new O.util.ByteBuffer;y.fillWithByte(a,u);var x=u*Math.ceil(g/u),S=new O.util.ByteBuffer;for(o=0;o<x;o++)S.putByte(t.at(o%g));var I=u*Math.ceil(v/u),B=new O.util.ByteBuffer;for(o=0;o<I;o++)B.putByte(c.at(o%v));var b=S;b.putBuffer(B);for(var U=Math.ceil(n/l),L=1;L<=U;L++){var w=new O.util.ByteBuffer;w.putBytes(y.bytes()),w.putBytes(b.bytes());for(var z=0;z<r;z++)s.start(),s.update(w.getBytes()),w=s.digest();var G=new O.util.ByteBuffer;for(o=0;o<u;o++)G.putByte(w.at(o%l));var j=Math.ceil(g/u)+Math.ceil(v/u),oe=new O.util.ByteBuffer;for(i=0;i<j;i++){var ue=new O.util.ByteBuffer(b.getBytes(u)),ee=511;for(o=G.length()-1;o>=0;o--)ee=ee>>8,ee+=G.at(o)+ue.at(o),ue.setAt(o,ee&255);oe.putBuffer(ue)}b=oe,f.putBuffer(w)}return f.truncate(f.length()-n),f};Y.pbe.getCipher=function(e,t,a){switch(e){case Y.oids.pkcs5PBES2:return Y.pbe.getCipherForPBES2(e,t,a);case Y.oids["pbeWithSHAAnd3-KeyTripleDES-CBC"]:case Y.oids["pbewithSHAAnd40BitRC2-CBC"]:return Y.pbe.getCipherForPKCS12PBE(e,t,a);default:var r=new Error("Cannot read encrypted PBE data block. Unsupported OID.");throw r.oid=e,r.supportedOids=["pkcs5PBES2","pbeWithSHAAnd3-KeyTripleDES-CBC","pbewithSHAAnd40BitRC2-CBC"],r}};Y.pbe.getCipherForPBES2=function(e,t,a){var r={},n=[];if(!A.validate(t,Yu,r,n)){var s=new Error("Cannot read password-based-encryption algorithm parameters. ASN.1 object is not a supported EncryptedPrivateKeyInfo.");throw s.errors=n,s}if(e=A.derToOid(r.kdfOid),e!==Y.oids.pkcs5PBKDF2){var s=new Error("Cannot read encrypted private key. Unsupported key derivation function OID.");throw s.oid=e,s.supportedOids=["pkcs5PBKDF2"],s}if(e=A.derToOid(r.encOid),e!==Y.oids["aes128-CBC"]&&e!==Y.oids["aes192-CBC"]&&e!==Y.oids["aes256-CBC"]&&e!==Y.oids["des-EDE3-CBC"]&&e!==Y.oids.desCBC){var s=new Error("Cannot read encrypted private key. Unsupported encryption scheme OID.");throw s.oid=e,s.supportedOids=["aes128-CBC","aes192-CBC","aes256-CBC","des-EDE3-CBC","desCBC"],s}var i=r.kdfSalt,o=O.util.createBuffer(r.kdfIterationCount);o=o.getInt(o.length()<<3);var l,u;switch(Y.oids[e]){case"aes128-CBC":l=16,u=O.aes.createDecryptionCipher;break;case"aes192-CBC":l=24,u=O.aes.createDecryptionCipher;break;case"aes256-CBC":l=32,u=O.aes.createDecryptionCipher;break;case"des-EDE3-CBC":l=24,u=O.des.createDecryptionCipher;break;case"desCBC":l=8,u=O.des.createDecryptionCipher;break}var f=Ui(r.prfOid),c=O.pkcs5.pbkdf2(a,i,o,l,f),v=r.encIv,g=u(c);return g.start(v),g};Y.pbe.getCipherForPKCS12PBE=function(e,t,a){var r={},n=[];if(!A.validate(t,Xu,r,n)){var s=new Error("Cannot read password-based-encryption algorithm parameters. ASN.1 object is not a supported EncryptedPrivateKeyInfo.");throw s.errors=n,s}var i=O.util.createBuffer(r.salt),o=O.util.createBuffer(r.iterations);o=o.getInt(o.length()<<3);var l,u,f;switch(e){case Y.oids["pbeWithSHAAnd3-KeyTripleDES-CBC"]:l=24,u=8,f=O.des.startDecrypting;break;case Y.oids["pbewithSHAAnd40BitRC2-CBC"]:l=5,u=8,f=function(x,S){var I=O.rc2.createDecryptionCipher(x,40);return I.start(S,null),I};break;default:var s=new Error("Cannot read PKCS #12 PBE data block. Unsupported OID.");throw s.oid=e,s}var c=Ui(r.prfOid),v=Y.pbe.generatePkcs12Key(a,i,1,o,l,c);c.start();var g=Y.pbe.generatePkcs12Key(a,i,2,o,u,c);return f(v,g)};Y.pbe.opensslDeriveBytes=function(e,t,a,r){if(typeof r>"u"||r===null){if(!("md5"in O.md))throw new Error('"md5" hash algorithm unavailable.');r=O.md.md5.create()}t===null&&(t="");for(var n=[Di(r,e+t)],s=16,i=1;s<a;++i,s+=16)n.push(Di(r,n[i-1]+e+t));return n.join("").substr(0,a)};function Di(e,t){return e.start().update(t).digest().getBytes()}function Ui(e){var t;if(!e)t="hmacWithSHA1";else if(t=Y.oids[A.derToOid(e)],!t){var a=new Error("Unsupported PRF OID.");throw a.oid=e,a.supported=["hmacWithSHA1","hmacWithSHA224","hmacWithSHA256","hmacWithSHA384","hmacWithSHA512"],a}return Pi(t)}function Pi(e){var t=O.md;switch(e){case"hmacWithSHA224":t=O.md.sha512;case"hmacWithSHA1":case"hmacWithSHA256":case"hmacWithSHA384":case"hmacWithSHA512":e=e.substr(8).toLowerCase();break;default:var a=new Error("Unsupported PRF algorithm.");throw a.algorithm=e,a.supported=["hmacWithSHA1","hmacWithSHA224","hmacWithSHA256","hmacWithSHA384","hmacWithSHA512"],a}if(!t||!(e in t))throw new Error("Unknown hash algorithm: "+e);return t[e].create()}function ju(e,t,a,r){var n=A.create(A.Class.UNIVERSAL,A.Type.SEQUENCE,!0,[A.create(A.Class.UNIVERSAL,A.Type.OCTETSTRING,!1,e),A.create(A.Class.UNIVERSAL,A.Type.INTEGER,!1,t.getBytes())]);return r!=="hmacWithSHA1"&&n.value.push(A.create(A.Class.UNIVERSAL,A.Type.INTEGER,!1,O.util.hexToBytes(a.toString(16))),A.create(A.Class.UNIVERSAL,A.Type.SEQUENCE,!0,[A.create(A.Class.UNIVERSAL,A.Type.OID,!1,A.oidToDer(Y.oids[r]).getBytes()),A.create(A.Class.UNIVERSAL,A.Type.NULL,!1,"")])),n}});var qa=M((Ic,Fi)=>{var nr=X();st();ne();var V=nr.asn1,ir=Fi.exports=nr.pkcs7asn1=nr.pkcs7asn1||{};nr.pkcs7=nr.pkcs7||{};nr.pkcs7.asn1=ir;var Oi={name:"ContentInfo",tagClass:V.Class.UNIVERSAL,type:V.Type.SEQUENCE,constructed:!0,value:[{name:"ContentInfo.ContentType",tagClass:V.Class.UNIVERSAL,type:V.Type.OID,constructed:!1,capture:"contentType"},{name:"ContentInfo.content",tagClass:V.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,optional:!0,captureAsn1:"content"}]};ir.contentInfoValidator=Oi;var Ki={name:"EncryptedContentInfo",tagClass:V.Class.UNIVERSAL,type:V.Type.SEQUENCE,constructed:!0,value:[{name:"EncryptedContentInfo.contentType",tagClass:V.Class.UNIVERSAL,type:V.Type.OID,constructed:!1,capture:"contentType"},{name:"EncryptedContentInfo.contentEncryptionAlgorithm",tagClass:V.Class.UNIVERSAL,type:V.Type.SEQUENCE,constructed:!0,value:[{name:"EncryptedContentInfo.contentEncryptionAlgorithm.algorithm",tagClass:V.Class.UNIVERSAL,type:V.Type.OID,constructed:!1,capture:"encAlgorithm"},{name:"EncryptedContentInfo.contentEncryptionAlgorithm.parameter",tagClass:V.Class.UNIVERSAL,captureAsn1:"encParameter"}]},{name:"EncryptedContentInfo.encryptedContent",tagClass:V.Class.CONTEXT_SPECIFIC,type:0,capture:"encryptedContent",captureAsn1:"encryptedContentAsn1"}]};ir.envelopedDataValidator={name:"EnvelopedData",tagClass:V.Class.UNIVERSAL,type:V.Type.SEQUENCE,constructed:!0,value:[{name:"EnvelopedData.Version",tagClass:V.Class.UNIVERSAL,type:V.Type.INTEGER,constructed:!1,capture:"version"},{name:"EnvelopedData.RecipientInfos",tagClass:V.Class.UNIVERSAL,type:V.Type.SET,constructed:!0,captureAsn1:"recipientInfos"}].concat(Ki)};ir.encryptedDataValidator={name:"EncryptedData",tagClass:V.Class.UNIVERSAL,type:V.Type.SEQUENCE,constructed:!0,value:[{name:"EncryptedData.Version",tagClass:V.Class.UNIVERSAL,type:V.Type.INTEGER,constructed:!1,capture:"version"}].concat(Ki)};var Wu={name:"SignerInfo",tagClass:V.Class.UNIVERSAL,type:V.Type.SEQUENCE,constructed:!0,value:[{name:"SignerInfo.version",tagClass:V.Class.UNIVERSAL,type:V.Type.INTEGER,constructed:!1},{name:"SignerInfo.issuerAndSerialNumber",tagClass:V.Class.UNIVERSAL,type:V.Type.SEQUENCE,constructed:!0,value:[{name:"SignerInfo.issuerAndSerialNumber.issuer",tagClass:V.Class.UNIVERSAL,type:V.Type.SEQUENCE,constructed:!0,captureAsn1:"issuer"},{name:"SignerInfo.issuerAndSerialNumber.serialNumber",tagClass:V.Class.UNIVERSAL,type:V.Type.INTEGER,constructed:!1,capture:"serial"}]},{name:"SignerInfo.digestAlgorithm",tagClass:V.Class.UNIVERSAL,type:V.Type.SEQUENCE,constructed:!0,value:[{name:"SignerInfo.digestAlgorithm.algorithm",tagClass:V.Class.UNIVERSAL,type:V.Type.OID,constructed:!1,capture:"digestAlgorithm"},{name:"SignerInfo.digestAlgorithm.parameter",tagClass:V.Class.UNIVERSAL,constructed:!1,captureAsn1:"digestParameter",optional:!0}]},{name:"SignerInfo.authenticatedAttributes",tagClass:V.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,optional:!0,capture:"authenticatedAttributes"},{name:"SignerInfo.digestEncryptionAlgorithm",tagClass:V.Class.UNIVERSAL,type:V.Type.SEQUENCE,constructed:!0,capture:"signatureAlgorithm"},{name:"SignerInfo.encryptedDigest",tagClass:V.Class.UNIVERSAL,type:V.Type.OCTETSTRING,constructed:!1,capture:"signature"},{name:"SignerInfo.unauthenticatedAttributes",tagClass:V.Class.CONTEXT_SPECIFIC,type:1,constructed:!0,optional:!0,capture:"unauthenticatedAttributes"}]};ir.signedDataValidator={name:"SignedData",tagClass:V.Class.UNIVERSAL,type:V.Type.SEQUENCE,constructed:!0,value:[{name:"SignedData.Version",tagClass:V.Class.UNIVERSAL,type:V.Type.INTEGER,constructed:!1,capture:"version"},{name:"SignedData.DigestAlgorithms",tagClass:V.Class.UNIVERSAL,type:V.Type.SET,constructed:!0,captureAsn1:"digestAlgorithms"},Oi,{name:"SignedData.Certificates",tagClass:V.Class.CONTEXT_SPECIFIC,type:0,optional:!0,captureAsn1:"certificates"},{name:"SignedData.CertificateRevocationLists",tagClass:V.Class.CONTEXT_SPECIFIC,type:1,optional:!0,captureAsn1:"crls"},{name:"SignedData.SignerInfos",tagClass:V.Class.UNIVERSAL,type:V.Type.SET,capture:"signerInfos",optional:!0,value:[Wu]}]};ir.recipientInfoValidator={name:"RecipientInfo",tagClass:V.Class.UNIVERSAL,type:V.Type.SEQUENCE,constructed:!0,value:[{name:"RecipientInfo.version",tagClass:V.Class.UNIVERSAL,type:V.Type.INTEGER,constructed:!1,capture:"version"},{name:"RecipientInfo.issuerAndSerial",tagClass:V.Class.UNIVERSAL,type:V.Type.SEQUENCE,constructed:!0,value:[{name:"RecipientInfo.issuerAndSerial.issuer",tagClass:V.Class.UNIVERSAL,type:V.Type.SEQUENCE,constructed:!0,captureAsn1:"issuer"},{name:"RecipientInfo.issuerAndSerial.serialNumber",tagClass:V.Class.UNIVERSAL,type:V.Type.INTEGER,constructed:!1,capture:"serial"}]},{name:"RecipientInfo.keyEncryptionAlgorithm",tagClass:V.Class.UNIVERSAL,type:V.Type.SEQUENCE,constructed:!0,value:[{name:"RecipientInfo.keyEncryptionAlgorithm.algorithm",tagClass:V.Class.UNIVERSAL,type:V.Type.OID,constructed:!1,capture:"encAlgorithm"},{name:"RecipientInfo.keyEncryptionAlgorithm.parameter",tagClass:V.Class.UNIVERSAL,constructed:!1,captureAsn1:"encParameter",optional:!0}]},{name:"RecipientInfo.encryptedKey",tagClass:V.Class.UNIVERSAL,type:V.Type.OCTETSTRING,constructed:!1,capture:"encKey"}]}});var Ma=M((Ac,qi)=>{var Ht=X();ne();Ht.mgf=Ht.mgf||{};var $u=qi.exports=Ht.mgf.mgf1=Ht.mgf1=Ht.mgf1||{};$u.create=function(e){var t={generate:function(a,r){for(var n=new Ht.util.ByteBuffer,s=Math.ceil(r/e.digestLength),i=0;i<s;i++){var o=new Ht.util.ByteBuffer;o.putInt32(i),e.start(),e.update(a+o.getBytes()),n.putBuffer(e.digest())}return n.truncate(n.length()-r),n.getBytes()}};return t}});var Hi=M((Bc,Mi)=>{var Zr=X();Ma();Mi.exports=Zr.mgf=Zr.mgf||{};Zr.mgf.mgf1=Zr.mgf1});var Jr=M((bc,Gi)=>{var Gt=X();Je();ne();var Zu=Gi.exports=Gt.pss=Gt.pss||{};Zu.create=function(e){arguments.length===3&&(e={md:arguments[0],mgf:arguments[1],saltLength:arguments[2]});var t=e.md,a=e.mgf,r=t.digestLength,n=e.salt||null;typeof n=="string"&&(n=Gt.util.createBuffer(n));var s;if("saltLength"in e)s=e.saltLength;else if(n!==null)s=n.length();else throw new Error("Salt length not specified or specific salt not given.");if(n!==null&&n.length()!==s)throw new Error("Given salt length does not match length of given salt.");var i=e.prng||Gt.random,o={};return o.encode=function(l,u){var f,c=u-1,v=Math.ceil(c/8),g=l.digest().getBytes();if(v<r+s+2)throw new Error("Message is too long to encrypt.");var y;n===null?y=i.getBytesSync(s):y=n.bytes();var x=new Gt.util.ByteBuffer;x.fillWithByte(0,8),x.putBytes(g),x.putBytes(y),t.start(),t.update(x.getBytes());var S=t.digest().getBytes(),I=new Gt.util.ByteBuffer;I.fillWithByte(0,v-s-r-2),I.putByte(1),I.putBytes(y);var B=I.getBytes(),b=v-r-1,U=a.generate(S,b),L="";for(f=0;f<b;f++)L+=String.fromCharCode(B.charCodeAt(f)^U.charCodeAt(f));var w=65280>>8*v-c&255;return L=String.fromCharCode(L.charCodeAt(0)&~w)+L.substr(1),L+S+"\xBC"},o.verify=function(l,u,f){var c,v=f-1,g=Math.ceil(v/8);if(u=u.substr(-g),g<r+s+2)throw new Error("Inconsistent parameters to PSS signature verification.");if(u.charCodeAt(g-1)!==188)throw new Error("Encoded message does not end in 0xBC.");var y=g-r-1,x=u.substr(0,y),S=u.substr(y,r),I=65280>>8*g-v&255;if((x.charCodeAt(0)&I)!==0)throw new Error("Bits beyond keysize not zero as expected.");var B=a.generate(S,y),b="";for(c=0;c<y;c++)b+=String.fromCharCode(x.charCodeAt(c)^B.charCodeAt(c));b=String.fromCharCode(b.charCodeAt(0)&~I)+b.substr(1);var U=g-r-s-2;for(c=0;c<U;c++)if(b.charCodeAt(c)!==0)throw new Error("Leftmost octets not zero as expected");if(b.charCodeAt(U)!==1)throw new Error("Inconsistent PSS signature, 0x01 marker not found");var L=b.substr(-s),w=new Gt.util.ByteBuffer;w.fillWithByte(0,8),w.putBytes(l),w.putBytes(L),t.start(),t.update(w.getBytes());var z=t.digest().getBytes();return S===z},o}});var ra=M((_c,ji)=>{var q=X();Bt();st();mr();ut();Hi();bt();Kt();Jr();xr();ne();var h=q.asn1,k=ji.exports=q.pki=q.pki||{},ae=k.oids,ve={};ve.CN=ae.commonName;ve.commonName="CN";ve.C=ae.countryName;ve.countryName="C";ve.L=ae.localityName;ve.localityName="L";ve.ST=ae.stateOrProvinceName;ve.stateOrProvinceName="ST";ve.O=ae.organizationName;ve.organizationName="O";ve.OU=ae.organizationalUnitName;ve.organizationalUnitName="OU";ve.E=ae.emailAddress;ve.emailAddress="E";var Qi=q.pki.rsa.publicKeyValidator,Ju={name:"Certificate",tagClass:h.Class.UNIVERSAL,type:h.Type.SEQUENCE,constructed:!0,value:[{name:"Certificate.TBSCertificate",tagClass:h.Class.UNIVERSAL,type:h.Type.SEQUENCE,constructed:!0,captureAsn1:"tbsCertificate",value:[{name:"Certificate.TBSCertificate.version",tagClass:h.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,optional:!0,value:[{name:"Certificate.TBSCertificate.version.integer",tagClass:h.Class.UNIVERSAL,type:h.Type.INTEGER,constructed:!1,capture:"certVersion"}]},{name:"Certificate.TBSCertificate.serialNumber",tagClass:h.Class.UNIVERSAL,type:h.Type.INTEGER,constructed:!1,capture:"certSerialNumber"},{name:"Certificate.TBSCertificate.signature",tagClass:h.Class.UNIVERSAL,type:h.Type.SEQUENCE,constructed:!0,value:[{name:"Certificate.TBSCertificate.signature.algorithm",tagClass:h.Class.UNIVERSAL,type:h.Type.OID,constructed:!1,capture:"certinfoSignatureOid"},{name:"Certificate.TBSCertificate.signature.parameters",tagClass:h.Class.UNIVERSAL,optional:!0,captureAsn1:"certinfoSignatureParams"}]},{name:"Certificate.TBSCertificate.issuer",tagClass:h.Class.UNIVERSAL,type:h.Type.SEQUENCE,constructed:!0,captureAsn1:"certIssuer"},{name:"Certificate.TBSCertificate.validity",tagClass:h.Class.UNIVERSAL,type:h.Type.SEQUENCE,constructed:!0,value:[{name:"Certificate.TBSCertificate.validity.notBefore (utc)",tagClass:h.Class.UNIVERSAL,type:h.Type.UTCTIME,constructed:!1,optional:!0,capture:"certValidity1UTCTime"},{name:"Certificate.TBSCertificate.validity.notBefore (generalized)",tagClass:h.Class.UNIVERSAL,type:h.Type.GENERALIZEDTIME,constructed:!1,optional:!0,capture:"certValidity2GeneralizedTime"},{name:"Certificate.TBSCertificate.validity.notAfter (utc)",tagClass:h.Class.UNIVERSAL,type:h.Type.UTCTIME,constructed:!1,optional:!0,capture:"certValidity3UTCTime"},{name:"Certificate.TBSCertificate.validity.notAfter (generalized)",tagClass:h.Class.UNIVERSAL,type:h.Type.GENERALIZEDTIME,constructed:!1,optional:!0,capture:"certValidity4GeneralizedTime"}]},{name:"Certificate.TBSCertificate.subject",tagClass:h.Class.UNIVERSAL,type:h.Type.SEQUENCE,constructed:!0,captureAsn1:"certSubject"},Qi,{name:"Certificate.TBSCertificate.issuerUniqueID",tagClass:h.Class.CONTEXT_SPECIFIC,type:1,constructed:!0,optional:!0,value:[{name:"Certificate.TBSCertificate.issuerUniqueID.id",tagClass:h.Class.UNIVERSAL,type:h.Type.BITSTRING,constructed:!1,captureBitStringValue:"certIssuerUniqueId"}]},{name:"Certificate.TBSCertificate.subjectUniqueID",tagClass:h.Class.CONTEXT_SPECIFIC,type:2,constructed:!0,optional:!0,value:[{name:"Certificate.TBSCertificate.subjectUniqueID.id",tagClass:h.Class.UNIVERSAL,type:h.Type.BITSTRING,constructed:!1,captureBitStringValue:"certSubjectUniqueId"}]},{name:"Certificate.TBSCertificate.extensions",tagClass:h.Class.CONTEXT_SPECIFIC,type:3,constructed:!0,captureAsn1:"certExtensions",optional:!0}]},{name:"Certificate.signatureAlgorithm",tagClass:h.Class.UNIVERSAL,type:h.Type.SEQUENCE,constructed:!0,value:[{name:"Certificate.signatureAlgorithm.algorithm",tagClass:h.Class.UNIVERSAL,type:h.Type.OID,constructed:!1,capture:"certSignatureOid"},{name:"Certificate.TBSCertificate.signature.parameters",tagClass:h.Class.UNIVERSAL,optional:!0,captureAsn1:"certSignatureParams"}]},{name:"Certificate.signatureValue",tagClass:h.Class.UNIVERSAL,type:h.Type.BITSTRING,constructed:!1,captureBitStringValue:"certSignature"}]},el={name:"rsapss",tagClass:h.Class.UNIVERSAL,type:h.Type.SEQUENCE,constructed:!0,value:[{name:"rsapss.hashAlgorithm",tagClass:h.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,value:[{name:"rsapss.hashAlgorithm.AlgorithmIdentifier",tagClass:h.Class.UNIVERSAL,type:h.Class.SEQUENCE,constructed:!0,optional:!0,value:[{name:"rsapss.hashAlgorithm.AlgorithmIdentifier.algorithm",tagClass:h.Class.UNIVERSAL,type:h.Type.OID,constructed:!1,capture:"hashOid"}]}]},{name:"rsapss.maskGenAlgorithm",tagClass:h.Class.CONTEXT_SPECIFIC,type:1,constructed:!0,value:[{name:"rsapss.maskGenAlgorithm.AlgorithmIdentifier",tagClass:h.Class.UNIVERSAL,type:h.Class.SEQUENCE,constructed:!0,optional:!0,value:[{name:"rsapss.maskGenAlgorithm.AlgorithmIdentifier.algorithm",tagClass:h.Class.UNIVERSAL,type:h.Type.OID,constructed:!1,capture:"maskGenOid"},{name:"rsapss.maskGenAlgorithm.AlgorithmIdentifier.params",tagClass:h.Class.UNIVERSAL,type:h.Type.SEQUENCE,constructed:!0,value:[{name:"rsapss.maskGenAlgorithm.AlgorithmIdentifier.params.algorithm",tagClass:h.Class.UNIVERSAL,type:h.Type.OID,constructed:!1,capture:"maskGenHashOid"}]}]}]},{name:"rsapss.saltLength",tagClass:h.Class.CONTEXT_SPECIFIC,type:2,optional:!0,value:[{name:"rsapss.saltLength.saltLength",tagClass:h.Class.UNIVERSAL,type:h.Class.INTEGER,constructed:!1,capture:"saltLength"}]},{name:"rsapss.trailerField",tagClass:h.Class.CONTEXT_SPECIFIC,type:3,optional:!0,value:[{name:"rsapss.trailer.trailer",tagClass:h.Class.UNIVERSAL,type:h.Class.INTEGER,constructed:!1,capture:"trailer"}]}]},tl={name:"CertificationRequestInfo",tagClass:h.Class.UNIVERSAL,type:h.Type.SEQUENCE,constructed:!0,captureAsn1:"certificationRequestInfo",value:[{name:"CertificationRequestInfo.integer",tagClass:h.Class.UNIVERSAL,type:h.Type.INTEGER,constructed:!1,capture:"certificationRequestInfoVersion"},{name:"CertificationRequestInfo.subject",tagClass:h.Class.UNIVERSAL,type:h.Type.SEQUENCE,constructed:!0,captureAsn1:"certificationRequestInfoSubject"},Qi,{name:"CertificationRequestInfo.attributes",tagClass:h.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,optional:!0,capture:"certificationRequestInfoAttributes",value:[{name:"CertificationRequestInfo.attributes",tagClass:h.Class.UNIVERSAL,type:h.Type.SEQUENCE,constructed:!0,value:[{name:"CertificationRequestInfo.attributes.type",tagClass:h.Class.UNIVERSAL,type:h.Type.OID,constructed:!1},{name:"CertificationRequestInfo.attributes.value",tagClass:h.Class.UNIVERSAL,type:h.Type.SET,constructed:!0}]}]}]},rl={name:"CertificationRequest",tagClass:h.Class.UNIVERSAL,type:h.Type.SEQUENCE,constructed:!0,captureAsn1:"csr",value:[tl,{name:"CertificationRequest.signatureAlgorithm",tagClass:h.Class.UNIVERSAL,type:h.Type.SEQUENCE,constructed:!0,value:[{name:"CertificationRequest.signatureAlgorithm.algorithm",tagClass:h.Class.UNIVERSAL,type:h.Type.OID,constructed:!1,capture:"csrSignatureOid"},{name:"CertificationRequest.signatureAlgorithm.parameters",tagClass:h.Class.UNIVERSAL,optional:!0,captureAsn1:"csrSignatureParams"}]},{name:"CertificationRequest.signature",tagClass:h.Class.UNIVERSAL,type:h.Type.BITSTRING,constructed:!1,captureBitStringValue:"csrSignature"}]};k.RDNAttributesAsArray=function(e,t){for(var a=[],r,n,s,i=0;i<e.value.length;++i){r=e.value[i];for(var o=0;o<r.value.length;++o)s={},n=r.value[o],s.type=h.derToOid(n.value[0].value),s.value=n.value[1].value,s.valueTagClass=n.value[1].type,s.type in ae&&(s.name=ae[s.type],s.name in ve&&(s.shortName=ve[s.name])),t&&(t.update(s.type),t.update(s.value)),a.push(s)}return a};k.CRIAttributesAsArray=function(e){for(var t=[],a=0;a<e.length;++a)for(var r=e[a],n=h.derToOid(r.value[0].value),s=r.value[1].value,i=0;i<s.length;++i){var o={};if(o.type=n,o.value=s[i].value,o.valueTagClass=s[i].type,o.type in ae&&(o.name=ae[o.type],o.name in ve&&(o.shortName=ve[o.name])),o.type===ae.extensionRequest){o.extensions=[];for(var l=0;l<o.value.length;++l)o.extensions.push(k.certificateExtensionFromAsn1(o.value[l]))}t.push(o)}return t};function Rt(e,t){typeof t=="string"&&(t={shortName:t});for(var a=null,r,n=0;a===null&&n<e.attributes.length;++n)r=e.attributes[n],(t.type&&t.type===r.type||t.name&&t.name===r.name||t.shortName&&t.shortName===r.shortName)&&(a=r);return a}var ea=function(e,t,a){var r={};if(e!==ae["RSASSA-PSS"])return r;a&&(r={hash:{algorithmOid:ae.sha1},mgf:{algorithmOid:ae.mgf1,hash:{algorithmOid:ae.sha1}},saltLength:20});var n={},s=[];if(!h.validate(t,el,n,s)){var i=new Error("Cannot read RSASSA-PSS parameter block.");throw i.errors=s,i}return n.hashOid!==void 0&&(r.hash=r.hash||{},r.hash.algorithmOid=h.derToOid(n.hashOid)),n.maskGenOid!==void 0&&(r.mgf=r.mgf||{},r.mgf.algorithmOid=h.derToOid(n.maskGenOid),r.mgf.hash=r.mgf.hash||{},r.mgf.hash.algorithmOid=h.derToOid(n.maskGenHashOid)),n.saltLength!==void 0&&(r.saltLength=n.saltLength.charCodeAt(0)),r},ta=function(e){switch(ae[e.signatureOid]){case"sha1WithRSAEncryption":case"sha1WithRSASignature":return q.md.sha1.create();case"md5WithRSAEncryption":return q.md.md5.create();case"sha256WithRSAEncryption":return q.md.sha256.create();case"sha384WithRSAEncryption":return q.md.sha384.create();case"sha512WithRSAEncryption":return q.md.sha512.create();case"RSASSA-PSS":return q.md.sha256.create();default:var t=new Error("Could not compute "+e.type+" digest. Unknown signature OID.");throw t.signatureOid=e.signatureOid,t}},Yi=function(e){var t=e.certificate,a;switch(t.signatureOid){case ae.sha1WithRSAEncryption:case ae.sha1WithRSASignature:break;case ae["RSASSA-PSS"]:var r,n;if(r=ae[t.signatureParameters.mgf.hash.algorithmOid],r===void 0||q.md[r]===void 0){var s=new Error("Unsupported MGF hash function.");throw s.oid=t.signatureParameters.mgf.hash.algorithmOid,s.name=r,s}if(n=ae[t.signatureParameters.mgf.algorithmOid],n===void 0||q.mgf[n]===void 0){var s=new Error("Unsupported MGF function.");throw s.oid=t.signatureParameters.mgf.algorithmOid,s.name=n,s}if(n=q.mgf[n].create(q.md[r].create()),r=ae[t.signatureParameters.hash.algorithmOid],r===void 0||q.md[r]===void 0){var s=new Error("Unsupported RSASSA-PSS hash function.");throw s.oid=t.signatureParameters.hash.algorithmOid,s.name=r,s}a=q.pss.create(q.md[r].create(),n,t.signatureParameters.saltLength);break}return t.publicKey.verify(e.md.digest().getBytes(),e.signature,a)};k.certificateFromPem=function(e,t,a){var r=q.pem.decode(e)[0];if(r.type!=="CERTIFICATE"&&r.type!=="X509 CERTIFICATE"&&r.type!=="TRUSTED CERTIFICATE"){var n=new Error('Could not convert certificate from PEM; PEM header type is not "CERTIFICATE", "X509 CERTIFICATE", or "TRUSTED CERTIFICATE".');throw n.headerType=r.type,n}if(r.procType&&r.procType.type==="ENCRYPTED")throw new Error("Could not convert certificate from PEM; PEM is encrypted.");var s=h.fromDer(r.body,a);return k.certificateFromAsn1(s,t)};k.certificateToPem=function(e,t){var a={type:"CERTIFICATE",body:h.toDer(k.certificateToAsn1(e)).getBytes()};return q.pem.encode(a,{maxline:t})};k.publicKeyFromPem=function(e){var t=q.pem.decode(e)[0];if(t.type!=="PUBLIC KEY"&&t.type!=="RSA PUBLIC KEY"){var a=new Error('Could not convert public key from PEM; PEM header type is not "PUBLIC KEY" or "RSA PUBLIC KEY".');throw a.headerType=t.type,a}if(t.procType&&t.procType.type==="ENCRYPTED")throw new Error("Could not convert public key from PEM; PEM is encrypted.");var r=h.fromDer(t.body);return k.publicKeyFromAsn1(r)};k.publicKeyToPem=function(e,t){var a={type:"PUBLIC KEY",body:h.toDer(k.publicKeyToAsn1(e)).getBytes()};return q.pem.encode(a,{maxline:t})};k.publicKeyToRSAPublicKeyPem=function(e,t){var a={type:"RSA PUBLIC KEY",body:h.toDer(k.publicKeyToRSAPublicKey(e)).getBytes()};return q.pem.encode(a,{maxline:t})};k.getPublicKeyFingerprint=function(e,t){t=t||{};var a=t.md||q.md.sha1.create(),r=t.type||"RSAPublicKey",n;switch(r){case"RSAPublicKey":n=h.toDer(k.publicKeyToRSAPublicKey(e)).getBytes();break;case"SubjectPublicKeyInfo":n=h.toDer(k.publicKeyToAsn1(e)).getBytes();break;default:throw new Error('Unknown fingerprint type "'+t.type+'".')}a.start(),a.update(n);var s=a.digest();if(t.encoding==="hex"){var i=s.toHex();return t.delimiter?i.match(/.{2}/g).join(t.delimiter):i}else{if(t.encoding==="binary")return s.getBytes();if(t.encoding)throw new Error('Unknown encoding "'+t.encoding+'".')}return s};k.certificationRequestFromPem=function(e,t,a){var r=q.pem.decode(e)[0];if(r.type!=="CERTIFICATE REQUEST"){var n=new Error('Could not convert certification request from PEM; PEM header type is not "CERTIFICATE REQUEST".');throw n.headerType=r.type,n}if(r.procType&&r.procType.type==="ENCRYPTED")throw new Error("Could not convert certification request from PEM; PEM is encrypted.");var s=h.fromDer(r.body,a);return k.certificationRequestFromAsn1(s,t)};k.certificationRequestToPem=function(e,t){var a={type:"CERTIFICATE REQUEST",body:h.toDer(k.certificationRequestToAsn1(e)).getBytes()};return q.pem.encode(a,{maxline:t})};k.createCertificate=function(){var e={};return e.version=2,e.serialNumber="00",e.signatureOid=null,e.signature=null,e.siginfo={},e.siginfo.algorithmOid=null,e.validity={},e.validity.notBefore=new Date,e.validity.notAfter=new Date,e.issuer={},e.issuer.getField=function(t){return Rt(e.issuer,t)},e.issuer.addField=function(t){rt([t]),e.issuer.attributes.push(t)},e.issuer.attributes=[],e.issuer.hash=null,e.subject={},e.subject.getField=function(t){return Rt(e.subject,t)},e.subject.addField=function(t){rt([t]),e.subject.attributes.push(t)},e.subject.attributes=[],e.subject.hash=null,e.extensions=[],e.publicKey=null,e.md=null,e.setSubject=function(t,a){rt(t),e.subject.attributes=t,delete e.subject.uniqueId,a&&(e.subject.uniqueId=a),e.subject.hash=null},e.setIssuer=function(t,a){rt(t),e.issuer.attributes=t,delete e.issuer.uniqueId,a&&(e.issuer.uniqueId=a),e.issuer.hash=null},e.setExtensions=function(t){for(var a=0;a<t.length;++a)Xi(t[a],{cert:e});e.extensions=t},e.getExtension=function(t){typeof t=="string"&&(t={name:t});for(var a=null,r,n=0;a===null&&n<e.extensions.length;++n)r=e.extensions[n],(t.id&&r.id===t.id||t.name&&r.name===t.name)&&(a=r);return a},e.sign=function(t,a){e.md=a||q.md.sha1.create();var r=ae[e.md.algorithm+"WithRSAEncryption"];if(!r){var n=new Error("Could not compute certificate digest. Unknown message digest algorithm OID.");throw n.algorithm=e.md.algorithm,n}e.signatureOid=e.siginfo.algorithmOid=r,e.tbsCertificate=k.getTBSCertificate(e);var s=h.toDer(e.tbsCertificate);e.md.update(s.getBytes()),e.signature=t.sign(e.md)},e.verify=function(t){var a=!1;if(!e.issued(t)){var r=t.issuer,n=e.subject,s=new Error("The parent certificate did not issue the given child certificate; the child certificate's issuer does not match the parent's subject.");throw s.expectedIssuer=n.attributes,s.actualIssuer=r.attributes,s}var i=t.md;if(i===null){i=ta({signatureOid:t.signatureOid,type:"certificate"});var o=t.tbsCertificate||k.getTBSCertificate(t),l=h.toDer(o);i.update(l.getBytes())}return i!==null&&(a=Yi({certificate:e,md:i,signature:t.signature})),a},e.isIssuer=function(t){var a=!1,r=e.issuer,n=t.subject;if(r.hash&&n.hash)a=r.hash===n.hash;else if(r.attributes.length===n.attributes.length){a=!0;for(var s,i,o=0;a&&o<r.attributes.length;++o)s=r.attributes[o],i=n.attributes[o],(s.type!==i.type||s.value!==i.value)&&(a=!1)}return a},e.issued=function(t){return t.isIssuer(e)},e.generateSubjectKeyIdentifier=function(){return k.getPublicKeyFingerprint(e.publicKey,{type:"RSAPublicKey"})},e.verifySubjectKeyIdentifier=function(){for(var t=ae.subjectKeyIdentifier,a=0;a<e.extensions.length;++a){var r=e.extensions[a];if(r.id===t){var n=e.generateSubjectKeyIdentifier().getBytes();return q.util.hexToBytes(r.subjectKeyIdentifier)===n}}return!1},e};k.certificateFromAsn1=function(e,t){var a={},r=[];if(!h.validate(e,Ju,a,r)){var n=new Error("Cannot read X.509 certificate. ASN.1 object is not an X509v3 Certificate.");throw n.errors=r,n}var s=h.derToOid(a.publicKeyOid);if(s!==k.oids.rsaEncryption)throw new Error("Cannot read public key. OID is not RSA.");var i=k.createCertificate();i.version=a.certVersion?a.certVersion.charCodeAt(0):0;var o=q.util.createBuffer(a.certSerialNumber);i.serialNumber=o.toHex(),i.signatureOid=q.asn1.derToOid(a.certSignatureOid),i.signatureParameters=ea(i.signatureOid,a.certSignatureParams,!0),i.siginfo.algorithmOid=q.asn1.derToOid(a.certinfoSignatureOid),i.siginfo.parameters=ea(i.siginfo.algorithmOid,a.certinfoSignatureParams,!1),i.signature=a.certSignature;var l=[];if(a.certValidity1UTCTime!==void 0&&l.push(h.utcTimeToDate(a.certValidity1UTCTime)),a.certValidity2GeneralizedTime!==void 0&&l.push(h.generalizedTimeToDate(a.certValidity2GeneralizedTime)),a.certValidity3UTCTime!==void 0&&l.push(h.utcTimeToDate(a.certValidity3UTCTime)),a.certValidity4GeneralizedTime!==void 0&&l.push(h.generalizedTimeToDate(a.certValidity4GeneralizedTime)),l.length>2)throw new Error("Cannot read notBefore/notAfter validity times; more than two times were provided in the certificate.");if(l.length<2)throw new Error("Cannot read notBefore/notAfter validity times; they were not provided as either UTCTime or GeneralizedTime.");if(i.validity.notBefore=l[0],i.validity.notAfter=l[1],i.tbsCertificate=a.tbsCertificate,t){i.md=ta({signatureOid:i.signatureOid,type:"certificate"});var u=h.toDer(i.tbsCertificate);i.md.update(u.getBytes())}var f=q.md.sha1.create(),c=h.toDer(a.certIssuer);f.update(c.getBytes()),i.issuer.getField=function(y){return Rt(i.issuer,y)},i.issuer.addField=function(y){rt([y]),i.issuer.attributes.push(y)},i.issuer.attributes=k.RDNAttributesAsArray(a.certIssuer),a.certIssuerUniqueId&&(i.issuer.uniqueId=a.certIssuerUniqueId),i.issuer.hash=f.digest().toHex();var v=q.md.sha1.create(),g=h.toDer(a.certSubject);return v.update(g.getBytes()),i.subject.getField=function(y){return Rt(i.subject,y)},i.subject.addField=function(y){rt([y]),i.subject.attributes.push(y)},i.subject.attributes=k.RDNAttributesAsArray(a.certSubject),a.certSubjectUniqueId&&(i.subject.uniqueId=a.certSubjectUniqueId),i.subject.hash=v.digest().toHex(),a.certExtensions?i.extensions=k.certificateExtensionsFromAsn1(a.certExtensions):i.extensions=[],i.publicKey=k.publicKeyFromAsn1(a.subjectPublicKeyInfo),i};k.certificateExtensionsFromAsn1=function(e){for(var t=[],a=0;a<e.value.length;++a)for(var r=e.value[a],n=0;n<r.value.length;++n)t.push(k.certificateExtensionFromAsn1(r.value[n]));return t};k.certificateExtensionFromAsn1=function(e){var t={};if(t.id=h.derToOid(e.value[0].value),t.critical=!1,e.value[1].type===h.Type.BOOLEAN?(t.critical=e.value[1].value.charCodeAt(0)!==0,t.value=e.value[2].value):t.value=e.value[1].value,t.id in ae){if(t.name=ae[t.id],t.name==="keyUsage"){var a=h.fromDer(t.value),r=0,n=0;a.value.length>1&&(r=a.value.charCodeAt(1),n=a.value.length>2?a.value.charCodeAt(2):0),t.digitalSignature=(r&128)===128,t.nonRepudiation=(r&64)===64,t.keyEncipherment=(r&32)===32,t.dataEncipherment=(r&16)===16,t.keyAgreement=(r&8)===8,t.keyCertSign=(r&4)===4,t.cRLSign=(r&2)===2,t.encipherOnly=(r&1)===1,t.decipherOnly=(n&128)===128}else if(t.name==="basicConstraints"){var a=h.fromDer(t.value);a.value.length>0&&a.value[0].type===h.Type.BOOLEAN?t.cA=a.value[0].value.charCodeAt(0)!==0:t.cA=!1;var s=null;a.value.length>0&&a.value[0].type===h.Type.INTEGER?s=a.value[0].value:a.value.length>1&&(s=a.value[1].value),s!==null&&(t.pathLenConstraint=h.derToInteger(s))}else if(t.name==="extKeyUsage")for(var a=h.fromDer(t.value),i=0;i<a.value.length;++i){var o=h.derToOid(a.value[i].value);o in ae?t[ae[o]]=!0:t[o]=!0}else if(t.name==="nsCertType"){var a=h.fromDer(t.value),r=0;a.value.length>1&&(r=a.value.charCodeAt(1)),t.client=(r&128)===128,t.server=(r&64)===64,t.email=(r&32)===32,t.objsign=(r&16)===16,t.reserved=(r&8)===8,t.sslCA=(r&4)===4,t.emailCA=(r&2)===2,t.objCA=(r&1)===1}else if(t.name==="subjectAltName"||t.name==="issuerAltName"){t.altNames=[];for(var l,a=h.fromDer(t.value),u=0;u<a.value.length;++u){l=a.value[u];var f={type:l.type,value:l.value};switch(t.altNames.push(f),l.type){case 1:case 2:case 6:break;case 7:f.ip=q.util.bytesToIP(l.value);break;case 8:f.oid=h.derToOid(l.value);break;default:}}}else if(t.name==="subjectKeyIdentifier"){var a=h.fromDer(t.value);t.subjectKeyIdentifier=q.util.bytesToHex(a.value)}}return t};k.certificationRequestFromAsn1=function(e,t){var a={},r=[];if(!h.validate(e,rl,a,r)){var n=new Error("Cannot read PKCS#10 certificate request. ASN.1 object is not a PKCS#10 CertificationRequest.");throw n.errors=r,n}var s=h.derToOid(a.publicKeyOid);if(s!==k.oids.rsaEncryption)throw new Error("Cannot read public key. OID is not RSA.");var i=k.createCertificationRequest();if(i.version=a.csrVersion?a.csrVersion.charCodeAt(0):0,i.signatureOid=q.asn1.derToOid(a.csrSignatureOid),i.signatureParameters=ea(i.signatureOid,a.csrSignatureParams,!0),i.siginfo.algorithmOid=q.asn1.derToOid(a.csrSignatureOid),i.siginfo.parameters=ea(i.siginfo.algorithmOid,a.csrSignatureParams,!1),i.signature=a.csrSignature,i.certificationRequestInfo=a.certificationRequestInfo,t){i.md=ta({signatureOid:i.signatureOid,type:"certification request"});var o=h.toDer(i.certificationRequestInfo);i.md.update(o.getBytes())}var l=q.md.sha1.create();return i.subject.getField=function(u){return Rt(i.subject,u)},i.subject.addField=function(u){rt([u]),i.subject.attributes.push(u)},i.subject.attributes=k.RDNAttributesAsArray(a.certificationRequestInfoSubject,l),i.subject.hash=l.digest().toHex(),i.publicKey=k.publicKeyFromAsn1(a.subjectPublicKeyInfo),i.getAttribute=function(u){return Rt(i,u)},i.addAttribute=function(u){rt([u]),i.attributes.push(u)},i.attributes=k.CRIAttributesAsArray(a.certificationRequestInfoAttributes||[]),i};k.createCertificationRequest=function(){var e={};return e.version=0,e.signatureOid=null,e.signature=null,e.siginfo={},e.siginfo.algorithmOid=null,e.subject={},e.subject.getField=function(t){return Rt(e.subject,t)},e.subject.addField=function(t){rt([t]),e.subject.attributes.push(t)},e.subject.attributes=[],e.subject.hash=null,e.publicKey=null,e.attributes=[],e.getAttribute=function(t){return Rt(e,t)},e.addAttribute=function(t){rt([t]),e.attributes.push(t)},e.md=null,e.setSubject=function(t){rt(t),e.subject.attributes=t,e.subject.hash=null},e.setAttributes=function(t){rt(t),e.attributes=t},e.sign=function(t,a){e.md=a||q.md.sha1.create();var r=ae[e.md.algorithm+"WithRSAEncryption"];if(!r){var n=new Error("Could not compute certification request digest. Unknown message digest algorithm OID.");throw n.algorithm=e.md.algorithm,n}e.signatureOid=e.siginfo.algorithmOid=r,e.certificationRequestInfo=k.getCertificationRequestInfo(e);var s=h.toDer(e.certificationRequestInfo);e.md.update(s.getBytes()),e.signature=t.sign(e.md)},e.verify=function(){var t=!1,a=e.md;if(a===null){a=ta({signatureOid:e.signatureOid,type:"certification request"});var r=e.certificationRequestInfo||k.getCertificationRequestInfo(e),n=h.toDer(r);a.update(n.getBytes())}return a!==null&&(t=Yi({certificate:e,md:a,signature:e.signature})),t},e};function sr(e){for(var t=h.create(h.Class.UNIVERSAL,h.Type.SEQUENCE,!0,[]),a,r,n=e.attributes,s=0;s<n.length;++s){a=n[s];var i=a.value,o=h.Type.PRINTABLESTRING;"valueTagClass"in a&&(o=a.valueTagClass,o===h.Type.UTF8&&(i=q.util.encodeUtf8(i))),r=h.create(h.Class.UNIVERSAL,h.Type.SET,!0,[h.create(h.Class.UNIVERSAL,h.Type.SEQUENCE,!0,[h.create(h.Class.UNIVERSAL,h.Type.OID,!1,h.oidToDer(a.type).getBytes()),h.create(h.Class.UNIVERSAL,o,!1,i)])]),t.value.push(r)}return t}function rt(e){for(var t,a=0;a<e.length;++a){if(t=e[a],typeof t.name>"u"&&(t.type&&t.type in k.oids?t.name=k.oids[t.type]:t.shortName&&t.shortName in ve&&(t.name=k.oids[ve[t.shortName]])),typeof t.type>"u")if(t.name&&t.name in k.oids)t.type=k.oids[t.name];else{var r=new Error("Attribute type not specified.");throw r.attribute=t,r}if(typeof t.shortName>"u"&&t.name&&t.name in ve&&(t.shortName=ve[t.name]),t.type===ae.extensionRequest&&(t.valueConstructed=!0,t.valueTagClass=h.Type.SEQUENCE,!t.value&&t.extensions)){t.value=[];for(var n=0;n<t.extensions.length;++n)t.value.push(k.certificateExtensionToAsn1(Xi(t.extensions[n])))}if(typeof t.value>"u"){var r=new Error("Attribute value not specified.");throw r.attribute=t,r}}}function Xi(e,t){if(t=t||{},typeof e.name>"u"&&e.id&&e.id in k.oids&&(e.name=k.oids[e.id]),typeof e.id>"u")if(e.name&&e.name in k.oids)e.id=k.oids[e.name];else{var a=new Error("Extension ID not specified.");throw a.extension=e,a}if(typeof e.value<"u")return e;if(e.name==="keyUsage"){var r=0,n=0,s=0;e.digitalSignature&&(n|=128,r=7),e.nonRepudiation&&(n|=64,r=6),e.keyEncipherment&&(n|=32,r=5),e.dataEncipherment&&(n|=16,r=4),e.keyAgreement&&(n|=8,r=3),e.keyCertSign&&(n|=4,r=2),e.cRLSign&&(n|=2,r=1),e.encipherOnly&&(n|=1,r=0),e.decipherOnly&&(s|=128,r=7);var i=String.fromCharCode(r);s!==0?i+=String.fromCharCode(n)+String.fromCharCode(s):n!==0&&(i+=String.fromCharCode(n)),e.value=h.create(h.Class.UNIVERSAL,h.Type.BITSTRING,!1,i)}else if(e.name==="basicConstraints")e.value=h.create(h.Class.UNIVERSAL,h.Type.SEQUENCE,!0,[]),e.cA&&e.value.value.push(h.create(h.Class.UNIVERSAL,h.Type.BOOLEAN,!1,"\xFF")),"pathLenConstraint"in e&&e.value.value.push(h.create(h.Class.UNIVERSAL,h.Type.INTEGER,!1,h.integerToDer(e.pathLenConstraint).getBytes()));else if(e.name==="extKeyUsage"){e.value=h.create(h.Class.UNIVERSAL,h.Type.SEQUENCE,!0,[]);var o=e.value.value;for(var l in e)e[l]===!0&&(l in ae?o.push(h.create(h.Class.UNIVERSAL,h.Type.OID,!1,h.oidToDer(ae[l]).getBytes())):l.indexOf(".")!==-1&&o.push(h.create(h.Class.UNIVERSAL,h.Type.OID,!1,h.oidToDer(l).getBytes())))}else if(e.name==="nsCertType"){var r=0,n=0;e.client&&(n|=128,r=7),e.server&&(n|=64,r=6),e.email&&(n|=32,r=5),e.objsign&&(n|=16,r=4),e.reserved&&(n|=8,r=3),e.sslCA&&(n|=4,r=2),e.emailCA&&(n|=2,r=1),e.objCA&&(n|=1,r=0);var i=String.fromCharCode(r);n!==0&&(i+=String.fromCharCode(n)),e.value=h.create(h.Class.UNIVERSAL,h.Type.BITSTRING,!1,i)}else if(e.name==="subjectAltName"||e.name==="issuerAltName"){e.value=h.create(h.Class.UNIVERSAL,h.Type.SEQUENCE,!0,[]);for(var u,f=0;f<e.altNames.length;++f){u=e.altNames[f];var i=u.value;if(u.type===7&&u.ip){if(i=q.util.bytesFromIP(u.ip),i===null){var a=new Error('Extension "ip" value is not a valid IPv4 or IPv6 address.');throw a.extension=e,a}}else u.type===8&&(u.oid?i=h.oidToDer(h.oidToDer(u.oid)):i=h.oidToDer(i));e.value.value.push(h.create(h.Class.CONTEXT_SPECIFIC,u.type,!1,i))}}else if(e.name==="nsComment"&&t.cert){if(!/^[\x00-\x7F]*$/.test(e.comment)||e.comment.length<1||e.comment.length>128)throw new Error('Invalid "nsComment" content.');e.value=h.create(h.Class.UNIVERSAL,h.Type.IA5STRING,!1,e.comment)}else if(e.name==="subjectKeyIdentifier"&&t.cert){var c=t.cert.generateSubjectKeyIdentifier();e.subjectKeyIdentifier=c.toHex(),e.value=h.create(h.Class.UNIVERSAL,h.Type.OCTETSTRING,!1,c.getBytes())}else if(e.name==="authorityKeyIdentifier"&&t.cert){e.value=h.create(h.Class.UNIVERSAL,h.Type.SEQUENCE,!0,[]);var o=e.value.value;if(e.keyIdentifier){var v=e.keyIdentifier===!0?t.cert.generateSubjectKeyIdentifier().getBytes():e.keyIdentifier;o.push(h.create(h.Class.CONTEXT_SPECIFIC,0,!1,v))}if(e.authorityCertIssuer){var g=[h.create(h.Class.CONTEXT_SPECIFIC,4,!0,[sr(e.authorityCertIssuer===!0?t.cert.issuer:e.authorityCertIssuer)])];o.push(h.create(h.Class.CONTEXT_SPECIFIC,1,!0,g))}if(e.serialNumber){var y=q.util.hexToBytes(e.serialNumber===!0?t.cert.serialNumber:e.serialNumber);o.push(h.create(h.Class.CONTEXT_SPECIFIC,2,!1,y))}}else if(e.name==="cRLDistributionPoints"){e.value=h.create(h.Class.UNIVERSAL,h.Type.SEQUENCE,!0,[]);for(var o=e.value.value,x=h.create(h.Class.UNIVERSAL,h.Type.SEQUENCE,!0,[]),S=h.create(h.Class.CONTEXT_SPECIFIC,0,!0,[]),u,f=0;f<e.altNames.length;++f){u=e.altNames[f];var i=u.value;if(u.type===7&&u.ip){if(i=q.util.bytesFromIP(u.ip),i===null){var a=new Error('Extension "ip" value is not a valid IPv4 or IPv6 address.');throw a.extension=e,a}}else u.type===8&&(u.oid?i=h.oidToDer(h.oidToDer(u.oid)):i=h.oidToDer(i));S.value.push(h.create(h.Class.CONTEXT_SPECIFIC,u.type,!1,i))}x.value.push(h.create(h.Class.CONTEXT_SPECIFIC,0,!0,[S])),o.push(x)}if(typeof e.value>"u"){var a=new Error("Extension value not specified.");throw a.extension=e,a}return e}function Ha(e,t){if(e===ae["RSASSA-PSS"]){var a=[];return t.hash.algorithmOid!==void 0&&a.push(h.create(h.Class.CONTEXT_SPECIFIC,0,!0,[h.create(h.Class.UNIVERSAL,h.Type.SEQUENCE,!0,[h.create(h.Class.UNIVERSAL,h.Type.OID,!1,h.oidToDer(t.hash.algorithmOid).getBytes()),h.create(h.Class.UNIVERSAL,h.Type.NULL,!1,"")])])),t.mgf.algorithmOid!==void 0&&a.push(h.create(h.Class.CONTEXT_SPECIFIC,1,!0,[h.create(h.Class.UNIVERSAL,h.Type.SEQUENCE,!0,[h.create(h.Class.UNIVERSAL,h.Type.OID,!1,h.oidToDer(t.mgf.algorithmOid).getBytes()),h.create(h.Class.UNIVERSAL,h.Type.SEQUENCE,!0,[h.create(h.Class.UNIVERSAL,h.Type.OID,!1,h.oidToDer(t.mgf.hash.algorithmOid).getBytes()),h.create(h.Class.UNIVERSAL,h.Type.NULL,!1,"")])])])),t.saltLength!==void 0&&a.push(h.create(h.Class.CONTEXT_SPECIFIC,2,!0,[h.create(h.Class.UNIVERSAL,h.Type.INTEGER,!1,h.integerToDer(t.saltLength).getBytes())])),h.create(h.Class.UNIVERSAL,h.Type.SEQUENCE,!0,a)}else return h.create(h.Class.UNIVERSAL,h.Type.NULL,!1,"")}function al(e){var t=h.create(h.Class.CONTEXT_SPECIFIC,0,!0,[]);if(e.attributes.length===0)return t;for(var a=e.attributes,r=0;r<a.length;++r){var n=a[r],s=n.value,i=h.Type.UTF8;"valueTagClass"in n&&(i=n.valueTagClass),i===h.Type.UTF8&&(s=q.util.encodeUtf8(s));var o=!1;"valueConstructed"in n&&(o=n.valueConstructed);var l=h.create(h.Class.UNIVERSAL,h.Type.SEQUENCE,!0,[h.create(h.Class.UNIVERSAL,h.Type.OID,!1,h.oidToDer(n.type).getBytes()),h.create(h.Class.UNIVERSAL,h.Type.SET,!0,[h.create(h.Class.UNIVERSAL,i,o,s)])]);t.value.push(l)}return t}var nl=new Date("1950-01-01T00:00:00Z"),il=new Date("2050-01-01T00:00:00Z");function zi(e){return e>=nl&&e<il?h.create(h.Class.UNIVERSAL,h.Type.UTCTIME,!1,h.dateToUtcTime(e)):h.create(h.Class.UNIVERSAL,h.Type.GENERALIZEDTIME,!1,h.dateToGeneralizedTime(e))}k.getTBSCertificate=function(e){var t=zi(e.validity.notBefore),a=zi(e.validity.notAfter),r=h.create(h.Class.UNIVERSAL,h.Type.SEQUENCE,!0,[h.create(h.Class.CONTEXT_SPECIFIC,0,!0,[h.create(h.Class.UNIVERSAL,h.Type.INTEGER,!1,h.integerToDer(e.version).getBytes())]),h.create(h.Class.UNIVERSAL,h.Type.INTEGER,!1,q.util.hexToBytes(e.serialNumber)),h.create(h.Class.UNIVERSAL,h.Type.SEQUENCE,!0,[h.create(h.Class.UNIVERSAL,h.Type.OID,!1,h.oidToDer(e.siginfo.algorithmOid).getBytes()),Ha(e.siginfo.algorithmOid,e.siginfo.parameters)]),sr(e.issuer),h.create(h.Class.UNIVERSAL,h.Type.SEQUENCE,!0,[t,a]),sr(e.subject),k.publicKeyToAsn1(e.publicKey)]);return e.issuer.uniqueId&&r.value.push(h.create(h.Class.CONTEXT_SPECIFIC,1,!0,[h.create(h.Class.UNIVERSAL,h.Type.BITSTRING,!1,"\0"+e.issuer.uniqueId)])),e.subject.uniqueId&&r.value.push(h.create(h.Class.CONTEXT_SPECIFIC,2,!0,[h.create(h.Class.UNIVERSAL,h.Type.BITSTRING,!1,"\0"+e.subject.uniqueId)])),e.extensions.length>0&&r.value.push(k.certificateExtensionsToAsn1(e.extensions)),r};k.getCertificationRequestInfo=function(e){var t=h.create(h.Class.UNIVERSAL,h.Type.SEQUENCE,!0,[h.create(h.Class.UNIVERSAL,h.Type.INTEGER,!1,h.integerToDer(e.version).getBytes()),sr(e.subject),k.publicKeyToAsn1(e.publicKey),al(e)]);return t};k.distinguishedNameToAsn1=function(e){return sr(e)};k.certificateToAsn1=function(e){var t=e.tbsCertificate||k.getTBSCertificate(e);return h.create(h.Class.UNIVERSAL,h.Type.SEQUENCE,!0,[t,h.create(h.Class.UNIVERSAL,h.Type.SEQUENCE,!0,[h.create(h.Class.UNIVERSAL,h.Type.OID,!1,h.oidToDer(e.signatureOid).getBytes()),Ha(e.signatureOid,e.signatureParameters)]),h.create(h.Class.UNIVERSAL,h.Type.BITSTRING,!1,"\0"+e.signature)])};k.certificateExtensionsToAsn1=function(e){var t=h.create(h.Class.CONTEXT_SPECIFIC,3,!0,[]),a=h.create(h.Class.UNIVERSAL,h.Type.SEQUENCE,!0,[]);t.value.push(a);for(var r=0;r<e.length;++r)a.value.push(k.certificateExtensionToAsn1(e[r]));return t};k.certificateExtensionToAsn1=function(e){var t=h.create(h.Class.UNIVERSAL,h.Type.SEQUENCE,!0,[]);t.value.push(h.create(h.Class.UNIVERSAL,h.Type.OID,!1,h.oidToDer(e.id).getBytes())),e.critical&&t.value.push(h.create(h.Class.UNIVERSAL,h.Type.BOOLEAN,!1,"\xFF"));var a=e.value;return typeof e.value!="string"&&(a=h.toDer(a).getBytes()),t.value.push(h.create(h.Class.UNIVERSAL,h.Type.OCTETSTRING,!1,a)),t};k.certificationRequestToAsn1=function(e){var t=e.certificationRequestInfo||k.getCertificationRequestInfo(e);return h.create(h.Class.UNIVERSAL,h.Type.SEQUENCE,!0,[t,h.create(h.Class.UNIVERSAL,h.Type.SEQUENCE,!0,[h.create(h.Class.UNIVERSAL,h.Type.OID,!1,h.oidToDer(e.signatureOid).getBytes()),Ha(e.signatureOid,e.signatureParameters)]),h.create(h.Class.UNIVERSAL,h.Type.BITSTRING,!1,"\0"+e.signature)])};k.createCaStore=function(e){var t={certs:{}};t.getIssuer=function(i){var o=a(i.issuer);return o},t.addCertificate=function(i){if(typeof i=="string"&&(i=q.pki.certificateFromPem(i)),r(i.subject),!t.hasCertificate(i))if(i.subject.hash in t.certs){var o=t.certs[i.subject.hash];q.util.isArray(o)||(o=[o]),o.push(i),t.certs[i.subject.hash]=o}else t.certs[i.subject.hash]=i},t.hasCertificate=function(i){typeof i=="string"&&(i=q.pki.certificateFromPem(i));var o=a(i.subject);if(!o)return!1;q.util.isArray(o)||(o=[o]);for(var l=h.toDer(k.certificateToAsn1(i)).getBytes(),u=0;u<o.length;++u){var f=h.toDer(k.certificateToAsn1(o[u])).getBytes();if(l===f)return!0}return!1},t.listAllCertificates=function(){var i=[];for(var o in t.certs)if(t.certs.hasOwnProperty(o)){var l=t.certs[o];if(!q.util.isArray(l))i.push(l);else for(var u=0;u<l.length;++u)i.push(l[u])}return i},t.removeCertificate=function(i){var o;if(typeof i=="string"&&(i=q.pki.certificateFromPem(i)),r(i.subject),!t.hasCertificate(i))return null;var l=a(i.subject);if(!q.util.isArray(l))return o=t.certs[i.subject.hash],delete t.certs[i.subject.hash],o;for(var u=h.toDer(k.certificateToAsn1(i)).getBytes(),f=0;f<l.length;++f){var c=h.toDer(k.certificateToAsn1(l[f])).getBytes();u===c&&(o=l[f],l.splice(f,1))}return l.length===0&&delete t.certs[i.subject.hash],o};function a(i){return r(i),t.certs[i.hash]||null}function r(i){if(!i.hash){var o=q.md.sha1.create();i.attributes=k.RDNAttributesAsArray(sr(i),o),i.hash=o.digest().toHex()}}if(e)for(var n=0;n<e.length;++n){var s=e[n];t.addCertificate(s)}return t};k.certificateError={bad_certificate:"forge.pki.BadCertificate",unsupported_certificate:"forge.pki.UnsupportedCertificate",certificate_revoked:"forge.pki.CertificateRevoked",certificate_expired:"forge.pki.CertificateExpired",certificate_unknown:"forge.pki.CertificateUnknown",unknown_ca:"forge.pki.UnknownCertificateAuthority"};k.verifyCertificateChain=function(e,t,a){typeof a=="function"&&(a={verify:a}),a=a||{},t=t.slice(0);var r=t.slice(0),n=a.validityCheckDate;typeof n>"u"&&(n=new Date);var s=!0,i=null,o=0;do{var l=t.shift(),u=null,f=!1;if(n&&(n<l.validity.notBefore||n>l.validity.notAfter)&&(i={message:"Certificate is not valid yet or has expired.",error:k.certificateError.certificate_expired,notBefore:l.validity.notBefore,notAfter:l.validity.notAfter,now:n}),i===null){if(u=t[0]||e.getIssuer(l),u===null&&l.isIssuer(l)&&(f=!0,u=l),u){var c=u;q.util.isArray(c)||(c=[c]);for(var v=!1;!v&&c.length>0;){u=c.shift();try{v=u.verify(l)}catch{}}v||(i={message:"Certificate signature is invalid.",error:k.certificateError.bad_certificate})}i===null&&(!u||f)&&!e.hasCertificate(l)&&(i={message:"Certificate is not trusted.",error:k.certificateError.unknown_ca})}if(i===null&&u&&!l.isIssuer(u)&&(i={message:"Certificate issuer is invalid.",error:k.certificateError.bad_certificate}),i===null)for(var g={keyUsage:!0,basicConstraints:!0},y=0;i===null&&y<l.extensions.length;++y){var x=l.extensions[y];x.critical&&!(x.name in g)&&(i={message:"Certificate has an unsupported critical extension.",error:k.certificateError.unsupported_certificate})}if(i===null&&(!s||t.length===0&&(!u||f))){var S=l.getExtension("basicConstraints"),I=l.getExtension("keyUsage");if(I!==null&&(!I.keyCertSign||S===null)&&(i={message:"Certificate keyUsage or basicConstraints conflict or indicate that the certificate is not a CA. If the certificate is the only one in the chain or isn't the first then the certificate must be a valid CA.",error:k.certificateError.bad_certificate}),i===null&&S===null&&(i={message:"Certificate is missing basicConstraints extension and cannot be used as a CA.",error:k.certificateError.bad_certificate}),i===null&&S!==null&&!S.cA&&(i={message:"Certificate basicConstraints indicates the certificate is not a CA.",error:k.certificateError.bad_certificate}),i===null&&I!==null&&"pathLenConstraint"in S){var B=o-1;B>S.pathLenConstraint&&(i={message:"Certificate basicConstraints pathLenConstraint violated.",error:k.certificateError.bad_certificate})}}var b=i===null?!0:i.error,U=a.verify?a.verify(b,o,r):b;if(U===!0)i=null;else throw b===!0&&(i={message:"The application rejected the certificate.",error:k.certificateError.bad_certificate}),(U||U===0)&&(typeof U=="object"&&!q.util.isArray(U)?(U.message&&(i.message=U.message),U.error&&(i.error=U.error)):typeof U=="string"&&(i.error=U)),i;s=!1,++o}while(t.length>0);return!0}});var za=M((Nc,$i)=>{var ce=X();st();Jt();bt();qa();Fa();Je();xr();ar();ne();ra();var m=ce.asn1,$=ce.pki,Tr=$i.exports=ce.pkcs12=ce.pkcs12||{},Wi={name:"ContentInfo",tagClass:m.Class.UNIVERSAL,type:m.Type.SEQUENCE,constructed:!0,value:[{name:"ContentInfo.contentType",tagClass:m.Class.UNIVERSAL,type:m.Type.OID,constructed:!1,capture:"contentType"},{name:"ContentInfo.content",tagClass:m.Class.CONTEXT_SPECIFIC,constructed:!0,captureAsn1:"content"}]},sl={name:"PFX",tagClass:m.Class.UNIVERSAL,type:m.Type.SEQUENCE,constructed:!0,value:[{name:"PFX.version",tagClass:m.Class.UNIVERSAL,type:m.Type.INTEGER,constructed:!1,capture:"version"},Wi,{name:"PFX.macData",tagClass:m.Class.UNIVERSAL,type:m.Type.SEQUENCE,constructed:!0,optional:!0,captureAsn1:"mac",value:[{name:"PFX.macData.mac",tagClass:m.Class.UNIVERSAL,type:m.Type.SEQUENCE,constructed:!0,value:[{name:"PFX.macData.mac.digestAlgorithm",tagClass:m.Class.UNIVERSAL,type:m.Type.SEQUENCE,constructed:!0,value:[{name:"PFX.macData.mac.digestAlgorithm.algorithm",tagClass:m.Class.UNIVERSAL,type:m.Type.OID,constructed:!1,capture:"macAlgorithm"},{name:"PFX.macData.mac.digestAlgorithm.parameters",optional:!0,tagClass:m.Class.UNIVERSAL,captureAsn1:"macAlgorithmParameters"}]},{name:"PFX.macData.mac.digest",tagClass:m.Class.UNIVERSAL,type:m.Type.OCTETSTRING,constructed:!1,capture:"macDigest"}]},{name:"PFX.macData.macSalt",tagClass:m.Class.UNIVERSAL,type:m.Type.OCTETSTRING,constructed:!1,capture:"macSalt"},{name:"PFX.macData.iterations",tagClass:m.Class.UNIVERSAL,type:m.Type.INTEGER,constructed:!1,optional:!0,capture:"macIterations"}]}]},ol={name:"SafeBag",tagClass:m.Class.UNIVERSAL,type:m.Type.SEQUENCE,constructed:!0,value:[{name:"SafeBag.bagId",tagClass:m.Class.UNIVERSAL,type:m.Type.OID,constructed:!1,capture:"bagId"},{name:"SafeBag.bagValue",tagClass:m.Class.CONTEXT_SPECIFIC,constructed:!0,captureAsn1:"bagValue"},{name:"SafeBag.bagAttributes",tagClass:m.Class.UNIVERSAL,type:m.Type.SET,constructed:!0,optional:!0,capture:"bagAttributes"}]},ul={name:"Attribute",tagClass:m.Class.UNIVERSAL,type:m.Type.SEQUENCE,constructed:!0,value:[{name:"Attribute.attrId",tagClass:m.Class.UNIVERSAL,type:m.Type.OID,constructed:!1,capture:"oid"},{name:"Attribute.attrValues",tagClass:m.Class.UNIVERSAL,type:m.Type.SET,constructed:!0,capture:"values"}]},ll={name:"CertBag",tagClass:m.Class.UNIVERSAL,type:m.Type.SEQUENCE,constructed:!0,value:[{name:"CertBag.certId",tagClass:m.Class.UNIVERSAL,type:m.Type.OID,constructed:!1,capture:"certId"},{name:"CertBag.certValue",tagClass:m.Class.CONTEXT_SPECIFIC,constructed:!0,value:[{name:"CertBag.certValue[0]",tagClass:m.Class.UNIVERSAL,type:m.Class.OCTETSTRING,constructed:!1,capture:"cert"}]}]};function Sr(e,t,a,r){for(var n=[],s=0;s<e.length;s++)for(var i=0;i<e[s].safeBags.length;i++){var o=e[s].safeBags[i];if(!(r!==void 0&&o.type!==r)){if(t===null){n.push(o);continue}o.attributes[t]!==void 0&&o.attributes[t].indexOf(a)>=0&&n.push(o)}}return n}Tr.pkcs12FromAsn1=function(e,t,a){typeof t=="string"?(a=t,t=!0):t===void 0&&(t=!0);var r={},n=[];if(!m.validate(e,sl,r,n)){var s=new Error("Cannot read PKCS#12 PFX. ASN.1 object is not an PKCS#12 PFX.");throw s.errors=s,s}var i={version:r.version.charCodeAt(0),safeContents:[],getBags:function(S){var I={},B;return"localKeyId"in S?B=S.localKeyId:"localKeyIdHex"in S&&(B=ce.util.hexToBytes(S.localKeyIdHex)),B===void 0&&!("friendlyName"in S)&&"bagType"in S&&(I[S.bagType]=Sr(i.safeContents,null,null,S.bagType)),B!==void 0&&(I.localKeyId=Sr(i.safeContents,"localKeyId",B,S.bagType)),"friendlyName"in S&&(I.friendlyName=Sr(i.safeContents,"friendlyName",S.friendlyName,S.bagType)),I},getBagsByFriendlyName:function(S,I){return Sr(i.safeContents,"friendlyName",S,I)},getBagsByLocalKeyId:function(S,I){return Sr(i.safeContents,"localKeyId",S,I)}};if(r.version.charCodeAt(0)!==3){var s=new Error("PKCS#12 PFX of version other than 3 not supported.");throw s.version=r.version.charCodeAt(0),s}if(m.derToOid(r.contentType)!==$.oids.data){var s=new Error("Only PKCS#12 PFX in password integrity mode supported.");throw s.oid=m.derToOid(r.contentType),s}var o=r.content.value[0];if(o.tagClass!==m.Class.UNIVERSAL||o.type!==m.Type.OCTETSTRING)throw new Error("PKCS#12 authSafe content data is not an OCTET STRING.");if(o=Ga(o),r.mac){var l=null,u=0,f=m.derToOid(r.macAlgorithm);switch(f){case $.oids.sha1:l=ce.md.sha1.create(),u=20;break;case $.oids.sha256:l=ce.md.sha256.create(),u=32;break;case $.oids.sha384:l=ce.md.sha384.create(),u=48;break;case $.oids.sha512:l=ce.md.sha512.create(),u=64;break;case $.oids.md5:l=ce.md.md5.create(),u=16;break}if(l===null)throw new Error("PKCS#12 uses unsupported MAC algorithm: "+f);var c=new ce.util.ByteBuffer(r.macSalt),v="macIterations"in r?parseInt(ce.util.bytesToHex(r.macIterations),16):1,g=Tr.generateKey(a,c,3,v,u,l),y=ce.hmac.create();y.start(l,g),y.update(o.value);var x=y.getMac();if(x.getBytes()!==r.macDigest)throw new Error("PKCS#12 MAC could not be verified. Invalid password?")}else if(Array.isArray(e.value)&&e.value.length>2)throw new Error("Invalid PKCS#12. macData field present but MAC was not validated.");return fl(i,o.value,t,a),i};function Ga(e){if(e.composed||e.constructed){for(var t=ce.util.createBuffer(),a=0;a<e.value.length;++a)t.putBytes(e.value[a].value);e.composed=e.constructed=!1,e.value=t.getBytes()}return e}function fl(e,t,a,r){if(t=m.fromDer(t,a),t.tagClass!==m.Class.UNIVERSAL||t.type!==m.Type.SEQUENCE||t.constructed!==!0)throw new Error("PKCS#12 AuthenticatedSafe expected to be a SEQUENCE OF ContentInfo");for(var n=0;n<t.value.length;n++){var s=t.value[n],i={},o=[];if(!m.validate(s,Wi,i,o)){var l=new Error("Cannot read ContentInfo.");throw l.errors=o,l}var u={encrypted:!1},f=null,c=i.content.value[0];switch(m.derToOid(i.contentType)){case $.oids.data:if(c.tagClass!==m.Class.UNIVERSAL||c.type!==m.Type.OCTETSTRING)throw new Error("PKCS#12 SafeContents Data is not an OCTET STRING.");f=Ga(c).value;break;case $.oids.encryptedData:f=cl(c,r),u.encrypted=!0;break;default:var l=new Error("Unsupported PKCS#12 contentType.");throw l.contentType=m.derToOid(i.contentType),l}u.safeBags=hl(f,a,r),e.safeContents.push(u)}}function cl(e,t){var a={},r=[];if(!m.validate(e,ce.pkcs7.asn1.encryptedDataValidator,a,r)){var n=new Error("Cannot read EncryptedContentInfo.");throw n.errors=r,n}var s=m.derToOid(a.contentType);if(s!==$.oids.data){var n=new Error("PKCS#12 EncryptedContentInfo ContentType is not Data.");throw n.oid=s,n}s=m.derToOid(a.encAlgorithm);var i=$.pbe.getCipher(s,a.encParameter,t),o=Ga(a.encryptedContentAsn1),l=ce.util.createBuffer(o.value);if(i.update(l),!i.finish())throw new Error("Failed to decrypt PKCS#12 SafeContents.");return i.output.getBytes()}function hl(e,t,a){if(!t&&e.length===0)return[];if(e=m.fromDer(e,t),e.tagClass!==m.Class.UNIVERSAL||e.type!==m.Type.SEQUENCE||e.constructed!==!0)throw new Error("PKCS#12 SafeContents expected to be a SEQUENCE OF SafeBag.");for(var r=[],n=0;n<e.value.length;n++){var s=e.value[n],i={},o=[];if(!m.validate(s,ol,i,o)){var l=new Error("Cannot read SafeBag.");throw l.errors=o,l}var u={type:m.derToOid(i.bagId),attributes:dl(i.bagAttributes)};r.push(u);var f,c,v=i.bagValue.value[0];switch(u.type){case $.oids.pkcs8ShroudedKeyBag:if(v=$.decryptPrivateKeyInfo(v,a),v===null)throw new Error("Unable to decrypt PKCS#8 ShroudedKeyBag, wrong password?");case $.oids.keyBag:try{u.key=$.privateKeyFromAsn1(v)}catch{u.key=null,u.asn1=v}continue;case $.oids.certBag:f=ll,c=function(){if(m.derToOid(i.certId)!==$.oids.x509Certificate){var y=new Error("Unsupported certificate type, only X.509 supported.");throw y.oid=m.derToOid(i.certId),y}var x=m.fromDer(i.cert,t);try{u.cert=$.certificateFromAsn1(x,!0)}catch{u.cert=null,u.asn1=x}};break;default:var l=new Error("Unsupported PKCS#12 SafeBag type.");throw l.oid=u.type,l}if(f!==void 0&&!m.validate(v,f,i,o)){var l=new Error("Cannot read PKCS#12 "+f.name);throw l.errors=o,l}c()}return r}function dl(e){var t={};if(e!==void 0)for(var a=0;a<e.length;++a){var r={},n=[];if(!m.validate(e[a],ul,r,n)){var s=new Error("Cannot read PKCS#12 BagAttribute.");throw s.errors=n,s}var i=m.derToOid(r.oid);if($.oids[i]!==void 0){t[$.oids[i]]=[];for(var o=0;o<r.values.length;++o)t[$.oids[i]].push(r.values[o].value)}}return t}Tr.toPkcs12Asn1=function(e,t,a,r){r=r||{},r.saltSize=r.saltSize||8,r.count=r.count||2048,r.algorithm=r.algorithm||r.encAlgorithm||"aes128","useMac"in r||(r.useMac=!0),"localKeyId"in r||(r.localKeyId=null),"generateLocalKeyId"in r||(r.generateLocalKeyId=!0);var n=r.localKeyId,s;if(n!==null)n=ce.util.hexToBytes(n);else if(r.generateLocalKeyId)if(t){var i=ce.util.isArray(t)?t[0]:t;typeof i=="string"&&(i=$.certificateFromPem(i));var o=ce.md.sha1.create();o.update(m.toDer($.certificateToAsn1(i)).getBytes()),n=o.digest().getBytes()}else n=ce.random.getBytes(20);var l=[];n!==null&&l.push(m.create(m.Class.UNIVERSAL,m.Type.SEQUENCE,!0,[m.create(m.Class.UNIVERSAL,m.Type.OID,!1,m.oidToDer($.oids.localKeyId).getBytes()),m.create(m.Class.UNIVERSAL,m.Type.SET,!0,[m.create(m.Class.UNIVERSAL,m.Type.OCTETSTRING,!1,n)])])),"friendlyName"in r&&l.push(m.create(m.Class.UNIVERSAL,m.Type.SEQUENCE,!0,[m.create(m.Class.UNIVERSAL,m.Type.OID,!1,m.oidToDer($.oids.friendlyName).getBytes()),m.create(m.Class.UNIVERSAL,m.Type.SET,!0,[m.create(m.Class.UNIVERSAL,m.Type.BMPSTRING,!1,r.friendlyName)])])),l.length>0&&(s=m.create(m.Class.UNIVERSAL,m.Type.SET,!0,l));var u=[],f=[];t!==null&&(ce.util.isArray(t)?f=t:f=[t]);for(var c=[],v=0;v<f.length;++v){t=f[v],typeof t=="string"&&(t=$.certificateFromPem(t));var g=v===0?s:void 0,y=$.certificateToAsn1(t),x=m.create(m.Class.UNIVERSAL,m.Type.SEQUENCE,!0,[m.create(m.Class.UNIVERSAL,m.Type.OID,!1,m.oidToDer($.oids.certBag).getBytes()),m.create(m.Class.CONTEXT_SPECIFIC,0,!0,[m.create(m.Class.UNIVERSAL,m.Type.SEQUENCE,!0,[m.create(m.Class.UNIVERSAL,m.Type.OID,!1,m.oidToDer($.oids.x509Certificate).getBytes()),m.create(m.Class.CONTEXT_SPECIFIC,0,!0,[m.create(m.Class.UNIVERSAL,m.Type.OCTETSTRING,!1,m.toDer(y).getBytes())])])]),g]);c.push(x)}if(c.length>0){var S=m.create(m.Class.UNIVERSAL,m.Type.SEQUENCE,!0,c),I=m.create(m.Class.UNIVERSAL,m.Type.SEQUENCE,!0,[m.create(m.Class.UNIVERSAL,m.Type.OID,!1,m.oidToDer($.oids.data).getBytes()),m.create(m.Class.CONTEXT_SPECIFIC,0,!0,[m.create(m.Class.UNIVERSAL,m.Type.OCTETSTRING,!1,m.toDer(S).getBytes())])]);u.push(I)}var B=null;if(e!==null){var b=$.wrapRsaPrivateKey($.privateKeyToAsn1(e));a===null?B=m.create(m.Class.UNIVERSAL,m.Type.SEQUENCE,!0,[m.create(m.Class.UNIVERSAL,m.Type.OID,!1,m.oidToDer($.oids.keyBag).getBytes()),m.create(m.Class.CONTEXT_SPECIFIC,0,!0,[b]),s]):B=m.create(m.Class.UNIVERSAL,m.Type.SEQUENCE,!0,[m.create(m.Class.UNIVERSAL,m.Type.OID,!1,m.oidToDer($.oids.pkcs8ShroudedKeyBag).getBytes()),m.create(m.Class.CONTEXT_SPECIFIC,0,!0,[$.encryptPrivateKeyInfo(b,a,r)]),s]);var U=m.create(m.Class.UNIVERSAL,m.Type.SEQUENCE,!0,[B]),L=m.create(m.Class.UNIVERSAL,m.Type.SEQUENCE,!0,[m.create(m.Class.UNIVERSAL,m.Type.OID,!1,m.oidToDer($.oids.data).getBytes()),m.create(m.Class.CONTEXT_SPECIFIC,0,!0,[m.create(m.Class.UNIVERSAL,m.Type.OCTETSTRING,!1,m.toDer(U).getBytes())])]);u.push(L)}var w=m.create(m.Class.UNIVERSAL,m.Type.SEQUENCE,!0,u),z;if(r.useMac){var o=ce.md.sha1.create(),G=new ce.util.ByteBuffer(ce.random.getBytes(r.saltSize)),j=r.count,e=Tr.generateKey(a,G,3,j,20),oe=ce.hmac.create();oe.start(o,e),oe.update(m.toDer(w).getBytes());var ue=oe.getMac();z=m.create(m.Class.UNIVERSAL,m.Type.SEQUENCE,!0,[m.create(m.Class.UNIVERSAL,m.Type.SEQUENCE,!0,[m.create(m.Class.UNIVERSAL,m.Type.SEQUENCE,!0,[m.create(m.Class.UNIVERSAL,m.Type.OID,!1,m.oidToDer($.oids.sha1).getBytes()),m.create(m.Class.UNIVERSAL,m.Type.NULL,!1,"")]),m.create(m.Class.UNIVERSAL,m.Type.OCTETSTRING,!1,ue.getBytes())]),m.create(m.Class.UNIVERSAL,m.Type.OCTETSTRING,!1,G.getBytes()),m.create(m.Class.UNIVERSAL,m.Type.INTEGER,!1,m.integerToDer(j).getBytes())])}return m.create(m.Class.UNIVERSAL,m.Type.SEQUENCE,!0,[m.create(m.Class.UNIVERSAL,m.Type.INTEGER,!1,m.integerToDer(3).getBytes()),m.create(m.Class.UNIVERSAL,m.Type.SEQUENCE,!0,[m.create(m.Class.UNIVERSAL,m.Type.OID,!1,m.oidToDer($.oids.data).getBytes()),m.create(m.Class.CONTEXT_SPECIFIC,0,!0,[m.create(m.Class.UNIVERSAL,m.Type.OCTETSTRING,!1,m.toDer(w).getBytes())])]),z])};Tr.generateKey=ce.pbe.generatePkcs12Key});var Ya=M((Rc,Zi)=>{var wt=X();st();bt();Fa();Kt();Qr();za();Jr();xr();ne();ra();var Qa=wt.asn1,or=Zi.exports=wt.pki=wt.pki||{};or.pemToDer=function(e){var t=wt.pem.decode(e)[0];if(t.procType&&t.procType.type==="ENCRYPTED")throw new Error("Could not convert PEM to DER; PEM is encrypted.");return wt.util.createBuffer(t.body)};or.privateKeyFromPem=function(e){var t=wt.pem.decode(e)[0];if(t.type!=="PRIVATE KEY"&&t.type!=="RSA PRIVATE KEY"){var a=new Error('Could not convert private key from PEM; PEM header type is not "PRIVATE KEY" or "RSA PRIVATE KEY".');throw a.headerType=t.type,a}if(t.procType&&t.procType.type==="ENCRYPTED")throw new Error("Could not convert private key from PEM; PEM is encrypted.");var r=Qa.fromDer(t.body);return or.privateKeyFromAsn1(r)};or.privateKeyToPem=function(e,t){var a={type:"RSA PRIVATE KEY",body:Qa.toDer(or.privateKeyToAsn1(e)).getBytes()};return wt.pem.encode(a,{maxline:t})};or.privateKeyInfoToPem=function(e,t){var a={type:"PRIVATE KEY",body:Qa.toDer(e).getBytes()};return wt.pem.encode(a,{maxline:t})}});var Ja=M((wc,ss)=>{var N=X();st();Jt();Mr();Kt();Ya();Je();ar();ne();var sa=function(e,t,a,r){var n=N.util.createBuffer(),s=e.length>>1,i=s+(e.length&1),o=e.substr(0,i),l=e.substr(s,i),u=N.util.createBuffer(),f=N.hmac.create();a=t+a;var c=Math.ceil(r/16),v=Math.ceil(r/20);f.start("MD5",o);var g=N.util.createBuffer();u.putBytes(a);for(var y=0;y<c;++y)f.start(null,null),f.update(u.getBytes()),u.putBuffer(f.digest()),f.start(null,null),f.update(u.bytes()+a),g.putBuffer(f.digest());f.start("SHA1",l);var x=N.util.createBuffer();u.clear(),u.putBytes(a);for(var y=0;y<v;++y)f.start(null,null),f.update(u.getBytes()),u.putBuffer(f.digest()),f.start(null,null),f.update(u.bytes()+a),x.putBuffer(f.digest());return n.putBytes(N.util.xorBytes(g.getBytes(),x.getBytes(),r)),n},pl=function(e,t,a){var r=N.hmac.create();r.start("SHA1",e);var n=N.util.createBuffer();return n.putInt32(t[0]),n.putInt32(t[1]),n.putByte(a.type),n.putByte(a.version.major),n.putByte(a.version.minor),n.putInt16(a.length),n.putBytes(a.fragment.bytes()),r.update(n.getBytes()),r.digest().getBytes()},vl=function(e,t,a){var r=!1;try{var n=e.deflate(t.fragment.getBytes());t.fragment=N.util.createBuffer(n),t.length=n.length,r=!0}catch{}return r},yl=function(e,t,a){var r=!1;try{var n=e.inflate(t.fragment.getBytes());t.fragment=N.util.createBuffer(n),t.length=n.length,r=!0}catch{}return r},je=function(e,t){var a=0;switch(t){case 1:a=e.getByte();break;case 2:a=e.getInt16();break;case 3:a=e.getInt24();break;case 4:a=e.getInt32();break}return N.util.createBuffer(e.getBytes(a))},at=function(e,t,a){e.putInt(a.length(),t<<3),e.putBuffer(a)},p={};p.Versions={TLS_1_0:{major:3,minor:1},TLS_1_1:{major:3,minor:2},TLS_1_2:{major:3,minor:3}};p.SupportedVersions=[p.Versions.TLS_1_1,p.Versions.TLS_1_0];p.Version=p.SupportedVersions[0];p.MaxFragment=15360;p.ConnectionEnd={server:0,client:1};p.PRFAlgorithm={tls_prf_sha256:0};p.BulkCipherAlgorithm={none:null,rc4:0,des3:1,aes:2};p.CipherType={stream:0,block:1,aead:2};p.MACAlgorithm={none:null,hmac_md5:0,hmac_sha1:1,hmac_sha256:2,hmac_sha384:3,hmac_sha512:4};p.CompressionMethod={none:0,deflate:1};p.ContentType={change_cipher_spec:20,alert:21,handshake:22,application_data:23,heartbeat:24};p.HandshakeType={hello_request:0,client_hello:1,server_hello:2,certificate:11,server_key_exchange:12,certificate_request:13,server_hello_done:14,certificate_verify:15,client_key_exchange:16,finished:20};p.Alert={};p.Alert.Level={warning:1,fatal:2};p.Alert.Description={close_notify:0,unexpected_message:10,bad_record_mac:20,decryption_failed:21,record_overflow:22,decompression_failure:30,handshake_failure:40,bad_certificate:42,unsupported_certificate:43,certificate_revoked:44,certificate_expired:45,certificate_unknown:46,illegal_parameter:47,unknown_ca:48,access_denied:49,decode_error:50,decrypt_error:51,export_restriction:60,protocol_version:70,insufficient_security:71,internal_error:80,user_canceled:90,no_renegotiation:100};p.HeartbeatMessageType={heartbeat_request:1,heartbeat_response:2};p.CipherSuites={};p.getCipherSuite=function(e){var t=null;for(var a in p.CipherSuites){var r=p.CipherSuites[a];if(r.id[0]===e.charCodeAt(0)&&r.id[1]===e.charCodeAt(1)){t=r;break}}return t};p.handleUnexpected=function(e,t){var a=!e.open&&e.entity===p.ConnectionEnd.client;a||e.error(e,{message:"Unexpected message. Received TLS record out of order.",send:!0,alert:{level:p.Alert.Level.fatal,description:p.Alert.Description.unexpected_message}})};p.handleHelloRequest=function(e,t,a){!e.handshaking&&e.handshakes>0&&(p.queue(e,p.createAlert(e,{level:p.Alert.Level.warning,description:p.Alert.Description.no_renegotiation})),p.flush(e)),e.process()};p.parseHelloMessage=function(e,t,a){var r=null,n=e.entity===p.ConnectionEnd.client;if(a<38)e.error(e,{message:n?"Invalid ServerHello message. Message too short.":"Invalid ClientHello message. Message too short.",send:!0,alert:{level:p.Alert.Level.fatal,description:p.Alert.Description.illegal_parameter}});else{var s=t.fragment,i=s.length();if(r={version:{major:s.getByte(),minor:s.getByte()},random:N.util.createBuffer(s.getBytes(32)),session_id:je(s,1),extensions:[]},n?(r.cipher_suite=s.getBytes(2),r.compression_method=s.getByte()):(r.cipher_suites=je(s,2),r.compression_methods=je(s,1)),i=a-(i-s.length()),i>0){for(var o=je(s,2);o.length()>0;)r.extensions.push({type:[o.getByte(),o.getByte()],data:je(o,2)});if(!n)for(var l=0;l<r.extensions.length;++l){var u=r.extensions[l];if(u.type[0]===0&&u.type[1]===0)for(var f=je(u.data,2);f.length()>0;){var c=f.getByte();if(c!==0)break;e.session.extensions.server_name.serverNameList.push(je(f,2).getBytes())}}}if(e.session.version&&(r.version.major!==e.session.version.major||r.version.minor!==e.session.version.minor))return e.error(e,{message:"TLS version change is disallowed during renegotiation.",send:!0,alert:{level:p.Alert.Level.fatal,description:p.Alert.Description.protocol_version}});if(n)e.session.cipherSuite=p.getCipherSuite(r.cipher_suite);else for(var v=N.util.createBuffer(r.cipher_suites.bytes());v.length()>0&&(e.session.cipherSuite=p.getCipherSuite(v.getBytes(2)),e.session.cipherSuite===null););if(e.session.cipherSuite===null)return e.error(e,{message:"No cipher suites in common.",send:!0,alert:{level:p.Alert.Level.fatal,description:p.Alert.Description.handshake_failure},cipherSuite:N.util.bytesToHex(r.cipher_suite)});n?e.session.compressionMethod=r.compression_method:e.session.compressionMethod=p.CompressionMethod.none}return r};p.createSecurityParameters=function(e,t){var a=e.entity===p.ConnectionEnd.client,r=t.random.bytes(),n=a?e.session.sp.client_random:r,s=a?r:p.createRandom().getBytes();e.session.sp={entity:e.entity,prf_algorithm:p.PRFAlgorithm.tls_prf_sha256,bulk_cipher_algorithm:null,cipher_type:null,enc_key_length:null,block_length:null,fixed_iv_length:null,record_iv_length:null,mac_algorithm:null,mac_length:null,mac_key_length:null,compression_algorithm:e.session.compressionMethod,pre_master_secret:null,master_secret:null,client_random:n,server_random:s}};p.handleServerHello=function(e,t,a){var r=p.parseHelloMessage(e,t,a);if(!e.fail){if(r.version.minor<=e.version.minor)e.version.minor=r.version.minor;else return e.error(e,{message:"Incompatible TLS version.",send:!0,alert:{level:p.Alert.Level.fatal,description:p.Alert.Description.protocol_version}});e.session.version=e.version;var n=r.session_id.bytes();n.length>0&&n===e.session.id?(e.expect=ts,e.session.resuming=!0,e.session.sp.server_random=r.random.bytes()):(e.expect=ml,e.session.resuming=!1,p.createSecurityParameters(e,r)),e.session.id=n,e.process()}};p.handleClientHello=function(e,t,a){var r=p.parseHelloMessage(e,t,a);if(!e.fail){var n=r.session_id.bytes(),s=null;if(e.sessionCache&&(s=e.sessionCache.getSession(n),s===null?n="":(s.version.major!==r.version.major||s.version.minor>r.version.minor)&&(s=null,n="")),n.length===0&&(n=N.random.getBytes(32)),e.session.id=n,e.session.clientHelloVersion=r.version,e.session.sp={},s)e.version=e.session.version=s.version,e.session.sp=s.sp;else{for(var i,o=1;o<p.SupportedVersions.length&&(i=p.SupportedVersions[o],!(i.minor<=r.version.minor));++o);e.version={major:i.major,minor:i.minor},e.session.version=e.version}s!==null?(e.expect=$a,e.session.resuming=!0,e.session.sp.client_random=r.random.bytes()):(e.expect=e.verifyClient!==!1?Al:Wa,e.session.resuming=!1,p.createSecurityParameters(e,r)),e.open=!0,p.queue(e,p.createRecord(e,{type:p.ContentType.handshake,data:p.createServerHello(e)})),e.session.resuming?(p.queue(e,p.createRecord(e,{type:p.ContentType.change_cipher_spec,data:p.createChangeCipherSpec()})),e.state.pending=p.createConnectionState(e),e.state.current.write=e.state.pending.write,p.queue(e,p.createRecord(e,{type:p.ContentType.handshake,data:p.createFinished(e)}))):(p.queue(e,p.createRecord(e,{type:p.ContentType.handshake,data:p.createCertificate(e)})),e.fail||(p.queue(e,p.createRecord(e,{type:p.ContentType.handshake,data:p.createServerKeyExchange(e)})),e.verifyClient!==!1&&p.queue(e,p.createRecord(e,{type:p.ContentType.handshake,data:p.createCertificateRequest(e)})),p.queue(e,p.createRecord(e,{type:p.ContentType.handshake,data:p.createServerHelloDone(e)})))),p.flush(e),e.process()}};p.handleCertificate=function(e,t,a){if(a<3)return e.error(e,{message:"Invalid Certificate message. Message too short.",send:!0,alert:{level:p.Alert.Level.fatal,description:p.Alert.Description.illegal_parameter}});var r=t.fragment,n={certificate_list:je(r,3)},s,i,o=[];try{for(;n.certificate_list.length()>0;)s=je(n.certificate_list,3),i=N.asn1.fromDer(s),s=N.pki.certificateFromAsn1(i,!0),o.push(s)}catch(u){return e.error(e,{message:"Could not parse certificate list.",cause:u,send:!0,alert:{level:p.Alert.Level.fatal,description:p.Alert.Description.bad_certificate}})}var l=e.entity===p.ConnectionEnd.client;(l||e.verifyClient===!0)&&o.length===0?e.error(e,{message:l?"No server certificate provided.":"No client certificate provided.",send:!0,alert:{level:p.Alert.Level.fatal,description:p.Alert.Description.illegal_parameter}}):o.length===0?e.expect=l?Ji:Wa:(l?e.session.serverCertificate=o[0]:e.session.clientCertificate=o[0],p.verifyCertificateChain(e,o)&&(e.expect=l?Ji:Wa)),e.process()};p.handleServerKeyExchange=function(e,t,a){if(a>0)return e.error(e,{message:"Invalid key parameters. Only RSA is supported.",send:!0,alert:{level:p.Alert.Level.fatal,description:p.Alert.Description.unsupported_certificate}});e.expect=Cl,e.process()};p.handleClientKeyExchange=function(e,t,a){if(a<48)return e.error(e,{message:"Invalid key parameters. Only RSA is supported.",send:!0,alert:{level:p.Alert.Level.fatal,description:p.Alert.Description.unsupported_certificate}});var r=t.fragment,n={enc_pre_master_secret:je(r,2).getBytes()},s=null;if(e.getPrivateKey)try{s=e.getPrivateKey(e,e.session.serverCertificate),s=N.pki.privateKeyFromPem(s)}catch(l){e.error(e,{message:"Could not get private key.",cause:l,send:!0,alert:{level:p.Alert.Level.fatal,description:p.Alert.Description.internal_error}})}if(s===null)return e.error(e,{message:"No private key set.",send:!0,alert:{level:p.Alert.Level.fatal,description:p.Alert.Description.internal_error}});try{var i=e.session.sp;i.pre_master_secret=s.decrypt(n.enc_pre_master_secret);var o=e.session.clientHelloVersion;if(o.major!==i.pre_master_secret.charCodeAt(0)||o.minor!==i.pre_master_secret.charCodeAt(1))throw new Error("TLS version rollback attack detected.")}catch{i.pre_master_secret=N.random.getBytes(48)}e.expect=$a,e.session.clientCertificate!==null&&(e.expect=Bl),e.process()};p.handleCertificateRequest=function(e,t,a){if(a<3)return e.error(e,{message:"Invalid CertificateRequest. Message too short.",send:!0,alert:{level:p.Alert.Level.fatal,description:p.Alert.Description.illegal_parameter}});var r=t.fragment,n={certificate_types:je(r,1),certificate_authorities:je(r,2)};e.session.certificateRequest=n,e.expect=El,e.process()};p.handleCertificateVerify=function(e,t,a){if(a<2)return e.error(e,{message:"Invalid CertificateVerify. Message too short.",send:!0,alert:{level:p.Alert.Level.fatal,description:p.Alert.Description.illegal_parameter}});var r=t.fragment;r.read-=4;var n=r.bytes();r.read+=4;var s={signature:je(r,2).getBytes()},i=N.util.createBuffer();i.putBuffer(e.session.md5.digest()),i.putBuffer(e.session.sha1.digest()),i=i.getBytes();try{var o=e.session.clientCertificate;if(!o.publicKey.verify(i,s.signature,"NONE"))throw new Error("CertificateVerify signature does not match.");e.session.md5.update(n),e.session.sha1.update(n)}catch{return e.error(e,{message:"Bad signature in CertificateVerify.",send:!0,alert:{level:p.Alert.Level.fatal,description:p.Alert.Description.handshake_failure}})}e.expect=$a,e.process()};p.handleServerHelloDone=function(e,t,a){if(a>0)return e.error(e,{message:"Invalid ServerHelloDone message. Invalid length.",send:!0,alert:{level:p.Alert.Level.fatal,description:p.Alert.Description.record_overflow}});if(e.serverCertificate===null){var r={message:"No server certificate provided. Not enough security.",send:!0,alert:{level:p.Alert.Level.fatal,description:p.Alert.Description.insufficient_security}},n=0,s=e.verify(e,r.alert.description,n,[]);if(s!==!0)return(s||s===0)&&(typeof s=="object"&&!N.util.isArray(s)?(s.message&&(r.message=s.message),s.alert&&(r.alert.description=s.alert)):typeof s=="number"&&(r.alert.description=s)),e.error(e,r)}e.session.certificateRequest!==null&&(t=p.createRecord(e,{type:p.ContentType.handshake,data:p.createCertificate(e)}),p.queue(e,t)),t=p.createRecord(e,{type:p.ContentType.handshake,data:p.createClientKeyExchange(e)}),p.queue(e,t),e.expect=Tl;var i=function(o,l){o.session.certificateRequest!==null&&o.session.clientCertificate!==null&&p.queue(o,p.createRecord(o,{type:p.ContentType.handshake,data:p.createCertificateVerify(o,l)})),p.queue(o,p.createRecord(o,{type:p.ContentType.change_cipher_spec,data:p.createChangeCipherSpec()})),o.state.pending=p.createConnectionState(o),o.state.current.write=o.state.pending.write,p.queue(o,p.createRecord(o,{type:p.ContentType.handshake,data:p.createFinished(o)})),o.expect=ts,p.flush(o),o.process()};if(e.session.certificateRequest===null||e.session.clientCertificate===null)return i(e,null);p.getClientSignature(e,i)};p.handleChangeCipherSpec=function(e,t){if(t.fragment.getByte()!==1)return e.error(e,{message:"Invalid ChangeCipherSpec message received.",send:!0,alert:{level:p.Alert.Level.fatal,description:p.Alert.Description.illegal_parameter}});var a=e.entity===p.ConnectionEnd.client;(e.session.resuming&&a||!e.session.resuming&&!a)&&(e.state.pending=p.createConnectionState(e)),e.state.current.read=e.state.pending.read,(!e.session.resuming&&a||e.session.resuming&&!a)&&(e.state.pending=null),e.expect=a?xl:bl,e.process()};p.handleFinished=function(e,t,a){var r=t.fragment;r.read-=4;var n=r.bytes();r.read+=4;var s=t.fragment.getBytes();r=N.util.createBuffer(),r.putBuffer(e.session.md5.digest()),r.putBuffer(e.session.sha1.digest());var i=e.entity===p.ConnectionEnd.client,o=i?"server finished":"client finished",l=e.session.sp,u=12,f=sa;if(r=f(l.master_secret,o,r.getBytes(),u),r.getBytes()!==s)return e.error(e,{message:"Invalid verify_data in Finished message.",send:!0,alert:{level:p.Alert.Level.fatal,description:p.Alert.Description.decrypt_error}});e.session.md5.update(n),e.session.sha1.update(n),(e.session.resuming&&i||!e.session.resuming&&!i)&&(p.queue(e,p.createRecord(e,{type:p.ContentType.change_cipher_spec,data:p.createChangeCipherSpec()})),e.state.current.write=e.state.pending.write,e.state.pending=null,p.queue(e,p.createRecord(e,{type:p.ContentType.handshake,data:p.createFinished(e)}))),e.expect=i?Sl:_l,e.handshaking=!1,++e.handshakes,e.peerCertificate=i?e.session.serverCertificate:e.session.clientCertificate,p.flush(e),e.isConnected=!0,e.connected(e),e.process()};p.handleAlert=function(e,t){var a=t.fragment,r={level:a.getByte(),description:a.getByte()},n;switch(r.description){case p.Alert.Description.close_notify:n="Connection closed.";break;case p.Alert.Description.unexpected_message:n="Unexpected message.";break;case p.Alert.Description.bad_record_mac:n="Bad record MAC.";break;case p.Alert.Description.decryption_failed:n="Decryption failed.";break;case p.Alert.Description.record_overflow:n="Record overflow.";break;case p.Alert.Description.decompression_failure:n="Decompression failed.";break;case p.Alert.Description.handshake_failure:n="Handshake failure.";break;case p.Alert.Description.bad_certificate:n="Bad certificate.";break;case p.Alert.Description.unsupported_certificate:n="Unsupported certificate.";break;case p.Alert.Description.certificate_revoked:n="Certificate revoked.";break;case p.Alert.Description.certificate_expired:n="Certificate expired.";break;case p.Alert.Description.certificate_unknown:n="Certificate unknown.";break;case p.Alert.Description.illegal_parameter:n="Illegal parameter.";break;case p.Alert.Description.unknown_ca:n="Unknown certificate authority.";break;case p.Alert.Description.access_denied:n="Access denied.";break;case p.Alert.Description.decode_error:n="Decode error.";break;case p.Alert.Description.decrypt_error:n="Decrypt error.";break;case p.Alert.Description.export_restriction:n="Export restriction.";break;case p.Alert.Description.protocol_version:n="Unsupported protocol version.";break;case p.Alert.Description.insufficient_security:n="Insufficient security.";break;case p.Alert.Description.internal_error:n="Internal error.";break;case p.Alert.Description.user_canceled:n="User canceled.";break;case p.Alert.Description.no_renegotiation:n="Renegotiation not supported.";break;default:n="Unknown error.";break}if(r.description===p.Alert.Description.close_notify)return e.close();e.error(e,{message:n,send:!1,origin:e.entity===p.ConnectionEnd.client?"server":"client",alert:r}),e.process()};p.handleHandshake=function(e,t){var a=t.fragment,r=a.getByte(),n=a.getInt24();if(n>a.length())return e.fragmented=t,t.fragment=N.util.createBuffer(),a.read-=4,e.process();e.fragmented=null,a.read-=4;var s=a.bytes(n+4);a.read+=4,r in ia[e.entity][e.expect]?(e.entity===p.ConnectionEnd.server&&!e.open&&!e.fail&&(e.handshaking=!0,e.session={version:null,extensions:{server_name:{serverNameList:[]}},cipherSuite:null,compressionMethod:null,serverCertificate:null,clientCertificate:null,md5:N.md.md5.create(),sha1:N.md.sha1.create()}),r!==p.HandshakeType.hello_request&&r!==p.HandshakeType.certificate_verify&&r!==p.HandshakeType.finished&&(e.session.md5.update(s),e.session.sha1.update(s)),ia[e.entity][e.expect][r](e,t,n)):p.handleUnexpected(e,t)};p.handleApplicationData=function(e,t){e.data.putBuffer(t.fragment),e.dataReady(e),e.process()};p.handleHeartbeat=function(e,t){var a=t.fragment,r=a.getByte(),n=a.getInt16(),s=a.getBytes(n);if(r===p.HeartbeatMessageType.heartbeat_request){if(e.handshaking||n>s.length)return e.process();p.queue(e,p.createRecord(e,{type:p.ContentType.heartbeat,data:p.createHeartbeat(p.HeartbeatMessageType.heartbeat_response,s)})),p.flush(e)}else if(r===p.HeartbeatMessageType.heartbeat_response){if(s!==e.expectedHeartbeatPayload)return e.process();e.heartbeatReceived&&e.heartbeatReceived(e,N.util.createBuffer(s))}e.process()};var gl=0,ml=1,Ji=2,Cl=3,El=4,ts=5,xl=6,Sl=7,Tl=8,Il=0,Al=1,Wa=2,Bl=3,$a=4,bl=5,_l=6,d=p.handleUnexpected,rs=p.handleChangeCipherSpec,Be=p.handleAlert,ze=p.handleHandshake,as=p.handleApplicationData,be=p.handleHeartbeat,Za=[];Za[p.ConnectionEnd.client]=[[d,Be,ze,d,be],[d,Be,ze,d,be],[d,Be,ze,d,be],[d,Be,ze,d,be],[d,Be,ze,d,be],[rs,Be,d,d,be],[d,Be,ze,d,be],[d,Be,ze,as,be],[d,Be,ze,d,be]];Za[p.ConnectionEnd.server]=[[d,Be,ze,d,be],[d,Be,ze,d,be],[d,Be,ze,d,be],[d,Be,ze,d,be],[rs,Be,d,d,be],[d,Be,ze,d,be],[d,Be,ze,as,be],[d,Be,ze,d,be]];var Lt=p.handleHelloRequest,Nl=p.handleServerHello,ns=p.handleCertificate,es=p.handleServerKeyExchange,Xa=p.handleCertificateRequest,aa=p.handleServerHelloDone,is=p.handleFinished,ia=[];ia[p.ConnectionEnd.client]=[[d,d,Nl,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d],[Lt,d,d,d,d,d,d,d,d,d,d,ns,es,Xa,aa,d,d,d,d,d,d],[Lt,d,d,d,d,d,d,d,d,d,d,d,es,Xa,aa,d,d,d,d,d,d],[Lt,d,d,d,d,d,d,d,d,d,d,d,d,Xa,aa,d,d,d,d,d,d],[Lt,d,d,d,d,d,d,d,d,d,d,d,d,d,aa,d,d,d,d,d,d],[Lt,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d],[Lt,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,is],[Lt,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d],[Lt,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d]];var Rl=p.handleClientHello,wl=p.handleClientKeyExchange,Ll=p.handleCertificateVerify;ia[p.ConnectionEnd.server]=[[d,Rl,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d],[d,d,d,d,d,d,d,d,d,d,d,ns,d,d,d,d,d,d,d,d,d],[d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,wl,d,d,d,d],[d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,Ll,d,d,d,d,d],[d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d],[d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,is],[d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d],[d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d]];p.generateKeys=function(e,t){var a=sa,r=t.client_random+t.server_random;e.session.resuming||(t.master_secret=a(t.pre_master_secret,"master secret",r,48).bytes(),t.pre_master_secret=null),r=t.server_random+t.client_random;var n=2*t.mac_key_length+2*t.enc_key_length,s=e.version.major===p.Versions.TLS_1_0.major&&e.version.minor===p.Versions.TLS_1_0.minor;s&&(n+=2*t.fixed_iv_length);var i=a(t.master_secret,"key expansion",r,n),o={client_write_MAC_key:i.getBytes(t.mac_key_length),server_write_MAC_key:i.getBytes(t.mac_key_length),client_write_key:i.getBytes(t.enc_key_length),server_write_key:i.getBytes(t.enc_key_length)};return s&&(o.client_write_IV=i.getBytes(t.fixed_iv_length),o.server_write_IV=i.getBytes(t.fixed_iv_length)),o};p.createConnectionState=function(e){var t=e.entity===p.ConnectionEnd.client,a=function(){var s={sequenceNumber:[0,0],macKey:null,macLength:0,macFunction:null,cipherState:null,cipherFunction:function(i){return!0},compressionState:null,compressFunction:function(i){return!0},updateSequenceNumber:function(){s.sequenceNumber[1]===4294967295?(s.sequenceNumber[1]=0,++s.sequenceNumber[0]):++s.sequenceNumber[1]}};return s},r={read:a(),write:a()};if(r.read.update=function(s,i){return r.read.cipherFunction(i,r.read)?r.read.compressFunction(s,i,r.read)||s.error(s,{message:"Could not decompress record.",send:!0,alert:{level:p.Alert.Level.fatal,description:p.Alert.Description.decompression_failure}}):s.error(s,{message:"Could not decrypt record or bad MAC.",send:!0,alert:{level:p.Alert.Level.fatal,description:p.Alert.Description.bad_record_mac}}),!s.fail},r.write.update=function(s,i){return r.write.compressFunction(s,i,r.write)?r.write.cipherFunction(i,r.write)||s.error(s,{message:"Could not encrypt record.",send:!1,alert:{level:p.Alert.Level.fatal,description:p.Alert.Description.internal_error}}):s.error(s,{message:"Could not compress record.",send:!1,alert:{level:p.Alert.Level.fatal,description:p.Alert.Description.internal_error}}),!s.fail},e.session){var n=e.session.sp;switch(e.session.cipherSuite.initSecurityParameters(n),n.keys=p.generateKeys(e,n),r.read.macKey=t?n.keys.server_write_MAC_key:n.keys.client_write_MAC_key,r.write.macKey=t?n.keys.client_write_MAC_key:n.keys.server_write_MAC_key,e.session.cipherSuite.initConnectionState(r,e,n),n.compression_algorithm){case p.CompressionMethod.none:break;case p.CompressionMethod.deflate:r.read.compressFunction=yl,r.write.compressFunction=vl;break;default:throw new Error("Unsupported compression algorithm.")}}return r};p.createRandom=function(){var e=new Date,t=+e+e.getTimezoneOffset()*6e4,a=N.util.createBuffer();return a.putInt32(t),a.putBytes(N.random.getBytes(28)),a};p.createRecord=function(e,t){if(!t.data)return null;var a={type:t.type,version:{major:e.version.major,minor:e.version.minor},length:t.data.length(),fragment:t.data};return a};p.createAlert=function(e,t){var a=N.util.createBuffer();return a.putByte(t.level),a.putByte(t.description),p.createRecord(e,{type:p.ContentType.alert,data:a})};p.createClientHello=function(e){e.session.clientHelloVersion={major:e.version.major,minor:e.version.minor};for(var t=N.util.createBuffer(),a=0;a<e.cipherSuites.length;++a){var r=e.cipherSuites[a];t.putByte(r.id[0]),t.putByte(r.id[1])}var n=t.length(),s=N.util.createBuffer();s.putByte(p.CompressionMethod.none);var i=s.length(),o=N.util.createBuffer();if(e.virtualHost){var l=N.util.createBuffer();l.putByte(0),l.putByte(0);var u=N.util.createBuffer();u.putByte(0),at(u,2,N.util.createBuffer(e.virtualHost));var f=N.util.createBuffer();at(f,2,u),at(l,2,f),o.putBuffer(l)}var c=o.length();c>0&&(c+=2);var v=e.session.id,g=v.length+1+2+4+28+2+n+1+i+c,y=N.util.createBuffer();return y.putByte(p.HandshakeType.client_hello),y.putInt24(g),y.putByte(e.version.major),y.putByte(e.version.minor),y.putBytes(e.session.sp.client_random),at(y,1,N.util.createBuffer(v)),at(y,2,t),at(y,1,s),c>0&&at(y,2,o),y};p.createServerHello=function(e){var t=e.session.id,a=t.length+1+2+4+28+2+1,r=N.util.createBuffer();return r.putByte(p.HandshakeType.server_hello),r.putInt24(a),r.putByte(e.version.major),r.putByte(e.version.minor),r.putBytes(e.session.sp.server_random),at(r,1,N.util.createBuffer(t)),r.putByte(e.session.cipherSuite.id[0]),r.putByte(e.session.cipherSuite.id[1]),r.putByte(e.session.compressionMethod),r};p.createCertificate=function(e){var t=e.entity===p.ConnectionEnd.client,a=null;if(e.getCertificate){var r;t?r=e.session.certificateRequest:r=e.session.extensions.server_name.serverNameList,a=e.getCertificate(e,r)}var n=N.util.createBuffer();if(a!==null)try{N.util.isArray(a)||(a=[a]);for(var s=null,i=0;i<a.length;++i){var o=N.pem.decode(a[i])[0];if(o.type!=="CERTIFICATE"&&o.type!=="X509 CERTIFICATE"&&o.type!=="TRUSTED CERTIFICATE"){var l=new Error('Could not convert certificate from PEM; PEM header type is not "CERTIFICATE", "X509 CERTIFICATE", or "TRUSTED CERTIFICATE".');throw l.headerType=o.type,l}if(o.procType&&o.procType.type==="ENCRYPTED")throw new Error("Could not convert certificate from PEM; PEM is encrypted.");var u=N.util.createBuffer(o.body);s===null&&(s=N.asn1.fromDer(u.bytes(),!1));var f=N.util.createBuffer();at(f,3,u),n.putBuffer(f)}a=N.pki.certificateFromAsn1(s),t?e.session.clientCertificate=a:e.session.serverCertificate=a}catch(g){return e.error(e,{message:"Could not send certificate list.",cause:g,send:!0,alert:{level:p.Alert.Level.fatal,description:p.Alert.Description.bad_certificate}})}var c=3+n.length(),v=N.util.createBuffer();return v.putByte(p.HandshakeType.certificate),v.putInt24(c),at(v,3,n),v};p.createClientKeyExchange=function(e){var t=N.util.createBuffer();t.putByte(e.session.clientHelloVersion.major),t.putByte(e.session.clientHelloVersion.minor),t.putBytes(N.random.getBytes(46));var a=e.session.sp;a.pre_master_secret=t.getBytes();var r=e.session.serverCertificate.publicKey;t=r.encrypt(a.pre_master_secret);var n=t.length+2,s=N.util.createBuffer();return s.putByte(p.HandshakeType.client_key_exchange),s.putInt24(n),s.putInt16(t.length),s.putBytes(t),s};p.createServerKeyExchange=function(e){var t=0,a=N.util.createBuffer();return t>0&&(a.putByte(p.HandshakeType.server_key_exchange),a.putInt24(t)),a};p.getClientSignature=function(e,t){var a=N.util.createBuffer();a.putBuffer(e.session.md5.digest()),a.putBuffer(e.session.sha1.digest()),a=a.getBytes(),e.getSignature=e.getSignature||function(r,n,s){var i=null;if(r.getPrivateKey)try{i=r.getPrivateKey(r,r.session.clientCertificate),i=N.pki.privateKeyFromPem(i)}catch(o){r.error(r,{message:"Could not get private key.",cause:o,send:!0,alert:{level:p.Alert.Level.fatal,description:p.Alert.Description.internal_error}})}i===null?r.error(r,{message:"No private key set.",send:!0,alert:{level:p.Alert.Level.fatal,description:p.Alert.Description.internal_error}}):n=i.sign(n,null),s(r,n)},e.getSignature(e,a,t)};p.createCertificateVerify=function(e,t){var a=t.length+2,r=N.util.createBuffer();return r.putByte(p.HandshakeType.certificate_verify),r.putInt24(a),r.putInt16(t.length),r.putBytes(t),r};p.createCertificateRequest=function(e){var t=N.util.createBuffer();t.putByte(1);var a=N.util.createBuffer();for(var r in e.caStore.certs){var n=e.caStore.certs[r],s=N.pki.distinguishedNameToAsn1(n.subject),i=N.asn1.toDer(s);a.putInt16(i.length()),a.putBuffer(i)}var o=1+t.length()+2+a.length(),l=N.util.createBuffer();return l.putByte(p.HandshakeType.certificate_request),l.putInt24(o),at(l,1,t),at(l,2,a),l};p.createServerHelloDone=function(e){var t=N.util.createBuffer();return t.putByte(p.HandshakeType.server_hello_done),t.putInt24(0),t};p.createChangeCipherSpec=function(){var e=N.util.createBuffer();return e.putByte(1),e};p.createFinished=function(e){var t=N.util.createBuffer();t.putBuffer(e.session.md5.digest()),t.putBuffer(e.session.sha1.digest());var a=e.entity===p.ConnectionEnd.client,r=e.session.sp,n=12,s=sa,i=a?"client finished":"server finished";t=s(r.master_secret,i,t.getBytes(),n);var o=N.util.createBuffer();return o.putByte(p.HandshakeType.finished),o.putInt24(t.length()),o.putBuffer(t),o};p.createHeartbeat=function(e,t,a){typeof a>"u"&&(a=t.length);var r=N.util.createBuffer();r.putByte(e),r.putInt16(a),r.putBytes(t);var n=r.length(),s=Math.max(16,n-a-3);return r.putBytes(N.random.getBytes(s)),r};p.queue=function(e,t){if(t&&!(t.fragment.length()===0&&(t.type===p.ContentType.handshake||t.type===p.ContentType.alert||t.type===p.ContentType.change_cipher_spec))){if(t.type===p.ContentType.handshake){var a=t.fragment.bytes();e.session.md5.update(a),e.session.sha1.update(a),a=null}var r;if(t.fragment.length()<=p.MaxFragment)r=[t];else{r=[];for(var n=t.fragment.bytes();n.length>p.MaxFragment;)r.push(p.createRecord(e,{type:t.type,data:N.util.createBuffer(n.slice(0,p.MaxFragment))})),n=n.slice(p.MaxFragment);n.length>0&&r.push(p.createRecord(e,{type:t.type,data:N.util.createBuffer(n)}))}for(var s=0;s<r.length&&!e.fail;++s){var i=r[s],o=e.state.current.write;o.update(e,i)&&e.records.push(i)}}};p.flush=function(e){for(var t=0;t<e.records.length;++t){var a=e.records[t];e.tlsData.putByte(a.type),e.tlsData.putByte(a.version.major),e.tlsData.putByte(a.version.minor),e.tlsData.putInt16(a.fragment.length()),e.tlsData.putBuffer(e.records[t].fragment)}return e.records=[],e.tlsDataReady(e)};var ja=function(e){switch(e){case!0:return!0;case N.pki.certificateError.bad_certificate:return p.Alert.Description.bad_certificate;case N.pki.certificateError.unsupported_certificate:return p.Alert.Description.unsupported_certificate;case N.pki.certificateError.certificate_revoked:return p.Alert.Description.certificate_revoked;case N.pki.certificateError.certificate_expired:return p.Alert.Description.certificate_expired;case N.pki.certificateError.certificate_unknown:return p.Alert.Description.certificate_unknown;case N.pki.certificateError.unknown_ca:return p.Alert.Description.unknown_ca;default:return p.Alert.Description.bad_certificate}},kl=function(e){switch(e){case!0:return!0;case p.Alert.Description.bad_certificate:return N.pki.certificateError.bad_certificate;case p.Alert.Description.unsupported_certificate:return N.pki.certificateError.unsupported_certificate;case p.Alert.Description.certificate_revoked:return N.pki.certificateError.certificate_revoked;case p.Alert.Description.certificate_expired:return N.pki.certificateError.certificate_expired;case p.Alert.Description.certificate_unknown:return N.pki.certificateError.certificate_unknown;case p.Alert.Description.unknown_ca:return N.pki.certificateError.unknown_ca;default:return N.pki.certificateError.bad_certificate}};p.verifyCertificateChain=function(e,t){try{var a={};for(var r in e.verifyOptions)a[r]=e.verifyOptions[r];a.verify=function(s,i,o){var l=ja(s),u=e.verify(e,s,i,o);if(u!==!0){if(typeof u=="object"&&!N.util.isArray(u)){var f=new Error("The application rejected the certificate.");throw f.send=!0,f.alert={level:p.Alert.Level.fatal,description:p.Alert.Description.bad_certificate},u.message&&(f.message=u.message),u.alert&&(f.alert.description=u.alert),f}u!==s&&(u=kl(u))}return u},N.pki.verifyCertificateChain(e.caStore,t,a)}catch(s){var n=s;(typeof n!="object"||N.util.isArray(n))&&(n={send:!0,alert:{level:p.Alert.Level.fatal,description:ja(s)}}),"send"in n||(n.send=!0),"alert"in n||(n.alert={level:p.Alert.Level.fatal,description:ja(n.error)}),e.error(e,n)}return!e.fail};p.createSessionCache=function(e,t){var a=null;if(e&&e.getSession&&e.setSession&&e.order)a=e;else{a={},a.cache=e||{},a.capacity=Math.max(t||100,1),a.order=[];for(var r in e)a.order.length<=t?a.order.push(r):delete e[r];a.getSession=function(n){var s=null,i=null;if(n?i=N.util.bytesToHex(n):a.order.length>0&&(i=a.order[0]),i!==null&&i in a.cache){s=a.cache[i],delete a.cache[i];for(var o in a.order)if(a.order[o]===i){a.order.splice(o,1);break}}return s},a.setSession=function(n,s){if(a.order.length===a.capacity){var i=a.order.shift();delete a.cache[i]}var i=N.util.bytesToHex(n);a.order.push(i),a.cache[i]=s}}return a};p.createConnection=function(e){var t=null;e.caStore?N.util.isArray(e.caStore)?t=N.pki.createCaStore(e.caStore):t=e.caStore:t=N.pki.createCaStore();var a=e.cipherSuites||null;if(a===null){a=[];for(var r in p.CipherSuites)a.push(p.CipherSuites[r])}var n=e.server?p.ConnectionEnd.server:p.ConnectionEnd.client,s=e.sessionCache?p.createSessionCache(e.sessionCache):null,i={version:{major:p.Version.major,minor:p.Version.minor},entity:n,sessionId:e.sessionId,caStore:t,sessionCache:s,cipherSuites:a,connected:e.connected,virtualHost:e.virtualHost||null,verifyClient:e.verifyClient||!1,verify:e.verify||function(f,c,v,g){return c},verifyOptions:e.verifyOptions||{},getCertificate:e.getCertificate||null,getPrivateKey:e.getPrivateKey||null,getSignature:e.getSignature||null,input:N.util.createBuffer(),tlsData:N.util.createBuffer(),data:N.util.createBuffer(),tlsDataReady:e.tlsDataReady,dataReady:e.dataReady,heartbeatReceived:e.heartbeatReceived,closed:e.closed,error:function(f,c){c.origin=c.origin||(f.entity===p.ConnectionEnd.client?"client":"server"),c.send&&(p.queue(f,p.createAlert(f,c.alert)),p.flush(f));var v=c.fatal!==!1;v&&(f.fail=!0),e.error(f,c),v&&f.close(!1)},deflate:e.deflate||null,inflate:e.inflate||null};i.reset=function(f){i.version={major:p.Version.major,minor:p.Version.minor},i.record=null,i.session=null,i.peerCertificate=null,i.state={pending:null,current:null},i.expect=i.entity===p.ConnectionEnd.client?gl:Il,i.fragmented=null,i.records=[],i.open=!1,i.handshakes=0,i.handshaking=!1,i.isConnected=!1,i.fail=!(f||typeof f>"u"),i.input.clear(),i.tlsData.clear(),i.data.clear(),i.state.current=p.createConnectionState(i)},i.reset();var o=function(f,c){var v=c.type-p.ContentType.change_cipher_spec,g=Za[f.entity][f.expect];v in g?g[v](f,c):p.handleUnexpected(f,c)},l=function(f){var c=0,v=f.input,g=v.length();if(g<5)c=5-g;else{f.record={type:v.getByte(),version:{major:v.getByte(),minor:v.getByte()},length:v.getInt16(),fragment:N.util.createBuffer(),ready:!1};var y=f.record.version.major===f.version.major;y&&f.session&&f.session.version&&(y=f.record.version.minor===f.version.minor),y||f.error(f,{message:"Incompatible TLS version.",send:!0,alert:{level:p.Alert.Level.fatal,description:p.Alert.Description.protocol_version}})}return c},u=function(f){var c=0,v=f.input,g=v.length();if(g<f.record.length)c=f.record.length-g;else{f.record.fragment.putBytes(v.getBytes(f.record.length)),v.compact();var y=f.state.current.read;y.update(f,f.record)&&(f.fragmented!==null&&(f.fragmented.type===f.record.type?(f.fragmented.fragment.putBuffer(f.record.fragment),f.record=f.fragmented):f.error(f,{message:"Invalid fragmented record.",send:!0,alert:{level:p.Alert.Level.fatal,description:p.Alert.Description.unexpected_message}})),f.record.ready=!0)}return c};return i.handshake=function(f){if(i.entity!==p.ConnectionEnd.client)i.error(i,{message:"Cannot initiate handshake as a server.",fatal:!1});else if(i.handshaking)i.error(i,{message:"Handshake already in progress.",fatal:!1});else{i.fail&&!i.open&&i.handshakes===0&&(i.fail=!1),i.handshaking=!0,f=f||"";var c=null;f.length>0&&(i.sessionCache&&(c=i.sessionCache.getSession(f)),c===null&&(f="")),f.length===0&&i.sessionCache&&(c=i.sessionCache.getSession(),c!==null&&(f=c.id)),i.session={id:f,version:null,cipherSuite:null,compressionMethod:null,serverCertificate:null,certificateRequest:null,clientCertificate:null,sp:{},md5:N.md.md5.create(),sha1:N.md.sha1.create()},c&&(i.version=c.version,i.session.sp=c.sp),i.session.sp.client_random=p.createRandom().getBytes(),i.open=!0,p.queue(i,p.createRecord(i,{type:p.ContentType.handshake,data:p.createClientHello(i)})),p.flush(i)}},i.process=function(f){var c=0;return f&&i.input.putBytes(f),i.fail||(i.record!==null&&i.record.ready&&i.record.fragment.isEmpty()&&(i.record=null),i.record===null&&(c=l(i)),!i.fail&&i.record!==null&&!i.record.ready&&(c=u(i)),!i.fail&&i.record!==null&&i.record.ready&&o(i,i.record)),c},i.prepare=function(f){return p.queue(i,p.createRecord(i,{type:p.ContentType.application_data,data:N.util.createBuffer(f)})),p.flush(i)},i.prepareHeartbeatRequest=function(f,c){return f instanceof N.util.ByteBuffer&&(f=f.bytes()),typeof c>"u"&&(c=f.length),i.expectedHeartbeatPayload=f,p.queue(i,p.createRecord(i,{type:p.ContentType.heartbeat,data:p.createHeartbeat(p.HeartbeatMessageType.heartbeat_request,f,c)})),p.flush(i)},i.close=function(f){if(!i.fail&&i.sessionCache&&i.session){var c={id:i.session.id,version:i.session.version,sp:i.session.sp};c.sp.keys=null,i.sessionCache.setSession(c.id,c)}i.open&&(i.open=!1,i.input.clear(),(i.isConnected||i.handshaking)&&(i.isConnected=i.handshaking=!1,p.queue(i,p.createAlert(i,{level:p.Alert.Level.warning,description:p.Alert.Description.close_notify})),p.flush(i)),i.closed(i)),i.reset(f)},i};ss.exports=N.tls=N.tls||{};for(na in p)typeof p[na]!="function"&&(N.tls[na]=p[na]);var na;N.tls.prf_tls1=sa;N.tls.hmac_sha1=pl;N.tls.createSessionCache=p.createSessionCache;N.tls.createConnection=p.createConnection});var ls=M((Lc,us)=>{var kt=X();Bt();Ja();var nt=us.exports=kt.tls;nt.CipherSuites.TLS_RSA_WITH_AES_128_CBC_SHA={id:[0,47],name:"TLS_RSA_WITH_AES_128_CBC_SHA",initSecurityParameters:function(e){e.bulk_cipher_algorithm=nt.BulkCipherAlgorithm.aes,e.cipher_type=nt.CipherType.block,e.enc_key_length=16,e.block_length=16,e.fixed_iv_length=16,e.record_iv_length=16,e.mac_algorithm=nt.MACAlgorithm.hmac_sha1,e.mac_length=20,e.mac_key_length=20},initConnectionState:os};nt.CipherSuites.TLS_RSA_WITH_AES_256_CBC_SHA={id:[0,53],name:"TLS_RSA_WITH_AES_256_CBC_SHA",initSecurityParameters:function(e){e.bulk_cipher_algorithm=nt.BulkCipherAlgorithm.aes,e.cipher_type=nt.CipherType.block,e.enc_key_length=32,e.block_length=16,e.fixed_iv_length=16,e.record_iv_length=16,e.mac_algorithm=nt.MACAlgorithm.hmac_sha1,e.mac_length=20,e.mac_key_length=20},initConnectionState:os};function os(e,t,a){var r=t.entity===kt.tls.ConnectionEnd.client;e.read.cipherState={init:!1,cipher:kt.cipher.createDecipher("AES-CBC",r?a.keys.server_write_key:a.keys.client_write_key),iv:r?a.keys.server_write_IV:a.keys.client_write_IV},e.write.cipherState={init:!1,cipher:kt.cipher.createCipher("AES-CBC",r?a.keys.client_write_key:a.keys.server_write_key),iv:r?a.keys.client_write_IV:a.keys.server_write_IV},e.read.cipherFunction=Vl,e.write.cipherFunction=Dl,e.read.macLength=e.write.macLength=a.mac_length,e.read.macFunction=e.write.macFunction=nt.hmac_sha1}function Dl(e,t){var a=!1,r=t.macFunction(t.macKey,t.sequenceNumber,e);e.fragment.putBytes(r),t.updateSequenceNumber();var n;e.version.minor===nt.Versions.TLS_1_0.minor?n=t.cipherState.init?null:t.cipherState.iv:n=kt.random.getBytesSync(16),t.cipherState.init=!0;var s=t.cipherState.cipher;return s.start({iv:n}),e.version.minor>=nt.Versions.TLS_1_1.minor&&s.output.putBytes(n),s.update(e.fragment),s.finish(Ul)&&(e.fragment=s.output,e.length=e.fragment.length(),a=!0),a}function Ul(e,t,a){if(!a){var r=e-t.length()%e;t.fillWithByte(r-1,r)}return!0}function Pl(e,t,a){var r=!0;if(a){for(var n=t.length(),s=t.last(),i=n-1-s;i<n-1;++i)r=r&&t.at(i)==s;r&&t.truncate(s+1)}return r}function Vl(e,t){var a=!1,r;e.version.minor===nt.Versions.TLS_1_0.minor?r=t.cipherState.init?null:t.cipherState.iv:r=e.fragment.getBytes(16),t.cipherState.init=!0;var n=t.cipherState.cipher;n.start({iv:r}),n.update(e.fragment),a=n.finish(Pl);var s=t.macLength,i=kt.random.getBytesSync(s),o=n.output.length();o>=s?(e.fragment=n.output.getBytes(o-s),i=n.output.getBytes(s)):e.fragment=n.output.getBytes(),e.fragment=kt.util.createBuffer(e.fragment),e.length=e.fragment.length();var l=t.macFunction(t.macKey,t.sequenceNumber,e);return t.updateSequenceNumber(),a=Ol(t.macKey,i,l)&&a,a}function Ol(e,t,a){var r=kt.hmac.create();return r.start("SHA1",e),r.update(t),t=r.digest().getBytes(),r.start(null,null),r.update(a),a=r.digest().getBytes(),t===a}});var rn=M((kc,ds)=>{var de=X();ut();ne();var Ir=ds.exports=de.sha512=de.sha512||{};de.md.sha512=de.md.algorithms.sha512=Ir;var cs=de.sha384=de.sha512.sha384=de.sha512.sha384||{};cs.create=function(){return Ir.create("SHA-384")};de.md.sha384=de.md.algorithms.sha384=cs;de.sha512.sha256=de.sha512.sha256||{create:function(){return Ir.create("SHA-512/256")}};de.md["sha512/256"]=de.md.algorithms["sha512/256"]=de.sha512.sha256;de.sha512.sha224=de.sha512.sha224||{create:function(){return Ir.create("SHA-512/224")}};de.md["sha512/224"]=de.md.algorithms["sha512/224"]=de.sha512.sha224;Ir.create=function(e){if(hs||Kl(),typeof e>"u"&&(e="SHA-512"),!(e in zt))throw new Error("Invalid SHA-512 algorithm: "+e);for(var t=zt[e],a=null,r=de.util.createBuffer(),n=new Array(80),s=0;s<80;++s)n[s]=new Array(2);var i=64;switch(e){case"SHA-384":i=48;break;case"SHA-512/256":i=32;break;case"SHA-512/224":i=28;break}var o={algorithm:e.replace("-","").toLowerCase(),blockLength:128,digestLength:i,messageLength:0,fullMessageLength:null,messageLengthSize:16};return o.start=function(){o.messageLength=0,o.fullMessageLength=o.messageLength128=[];for(var l=o.messageLengthSize/4,u=0;u<l;++u)o.fullMessageLength.push(0);r=de.util.createBuffer(),a=new Array(t.length);for(var u=0;u<t.length;++u)a[u]=t[u].slice(0);return o},o.start(),o.update=function(l,u){u==="utf8"&&(l=de.util.encodeUtf8(l));var f=l.length;o.messageLength+=f,f=[f/4294967296>>>0,f>>>0];for(var c=o.fullMessageLength.length-1;c>=0;--c)o.fullMessageLength[c]+=f[1],f[1]=f[0]+(o.fullMessageLength[c]/4294967296>>>0),o.fullMessageLength[c]=o.fullMessageLength[c]>>>0,f[0]=f[1]/4294967296>>>0;return r.putBytes(l),fs(a,n,r),(r.read>2048||r.length()===0)&&r.compact(),o},o.digest=function(){var l=de.util.createBuffer();l.putBytes(r.bytes());var u=o.fullMessageLength[o.fullMessageLength.length-1]+o.messageLengthSize,f=u&o.blockLength-1;l.putBytes(en.substr(0,o.blockLength-f));for(var c,v,g=o.fullMessageLength[0]*8,y=0;y<o.fullMessageLength.length-1;++y)c=o.fullMessageLength[y+1]*8,v=c/4294967296>>>0,g+=v,l.putInt32(g>>>0),g=c>>>0;l.putInt32(g);for(var x=new Array(a.length),y=0;y<a.length;++y)x[y]=a[y].slice(0);fs(x,n,l);var S=de.util.createBuffer(),I;e==="SHA-512"?I=x.length:e==="SHA-384"?I=x.length-2:I=x.length-4;for(var y=0;y<I;++y)S.putInt32(x[y][0]),(y!==I-1||e!=="SHA-512/224")&&S.putInt32(x[y][1]);return S},o};var en=null,hs=!1,tn=null,zt=null;function Kl(){en="\x80",en+=de.util.fillString("\0",128),tn=[[1116352408,3609767458],[1899447441,602891725],[3049323471,3964484399],[3921009573,2173295548],[961987163,4081628472],[1508970993,3053834265],[2453635748,2937671579],[2870763221,3664609560],[3624381080,2734883394],[310598401,1164996542],[607225278,1323610764],[1426881987,3590304994],[1925078388,4068182383],[2162078206,991336113],[2614888103,633803317],[3248222580,3479774868],[3835390401,2666613458],[4022224774,944711139],[264347078,2341262773],[604807628,2007800933],[770255983,1495990901],[1249150122,1856431235],[1555081692,3175218132],[1996064986,2198950837],[2554220882,3999719339],[2821834349,766784016],[2952996808,2566594879],[3210313671,3203337956],[3336571891,1034457026],[3584528711,2466948901],[113926993,3758326383],[338241895,168717936],[666307205,1188179964],[773529912,1546045734],[1294757372,1522805485],[1396182291,2643833823],[1695183700,2343527390],[1986661051,1014477480],[2177026350,1206759142],[2456956037,344077627],[2730485921,1290863460],[2820302411,3158454273],[3259730800,3505952657],[3345764771,106217008],[3516065817,3606008344],[3600352804,1432725776],[4094571909,1467031594],[275423344,851169720],[430227734,3100823752],[506948616,1363258195],[659060556,3750685593],[883997877,3785050280],[958139571,3318307427],[1322822218,3812723403],[1537002063,2003034995],[1747873779,3602036899],[1955562222,1575990012],[2024104815,1125592928],[2227730452,2716904306],[2361852424,442776044],[2428436474,593698344],[2756734187,3733110249],[3204031479,2999351573],[3329325298,3815920427],[3391569614,3928383900],[3515267271,566280711],[3940187606,3454069534],[4118630271,4000239992],[116418474,1914138554],[174292421,2731055270],[289380356,3203993006],[460393269,320620315],[685471733,587496836],[852142971,1086792851],[1017036298,365543100],[1126000580,2618297676],[1288033470,3409855158],[1501505948,4234509866],[1607167915,987167468],[1816402316,1246189591]],zt={},zt["SHA-512"]=[[1779033703,4089235720],[3144134277,2227873595],[1013904242,4271175723],[2773480762,1595750129],[1359893119,2917565137],[2600822924,725511199],[528734635,4215389547],[1541459225,327033209]],zt["SHA-384"]=[[3418070365,3238371032],[1654270250,914150663],[2438529370,812702999],[355462360,4144912697],[1731405415,4290775857],[2394180231,1750603025],[3675008525,1694076839],[1203062813,3204075428]],zt["SHA-512/256"]=[[573645204,4230739756],[2673172387,3360449730],[596883563,1867755857],[2520282905,1497426621],[2519219938,2827943907],[3193839141,1401305490],[721525244,746961066],[246885852,2177182882]],zt["SHA-512/224"]=[[2352822216,424955298],[1944164710,2312950998],[502970286,855612546],[1738396948,1479516111],[258812777,2077511080],[2011393907,79989058],[1067287976,1780299464],[286451373,2446758561]],hs=!0}function fs(e,t,a){for(var r,n,s,i,o,l,u,f,c,v,g,y,x,S,I,B,b,U,L,w,z,G,j,oe,ue,ee,xe,Me,ie,ye,K,Vt,jt,ge,me,Ee=a.length();Ee>=128;){for(ie=0;ie<16;++ie)t[ie][0]=a.getInt32()>>>0,t[ie][1]=a.getInt32()>>>0;for(;ie<80;++ie)Vt=t[ie-2],ye=Vt[0],K=Vt[1],r=((ye>>>19|K<<13)^(K>>>29|ye<<3)^ye>>>6)>>>0,n=((ye<<13|K>>>19)^(K<<3|ye>>>29)^(ye<<26|K>>>6))>>>0,ge=t[ie-15],ye=ge[0],K=ge[1],s=((ye>>>1|K<<31)^(ye>>>8|K<<24)^ye>>>7)>>>0,i=((ye<<31|K>>>1)^(ye<<24|K>>>8)^(ye<<25|K>>>7))>>>0,jt=t[ie-7],me=t[ie-16],K=n+jt[1]+i+me[1],t[ie][0]=r+jt[0]+s+me[0]+(K/4294967296>>>0)>>>0,t[ie][1]=K>>>0;for(x=e[0][0],S=e[0][1],I=e[1][0],B=e[1][1],b=e[2][0],U=e[2][1],L=e[3][0],w=e[3][1],z=e[4][0],G=e[4][1],j=e[5][0],oe=e[5][1],ue=e[6][0],ee=e[6][1],xe=e[7][0],Me=e[7][1],ie=0;ie<80;++ie)u=((z>>>14|G<<18)^(z>>>18|G<<14)^(G>>>9|z<<23))>>>0,f=((z<<18|G>>>14)^(z<<14|G>>>18)^(G<<23|z>>>9))>>>0,c=(ue^z&(j^ue))>>>0,v=(ee^G&(oe^ee))>>>0,o=((x>>>28|S<<4)^(S>>>2|x<<30)^(S>>>7|x<<25))>>>0,l=((x<<4|S>>>28)^(S<<30|x>>>2)^(S<<25|x>>>7))>>>0,g=(x&I|b&(x^I))>>>0,y=(S&B|U&(S^B))>>>0,K=Me+f+v+tn[ie][1]+t[ie][1],r=xe+u+c+tn[ie][0]+t[ie][0]+(K/4294967296>>>0)>>>0,n=K>>>0,K=l+y,s=o+g+(K/4294967296>>>0)>>>0,i=K>>>0,xe=ue,Me=ee,ue=j,ee=oe,j=z,oe=G,K=w+n,z=L+r+(K/4294967296>>>0)>>>0,G=K>>>0,L=b,w=U,b=I,U=B,I=x,B=S,K=n+i,x=r+s+(K/4294967296>>>0)>>>0,S=K>>>0;K=e[0][1]+S,e[0][0]=e[0][0]+x+(K/4294967296>>>0)>>>0,e[0][1]=K>>>0,K=e[1][1]+B,e[1][0]=e[1][0]+I+(K/4294967296>>>0)>>>0,e[1][1]=K>>>0,K=e[2][1]+U,e[2][0]=e[2][0]+b+(K/4294967296>>>0)>>>0,e[2][1]=K>>>0,K=e[3][1]+w,e[3][0]=e[3][0]+L+(K/4294967296>>>0)>>>0,e[3][1]=K>>>0,K=e[4][1]+G,e[4][0]=e[4][0]+z+(K/4294967296>>>0)>>>0,e[4][1]=K>>>0,K=e[5][1]+oe,e[5][0]=e[5][0]+j+(K/4294967296>>>0)>>>0,e[5][1]=K>>>0,K=e[6][1]+ee,e[6][0]=e[6][0]+ue+(K/4294967296>>>0)>>>0,e[6][1]=K>>>0,K=e[7][1]+Me,e[7][0]=e[7][0]+xe+(K/4294967296>>>0)>>>0,e[7][1]=K>>>0,Ee-=128}}});var ps=M(an=>{var Fl=X();st();var Ae=Fl.asn1;an.privateKeyValidator={name:"PrivateKeyInfo",tagClass:Ae.Class.UNIVERSAL,type:Ae.Type.SEQUENCE,constructed:!0,value:[{name:"PrivateKeyInfo.version",tagClass:Ae.Class.UNIVERSAL,type:Ae.Type.INTEGER,constructed:!1,capture:"privateKeyVersion"},{name:"PrivateKeyInfo.privateKeyAlgorithm",tagClass:Ae.Class.UNIVERSAL,type:Ae.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:Ae.Class.UNIVERSAL,type:Ae.Type.OID,constructed:!1,capture:"privateKeyOid"}]},{name:"PrivateKeyInfo",tagClass:Ae.Class.UNIVERSAL,type:Ae.Type.OCTETSTRING,constructed:!1,capture:"privateKey"}]};an.publicKeyValidator={name:"SubjectPublicKeyInfo",tagClass:Ae.Class.UNIVERSAL,type:Ae.Type.SEQUENCE,constructed:!0,captureAsn1:"subjectPublicKeyInfo",value:[{name:"SubjectPublicKeyInfo.AlgorithmIdentifier",tagClass:Ae.Class.UNIVERSAL,type:Ae.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:Ae.Class.UNIVERSAL,type:Ae.Type.OID,constructed:!1,capture:"publicKeyOid"}]},{tagClass:Ae.Class.UNIVERSAL,type:Ae.Type.BITSTRING,constructed:!1,composed:!0,captureBitStringValue:"ed25519PublicKey"}]}});var bs=M((Uc,Bs)=>{var _e=X();Er();Je();rn();ne();var Es=ps(),ql=Es.publicKeyValidator,Ml=Es.privateKeyValidator;typeof vs>"u"&&(vs=_e.jsbn.BigInteger);var vs,sn=_e.util.ByteBuffer,Xe=typeof Buffer>"u"?Uint8Array:Buffer;_e.pki=_e.pki||{};Bs.exports=_e.pki.ed25519=_e.ed25519=_e.ed25519||{};var Z=_e.ed25519;Z.constants={};Z.constants.PUBLIC_KEY_BYTE_LENGTH=32;Z.constants.PRIVATE_KEY_BYTE_LENGTH=64;Z.constants.SEED_BYTE_LENGTH=32;Z.constants.SIGN_BYTE_LENGTH=64;Z.constants.HASH_BYTE_LENGTH=64;Z.generateKeyPair=function(e){e=e||{};var t=e.seed;if(t===void 0)t=_e.random.getBytesSync(Z.constants.SEED_BYTE_LENGTH);else if(typeof t=="string"){if(t.length!==Z.constants.SEED_BYTE_LENGTH)throw new TypeError('"seed" must be '+Z.constants.SEED_BYTE_LENGTH+" bytes in length.")}else if(!(t instanceof Uint8Array))throw new TypeError('"seed" must be a node.js Buffer, Uint8Array, or a binary string.');t=xt({message:t,encoding:"binary"});for(var a=new Xe(Z.constants.PUBLIC_KEY_BYTE_LENGTH),r=new Xe(Z.constants.PRIVATE_KEY_BYTE_LENGTH),n=0;n<32;++n)r[n]=t[n];return Ql(a,r),{publicKey:a,privateKey:r}};Z.privateKeyFromAsn1=function(e){var t={},a=[],r=_e.asn1.validate(e,Ml,t,a);if(!r){var n=new Error("Invalid Key.");throw n.errors=a,n}var s=_e.asn1.derToOid(t.privateKeyOid),i=_e.oids.EdDSA25519;if(s!==i)throw new Error('Invalid OID "'+s+'"; OID must be "'+i+'".');var o=t.privateKey,l=xt({message:_e.asn1.fromDer(o).value,encoding:"binary"});return{privateKeyBytes:l}};Z.publicKeyFromAsn1=function(e){var t={},a=[],r=_e.asn1.validate(e,ql,t,a);if(!r){var n=new Error("Invalid Key.");throw n.errors=a,n}var s=_e.asn1.derToOid(t.publicKeyOid),i=_e.oids.EdDSA25519;if(s!==i)throw new Error('Invalid OID "'+s+'"; OID must be "'+i+'".');var o=t.ed25519PublicKey;if(o.length!==Z.constants.PUBLIC_KEY_BYTE_LENGTH)throw new Error("Key length is invalid.");return xt({message:o,encoding:"binary"})};Z.publicKeyFromPrivateKey=function(e){e=e||{};var t=xt({message:e.privateKey,encoding:"binary"});if(t.length!==Z.constants.PRIVATE_KEY_BYTE_LENGTH)throw new TypeError('"options.privateKey" must have a byte length of '+Z.constants.PRIVATE_KEY_BYTE_LENGTH);for(var a=new Xe(Z.constants.PUBLIC_KEY_BYTE_LENGTH),r=0;r<a.length;++r)a[r]=t[32+r];return a};Z.sign=function(e){e=e||{};var t=xt(e),a=xt({message:e.privateKey,encoding:"binary"});if(a.length===Z.constants.SEED_BYTE_LENGTH){var r=Z.generateKeyPair({seed:a});a=r.privateKey}else if(a.length!==Z.constants.PRIVATE_KEY_BYTE_LENGTH)throw new TypeError('"options.privateKey" must have a byte length of '+Z.constants.SEED_BYTE_LENGTH+" or "+Z.constants.PRIVATE_KEY_BYTE_LENGTH);var n=new Xe(Z.constants.SIGN_BYTE_LENGTH+t.length);Yl(n,t,t.length,a);for(var s=new Xe(Z.constants.SIGN_BYTE_LENGTH),i=0;i<s.length;++i)s[i]=n[i];return s};Z.verify=function(e){e=e||{};var t=xt(e);if(e.signature===void 0)throw new TypeError('"options.signature" must be a node.js Buffer, a Uint8Array, a forge ByteBuffer, or a binary string.');var a=xt({message:e.signature,encoding:"binary"});if(a.length!==Z.constants.SIGN_BYTE_LENGTH)throw new TypeError('"options.signature" must have a byte length of '+Z.constants.SIGN_BYTE_LENGTH);var r=xt({message:e.publicKey,encoding:"binary"});if(r.length!==Z.constants.PUBLIC_KEY_BYTE_LENGTH)throw new TypeError('"options.publicKey" must have a byte length of '+Z.constants.PUBLIC_KEY_BYTE_LENGTH);var n=new Xe(Z.constants.SIGN_BYTE_LENGTH+t.length),s=new Xe(Z.constants.SIGN_BYTE_LENGTH+t.length),i;for(i=0;i<Z.constants.SIGN_BYTE_LENGTH;++i)n[i]=a[i];for(i=0;i<t.length;++i)n[i+Z.constants.SIGN_BYTE_LENGTH]=t[i];return Xl(s,n,n.length,r)>=0};function xt(e){var t=e.message;if(t instanceof Uint8Array||t instanceof Xe)return t;var a=e.encoding;if(t===void 0)if(e.md)t=e.md.digest().getBytes(),a="binary";else throw new TypeError('"options.message" or "options.md" not specified.');if(typeof t=="string"&&!a)throw new TypeError('"options.encoding" must be "binary" or "utf8".');if(typeof t=="string"){if(typeof Buffer<"u")return Buffer.from(t,a);t=new sn(t,a)}else if(!(t instanceof sn))throw new TypeError('"options.message" must be a node.js Buffer, a Uint8Array, a forge ByteBuffer, or a string with "options.encoding" specifying its encoding.');for(var r=new Xe(t.length()),n=0;n<r.length;++n)r[n]=t.at(n);return r}var on=H(),oa=H([1]),Hl=H([30883,4953,19914,30187,55467,16705,2637,112,59544,30585,16505,36039,65139,11119,27886,20995]),Gl=H([61785,9906,39828,60374,45398,33411,5274,224,53552,61171,33010,6542,64743,22239,55772,9222]),ys=H([54554,36645,11616,51542,42930,38181,51040,26924,56412,64982,57905,49316,21502,52590,14035,8553]),gs=H([26200,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214]),Ar=new Float64Array([237,211,245,92,26,99,18,88,214,156,247,162,222,249,222,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16]),zl=H([41136,18958,6951,50414,58488,44335,6150,12099,55207,15867,153,11085,57099,20417,9344,11139]);function Br(e,t){var a=_e.md.sha512.create(),r=new sn(e);a.update(r.getBytes(t),"binary");var n=a.digest().getBytes();if(typeof Buffer<"u")return Buffer.from(n,"binary");for(var s=new Xe(Z.constants.HASH_BYTE_LENGTH),i=0;i<64;++i)s[i]=n.charCodeAt(i);return s}function Ql(e,t){var a=[H(),H(),H(),H()],r,n=Br(t,32);for(n[0]&=248,n[31]&=127,n[31]|=64,cn(a,n),fn(e,a),r=0;r<32;++r)t[r+32]=e[r];return 0}function Yl(e,t,a,r){var n,s,i=new Float64Array(64),o=[H(),H(),H(),H()],l=Br(r,32);l[0]&=248,l[31]&=127,l[31]|=64;var u=a+64;for(n=0;n<a;++n)e[64+n]=t[n];for(n=0;n<32;++n)e[32+n]=l[32+n];var f=Br(e.subarray(32),a+32);for(un(f),cn(o,f),fn(e,o),n=32;n<64;++n)e[n]=r[n];var c=Br(e,a+64);for(un(c),n=32;n<64;++n)i[n]=0;for(n=0;n<32;++n)i[n]=f[n];for(n=0;n<32;++n)for(s=0;s<32;s++)i[n+s]+=c[n]*l[s];return xs(e.subarray(32),i),u}function Xl(e,t,a,r){var n,s,i=new Xe(32),o=[H(),H(),H(),H()],l=[H(),H(),H(),H()];if(s=-1,a<64||Wl(l,r)||!jl(t,32))return-1;for(n=0;n<a;++n)e[n]=t[n];for(n=0;n<32;++n)e[n+32]=r[n];var u=Br(e,a);if(un(u),Is(o,l,u),cn(l,t.subarray(32)),ln(o,l),fn(i,o),a-=64,Ss(t,0,i,0)){for(n=0;n<a;++n)e[n]=0;return-1}for(n=0;n<a;++n)e[n]=t[n+64];return s=a,s}function jl(e,t){var a;for(a=31;a>=0;--a){if(e[t+a]<Ar[a])return!0;if(e[t+a]>Ar[a])return!1}return!1}function xs(e,t){var a,r,n,s;for(r=63;r>=32;--r){for(a=0,n=r-32,s=r-12;n<s;++n)t[n]+=a-16*t[r]*Ar[n-(r-32)],a=t[n]+128>>8,t[n]-=a*256;t[n]+=a,t[r]=0}for(a=0,n=0;n<32;++n)t[n]+=a-(t[31]>>4)*Ar[n],a=t[n]>>8,t[n]&=255;for(n=0;n<32;++n)t[n]-=a*Ar[n];for(r=0;r<32;++r)t[r+1]+=t[r]>>8,e[r]=t[r]&255}function un(e){for(var t=new Float64Array(64),a=0;a<64;++a)t[a]=e[a],e[a]=0;xs(e,t)}function ln(e,t){var a=H(),r=H(),n=H(),s=H(),i=H(),o=H(),l=H(),u=H(),f=H();lr(a,e[1],e[0]),lr(f,t[1],t[0]),le(a,a,f),ur(r,e[0],e[1]),ur(f,t[0],t[1]),le(r,r,f),le(n,e[3],t[3]),le(n,n,Gl),le(s,e[2],t[2]),ur(s,s,s),lr(i,r,a),lr(o,s,n),ur(l,s,n),ur(u,r,a),le(e[0],i,o),le(e[1],u,l),le(e[2],l,o),le(e[3],i,u)}function ms(e,t,a){for(var r=0;r<4;++r)As(e[r],t[r],a)}function fn(e,t){var a=H(),r=H(),n=H();ef(n,t[2]),le(a,t[0],n),le(r,t[1],n),ua(e,r),e[31]^=Ts(a)<<7}function ua(e,t){var a,r,n,s=H(),i=H();for(a=0;a<16;++a)i[a]=t[a];for(nn(i),nn(i),nn(i),r=0;r<2;++r){for(s[0]=i[0]-65517,a=1;a<15;++a)s[a]=i[a]-65535-(s[a-1]>>16&1),s[a-1]&=65535;s[15]=i[15]-32767-(s[14]>>16&1),n=s[15]>>16&1,s[14]&=65535,As(i,s,1-n)}for(a=0;a<16;a++)e[2*a]=i[a]&255,e[2*a+1]=i[a]>>8}function Wl(e,t){var a=H(),r=H(),n=H(),s=H(),i=H(),o=H(),l=H();return Dt(e[2],oa),$l(e[1],t),Qt(n,e[1]),le(s,n,Hl),lr(n,n,e[2]),ur(s,e[2],s),Qt(i,s),Qt(o,i),le(l,o,i),le(a,l,n),le(a,a,s),Zl(a,a),le(a,a,n),le(a,a,s),le(a,a,s),le(e[0],a,s),Qt(r,e[0]),le(r,r,s),Cs(r,n)&&le(e[0],e[0],zl),Qt(r,e[0]),le(r,r,s),Cs(r,n)?-1:(Ts(e[0])===t[31]>>7&&lr(e[0],on,e[0]),le(e[3],e[0],e[1]),0)}function $l(e,t){var a;for(a=0;a<16;++a)e[a]=t[2*a]+(t[2*a+1]<<8);e[15]&=32767}function Zl(e,t){var a=H(),r;for(r=0;r<16;++r)a[r]=t[r];for(r=250;r>=0;--r)Qt(a,a),r!==1&&le(a,a,t);for(r=0;r<16;++r)e[r]=a[r]}function Cs(e,t){var a=new Xe(32),r=new Xe(32);return ua(a,e),ua(r,t),Ss(a,0,r,0)}function Ss(e,t,a,r){return Jl(e,t,a,r,32)}function Jl(e,t,a,r,n){var s,i=0;for(s=0;s<n;++s)i|=e[t+s]^a[r+s];return(1&i-1>>>8)-1}function Ts(e){var t=new Xe(32);return ua(t,e),t[0]&1}function Is(e,t,a){var r,n;for(Dt(e[0],on),Dt(e[1],oa),Dt(e[2],oa),Dt(e[3],on),n=255;n>=0;--n)r=a[n/8|0]>>(n&7)&1,ms(e,t,r),ln(t,e),ln(e,e),ms(e,t,r)}function cn(e,t){var a=[H(),H(),H(),H()];Dt(a[0],ys),Dt(a[1],gs),Dt(a[2],oa),le(a[3],ys,gs),Is(e,a,t)}function Dt(e,t){var a;for(a=0;a<16;a++)e[a]=t[a]|0}function ef(e,t){var a=H(),r;for(r=0;r<16;++r)a[r]=t[r];for(r=253;r>=0;--r)Qt(a,a),r!==2&&r!==4&&le(a,a,t);for(r=0;r<16;++r)e[r]=a[r]}function nn(e){var t,a,r=1;for(t=0;t<16;++t)a=e[t]+r+65535,r=Math.floor(a/65536),e[t]=a-r*65536;e[0]+=r-1+37*(r-1)}function As(e,t,a){for(var r,n=~(a-1),s=0;s<16;++s)r=n&(e[s]^t[s]),e[s]^=r,t[s]^=r}function H(e){var t,a=new Float64Array(16);if(e)for(t=0;t<e.length;++t)a[t]=e[t];return a}function ur(e,t,a){for(var r=0;r<16;++r)e[r]=t[r]+a[r]}function lr(e,t,a){for(var r=0;r<16;++r)e[r]=t[r]-a[r]}function Qt(e,t){le(e,t,t)}function le(e,t,a){var r,n,s=0,i=0,o=0,l=0,u=0,f=0,c=0,v=0,g=0,y=0,x=0,S=0,I=0,B=0,b=0,U=0,L=0,w=0,z=0,G=0,j=0,oe=0,ue=0,ee=0,xe=0,Me=0,ie=0,ye=0,K=0,Vt=0,jt=0,ge=a[0],me=a[1],Ee=a[2],Ne=a[3],Re=a[4],we=a[5],Le=a[6],ke=a[7],De=a[8],Ue=a[9],Pe=a[10],Ve=a[11],Oe=a[12],Ke=a[13],Fe=a[14],qe=a[15];r=t[0],s+=r*ge,i+=r*me,o+=r*Ee,l+=r*Ne,u+=r*Re,f+=r*we,c+=r*Le,v+=r*ke,g+=r*De,y+=r*Ue,x+=r*Pe,S+=r*Ve,I+=r*Oe,B+=r*Ke,b+=r*Fe,U+=r*qe,r=t[1],i+=r*ge,o+=r*me,l+=r*Ee,u+=r*Ne,f+=r*Re,c+=r*we,v+=r*Le,g+=r*ke,y+=r*De,x+=r*Ue,S+=r*Pe,I+=r*Ve,B+=r*Oe,b+=r*Ke,U+=r*Fe,L+=r*qe,r=t[2],o+=r*ge,l+=r*me,u+=r*Ee,f+=r*Ne,c+=r*Re,v+=r*we,g+=r*Le,y+=r*ke,x+=r*De,S+=r*Ue,I+=r*Pe,B+=r*Ve,b+=r*Oe,U+=r*Ke,L+=r*Fe,w+=r*qe,r=t[3],l+=r*ge,u+=r*me,f+=r*Ee,c+=r*Ne,v+=r*Re,g+=r*we,y+=r*Le,x+=r*ke,S+=r*De,I+=r*Ue,B+=r*Pe,b+=r*Ve,U+=r*Oe,L+=r*Ke,w+=r*Fe,z+=r*qe,r=t[4],u+=r*ge,f+=r*me,c+=r*Ee,v+=r*Ne,g+=r*Re,y+=r*we,x+=r*Le,S+=r*ke,I+=r*De,B+=r*Ue,b+=r*Pe,U+=r*Ve,L+=r*Oe,w+=r*Ke,z+=r*Fe,G+=r*qe,r=t[5],f+=r*ge,c+=r*me,v+=r*Ee,g+=r*Ne,y+=r*Re,x+=r*we,S+=r*Le,I+=r*ke,B+=r*De,b+=r*Ue,U+=r*Pe,L+=r*Ve,w+=r*Oe,z+=r*Ke,G+=r*Fe,j+=r*qe,r=t[6],c+=r*ge,v+=r*me,g+=r*Ee,y+=r*Ne,x+=r*Re,S+=r*we,I+=r*Le,B+=r*ke,b+=r*De,U+=r*Ue,L+=r*Pe,w+=r*Ve,z+=r*Oe,G+=r*Ke,j+=r*Fe,oe+=r*qe,r=t[7],v+=r*ge,g+=r*me,y+=r*Ee,x+=r*Ne,S+=r*Re,I+=r*we,B+=r*Le,b+=r*ke,U+=r*De,L+=r*Ue,w+=r*Pe,z+=r*Ve,G+=r*Oe,j+=r*Ke,oe+=r*Fe,ue+=r*qe,r=t[8],g+=r*ge,y+=r*me,x+=r*Ee,S+=r*Ne,I+=r*Re,B+=r*we,b+=r*Le,U+=r*ke,L+=r*De,w+=r*Ue,z+=r*Pe,G+=r*Ve,j+=r*Oe,oe+=r*Ke,ue+=r*Fe,ee+=r*qe,r=t[9],y+=r*ge,x+=r*me,S+=r*Ee,I+=r*Ne,B+=r*Re,b+=r*we,U+=r*Le,L+=r*ke,w+=r*De,z+=r*Ue,G+=r*Pe,j+=r*Ve,oe+=r*Oe,ue+=r*Ke,ee+=r*Fe,xe+=r*qe,r=t[10],x+=r*ge,S+=r*me,I+=r*Ee,B+=r*Ne,b+=r*Re,U+=r*we,L+=r*Le,w+=r*ke,z+=r*De,G+=r*Ue,j+=r*Pe,oe+=r*Ve,ue+=r*Oe,ee+=r*Ke,xe+=r*Fe,Me+=r*qe,r=t[11],S+=r*ge,I+=r*me,B+=r*Ee,b+=r*Ne,U+=r*Re,L+=r*we,w+=r*Le,z+=r*ke,G+=r*De,j+=r*Ue,oe+=r*Pe,ue+=r*Ve,ee+=r*Oe,xe+=r*Ke,Me+=r*Fe,ie+=r*qe,r=t[12],I+=r*ge,B+=r*me,b+=r*Ee,U+=r*Ne,L+=r*Re,w+=r*we,z+=r*Le,G+=r*ke,j+=r*De,oe+=r*Ue,ue+=r*Pe,ee+=r*Ve,xe+=r*Oe,Me+=r*Ke,ie+=r*Fe,ye+=r*qe,r=t[13],B+=r*ge,b+=r*me,U+=r*Ee,L+=r*Ne,w+=r*Re,z+=r*we,G+=r*Le,j+=r*ke,oe+=r*De,ue+=r*Ue,ee+=r*Pe,xe+=r*Ve,Me+=r*Oe,ie+=r*Ke,ye+=r*Fe,K+=r*qe,r=t[14],b+=r*ge,U+=r*me,L+=r*Ee,w+=r*Ne,z+=r*Re,G+=r*we,j+=r*Le,oe+=r*ke,ue+=r*De,ee+=r*Ue,xe+=r*Pe,Me+=r*Ve,ie+=r*Oe,ye+=r*Ke,K+=r*Fe,Vt+=r*qe,r=t[15],U+=r*ge,L+=r*me,w+=r*Ee,z+=r*Ne,G+=r*Re,j+=r*we,oe+=r*Le,ue+=r*ke,ee+=r*De,xe+=r*Ue,Me+=r*Pe,ie+=r*Ve,ye+=r*Oe,K+=r*Ke,Vt+=r*Fe,jt+=r*qe,s+=38*L,i+=38*w,o+=38*z,l+=38*G,u+=38*j,f+=38*oe,c+=38*ue,v+=38*ee,g+=38*xe,y+=38*Me,x+=38*ie,S+=38*ye,I+=38*K,B+=38*Vt,b+=38*jt,n=1,r=s+n+65535,n=Math.floor(r/65536),s=r-n*65536,r=i+n+65535,n=Math.floor(r/65536),i=r-n*65536,r=o+n+65535,n=Math.floor(r/65536),o=r-n*65536,r=l+n+65535,n=Math.floor(r/65536),l=r-n*65536,r=u+n+65535,n=Math.floor(r/65536),u=r-n*65536,r=f+n+65535,n=Math.floor(r/65536),f=r-n*65536,r=c+n+65535,n=Math.floor(r/65536),c=r-n*65536,r=v+n+65535,n=Math.floor(r/65536),v=r-n*65536,r=g+n+65535,n=Math.floor(r/65536),g=r-n*65536,r=y+n+65535,n=Math.floor(r/65536),y=r-n*65536,r=x+n+65535,n=Math.floor(r/65536),x=r-n*65536,r=S+n+65535,n=Math.floor(r/65536),S=r-n*65536,r=I+n+65535,n=Math.floor(r/65536),I=r-n*65536,r=B+n+65535,n=Math.floor(r/65536),B=r-n*65536,r=b+n+65535,n=Math.floor(r/65536),b=r-n*65536,r=U+n+65535,n=Math.floor(r/65536),U=r-n*65536,s+=n-1+37*(n-1),n=1,r=s+n+65535,n=Math.floor(r/65536),s=r-n*65536,r=i+n+65535,n=Math.floor(r/65536),i=r-n*65536,r=o+n+65535,n=Math.floor(r/65536),o=r-n*65536,r=l+n+65535,n=Math.floor(r/65536),l=r-n*65536,r=u+n+65535,n=Math.floor(r/65536),u=r-n*65536,r=f+n+65535,n=Math.floor(r/65536),f=r-n*65536,r=c+n+65535,n=Math.floor(r/65536),c=r-n*65536,r=v+n+65535,n=Math.floor(r/65536),v=r-n*65536,r=g+n+65535,n=Math.floor(r/65536),g=r-n*65536,r=y+n+65535,n=Math.floor(r/65536),y=r-n*65536,r=x+n+65535,n=Math.floor(r/65536),x=r-n*65536,r=S+n+65535,n=Math.floor(r/65536),S=r-n*65536,r=I+n+65535,n=Math.floor(r/65536),I=r-n*65536,r=B+n+65535,n=Math.floor(r/65536),B=r-n*65536,r=b+n+65535,n=Math.floor(r/65536),b=r-n*65536,r=U+n+65535,n=Math.floor(r/65536),U=r-n*65536,s+=n-1+37*(n-1),e[0]=s,e[1]=i,e[2]=o,e[3]=l,e[4]=u,e[5]=f,e[6]=c,e[7]=v,e[8]=g,e[9]=y,e[10]=x,e[11]=S,e[12]=I,e[13]=B,e[14]=b,e[15]=U}});var ws=M((Pc,Rs)=>{var We=X();ne();Je();Er();Rs.exports=We.kem=We.kem||{};var _s=We.jsbn.BigInteger;We.kem.rsa={};We.kem.rsa.create=function(e,t){t=t||{};var a=t.prng||We.random,r={};return r.encrypt=function(n,s){var i=Math.ceil(n.n.bitLength()/8),o;do o=new _s(We.util.bytesToHex(a.getBytesSync(i)),16).mod(n.n);while(o.compareTo(_s.ONE)<=0);o=We.util.hexToBytes(o.toString(16));var l=i-o.length;l>0&&(o=We.util.fillString("\0",l)+o);var u=n.encrypt(o,"NONE"),f=e.generate(o,s);return{encapsulation:u,key:f}},r.decrypt=function(n,s,i){var o=n.decrypt(s,"NONE");return e.generate(o,i)},r};We.kem.kdf1=function(e,t){Ns(this,e,0,t||e.digestLength)};We.kem.kdf2=function(e,t){Ns(this,e,1,t||e.digestLength)};function Ns(e,t,a,r){e.generate=function(n,s){for(var i=new We.util.ByteBuffer,o=Math.ceil(s/r)+a,l=new We.util.ByteBuffer,u=a;u<o;++u){l.putInt32(u),t.start(),t.update(n+l.getBytes());var f=t.digest();i.putBytes(f.getBytes(r))}return i.truncate(i.length()-s),i.getBytes()}}});var Us=M((Vc,Ds)=>{var J=X();ne();Ds.exports=J.log=J.log||{};J.log.levels=["none","error","warning","info","debug","verbose","max"];var la={},pn=[],_r=null;J.log.LEVEL_LOCKED=2;J.log.NO_LEVEL_CHECK=4;J.log.INTERPOLATE=8;for(yt=0;yt<J.log.levels.length;++yt)hn=J.log.levels[yt],la[hn]={index:yt,name:hn.toUpperCase()};var hn,yt;J.log.logMessage=function(e){for(var t=la[e.level].index,a=0;a<pn.length;++a){var r=pn[a];if(r.flags&J.log.NO_LEVEL_CHECK)r.f(e);else{var n=la[r.level].index;t<=n&&r.f(r,e)}}};J.log.prepareStandard=function(e){"standard"in e||(e.standard=la[e.level].name+" ["+e.category+"] "+e.message)};J.log.prepareFull=function(e){if(!("full"in e)){var t=[e.message];t=t.concat([]),e.full=J.util.format.apply(this,t)}};J.log.prepareStandardFull=function(e){"standardFull"in e||(J.log.prepareStandard(e),e.standardFull=e.standard)};for(dn=["error","warning","info","debug","verbose"],yt=0;yt<dn.length;++yt)(function(t){J.log[t]=function(a,r){var n=Array.prototype.slice.call(arguments).slice(2),s={timestamp:new Date,level:t,category:a,message:r,arguments:n};J.log.logMessage(s)}})(dn[yt]);var dn,yt;J.log.makeLogger=function(e){var t={flags:0,f:e};return J.log.setLevel(t,"none"),t};J.log.setLevel=function(e,t){var a=!1;if(e&&!(e.flags&J.log.LEVEL_LOCKED))for(var r=0;r<J.log.levels.length;++r){var n=J.log.levels[r];if(t==n){e.level=t,a=!0;break}}return a};J.log.lock=function(e,t){typeof t>"u"||t?e.flags|=J.log.LEVEL_LOCKED:e.flags&=~J.log.LEVEL_LOCKED};J.log.addLogger=function(e){pn.push(e)};typeof console<"u"&&"log"in console?(console.error&&console.warn&&console.info&&console.debug?(Ls={error:console.error,warning:console.warn,info:console.info,debug:console.debug,verbose:console.debug},Nr=function(e,t){J.log.prepareStandard(t);var a=Ls[t.level],r=[t.standard];r=r.concat(t.arguments.slice()),a.apply(console,r)},fr=J.log.makeLogger(Nr)):(Nr=function(t,a){J.log.prepareStandardFull(a),console.log(a.standardFull)},fr=J.log.makeLogger(Nr)),J.log.setLevel(fr,"debug"),J.log.addLogger(fr),_r=fr):console={log:function(){}};var fr,Ls,Nr;_r!==null&&typeof window<"u"&&window.location&&(br=new URL(window.location.href).searchParams,br.has("console.level")&&J.log.setLevel(_r,br.get("console.level").slice(-1)[0]),br.has("console.lock")&&(ks=br.get("console.lock").slice(-1)[0],ks=="true"&&J.log.lock(_r)));var br,ks;J.log.consoleLogger=_r});var Vs=M((Oc,Ps)=>{Ps.exports=ut();Mr();ar();ba();rn()});var Fs=M((Kc,Ks)=>{var D=X();Bt();st();mr();bt();Kt();qa();Je();ne();ra();var C=D.asn1,Qe=Ks.exports=D.pkcs7=D.pkcs7||{};Qe.messageFromPem=function(e){var t=D.pem.decode(e)[0];if(t.type!=="PKCS7"){var a=new Error('Could not convert PKCS#7 message from PEM; PEM header type is not "PKCS#7".');throw a.headerType=t.type,a}if(t.procType&&t.procType.type==="ENCRYPTED")throw new Error("Could not convert PKCS#7 message from PEM; PEM is encrypted.");var r=C.fromDer(t.body);return Qe.messageFromAsn1(r)};Qe.messageToPem=function(e,t){var a={type:"PKCS7",body:C.toDer(e.toAsn1()).getBytes()};return D.pem.encode(a,{maxline:t})};Qe.messageFromAsn1=function(e){var t={},a=[];if(!C.validate(e,Qe.asn1.contentInfoValidator,t,a)){var r=new Error("Cannot read PKCS#7 message. ASN.1 object is not an PKCS#7 ContentInfo.");throw r.errors=a,r}var n=C.derToOid(t.contentType),s;switch(n){case D.pki.oids.envelopedData:s=Qe.createEnvelopedData();break;case D.pki.oids.encryptedData:s=Qe.createEncryptedData();break;case D.pki.oids.signedData:s=Qe.createSignedData();break;default:throw new Error("Cannot read PKCS#7 message. ContentType with OID "+n+" is not (yet) supported.")}return s.fromAsn1(t.content.value[0]),s};Qe.createSignedData=function(){var e=null;return e={type:D.pki.oids.signedData,version:1,certificates:[],crls:[],signers:[],digestAlgorithmIdentifiers:[],contentInfo:null,signerInfos:[],fromAsn1:function(r){if(yn(e,r,Qe.asn1.signedDataValidator),e.certificates=[],e.crls=[],e.digestAlgorithmIdentifiers=[],e.contentInfo=null,e.signerInfos=[],e.rawCapture.certificates)for(var n=e.rawCapture.certificates.value,s=0;s<n.length;++s)e.certificates.push(D.pki.certificateFromAsn1(n[s]))},toAsn1:function(){e.contentInfo||e.sign();for(var r=[],n=0;n<e.certificates.length;++n)r.push(D.pki.certificateToAsn1(e.certificates[n]));var s=[],i=C.create(C.Class.CONTEXT_SPECIFIC,0,!0,[C.create(C.Class.UNIVERSAL,C.Type.SEQUENCE,!0,[C.create(C.Class.UNIVERSAL,C.Type.INTEGER,!1,C.integerToDer(e.version).getBytes()),C.create(C.Class.UNIVERSAL,C.Type.SET,!0,e.digestAlgorithmIdentifiers),e.contentInfo])]);return r.length>0&&i.value[0].value.push(C.create(C.Class.CONTEXT_SPECIFIC,0,!0,r)),s.length>0&&i.value[0].value.push(C.create(C.Class.CONTEXT_SPECIFIC,1,!0,s)),i.value[0].value.push(C.create(C.Class.UNIVERSAL,C.Type.SET,!0,e.signerInfos)),C.create(C.Class.UNIVERSAL,C.Type.SEQUENCE,!0,[C.create(C.Class.UNIVERSAL,C.Type.OID,!1,C.oidToDer(e.type).getBytes()),i])},addSigner:function(r){var n=r.issuer,s=r.serialNumber;if(r.certificate){var i=r.certificate;typeof i=="string"&&(i=D.pki.certificateFromPem(i)),n=i.issuer.attributes,s=i.serialNumber}var o=r.key;if(!o)throw new Error("Could not add PKCS#7 signer; no private key specified.");typeof o=="string"&&(o=D.pki.privateKeyFromPem(o));var l=r.digestAlgorithm||D.pki.oids.sha1;switch(l){case D.pki.oids.sha1:case D.pki.oids.sha256:case D.pki.oids.sha384:case D.pki.oids.sha512:case D.pki.oids.md5:break;default:throw new Error("Could not add PKCS#7 signer; unknown message digest algorithm: "+l)}var u=r.authenticatedAttributes||[];if(u.length>0){for(var f=!1,c=!1,v=0;v<u.length;++v){var g=u[v];if(!f&&g.type===D.pki.oids.contentType){if(f=!0,c)break;continue}if(!c&&g.type===D.pki.oids.messageDigest){if(c=!0,f)break;continue}}if(!f||!c)throw new Error("Invalid signer.authenticatedAttributes. If signer.authenticatedAttributes is specified, then it must contain at least two attributes, PKCS #9 content-type and PKCS #9 message-digest.")}e.signers.push({key:o,version:1,issuer:n,serialNumber:s,digestAlgorithm:l,signatureAlgorithm:D.pki.oids.rsaEncryption,signature:null,authenticatedAttributes:u,unauthenticatedAttributes:[]})},sign:function(r){if(r=r||{},(typeof e.content!="object"||e.contentInfo===null)&&(e.contentInfo=C.create(C.Class.UNIVERSAL,C.Type.SEQUENCE,!0,[C.create(C.Class.UNIVERSAL,C.Type.OID,!1,C.oidToDer(D.pki.oids.data).getBytes())]),"content"in e)){var n;e.content instanceof D.util.ByteBuffer?n=e.content.bytes():typeof e.content=="string"&&(n=D.util.encodeUtf8(e.content)),r.detached?e.detachedContent=C.create(C.Class.UNIVERSAL,C.Type.OCTETSTRING,!1,n):e.contentInfo.value.push(C.create(C.Class.CONTEXT_SPECIFIC,0,!0,[C.create(C.Class.UNIVERSAL,C.Type.OCTETSTRING,!1,n)]))}if(e.signers.length!==0){var s=t();a(s)}},verify:function(){throw new Error("PKCS#7 signature verification not yet implemented.")},addCertificate:function(r){typeof r=="string"&&(r=D.pki.certificateFromPem(r)),e.certificates.push(r)},addCertificateRevokationList:function(r){throw new Error("PKCS#7 CRL support not yet implemented.")}},e;function t(){for(var r={},n=0;n<e.signers.length;++n){var s=e.signers[n],i=s.digestAlgorithm;i in r||(r[i]=D.md[D.pki.oids[i]].create()),s.authenticatedAttributes.length===0?s.md=r[i]:s.md=D.md[D.pki.oids[i]].create()}e.digestAlgorithmIdentifiers=[];for(var i in r)e.digestAlgorithmIdentifiers.push(C.create(C.Class.UNIVERSAL,C.Type.SEQUENCE,!0,[C.create(C.Class.UNIVERSAL,C.Type.OID,!1,C.oidToDer(i).getBytes()),C.create(C.Class.UNIVERSAL,C.Type.NULL,!1,"")]));return r}function a(r){var n;if(e.detachedContent?n=e.detachedContent:(n=e.contentInfo.value[1],n=n.value[0]),!n)throw new Error("Could not sign PKCS#7 message; there is no content to sign.");var s=C.derToOid(e.contentInfo.value[0].value),i=C.toDer(n);i.getByte(),C.getBerValueLength(i),i=i.getBytes();for(var o in r)r[o].start().update(i);for(var l=new Date,u=0;u<e.signers.length;++u){var f=e.signers[u];if(f.authenticatedAttributes.length===0){if(s!==D.pki.oids.data)throw new Error("Invalid signer; authenticatedAttributes must be present when the ContentInfo content type is not PKCS#7 Data.")}else{f.authenticatedAttributesAsn1=C.create(C.Class.CONTEXT_SPECIFIC,0,!0,[]);for(var c=C.create(C.Class.UNIVERSAL,C.Type.SET,!0,[]),v=0;v<f.authenticatedAttributes.length;++v){var g=f.authenticatedAttributes[v];g.type===D.pki.oids.messageDigest?g.value=r[f.digestAlgorithm].digest():g.type===D.pki.oids.signingTime&&(g.value||(g.value=l)),c.value.push(vn(g)),f.authenticatedAttributesAsn1.value.push(vn(g))}i=C.toDer(c).getBytes(),f.md.start().update(i)}f.signature=f.key.sign(f.md,"RSASSA-PKCS1-V1_5")}e.signerInfos=of(e.signers)}};Qe.createEncryptedData=function(){var e=null;return e={type:D.pki.oids.encryptedData,version:0,encryptedContent:{algorithm:D.pki.oids["aes256-CBC"]},fromAsn1:function(t){yn(e,t,Qe.asn1.encryptedDataValidator)},decrypt:function(t){t!==void 0&&(e.encryptedContent.key=t),Os(e)}},e};Qe.createEnvelopedData=function(){var e=null;return e={type:D.pki.oids.envelopedData,version:0,recipients:[],encryptedContent:{algorithm:D.pki.oids["aes256-CBC"]},fromAsn1:function(t){var a=yn(e,t,Qe.asn1.envelopedDataValidator);e.recipients=af(a.recipientInfos.value)},toAsn1:function(){return C.create(C.Class.UNIVERSAL,C.Type.SEQUENCE,!0,[C.create(C.Class.UNIVERSAL,C.Type.OID,!1,C.oidToDer(e.type).getBytes()),C.create(C.Class.CONTEXT_SPECIFIC,0,!0,[C.create(C.Class.UNIVERSAL,C.Type.SEQUENCE,!0,[C.create(C.Class.UNIVERSAL,C.Type.INTEGER,!1,C.integerToDer(e.version).getBytes()),C.create(C.Class.UNIVERSAL,C.Type.SET,!0,nf(e.recipients)),C.create(C.Class.UNIVERSAL,C.Type.SEQUENCE,!0,uf(e.encryptedContent))])])])},findRecipient:function(t){for(var a=t.issuer.attributes,r=0;r<e.recipients.length;++r){var n=e.recipients[r],s=n.issuer;if(n.serialNumber===t.serialNumber&&s.length===a.length){for(var i=!0,o=0;o<a.length;++o)if(s[o].type!==a[o].type||s[o].value!==a[o].value){i=!1;break}if(i)return n}}return null},decrypt:function(t,a){if(e.encryptedContent.key===void 0&&t!==void 0&&a!==void 0)switch(t.encryptedContent.algorithm){case D.pki.oids.rsaEncryption:case D.pki.oids.desCBC:var r=a.decrypt(t.encryptedContent.content);e.encryptedContent.key=D.util.createBuffer(r);break;default:throw new Error("Unsupported asymmetric cipher, OID "+t.encryptedContent.algorithm)}Os(e)},addRecipient:function(t){e.recipients.push({version:0,issuer:t.issuer.attributes,serialNumber:t.serialNumber,encryptedContent:{algorithm:D.pki.oids.rsaEncryption,key:t.publicKey}})},encrypt:function(t,a){if(e.encryptedContent.content===void 0){a=a||e.encryptedContent.algorithm,t=t||e.encryptedContent.key;var r,n,s;switch(a){case D.pki.oids["aes128-CBC"]:r=16,n=16,s=D.aes.createEncryptionCipher;break;case D.pki.oids["aes192-CBC"]:r=24,n=16,s=D.aes.createEncryptionCipher;break;case D.pki.oids["aes256-CBC"]:r=32,n=16,s=D.aes.createEncryptionCipher;break;case D.pki.oids["des-EDE3-CBC"]:r=24,n=8,s=D.des.createEncryptionCipher;break;default:throw new Error("Unsupported symmetric cipher, OID "+a)}if(t===void 0)t=D.util.createBuffer(D.random.getBytes(r));else if(t.length()!=r)throw new Error("Symmetric key has wrong length; got "+t.length()+" bytes, expected "+r+".");e.encryptedContent.algorithm=a,e.encryptedContent.key=t,e.encryptedContent.parameter=D.util.createBuffer(D.random.getBytes(n));var i=s(t);if(i.start(e.encryptedContent.parameter.copy()),i.update(e.content),!i.finish())throw new Error("Symmetric encryption failed.");e.encryptedContent.content=i.output}for(var o=0;o<e.recipients.length;++o){var l=e.recipients[o];if(l.encryptedContent.content===void 0)if(l.encryptedContent.algorithm===D.pki.oids.rsaEncryption)l.encryptedContent.content=l.encryptedContent.key.encrypt(e.encryptedContent.key.data);else throw new Error("Unsupported asymmetric cipher, OID "+l.encryptedContent.algorithm)}}},e};function tf(e){var t={},a=[];if(!C.validate(e,Qe.asn1.recipientInfoValidator,t,a)){var r=new Error("Cannot read PKCS#7 RecipientInfo. ASN.1 object is not an PKCS#7 RecipientInfo.");throw r.errors=a,r}return{version:t.version.charCodeAt(0),issuer:D.pki.RDNAttributesAsArray(t.issuer),serialNumber:D.util.createBuffer(t.serial).toHex(),encryptedContent:{algorithm:C.derToOid(t.encAlgorithm),parameter:t.encParameter?t.encParameter.value:void 0,content:t.encKey}}}function rf(e){return C.create(C.Class.UNIVERSAL,C.Type.SEQUENCE,!0,[C.create(C.Class.UNIVERSAL,C.Type.INTEGER,!1,C.integerToDer(e.version).getBytes()),C.create(C.Class.UNIVERSAL,C.Type.SEQUENCE,!0,[D.pki.distinguishedNameToAsn1({attributes:e.issuer}),C.create(C.Class.UNIVERSAL,C.Type.INTEGER,!1,D.util.hexToBytes(e.serialNumber))]),C.create(C.Class.UNIVERSAL,C.Type.SEQUENCE,!0,[C.create(C.Class.UNIVERSAL,C.Type.OID,!1,C.oidToDer(e.encryptedContent.algorithm).getBytes()),C.create(C.Class.UNIVERSAL,C.Type.NULL,!1,"")]),C.create(C.Class.UNIVERSAL,C.Type.OCTETSTRING,!1,e.encryptedContent.content)])}function af(e){for(var t=[],a=0;a<e.length;++a)t.push(tf(e[a]));return t}function nf(e){for(var t=[],a=0;a<e.length;++a)t.push(rf(e[a]));return t}function sf(e){var t=C.create(C.Class.UNIVERSAL,C.Type.SEQUENCE,!0,[C.create(C.Class.UNIVERSAL,C.Type.INTEGER,!1,C.integerToDer(e.version).getBytes()),C.create(C.Class.UNIVERSAL,C.Type.SEQUENCE,!0,[D.pki.distinguishedNameToAsn1({attributes:e.issuer}),C.create(C.Class.UNIVERSAL,C.Type.INTEGER,!1,D.util.hexToBytes(e.serialNumber))]),C.create(C.Class.UNIVERSAL,C.Type.SEQUENCE,!0,[C.create(C.Class.UNIVERSAL,C.Type.OID,!1,C.oidToDer(e.digestAlgorithm).getBytes()),C.create(C.Class.UNIVERSAL,C.Type.NULL,!1,"")])]);if(e.authenticatedAttributesAsn1&&t.value.push(e.authenticatedAttributesAsn1),t.value.push(C.create(C.Class.UNIVERSAL,C.Type.SEQUENCE,!0,[C.create(C.Class.UNIVERSAL,C.Type.OID,!1,C.oidToDer(e.signatureAlgorithm).getBytes()),C.create(C.Class.UNIVERSAL,C.Type.NULL,!1,"")])),t.value.push(C.create(C.Class.UNIVERSAL,C.Type.OCTETSTRING,!1,e.signature)),e.unauthenticatedAttributes.length>0){for(var a=C.create(C.Class.CONTEXT_SPECIFIC,1,!0,[]),r=0;r<e.unauthenticatedAttributes.length;++r){var n=e.unauthenticatedAttributes[r];a.values.push(vn(n))}t.value.push(a)}return t}function of(e){for(var t=[],a=0;a<e.length;++a)t.push(sf(e[a]));return t}function vn(e){var t;if(e.type===D.pki.oids.contentType)t=C.create(C.Class.UNIVERSAL,C.Type.OID,!1,C.oidToDer(e.value).getBytes());else if(e.type===D.pki.oids.messageDigest)t=C.create(C.Class.UNIVERSAL,C.Type.OCTETSTRING,!1,e.value.bytes());else if(e.type===D.pki.oids.signingTime){var a=new Date("1950-01-01T00:00:00Z"),r=new Date("2050-01-01T00:00:00Z"),n=e.value;if(typeof n=="string"){var s=Date.parse(n);isNaN(s)?n.length===13?n=C.utcTimeToDate(n):n=C.generalizedTimeToDate(n):n=new Date(s)}n>=a&&n<r?t=C.create(C.Class.UNIVERSAL,C.Type.UTCTIME,!1,C.dateToUtcTime(n)):t=C.create(C.Class.UNIVERSAL,C.Type.GENERALIZEDTIME,!1,C.dateToGeneralizedTime(n))}return C.create(C.Class.UNIVERSAL,C.Type.SEQUENCE,!0,[C.create(C.Class.UNIVERSAL,C.Type.OID,!1,C.oidToDer(e.type).getBytes()),C.create(C.Class.UNIVERSAL,C.Type.SET,!0,[t])])}function uf(e){return[C.create(C.Class.UNIVERSAL,C.Type.OID,!1,C.oidToDer(D.pki.oids.data).getBytes()),C.create(C.Class.UNIVERSAL,C.Type.SEQUENCE,!0,[C.create(C.Class.UNIVERSAL,C.Type.OID,!1,C.oidToDer(e.algorithm).getBytes()),e.parameter?C.create(C.Class.UNIVERSAL,C.Type.OCTETSTRING,!1,e.parameter.getBytes()):void 0]),C.create(C.Class.CONTEXT_SPECIFIC,0,!0,[C.create(C.Class.UNIVERSAL,C.Type.OCTETSTRING,!1,e.content.getBytes())])]}function yn(e,t,a){var r={},n=[];if(!C.validate(t,a,r,n)){var s=new Error("Cannot read PKCS#7 message. ASN.1 object is not a supported PKCS#7 message.");throw s.errors=s,s}var i=C.derToOid(r.contentType);if(i!==D.pki.oids.data)throw new Error("Unsupported PKCS#7 message. Only wrapped ContentType Data supported.");if(r.encryptedContent){var o="";if(D.util.isArray(r.encryptedContent))for(var l=0;l<r.encryptedContent.length;++l){if(r.encryptedContent[l].type!==C.Type.OCTETSTRING)throw new Error("Malformed PKCS#7 message, expecting encrypted content constructed of only OCTET STRING objects.");o+=r.encryptedContent[l].value}else o=r.encryptedContent;e.encryptedContent={algorithm:C.derToOid(r.encAlgorithm),parameter:D.util.createBuffer(r.encParameter.value),content:D.util.createBuffer(o)}}if(r.content){var o="";if(D.util.isArray(r.content))for(var l=0;l<r.content.length;++l){if(r.content[l].type!==C.Type.OCTETSTRING)throw new Error("Malformed PKCS#7 message, expecting content constructed of only OCTET STRING objects.");o+=r.content[l].value}else o=r.content;e.content=D.util.createBuffer(o)}return e.version=r.version.charCodeAt(0),e.rawCapture=r,r}function Os(e){if(e.encryptedContent.key===void 0)throw new Error("Symmetric key not available.");if(e.content===void 0){var t;switch(e.encryptedContent.algorithm){case D.pki.oids["aes128-CBC"]:case D.pki.oids["aes192-CBC"]:case D.pki.oids["aes256-CBC"]:t=D.aes.createDecryptionCipher(e.encryptedContent.key);break;case D.pki.oids.desCBC:case D.pki.oids["des-EDE3-CBC"]:t=D.des.createDecryptionCipher(e.encryptedContent.key);break;default:throw new Error("Unsupported symmetric cipher, OID "+e.encryptedContent.algorithm)}if(t.start(e.encryptedContent.parameter),t.update(e.encryptedContent.content),!t.finish())throw new Error("Symmetric decryption failed.");e.content=t.output}}});var Ms=M((Fc,qs)=>{var Ce=X();Bt();Jt();Mr();ar();ne();var ca=qs.exports=Ce.ssh=Ce.ssh||{};ca.privateKeyToPutty=function(e,t,a){a=a||"",t=t||"";var r="ssh-rsa",n=t===""?"none":"aes256-cbc",s="PuTTY-User-Key-File-2: "+r+`\r
14
+ `+o+t.substr(i+1),s=n-i-1,i=-1,++n}else(t[n]===" "||t[n]===" "||t[n]===",")&&(i=n);return t}function Po(e){return e.replace(/^\s+/,"")}});var mr=M((dc,ri)=>{var pe=X();Ur();Ea();ne();ri.exports=pe.des=pe.des||{};pe.des.startEncrypting=function(e,t,a,r){var n=zr({key:e,output:a,decrypt:!1,mode:r||(t===null?"ECB":"CBC")});return n.start(t),n};pe.des.createEncryptionCipher=function(e,t){return zr({key:e,output:null,decrypt:!1,mode:t})};pe.des.startDecrypting=function(e,t,a,r){var n=zr({key:e,output:a,decrypt:!0,mode:r||(t===null?"ECB":"CBC")});return n.start(t),n};pe.des.createDecryptionCipher=function(e,t){return zr({key:e,output:null,decrypt:!0,mode:t})};pe.des.Algorithm=function(e,t){var a=this;a.name=e,a.mode=new t({blockSize:8,cipher:{encrypt:function(r,n){return ti(a._keys,r,n,!1)},decrypt:function(r,n){return ti(a._keys,r,n,!0)}}}),a._init=!1};pe.des.Algorithm.prototype.initialize=function(e){if(!this._init){var t=pe.util.createBuffer(e.key);if(this.name.indexOf("3DES")===0&&t.length()!==24)throw new Error("Invalid Triple-DES key size: "+t.length()*8);this._keys=zo(t),this._init=!0}};ft("DES-ECB",pe.cipher.modes.ecb);ft("DES-CBC",pe.cipher.modes.cbc);ft("DES-CFB",pe.cipher.modes.cfb);ft("DES-OFB",pe.cipher.modes.ofb);ft("DES-CTR",pe.cipher.modes.ctr);ft("3DES-ECB",pe.cipher.modes.ecb);ft("3DES-CBC",pe.cipher.modes.cbc);ft("3DES-CFB",pe.cipher.modes.cfb);ft("3DES-OFB",pe.cipher.modes.ofb);ft("3DES-CTR",pe.cipher.modes.ctr);function ft(e,t){var a=function(){return new pe.des.Algorithm(e,t)};pe.cipher.registerAlgorithm(e,a)}var Vo=[16843776,0,65536,16843780,16842756,66564,4,65536,1024,16843776,16843780,1024,16778244,16842756,16777216,4,1028,16778240,16778240,66560,66560,16842752,16842752,16778244,65540,16777220,16777220,65540,0,1028,66564,16777216,65536,16843780,4,16842752,16843776,16777216,16777216,1024,16842756,65536,66560,16777220,1024,4,16778244,66564,16843780,65540,16842752,16778244,16777220,1028,66564,16843776,1028,16778240,16778240,0,65540,66560,0,16842756],Oo=[-2146402272,-2147450880,32768,1081376,1048576,32,-2146435040,-2147450848,-2147483616,-2146402272,-2146402304,-2147483648,-2147450880,1048576,32,-2146435040,1081344,1048608,-2147450848,0,-2147483648,32768,1081376,-2146435072,1048608,-2147483616,0,1081344,32800,-2146402304,-2146435072,32800,0,1081376,-2146435040,1048576,-2147450848,-2146435072,-2146402304,32768,-2146435072,-2147450880,32,-2146402272,1081376,32,32768,-2147483648,32800,-2146402304,1048576,-2147483616,1048608,-2147450848,-2147483616,1048608,1081344,0,-2147450880,32800,-2147483648,-2146435040,-2146402272,1081344],Ko=[520,134349312,0,134348808,134218240,0,131592,134218240,131080,134217736,134217736,131072,134349320,131080,134348800,520,134217728,8,134349312,512,131584,134348800,134348808,131592,134218248,131584,131072,134218248,8,134349320,512,134217728,134349312,134217728,131080,520,131072,134349312,134218240,0,512,131080,134349320,134218240,134217736,512,0,134348808,134218248,131072,134217728,134349320,8,131592,131584,134217736,134348800,134218248,520,134348800,131592,8,134348808,131584],Fo=[8396801,8321,8321,128,8396928,8388737,8388609,8193,0,8396800,8396800,8396929,129,0,8388736,8388609,1,8192,8388608,8396801,128,8388608,8193,8320,8388737,1,8320,8388736,8192,8396928,8396929,129,8388736,8388609,8396800,8396929,129,0,0,8396800,8320,8388736,8388737,1,8396801,8321,8321,128,8396929,129,1,8192,8388609,8193,8396928,8388737,8193,8320,8388608,8396801,128,8388608,8192,8396928],qo=[256,34078976,34078720,1107296512,524288,256,1073741824,34078720,1074266368,524288,33554688,1074266368,1107296512,1107820544,524544,1073741824,33554432,1074266112,1074266112,0,1073742080,1107820800,1107820800,33554688,1107820544,1073742080,0,1107296256,34078976,33554432,1107296256,524544,524288,1107296512,256,33554432,1073741824,34078720,1107296512,1074266368,33554688,1073741824,1107820544,34078976,1074266368,256,33554432,1107820544,1107820800,524544,1107296256,1107820800,34078720,0,1074266112,1107296256,524544,33554688,1073742080,524288,0,1074266112,34078976,1073742080],Mo=[536870928,541065216,16384,541081616,541065216,16,541081616,4194304,536887296,4210704,4194304,536870928,4194320,536887296,536870912,16400,0,4194320,536887312,16384,4210688,536887312,16,541065232,541065232,0,4210704,541081600,16400,4210688,541081600,536870912,536887296,16,541065232,4210688,541081616,4194304,16400,536870928,4194304,536887296,536870912,16400,536870928,541081616,4210688,541065216,4210704,541081600,0,541065232,16,16384,541065216,4210704,16384,4194320,536887312,0,541081600,536870912,4194320,536887312],Ho=[2097152,69206018,67110914,0,2048,67110914,2099202,69208064,69208066,2097152,0,67108866,2,67108864,69206018,2050,67110912,2099202,2097154,67110912,67108866,69206016,69208064,2097154,69206016,2048,2050,69208066,2099200,2,67108864,2099200,67108864,2099200,2097152,67110914,67110914,69206018,69206018,2,2097154,67108864,67110912,2097152,69208064,2050,2099202,69208064,2050,67108866,69208066,69206016,2099200,0,2,69208066,0,2099202,69206016,2048,67108866,67110912,2048,2097154],Go=[268439616,4096,262144,268701760,268435456,268439616,64,268435456,262208,268697600,268701760,266240,268701696,266304,4096,64,268697600,268435520,268439552,4160,266240,262208,268697664,268701696,4160,0,0,268697664,268435520,268439552,266304,262144,266304,262144,268701696,4096,64,268697664,4096,266304,268439552,64,268435520,268697600,268697664,268435456,262144,268439616,0,268701760,262208,268435520,268697600,268439552,268439616,0,268701760,266240,266240,4160,4160,262208,268435456,268701696];function zo(e){for(var t=[0,4,536870912,536870916,65536,65540,536936448,536936452,512,516,536871424,536871428,66048,66052,536936960,536936964],a=[0,1,1048576,1048577,67108864,67108865,68157440,68157441,256,257,1048832,1048833,67109120,67109121,68157696,68157697],r=[0,8,2048,2056,16777216,16777224,16779264,16779272,0,8,2048,2056,16777216,16777224,16779264,16779272],n=[0,2097152,134217728,136314880,8192,2105344,134225920,136323072,131072,2228224,134348800,136445952,139264,2236416,134356992,136454144],s=[0,262144,16,262160,0,262144,16,262160,4096,266240,4112,266256,4096,266240,4112,266256],i=[0,1024,32,1056,0,1024,32,1056,33554432,33555456,33554464,33555488,33554432,33555456,33554464,33555488],o=[0,268435456,524288,268959744,2,268435458,524290,268959746,0,268435456,524288,268959744,2,268435458,524290,268959746],l=[0,65536,2048,67584,536870912,536936448,536872960,536938496,131072,196608,133120,198656,537001984,537067520,537004032,537069568],u=[0,262144,0,262144,2,262146,2,262146,33554432,33816576,33554432,33816576,33554434,33816578,33554434,33816578],f=[0,268435456,8,268435464,0,268435456,8,268435464,1024,268436480,1032,268436488,1024,268436480,1032,268436488],c=[0,32,0,32,1048576,1048608,1048576,1048608,8192,8224,8192,8224,1056768,1056800,1056768,1056800],v=[0,16777216,512,16777728,2097152,18874368,2097664,18874880,67108864,83886080,67109376,83886592,69206016,85983232,69206528,85983744],g=[0,4096,134217728,134221824,524288,528384,134742016,134746112,16,4112,134217744,134221840,524304,528400,134742032,134746128],y=[0,4,256,260,0,4,256,260,1,5,257,261,1,5,257,261],x=e.length()>8?3:1,S=[],I=[0,0,1,1,1,1,1,1,0,1,1,1,1,1,1,0],B=0,b,U=0;U<x;U++){var L=e.getInt32(),w=e.getInt32();b=(L>>>4^w)&252645135,w^=b,L^=b<<4,b=(w>>>-16^L)&65535,L^=b,w^=b<<-16,b=(L>>>2^w)&858993459,w^=b,L^=b<<2,b=(w>>>-16^L)&65535,L^=b,w^=b<<-16,b=(L>>>1^w)&1431655765,w^=b,L^=b<<1,b=(w>>>8^L)&16711935,L^=b,w^=b<<8,b=(L>>>1^w)&1431655765,w^=b,L^=b<<1,b=L<<8|w>>>20&240,L=w<<24|w<<8&16711680|w>>>8&65280|w>>>24&240,w=b;for(var z=0;z<I.length;++z){I[z]?(L=L<<2|L>>>26,w=w<<2|w>>>26):(L=L<<1|L>>>27,w=w<<1|w>>>27),L&=-15,w&=-15;var G=t[L>>>28]|a[L>>>24&15]|r[L>>>20&15]|n[L>>>16&15]|s[L>>>12&15]|i[L>>>8&15]|o[L>>>4&15],W=l[w>>>28]|u[w>>>24&15]|f[w>>>20&15]|c[w>>>16&15]|v[w>>>12&15]|g[w>>>8&15]|y[w>>>4&15];b=(W>>>16^G)&65535,S[B++]=G^b,S[B++]=W^b<<16}}return S}function ti(e,t,a,r){var n=e.length===32?3:9,s;n===3?s=r?[30,-2,-2]:[0,32,2]:s=r?[94,62,-2,32,64,2,30,-2,-2]:[0,32,2,62,30,-2,64,96,2];var i,o=t[0],l=t[1];i=(o>>>4^l)&252645135,l^=i,o^=i<<4,i=(o>>>16^l)&65535,l^=i,o^=i<<16,i=(l>>>2^o)&858993459,o^=i,l^=i<<2,i=(l>>>8^o)&16711935,o^=i,l^=i<<8,i=(o>>>1^l)&1431655765,l^=i,o^=i<<1,o=o<<1|o>>>31,l=l<<1|l>>>31;for(var u=0;u<n;u+=3){for(var f=s[u+1],c=s[u+2],v=s[u];v!=f;v+=c){var g=l^e[v],y=(l>>>4|l<<28)^e[v+1];i=o,o=l,l=i^(Oo[g>>>24&63]|Fo[g>>>16&63]|Mo[g>>>8&63]|Go[g&63]|Vo[y>>>24&63]|Ko[y>>>16&63]|qo[y>>>8&63]|Ho[y&63])}i=o,o=l,l=i}o=o>>>1|o<<31,l=l>>>1|l<<31,i=(o>>>1^l)&1431655765,l^=i,o^=i<<1,i=(l>>>8^o)&16711935,o^=i,l^=i<<8,i=(l>>>2^o)&858993459,o^=i,l^=i<<2,i=(o>>>16^l)&65535,l^=i,o^=i<<16,i=(o>>>4^l)&252645135,l^=i,o^=i<<4,a[0]=o,a[1]=l}function zr(e){e=e||{};var t=(e.mode||"CBC").toUpperCase(),a="DES-"+t,r;e.decrypt?r=pe.cipher.createDecipher(a,e.key):r=pe.cipher.createCipher(a,e.key);var n=r.start;return r.start=function(s,i){var o=null;i instanceof pe.util.ByteBuffer&&(o=i,i={}),i=i||{},i.output=o,i.iv=s,n.call(r,i)},r}});var Qr=M((pc,ai)=>{var Ge=X();Jt();ut();ne();var Qo=Ge.pkcs5=Ge.pkcs5||{},Ct;Ge.util.isNodejs&&!Ge.options.usePureJavaScript&&(Ct=require("crypto"));ai.exports=Ge.pbkdf2=Qo.pbkdf2=function(e,t,a,r,n,s){if(typeof n=="function"&&(s=n,n=null),Ge.util.isNodejs&&!Ge.options.usePureJavaScript&&Ct.pbkdf2&&(n===null||typeof n!="object")&&(Ct.pbkdf2Sync.length>4||!n||n==="sha1"))return typeof n!="string"&&(n="sha1"),e=Buffer.from(e,"binary"),t=Buffer.from(t,"binary"),s?Ct.pbkdf2Sync.length===4?Ct.pbkdf2(e,t,a,r,function(b,U){if(b)return s(b);s(null,U.toString("binary"))}):Ct.pbkdf2(e,t,a,r,n,function(b,U){if(b)return s(b);s(null,U.toString("binary"))}):Ct.pbkdf2Sync.length===4?Ct.pbkdf2Sync(e,t,a,r).toString("binary"):Ct.pbkdf2Sync(e,t,a,r,n).toString("binary");if((typeof n>"u"||n===null)&&(n="sha1"),typeof n=="string"){if(!(n in Ge.md.algorithms))throw new Error("Unknown hash algorithm: "+n);n=Ge.md[n].create()}var i=n.digestLength;if(r>4294967295*i){var o=new Error("Derived key is too long.");if(s)return s(o);throw o}var l=Math.ceil(r/i),u=r-(l-1)*i,f=Ge.hmac.create();f.start(n,e);var c="",v,g,y;if(!s){for(var x=1;x<=l;++x){f.start(null,null),f.update(t),f.update(Ge.util.int32ToBytes(x)),v=y=f.digest().getBytes();for(var S=2;S<=a;++S)f.start(null,null),f.update(y),g=f.digest().getBytes(),v=Ge.util.xorBytes(v,g,i),y=g;c+=x<l?v:v.substr(0,u)}return c}var x=1,S;function I(){if(x>l)return s(null,c);f.start(null,null),f.update(t),f.update(Ge.util.int32ToBytes(x)),v=y=f.digest().getBytes(),S=2,B()}function B(){if(S<=a)return f.start(null,null),f.update(y),g=f.digest().getBytes(),v=Ge.util.xorBytes(v,g,i),y=g,++S,Ge.util.setImmediate(B);c+=x<l?v:v.substr(0,u),++x,I()}I()}});var ba=M((vc,ui)=>{var ct=X();ut();ne();var ii=ui.exports=ct.sha256=ct.sha256||{};ct.md.sha256=ct.md.algorithms.sha256=ii;ii.create=function(){si||Yo();var e=null,t=ct.util.createBuffer(),a=new Array(64),r={algorithm:"sha256",blockLength:64,digestLength:32,messageLength:0,fullMessageLength:null,messageLengthSize:8};return r.start=function(){r.messageLength=0,r.fullMessageLength=r.messageLength64=[];for(var n=r.messageLengthSize/4,s=0;s<n;++s)r.fullMessageLength.push(0);return t=ct.util.createBuffer(),e={h0:1779033703,h1:3144134277,h2:1013904242,h3:2773480762,h4:1359893119,h5:2600822924,h6:528734635,h7:1541459225},r},r.start(),r.update=function(n,s){s==="utf8"&&(n=ct.util.encodeUtf8(n));var i=n.length;r.messageLength+=i,i=[i/4294967296>>>0,i>>>0];for(var o=r.fullMessageLength.length-1;o>=0;--o)r.fullMessageLength[o]+=i[1],i[1]=i[0]+(r.fullMessageLength[o]/4294967296>>>0),r.fullMessageLength[o]=r.fullMessageLength[o]>>>0,i[0]=i[1]/4294967296>>>0;return t.putBytes(n),ni(e,a,t),(t.read>2048||t.length()===0)&&t.compact(),r},r.digest=function(){var n=ct.util.createBuffer();n.putBytes(t.bytes());var s=r.fullMessageLength[r.fullMessageLength.length-1]+r.messageLengthSize,i=s&r.blockLength-1;n.putBytes(Ba.substr(0,r.blockLength-i));for(var o,l,u=r.fullMessageLength[0]*8,f=0;f<r.fullMessageLength.length-1;++f)o=r.fullMessageLength[f+1]*8,l=o/4294967296>>>0,u+=l,n.putInt32(u>>>0),u=o>>>0;n.putInt32(u);var c={h0:e.h0,h1:e.h1,h2:e.h2,h3:e.h3,h4:e.h4,h5:e.h5,h6:e.h6,h7:e.h7};ni(c,a,n);var v=ct.util.createBuffer();return v.putInt32(c.h0),v.putInt32(c.h1),v.putInt32(c.h2),v.putInt32(c.h3),v.putInt32(c.h4),v.putInt32(c.h5),v.putInt32(c.h6),v.putInt32(c.h7),v},r};var Ba=null,si=!1,oi=null;function Yo(){Ba="\x80",Ba+=ct.util.fillString("\0",64),oi=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298],si=!0}function ni(e,t,a){for(var r,n,s,i,o,l,u,f,c,v,g,y,x,S,I,B=a.length();B>=64;){for(u=0;u<16;++u)t[u]=a.getInt32();for(;u<64;++u)r=t[u-2],r=(r>>>17|r<<15)^(r>>>19|r<<13)^r>>>10,n=t[u-15],n=(n>>>7|n<<25)^(n>>>18|n<<14)^n>>>3,t[u]=r+t[u-7]+n+t[u-16]|0;for(f=e.h0,c=e.h1,v=e.h2,g=e.h3,y=e.h4,x=e.h5,S=e.h6,I=e.h7,u=0;u<64;++u)i=(y>>>6|y<<26)^(y>>>11|y<<21)^(y>>>25|y<<7),o=S^y&(x^S),s=(f>>>2|f<<30)^(f>>>13|f<<19)^(f>>>22|f<<10),l=f&c|v&(f^c),r=I+i+o+oi[u]+t[u],n=s+l,I=S,S=x,x=y,y=g+r>>>0,g=v,v=c,c=f,f=r+n>>>0;e.h0=e.h0+f|0,e.h1=e.h1+c|0,e.h2=e.h2+v|0,e.h3=e.h3+g|0,e.h4=e.h4+y|0,e.h5=e.h5+x|0,e.h6=e.h6+S|0,e.h7=e.h7+I|0,B-=64}}});var _a=M((yc,li)=>{var ht=X();ne();var Yr=null;ht.util.isNodejs&&!ht.options.usePureJavaScript&&!process.versions["node-webkit"]&&(Yr=require("crypto"));var Xo=li.exports=ht.prng=ht.prng||{};Xo.create=function(e){for(var t={plugin:e,key:null,seed:null,time:null,reseeds:0,generated:0,keyBytes:""},a=e.md,r=new Array(32),n=0;n<32;++n)r[n]=a.create();t.pools=r,t.pool=0,t.generate=function(u,f){if(!f)return t.generateSync(u);var c=t.plugin.cipher,v=t.plugin.increment,g=t.plugin.formatKey,y=t.plugin.formatSeed,x=ht.util.createBuffer();t.key=null,S();function S(I){if(I)return f(I);if(x.length()>=u)return f(null,x.getBytes(u));if(t.generated>1048575&&(t.key=null),t.key===null)return ht.util.nextTick(function(){s(S)});var B=c(t.key,t.seed);t.generated+=B.length,x.putBytes(B),t.key=g(c(t.key,v(t.seed))),t.seed=y(c(t.key,t.seed)),ht.util.setImmediate(S)}},t.generateSync=function(u){var f=t.plugin.cipher,c=t.plugin.increment,v=t.plugin.formatKey,g=t.plugin.formatSeed;t.key=null;for(var y=ht.util.createBuffer();y.length()<u;){t.generated>1048575&&(t.key=null),t.key===null&&i();var x=f(t.key,t.seed);t.generated+=x.length,y.putBytes(x),t.key=v(f(t.key,c(t.seed))),t.seed=g(f(t.key,t.seed))}return y.getBytes(u)};function s(u){if(t.pools[0].messageLength>=32)return o(),u();var f=32-t.pools[0].messageLength<<5;t.seedFile(f,function(c,v){if(c)return u(c);t.collect(v),o(),u()})}function i(){if(t.pools[0].messageLength>=32)return o();var u=32-t.pools[0].messageLength<<5;t.collect(t.seedFileSync(u)),o()}function o(){t.reseeds=t.reseeds===4294967295?0:t.reseeds+1;var u=t.plugin.md.create();u.update(t.keyBytes);for(var f=1,c=0;c<32;++c)t.reseeds%f===0&&(u.update(t.pools[c].digest().getBytes()),t.pools[c].start()),f=f<<1;t.keyBytes=u.digest().getBytes(),u.start(),u.update(t.keyBytes);var v=u.digest().getBytes();t.key=t.plugin.formatKey(t.keyBytes),t.seed=t.plugin.formatSeed(v),t.generated=0}function l(u){var f=null,c=ht.util.globalScope,v=c.crypto||c.msCrypto;v&&v.getRandomValues&&(f=function(L){return v.getRandomValues(L)});var g=ht.util.createBuffer();if(f)for(;g.length()<u;){var y=Math.max(1,Math.min(u-g.length(),65536)/4),x=new Uint32Array(Math.floor(y));try{f(x);for(var S=0;S<x.length;++S)g.putInt32(x[S])}catch(L){if(!(typeof QuotaExceededError<"u"&&L instanceof QuotaExceededError))throw L}}if(g.length()<u)for(var I,B,b,U=Math.floor(Math.random()*65536);g.length()<u;){B=16807*(U&65535),I=16807*(U>>16),B+=(I&32767)<<16,B+=I>>15,B=(B&2147483647)+(B>>31),U=B&4294967295;for(var S=0;S<3;++S)b=U>>>(S<<3),b^=Math.floor(Math.random()*256),g.putByte(b&255)}return g.getBytes(u)}return Yr?(t.seedFile=function(u,f){Yr.randomBytes(u,function(c,v){if(c)return f(c);f(null,v.toString())})},t.seedFileSync=function(u){return Yr.randomBytes(u).toString()}):(t.seedFile=function(u,f){try{f(null,l(u))}catch(c){f(c)}},t.seedFileSync=l),t.collect=function(u){for(var f=u.length,c=0;c<f;++c)t.pools[t.pool].update(u.substr(c,1)),t.pool=t.pool===31?0:t.pool+1},t.collectInt=function(u,f){for(var c="",v=0;v<f;v+=8)c+=String.fromCharCode(u>>v&255);t.collect(c)},t.registerWorker=function(u){if(u===self)t.seedFile=function(c,v){function g(y){var x=y.data;x.forge&&x.forge.prng&&(self.removeEventListener("message",g),v(x.forge.prng.err,x.forge.prng.bytes))}self.addEventListener("message",g),self.postMessage({forge:{prng:{needed:c}}})};else{var f=function(c){var v=c.data;v.forge&&v.forge.prng&&t.seedFile(v.forge.prng.needed,function(g,y){u.postMessage({forge:{prng:{err:g,bytes:y}}})})};u.addEventListener("message",f)}},t}});var Je=M((gc,Na)=>{var Ie=X();Bt();ba();_a();ne();(function(){if(Ie.random&&Ie.random.getBytes){Na.exports=Ie.random;return}(function(e){var t={},a=new Array(4),r=Ie.util.createBuffer();t.formatKey=function(c){var v=Ie.util.createBuffer(c);return c=new Array(4),c[0]=v.getInt32(),c[1]=v.getInt32(),c[2]=v.getInt32(),c[3]=v.getInt32(),Ie.aes._expandKey(c,!1)},t.formatSeed=function(c){var v=Ie.util.createBuffer(c);return c=new Array(4),c[0]=v.getInt32(),c[1]=v.getInt32(),c[2]=v.getInt32(),c[3]=v.getInt32(),c},t.cipher=function(c,v){return Ie.aes._updateBlock(c,v,a,!1),r.putInt32(a[0]),r.putInt32(a[1]),r.putInt32(a[2]),r.putInt32(a[3]),r.getBytes()},t.increment=function(c){return++c[3],c},t.md=Ie.md.sha256;function n(){var c=Ie.prng.create(t);return c.getBytes=function(v,g){return c.generate(v,g)},c.getBytesSync=function(v){return c.generate(v)},c}var s=n(),i=null,o=Ie.util.globalScope,l=o.crypto||o.msCrypto;if(l&&l.getRandomValues&&(i=function(c){return l.getRandomValues(c)}),Ie.options.usePureJavaScript||!Ie.util.isNodejs&&!i){if(typeof window>"u"||window.document,s.collectInt(+new Date,32),typeof navigator<"u"){var u="";for(var f in navigator)try{typeof navigator[f]=="string"&&(u+=navigator[f])}catch{}s.collect(u),u=null}e&&(e().mousemove(function(c){s.collectInt(c.clientX,16),s.collectInt(c.clientY,16)}),e().keypress(function(c){s.collectInt(c.charCode,8)}))}if(!Ie.random)Ie.random=s;else for(var f in s)Ie.random[f]=s[f];Ie.random.createInstance=n,Na.exports=Ie.random})(typeof jQuery<"u"?jQuery:null)})()});var wa=M((mc,hi)=>{var Ye=X();ne();var Ra=[217,120,249,196,25,221,181,237,40,233,253,121,74,160,216,157,198,126,55,131,43,118,83,142,98,76,100,136,68,139,251,162,23,154,89,245,135,179,79,19,97,69,109,141,9,129,125,50,189,143,64,235,134,183,123,11,240,149,33,34,92,107,78,130,84,214,101,147,206,96,178,28,115,86,192,20,167,140,241,220,18,117,202,31,59,190,228,209,66,61,212,48,163,60,182,38,111,191,14,218,70,105,7,87,39,242,29,155,188,148,67,3,248,17,199,246,144,239,62,231,6,195,213,47,200,102,30,215,8,232,234,222,128,82,238,247,132,170,114,172,53,77,106,42,150,26,210,113,90,21,73,116,75,159,208,94,4,24,164,236,194,224,65,110,15,81,203,204,36,145,175,80,161,244,112,57,153,124,58,133,35,184,180,122,252,2,54,91,37,85,151,49,45,93,250,152,227,138,146,174,5,223,41,16,103,108,186,201,211,0,230,207,225,158,168,44,99,22,1,63,88,226,137,169,13,56,52,27,171,51,255,176,187,72,12,95,185,177,205,46,197,243,219,71,229,165,156,119,10,166,32,104,254,127,193,173],fi=[1,2,3,5],Wo=function(e,t){return e<<t&65535|(e&65535)>>16-t},jo=function(e,t){return(e&65535)>>t|e<<16-t&65535};hi.exports=Ye.rc2=Ye.rc2||{};Ye.rc2.expandKey=function(e,t){typeof e=="string"&&(e=Ye.util.createBuffer(e)),t=t||128;var a=e,r=e.length(),n=t,s=Math.ceil(n/8),i=255>>(n&7),o;for(o=r;o<128;o++)a.putByte(Ra[a.at(o-1)+a.at(o-r)&255]);for(a.setAt(128-s,Ra[a.at(128-s)&i]),o=127-s;o>=0;o--)a.setAt(o,Ra[a.at(o+1)^a.at(o+s)]);return a};var ci=function(e,t,a){var r=!1,n=null,s=null,i=null,o,l,u,f,c=[];for(e=Ye.rc2.expandKey(e,t),u=0;u<64;u++)c.push(e.getInt16Le());a?(o=function(y){for(u=0;u<4;u++)y[u]+=c[f]+(y[(u+3)%4]&y[(u+2)%4])+(~y[(u+3)%4]&y[(u+1)%4]),y[u]=Wo(y[u],fi[u]),f++},l=function(y){for(u=0;u<4;u++)y[u]+=c[y[(u+3)%4]&63]}):(o=function(y){for(u=3;u>=0;u--)y[u]=jo(y[u],fi[u]),y[u]-=c[f]+(y[(u+3)%4]&y[(u+2)%4])+(~y[(u+3)%4]&y[(u+1)%4]),f--},l=function(y){for(u=3;u>=0;u--)y[u]-=c[y[(u+3)%4]&63]});var v=function(y){var x=[];for(u=0;u<4;u++){var S=n.getInt16Le();i!==null&&(a?S^=i.getInt16Le():i.putInt16Le(S)),x.push(S&65535)}f=a?0:63;for(var I=0;I<y.length;I++)for(var B=0;B<y[I][0];B++)y[I][1](x);for(u=0;u<4;u++)i!==null&&(a?i.putInt16Le(x[u]):x[u]^=i.getInt16Le()),s.putInt16Le(x[u])},g=null;return g={start:function(y,x){y&&typeof y=="string"&&(y=Ye.util.createBuffer(y)),r=!1,n=Ye.util.createBuffer(),s=x||new Ye.util.createBuffer,i=y,g.output=s},update:function(y){for(r||n.putBuffer(y);n.length()>=8;)v([[5,o],[1,l],[6,o],[1,l],[5,o]])},finish:function(y){var x=!0;if(a)if(y)x=y(8,n,!a);else{var S=n.length()===8?8:8-n.length();n.fillWithByte(S,S)}if(x&&(r=!0,g.update()),!a&&(x=n.length()===0,x))if(y)x=y(8,s,!a);else{var I=s.length(),B=s.at(I-1);B>I?x=!1:s.truncate(B)}return x}},g};Ye.rc2.startEncrypting=function(e,t,a){var r=Ye.rc2.createEncryptionCipher(e,128);return r.start(t,a),r};Ye.rc2.createEncryptionCipher=function(e,t){return ci(e,t,!0)};Ye.rc2.startDecrypting=function(e,t,a){var r=Ye.rc2.createDecryptionCipher(e,128);return r.start(t,a),r};Ye.rc2.createDecryptionCipher=function(e,t){return ci(e,t,!1)}});var Er=M((Cc,Ei)=>{var La=X();Ei.exports=La.jsbn=La.jsbn||{};var Et,$o=0xdeadbeefcafe,di=($o&16777215)==15715070;function _(e,t,a){this.data=[],e!=null&&(typeof e=="number"?this.fromNumber(e,t,a):t==null&&typeof e!="string"?this.fromString(e,256):this.fromString(e,t))}La.jsbn.BigInteger=_;function te(){return new _(null)}function Zo(e,t,a,r,n,s){for(;--s>=0;){var i=t*this.data[e++]+a.data[r]+n;n=Math.floor(i/67108864),a.data[r++]=i&67108863}return n}function Jo(e,t,a,r,n,s){for(var i=t&32767,o=t>>15;--s>=0;){var l=this.data[e]&32767,u=this.data[e++]>>15,f=o*l+u*i;l=i*l+((f&32767)<<15)+a.data[r]+(n&1073741823),n=(l>>>30)+(f>>>15)+o*u+(n>>>30),a.data[r++]=l&1073741823}return n}function pi(e,t,a,r,n,s){for(var i=t&16383,o=t>>14;--s>=0;){var l=this.data[e]&16383,u=this.data[e++]>>14,f=o*l+u*i;l=i*l+((f&16383)<<14)+a.data[r]+n,n=(l>>28)+(f>>14)+o*u,a.data[r++]=l&268435455}return n}typeof navigator>"u"?(_.prototype.am=pi,Et=28):di&&navigator.appName=="Microsoft Internet Explorer"?(_.prototype.am=Jo,Et=30):di&&navigator.appName!="Netscape"?(_.prototype.am=Zo,Et=26):(_.prototype.am=pi,Et=28);_.prototype.DB=Et;_.prototype.DM=(1<<Et)-1;_.prototype.DV=1<<Et;var ka=52;_.prototype.FV=Math.pow(2,ka);_.prototype.F1=ka-Et;_.prototype.F2=2*Et-ka;var e0="0123456789abcdefghijklmnopqrstuvwxyz",Xr=new Array,tr,et;tr=48;for(et=0;et<=9;++et)Xr[tr++]=et;tr=97;for(et=10;et<36;++et)Xr[tr++]=et;tr=65;for(et=10;et<36;++et)Xr[tr++]=et;function vi(e){return e0.charAt(e)}function yi(e,t){var a=Xr[e.charCodeAt(t)];return a??-1}function t0(e){for(var t=this.t-1;t>=0;--t)e.data[t]=this.data[t];e.t=this.t,e.s=this.s}function r0(e){this.t=1,this.s=e<0?-1:0,e>0?this.data[0]=e:e<-1?this.data[0]=e+this.DV:this.t=0}function _t(e){var t=te();return t.fromInt(e),t}function a0(e,t){var a;if(t==16)a=4;else if(t==8)a=3;else if(t==256)a=8;else if(t==2)a=1;else if(t==32)a=5;else if(t==4)a=2;else{this.fromRadix(e,t);return}this.t=0,this.s=0;for(var r=e.length,n=!1,s=0;--r>=0;){var i=a==8?e[r]&255:yi(e,r);if(i<0){e.charAt(r)=="-"&&(n=!0);continue}n=!1,s==0?this.data[this.t++]=i:s+a>this.DB?(this.data[this.t-1]|=(i&(1<<this.DB-s)-1)<<s,this.data[this.t++]=i>>this.DB-s):this.data[this.t-1]|=i<<s,s+=a,s>=this.DB&&(s-=this.DB)}a==8&&(e[0]&128)!=0&&(this.s=-1,s>0&&(this.data[this.t-1]|=(1<<this.DB-s)-1<<s)),this.clamp(),n&&_.ZERO.subTo(this,this)}function n0(){for(var e=this.s&this.DM;this.t>0&&this.data[this.t-1]==e;)--this.t}function i0(e){if(this.s<0)return"-"+this.negate().toString(e);var t;if(e==16)t=4;else if(e==8)t=3;else if(e==2)t=1;else if(e==32)t=5;else if(e==4)t=2;else return this.toRadix(e);var a=(1<<t)-1,r,n=!1,s="",i=this.t,o=this.DB-i*this.DB%t;if(i-- >0)for(o<this.DB&&(r=this.data[i]>>o)>0&&(n=!0,s=vi(r));i>=0;)o<t?(r=(this.data[i]&(1<<o)-1)<<t-o,r|=this.data[--i]>>(o+=this.DB-t)):(r=this.data[i]>>(o-=t)&a,o<=0&&(o+=this.DB,--i)),r>0&&(n=!0),n&&(s+=vi(r));return n?s:"0"}function s0(){var e=te();return _.ZERO.subTo(this,e),e}function o0(){return this.s<0?this.negate():this}function u0(e){var t=this.s-e.s;if(t!=0)return t;var a=this.t;if(t=a-e.t,t!=0)return this.s<0?-t:t;for(;--a>=0;)if((t=this.data[a]-e.data[a])!=0)return t;return 0}function Wr(e){var t=1,a;return(a=e>>>16)!=0&&(e=a,t+=16),(a=e>>8)!=0&&(e=a,t+=8),(a=e>>4)!=0&&(e=a,t+=4),(a=e>>2)!=0&&(e=a,t+=2),(a=e>>1)!=0&&(e=a,t+=1),t}function l0(){return this.t<=0?0:this.DB*(this.t-1)+Wr(this.data[this.t-1]^this.s&this.DM)}function f0(e,t){var a;for(a=this.t-1;a>=0;--a)t.data[a+e]=this.data[a];for(a=e-1;a>=0;--a)t.data[a]=0;t.t=this.t+e,t.s=this.s}function c0(e,t){for(var a=e;a<this.t;++a)t.data[a-e]=this.data[a];t.t=Math.max(this.t-e,0),t.s=this.s}function h0(e,t){var a=e%this.DB,r=this.DB-a,n=(1<<r)-1,s=Math.floor(e/this.DB),i=this.s<<a&this.DM,o;for(o=this.t-1;o>=0;--o)t.data[o+s+1]=this.data[o]>>r|i,i=(this.data[o]&n)<<a;for(o=s-1;o>=0;--o)t.data[o]=0;t.data[s]=i,t.t=this.t+s+1,t.s=this.s,t.clamp()}function d0(e,t){t.s=this.s;var a=Math.floor(e/this.DB);if(a>=this.t){t.t=0;return}var r=e%this.DB,n=this.DB-r,s=(1<<r)-1;t.data[0]=this.data[a]>>r;for(var i=a+1;i<this.t;++i)t.data[i-a-1]|=(this.data[i]&s)<<n,t.data[i-a]=this.data[i]>>r;r>0&&(t.data[this.t-a-1]|=(this.s&s)<<n),t.t=this.t-a,t.clamp()}function p0(e,t){for(var a=0,r=0,n=Math.min(e.t,this.t);a<n;)r+=this.data[a]-e.data[a],t.data[a++]=r&this.DM,r>>=this.DB;if(e.t<this.t){for(r-=e.s;a<this.t;)r+=this.data[a],t.data[a++]=r&this.DM,r>>=this.DB;r+=this.s}else{for(r+=this.s;a<e.t;)r-=e.data[a],t.data[a++]=r&this.DM,r>>=this.DB;r-=e.s}t.s=r<0?-1:0,r<-1?t.data[a++]=this.DV+r:r>0&&(t.data[a++]=r),t.t=a,t.clamp()}function v0(e,t){var a=this.abs(),r=e.abs(),n=a.t;for(t.t=n+r.t;--n>=0;)t.data[n]=0;for(n=0;n<r.t;++n)t.data[n+a.t]=a.am(0,r.data[n],t,n,0,a.t);t.s=0,t.clamp(),this.s!=e.s&&_.ZERO.subTo(t,t)}function y0(e){for(var t=this.abs(),a=e.t=2*t.t;--a>=0;)e.data[a]=0;for(a=0;a<t.t-1;++a){var r=t.am(a,t.data[a],e,2*a,0,1);(e.data[a+t.t]+=t.am(a+1,2*t.data[a],e,2*a+1,r,t.t-a-1))>=t.DV&&(e.data[a+t.t]-=t.DV,e.data[a+t.t+1]=1)}e.t>0&&(e.data[e.t-1]+=t.am(a,t.data[a],e,2*a,0,1)),e.s=0,e.clamp()}function g0(e,t,a){var r=e.abs();if(!(r.t<=0)){var n=this.abs();if(n.t<r.t){t?.fromInt(0),a!=null&&this.copyTo(a);return}a==null&&(a=te());var s=te(),i=this.s,o=e.s,l=this.DB-Wr(r.data[r.t-1]);l>0?(r.lShiftTo(l,s),n.lShiftTo(l,a)):(r.copyTo(s),n.copyTo(a));var u=s.t,f=s.data[u-1];if(f!=0){var c=f*(1<<this.F1)+(u>1?s.data[u-2]>>this.F2:0),v=this.FV/c,g=(1<<this.F1)/c,y=1<<this.F2,x=a.t,S=x-u,I=t??te();for(s.dlShiftTo(S,I),a.compareTo(I)>=0&&(a.data[a.t++]=1,a.subTo(I,a)),_.ONE.dlShiftTo(u,I),I.subTo(s,s);s.t<u;)s.data[s.t++]=0;for(;--S>=0;){var B=a.data[--x]==f?this.DM:Math.floor(a.data[x]*v+(a.data[x-1]+y)*g);if((a.data[x]+=s.am(0,B,a,S,0,u))<B)for(s.dlShiftTo(S,I),a.subTo(I,a);a.data[x]<--B;)a.subTo(I,a)}t!=null&&(a.drShiftTo(u,t),i!=o&&_.ZERO.subTo(t,t)),a.t=u,a.clamp(),l>0&&a.rShiftTo(l,a),i<0&&_.ZERO.subTo(a,a)}}}function m0(e){var t=te();return this.abs().divRemTo(e,null,t),this.s<0&&t.compareTo(_.ZERO)>0&&e.subTo(t,t),t}function Ft(e){this.m=e}function C0(e){return e.s<0||e.compareTo(this.m)>=0?e.mod(this.m):e}function E0(e){return e}function x0(e){e.divRemTo(this.m,null,e)}function S0(e,t,a){e.multiplyTo(t,a),this.reduce(a)}function T0(e,t){e.squareTo(t),this.reduce(t)}Ft.prototype.convert=C0;Ft.prototype.revert=E0;Ft.prototype.reduce=x0;Ft.prototype.mulTo=S0;Ft.prototype.sqrTo=T0;function I0(){if(this.t<1)return 0;var e=this.data[0];if((e&1)==0)return 0;var t=e&3;return t=t*(2-(e&15)*t)&15,t=t*(2-(e&255)*t)&255,t=t*(2-((e&65535)*t&65535))&65535,t=t*(2-e*t%this.DV)%this.DV,t>0?this.DV-t:-t}function qt(e){this.m=e,this.mp=e.invDigit(),this.mpl=this.mp&32767,this.mph=this.mp>>15,this.um=(1<<e.DB-15)-1,this.mt2=2*e.t}function A0(e){var t=te();return e.abs().dlShiftTo(this.m.t,t),t.divRemTo(this.m,null,t),e.s<0&&t.compareTo(_.ZERO)>0&&this.m.subTo(t,t),t}function B0(e){var t=te();return e.copyTo(t),this.reduce(t),t}function b0(e){for(;e.t<=this.mt2;)e.data[e.t++]=0;for(var t=0;t<this.m.t;++t){var a=e.data[t]&32767,r=a*this.mpl+((a*this.mph+(e.data[t]>>15)*this.mpl&this.um)<<15)&e.DM;for(a=t+this.m.t,e.data[a]+=this.m.am(0,r,e,t,0,this.m.t);e.data[a]>=e.DV;)e.data[a]-=e.DV,e.data[++a]++}e.clamp(),e.drShiftTo(this.m.t,e),e.compareTo(this.m)>=0&&e.subTo(this.m,e)}function _0(e,t){e.squareTo(t),this.reduce(t)}function N0(e,t,a){e.multiplyTo(t,a),this.reduce(a)}qt.prototype.convert=A0;qt.prototype.revert=B0;qt.prototype.reduce=b0;qt.prototype.mulTo=N0;qt.prototype.sqrTo=_0;function R0(){return(this.t>0?this.data[0]&1:this.s)==0}function w0(e,t){if(e>4294967295||e<1)return _.ONE;var a=te(),r=te(),n=t.convert(this),s=Wr(e)-1;for(n.copyTo(a);--s>=0;)if(t.sqrTo(a,r),(e&1<<s)>0)t.mulTo(r,n,a);else{var i=a;a=r,r=i}return t.revert(a)}function L0(e,t){var a;return e<256||t.isEven()?a=new Ft(t):a=new qt(t),this.exp(e,a)}_.prototype.copyTo=t0;_.prototype.fromInt=r0;_.prototype.fromString=a0;_.prototype.clamp=n0;_.prototype.dlShiftTo=f0;_.prototype.drShiftTo=c0;_.prototype.lShiftTo=h0;_.prototype.rShiftTo=d0;_.prototype.subTo=p0;_.prototype.multiplyTo=v0;_.prototype.squareTo=y0;_.prototype.divRemTo=g0;_.prototype.invDigit=I0;_.prototype.isEven=R0;_.prototype.exp=w0;_.prototype.toString=i0;_.prototype.negate=s0;_.prototype.abs=o0;_.prototype.compareTo=u0;_.prototype.bitLength=l0;_.prototype.mod=m0;_.prototype.modPowInt=L0;_.ZERO=_t(0);_.ONE=_t(1);function k0(){var e=te();return this.copyTo(e),e}function D0(){if(this.s<0){if(this.t==1)return this.data[0]-this.DV;if(this.t==0)return-1}else{if(this.t==1)return this.data[0];if(this.t==0)return 0}return(this.data[1]&(1<<32-this.DB)-1)<<this.DB|this.data[0]}function U0(){return this.t==0?this.s:this.data[0]<<24>>24}function P0(){return this.t==0?this.s:this.data[0]<<16>>16}function V0(e){return Math.floor(Math.LN2*this.DB/Math.log(e))}function O0(){return this.s<0?-1:this.t<=0||this.t==1&&this.data[0]<=0?0:1}function K0(e){if(e==null&&(e=10),this.signum()==0||e<2||e>36)return"0";var t=this.chunkSize(e),a=Math.pow(e,t),r=_t(a),n=te(),s=te(),i="";for(this.divRemTo(r,n,s);n.signum()>0;)i=(a+s.intValue()).toString(e).substr(1)+i,n.divRemTo(r,n,s);return s.intValue().toString(e)+i}function F0(e,t){this.fromInt(0),t==null&&(t=10);for(var a=this.chunkSize(t),r=Math.pow(t,a),n=!1,s=0,i=0,o=0;o<e.length;++o){var l=yi(e,o);if(l<0){e.charAt(o)=="-"&&this.signum()==0&&(n=!0);continue}i=t*i+l,++s>=a&&(this.dMultiply(r),this.dAddOffset(i,0),s=0,i=0)}s>0&&(this.dMultiply(Math.pow(t,s)),this.dAddOffset(i,0)),n&&_.ZERO.subTo(this,this)}function q0(e,t,a){if(typeof t=="number")if(e<2)this.fromInt(1);else for(this.fromNumber(e,a),this.testBit(e-1)||this.bitwiseTo(_.ONE.shiftLeft(e-1),Da,this),this.isEven()&&this.dAddOffset(1,0);!this.isProbablePrime(t);)this.dAddOffset(2,0),this.bitLength()>e&&this.subTo(_.ONE.shiftLeft(e-1),this);else{var r=new Array,n=e&7;r.length=(e>>3)+1,t.nextBytes(r),n>0?r[0]&=(1<<n)-1:r[0]=0,this.fromString(r,256)}}function M0(){var e=this.t,t=new Array;t[0]=this.s;var a=this.DB-e*this.DB%8,r,n=0;if(e-- >0)for(a<this.DB&&(r=this.data[e]>>a)!=(this.s&this.DM)>>a&&(t[n++]=r|this.s<<this.DB-a);e>=0;)a<8?(r=(this.data[e]&(1<<a)-1)<<8-a,r|=this.data[--e]>>(a+=this.DB-8)):(r=this.data[e]>>(a-=8)&255,a<=0&&(a+=this.DB,--e)),(r&128)!=0&&(r|=-256),n==0&&(this.s&128)!=(r&128)&&++n,(n>0||r!=this.s)&&(t[n++]=r);return t}function H0(e){return this.compareTo(e)==0}function G0(e){return this.compareTo(e)<0?this:e}function z0(e){return this.compareTo(e)>0?this:e}function Q0(e,t,a){var r,n,s=Math.min(e.t,this.t);for(r=0;r<s;++r)a.data[r]=t(this.data[r],e.data[r]);if(e.t<this.t){for(n=e.s&this.DM,r=s;r<this.t;++r)a.data[r]=t(this.data[r],n);a.t=this.t}else{for(n=this.s&this.DM,r=s;r<e.t;++r)a.data[r]=t(n,e.data[r]);a.t=e.t}a.s=t(this.s,e.s),a.clamp()}function Y0(e,t){return e&t}function X0(e){var t=te();return this.bitwiseTo(e,Y0,t),t}function Da(e,t){return e|t}function W0(e){var t=te();return this.bitwiseTo(e,Da,t),t}function gi(e,t){return e^t}function j0(e){var t=te();return this.bitwiseTo(e,gi,t),t}function mi(e,t){return e&~t}function $0(e){var t=te();return this.bitwiseTo(e,mi,t),t}function Z0(){for(var e=te(),t=0;t<this.t;++t)e.data[t]=this.DM&~this.data[t];return e.t=this.t,e.s=~this.s,e}function J0(e){var t=te();return e<0?this.rShiftTo(-e,t):this.lShiftTo(e,t),t}function eu(e){var t=te();return e<0?this.lShiftTo(-e,t):this.rShiftTo(e,t),t}function tu(e){if(e==0)return-1;var t=0;return(e&65535)==0&&(e>>=16,t+=16),(e&255)==0&&(e>>=8,t+=8),(e&15)==0&&(e>>=4,t+=4),(e&3)==0&&(e>>=2,t+=2),(e&1)==0&&++t,t}function ru(){for(var e=0;e<this.t;++e)if(this.data[e]!=0)return e*this.DB+tu(this.data[e]);return this.s<0?this.t*this.DB:-1}function au(e){for(var t=0;e!=0;)e&=e-1,++t;return t}function nu(){for(var e=0,t=this.s&this.DM,a=0;a<this.t;++a)e+=au(this.data[a]^t);return e}function iu(e){var t=Math.floor(e/this.DB);return t>=this.t?this.s!=0:(this.data[t]&1<<e%this.DB)!=0}function su(e,t){var a=_.ONE.shiftLeft(e);return this.bitwiseTo(a,t,a),a}function ou(e){return this.changeBit(e,Da)}function uu(e){return this.changeBit(e,mi)}function lu(e){return this.changeBit(e,gi)}function fu(e,t){for(var a=0,r=0,n=Math.min(e.t,this.t);a<n;)r+=this.data[a]+e.data[a],t.data[a++]=r&this.DM,r>>=this.DB;if(e.t<this.t){for(r+=e.s;a<this.t;)r+=this.data[a],t.data[a++]=r&this.DM,r>>=this.DB;r+=this.s}else{for(r+=this.s;a<e.t;)r+=e.data[a],t.data[a++]=r&this.DM,r>>=this.DB;r+=e.s}t.s=r<0?-1:0,r>0?t.data[a++]=r:r<-1&&(t.data[a++]=this.DV+r),t.t=a,t.clamp()}function cu(e){var t=te();return this.addTo(e,t),t}function hu(e){var t=te();return this.subTo(e,t),t}function du(e){var t=te();return this.multiplyTo(e,t),t}function pu(){var e=te();return this.squareTo(e),e}function vu(e){var t=te();return this.divRemTo(e,t,null),t}function yu(e){var t=te();return this.divRemTo(e,null,t),t}function gu(e){var t=te(),a=te();return this.divRemTo(e,t,a),new Array(t,a)}function mu(e){this.data[this.t]=this.am(0,e-1,this,0,0,this.t),++this.t,this.clamp()}function Cu(e,t){if(e!=0){for(;this.t<=t;)this.data[this.t++]=0;for(this.data[t]+=e;this.data[t]>=this.DV;)this.data[t]-=this.DV,++t>=this.t&&(this.data[this.t++]=0),++this.data[t]}}function Cr(){}function Ci(e){return e}function Eu(e,t,a){e.multiplyTo(t,a)}function xu(e,t){e.squareTo(t)}Cr.prototype.convert=Ci;Cr.prototype.revert=Ci;Cr.prototype.mulTo=Eu;Cr.prototype.sqrTo=xu;function Su(e){return this.exp(e,new Cr)}function Tu(e,t,a){var r=Math.min(this.t+e.t,t);for(a.s=0,a.t=r;r>0;)a.data[--r]=0;var n;for(n=a.t-this.t;r<n;++r)a.data[r+this.t]=this.am(0,e.data[r],a,r,0,this.t);for(n=Math.min(e.t,t);r<n;++r)this.am(0,e.data[r],a,r,0,t-r);a.clamp()}function Iu(e,t,a){--t;var r=a.t=this.t+e.t-t;for(a.s=0;--r>=0;)a.data[r]=0;for(r=Math.max(t-this.t,0);r<e.t;++r)a.data[this.t+r-t]=this.am(t-r,e.data[r],a,0,0,this.t+r-t);a.clamp(),a.drShiftTo(1,a)}function rr(e){this.r2=te(),this.q3=te(),_.ONE.dlShiftTo(2*e.t,this.r2),this.mu=this.r2.divide(e),this.m=e}function Au(e){if(e.s<0||e.t>2*this.m.t)return e.mod(this.m);if(e.compareTo(this.m)<0)return e;var t=te();return e.copyTo(t),this.reduce(t),t}function Bu(e){return e}function bu(e){for(e.drShiftTo(this.m.t-1,this.r2),e.t>this.m.t+1&&(e.t=this.m.t+1,e.clamp()),this.mu.multiplyUpperTo(this.r2,this.m.t+1,this.q3),this.m.multiplyLowerTo(this.q3,this.m.t+1,this.r2);e.compareTo(this.r2)<0;)e.dAddOffset(1,this.m.t+1);for(e.subTo(this.r2,e);e.compareTo(this.m)>=0;)e.subTo(this.m,e)}function _u(e,t){e.squareTo(t),this.reduce(t)}function Nu(e,t,a){e.multiplyTo(t,a),this.reduce(a)}rr.prototype.convert=Au;rr.prototype.revert=Bu;rr.prototype.reduce=bu;rr.prototype.mulTo=Nu;rr.prototype.sqrTo=_u;function Ru(e,t){var a=e.bitLength(),r,n=_t(1),s;if(a<=0)return n;a<18?r=1:a<48?r=3:a<144?r=4:a<768?r=5:r=6,a<8?s=new Ft(t):t.isEven()?s=new rr(t):s=new qt(t);var i=new Array,o=3,l=r-1,u=(1<<r)-1;if(i[1]=s.convert(this),r>1){var f=te();for(s.sqrTo(i[1],f);o<=u;)i[o]=te(),s.mulTo(f,i[o-2],i[o]),o+=2}var c=e.t-1,v,g=!0,y=te(),x;for(a=Wr(e.data[c])-1;c>=0;){for(a>=l?v=e.data[c]>>a-l&u:(v=(e.data[c]&(1<<a+1)-1)<<l-a,c>0&&(v|=e.data[c-1]>>this.DB+a-l)),o=r;(v&1)==0;)v>>=1,--o;if((a-=o)<0&&(a+=this.DB,--c),g)i[v].copyTo(n),g=!1;else{for(;o>1;)s.sqrTo(n,y),s.sqrTo(y,n),o-=2;o>0?s.sqrTo(n,y):(x=n,n=y,y=x),s.mulTo(y,i[v],n)}for(;c>=0&&(e.data[c]&1<<a)==0;)s.sqrTo(n,y),x=n,n=y,y=x,--a<0&&(a=this.DB-1,--c)}return s.revert(n)}function wu(e){var t=this.s<0?this.negate():this.clone(),a=e.s<0?e.negate():e.clone();if(t.compareTo(a)<0){var r=t;t=a,a=r}var n=t.getLowestSetBit(),s=a.getLowestSetBit();if(s<0)return t;for(n<s&&(s=n),s>0&&(t.rShiftTo(s,t),a.rShiftTo(s,a));t.signum()>0;)(n=t.getLowestSetBit())>0&&t.rShiftTo(n,t),(n=a.getLowestSetBit())>0&&a.rShiftTo(n,a),t.compareTo(a)>=0?(t.subTo(a,t),t.rShiftTo(1,t)):(a.subTo(t,a),a.rShiftTo(1,a));return s>0&&a.lShiftTo(s,a),a}function Lu(e){if(e<=0)return 0;var t=this.DV%e,a=this.s<0?e-1:0;if(this.t>0)if(t==0)a=this.data[0]%e;else for(var r=this.t-1;r>=0;--r)a=(t*a+this.data[r])%e;return a}function ku(e){if(this.signum()==0)return _.ZERO;var t=e.isEven();if(this.isEven()&&t||e.signum()==0)return _.ZERO;for(var a=e.clone(),r=this.clone(),n=_t(1),s=_t(0),i=_t(0),o=_t(1);a.signum()!=0;){for(;a.isEven();)a.rShiftTo(1,a),t?((!n.isEven()||!s.isEven())&&(n.addTo(this,n),s.subTo(e,s)),n.rShiftTo(1,n)):s.isEven()||s.subTo(e,s),s.rShiftTo(1,s);for(;r.isEven();)r.rShiftTo(1,r),t?((!i.isEven()||!o.isEven())&&(i.addTo(this,i),o.subTo(e,o)),i.rShiftTo(1,i)):o.isEven()||o.subTo(e,o),o.rShiftTo(1,o);a.compareTo(r)>=0?(a.subTo(r,a),t&&n.subTo(i,n),s.subTo(o,s)):(r.subTo(a,r),t&&i.subTo(n,i),o.subTo(s,o))}if(r.compareTo(_.ONE)!=0)return _.ZERO;if(o.compareTo(e)>=0)return o.subtract(e);if(o.signum()<0)o.addTo(e,o);else return o;return o.signum()<0?o.add(e):o}var ot=[2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103,107,109,113,127,131,137,139,149,151,157,163,167,173,179,181,191,193,197,199,211,223,227,229,233,239,241,251,257,263,269,271,277,281,283,293,307,311,313,317,331,337,347,349,353,359,367,373,379,383,389,397,401,409,419,421,431,433,439,443,449,457,461,463,467,479,487,491,499,503,509,521,523,541,547,557,563,569,571,577,587,593,599,601,607,613,617,619,631,641,643,647,653,659,661,673,677,683,691,701,709,719,727,733,739,743,751,757,761,769,773,787,797,809,811,821,823,827,829,839,853,857,859,863,877,881,883,887,907,911,919,929,937,941,947,953,967,971,977,983,991,997],Du=(1<<26)/ot[ot.length-1];function Uu(e){var t,a=this.abs();if(a.t==1&&a.data[0]<=ot[ot.length-1]){for(t=0;t<ot.length;++t)if(a.data[0]==ot[t])return!0;return!1}if(a.isEven())return!1;for(t=1;t<ot.length;){for(var r=ot[t],n=t+1;n<ot.length&&r<Du;)r*=ot[n++];for(r=a.modInt(r);t<n;)if(r%ot[t++]==0)return!1}return a.millerRabin(e)}function Pu(e){var t=this.subtract(_.ONE),a=t.getLowestSetBit();if(a<=0)return!1;for(var r=t.shiftRight(a),n=Vu(),s,i=0;i<e;++i){do s=new _(this.bitLength(),n);while(s.compareTo(_.ONE)<=0||s.compareTo(t)>=0);var o=s.modPow(r,this);if(o.compareTo(_.ONE)!=0&&o.compareTo(t)!=0){for(var l=1;l++<a&&o.compareTo(t)!=0;)if(o=o.modPowInt(2,this),o.compareTo(_.ONE)==0)return!1;if(o.compareTo(t)!=0)return!1}}return!0}function Vu(){return{nextBytes:function(e){for(var t=0;t<e.length;++t)e[t]=Math.floor(Math.random()*256)}}}_.prototype.chunkSize=V0;_.prototype.toRadix=K0;_.prototype.fromRadix=F0;_.prototype.fromNumber=q0;_.prototype.bitwiseTo=Q0;_.prototype.changeBit=su;_.prototype.addTo=fu;_.prototype.dMultiply=mu;_.prototype.dAddOffset=Cu;_.prototype.multiplyLowerTo=Tu;_.prototype.multiplyUpperTo=Iu;_.prototype.modInt=Lu;_.prototype.millerRabin=Pu;_.prototype.clone=k0;_.prototype.intValue=D0;_.prototype.byteValue=U0;_.prototype.shortValue=P0;_.prototype.signum=O0;_.prototype.toByteArray=M0;_.prototype.equals=H0;_.prototype.min=G0;_.prototype.max=z0;_.prototype.and=X0;_.prototype.or=W0;_.prototype.xor=j0;_.prototype.andNot=$0;_.prototype.not=Z0;_.prototype.shiftLeft=J0;_.prototype.shiftRight=eu;_.prototype.getLowestSetBit=ru;_.prototype.bitCount=nu;_.prototype.testBit=iu;_.prototype.setBit=ou;_.prototype.clearBit=uu;_.prototype.flipBit=lu;_.prototype.add=cu;_.prototype.subtract=hu;_.prototype.multiply=du;_.prototype.divide=vu;_.prototype.remainder=yu;_.prototype.divideAndRemainder=gu;_.prototype.modPow=Ru;_.prototype.modInverse=ku;_.prototype.pow=Su;_.prototype.gcd=wu;_.prototype.isProbablePrime=Uu;_.prototype.square=pu});var ar=M((Ec,Ii)=>{var dt=X();ut();ne();var Si=Ii.exports=dt.sha1=dt.sha1||{};dt.md.sha1=dt.md.algorithms.sha1=Si;Si.create=function(){Ti||Ou();var e=null,t=dt.util.createBuffer(),a=new Array(80),r={algorithm:"sha1",blockLength:64,digestLength:20,messageLength:0,fullMessageLength:null,messageLengthSize:8};return r.start=function(){r.messageLength=0,r.fullMessageLength=r.messageLength64=[];for(var n=r.messageLengthSize/4,s=0;s<n;++s)r.fullMessageLength.push(0);return t=dt.util.createBuffer(),e={h0:1732584193,h1:4023233417,h2:2562383102,h3:271733878,h4:3285377520},r},r.start(),r.update=function(n,s){s==="utf8"&&(n=dt.util.encodeUtf8(n));var i=n.length;r.messageLength+=i,i=[i/4294967296>>>0,i>>>0];for(var o=r.fullMessageLength.length-1;o>=0;--o)r.fullMessageLength[o]+=i[1],i[1]=i[0]+(r.fullMessageLength[o]/4294967296>>>0),r.fullMessageLength[o]=r.fullMessageLength[o]>>>0,i[0]=i[1]/4294967296>>>0;return t.putBytes(n),xi(e,a,t),(t.read>2048||t.length()===0)&&t.compact(),r},r.digest=function(){var n=dt.util.createBuffer();n.putBytes(t.bytes());var s=r.fullMessageLength[r.fullMessageLength.length-1]+r.messageLengthSize,i=s&r.blockLength-1;n.putBytes(Ua.substr(0,r.blockLength-i));for(var o,l,u=r.fullMessageLength[0]*8,f=0;f<r.fullMessageLength.length-1;++f)o=r.fullMessageLength[f+1]*8,l=o/4294967296>>>0,u+=l,n.putInt32(u>>>0),u=o>>>0;n.putInt32(u);var c={h0:e.h0,h1:e.h1,h2:e.h2,h3:e.h3,h4:e.h4};xi(c,a,n);var v=dt.util.createBuffer();return v.putInt32(c.h0),v.putInt32(c.h1),v.putInt32(c.h2),v.putInt32(c.h3),v.putInt32(c.h4),v},r};var Ua=null,Ti=!1;function Ou(){Ua="\x80",Ua+=dt.util.fillString("\0",64),Ti=!0}function xi(e,t,a){for(var r,n,s,i,o,l,u,f,c=a.length();c>=64;){for(n=e.h0,s=e.h1,i=e.h2,o=e.h3,l=e.h4,f=0;f<16;++f)r=a.getInt32(),t[f]=r,u=o^s&(i^o),r=(n<<5|n>>>27)+u+l+1518500249+r,l=o,o=i,i=(s<<30|s>>>2)>>>0,s=n,n=r;for(;f<20;++f)r=t[f-3]^t[f-8]^t[f-14]^t[f-16],r=r<<1|r>>>31,t[f]=r,u=o^s&(i^o),r=(n<<5|n>>>27)+u+l+1518500249+r,l=o,o=i,i=(s<<30|s>>>2)>>>0,s=n,n=r;for(;f<32;++f)r=t[f-3]^t[f-8]^t[f-14]^t[f-16],r=r<<1|r>>>31,t[f]=r,u=s^i^o,r=(n<<5|n>>>27)+u+l+1859775393+r,l=o,o=i,i=(s<<30|s>>>2)>>>0,s=n,n=r;for(;f<40;++f)r=t[f-6]^t[f-16]^t[f-28]^t[f-32],r=r<<2|r>>>30,t[f]=r,u=s^i^o,r=(n<<5|n>>>27)+u+l+1859775393+r,l=o,o=i,i=(s<<30|s>>>2)>>>0,s=n,n=r;for(;f<60;++f)r=t[f-6]^t[f-16]^t[f-28]^t[f-32],r=r<<2|r>>>30,t[f]=r,u=s&i|o&(s^i),r=(n<<5|n>>>27)+u+l+2400959708+r,l=o,o=i,i=(s<<30|s>>>2)>>>0,s=n,n=r;for(;f<80;++f)r=t[f-6]^t[f-16]^t[f-28]^t[f-32],r=r<<2|r>>>30,t[f]=r,u=s^i^o,r=(n<<5|n>>>27)+u+l+3395469782+r,l=o,o=i,i=(s<<30|s>>>2)>>>0,s=n,n=r;e.h0=e.h0+n|0,e.h1=e.h1+s|0,e.h2=e.h2+i|0,e.h3=e.h3+o|0,e.h4=e.h4+l|0,c-=64}}});var Pa=M((xc,Bi)=>{var pt=X();ne();Je();ar();var Ai=Bi.exports=pt.pkcs1=pt.pkcs1||{};Ai.encode_rsa_oaep=function(e,t,a){var r,n,s,i;typeof a=="string"?(r=a,n=arguments[3]||void 0,s=arguments[4]||void 0):a&&(r=a.label||void 0,n=a.seed||void 0,s=a.md||void 0,a.mgf1&&a.mgf1.md&&(i=a.mgf1.md)),s?s.start():s=pt.md.sha1.create(),i||(i=s);var o=Math.ceil(e.n.bitLength()/8),l=o-2*s.digestLength-2;if(t.length>l){var u=new Error("RSAES-OAEP input message length is too long.");throw u.length=t.length,u.maxLength=l,u}r||(r=""),s.update(r,"raw");for(var f=s.digest(),c="",v=l-t.length,g=0;g<v;g++)c+="\0";var y=f.getBytes()+c+""+t;if(!n)n=pt.random.getBytes(s.digestLength);else if(n.length!==s.digestLength){var u=new Error("Invalid RSAES-OAEP seed. The seed length must match the digest length.");throw u.seedLength=n.length,u.digestLength=s.digestLength,u}var x=jr(n,o-s.digestLength-1,i),S=pt.util.xorBytes(y,x,y.length),I=jr(S,s.digestLength,i),B=pt.util.xorBytes(n,I,n.length);return"\0"+B+S};Ai.decode_rsa_oaep=function(e,t,a){var r,n,s;typeof a=="string"?(r=a,n=arguments[3]||void 0):a&&(r=a.label||void 0,n=a.md||void 0,a.mgf1&&a.mgf1.md&&(s=a.mgf1.md));var i=Math.ceil(e.n.bitLength()/8);if(t.length!==i){var S=new Error("RSAES-OAEP encoded message length is invalid.");throw S.length=t.length,S.expectedLength=i,S}if(n===void 0?n=pt.md.sha1.create():n.start(),s||(s=n),i<2*n.digestLength+2)throw new Error("RSAES-OAEP key is too short for the hash function.");r||(r=""),n.update(r,"raw");for(var o=n.digest().getBytes(),l=t.charAt(0),u=t.substring(1,n.digestLength+1),f=t.substring(1+n.digestLength),c=jr(f,n.digestLength,s),v=pt.util.xorBytes(u,c,u.length),g=jr(v,i-n.digestLength-1,s),y=pt.util.xorBytes(f,g,f.length),x=y.substring(0,n.digestLength),S=l!=="\0",I=0;I<n.digestLength;++I)S|=o.charAt(I)!==x.charAt(I);for(var B=1,b=n.digestLength,U=n.digestLength;U<y.length;U++){var L=y.charCodeAt(U),w=L&1^1,z=B?65534:0;S|=L&z,B=B&w,b+=B}if(S||y.charCodeAt(b)!==1)throw new Error("Invalid RSAES-OAEP padding.");return y.substring(b+1)};function jr(e,t,a){a||(a=pt.md.sha1.create());for(var r="",n=Math.ceil(t/a.digestLength),s=0;s<n;++s){var i=String.fromCharCode(s>>24&255,s>>16&255,s>>8&255,s&255);a.start(),a.update(e+i),r+=a.digest().getBytes()}return r.substring(0,t)}});var Oa=M((Sc,Va)=>{var Nt=X();ne();Er();Je();(function(){if(Nt.prime){Va.exports=Nt.prime;return}var e=Va.exports=Nt.prime=Nt.prime||{},t=Nt.jsbn.BigInteger,a=[6,4,2,4,2,4,6,2],r=new t(null);r.fromInt(30);var n=function(c,v){return c|v};e.generateProbablePrime=function(c,v,g){typeof v=="function"&&(g=v,v={}),v=v||{};var y=v.algorithm||"PRIMEINC";typeof y=="string"&&(y={name:y}),y.options=y.options||{};var x=v.prng||Nt.random,S={nextBytes:function(I){for(var B=x.getBytesSync(I.length),b=0;b<I.length;++b)I[b]=B.charCodeAt(b)}};if(y.name==="PRIMEINC")return s(c,S,y.options,g);throw new Error("Invalid prime generation algorithm: "+y.name)};function s(c,v,g,y){return"workers"in g?l(c,v,g,y):i(c,v,g,y)}function i(c,v,g,y){var x=u(c,v),S=0,I=f(x.bitLength());"millerRabinTests"in g&&(I=g.millerRabinTests);var B=10;"maxBlockTime"in g&&(B=g.maxBlockTime),o(x,c,v,S,I,B,y)}function o(c,v,g,y,x,S,I){var B=+new Date;do{if(c.bitLength()>v&&(c=u(v,g)),c.isProbablePrime(x))return I(null,c);c.dAddOffset(a[y++%8],0)}while(S<0||+new Date-B<S);Nt.util.setImmediate(function(){o(c,v,g,y,x,S,I)})}function l(c,v,g,y){if(typeof Worker>"u")return i(c,v,g,y);var x=u(c,v),S=g.workers,I=g.workLoad||100,B=I*30/8,b=g.workerScript||"forge/prime.worker.js";if(S===-1)return Nt.util.estimateCores(function(L,w){L&&(w=2),S=w-1,U()});U();function U(){S=Math.max(1,S);for(var L=[],w=0;w<S;++w)L[w]=new Worker(b);for(var z=S,w=0;w<S;++w)L[w].addEventListener("message",W);var G=!1;function W(oe){if(!G){--z;var ue=oe.data;if(ue.found){for(var ee=0;ee<L.length;++ee)L[ee].terminate();return G=!0,y(null,new t(ue.prime,16))}x.bitLength()>c&&(x=u(c,v));var xe=x.toString(16);oe.target.postMessage({hex:xe,workLoad:I}),x.dAddOffset(B,0)}}}}function u(c,v){var g=new t(c,v),y=c-1;return g.testBit(y)||g.bitwiseTo(t.ONE.shiftLeft(y),n,g),g.dAddOffset(31-g.mod(r).byteValue(),0),g}function f(c){return c<=100?27:c<=150?18:c<=200?15:c<=250?12:c<=300?9:c<=350?8:c<=400?7:c<=500?6:c<=600?5:c<=800?4:c<=1250?3:2}})()});var xr=M((Tc,ki)=>{var F=X();st();Er();bt();Pa();Oa();Je();ne();typeof re>"u"&&(re=F.jsbn.BigInteger);var re,Ka=F.util.isNodejs?require("crypto"):null,T=F.asn1,tt=F.util;F.pki=F.pki||{};ki.exports=F.pki.rsa=F.rsa=F.rsa||{};var Q=F.pki,Ku=[6,4,2,4,2,4,6,2],Fu={name:"PrivateKeyInfo",tagClass:T.Class.UNIVERSAL,type:T.Type.SEQUENCE,constructed:!0,value:[{name:"PrivateKeyInfo.version",tagClass:T.Class.UNIVERSAL,type:T.Type.INTEGER,constructed:!1,capture:"privateKeyVersion"},{name:"PrivateKeyInfo.privateKeyAlgorithm",tagClass:T.Class.UNIVERSAL,type:T.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:T.Class.UNIVERSAL,type:T.Type.OID,constructed:!1,capture:"privateKeyOid"}]},{name:"PrivateKeyInfo",tagClass:T.Class.UNIVERSAL,type:T.Type.OCTETSTRING,constructed:!1,capture:"privateKey"}]},qu={name:"RSAPrivateKey",tagClass:T.Class.UNIVERSAL,type:T.Type.SEQUENCE,constructed:!0,value:[{name:"RSAPrivateKey.version",tagClass:T.Class.UNIVERSAL,type:T.Type.INTEGER,constructed:!1,capture:"privateKeyVersion"},{name:"RSAPrivateKey.modulus",tagClass:T.Class.UNIVERSAL,type:T.Type.INTEGER,constructed:!1,capture:"privateKeyModulus"},{name:"RSAPrivateKey.publicExponent",tagClass:T.Class.UNIVERSAL,type:T.Type.INTEGER,constructed:!1,capture:"privateKeyPublicExponent"},{name:"RSAPrivateKey.privateExponent",tagClass:T.Class.UNIVERSAL,type:T.Type.INTEGER,constructed:!1,capture:"privateKeyPrivateExponent"},{name:"RSAPrivateKey.prime1",tagClass:T.Class.UNIVERSAL,type:T.Type.INTEGER,constructed:!1,capture:"privateKeyPrime1"},{name:"RSAPrivateKey.prime2",tagClass:T.Class.UNIVERSAL,type:T.Type.INTEGER,constructed:!1,capture:"privateKeyPrime2"},{name:"RSAPrivateKey.exponent1",tagClass:T.Class.UNIVERSAL,type:T.Type.INTEGER,constructed:!1,capture:"privateKeyExponent1"},{name:"RSAPrivateKey.exponent2",tagClass:T.Class.UNIVERSAL,type:T.Type.INTEGER,constructed:!1,capture:"privateKeyExponent2"},{name:"RSAPrivateKey.coefficient",tagClass:T.Class.UNIVERSAL,type:T.Type.INTEGER,constructed:!1,capture:"privateKeyCoefficient"}]},Mu={name:"RSAPublicKey",tagClass:T.Class.UNIVERSAL,type:T.Type.SEQUENCE,constructed:!0,value:[{name:"RSAPublicKey.modulus",tagClass:T.Class.UNIVERSAL,type:T.Type.INTEGER,constructed:!1,capture:"publicKeyModulus"},{name:"RSAPublicKey.exponent",tagClass:T.Class.UNIVERSAL,type:T.Type.INTEGER,constructed:!1,capture:"publicKeyExponent"}]},Hu=F.pki.rsa.publicKeyValidator={name:"SubjectPublicKeyInfo",tagClass:T.Class.UNIVERSAL,type:T.Type.SEQUENCE,constructed:!0,captureAsn1:"subjectPublicKeyInfo",value:[{name:"SubjectPublicKeyInfo.AlgorithmIdentifier",tagClass:T.Class.UNIVERSAL,type:T.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:T.Class.UNIVERSAL,type:T.Type.OID,constructed:!1,capture:"publicKeyOid"}]},{name:"SubjectPublicKeyInfo.subjectPublicKey",tagClass:T.Class.UNIVERSAL,type:T.Type.BITSTRING,constructed:!1,value:[{name:"SubjectPublicKeyInfo.subjectPublicKey.RSAPublicKey",tagClass:T.Class.UNIVERSAL,type:T.Type.SEQUENCE,constructed:!0,optional:!0,captureAsn1:"rsaPublicKey"}]}]},Gu={name:"DigestInfo",tagClass:T.Class.UNIVERSAL,type:T.Type.SEQUENCE,constructed:!0,value:[{name:"DigestInfo.DigestAlgorithm",tagClass:T.Class.UNIVERSAL,type:T.Type.SEQUENCE,constructed:!0,value:[{name:"DigestInfo.DigestAlgorithm.algorithmIdentifier",tagClass:T.Class.UNIVERSAL,type:T.Type.OID,constructed:!1,capture:"algorithmIdentifier"},{name:"DigestInfo.DigestAlgorithm.parameters",tagClass:T.Class.UNIVERSAL,type:T.Type.NULL,capture:"parameters",optional:!0,constructed:!1}]},{name:"DigestInfo.digest",tagClass:T.Class.UNIVERSAL,type:T.Type.OCTETSTRING,constructed:!1,capture:"digest"}]},zu=function(e){var t;if(e.algorithm in Q.oids)t=Q.oids[e.algorithm];else{var a=new Error("Unknown message digest algorithm.");throw a.algorithm=e.algorithm,a}var r=T.oidToDer(t).getBytes(),n=T.create(T.Class.UNIVERSAL,T.Type.SEQUENCE,!0,[]),s=T.create(T.Class.UNIVERSAL,T.Type.SEQUENCE,!0,[]);s.value.push(T.create(T.Class.UNIVERSAL,T.Type.OID,!1,r)),s.value.push(T.create(T.Class.UNIVERSAL,T.Type.NULL,!1,""));var i=T.create(T.Class.UNIVERSAL,T.Type.OCTETSTRING,!1,e.digest().getBytes());return n.value.push(s),n.value.push(i),T.toDer(n).getBytes()},wi=function(e,t,a){if(a)return e.modPow(t.e,t.n);if(!t.p||!t.q)return e.modPow(t.d,t.n);t.dP||(t.dP=t.d.mod(t.p.subtract(re.ONE))),t.dQ||(t.dQ=t.d.mod(t.q.subtract(re.ONE))),t.qInv||(t.qInv=t.q.modInverse(t.p));var r;do r=new re(F.util.bytesToHex(F.random.getBytes(t.n.bitLength()/8)),16);while(r.compareTo(t.n)>=0||!r.gcd(t.n).equals(re.ONE));e=e.multiply(r.modPow(t.e,t.n)).mod(t.n);for(var n=e.mod(t.p).modPow(t.dP,t.p),s=e.mod(t.q).modPow(t.dQ,t.q);n.compareTo(s)<0;)n=n.add(t.p);var i=n.subtract(s).multiply(t.qInv).mod(t.p).multiply(t.q).add(s);return i=i.multiply(r.modInverse(t.n)).mod(t.n),i};Q.rsa.encrypt=function(e,t,a){var r=a,n,s=Math.ceil(t.n.bitLength()/8);a!==!1&&a!==!0?(r=a===2,n=Li(e,t,a)):(n=F.util.createBuffer(),n.putBytes(e));for(var i=new re(n.toHex(),16),o=wi(i,t,r),l=o.toString(16),u=F.util.createBuffer(),f=s-Math.ceil(l.length/2);f>0;)u.putByte(0),--f;return u.putBytes(F.util.hexToBytes(l)),u.getBytes()};Q.rsa.decrypt=function(e,t,a,r){var n=Math.ceil(t.n.bitLength()/8);if(e.length!==n){var s=new Error("Encrypted message length is invalid.");throw s.length=e.length,s.expected=n,s}var i=new re(F.util.createBuffer(e).toHex(),16);if(i.compareTo(t.n)>=0)throw new Error("Encrypted message is invalid.");for(var o=wi(i,t,a),l=o.toString(16),u=F.util.createBuffer(),f=n-Math.ceil(l.length/2);f>0;)u.putByte(0),--f;return u.putBytes(F.util.hexToBytes(l)),r!==!1?$r(u.getBytes(),t,a):u.getBytes()};Q.rsa.createKeyPairGenerationState=function(e,t,a){typeof e=="string"&&(e=parseInt(e,10)),e=e||2048,a=a||{};var r=a.prng||F.random,n={nextBytes:function(o){for(var l=r.getBytesSync(o.length),u=0;u<o.length;++u)o[u]=l.charCodeAt(u)}},s=a.algorithm||"PRIMEINC",i;if(s==="PRIMEINC")i={algorithm:s,state:0,bits:e,rng:n,eInt:t||65537,e:new re(null),p:null,q:null,qBits:e>>1,pBits:e-(e>>1),pqState:0,num:null,keys:null},i.e.fromInt(i.eInt);else throw new Error("Invalid key generation algorithm: "+s);return i};Q.rsa.stepKeyPairGenerationState=function(e,t){"algorithm"in e||(e.algorithm="PRIMEINC");var a=new re(null);a.fromInt(30);for(var r=0,n=function(c,v){return c|v},s=+new Date,i,o=0;e.keys===null&&(t<=0||o<t);){if(e.state===0){var l=e.p===null?e.pBits:e.qBits,u=l-1;e.pqState===0?(e.num=new re(l,e.rng),e.num.testBit(u)||e.num.bitwiseTo(re.ONE.shiftLeft(u),n,e.num),e.num.dAddOffset(31-e.num.mod(a).byteValue(),0),r=0,++e.pqState):e.pqState===1?e.num.bitLength()>l?e.pqState=0:e.num.isProbablePrime(Yu(e.num.bitLength()))?++e.pqState:e.num.dAddOffset(Ku[r++%8],0):e.pqState===2?e.pqState=e.num.subtract(re.ONE).gcd(e.e).compareTo(re.ONE)===0?3:0:e.pqState===3&&(e.pqState=0,e.p===null?e.p=e.num:e.q=e.num,e.p!==null&&e.q!==null&&++e.state,e.num=null)}else if(e.state===1)e.p.compareTo(e.q)<0&&(e.num=e.p,e.p=e.q,e.q=e.num),++e.state;else if(e.state===2)e.p1=e.p.subtract(re.ONE),e.q1=e.q.subtract(re.ONE),e.phi=e.p1.multiply(e.q1),++e.state;else if(e.state===3)e.phi.gcd(e.e).compareTo(re.ONE)===0?++e.state:(e.p=null,e.q=null,e.state=0);else if(e.state===4)e.n=e.p.multiply(e.q),e.n.bitLength()===e.bits?++e.state:(e.q=null,e.state=0);else if(e.state===5){var f=e.e.modInverse(e.phi);e.keys={privateKey:Q.rsa.setPrivateKey(e.n,e.e,f,e.p,e.q,f.mod(e.p1),f.mod(e.q1),e.q.modInverse(e.p)),publicKey:Q.rsa.setPublicKey(e.n,e.e)}}i=+new Date,o+=i-s,s=i}return e.keys!==null};Q.rsa.generateKeyPair=function(e,t,a,r){if(arguments.length===1?typeof e=="object"?(a=e,e=void 0):typeof e=="function"&&(r=e,e=void 0):arguments.length===2?typeof e=="number"?typeof t=="function"?(r=t,t=void 0):typeof t!="number"&&(a=t,t=void 0):(a=e,r=t,e=void 0,t=void 0):arguments.length===3&&(typeof t=="number"?typeof a=="function"&&(r=a,a=void 0):(r=a,a=t,t=void 0)),a=a||{},e===void 0&&(e=a.bits||2048),t===void 0&&(t=a.e||65537),!F.options.usePureJavaScript&&!a.prng&&e>=256&&e<=16384&&(t===65537||t===3)){if(r){if(bi("generateKeyPair"))return Ka.generateKeyPair("rsa",{modulusLength:e,publicExponent:t,publicKeyEncoding:{type:"spki",format:"pem"},privateKeyEncoding:{type:"pkcs8",format:"pem"}},function(o,l,u){if(o)return r(o);r(null,{privateKey:Q.privateKeyFromPem(u),publicKey:Q.publicKeyFromPem(l)})});if(_i("generateKey")&&_i("exportKey"))return tt.globalScope.crypto.subtle.generateKey({name:"RSASSA-PKCS1-v1_5",modulusLength:e,publicExponent:Ri(t),hash:{name:"SHA-256"}},!0,["sign","verify"]).then(function(o){return tt.globalScope.crypto.subtle.exportKey("pkcs8",o.privateKey)}).then(void 0,function(o){r(o)}).then(function(o){if(o){var l=Q.privateKeyFromAsn1(T.fromDer(F.util.createBuffer(o)));r(null,{privateKey:l,publicKey:Q.setRsaPublicKey(l.n,l.e)})}});if(Ni("generateKey")&&Ni("exportKey")){var n=tt.globalScope.msCrypto.subtle.generateKey({name:"RSASSA-PKCS1-v1_5",modulusLength:e,publicExponent:Ri(t),hash:{name:"SHA-256"}},!0,["sign","verify"]);n.oncomplete=function(o){var l=o.target.result,u=tt.globalScope.msCrypto.subtle.exportKey("pkcs8",l.privateKey);u.oncomplete=function(f){var c=f.target.result,v=Q.privateKeyFromAsn1(T.fromDer(F.util.createBuffer(c)));r(null,{privateKey:v,publicKey:Q.setRsaPublicKey(v.n,v.e)})},u.onerror=function(f){r(f)}},n.onerror=function(o){r(o)};return}}else if(bi("generateKeyPairSync")){var s=Ka.generateKeyPairSync("rsa",{modulusLength:e,publicExponent:t,publicKeyEncoding:{type:"spki",format:"pem"},privateKeyEncoding:{type:"pkcs8",format:"pem"}});return{privateKey:Q.privateKeyFromPem(s.privateKey),publicKey:Q.publicKeyFromPem(s.publicKey)}}}var i=Q.rsa.createKeyPairGenerationState(e,t,a);if(!r)return Q.rsa.stepKeyPairGenerationState(i,0),i.keys;Qu(i,a,r)};Q.setRsaPublicKey=Q.rsa.setPublicKey=function(e,t){var a={n:e,e:t};return a.encrypt=function(r,n,s){if(typeof n=="string"?n=n.toUpperCase():n===void 0&&(n="RSAES-PKCS1-V1_5"),n==="RSAES-PKCS1-V1_5")n={encode:function(o,l,u){return Li(o,l,2).getBytes()}};else if(n==="RSA-OAEP"||n==="RSAES-OAEP")n={encode:function(o,l){return F.pkcs1.encode_rsa_oaep(l,o,s)}};else if(["RAW","NONE","NULL",null].indexOf(n)!==-1)n={encode:function(o){return o}};else if(typeof n=="string")throw new Error('Unsupported encryption scheme: "'+n+'".');var i=n.encode(r,a,!0);return Q.rsa.encrypt(i,a,!0)},a.verify=function(r,n,s,i){typeof s=="string"?s=s.toUpperCase():s===void 0&&(s="RSASSA-PKCS1-V1_5"),i===void 0&&(i={_parseAllDigestBytes:!0,_skipPaddingChecks:!1}),"_parseAllDigestBytes"in i||(i._parseAllDigestBytes=!0),"_skipPaddingChecks"in i||(i._skipPaddingChecks=!1),s==="RSASSA-PKCS1-V1_5"?s={verify:function(l,u){u=$r(u,a,!0,void 0,i);var f=T.fromDer(u,{parseAllBytes:i._parseAllDigestBytes}),c={},v=[];if(!T.validate(f,Gu,c,v)||f.value.length!==2){var g=new Error("ASN.1 object does not contain a valid RSASSA-PKCS1-v1_5 DigestInfo value.");throw g.errors=v,g}var y=T.derToOid(c.algorithmIdentifier);if(!(y===F.oids.md2||y===F.oids.md5||y===F.oids.sha1||y===F.oids.sha224||y===F.oids.sha256||y===F.oids.sha384||y===F.oids.sha512||y===F.oids["sha512-224"]||y===F.oids["sha512-256"])){var g=new Error("Unknown RSASSA-PKCS1-v1_5 DigestAlgorithm identifier.");throw g.oid=y,g}if((y===F.oids.md2||y===F.oids.md5)&&!("parameters"in c))throw new Error("ASN.1 object does not contain a valid RSASSA-PKCS1-v1_5 DigestInfo value. Missing algorithm identifier NULL parameters.");return l===c.digest}}:(s==="NONE"||s==="NULL"||s===null)&&(s={verify:function(l,u){return u=$r(u,a,!0,void 0,i),l===u}});var o=Q.rsa.decrypt(n,a,!0,!1);return s.verify(r,o,a.n.bitLength())},a};Q.setRsaPrivateKey=Q.rsa.setPrivateKey=function(e,t,a,r,n,s,i,o){var l={n:e,e:t,d:a,p:r,q:n,dP:s,dQ:i,qInv:o};return l.decrypt=function(u,f,c){typeof f=="string"?f=f.toUpperCase():f===void 0&&(f="RSAES-PKCS1-V1_5");var v=Q.rsa.decrypt(u,l,!1,!1);if(f==="RSAES-PKCS1-V1_5")f={decode:$r};else if(f==="RSA-OAEP"||f==="RSAES-OAEP")f={decode:function(g,y){return F.pkcs1.decode_rsa_oaep(y,g,c)}};else if(["RAW","NONE","NULL",null].indexOf(f)!==-1)f={decode:function(g){return g}};else throw new Error('Unsupported encryption scheme: "'+f+'".');return f.decode(v,l,!1)},l.sign=function(u,f){var c=!1;typeof f=="string"&&(f=f.toUpperCase()),f===void 0||f==="RSASSA-PKCS1-V1_5"?(f={encode:zu},c=1):(f==="NONE"||f==="NULL"||f===null)&&(f={encode:function(){return u}},c=1);var v=f.encode(u,l.n.bitLength());return Q.rsa.encrypt(v,l,c)},l};Q.wrapRsaPrivateKey=function(e){return T.create(T.Class.UNIVERSAL,T.Type.SEQUENCE,!0,[T.create(T.Class.UNIVERSAL,T.Type.INTEGER,!1,T.integerToDer(0).getBytes()),T.create(T.Class.UNIVERSAL,T.Type.SEQUENCE,!0,[T.create(T.Class.UNIVERSAL,T.Type.OID,!1,T.oidToDer(Q.oids.rsaEncryption).getBytes()),T.create(T.Class.UNIVERSAL,T.Type.NULL,!1,"")]),T.create(T.Class.UNIVERSAL,T.Type.OCTETSTRING,!1,T.toDer(e).getBytes())])};Q.privateKeyFromAsn1=function(e){var t={},a=[];if(T.validate(e,Fu,t,a)&&(e=T.fromDer(F.util.createBuffer(t.privateKey))),t={},a=[],!T.validate(e,qu,t,a)){var r=new Error("Cannot read private key. ASN.1 object does not contain an RSAPrivateKey.");throw r.errors=a,r}var n,s,i,o,l,u,f,c;return n=F.util.createBuffer(t.privateKeyModulus).toHex(),s=F.util.createBuffer(t.privateKeyPublicExponent).toHex(),i=F.util.createBuffer(t.privateKeyPrivateExponent).toHex(),o=F.util.createBuffer(t.privateKeyPrime1).toHex(),l=F.util.createBuffer(t.privateKeyPrime2).toHex(),u=F.util.createBuffer(t.privateKeyExponent1).toHex(),f=F.util.createBuffer(t.privateKeyExponent2).toHex(),c=F.util.createBuffer(t.privateKeyCoefficient).toHex(),Q.setRsaPrivateKey(new re(n,16),new re(s,16),new re(i,16),new re(o,16),new re(l,16),new re(u,16),new re(f,16),new re(c,16))};Q.privateKeyToAsn1=Q.privateKeyToRSAPrivateKey=function(e){return T.create(T.Class.UNIVERSAL,T.Type.SEQUENCE,!0,[T.create(T.Class.UNIVERSAL,T.Type.INTEGER,!1,T.integerToDer(0).getBytes()),T.create(T.Class.UNIVERSAL,T.Type.INTEGER,!1,vt(e.n)),T.create(T.Class.UNIVERSAL,T.Type.INTEGER,!1,vt(e.e)),T.create(T.Class.UNIVERSAL,T.Type.INTEGER,!1,vt(e.d)),T.create(T.Class.UNIVERSAL,T.Type.INTEGER,!1,vt(e.p)),T.create(T.Class.UNIVERSAL,T.Type.INTEGER,!1,vt(e.q)),T.create(T.Class.UNIVERSAL,T.Type.INTEGER,!1,vt(e.dP)),T.create(T.Class.UNIVERSAL,T.Type.INTEGER,!1,vt(e.dQ)),T.create(T.Class.UNIVERSAL,T.Type.INTEGER,!1,vt(e.qInv))])};Q.publicKeyFromAsn1=function(e){var t={},a=[];if(T.validate(e,Hu,t,a)){var r=T.derToOid(t.publicKeyOid);if(r!==Q.oids.rsaEncryption){var n=new Error("Cannot read public key. Unknown OID.");throw n.oid=r,n}e=t.rsaPublicKey}if(a=[],!T.validate(e,Mu,t,a)){var n=new Error("Cannot read public key. ASN.1 object does not contain an RSAPublicKey.");throw n.errors=a,n}var s=F.util.createBuffer(t.publicKeyModulus).toHex(),i=F.util.createBuffer(t.publicKeyExponent).toHex();return Q.setRsaPublicKey(new re(s,16),new re(i,16))};Q.publicKeyToAsn1=Q.publicKeyToSubjectPublicKeyInfo=function(e){return T.create(T.Class.UNIVERSAL,T.Type.SEQUENCE,!0,[T.create(T.Class.UNIVERSAL,T.Type.SEQUENCE,!0,[T.create(T.Class.UNIVERSAL,T.Type.OID,!1,T.oidToDer(Q.oids.rsaEncryption).getBytes()),T.create(T.Class.UNIVERSAL,T.Type.NULL,!1,"")]),T.create(T.Class.UNIVERSAL,T.Type.BITSTRING,!1,[Q.publicKeyToRSAPublicKey(e)])])};Q.publicKeyToRSAPublicKey=function(e){return T.create(T.Class.UNIVERSAL,T.Type.SEQUENCE,!0,[T.create(T.Class.UNIVERSAL,T.Type.INTEGER,!1,vt(e.n)),T.create(T.Class.UNIVERSAL,T.Type.INTEGER,!1,vt(e.e))])};function Li(e,t,a){var r=F.util.createBuffer(),n=Math.ceil(t.n.bitLength()/8);if(e.length>n-11){var s=new Error("Message is too long for PKCS#1 v1.5 padding.");throw s.length=e.length,s.max=n-11,s}r.putByte(0),r.putByte(a);var i=n-3-e.length,o;if(a===0||a===1){o=a===0?0:255;for(var l=0;l<i;++l)r.putByte(o)}else for(;i>0;){for(var u=0,f=F.random.getBytes(i),l=0;l<i;++l)o=f.charCodeAt(l),o===0?++u:r.putByte(o);i=u}return r.putByte(0),r.putBytes(e),r}function $r(e,t,a,r,n){var s=Math.ceil(t.n.bitLength()/8),i=F.util.createBuffer(e),o=i.getByte(),l=i.getByte();if(o!==0||a&&l!==0&&l!==1||!a&&l!==2||a&&l===0&&typeof r>"u")throw new Error("Encryption block is invalid.");var u=0;if(l===0){u=s-3-r;for(var f=0;f<u;++f)if(i.getByte()!==0)throw new Error("Encryption block is invalid.")}else if(l===1){for(u=0;i.length()>1;){if(i.getByte()!==255){--i.read;break}++u}if(u<8&&!(n&&n._skipPaddingChecks))throw new Error("Encryption block is invalid.")}else if(l===2){for(u=0;i.length()>1;){if(i.getByte()===0){--i.read;break}++u}if(u<8&&!(n&&n._skipPaddingChecks))throw new Error("Encryption block is invalid.")}var c=i.getByte();if(c!==0||u!==s-3-i.length())throw new Error("Encryption block is invalid.");return i.getBytes()}function Qu(e,t,a){typeof t=="function"&&(a=t,t={}),t=t||{};var r={algorithm:{name:t.algorithm||"PRIMEINC",options:{workers:t.workers||2,workLoad:t.workLoad||100,workerScript:t.workerScript}}};"prng"in t&&(r.prng=t.prng),n();function n(){s(e.pBits,function(o,l){if(o)return a(o);if(e.p=l,e.q!==null)return i(o,e.q);s(e.qBits,i)})}function s(o,l){F.prime.generateProbablePrime(o,r,l)}function i(o,l){if(o)return a(o);if(e.q=l,e.p.compareTo(e.q)<0){var u=e.p;e.p=e.q,e.q=u}if(e.p.subtract(re.ONE).gcd(e.e).compareTo(re.ONE)!==0){e.p=null,n();return}if(e.q.subtract(re.ONE).gcd(e.e).compareTo(re.ONE)!==0){e.q=null,s(e.qBits,i);return}if(e.p1=e.p.subtract(re.ONE),e.q1=e.q.subtract(re.ONE),e.phi=e.p1.multiply(e.q1),e.phi.gcd(e.e).compareTo(re.ONE)!==0){e.p=e.q=null,n();return}if(e.n=e.p.multiply(e.q),e.n.bitLength()!==e.bits){e.q=null,s(e.qBits,i);return}var f=e.e.modInverse(e.phi);e.keys={privateKey:Q.rsa.setPrivateKey(e.n,e.e,f,e.p,e.q,f.mod(e.p1),f.mod(e.q1),e.q.modInverse(e.p)),publicKey:Q.rsa.setPublicKey(e.n,e.e)},a(null,e.keys)}}function vt(e){var t=e.toString(16);t[0]>="8"&&(t="00"+t);var a=F.util.hexToBytes(t);return a.length>1&&(a.charCodeAt(0)===0&&(a.charCodeAt(1)&128)===0||a.charCodeAt(0)===255&&(a.charCodeAt(1)&128)===128)?a.substr(1):a}function Yu(e){return e<=100?27:e<=150?18:e<=200?15:e<=250?12:e<=300?9:e<=350?8:e<=400?7:e<=500?6:e<=600?5:e<=800?4:e<=1250?3:2}function bi(e){return F.util.isNodejs&&typeof Ka[e]=="function"}function _i(e){return typeof tt.globalScope<"u"&&typeof tt.globalScope.crypto=="object"&&typeof tt.globalScope.crypto.subtle=="object"&&typeof tt.globalScope.crypto.subtle[e]=="function"}function Ni(e){return typeof tt.globalScope<"u"&&typeof tt.globalScope.msCrypto=="object"&&typeof tt.globalScope.msCrypto.subtle=="object"&&typeof tt.globalScope.msCrypto.subtle[e]=="function"}function Ri(e){for(var t=F.util.hexToBytes(e.toString(16)),a=new Uint8Array(t.length),r=0;r<t.length;++r)a[r]=t.charCodeAt(r);return a}});var Fa=M((Ic,Oi)=>{var O=X();Bt();st();mr();ut();bt();Qr();Kt();Je();wa();xr();ne();typeof Di>"u"&&(Di=O.jsbn.BigInteger);var Di,A=O.asn1,Y=O.pki=O.pki||{};Oi.exports=Y.pbe=O.pbe=O.pbe||{};var Mt=Y.oids,Xu={name:"EncryptedPrivateKeyInfo",tagClass:A.Class.UNIVERSAL,type:A.Type.SEQUENCE,constructed:!0,value:[{name:"EncryptedPrivateKeyInfo.encryptionAlgorithm",tagClass:A.Class.UNIVERSAL,type:A.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:A.Class.UNIVERSAL,type:A.Type.OID,constructed:!1,capture:"encryptionOid"},{name:"AlgorithmIdentifier.parameters",tagClass:A.Class.UNIVERSAL,type:A.Type.SEQUENCE,constructed:!0,captureAsn1:"encryptionParams"}]},{name:"EncryptedPrivateKeyInfo.encryptedData",tagClass:A.Class.UNIVERSAL,type:A.Type.OCTETSTRING,constructed:!1,capture:"encryptedData"}]},Wu={name:"PBES2Algorithms",tagClass:A.Class.UNIVERSAL,type:A.Type.SEQUENCE,constructed:!0,value:[{name:"PBES2Algorithms.keyDerivationFunc",tagClass:A.Class.UNIVERSAL,type:A.Type.SEQUENCE,constructed:!0,value:[{name:"PBES2Algorithms.keyDerivationFunc.oid",tagClass:A.Class.UNIVERSAL,type:A.Type.OID,constructed:!1,capture:"kdfOid"},{name:"PBES2Algorithms.params",tagClass:A.Class.UNIVERSAL,type:A.Type.SEQUENCE,constructed:!0,value:[{name:"PBES2Algorithms.params.salt",tagClass:A.Class.UNIVERSAL,type:A.Type.OCTETSTRING,constructed:!1,capture:"kdfSalt"},{name:"PBES2Algorithms.params.iterationCount",tagClass:A.Class.UNIVERSAL,type:A.Type.INTEGER,constructed:!1,capture:"kdfIterationCount"},{name:"PBES2Algorithms.params.keyLength",tagClass:A.Class.UNIVERSAL,type:A.Type.INTEGER,constructed:!1,optional:!0,capture:"keyLength"},{name:"PBES2Algorithms.params.prf",tagClass:A.Class.UNIVERSAL,type:A.Type.SEQUENCE,constructed:!0,optional:!0,value:[{name:"PBES2Algorithms.params.prf.algorithm",tagClass:A.Class.UNIVERSAL,type:A.Type.OID,constructed:!1,capture:"prfOid"}]}]}]},{name:"PBES2Algorithms.encryptionScheme",tagClass:A.Class.UNIVERSAL,type:A.Type.SEQUENCE,constructed:!0,value:[{name:"PBES2Algorithms.encryptionScheme.oid",tagClass:A.Class.UNIVERSAL,type:A.Type.OID,constructed:!1,capture:"encOid"},{name:"PBES2Algorithms.encryptionScheme.iv",tagClass:A.Class.UNIVERSAL,type:A.Type.OCTETSTRING,constructed:!1,capture:"encIv"}]}]},ju={name:"pkcs-12PbeParams",tagClass:A.Class.UNIVERSAL,type:A.Type.SEQUENCE,constructed:!0,value:[{name:"pkcs-12PbeParams.salt",tagClass:A.Class.UNIVERSAL,type:A.Type.OCTETSTRING,constructed:!1,capture:"salt"},{name:"pkcs-12PbeParams.iterations",tagClass:A.Class.UNIVERSAL,type:A.Type.INTEGER,constructed:!1,capture:"iterations"}]};Y.encryptPrivateKeyInfo=function(e,t,a){a=a||{},a.saltSize=a.saltSize||8,a.count=a.count||2048,a.algorithm=a.algorithm||"aes128",a.prfAlgorithm=a.prfAlgorithm||"sha1";var r=O.random.getBytesSync(a.saltSize),n=a.count,s=A.integerToDer(n),i,o,l;if(a.algorithm.indexOf("aes")===0||a.algorithm==="des"){var u,f,c;switch(a.algorithm){case"aes128":i=16,u=16,f=Mt["aes128-CBC"],c=O.aes.createEncryptionCipher;break;case"aes192":i=24,u=16,f=Mt["aes192-CBC"],c=O.aes.createEncryptionCipher;break;case"aes256":i=32,u=16,f=Mt["aes256-CBC"],c=O.aes.createEncryptionCipher;break;case"des":i=8,u=8,f=Mt.desCBC,c=O.des.createEncryptionCipher;break;default:var v=new Error("Cannot encrypt private key. Unknown encryption algorithm.");throw v.algorithm=a.algorithm,v}var g="hmacWith"+a.prfAlgorithm.toUpperCase(),y=Vi(g),x=O.pkcs5.pbkdf2(t,r,n,i,y),S=O.random.getBytesSync(u),I=c(x);I.start(S),I.update(A.toDer(e)),I.finish(),l=I.output.getBytes();var B=$u(r,s,i,g);o=A.create(A.Class.UNIVERSAL,A.Type.SEQUENCE,!0,[A.create(A.Class.UNIVERSAL,A.Type.OID,!1,A.oidToDer(Mt.pkcs5PBES2).getBytes()),A.create(A.Class.UNIVERSAL,A.Type.SEQUENCE,!0,[A.create(A.Class.UNIVERSAL,A.Type.SEQUENCE,!0,[A.create(A.Class.UNIVERSAL,A.Type.OID,!1,A.oidToDer(Mt.pkcs5PBKDF2).getBytes()),B]),A.create(A.Class.UNIVERSAL,A.Type.SEQUENCE,!0,[A.create(A.Class.UNIVERSAL,A.Type.OID,!1,A.oidToDer(f).getBytes()),A.create(A.Class.UNIVERSAL,A.Type.OCTETSTRING,!1,S)])])])}else if(a.algorithm==="3des"){i=24;var b=new O.util.ByteBuffer(r),x=Y.pbe.generatePkcs12Key(t,b,1,n,i),S=Y.pbe.generatePkcs12Key(t,b,2,n,i),I=O.des.createEncryptionCipher(x);I.start(S),I.update(A.toDer(e)),I.finish(),l=I.output.getBytes(),o=A.create(A.Class.UNIVERSAL,A.Type.SEQUENCE,!0,[A.create(A.Class.UNIVERSAL,A.Type.OID,!1,A.oidToDer(Mt["pbeWithSHAAnd3-KeyTripleDES-CBC"]).getBytes()),A.create(A.Class.UNIVERSAL,A.Type.SEQUENCE,!0,[A.create(A.Class.UNIVERSAL,A.Type.OCTETSTRING,!1,r),A.create(A.Class.UNIVERSAL,A.Type.INTEGER,!1,s.getBytes())])])}else{var v=new Error("Cannot encrypt private key. Unknown encryption algorithm.");throw v.algorithm=a.algorithm,v}var U=A.create(A.Class.UNIVERSAL,A.Type.SEQUENCE,!0,[o,A.create(A.Class.UNIVERSAL,A.Type.OCTETSTRING,!1,l)]);return U};Y.decryptPrivateKeyInfo=function(e,t){var a=null,r={},n=[];if(!A.validate(e,Xu,r,n)){var s=new Error("Cannot read encrypted private key. ASN.1 object is not a supported EncryptedPrivateKeyInfo.");throw s.errors=n,s}var i=A.derToOid(r.encryptionOid),o=Y.pbe.getCipher(i,r.encryptionParams,t),l=O.util.createBuffer(r.encryptedData);return o.update(l),o.finish()&&(a=A.fromDer(o.output)),a};Y.encryptedPrivateKeyToPem=function(e,t){var a={type:"ENCRYPTED PRIVATE KEY",body:A.toDer(e).getBytes()};return O.pem.encode(a,{maxline:t})};Y.encryptedPrivateKeyFromPem=function(e){var t=O.pem.decode(e)[0];if(t.type!=="ENCRYPTED PRIVATE KEY"){var a=new Error('Could not convert encrypted private key from PEM; PEM header type is "ENCRYPTED PRIVATE KEY".');throw a.headerType=t.type,a}if(t.procType&&t.procType.type==="ENCRYPTED")throw new Error("Could not convert encrypted private key from PEM; PEM is encrypted.");return A.fromDer(t.body)};Y.encryptRsaPrivateKey=function(e,t,a){if(a=a||{},!a.legacy){var r=Y.wrapRsaPrivateKey(Y.privateKeyToAsn1(e));return r=Y.encryptPrivateKeyInfo(r,t,a),Y.encryptedPrivateKeyToPem(r)}var n,s,i,o;switch(a.algorithm){case"aes128":n="AES-128-CBC",i=16,s=O.random.getBytesSync(16),o=O.aes.createEncryptionCipher;break;case"aes192":n="AES-192-CBC",i=24,s=O.random.getBytesSync(16),o=O.aes.createEncryptionCipher;break;case"aes256":n="AES-256-CBC",i=32,s=O.random.getBytesSync(16),o=O.aes.createEncryptionCipher;break;case"3des":n="DES-EDE3-CBC",i=24,s=O.random.getBytesSync(8),o=O.des.createEncryptionCipher;break;case"des":n="DES-CBC",i=8,s=O.random.getBytesSync(8),o=O.des.createEncryptionCipher;break;default:var l=new Error('Could not encrypt RSA private key; unsupported encryption algorithm "'+a.algorithm+'".');throw l.algorithm=a.algorithm,l}var u=O.pbe.opensslDeriveBytes(t,s.substr(0,8),i),f=o(u);f.start(s),f.update(A.toDer(Y.privateKeyToAsn1(e))),f.finish();var c={type:"RSA PRIVATE KEY",procType:{version:"4",type:"ENCRYPTED"},dekInfo:{algorithm:n,parameters:O.util.bytesToHex(s).toUpperCase()},body:f.output.getBytes()};return O.pem.encode(c)};Y.decryptRsaPrivateKey=function(e,t){var a=null,r=O.pem.decode(e)[0];if(r.type!=="ENCRYPTED PRIVATE KEY"&&r.type!=="PRIVATE KEY"&&r.type!=="RSA PRIVATE KEY"){var n=new Error('Could not convert private key from PEM; PEM header type is not "ENCRYPTED PRIVATE KEY", "PRIVATE KEY", or "RSA PRIVATE KEY".');throw n.headerType=n,n}if(r.procType&&r.procType.type==="ENCRYPTED"){var s,i;switch(r.dekInfo.algorithm){case"DES-CBC":s=8,i=O.des.createDecryptionCipher;break;case"DES-EDE3-CBC":s=24,i=O.des.createDecryptionCipher;break;case"AES-128-CBC":s=16,i=O.aes.createDecryptionCipher;break;case"AES-192-CBC":s=24,i=O.aes.createDecryptionCipher;break;case"AES-256-CBC":s=32,i=O.aes.createDecryptionCipher;break;case"RC2-40-CBC":s=5,i=function(c){return O.rc2.createDecryptionCipher(c,40)};break;case"RC2-64-CBC":s=8,i=function(c){return O.rc2.createDecryptionCipher(c,64)};break;case"RC2-128-CBC":s=16,i=function(c){return O.rc2.createDecryptionCipher(c,128)};break;default:var n=new Error('Could not decrypt private key; unsupported encryption algorithm "'+r.dekInfo.algorithm+'".');throw n.algorithm=r.dekInfo.algorithm,n}var o=O.util.hexToBytes(r.dekInfo.parameters),l=O.pbe.opensslDeriveBytes(t,o.substr(0,8),s),u=i(l);if(u.start(o),u.update(O.util.createBuffer(r.body)),u.finish())a=u.output.getBytes();else return a}else a=r.body;return r.type==="ENCRYPTED PRIVATE KEY"?a=Y.decryptPrivateKeyInfo(A.fromDer(a),t):a=A.fromDer(a),a!==null&&(a=Y.privateKeyFromAsn1(a)),a};Y.pbe.generatePkcs12Key=function(e,t,a,r,n,s){var i,o;if(typeof s>"u"||s===null){if(!("sha1"in O.md))throw new Error('"sha1" hash algorithm unavailable.');s=O.md.sha1.create()}var l=s.digestLength,u=s.blockLength,f=new O.util.ByteBuffer,c=new O.util.ByteBuffer;if(e!=null){for(o=0;o<e.length;o++)c.putInt16(e.charCodeAt(o));c.putInt16(0)}var v=c.length(),g=t.length(),y=new O.util.ByteBuffer;y.fillWithByte(a,u);var x=u*Math.ceil(g/u),S=new O.util.ByteBuffer;for(o=0;o<x;o++)S.putByte(t.at(o%g));var I=u*Math.ceil(v/u),B=new O.util.ByteBuffer;for(o=0;o<I;o++)B.putByte(c.at(o%v));var b=S;b.putBuffer(B);for(var U=Math.ceil(n/l),L=1;L<=U;L++){var w=new O.util.ByteBuffer;w.putBytes(y.bytes()),w.putBytes(b.bytes());for(var z=0;z<r;z++)s.start(),s.update(w.getBytes()),w=s.digest();var G=new O.util.ByteBuffer;for(o=0;o<u;o++)G.putByte(w.at(o%l));var W=Math.ceil(g/u)+Math.ceil(v/u),oe=new O.util.ByteBuffer;for(i=0;i<W;i++){var ue=new O.util.ByteBuffer(b.getBytes(u)),ee=511;for(o=G.length()-1;o>=0;o--)ee=ee>>8,ee+=G.at(o)+ue.at(o),ue.setAt(o,ee&255);oe.putBuffer(ue)}b=oe,f.putBuffer(w)}return f.truncate(f.length()-n),f};Y.pbe.getCipher=function(e,t,a){switch(e){case Y.oids.pkcs5PBES2:return Y.pbe.getCipherForPBES2(e,t,a);case Y.oids["pbeWithSHAAnd3-KeyTripleDES-CBC"]:case Y.oids["pbewithSHAAnd40BitRC2-CBC"]:return Y.pbe.getCipherForPKCS12PBE(e,t,a);default:var r=new Error("Cannot read encrypted PBE data block. Unsupported OID.");throw r.oid=e,r.supportedOids=["pkcs5PBES2","pbeWithSHAAnd3-KeyTripleDES-CBC","pbewithSHAAnd40BitRC2-CBC"],r}};Y.pbe.getCipherForPBES2=function(e,t,a){var r={},n=[];if(!A.validate(t,Wu,r,n)){var s=new Error("Cannot read password-based-encryption algorithm parameters. ASN.1 object is not a supported EncryptedPrivateKeyInfo.");throw s.errors=n,s}if(e=A.derToOid(r.kdfOid),e!==Y.oids.pkcs5PBKDF2){var s=new Error("Cannot read encrypted private key. Unsupported key derivation function OID.");throw s.oid=e,s.supportedOids=["pkcs5PBKDF2"],s}if(e=A.derToOid(r.encOid),e!==Y.oids["aes128-CBC"]&&e!==Y.oids["aes192-CBC"]&&e!==Y.oids["aes256-CBC"]&&e!==Y.oids["des-EDE3-CBC"]&&e!==Y.oids.desCBC){var s=new Error("Cannot read encrypted private key. Unsupported encryption scheme OID.");throw s.oid=e,s.supportedOids=["aes128-CBC","aes192-CBC","aes256-CBC","des-EDE3-CBC","desCBC"],s}var i=r.kdfSalt,o=O.util.createBuffer(r.kdfIterationCount);o=o.getInt(o.length()<<3);var l,u;switch(Y.oids[e]){case"aes128-CBC":l=16,u=O.aes.createDecryptionCipher;break;case"aes192-CBC":l=24,u=O.aes.createDecryptionCipher;break;case"aes256-CBC":l=32,u=O.aes.createDecryptionCipher;break;case"des-EDE3-CBC":l=24,u=O.des.createDecryptionCipher;break;case"desCBC":l=8,u=O.des.createDecryptionCipher;break}var f=Pi(r.prfOid),c=O.pkcs5.pbkdf2(a,i,o,l,f),v=r.encIv,g=u(c);return g.start(v),g};Y.pbe.getCipherForPKCS12PBE=function(e,t,a){var r={},n=[];if(!A.validate(t,ju,r,n)){var s=new Error("Cannot read password-based-encryption algorithm parameters. ASN.1 object is not a supported EncryptedPrivateKeyInfo.");throw s.errors=n,s}var i=O.util.createBuffer(r.salt),o=O.util.createBuffer(r.iterations);o=o.getInt(o.length()<<3);var l,u,f;switch(e){case Y.oids["pbeWithSHAAnd3-KeyTripleDES-CBC"]:l=24,u=8,f=O.des.startDecrypting;break;case Y.oids["pbewithSHAAnd40BitRC2-CBC"]:l=5,u=8,f=function(x,S){var I=O.rc2.createDecryptionCipher(x,40);return I.start(S,null),I};break;default:var s=new Error("Cannot read PKCS #12 PBE data block. Unsupported OID.");throw s.oid=e,s}var c=Pi(r.prfOid),v=Y.pbe.generatePkcs12Key(a,i,1,o,l,c);c.start();var g=Y.pbe.generatePkcs12Key(a,i,2,o,u,c);return f(v,g)};Y.pbe.opensslDeriveBytes=function(e,t,a,r){if(typeof r>"u"||r===null){if(!("md5"in O.md))throw new Error('"md5" hash algorithm unavailable.');r=O.md.md5.create()}t===null&&(t="");for(var n=[Ui(r,e+t)],s=16,i=1;s<a;++i,s+=16)n.push(Ui(r,n[i-1]+e+t));return n.join("").substr(0,a)};function Ui(e,t){return e.start().update(t).digest().getBytes()}function Pi(e){var t;if(!e)t="hmacWithSHA1";else if(t=Y.oids[A.derToOid(e)],!t){var a=new Error("Unsupported PRF OID.");throw a.oid=e,a.supported=["hmacWithSHA1","hmacWithSHA224","hmacWithSHA256","hmacWithSHA384","hmacWithSHA512"],a}return Vi(t)}function Vi(e){var t=O.md;switch(e){case"hmacWithSHA224":t=O.md.sha512;case"hmacWithSHA1":case"hmacWithSHA256":case"hmacWithSHA384":case"hmacWithSHA512":e=e.substr(8).toLowerCase();break;default:var a=new Error("Unsupported PRF algorithm.");throw a.algorithm=e,a.supported=["hmacWithSHA1","hmacWithSHA224","hmacWithSHA256","hmacWithSHA384","hmacWithSHA512"],a}if(!t||!(e in t))throw new Error("Unknown hash algorithm: "+e);return t[e].create()}function $u(e,t,a,r){var n=A.create(A.Class.UNIVERSAL,A.Type.SEQUENCE,!0,[A.create(A.Class.UNIVERSAL,A.Type.OCTETSTRING,!1,e),A.create(A.Class.UNIVERSAL,A.Type.INTEGER,!1,t.getBytes())]);return r!=="hmacWithSHA1"&&n.value.push(A.create(A.Class.UNIVERSAL,A.Type.INTEGER,!1,O.util.hexToBytes(a.toString(16))),A.create(A.Class.UNIVERSAL,A.Type.SEQUENCE,!0,[A.create(A.Class.UNIVERSAL,A.Type.OID,!1,A.oidToDer(Y.oids[r]).getBytes()),A.create(A.Class.UNIVERSAL,A.Type.NULL,!1,"")])),n}});var qa=M((Ac,qi)=>{var nr=X();st();ne();var V=nr.asn1,ir=qi.exports=nr.pkcs7asn1=nr.pkcs7asn1||{};nr.pkcs7=nr.pkcs7||{};nr.pkcs7.asn1=ir;var Ki={name:"ContentInfo",tagClass:V.Class.UNIVERSAL,type:V.Type.SEQUENCE,constructed:!0,value:[{name:"ContentInfo.ContentType",tagClass:V.Class.UNIVERSAL,type:V.Type.OID,constructed:!1,capture:"contentType"},{name:"ContentInfo.content",tagClass:V.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,optional:!0,captureAsn1:"content"}]};ir.contentInfoValidator=Ki;var Fi={name:"EncryptedContentInfo",tagClass:V.Class.UNIVERSAL,type:V.Type.SEQUENCE,constructed:!0,value:[{name:"EncryptedContentInfo.contentType",tagClass:V.Class.UNIVERSAL,type:V.Type.OID,constructed:!1,capture:"contentType"},{name:"EncryptedContentInfo.contentEncryptionAlgorithm",tagClass:V.Class.UNIVERSAL,type:V.Type.SEQUENCE,constructed:!0,value:[{name:"EncryptedContentInfo.contentEncryptionAlgorithm.algorithm",tagClass:V.Class.UNIVERSAL,type:V.Type.OID,constructed:!1,capture:"encAlgorithm"},{name:"EncryptedContentInfo.contentEncryptionAlgorithm.parameter",tagClass:V.Class.UNIVERSAL,captureAsn1:"encParameter"}]},{name:"EncryptedContentInfo.encryptedContent",tagClass:V.Class.CONTEXT_SPECIFIC,type:0,capture:"encryptedContent",captureAsn1:"encryptedContentAsn1"}]};ir.envelopedDataValidator={name:"EnvelopedData",tagClass:V.Class.UNIVERSAL,type:V.Type.SEQUENCE,constructed:!0,value:[{name:"EnvelopedData.Version",tagClass:V.Class.UNIVERSAL,type:V.Type.INTEGER,constructed:!1,capture:"version"},{name:"EnvelopedData.RecipientInfos",tagClass:V.Class.UNIVERSAL,type:V.Type.SET,constructed:!0,captureAsn1:"recipientInfos"}].concat(Fi)};ir.encryptedDataValidator={name:"EncryptedData",tagClass:V.Class.UNIVERSAL,type:V.Type.SEQUENCE,constructed:!0,value:[{name:"EncryptedData.Version",tagClass:V.Class.UNIVERSAL,type:V.Type.INTEGER,constructed:!1,capture:"version"}].concat(Fi)};var Zu={name:"SignerInfo",tagClass:V.Class.UNIVERSAL,type:V.Type.SEQUENCE,constructed:!0,value:[{name:"SignerInfo.version",tagClass:V.Class.UNIVERSAL,type:V.Type.INTEGER,constructed:!1},{name:"SignerInfo.issuerAndSerialNumber",tagClass:V.Class.UNIVERSAL,type:V.Type.SEQUENCE,constructed:!0,value:[{name:"SignerInfo.issuerAndSerialNumber.issuer",tagClass:V.Class.UNIVERSAL,type:V.Type.SEQUENCE,constructed:!0,captureAsn1:"issuer"},{name:"SignerInfo.issuerAndSerialNumber.serialNumber",tagClass:V.Class.UNIVERSAL,type:V.Type.INTEGER,constructed:!1,capture:"serial"}]},{name:"SignerInfo.digestAlgorithm",tagClass:V.Class.UNIVERSAL,type:V.Type.SEQUENCE,constructed:!0,value:[{name:"SignerInfo.digestAlgorithm.algorithm",tagClass:V.Class.UNIVERSAL,type:V.Type.OID,constructed:!1,capture:"digestAlgorithm"},{name:"SignerInfo.digestAlgorithm.parameter",tagClass:V.Class.UNIVERSAL,constructed:!1,captureAsn1:"digestParameter",optional:!0}]},{name:"SignerInfo.authenticatedAttributes",tagClass:V.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,optional:!0,capture:"authenticatedAttributes"},{name:"SignerInfo.digestEncryptionAlgorithm",tagClass:V.Class.UNIVERSAL,type:V.Type.SEQUENCE,constructed:!0,capture:"signatureAlgorithm"},{name:"SignerInfo.encryptedDigest",tagClass:V.Class.UNIVERSAL,type:V.Type.OCTETSTRING,constructed:!1,capture:"signature"},{name:"SignerInfo.unauthenticatedAttributes",tagClass:V.Class.CONTEXT_SPECIFIC,type:1,constructed:!0,optional:!0,capture:"unauthenticatedAttributes"}]};ir.signedDataValidator={name:"SignedData",tagClass:V.Class.UNIVERSAL,type:V.Type.SEQUENCE,constructed:!0,value:[{name:"SignedData.Version",tagClass:V.Class.UNIVERSAL,type:V.Type.INTEGER,constructed:!1,capture:"version"},{name:"SignedData.DigestAlgorithms",tagClass:V.Class.UNIVERSAL,type:V.Type.SET,constructed:!0,captureAsn1:"digestAlgorithms"},Ki,{name:"SignedData.Certificates",tagClass:V.Class.CONTEXT_SPECIFIC,type:0,optional:!0,captureAsn1:"certificates"},{name:"SignedData.CertificateRevocationLists",tagClass:V.Class.CONTEXT_SPECIFIC,type:1,optional:!0,captureAsn1:"crls"},{name:"SignedData.SignerInfos",tagClass:V.Class.UNIVERSAL,type:V.Type.SET,capture:"signerInfos",optional:!0,value:[Zu]}]};ir.recipientInfoValidator={name:"RecipientInfo",tagClass:V.Class.UNIVERSAL,type:V.Type.SEQUENCE,constructed:!0,value:[{name:"RecipientInfo.version",tagClass:V.Class.UNIVERSAL,type:V.Type.INTEGER,constructed:!1,capture:"version"},{name:"RecipientInfo.issuerAndSerial",tagClass:V.Class.UNIVERSAL,type:V.Type.SEQUENCE,constructed:!0,value:[{name:"RecipientInfo.issuerAndSerial.issuer",tagClass:V.Class.UNIVERSAL,type:V.Type.SEQUENCE,constructed:!0,captureAsn1:"issuer"},{name:"RecipientInfo.issuerAndSerial.serialNumber",tagClass:V.Class.UNIVERSAL,type:V.Type.INTEGER,constructed:!1,capture:"serial"}]},{name:"RecipientInfo.keyEncryptionAlgorithm",tagClass:V.Class.UNIVERSAL,type:V.Type.SEQUENCE,constructed:!0,value:[{name:"RecipientInfo.keyEncryptionAlgorithm.algorithm",tagClass:V.Class.UNIVERSAL,type:V.Type.OID,constructed:!1,capture:"encAlgorithm"},{name:"RecipientInfo.keyEncryptionAlgorithm.parameter",tagClass:V.Class.UNIVERSAL,constructed:!1,captureAsn1:"encParameter",optional:!0}]},{name:"RecipientInfo.encryptedKey",tagClass:V.Class.UNIVERSAL,type:V.Type.OCTETSTRING,constructed:!1,capture:"encKey"}]}});var Ma=M((Bc,Mi)=>{var Ht=X();ne();Ht.mgf=Ht.mgf||{};var Ju=Mi.exports=Ht.mgf.mgf1=Ht.mgf1=Ht.mgf1||{};Ju.create=function(e){var t={generate:function(a,r){for(var n=new Ht.util.ByteBuffer,s=Math.ceil(r/e.digestLength),i=0;i<s;i++){var o=new Ht.util.ByteBuffer;o.putInt32(i),e.start(),e.update(a+o.getBytes()),n.putBuffer(e.digest())}return n.truncate(n.length()-r),n.getBytes()}};return t}});var Gi=M((bc,Hi)=>{var Zr=X();Ma();Hi.exports=Zr.mgf=Zr.mgf||{};Zr.mgf.mgf1=Zr.mgf1});var Jr=M((_c,zi)=>{var Gt=X();Je();ne();var el=zi.exports=Gt.pss=Gt.pss||{};el.create=function(e){arguments.length===3&&(e={md:arguments[0],mgf:arguments[1],saltLength:arguments[2]});var t=e.md,a=e.mgf,r=t.digestLength,n=e.salt||null;typeof n=="string"&&(n=Gt.util.createBuffer(n));var s;if("saltLength"in e)s=e.saltLength;else if(n!==null)s=n.length();else throw new Error("Salt length not specified or specific salt not given.");if(n!==null&&n.length()!==s)throw new Error("Given salt length does not match length of given salt.");var i=e.prng||Gt.random,o={};return o.encode=function(l,u){var f,c=u-1,v=Math.ceil(c/8),g=l.digest().getBytes();if(v<r+s+2)throw new Error("Message is too long to encrypt.");var y;n===null?y=i.getBytesSync(s):y=n.bytes();var x=new Gt.util.ByteBuffer;x.fillWithByte(0,8),x.putBytes(g),x.putBytes(y),t.start(),t.update(x.getBytes());var S=t.digest().getBytes(),I=new Gt.util.ByteBuffer;I.fillWithByte(0,v-s-r-2),I.putByte(1),I.putBytes(y);var B=I.getBytes(),b=v-r-1,U=a.generate(S,b),L="";for(f=0;f<b;f++)L+=String.fromCharCode(B.charCodeAt(f)^U.charCodeAt(f));var w=65280>>8*v-c&255;return L=String.fromCharCode(L.charCodeAt(0)&~w)+L.substr(1),L+S+"\xBC"},o.verify=function(l,u,f){var c,v=f-1,g=Math.ceil(v/8);if(u=u.substr(-g),g<r+s+2)throw new Error("Inconsistent parameters to PSS signature verification.");if(u.charCodeAt(g-1)!==188)throw new Error("Encoded message does not end in 0xBC.");var y=g-r-1,x=u.substr(0,y),S=u.substr(y,r),I=65280>>8*g-v&255;if((x.charCodeAt(0)&I)!==0)throw new Error("Bits beyond keysize not zero as expected.");var B=a.generate(S,y),b="";for(c=0;c<y;c++)b+=String.fromCharCode(x.charCodeAt(c)^B.charCodeAt(c));b=String.fromCharCode(b.charCodeAt(0)&~I)+b.substr(1);var U=g-r-s-2;for(c=0;c<U;c++)if(b.charCodeAt(c)!==0)throw new Error("Leftmost octets not zero as expected");if(b.charCodeAt(U)!==1)throw new Error("Inconsistent PSS signature, 0x01 marker not found");var L=b.substr(-s),w=new Gt.util.ByteBuffer;w.fillWithByte(0,8),w.putBytes(l),w.putBytes(L),t.start(),t.update(w.getBytes());var z=t.digest().getBytes();return S===z},o}});var ra=M((Nc,ji)=>{var q=X();Bt();st();mr();ut();Gi();bt();Kt();Jr();xr();ne();var h=q.asn1,k=ji.exports=q.pki=q.pki||{},ae=k.oids,ve={};ve.CN=ae.commonName;ve.commonName="CN";ve.C=ae.countryName;ve.countryName="C";ve.L=ae.localityName;ve.localityName="L";ve.ST=ae.stateOrProvinceName;ve.stateOrProvinceName="ST";ve.O=ae.organizationName;ve.organizationName="O";ve.OU=ae.organizationalUnitName;ve.organizationalUnitName="OU";ve.E=ae.emailAddress;ve.emailAddress="E";var Yi=q.pki.rsa.publicKeyValidator,tl={name:"Certificate",tagClass:h.Class.UNIVERSAL,type:h.Type.SEQUENCE,constructed:!0,value:[{name:"Certificate.TBSCertificate",tagClass:h.Class.UNIVERSAL,type:h.Type.SEQUENCE,constructed:!0,captureAsn1:"tbsCertificate",value:[{name:"Certificate.TBSCertificate.version",tagClass:h.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,optional:!0,value:[{name:"Certificate.TBSCertificate.version.integer",tagClass:h.Class.UNIVERSAL,type:h.Type.INTEGER,constructed:!1,capture:"certVersion"}]},{name:"Certificate.TBSCertificate.serialNumber",tagClass:h.Class.UNIVERSAL,type:h.Type.INTEGER,constructed:!1,capture:"certSerialNumber"},{name:"Certificate.TBSCertificate.signature",tagClass:h.Class.UNIVERSAL,type:h.Type.SEQUENCE,constructed:!0,value:[{name:"Certificate.TBSCertificate.signature.algorithm",tagClass:h.Class.UNIVERSAL,type:h.Type.OID,constructed:!1,capture:"certinfoSignatureOid"},{name:"Certificate.TBSCertificate.signature.parameters",tagClass:h.Class.UNIVERSAL,optional:!0,captureAsn1:"certinfoSignatureParams"}]},{name:"Certificate.TBSCertificate.issuer",tagClass:h.Class.UNIVERSAL,type:h.Type.SEQUENCE,constructed:!0,captureAsn1:"certIssuer"},{name:"Certificate.TBSCertificate.validity",tagClass:h.Class.UNIVERSAL,type:h.Type.SEQUENCE,constructed:!0,value:[{name:"Certificate.TBSCertificate.validity.notBefore (utc)",tagClass:h.Class.UNIVERSAL,type:h.Type.UTCTIME,constructed:!1,optional:!0,capture:"certValidity1UTCTime"},{name:"Certificate.TBSCertificate.validity.notBefore (generalized)",tagClass:h.Class.UNIVERSAL,type:h.Type.GENERALIZEDTIME,constructed:!1,optional:!0,capture:"certValidity2GeneralizedTime"},{name:"Certificate.TBSCertificate.validity.notAfter (utc)",tagClass:h.Class.UNIVERSAL,type:h.Type.UTCTIME,constructed:!1,optional:!0,capture:"certValidity3UTCTime"},{name:"Certificate.TBSCertificate.validity.notAfter (generalized)",tagClass:h.Class.UNIVERSAL,type:h.Type.GENERALIZEDTIME,constructed:!1,optional:!0,capture:"certValidity4GeneralizedTime"}]},{name:"Certificate.TBSCertificate.subject",tagClass:h.Class.UNIVERSAL,type:h.Type.SEQUENCE,constructed:!0,captureAsn1:"certSubject"},Yi,{name:"Certificate.TBSCertificate.issuerUniqueID",tagClass:h.Class.CONTEXT_SPECIFIC,type:1,constructed:!0,optional:!0,value:[{name:"Certificate.TBSCertificate.issuerUniqueID.id",tagClass:h.Class.UNIVERSAL,type:h.Type.BITSTRING,constructed:!1,captureBitStringValue:"certIssuerUniqueId"}]},{name:"Certificate.TBSCertificate.subjectUniqueID",tagClass:h.Class.CONTEXT_SPECIFIC,type:2,constructed:!0,optional:!0,value:[{name:"Certificate.TBSCertificate.subjectUniqueID.id",tagClass:h.Class.UNIVERSAL,type:h.Type.BITSTRING,constructed:!1,captureBitStringValue:"certSubjectUniqueId"}]},{name:"Certificate.TBSCertificate.extensions",tagClass:h.Class.CONTEXT_SPECIFIC,type:3,constructed:!0,captureAsn1:"certExtensions",optional:!0}]},{name:"Certificate.signatureAlgorithm",tagClass:h.Class.UNIVERSAL,type:h.Type.SEQUENCE,constructed:!0,value:[{name:"Certificate.signatureAlgorithm.algorithm",tagClass:h.Class.UNIVERSAL,type:h.Type.OID,constructed:!1,capture:"certSignatureOid"},{name:"Certificate.TBSCertificate.signature.parameters",tagClass:h.Class.UNIVERSAL,optional:!0,captureAsn1:"certSignatureParams"}]},{name:"Certificate.signatureValue",tagClass:h.Class.UNIVERSAL,type:h.Type.BITSTRING,constructed:!1,captureBitStringValue:"certSignature"}]},rl={name:"rsapss",tagClass:h.Class.UNIVERSAL,type:h.Type.SEQUENCE,constructed:!0,value:[{name:"rsapss.hashAlgorithm",tagClass:h.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,value:[{name:"rsapss.hashAlgorithm.AlgorithmIdentifier",tagClass:h.Class.UNIVERSAL,type:h.Class.SEQUENCE,constructed:!0,optional:!0,value:[{name:"rsapss.hashAlgorithm.AlgorithmIdentifier.algorithm",tagClass:h.Class.UNIVERSAL,type:h.Type.OID,constructed:!1,capture:"hashOid"}]}]},{name:"rsapss.maskGenAlgorithm",tagClass:h.Class.CONTEXT_SPECIFIC,type:1,constructed:!0,value:[{name:"rsapss.maskGenAlgorithm.AlgorithmIdentifier",tagClass:h.Class.UNIVERSAL,type:h.Class.SEQUENCE,constructed:!0,optional:!0,value:[{name:"rsapss.maskGenAlgorithm.AlgorithmIdentifier.algorithm",tagClass:h.Class.UNIVERSAL,type:h.Type.OID,constructed:!1,capture:"maskGenOid"},{name:"rsapss.maskGenAlgorithm.AlgorithmIdentifier.params",tagClass:h.Class.UNIVERSAL,type:h.Type.SEQUENCE,constructed:!0,value:[{name:"rsapss.maskGenAlgorithm.AlgorithmIdentifier.params.algorithm",tagClass:h.Class.UNIVERSAL,type:h.Type.OID,constructed:!1,capture:"maskGenHashOid"}]}]}]},{name:"rsapss.saltLength",tagClass:h.Class.CONTEXT_SPECIFIC,type:2,optional:!0,value:[{name:"rsapss.saltLength.saltLength",tagClass:h.Class.UNIVERSAL,type:h.Class.INTEGER,constructed:!1,capture:"saltLength"}]},{name:"rsapss.trailerField",tagClass:h.Class.CONTEXT_SPECIFIC,type:3,optional:!0,value:[{name:"rsapss.trailer.trailer",tagClass:h.Class.UNIVERSAL,type:h.Class.INTEGER,constructed:!1,capture:"trailer"}]}]},al={name:"CertificationRequestInfo",tagClass:h.Class.UNIVERSAL,type:h.Type.SEQUENCE,constructed:!0,captureAsn1:"certificationRequestInfo",value:[{name:"CertificationRequestInfo.integer",tagClass:h.Class.UNIVERSAL,type:h.Type.INTEGER,constructed:!1,capture:"certificationRequestInfoVersion"},{name:"CertificationRequestInfo.subject",tagClass:h.Class.UNIVERSAL,type:h.Type.SEQUENCE,constructed:!0,captureAsn1:"certificationRequestInfoSubject"},Yi,{name:"CertificationRequestInfo.attributes",tagClass:h.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,optional:!0,capture:"certificationRequestInfoAttributes",value:[{name:"CertificationRequestInfo.attributes",tagClass:h.Class.UNIVERSAL,type:h.Type.SEQUENCE,constructed:!0,value:[{name:"CertificationRequestInfo.attributes.type",tagClass:h.Class.UNIVERSAL,type:h.Type.OID,constructed:!1},{name:"CertificationRequestInfo.attributes.value",tagClass:h.Class.UNIVERSAL,type:h.Type.SET,constructed:!0}]}]}]},nl={name:"CertificationRequest",tagClass:h.Class.UNIVERSAL,type:h.Type.SEQUENCE,constructed:!0,captureAsn1:"csr",value:[al,{name:"CertificationRequest.signatureAlgorithm",tagClass:h.Class.UNIVERSAL,type:h.Type.SEQUENCE,constructed:!0,value:[{name:"CertificationRequest.signatureAlgorithm.algorithm",tagClass:h.Class.UNIVERSAL,type:h.Type.OID,constructed:!1,capture:"csrSignatureOid"},{name:"CertificationRequest.signatureAlgorithm.parameters",tagClass:h.Class.UNIVERSAL,optional:!0,captureAsn1:"csrSignatureParams"}]},{name:"CertificationRequest.signature",tagClass:h.Class.UNIVERSAL,type:h.Type.BITSTRING,constructed:!1,captureBitStringValue:"csrSignature"}]};k.RDNAttributesAsArray=function(e,t){for(var a=[],r,n,s,i=0;i<e.value.length;++i){r=e.value[i];for(var o=0;o<r.value.length;++o)s={},n=r.value[o],s.type=h.derToOid(n.value[0].value),s.value=n.value[1].value,s.valueTagClass=n.value[1].type,s.type in ae&&(s.name=ae[s.type],s.name in ve&&(s.shortName=ve[s.name])),t&&(t.update(s.type),t.update(s.value)),a.push(s)}return a};k.CRIAttributesAsArray=function(e){for(var t=[],a=0;a<e.length;++a)for(var r=e[a],n=h.derToOid(r.value[0].value),s=r.value[1].value,i=0;i<s.length;++i){var o={};if(o.type=n,o.value=s[i].value,o.valueTagClass=s[i].type,o.type in ae&&(o.name=ae[o.type],o.name in ve&&(o.shortName=ve[o.name])),o.type===ae.extensionRequest){o.extensions=[];for(var l=0;l<o.value.length;++l)o.extensions.push(k.certificateExtensionFromAsn1(o.value[l]))}t.push(o)}return t};function Rt(e,t){typeof t=="string"&&(t={shortName:t});for(var a=null,r,n=0;a===null&&n<e.attributes.length;++n)r=e.attributes[n],(t.type&&t.type===r.type||t.name&&t.name===r.name||t.shortName&&t.shortName===r.shortName)&&(a=r);return a}var ea=function(e,t,a){var r={};if(e!==ae["RSASSA-PSS"])return r;a&&(r={hash:{algorithmOid:ae.sha1},mgf:{algorithmOid:ae.mgf1,hash:{algorithmOid:ae.sha1}},saltLength:20});var n={},s=[];if(!h.validate(t,rl,n,s)){var i=new Error("Cannot read RSASSA-PSS parameter block.");throw i.errors=s,i}return n.hashOid!==void 0&&(r.hash=r.hash||{},r.hash.algorithmOid=h.derToOid(n.hashOid)),n.maskGenOid!==void 0&&(r.mgf=r.mgf||{},r.mgf.algorithmOid=h.derToOid(n.maskGenOid),r.mgf.hash=r.mgf.hash||{},r.mgf.hash.algorithmOid=h.derToOid(n.maskGenHashOid)),n.saltLength!==void 0&&(r.saltLength=n.saltLength.charCodeAt(0)),r},ta=function(e){switch(ae[e.signatureOid]){case"sha1WithRSAEncryption":case"sha1WithRSASignature":return q.md.sha1.create();case"md5WithRSAEncryption":return q.md.md5.create();case"sha256WithRSAEncryption":return q.md.sha256.create();case"sha384WithRSAEncryption":return q.md.sha384.create();case"sha512WithRSAEncryption":return q.md.sha512.create();case"RSASSA-PSS":return q.md.sha256.create();default:var t=new Error("Could not compute "+e.type+" digest. Unknown signature OID.");throw t.signatureOid=e.signatureOid,t}},Xi=function(e){var t=e.certificate,a;switch(t.signatureOid){case ae.sha1WithRSAEncryption:case ae.sha1WithRSASignature:break;case ae["RSASSA-PSS"]:var r,n;if(r=ae[t.signatureParameters.mgf.hash.algorithmOid],r===void 0||q.md[r]===void 0){var s=new Error("Unsupported MGF hash function.");throw s.oid=t.signatureParameters.mgf.hash.algorithmOid,s.name=r,s}if(n=ae[t.signatureParameters.mgf.algorithmOid],n===void 0||q.mgf[n]===void 0){var s=new Error("Unsupported MGF function.");throw s.oid=t.signatureParameters.mgf.algorithmOid,s.name=n,s}if(n=q.mgf[n].create(q.md[r].create()),r=ae[t.signatureParameters.hash.algorithmOid],r===void 0||q.md[r]===void 0){var s=new Error("Unsupported RSASSA-PSS hash function.");throw s.oid=t.signatureParameters.hash.algorithmOid,s.name=r,s}a=q.pss.create(q.md[r].create(),n,t.signatureParameters.saltLength);break}return t.publicKey.verify(e.md.digest().getBytes(),e.signature,a)};k.certificateFromPem=function(e,t,a){var r=q.pem.decode(e)[0];if(r.type!=="CERTIFICATE"&&r.type!=="X509 CERTIFICATE"&&r.type!=="TRUSTED CERTIFICATE"){var n=new Error('Could not convert certificate from PEM; PEM header type is not "CERTIFICATE", "X509 CERTIFICATE", or "TRUSTED CERTIFICATE".');throw n.headerType=r.type,n}if(r.procType&&r.procType.type==="ENCRYPTED")throw new Error("Could not convert certificate from PEM; PEM is encrypted.");var s=h.fromDer(r.body,a);return k.certificateFromAsn1(s,t)};k.certificateToPem=function(e,t){var a={type:"CERTIFICATE",body:h.toDer(k.certificateToAsn1(e)).getBytes()};return q.pem.encode(a,{maxline:t})};k.publicKeyFromPem=function(e){var t=q.pem.decode(e)[0];if(t.type!=="PUBLIC KEY"&&t.type!=="RSA PUBLIC KEY"){var a=new Error('Could not convert public key from PEM; PEM header type is not "PUBLIC KEY" or "RSA PUBLIC KEY".');throw a.headerType=t.type,a}if(t.procType&&t.procType.type==="ENCRYPTED")throw new Error("Could not convert public key from PEM; PEM is encrypted.");var r=h.fromDer(t.body);return k.publicKeyFromAsn1(r)};k.publicKeyToPem=function(e,t){var a={type:"PUBLIC KEY",body:h.toDer(k.publicKeyToAsn1(e)).getBytes()};return q.pem.encode(a,{maxline:t})};k.publicKeyToRSAPublicKeyPem=function(e,t){var a={type:"RSA PUBLIC KEY",body:h.toDer(k.publicKeyToRSAPublicKey(e)).getBytes()};return q.pem.encode(a,{maxline:t})};k.getPublicKeyFingerprint=function(e,t){t=t||{};var a=t.md||q.md.sha1.create(),r=t.type||"RSAPublicKey",n;switch(r){case"RSAPublicKey":n=h.toDer(k.publicKeyToRSAPublicKey(e)).getBytes();break;case"SubjectPublicKeyInfo":n=h.toDer(k.publicKeyToAsn1(e)).getBytes();break;default:throw new Error('Unknown fingerprint type "'+t.type+'".')}a.start(),a.update(n);var s=a.digest();if(t.encoding==="hex"){var i=s.toHex();return t.delimiter?i.match(/.{2}/g).join(t.delimiter):i}else{if(t.encoding==="binary")return s.getBytes();if(t.encoding)throw new Error('Unknown encoding "'+t.encoding+'".')}return s};k.certificationRequestFromPem=function(e,t,a){var r=q.pem.decode(e)[0];if(r.type!=="CERTIFICATE REQUEST"){var n=new Error('Could not convert certification request from PEM; PEM header type is not "CERTIFICATE REQUEST".');throw n.headerType=r.type,n}if(r.procType&&r.procType.type==="ENCRYPTED")throw new Error("Could not convert certification request from PEM; PEM is encrypted.");var s=h.fromDer(r.body,a);return k.certificationRequestFromAsn1(s,t)};k.certificationRequestToPem=function(e,t){var a={type:"CERTIFICATE REQUEST",body:h.toDer(k.certificationRequestToAsn1(e)).getBytes()};return q.pem.encode(a,{maxline:t})};k.createCertificate=function(){var e={};return e.version=2,e.serialNumber="00",e.signatureOid=null,e.signature=null,e.siginfo={},e.siginfo.algorithmOid=null,e.validity={},e.validity.notBefore=new Date,e.validity.notAfter=new Date,e.issuer={},e.issuer.getField=function(t){return Rt(e.issuer,t)},e.issuer.addField=function(t){rt([t]),e.issuer.attributes.push(t)},e.issuer.attributes=[],e.issuer.hash=null,e.subject={},e.subject.getField=function(t){return Rt(e.subject,t)},e.subject.addField=function(t){rt([t]),e.subject.attributes.push(t)},e.subject.attributes=[],e.subject.hash=null,e.extensions=[],e.publicKey=null,e.md=null,e.setSubject=function(t,a){rt(t),e.subject.attributes=t,delete e.subject.uniqueId,a&&(e.subject.uniqueId=a),e.subject.hash=null},e.setIssuer=function(t,a){rt(t),e.issuer.attributes=t,delete e.issuer.uniqueId,a&&(e.issuer.uniqueId=a),e.issuer.hash=null},e.setExtensions=function(t){for(var a=0;a<t.length;++a)Wi(t[a],{cert:e});e.extensions=t},e.getExtension=function(t){typeof t=="string"&&(t={name:t});for(var a=null,r,n=0;a===null&&n<e.extensions.length;++n)r=e.extensions[n],(t.id&&r.id===t.id||t.name&&r.name===t.name)&&(a=r);return a},e.sign=function(t,a){e.md=a||q.md.sha1.create();var r=ae[e.md.algorithm+"WithRSAEncryption"];if(!r){var n=new Error("Could not compute certificate digest. Unknown message digest algorithm OID.");throw n.algorithm=e.md.algorithm,n}e.signatureOid=e.siginfo.algorithmOid=r,e.tbsCertificate=k.getTBSCertificate(e);var s=h.toDer(e.tbsCertificate);e.md.update(s.getBytes()),e.signature=t.sign(e.md)},e.verify=function(t){var a=!1;if(!e.issued(t)){var r=t.issuer,n=e.subject,s=new Error("The parent certificate did not issue the given child certificate; the child certificate's issuer does not match the parent's subject.");throw s.expectedIssuer=n.attributes,s.actualIssuer=r.attributes,s}var i=t.md;if(i===null){i=ta({signatureOid:t.signatureOid,type:"certificate"});var o=t.tbsCertificate||k.getTBSCertificate(t),l=h.toDer(o);i.update(l.getBytes())}return i!==null&&(a=Xi({certificate:e,md:i,signature:t.signature})),a},e.isIssuer=function(t){var a=!1,r=e.issuer,n=t.subject;if(r.hash&&n.hash)a=r.hash===n.hash;else if(r.attributes.length===n.attributes.length){a=!0;for(var s,i,o=0;a&&o<r.attributes.length;++o)s=r.attributes[o],i=n.attributes[o],(s.type!==i.type||s.value!==i.value)&&(a=!1)}return a},e.issued=function(t){return t.isIssuer(e)},e.generateSubjectKeyIdentifier=function(){return k.getPublicKeyFingerprint(e.publicKey,{type:"RSAPublicKey"})},e.verifySubjectKeyIdentifier=function(){for(var t=ae.subjectKeyIdentifier,a=0;a<e.extensions.length;++a){var r=e.extensions[a];if(r.id===t){var n=e.generateSubjectKeyIdentifier().getBytes();return q.util.hexToBytes(r.subjectKeyIdentifier)===n}}return!1},e};k.certificateFromAsn1=function(e,t){var a={},r=[];if(!h.validate(e,tl,a,r)){var n=new Error("Cannot read X.509 certificate. ASN.1 object is not an X509v3 Certificate.");throw n.errors=r,n}var s=h.derToOid(a.publicKeyOid);if(s!==k.oids.rsaEncryption)throw new Error("Cannot read public key. OID is not RSA.");var i=k.createCertificate();i.version=a.certVersion?a.certVersion.charCodeAt(0):0;var o=q.util.createBuffer(a.certSerialNumber);i.serialNumber=o.toHex(),i.signatureOid=q.asn1.derToOid(a.certSignatureOid),i.signatureParameters=ea(i.signatureOid,a.certSignatureParams,!0),i.siginfo.algorithmOid=q.asn1.derToOid(a.certinfoSignatureOid),i.siginfo.parameters=ea(i.siginfo.algorithmOid,a.certinfoSignatureParams,!1),i.signature=a.certSignature;var l=[];if(a.certValidity1UTCTime!==void 0&&l.push(h.utcTimeToDate(a.certValidity1UTCTime)),a.certValidity2GeneralizedTime!==void 0&&l.push(h.generalizedTimeToDate(a.certValidity2GeneralizedTime)),a.certValidity3UTCTime!==void 0&&l.push(h.utcTimeToDate(a.certValidity3UTCTime)),a.certValidity4GeneralizedTime!==void 0&&l.push(h.generalizedTimeToDate(a.certValidity4GeneralizedTime)),l.length>2)throw new Error("Cannot read notBefore/notAfter validity times; more than two times were provided in the certificate.");if(l.length<2)throw new Error("Cannot read notBefore/notAfter validity times; they were not provided as either UTCTime or GeneralizedTime.");if(i.validity.notBefore=l[0],i.validity.notAfter=l[1],i.tbsCertificate=a.tbsCertificate,t){i.md=ta({signatureOid:i.signatureOid,type:"certificate"});var u=h.toDer(i.tbsCertificate);i.md.update(u.getBytes())}var f=q.md.sha1.create(),c=h.toDer(a.certIssuer);f.update(c.getBytes()),i.issuer.getField=function(y){return Rt(i.issuer,y)},i.issuer.addField=function(y){rt([y]),i.issuer.attributes.push(y)},i.issuer.attributes=k.RDNAttributesAsArray(a.certIssuer),a.certIssuerUniqueId&&(i.issuer.uniqueId=a.certIssuerUniqueId),i.issuer.hash=f.digest().toHex();var v=q.md.sha1.create(),g=h.toDer(a.certSubject);return v.update(g.getBytes()),i.subject.getField=function(y){return Rt(i.subject,y)},i.subject.addField=function(y){rt([y]),i.subject.attributes.push(y)},i.subject.attributes=k.RDNAttributesAsArray(a.certSubject),a.certSubjectUniqueId&&(i.subject.uniqueId=a.certSubjectUniqueId),i.subject.hash=v.digest().toHex(),a.certExtensions?i.extensions=k.certificateExtensionsFromAsn1(a.certExtensions):i.extensions=[],i.publicKey=k.publicKeyFromAsn1(a.subjectPublicKeyInfo),i};k.certificateExtensionsFromAsn1=function(e){for(var t=[],a=0;a<e.value.length;++a)for(var r=e.value[a],n=0;n<r.value.length;++n)t.push(k.certificateExtensionFromAsn1(r.value[n]));return t};k.certificateExtensionFromAsn1=function(e){var t={};if(t.id=h.derToOid(e.value[0].value),t.critical=!1,e.value[1].type===h.Type.BOOLEAN?(t.critical=e.value[1].value.charCodeAt(0)!==0,t.value=e.value[2].value):t.value=e.value[1].value,t.id in ae){if(t.name=ae[t.id],t.name==="keyUsage"){var a=h.fromDer(t.value),r=0,n=0;a.value.length>1&&(r=a.value.charCodeAt(1),n=a.value.length>2?a.value.charCodeAt(2):0),t.digitalSignature=(r&128)===128,t.nonRepudiation=(r&64)===64,t.keyEncipherment=(r&32)===32,t.dataEncipherment=(r&16)===16,t.keyAgreement=(r&8)===8,t.keyCertSign=(r&4)===4,t.cRLSign=(r&2)===2,t.encipherOnly=(r&1)===1,t.decipherOnly=(n&128)===128}else if(t.name==="basicConstraints"){var a=h.fromDer(t.value);a.value.length>0&&a.value[0].type===h.Type.BOOLEAN?t.cA=a.value[0].value.charCodeAt(0)!==0:t.cA=!1;var s=null;a.value.length>0&&a.value[0].type===h.Type.INTEGER?s=a.value[0].value:a.value.length>1&&(s=a.value[1].value),s!==null&&(t.pathLenConstraint=h.derToInteger(s))}else if(t.name==="extKeyUsage")for(var a=h.fromDer(t.value),i=0;i<a.value.length;++i){var o=h.derToOid(a.value[i].value);o in ae?t[ae[o]]=!0:t[o]=!0}else if(t.name==="nsCertType"){var a=h.fromDer(t.value),r=0;a.value.length>1&&(r=a.value.charCodeAt(1)),t.client=(r&128)===128,t.server=(r&64)===64,t.email=(r&32)===32,t.objsign=(r&16)===16,t.reserved=(r&8)===8,t.sslCA=(r&4)===4,t.emailCA=(r&2)===2,t.objCA=(r&1)===1}else if(t.name==="subjectAltName"||t.name==="issuerAltName"){t.altNames=[];for(var l,a=h.fromDer(t.value),u=0;u<a.value.length;++u){l=a.value[u];var f={type:l.type,value:l.value};switch(t.altNames.push(f),l.type){case 1:case 2:case 6:break;case 7:f.ip=q.util.bytesToIP(l.value);break;case 8:f.oid=h.derToOid(l.value);break;default:}}}else if(t.name==="subjectKeyIdentifier"){var a=h.fromDer(t.value);t.subjectKeyIdentifier=q.util.bytesToHex(a.value)}}return t};k.certificationRequestFromAsn1=function(e,t){var a={},r=[];if(!h.validate(e,nl,a,r)){var n=new Error("Cannot read PKCS#10 certificate request. ASN.1 object is not a PKCS#10 CertificationRequest.");throw n.errors=r,n}var s=h.derToOid(a.publicKeyOid);if(s!==k.oids.rsaEncryption)throw new Error("Cannot read public key. OID is not RSA.");var i=k.createCertificationRequest();if(i.version=a.csrVersion?a.csrVersion.charCodeAt(0):0,i.signatureOid=q.asn1.derToOid(a.csrSignatureOid),i.signatureParameters=ea(i.signatureOid,a.csrSignatureParams,!0),i.siginfo.algorithmOid=q.asn1.derToOid(a.csrSignatureOid),i.siginfo.parameters=ea(i.siginfo.algorithmOid,a.csrSignatureParams,!1),i.signature=a.csrSignature,i.certificationRequestInfo=a.certificationRequestInfo,t){i.md=ta({signatureOid:i.signatureOid,type:"certification request"});var o=h.toDer(i.certificationRequestInfo);i.md.update(o.getBytes())}var l=q.md.sha1.create();return i.subject.getField=function(u){return Rt(i.subject,u)},i.subject.addField=function(u){rt([u]),i.subject.attributes.push(u)},i.subject.attributes=k.RDNAttributesAsArray(a.certificationRequestInfoSubject,l),i.subject.hash=l.digest().toHex(),i.publicKey=k.publicKeyFromAsn1(a.subjectPublicKeyInfo),i.getAttribute=function(u){return Rt(i,u)},i.addAttribute=function(u){rt([u]),i.attributes.push(u)},i.attributes=k.CRIAttributesAsArray(a.certificationRequestInfoAttributes||[]),i};k.createCertificationRequest=function(){var e={};return e.version=0,e.signatureOid=null,e.signature=null,e.siginfo={},e.siginfo.algorithmOid=null,e.subject={},e.subject.getField=function(t){return Rt(e.subject,t)},e.subject.addField=function(t){rt([t]),e.subject.attributes.push(t)},e.subject.attributes=[],e.subject.hash=null,e.publicKey=null,e.attributes=[],e.getAttribute=function(t){return Rt(e,t)},e.addAttribute=function(t){rt([t]),e.attributes.push(t)},e.md=null,e.setSubject=function(t){rt(t),e.subject.attributes=t,e.subject.hash=null},e.setAttributes=function(t){rt(t),e.attributes=t},e.sign=function(t,a){e.md=a||q.md.sha1.create();var r=ae[e.md.algorithm+"WithRSAEncryption"];if(!r){var n=new Error("Could not compute certification request digest. Unknown message digest algorithm OID.");throw n.algorithm=e.md.algorithm,n}e.signatureOid=e.siginfo.algorithmOid=r,e.certificationRequestInfo=k.getCertificationRequestInfo(e);var s=h.toDer(e.certificationRequestInfo);e.md.update(s.getBytes()),e.signature=t.sign(e.md)},e.verify=function(){var t=!1,a=e.md;if(a===null){a=ta({signatureOid:e.signatureOid,type:"certification request"});var r=e.certificationRequestInfo||k.getCertificationRequestInfo(e),n=h.toDer(r);a.update(n.getBytes())}return a!==null&&(t=Xi({certificate:e,md:a,signature:e.signature})),t},e};function sr(e){for(var t=h.create(h.Class.UNIVERSAL,h.Type.SEQUENCE,!0,[]),a,r,n=e.attributes,s=0;s<n.length;++s){a=n[s];var i=a.value,o=h.Type.PRINTABLESTRING;"valueTagClass"in a&&(o=a.valueTagClass,o===h.Type.UTF8&&(i=q.util.encodeUtf8(i))),r=h.create(h.Class.UNIVERSAL,h.Type.SET,!0,[h.create(h.Class.UNIVERSAL,h.Type.SEQUENCE,!0,[h.create(h.Class.UNIVERSAL,h.Type.OID,!1,h.oidToDer(a.type).getBytes()),h.create(h.Class.UNIVERSAL,o,!1,i)])]),t.value.push(r)}return t}function rt(e){for(var t,a=0;a<e.length;++a){if(t=e[a],typeof t.name>"u"&&(t.type&&t.type in k.oids?t.name=k.oids[t.type]:t.shortName&&t.shortName in ve&&(t.name=k.oids[ve[t.shortName]])),typeof t.type>"u")if(t.name&&t.name in k.oids)t.type=k.oids[t.name];else{var r=new Error("Attribute type not specified.");throw r.attribute=t,r}if(typeof t.shortName>"u"&&t.name&&t.name in ve&&(t.shortName=ve[t.name]),t.type===ae.extensionRequest&&(t.valueConstructed=!0,t.valueTagClass=h.Type.SEQUENCE,!t.value&&t.extensions)){t.value=[];for(var n=0;n<t.extensions.length;++n)t.value.push(k.certificateExtensionToAsn1(Wi(t.extensions[n])))}if(typeof t.value>"u"){var r=new Error("Attribute value not specified.");throw r.attribute=t,r}}}function Wi(e,t){if(t=t||{},typeof e.name>"u"&&e.id&&e.id in k.oids&&(e.name=k.oids[e.id]),typeof e.id>"u")if(e.name&&e.name in k.oids)e.id=k.oids[e.name];else{var a=new Error("Extension ID not specified.");throw a.extension=e,a}if(typeof e.value<"u")return e;if(e.name==="keyUsage"){var r=0,n=0,s=0;e.digitalSignature&&(n|=128,r=7),e.nonRepudiation&&(n|=64,r=6),e.keyEncipherment&&(n|=32,r=5),e.dataEncipherment&&(n|=16,r=4),e.keyAgreement&&(n|=8,r=3),e.keyCertSign&&(n|=4,r=2),e.cRLSign&&(n|=2,r=1),e.encipherOnly&&(n|=1,r=0),e.decipherOnly&&(s|=128,r=7);var i=String.fromCharCode(r);s!==0?i+=String.fromCharCode(n)+String.fromCharCode(s):n!==0&&(i+=String.fromCharCode(n)),e.value=h.create(h.Class.UNIVERSAL,h.Type.BITSTRING,!1,i)}else if(e.name==="basicConstraints")e.value=h.create(h.Class.UNIVERSAL,h.Type.SEQUENCE,!0,[]),e.cA&&e.value.value.push(h.create(h.Class.UNIVERSAL,h.Type.BOOLEAN,!1,"\xFF")),"pathLenConstraint"in e&&e.value.value.push(h.create(h.Class.UNIVERSAL,h.Type.INTEGER,!1,h.integerToDer(e.pathLenConstraint).getBytes()));else if(e.name==="extKeyUsage"){e.value=h.create(h.Class.UNIVERSAL,h.Type.SEQUENCE,!0,[]);var o=e.value.value;for(var l in e)e[l]===!0&&(l in ae?o.push(h.create(h.Class.UNIVERSAL,h.Type.OID,!1,h.oidToDer(ae[l]).getBytes())):l.indexOf(".")!==-1&&o.push(h.create(h.Class.UNIVERSAL,h.Type.OID,!1,h.oidToDer(l).getBytes())))}else if(e.name==="nsCertType"){var r=0,n=0;e.client&&(n|=128,r=7),e.server&&(n|=64,r=6),e.email&&(n|=32,r=5),e.objsign&&(n|=16,r=4),e.reserved&&(n|=8,r=3),e.sslCA&&(n|=4,r=2),e.emailCA&&(n|=2,r=1),e.objCA&&(n|=1,r=0);var i=String.fromCharCode(r);n!==0&&(i+=String.fromCharCode(n)),e.value=h.create(h.Class.UNIVERSAL,h.Type.BITSTRING,!1,i)}else if(e.name==="subjectAltName"||e.name==="issuerAltName"){e.value=h.create(h.Class.UNIVERSAL,h.Type.SEQUENCE,!0,[]);for(var u,f=0;f<e.altNames.length;++f){u=e.altNames[f];var i=u.value;if(u.type===7&&u.ip){if(i=q.util.bytesFromIP(u.ip),i===null){var a=new Error('Extension "ip" value is not a valid IPv4 or IPv6 address.');throw a.extension=e,a}}else u.type===8&&(u.oid?i=h.oidToDer(h.oidToDer(u.oid)):i=h.oidToDer(i));e.value.value.push(h.create(h.Class.CONTEXT_SPECIFIC,u.type,!1,i))}}else if(e.name==="nsComment"&&t.cert){if(!/^[\x00-\x7F]*$/.test(e.comment)||e.comment.length<1||e.comment.length>128)throw new Error('Invalid "nsComment" content.');e.value=h.create(h.Class.UNIVERSAL,h.Type.IA5STRING,!1,e.comment)}else if(e.name==="subjectKeyIdentifier"&&t.cert){var c=t.cert.generateSubjectKeyIdentifier();e.subjectKeyIdentifier=c.toHex(),e.value=h.create(h.Class.UNIVERSAL,h.Type.OCTETSTRING,!1,c.getBytes())}else if(e.name==="authorityKeyIdentifier"&&t.cert){e.value=h.create(h.Class.UNIVERSAL,h.Type.SEQUENCE,!0,[]);var o=e.value.value;if(e.keyIdentifier){var v=e.keyIdentifier===!0?t.cert.generateSubjectKeyIdentifier().getBytes():e.keyIdentifier;o.push(h.create(h.Class.CONTEXT_SPECIFIC,0,!1,v))}if(e.authorityCertIssuer){var g=[h.create(h.Class.CONTEXT_SPECIFIC,4,!0,[sr(e.authorityCertIssuer===!0?t.cert.issuer:e.authorityCertIssuer)])];o.push(h.create(h.Class.CONTEXT_SPECIFIC,1,!0,g))}if(e.serialNumber){var y=q.util.hexToBytes(e.serialNumber===!0?t.cert.serialNumber:e.serialNumber);o.push(h.create(h.Class.CONTEXT_SPECIFIC,2,!1,y))}}else if(e.name==="cRLDistributionPoints"){e.value=h.create(h.Class.UNIVERSAL,h.Type.SEQUENCE,!0,[]);for(var o=e.value.value,x=h.create(h.Class.UNIVERSAL,h.Type.SEQUENCE,!0,[]),S=h.create(h.Class.CONTEXT_SPECIFIC,0,!0,[]),u,f=0;f<e.altNames.length;++f){u=e.altNames[f];var i=u.value;if(u.type===7&&u.ip){if(i=q.util.bytesFromIP(u.ip),i===null){var a=new Error('Extension "ip" value is not a valid IPv4 or IPv6 address.');throw a.extension=e,a}}else u.type===8&&(u.oid?i=h.oidToDer(h.oidToDer(u.oid)):i=h.oidToDer(i));S.value.push(h.create(h.Class.CONTEXT_SPECIFIC,u.type,!1,i))}x.value.push(h.create(h.Class.CONTEXT_SPECIFIC,0,!0,[S])),o.push(x)}if(typeof e.value>"u"){var a=new Error("Extension value not specified.");throw a.extension=e,a}return e}function Ha(e,t){if(e===ae["RSASSA-PSS"]){var a=[];return t.hash.algorithmOid!==void 0&&a.push(h.create(h.Class.CONTEXT_SPECIFIC,0,!0,[h.create(h.Class.UNIVERSAL,h.Type.SEQUENCE,!0,[h.create(h.Class.UNIVERSAL,h.Type.OID,!1,h.oidToDer(t.hash.algorithmOid).getBytes()),h.create(h.Class.UNIVERSAL,h.Type.NULL,!1,"")])])),t.mgf.algorithmOid!==void 0&&a.push(h.create(h.Class.CONTEXT_SPECIFIC,1,!0,[h.create(h.Class.UNIVERSAL,h.Type.SEQUENCE,!0,[h.create(h.Class.UNIVERSAL,h.Type.OID,!1,h.oidToDer(t.mgf.algorithmOid).getBytes()),h.create(h.Class.UNIVERSAL,h.Type.SEQUENCE,!0,[h.create(h.Class.UNIVERSAL,h.Type.OID,!1,h.oidToDer(t.mgf.hash.algorithmOid).getBytes()),h.create(h.Class.UNIVERSAL,h.Type.NULL,!1,"")])])])),t.saltLength!==void 0&&a.push(h.create(h.Class.CONTEXT_SPECIFIC,2,!0,[h.create(h.Class.UNIVERSAL,h.Type.INTEGER,!1,h.integerToDer(t.saltLength).getBytes())])),h.create(h.Class.UNIVERSAL,h.Type.SEQUENCE,!0,a)}else return h.create(h.Class.UNIVERSAL,h.Type.NULL,!1,"")}function il(e){var t=h.create(h.Class.CONTEXT_SPECIFIC,0,!0,[]);if(e.attributes.length===0)return t;for(var a=e.attributes,r=0;r<a.length;++r){var n=a[r],s=n.value,i=h.Type.UTF8;"valueTagClass"in n&&(i=n.valueTagClass),i===h.Type.UTF8&&(s=q.util.encodeUtf8(s));var o=!1;"valueConstructed"in n&&(o=n.valueConstructed);var l=h.create(h.Class.UNIVERSAL,h.Type.SEQUENCE,!0,[h.create(h.Class.UNIVERSAL,h.Type.OID,!1,h.oidToDer(n.type).getBytes()),h.create(h.Class.UNIVERSAL,h.Type.SET,!0,[h.create(h.Class.UNIVERSAL,i,o,s)])]);t.value.push(l)}return t}var sl=new Date("1950-01-01T00:00:00Z"),ol=new Date("2050-01-01T00:00:00Z");function Qi(e){return e>=sl&&e<ol?h.create(h.Class.UNIVERSAL,h.Type.UTCTIME,!1,h.dateToUtcTime(e)):h.create(h.Class.UNIVERSAL,h.Type.GENERALIZEDTIME,!1,h.dateToGeneralizedTime(e))}k.getTBSCertificate=function(e){var t=Qi(e.validity.notBefore),a=Qi(e.validity.notAfter),r=h.create(h.Class.UNIVERSAL,h.Type.SEQUENCE,!0,[h.create(h.Class.CONTEXT_SPECIFIC,0,!0,[h.create(h.Class.UNIVERSAL,h.Type.INTEGER,!1,h.integerToDer(e.version).getBytes())]),h.create(h.Class.UNIVERSAL,h.Type.INTEGER,!1,q.util.hexToBytes(e.serialNumber)),h.create(h.Class.UNIVERSAL,h.Type.SEQUENCE,!0,[h.create(h.Class.UNIVERSAL,h.Type.OID,!1,h.oidToDer(e.siginfo.algorithmOid).getBytes()),Ha(e.siginfo.algorithmOid,e.siginfo.parameters)]),sr(e.issuer),h.create(h.Class.UNIVERSAL,h.Type.SEQUENCE,!0,[t,a]),sr(e.subject),k.publicKeyToAsn1(e.publicKey)]);return e.issuer.uniqueId&&r.value.push(h.create(h.Class.CONTEXT_SPECIFIC,1,!0,[h.create(h.Class.UNIVERSAL,h.Type.BITSTRING,!1,"\0"+e.issuer.uniqueId)])),e.subject.uniqueId&&r.value.push(h.create(h.Class.CONTEXT_SPECIFIC,2,!0,[h.create(h.Class.UNIVERSAL,h.Type.BITSTRING,!1,"\0"+e.subject.uniqueId)])),e.extensions.length>0&&r.value.push(k.certificateExtensionsToAsn1(e.extensions)),r};k.getCertificationRequestInfo=function(e){var t=h.create(h.Class.UNIVERSAL,h.Type.SEQUENCE,!0,[h.create(h.Class.UNIVERSAL,h.Type.INTEGER,!1,h.integerToDer(e.version).getBytes()),sr(e.subject),k.publicKeyToAsn1(e.publicKey),il(e)]);return t};k.distinguishedNameToAsn1=function(e){return sr(e)};k.certificateToAsn1=function(e){var t=e.tbsCertificate||k.getTBSCertificate(e);return h.create(h.Class.UNIVERSAL,h.Type.SEQUENCE,!0,[t,h.create(h.Class.UNIVERSAL,h.Type.SEQUENCE,!0,[h.create(h.Class.UNIVERSAL,h.Type.OID,!1,h.oidToDer(e.signatureOid).getBytes()),Ha(e.signatureOid,e.signatureParameters)]),h.create(h.Class.UNIVERSAL,h.Type.BITSTRING,!1,"\0"+e.signature)])};k.certificateExtensionsToAsn1=function(e){var t=h.create(h.Class.CONTEXT_SPECIFIC,3,!0,[]),a=h.create(h.Class.UNIVERSAL,h.Type.SEQUENCE,!0,[]);t.value.push(a);for(var r=0;r<e.length;++r)a.value.push(k.certificateExtensionToAsn1(e[r]));return t};k.certificateExtensionToAsn1=function(e){var t=h.create(h.Class.UNIVERSAL,h.Type.SEQUENCE,!0,[]);t.value.push(h.create(h.Class.UNIVERSAL,h.Type.OID,!1,h.oidToDer(e.id).getBytes())),e.critical&&t.value.push(h.create(h.Class.UNIVERSAL,h.Type.BOOLEAN,!1,"\xFF"));var a=e.value;return typeof e.value!="string"&&(a=h.toDer(a).getBytes()),t.value.push(h.create(h.Class.UNIVERSAL,h.Type.OCTETSTRING,!1,a)),t};k.certificationRequestToAsn1=function(e){var t=e.certificationRequestInfo||k.getCertificationRequestInfo(e);return h.create(h.Class.UNIVERSAL,h.Type.SEQUENCE,!0,[t,h.create(h.Class.UNIVERSAL,h.Type.SEQUENCE,!0,[h.create(h.Class.UNIVERSAL,h.Type.OID,!1,h.oidToDer(e.signatureOid).getBytes()),Ha(e.signatureOid,e.signatureParameters)]),h.create(h.Class.UNIVERSAL,h.Type.BITSTRING,!1,"\0"+e.signature)])};k.createCaStore=function(e){var t={certs:{}};t.getIssuer=function(i){var o=a(i.issuer);return o},t.addCertificate=function(i){if(typeof i=="string"&&(i=q.pki.certificateFromPem(i)),r(i.subject),!t.hasCertificate(i))if(i.subject.hash in t.certs){var o=t.certs[i.subject.hash];q.util.isArray(o)||(o=[o]),o.push(i),t.certs[i.subject.hash]=o}else t.certs[i.subject.hash]=i},t.hasCertificate=function(i){typeof i=="string"&&(i=q.pki.certificateFromPem(i));var o=a(i.subject);if(!o)return!1;q.util.isArray(o)||(o=[o]);for(var l=h.toDer(k.certificateToAsn1(i)).getBytes(),u=0;u<o.length;++u){var f=h.toDer(k.certificateToAsn1(o[u])).getBytes();if(l===f)return!0}return!1},t.listAllCertificates=function(){var i=[];for(var o in t.certs)if(t.certs.hasOwnProperty(o)){var l=t.certs[o];if(!q.util.isArray(l))i.push(l);else for(var u=0;u<l.length;++u)i.push(l[u])}return i},t.removeCertificate=function(i){var o;if(typeof i=="string"&&(i=q.pki.certificateFromPem(i)),r(i.subject),!t.hasCertificate(i))return null;var l=a(i.subject);if(!q.util.isArray(l))return o=t.certs[i.subject.hash],delete t.certs[i.subject.hash],o;for(var u=h.toDer(k.certificateToAsn1(i)).getBytes(),f=0;f<l.length;++f){var c=h.toDer(k.certificateToAsn1(l[f])).getBytes();u===c&&(o=l[f],l.splice(f,1))}return l.length===0&&delete t.certs[i.subject.hash],o};function a(i){return r(i),t.certs[i.hash]||null}function r(i){if(!i.hash){var o=q.md.sha1.create();i.attributes=k.RDNAttributesAsArray(sr(i),o),i.hash=o.digest().toHex()}}if(e)for(var n=0;n<e.length;++n){var s=e[n];t.addCertificate(s)}return t};k.certificateError={bad_certificate:"forge.pki.BadCertificate",unsupported_certificate:"forge.pki.UnsupportedCertificate",certificate_revoked:"forge.pki.CertificateRevoked",certificate_expired:"forge.pki.CertificateExpired",certificate_unknown:"forge.pki.CertificateUnknown",unknown_ca:"forge.pki.UnknownCertificateAuthority"};k.verifyCertificateChain=function(e,t,a){typeof a=="function"&&(a={verify:a}),a=a||{},t=t.slice(0);var r=t.slice(0),n=a.validityCheckDate;typeof n>"u"&&(n=new Date);var s=!0,i=null,o=0;do{var l=t.shift(),u=null,f=!1;if(n&&(n<l.validity.notBefore||n>l.validity.notAfter)&&(i={message:"Certificate is not valid yet or has expired.",error:k.certificateError.certificate_expired,notBefore:l.validity.notBefore,notAfter:l.validity.notAfter,now:n}),i===null){if(u=t[0]||e.getIssuer(l),u===null&&l.isIssuer(l)&&(f=!0,u=l),u){var c=u;q.util.isArray(c)||(c=[c]);for(var v=!1;!v&&c.length>0;){u=c.shift();try{v=u.verify(l)}catch{}}v||(i={message:"Certificate signature is invalid.",error:k.certificateError.bad_certificate})}i===null&&(!u||f)&&!e.hasCertificate(l)&&(i={message:"Certificate is not trusted.",error:k.certificateError.unknown_ca})}if(i===null&&u&&!l.isIssuer(u)&&(i={message:"Certificate issuer is invalid.",error:k.certificateError.bad_certificate}),i===null)for(var g={keyUsage:!0,basicConstraints:!0},y=0;i===null&&y<l.extensions.length;++y){var x=l.extensions[y];x.critical&&!(x.name in g)&&(i={message:"Certificate has an unsupported critical extension.",error:k.certificateError.unsupported_certificate})}if(i===null&&(!s||t.length===0&&(!u||f))){var S=l.getExtension("basicConstraints"),I=l.getExtension("keyUsage");if(I!==null&&(!I.keyCertSign||S===null)&&(i={message:"Certificate keyUsage or basicConstraints conflict or indicate that the certificate is not a CA. If the certificate is the only one in the chain or isn't the first then the certificate must be a valid CA.",error:k.certificateError.bad_certificate}),i===null&&S===null&&(i={message:"Certificate is missing basicConstraints extension and cannot be used as a CA.",error:k.certificateError.bad_certificate}),i===null&&S!==null&&!S.cA&&(i={message:"Certificate basicConstraints indicates the certificate is not a CA.",error:k.certificateError.bad_certificate}),i===null&&I!==null&&"pathLenConstraint"in S){var B=o-1;B>S.pathLenConstraint&&(i={message:"Certificate basicConstraints pathLenConstraint violated.",error:k.certificateError.bad_certificate})}}var b=i===null?!0:i.error,U=a.verify?a.verify(b,o,r):b;if(U===!0)i=null;else throw b===!0&&(i={message:"The application rejected the certificate.",error:k.certificateError.bad_certificate}),(U||U===0)&&(typeof U=="object"&&!q.util.isArray(U)?(U.message&&(i.message=U.message),U.error&&(i.error=U.error)):typeof U=="string"&&(i.error=U)),i;s=!1,++o}while(t.length>0);return!0}});var za=M((Rc,Zi)=>{var ce=X();st();Jt();bt();qa();Fa();Je();xr();ar();ne();ra();var m=ce.asn1,$=ce.pki,Tr=Zi.exports=ce.pkcs12=ce.pkcs12||{},$i={name:"ContentInfo",tagClass:m.Class.UNIVERSAL,type:m.Type.SEQUENCE,constructed:!0,value:[{name:"ContentInfo.contentType",tagClass:m.Class.UNIVERSAL,type:m.Type.OID,constructed:!1,capture:"contentType"},{name:"ContentInfo.content",tagClass:m.Class.CONTEXT_SPECIFIC,constructed:!0,captureAsn1:"content"}]},ul={name:"PFX",tagClass:m.Class.UNIVERSAL,type:m.Type.SEQUENCE,constructed:!0,value:[{name:"PFX.version",tagClass:m.Class.UNIVERSAL,type:m.Type.INTEGER,constructed:!1,capture:"version"},$i,{name:"PFX.macData",tagClass:m.Class.UNIVERSAL,type:m.Type.SEQUENCE,constructed:!0,optional:!0,captureAsn1:"mac",value:[{name:"PFX.macData.mac",tagClass:m.Class.UNIVERSAL,type:m.Type.SEQUENCE,constructed:!0,value:[{name:"PFX.macData.mac.digestAlgorithm",tagClass:m.Class.UNIVERSAL,type:m.Type.SEQUENCE,constructed:!0,value:[{name:"PFX.macData.mac.digestAlgorithm.algorithm",tagClass:m.Class.UNIVERSAL,type:m.Type.OID,constructed:!1,capture:"macAlgorithm"},{name:"PFX.macData.mac.digestAlgorithm.parameters",optional:!0,tagClass:m.Class.UNIVERSAL,captureAsn1:"macAlgorithmParameters"}]},{name:"PFX.macData.mac.digest",tagClass:m.Class.UNIVERSAL,type:m.Type.OCTETSTRING,constructed:!1,capture:"macDigest"}]},{name:"PFX.macData.macSalt",tagClass:m.Class.UNIVERSAL,type:m.Type.OCTETSTRING,constructed:!1,capture:"macSalt"},{name:"PFX.macData.iterations",tagClass:m.Class.UNIVERSAL,type:m.Type.INTEGER,constructed:!1,optional:!0,capture:"macIterations"}]}]},ll={name:"SafeBag",tagClass:m.Class.UNIVERSAL,type:m.Type.SEQUENCE,constructed:!0,value:[{name:"SafeBag.bagId",tagClass:m.Class.UNIVERSAL,type:m.Type.OID,constructed:!1,capture:"bagId"},{name:"SafeBag.bagValue",tagClass:m.Class.CONTEXT_SPECIFIC,constructed:!0,captureAsn1:"bagValue"},{name:"SafeBag.bagAttributes",tagClass:m.Class.UNIVERSAL,type:m.Type.SET,constructed:!0,optional:!0,capture:"bagAttributes"}]},fl={name:"Attribute",tagClass:m.Class.UNIVERSAL,type:m.Type.SEQUENCE,constructed:!0,value:[{name:"Attribute.attrId",tagClass:m.Class.UNIVERSAL,type:m.Type.OID,constructed:!1,capture:"oid"},{name:"Attribute.attrValues",tagClass:m.Class.UNIVERSAL,type:m.Type.SET,constructed:!0,capture:"values"}]},cl={name:"CertBag",tagClass:m.Class.UNIVERSAL,type:m.Type.SEQUENCE,constructed:!0,value:[{name:"CertBag.certId",tagClass:m.Class.UNIVERSAL,type:m.Type.OID,constructed:!1,capture:"certId"},{name:"CertBag.certValue",tagClass:m.Class.CONTEXT_SPECIFIC,constructed:!0,value:[{name:"CertBag.certValue[0]",tagClass:m.Class.UNIVERSAL,type:m.Class.OCTETSTRING,constructed:!1,capture:"cert"}]}]};function Sr(e,t,a,r){for(var n=[],s=0;s<e.length;s++)for(var i=0;i<e[s].safeBags.length;i++){var o=e[s].safeBags[i];if(!(r!==void 0&&o.type!==r)){if(t===null){n.push(o);continue}o.attributes[t]!==void 0&&o.attributes[t].indexOf(a)>=0&&n.push(o)}}return n}Tr.pkcs12FromAsn1=function(e,t,a){typeof t=="string"?(a=t,t=!0):t===void 0&&(t=!0);var r={},n=[];if(!m.validate(e,ul,r,n)){var s=new Error("Cannot read PKCS#12 PFX. ASN.1 object is not an PKCS#12 PFX.");throw s.errors=s,s}var i={version:r.version.charCodeAt(0),safeContents:[],getBags:function(S){var I={},B;return"localKeyId"in S?B=S.localKeyId:"localKeyIdHex"in S&&(B=ce.util.hexToBytes(S.localKeyIdHex)),B===void 0&&!("friendlyName"in S)&&"bagType"in S&&(I[S.bagType]=Sr(i.safeContents,null,null,S.bagType)),B!==void 0&&(I.localKeyId=Sr(i.safeContents,"localKeyId",B,S.bagType)),"friendlyName"in S&&(I.friendlyName=Sr(i.safeContents,"friendlyName",S.friendlyName,S.bagType)),I},getBagsByFriendlyName:function(S,I){return Sr(i.safeContents,"friendlyName",S,I)},getBagsByLocalKeyId:function(S,I){return Sr(i.safeContents,"localKeyId",S,I)}};if(r.version.charCodeAt(0)!==3){var s=new Error("PKCS#12 PFX of version other than 3 not supported.");throw s.version=r.version.charCodeAt(0),s}if(m.derToOid(r.contentType)!==$.oids.data){var s=new Error("Only PKCS#12 PFX in password integrity mode supported.");throw s.oid=m.derToOid(r.contentType),s}var o=r.content.value[0];if(o.tagClass!==m.Class.UNIVERSAL||o.type!==m.Type.OCTETSTRING)throw new Error("PKCS#12 authSafe content data is not an OCTET STRING.");if(o=Ga(o),r.mac){var l=null,u=0,f=m.derToOid(r.macAlgorithm);switch(f){case $.oids.sha1:l=ce.md.sha1.create(),u=20;break;case $.oids.sha256:l=ce.md.sha256.create(),u=32;break;case $.oids.sha384:l=ce.md.sha384.create(),u=48;break;case $.oids.sha512:l=ce.md.sha512.create(),u=64;break;case $.oids.md5:l=ce.md.md5.create(),u=16;break}if(l===null)throw new Error("PKCS#12 uses unsupported MAC algorithm: "+f);var c=new ce.util.ByteBuffer(r.macSalt),v="macIterations"in r?parseInt(ce.util.bytesToHex(r.macIterations),16):1,g=Tr.generateKey(a,c,3,v,u,l),y=ce.hmac.create();y.start(l,g),y.update(o.value);var x=y.getMac();if(x.getBytes()!==r.macDigest)throw new Error("PKCS#12 MAC could not be verified. Invalid password?")}else if(Array.isArray(e.value)&&e.value.length>2)throw new Error("Invalid PKCS#12. macData field present but MAC was not validated.");return hl(i,o.value,t,a),i};function Ga(e){if(e.composed||e.constructed){for(var t=ce.util.createBuffer(),a=0;a<e.value.length;++a)t.putBytes(e.value[a].value);e.composed=e.constructed=!1,e.value=t.getBytes()}return e}function hl(e,t,a,r){if(t=m.fromDer(t,a),t.tagClass!==m.Class.UNIVERSAL||t.type!==m.Type.SEQUENCE||t.constructed!==!0)throw new Error("PKCS#12 AuthenticatedSafe expected to be a SEQUENCE OF ContentInfo");for(var n=0;n<t.value.length;n++){var s=t.value[n],i={},o=[];if(!m.validate(s,$i,i,o)){var l=new Error("Cannot read ContentInfo.");throw l.errors=o,l}var u={encrypted:!1},f=null,c=i.content.value[0];switch(m.derToOid(i.contentType)){case $.oids.data:if(c.tagClass!==m.Class.UNIVERSAL||c.type!==m.Type.OCTETSTRING)throw new Error("PKCS#12 SafeContents Data is not an OCTET STRING.");f=Ga(c).value;break;case $.oids.encryptedData:f=dl(c,r),u.encrypted=!0;break;default:var l=new Error("Unsupported PKCS#12 contentType.");throw l.contentType=m.derToOid(i.contentType),l}u.safeBags=pl(f,a,r),e.safeContents.push(u)}}function dl(e,t){var a={},r=[];if(!m.validate(e,ce.pkcs7.asn1.encryptedDataValidator,a,r)){var n=new Error("Cannot read EncryptedContentInfo.");throw n.errors=r,n}var s=m.derToOid(a.contentType);if(s!==$.oids.data){var n=new Error("PKCS#12 EncryptedContentInfo ContentType is not Data.");throw n.oid=s,n}s=m.derToOid(a.encAlgorithm);var i=$.pbe.getCipher(s,a.encParameter,t),o=Ga(a.encryptedContentAsn1),l=ce.util.createBuffer(o.value);if(i.update(l),!i.finish())throw new Error("Failed to decrypt PKCS#12 SafeContents.");return i.output.getBytes()}function pl(e,t,a){if(!t&&e.length===0)return[];if(e=m.fromDer(e,t),e.tagClass!==m.Class.UNIVERSAL||e.type!==m.Type.SEQUENCE||e.constructed!==!0)throw new Error("PKCS#12 SafeContents expected to be a SEQUENCE OF SafeBag.");for(var r=[],n=0;n<e.value.length;n++){var s=e.value[n],i={},o=[];if(!m.validate(s,ll,i,o)){var l=new Error("Cannot read SafeBag.");throw l.errors=o,l}var u={type:m.derToOid(i.bagId),attributes:vl(i.bagAttributes)};r.push(u);var f,c,v=i.bagValue.value[0];switch(u.type){case $.oids.pkcs8ShroudedKeyBag:if(v=$.decryptPrivateKeyInfo(v,a),v===null)throw new Error("Unable to decrypt PKCS#8 ShroudedKeyBag, wrong password?");case $.oids.keyBag:try{u.key=$.privateKeyFromAsn1(v)}catch{u.key=null,u.asn1=v}continue;case $.oids.certBag:f=cl,c=function(){if(m.derToOid(i.certId)!==$.oids.x509Certificate){var y=new Error("Unsupported certificate type, only X.509 supported.");throw y.oid=m.derToOid(i.certId),y}var x=m.fromDer(i.cert,t);try{u.cert=$.certificateFromAsn1(x,!0)}catch{u.cert=null,u.asn1=x}};break;default:var l=new Error("Unsupported PKCS#12 SafeBag type.");throw l.oid=u.type,l}if(f!==void 0&&!m.validate(v,f,i,o)){var l=new Error("Cannot read PKCS#12 "+f.name);throw l.errors=o,l}c()}return r}function vl(e){var t={};if(e!==void 0)for(var a=0;a<e.length;++a){var r={},n=[];if(!m.validate(e[a],fl,r,n)){var s=new Error("Cannot read PKCS#12 BagAttribute.");throw s.errors=n,s}var i=m.derToOid(r.oid);if($.oids[i]!==void 0){t[$.oids[i]]=[];for(var o=0;o<r.values.length;++o)t[$.oids[i]].push(r.values[o].value)}}return t}Tr.toPkcs12Asn1=function(e,t,a,r){r=r||{},r.saltSize=r.saltSize||8,r.count=r.count||2048,r.algorithm=r.algorithm||r.encAlgorithm||"aes128","useMac"in r||(r.useMac=!0),"localKeyId"in r||(r.localKeyId=null),"generateLocalKeyId"in r||(r.generateLocalKeyId=!0);var n=r.localKeyId,s;if(n!==null)n=ce.util.hexToBytes(n);else if(r.generateLocalKeyId)if(t){var i=ce.util.isArray(t)?t[0]:t;typeof i=="string"&&(i=$.certificateFromPem(i));var o=ce.md.sha1.create();o.update(m.toDer($.certificateToAsn1(i)).getBytes()),n=o.digest().getBytes()}else n=ce.random.getBytes(20);var l=[];n!==null&&l.push(m.create(m.Class.UNIVERSAL,m.Type.SEQUENCE,!0,[m.create(m.Class.UNIVERSAL,m.Type.OID,!1,m.oidToDer($.oids.localKeyId).getBytes()),m.create(m.Class.UNIVERSAL,m.Type.SET,!0,[m.create(m.Class.UNIVERSAL,m.Type.OCTETSTRING,!1,n)])])),"friendlyName"in r&&l.push(m.create(m.Class.UNIVERSAL,m.Type.SEQUENCE,!0,[m.create(m.Class.UNIVERSAL,m.Type.OID,!1,m.oidToDer($.oids.friendlyName).getBytes()),m.create(m.Class.UNIVERSAL,m.Type.SET,!0,[m.create(m.Class.UNIVERSAL,m.Type.BMPSTRING,!1,r.friendlyName)])])),l.length>0&&(s=m.create(m.Class.UNIVERSAL,m.Type.SET,!0,l));var u=[],f=[];t!==null&&(ce.util.isArray(t)?f=t:f=[t]);for(var c=[],v=0;v<f.length;++v){t=f[v],typeof t=="string"&&(t=$.certificateFromPem(t));var g=v===0?s:void 0,y=$.certificateToAsn1(t),x=m.create(m.Class.UNIVERSAL,m.Type.SEQUENCE,!0,[m.create(m.Class.UNIVERSAL,m.Type.OID,!1,m.oidToDer($.oids.certBag).getBytes()),m.create(m.Class.CONTEXT_SPECIFIC,0,!0,[m.create(m.Class.UNIVERSAL,m.Type.SEQUENCE,!0,[m.create(m.Class.UNIVERSAL,m.Type.OID,!1,m.oidToDer($.oids.x509Certificate).getBytes()),m.create(m.Class.CONTEXT_SPECIFIC,0,!0,[m.create(m.Class.UNIVERSAL,m.Type.OCTETSTRING,!1,m.toDer(y).getBytes())])])]),g]);c.push(x)}if(c.length>0){var S=m.create(m.Class.UNIVERSAL,m.Type.SEQUENCE,!0,c),I=m.create(m.Class.UNIVERSAL,m.Type.SEQUENCE,!0,[m.create(m.Class.UNIVERSAL,m.Type.OID,!1,m.oidToDer($.oids.data).getBytes()),m.create(m.Class.CONTEXT_SPECIFIC,0,!0,[m.create(m.Class.UNIVERSAL,m.Type.OCTETSTRING,!1,m.toDer(S).getBytes())])]);u.push(I)}var B=null;if(e!==null){var b=$.wrapRsaPrivateKey($.privateKeyToAsn1(e));a===null?B=m.create(m.Class.UNIVERSAL,m.Type.SEQUENCE,!0,[m.create(m.Class.UNIVERSAL,m.Type.OID,!1,m.oidToDer($.oids.keyBag).getBytes()),m.create(m.Class.CONTEXT_SPECIFIC,0,!0,[b]),s]):B=m.create(m.Class.UNIVERSAL,m.Type.SEQUENCE,!0,[m.create(m.Class.UNIVERSAL,m.Type.OID,!1,m.oidToDer($.oids.pkcs8ShroudedKeyBag).getBytes()),m.create(m.Class.CONTEXT_SPECIFIC,0,!0,[$.encryptPrivateKeyInfo(b,a,r)]),s]);var U=m.create(m.Class.UNIVERSAL,m.Type.SEQUENCE,!0,[B]),L=m.create(m.Class.UNIVERSAL,m.Type.SEQUENCE,!0,[m.create(m.Class.UNIVERSAL,m.Type.OID,!1,m.oidToDer($.oids.data).getBytes()),m.create(m.Class.CONTEXT_SPECIFIC,0,!0,[m.create(m.Class.UNIVERSAL,m.Type.OCTETSTRING,!1,m.toDer(U).getBytes())])]);u.push(L)}var w=m.create(m.Class.UNIVERSAL,m.Type.SEQUENCE,!0,u),z;if(r.useMac){var o=ce.md.sha1.create(),G=new ce.util.ByteBuffer(ce.random.getBytes(r.saltSize)),W=r.count,e=Tr.generateKey(a,G,3,W,20),oe=ce.hmac.create();oe.start(o,e),oe.update(m.toDer(w).getBytes());var ue=oe.getMac();z=m.create(m.Class.UNIVERSAL,m.Type.SEQUENCE,!0,[m.create(m.Class.UNIVERSAL,m.Type.SEQUENCE,!0,[m.create(m.Class.UNIVERSAL,m.Type.SEQUENCE,!0,[m.create(m.Class.UNIVERSAL,m.Type.OID,!1,m.oidToDer($.oids.sha1).getBytes()),m.create(m.Class.UNIVERSAL,m.Type.NULL,!1,"")]),m.create(m.Class.UNIVERSAL,m.Type.OCTETSTRING,!1,ue.getBytes())]),m.create(m.Class.UNIVERSAL,m.Type.OCTETSTRING,!1,G.getBytes()),m.create(m.Class.UNIVERSAL,m.Type.INTEGER,!1,m.integerToDer(W).getBytes())])}return m.create(m.Class.UNIVERSAL,m.Type.SEQUENCE,!0,[m.create(m.Class.UNIVERSAL,m.Type.INTEGER,!1,m.integerToDer(3).getBytes()),m.create(m.Class.UNIVERSAL,m.Type.SEQUENCE,!0,[m.create(m.Class.UNIVERSAL,m.Type.OID,!1,m.oidToDer($.oids.data).getBytes()),m.create(m.Class.CONTEXT_SPECIFIC,0,!0,[m.create(m.Class.UNIVERSAL,m.Type.OCTETSTRING,!1,m.toDer(w).getBytes())])]),z])};Tr.generateKey=ce.pbe.generatePkcs12Key});var Ya=M((wc,Ji)=>{var wt=X();st();bt();Fa();Kt();Qr();za();Jr();xr();ne();ra();var Qa=wt.asn1,or=Ji.exports=wt.pki=wt.pki||{};or.pemToDer=function(e){var t=wt.pem.decode(e)[0];if(t.procType&&t.procType.type==="ENCRYPTED")throw new Error("Could not convert PEM to DER; PEM is encrypted.");return wt.util.createBuffer(t.body)};or.privateKeyFromPem=function(e){var t=wt.pem.decode(e)[0];if(t.type!=="PRIVATE KEY"&&t.type!=="RSA PRIVATE KEY"){var a=new Error('Could not convert private key from PEM; PEM header type is not "PRIVATE KEY" or "RSA PRIVATE KEY".');throw a.headerType=t.type,a}if(t.procType&&t.procType.type==="ENCRYPTED")throw new Error("Could not convert private key from PEM; PEM is encrypted.");var r=Qa.fromDer(t.body);return or.privateKeyFromAsn1(r)};or.privateKeyToPem=function(e,t){var a={type:"RSA PRIVATE KEY",body:Qa.toDer(or.privateKeyToAsn1(e)).getBytes()};return wt.pem.encode(a,{maxline:t})};or.privateKeyInfoToPem=function(e,t){var a={type:"PRIVATE KEY",body:Qa.toDer(e).getBytes()};return wt.pem.encode(a,{maxline:t})}});var Ja=M((Lc,os)=>{var N=X();st();Jt();Mr();Kt();Ya();Je();ar();ne();var sa=function(e,t,a,r){var n=N.util.createBuffer(),s=e.length>>1,i=s+(e.length&1),o=e.substr(0,i),l=e.substr(s,i),u=N.util.createBuffer(),f=N.hmac.create();a=t+a;var c=Math.ceil(r/16),v=Math.ceil(r/20);f.start("MD5",o);var g=N.util.createBuffer();u.putBytes(a);for(var y=0;y<c;++y)f.start(null,null),f.update(u.getBytes()),u.putBuffer(f.digest()),f.start(null,null),f.update(u.bytes()+a),g.putBuffer(f.digest());f.start("SHA1",l);var x=N.util.createBuffer();u.clear(),u.putBytes(a);for(var y=0;y<v;++y)f.start(null,null),f.update(u.getBytes()),u.putBuffer(f.digest()),f.start(null,null),f.update(u.bytes()+a),x.putBuffer(f.digest());return n.putBytes(N.util.xorBytes(g.getBytes(),x.getBytes(),r)),n},yl=function(e,t,a){var r=N.hmac.create();r.start("SHA1",e);var n=N.util.createBuffer();return n.putInt32(t[0]),n.putInt32(t[1]),n.putByte(a.type),n.putByte(a.version.major),n.putByte(a.version.minor),n.putInt16(a.length),n.putBytes(a.fragment.bytes()),r.update(n.getBytes()),r.digest().getBytes()},gl=function(e,t,a){var r=!1;try{var n=e.deflate(t.fragment.getBytes());t.fragment=N.util.createBuffer(n),t.length=n.length,r=!0}catch{}return r},ml=function(e,t,a){var r=!1;try{var n=e.inflate(t.fragment.getBytes());t.fragment=N.util.createBuffer(n),t.length=n.length,r=!0}catch{}return r},We=function(e,t){var a=0;switch(t){case 1:a=e.getByte();break;case 2:a=e.getInt16();break;case 3:a=e.getInt24();break;case 4:a=e.getInt32();break}return N.util.createBuffer(e.getBytes(a))},at=function(e,t,a){e.putInt(a.length(),t<<3),e.putBuffer(a)},p={};p.Versions={TLS_1_0:{major:3,minor:1},TLS_1_1:{major:3,minor:2},TLS_1_2:{major:3,minor:3}};p.SupportedVersions=[p.Versions.TLS_1_1,p.Versions.TLS_1_0];p.Version=p.SupportedVersions[0];p.MaxFragment=15360;p.ConnectionEnd={server:0,client:1};p.PRFAlgorithm={tls_prf_sha256:0};p.BulkCipherAlgorithm={none:null,rc4:0,des3:1,aes:2};p.CipherType={stream:0,block:1,aead:2};p.MACAlgorithm={none:null,hmac_md5:0,hmac_sha1:1,hmac_sha256:2,hmac_sha384:3,hmac_sha512:4};p.CompressionMethod={none:0,deflate:1};p.ContentType={change_cipher_spec:20,alert:21,handshake:22,application_data:23,heartbeat:24};p.HandshakeType={hello_request:0,client_hello:1,server_hello:2,certificate:11,server_key_exchange:12,certificate_request:13,server_hello_done:14,certificate_verify:15,client_key_exchange:16,finished:20};p.Alert={};p.Alert.Level={warning:1,fatal:2};p.Alert.Description={close_notify:0,unexpected_message:10,bad_record_mac:20,decryption_failed:21,record_overflow:22,decompression_failure:30,handshake_failure:40,bad_certificate:42,unsupported_certificate:43,certificate_revoked:44,certificate_expired:45,certificate_unknown:46,illegal_parameter:47,unknown_ca:48,access_denied:49,decode_error:50,decrypt_error:51,export_restriction:60,protocol_version:70,insufficient_security:71,internal_error:80,user_canceled:90,no_renegotiation:100};p.HeartbeatMessageType={heartbeat_request:1,heartbeat_response:2};p.CipherSuites={};p.getCipherSuite=function(e){var t=null;for(var a in p.CipherSuites){var r=p.CipherSuites[a];if(r.id[0]===e.charCodeAt(0)&&r.id[1]===e.charCodeAt(1)){t=r;break}}return t};p.handleUnexpected=function(e,t){var a=!e.open&&e.entity===p.ConnectionEnd.client;a||e.error(e,{message:"Unexpected message. Received TLS record out of order.",send:!0,alert:{level:p.Alert.Level.fatal,description:p.Alert.Description.unexpected_message}})};p.handleHelloRequest=function(e,t,a){!e.handshaking&&e.handshakes>0&&(p.queue(e,p.createAlert(e,{level:p.Alert.Level.warning,description:p.Alert.Description.no_renegotiation})),p.flush(e)),e.process()};p.parseHelloMessage=function(e,t,a){var r=null,n=e.entity===p.ConnectionEnd.client;if(a<38)e.error(e,{message:n?"Invalid ServerHello message. Message too short.":"Invalid ClientHello message. Message too short.",send:!0,alert:{level:p.Alert.Level.fatal,description:p.Alert.Description.illegal_parameter}});else{var s=t.fragment,i=s.length();if(r={version:{major:s.getByte(),minor:s.getByte()},random:N.util.createBuffer(s.getBytes(32)),session_id:We(s,1),extensions:[]},n?(r.cipher_suite=s.getBytes(2),r.compression_method=s.getByte()):(r.cipher_suites=We(s,2),r.compression_methods=We(s,1)),i=a-(i-s.length()),i>0){for(var o=We(s,2);o.length()>0;)r.extensions.push({type:[o.getByte(),o.getByte()],data:We(o,2)});if(!n)for(var l=0;l<r.extensions.length;++l){var u=r.extensions[l];if(u.type[0]===0&&u.type[1]===0)for(var f=We(u.data,2);f.length()>0;){var c=f.getByte();if(c!==0)break;e.session.extensions.server_name.serverNameList.push(We(f,2).getBytes())}}}if(e.session.version&&(r.version.major!==e.session.version.major||r.version.minor!==e.session.version.minor))return e.error(e,{message:"TLS version change is disallowed during renegotiation.",send:!0,alert:{level:p.Alert.Level.fatal,description:p.Alert.Description.protocol_version}});if(n)e.session.cipherSuite=p.getCipherSuite(r.cipher_suite);else for(var v=N.util.createBuffer(r.cipher_suites.bytes());v.length()>0&&(e.session.cipherSuite=p.getCipherSuite(v.getBytes(2)),e.session.cipherSuite===null););if(e.session.cipherSuite===null)return e.error(e,{message:"No cipher suites in common.",send:!0,alert:{level:p.Alert.Level.fatal,description:p.Alert.Description.handshake_failure},cipherSuite:N.util.bytesToHex(r.cipher_suite)});n?e.session.compressionMethod=r.compression_method:e.session.compressionMethod=p.CompressionMethod.none}return r};p.createSecurityParameters=function(e,t){var a=e.entity===p.ConnectionEnd.client,r=t.random.bytes(),n=a?e.session.sp.client_random:r,s=a?r:p.createRandom().getBytes();e.session.sp={entity:e.entity,prf_algorithm:p.PRFAlgorithm.tls_prf_sha256,bulk_cipher_algorithm:null,cipher_type:null,enc_key_length:null,block_length:null,fixed_iv_length:null,record_iv_length:null,mac_algorithm:null,mac_length:null,mac_key_length:null,compression_algorithm:e.session.compressionMethod,pre_master_secret:null,master_secret:null,client_random:n,server_random:s}};p.handleServerHello=function(e,t,a){var r=p.parseHelloMessage(e,t,a);if(!e.fail){if(r.version.minor<=e.version.minor)e.version.minor=r.version.minor;else return e.error(e,{message:"Incompatible TLS version.",send:!0,alert:{level:p.Alert.Level.fatal,description:p.Alert.Description.protocol_version}});e.session.version=e.version;var n=r.session_id.bytes();n.length>0&&n===e.session.id?(e.expect=rs,e.session.resuming=!0,e.session.sp.server_random=r.random.bytes()):(e.expect=El,e.session.resuming=!1,p.createSecurityParameters(e,r)),e.session.id=n,e.process()}};p.handleClientHello=function(e,t,a){var r=p.parseHelloMessage(e,t,a);if(!e.fail){var n=r.session_id.bytes(),s=null;if(e.sessionCache&&(s=e.sessionCache.getSession(n),s===null?n="":(s.version.major!==r.version.major||s.version.minor>r.version.minor)&&(s=null,n="")),n.length===0&&(n=N.random.getBytes(32)),e.session.id=n,e.session.clientHelloVersion=r.version,e.session.sp={},s)e.version=e.session.version=s.version,e.session.sp=s.sp;else{for(var i,o=1;o<p.SupportedVersions.length&&(i=p.SupportedVersions[o],!(i.minor<=r.version.minor));++o);e.version={major:i.major,minor:i.minor},e.session.version=e.version}s!==null?(e.expect=$a,e.session.resuming=!0,e.session.sp.client_random=r.random.bytes()):(e.expect=e.verifyClient!==!1?bl:ja,e.session.resuming=!1,p.createSecurityParameters(e,r)),e.open=!0,p.queue(e,p.createRecord(e,{type:p.ContentType.handshake,data:p.createServerHello(e)})),e.session.resuming?(p.queue(e,p.createRecord(e,{type:p.ContentType.change_cipher_spec,data:p.createChangeCipherSpec()})),e.state.pending=p.createConnectionState(e),e.state.current.write=e.state.pending.write,p.queue(e,p.createRecord(e,{type:p.ContentType.handshake,data:p.createFinished(e)}))):(p.queue(e,p.createRecord(e,{type:p.ContentType.handshake,data:p.createCertificate(e)})),e.fail||(p.queue(e,p.createRecord(e,{type:p.ContentType.handshake,data:p.createServerKeyExchange(e)})),e.verifyClient!==!1&&p.queue(e,p.createRecord(e,{type:p.ContentType.handshake,data:p.createCertificateRequest(e)})),p.queue(e,p.createRecord(e,{type:p.ContentType.handshake,data:p.createServerHelloDone(e)})))),p.flush(e),e.process()}};p.handleCertificate=function(e,t,a){if(a<3)return e.error(e,{message:"Invalid Certificate message. Message too short.",send:!0,alert:{level:p.Alert.Level.fatal,description:p.Alert.Description.illegal_parameter}});var r=t.fragment,n={certificate_list:We(r,3)},s,i,o=[];try{for(;n.certificate_list.length()>0;)s=We(n.certificate_list,3),i=N.asn1.fromDer(s),s=N.pki.certificateFromAsn1(i,!0),o.push(s)}catch(u){return e.error(e,{message:"Could not parse certificate list.",cause:u,send:!0,alert:{level:p.Alert.Level.fatal,description:p.Alert.Description.bad_certificate}})}var l=e.entity===p.ConnectionEnd.client;(l||e.verifyClient===!0)&&o.length===0?e.error(e,{message:l?"No server certificate provided.":"No client certificate provided.",send:!0,alert:{level:p.Alert.Level.fatal,description:p.Alert.Description.illegal_parameter}}):o.length===0?e.expect=l?es:ja:(l?e.session.serverCertificate=o[0]:e.session.clientCertificate=o[0],p.verifyCertificateChain(e,o)&&(e.expect=l?es:ja)),e.process()};p.handleServerKeyExchange=function(e,t,a){if(a>0)return e.error(e,{message:"Invalid key parameters. Only RSA is supported.",send:!0,alert:{level:p.Alert.Level.fatal,description:p.Alert.Description.unsupported_certificate}});e.expect=xl,e.process()};p.handleClientKeyExchange=function(e,t,a){if(a<48)return e.error(e,{message:"Invalid key parameters. Only RSA is supported.",send:!0,alert:{level:p.Alert.Level.fatal,description:p.Alert.Description.unsupported_certificate}});var r=t.fragment,n={enc_pre_master_secret:We(r,2).getBytes()},s=null;if(e.getPrivateKey)try{s=e.getPrivateKey(e,e.session.serverCertificate),s=N.pki.privateKeyFromPem(s)}catch(l){e.error(e,{message:"Could not get private key.",cause:l,send:!0,alert:{level:p.Alert.Level.fatal,description:p.Alert.Description.internal_error}})}if(s===null)return e.error(e,{message:"No private key set.",send:!0,alert:{level:p.Alert.Level.fatal,description:p.Alert.Description.internal_error}});try{var i=e.session.sp;i.pre_master_secret=s.decrypt(n.enc_pre_master_secret);var o=e.session.clientHelloVersion;if(o.major!==i.pre_master_secret.charCodeAt(0)||o.minor!==i.pre_master_secret.charCodeAt(1))throw new Error("TLS version rollback attack detected.")}catch{i.pre_master_secret=N.random.getBytes(48)}e.expect=$a,e.session.clientCertificate!==null&&(e.expect=_l),e.process()};p.handleCertificateRequest=function(e,t,a){if(a<3)return e.error(e,{message:"Invalid CertificateRequest. Message too short.",send:!0,alert:{level:p.Alert.Level.fatal,description:p.Alert.Description.illegal_parameter}});var r=t.fragment,n={certificate_types:We(r,1),certificate_authorities:We(r,2)};e.session.certificateRequest=n,e.expect=Sl,e.process()};p.handleCertificateVerify=function(e,t,a){if(a<2)return e.error(e,{message:"Invalid CertificateVerify. Message too short.",send:!0,alert:{level:p.Alert.Level.fatal,description:p.Alert.Description.illegal_parameter}});var r=t.fragment;r.read-=4;var n=r.bytes();r.read+=4;var s={signature:We(r,2).getBytes()},i=N.util.createBuffer();i.putBuffer(e.session.md5.digest()),i.putBuffer(e.session.sha1.digest()),i=i.getBytes();try{var o=e.session.clientCertificate;if(!o.publicKey.verify(i,s.signature,"NONE"))throw new Error("CertificateVerify signature does not match.");e.session.md5.update(n),e.session.sha1.update(n)}catch{return e.error(e,{message:"Bad signature in CertificateVerify.",send:!0,alert:{level:p.Alert.Level.fatal,description:p.Alert.Description.handshake_failure}})}e.expect=$a,e.process()};p.handleServerHelloDone=function(e,t,a){if(a>0)return e.error(e,{message:"Invalid ServerHelloDone message. Invalid length.",send:!0,alert:{level:p.Alert.Level.fatal,description:p.Alert.Description.record_overflow}});if(e.serverCertificate===null){var r={message:"No server certificate provided. Not enough security.",send:!0,alert:{level:p.Alert.Level.fatal,description:p.Alert.Description.insufficient_security}},n=0,s=e.verify(e,r.alert.description,n,[]);if(s!==!0)return(s||s===0)&&(typeof s=="object"&&!N.util.isArray(s)?(s.message&&(r.message=s.message),s.alert&&(r.alert.description=s.alert)):typeof s=="number"&&(r.alert.description=s)),e.error(e,r)}e.session.certificateRequest!==null&&(t=p.createRecord(e,{type:p.ContentType.handshake,data:p.createCertificate(e)}),p.queue(e,t)),t=p.createRecord(e,{type:p.ContentType.handshake,data:p.createClientKeyExchange(e)}),p.queue(e,t),e.expect=Al;var i=function(o,l){o.session.certificateRequest!==null&&o.session.clientCertificate!==null&&p.queue(o,p.createRecord(o,{type:p.ContentType.handshake,data:p.createCertificateVerify(o,l)})),p.queue(o,p.createRecord(o,{type:p.ContentType.change_cipher_spec,data:p.createChangeCipherSpec()})),o.state.pending=p.createConnectionState(o),o.state.current.write=o.state.pending.write,p.queue(o,p.createRecord(o,{type:p.ContentType.handshake,data:p.createFinished(o)})),o.expect=rs,p.flush(o),o.process()};if(e.session.certificateRequest===null||e.session.clientCertificate===null)return i(e,null);p.getClientSignature(e,i)};p.handleChangeCipherSpec=function(e,t){if(t.fragment.getByte()!==1)return e.error(e,{message:"Invalid ChangeCipherSpec message received.",send:!0,alert:{level:p.Alert.Level.fatal,description:p.Alert.Description.illegal_parameter}});var a=e.entity===p.ConnectionEnd.client;(e.session.resuming&&a||!e.session.resuming&&!a)&&(e.state.pending=p.createConnectionState(e)),e.state.current.read=e.state.pending.read,(!e.session.resuming&&a||e.session.resuming&&!a)&&(e.state.pending=null),e.expect=a?Tl:Nl,e.process()};p.handleFinished=function(e,t,a){var r=t.fragment;r.read-=4;var n=r.bytes();r.read+=4;var s=t.fragment.getBytes();r=N.util.createBuffer(),r.putBuffer(e.session.md5.digest()),r.putBuffer(e.session.sha1.digest());var i=e.entity===p.ConnectionEnd.client,o=i?"server finished":"client finished",l=e.session.sp,u=12,f=sa;if(r=f(l.master_secret,o,r.getBytes(),u),r.getBytes()!==s)return e.error(e,{message:"Invalid verify_data in Finished message.",send:!0,alert:{level:p.Alert.Level.fatal,description:p.Alert.Description.decrypt_error}});e.session.md5.update(n),e.session.sha1.update(n),(e.session.resuming&&i||!e.session.resuming&&!i)&&(p.queue(e,p.createRecord(e,{type:p.ContentType.change_cipher_spec,data:p.createChangeCipherSpec()})),e.state.current.write=e.state.pending.write,e.state.pending=null,p.queue(e,p.createRecord(e,{type:p.ContentType.handshake,data:p.createFinished(e)}))),e.expect=i?Il:Rl,e.handshaking=!1,++e.handshakes,e.peerCertificate=i?e.session.serverCertificate:e.session.clientCertificate,p.flush(e),e.isConnected=!0,e.connected(e),e.process()};p.handleAlert=function(e,t){var a=t.fragment,r={level:a.getByte(),description:a.getByte()},n;switch(r.description){case p.Alert.Description.close_notify:n="Connection closed.";break;case p.Alert.Description.unexpected_message:n="Unexpected message.";break;case p.Alert.Description.bad_record_mac:n="Bad record MAC.";break;case p.Alert.Description.decryption_failed:n="Decryption failed.";break;case p.Alert.Description.record_overflow:n="Record overflow.";break;case p.Alert.Description.decompression_failure:n="Decompression failed.";break;case p.Alert.Description.handshake_failure:n="Handshake failure.";break;case p.Alert.Description.bad_certificate:n="Bad certificate.";break;case p.Alert.Description.unsupported_certificate:n="Unsupported certificate.";break;case p.Alert.Description.certificate_revoked:n="Certificate revoked.";break;case p.Alert.Description.certificate_expired:n="Certificate expired.";break;case p.Alert.Description.certificate_unknown:n="Certificate unknown.";break;case p.Alert.Description.illegal_parameter:n="Illegal parameter.";break;case p.Alert.Description.unknown_ca:n="Unknown certificate authority.";break;case p.Alert.Description.access_denied:n="Access denied.";break;case p.Alert.Description.decode_error:n="Decode error.";break;case p.Alert.Description.decrypt_error:n="Decrypt error.";break;case p.Alert.Description.export_restriction:n="Export restriction.";break;case p.Alert.Description.protocol_version:n="Unsupported protocol version.";break;case p.Alert.Description.insufficient_security:n="Insufficient security.";break;case p.Alert.Description.internal_error:n="Internal error.";break;case p.Alert.Description.user_canceled:n="User canceled.";break;case p.Alert.Description.no_renegotiation:n="Renegotiation not supported.";break;default:n="Unknown error.";break}if(r.description===p.Alert.Description.close_notify)return e.close();e.error(e,{message:n,send:!1,origin:e.entity===p.ConnectionEnd.client?"server":"client",alert:r}),e.process()};p.handleHandshake=function(e,t){var a=t.fragment,r=a.getByte(),n=a.getInt24();if(n>a.length())return e.fragmented=t,t.fragment=N.util.createBuffer(),a.read-=4,e.process();e.fragmented=null,a.read-=4;var s=a.bytes(n+4);a.read+=4,r in ia[e.entity][e.expect]?(e.entity===p.ConnectionEnd.server&&!e.open&&!e.fail&&(e.handshaking=!0,e.session={version:null,extensions:{server_name:{serverNameList:[]}},cipherSuite:null,compressionMethod:null,serverCertificate:null,clientCertificate:null,md5:N.md.md5.create(),sha1:N.md.sha1.create()}),r!==p.HandshakeType.hello_request&&r!==p.HandshakeType.certificate_verify&&r!==p.HandshakeType.finished&&(e.session.md5.update(s),e.session.sha1.update(s)),ia[e.entity][e.expect][r](e,t,n)):p.handleUnexpected(e,t)};p.handleApplicationData=function(e,t){e.data.putBuffer(t.fragment),e.dataReady(e),e.process()};p.handleHeartbeat=function(e,t){var a=t.fragment,r=a.getByte(),n=a.getInt16(),s=a.getBytes(n);if(r===p.HeartbeatMessageType.heartbeat_request){if(e.handshaking||n>s.length)return e.process();p.queue(e,p.createRecord(e,{type:p.ContentType.heartbeat,data:p.createHeartbeat(p.HeartbeatMessageType.heartbeat_response,s)})),p.flush(e)}else if(r===p.HeartbeatMessageType.heartbeat_response){if(s!==e.expectedHeartbeatPayload)return e.process();e.heartbeatReceived&&e.heartbeatReceived(e,N.util.createBuffer(s))}e.process()};var Cl=0,El=1,es=2,xl=3,Sl=4,rs=5,Tl=6,Il=7,Al=8,Bl=0,bl=1,ja=2,_l=3,$a=4,Nl=5,Rl=6,d=p.handleUnexpected,as=p.handleChangeCipherSpec,Be=p.handleAlert,ze=p.handleHandshake,ns=p.handleApplicationData,be=p.handleHeartbeat,Za=[];Za[p.ConnectionEnd.client]=[[d,Be,ze,d,be],[d,Be,ze,d,be],[d,Be,ze,d,be],[d,Be,ze,d,be],[d,Be,ze,d,be],[as,Be,d,d,be],[d,Be,ze,d,be],[d,Be,ze,ns,be],[d,Be,ze,d,be]];Za[p.ConnectionEnd.server]=[[d,Be,ze,d,be],[d,Be,ze,d,be],[d,Be,ze,d,be],[d,Be,ze,d,be],[as,Be,d,d,be],[d,Be,ze,d,be],[d,Be,ze,ns,be],[d,Be,ze,d,be]];var Lt=p.handleHelloRequest,wl=p.handleServerHello,is=p.handleCertificate,ts=p.handleServerKeyExchange,Xa=p.handleCertificateRequest,aa=p.handleServerHelloDone,ss=p.handleFinished,ia=[];ia[p.ConnectionEnd.client]=[[d,d,wl,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d],[Lt,d,d,d,d,d,d,d,d,d,d,is,ts,Xa,aa,d,d,d,d,d,d],[Lt,d,d,d,d,d,d,d,d,d,d,d,ts,Xa,aa,d,d,d,d,d,d],[Lt,d,d,d,d,d,d,d,d,d,d,d,d,Xa,aa,d,d,d,d,d,d],[Lt,d,d,d,d,d,d,d,d,d,d,d,d,d,aa,d,d,d,d,d,d],[Lt,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d],[Lt,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,ss],[Lt,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d],[Lt,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d]];var Ll=p.handleClientHello,kl=p.handleClientKeyExchange,Dl=p.handleCertificateVerify;ia[p.ConnectionEnd.server]=[[d,Ll,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d],[d,d,d,d,d,d,d,d,d,d,d,is,d,d,d,d,d,d,d,d,d],[d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,kl,d,d,d,d],[d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,Dl,d,d,d,d,d],[d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d],[d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,ss],[d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d],[d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d]];p.generateKeys=function(e,t){var a=sa,r=t.client_random+t.server_random;e.session.resuming||(t.master_secret=a(t.pre_master_secret,"master secret",r,48).bytes(),t.pre_master_secret=null),r=t.server_random+t.client_random;var n=2*t.mac_key_length+2*t.enc_key_length,s=e.version.major===p.Versions.TLS_1_0.major&&e.version.minor===p.Versions.TLS_1_0.minor;s&&(n+=2*t.fixed_iv_length);var i=a(t.master_secret,"key expansion",r,n),o={client_write_MAC_key:i.getBytes(t.mac_key_length),server_write_MAC_key:i.getBytes(t.mac_key_length),client_write_key:i.getBytes(t.enc_key_length),server_write_key:i.getBytes(t.enc_key_length)};return s&&(o.client_write_IV=i.getBytes(t.fixed_iv_length),o.server_write_IV=i.getBytes(t.fixed_iv_length)),o};p.createConnectionState=function(e){var t=e.entity===p.ConnectionEnd.client,a=function(){var s={sequenceNumber:[0,0],macKey:null,macLength:0,macFunction:null,cipherState:null,cipherFunction:function(i){return!0},compressionState:null,compressFunction:function(i){return!0},updateSequenceNumber:function(){s.sequenceNumber[1]===4294967295?(s.sequenceNumber[1]=0,++s.sequenceNumber[0]):++s.sequenceNumber[1]}};return s},r={read:a(),write:a()};if(r.read.update=function(s,i){return r.read.cipherFunction(i,r.read)?r.read.compressFunction(s,i,r.read)||s.error(s,{message:"Could not decompress record.",send:!0,alert:{level:p.Alert.Level.fatal,description:p.Alert.Description.decompression_failure}}):s.error(s,{message:"Could not decrypt record or bad MAC.",send:!0,alert:{level:p.Alert.Level.fatal,description:p.Alert.Description.bad_record_mac}}),!s.fail},r.write.update=function(s,i){return r.write.compressFunction(s,i,r.write)?r.write.cipherFunction(i,r.write)||s.error(s,{message:"Could not encrypt record.",send:!1,alert:{level:p.Alert.Level.fatal,description:p.Alert.Description.internal_error}}):s.error(s,{message:"Could not compress record.",send:!1,alert:{level:p.Alert.Level.fatal,description:p.Alert.Description.internal_error}}),!s.fail},e.session){var n=e.session.sp;switch(e.session.cipherSuite.initSecurityParameters(n),n.keys=p.generateKeys(e,n),r.read.macKey=t?n.keys.server_write_MAC_key:n.keys.client_write_MAC_key,r.write.macKey=t?n.keys.client_write_MAC_key:n.keys.server_write_MAC_key,e.session.cipherSuite.initConnectionState(r,e,n),n.compression_algorithm){case p.CompressionMethod.none:break;case p.CompressionMethod.deflate:r.read.compressFunction=ml,r.write.compressFunction=gl;break;default:throw new Error("Unsupported compression algorithm.")}}return r};p.createRandom=function(){var e=new Date,t=+e+e.getTimezoneOffset()*6e4,a=N.util.createBuffer();return a.putInt32(t),a.putBytes(N.random.getBytes(28)),a};p.createRecord=function(e,t){if(!t.data)return null;var a={type:t.type,version:{major:e.version.major,minor:e.version.minor},length:t.data.length(),fragment:t.data};return a};p.createAlert=function(e,t){var a=N.util.createBuffer();return a.putByte(t.level),a.putByte(t.description),p.createRecord(e,{type:p.ContentType.alert,data:a})};p.createClientHello=function(e){e.session.clientHelloVersion={major:e.version.major,minor:e.version.minor};for(var t=N.util.createBuffer(),a=0;a<e.cipherSuites.length;++a){var r=e.cipherSuites[a];t.putByte(r.id[0]),t.putByte(r.id[1])}var n=t.length(),s=N.util.createBuffer();s.putByte(p.CompressionMethod.none);var i=s.length(),o=N.util.createBuffer();if(e.virtualHost){var l=N.util.createBuffer();l.putByte(0),l.putByte(0);var u=N.util.createBuffer();u.putByte(0),at(u,2,N.util.createBuffer(e.virtualHost));var f=N.util.createBuffer();at(f,2,u),at(l,2,f),o.putBuffer(l)}var c=o.length();c>0&&(c+=2);var v=e.session.id,g=v.length+1+2+4+28+2+n+1+i+c,y=N.util.createBuffer();return y.putByte(p.HandshakeType.client_hello),y.putInt24(g),y.putByte(e.version.major),y.putByte(e.version.minor),y.putBytes(e.session.sp.client_random),at(y,1,N.util.createBuffer(v)),at(y,2,t),at(y,1,s),c>0&&at(y,2,o),y};p.createServerHello=function(e){var t=e.session.id,a=t.length+1+2+4+28+2+1,r=N.util.createBuffer();return r.putByte(p.HandshakeType.server_hello),r.putInt24(a),r.putByte(e.version.major),r.putByte(e.version.minor),r.putBytes(e.session.sp.server_random),at(r,1,N.util.createBuffer(t)),r.putByte(e.session.cipherSuite.id[0]),r.putByte(e.session.cipherSuite.id[1]),r.putByte(e.session.compressionMethod),r};p.createCertificate=function(e){var t=e.entity===p.ConnectionEnd.client,a=null;if(e.getCertificate){var r;t?r=e.session.certificateRequest:r=e.session.extensions.server_name.serverNameList,a=e.getCertificate(e,r)}var n=N.util.createBuffer();if(a!==null)try{N.util.isArray(a)||(a=[a]);for(var s=null,i=0;i<a.length;++i){var o=N.pem.decode(a[i])[0];if(o.type!=="CERTIFICATE"&&o.type!=="X509 CERTIFICATE"&&o.type!=="TRUSTED CERTIFICATE"){var l=new Error('Could not convert certificate from PEM; PEM header type is not "CERTIFICATE", "X509 CERTIFICATE", or "TRUSTED CERTIFICATE".');throw l.headerType=o.type,l}if(o.procType&&o.procType.type==="ENCRYPTED")throw new Error("Could not convert certificate from PEM; PEM is encrypted.");var u=N.util.createBuffer(o.body);s===null&&(s=N.asn1.fromDer(u.bytes(),!1));var f=N.util.createBuffer();at(f,3,u),n.putBuffer(f)}a=N.pki.certificateFromAsn1(s),t?e.session.clientCertificate=a:e.session.serverCertificate=a}catch(g){return e.error(e,{message:"Could not send certificate list.",cause:g,send:!0,alert:{level:p.Alert.Level.fatal,description:p.Alert.Description.bad_certificate}})}var c=3+n.length(),v=N.util.createBuffer();return v.putByte(p.HandshakeType.certificate),v.putInt24(c),at(v,3,n),v};p.createClientKeyExchange=function(e){var t=N.util.createBuffer();t.putByte(e.session.clientHelloVersion.major),t.putByte(e.session.clientHelloVersion.minor),t.putBytes(N.random.getBytes(46));var a=e.session.sp;a.pre_master_secret=t.getBytes();var r=e.session.serverCertificate.publicKey;t=r.encrypt(a.pre_master_secret);var n=t.length+2,s=N.util.createBuffer();return s.putByte(p.HandshakeType.client_key_exchange),s.putInt24(n),s.putInt16(t.length),s.putBytes(t),s};p.createServerKeyExchange=function(e){var t=0,a=N.util.createBuffer();return t>0&&(a.putByte(p.HandshakeType.server_key_exchange),a.putInt24(t)),a};p.getClientSignature=function(e,t){var a=N.util.createBuffer();a.putBuffer(e.session.md5.digest()),a.putBuffer(e.session.sha1.digest()),a=a.getBytes(),e.getSignature=e.getSignature||function(r,n,s){var i=null;if(r.getPrivateKey)try{i=r.getPrivateKey(r,r.session.clientCertificate),i=N.pki.privateKeyFromPem(i)}catch(o){r.error(r,{message:"Could not get private key.",cause:o,send:!0,alert:{level:p.Alert.Level.fatal,description:p.Alert.Description.internal_error}})}i===null?r.error(r,{message:"No private key set.",send:!0,alert:{level:p.Alert.Level.fatal,description:p.Alert.Description.internal_error}}):n=i.sign(n,null),s(r,n)},e.getSignature(e,a,t)};p.createCertificateVerify=function(e,t){var a=t.length+2,r=N.util.createBuffer();return r.putByte(p.HandshakeType.certificate_verify),r.putInt24(a),r.putInt16(t.length),r.putBytes(t),r};p.createCertificateRequest=function(e){var t=N.util.createBuffer();t.putByte(1);var a=N.util.createBuffer();for(var r in e.caStore.certs){var n=e.caStore.certs[r],s=N.pki.distinguishedNameToAsn1(n.subject),i=N.asn1.toDer(s);a.putInt16(i.length()),a.putBuffer(i)}var o=1+t.length()+2+a.length(),l=N.util.createBuffer();return l.putByte(p.HandshakeType.certificate_request),l.putInt24(o),at(l,1,t),at(l,2,a),l};p.createServerHelloDone=function(e){var t=N.util.createBuffer();return t.putByte(p.HandshakeType.server_hello_done),t.putInt24(0),t};p.createChangeCipherSpec=function(){var e=N.util.createBuffer();return e.putByte(1),e};p.createFinished=function(e){var t=N.util.createBuffer();t.putBuffer(e.session.md5.digest()),t.putBuffer(e.session.sha1.digest());var a=e.entity===p.ConnectionEnd.client,r=e.session.sp,n=12,s=sa,i=a?"client finished":"server finished";t=s(r.master_secret,i,t.getBytes(),n);var o=N.util.createBuffer();return o.putByte(p.HandshakeType.finished),o.putInt24(t.length()),o.putBuffer(t),o};p.createHeartbeat=function(e,t,a){typeof a>"u"&&(a=t.length);var r=N.util.createBuffer();r.putByte(e),r.putInt16(a),r.putBytes(t);var n=r.length(),s=Math.max(16,n-a-3);return r.putBytes(N.random.getBytes(s)),r};p.queue=function(e,t){if(t&&!(t.fragment.length()===0&&(t.type===p.ContentType.handshake||t.type===p.ContentType.alert||t.type===p.ContentType.change_cipher_spec))){if(t.type===p.ContentType.handshake){var a=t.fragment.bytes();e.session.md5.update(a),e.session.sha1.update(a),a=null}var r;if(t.fragment.length()<=p.MaxFragment)r=[t];else{r=[];for(var n=t.fragment.bytes();n.length>p.MaxFragment;)r.push(p.createRecord(e,{type:t.type,data:N.util.createBuffer(n.slice(0,p.MaxFragment))})),n=n.slice(p.MaxFragment);n.length>0&&r.push(p.createRecord(e,{type:t.type,data:N.util.createBuffer(n)}))}for(var s=0;s<r.length&&!e.fail;++s){var i=r[s],o=e.state.current.write;o.update(e,i)&&e.records.push(i)}}};p.flush=function(e){for(var t=0;t<e.records.length;++t){var a=e.records[t];e.tlsData.putByte(a.type),e.tlsData.putByte(a.version.major),e.tlsData.putByte(a.version.minor),e.tlsData.putInt16(a.fragment.length()),e.tlsData.putBuffer(e.records[t].fragment)}return e.records=[],e.tlsDataReady(e)};var Wa=function(e){switch(e){case!0:return!0;case N.pki.certificateError.bad_certificate:return p.Alert.Description.bad_certificate;case N.pki.certificateError.unsupported_certificate:return p.Alert.Description.unsupported_certificate;case N.pki.certificateError.certificate_revoked:return p.Alert.Description.certificate_revoked;case N.pki.certificateError.certificate_expired:return p.Alert.Description.certificate_expired;case N.pki.certificateError.certificate_unknown:return p.Alert.Description.certificate_unknown;case N.pki.certificateError.unknown_ca:return p.Alert.Description.unknown_ca;default:return p.Alert.Description.bad_certificate}},Ul=function(e){switch(e){case!0:return!0;case p.Alert.Description.bad_certificate:return N.pki.certificateError.bad_certificate;case p.Alert.Description.unsupported_certificate:return N.pki.certificateError.unsupported_certificate;case p.Alert.Description.certificate_revoked:return N.pki.certificateError.certificate_revoked;case p.Alert.Description.certificate_expired:return N.pki.certificateError.certificate_expired;case p.Alert.Description.certificate_unknown:return N.pki.certificateError.certificate_unknown;case p.Alert.Description.unknown_ca:return N.pki.certificateError.unknown_ca;default:return N.pki.certificateError.bad_certificate}};p.verifyCertificateChain=function(e,t){try{var a={};for(var r in e.verifyOptions)a[r]=e.verifyOptions[r];a.verify=function(s,i,o){var l=Wa(s),u=e.verify(e,s,i,o);if(u!==!0){if(typeof u=="object"&&!N.util.isArray(u)){var f=new Error("The application rejected the certificate.");throw f.send=!0,f.alert={level:p.Alert.Level.fatal,description:p.Alert.Description.bad_certificate},u.message&&(f.message=u.message),u.alert&&(f.alert.description=u.alert),f}u!==s&&(u=Ul(u))}return u},N.pki.verifyCertificateChain(e.caStore,t,a)}catch(s){var n=s;(typeof n!="object"||N.util.isArray(n))&&(n={send:!0,alert:{level:p.Alert.Level.fatal,description:Wa(s)}}),"send"in n||(n.send=!0),"alert"in n||(n.alert={level:p.Alert.Level.fatal,description:Wa(n.error)}),e.error(e,n)}return!e.fail};p.createSessionCache=function(e,t){var a=null;if(e&&e.getSession&&e.setSession&&e.order)a=e;else{a={},a.cache=e||{},a.capacity=Math.max(t||100,1),a.order=[];for(var r in e)a.order.length<=t?a.order.push(r):delete e[r];a.getSession=function(n){var s=null,i=null;if(n?i=N.util.bytesToHex(n):a.order.length>0&&(i=a.order[0]),i!==null&&i in a.cache){s=a.cache[i],delete a.cache[i];for(var o in a.order)if(a.order[o]===i){a.order.splice(o,1);break}}return s},a.setSession=function(n,s){if(a.order.length===a.capacity){var i=a.order.shift();delete a.cache[i]}var i=N.util.bytesToHex(n);a.order.push(i),a.cache[i]=s}}return a};p.createConnection=function(e){var t=null;e.caStore?N.util.isArray(e.caStore)?t=N.pki.createCaStore(e.caStore):t=e.caStore:t=N.pki.createCaStore();var a=e.cipherSuites||null;if(a===null){a=[];for(var r in p.CipherSuites)a.push(p.CipherSuites[r])}var n=e.server?p.ConnectionEnd.server:p.ConnectionEnd.client,s=e.sessionCache?p.createSessionCache(e.sessionCache):null,i={version:{major:p.Version.major,minor:p.Version.minor},entity:n,sessionId:e.sessionId,caStore:t,sessionCache:s,cipherSuites:a,connected:e.connected,virtualHost:e.virtualHost||null,verifyClient:e.verifyClient||!1,verify:e.verify||function(f,c,v,g){return c},verifyOptions:e.verifyOptions||{},getCertificate:e.getCertificate||null,getPrivateKey:e.getPrivateKey||null,getSignature:e.getSignature||null,input:N.util.createBuffer(),tlsData:N.util.createBuffer(),data:N.util.createBuffer(),tlsDataReady:e.tlsDataReady,dataReady:e.dataReady,heartbeatReceived:e.heartbeatReceived,closed:e.closed,error:function(f,c){c.origin=c.origin||(f.entity===p.ConnectionEnd.client?"client":"server"),c.send&&(p.queue(f,p.createAlert(f,c.alert)),p.flush(f));var v=c.fatal!==!1;v&&(f.fail=!0),e.error(f,c),v&&f.close(!1)},deflate:e.deflate||null,inflate:e.inflate||null};i.reset=function(f){i.version={major:p.Version.major,minor:p.Version.minor},i.record=null,i.session=null,i.peerCertificate=null,i.state={pending:null,current:null},i.expect=i.entity===p.ConnectionEnd.client?Cl:Bl,i.fragmented=null,i.records=[],i.open=!1,i.handshakes=0,i.handshaking=!1,i.isConnected=!1,i.fail=!(f||typeof f>"u"),i.input.clear(),i.tlsData.clear(),i.data.clear(),i.state.current=p.createConnectionState(i)},i.reset();var o=function(f,c){var v=c.type-p.ContentType.change_cipher_spec,g=Za[f.entity][f.expect];v in g?g[v](f,c):p.handleUnexpected(f,c)},l=function(f){var c=0,v=f.input,g=v.length();if(g<5)c=5-g;else{f.record={type:v.getByte(),version:{major:v.getByte(),minor:v.getByte()},length:v.getInt16(),fragment:N.util.createBuffer(),ready:!1};var y=f.record.version.major===f.version.major;y&&f.session&&f.session.version&&(y=f.record.version.minor===f.version.minor),y||f.error(f,{message:"Incompatible TLS version.",send:!0,alert:{level:p.Alert.Level.fatal,description:p.Alert.Description.protocol_version}})}return c},u=function(f){var c=0,v=f.input,g=v.length();if(g<f.record.length)c=f.record.length-g;else{f.record.fragment.putBytes(v.getBytes(f.record.length)),v.compact();var y=f.state.current.read;y.update(f,f.record)&&(f.fragmented!==null&&(f.fragmented.type===f.record.type?(f.fragmented.fragment.putBuffer(f.record.fragment),f.record=f.fragmented):f.error(f,{message:"Invalid fragmented record.",send:!0,alert:{level:p.Alert.Level.fatal,description:p.Alert.Description.unexpected_message}})),f.record.ready=!0)}return c};return i.handshake=function(f){if(i.entity!==p.ConnectionEnd.client)i.error(i,{message:"Cannot initiate handshake as a server.",fatal:!1});else if(i.handshaking)i.error(i,{message:"Handshake already in progress.",fatal:!1});else{i.fail&&!i.open&&i.handshakes===0&&(i.fail=!1),i.handshaking=!0,f=f||"";var c=null;f.length>0&&(i.sessionCache&&(c=i.sessionCache.getSession(f)),c===null&&(f="")),f.length===0&&i.sessionCache&&(c=i.sessionCache.getSession(),c!==null&&(f=c.id)),i.session={id:f,version:null,cipherSuite:null,compressionMethod:null,serverCertificate:null,certificateRequest:null,clientCertificate:null,sp:{},md5:N.md.md5.create(),sha1:N.md.sha1.create()},c&&(i.version=c.version,i.session.sp=c.sp),i.session.sp.client_random=p.createRandom().getBytes(),i.open=!0,p.queue(i,p.createRecord(i,{type:p.ContentType.handshake,data:p.createClientHello(i)})),p.flush(i)}},i.process=function(f){var c=0;return f&&i.input.putBytes(f),i.fail||(i.record!==null&&i.record.ready&&i.record.fragment.isEmpty()&&(i.record=null),i.record===null&&(c=l(i)),!i.fail&&i.record!==null&&!i.record.ready&&(c=u(i)),!i.fail&&i.record!==null&&i.record.ready&&o(i,i.record)),c},i.prepare=function(f){return p.queue(i,p.createRecord(i,{type:p.ContentType.application_data,data:N.util.createBuffer(f)})),p.flush(i)},i.prepareHeartbeatRequest=function(f,c){return f instanceof N.util.ByteBuffer&&(f=f.bytes()),typeof c>"u"&&(c=f.length),i.expectedHeartbeatPayload=f,p.queue(i,p.createRecord(i,{type:p.ContentType.heartbeat,data:p.createHeartbeat(p.HeartbeatMessageType.heartbeat_request,f,c)})),p.flush(i)},i.close=function(f){if(!i.fail&&i.sessionCache&&i.session){var c={id:i.session.id,version:i.session.version,sp:i.session.sp};c.sp.keys=null,i.sessionCache.setSession(c.id,c)}i.open&&(i.open=!1,i.input.clear(),(i.isConnected||i.handshaking)&&(i.isConnected=i.handshaking=!1,p.queue(i,p.createAlert(i,{level:p.Alert.Level.warning,description:p.Alert.Description.close_notify})),p.flush(i)),i.closed(i)),i.reset(f)},i};os.exports=N.tls=N.tls||{};for(na in p)typeof p[na]!="function"&&(N.tls[na]=p[na]);var na;N.tls.prf_tls1=sa;N.tls.hmac_sha1=yl;N.tls.createSessionCache=p.createSessionCache;N.tls.createConnection=p.createConnection});var fs=M((kc,ls)=>{var kt=X();Bt();Ja();var nt=ls.exports=kt.tls;nt.CipherSuites.TLS_RSA_WITH_AES_128_CBC_SHA={id:[0,47],name:"TLS_RSA_WITH_AES_128_CBC_SHA",initSecurityParameters:function(e){e.bulk_cipher_algorithm=nt.BulkCipherAlgorithm.aes,e.cipher_type=nt.CipherType.block,e.enc_key_length=16,e.block_length=16,e.fixed_iv_length=16,e.record_iv_length=16,e.mac_algorithm=nt.MACAlgorithm.hmac_sha1,e.mac_length=20,e.mac_key_length=20},initConnectionState:us};nt.CipherSuites.TLS_RSA_WITH_AES_256_CBC_SHA={id:[0,53],name:"TLS_RSA_WITH_AES_256_CBC_SHA",initSecurityParameters:function(e){e.bulk_cipher_algorithm=nt.BulkCipherAlgorithm.aes,e.cipher_type=nt.CipherType.block,e.enc_key_length=32,e.block_length=16,e.fixed_iv_length=16,e.record_iv_length=16,e.mac_algorithm=nt.MACAlgorithm.hmac_sha1,e.mac_length=20,e.mac_key_length=20},initConnectionState:us};function us(e,t,a){var r=t.entity===kt.tls.ConnectionEnd.client;e.read.cipherState={init:!1,cipher:kt.cipher.createDecipher("AES-CBC",r?a.keys.server_write_key:a.keys.client_write_key),iv:r?a.keys.server_write_IV:a.keys.client_write_IV},e.write.cipherState={init:!1,cipher:kt.cipher.createCipher("AES-CBC",r?a.keys.client_write_key:a.keys.server_write_key),iv:r?a.keys.client_write_IV:a.keys.server_write_IV},e.read.cipherFunction=Kl,e.write.cipherFunction=Pl,e.read.macLength=e.write.macLength=a.mac_length,e.read.macFunction=e.write.macFunction=nt.hmac_sha1}function Pl(e,t){var a=!1,r=t.macFunction(t.macKey,t.sequenceNumber,e);e.fragment.putBytes(r),t.updateSequenceNumber();var n;e.version.minor===nt.Versions.TLS_1_0.minor?n=t.cipherState.init?null:t.cipherState.iv:n=kt.random.getBytesSync(16),t.cipherState.init=!0;var s=t.cipherState.cipher;return s.start({iv:n}),e.version.minor>=nt.Versions.TLS_1_1.minor&&s.output.putBytes(n),s.update(e.fragment),s.finish(Vl)&&(e.fragment=s.output,e.length=e.fragment.length(),a=!0),a}function Vl(e,t,a){if(!a){var r=e-t.length()%e;t.fillWithByte(r-1,r)}return!0}function Ol(e,t,a){var r=!0;if(a){for(var n=t.length(),s=t.last(),i=n-1-s;i<n-1;++i)r=r&&t.at(i)==s;r&&t.truncate(s+1)}return r}function Kl(e,t){var a=!1,r;e.version.minor===nt.Versions.TLS_1_0.minor?r=t.cipherState.init?null:t.cipherState.iv:r=e.fragment.getBytes(16),t.cipherState.init=!0;var n=t.cipherState.cipher;n.start({iv:r}),n.update(e.fragment),a=n.finish(Ol);var s=t.macLength,i=kt.random.getBytesSync(s),o=n.output.length();o>=s?(e.fragment=n.output.getBytes(o-s),i=n.output.getBytes(s)):e.fragment=n.output.getBytes(),e.fragment=kt.util.createBuffer(e.fragment),e.length=e.fragment.length();var l=t.macFunction(t.macKey,t.sequenceNumber,e);return t.updateSequenceNumber(),a=Fl(t.macKey,i,l)&&a,a}function Fl(e,t,a){var r=kt.hmac.create();return r.start("SHA1",e),r.update(t),t=r.digest().getBytes(),r.start(null,null),r.update(a),a=r.digest().getBytes(),t===a}});var rn=M((Dc,ps)=>{var de=X();ut();ne();var Ir=ps.exports=de.sha512=de.sha512||{};de.md.sha512=de.md.algorithms.sha512=Ir;var hs=de.sha384=de.sha512.sha384=de.sha512.sha384||{};hs.create=function(){return Ir.create("SHA-384")};de.md.sha384=de.md.algorithms.sha384=hs;de.sha512.sha256=de.sha512.sha256||{create:function(){return Ir.create("SHA-512/256")}};de.md["sha512/256"]=de.md.algorithms["sha512/256"]=de.sha512.sha256;de.sha512.sha224=de.sha512.sha224||{create:function(){return Ir.create("SHA-512/224")}};de.md["sha512/224"]=de.md.algorithms["sha512/224"]=de.sha512.sha224;Ir.create=function(e){if(ds||ql(),typeof e>"u"&&(e="SHA-512"),!(e in zt))throw new Error("Invalid SHA-512 algorithm: "+e);for(var t=zt[e],a=null,r=de.util.createBuffer(),n=new Array(80),s=0;s<80;++s)n[s]=new Array(2);var i=64;switch(e){case"SHA-384":i=48;break;case"SHA-512/256":i=32;break;case"SHA-512/224":i=28;break}var o={algorithm:e.replace("-","").toLowerCase(),blockLength:128,digestLength:i,messageLength:0,fullMessageLength:null,messageLengthSize:16};return o.start=function(){o.messageLength=0,o.fullMessageLength=o.messageLength128=[];for(var l=o.messageLengthSize/4,u=0;u<l;++u)o.fullMessageLength.push(0);r=de.util.createBuffer(),a=new Array(t.length);for(var u=0;u<t.length;++u)a[u]=t[u].slice(0);return o},o.start(),o.update=function(l,u){u==="utf8"&&(l=de.util.encodeUtf8(l));var f=l.length;o.messageLength+=f,f=[f/4294967296>>>0,f>>>0];for(var c=o.fullMessageLength.length-1;c>=0;--c)o.fullMessageLength[c]+=f[1],f[1]=f[0]+(o.fullMessageLength[c]/4294967296>>>0),o.fullMessageLength[c]=o.fullMessageLength[c]>>>0,f[0]=f[1]/4294967296>>>0;return r.putBytes(l),cs(a,n,r),(r.read>2048||r.length()===0)&&r.compact(),o},o.digest=function(){var l=de.util.createBuffer();l.putBytes(r.bytes());var u=o.fullMessageLength[o.fullMessageLength.length-1]+o.messageLengthSize,f=u&o.blockLength-1;l.putBytes(en.substr(0,o.blockLength-f));for(var c,v,g=o.fullMessageLength[0]*8,y=0;y<o.fullMessageLength.length-1;++y)c=o.fullMessageLength[y+1]*8,v=c/4294967296>>>0,g+=v,l.putInt32(g>>>0),g=c>>>0;l.putInt32(g);for(var x=new Array(a.length),y=0;y<a.length;++y)x[y]=a[y].slice(0);cs(x,n,l);var S=de.util.createBuffer(),I;e==="SHA-512"?I=x.length:e==="SHA-384"?I=x.length-2:I=x.length-4;for(var y=0;y<I;++y)S.putInt32(x[y][0]),(y!==I-1||e!=="SHA-512/224")&&S.putInt32(x[y][1]);return S},o};var en=null,ds=!1,tn=null,zt=null;function ql(){en="\x80",en+=de.util.fillString("\0",128),tn=[[1116352408,3609767458],[1899447441,602891725],[3049323471,3964484399],[3921009573,2173295548],[961987163,4081628472],[1508970993,3053834265],[2453635748,2937671579],[2870763221,3664609560],[3624381080,2734883394],[310598401,1164996542],[607225278,1323610764],[1426881987,3590304994],[1925078388,4068182383],[2162078206,991336113],[2614888103,633803317],[3248222580,3479774868],[3835390401,2666613458],[4022224774,944711139],[264347078,2341262773],[604807628,2007800933],[770255983,1495990901],[1249150122,1856431235],[1555081692,3175218132],[1996064986,2198950837],[2554220882,3999719339],[2821834349,766784016],[2952996808,2566594879],[3210313671,3203337956],[3336571891,1034457026],[3584528711,2466948901],[113926993,3758326383],[338241895,168717936],[666307205,1188179964],[773529912,1546045734],[1294757372,1522805485],[1396182291,2643833823],[1695183700,2343527390],[1986661051,1014477480],[2177026350,1206759142],[2456956037,344077627],[2730485921,1290863460],[2820302411,3158454273],[3259730800,3505952657],[3345764771,106217008],[3516065817,3606008344],[3600352804,1432725776],[4094571909,1467031594],[275423344,851169720],[430227734,3100823752],[506948616,1363258195],[659060556,3750685593],[883997877,3785050280],[958139571,3318307427],[1322822218,3812723403],[1537002063,2003034995],[1747873779,3602036899],[1955562222,1575990012],[2024104815,1125592928],[2227730452,2716904306],[2361852424,442776044],[2428436474,593698344],[2756734187,3733110249],[3204031479,2999351573],[3329325298,3815920427],[3391569614,3928383900],[3515267271,566280711],[3940187606,3454069534],[4118630271,4000239992],[116418474,1914138554],[174292421,2731055270],[289380356,3203993006],[460393269,320620315],[685471733,587496836],[852142971,1086792851],[1017036298,365543100],[1126000580,2618297676],[1288033470,3409855158],[1501505948,4234509866],[1607167915,987167468],[1816402316,1246189591]],zt={},zt["SHA-512"]=[[1779033703,4089235720],[3144134277,2227873595],[1013904242,4271175723],[2773480762,1595750129],[1359893119,2917565137],[2600822924,725511199],[528734635,4215389547],[1541459225,327033209]],zt["SHA-384"]=[[3418070365,3238371032],[1654270250,914150663],[2438529370,812702999],[355462360,4144912697],[1731405415,4290775857],[2394180231,1750603025],[3675008525,1694076839],[1203062813,3204075428]],zt["SHA-512/256"]=[[573645204,4230739756],[2673172387,3360449730],[596883563,1867755857],[2520282905,1497426621],[2519219938,2827943907],[3193839141,1401305490],[721525244,746961066],[246885852,2177182882]],zt["SHA-512/224"]=[[2352822216,424955298],[1944164710,2312950998],[502970286,855612546],[1738396948,1479516111],[258812777,2077511080],[2011393907,79989058],[1067287976,1780299464],[286451373,2446758561]],ds=!0}function cs(e,t,a){for(var r,n,s,i,o,l,u,f,c,v,g,y,x,S,I,B,b,U,L,w,z,G,W,oe,ue,ee,xe,Me,ie,ye,K,Vt,Wt,ge,me,Ee=a.length();Ee>=128;){for(ie=0;ie<16;++ie)t[ie][0]=a.getInt32()>>>0,t[ie][1]=a.getInt32()>>>0;for(;ie<80;++ie)Vt=t[ie-2],ye=Vt[0],K=Vt[1],r=((ye>>>19|K<<13)^(K>>>29|ye<<3)^ye>>>6)>>>0,n=((ye<<13|K>>>19)^(K<<3|ye>>>29)^(ye<<26|K>>>6))>>>0,ge=t[ie-15],ye=ge[0],K=ge[1],s=((ye>>>1|K<<31)^(ye>>>8|K<<24)^ye>>>7)>>>0,i=((ye<<31|K>>>1)^(ye<<24|K>>>8)^(ye<<25|K>>>7))>>>0,Wt=t[ie-7],me=t[ie-16],K=n+Wt[1]+i+me[1],t[ie][0]=r+Wt[0]+s+me[0]+(K/4294967296>>>0)>>>0,t[ie][1]=K>>>0;for(x=e[0][0],S=e[0][1],I=e[1][0],B=e[1][1],b=e[2][0],U=e[2][1],L=e[3][0],w=e[3][1],z=e[4][0],G=e[4][1],W=e[5][0],oe=e[5][1],ue=e[6][0],ee=e[6][1],xe=e[7][0],Me=e[7][1],ie=0;ie<80;++ie)u=((z>>>14|G<<18)^(z>>>18|G<<14)^(G>>>9|z<<23))>>>0,f=((z<<18|G>>>14)^(z<<14|G>>>18)^(G<<23|z>>>9))>>>0,c=(ue^z&(W^ue))>>>0,v=(ee^G&(oe^ee))>>>0,o=((x>>>28|S<<4)^(S>>>2|x<<30)^(S>>>7|x<<25))>>>0,l=((x<<4|S>>>28)^(S<<30|x>>>2)^(S<<25|x>>>7))>>>0,g=(x&I|b&(x^I))>>>0,y=(S&B|U&(S^B))>>>0,K=Me+f+v+tn[ie][1]+t[ie][1],r=xe+u+c+tn[ie][0]+t[ie][0]+(K/4294967296>>>0)>>>0,n=K>>>0,K=l+y,s=o+g+(K/4294967296>>>0)>>>0,i=K>>>0,xe=ue,Me=ee,ue=W,ee=oe,W=z,oe=G,K=w+n,z=L+r+(K/4294967296>>>0)>>>0,G=K>>>0,L=b,w=U,b=I,U=B,I=x,B=S,K=n+i,x=r+s+(K/4294967296>>>0)>>>0,S=K>>>0;K=e[0][1]+S,e[0][0]=e[0][0]+x+(K/4294967296>>>0)>>>0,e[0][1]=K>>>0,K=e[1][1]+B,e[1][0]=e[1][0]+I+(K/4294967296>>>0)>>>0,e[1][1]=K>>>0,K=e[2][1]+U,e[2][0]=e[2][0]+b+(K/4294967296>>>0)>>>0,e[2][1]=K>>>0,K=e[3][1]+w,e[3][0]=e[3][0]+L+(K/4294967296>>>0)>>>0,e[3][1]=K>>>0,K=e[4][1]+G,e[4][0]=e[4][0]+z+(K/4294967296>>>0)>>>0,e[4][1]=K>>>0,K=e[5][1]+oe,e[5][0]=e[5][0]+W+(K/4294967296>>>0)>>>0,e[5][1]=K>>>0,K=e[6][1]+ee,e[6][0]=e[6][0]+ue+(K/4294967296>>>0)>>>0,e[6][1]=K>>>0,K=e[7][1]+Me,e[7][0]=e[7][0]+xe+(K/4294967296>>>0)>>>0,e[7][1]=K>>>0,Ee-=128}}});var vs=M(an=>{var Ml=X();st();var Ae=Ml.asn1;an.privateKeyValidator={name:"PrivateKeyInfo",tagClass:Ae.Class.UNIVERSAL,type:Ae.Type.SEQUENCE,constructed:!0,value:[{name:"PrivateKeyInfo.version",tagClass:Ae.Class.UNIVERSAL,type:Ae.Type.INTEGER,constructed:!1,capture:"privateKeyVersion"},{name:"PrivateKeyInfo.privateKeyAlgorithm",tagClass:Ae.Class.UNIVERSAL,type:Ae.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:Ae.Class.UNIVERSAL,type:Ae.Type.OID,constructed:!1,capture:"privateKeyOid"}]},{name:"PrivateKeyInfo",tagClass:Ae.Class.UNIVERSAL,type:Ae.Type.OCTETSTRING,constructed:!1,capture:"privateKey"}]};an.publicKeyValidator={name:"SubjectPublicKeyInfo",tagClass:Ae.Class.UNIVERSAL,type:Ae.Type.SEQUENCE,constructed:!0,captureAsn1:"subjectPublicKeyInfo",value:[{name:"SubjectPublicKeyInfo.AlgorithmIdentifier",tagClass:Ae.Class.UNIVERSAL,type:Ae.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:Ae.Class.UNIVERSAL,type:Ae.Type.OID,constructed:!1,capture:"publicKeyOid"}]},{tagClass:Ae.Class.UNIVERSAL,type:Ae.Type.BITSTRING,constructed:!1,composed:!0,captureBitStringValue:"ed25519PublicKey"}]}});var _s=M((Pc,bs)=>{var _e=X();Er();Je();rn();ne();var xs=vs(),Hl=xs.publicKeyValidator,Gl=xs.privateKeyValidator;typeof ys>"u"&&(ys=_e.jsbn.BigInteger);var ys,sn=_e.util.ByteBuffer,Xe=typeof Buffer>"u"?Uint8Array:Buffer;_e.pki=_e.pki||{};bs.exports=_e.pki.ed25519=_e.ed25519=_e.ed25519||{};var Z=_e.ed25519;Z.constants={};Z.constants.PUBLIC_KEY_BYTE_LENGTH=32;Z.constants.PRIVATE_KEY_BYTE_LENGTH=64;Z.constants.SEED_BYTE_LENGTH=32;Z.constants.SIGN_BYTE_LENGTH=64;Z.constants.HASH_BYTE_LENGTH=64;Z.generateKeyPair=function(e){e=e||{};var t=e.seed;if(t===void 0)t=_e.random.getBytesSync(Z.constants.SEED_BYTE_LENGTH);else if(typeof t=="string"){if(t.length!==Z.constants.SEED_BYTE_LENGTH)throw new TypeError('"seed" must be '+Z.constants.SEED_BYTE_LENGTH+" bytes in length.")}else if(!(t instanceof Uint8Array))throw new TypeError('"seed" must be a node.js Buffer, Uint8Array, or a binary string.');t=xt({message:t,encoding:"binary"});for(var a=new Xe(Z.constants.PUBLIC_KEY_BYTE_LENGTH),r=new Xe(Z.constants.PRIVATE_KEY_BYTE_LENGTH),n=0;n<32;++n)r[n]=t[n];return Xl(a,r),{publicKey:a,privateKey:r}};Z.privateKeyFromAsn1=function(e){var t={},a=[],r=_e.asn1.validate(e,Gl,t,a);if(!r){var n=new Error("Invalid Key.");throw n.errors=a,n}var s=_e.asn1.derToOid(t.privateKeyOid),i=_e.oids.EdDSA25519;if(s!==i)throw new Error('Invalid OID "'+s+'"; OID must be "'+i+'".');var o=t.privateKey,l=xt({message:_e.asn1.fromDer(o).value,encoding:"binary"});return{privateKeyBytes:l}};Z.publicKeyFromAsn1=function(e){var t={},a=[],r=_e.asn1.validate(e,Hl,t,a);if(!r){var n=new Error("Invalid Key.");throw n.errors=a,n}var s=_e.asn1.derToOid(t.publicKeyOid),i=_e.oids.EdDSA25519;if(s!==i)throw new Error('Invalid OID "'+s+'"; OID must be "'+i+'".');var o=t.ed25519PublicKey;if(o.length!==Z.constants.PUBLIC_KEY_BYTE_LENGTH)throw new Error("Key length is invalid.");return xt({message:o,encoding:"binary"})};Z.publicKeyFromPrivateKey=function(e){e=e||{};var t=xt({message:e.privateKey,encoding:"binary"});if(t.length!==Z.constants.PRIVATE_KEY_BYTE_LENGTH)throw new TypeError('"options.privateKey" must have a byte length of '+Z.constants.PRIVATE_KEY_BYTE_LENGTH);for(var a=new Xe(Z.constants.PUBLIC_KEY_BYTE_LENGTH),r=0;r<a.length;++r)a[r]=t[32+r];return a};Z.sign=function(e){e=e||{};var t=xt(e),a=xt({message:e.privateKey,encoding:"binary"});if(a.length===Z.constants.SEED_BYTE_LENGTH){var r=Z.generateKeyPair({seed:a});a=r.privateKey}else if(a.length!==Z.constants.PRIVATE_KEY_BYTE_LENGTH)throw new TypeError('"options.privateKey" must have a byte length of '+Z.constants.SEED_BYTE_LENGTH+" or "+Z.constants.PRIVATE_KEY_BYTE_LENGTH);var n=new Xe(Z.constants.SIGN_BYTE_LENGTH+t.length);Wl(n,t,t.length,a);for(var s=new Xe(Z.constants.SIGN_BYTE_LENGTH),i=0;i<s.length;++i)s[i]=n[i];return s};Z.verify=function(e){e=e||{};var t=xt(e);if(e.signature===void 0)throw new TypeError('"options.signature" must be a node.js Buffer, a Uint8Array, a forge ByteBuffer, or a binary string.');var a=xt({message:e.signature,encoding:"binary"});if(a.length!==Z.constants.SIGN_BYTE_LENGTH)throw new TypeError('"options.signature" must have a byte length of '+Z.constants.SIGN_BYTE_LENGTH);var r=xt({message:e.publicKey,encoding:"binary"});if(r.length!==Z.constants.PUBLIC_KEY_BYTE_LENGTH)throw new TypeError('"options.publicKey" must have a byte length of '+Z.constants.PUBLIC_KEY_BYTE_LENGTH);var n=new Xe(Z.constants.SIGN_BYTE_LENGTH+t.length),s=new Xe(Z.constants.SIGN_BYTE_LENGTH+t.length),i;for(i=0;i<Z.constants.SIGN_BYTE_LENGTH;++i)n[i]=a[i];for(i=0;i<t.length;++i)n[i+Z.constants.SIGN_BYTE_LENGTH]=t[i];return jl(s,n,n.length,r)>=0};function xt(e){var t=e.message;if(t instanceof Uint8Array||t instanceof Xe)return t;var a=e.encoding;if(t===void 0)if(e.md)t=e.md.digest().getBytes(),a="binary";else throw new TypeError('"options.message" or "options.md" not specified.');if(typeof t=="string"&&!a)throw new TypeError('"options.encoding" must be "binary" or "utf8".');if(typeof t=="string"){if(typeof Buffer<"u")return Buffer.from(t,a);t=new sn(t,a)}else if(!(t instanceof sn))throw new TypeError('"options.message" must be a node.js Buffer, a Uint8Array, a forge ByteBuffer, or a string with "options.encoding" specifying its encoding.');for(var r=new Xe(t.length()),n=0;n<r.length;++n)r[n]=t.at(n);return r}var on=H(),oa=H([1]),zl=H([30883,4953,19914,30187,55467,16705,2637,112,59544,30585,16505,36039,65139,11119,27886,20995]),Ql=H([61785,9906,39828,60374,45398,33411,5274,224,53552,61171,33010,6542,64743,22239,55772,9222]),gs=H([54554,36645,11616,51542,42930,38181,51040,26924,56412,64982,57905,49316,21502,52590,14035,8553]),ms=H([26200,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214]),Ar=new Float64Array([237,211,245,92,26,99,18,88,214,156,247,162,222,249,222,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16]),Yl=H([41136,18958,6951,50414,58488,44335,6150,12099,55207,15867,153,11085,57099,20417,9344,11139]);function Br(e,t){var a=_e.md.sha512.create(),r=new sn(e);a.update(r.getBytes(t),"binary");var n=a.digest().getBytes();if(typeof Buffer<"u")return Buffer.from(n,"binary");for(var s=new Xe(Z.constants.HASH_BYTE_LENGTH),i=0;i<64;++i)s[i]=n.charCodeAt(i);return s}function Xl(e,t){var a=[H(),H(),H(),H()],r,n=Br(t,32);for(n[0]&=248,n[31]&=127,n[31]|=64,cn(a,n),fn(e,a),r=0;r<32;++r)t[r+32]=e[r];return 0}function Wl(e,t,a,r){var n,s,i=new Float64Array(64),o=[H(),H(),H(),H()],l=Br(r,32);l[0]&=248,l[31]&=127,l[31]|=64;var u=a+64;for(n=0;n<a;++n)e[64+n]=t[n];for(n=0;n<32;++n)e[32+n]=l[32+n];var f=Br(e.subarray(32),a+32);for(un(f),cn(o,f),fn(e,o),n=32;n<64;++n)e[n]=r[n];var c=Br(e,a+64);for(un(c),n=32;n<64;++n)i[n]=0;for(n=0;n<32;++n)i[n]=f[n];for(n=0;n<32;++n)for(s=0;s<32;s++)i[n+s]+=c[n]*l[s];return Ss(e.subarray(32),i),u}function jl(e,t,a,r){var n,s,i=new Xe(32),o=[H(),H(),H(),H()],l=[H(),H(),H(),H()];if(s=-1,a<64||Zl(l,r)||!$l(t,32))return-1;for(n=0;n<a;++n)e[n]=t[n];for(n=0;n<32;++n)e[n+32]=r[n];var u=Br(e,a);if(un(u),As(o,l,u),cn(l,t.subarray(32)),ln(o,l),fn(i,o),a-=64,Ts(t,0,i,0)){for(n=0;n<a;++n)e[n]=0;return-1}for(n=0;n<a;++n)e[n]=t[n+64];return s=a,s}function $l(e,t){var a;for(a=31;a>=0;--a){if(e[t+a]<Ar[a])return!0;if(e[t+a]>Ar[a])return!1}return!1}function Ss(e,t){var a,r,n,s;for(r=63;r>=32;--r){for(a=0,n=r-32,s=r-12;n<s;++n)t[n]+=a-16*t[r]*Ar[n-(r-32)],a=t[n]+128>>8,t[n]-=a*256;t[n]+=a,t[r]=0}for(a=0,n=0;n<32;++n)t[n]+=a-(t[31]>>4)*Ar[n],a=t[n]>>8,t[n]&=255;for(n=0;n<32;++n)t[n]-=a*Ar[n];for(r=0;r<32;++r)t[r+1]+=t[r]>>8,e[r]=t[r]&255}function un(e){for(var t=new Float64Array(64),a=0;a<64;++a)t[a]=e[a],e[a]=0;Ss(e,t)}function ln(e,t){var a=H(),r=H(),n=H(),s=H(),i=H(),o=H(),l=H(),u=H(),f=H();lr(a,e[1],e[0]),lr(f,t[1],t[0]),le(a,a,f),ur(r,e[0],e[1]),ur(f,t[0],t[1]),le(r,r,f),le(n,e[3],t[3]),le(n,n,Ql),le(s,e[2],t[2]),ur(s,s,s),lr(i,r,a),lr(o,s,n),ur(l,s,n),ur(u,r,a),le(e[0],i,o),le(e[1],u,l),le(e[2],l,o),le(e[3],i,u)}function Cs(e,t,a){for(var r=0;r<4;++r)Bs(e[r],t[r],a)}function fn(e,t){var a=H(),r=H(),n=H();rf(n,t[2]),le(a,t[0],n),le(r,t[1],n),ua(e,r),e[31]^=Is(a)<<7}function ua(e,t){var a,r,n,s=H(),i=H();for(a=0;a<16;++a)i[a]=t[a];for(nn(i),nn(i),nn(i),r=0;r<2;++r){for(s[0]=i[0]-65517,a=1;a<15;++a)s[a]=i[a]-65535-(s[a-1]>>16&1),s[a-1]&=65535;s[15]=i[15]-32767-(s[14]>>16&1),n=s[15]>>16&1,s[14]&=65535,Bs(i,s,1-n)}for(a=0;a<16;a++)e[2*a]=i[a]&255,e[2*a+1]=i[a]>>8}function Zl(e,t){var a=H(),r=H(),n=H(),s=H(),i=H(),o=H(),l=H();return Dt(e[2],oa),Jl(e[1],t),Qt(n,e[1]),le(s,n,zl),lr(n,n,e[2]),ur(s,e[2],s),Qt(i,s),Qt(o,i),le(l,o,i),le(a,l,n),le(a,a,s),ef(a,a),le(a,a,n),le(a,a,s),le(a,a,s),le(e[0],a,s),Qt(r,e[0]),le(r,r,s),Es(r,n)&&le(e[0],e[0],Yl),Qt(r,e[0]),le(r,r,s),Es(r,n)?-1:(Is(e[0])===t[31]>>7&&lr(e[0],on,e[0]),le(e[3],e[0],e[1]),0)}function Jl(e,t){var a;for(a=0;a<16;++a)e[a]=t[2*a]+(t[2*a+1]<<8);e[15]&=32767}function ef(e,t){var a=H(),r;for(r=0;r<16;++r)a[r]=t[r];for(r=250;r>=0;--r)Qt(a,a),r!==1&&le(a,a,t);for(r=0;r<16;++r)e[r]=a[r]}function Es(e,t){var a=new Xe(32),r=new Xe(32);return ua(a,e),ua(r,t),Ts(a,0,r,0)}function Ts(e,t,a,r){return tf(e,t,a,r,32)}function tf(e,t,a,r,n){var s,i=0;for(s=0;s<n;++s)i|=e[t+s]^a[r+s];return(1&i-1>>>8)-1}function Is(e){var t=new Xe(32);return ua(t,e),t[0]&1}function As(e,t,a){var r,n;for(Dt(e[0],on),Dt(e[1],oa),Dt(e[2],oa),Dt(e[3],on),n=255;n>=0;--n)r=a[n/8|0]>>(n&7)&1,Cs(e,t,r),ln(t,e),ln(e,e),Cs(e,t,r)}function cn(e,t){var a=[H(),H(),H(),H()];Dt(a[0],gs),Dt(a[1],ms),Dt(a[2],oa),le(a[3],gs,ms),As(e,a,t)}function Dt(e,t){var a;for(a=0;a<16;a++)e[a]=t[a]|0}function rf(e,t){var a=H(),r;for(r=0;r<16;++r)a[r]=t[r];for(r=253;r>=0;--r)Qt(a,a),r!==2&&r!==4&&le(a,a,t);for(r=0;r<16;++r)e[r]=a[r]}function nn(e){var t,a,r=1;for(t=0;t<16;++t)a=e[t]+r+65535,r=Math.floor(a/65536),e[t]=a-r*65536;e[0]+=r-1+37*(r-1)}function Bs(e,t,a){for(var r,n=~(a-1),s=0;s<16;++s)r=n&(e[s]^t[s]),e[s]^=r,t[s]^=r}function H(e){var t,a=new Float64Array(16);if(e)for(t=0;t<e.length;++t)a[t]=e[t];return a}function ur(e,t,a){for(var r=0;r<16;++r)e[r]=t[r]+a[r]}function lr(e,t,a){for(var r=0;r<16;++r)e[r]=t[r]-a[r]}function Qt(e,t){le(e,t,t)}function le(e,t,a){var r,n,s=0,i=0,o=0,l=0,u=0,f=0,c=0,v=0,g=0,y=0,x=0,S=0,I=0,B=0,b=0,U=0,L=0,w=0,z=0,G=0,W=0,oe=0,ue=0,ee=0,xe=0,Me=0,ie=0,ye=0,K=0,Vt=0,Wt=0,ge=a[0],me=a[1],Ee=a[2],Ne=a[3],Re=a[4],we=a[5],Le=a[6],ke=a[7],De=a[8],Ue=a[9],Pe=a[10],Ve=a[11],Oe=a[12],Ke=a[13],Fe=a[14],qe=a[15];r=t[0],s+=r*ge,i+=r*me,o+=r*Ee,l+=r*Ne,u+=r*Re,f+=r*we,c+=r*Le,v+=r*ke,g+=r*De,y+=r*Ue,x+=r*Pe,S+=r*Ve,I+=r*Oe,B+=r*Ke,b+=r*Fe,U+=r*qe,r=t[1],i+=r*ge,o+=r*me,l+=r*Ee,u+=r*Ne,f+=r*Re,c+=r*we,v+=r*Le,g+=r*ke,y+=r*De,x+=r*Ue,S+=r*Pe,I+=r*Ve,B+=r*Oe,b+=r*Ke,U+=r*Fe,L+=r*qe,r=t[2],o+=r*ge,l+=r*me,u+=r*Ee,f+=r*Ne,c+=r*Re,v+=r*we,g+=r*Le,y+=r*ke,x+=r*De,S+=r*Ue,I+=r*Pe,B+=r*Ve,b+=r*Oe,U+=r*Ke,L+=r*Fe,w+=r*qe,r=t[3],l+=r*ge,u+=r*me,f+=r*Ee,c+=r*Ne,v+=r*Re,g+=r*we,y+=r*Le,x+=r*ke,S+=r*De,I+=r*Ue,B+=r*Pe,b+=r*Ve,U+=r*Oe,L+=r*Ke,w+=r*Fe,z+=r*qe,r=t[4],u+=r*ge,f+=r*me,c+=r*Ee,v+=r*Ne,g+=r*Re,y+=r*we,x+=r*Le,S+=r*ke,I+=r*De,B+=r*Ue,b+=r*Pe,U+=r*Ve,L+=r*Oe,w+=r*Ke,z+=r*Fe,G+=r*qe,r=t[5],f+=r*ge,c+=r*me,v+=r*Ee,g+=r*Ne,y+=r*Re,x+=r*we,S+=r*Le,I+=r*ke,B+=r*De,b+=r*Ue,U+=r*Pe,L+=r*Ve,w+=r*Oe,z+=r*Ke,G+=r*Fe,W+=r*qe,r=t[6],c+=r*ge,v+=r*me,g+=r*Ee,y+=r*Ne,x+=r*Re,S+=r*we,I+=r*Le,B+=r*ke,b+=r*De,U+=r*Ue,L+=r*Pe,w+=r*Ve,z+=r*Oe,G+=r*Ke,W+=r*Fe,oe+=r*qe,r=t[7],v+=r*ge,g+=r*me,y+=r*Ee,x+=r*Ne,S+=r*Re,I+=r*we,B+=r*Le,b+=r*ke,U+=r*De,L+=r*Ue,w+=r*Pe,z+=r*Ve,G+=r*Oe,W+=r*Ke,oe+=r*Fe,ue+=r*qe,r=t[8],g+=r*ge,y+=r*me,x+=r*Ee,S+=r*Ne,I+=r*Re,B+=r*we,b+=r*Le,U+=r*ke,L+=r*De,w+=r*Ue,z+=r*Pe,G+=r*Ve,W+=r*Oe,oe+=r*Ke,ue+=r*Fe,ee+=r*qe,r=t[9],y+=r*ge,x+=r*me,S+=r*Ee,I+=r*Ne,B+=r*Re,b+=r*we,U+=r*Le,L+=r*ke,w+=r*De,z+=r*Ue,G+=r*Pe,W+=r*Ve,oe+=r*Oe,ue+=r*Ke,ee+=r*Fe,xe+=r*qe,r=t[10],x+=r*ge,S+=r*me,I+=r*Ee,B+=r*Ne,b+=r*Re,U+=r*we,L+=r*Le,w+=r*ke,z+=r*De,G+=r*Ue,W+=r*Pe,oe+=r*Ve,ue+=r*Oe,ee+=r*Ke,xe+=r*Fe,Me+=r*qe,r=t[11],S+=r*ge,I+=r*me,B+=r*Ee,b+=r*Ne,U+=r*Re,L+=r*we,w+=r*Le,z+=r*ke,G+=r*De,W+=r*Ue,oe+=r*Pe,ue+=r*Ve,ee+=r*Oe,xe+=r*Ke,Me+=r*Fe,ie+=r*qe,r=t[12],I+=r*ge,B+=r*me,b+=r*Ee,U+=r*Ne,L+=r*Re,w+=r*we,z+=r*Le,G+=r*ke,W+=r*De,oe+=r*Ue,ue+=r*Pe,ee+=r*Ve,xe+=r*Oe,Me+=r*Ke,ie+=r*Fe,ye+=r*qe,r=t[13],B+=r*ge,b+=r*me,U+=r*Ee,L+=r*Ne,w+=r*Re,z+=r*we,G+=r*Le,W+=r*ke,oe+=r*De,ue+=r*Ue,ee+=r*Pe,xe+=r*Ve,Me+=r*Oe,ie+=r*Ke,ye+=r*Fe,K+=r*qe,r=t[14],b+=r*ge,U+=r*me,L+=r*Ee,w+=r*Ne,z+=r*Re,G+=r*we,W+=r*Le,oe+=r*ke,ue+=r*De,ee+=r*Ue,xe+=r*Pe,Me+=r*Ve,ie+=r*Oe,ye+=r*Ke,K+=r*Fe,Vt+=r*qe,r=t[15],U+=r*ge,L+=r*me,w+=r*Ee,z+=r*Ne,G+=r*Re,W+=r*we,oe+=r*Le,ue+=r*ke,ee+=r*De,xe+=r*Ue,Me+=r*Pe,ie+=r*Ve,ye+=r*Oe,K+=r*Ke,Vt+=r*Fe,Wt+=r*qe,s+=38*L,i+=38*w,o+=38*z,l+=38*G,u+=38*W,f+=38*oe,c+=38*ue,v+=38*ee,g+=38*xe,y+=38*Me,x+=38*ie,S+=38*ye,I+=38*K,B+=38*Vt,b+=38*Wt,n=1,r=s+n+65535,n=Math.floor(r/65536),s=r-n*65536,r=i+n+65535,n=Math.floor(r/65536),i=r-n*65536,r=o+n+65535,n=Math.floor(r/65536),o=r-n*65536,r=l+n+65535,n=Math.floor(r/65536),l=r-n*65536,r=u+n+65535,n=Math.floor(r/65536),u=r-n*65536,r=f+n+65535,n=Math.floor(r/65536),f=r-n*65536,r=c+n+65535,n=Math.floor(r/65536),c=r-n*65536,r=v+n+65535,n=Math.floor(r/65536),v=r-n*65536,r=g+n+65535,n=Math.floor(r/65536),g=r-n*65536,r=y+n+65535,n=Math.floor(r/65536),y=r-n*65536,r=x+n+65535,n=Math.floor(r/65536),x=r-n*65536,r=S+n+65535,n=Math.floor(r/65536),S=r-n*65536,r=I+n+65535,n=Math.floor(r/65536),I=r-n*65536,r=B+n+65535,n=Math.floor(r/65536),B=r-n*65536,r=b+n+65535,n=Math.floor(r/65536),b=r-n*65536,r=U+n+65535,n=Math.floor(r/65536),U=r-n*65536,s+=n-1+37*(n-1),n=1,r=s+n+65535,n=Math.floor(r/65536),s=r-n*65536,r=i+n+65535,n=Math.floor(r/65536),i=r-n*65536,r=o+n+65535,n=Math.floor(r/65536),o=r-n*65536,r=l+n+65535,n=Math.floor(r/65536),l=r-n*65536,r=u+n+65535,n=Math.floor(r/65536),u=r-n*65536,r=f+n+65535,n=Math.floor(r/65536),f=r-n*65536,r=c+n+65535,n=Math.floor(r/65536),c=r-n*65536,r=v+n+65535,n=Math.floor(r/65536),v=r-n*65536,r=g+n+65535,n=Math.floor(r/65536),g=r-n*65536,r=y+n+65535,n=Math.floor(r/65536),y=r-n*65536,r=x+n+65535,n=Math.floor(r/65536),x=r-n*65536,r=S+n+65535,n=Math.floor(r/65536),S=r-n*65536,r=I+n+65535,n=Math.floor(r/65536),I=r-n*65536,r=B+n+65535,n=Math.floor(r/65536),B=r-n*65536,r=b+n+65535,n=Math.floor(r/65536),b=r-n*65536,r=U+n+65535,n=Math.floor(r/65536),U=r-n*65536,s+=n-1+37*(n-1),e[0]=s,e[1]=i,e[2]=o,e[3]=l,e[4]=u,e[5]=f,e[6]=c,e[7]=v,e[8]=g,e[9]=y,e[10]=x,e[11]=S,e[12]=I,e[13]=B,e[14]=b,e[15]=U}});var Ls=M((Vc,ws)=>{var je=X();ne();Je();Er();ws.exports=je.kem=je.kem||{};var Ns=je.jsbn.BigInteger;je.kem.rsa={};je.kem.rsa.create=function(e,t){t=t||{};var a=t.prng||je.random,r={};return r.encrypt=function(n,s){var i=Math.ceil(n.n.bitLength()/8),o;do o=new Ns(je.util.bytesToHex(a.getBytesSync(i)),16).mod(n.n);while(o.compareTo(Ns.ONE)<=0);o=je.util.hexToBytes(o.toString(16));var l=i-o.length;l>0&&(o=je.util.fillString("\0",l)+o);var u=n.encrypt(o,"NONE"),f=e.generate(o,s);return{encapsulation:u,key:f}},r.decrypt=function(n,s,i){var o=n.decrypt(s,"NONE");return e.generate(o,i)},r};je.kem.kdf1=function(e,t){Rs(this,e,0,t||e.digestLength)};je.kem.kdf2=function(e,t){Rs(this,e,1,t||e.digestLength)};function Rs(e,t,a,r){e.generate=function(n,s){for(var i=new je.util.ByteBuffer,o=Math.ceil(s/r)+a,l=new je.util.ByteBuffer,u=a;u<o;++u){l.putInt32(u),t.start(),t.update(n+l.getBytes());var f=t.digest();i.putBytes(f.getBytes(r))}return i.truncate(i.length()-s),i.getBytes()}}});var Ps=M((Oc,Us)=>{var J=X();ne();Us.exports=J.log=J.log||{};J.log.levels=["none","error","warning","info","debug","verbose","max"];var la={},pn=[],_r=null;J.log.LEVEL_LOCKED=2;J.log.NO_LEVEL_CHECK=4;J.log.INTERPOLATE=8;for(yt=0;yt<J.log.levels.length;++yt)hn=J.log.levels[yt],la[hn]={index:yt,name:hn.toUpperCase()};var hn,yt;J.log.logMessage=function(e){for(var t=la[e.level].index,a=0;a<pn.length;++a){var r=pn[a];if(r.flags&J.log.NO_LEVEL_CHECK)r.f(e);else{var n=la[r.level].index;t<=n&&r.f(r,e)}}};J.log.prepareStandard=function(e){"standard"in e||(e.standard=la[e.level].name+" ["+e.category+"] "+e.message)};J.log.prepareFull=function(e){if(!("full"in e)){var t=[e.message];t=t.concat([]),e.full=J.util.format.apply(this,t)}};J.log.prepareStandardFull=function(e){"standardFull"in e||(J.log.prepareStandard(e),e.standardFull=e.standard)};for(dn=["error","warning","info","debug","verbose"],yt=0;yt<dn.length;++yt)(function(t){J.log[t]=function(a,r){var n=Array.prototype.slice.call(arguments).slice(2),s={timestamp:new Date,level:t,category:a,message:r,arguments:n};J.log.logMessage(s)}})(dn[yt]);var dn,yt;J.log.makeLogger=function(e){var t={flags:0,f:e};return J.log.setLevel(t,"none"),t};J.log.setLevel=function(e,t){var a=!1;if(e&&!(e.flags&J.log.LEVEL_LOCKED))for(var r=0;r<J.log.levels.length;++r){var n=J.log.levels[r];if(t==n){e.level=t,a=!0;break}}return a};J.log.lock=function(e,t){typeof t>"u"||t?e.flags|=J.log.LEVEL_LOCKED:e.flags&=~J.log.LEVEL_LOCKED};J.log.addLogger=function(e){pn.push(e)};typeof console<"u"&&"log"in console?(console.error&&console.warn&&console.info&&console.debug?(ks={error:console.error,warning:console.warn,info:console.info,debug:console.debug,verbose:console.debug},Nr=function(e,t){J.log.prepareStandard(t);var a=ks[t.level],r=[t.standard];r=r.concat(t.arguments.slice()),a.apply(console,r)},fr=J.log.makeLogger(Nr)):(Nr=function(t,a){J.log.prepareStandardFull(a),console.log(a.standardFull)},fr=J.log.makeLogger(Nr)),J.log.setLevel(fr,"debug"),J.log.addLogger(fr),_r=fr):console={log:function(){}};var fr,ks,Nr;_r!==null&&typeof window<"u"&&window.location&&(br=new URL(window.location.href).searchParams,br.has("console.level")&&J.log.setLevel(_r,br.get("console.level").slice(-1)[0]),br.has("console.lock")&&(Ds=br.get("console.lock").slice(-1)[0],Ds=="true"&&J.log.lock(_r)));var br,Ds;J.log.consoleLogger=_r});var Os=M((Kc,Vs)=>{Vs.exports=ut();Mr();ar();ba();rn()});var qs=M((Fc,Fs)=>{var D=X();Bt();st();mr();bt();Kt();qa();Je();ne();ra();var C=D.asn1,Qe=Fs.exports=D.pkcs7=D.pkcs7||{};Qe.messageFromPem=function(e){var t=D.pem.decode(e)[0];if(t.type!=="PKCS7"){var a=new Error('Could not convert PKCS#7 message from PEM; PEM header type is not "PKCS#7".');throw a.headerType=t.type,a}if(t.procType&&t.procType.type==="ENCRYPTED")throw new Error("Could not convert PKCS#7 message from PEM; PEM is encrypted.");var r=C.fromDer(t.body);return Qe.messageFromAsn1(r)};Qe.messageToPem=function(e,t){var a={type:"PKCS7",body:C.toDer(e.toAsn1()).getBytes()};return D.pem.encode(a,{maxline:t})};Qe.messageFromAsn1=function(e){var t={},a=[];if(!C.validate(e,Qe.asn1.contentInfoValidator,t,a)){var r=new Error("Cannot read PKCS#7 message. ASN.1 object is not an PKCS#7 ContentInfo.");throw r.errors=a,r}var n=C.derToOid(t.contentType),s;switch(n){case D.pki.oids.envelopedData:s=Qe.createEnvelopedData();break;case D.pki.oids.encryptedData:s=Qe.createEncryptedData();break;case D.pki.oids.signedData:s=Qe.createSignedData();break;default:throw new Error("Cannot read PKCS#7 message. ContentType with OID "+n+" is not (yet) supported.")}return s.fromAsn1(t.content.value[0]),s};Qe.createSignedData=function(){var e=null;return e={type:D.pki.oids.signedData,version:1,certificates:[],crls:[],signers:[],digestAlgorithmIdentifiers:[],contentInfo:null,signerInfos:[],fromAsn1:function(r){if(yn(e,r,Qe.asn1.signedDataValidator),e.certificates=[],e.crls=[],e.digestAlgorithmIdentifiers=[],e.contentInfo=null,e.signerInfos=[],e.rawCapture.certificates)for(var n=e.rawCapture.certificates.value,s=0;s<n.length;++s)e.certificates.push(D.pki.certificateFromAsn1(n[s]))},toAsn1:function(){e.contentInfo||e.sign();for(var r=[],n=0;n<e.certificates.length;++n)r.push(D.pki.certificateToAsn1(e.certificates[n]));var s=[],i=C.create(C.Class.CONTEXT_SPECIFIC,0,!0,[C.create(C.Class.UNIVERSAL,C.Type.SEQUENCE,!0,[C.create(C.Class.UNIVERSAL,C.Type.INTEGER,!1,C.integerToDer(e.version).getBytes()),C.create(C.Class.UNIVERSAL,C.Type.SET,!0,e.digestAlgorithmIdentifiers),e.contentInfo])]);return r.length>0&&i.value[0].value.push(C.create(C.Class.CONTEXT_SPECIFIC,0,!0,r)),s.length>0&&i.value[0].value.push(C.create(C.Class.CONTEXT_SPECIFIC,1,!0,s)),i.value[0].value.push(C.create(C.Class.UNIVERSAL,C.Type.SET,!0,e.signerInfos)),C.create(C.Class.UNIVERSAL,C.Type.SEQUENCE,!0,[C.create(C.Class.UNIVERSAL,C.Type.OID,!1,C.oidToDer(e.type).getBytes()),i])},addSigner:function(r){var n=r.issuer,s=r.serialNumber;if(r.certificate){var i=r.certificate;typeof i=="string"&&(i=D.pki.certificateFromPem(i)),n=i.issuer.attributes,s=i.serialNumber}var o=r.key;if(!o)throw new Error("Could not add PKCS#7 signer; no private key specified.");typeof o=="string"&&(o=D.pki.privateKeyFromPem(o));var l=r.digestAlgorithm||D.pki.oids.sha1;switch(l){case D.pki.oids.sha1:case D.pki.oids.sha256:case D.pki.oids.sha384:case D.pki.oids.sha512:case D.pki.oids.md5:break;default:throw new Error("Could not add PKCS#7 signer; unknown message digest algorithm: "+l)}var u=r.authenticatedAttributes||[];if(u.length>0){for(var f=!1,c=!1,v=0;v<u.length;++v){var g=u[v];if(!f&&g.type===D.pki.oids.contentType){if(f=!0,c)break;continue}if(!c&&g.type===D.pki.oids.messageDigest){if(c=!0,f)break;continue}}if(!f||!c)throw new Error("Invalid signer.authenticatedAttributes. If signer.authenticatedAttributes is specified, then it must contain at least two attributes, PKCS #9 content-type and PKCS #9 message-digest.")}e.signers.push({key:o,version:1,issuer:n,serialNumber:s,digestAlgorithm:l,signatureAlgorithm:D.pki.oids.rsaEncryption,signature:null,authenticatedAttributes:u,unauthenticatedAttributes:[]})},sign:function(r){if(r=r||{},(typeof e.content!="object"||e.contentInfo===null)&&(e.contentInfo=C.create(C.Class.UNIVERSAL,C.Type.SEQUENCE,!0,[C.create(C.Class.UNIVERSAL,C.Type.OID,!1,C.oidToDer(D.pki.oids.data).getBytes())]),"content"in e)){var n;e.content instanceof D.util.ByteBuffer?n=e.content.bytes():typeof e.content=="string"&&(n=D.util.encodeUtf8(e.content)),r.detached?e.detachedContent=C.create(C.Class.UNIVERSAL,C.Type.OCTETSTRING,!1,n):e.contentInfo.value.push(C.create(C.Class.CONTEXT_SPECIFIC,0,!0,[C.create(C.Class.UNIVERSAL,C.Type.OCTETSTRING,!1,n)]))}if(e.signers.length!==0){var s=t();a(s)}},verify:function(){throw new Error("PKCS#7 signature verification not yet implemented.")},addCertificate:function(r){typeof r=="string"&&(r=D.pki.certificateFromPem(r)),e.certificates.push(r)},addCertificateRevokationList:function(r){throw new Error("PKCS#7 CRL support not yet implemented.")}},e;function t(){for(var r={},n=0;n<e.signers.length;++n){var s=e.signers[n],i=s.digestAlgorithm;i in r||(r[i]=D.md[D.pki.oids[i]].create()),s.authenticatedAttributes.length===0?s.md=r[i]:s.md=D.md[D.pki.oids[i]].create()}e.digestAlgorithmIdentifiers=[];for(var i in r)e.digestAlgorithmIdentifiers.push(C.create(C.Class.UNIVERSAL,C.Type.SEQUENCE,!0,[C.create(C.Class.UNIVERSAL,C.Type.OID,!1,C.oidToDer(i).getBytes()),C.create(C.Class.UNIVERSAL,C.Type.NULL,!1,"")]));return r}function a(r){var n;if(e.detachedContent?n=e.detachedContent:(n=e.contentInfo.value[1],n=n.value[0]),!n)throw new Error("Could not sign PKCS#7 message; there is no content to sign.");var s=C.derToOid(e.contentInfo.value[0].value),i=C.toDer(n);i.getByte(),C.getBerValueLength(i),i=i.getBytes();for(var o in r)r[o].start().update(i);for(var l=new Date,u=0;u<e.signers.length;++u){var f=e.signers[u];if(f.authenticatedAttributes.length===0){if(s!==D.pki.oids.data)throw new Error("Invalid signer; authenticatedAttributes must be present when the ContentInfo content type is not PKCS#7 Data.")}else{f.authenticatedAttributesAsn1=C.create(C.Class.CONTEXT_SPECIFIC,0,!0,[]);for(var c=C.create(C.Class.UNIVERSAL,C.Type.SET,!0,[]),v=0;v<f.authenticatedAttributes.length;++v){var g=f.authenticatedAttributes[v];g.type===D.pki.oids.messageDigest?g.value=r[f.digestAlgorithm].digest():g.type===D.pki.oids.signingTime&&(g.value||(g.value=l)),c.value.push(vn(g)),f.authenticatedAttributesAsn1.value.push(vn(g))}i=C.toDer(c).getBytes(),f.md.start().update(i)}f.signature=f.key.sign(f.md,"RSASSA-PKCS1-V1_5")}e.signerInfos=lf(e.signers)}};Qe.createEncryptedData=function(){var e=null;return e={type:D.pki.oids.encryptedData,version:0,encryptedContent:{algorithm:D.pki.oids["aes256-CBC"]},fromAsn1:function(t){yn(e,t,Qe.asn1.encryptedDataValidator)},decrypt:function(t){t!==void 0&&(e.encryptedContent.key=t),Ks(e)}},e};Qe.createEnvelopedData=function(){var e=null;return e={type:D.pki.oids.envelopedData,version:0,recipients:[],encryptedContent:{algorithm:D.pki.oids["aes256-CBC"]},fromAsn1:function(t){var a=yn(e,t,Qe.asn1.envelopedDataValidator);e.recipients=sf(a.recipientInfos.value)},toAsn1:function(){return C.create(C.Class.UNIVERSAL,C.Type.SEQUENCE,!0,[C.create(C.Class.UNIVERSAL,C.Type.OID,!1,C.oidToDer(e.type).getBytes()),C.create(C.Class.CONTEXT_SPECIFIC,0,!0,[C.create(C.Class.UNIVERSAL,C.Type.SEQUENCE,!0,[C.create(C.Class.UNIVERSAL,C.Type.INTEGER,!1,C.integerToDer(e.version).getBytes()),C.create(C.Class.UNIVERSAL,C.Type.SET,!0,of(e.recipients)),C.create(C.Class.UNIVERSAL,C.Type.SEQUENCE,!0,ff(e.encryptedContent))])])])},findRecipient:function(t){for(var a=t.issuer.attributes,r=0;r<e.recipients.length;++r){var n=e.recipients[r],s=n.issuer;if(n.serialNumber===t.serialNumber&&s.length===a.length){for(var i=!0,o=0;o<a.length;++o)if(s[o].type!==a[o].type||s[o].value!==a[o].value){i=!1;break}if(i)return n}}return null},decrypt:function(t,a){if(e.encryptedContent.key===void 0&&t!==void 0&&a!==void 0)switch(t.encryptedContent.algorithm){case D.pki.oids.rsaEncryption:case D.pki.oids.desCBC:var r=a.decrypt(t.encryptedContent.content);e.encryptedContent.key=D.util.createBuffer(r);break;default:throw new Error("Unsupported asymmetric cipher, OID "+t.encryptedContent.algorithm)}Ks(e)},addRecipient:function(t){e.recipients.push({version:0,issuer:t.issuer.attributes,serialNumber:t.serialNumber,encryptedContent:{algorithm:D.pki.oids.rsaEncryption,key:t.publicKey}})},encrypt:function(t,a){if(e.encryptedContent.content===void 0){a=a||e.encryptedContent.algorithm,t=t||e.encryptedContent.key;var r,n,s;switch(a){case D.pki.oids["aes128-CBC"]:r=16,n=16,s=D.aes.createEncryptionCipher;break;case D.pki.oids["aes192-CBC"]:r=24,n=16,s=D.aes.createEncryptionCipher;break;case D.pki.oids["aes256-CBC"]:r=32,n=16,s=D.aes.createEncryptionCipher;break;case D.pki.oids["des-EDE3-CBC"]:r=24,n=8,s=D.des.createEncryptionCipher;break;default:throw new Error("Unsupported symmetric cipher, OID "+a)}if(t===void 0)t=D.util.createBuffer(D.random.getBytes(r));else if(t.length()!=r)throw new Error("Symmetric key has wrong length; got "+t.length()+" bytes, expected "+r+".");e.encryptedContent.algorithm=a,e.encryptedContent.key=t,e.encryptedContent.parameter=D.util.createBuffer(D.random.getBytes(n));var i=s(t);if(i.start(e.encryptedContent.parameter.copy()),i.update(e.content),!i.finish())throw new Error("Symmetric encryption failed.");e.encryptedContent.content=i.output}for(var o=0;o<e.recipients.length;++o){var l=e.recipients[o];if(l.encryptedContent.content===void 0)if(l.encryptedContent.algorithm===D.pki.oids.rsaEncryption)l.encryptedContent.content=l.encryptedContent.key.encrypt(e.encryptedContent.key.data);else throw new Error("Unsupported asymmetric cipher, OID "+l.encryptedContent.algorithm)}}},e};function af(e){var t={},a=[];if(!C.validate(e,Qe.asn1.recipientInfoValidator,t,a)){var r=new Error("Cannot read PKCS#7 RecipientInfo. ASN.1 object is not an PKCS#7 RecipientInfo.");throw r.errors=a,r}return{version:t.version.charCodeAt(0),issuer:D.pki.RDNAttributesAsArray(t.issuer),serialNumber:D.util.createBuffer(t.serial).toHex(),encryptedContent:{algorithm:C.derToOid(t.encAlgorithm),parameter:t.encParameter?t.encParameter.value:void 0,content:t.encKey}}}function nf(e){return C.create(C.Class.UNIVERSAL,C.Type.SEQUENCE,!0,[C.create(C.Class.UNIVERSAL,C.Type.INTEGER,!1,C.integerToDer(e.version).getBytes()),C.create(C.Class.UNIVERSAL,C.Type.SEQUENCE,!0,[D.pki.distinguishedNameToAsn1({attributes:e.issuer}),C.create(C.Class.UNIVERSAL,C.Type.INTEGER,!1,D.util.hexToBytes(e.serialNumber))]),C.create(C.Class.UNIVERSAL,C.Type.SEQUENCE,!0,[C.create(C.Class.UNIVERSAL,C.Type.OID,!1,C.oidToDer(e.encryptedContent.algorithm).getBytes()),C.create(C.Class.UNIVERSAL,C.Type.NULL,!1,"")]),C.create(C.Class.UNIVERSAL,C.Type.OCTETSTRING,!1,e.encryptedContent.content)])}function sf(e){for(var t=[],a=0;a<e.length;++a)t.push(af(e[a]));return t}function of(e){for(var t=[],a=0;a<e.length;++a)t.push(nf(e[a]));return t}function uf(e){var t=C.create(C.Class.UNIVERSAL,C.Type.SEQUENCE,!0,[C.create(C.Class.UNIVERSAL,C.Type.INTEGER,!1,C.integerToDer(e.version).getBytes()),C.create(C.Class.UNIVERSAL,C.Type.SEQUENCE,!0,[D.pki.distinguishedNameToAsn1({attributes:e.issuer}),C.create(C.Class.UNIVERSAL,C.Type.INTEGER,!1,D.util.hexToBytes(e.serialNumber))]),C.create(C.Class.UNIVERSAL,C.Type.SEQUENCE,!0,[C.create(C.Class.UNIVERSAL,C.Type.OID,!1,C.oidToDer(e.digestAlgorithm).getBytes()),C.create(C.Class.UNIVERSAL,C.Type.NULL,!1,"")])]);if(e.authenticatedAttributesAsn1&&t.value.push(e.authenticatedAttributesAsn1),t.value.push(C.create(C.Class.UNIVERSAL,C.Type.SEQUENCE,!0,[C.create(C.Class.UNIVERSAL,C.Type.OID,!1,C.oidToDer(e.signatureAlgorithm).getBytes()),C.create(C.Class.UNIVERSAL,C.Type.NULL,!1,"")])),t.value.push(C.create(C.Class.UNIVERSAL,C.Type.OCTETSTRING,!1,e.signature)),e.unauthenticatedAttributes.length>0){for(var a=C.create(C.Class.CONTEXT_SPECIFIC,1,!0,[]),r=0;r<e.unauthenticatedAttributes.length;++r){var n=e.unauthenticatedAttributes[r];a.values.push(vn(n))}t.value.push(a)}return t}function lf(e){for(var t=[],a=0;a<e.length;++a)t.push(uf(e[a]));return t}function vn(e){var t;if(e.type===D.pki.oids.contentType)t=C.create(C.Class.UNIVERSAL,C.Type.OID,!1,C.oidToDer(e.value).getBytes());else if(e.type===D.pki.oids.messageDigest)t=C.create(C.Class.UNIVERSAL,C.Type.OCTETSTRING,!1,e.value.bytes());else if(e.type===D.pki.oids.signingTime){var a=new Date("1950-01-01T00:00:00Z"),r=new Date("2050-01-01T00:00:00Z"),n=e.value;if(typeof n=="string"){var s=Date.parse(n);isNaN(s)?n.length===13?n=C.utcTimeToDate(n):n=C.generalizedTimeToDate(n):n=new Date(s)}n>=a&&n<r?t=C.create(C.Class.UNIVERSAL,C.Type.UTCTIME,!1,C.dateToUtcTime(n)):t=C.create(C.Class.UNIVERSAL,C.Type.GENERALIZEDTIME,!1,C.dateToGeneralizedTime(n))}return C.create(C.Class.UNIVERSAL,C.Type.SEQUENCE,!0,[C.create(C.Class.UNIVERSAL,C.Type.OID,!1,C.oidToDer(e.type).getBytes()),C.create(C.Class.UNIVERSAL,C.Type.SET,!0,[t])])}function ff(e){return[C.create(C.Class.UNIVERSAL,C.Type.OID,!1,C.oidToDer(D.pki.oids.data).getBytes()),C.create(C.Class.UNIVERSAL,C.Type.SEQUENCE,!0,[C.create(C.Class.UNIVERSAL,C.Type.OID,!1,C.oidToDer(e.algorithm).getBytes()),e.parameter?C.create(C.Class.UNIVERSAL,C.Type.OCTETSTRING,!1,e.parameter.getBytes()):void 0]),C.create(C.Class.CONTEXT_SPECIFIC,0,!0,[C.create(C.Class.UNIVERSAL,C.Type.OCTETSTRING,!1,e.content.getBytes())])]}function yn(e,t,a){var r={},n=[];if(!C.validate(t,a,r,n)){var s=new Error("Cannot read PKCS#7 message. ASN.1 object is not a supported PKCS#7 message.");throw s.errors=s,s}var i=C.derToOid(r.contentType);if(i!==D.pki.oids.data)throw new Error("Unsupported PKCS#7 message. Only wrapped ContentType Data supported.");if(r.encryptedContent){var o="";if(D.util.isArray(r.encryptedContent))for(var l=0;l<r.encryptedContent.length;++l){if(r.encryptedContent[l].type!==C.Type.OCTETSTRING)throw new Error("Malformed PKCS#7 message, expecting encrypted content constructed of only OCTET STRING objects.");o+=r.encryptedContent[l].value}else o=r.encryptedContent;e.encryptedContent={algorithm:C.derToOid(r.encAlgorithm),parameter:D.util.createBuffer(r.encParameter.value),content:D.util.createBuffer(o)}}if(r.content){var o="";if(D.util.isArray(r.content))for(var l=0;l<r.content.length;++l){if(r.content[l].type!==C.Type.OCTETSTRING)throw new Error("Malformed PKCS#7 message, expecting content constructed of only OCTET STRING objects.");o+=r.content[l].value}else o=r.content;e.content=D.util.createBuffer(o)}return e.version=r.version.charCodeAt(0),e.rawCapture=r,r}function Ks(e){if(e.encryptedContent.key===void 0)throw new Error("Symmetric key not available.");if(e.content===void 0){var t;switch(e.encryptedContent.algorithm){case D.pki.oids["aes128-CBC"]:case D.pki.oids["aes192-CBC"]:case D.pki.oids["aes256-CBC"]:t=D.aes.createDecryptionCipher(e.encryptedContent.key);break;case D.pki.oids.desCBC:case D.pki.oids["des-EDE3-CBC"]:t=D.des.createDecryptionCipher(e.encryptedContent.key);break;default:throw new Error("Unsupported symmetric cipher, OID "+e.encryptedContent.algorithm)}if(t.start(e.encryptedContent.parameter),t.update(e.encryptedContent.content),!t.finish())throw new Error("Symmetric decryption failed.");e.content=t.output}}});var Hs=M((qc,Ms)=>{var Ce=X();Bt();Jt();Mr();ar();ne();var ca=Ms.exports=Ce.ssh=Ce.ssh||{};ca.privateKeyToPutty=function(e,t,a){a=a||"",t=t||"";var r="ssh-rsa",n=t===""?"none":"aes256-cbc",s="PuTTY-User-Key-File-2: "+r+`\r
15
15
  `;s+="Encryption: "+n+`\r
16
16
  `,s+="Comment: "+a+`\r
17
17
  `;var i=Ce.util.createBuffer();cr(i,r),gt(i,e.e),gt(i,e.n);var o=Ce.util.encode64(i.bytes(),64),l=Math.floor(o.length/66)+1;s+="Public-Lines: "+l+`\r
@@ -19,9 +19,9 @@ var M=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var Wt=M(($f,Tn)=>
19
19
  Private-Lines: `+l+`\r
20
20
  `,s+=f;var S=fa("putty-private-key-file-mac-key",t),I=Ce.util.createBuffer();cr(I,r),cr(I,n),cr(I,a),I.putInt32(i.length()),I.putBuffer(i),I.putInt32(u.length()),I.putBuffer(u);var B=Ce.hmac.create();return B.start("sha1",S),B.update(I.bytes()),s+=`\r
21
21
  Private-MAC: `+B.digest().toHex()+`\r
22
- `,s};ca.publicKeyToOpenSSH=function(e,t){var a="ssh-rsa";t=t||"";var r=Ce.util.createBuffer();return cr(r,a),gt(r,e.e),gt(r,e.n),a+" "+Ce.util.encode64(r.bytes())+" "+t};ca.privateKeyToOpenSSH=function(e,t){return t?Ce.pki.encryptRsaPrivateKey(e,t,{legacy:!0,algorithm:"aes128"}):Ce.pki.privateKeyToPem(e)};ca.getPublicKeyFingerprint=function(e,t){t=t||{};var a=t.md||Ce.md.md5.create(),r="ssh-rsa",n=Ce.util.createBuffer();cr(n,r),gt(n,e.e),gt(n,e.n),a.start(),a.update(n.getBytes());var s=a.digest();if(t.encoding==="hex"){var i=s.toHex();return t.delimiter?i.match(/.{2}/g).join(t.delimiter):i}else{if(t.encoding==="binary")return s.getBytes();if(t.encoding)throw new Error('Unknown encoding "'+t.encoding+'".')}return s};function gt(e,t){var a=t.toString(16);a[0]>="8"&&(a="00"+a);var r=Ce.util.hexToBytes(a);e.putInt32(r.length),e.putBytes(r)}function cr(e,t){e.putInt32(t.length),e.putString(t)}function fa(){for(var e=Ce.md.sha1.create(),t=arguments.length,a=0;a<t;++a)e.update(arguments[a]);return e.digest()}});var Gs=M((qc,Hs)=>{Hs.exports=X();Bt();ls();st();Ur();mr();bs();Jt();ws();Us();Vs();Ma();Qr();Kt();Pa();za();Fs();Ya();Oa();_a();Jr();Je();wa();Ms();Ja();ne()});var Xs=M((Mc,Ys)=>{var zs=require("path"),$e=require("fs"),Ze=Gs(),{MITM_DIR:ha}=kr(),Ut=zs.join(ha,"rootCA.key"),St=zs.join(ha,"rootCA.crt");function Qs(e){try{let t=Ze.pki.certificateFromPem($e.readFileSync(e,"utf8")),a=new Date(Date.now()+720*60*60*1e3);return t.validity.notAfter<a}catch{return!0}}async function lf(){let e=$e.existsSync(Ut)&&$e.existsSync(St);if(e&&!Qs(St))return console.log("\u2705 Root CA already exists"),{key:Ut,cert:St};if(e){console.log("\u{1F510} Root CA expired or expiring soon \u2014 regenerating...");try{$e.unlinkSync(Ut)}catch{}try{$e.unlinkSync(St)}catch{}}$e.existsSync(ha)||$e.mkdirSync(ha,{recursive:!0}),console.log("\u{1F510} Generating Root CA certificate...");let t=Ze.pki.rsa.generateKeyPair(2048),a=Ze.pki.createCertificate();a.publicKey=t.publicKey,a.serialNumber="01",a.validity.notBefore=new Date,a.validity.notAfter=new Date,a.validity.notAfter.setFullYear(a.validity.notBefore.getFullYear()+10);let r=[{name:"commonName",value:"9Router MITM Root CA"},{name:"organizationName",value:"9Router"},{name:"countryName",value:"US"}];a.setSubject(r),a.setIssuer(r),a.setExtensions([{name:"basicConstraints",cA:!0,critical:!0},{name:"keyUsage",keyCertSign:!0,cRLSign:!0,critical:!0},{name:"subjectKeyIdentifier"}]),a.sign(t.privateKey,Ze.md.sha256.create());let n=Ze.pki.privateKeyToPem(t.privateKey),s=Ze.pki.certificateToPem(a);return $e.writeFileSync(Ut,n),$e.writeFileSync(St,s),console.log("\u2705 Root CA generated successfully"),{key:Ut,cert:St}}function ff(){if(!$e.existsSync(Ut)||!$e.existsSync(St))throw new Error("Root CA not found. Generate it first.");let e=$e.readFileSync(Ut,"utf8"),t=$e.readFileSync(St,"utf8");return{key:Ze.pki.privateKeyFromPem(e),cert:Ze.pki.certificateFromPem(t)}}function cf(e,t){let a=Ze.pki.rsa.generateKeyPair(2048),r=Ze.pki.createCertificate();return r.publicKey=a.publicKey,r.serialNumber=Math.floor(Math.random()*1e6).toString(),r.validity.notBefore=new Date,r.validity.notAfter=new Date,r.validity.notAfter.setFullYear(r.validity.notBefore.getFullYear()+1),r.setSubject([{name:"commonName",value:e}]),r.setIssuer(t.cert.subject.attributes),r.setExtensions([{name:"basicConstraints",cA:!1},{name:"keyUsage",digitalSignature:!0,keyEncipherment:!0},{name:"extKeyUsage",serverAuth:!0,clientAuth:!0},{name:"subjectAltName",altNames:[{type:2,value:e},{type:2,value:`*.${e}`}]}]),r.sign(t.key,Ze.md.sha256.create()),{key:Ze.pki.privateKeyToPem(a.privateKey),cert:Ze.pki.certificateToPem(r)}}Ys.exports={generateRootCA:lf,loadRootCA:ff,generateLeafCert:cf,isCertExpired:Qs,ROOT_CA_CERT_PATH:St,ROOT_CA_KEY_PATH:Ut}});var Ws=M((Qc,js)=>{var Hc=require("path"),Gc=require("fs"),{MITM_DIR:zc}=kr(),{generateRootCA:hf,loadRootCA:df,generateLeafCert:pf}=Xs();async function vf(){return await hf()}function yf(e){try{let t=df(),a=pf(e,t);return{key:a.key,cert:a.cert}}catch(t){return console.error(`Failed to generate cert for ${e}:`,t.message),null}}js.exports={generateCert:vf,getCertForDomain:yf}});var da=M((jc,Js)=>{var{log:Yc,err:Xc}=Wt(),$s="http://localhost:20128",gf=String(process.env.MITM_ROUTER_BASE||$s).trim().replace(/\/+$/,"")||$s,Zs=process.env.ROUTER_API_KEY,mf=new Set(["host","content-length","connection","transfer-encoding","content-type","authorization"]);async function Cf(e,t="/v1/chat/completions",a={}){let r={};for(let[s,i]of Object.entries(a))mf.has(s.toLowerCase())||(r[s]=i);let n=await fetch(`${gf}${t}`,{method:"POST",headers:{...r,"Content-Type":"application/json",...Zs&&{Authorization:`Bearer ${Zs}`}},body:JSON.stringify(e)});if(!n.ok){let s=await n.text().catch(()=>"");throw new Error(`[${n.status}]: ${s}`)}return n}async function Ef(e,t){let a=e.headers.get("content-type")||"application/json",r={"Content-Type":a,"Cache-Control":"no-cache",Connection:"keep-alive"};if(a.includes("text/event-stream")&&(r["X-Accel-Buffering"]="no"),t.writeHead(200,r),!e.body){t.end(await e.text().catch(()=>""));return}let n=e.body.getReader(),s=new TextDecoder;for(;;){let{done:i,value:o}=await n.read();if(i){t.end();break}t.write(s.decode(o,{stream:!0}))}}Js.exports={fetchRouter:Cf,pipeSSE:Ef}});var to=M((Wc,eo)=>{var{err:xf}=Wt(),{fetchRouter:Sf,pipeSSE:Tf}=da();async function If(e,t,a,r){try{let n=JSON.parse(a.toString());n.model=r;let s=await Sf(n,"/v1/chat/completions",e.headers);await Tf(s,t)}catch(n){xf(`[antigravity] ${n.message}`),t.headersSent||t.writeHead(500,{"Content-Type":"application/json"}),t.end(JSON.stringify({error:{message:n.message,type:"mitm_error"}}))}}eo.exports={intercept:If}});var ao=M(($c,ro)=>{var{err:Af}=Wt(),{fetchRouter:Bf,pipeSSE:bf}=da(),_f={"/chat/completions":"/v1/chat/completions","/v1/messages":"/v1/messages","/responses":"/v1/responses"};function Nf(e){for(let[t,a]of Object.entries(_f))if(e.includes(t))return a;return"/v1/chat/completions"}async function Rf(e,t,a,r){try{let n=JSON.parse(a.toString());n.model=r;let s=Nf(e.url),i=await Bf(n,s,e.headers);await bf(i,t)}catch(n){Af(`[copilot] ${n.message}`),t.headersSent||t.writeHead(500,{"Content-Type":"application/json"}),t.end(JSON.stringify({error:{message:n.message,type:"mitm_error"}}))}}ro.exports={intercept:Rf}});var oo=M((Zc,so)=>{var no=require("zlib"),{log:Rr,err:io}=Wt(),{fetchRouter:wf}=da();function Lf(e){return typeof e!="string"?!1:e.includes("<identity>")||e.includes("You are an intent classifier")}function kf(e,t){let a=e.conversationState||{},r=a.history||[],n=a.currentMessage?.userInputMessage,s=[],i=!1;for(let u of r)if(u.userInputMessage){let f=u.userInputMessage,c=(f.content||"").trim(),v=f.userInputMessageContext?.toolResults;if(!i&&Lf(c)){if(s.push({role:"system",content:c}),i=!0,v?.length>0)for(let g of v)s.push({role:"tool",tool_call_id:g.toolUseId,content:g.content?.map(y=>y.text).join(`
22
+ `,s};ca.publicKeyToOpenSSH=function(e,t){var a="ssh-rsa";t=t||"";var r=Ce.util.createBuffer();return cr(r,a),gt(r,e.e),gt(r,e.n),a+" "+Ce.util.encode64(r.bytes())+" "+t};ca.privateKeyToOpenSSH=function(e,t){return t?Ce.pki.encryptRsaPrivateKey(e,t,{legacy:!0,algorithm:"aes128"}):Ce.pki.privateKeyToPem(e)};ca.getPublicKeyFingerprint=function(e,t){t=t||{};var a=t.md||Ce.md.md5.create(),r="ssh-rsa",n=Ce.util.createBuffer();cr(n,r),gt(n,e.e),gt(n,e.n),a.start(),a.update(n.getBytes());var s=a.digest();if(t.encoding==="hex"){var i=s.toHex();return t.delimiter?i.match(/.{2}/g).join(t.delimiter):i}else{if(t.encoding==="binary")return s.getBytes();if(t.encoding)throw new Error('Unknown encoding "'+t.encoding+'".')}return s};function gt(e,t){var a=t.toString(16);a[0]>="8"&&(a="00"+a);var r=Ce.util.hexToBytes(a);e.putInt32(r.length),e.putBytes(r)}function cr(e,t){e.putInt32(t.length),e.putString(t)}function fa(){for(var e=Ce.md.sha1.create(),t=arguments.length,a=0;a<t;++a)e.update(arguments[a]);return e.digest()}});var zs=M((Mc,Gs)=>{Gs.exports=X();Bt();fs();st();Ur();mr();_s();Jt();Ls();Ps();Os();Ma();Qr();Kt();Pa();za();qs();Ya();Oa();_a();Jr();Je();wa();Hs();Ja();ne()});var Ws=M((Hc,Xs)=>{var Qs=require("path"),$e=require("fs"),Ze=zs(),{MITM_DIR:ha}=kr(),Ut=Qs.join(ha,"rootCA.key"),St=Qs.join(ha,"rootCA.crt");function Ys(e){try{let t=Ze.pki.certificateFromPem($e.readFileSync(e,"utf8")),a=new Date(Date.now()+720*60*60*1e3);return t.validity.notAfter<a}catch{return!0}}async function cf(){let e=$e.existsSync(Ut)&&$e.existsSync(St);if(e&&!Ys(St))return console.log("\u2705 Root CA already exists"),{key:Ut,cert:St};if(e){console.log("\u{1F510} Root CA expired or expiring soon \u2014 regenerating...");try{$e.unlinkSync(Ut)}catch{}try{$e.unlinkSync(St)}catch{}}$e.existsSync(ha)||$e.mkdirSync(ha,{recursive:!0}),console.log("\u{1F510} Generating Root CA certificate...");let t=Ze.pki.rsa.generateKeyPair(2048),a=Ze.pki.createCertificate();a.publicKey=t.publicKey,a.serialNumber="01",a.validity.notBefore=new Date,a.validity.notAfter=new Date,a.validity.notAfter.setFullYear(a.validity.notBefore.getFullYear()+10);let r=[{name:"commonName",value:"9Router MITM Root CA"},{name:"organizationName",value:"9Router"},{name:"countryName",value:"US"}];a.setSubject(r),a.setIssuer(r),a.setExtensions([{name:"basicConstraints",cA:!0,critical:!0},{name:"keyUsage",keyCertSign:!0,cRLSign:!0,critical:!0},{name:"subjectKeyIdentifier"}]),a.sign(t.privateKey,Ze.md.sha256.create());let n=Ze.pki.privateKeyToPem(t.privateKey),s=Ze.pki.certificateToPem(a);return $e.writeFileSync(Ut,n),$e.writeFileSync(St,s),console.log("\u2705 Root CA generated successfully"),{key:Ut,cert:St}}function hf(){if(!$e.existsSync(Ut)||!$e.existsSync(St))throw new Error("Root CA not found. Generate it first.");let e=$e.readFileSync(Ut,"utf8"),t=$e.readFileSync(St,"utf8");return{key:Ze.pki.privateKeyFromPem(e),cert:Ze.pki.certificateFromPem(t)}}function df(e,t){let a=Ze.pki.rsa.generateKeyPair(2048),r=Ze.pki.createCertificate();return r.publicKey=a.publicKey,r.serialNumber=Math.floor(Math.random()*1e6).toString(),r.validity.notBefore=new Date,r.validity.notAfter=new Date,r.validity.notAfter.setFullYear(r.validity.notBefore.getFullYear()+1),r.setSubject([{name:"commonName",value:e}]),r.setIssuer(t.cert.subject.attributes),r.setExtensions([{name:"basicConstraints",cA:!1},{name:"keyUsage",digitalSignature:!0,keyEncipherment:!0},{name:"extKeyUsage",serverAuth:!0,clientAuth:!0},{name:"subjectAltName",altNames:[{type:2,value:e},{type:2,value:`*.${e}`}]}]),r.sign(t.key,Ze.md.sha256.create()),{key:Ze.pki.privateKeyToPem(a.privateKey),cert:Ze.pki.certificateToPem(r)}}Xs.exports={generateRootCA:cf,loadRootCA:hf,generateLeafCert:df,isCertExpired:Ys,ROOT_CA_CERT_PATH:St,ROOT_CA_KEY_PATH:Ut}});var $s=M((Yc,js)=>{var Gc=require("path"),zc=require("fs"),{MITM_DIR:Qc}=kr(),{generateRootCA:pf,loadRootCA:vf,generateLeafCert:yf}=Ws();async function gf(){return await pf()}function mf(e){try{let t=vf(),a=yf(e,t);return{key:a.key,cert:a.cert}}catch(t){return console.error(`Failed to generate cert for ${e}:`,t.message),null}}js.exports={generateCert:gf,getCertForDomain:mf}});var da=M((jc,eo)=>{var{log:Xc,err:Wc}=jt(),Zs="http://localhost:20128",Cf=String(process.env.MITM_ROUTER_BASE||Zs).trim().replace(/\/+$/,"")||Zs,Js=process.env.ROUTER_API_KEY,Ef=new Set(["host","content-length","connection","transfer-encoding","content-type","authorization"]);async function xf(e,t="/v1/chat/completions",a={}){let r={};for(let[s,i]of Object.entries(a))Ef.has(s.toLowerCase())||(r[s]=i);let n=await fetch(`${Cf}${t}`,{method:"POST",headers:{...r,"Content-Type":"application/json",...Js&&{Authorization:`Bearer ${Js}`}},body:JSON.stringify(e)});if(!n.ok){let s=await n.text().catch(()=>"");throw new Error(`[${n.status}]: ${s}`)}return n}async function Sf(e,t){let a=e.headers.get("content-type")||"application/json",r={"Content-Type":a,"Cache-Control":"no-cache",Connection:"keep-alive"};if(a.includes("text/event-stream")&&(r["X-Accel-Buffering"]="no"),t.writeHead(200,r),!e.body){t.end(await e.text().catch(()=>""));return}let n=e.body.getReader(),s=new TextDecoder;for(;;){let{done:i,value:o}=await n.read();if(i){t.end();break}t.write(s.decode(o,{stream:!0}))}}eo.exports={fetchRouter:xf,pipeSSE:Sf}});var ro=M(($c,to)=>{var{err:Tf}=jt(),{fetchRouter:If,pipeSSE:Af}=da();async function Bf(e,t,a,r){try{let n=JSON.parse(a.toString());n.model=r;let s=await If(n,"/v1/chat/completions",e.headers);await Af(s,t)}catch(n){Tf(`[antigravity] ${n.message}`),t.headersSent||t.writeHead(500,{"Content-Type":"application/json"}),t.end(JSON.stringify({error:{message:n.message,type:"mitm_error"}}))}}to.exports={intercept:Bf}});var no=M((Zc,ao)=>{var{err:bf}=jt(),{fetchRouter:_f,pipeSSE:Nf}=da(),Rf={"/chat/completions":"/v1/chat/completions","/v1/messages":"/v1/messages","/responses":"/v1/responses"};function wf(e){for(let[t,a]of Object.entries(Rf))if(e.includes(t))return a;return"/v1/chat/completions"}async function Lf(e,t,a,r){try{let n=JSON.parse(a.toString());n.model=r;let s=wf(e.url),i=await _f(n,s,e.headers);await Nf(i,t)}catch(n){bf(`[copilot] ${n.message}`),t.headersSent||t.writeHead(500,{"Content-Type":"application/json"}),t.end(JSON.stringify({error:{message:n.message,type:"mitm_error"}}))}}ao.exports={intercept:Lf}});var uo=M((Jc,oo)=>{var io=require("zlib"),{log:Rr,err:so}=jt(),{fetchRouter:kf}=da();function Df(e){return typeof e!="string"?!1:e.includes("<identity>")||e.includes("You are an intent classifier")}function Uf(e,t){let a=e.conversationState||{},r=a.history||[],n=a.currentMessage?.userInputMessage,s=[],i=!1;for(let u of r)if(u.userInputMessage){let f=u.userInputMessage,c=(f.content||"").trim(),v=f.userInputMessageContext?.toolResults;if(!i&&Df(c)){if(s.push({role:"system",content:c}),i=!0,v?.length>0)for(let g of v)s.push({role:"tool",tool_call_id:g.toolUseId,content:g.content?.map(y=>y.text).join(`
23
23
  `)||""});continue}if(v?.length>0)for(let g of v)s.push({role:"tool",tool_call_id:g.toolUseId,content:g.content?.map(y=>y.text).join(`
24
24
  `)||""});c&&s.push({role:"user",content:c})}else if(u.assistantResponseMessage){let f=u.assistantResponseMessage,c={role:"assistant",content:f.content||""};f.toolUses?.length>0&&(c.tool_calls=f.toolUses.map(v=>({id:v.toolUseId,type:"function",function:{name:v.name,arguments:JSON.stringify(v.input||{})}}))),s.push(c)}if(n){let u=n.userInputMessageContext?.toolResults;if(u?.length>0)for(let c of u)s.push({role:"tool",tool_call_id:c.toolUseId,content:c.content?.map(v=>v.text).join(`
25
- `)||""});let f=(n.content||"").trim();f&&s.push({role:"user",content:f})}let o={model:t,messages:s,stream:!0,stream_options:{include_usage:!0}},l=n?.userInputMessageContext?.tools;return l?.length>0&&(o.tools=l.map(u=>({type:"function",function:{name:u.toolSpecification.name,description:u.toolSpecification.description||u.toolSpecification.name,parameters:u.toolSpecification.inputSchema?.json||{type:"object",properties:{}}}}))),o}function Yt(e,t){let a=Buffer.from(JSON.stringify(t),"utf8"),r=[[":event-type",e],[":content-type","application/json"],[":message-type","event"]],n=[];for(let[c,v]of r){let g=Buffer.from(c,"utf8"),y=Buffer.from(v,"utf8"),x=Buffer.alloc(1+g.length+1+2+y.length),S=0;x[S++]=g.length,g.copy(x,S),S+=g.length,x[S++]=7,x.writeUInt16BE(y.length,S),S+=2,y.copy(x,S),n.push(x)}let s=Buffer.concat(n),i=12+s.length+a.length+4,o=Buffer.alloc(i),l=0;o.writeUInt32BE(i,l),l+=4,o.writeUInt32BE(s.length,l),l+=4;let u=no.crc32(o.slice(0,8));o.writeUInt32BE(u,l),l+=4,s.copy(o,l),l+=s.length,a.copy(o,l),l+=a.length;let f=no.crc32(o.slice(0,i-4));return o.writeUInt32BE(f,l),o}async function Df(e,t,a,r,n){try{let s=JSON.parse(a.toString()),i=s.conversationState?.conversationId||"unknown";Rr(`\u{1F537} [KIRO] intercept | conversationId=${i} | model=${r}`);let o=kf(s,r);if(Rr(`\u{1F537} [KIRO] converted | messages=${o.messages.length} | tools=${o.tools?.length||0}`),o.tools?.length&&Rr(`\u{1F537} [KIRO] tools: ${o.tools.map(x=>x.function.name).join(", ")}`),!o.messages.length)return io("[KIRO] No messages after conversion \u2014 passthrough"),n(e,t,a);let l=await wf(o,"/v1/chat/completions",e.headers);t.writeHead(200,{"Content-Type":"application/vnd.amazon.eventstream","Cache-Control":"no-cache",Connection:"keep-alive","Transfer-Encoding":"chunked","x-amzn-RequestId":e.headers["amz-sdk-invocation-id"]||i,"x-amzn-codewhisperer-conversation-id":i,"X-XSS-Protection":"1; mode=block","X-Frame-Options":"DENY","X-Content-Type-Options":"nosniff"});let u=l.body.getReader(),f=new TextDecoder,c="",v=!1,g={},y=null;for(;;){let{done:x,value:S}=await u.read();if(x)break;c+=f.decode(S,{stream:!0});let I=c.split(`
26
- `);c=I.pop();for(let B of I){if(!B.startsWith("data: "))continue;let b=B.slice(6).trim();if(b==="[DONE]")continue;let U;try{U=JSON.parse(b)}catch{continue}U.usage&&(y=U.usage);let L=U.choices?.[0];if(!L)continue;let w=L.delta||{},z=L.finish_reason;if(w.content&&t.write(Yt("assistantResponseEvent",{content:w.content,modelId:r})),w.tool_calls){v=!0;for(let G of w.tool_calls){let j=G.index??0;g[j]||(g[j]={id:"",name:"",args:""}),G.id&&(g[j].id=G.id),G.function?.name&&(g[j].name=G.function.name),G.function?.arguments&&(g[j].args+=G.function.arguments)}}if(z){if(v){for(let ee of Object.values(g)){Rr(`\u{1F537} [KIRO] toolUseEvent | id=${ee.id} name=${ee.name}`),t.write(Yt("toolUseEvent",{name:ee.name,toolUseId:ee.id}));let xe=ee.args||"{}",Me=32;for(let ie=0;ie<xe.length;ie+=Me)t.write(Yt("toolUseEvent",{input:xe.slice(ie,ie+Me),name:ee.name,toolUseId:ee.id}));t.write(Yt("toolUseEvent",{name:ee.name,stop:!0,toolUseId:ee.id}))}t.write(Yt("assistantResponseEvent",{content:"",modelId:r}))}let G=y?.prompt_tokens||0,j=y?.total_tokens||0,oe=G>0?G/2e5*100:1.5,ue=j>0?j*4e-6:.001;t.write(Yt("contextUsageEvent",{contextUsagePercentage:oe})),t.write(Yt("meteringEvent",{unit:"credit",unitPlural:"credits",usage:ue})),Rr(`\u{1F537} [KIRO] done | finishReason=${z} hasToolCalls=${v}`)}}}t.end()}catch(s){io(`[KIRO] ${s.message}`),t.headersSent||t.writeHead(500,{"Content-Type":"application/json"}),t.end(JSON.stringify({error:{message:s.message,type:"mitm_error"}}))}}so.exports={intercept:Df}});var ho=require("https"),Xt=require("fs"),wr=require("path"),Uf=require("dns"),{promisify:Pf}=require("util"),{execSync:Vf}=require("child_process"),{log:Pt,err:Tt}=Wt(),{TARGET_HOSTS:Of,URL_PATTERNS:Kf,getToolForHost:Ff}=An(),{DATA_DIR:po,MITM_DIR:uo}=kr(),{getCertForDomain:qf}=Ws(),lo=wr.join(po,"db.json"),dr=443,vo=!1,Cn=wr.join(po,"logs","mitm"),fo={name:"x-request-source",value:"local"};vo&&!Xt.existsSync(Cn)&&Xt.mkdirSync(Cn,{recursive:!0});var co={antigravity:to(),copilot:ao(),kiro:oo()},gn=new Map;function Mf(e,t){try{if(gn.has(e))return t(null,gn.get(e));let a=qf(e);if(!a)return t(new Error(`Failed to generate cert for ${e}`));let r=require("tls").createSecureContext({key:a.key,cert:a.cert});gn.set(e,r),Pt(`\u{1F510} Cert generated: ${e}`),t(null,r)}catch(a){Tt(`SNI error for ${e}: ${a.message}`),t(a)}}var yo;try{yo={key:Xt.readFileSync(wr.join(uo,"rootCA.key")),cert:Xt.readFileSync(wr.join(uo,"rootCA.crt")),SNICallback:Mf}}catch(e){Tt(`Root CA not found: ${e.message}`),process.exit(1)}var mn={},Hf=300*1e3;async function Gf(e){let t=mn[e];if(t&&Date.now()-t.ts<Hf)return t.ip;let a=new Uf.Resolver;a.setServers(["8.8.8.8"]);let n=await Pf(a.resolve4.bind(a))(e);return mn[e]={ip:n[0],ts:Date.now()},mn[e].ip}function zf(e){return new Promise((t,a)=>{let r=[];e.on("data",n=>r.push(n)),e.on("end",()=>t(Buffer.concat(r))),e.on("error",a)})}function Qf(e,t){let a=e.match(/\/models\/([^/:]+)/);if(a)return a[1];try{let r=JSON.parse(t.toString());return r.conversationState?r.conversationState.currentMessage?.userInputMessage?.modelId||null:r.model||null}catch{return null}}function Yf(e,t){if(!t)return null;try{if(!Xt.existsSync(lo))return null;let r=JSON.parse(Xt.readFileSync(lo,"utf-8")).mitmAlias?.[e];if(!r)return null;if(r[t])return r[t];let n=Object.keys(r).find(s=>s&&r[s]&&(t.startsWith(s)||s.startsWith(t)));return n?r[n]:null}catch{return null}}function Xf(e,t){if(vo)try{let a=new Date().toISOString().replace(/[:.]/g,"-"),r=e.replace(/[^a-zA-Z0-9]/g,"_").substring(0,60),n=JSON.parse(t.toString());Xt.writeFileSync(wr.join(Cn,`${a}_${r}.json`),JSON.stringify(n,null,2))}catch{}}async function hr(e,t,a,r){let n=(e.headers.host||Of[0]).split(":")[0],s=await Gf(n),i=ho.request({hostname:s,port:443,path:e.url,method:e.method,headers:{...e.headers,host:n},servername:n,rejectUnauthorized:!1},o=>{if(t.writeHead(o.statusCode,o.headers),!r){o.pipe(t);return}let l=[];o.on("data",u=>{l.push(u),t.write(u)}),o.on("end",()=>{t.end();try{r(Buffer.concat(l),o.headers)}catch{}})});i.on("error",o=>{Tt(`Passthrough error: ${o.message}`),t.headersSent||t.writeHead(502),t.end("Bad Gateway")}),a.length>0&&i.write(a),i.end()}var En=ho.createServer(yo,async(e,t)=>{try{if(e.url==="/_mitm_health"){t.writeHead(200,{"Content-Type":"application/json"}),t.end(JSON.stringify({ok:!0,pid:process.pid}));return}let a=await zf(e);if(a.length>0&&Xf(e.url,a),e.headers[fo.name]===fo.value)return hr(e,t,a);let r=Ff(e.headers.host);if(!r||!(Kf[r]||[]).some(l=>e.url.includes(l)))return hr(e,t,a);if(Pt(`\u{1F50D} [${r}] url=${e.url} | bodyLen=${a.length}`),r==="cursor")return Pt("\u26A1 intercept | cursor | proto"),co[r].intercept(e,t,a,null,hr);let i=Qf(e.url,a);Pt(`\u{1F50D} [${r}] model="${i}"`);let o=Yf(r,i);return o?(Pt(`\u26A1 intercept | ${r} | ${i} \u2192 ${o}`),co[r].intercept(e,t,a,o,hr)):(Pt(`\u23E9 passthrough | no mapping | ${r} | ${i||"unknown"}`),hr(e,t,a))}catch(a){Tt(`Unhandled error: ${a.message}`),t.headersSent||t.writeHead(500,{"Content-Type":"application/json"}),t.end(JSON.stringify({error:{message:a.message,type:"mitm_error"}}))}});function jf(e){try{let t=Vf(`lsof -nP -iTCP:${e} -sTCP:LISTEN -t`,{encoding:"utf-8",windowsHide:!0}).trim();if(!t)return;let a=t.split(`
27
- `).filter(r=>r&&Number(r)!==process.pid);if(a.length===0)return;a.forEach(r=>{try{process.kill(Number(r),"SIGKILL")}catch(n){throw Tt(`Failed to kill PID ${r}: ${n.message}`),n}}),Pt(`Killed ${a.length} process(es) on port ${e}`)}catch(t){if(t.status!==1)throw t}}try{jf(dr)}catch(e){Tt(`Cannot kill process on port ${dr}: ${e.message}`),process.exit(1)}En.listen(dr,()=>Pt(`\u{1F680} Server ready on :${dr}`));En.on("error",e=>{e.code==="EADDRINUSE"?Tt(`Port ${dr} already in use`):e.code==="EACCES"?Tt(`Permission denied for port ${dr}`):Tt(e.message),process.exit(1)});var xn=()=>En.close(()=>process.exit(0));process.on("SIGTERM",xn);process.on("SIGINT",xn);process.platform==="win32"&&process.on("SIGBREAK",xn);
25
+ `)||""});let f=(n.content||"").trim();f&&s.push({role:"user",content:f})}let o={model:t,messages:s,stream:!0,stream_options:{include_usage:!0}},l=n?.userInputMessageContext?.tools;return l?.length>0&&(o.tools=l.map(u=>({type:"function",function:{name:u.toolSpecification.name,description:u.toolSpecification.description||u.toolSpecification.name,parameters:u.toolSpecification.inputSchema?.json||{type:"object",properties:{}}}}))),o}function Yt(e,t){let a=Buffer.from(JSON.stringify(t),"utf8"),r=[[":event-type",e],[":content-type","application/json"],[":message-type","event"]],n=[];for(let[c,v]of r){let g=Buffer.from(c,"utf8"),y=Buffer.from(v,"utf8"),x=Buffer.alloc(1+g.length+1+2+y.length),S=0;x[S++]=g.length,g.copy(x,S),S+=g.length,x[S++]=7,x.writeUInt16BE(y.length,S),S+=2,y.copy(x,S),n.push(x)}let s=Buffer.concat(n),i=12+s.length+a.length+4,o=Buffer.alloc(i),l=0;o.writeUInt32BE(i,l),l+=4,o.writeUInt32BE(s.length,l),l+=4;let u=io.crc32(o.slice(0,8));o.writeUInt32BE(u,l),l+=4,s.copy(o,l),l+=s.length,a.copy(o,l),l+=a.length;let f=io.crc32(o.slice(0,i-4));return o.writeUInt32BE(f,l),o}async function Pf(e,t,a,r,n){try{let s=JSON.parse(a.toString()),i=s.conversationState?.conversationId||"unknown";Rr(`\u{1F537} [KIRO] intercept | conversationId=${i} | model=${r}`);let o=Uf(s,r);if(Rr(`\u{1F537} [KIRO] converted | messages=${o.messages.length} | tools=${o.tools?.length||0}`),o.tools?.length&&Rr(`\u{1F537} [KIRO] tools: ${o.tools.map(x=>x.function.name).join(", ")}`),!o.messages.length)return so("[KIRO] No messages after conversion \u2014 passthrough"),n(e,t,a);let l=await kf(o,"/v1/chat/completions",e.headers);t.writeHead(200,{"Content-Type":"application/vnd.amazon.eventstream","Cache-Control":"no-cache",Connection:"keep-alive","Transfer-Encoding":"chunked","x-amzn-RequestId":e.headers["amz-sdk-invocation-id"]||i,"x-amzn-codewhisperer-conversation-id":i,"X-XSS-Protection":"1; mode=block","X-Frame-Options":"DENY","X-Content-Type-Options":"nosniff"});let u=l.body.getReader(),f=new TextDecoder,c="",v=!1,g={},y=null;for(;;){let{done:x,value:S}=await u.read();if(x)break;c+=f.decode(S,{stream:!0});let I=c.split(`
26
+ `);c=I.pop();for(let B of I){if(!B.startsWith("data: "))continue;let b=B.slice(6).trim();if(b==="[DONE]")continue;let U;try{U=JSON.parse(b)}catch{continue}U.usage&&(y=U.usage);let L=U.choices?.[0];if(!L)continue;let w=L.delta||{},z=L.finish_reason;if(w.content&&t.write(Yt("assistantResponseEvent",{content:w.content,modelId:r})),w.tool_calls){v=!0;for(let G of w.tool_calls){let W=G.index??0;g[W]||(g[W]={id:"",name:"",args:""}),G.id&&(g[W].id=G.id),G.function?.name&&(g[W].name=G.function.name),G.function?.arguments&&(g[W].args+=G.function.arguments)}}if(z){if(v){for(let ee of Object.values(g)){Rr(`\u{1F537} [KIRO] toolUseEvent | id=${ee.id} name=${ee.name}`),t.write(Yt("toolUseEvent",{name:ee.name,toolUseId:ee.id}));let xe=ee.args||"{}",Me=32;for(let ie=0;ie<xe.length;ie+=Me)t.write(Yt("toolUseEvent",{input:xe.slice(ie,ie+Me),name:ee.name,toolUseId:ee.id}));t.write(Yt("toolUseEvent",{name:ee.name,stop:!0,toolUseId:ee.id}))}t.write(Yt("assistantResponseEvent",{content:"",modelId:r}))}let G=y?.prompt_tokens||0,W=y?.total_tokens||0,oe=G>0?G/2e5*100:1.5,ue=W>0?W*4e-6:.001;t.write(Yt("contextUsageEvent",{contextUsagePercentage:oe})),t.write(Yt("meteringEvent",{unit:"credit",unitPlural:"credits",usage:ue})),Rr(`\u{1F537} [KIRO] done | finishReason=${z} hasToolCalls=${v}`)}}}t.end()}catch(s){so(`[KIRO] ${s.message}`),t.headersSent||t.writeHead(500,{"Content-Type":"application/json"}),t.end(JSON.stringify({error:{message:s.message,type:"mitm_error"}}))}}oo.exports={intercept:Pf}});var vo=require("https"),Xt=require("fs"),wr=require("path"),Vf=require("dns"),{promisify:Of}=require("util"),{execSync:gn}=require("child_process"),{log:Pt,err:Tt}=jt(),{TARGET_HOSTS:Kf,URL_PATTERNS:Ff,getToolForHost:qf}=Bn(),{DATA_DIR:yo,MITM_DIR:lo}=kr(),{getCertForDomain:Mf}=$s(),fo=wr.join(yo,"db.json"),dr=443,co=process.platform==="win32",go=!1,En=wr.join(yo,"logs","mitm"),ho={name:"x-request-source",value:"local"};go&&!Xt.existsSync(En)&&Xt.mkdirSync(En,{recursive:!0});var po={antigravity:ro(),copilot:no(),kiro:uo()},mn=new Map;function Hf(e,t){try{if(mn.has(e))return t(null,mn.get(e));let a=Mf(e);if(!a)return t(new Error(`Failed to generate cert for ${e}`));let r=require("tls").createSecureContext({key:a.key,cert:a.cert});mn.set(e,r),Pt(`\u{1F510} Cert generated: ${e}`),t(null,r)}catch(a){Tt(`SNI error for ${e}: ${a.message}`),t(a)}}var mo;try{mo={key:Xt.readFileSync(wr.join(lo,"rootCA.key")),cert:Xt.readFileSync(wr.join(lo,"rootCA.crt")),SNICallback:Hf}}catch(e){Tt(`Root CA not found: ${e.message}`),process.exit(1)}var Cn={},Gf=300*1e3;async function zf(e){let t=Cn[e];if(t&&Date.now()-t.ts<Gf)return t.ip;let a=new Vf.Resolver;a.setServers(["8.8.8.8"]);let n=await Of(a.resolve4.bind(a))(e);return Cn[e]={ip:n[0],ts:Date.now()},Cn[e].ip}function Qf(e){return new Promise((t,a)=>{let r=[];e.on("data",n=>r.push(n)),e.on("end",()=>t(Buffer.concat(r))),e.on("error",a)})}function Yf(e,t){let a=e.match(/\/models\/([^/:]+)/);if(a)return a[1];try{let r=JSON.parse(t.toString());return r.conversationState?r.conversationState.currentMessage?.userInputMessage?.modelId||null:r.model||null}catch{return null}}function Xf(e,t){if(!t)return null;try{if(!Xt.existsSync(fo))return null;let r=JSON.parse(Xt.readFileSync(fo,"utf-8")).mitmAlias?.[e];if(!r)return null;if(r[t])return r[t];let n=Object.keys(r).find(s=>s&&r[s]&&(t.startsWith(s)||s.startsWith(t)));return n?r[n]:null}catch{return null}}function Wf(e,t){if(go)try{let a=new Date().toISOString().replace(/[:.]/g,"-"),r=e.replace(/[^a-zA-Z0-9]/g,"_").substring(0,60),n=JSON.parse(t.toString());Xt.writeFileSync(wr.join(En,`${a}_${r}.json`),JSON.stringify(n,null,2))}catch{}}async function hr(e,t,a,r){let n=(e.headers.host||Kf[0]).split(":")[0],s=await zf(n),i=vo.request({hostname:s,port:443,path:e.url,method:e.method,headers:{...e.headers,host:n},servername:n,rejectUnauthorized:!1},o=>{if(t.writeHead(o.statusCode,o.headers),!r){o.pipe(t);return}let l=[];o.on("data",u=>{l.push(u),t.write(u)}),o.on("end",()=>{t.end();try{r(Buffer.concat(l),o.headers)}catch{}})});i.on("error",o=>{Tt(`Passthrough error: ${o.message}`),t.headersSent||t.writeHead(502),t.end("Bad Gateway")}),a.length>0&&i.write(a),i.end()}var xn=vo.createServer(mo,async(e,t)=>{try{if(e.url==="/_mitm_health"){t.writeHead(200,{"Content-Type":"application/json"}),t.end(JSON.stringify({ok:!0,pid:process.pid}));return}let a=await Qf(e);if(a.length>0&&Wf(e.url,a),e.headers[ho.name]===ho.value)return hr(e,t,a);let r=qf(e.headers.host);if(!r||!(Ff[r]||[]).some(l=>e.url.includes(l)))return hr(e,t,a);if(Pt(`\u{1F50D} [${r}] url=${e.url} | bodyLen=${a.length}`),r==="cursor")return Pt("\u26A1 intercept | cursor | proto"),po[r].intercept(e,t,a,null,hr);let i=Yf(e.url,a);Pt(`\u{1F50D} [${r}] model="${i}"`);let o=Xf(r,i);return o?(Pt(`\u26A1 intercept | ${r} | ${i} \u2192 ${o}`),po[r].intercept(e,t,a,o,hr)):(Pt(`\u23E9 passthrough | no mapping | ${r} | ${i||"unknown"}`),hr(e,t,a))}catch(a){Tt(`Unhandled error: ${a.message}`),t.headersSent||t.writeHead(500,{"Content-Type":"application/json"}),t.end(JSON.stringify({error:{message:a.message,type:"mitm_error"}}))}});function jf(e){try{let t=[];if(co){let a=`powershell -NonInteractive -WindowStyle Hidden -Command "Get-NetTCPConnection -LocalPort ${e} -State Listen -ErrorAction SilentlyContinue | Select-Object -ExpandProperty OwningProcess"`,r=gn(a,{encoding:"utf-8",windowsHide:!0}).trim();if(!r)return;t=r.split(/\r?\n/).map(n=>n.trim()).filter(n=>n&&Number(n)!==process.pid&&Number(n)>4)}else{let a=gn(`lsof -nP -iTCP:${e} -sTCP:LISTEN -t`,{encoding:"utf-8",windowsHide:!0}).trim();if(!a)return;t=a.split(`
27
+ `).filter(r=>r&&Number(r)!==process.pid)}if(t.length===0)return;t.forEach(a=>{try{co?gn(`taskkill /F /PID ${a}`,{windowsHide:!0}):process.kill(Number(a),"SIGKILL")}catch(r){Tt(`Failed to kill PID ${a}: ${r.message}`)}}),Pt(`Killed ${t.length} process(es) on port ${e}`)}catch(t){if(t.status!==1)throw t}}try{jf(dr)}catch(e){Tt(`Cannot kill process on port ${dr}: ${e.message}`),process.exit(1)}xn.listen(dr,()=>Pt(`\u{1F680} Server ready on :${dr}`));xn.on("error",e=>{e.code==="EADDRINUSE"?Tt(`Port ${dr} already in use`):e.code==="EACCES"?Tt(`Permission denied for port ${dr}`):Tt(e.message),process.exit(1)});var Sn=()=>xn.close(()=>process.exit(0));process.on("SIGTERM",Sn);process.on("SIGINT",Sn);process.platform==="win32"&&process.on("SIGBREAK",Sn);