wiki-viewer 1.12.0 → 1.12.1

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 (333) hide show
  1. package/.next/standalone/.handoffs/archive/handoff-20260612-113332.md +98 -0
  2. package/.next/standalone/.handoffs/archive/handoff-20260612-141032.md +73 -0
  3. package/.next/standalone/.next/BUILD_ID +1 -1
  4. package/.next/standalone/.next/app-path-routes-manifest.json +7 -0
  5. package/.next/standalone/.next/build-manifest.json +3 -3
  6. package/.next/standalone/.next/routes-manifest.json +44 -0
  7. package/.next/standalone/.next/server/app/_global-error.html +1 -1
  8. package/.next/standalone/.next/server/app/_global-error.rsc +1 -1
  9. package/.next/standalone/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +1 -1
  10. package/.next/standalone/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
  11. package/.next/standalone/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
  12. package/.next/standalone/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
  13. package/.next/standalone/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  14. package/.next/standalone/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  15. package/.next/standalone/.next/server/app/_not-found.html +1 -1
  16. package/.next/standalone/.next/server/app/_not-found.rsc +2 -2
  17. package/.next/standalone/.next/server/app/_not-found.segments/_full.segment.rsc +2 -2
  18. package/.next/standalone/.next/server/app/_not-found.segments/_head.segment.rsc +1 -1
  19. package/.next/standalone/.next/server/app/_not-found.segments/_index.segment.rsc +2 -2
  20. package/.next/standalone/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
  21. package/.next/standalone/.next/server/app/_not-found.segments/_not-found.segment.rsc +1 -1
  22. package/.next/standalone/.next/server/app/_not-found.segments/_tree.segment.rsc +2 -2
  23. package/.next/standalone/.next/server/app/api/agent/activity/route.js +8 -7
  24. package/.next/standalone/.next/server/app/api/agent/activity/route.js.nft.json +1 -1
  25. package/.next/standalone/.next/server/app/api/agent/events/[...path]/route.js +6 -5
  26. package/.next/standalone/.next/server/app/api/agent/events/[...path]/route.js.nft.json +1 -1
  27. package/.next/standalone/.next/server/app/api/agent/files/[...path]/route.js +9 -8
  28. package/.next/standalone/.next/server/app/api/agent/files/[...path]/route.js.nft.json +1 -1
  29. package/.next/standalone/.next/server/app/api/agent/fs/file/[...path]/route.js +6 -5
  30. package/.next/standalone/.next/server/app/api/agent/fs/file/[...path]/route.js.nft.json +1 -1
  31. package/.next/standalone/.next/server/app/api/agent/fs/ls/[[...path]]/route.js +8 -7
  32. package/.next/standalone/.next/server/app/api/agent/fs/ls/[[...path]]/route.js.nft.json +1 -1
  33. package/.next/standalone/.next/server/app/api/agent/fs/move/route.js +5 -4
  34. package/.next/standalone/.next/server/app/api/agent/fs/move/route.js.nft.json +1 -1
  35. package/.next/standalone/.next/server/app/api/agent/fs/search/route.js +5 -4
  36. package/.next/standalone/.next/server/app/api/agent/fs/search/route.js.nft.json +1 -1
  37. package/.next/standalone/.next/server/app/api/agent/internal/span/route.js +6 -5
  38. package/.next/standalone/.next/server/app/api/agent/internal/span/route.js.nft.json +1 -1
  39. package/.next/standalone/.next/server/app/api/agent/settings/route.js +5 -4
  40. package/.next/standalone/.next/server/app/api/agent/settings/route.js.nft.json +1 -1
  41. package/.next/standalone/.next/server/app/api/agent/sidecar/[...path]/route.js +7 -6
  42. package/.next/standalone/.next/server/app/api/agent/sidecar/[...path]/route.js.nft.json +1 -1
  43. package/.next/standalone/.next/server/app/api/app-proxy/[...path]/route.js +3 -3
  44. package/.next/standalone/.next/server/app/api/app-proxy/[...path]/route.js.nft.json +1 -1
  45. package/.next/standalone/.next/server/app/api/assets/[...path]/route.js +5 -4
  46. package/.next/standalone/.next/server/app/api/assets/[...path]/route.js.nft.json +1 -1
  47. package/.next/standalone/.next/server/app/api/share/[token]/route.js +3 -3
  48. package/.next/standalone/.next/server/app/api/share/[token]/route.js.nft.json +1 -1
  49. package/.next/standalone/.next/server/app/api/share/route.js +5 -4
  50. package/.next/standalone/.next/server/app/api/share/route.js.nft.json +1 -1
  51. package/.next/standalone/.next/server/app/api/system/browse/route.js.nft.json +1 -1
  52. package/.next/standalone/.next/server/app/api/system/clear-root/route.js.nft.json +1 -1
  53. package/.next/standalone/.next/server/app/api/system/reveal/route.js +5 -4
  54. package/.next/standalone/.next/server/app/api/system/reveal/route.js.nft.json +1 -1
  55. package/.next/standalone/.next/server/app/api/system/root-status/route.js.nft.json +1 -1
  56. package/.next/standalone/.next/server/app/api/system/set-root/route.js +5 -5
  57. package/.next/standalone/.next/server/app/api/system/set-root/route.js.nft.json +1 -1
  58. package/.next/standalone/.next/server/app/api/system/workspaces/[id]/open/route.js +5 -5
  59. package/.next/standalone/.next/server/app/api/system/workspaces/[id]/open/route.js.nft.json +1 -1
  60. package/.next/standalone/.next/server/app/api/system/workspaces/[id]/refresh/route/app-paths-manifest.json +3 -0
  61. package/.next/standalone/.next/server/app/api/system/workspaces/[id]/refresh/route/build-manifest.json +9 -0
  62. package/.next/standalone/.next/server/app/api/system/workspaces/[id]/refresh/route/server-reference-manifest.json +4 -0
  63. package/.next/standalone/.next/server/app/api/system/workspaces/[id]/refresh/route.js +14 -0
  64. package/.next/standalone/.next/server/app/api/system/workspaces/[id]/refresh/route.js.map +5 -0
  65. package/.next/standalone/.next/server/app/api/system/workspaces/[id]/refresh/route.js.nft.json +1 -0
  66. package/.next/standalone/.next/server/app/api/system/workspaces/[id]/refresh/route_client-reference-manifest.js +3 -0
  67. package/.next/standalone/.next/server/app/api/system/workspaces/[id]/route.js +5 -5
  68. package/.next/standalone/.next/server/app/api/system/workspaces/[id]/route.js.nft.json +1 -1
  69. package/.next/standalone/.next/server/app/api/system/workspaces/route.js +5 -5
  70. package/.next/standalone/.next/server/app/api/system/workspaces/route.js.nft.json +1 -1
  71. package/.next/standalone/.next/server/app/api/upload/[...path]/route.js +5 -4
  72. package/.next/standalone/.next/server/app/api/upload/[...path]/route.js.nft.json +1 -1
  73. package/.next/standalone/.next/server/app/api/wiki/app/route.js +3 -2
  74. package/.next/standalone/.next/server/app/api/wiki/app/route.js.nft.json +1 -1
  75. package/.next/standalone/.next/server/app/api/wiki/content/route.js +7 -6
  76. package/.next/standalone/.next/server/app/api/wiki/content/route.js.nft.json +1 -1
  77. package/.next/standalone/.next/server/app/api/wiki/download/route.js +5 -4
  78. package/.next/standalone/.next/server/app/api/wiki/download/route.js.nft.json +1 -1
  79. package/.next/standalone/.next/server/app/api/wiki/file/route.js +5 -4
  80. package/.next/standalone/.next/server/app/api/wiki/file/route.js.nft.json +1 -1
  81. package/.next/standalone/.next/server/app/api/wiki/folder/route.js +4 -3
  82. package/.next/standalone/.next/server/app/api/wiki/folder/route.js.nft.json +1 -1
  83. package/.next/standalone/.next/server/app/api/wiki/git-branches/route/app-paths-manifest.json +3 -0
  84. package/.next/standalone/.next/server/app/api/wiki/git-branches/route/build-manifest.json +9 -0
  85. package/.next/standalone/.next/server/app/api/wiki/git-branches/route/server-reference-manifest.json +4 -0
  86. package/.next/standalone/.next/server/app/api/wiki/git-branches/route.js +15 -0
  87. package/.next/standalone/.next/server/app/api/wiki/git-branches/route.js.map +5 -0
  88. package/.next/standalone/.next/server/app/api/wiki/git-branches/route.js.nft.json +1 -0
  89. package/.next/standalone/.next/server/app/api/wiki/git-branches/route_client-reference-manifest.js +3 -0
  90. package/.next/standalone/.next/server/app/api/wiki/git-checkout/route/app-paths-manifest.json +3 -0
  91. package/.next/standalone/.next/server/app/api/wiki/git-checkout/route/build-manifest.json +9 -0
  92. package/.next/standalone/.next/server/app/api/wiki/git-checkout/route/server-reference-manifest.json +4 -0
  93. package/.next/standalone/.next/server/app/api/wiki/git-checkout/route.js +15 -0
  94. package/.next/standalone/.next/server/app/api/wiki/git-checkout/route.js.map +5 -0
  95. package/.next/standalone/.next/server/app/api/wiki/git-checkout/route.js.nft.json +1 -0
  96. package/.next/standalone/.next/server/app/api/wiki/git-checkout/route_client-reference-manifest.js +3 -0
  97. package/.next/standalone/.next/server/app/api/wiki/git-diff/route/app-paths-manifest.json +3 -0
  98. package/.next/standalone/.next/server/app/api/wiki/git-diff/route/build-manifest.json +9 -0
  99. package/.next/standalone/.next/server/app/api/wiki/git-diff/route/server-reference-manifest.json +4 -0
  100. package/.next/standalone/.next/server/app/api/wiki/git-diff/route.js +15 -0
  101. package/.next/standalone/.next/server/app/api/wiki/git-diff/route.js.map +5 -0
  102. package/.next/standalone/.next/server/app/api/wiki/git-diff/route.js.nft.json +1 -0
  103. package/.next/standalone/.next/server/app/api/wiki/git-diff/route_client-reference-manifest.js +3 -0
  104. package/.next/standalone/.next/server/app/api/wiki/git-file-info/route/app-paths-manifest.json +3 -0
  105. package/.next/standalone/.next/server/app/api/wiki/git-file-info/route/build-manifest.json +9 -0
  106. package/.next/standalone/.next/server/app/api/wiki/git-file-info/route/server-reference-manifest.json +4 -0
  107. package/.next/standalone/.next/server/app/api/wiki/git-file-info/route.js +15 -0
  108. package/.next/standalone/.next/server/app/api/wiki/git-file-info/route.js.map +5 -0
  109. package/.next/standalone/.next/server/app/api/wiki/git-file-info/route.js.nft.json +1 -0
  110. package/.next/standalone/.next/server/app/api/wiki/git-file-info/route_client-reference-manifest.js +3 -0
  111. package/.next/standalone/.next/server/app/api/wiki/git-history/route/app-paths-manifest.json +3 -0
  112. package/.next/standalone/.next/server/app/api/wiki/git-history/route/build-manifest.json +9 -0
  113. package/.next/standalone/.next/server/app/api/wiki/git-history/route/server-reference-manifest.json +4 -0
  114. package/.next/standalone/.next/server/app/api/wiki/git-history/route.js +15 -0
  115. package/.next/standalone/.next/server/app/api/wiki/git-history/route.js.map +5 -0
  116. package/.next/standalone/.next/server/app/api/wiki/git-history/route.js.nft.json +1 -0
  117. package/.next/standalone/.next/server/app/api/wiki/git-history/route_client-reference-manifest.js +3 -0
  118. package/.next/standalone/.next/server/app/api/wiki/git-pull/route/app-paths-manifest.json +3 -0
  119. package/.next/standalone/.next/server/app/api/wiki/git-pull/route/build-manifest.json +9 -0
  120. package/.next/standalone/.next/server/app/api/wiki/git-pull/route/server-reference-manifest.json +4 -0
  121. package/.next/standalone/.next/server/app/api/wiki/git-pull/route.js +15 -0
  122. package/.next/standalone/.next/server/app/api/wiki/git-pull/route.js.map +5 -0
  123. package/.next/standalone/.next/server/app/api/wiki/git-pull/route.js.nft.json +1 -0
  124. package/.next/standalone/.next/server/app/api/wiki/git-pull/route_client-reference-manifest.js +3 -0
  125. package/.next/standalone/.next/server/app/api/wiki/move/route.js +7 -6
  126. package/.next/standalone/.next/server/app/api/wiki/move/route.js.nft.json +1 -1
  127. package/.next/standalone/.next/server/app/api/wiki/new-file/route.js +5 -4
  128. package/.next/standalone/.next/server/app/api/wiki/new-file/route.js.nft.json +1 -1
  129. package/.next/standalone/.next/server/app/api/wiki/page/route.js +5 -4
  130. package/.next/standalone/.next/server/app/api/wiki/page/route.js.nft.json +1 -1
  131. package/.next/standalone/.next/server/app/api/wiki/presence/route.js +4 -3
  132. package/.next/standalone/.next/server/app/api/wiki/presence/route.js.nft.json +1 -1
  133. package/.next/standalone/.next/server/app/api/wiki/route.js +5 -4
  134. package/.next/standalone/.next/server/app/api/wiki/route.js.nft.json +1 -1
  135. package/.next/standalone/.next/server/app/api/wiki/search/route.js +7 -6
  136. package/.next/standalone/.next/server/app/api/wiki/search/route.js.nft.json +1 -1
  137. package/.next/standalone/.next/server/app/api/wiki/slugs/route.js +5 -4
  138. package/.next/standalone/.next/server/app/api/wiki/slugs/route.js.nft.json +1 -1
  139. package/.next/standalone/.next/server/app/api/wiki/upload/route.js +5 -4
  140. package/.next/standalone/.next/server/app/api/wiki/upload/route.js.nft.json +1 -1
  141. package/.next/standalone/.next/server/app/api/wiki/watch/route.js +4 -3
  142. package/.next/standalone/.next/server/app/api/wiki/watch/route.js.nft.json +1 -1
  143. package/.next/standalone/.next/server/app/index.html +1 -1
  144. package/.next/standalone/.next/server/app/index.rsc +3 -3
  145. package/.next/standalone/.next/server/app/index.segments/__PAGE__.segment.rsc +2 -2
  146. package/.next/standalone/.next/server/app/index.segments/_full.segment.rsc +3 -3
  147. package/.next/standalone/.next/server/app/index.segments/_head.segment.rsc +1 -1
  148. package/.next/standalone/.next/server/app/index.segments/_index.segment.rsc +2 -2
  149. package/.next/standalone/.next/server/app/index.segments/_tree.segment.rsc +2 -2
  150. package/.next/standalone/.next/server/app/page.js.nft.json +1 -1
  151. package/.next/standalone/.next/server/app/page_client-reference-manifest.js +1 -1
  152. package/.next/standalone/.next/server/app/s/[token]/page_client-reference-manifest.js +1 -1
  153. package/.next/standalone/.next/server/app/signin/page_client-reference-manifest.js +1 -1
  154. package/.next/standalone/.next/server/app-paths-manifest.json +7 -0
  155. package/.next/standalone/.next/server/chunks/0p91_next_dist_esm_build_templates_app-route_0d2jbo5.js +1 -1
  156. package/.next/standalone/.next/server/chunks/0p91_next_dist_esm_build_templates_app-route_0ytral2.js +1 -1
  157. package/.next/standalone/.next/server/chunks/0zjb_server_app_api_system_workspaces_[id]_refresh_route_actions_0hkhk63.js +3 -0
  158. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0-.y6im._.js +3 -0
  159. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0-3_t2y._.js +3 -0
  160. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0-kjkzt._.js +3 -0
  161. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0-puax4._.js +4 -0
  162. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0329ktu._.js +3 -0
  163. package/.next/standalone/.next/server/chunks/[root-of-the-server]__03_xj4r._.js +3 -0
  164. package/.next/standalone/.next/server/chunks/[root-of-the-server]__05398dt._.js +4 -0
  165. package/.next/standalone/.next/server/chunks/[root-of-the-server]__06lfvxh._.js +3 -0
  166. package/.next/standalone/.next/server/chunks/[root-of-the-server]__070_p2a._.js +4 -0
  167. package/.next/standalone/.next/server/chunks/[root-of-the-server]__07tq6o4._.js +3 -0
  168. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0905hi1._.js +21 -0
  169. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0aa63~j._.js +5 -0
  170. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0avcplk._.js +4 -0
  171. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0b8_kyo._.js +16 -0
  172. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0bticq1._.js +3 -0
  173. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0bwevvu._.js +3 -0
  174. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0c__k3q._.js +4 -0
  175. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0cp~z4x._.js +3 -0
  176. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0fmdv9h._.js +20 -0
  177. package/.next/standalone/.next/server/chunks/{[root-of-the-server]__09s9qkd._.js → [root-of-the-server]__0gurz9a._.js} +12 -12
  178. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0h0qbwr._.js +3 -0
  179. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0jk~oyi._.js +3 -0
  180. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0ndq77b._.js +3 -0
  181. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0nvgpuk._.js +3 -0
  182. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0ocvng2._.js +3 -0
  183. package/.next/standalone/.next/server/chunks/{[root-of-the-server]__12y5z5j._.js → [root-of-the-server]__0oruwos._.js} +2 -2
  184. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0ps4h~.._.js +3 -0
  185. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0q7jqwp._.js +12 -0
  186. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0qew~6p._.js +3 -0
  187. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0s_9f-a._.js +3 -0
  188. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0uv7b8u._.js +3 -0
  189. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0uv8.9i._.js +3 -0
  190. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0vfe2io._.js +4 -0
  191. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0w11kjy._.js +3 -0
  192. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0wc-.e4._.js +3 -0
  193. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0ymovmp._.js +3 -0
  194. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0~c6ouv._.js +3 -0
  195. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0~rhs0u._.js +16 -0
  196. package/.next/standalone/.next/server/chunks/[root-of-the-server]__10h9tid._.js +3 -0
  197. package/.next/standalone/.next/server/chunks/[root-of-the-server]__10yk-u1._.js +3 -0
  198. package/.next/standalone/.next/server/chunks/[root-of-the-server]__11105ew._.js +3 -0
  199. package/.next/standalone/.next/server/chunks/[root-of-the-server]__13420tt._.js +3 -0
  200. package/.next/standalone/.next/server/chunks/[root-of-the-server]__13h~pdf._.js +3 -0
  201. package/.next/standalone/.next/server/chunks/_0dr1r1g._.js +1 -1
  202. package/.next/standalone/.next/server/chunks/_101exke._.js +1 -1
  203. package/.next/standalone/.next/server/chunks/_next-internal_server_app_api_system_workspaces_[id]_open_route_actions_1087xu7.js +1 -1
  204. package/.next/standalone/.next/server/chunks/_next-internal_server_app_api_wiki_git-branches_route_actions_05b396c.js +3 -0
  205. package/.next/standalone/.next/server/chunks/_next-internal_server_app_api_wiki_git-checkout_route_actions_089u9p9.js +3 -0
  206. package/.next/standalone/.next/server/chunks/_next-internal_server_app_api_wiki_git-diff_route_actions_0iy8l24.js +3 -0
  207. package/.next/standalone/.next/server/chunks/_next-internal_server_app_api_wiki_git-file-info_route_actions_0x60n1-.js +3 -0
  208. package/.next/standalone/.next/server/chunks/_next-internal_server_app_api_wiki_git-history_route_actions_0tkpmp_.js +3 -0
  209. package/.next/standalone/.next/server/chunks/_next-internal_server_app_api_wiki_git-pull_route_actions_0g4vacp.js +3 -0
  210. package/.next/standalone/.next/server/chunks/ssr/{0~w0_katex_dist_katex_mjs_13chgf0._.js → 0~w0_katex_dist_katex_mjs_0qx2j07._.js} +1 -1
  211. package/.next/standalone/.next/server/chunks/ssr/{[root-of-the-server]__0i~n9pv._.js → [root-of-the-server]__0h4wd53._.js} +2 -2
  212. package/.next/standalone/.next/server/chunks/ssr/_0yevh-d._.js +2 -2
  213. package/.next/standalone/.next/server/chunks/ssr/_0~a9dyk._.js +2 -2
  214. package/.next/standalone/.next/server/chunks/ssr/{node_modules__pnpm_0n1.j2i._.js → node_modules__pnpm_01kc--z._.js} +1 -1
  215. package/.next/standalone/.next/server/chunks/ssr/{node_modules__pnpm_0xp183v._.js → node_modules__pnpm_03cm2zh._.js} +1 -1
  216. package/.next/standalone/.next/server/chunks/ssr/{node_modules__pnpm_0oibo.w._.js → node_modules__pnpm_04hxlb_._.js} +1 -1
  217. package/.next/standalone/.next/server/chunks/ssr/{node_modules__pnpm_12q.b2f._.js → node_modules__pnpm_0820yu1._.js} +1 -1
  218. package/.next/standalone/.next/server/chunks/ssr/{node_modules__pnpm_0w9n5vj._.js → node_modules__pnpm_08c9lfr._.js} +1 -1
  219. package/.next/standalone/.next/server/chunks/ssr/{node_modules__pnpm_0nll2aq._.js → node_modules__pnpm_0_.fyaw._.js} +1 -1
  220. package/.next/standalone/.next/server/chunks/ssr/{node_modules__pnpm_0_oavke._.js → node_modules__pnpm_0_xt~7t._.js} +1 -1
  221. package/.next/standalone/.next/server/chunks/ssr/node_modules__pnpm_0a4su30._.js +1 -1
  222. package/.next/standalone/.next/server/chunks/ssr/{node_modules__pnpm_0rzput-._.js → node_modules__pnpm_0aitjy1._.js} +1 -1
  223. package/.next/standalone/.next/server/chunks/ssr/{node_modules__pnpm_0qfk1f1._.js → node_modules__pnpm_0ayirr4._.js} +1 -1
  224. package/.next/standalone/.next/server/chunks/ssr/{node_modules__pnpm_0m58haa._.js → node_modules__pnpm_0czi-y7._.js} +1 -1
  225. package/.next/standalone/.next/server/chunks/ssr/{node_modules__pnpm_0kr6hmt._.js → node_modules__pnpm_0ejdhkw._.js} +1 -1
  226. package/.next/standalone/.next/server/chunks/ssr/{node_modules__pnpm_0lzlkeq._.js → node_modules__pnpm_0e~azys._.js} +2 -2
  227. package/.next/standalone/.next/server/chunks/ssr/{node_modules__pnpm_0mfii1i._.js → node_modules__pnpm_0gc.tst._.js} +1 -1
  228. package/.next/standalone/.next/server/chunks/ssr/{node_modules__pnpm_0xbcqhl._.js → node_modules__pnpm_0h2_y0t._.js} +1 -1
  229. package/.next/standalone/.next/server/chunks/ssr/{node_modules__pnpm_0gl18q1._.js → node_modules__pnpm_0i.tyr0._.js} +1 -1
  230. package/.next/standalone/.next/server/chunks/ssr/{node_modules__pnpm_08gkil-._.js → node_modules__pnpm_0qqam_2._.js} +2 -2
  231. package/.next/standalone/.next/server/chunks/ssr/{node_modules__pnpm_11nai6s._.js → node_modules__pnpm_0rikhgz._.js} +2 -2
  232. package/.next/standalone/.next/server/chunks/ssr/{node_modules__pnpm_0bb1d87._.js → node_modules__pnpm_0smyw3~._.js} +1 -1
  233. package/.next/standalone/.next/server/chunks/ssr/{node_modules__pnpm_0c0u-lf._.js → node_modules__pnpm_0sxgjbs._.js} +2 -2
  234. package/.next/standalone/.next/server/chunks/ssr/{node_modules__pnpm_122wqoe._.js → node_modules__pnpm_0u9e~t-._.js} +2 -2
  235. package/.next/standalone/.next/server/chunks/ssr/{node_modules__pnpm_0t5tgdj._.js → node_modules__pnpm_0v9nm7z._.js} +1 -1
  236. package/.next/standalone/.next/server/chunks/ssr/{node_modules__pnpm_0m-flj.._.js → node_modules__pnpm_0vw2lox._.js} +1 -1
  237. package/.next/standalone/.next/server/chunks/ssr/{node_modules__pnpm_06feu_5._.js → node_modules__pnpm_0wepk.3._.js} +1 -1
  238. package/.next/standalone/.next/server/chunks/ssr/{node_modules__pnpm_11vksmi._.js → node_modules__pnpm_12~uc4r._.js} +2 -2
  239. package/.next/standalone/.next/server/chunks/ssr/{node_modules__pnpm_0fiq.d~._.js → node_modules__pnpm_1391bd5._.js} +1 -1
  240. package/.next/standalone/.next/server/chunks/ssr/{node_modules__pnpm_0y8u~8e._.js → node_modules__pnpm_13dxxs2._.js} +2 -2
  241. package/.next/standalone/.next/server/chunks/ssr/{node_modules__pnpm_0o4821k._.js → node_modules__pnpm_13zhbe4._.js} +1 -1
  242. package/.next/standalone/.next/server/chunks/ssr/src_app_page_tsx_0ss2.w7._.js +3 -3
  243. package/.next/standalone/.next/server/functions-config-manifest.json +1 -0
  244. package/.next/standalone/.next/server/middleware-build-manifest.js +3 -3
  245. package/.next/standalone/.next/server/middleware-manifest.json +1 -1
  246. package/.next/standalone/.next/server/pages/404.html +1 -1
  247. package/.next/standalone/.next/server/pages/500.html +1 -1
  248. package/.next/standalone/.next/static/chunks/0.9~g4nvqt9if.css +5 -0
  249. package/.next/standalone/.next/static/chunks/0qiiie0s9~eqg.js +17 -0
  250. package/.next/standalone/.next/static/chunks/{0_cyfljw-guxi.js → 0rmw2y5~zh8p4.js} +2 -2
  251. package/.next/standalone/.next/static/chunks/{0l494q_1hjc2y.js → 132w2~-ghm05e.js} +2 -2
  252. package/.next/standalone/AGENTS.md +13 -3
  253. package/.next/standalone/README.md +109 -11
  254. package/.next/standalone/package.json +1 -1
  255. package/.next/standalone/src/app/api/agent/events/[...path]/route.ts +1 -1
  256. package/.next/standalone/src/app/api/agent/files/[...path]/route.ts +1 -1
  257. package/.next/standalone/src/app/api/agent/fs/file/[...path]/route.ts +2 -2
  258. package/.next/standalone/src/app/api/agent/fs/move/route.ts +1 -1
  259. package/.next/standalone/src/app/api/agent/internal/span/route.ts +1 -1
  260. package/.next/standalone/src/app/api/system/workspaces/[id]/refresh/route.ts +32 -0
  261. package/.next/standalone/src/app/api/system/workspaces/[id]/route.ts +5 -1
  262. package/.next/standalone/src/app/api/system/workspaces/route.ts +56 -4
  263. package/.next/standalone/src/app/api/upload/[...path]/route.ts +1 -1
  264. package/.next/standalone/src/app/api/wiki/app/route.ts +2 -2
  265. package/.next/standalone/src/app/api/wiki/content/route.ts +1 -1
  266. package/.next/standalone/src/app/api/wiki/folder/route.ts +1 -1
  267. package/.next/standalone/src/app/api/wiki/git-branches/route.ts +32 -0
  268. package/.next/standalone/src/app/api/wiki/git-checkout/route.ts +45 -0
  269. package/.next/standalone/src/app/api/wiki/git-diff/route.ts +33 -0
  270. package/.next/standalone/src/app/api/wiki/git-file-info/route.ts +27 -0
  271. package/.next/standalone/src/app/api/wiki/git-history/route.ts +27 -0
  272. package/.next/standalone/src/app/api/wiki/git-pull/route.ts +48 -0
  273. package/.next/standalone/src/app/api/wiki/move/route.ts +1 -1
  274. package/.next/standalone/src/app/api/wiki/new-file/route.ts +1 -1
  275. package/.next/standalone/src/app/api/wiki/page/route.ts +1 -1
  276. package/.next/standalone/src/app/api/wiki/route.ts +22 -16
  277. package/.next/standalone/src/app/api/wiki/upload/route.ts +1 -1
  278. package/.next/standalone/src/app/page.tsx +376 -5
  279. package/.next/standalone/src/components/dir-picker.tsx +219 -8
  280. package/.next/standalone/src/components/editor/document-outline.tsx +1 -1
  281. package/.next/standalone/src/lib/config.ts +26 -0
  282. package/.next/standalone/src/lib/git-secrets.ts +65 -0
  283. package/.next/standalone/src/lib/git.ts +503 -0
  284. package/.next/standalone/src/lib/workspace-context.ts +20 -2
  285. package/.next/standalone/src/lib/workspaces.ts +205 -1
  286. package/.next/standalone/src/tests/proof/git-branches-checkout.test.ts +136 -0
  287. package/.next/standalone/src/tests/proof/git-read-features.test.ts +473 -0
  288. package/.next/standalone/src/tests/proof/git-secrets.test.ts +138 -0
  289. package/.next/standalone/src/tests/proof/git-sparse.test.ts +257 -0
  290. package/.next/standalone/src/tests/proof/git-workspace.test.ts +135 -0
  291. package/.next/standalone/src/tests/proof/git.test.ts +243 -0
  292. package/.next/standalone/src/tests/proof/readonly-enforcement.test.ts +161 -0
  293. package/.next/standalone/tsconfig.tsbuildinfo +1 -1
  294. package/README.md +109 -11
  295. package/package.json +1 -1
  296. package/.next/standalone/.next/server/chunks/[root-of-the-server]__00lep-u._.js +0 -3
  297. package/.next/standalone/.next/server/chunks/[root-of-the-server]__01hp8ax._.js +0 -3
  298. package/.next/standalone/.next/server/chunks/[root-of-the-server]__02scxiu._.js +0 -3
  299. package/.next/standalone/.next/server/chunks/[root-of-the-server]__036mhjp._.js +0 -5
  300. package/.next/standalone/.next/server/chunks/[root-of-the-server]__05t~v6l._.js +0 -3
  301. package/.next/standalone/.next/server/chunks/[root-of-the-server]__07nnfjx._.js +0 -16
  302. package/.next/standalone/.next/server/chunks/[root-of-the-server]__09cqzem._.js +0 -3
  303. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0_0_601._.js +0 -3
  304. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0ae3dk6._.js +0 -3
  305. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0d7x3e1._.js +0 -3
  306. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0e7vs98._.js +0 -3
  307. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0fxzg4v._.js +0 -3
  308. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0hu~q20._.js +0 -3
  309. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0l-8clq._.js +0 -3
  310. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0n3i3vu._.js +0 -16
  311. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0ncjv3e._.js +0 -3
  312. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0otb8ra._.js +0 -3
  313. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0p0-p__._.js +0 -3
  314. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0piofm3._.js +0 -3
  315. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0s6_lzw._.js +0 -3
  316. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0s8ovh5._.js +0 -3
  317. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0sh13v5._.js +0 -3
  318. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0ta~flu._.js +0 -3
  319. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0v4im4p._.js +0 -3
  320. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0vdb2nr._.js +0 -3
  321. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0yzle76._.js +0 -20
  322. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0z.pwwj._.js +0 -20
  323. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0zgb.q2._.js +0 -3
  324. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0zq0rlw._.js +0 -3
  325. package/.next/standalone/.next/server/chunks/[root-of-the-server]__123._fe._.js +0 -3
  326. package/.next/standalone/.next/server/chunks/[root-of-the-server]__1377.79._.js +0 -3
  327. package/.next/standalone/.next/server/chunks/[root-of-the-server]__1378-ox._.js +0 -3
  328. package/.next/standalone/.next/server/chunks/[root-of-the-server]__13hp4tw._.js +0 -12
  329. package/.next/standalone/.next/static/chunks/0g3kmqqu.d0cc.css +0 -5
  330. package/.next/standalone/.next/static/chunks/0qtn1qu_g8qia.js +0 -17
  331. /package/.next/standalone/.next/static/{hYuHIYrZPBlI82UnWPCoY → ucX5u3D8Ca9KdVyeRk_D_}/_buildManifest.js +0 -0
  332. /package/.next/standalone/.next/static/{hYuHIYrZPBlI82UnWPCoY → ucX5u3D8Ca9KdVyeRk_D_}/_clientMiddlewareManifest.js +0 -0
  333. /package/.next/standalone/.next/static/{hYuHIYrZPBlI82UnWPCoY → ucX5u3D8Ca9KdVyeRk_D_}/_ssgManifest.js +0 -0
@@ -1,4 +1,4 @@
1
- module.exports=[798003,e=>{"use strict";var t=e.i(912714),r=e.i(660526),n=e.i(750227);function i(){return n.default.join(r.default.homedir(),".wiki-viewer","config.json")}async function a(){await (0,t.mkdir)(n.default.join(r.default.homedir(),".wiki-viewer"),{recursive:!0})}async function o(){try{let e=await (0,t.readFile)(i(),"utf8");return JSON.parse(e)}catch{return{}}}let s=Promise.resolve();function c(e){let t=s.then(e,e);return s=t.then(()=>void 0,()=>void 0),t}async function l(e){await a(),await (0,t.writeFile)(i(),JSON.stringify(e,null,2),"utf8")}async function d(e){return c(async()=>{let t=await o();await l({...t,...e})})}async function u(e){return c(async()=>{let t=e({...await o()});return await l(t),t})}e.s(["readConfig",0,o,"updateConfig",0,u,"writeConfig",0,d])},223741,473845,e=>{"use strict";let t,r,n,i,a,o,s,c,l,d,u;var p,f,h,m,y=e.i(563811),g=e.i(560912);async function w(t,r){let n;if(t.database)n="function"==typeof t.database?t.database(t):await r(t);else{let r=Object.keys((0,y.getAuthTables)(t)).reduce((e,t)=>(e[t]=[],e),{}),{memoryAdapter:i}=await e.A(168315);n=i(r)(t)}return n.transaction||(g.logger.warn("Adapter does not correctly implement transaction function, patching it automatically. Please update your adapter implementation."),n.transaction=async e=>e(n)),n}var b=e.i(451894);async function A(t){return w(t,async t=>{let{createKyselyAdapter:r}=await e.A(317691),{kysely:n,databaseType:i,transaction:a}=await r(t);if(!n)throw new b.BetterAuthError("Failed to initialize database adapter");let{kyselyAdapter:o}=await e.A(317691);return o(n,{type:i||"sqlite",debugLogs:!!t.database&&"debugLogs"in t.database&&t.database.debugLogs,transaction:a})(t)})}var E=e.i(177730);function v(e){return"-"===e||"^"===e||"$"===e||"+"===e||"."===e||"("===e||")"===e||"|"===e||"["===e||"]"===e||"{"===e||"}"===e||"*"===e||"?"===e||"\\"===e?`\\${e}`:e}function k(e,t){if("string"!=typeof t)throw TypeError(`Sample must be a string, but ${typeof t} given`);return e.test(t)}function _(e,t){if("string"!=typeof e&&!Array.isArray(e))throw TypeError(`The first argument must be a single pattern string or an array of patterns, but ${typeof e} given`);if(("string"==typeof t||"boolean"==typeof t)&&(t={separator:t}),2==arguments.length&&!(void 0===t||"object"==typeof t&&null!==t&&!Array.isArray(t)))throw TypeError(`The second argument must be an options object or a string/boolean separator, but ${typeof t} given`);if("\\"===(t=t||{}).separator)throw Error("\\ is not a valid separator because it is used for escaping. Try setting the separator to `true` instead");let r=function e(t,r=!0){if(Array.isArray(t))return`(?:${t.map(t=>`^${e(t,r)}$`).join("|")})`;let n="",i="",a=".";!0===r?(n="/",i="[/\\\\]",a="[^/\\\\]"):r&&((i=function(e){let t="";for(let r=0;r<e.length;r++)t+=v(e[r]);return t}(n=r)).length>1?(i=`(?:${i})`,a=`((?!${i}).)`):a=`[^${i}]`);let o=r?`${i}+?`:"",s=r?`${i}*?`:"",c=r?t.split(n):[t],l="";for(let e=0;e<c.length;e++){let t=c[e],n=c[e+1],i="";if(t||!(e>0)){if(r&&(i=e===c.length-1?s:"**"!==n?o:""),r&&"**"===t){i&&(l+=0===e?"":i,l+=`(?:${a}*?${i})*?`);continue}for(let e=0;e<t.length;e++){let r=t[e];"\\"===r?e<t.length-1&&(l+=v(t[e+1]),e++):"?"===r?l+=a:"*"===r?l+=`${a}*?`:l+=v(r)}l+=i}}return l}(e,t.separator),n=RegExp(`^${r}$`,t.flags),i=k.bind(null,n);return i.options=t,i.pattern=e,i.regexp=n,i}var S=e.i(426232);function x(e){let t=e.length;for(;t>0&&47===e.charCodeAt(t-1);)t--;return t===e.length?e:e.slice(0,t)}function T(e,t="/api/auth"){try{let t=new URL(e);if("http:"!==t.protocol&&"https:"!==t.protocol)throw new b.BetterAuthError(`Invalid base URL: ${e}. URL must include 'http://' or 'https://'`)}catch(t){if(t instanceof b.BetterAuthError)throw t;throw new b.BetterAuthError(`Invalid base URL: ${e}. Please provide a valid base URL.`,{cause:t})}if(function(e){try{return"/"!==(x(new URL(e).pathname)||"/")}catch{throw new b.BetterAuthError(`Invalid base URL: ${e}. Please provide a valid base URL.`)}}(e))return e;let r=x(e);return t&&"/"!==t?(t=t.startsWith("/")?t:`/${t}`,`${r}${t}`):r}function R(e,t){return!!e&&""!==e.trim()&&("proto"===t?"http"===e||"https"===e:"host"===t&&![/\.\./,/\0/,/[\s]/,/^[.]/,/[<>'"]/,/javascript:/i,/file:/i,/data:/i].some(t=>t.test(e))&&(/^[a-zA-Z0-9]([a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(\.[a-zA-Z0-9]([a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*(:[0-9]{1,5})?$/.test(e)||/^(\d{1,3}\.){3}\d{1,3}(:[0-9]{1,5})?$/.test(e)||/^\[[0-9a-fA-F:]+\](:[0-9]{1,5})?$/.test(e)||/^localhost(:[0-9]{1,5})?$/i.test(e)))}function I(e,t,r,n,i){if(e)return T(e,t);if(!1!==n){let e=S.env.BETTER_AUTH_URL||S.env.NEXT_PUBLIC_BETTER_AUTH_URL||S.env.PUBLIC_BETTER_AUTH_URL||S.env.NUXT_PUBLIC_BETTER_AUTH_URL||S.env.NUXT_PUBLIC_AUTH_URL||("/"!==S.env.BASE_URL?S.env.BASE_URL:void 0);if(e)return T(e,t)}let a=r?.headers.get("x-forwarded-host"),o=r?.headers.get("x-forwarded-proto");if(a&&o&&i&&R(o,"proto")&&R(a,"host"))try{return T(`${o}://${a}`,t)}catch(e){}if(r){let e=U(r.url);if(!e)throw new b.BetterAuthError("Could not get origin from request. Please provide a valid base URL.");return T(e,t)}}function U(e){try{let t=new URL(e);return"null"===t.origin?null:t.origin}catch{return null}}function O(e){return"object"==typeof e&&null!==e&&"allowedHosts"in e&&Array.isArray(e.allowedHosts)}function P(e){return e instanceof Request||"object"==typeof e&&null!==e&&"[object Request]"===Object.prototype.toString.call(e)&&"string"==typeof e.url&&"object"==typeof e.headers&&null!==e.headers&&"function"==typeof e.headers.get}function C(e,t){let r=P(e)?e.headers:e;if(t){let e=r.get("x-forwarded-host");if(e&&R(e,"host"))return e}let n=r.get("host");if(n&&R(n,"host"))return n;if(P(e))try{return new URL(e.url).host}catch{}return null}let D=(e,t,r)=>{if(e.startsWith("/"))return!!r?.allowRelativePaths&&e.startsWith("/")&&/^\/(?!\/|\\|%2f|%5c)[\w\-.\+/@]*(?:\?[\w\-.\+/=&%@]*)?$/.test(e);if(t.includes("*")||t.includes("?")){if(t.includes("://"))return _(t)(U(e)||e);let r=function(e){try{return new URL(e).host}catch{return null}}(e);return!!r&&_(t)(r)}let n=function(e){try{return new URL(e).protocol}catch{return null}}(e);return"http:"!==n&&"https:"!==n&&n?e.startsWith(t):t===U(e)};function L(e){return!!e&&("object"==typeof e||"function"==typeof e)&&"function"==typeof e.then}var z=e.i(666680);function $(e,t){return new Promise((r,n)=>{(0,z.scrypt)(e.normalize("NFKC"),t,64,{N:16384,r:16,p:1,maxmem:0x4000000},(e,t)=>{e?n(e):r(t)})})}async function N(e){let t=(0,z.randomBytes)(16).toString("hex"),r=await $(e,t);return`${t}:${r.toString("hex")}`}async function j(e,t){let[r,n]=e.split(":");if(!r||!n)throw Error("Invalid password hash");return(await $(t,r)).toString("hex")===n}let H=async({hash:e,password:t})=>j(e,t);function B(e,t=""){if("number"!=typeof e){let r=t&&`"${t}" `;throw TypeError(`${r}expected number, got ${typeof e}`)}if(!Number.isSafeInteger(e)||e<0){let r=t&&`"${t}" `;throw RangeError(`${r}expected integer >= 0, got ${e}`)}}function V(e,t,r=""){let n=e instanceof Uint8Array||ArrayBuffer.isView(e)&&"Uint8Array"===e.constructor.name&&"BYTES_PER_ELEMENT"in e&&1===e.BYTES_PER_ELEMENT,i=e?.length,a=void 0!==t;if(!n||a&&i!==t){let o=(r&&`"${r}" `)+"expected Uint8Array"+(a?` of length ${t}`:"")+", got "+(n?`length=${i}`:`type=${typeof e}`);if(!n)throw TypeError(o);throw RangeError(o)}return e}function M(e){if("function"!=typeof e||"function"!=typeof e.create)throw TypeError("Hash must wrapped by utils.createHasher");if(B(e.outputLen),B(e.blockLen),e.outputLen<1)throw Error('"outputLen" must be >= 1');if(e.blockLen<1)throw Error('"blockLen" must be >= 1')}function K(e,t=!0){if(e.destroyed)throw Error("Hash instance has been destroyed");if(t&&e.finished)throw Error("Hash#digest() has already been called")}function W(e,t){V(e,void 0,"digestInto() output");let r=t.outputLen;if(e.length<r)throw RangeError('"digestInto() output" expected to be of length >='+r)}function q(...e){for(let t=0;t<e.length;t++)e[t].fill(0)}function F(e){return new DataView(e.buffer,e.byteOffset,e.byteLength)}function J(e,t){return e<<32-t|e>>>t}class Z{oHash;iHash;blockLen;outputLen;canXOF=!1;finished=!1;destroyed=!1;constructor(e,t){if(M(e),V(t,void 0,"key"),this.iHash=e.create(),"function"!=typeof this.iHash.update)throw Error("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;const r=this.blockLen,n=new Uint8Array(r);n.set(t.length>r?e.create().update(t).digest():t);for(let e=0;e<n.length;e++)n[e]^=54;this.iHash.update(n),this.oHash=e.create();for(let e=0;e<n.length;e++)n[e]^=106;this.oHash.update(n),q(n)}update(e){return K(this),this.iHash.update(e),this}digestInto(e){K(this),W(e,this),this.finished=!0;let t=e.subarray(0,this.outputLen);this.iHash.digestInto(t),this.oHash.update(t),this.oHash.digestInto(t),this.destroy()}digest(){let e=new Uint8Array(this.oHash.outputLen);return this.digestInto(e),e}_cloneInto(e){e||=Object.create(Object.getPrototypeOf(this),{});let{oHash:t,iHash:r,finished:n,destroyed:i,blockLen:a,outputLen:o}=this;return e.finished=n,e.destroyed=i,e.blockLen=a,e.outputLen=o,e.oHash=t._cloneInto(e.oHash),e.iHash=r._cloneInto(e.iHash),e}clone(){return this._cloneInto()}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}}let G=((o=(e,t,r)=>new Z(e,t).update(r).digest()).create=(e,t)=>new Z(e,t),o),Q=Uint8Array.of(0),Y=Uint8Array.of();class X{blockLen;outputLen;canXOF=!1;padOffset;isLE;buffer;view;finished=!1;length=0;pos=0;destroyed=!1;constructor(e,t,r,n){this.blockLen=e,this.outputLen=t,this.padOffset=r,this.isLE=n,this.buffer=new Uint8Array(e),this.view=F(this.buffer)}update(e){K(this),V(e);let{view:t,buffer:r,blockLen:n}=this,i=e.length;for(let a=0;a<i;){let o=Math.min(n-this.pos,i-a);if(o===n){let t=F(e);for(;n<=i-a;a+=n)this.process(t,a);continue}r.set(e.subarray(a,a+o),this.pos),this.pos+=o,a+=o,this.pos===n&&(this.process(t,0),this.pos=0)}return this.length+=e.length,this.roundClean(),this}digestInto(e){K(this),W(e,this),this.finished=!0;let{buffer:t,view:r,blockLen:n,isLE:i}=this,{pos:a}=this;t[a++]=128,q(this.buffer.subarray(a)),this.padOffset>n-a&&(this.process(r,0),a=0);for(let e=a;e<n;e++)t[e]=0;r.setBigUint64(n-8,BigInt(8*this.length),i),this.process(r,0);let o=F(e),s=this.outputLen;if(s%4)throw Error("_sha2: outputLen must be aligned to 32bit");let c=s/4,l=this.get();if(c>l.length)throw Error("_sha2: outputLen bigger than state");for(let e=0;e<c;e++)o.setUint32(4*e,l[e],i)}digest(){let{buffer:e,outputLen:t}=this;this.digestInto(e);let r=e.slice(0,t);return this.destroy(),r}_cloneInto(e){(e||=new this.constructor).set(...this.get());let{blockLen:t,buffer:r,length:n,finished:i,destroyed:a,pos:o}=this;return e.destroyed=a,e.finished=i,e.length=n,e.pos=o,n%t&&e.buffer.set(r),e}clone(){return this._cloneInto()}}let ee=Uint32Array.from([0x6a09e667,0xbb67ae85,0x3c6ef372,0xa54ff53a,0x510e527f,0x9b05688c,0x1f83d9ab,0x5be0cd19]),et=Uint32Array.from([0xc1059ed8,0x367cd507,0x3070dd17,0xf70e5939,0xffc00b31,0x68581511,0x64f98fa7,0xbefa4fa4]),er=Uint32Array.from([0xcbbb9d5d,0xc1059ed8,0x629a292a,0x367cd507,0x9159015a,0x3070dd17,0x152fecd8,0xf70e5939,0x67332667,0xffc00b31,0x8eb44a87,0x68581511,0xdb0c2e0d,0x64f98fa7,0x47b5481d,0xbefa4fa4]),en=Uint32Array.from([0x6a09e667,0xf3bcc908,0xbb67ae85,0x84caa73b,0x3c6ef372,0xfe94f82b,0xa54ff53a,0x5f1d36f1,0x510e527f,0xade682d1,0x9b05688c,0x2b3e6c1f,0x1f83d9ab,0xfb41bd6b,0x5be0cd19,0x137e2179]),ei=BigInt(0x100000000-1),ea=BigInt(32),eo=Uint32Array.from([0x428a2f98,0x71374491,0xb5c0fbcf,0xe9b5dba5,0x3956c25b,0x59f111f1,0x923f82a4,0xab1c5ed5,0xd807aa98,0x12835b01,0x243185be,0x550c7dc3,0x72be5d74,0x80deb1fe,0x9bdc06a7,0xc19bf174,0xe49b69c1,0xefbe4786,0xfc19dc6,0x240ca1cc,0x2de92c6f,0x4a7484aa,0x5cb0a9dc,0x76f988da,0x983e5152,0xa831c66d,0xb00327c8,0xbf597fc7,0xc6e00bf3,0xd5a79147,0x6ca6351,0x14292967,0x27b70a85,0x2e1b2138,0x4d2c6dfc,0x53380d13,0x650a7354,0x766a0abb,0x81c2c92e,0x92722c85,0xa2bfe8a1,0xa81a664b,0xc24b8b70,0xc76c51a3,0xd192e819,0xd6990624,0xf40e3585,0x106aa070,0x19a4c116,0x1e376c08,0x2748774c,0x34b0bcb5,0x391c0cb3,0x4ed8aa4a,0x5b9cca4f,0x682e6ff3,0x748f82ee,0x78a5636f,0x84c87814,0x8cc70208,0x90befffa,0xa4506ceb,0xbef9a3f7,0xc67178f2]),es=new Uint32Array(64);class ec extends X{constructor(e){super(64,e,8,!1)}get(){let{A:e,B:t,C:r,D:n,E:i,F:a,G:o,H:s}=this;return[e,t,r,n,i,a,o,s]}set(e,t,r,n,i,a,o,s){this.A=0|e,this.B=0|t,this.C=0|r,this.D=0|n,this.E=0|i,this.F=0|a,this.G=0|o,this.H=0|s}process(e,t){for(let r=0;r<16;r++,t+=4)es[r]=e.getUint32(t,!1);for(let e=16;e<64;e++){let t=es[e-15],r=es[e-2],n=J(t,7)^J(t,18)^t>>>3,i=J(r,17)^J(r,19)^r>>>10;es[e]=i+es[e-7]+n+es[e-16]|0}let{A:r,B:n,C:i,D:a,E:o,F:s,G:c,H:l}=this;for(let e=0;e<64;e++){var d,u,p,f;let t=l+(J(o,6)^J(o,11)^J(o,25))+((d=o)&s^~d&c)+eo[e]+es[e]|0,h=(J(r,2)^J(r,13)^J(r,22))+((u=r)&(p=n)^u&(f=i)^p&f)|0;l=c,c=s,s=o,o=a+t|0,a=i,i=n,n=r,r=t+h|0}r=r+this.A|0,n=n+this.B|0,i=i+this.C|0,a=a+this.D|0,o=o+this.E|0,s=s+this.F|0,c=c+this.G|0,l=l+this.H|0,this.set(r,n,i,a,o,s,c,l)}roundClean(){q(es)}destroy(){this.destroyed=!0,this.set(0,0,0,0,0,0,0,0),q(this.buffer)}}class el extends ec{A=0|ee[0];B=0|ee[1];C=0|ee[2];D=0|ee[3];E=0|ee[4];F=0|ee[5];G=0|ee[6];H=0|ee[7];constructor(){super(32)}}let ed=function(e,t=!1){let r=e.length,n=new Uint32Array(r),i=new Uint32Array(r);for(let a=0;a<r;a++){let{h:r,l:o}=function(e,t=!1){return t?{h:Number(e&ei),l:Number(e>>ea&ei)}:{h:0|Number(e>>ea&ei),l:0|Number(e&ei)}}(e[a],t);[n[a],i[a]]=[r,o]}return[n,i]}(["0x428a2f98d728ae22","0x7137449123ef65cd","0xb5c0fbcfec4d3b2f","0xe9b5dba58189dbbc","0x3956c25bf348b538","0x59f111f1b605d019","0x923f82a4af194f9b","0xab1c5ed5da6d8118","0xd807aa98a3030242","0x12835b0145706fbe","0x243185be4ee4b28c","0x550c7dc3d5ffb4e2","0x72be5d74f27b896f","0x80deb1fe3b1696b1","0x9bdc06a725c71235","0xc19bf174cf692694","0xe49b69c19ef14ad2","0xefbe4786384f25e3","0x0fc19dc68b8cd5b5","0x240ca1cc77ac9c65","0x2de92c6f592b0275","0x4a7484aa6ea6e483","0x5cb0a9dcbd41fbd4","0x76f988da831153b5","0x983e5152ee66dfab","0xa831c66d2db43210","0xb00327c898fb213f","0xbf597fc7beef0ee4","0xc6e00bf33da88fc2","0xd5a79147930aa725","0x06ca6351e003826f","0x142929670a0e6e70","0x27b70a8546d22ffc","0x2e1b21385c26c926","0x4d2c6dfc5ac42aed","0x53380d139d95b3df","0x650a73548baf63de","0x766a0abb3c77b2a8","0x81c2c92e47edaee6","0x92722c851482353b","0xa2bfe8a14cf10364","0xa81a664bbc423001","0xc24b8b70d0f89791","0xc76c51a30654be30","0xd192e819d6ef5218","0xd69906245565a910","0xf40e35855771202a","0x106aa07032bbd1b8","0x19a4c116b8d2d0c8","0x1e376c085141ab53","0x2748774cdf8eeb99","0x34b0bcb5e19b48a8","0x391c0cb3c5c95a63","0x4ed8aa4ae3418acb","0x5b9cca4f7763e373","0x682e6ff3d6b2b8a3","0x748f82ee5defb2fc","0x78a5636f43172f60","0x84c87814a1f0ab72","0x8cc702081a6439ec","0x90befffa23631e28","0xa4506cebde82bde9","0xbef9a3f7b2c67915","0xc67178f2e372532b","0xca273eceea26619c","0xd186b8c721c0c207","0xeada7dd6cde0eb1e","0xf57d4f7fee6ed178","0x06f067aa72176fba","0x0a637dc5a2c898a6","0x113f9804bef90dae","0x1b710b35131c471b","0x28db77f523047d84","0x32caab7b40c72493","0x3c9ebe0a15c9bebc","0x431d67c49c100d4c","0x4cc5d4becb3e42b6","0x597f299cfc657e2a","0x5fcb6fab3ad6faec","0x6c44198c4a475817"].map(e=>BigInt(e))),eu=ed[0],ep=ed[1],ef=new Uint32Array(80),eh=new Uint32Array(80),em=function(e,t={}){let r=(t,r)=>e(r).update(t).digest(),n=e(void 0);return r.outputLen=n.outputLen,r.blockLen=n.blockLen,r.canXOF=n.canXOF,r.create=t=>e(t),Object.assign(r,t),Object.freeze(r)}(()=>new el,{oid:Uint8Array.from([6,9,96,134,72,1,101,3,4,2,1])}),ey=new TextEncoder,eg=new TextDecoder;function ew(...e){let t=new Uint8Array(e.reduce((e,{length:t})=>e+t,0)),r=0;for(let n of e)t.set(n,r),r+=n.length;return t}function eb(e,t,r){if(t<0||t>=0x100000000)throw RangeError(`value must be >= 0 and <= ${0x100000000-1}. Received ${t}`);e.set([t>>>24,t>>>16,t>>>8,255&t],r)}function eA(e){let t=Math.floor(e/0x100000000),r=new Uint8Array(8);return eb(r,t,0),eb(r,e%0x100000000,4),r}function eE(e){let t=new Uint8Array(4);return eb(t,e),t}function ev(e){let t=new Uint8Array(e.length);for(let r=0;r<e.length;r++){let n=e.charCodeAt(r);if(n>127)throw TypeError("non-ASCII string encountered in encode()");t[r]=n}return t}function ek(e){if(Uint8Array.fromBase64)return Uint8Array.fromBase64("string"==typeof e?e:eg.decode(e),{alphabet:"base64url"});let t=e;t instanceof Uint8Array&&(t=eg.decode(t)),t=t.replace(/-/g,"+").replace(/_/g,"/");try{var r=t;if(Uint8Array.fromBase64)return Uint8Array.fromBase64(r);let e=atob(r),n=new Uint8Array(e.length);for(let t=0;t<e.length;t++)n[t]=e.charCodeAt(t);return n}catch{throw TypeError("The input to be decoded is not correctly encoded.")}}function e_(e){let t=e;return("string"==typeof t&&(t=ey.encode(t)),Uint8Array.prototype.toBase64)?t.toBase64({alphabet:"base64url",omitPadding:!0}):(function(e){if(Uint8Array.prototype.toBase64)return e.toBase64();let t=[];for(let r=0;r<e.length;r+=32768)t.push(String.fromCharCode.apply(null,e.subarray(r,r+32768)));return btoa(t.join(""))})(t).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}e.s(["decode",0,ek,"encode",0,e_],797379);let eS=Symbol();function ex(e,t){if(e)throw TypeError(`${t} can only be called once`)}function eT(e,t,r){try{return ek(e)}catch{throw new r(`Failed to base64url decode the ${t}`)}}async function eR(e,t){let r=`SHA-${e.slice(-3)}`;return new Uint8Array(await crypto.subtle.digest(r,t))}let eI=(e,t="algorithm.name")=>TypeError(`CryptoKey does not support this operation, its ${t} must be ${e}`);function eU(e,t){if(parseInt(e.hash.name.slice(4),10)!==t)throw eI(`SHA-${t}`,"algorithm.hash")}function eO(e,t){if(t&&!e.usages.includes(t))throw TypeError(`CryptoKey does not support this operation, its usages must include ${t}.`)}function eP(e,t,r){switch(t){case"A128GCM":case"A192GCM":case"A256GCM":{if("AES-GCM"!==e.algorithm.name)throw eI("AES-GCM");let r=parseInt(t.slice(1,4),10);if(e.algorithm.length!==r)throw eI(r,"algorithm.length");break}case"A128KW":case"A192KW":case"A256KW":{if("AES-KW"!==e.algorithm.name)throw eI("AES-KW");let r=parseInt(t.slice(1,4),10);if(e.algorithm.length!==r)throw eI(r,"algorithm.length");break}case"ECDH":switch(e.algorithm.name){case"ECDH":case"X25519":break;default:throw eI("ECDH or X25519")}break;case"PBES2-HS256+A128KW":case"PBES2-HS384+A192KW":case"PBES2-HS512+A256KW":if("PBKDF2"!==e.algorithm.name)throw eI("PBKDF2");break;case"RSA-OAEP":case"RSA-OAEP-256":case"RSA-OAEP-384":case"RSA-OAEP-512":if("RSA-OAEP"!==e.algorithm.name)throw eI("RSA-OAEP");eU(e.algorithm,parseInt(t.slice(9),10)||1);break;default:throw TypeError("CryptoKey does not support this operation")}eO(e,r)}function eC(e,t,...r){if((r=r.filter(Boolean)).length>2){let t=r.pop();e+=`one of type ${r.join(", ")}, or ${t}.`}else 2===r.length?e+=`one of type ${r[0]} or ${r[1]}.`:e+=`of type ${r[0]}.`;return null==t?e+=` Received ${t}`:"function"==typeof t&&t.name?e+=` Received function ${t.name}`:"object"==typeof t&&null!=t&&t.constructor?.name&&(e+=` Received an instance of ${t.constructor.name}`),e}let eD=(e,...t)=>eC("Key must be ",e,...t),eL=(e,t,...r)=>eC(`Key for the ${e} algorithm must be `,t,...r);class ez extends Error{static code="ERR_JOSE_GENERIC";code="ERR_JOSE_GENERIC";constructor(e,t){super(e,t),this.name=this.constructor.name,Error.captureStackTrace?.(this,this.constructor)}}class e$ extends ez{static code="ERR_JWT_CLAIM_VALIDATION_FAILED";code="ERR_JWT_CLAIM_VALIDATION_FAILED";claim;reason;payload;constructor(e,t,r="unspecified",n="unspecified"){super(e,{cause:{claim:r,reason:n,payload:t}}),this.claim=r,this.reason=n,this.payload=t}}class eN extends ez{static code="ERR_JWT_EXPIRED";code="ERR_JWT_EXPIRED";claim;reason;payload;constructor(e,t,r="unspecified",n="unspecified"){super(e,{cause:{claim:r,reason:n,payload:t}}),this.claim=r,this.reason=n,this.payload=t}}class ej extends ez{static code="ERR_JOSE_ALG_NOT_ALLOWED";code="ERR_JOSE_ALG_NOT_ALLOWED"}class eH extends ez{static code="ERR_JOSE_NOT_SUPPORTED";code="ERR_JOSE_NOT_SUPPORTED"}class eB extends ez{static code="ERR_JWE_DECRYPTION_FAILED";code="ERR_JWE_DECRYPTION_FAILED";constructor(e="decryption operation failed",t){super(e,t)}}class eV extends ez{static code="ERR_JWE_INVALID";code="ERR_JWE_INVALID"}class eM extends ez{static code="ERR_JWS_INVALID";code="ERR_JWS_INVALID"}class eK extends ez{static code="ERR_JWT_INVALID";code="ERR_JWT_INVALID"}class eW extends ez{static code="ERR_JWK_INVALID";code="ERR_JWK_INVALID"}class eq extends ez{static code="ERR_JWKS_INVALID";code="ERR_JWKS_INVALID"}class eF extends ez{static code="ERR_JWKS_NO_MATCHING_KEY";code="ERR_JWKS_NO_MATCHING_KEY";constructor(e="no applicable key found in the JSON Web Key Set",t){super(e,t)}}class eJ extends ez{[Symbol.asyncIterator];static code="ERR_JWKS_MULTIPLE_MATCHING_KEYS";code="ERR_JWKS_MULTIPLE_MATCHING_KEYS";constructor(e="multiple matching keys found in the JSON Web Key Set",t){super(e,t)}}class eZ extends ez{static code="ERR_JWKS_TIMEOUT";code="ERR_JWKS_TIMEOUT";constructor(e="request timed out",t){super(e,t)}}class eG extends ez{static code="ERR_JWS_SIGNATURE_VERIFICATION_FAILED";code="ERR_JWS_SIGNATURE_VERIFICATION_FAILED";constructor(e="signature verification failed",t){super(e,t)}}function eQ(e){if(!eY(e))throw Error("CryptoKey instance expected")}let eY=e=>{if(e?.[Symbol.toStringTag]==="CryptoKey")return!0;try{return e instanceof CryptoKey}catch{return!1}},eX=e=>e?.[Symbol.toStringTag]==="KeyObject",e0=e=>eY(e)||eX(e);function e1(e){switch(e){case"A128GCM":return 128;case"A192GCM":return 192;case"A256GCM":case"A128CBC-HS256":return 256;case"A192CBC-HS384":return 384;case"A256CBC-HS512":return 512;default:throw new eH(`Unsupported JWE Algorithm: ${e}`)}}let e2=e=>crypto.getRandomValues(new Uint8Array(e1(e)>>3));function e6(e,t){let r=e.byteLength<<3;if(r!==t)throw new eV(`Invalid Content Encryption Key length. Expected ${t} bits, got ${r} bits`)}function e5(e){switch(e){case"A128GCM":case"A128GCMKW":case"A192GCM":case"A192GCMKW":case"A256GCM":case"A256GCMKW":return 96;case"A128CBC-HS256":case"A192CBC-HS384":case"A256CBC-HS512":return 128;default:throw new eH(`Unsupported JWE Algorithm: ${e}`)}}function e8(e,t){if(t.length<<3!==e5(e))throw new eV("Invalid Initialization Vector length")}async function e4(e,t,r){if(!(t instanceof Uint8Array))throw TypeError(eD(t,"Uint8Array"));let n=parseInt(e.slice(1,4),10);return{encKey:await crypto.subtle.importKey("raw",t.subarray(n>>3),"AES-CBC",!1,[r]),macKey:await crypto.subtle.importKey("raw",t.subarray(0,n>>3),{hash:`SHA-${n<<1}`,name:"HMAC"},!1,["sign"]),keySize:n}}async function e3(e,t,r){return new Uint8Array((await crypto.subtle.sign("HMAC",e,t)).slice(0,r>>3))}async function e9(e,t,r,n,i){let{encKey:a,macKey:o,keySize:s}=await e4(e,r,"encrypt"),c=new Uint8Array(await crypto.subtle.encrypt({iv:n,name:"AES-CBC"},a,t)),l=ew(i,n,c,eA(i.length<<3));return{ciphertext:c,tag:await e3(o,l,s),iv:n}}async function e7(e,t){if(!(e instanceof Uint8Array))throw TypeError("First argument must be a buffer");if(!(t instanceof Uint8Array))throw TypeError("Second argument must be a buffer");let r={name:"HMAC",hash:"SHA-256"},n=await crypto.subtle.generateKey(r,!1,["sign"]),i=new Uint8Array(await crypto.subtle.sign(r,n,e)),a=new Uint8Array(await crypto.subtle.sign(r,n,t)),o=0,s=-1;for(;++s<32;)o|=i[s]^a[s];return 0===o}async function te(e,t,r,n,i,a){let o,s,{encKey:c,macKey:l,keySize:d}=await e4(e,t,"decrypt"),u=ew(a,n,r,eA(a.length<<3)),p=await e3(l,u,d);try{o=await e7(i,p)}catch{}if(!o)throw new eB;try{s=new Uint8Array(await crypto.subtle.decrypt({iv:n,name:"AES-CBC"},c,r))}catch{}if(!s)throw new eB;return s}async function tt(e,t,r,n,i){let a;r instanceof Uint8Array?a=await crypto.subtle.importKey("raw",r,"AES-GCM",!1,["encrypt"]):(eP(r,e,"encrypt"),a=r);let o=new Uint8Array(await crypto.subtle.encrypt({additionalData:i,iv:n,name:"AES-GCM",tagLength:128},a,t)),s=o.slice(-16);return{ciphertext:o.slice(0,-16),tag:s,iv:n}}async function tr(e,t,r,n,i,a){let o;t instanceof Uint8Array?o=await crypto.subtle.importKey("raw",t,"AES-GCM",!1,["decrypt"]):(eP(t,e,"decrypt"),o=t);try{return new Uint8Array(await crypto.subtle.decrypt({additionalData:a,iv:n,name:"AES-GCM",tagLength:128},o,ew(r,i)))}catch{throw new eB}}let tn="Unsupported JWE Content Encryption Algorithm";async function ti(e,t,r,n,i){if(!eY(r)&&!(r instanceof Uint8Array))throw TypeError(eD(r,"CryptoKey","KeyObject","Uint8Array","JSON Web Key"));if(n)e8(e,n);else n=crypto.getRandomValues(new Uint8Array(e5(e)>>3));switch(e){case"A128CBC-HS256":case"A192CBC-HS384":case"A256CBC-HS512":return r instanceof Uint8Array&&e6(r,parseInt(e.slice(-3),10)),e9(e,t,r,n,i);case"A128GCM":case"A192GCM":case"A256GCM":return r instanceof Uint8Array&&e6(r,parseInt(e.slice(1,4),10)),tt(e,t,r,n,i);default:throw new eH(tn)}}async function ta(e,t,r,n,i,a){if(!eY(t)&&!(t instanceof Uint8Array))throw TypeError(eD(t,"CryptoKey","KeyObject","Uint8Array","JSON Web Key"));if(!n)throw new eV("JWE Initialization Vector missing");if(!i)throw new eV("JWE Authentication Tag missing");switch(e8(e,n),e){case"A128CBC-HS256":case"A192CBC-HS384":case"A256CBC-HS512":return t instanceof Uint8Array&&e6(t,parseInt(e.slice(-3),10)),te(e,t,r,n,i,a);case"A128GCM":case"A192GCM":case"A256GCM":return t instanceof Uint8Array&&e6(t,parseInt(e.slice(1,4),10)),tr(e,t,r,n,i,a);default:throw new eH(tn)}}function to(e,t){if(e.algorithm.length!==parseInt(t.slice(1,4),10))throw TypeError(`Invalid key size for alg: ${t}`)}function ts(e,t,r){return e instanceof Uint8Array?crypto.subtle.importKey("raw",e,"AES-KW",!0,[r]):(eP(e,t,r),e)}async function tc(e,t,r){let n=await ts(t,e,"wrapKey");to(n,e);let i=await crypto.subtle.importKey("raw",r,{hash:"SHA-256",name:"HMAC"},!0,["sign"]);return new Uint8Array(await crypto.subtle.wrapKey("raw",i,n,"AES-KW"))}async function tl(e,t,r){let n=await ts(t,e,"unwrapKey");to(n,e);let i=await crypto.subtle.unwrapKey("raw",r,n,"AES-KW",{hash:"SHA-256",name:"HMAC"},!0,["sign"]);return new Uint8Array(await crypto.subtle.exportKey("raw",i))}function td(e){return ew(eE(e.length),e)}async function tu(e,t,r){let n=t>>3,i=Math.ceil(n/32),a=new Uint8Array(32*i);for(let t=1;t<=i;t++){let n=new Uint8Array(4+e.length+r.length);n.set(eE(t),0),n.set(e,4),n.set(r,4+e.length);let i=await eR("sha256",n);a.set(i,(t-1)*32)}return a.slice(0,n)}async function tp(e,t,r,n,i=new Uint8Array,a=new Uint8Array){var o;eP(e,"ECDH"),eP(t,"ECDH","deriveBits");let s=ew(td(ev(r)),td(i),td(a),eE(n),new Uint8Array);return tu(new Uint8Array(await crypto.subtle.deriveBits({name:e.algorithm.name,public:e},t,"X25519"===(o=e).algorithm.name?256:Math.ceil(parseInt(o.algorithm.namedCurve.slice(-3),10)/8)<<3)),n,s)}function tf(e){switch(e.algorithm.namedCurve){case"P-256":case"P-384":case"P-521":return!0;default:return"X25519"===e.algorithm.name}}async function th(e,t,r,n){if(!(e instanceof Uint8Array)||e.length<8)throw new eV("PBES2 Salt Input must be 8 or more octets");if(!Number.isSafeInteger(r)||1!==Math.sign(r))throw new eV("PBES2 Count Input must be a positive integer");let i=ew(ev(t),Uint8Array.of(0),e),a=parseInt(t.slice(13,16),10),o={hash:`SHA-${t.slice(8,11)}`,iterations:r,name:"PBKDF2",salt:i},s=await (n instanceof Uint8Array?crypto.subtle.importKey("raw",n,"PBKDF2",!1,["deriveBits"]):(eP(n,t,"deriveBits"),n));return new Uint8Array(await crypto.subtle.deriveBits(o,s,a))}async function tm(e,t,r,n=2048,i=crypto.getRandomValues(new Uint8Array(16))){let a=await th(i,e,n,t);return{encryptedKey:await tc(e.slice(-6),a,r),p2c:n,p2s:e_(i)}}async function ty(e,t,r,n,i){let a=await th(i,e,n,t);return tl(e.slice(-6),a,r)}function tg(e,t){if(e.startsWith("RS")||e.startsWith("PS")){let{modulusLength:r}=t.algorithm;if("number"!=typeof r||r<2048)throw TypeError(`${e} requires key modulusLength to be 2048 bits or larger`)}}function tw(e,t){let r=`SHA-${e.slice(-3)}`;switch(e){case"HS256":case"HS384":case"HS512":return{hash:r,name:"HMAC"};case"PS256":case"PS384":case"PS512":return{hash:r,name:"RSA-PSS",saltLength:parseInt(e.slice(-3),10)>>3};case"RS256":case"RS384":case"RS512":return{hash:r,name:"RSASSA-PKCS1-v1_5"};case"ES256":case"ES384":case"ES512":return{hash:r,name:"ECDSA",namedCurve:t.namedCurve};case"Ed25519":case"EdDSA":return{name:"Ed25519"};case"ML-DSA-44":case"ML-DSA-65":case"ML-DSA-87":return{name:e};default:throw new eH(`alg ${e} is not supported either by JOSE or your javascript runtime`)}}async function tb(e,t,r){if(t instanceof Uint8Array){if(!e.startsWith("HS"))throw TypeError(eD(t,"CryptoKey","KeyObject","JSON Web Key"));return crypto.subtle.importKey("raw",t,{hash:`SHA-${e.slice(-3)}`,name:"HMAC"},!1,[r])}switch(e){case"HS256":case"HS384":case"HS512":if("HMAC"!==t.algorithm.name)throw eI("HMAC");eU(t.algorithm,parseInt(e.slice(2),10));break;case"RS256":case"RS384":case"RS512":if("RSASSA-PKCS1-v1_5"!==t.algorithm.name)throw eI("RSASSA-PKCS1-v1_5");eU(t.algorithm,parseInt(e.slice(2),10));break;case"PS256":case"PS384":case"PS512":if("RSA-PSS"!==t.algorithm.name)throw eI("RSA-PSS");eU(t.algorithm,parseInt(e.slice(2),10));break;case"Ed25519":case"EdDSA":if("Ed25519"!==t.algorithm.name)throw eI("Ed25519");break;case"ML-DSA-44":case"ML-DSA-65":case"ML-DSA-87":let n;if(n=t.algorithm,n.name!==e)throw eI(e);break;case"ES256":case"ES384":case"ES512":{if("ECDSA"!==t.algorithm.name)throw eI("ECDSA");let r=function(e){switch(e){case"ES256":return"P-256";case"ES384":return"P-384";case"ES512":return"P-521";default:throw Error("unreachable")}}(e);if(t.algorithm.namedCurve!==r)throw eI(r,"algorithm.namedCurve");break}default:throw TypeError("CryptoKey does not support this operation")}return eO(t,r),t}async function tA(e,t,r){let n=await tb(e,t,"sign");return tg(e,n),new Uint8Array(await crypto.subtle.sign(tw(e,n.algorithm),n,r))}async function tE(e,t,r,n){let i=await tb(e,t,"verify");tg(e,i);let a=tw(e,i.algorithm);try{return await crypto.subtle.verify(a,i,r,n)}catch{return!1}}let tv=e=>{switch(e){case"RSA-OAEP":case"RSA-OAEP-256":case"RSA-OAEP-384":case"RSA-OAEP-512":return"RSA-OAEP";default:throw new eH(`alg ${e} is not supported either by JOSE or your javascript runtime`)}};async function tk(e,t,r){return eP(t,e,"encrypt"),tg(e,t),new Uint8Array(await crypto.subtle.encrypt(tv(e),t,r))}async function t_(e,t,r){return eP(t,e,"decrypt"),tg(e,t),new Uint8Array(await crypto.subtle.decrypt(tv(e),t,r))}function tS(e){if("object"!=typeof e||null===e||"[object Object]"!==Object.prototype.toString.call(e))return!1;if(null===Object.getPrototypeOf(e))return!0;let t=e;for(;null!==Object.getPrototypeOf(t);)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t}function tx(...e){let t,r=e.filter(Boolean);if(0===r.length||1===r.length)return!0;for(let e of r){let r=Object.keys(e);if(!t||0===t.size){t=new Set(r);continue}for(let e of r){if(t.has(e))return!1;t.add(e)}}return!0}let tT=e=>tS(e)&&"string"==typeof e.kty,tR='Invalid or unsupported JWK "alg" (Algorithm) Parameter value';async function tI(e){if(!e.alg)throw TypeError('"alg" argument is required when "jwk.alg" is not present');let{algorithm:t,keyUsages:r}=function(e){let t,r;switch(e.kty){case"AKP":switch(e.alg){case"ML-DSA-44":case"ML-DSA-65":case"ML-DSA-87":t={name:e.alg},r=e.priv?["sign"]:["verify"];break;default:throw new eH(tR)}break;case"RSA":switch(e.alg){case"PS256":case"PS384":case"PS512":t={name:"RSA-PSS",hash:`SHA-${e.alg.slice(-3)}`},r=e.d?["sign"]:["verify"];break;case"RS256":case"RS384":case"RS512":t={name:"RSASSA-PKCS1-v1_5",hash:`SHA-${e.alg.slice(-3)}`},r=e.d?["sign"]:["verify"];break;case"RSA-OAEP":case"RSA-OAEP-256":case"RSA-OAEP-384":case"RSA-OAEP-512":t={name:"RSA-OAEP",hash:`SHA-${parseInt(e.alg.slice(-3),10)||1}`},r=e.d?["decrypt","unwrapKey"]:["encrypt","wrapKey"];break;default:throw new eH(tR)}break;case"EC":switch(e.alg){case"ES256":case"ES384":case"ES512":t={name:"ECDSA",namedCurve:({ES256:"P-256",ES384:"P-384",ES512:"P-521"})[e.alg]},r=e.d?["sign"]:["verify"];break;case"ECDH-ES":case"ECDH-ES+A128KW":case"ECDH-ES+A192KW":case"ECDH-ES+A256KW":t={name:"ECDH",namedCurve:e.crv},r=e.d?["deriveBits"]:[];break;default:throw new eH(tR)}break;case"OKP":switch(e.alg){case"Ed25519":case"EdDSA":t={name:"Ed25519"},r=e.d?["sign"]:["verify"];break;case"ECDH-ES":case"ECDH-ES+A128KW":case"ECDH-ES+A192KW":case"ECDH-ES+A256KW":t={name:e.crv},r=e.d?["deriveBits"]:[];break;default:throw new eH(tR)}break;default:throw new eH('Invalid or unsupported JWK "kty" (Key Type) Parameter value')}return{algorithm:t,keyUsages:r}}(e),n={...e};return"AKP"!==n.kty&&delete n.alg,delete n.use,crypto.subtle.importKey("jwk",n,t,e.ext??(!e.d&&!e.priv),e.key_ops??r)}let tU="given KeyObject instance cannot be used for this algorithm",tO=async(e,r,n,i=!1)=>{let a=(t||=new WeakMap).get(e);if(a?.[n])return a[n];let o=await tI({...r,alg:n});return i&&Object.freeze(e),a?a[n]=o:t.set(e,{[n]:o}),o};async function tP(e,r){if(e instanceof Uint8Array||eY(e))return e;if(eX(e)){if("secret"===e.type)return e.export();if("toCryptoKey"in e&&"function"==typeof e.toCryptoKey)try{return((e,r)=>{let n,i=(t||=new WeakMap).get(e);if(i?.[r])return i[r];let a="public"===e.type,o=!!a;if("x25519"===e.asymmetricKeyType){switch(r){case"ECDH-ES":case"ECDH-ES+A128KW":case"ECDH-ES+A192KW":case"ECDH-ES+A256KW":break;default:throw TypeError(tU)}n=e.toCryptoKey(e.asymmetricKeyType,o,a?[]:["deriveBits"])}if("ed25519"===e.asymmetricKeyType){if("EdDSA"!==r&&"Ed25519"!==r)throw TypeError(tU);n=e.toCryptoKey(e.asymmetricKeyType,o,[a?"verify":"sign"])}switch(e.asymmetricKeyType){case"ml-dsa-44":case"ml-dsa-65":case"ml-dsa-87":if(r!==e.asymmetricKeyType.toUpperCase())throw TypeError(tU);n=e.toCryptoKey(e.asymmetricKeyType,o,[a?"verify":"sign"])}if("rsa"===e.asymmetricKeyType){let t;switch(r){case"RSA-OAEP":t="SHA-1";break;case"RS256":case"PS256":case"RSA-OAEP-256":t="SHA-256";break;case"RS384":case"PS384":case"RSA-OAEP-384":t="SHA-384";break;case"RS512":case"PS512":case"RSA-OAEP-512":t="SHA-512";break;default:throw TypeError(tU)}if(r.startsWith("RSA-OAEP"))return e.toCryptoKey({name:"RSA-OAEP",hash:t},o,a?["encrypt"]:["decrypt"]);n=e.toCryptoKey({name:r.startsWith("PS")?"RSA-PSS":"RSASSA-PKCS1-v1_5",hash:t},o,[a?"verify":"sign"])}if("ec"===e.asymmetricKeyType){let t=new Map([["prime256v1","P-256"],["secp384r1","P-384"],["secp521r1","P-521"]]).get(e.asymmetricKeyDetails?.namedCurve);if(!t)throw TypeError(tU);let i={ES256:"P-256",ES384:"P-384",ES512:"P-521"};i[r]&&t===i[r]&&(n=e.toCryptoKey({name:"ECDSA",namedCurve:t},o,[a?"verify":"sign"])),r.startsWith("ECDH-ES")&&(n=e.toCryptoKey({name:"ECDH",namedCurve:t},o,a?[]:["deriveBits"]))}if(!n)throw TypeError(tU);return i?i[r]=n:t.set(e,{[r]:n}),n})(e,r)}catch(e){if(e instanceof TypeError)throw e}let n=e.export({format:"jwk"});return tO(e,n,r)}if(tT(e))return e.k?ek(e.k):tO(e,e,r,!0);throw Error("unreachable")}async function tC(e,t,r){let n;if(!tS(e))throw TypeError("JWK must be an object");switch(t??=e.alg,n??=r?.extractable??e.ext,e.kty){case"oct":if("string"!=typeof e.k||!e.k)throw TypeError('missing "k" (Key Value) Parameter value');return ek(e.k);case"RSA":if("oth"in e&&void 0!==e.oth)throw new eH('RSA JWK "oth" (Other Primes Info) Parameter value is not supported');return tI({...e,alg:t,ext:n});case"AKP":if("string"!=typeof e.alg||!e.alg)throw TypeError('missing "alg" (Algorithm) Parameter value');if(void 0!==t&&t!==e.alg)throw TypeError("JWK alg and alg option value mismatch");return tI({...e,ext:n});case"EC":case"OKP":return tI({...e,alg:t,ext:n});default:throw new eH('Unsupported "kty" (Key Type) Parameter value')}}async function tD(e){if(eX(e))if("secret"!==e.type)return e.export({format:"jwk"});else e=e.export();if(e instanceof Uint8Array)return{kty:"oct",k:e_(e)};if(!eY(e))throw TypeError(eD(e,"CryptoKey","KeyObject","Uint8Array"));if(!e.extractable)throw TypeError("non-extractable CryptoKey cannot be exported as a JWK");let{ext:t,key_ops:r,alg:n,use:i,...a}=await crypto.subtle.exportKey("jwk",e);return"AKP"===a.kty&&(a.alg=n),a}async function tL(e){return tD(e)}async function tz(e,t,r,n){let i=e.slice(0,7),a=await ti(i,r,t,n,new Uint8Array);return{encryptedKey:a.ciphertext,iv:e_(a.iv),tag:e_(a.tag)}}async function t$(e,t,r,n,i){return ta(e.slice(0,7),t,r,n,i,new Uint8Array)}let tN='Invalid or unsupported "alg" (JWE Algorithm) header value';function tj(e){if(void 0===e)throw new eV("JWE Encrypted Key missing")}async function tH(e,t,r,n,i){switch(e){case"dir":if(void 0!==r)throw new eV("Encountered unexpected JWE Encrypted Key");return t;case"ECDH-ES":if(void 0!==r)throw new eV("Encountered unexpected JWE Encrypted Key");case"ECDH-ES+A128KW":case"ECDH-ES+A192KW":case"ECDH-ES+A256KW":{let i,a;if(!tS(n.epk))throw new eV('JOSE Header "epk" (Ephemeral Public Key) missing or invalid');if(eQ(t),!tf(t))throw new eH("ECDH with the provided key is not allowed or not supported by your javascript runtime");let o=await tC(n.epk,e);if(eQ(o),void 0!==n.apu){if("string"!=typeof n.apu)throw new eV('JOSE Header "apu" (Agreement PartyUInfo) invalid');i=eT(n.apu,"apu",eV)}if(void 0!==n.apv){if("string"!=typeof n.apv)throw new eV('JOSE Header "apv" (Agreement PartyVInfo) invalid');a=eT(n.apv,"apv",eV)}let s=await tp(o,t,"ECDH-ES"===e?n.enc:e,"ECDH-ES"===e?e1(n.enc):parseInt(e.slice(-5,-2),10),i,a);if("ECDH-ES"===e)return s;return tj(r),tl(e.slice(-6),s,r)}case"RSA-OAEP":case"RSA-OAEP-256":case"RSA-OAEP-384":case"RSA-OAEP-512":return tj(r),eQ(t),t_(e,t,r);case"PBES2-HS256+A128KW":case"PBES2-HS384+A192KW":case"PBES2-HS512+A256KW":{let a;if(tj(r),"number"!=typeof n.p2c)throw new eV('JOSE Header "p2c" (PBES2 Count) missing or invalid');let o=i?.maxPBES2Count||1e4;if(n.p2c>o)throw new eV('JOSE Header "p2c" (PBES2 Count) out is of acceptable bounds');if("string"!=typeof n.p2s)throw new eV('JOSE Header "p2s" (PBES2 Salt) missing or invalid');return a=eT(n.p2s,"p2s",eV),ty(e,t,r,n.p2c,a)}case"A128KW":case"A192KW":case"A256KW":return tj(r),tl(e,t,r);case"A128GCMKW":case"A192GCMKW":case"A256GCMKW":if(tj(r),"string"!=typeof n.iv)throw new eV('JOSE Header "iv" (Initialization Vector) missing or invalid');if("string"!=typeof n.tag)throw new eV('JOSE Header "tag" (Authentication Tag) missing or invalid');return t$(e,t,r,eT(n.iv,"iv",eV),eT(n.tag,"tag",eV));default:throw new eH(tN)}}async function tB(e,t,r,n,i={}){let a,o,s;switch(e){case"dir":s=r;break;case"ECDH-ES":case"ECDH-ES+A128KW":case"ECDH-ES+A192KW":case"ECDH-ES+A256KW":{let c;if(eQ(r),!tf(r))throw new eH("ECDH with the provided key is not allowed or not supported by your javascript runtime");let{apu:l,apv:d}=i;c=i.epk?await tP(i.epk,e):(await crypto.subtle.generateKey(r.algorithm,!0,["deriveBits"])).privateKey;let{x:u,y:p,crv:f,kty:h}=await tL(c),m=await tp(r,c,"ECDH-ES"===e?t:e,"ECDH-ES"===e?e1(t):parseInt(e.slice(-5,-2),10),l,d);if(o={epk:{x:u,crv:f,kty:h}},"EC"===h&&(o.epk.y=p),l&&(o.apu=e_(l)),d&&(o.apv=e_(d)),"ECDH-ES"===e){s=m;break}s=n||e2(t);let y=e.slice(-6);a=await tc(y,m,s);break}case"RSA-OAEP":case"RSA-OAEP-256":case"RSA-OAEP-384":case"RSA-OAEP-512":s=n||e2(t),eQ(r),a=await tk(e,r,s);break;case"PBES2-HS256+A128KW":case"PBES2-HS384+A192KW":case"PBES2-HS512+A256KW":{s=n||e2(t);let{p2c:c,p2s:l}=i;({encryptedKey:a,...o}=await tm(e,r,s,c,l));break}case"A128KW":case"A192KW":case"A256KW":s=n||e2(t),a=await tc(e,r,s);break;case"A128GCMKW":case"A192GCMKW":case"A256GCMKW":{s=n||e2(t);let{iv:c}=i;({encryptedKey:a,...o}=await tz(e,r,s,c));break}default:throw new eH(tN)}return{cek:s,encryptedKey:a,parameters:o}}function tV(e,t,r,n,i){let a;if(void 0!==i.crit&&n?.crit===void 0)throw new e('"crit" (Critical) Header Parameter MUST be integrity protected');if(!n||void 0===n.crit)return new Set;if(!Array.isArray(n.crit)||0===n.crit.length||n.crit.some(e=>"string"!=typeof e||0===e.length))throw new e('"crit" (Critical) Header Parameter MUST be an array of non-empty strings when present');for(let o of(a=void 0!==r?new Map([...Object.entries(r),...t.entries()]):t,n.crit)){if(!a.has(o))throw new eH(`Extension Header Parameter "${o}" is not recognized`);if(void 0===i[o])throw new e(`Extension Header Parameter "${o}" is missing`);if(a.get(o)&&void 0===n[o])throw new e(`Extension Header Parameter "${o}" MUST be integrity protected`)}return new Set(n.crit)}let tM=e=>e?.[Symbol.toStringTag],tK=(e,t,r)=>{if(void 0!==t.use){let e;switch(r){case"sign":case"verify":e="sig";break;case"encrypt":case"decrypt":e="enc"}if(t.use!==e)throw TypeError(`Invalid key for this operation, its "use" must be "${e}" when present`)}if(void 0!==t.alg&&t.alg!==e)throw TypeError(`Invalid key for this operation, its "alg" must be "${e}" when present`);if(Array.isArray(t.key_ops)){let n;switch(!0){case"sign"===r||"verify"===r:case"dir"===e:case e.includes("CBC-HS"):n=r;break;case e.startsWith("PBES2"):n="deriveBits";break;case/^A\d{3}(?:GCM)?(?:KW)?$/.test(e):n=!e.includes("GCM")&&e.endsWith("KW")?"encrypt"===r?"wrapKey":"unwrapKey":r;break;case"encrypt"===r&&e.startsWith("RSA"):n="wrapKey";break;case"decrypt"===r:n=e.startsWith("RSA")?"unwrapKey":"deriveBits"}if(n&&t.key_ops?.includes?.(n)===!1)throw TypeError(`Invalid key for this operation, its "key_ops" must include "${n}" when present`)}return!0};function tW(e,t,r){switch(e.substring(0,2)){case"A1":case"A2":case"di":case"HS":case"PB":((e,t,r)=>{if(!(t instanceof Uint8Array)){if(tT(t)){if("oct"===t.kty&&"string"==typeof t.k&&tK(e,t,r))return;throw TypeError('JSON Web Key for symmetric algorithms must have JWK "kty" (Key Type) equal to "oct" and the JWK "k" (Key Value) present')}if(!e0(t))throw TypeError(eL(e,t,"CryptoKey","KeyObject","JSON Web Key","Uint8Array"));if("secret"!==t.type)throw TypeError(`${tM(t)} instances for symmetric algorithms must be of type "secret"`)}})(e,t,r);break;default:((e,t,r)=>{if(tT(t))switch(r){case"decrypt":case"sign":if("oct"!==t.kty&&("AKP"===t.kty&&"string"==typeof t.priv||"string"==typeof t.d)&&tK(e,t,r))return;throw TypeError("JSON Web Key for this operation must be a private JWK");case"encrypt":case"verify":if("oct"!==t.kty&&void 0===t.d&&void 0===t.priv&&tK(e,t,r))return;throw TypeError("JSON Web Key for this operation must be a public JWK")}if(!e0(t))throw TypeError(eL(e,t,"CryptoKey","KeyObject","JSON Web Key"));if("secret"===t.type)throw TypeError(`${tM(t)} instances for asymmetric algorithms must not be of type "secret"`);if("public"===t.type)switch(r){case"sign":throw TypeError(`${tM(t)} instances for asymmetric algorithm signing must be of type "private"`);case"decrypt":throw TypeError(`${tM(t)} instances for asymmetric algorithm decryption must be of type "private"`)}if("private"===t.type)switch(r){case"verify":throw TypeError(`${tM(t)} instances for asymmetric algorithm verifying must be of type "public"`);case"encrypt":throw TypeError(`${tM(t)} instances for asymmetric algorithm encryption must be of type "public"`)}})(e,t,r)}}function tq(e){if(void 0===globalThis[e])throw new eH(`JWE "zip" (Compression Algorithm) Header Parameter requires the ${e} API.`)}async function tF(e){tq("CompressionStream");let t=new CompressionStream("deflate-raw"),r=t.writable.getWriter();r.write(e).catch(()=>{}),r.close().catch(()=>{});let n=[],i=t.readable.getReader();for(;;){let{value:e,done:t}=await i.read();if(t)break;n.push(e)}return ew(...n)}async function tJ(e,t){tq("DecompressionStream");let r=new DecompressionStream("deflate-raw"),n=r.writable.getWriter();n.write(e).catch(()=>{}),n.close().catch(()=>{});let i=[],a=0,o=r.readable.getReader();for(;;){let{value:e,done:r}=await o.read();if(r)break;if(i.push(e),a+=e.byteLength,t!==1/0&&a>t)throw new eV("Decompressed plaintext exceeded the configured limit")}return ew(...i)}class tZ{#e;#t;#r;#n;#i;#a;#o;#s;constructor(e){if(!(e instanceof Uint8Array))throw TypeError("plaintext must be an instance of Uint8Array");this.#e=e}setKeyManagementParameters(e){return ex(this.#s,"setKeyManagementParameters"),this.#s=e,this}setProtectedHeader(e){return ex(this.#t,"setProtectedHeader"),this.#t=e,this}setSharedUnprotectedHeader(e){return ex(this.#r,"setSharedUnprotectedHeader"),this.#r=e,this}setUnprotectedHeader(e){return ex(this.#n,"setUnprotectedHeader"),this.#n=e,this}setAdditionalAuthenticatedData(e){return this.#i=e,this}setContentEncryptionKey(e){return ex(this.#a,"setContentEncryptionKey"),this.#a=e,this}setInitializationVector(e){return ex(this.#o,"setInitializationVector"),this.#o=e,this}async encrypt(e,t){let r,n,i,a,o,s;if(!this.#t&&!this.#n&&!this.#r)throw new eV("either setProtectedHeader, setUnprotectedHeader, or sharedUnprotectedHeader must be called before #encrypt()");if(!tx(this.#t,this.#n,this.#r))throw new eV("JWE Protected, JWE Shared Unprotected and JWE Per-Recipient Header Parameter names must be disjoint");let c={...this.#t,...this.#n,...this.#r};if(tV(eV,new Map,t?.crit,this.#t,c),void 0!==c.zip&&"DEF"!==c.zip)throw new eH('Unsupported JWE "zip" (Compression Algorithm) Header Parameter value.');if(void 0!==c.zip&&!this.#t?.zip)throw new eV('JWE "zip" (Compression Algorithm) Header Parameter MUST be in a protected header.');let{alg:l,enc:d}=c;if("string"!=typeof l||!l)throw new eV('JWE "alg" (Algorithm) Header Parameter missing or invalid');if("string"!=typeof d||!d)throw new eV('JWE "enc" (Encryption Algorithm) Header Parameter missing or invalid');if(this.#a&&("dir"===l||"ECDH-ES"===l))throw TypeError(`setContentEncryptionKey cannot be called with JWE "alg" (Algorithm) Header ${l}`);tW("dir"===l?d:l,e,"encrypt");{let i,a=await tP(e,l);({cek:n,encryptedKey:r,parameters:i}=await tB(l,d,a,this.#a,this.#s)),i&&(t&&eS in t?this.#n?this.#n={...this.#n,...i}:this.setUnprotectedHeader(i):this.#t?this.#t={...this.#t,...i}:this.setProtectedHeader(i))}if(this.#t?o=ev(a=e_(JSON.stringify(this.#t))):(a="",o=new Uint8Array),this.#i){let e=ev(s=e_(this.#i));i=ew(o,ev("."),e)}else i=o;let u=this.#e;"DEF"===c.zip&&(u=await tF(u).catch(e=>{throw new eV("Failed to compress plaintext",{cause:e})}));let{ciphertext:p,tag:f,iv:h}=await ti(d,u,n,this.#o,i),m={ciphertext:e_(p)};return h&&(m.iv=e_(h)),f&&(m.tag=e_(f)),r&&(m.encrypted_key=e_(r)),s&&(m.aad=s),this.#t&&(m.protected=a),this.#r&&(m.unprotected=this.#r),this.#n&&(m.header=this.#n),m}}class tG{#c;constructor(e){this.#c=new tZ(e)}setContentEncryptionKey(e){return this.#c.setContentEncryptionKey(e),this}setInitializationVector(e){return this.#c.setInitializationVector(e),this}setProtectedHeader(e){return this.#c.setProtectedHeader(e),this}setKeyManagementParameters(e){return this.#c.setKeyManagementParameters(e),this}async encrypt(e,t){let r=await this.#c.encrypt(e,t);return[r.protected,r.encrypted_key,r.iv,r.ciphertext,r.tag].join(".")}}let tQ=e=>Math.floor(e.getTime()/1e3),tY=/^(\+|\-)? ?(\d+|\d+\.\d+) ?(seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)(?: (ago|from now))?$/i;function tX(e){let t,r=tY.exec(e);if(!r||r[4]&&r[1])throw TypeError("Invalid time period format");let n=parseFloat(r[2]);switch(r[3].toLowerCase()){case"sec":case"secs":case"second":case"seconds":case"s":t=Math.round(n);break;case"minute":case"minutes":case"min":case"mins":case"m":t=Math.round(60*n);break;case"hour":case"hours":case"hr":case"hrs":case"h":t=Math.round(3600*n);break;case"day":case"days":case"d":t=Math.round(86400*n);break;case"week":case"weeks":case"w":t=Math.round(604800*n);break;default:t=Math.round(0x1e187e0*n)}return"-"===r[1]||"ago"===r[4]?-t:t}function t0(e,t){if(!Number.isFinite(t))throw TypeError(`Invalid ${e} input`);return t}let t1=e=>e.includes("/")?e.toLowerCase():`application/${e.toLowerCase()}`;function t2(e,t,r={}){var n,i;let a,o;try{a=JSON.parse(eg.decode(t))}catch{}if(!tS(a))throw new eK("JWT Claims Set must be a top-level JSON object");let{typ:s}=r;if(s&&("string"!=typeof e.typ||t1(e.typ)!==t1(s)))throw new e$('unexpected "typ" JWT header value',a,"typ","check_failed");let{requiredClaims:c=[],issuer:l,subject:d,audience:u,maxTokenAge:p}=r,f=[...c];for(let e of(void 0!==p&&f.push("iat"),void 0!==u&&f.push("aud"),void 0!==d&&f.push("sub"),void 0!==l&&f.push("iss"),new Set(f.reverse())))if(!(e in a))throw new e$(`missing required "${e}" claim`,a,e,"missing");if(l&&!(Array.isArray(l)?l:[l]).includes(a.iss))throw new e$('unexpected "iss" claim value',a,"iss","check_failed");if(d&&a.sub!==d)throw new e$('unexpected "sub" claim value',a,"sub","check_failed");if(u&&(n=a.aud,i="string"==typeof u?[u]:u,"string"==typeof n?!i.includes(n):!(Array.isArray(n)&&i.some(Set.prototype.has.bind(new Set(n))))))throw new e$('unexpected "aud" claim value',a,"aud","check_failed");switch(typeof r.clockTolerance){case"string":o=tX(r.clockTolerance);break;case"number":o=r.clockTolerance;break;case"undefined":o=0;break;default:throw TypeError("Invalid clockTolerance option type")}let{currentDate:h}=r,m=tQ(h||new Date);if((void 0!==a.iat||p)&&"number"!=typeof a.iat)throw new e$('"iat" claim must be a number',a,"iat","invalid");if(void 0!==a.nbf){if("number"!=typeof a.nbf)throw new e$('"nbf" claim must be a number',a,"nbf","invalid");if(a.nbf>m+o)throw new e$('"nbf" claim timestamp check failed',a,"nbf","check_failed")}if(void 0!==a.exp){if("number"!=typeof a.exp)throw new e$('"exp" claim must be a number',a,"exp","invalid");if(a.exp<=m-o)throw new eN('"exp" claim timestamp check failed',a,"exp","check_failed")}if(p){let e=m-a.iat;if(e-o>("number"==typeof p?p:tX(p)))throw new eN('"iat" claim timestamp check failed (too far in the past)',a,"iat","check_failed");if(e<0-o)throw new e$('"iat" claim timestamp check failed (it should be in the past)',a,"iat","check_failed")}return a}class t6{#l;constructor(e){if(!tS(e))throw TypeError("JWT Claims Set MUST be an object");this.#l=structuredClone(e)}data(){return ey.encode(JSON.stringify(this.#l))}get iss(){return this.#l.iss}set iss(e){this.#l.iss=e}get sub(){return this.#l.sub}set sub(e){this.#l.sub=e}get aud(){return this.#l.aud}set aud(e){this.#l.aud=e}set jti(e){this.#l.jti=e}set nbf(e){"number"==typeof e?this.#l.nbf=t0("setNotBefore",e):e instanceof Date?this.#l.nbf=t0("setNotBefore",tQ(e)):this.#l.nbf=tQ(new Date)+tX(e)}set exp(e){"number"==typeof e?this.#l.exp=t0("setExpirationTime",e):e instanceof Date?this.#l.exp=t0("setExpirationTime",tQ(e)):this.#l.exp=tQ(new Date)+tX(e)}set iat(e){void 0===e?this.#l.iat=tQ(new Date):e instanceof Date?this.#l.iat=t0("setIssuedAt",tQ(e)):"string"==typeof e?this.#l.iat=t0("setIssuedAt",tQ(new Date)+tX(e)):this.#l.iat=t0("setIssuedAt",e)}}class t5{#a;#o;#s;#t;#d;#u;#p;#f;constructor(e={}){this.#f=new t6(e)}setIssuer(e){return this.#f.iss=e,this}setSubject(e){return this.#f.sub=e,this}setAudience(e){return this.#f.aud=e,this}setJti(e){return this.#f.jti=e,this}setNotBefore(e){return this.#f.nbf=e,this}setExpirationTime(e){return this.#f.exp=e,this}setIssuedAt(e){return this.#f.iat=e,this}setProtectedHeader(e){return ex(this.#t,"setProtectedHeader"),this.#t=e,this}setKeyManagementParameters(e){return ex(this.#s,"setKeyManagementParameters"),this.#s=e,this}setContentEncryptionKey(e){return ex(this.#a,"setContentEncryptionKey"),this.#a=e,this}setInitializationVector(e){return ex(this.#o,"setInitializationVector"),this.#o=e,this}replicateIssuerAsHeader(){return this.#d=!0,this}replicateSubjectAsHeader(){return this.#u=!0,this}replicateAudienceAsHeader(){return this.#p=!0,this}async encrypt(e,t){let r=new tG(this.#f.data());return this.#t&&(this.#d||this.#u||this.#p)&&(this.#t={...this.#t,iss:this.#d?this.#f.iss:void 0,sub:this.#u?this.#f.sub:void 0,aud:this.#p?this.#f.aud:void 0}),r.setProtectedHeader(this.#t),this.#o&&r.setInitializationVector(this.#o),this.#a&&r.setContentEncryptionKey(this.#a),this.#s&&r.setKeyManagementParameters(this.#s),r.encrypt(e,t)}}class t8{#l;#t;#n;constructor(e){if(!(e instanceof Uint8Array))throw TypeError("payload must be an instance of Uint8Array");this.#l=e}setProtectedHeader(e){return ex(this.#t,"setProtectedHeader"),this.#t=e,this}setUnprotectedHeader(e){return ex(this.#n,"setUnprotectedHeader"),this.#n=e,this}async sign(e,t){let r,n,i,a;if(!this.#t&&!this.#n)throw new eM("either setProtectedHeader or setUnprotectedHeader must be called before #sign()");if(!tx(this.#t,this.#n))throw new eM("JWS Protected and JWS Unprotected Header Parameter names must be disjoint");let o={...this.#t,...this.#n},s=tV(eM,new Map([["b64",!0]]),t?.crit,this.#t,o),c=!0;if(s.has("b64")&&"boolean"!=typeof(c=this.#t.b64))throw new eM('The "b64" (base64url-encode payload) Header Parameter must be a boolean');let{alg:l}=o;if("string"!=typeof l||!l)throw new eM('JWS "alg" (Algorithm) Header Parameter missing or invalid');tW(l,e,"sign"),c?n=ev(r=e_(this.#l)):(n=this.#l,r=""),this.#t?a=ev(i=e_(JSON.stringify(this.#t))):(i="",a=new Uint8Array);let d=ew(a,ev("."),n),u=await tP(e,l),p={signature:e_(await tA(l,u,d)),payload:r};return this.#n&&(p.header=this.#n),this.#t&&(p.protected=i),p}}class t4{#c;constructor(e){this.#c=new t8(e)}setProtectedHeader(e){return this.#c.setProtectedHeader(e),this}async sign(e,t){let r=await this.#c.sign(e,t);if(void 0===r.payload)throw TypeError("use the flattened module for creating JWS with b64: false");return`${r.protected}.${r.payload}.${r.signature}`}}class t3{#t;#f;constructor(e={}){this.#f=new t6(e)}setIssuer(e){return this.#f.iss=e,this}setSubject(e){return this.#f.sub=e,this}setAudience(e){return this.#f.aud=e,this}setJti(e){return this.#f.jti=e,this}setNotBefore(e){return this.#f.nbf=e,this}setExpirationTime(e){return this.#f.exp=e,this}setIssuedAt(e){return this.#f.iat=e,this}setProtectedHeader(e){return this.#t=e,this}async sign(e,t){let r=new t4(this.#f.data());if(r.setProtectedHeader(this.#t),Array.isArray(this.#t?.crit)&&this.#t.crit.includes("b64")&&!1===this.#t.b64)throw new eK("JWTs MUST NOT use unencoded payload");return r.sign(e,t)}}var t9=e.i(797379),t9=t9;let t7=(e,t)=>{if("string"!=typeof e||!e)throw new eW(`${t} missing or invalid`)};async function re(e,t){let r,n;if(tT(e))r=e;else if(e0(e))r=await tL(e);else throw TypeError(eD(e,"CryptoKey","KeyObject","JSON Web Key"));if("sha256"!==(t??="sha256")&&"sha384"!==t&&"sha512"!==t)throw TypeError('digestAlgorithm must one of "sha256", "sha384", or "sha512"');switch(r.kty){case"AKP":t7(r.alg,'"alg" (Algorithm) Parameter'),t7(r.pub,'"pub" (Public key) Parameter'),n={alg:r.alg,kty:r.kty,pub:r.pub};break;case"EC":t7(r.crv,'"crv" (Curve) Parameter'),t7(r.x,'"x" (X Coordinate) Parameter'),t7(r.y,'"y" (Y Coordinate) Parameter'),n={crv:r.crv,kty:r.kty,x:r.x,y:r.y};break;case"OKP":t7(r.crv,'"crv" (Subtype of Key Pair) Parameter'),t7(r.x,'"x" (Public Key) Parameter'),n={crv:r.crv,kty:r.kty,x:r.x};break;case"RSA":t7(r.e,'"e" (Exponent) Parameter'),t7(r.n,'"n" (Modulus) Parameter'),n={e:r.e,kty:r.kty,n:r.n};break;case"oct":t7(r.k,'"k" (Key Value) Parameter'),n={k:r.k,kty:r.kty};break;default:throw new eH('"kty" (Key Type) Parameter missing or unsupported')}let i=ev(JSON.stringify(n));return e_(await eR(t,i))}function rt(e){let t;if("string"==typeof e){let r=e.split(".");(3===r.length||5===r.length)&&([t]=r)}else if("object"==typeof e&&e)if("protected"in e)t=e.protected;else throw TypeError("Token does not contain a Protected Header");try{if("string"!=typeof t||!t)throw Error();let e=JSON.parse(eg.decode(ek(t)));if(!tS(e))throw Error();return e}catch{throw TypeError("Invalid Token or Protected Header formatting")}}function rr(e,t){if(void 0!==t&&(!Array.isArray(t)||t.some(e=>"string"!=typeof e)))throw TypeError(`"${e}" option must be an array of strings`);if(t)return new Set(t)}async function rn(e,t,r){let n,i,a,o,s,c;if(!tS(e))throw new eV("Flattened JWE must be an object");if(void 0===e.protected&&void 0===e.header&&void 0===e.unprotected)throw new eV("JOSE Header missing");if(void 0!==e.iv&&"string"!=typeof e.iv)throw new eV("JWE Initialization Vector incorrect type");if("string"!=typeof e.ciphertext)throw new eV("JWE Ciphertext missing or incorrect type");if(void 0!==e.tag&&"string"!=typeof e.tag)throw new eV("JWE Authentication Tag incorrect type");if(void 0!==e.protected&&"string"!=typeof e.protected)throw new eV("JWE Protected Header incorrect type");if(void 0!==e.encrypted_key&&"string"!=typeof e.encrypted_key)throw new eV("JWE Encrypted Key incorrect type");if(void 0!==e.aad&&"string"!=typeof e.aad)throw new eV("JWE AAD incorrect type");if(void 0!==e.header&&!tS(e.header))throw new eV("JWE Shared Unprotected Header incorrect type");if(void 0!==e.unprotected&&!tS(e.unprotected))throw new eV("JWE Per-Recipient Unprotected Header incorrect type");if(e.protected)try{let t=ek(e.protected);n=JSON.parse(eg.decode(t))}catch{throw new eV("JWE Protected Header is invalid")}if(!tx(n,e.header,e.unprotected))throw new eV("JWE Protected, JWE Unprotected Header, and JWE Per-Recipient Unprotected Header Parameter names must be disjoint");let l={...n,...e.header,...e.unprotected};if(tV(eV,new Map,r?.crit,n,l),void 0!==l.zip&&"DEF"!==l.zip)throw new eH('Unsupported JWE "zip" (Compression Algorithm) Header Parameter value.');if(void 0!==l.zip&&!n?.zip)throw new eV('JWE "zip" (Compression Algorithm) Header Parameter MUST be in a protected header.');let{alg:d,enc:u}=l;if("string"!=typeof d||!d)throw new eV("missing JWE Algorithm (alg) in JWE Header");if("string"!=typeof u||!u)throw new eV("missing JWE Encryption Algorithm (enc) in JWE Header");let p=r&&rr("keyManagementAlgorithms",r.keyManagementAlgorithms),f=r&&rr("contentEncryptionAlgorithms",r.contentEncryptionAlgorithms);if(p&&!p.has(d)||!p&&d.startsWith("PBES2"))throw new ej('"alg" (Algorithm) Header Parameter value not allowed');if(f&&!f.has(u))throw new ej('"enc" (Encryption Algorithm) Header Parameter value not allowed');void 0!==e.encrypted_key&&(i=eT(e.encrypted_key,"encrypted_key",eV));let h=!1;"function"==typeof t&&(t=await t(n,e),h=!0),tW("dir"===d?u:d,t,"decrypt");let m=await tP(t,d);try{a=await tH(d,m,i,l,r)}catch(e){if(e instanceof TypeError||e instanceof eV||e instanceof eH)throw e;a=e2(u)}void 0!==e.iv&&(o=eT(e.iv,"iv",eV)),void 0!==e.tag&&(s=eT(e.tag,"tag",eV));let y=void 0!==e.protected?ev(e.protected):new Uint8Array;c=void 0!==e.aad?ew(y,ev("."),ev(e.aad)):y;let g=eT(e.ciphertext,"ciphertext",eV),w=await ta(u,a,g,o,s,c),b={plaintext:w};if("DEF"===l.zip){let e=r?.maxDecompressedLength??25e4;if(0===e)throw new eH('JWE "zip" (Compression Algorithm) Header Parameter is not supported.');if(e!==1/0&&(!Number.isSafeInteger(e)||e<1))throw TypeError("maxDecompressedLength must be 0, a positive safe integer, or Infinity");b.plaintext=await tJ(w,e).catch(e=>{if(e instanceof eV)throw e;throw new eV("Failed to decompress plaintext",{cause:e})})}return(void 0!==e.protected&&(b.protectedHeader=n),void 0!==e.aad&&(b.additionalAuthenticatedData=eT(e.aad,"aad",eV)),void 0!==e.unprotected&&(b.sharedUnprotectedHeader=e.unprotected),void 0!==e.header&&(b.unprotectedHeader=e.header),h)?{...b,key:m}:b}async function ri(e,t,r){if(e instanceof Uint8Array&&(e=eg.decode(e)),"string"!=typeof e)throw new eV("Compact JWE must be a string or Uint8Array");let{0:n,1:i,2:a,3:o,4:s,length:c}=e.split(".");if(5!==c)throw new eV("Invalid Compact JWE");let l=await rn({ciphertext:o,iv:a||void 0,protected:n,tag:s||void 0,encrypted_key:i||void 0},t,r),d={plaintext:l.plaintext,protectedHeader:l.protectedHeader};return"function"==typeof t?{...d,key:l.key}:d}async function ra(e,t,r){let n=await ri(e,t,r),i=t2(n.protectedHeader,n.plaintext,r),{protectedHeader:a}=n;if(void 0!==a.iss&&a.iss!==i.iss)throw new e$('replicated "iss" claim header parameter mismatch',i,"iss","mismatch");if(void 0!==a.sub&&a.sub!==i.sub)throw new e$('replicated "sub" claim header parameter mismatch',i,"sub","mismatch");if(void 0!==a.aud&&JSON.stringify(a.aud)!==JSON.stringify(i.aud))throw new e$('replicated "aud" claim header parameter mismatch',i,"aud","mismatch");let o={payload:i,protectedHeader:a};return"function"==typeof t?{...o,key:n.key}:o}async function ro(e,t,r){if(!tS(e))throw new eM("Flattened JWS must be an object");if(void 0===e.protected&&void 0===e.header)throw new eM('Flattened JWS must have either of the "protected" or "header" members');if(void 0!==e.protected&&"string"!=typeof e.protected)throw new eM("JWS Protected Header incorrect type");if(void 0===e.payload)throw new eM("JWS Payload missing");if("string"!=typeof e.signature)throw new eM("JWS Signature missing or incorrect type");if(void 0!==e.header&&!tS(e.header))throw new eM("JWS Unprotected Header incorrect type");let n={};if(e.protected)try{let t=ek(e.protected);n=JSON.parse(eg.decode(t))}catch{throw new eM("JWS Protected Header is invalid")}if(!tx(n,e.header))throw new eM("JWS Protected and JWS Unprotected Header Parameter names must be disjoint");let i={...n,...e.header},a=tV(eM,new Map([["b64",!0]]),r?.crit,n,i),o=!0;if(a.has("b64")&&"boolean"!=typeof(o=n.b64))throw new eM('The "b64" (base64url-encode payload) Header Parameter must be a boolean');let{alg:s}=i;if("string"!=typeof s||!s)throw new eM('JWS "alg" (Algorithm) Header Parameter missing or invalid');let c=r&&rr("algorithms",r.algorithms);if(c&&!c.has(s))throw new ej('"alg" (Algorithm) Header Parameter value not allowed');if(o){if("string"!=typeof e.payload)throw new eM("JWS Payload must be a string")}else if("string"!=typeof e.payload&&!(e.payload instanceof Uint8Array))throw new eM("JWS Payload must be a string or an Uint8Array instance");let l=!1;"function"==typeof t&&(t=await t(n,e),l=!0),tW(s,t,"verify");let d=ew(void 0!==e.protected?ev(e.protected):new Uint8Array,ev("."),"string"==typeof e.payload?o?ev(e.payload):ey.encode(e.payload):e.payload),u=eT(e.signature,"signature",eM),p=await tP(t,s);if(!await tE(s,p,u,d))throw new eG;let f={payload:o?eT(e.payload,"payload",eM):"string"==typeof e.payload?ey.encode(e.payload):e.payload};return(void 0!==e.protected&&(f.protectedHeader=n),void 0!==e.header&&(f.unprotectedHeader=e.header),l)?{...f,key:p}:f}async function rs(e,t,r){if(e instanceof Uint8Array&&(e=eg.decode(e)),"string"!=typeof e)throw new eM("Compact JWS must be a string or Uint8Array");let{0:n,1:i,2:a,length:o}=e.split(".");if(3!==o)throw new eM("Invalid Compact JWS");let s=await ro({payload:i,protected:n,signature:a},t,r),c={payload:s.payload,protectedHeader:s.protectedHeader};return"function"==typeof t?{...c,key:s.key}:c}async function rc(e,t,r){let n=await rs(e,t,r);if(n.protectedHeader.crit?.includes("b64")&&!1===n.protectedHeader.b64)throw new eK("JWTs MUST NOT use unencoded payload");let i={payload:t2(n.protectedHeader,n.payload,r),protectedHeader:n.protectedHeader};return"function"==typeof t?{...i,key:n.key}:i}async function rl(e,t,r=3600){return await new t3(e).setProtectedHeader({alg:"HS256"}).setIssuedAt().setExpirationTime(Math.floor(Date.now()/1e3)+r).sign(new TextEncoder().encode(t))}async function rd(e,t){try{return(await rc(e,new TextEncoder().encode(t))).payload}catch{return null}}let ru=new Uint8Array([66,101,116,116,101,114,65,117,116,104,46,106,115,32,71,101,110,101,114,97,116,101,100,32,69,110,99,114,121,112,116,105,111,110,32,75,101,121]),rp="A256CBC-HS512";function rf(e,t){var r,n,i;return r=new TextEncoder().encode(e),n=new TextEncoder().encode(t),function(e,t,r,n=32){M(e),B(n,"length"),V(t,void 0,"prk");let i=e.outputLen;if(t.length<i)throw Error('"prk" must be at least HashLen octets');if(n>255*i)throw Error("Length must be <= 255*HashLen");let a=Math.ceil(n/i);void 0===r?r=Y:V(r,void 0,"info");let o=new Uint8Array(a*i),s=G.create(e,t),c=s._cloneInto(),l=new Uint8Array(s.outputLen);for(let e=0;e<a;e++)Q[0]=e+1,c.update(0===e?Y:l).update(r).update(Q).digestInto(l),o.set(l,i*e),s._cloneInto(c);return s.destroy(),c.destroy(),q(l,Q),o.slice(0,n)}(em,(i=n,M(em),void 0===i&&(i=new Uint8Array(em.outputLen)),G(em,i,r)),ru,64)}function rh(e){if("string"==typeof e)return[{version:0,value:e}];let t=[];for(let[r,n]of e.keys)t.push({version:r,value:n});return e.legacySecret&&!t.some(t=>t.value===e.legacySecret)&&t.push({version:-1,value:e.legacySecret}),t}async function rm(e,t,r,n=3600){let i=rf(function(e){if("string"==typeof e)return e;let t=e.keys.get(e.currentVersion);if(!t)throw Error(`Secret version ${e.currentVersion} not found in keys`);return t}(t),r),a=await re({kty:"oct",k:t9.encode(i)},"sha256");return await new t5(e).setProtectedHeader({alg:"dir",enc:rp,kid:a}).setIssuedAt().setExpirationTime((Date.now()/1e3|0)+n).setJti(crypto.randomUUID()).encrypt(i)}let ry={clockTolerance:15,keyManagementAlgorithms:["dir"],contentEncryptionAlgorithms:[rp,"A256GCM"]};async function rg(e,t,r){if(!e)return null;let n=!1;try{n=void 0!==rt(e).kid}catch{return null}try{let n=rh(t),{payload:i}=await ra(e,async e=>{let t=e.kid;if(void 0!==t){for(let e of n){let n=rf(e.value,r);if(t===await re({kty:"oct",k:t9.encode(n)},"sha256"))return n}throw Error("no matching decryption secret")}return n.length,rf(n[0].value,r)},ry);return i}catch{if(n)return null;let i=rh(t);if(i.length<=1)return null;for(let t=1;t<i.length;t++)try{let n=i[t],{payload:a}=await ra(e,rf(n.value,r),ry);return a}catch{continue}return null}}var rw=e.i(163738);function rb(e,t){if(!e||!t)return e;let r=Object.entries(t).filter(([,{returned:e}])=>!1===e).map(([e])=>e);return Object.entries(structuredClone(e)).filter(([e])=>!r.includes(e)).reduce((e,[t,r])=>({...e,[t]:r}),{})}let rA=new WeakMap;function rE(e,t,r){let n=`${t}:${r}`;rA.has(e)||rA.set(e,new Map);let i=rA.get(e);if(i.has(n))return i.get(n);let a="output"===r?(0,y.getAuthTables)(e)[t]?.fields??{}:{},o="user"===t||"session"===t||"account"===t?e[t]?.additionalFields:void 0,s={...a,...o??{}};for(let r of e.plugins||[])r.schema&&r.schema[t]&&(s={...s,...r.schema[t].fields});return i.set(n,s),s}function rv(e,t){return rb(t,rE(e,"user","output"))}function rk(e,t){let r=rE(e,"user","output"),n={};for(let e in r){let i=r[e];!1!==i.returned&&(e in t&&void 0!==t[e]?n[e]=t[e]:void 0!==i.defaultValue?n[e]="function"==typeof i.defaultValue?i.defaultValue():i.defaultValue:i.required||(n[e]=null))}return"id"in t&&(n.id=t.id),n}function r_(e,t){return rb(t,rE(e,"session","output"))}function rS(e,t){let r=t.action||"create",n=t.fields,i=Object.create(null);for(let t in n){if(t in e){if(!1===n[t].input){if(void 0!==n[t].defaultValue&&"update"!==r){i[t]=n[t].defaultValue;continue}if(e[t])throw b.APIError.from("BAD_REQUEST",{...rw.BASE_ERROR_CODES.FIELD_NOT_ALLOWED,message:`${t} is not allowed to be set`});continue}if(n[t].validator?.input&&void 0!==e[t]){let r=n[t].validator.input["~standard"].validate(e[t]);if(r instanceof Promise)throw b.APIError.from("INTERNAL_SERVER_ERROR",rw.BASE_ERROR_CODES.ASYNC_VALIDATION_NOT_SUPPORTED);if("issues"in r&&r.issues)throw b.APIError.from("BAD_REQUEST",{...rw.BASE_ERROR_CODES.VALIDATION_ERROR,message:r.issues[0]?.message||"Validation Error"});i[t]=r.value;continue}if(n[t].transform?.input&&void 0!==e[t]){i[t]=n[t].transform?.input(e[t]);continue}i[t]=e[t];continue}if(void 0!==n[t].defaultValue&&"create"===r){if("function"==typeof n[t].defaultValue){i[t]=n[t].defaultValue();continue}i[t]=n[t].defaultValue;continue}if(n[t].required&&"create"===r)throw b.APIError.from("BAD_REQUEST",{...rw.BASE_ERROR_CODES.MISSING_FIELD,message:`${t} is required`})}return i}function rx(e,t={},r){return rS(t,{fields:rE(e,"user","input"),action:r})}let rT=(e,t="ms")=>new Date(Date.now()+("sec"===t?1e3*e:e)),rR=/^(\+|\-)? ?(\d+|\d+\.\d+) ?(seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|months?|mo|years?|yrs?|y)(?: (ago|from now))?$/i;function rI(e){if(-1===e.indexOf("%"))return e;try{return decodeURIComponent(e)}catch{return e}}function rU(e){if(!e)return[];let t=[],r=0,n=0;for(;n<e.length;){if(","===e[n]){let i=n+1;for(;i<e.length&&" "===e[i];)i++;for(;i<e.length&&"="!==e[i]&&";"!==e[i]&&","!==e[i];)i++;if(i<e.length&&"="===e[i]){let i=e.slice(r,n).trim();for(i&&t.push(i),r=n+1;r<e.length&&" "===e[r];)r++;n=r;continue}}n++}let i=e.slice(r).trim();return i&&t.push(i),t}let rO=/^[\w!#$%&'*.^`|~+-]+$/,rP=/^[ !#-:<-[\]-~]*$/;function rC(e){return!(e.length<2)&&e.startsWith('"')&&e.endsWith('"')?e.slice(1,-1):e}function rD(e){let t=0,r=e.length;for(;t<r;){let r=e.charCodeAt(t);if(32!==r&&9!==r)break;t++}for(;r>t;){let t=e.charCodeAt(r-1);if(32!==t&&9!==t)break;r--}return 0===t&&r===e.length?e:e.slice(t,r)}function rL(e){let t=new Map;if(e.length<2)return t;for(let r of e.split(";")){let e=r.indexOf("=");if(-1===e)continue;let n=rD(r.slice(0,e)),i=rC(rD(r.slice(e+1)));rO.test(n)&&rP.test(i)&&t.set(n,rI(i))}return t}var rz=e.i(858544);function r$(e,t,r){function n(r,n){if(r._zod||Object.defineProperty(r,"_zod",{value:{def:n,constr:o,traits:new Set},enumerable:!1}),r._zod.traits.has(e))return;r._zod.traits.add(e),t(r,n);let i=o.prototype,a=Object.keys(i);for(let e=0;e<a.length;e++){let t=a[e];t in r||(r[t]=i[t].bind(r))}}let i=r?.Parent??Object;class a extends i{}function o(e){var t;let i=r?.Parent?new a:this;for(let r of(n(i,e),(t=i._zod).deferred??(t.deferred=[]),i._zod.deferred))r();return i}return Object.defineProperty(a,"name",{value:e}),Object.defineProperty(o,"init",{value:n}),Object.defineProperty(o,Symbol.hasInstance,{value:t=>!!r?.Parent&&t instanceof r.Parent||t?._zod?.traits?.has(e)}),Object.defineProperty(o,"name",{value:e}),o}Symbol("zod_brand");class rN extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class rj extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name="ZodEncodeError"}}(h=globalThis).__zod_globalConfig??(h.__zod_globalConfig={});let rH=globalThis.__zod_globalConfig;function rB(e){return e&&Object.assign(rH,e),rH}function rV(e){let t=Object.values(e).filter(e=>"number"==typeof e);return Object.entries(e).filter(([e,r])=>-1===t.indexOf(+e)).map(([e,t])=>t)}function rM(e,t){return"bigint"==typeof t?t.toString():t}function rK(e){return{get value(){{let t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function rW(e){return null==e}function rq(e){let t=+!!e.startsWith("^"),r=e.endsWith("$")?e.length-1:e.length;return e.slice(t,r)}function rF(e,t){let r=e/t,n=Math.round(r),i=Number.EPSILON*Math.max(Math.abs(r),1);return Math.abs(r-n)<i?0:r-n}let rJ=Symbol("evaluating");function rZ(e,t,r){let n;Object.defineProperty(e,t,{get(){if(n!==rJ)return void 0===n&&(n=rJ,n=r()),n},set(r){Object.defineProperty(e,t,{value:r})},configurable:!0})}function rG(e,t,r){Object.defineProperty(e,t,{value:r,writable:!0,enumerable:!0,configurable:!0})}function rQ(...e){let t={};for(let r of e)Object.assign(t,Object.getOwnPropertyDescriptors(r));return Object.defineProperties({},t)}function rY(e){return JSON.stringify(e)}function rX(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}let r0="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function r1(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)}let r2=rK(()=>{if(rH.jitless||"u">typeof navigator&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{return Function(""),!0}catch(e){return!1}});function r6(e){if(!1===r1(e))return!1;let t=e.constructor;if(void 0===t||"function"!=typeof t)return!0;let r=t.prototype;return!1!==r1(r)&&!1!==Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")}let r5=new Set(["string","number","symbol"]),r8=new Set(["string","number","bigint","boolean","symbol","undefined"]);function r4(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function r3(e,t,r){let n=new e._zod.constr(t??e._zod.def);return(!t||r?.parent)&&(n._zod.parent=e),n}function r9(e){if(!e)return{};if("string"==typeof e)return{error:()=>e};if(e?.message!==void 0){if(e?.error!==void 0)throw Error("Cannot specify both `message` and `error` params");e.error=e.message}return(delete e.message,"string"==typeof e.error)?{...e,error:()=>e.error}:e}function r7(e){return"bigint"==typeof e?e.toString()+"n":"string"==typeof e?`"${e}"`:`${e}`}function ne(e){return Object.keys(e).filter(t=>"optional"===e[t]._zod.optin&&"optional"===e[t]._zod.optout)}let nt={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-0x80000000,0x7fffffff],uint32:[0,0xffffffff],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]},nr={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function nn(e,t=0){if(!0===e.aborted)return!0;for(let r=t;r<e.issues.length;r++)if(e.issues[r]?.continue!==!0)return!0;return!1}function ni(e,t=0){if(!0===e.aborted)return!0;for(let r=t;r<e.issues.length;r++)if(e.issues[r]?.continue===!1)return!0;return!1}function na(e,t){return t.map(t=>(t.path??(t.path=[]),t.path.unshift(e),t))}function no(e){return"string"==typeof e?e:e?.message}function ns(e,t,r){let n=e.message?e.message:no(e.inst?._zod.def?.error?.(e))??no(t?.error?.(e))??no(r.customError?.(e))??no(r.localeError?.(e))??"Invalid input",{inst:i,continue:a,input:o,...s}=e;return s.path??(s.path=[]),s.message=n,t?.reportInput&&(s.input=o),s}function nc(e){return e instanceof Set?"set":e instanceof Map?"map":e instanceof File?"file":"unknown"}function nl(e){return Array.isArray(e)?"array":"string"==typeof e?"string":"unknown"}function nd(...e){let[t,r,n]=e;return"string"==typeof t?{message:t,code:"custom",input:r,inst:n}:{...t}}function nu(e){let t=atob(e),r=new Uint8Array(t.length);for(let e=0;e<t.length;e++)r[e]=t.charCodeAt(e);return r}function np(e){let t="";for(let r=0;r<e.length;r++)t+=String.fromCharCode(e[r]);return btoa(t)}e.s(["BIGINT_FORMAT_RANGES",0,nr,"Class",0,class{constructor(...e){}},"NUMBER_FORMAT_RANGES",0,nt,"aborted",0,nn,"allowsEval",0,r2,"assert",0,function(e){},"assertEqual",0,function(e){return e},"assertIs",0,function(e){},"assertNever",0,function(e){throw Error("Unexpected value in exhaustive check")},"assertNotEqual",0,function(e){return e},"assignProp",0,rG,"base64ToUint8Array",0,nu,"base64urlToUint8Array",0,function(e){let t=e.replace(/-/g,"+").replace(/_/g,"/"),r="=".repeat((4-t.length%4)%4);return nu(t+r)},"cached",0,rK,"captureStackTrace",0,r0,"cleanEnum",0,function(e){return Object.entries(e).filter(([e,t])=>Number.isNaN(Number.parseInt(e,10))).map(e=>e[1])},"cleanRegex",0,rq,"clone",0,r3,"cloneDef",0,function(e){return rQ(e._zod.def)},"createTransparentProxy",0,function(e){let t;return new Proxy({},{get:(r,n,i)=>(t??(t=e()),Reflect.get(t,n,i)),set:(r,n,i,a)=>(t??(t=e()),Reflect.set(t,n,i,a)),has:(r,n)=>(t??(t=e()),Reflect.has(t,n)),deleteProperty:(r,n)=>(t??(t=e()),Reflect.deleteProperty(t,n)),ownKeys:r=>(t??(t=e()),Reflect.ownKeys(t)),getOwnPropertyDescriptor:(r,n)=>(t??(t=e()),Reflect.getOwnPropertyDescriptor(t,n)),defineProperty:(r,n,i)=>(t??(t=e()),Reflect.defineProperty(t,n,i))})},"defineLazy",0,rZ,"esc",0,rY,"escapeRegex",0,r4,"explicitlyAborted",0,ni,"extend",0,function(e,t){if(!r6(t))throw Error("Invalid input to extend: expected a plain object");let r=e._zod.def.checks;if(r&&r.length>0){let r=e._zod.def.shape;for(let e in t)if(void 0!==Object.getOwnPropertyDescriptor(r,e))throw Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}let n=rQ(e._zod.def,{get shape(){let r={...e._zod.def.shape,...t};return rG(this,"shape",r),r}});return r3(e,n)},"finalizeIssue",0,ns,"floatSafeRemainder",0,rF,"getElementAtPath",0,function(e,t){return t?t.reduce((e,t)=>e?.[t],e):e},"getEnumValues",0,rV,"getLengthableOrigin",0,nl,"getParsedType",0,e=>{let t=typeof e;switch(t){case"undefined":return"undefined";case"string":return"string";case"number":return Number.isNaN(e)?"nan":"number";case"boolean":return"boolean";case"function":return"function";case"bigint":return"bigint";case"symbol":return"symbol";case"object":if(Array.isArray(e))return"array";if(null===e)return"null";if(e.then&&"function"==typeof e.then&&e.catch&&"function"==typeof e.catch)return"promise";if("u">typeof Map&&e instanceof Map)return"map";if("u">typeof Set&&e instanceof Set)return"set";if("u">typeof Date&&e instanceof Date)return"date";if("u">typeof File&&e instanceof File)return"file";return"object";default:throw Error(`Unknown data type: ${t}`)}},"getSizableOrigin",0,nc,"hexToUint8Array",0,function(e){let t=e.replace(/^0x/,"");if(t.length%2!=0)throw Error("Invalid hex string length");let r=new Uint8Array(t.length/2);for(let e=0;e<t.length;e+=2)r[e/2]=Number.parseInt(t.slice(e,e+2),16);return r},"isObject",0,r1,"isPlainObject",0,r6,"issue",0,nd,"joinValues",0,function(e,t="|"){return e.map(e=>r7(e)).join(t)},"jsonStringifyReplacer",0,rM,"merge",0,function(e,t){if(e._zod.def.checks?.length)throw Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");let r=rQ(e._zod.def,{get shape(){let r={...e._zod.def.shape,...t._zod.def.shape};return rG(this,"shape",r),r},get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]});return r3(e,r)},"mergeDefs",0,rQ,"normalizeParams",0,r9,"nullish",0,rW,"numKeys",0,function(e){let t=0;for(let r in e)Object.prototype.hasOwnProperty.call(e,r)&&t++;return t},"objectClone",0,function(e){return Object.create(Object.getPrototypeOf(e),Object.getOwnPropertyDescriptors(e))},"omit",0,function(e,t){let r=e._zod.def,n=r.checks;if(n&&n.length>0)throw Error(".omit() cannot be used on object schemas containing refinements");let i=rQ(e._zod.def,{get shape(){let n={...e._zod.def.shape};for(let e in t){if(!(e in r.shape))throw Error(`Unrecognized key: "${e}"`);t[e]&&delete n[e]}return rG(this,"shape",n),n},checks:[]});return r3(e,i)},"optionalKeys",0,ne,"parsedType",0,function(e){let t=typeof e;switch(t){case"number":return Number.isNaN(e)?"nan":"number";case"object":if(null===e)return"null";if(Array.isArray(e))return"array";if(e&&Object.getPrototypeOf(e)!==Object.prototype&&"constructor"in e&&e.constructor)return e.constructor.name}return t},"partial",0,function(e,t,r){let n=t._zod.def.checks;if(n&&n.length>0)throw Error(".partial() cannot be used on object schemas containing refinements");let i=rQ(t._zod.def,{get shape(){let n=t._zod.def.shape,i={...n};if(r)for(let t in r){if(!(t in n))throw Error(`Unrecognized key: "${t}"`);r[t]&&(i[t]=e?new e({type:"optional",innerType:n[t]}):n[t])}else for(let t in n)i[t]=e?new e({type:"optional",innerType:n[t]}):n[t];return rG(this,"shape",i),i},checks:[]});return r3(t,i)},"pick",0,function(e,t){let r=e._zod.def,n=r.checks;if(n&&n.length>0)throw Error(".pick() cannot be used on object schemas containing refinements");let i=rQ(e._zod.def,{get shape(){let e={};for(let n in t){if(!(n in r.shape))throw Error(`Unrecognized key: "${n}"`);t[n]&&(e[n]=r.shape[n])}return rG(this,"shape",e),e},checks:[]});return r3(e,i)},"prefixIssues",0,na,"primitiveTypes",0,r8,"promiseAllObject",0,function(e){let t=Object.keys(e);return Promise.all(t.map(t=>e[t])).then(e=>{let r={};for(let n=0;n<t.length;n++)r[t[n]]=e[n];return r})},"propertyKeyTypes",0,r5,"randomString",0,function(e=10){let t="abcdefghijklmnopqrstuvwxyz",r="";for(let n=0;n<e;n++)r+=t[Math.floor(Math.random()*t.length)];return r},"required",0,function(e,t,r){let n=rQ(t._zod.def,{get shape(){let n=t._zod.def.shape,i={...n};if(r)for(let t in r){if(!(t in i))throw Error(`Unrecognized key: "${t}"`);r[t]&&(i[t]=new e({type:"nonoptional",innerType:n[t]}))}else for(let t in n)i[t]=new e({type:"nonoptional",innerType:n[t]});return rG(this,"shape",i),i}});return r3(t,n)},"safeExtend",0,function(e,t){if(!r6(t))throw Error("Invalid input to safeExtend: expected a plain object");let r=rQ(e._zod.def,{get shape(){let r={...e._zod.def.shape,...t};return rG(this,"shape",r),r}});return r3(e,r)},"shallowClone",0,function(e){return r6(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e},"slugify",0,rX,"stringifyPrimitive",0,r7,"uint8ArrayToBase64",0,np,"uint8ArrayToBase64url",0,function(e){return np(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")},"uint8ArrayToHex",0,function(e){return Array.from(e).map(e=>e.toString(16).padStart(2,"0")).join("")},"unwrapMessage",0,no],202721);let nf=/^[cC][0-9a-z]{6,}$/,nh=/^[0-9a-z]+$/,nm=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,ny=/^[0-9a-vA-V]{20}$/,ng=/^[A-Za-z0-9]{27}$/,nw=/^[a-zA-Z0-9_-]{21}$/,nb=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,nA=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,nE=e=>e?RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,nv=nE(4),nk=nE(6),n_=nE(7),nS=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,nx=/^[^\s@"]{1,64}@[^\s@]{1,255}$/u;function nT(){return RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")}let nR=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,nI=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,nU=e=>{let t=r4(e??":");return RegExp(`^(?:[0-9A-F]{2}${t}){5}[0-9A-F]{2}$|^(?:[0-9a-f]{2}${t}){5}[0-9a-f]{2}$`)},nO=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,nP=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,nC=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,nD=/^[A-Za-z0-9_-]*$/,nL=/^https?$/,nz=/^\+[1-9]\d{6,14}$/,n$="(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))",nN=RegExp(`^${n$}$`);function nj(e){let t="(?:[01]\\d|2[0-3]):[0-5]\\d";return"number"==typeof e.precision?-1===e.precision?`${t}`:0===e.precision?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function nH(e){return RegExp(`^${nj(e)}$`)}function nB(e){let t=nj({precision:e.precision}),r=["Z"];e.local&&r.push(""),e.offset&&r.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");let n=`${t}(?:${r.join("|")})`;return RegExp(`^${n$}T(?:${n})$`)}let nV=e=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return RegExp(`^${t}$`)},nM=/^-?\d+n?$/,nK=/^-?\d+$/,nW=/^-?\d+(?:\.\d+)?$/,nq=/^(?:true|false)$/i,nF=/^null$/i,nJ=/^undefined$/i,nZ=/^[^A-Z]*$/,nG=/^[^a-z]*$/;function nQ(e,t){return RegExp(`^[A-Za-z0-9+/]{${e}}${t}$`)}function nY(e){return RegExp(`^[A-Za-z0-9_-]{${e}}$`)}let nX=nQ(22,"=="),n0=nY(22),n1=nQ(27,"="),n2=nY(27),n6=nQ(43,"="),n5=nY(43),n8=nQ(64,""),n4=nY(64),n3=nQ(86,"=="),n9=nY(86);e.s(["base64",0,nC,"base64url",0,nD,"bigint",0,nM,"boolean",0,nq,"browserEmail",0,/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/,"cidrv4",0,nO,"cidrv6",0,nP,"cuid",0,nf,"cuid2",0,nh,"date",0,nN,"datetime",0,nB,"domain",0,/^([a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,}$/,"duration",0,nb,"e164",0,nz,"email",0,nS,"emoji",0,nT,"extendedDuration",0,/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,"guid",0,nA,"hex",0,/^[0-9a-fA-F]*$/,"hostname",0,/^(?=.{1,253}\.?$)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[-0-9a-zA-Z]{0,61}[0-9a-zA-Z])?)*\.?$/,"html5Email",0,/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/,"httpProtocol",0,nL,"idnEmail",0,nx,"integer",0,nK,"ipv4",0,nR,"ipv6",0,nI,"ksuid",0,ng,"lowercase",0,nZ,"mac",0,nU,"md5_base64",0,nX,"md5_base64url",0,n0,"md5_hex",0,/^[0-9a-fA-F]{32}$/,"nanoid",0,nw,"null",0,nF,"number",0,nW,"rfc5322Email",0,/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/,"sha1_base64",0,n1,"sha1_base64url",0,n2,"sha1_hex",0,/^[0-9a-fA-F]{40}$/,"sha256_base64",0,n6,"sha256_base64url",0,n5,"sha256_hex",0,/^[0-9a-fA-F]{64}$/,"sha384_base64",0,n8,"sha384_base64url",0,n4,"sha384_hex",0,/^[0-9a-fA-F]{96}$/,"sha512_base64",0,n3,"sha512_base64url",0,n9,"sha512_hex",0,/^[0-9a-fA-F]{128}$/,"string",0,nV,"time",0,nH,"ulid",0,nm,"undefined",0,nJ,"unicodeEmail",0,nx,"uppercase",0,nG,"uuid",0,nE,"uuid4",0,nv,"uuid6",0,nk,"uuid7",0,n_,"xid",0,ny],110107);let n7=r$("$ZodCheck",(e,t)=>{var r;e._zod??(e._zod={}),e._zod.def=t,(r=e._zod).onattach??(r.onattach=[])}),ie={number:"number",bigint:"bigint",object:"date"},it=r$("$ZodCheckLessThan",(e,t)=>{n7.init(e,t);let r=ie[typeof t.value];e._zod.onattach.push(e=>{let r=e._zod.bag,n=(t.inclusive?r.maximum:r.exclusiveMaximum)??1/0;t.value<n&&(t.inclusive?r.maximum=t.value:r.exclusiveMaximum=t.value)}),e._zod.check=n=>{(t.inclusive?n.value<=t.value:n.value<t.value)||n.issues.push({origin:r,code:"too_big",maximum:"object"==typeof t.value?t.value.getTime():t.value,input:n.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),ir=r$("$ZodCheckGreaterThan",(e,t)=>{n7.init(e,t);let r=ie[typeof t.value];e._zod.onattach.push(e=>{let r=e._zod.bag,n=(t.inclusive?r.minimum:r.exclusiveMinimum)??-1/0;t.value>n&&(t.inclusive?r.minimum=t.value:r.exclusiveMinimum=t.value)}),e._zod.check=n=>{(t.inclusive?n.value>=t.value:n.value>t.value)||n.issues.push({origin:r,code:"too_small",minimum:"object"==typeof t.value?t.value.getTime():t.value,input:n.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),ii=r$("$ZodCheckMultipleOf",(e,t)=>{n7.init(e,t),e._zod.onattach.push(e=>{var r;(r=e._zod.bag).multipleOf??(r.multipleOf=t.value)}),e._zod.check=r=>{if(typeof r.value!=typeof t.value)throw Error("Cannot mix number and bigint in multiple_of check.");("bigint"==typeof r.value?r.value%t.value===BigInt(0):0===rF(r.value,t.value))||r.issues.push({origin:typeof r.value,code:"not_multiple_of",divisor:t.value,input:r.value,inst:e,continue:!t.abort})}}),ia=r$("$ZodCheckNumberFormat",(e,t)=>{n7.init(e,t),t.format=t.format||"float64";let r=t.format?.includes("int"),n=r?"int":"number",[i,a]=nt[t.format];e._zod.onattach.push(e=>{let n=e._zod.bag;n.format=t.format,n.minimum=i,n.maximum=a,r&&(n.pattern=nK)}),e._zod.check=o=>{let s=o.value;if(r){if(!Number.isInteger(s))return void o.issues.push({expected:n,format:t.format,code:"invalid_type",continue:!1,input:s,inst:e});if(!Number.isSafeInteger(s))return void(s>0?o.issues.push({input:s,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:n,inclusive:!0,continue:!t.abort}):o.issues.push({input:s,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:n,inclusive:!0,continue:!t.abort}))}s<i&&o.issues.push({origin:"number",input:s,code:"too_small",minimum:i,inclusive:!0,inst:e,continue:!t.abort}),s>a&&o.issues.push({origin:"number",input:s,code:"too_big",maximum:a,inclusive:!0,inst:e,continue:!t.abort})}}),io=r$("$ZodCheckBigIntFormat",(e,t)=>{n7.init(e,t);let[r,n]=nr[t.format];e._zod.onattach.push(e=>{let i=e._zod.bag;i.format=t.format,i.minimum=r,i.maximum=n}),e._zod.check=i=>{let a=i.value;a<r&&i.issues.push({origin:"bigint",input:a,code:"too_small",minimum:r,inclusive:!0,inst:e,continue:!t.abort}),a>n&&i.issues.push({origin:"bigint",input:a,code:"too_big",maximum:n,inclusive:!0,inst:e,continue:!t.abort})}}),is=r$("$ZodCheckMaxSize",(e,t)=>{var r;n7.init(e,t),(r=e._zod.def).when??(r.when=e=>{let t=e.value;return!rW(t)&&void 0!==t.size}),e._zod.onattach.push(e=>{let r=e._zod.bag.maximum??1/0;t.maximum<r&&(e._zod.bag.maximum=t.maximum)}),e._zod.check=r=>{let n=r.value;n.size<=t.maximum||r.issues.push({origin:nc(n),code:"too_big",maximum:t.maximum,inclusive:!0,input:n,inst:e,continue:!t.abort})}}),ic=r$("$ZodCheckMinSize",(e,t)=>{var r;n7.init(e,t),(r=e._zod.def).when??(r.when=e=>{let t=e.value;return!rW(t)&&void 0!==t.size}),e._zod.onattach.push(e=>{let r=e._zod.bag.minimum??-1/0;t.minimum>r&&(e._zod.bag.minimum=t.minimum)}),e._zod.check=r=>{let n=r.value;n.size>=t.minimum||r.issues.push({origin:nc(n),code:"too_small",minimum:t.minimum,inclusive:!0,input:n,inst:e,continue:!t.abort})}}),il=r$("$ZodCheckSizeEquals",(e,t)=>{var r;n7.init(e,t),(r=e._zod.def).when??(r.when=e=>{let t=e.value;return!rW(t)&&void 0!==t.size}),e._zod.onattach.push(e=>{let r=e._zod.bag;r.minimum=t.size,r.maximum=t.size,r.size=t.size}),e._zod.check=r=>{let n=r.value,i=n.size;if(i===t.size)return;let a=i>t.size;r.issues.push({origin:nc(n),...a?{code:"too_big",maximum:t.size}:{code:"too_small",minimum:t.size},inclusive:!0,exact:!0,input:r.value,inst:e,continue:!t.abort})}}),id=r$("$ZodCheckMaxLength",(e,t)=>{var r;n7.init(e,t),(r=e._zod.def).when??(r.when=e=>{let t=e.value;return!rW(t)&&void 0!==t.length}),e._zod.onattach.push(e=>{let r=e._zod.bag.maximum??1/0;t.maximum<r&&(e._zod.bag.maximum=t.maximum)}),e._zod.check=r=>{let n=r.value;if(n.length<=t.maximum)return;let i=nl(n);r.issues.push({origin:i,code:"too_big",maximum:t.maximum,inclusive:!0,input:n,inst:e,continue:!t.abort})}}),iu=r$("$ZodCheckMinLength",(e,t)=>{var r;n7.init(e,t),(r=e._zod.def).when??(r.when=e=>{let t=e.value;return!rW(t)&&void 0!==t.length}),e._zod.onattach.push(e=>{let r=e._zod.bag.minimum??-1/0;t.minimum>r&&(e._zod.bag.minimum=t.minimum)}),e._zod.check=r=>{let n=r.value;if(n.length>=t.minimum)return;let i=nl(n);r.issues.push({origin:i,code:"too_small",minimum:t.minimum,inclusive:!0,input:n,inst:e,continue:!t.abort})}}),ip=r$("$ZodCheckLengthEquals",(e,t)=>{var r;n7.init(e,t),(r=e._zod.def).when??(r.when=e=>{let t=e.value;return!rW(t)&&void 0!==t.length}),e._zod.onattach.push(e=>{let r=e._zod.bag;r.minimum=t.length,r.maximum=t.length,r.length=t.length}),e._zod.check=r=>{let n=r.value,i=n.length;if(i===t.length)return;let a=nl(n),o=i>t.length;r.issues.push({origin:a,...o?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:r.value,inst:e,continue:!t.abort})}}),ih=r$("$ZodCheckStringFormat",(e,t)=>{var r,n;n7.init(e,t),e._zod.onattach.push(e=>{let r=e._zod.bag;r.format=t.format,t.pattern&&(r.patterns??(r.patterns=new Set),r.patterns.add(t.pattern))}),t.pattern?(r=e._zod).check??(r.check=r=>{t.pattern.lastIndex=0,t.pattern.test(r.value)||r.issues.push({origin:"string",code:"invalid_format",format:t.format,input:r.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(n=e._zod).check??(n.check=()=>{})}),im=r$("$ZodCheckRegex",(e,t)=>{ih.init(e,t),e._zod.check=r=>{t.pattern.lastIndex=0,t.pattern.test(r.value)||r.issues.push({origin:"string",code:"invalid_format",format:"regex",input:r.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),iy=r$("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=nZ),ih.init(e,t)}),ig=r$("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=nG),ih.init(e,t)}),iw=r$("$ZodCheckIncludes",(e,t)=>{n7.init(e,t);let r=r4(t.includes),n=new RegExp("number"==typeof t.position?`^.{${t.position}}${r}`:r);t.pattern=n,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??(t.patterns=new Set),t.patterns.add(n)}),e._zod.check=r=>{r.value.includes(t.includes,t.position)||r.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:r.value,inst:e,continue:!t.abort})}}),ib=r$("$ZodCheckStartsWith",(e,t)=>{n7.init(e,t);let r=RegExp(`^${r4(t.prefix)}.*`);t.pattern??(t.pattern=r),e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??(t.patterns=new Set),t.patterns.add(r)}),e._zod.check=r=>{r.value.startsWith(t.prefix)||r.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:r.value,inst:e,continue:!t.abort})}}),iA=r$("$ZodCheckEndsWith",(e,t)=>{n7.init(e,t);let r=RegExp(`.*${r4(t.suffix)}$`);t.pattern??(t.pattern=r),e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??(t.patterns=new Set),t.patterns.add(r)}),e._zod.check=r=>{r.value.endsWith(t.suffix)||r.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:r.value,inst:e,continue:!t.abort})}});(e,t)=>{n7.init(e,t);let r=new Set(t.mime);e._zod.onattach.push(e=>{e._zod.bag.mime=t.mime}),e._zod.check=n=>{r.has(n.value.type)||n.issues.push({code:"invalid_value",values:t.mime,input:n.value.type,inst:e,continue:!t.abort})}};let iE=r$("$ZodCheckOverwrite",(e,t)=>{n7.init(e,t),e._zod.check=e=>{e.value=t.tx(e.value)}});class iv{constructor(e=[]){this.content=[],this.indent=0,this&&(this.args=e)}indented(e){this.indent+=1,e(this),this.indent-=1}write(e){if("function"==typeof e){e(this,{execution:"sync"}),e(this,{execution:"async"});return}let t=e.split("\n").filter(e=>e),r=Math.min(...t.map(e=>e.length-e.trimStart().length));for(let e of t.map(e=>e.slice(r)).map(e=>" ".repeat(2*this.indent)+e))this.content.push(e)}compile(){return Function(...this?.args,[...(this?.content??[""]).map(e=>` ${e}`)].join("\n"))}}let ik=(e,t)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),e.message=JSON.stringify(t,rM,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},i_=r$("$ZodError",ik),iS=r$("$ZodError",ik,{Parent:Error}),ix=e=>(t,r,n,i)=>{let a=n?{...n,async:!1}:{async:!1},o=t._zod.run({value:r,issues:[]},a);if(o instanceof Promise)throw new rN;if(o.issues.length){let t=new(i?.Err??e)(o.issues.map(e=>ns(e,a,rB())));throw r0(t,i?.callee),t}return o.value},iT=ix(iS),iR=e=>async(t,r,n,i)=>{let a=n?{...n,async:!0}:{async:!0},o=t._zod.run({value:r,issues:[]},a);if(o instanceof Promise&&(o=await o),o.issues.length){let t=new(i?.Err??e)(o.issues.map(e=>ns(e,a,rB())));throw r0(t,i?.callee),t}return o.value},iI=iR(iS),iU=e=>(t,r,n)=>{let i=n?{...n,async:!1}:{async:!1},a=t._zod.run({value:r,issues:[]},i);if(a instanceof Promise)throw new rN;return a.issues.length?{success:!1,error:new(e??i_)(a.issues.map(e=>ns(e,i,rB())))}:{success:!0,data:a.value}},iO=iU(iS),iP=e=>async(t,r,n)=>{let i=n?{...n,async:!0}:{async:!0},a=t._zod.run({value:r,issues:[]},i);return a instanceof Promise&&(a=await a),a.issues.length?{success:!1,error:new e(a.issues.map(e=>ns(e,i,rB())))}:{success:!0,data:a.value}},iC=iP(iS),iD={major:4,minor:4,patch:3},iL=r$("$ZodType",(e,t)=>{var r;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=iD;let n=[...e._zod.def.checks??[]];for(let t of(e._zod.traits.has("$ZodCheck")&&n.unshift(e),n))for(let r of t._zod.onattach)r(e);if(0===n.length)(r=e._zod).deferred??(r.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let t=(e,t,r)=>{let n,i=nn(e);for(let a of t){if(a._zod.def.when){if(ni(e)||!a._zod.def.when(e))continue}else if(i)continue;let t=e.issues.length,o=a._zod.check(e);if(o instanceof Promise&&r?.async===!1)throw new rN;if(n||o instanceof Promise)n=(n??Promise.resolve()).then(async()=>{await o,e.issues.length!==t&&(i||(i=nn(e,t)))});else{if(e.issues.length===t)continue;i||(i=nn(e,t))}}return n?n.then(()=>e):e},r=(r,i,a)=>{if(nn(r))return r.aborted=!0,r;let o=t(i,n,a);if(o instanceof Promise){if(!1===a.async)throw new rN;return o.then(t=>e._zod.parse(t,a))}return e._zod.parse(o,a)};e._zod.run=(i,a)=>{if(a.skipChecks)return e._zod.parse(i,a);if("backward"===a.direction){let t=e._zod.parse({value:i.value,issues:[]},{...a,skipChecks:!0});return t instanceof Promise?t.then(e=>r(e,i,a)):r(t,i,a)}let o=e._zod.parse(i,a);if(o instanceof Promise){if(!1===a.async)throw new rN;return o.then(e=>t(e,n,a))}return t(o,n,a)}}rZ(e,"~standard",()=>({validate:t=>{try{let r=iO(e,t);return r.success?{value:r.data}:{issues:r.error?.issues}}catch(r){return iC(e,t).then(e=>e.success?{value:e.data}:{issues:e.error?.issues})}},vendor:"zod",version:1}))}),iz=r$("$ZodString",(e,t)=>{iL.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??nV(e._zod.bag),e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=String(r.value)}catch(e){}return"string"==typeof r.value||r.issues.push({expected:"string",code:"invalid_type",input:r.value,inst:e}),r}}),i$=r$("$ZodStringFormat",(e,t)=>{ih.init(e,t),iz.init(e,t)}),iN=r$("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=nA),i$.init(e,t)}),ij=r$("$ZodUUID",(e,t)=>{if(t.version){let e={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(void 0===e)throw Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=nE(e))}else t.pattern??(t.pattern=nE());i$.init(e,t)}),iH=r$("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=nS),i$.init(e,t)}),iB=r$("$ZodURL",(e,t)=>{i$.init(e,t),e._zod.check=r=>{try{let n=r.value.trim();if(!t.normalize&&t.protocol?.source===nL.source&&!/^https?:\/\//i.test(n))return void r.issues.push({code:"invalid_format",format:"url",note:"Invalid URL format",input:r.value,inst:e,continue:!t.abort});let i=new URL(n);t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(i.hostname)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:t.hostname.source,input:r.value,inst:e,continue:!t.abort})),t.protocol&&(t.protocol.lastIndex=0,t.protocol.test(i.protocol.endsWith(":")?i.protocol.slice(0,-1):i.protocol)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:r.value,inst:e,continue:!t.abort})),t.normalize?r.value=i.href:r.value=n;return}catch(n){r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:e,continue:!t.abort})}}}),iV=r$("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=nT()),i$.init(e,t)}),iM=r$("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=nw),i$.init(e,t)}),iK=r$("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=nf),i$.init(e,t)}),iW=r$("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=nh),i$.init(e,t)}),iq=r$("$ZodULID",(e,t)=>{t.pattern??(t.pattern=nm),i$.init(e,t)}),iF=r$("$ZodXID",(e,t)=>{t.pattern??(t.pattern=ny),i$.init(e,t)}),iJ=r$("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=ng),i$.init(e,t)}),iZ=r$("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=nB(t)),i$.init(e,t)}),iG=r$("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=nN),i$.init(e,t)}),iQ=r$("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=nH(t)),i$.init(e,t)}),iY=r$("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=nb),i$.init(e,t)}),iX=r$("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=nR),i$.init(e,t),e._zod.bag.format="ipv4"}),i0=r$("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=nI),i$.init(e,t),e._zod.bag.format="ipv6",e._zod.check=r=>{try{new URL(`http://[${r.value}]`)}catch{r.issues.push({code:"invalid_format",format:"ipv6",input:r.value,inst:e,continue:!t.abort})}}}),i1=((e,t)=>{t.pattern??(t.pattern=nU(t.delimiter)),i$.init(e,t),e._zod.bag.format="mac"},r$("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=nO),i$.init(e,t)})),i2=r$("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=nP),i$.init(e,t),e._zod.check=r=>{let n=r.value.split("/");try{if(2!==n.length)throw Error();let[e,t]=n;if(!t)throw Error();let r=Number(t);if(`${r}`!==t||r<0||r>128)throw Error();new URL(`http://[${e}]`)}catch{r.issues.push({code:"invalid_format",format:"cidrv6",input:r.value,inst:e,continue:!t.abort})}}});function i6(e){if(""===e)return!0;if(/\s/.test(e)||e.length%4!=0)return!1;try{return atob(e),!0}catch{return!1}}let i5=r$("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=nC),i$.init(e,t),e._zod.bag.contentEncoding="base64",e._zod.check=r=>{i6(r.value)||r.issues.push({code:"invalid_format",format:"base64",input:r.value,inst:e,continue:!t.abort})}}),i8=r$("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=nD),i$.init(e,t),e._zod.bag.contentEncoding="base64url",e._zod.check=r=>{!function(e){if(!nD.test(e))return!1;let t=e.replace(/[-_]/g,e=>"-"===e?"+":"/");return i6(t.padEnd(4*Math.ceil(t.length/4),"="))}(r.value)&&r.issues.push({code:"invalid_format",format:"base64url",input:r.value,inst:e,continue:!t.abort})}}),i4=r$("$ZodE164",(e,t)=>{t.pattern??(t.pattern=nz),i$.init(e,t)}),i3=r$("$ZodJWT",(e,t)=>{i$.init(e,t),e._zod.check=r=>{!function(e,t=null){try{let r=e.split(".");if(3!==r.length)return!1;let[n]=r;if(!n)return!1;let i=JSON.parse(atob(n));if("typ"in i&&i?.typ!=="JWT"||!i.alg||t&&(!("alg"in i)||i.alg!==t))return!1;return!0}catch{return!1}}(r.value,t.alg)&&r.issues.push({code:"invalid_format",format:"jwt",input:r.value,inst:e,continue:!t.abort})}}),i9=((e,t)=>{i$.init(e,t),e._zod.check=r=>{t.fn(r.value)||r.issues.push({code:"invalid_format",format:t.format,input:r.value,inst:e,continue:!t.abort})}},r$("$ZodNumber",(e,t)=>{iL.init(e,t),e._zod.pattern=e._zod.bag.pattern??nW,e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=Number(r.value)}catch(e){}let i=r.value;if("number"==typeof i&&!Number.isNaN(i)&&Number.isFinite(i))return r;let a="number"==typeof i?Number.isNaN(i)?"NaN":Number.isFinite(i)?void 0:"Infinity":void 0;return r.issues.push({expected:"number",code:"invalid_type",input:i,inst:e,...a?{received:a}:{}}),r}})),i7=r$("$ZodNumberFormat",(e,t)=>{ia.init(e,t),i9.init(e,t)}),ae=r$("$ZodBoolean",(e,t)=>{iL.init(e,t),e._zod.pattern=nq,e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=!!r.value}catch(e){}let i=r.value;return"boolean"==typeof i||r.issues.push({expected:"boolean",code:"invalid_type",input:i,inst:e}),r}}),at=r$("$ZodBigInt",(e,t)=>{iL.init(e,t),e._zod.pattern=nM,e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=BigInt(r.value)}catch(e){}return"bigint"==typeof r.value||r.issues.push({expected:"bigint",code:"invalid_type",input:r.value,inst:e}),r}}),ar=((e,t)=>{io.init(e,t),at.init(e,t)},r$("$ZodAny",(e,t)=>{iL.init(e,t),e._zod.parse=e=>e})),an=r$("$ZodUnknown",(e,t)=>{iL.init(e,t),e._zod.parse=e=>e}),ai=r$("$ZodNever",(e,t)=>{iL.init(e,t),e._zod.parse=(t,r)=>(t.issues.push({expected:"never",code:"invalid_type",input:t.value,inst:e}),t)}),aa=((e,t)=>{iL.init(e,t),e._zod.parse=(t,r)=>{let n=t.value;return void 0===n||t.issues.push({expected:"void",code:"invalid_type",input:n,inst:e}),t}},r$("$ZodDate",(e,t)=>{iL.init(e,t),e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=new Date(r.value)}catch(e){}let i=r.value,a=i instanceof Date;return a&&!Number.isNaN(i.getTime())||r.issues.push({expected:"date",code:"invalid_type",input:i,...a?{received:"Invalid Date"}:{},inst:e}),r}}));function ao(e,t,r){e.issues.length&&t.issues.push(...na(r,e.issues)),t.value[r]=e.value}let as=r$("$ZodArray",(e,t)=>{iL.init(e,t),e._zod.parse=(r,n)=>{let i=r.value;if(!Array.isArray(i))return r.issues.push({expected:"array",code:"invalid_type",input:i,inst:e}),r;r.value=Array(i.length);let a=[];for(let e=0;e<i.length;e++){let o=i[e],s=t.element._zod.run({value:o,issues:[]},n);s instanceof Promise?a.push(s.then(t=>ao(t,r,e))):ao(s,r,e)}return a.length?Promise.all(a).then(()=>r):r}});function ac(e,t,r,n,i,a){let o=r in n;if(e.issues.length){if(i&&a&&!o)return;t.issues.push(...na(r,e.issues))}if(!o&&!i){e.issues.length||t.issues.push({code:"invalid_type",expected:"nonoptional",input:void 0,path:[r]});return}void 0===e.value?o&&(t.value[r]=void 0):t.value[r]=e.value}function al(e){let t=Object.keys(e.shape);for(let r of t)if(!e.shape?.[r]?._zod?.traits?.has("$ZodType"))throw Error(`Invalid element at key "${r}": expected a Zod schema`);let r=ne(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(r)}}function ad(e,t,r,n,i,a){let o=[],s=i.keySet,c=i.catchall._zod,l=c.def.type,d="optional"===c.optin,u="optional"===c.optout;for(let i in t){if("__proto__"===i||s.has(i))continue;if("never"===l){o.push(i);continue}let a=c.run({value:t[i],issues:[]},n);a instanceof Promise?e.push(a.then(e=>ac(e,r,i,t,d,u))):ac(a,r,i,t,d,u)}return(o.length&&r.issues.push({code:"unrecognized_keys",keys:o,input:t,inst:a}),e.length)?Promise.all(e).then(()=>r):r}let au=r$("$ZodObject",(e,t)=>{let r;iL.init(e,t);let n=Object.getOwnPropertyDescriptor(t,"shape");if(!n?.get){let e=t.shape;Object.defineProperty(t,"shape",{get:()=>{let r={...e};return Object.defineProperty(t,"shape",{value:r}),r}})}let i=rK(()=>al(t));rZ(e._zod,"propValues",()=>{let e=t.shape,r={};for(let t in e){let n=e[t]._zod;if(n.values)for(let e of(r[t]??(r[t]=new Set),n.values))r[t].add(e)}return r});let a=t.catchall;e._zod.parse=(t,n)=>{r??(r=i.value);let o=t.value;if(!r1(o))return t.issues.push({expected:"object",code:"invalid_type",input:o,inst:e}),t;t.value={};let s=[],c=r.shape;for(let e of r.keys){let r=c[e],i="optional"===r._zod.optin,a="optional"===r._zod.optout,l=r._zod.run({value:o[e],issues:[]},n);l instanceof Promise?s.push(l.then(r=>ac(r,t,e,o,i,a))):ac(l,t,e,o,i,a)}return a?ad(s,o,t,n,i.value,e):s.length?Promise.all(s).then(()=>t):t}}),ap=r$("$ZodObjectJIT",(e,t)=>{let r,n;au.init(e,t);let i=e._zod.parse,a=rK(()=>al(t)),o=!rH.jitless,s=o&&r2.value,c=t.catchall;e._zod.parse=(l,d)=>{n??(n=a.value);let u=l.value;return r1(u)?o&&s&&d?.async===!1&&!0!==d.jitless?(r||(r=(e=>{let t=new iv(["shape","payload","ctx"]),r=a.value,n=e=>{let t=rY(e);return`shape[${t}]._zod.run({ value: input[${t}], issues: [] }, ctx)`};t.write("const input = payload.value;");let i=Object.create(null),o=0;for(let e of r.keys)i[e]=`key_${o++}`;for(let a of(t.write("const newResult = {};"),r.keys)){let r=i[a],o=rY(a),s=e[a],c=s?._zod?.optin==="optional",l=s?._zod?.optout==="optional";t.write(`const ${r} = ${n(a)};`),c&&l?t.write(`
1
+ module.exports=[798003,e=>{"use strict";var t=e.i(912714),r=e.i(660526),n=e.i(750227);function i(){return n.default.join(r.default.homedir(),".wiki-viewer","config.json")}async function a(){await (0,t.mkdir)(n.default.join(r.default.homedir(),".wiki-viewer"),{recursive:!0})}async function o(){try{let e=await (0,t.readFile)(i(),"utf8");return JSON.parse(e)}catch{return{}}}let s=Promise.resolve();function c(e){let t=s.then(e,e);return s=t.then(()=>void 0,()=>void 0),t}async function l(e){await a(),await (0,t.writeFile)(i(),JSON.stringify(e,null,2),"utf8")}async function d(e){return c(async()=>{let t=await o();await l({...t,...e})})}async function u(e){return c(async()=>{let t=e({...await o()});return await l(t),t})}e.s(["readConfig",0,o,"reposDir",0,function(){return n.default.join(r.default.homedir(),".wiki-viewer","repos")},"updateConfig",0,u,"writeConfig",0,d])},223741,473845,e=>{"use strict";let t,r,n,i,a,o,s,c,l,d,u;var p,f,h,m,y=e.i(563811),g=e.i(560912);async function w(t,r){let n;if(t.database)n="function"==typeof t.database?t.database(t):await r(t);else{let r=Object.keys((0,y.getAuthTables)(t)).reduce((e,t)=>(e[t]=[],e),{}),{memoryAdapter:i}=await e.A(168315);n=i(r)(t)}return n.transaction||(g.logger.warn("Adapter does not correctly implement transaction function, patching it automatically. Please update your adapter implementation."),n.transaction=async e=>e(n)),n}var b=e.i(451894);async function A(t){return w(t,async t=>{let{createKyselyAdapter:r}=await e.A(317691),{kysely:n,databaseType:i,transaction:a}=await r(t);if(!n)throw new b.BetterAuthError("Failed to initialize database adapter");let{kyselyAdapter:o}=await e.A(317691);return o(n,{type:i||"sqlite",debugLogs:!!t.database&&"debugLogs"in t.database&&t.database.debugLogs,transaction:a})(t)})}var E=e.i(177730);function v(e){return"-"===e||"^"===e||"$"===e||"+"===e||"."===e||"("===e||")"===e||"|"===e||"["===e||"]"===e||"{"===e||"}"===e||"*"===e||"?"===e||"\\"===e?`\\${e}`:e}function k(e,t){if("string"!=typeof t)throw TypeError(`Sample must be a string, but ${typeof t} given`);return e.test(t)}function _(e,t){if("string"!=typeof e&&!Array.isArray(e))throw TypeError(`The first argument must be a single pattern string or an array of patterns, but ${typeof e} given`);if(("string"==typeof t||"boolean"==typeof t)&&(t={separator:t}),2==arguments.length&&!(void 0===t||"object"==typeof t&&null!==t&&!Array.isArray(t)))throw TypeError(`The second argument must be an options object or a string/boolean separator, but ${typeof t} given`);if("\\"===(t=t||{}).separator)throw Error("\\ is not a valid separator because it is used for escaping. Try setting the separator to `true` instead");let r=function e(t,r=!0){if(Array.isArray(t))return`(?:${t.map(t=>`^${e(t,r)}$`).join("|")})`;let n="",i="",a=".";!0===r?(n="/",i="[/\\\\]",a="[^/\\\\]"):r&&((i=function(e){let t="";for(let r=0;r<e.length;r++)t+=v(e[r]);return t}(n=r)).length>1?(i=`(?:${i})`,a=`((?!${i}).)`):a=`[^${i}]`);let o=r?`${i}+?`:"",s=r?`${i}*?`:"",c=r?t.split(n):[t],l="";for(let e=0;e<c.length;e++){let t=c[e],n=c[e+1],i="";if(t||!(e>0)){if(r&&(i=e===c.length-1?s:"**"!==n?o:""),r&&"**"===t){i&&(l+=0===e?"":i,l+=`(?:${a}*?${i})*?`);continue}for(let e=0;e<t.length;e++){let r=t[e];"\\"===r?e<t.length-1&&(l+=v(t[e+1]),e++):"?"===r?l+=a:"*"===r?l+=`${a}*?`:l+=v(r)}l+=i}}return l}(e,t.separator),n=RegExp(`^${r}$`,t.flags),i=k.bind(null,n);return i.options=t,i.pattern=e,i.regexp=n,i}var S=e.i(426232);function x(e){let t=e.length;for(;t>0&&47===e.charCodeAt(t-1);)t--;return t===e.length?e:e.slice(0,t)}function T(e,t="/api/auth"){try{let t=new URL(e);if("http:"!==t.protocol&&"https:"!==t.protocol)throw new b.BetterAuthError(`Invalid base URL: ${e}. URL must include 'http://' or 'https://'`)}catch(t){if(t instanceof b.BetterAuthError)throw t;throw new b.BetterAuthError(`Invalid base URL: ${e}. Please provide a valid base URL.`,{cause:t})}if(function(e){try{return"/"!==(x(new URL(e).pathname)||"/")}catch{throw new b.BetterAuthError(`Invalid base URL: ${e}. Please provide a valid base URL.`)}}(e))return e;let r=x(e);return t&&"/"!==t?(t=t.startsWith("/")?t:`/${t}`,`${r}${t}`):r}function R(e,t){return!!e&&""!==e.trim()&&("proto"===t?"http"===e||"https"===e:"host"===t&&![/\.\./,/\0/,/[\s]/,/^[.]/,/[<>'"]/,/javascript:/i,/file:/i,/data:/i].some(t=>t.test(e))&&(/^[a-zA-Z0-9]([a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(\.[a-zA-Z0-9]([a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*(:[0-9]{1,5})?$/.test(e)||/^(\d{1,3}\.){3}\d{1,3}(:[0-9]{1,5})?$/.test(e)||/^\[[0-9a-fA-F:]+\](:[0-9]{1,5})?$/.test(e)||/^localhost(:[0-9]{1,5})?$/i.test(e)))}function I(e,t,r,n,i){if(e)return T(e,t);if(!1!==n){let e=S.env.BETTER_AUTH_URL||S.env.NEXT_PUBLIC_BETTER_AUTH_URL||S.env.PUBLIC_BETTER_AUTH_URL||S.env.NUXT_PUBLIC_BETTER_AUTH_URL||S.env.NUXT_PUBLIC_AUTH_URL||("/"!==S.env.BASE_URL?S.env.BASE_URL:void 0);if(e)return T(e,t)}let a=r?.headers.get("x-forwarded-host"),o=r?.headers.get("x-forwarded-proto");if(a&&o&&i&&R(o,"proto")&&R(a,"host"))try{return T(`${o}://${a}`,t)}catch(e){}if(r){let e=U(r.url);if(!e)throw new b.BetterAuthError("Could not get origin from request. Please provide a valid base URL.");return T(e,t)}}function U(e){try{let t=new URL(e);return"null"===t.origin?null:t.origin}catch{return null}}function O(e){return"object"==typeof e&&null!==e&&"allowedHosts"in e&&Array.isArray(e.allowedHosts)}function P(e){return e instanceof Request||"object"==typeof e&&null!==e&&"[object Request]"===Object.prototype.toString.call(e)&&"string"==typeof e.url&&"object"==typeof e.headers&&null!==e.headers&&"function"==typeof e.headers.get}function C(e,t){let r=P(e)?e.headers:e;if(t){let e=r.get("x-forwarded-host");if(e&&R(e,"host"))return e}let n=r.get("host");if(n&&R(n,"host"))return n;if(P(e))try{return new URL(e.url).host}catch{}return null}let D=(e,t,r)=>{if(e.startsWith("/"))return!!r?.allowRelativePaths&&e.startsWith("/")&&/^\/(?!\/|\\|%2f|%5c)[\w\-.\+/@]*(?:\?[\w\-.\+/=&%@]*)?$/.test(e);if(t.includes("*")||t.includes("?")){if(t.includes("://"))return _(t)(U(e)||e);let r=function(e){try{return new URL(e).host}catch{return null}}(e);return!!r&&_(t)(r)}let n=function(e){try{return new URL(e).protocol}catch{return null}}(e);return"http:"!==n&&"https:"!==n&&n?e.startsWith(t):t===U(e)};function L(e){return!!e&&("object"==typeof e||"function"==typeof e)&&"function"==typeof e.then}var z=e.i(666680);function $(e,t){return new Promise((r,n)=>{(0,z.scrypt)(e.normalize("NFKC"),t,64,{N:16384,r:16,p:1,maxmem:0x4000000},(e,t)=>{e?n(e):r(t)})})}async function N(e){let t=(0,z.randomBytes)(16).toString("hex"),r=await $(e,t);return`${t}:${r.toString("hex")}`}async function j(e,t){let[r,n]=e.split(":");if(!r||!n)throw Error("Invalid password hash");return(await $(t,r)).toString("hex")===n}let H=async({hash:e,password:t})=>j(e,t);function B(e,t=""){if("number"!=typeof e){let r=t&&`"${t}" `;throw TypeError(`${r}expected number, got ${typeof e}`)}if(!Number.isSafeInteger(e)||e<0){let r=t&&`"${t}" `;throw RangeError(`${r}expected integer >= 0, got ${e}`)}}function V(e,t,r=""){let n=e instanceof Uint8Array||ArrayBuffer.isView(e)&&"Uint8Array"===e.constructor.name&&"BYTES_PER_ELEMENT"in e&&1===e.BYTES_PER_ELEMENT,i=e?.length,a=void 0!==t;if(!n||a&&i!==t){let o=(r&&`"${r}" `)+"expected Uint8Array"+(a?` of length ${t}`:"")+", got "+(n?`length=${i}`:`type=${typeof e}`);if(!n)throw TypeError(o);throw RangeError(o)}return e}function M(e){if("function"!=typeof e||"function"!=typeof e.create)throw TypeError("Hash must wrapped by utils.createHasher");if(B(e.outputLen),B(e.blockLen),e.outputLen<1)throw Error('"outputLen" must be >= 1');if(e.blockLen<1)throw Error('"blockLen" must be >= 1')}function K(e,t=!0){if(e.destroyed)throw Error("Hash instance has been destroyed");if(t&&e.finished)throw Error("Hash#digest() has already been called")}function W(e,t){V(e,void 0,"digestInto() output");let r=t.outputLen;if(e.length<r)throw RangeError('"digestInto() output" expected to be of length >='+r)}function q(...e){for(let t=0;t<e.length;t++)e[t].fill(0)}function F(e){return new DataView(e.buffer,e.byteOffset,e.byteLength)}function J(e,t){return e<<32-t|e>>>t}class Z{oHash;iHash;blockLen;outputLen;canXOF=!1;finished=!1;destroyed=!1;constructor(e,t){if(M(e),V(t,void 0,"key"),this.iHash=e.create(),"function"!=typeof this.iHash.update)throw Error("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;const r=this.blockLen,n=new Uint8Array(r);n.set(t.length>r?e.create().update(t).digest():t);for(let e=0;e<n.length;e++)n[e]^=54;this.iHash.update(n),this.oHash=e.create();for(let e=0;e<n.length;e++)n[e]^=106;this.oHash.update(n),q(n)}update(e){return K(this),this.iHash.update(e),this}digestInto(e){K(this),W(e,this),this.finished=!0;let t=e.subarray(0,this.outputLen);this.iHash.digestInto(t),this.oHash.update(t),this.oHash.digestInto(t),this.destroy()}digest(){let e=new Uint8Array(this.oHash.outputLen);return this.digestInto(e),e}_cloneInto(e){e||=Object.create(Object.getPrototypeOf(this),{});let{oHash:t,iHash:r,finished:n,destroyed:i,blockLen:a,outputLen:o}=this;return e.finished=n,e.destroyed=i,e.blockLen=a,e.outputLen=o,e.oHash=t._cloneInto(e.oHash),e.iHash=r._cloneInto(e.iHash),e}clone(){return this._cloneInto()}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}}let G=((o=(e,t,r)=>new Z(e,t).update(r).digest()).create=(e,t)=>new Z(e,t),o),Q=Uint8Array.of(0),Y=Uint8Array.of();class X{blockLen;outputLen;canXOF=!1;padOffset;isLE;buffer;view;finished=!1;length=0;pos=0;destroyed=!1;constructor(e,t,r,n){this.blockLen=e,this.outputLen=t,this.padOffset=r,this.isLE=n,this.buffer=new Uint8Array(e),this.view=F(this.buffer)}update(e){K(this),V(e);let{view:t,buffer:r,blockLen:n}=this,i=e.length;for(let a=0;a<i;){let o=Math.min(n-this.pos,i-a);if(o===n){let t=F(e);for(;n<=i-a;a+=n)this.process(t,a);continue}r.set(e.subarray(a,a+o),this.pos),this.pos+=o,a+=o,this.pos===n&&(this.process(t,0),this.pos=0)}return this.length+=e.length,this.roundClean(),this}digestInto(e){K(this),W(e,this),this.finished=!0;let{buffer:t,view:r,blockLen:n,isLE:i}=this,{pos:a}=this;t[a++]=128,q(this.buffer.subarray(a)),this.padOffset>n-a&&(this.process(r,0),a=0);for(let e=a;e<n;e++)t[e]=0;r.setBigUint64(n-8,BigInt(8*this.length),i),this.process(r,0);let o=F(e),s=this.outputLen;if(s%4)throw Error("_sha2: outputLen must be aligned to 32bit");let c=s/4,l=this.get();if(c>l.length)throw Error("_sha2: outputLen bigger than state");for(let e=0;e<c;e++)o.setUint32(4*e,l[e],i)}digest(){let{buffer:e,outputLen:t}=this;this.digestInto(e);let r=e.slice(0,t);return this.destroy(),r}_cloneInto(e){(e||=new this.constructor).set(...this.get());let{blockLen:t,buffer:r,length:n,finished:i,destroyed:a,pos:o}=this;return e.destroyed=a,e.finished=i,e.length=n,e.pos=o,n%t&&e.buffer.set(r),e}clone(){return this._cloneInto()}}let ee=Uint32Array.from([0x6a09e667,0xbb67ae85,0x3c6ef372,0xa54ff53a,0x510e527f,0x9b05688c,0x1f83d9ab,0x5be0cd19]),et=Uint32Array.from([0xc1059ed8,0x367cd507,0x3070dd17,0xf70e5939,0xffc00b31,0x68581511,0x64f98fa7,0xbefa4fa4]),er=Uint32Array.from([0xcbbb9d5d,0xc1059ed8,0x629a292a,0x367cd507,0x9159015a,0x3070dd17,0x152fecd8,0xf70e5939,0x67332667,0xffc00b31,0x8eb44a87,0x68581511,0xdb0c2e0d,0x64f98fa7,0x47b5481d,0xbefa4fa4]),en=Uint32Array.from([0x6a09e667,0xf3bcc908,0xbb67ae85,0x84caa73b,0x3c6ef372,0xfe94f82b,0xa54ff53a,0x5f1d36f1,0x510e527f,0xade682d1,0x9b05688c,0x2b3e6c1f,0x1f83d9ab,0xfb41bd6b,0x5be0cd19,0x137e2179]),ei=BigInt(0x100000000-1),ea=BigInt(32),eo=Uint32Array.from([0x428a2f98,0x71374491,0xb5c0fbcf,0xe9b5dba5,0x3956c25b,0x59f111f1,0x923f82a4,0xab1c5ed5,0xd807aa98,0x12835b01,0x243185be,0x550c7dc3,0x72be5d74,0x80deb1fe,0x9bdc06a7,0xc19bf174,0xe49b69c1,0xefbe4786,0xfc19dc6,0x240ca1cc,0x2de92c6f,0x4a7484aa,0x5cb0a9dc,0x76f988da,0x983e5152,0xa831c66d,0xb00327c8,0xbf597fc7,0xc6e00bf3,0xd5a79147,0x6ca6351,0x14292967,0x27b70a85,0x2e1b2138,0x4d2c6dfc,0x53380d13,0x650a7354,0x766a0abb,0x81c2c92e,0x92722c85,0xa2bfe8a1,0xa81a664b,0xc24b8b70,0xc76c51a3,0xd192e819,0xd6990624,0xf40e3585,0x106aa070,0x19a4c116,0x1e376c08,0x2748774c,0x34b0bcb5,0x391c0cb3,0x4ed8aa4a,0x5b9cca4f,0x682e6ff3,0x748f82ee,0x78a5636f,0x84c87814,0x8cc70208,0x90befffa,0xa4506ceb,0xbef9a3f7,0xc67178f2]),es=new Uint32Array(64);class ec extends X{constructor(e){super(64,e,8,!1)}get(){let{A:e,B:t,C:r,D:n,E:i,F:a,G:o,H:s}=this;return[e,t,r,n,i,a,o,s]}set(e,t,r,n,i,a,o,s){this.A=0|e,this.B=0|t,this.C=0|r,this.D=0|n,this.E=0|i,this.F=0|a,this.G=0|o,this.H=0|s}process(e,t){for(let r=0;r<16;r++,t+=4)es[r]=e.getUint32(t,!1);for(let e=16;e<64;e++){let t=es[e-15],r=es[e-2],n=J(t,7)^J(t,18)^t>>>3,i=J(r,17)^J(r,19)^r>>>10;es[e]=i+es[e-7]+n+es[e-16]|0}let{A:r,B:n,C:i,D:a,E:o,F:s,G:c,H:l}=this;for(let e=0;e<64;e++){var d,u,p,f;let t=l+(J(o,6)^J(o,11)^J(o,25))+((d=o)&s^~d&c)+eo[e]+es[e]|0,h=(J(r,2)^J(r,13)^J(r,22))+((u=r)&(p=n)^u&(f=i)^p&f)|0;l=c,c=s,s=o,o=a+t|0,a=i,i=n,n=r,r=t+h|0}r=r+this.A|0,n=n+this.B|0,i=i+this.C|0,a=a+this.D|0,o=o+this.E|0,s=s+this.F|0,c=c+this.G|0,l=l+this.H|0,this.set(r,n,i,a,o,s,c,l)}roundClean(){q(es)}destroy(){this.destroyed=!0,this.set(0,0,0,0,0,0,0,0),q(this.buffer)}}class el extends ec{A=0|ee[0];B=0|ee[1];C=0|ee[2];D=0|ee[3];E=0|ee[4];F=0|ee[5];G=0|ee[6];H=0|ee[7];constructor(){super(32)}}let ed=function(e,t=!1){let r=e.length,n=new Uint32Array(r),i=new Uint32Array(r);for(let a=0;a<r;a++){let{h:r,l:o}=function(e,t=!1){return t?{h:Number(e&ei),l:Number(e>>ea&ei)}:{h:0|Number(e>>ea&ei),l:0|Number(e&ei)}}(e[a],t);[n[a],i[a]]=[r,o]}return[n,i]}(["0x428a2f98d728ae22","0x7137449123ef65cd","0xb5c0fbcfec4d3b2f","0xe9b5dba58189dbbc","0x3956c25bf348b538","0x59f111f1b605d019","0x923f82a4af194f9b","0xab1c5ed5da6d8118","0xd807aa98a3030242","0x12835b0145706fbe","0x243185be4ee4b28c","0x550c7dc3d5ffb4e2","0x72be5d74f27b896f","0x80deb1fe3b1696b1","0x9bdc06a725c71235","0xc19bf174cf692694","0xe49b69c19ef14ad2","0xefbe4786384f25e3","0x0fc19dc68b8cd5b5","0x240ca1cc77ac9c65","0x2de92c6f592b0275","0x4a7484aa6ea6e483","0x5cb0a9dcbd41fbd4","0x76f988da831153b5","0x983e5152ee66dfab","0xa831c66d2db43210","0xb00327c898fb213f","0xbf597fc7beef0ee4","0xc6e00bf33da88fc2","0xd5a79147930aa725","0x06ca6351e003826f","0x142929670a0e6e70","0x27b70a8546d22ffc","0x2e1b21385c26c926","0x4d2c6dfc5ac42aed","0x53380d139d95b3df","0x650a73548baf63de","0x766a0abb3c77b2a8","0x81c2c92e47edaee6","0x92722c851482353b","0xa2bfe8a14cf10364","0xa81a664bbc423001","0xc24b8b70d0f89791","0xc76c51a30654be30","0xd192e819d6ef5218","0xd69906245565a910","0xf40e35855771202a","0x106aa07032bbd1b8","0x19a4c116b8d2d0c8","0x1e376c085141ab53","0x2748774cdf8eeb99","0x34b0bcb5e19b48a8","0x391c0cb3c5c95a63","0x4ed8aa4ae3418acb","0x5b9cca4f7763e373","0x682e6ff3d6b2b8a3","0x748f82ee5defb2fc","0x78a5636f43172f60","0x84c87814a1f0ab72","0x8cc702081a6439ec","0x90befffa23631e28","0xa4506cebde82bde9","0xbef9a3f7b2c67915","0xc67178f2e372532b","0xca273eceea26619c","0xd186b8c721c0c207","0xeada7dd6cde0eb1e","0xf57d4f7fee6ed178","0x06f067aa72176fba","0x0a637dc5a2c898a6","0x113f9804bef90dae","0x1b710b35131c471b","0x28db77f523047d84","0x32caab7b40c72493","0x3c9ebe0a15c9bebc","0x431d67c49c100d4c","0x4cc5d4becb3e42b6","0x597f299cfc657e2a","0x5fcb6fab3ad6faec","0x6c44198c4a475817"].map(e=>BigInt(e))),eu=ed[0],ep=ed[1],ef=new Uint32Array(80),eh=new Uint32Array(80),em=function(e,t={}){let r=(t,r)=>e(r).update(t).digest(),n=e(void 0);return r.outputLen=n.outputLen,r.blockLen=n.blockLen,r.canXOF=n.canXOF,r.create=t=>e(t),Object.assign(r,t),Object.freeze(r)}(()=>new el,{oid:Uint8Array.from([6,9,96,134,72,1,101,3,4,2,1])}),ey=new TextEncoder,eg=new TextDecoder;function ew(...e){let t=new Uint8Array(e.reduce((e,{length:t})=>e+t,0)),r=0;for(let n of e)t.set(n,r),r+=n.length;return t}function eb(e,t,r){if(t<0||t>=0x100000000)throw RangeError(`value must be >= 0 and <= ${0x100000000-1}. Received ${t}`);e.set([t>>>24,t>>>16,t>>>8,255&t],r)}function eA(e){let t=Math.floor(e/0x100000000),r=new Uint8Array(8);return eb(r,t,0),eb(r,e%0x100000000,4),r}function eE(e){let t=new Uint8Array(4);return eb(t,e),t}function ev(e){let t=new Uint8Array(e.length);for(let r=0;r<e.length;r++){let n=e.charCodeAt(r);if(n>127)throw TypeError("non-ASCII string encountered in encode()");t[r]=n}return t}function ek(e){if(Uint8Array.fromBase64)return Uint8Array.fromBase64("string"==typeof e?e:eg.decode(e),{alphabet:"base64url"});let t=e;t instanceof Uint8Array&&(t=eg.decode(t)),t=t.replace(/-/g,"+").replace(/_/g,"/");try{var r=t;if(Uint8Array.fromBase64)return Uint8Array.fromBase64(r);let e=atob(r),n=new Uint8Array(e.length);for(let t=0;t<e.length;t++)n[t]=e.charCodeAt(t);return n}catch{throw TypeError("The input to be decoded is not correctly encoded.")}}function e_(e){let t=e;return("string"==typeof t&&(t=ey.encode(t)),Uint8Array.prototype.toBase64)?t.toBase64({alphabet:"base64url",omitPadding:!0}):(function(e){if(Uint8Array.prototype.toBase64)return e.toBase64();let t=[];for(let r=0;r<e.length;r+=32768)t.push(String.fromCharCode.apply(null,e.subarray(r,r+32768)));return btoa(t.join(""))})(t).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}e.s(["decode",0,ek,"encode",0,e_],797379);let eS=Symbol();function ex(e,t){if(e)throw TypeError(`${t} can only be called once`)}function eT(e,t,r){try{return ek(e)}catch{throw new r(`Failed to base64url decode the ${t}`)}}async function eR(e,t){let r=`SHA-${e.slice(-3)}`;return new Uint8Array(await crypto.subtle.digest(r,t))}let eI=(e,t="algorithm.name")=>TypeError(`CryptoKey does not support this operation, its ${t} must be ${e}`);function eU(e,t){if(parseInt(e.hash.name.slice(4),10)!==t)throw eI(`SHA-${t}`,"algorithm.hash")}function eO(e,t){if(t&&!e.usages.includes(t))throw TypeError(`CryptoKey does not support this operation, its usages must include ${t}.`)}function eP(e,t,r){switch(t){case"A128GCM":case"A192GCM":case"A256GCM":{if("AES-GCM"!==e.algorithm.name)throw eI("AES-GCM");let r=parseInt(t.slice(1,4),10);if(e.algorithm.length!==r)throw eI(r,"algorithm.length");break}case"A128KW":case"A192KW":case"A256KW":{if("AES-KW"!==e.algorithm.name)throw eI("AES-KW");let r=parseInt(t.slice(1,4),10);if(e.algorithm.length!==r)throw eI(r,"algorithm.length");break}case"ECDH":switch(e.algorithm.name){case"ECDH":case"X25519":break;default:throw eI("ECDH or X25519")}break;case"PBES2-HS256+A128KW":case"PBES2-HS384+A192KW":case"PBES2-HS512+A256KW":if("PBKDF2"!==e.algorithm.name)throw eI("PBKDF2");break;case"RSA-OAEP":case"RSA-OAEP-256":case"RSA-OAEP-384":case"RSA-OAEP-512":if("RSA-OAEP"!==e.algorithm.name)throw eI("RSA-OAEP");eU(e.algorithm,parseInt(t.slice(9),10)||1);break;default:throw TypeError("CryptoKey does not support this operation")}eO(e,r)}function eC(e,t,...r){if((r=r.filter(Boolean)).length>2){let t=r.pop();e+=`one of type ${r.join(", ")}, or ${t}.`}else 2===r.length?e+=`one of type ${r[0]} or ${r[1]}.`:e+=`of type ${r[0]}.`;return null==t?e+=` Received ${t}`:"function"==typeof t&&t.name?e+=` Received function ${t.name}`:"object"==typeof t&&null!=t&&t.constructor?.name&&(e+=` Received an instance of ${t.constructor.name}`),e}let eD=(e,...t)=>eC("Key must be ",e,...t),eL=(e,t,...r)=>eC(`Key for the ${e} algorithm must be `,t,...r);class ez extends Error{static code="ERR_JOSE_GENERIC";code="ERR_JOSE_GENERIC";constructor(e,t){super(e,t),this.name=this.constructor.name,Error.captureStackTrace?.(this,this.constructor)}}class e$ extends ez{static code="ERR_JWT_CLAIM_VALIDATION_FAILED";code="ERR_JWT_CLAIM_VALIDATION_FAILED";claim;reason;payload;constructor(e,t,r="unspecified",n="unspecified"){super(e,{cause:{claim:r,reason:n,payload:t}}),this.claim=r,this.reason=n,this.payload=t}}class eN extends ez{static code="ERR_JWT_EXPIRED";code="ERR_JWT_EXPIRED";claim;reason;payload;constructor(e,t,r="unspecified",n="unspecified"){super(e,{cause:{claim:r,reason:n,payload:t}}),this.claim=r,this.reason=n,this.payload=t}}class ej extends ez{static code="ERR_JOSE_ALG_NOT_ALLOWED";code="ERR_JOSE_ALG_NOT_ALLOWED"}class eH extends ez{static code="ERR_JOSE_NOT_SUPPORTED";code="ERR_JOSE_NOT_SUPPORTED"}class eB extends ez{static code="ERR_JWE_DECRYPTION_FAILED";code="ERR_JWE_DECRYPTION_FAILED";constructor(e="decryption operation failed",t){super(e,t)}}class eV extends ez{static code="ERR_JWE_INVALID";code="ERR_JWE_INVALID"}class eM extends ez{static code="ERR_JWS_INVALID";code="ERR_JWS_INVALID"}class eK extends ez{static code="ERR_JWT_INVALID";code="ERR_JWT_INVALID"}class eW extends ez{static code="ERR_JWK_INVALID";code="ERR_JWK_INVALID"}class eq extends ez{static code="ERR_JWKS_INVALID";code="ERR_JWKS_INVALID"}class eF extends ez{static code="ERR_JWKS_NO_MATCHING_KEY";code="ERR_JWKS_NO_MATCHING_KEY";constructor(e="no applicable key found in the JSON Web Key Set",t){super(e,t)}}class eJ extends ez{[Symbol.asyncIterator];static code="ERR_JWKS_MULTIPLE_MATCHING_KEYS";code="ERR_JWKS_MULTIPLE_MATCHING_KEYS";constructor(e="multiple matching keys found in the JSON Web Key Set",t){super(e,t)}}class eZ extends ez{static code="ERR_JWKS_TIMEOUT";code="ERR_JWKS_TIMEOUT";constructor(e="request timed out",t){super(e,t)}}class eG extends ez{static code="ERR_JWS_SIGNATURE_VERIFICATION_FAILED";code="ERR_JWS_SIGNATURE_VERIFICATION_FAILED";constructor(e="signature verification failed",t){super(e,t)}}function eQ(e){if(!eY(e))throw Error("CryptoKey instance expected")}let eY=e=>{if(e?.[Symbol.toStringTag]==="CryptoKey")return!0;try{return e instanceof CryptoKey}catch{return!1}},eX=e=>e?.[Symbol.toStringTag]==="KeyObject",e0=e=>eY(e)||eX(e);function e1(e){switch(e){case"A128GCM":return 128;case"A192GCM":return 192;case"A256GCM":case"A128CBC-HS256":return 256;case"A192CBC-HS384":return 384;case"A256CBC-HS512":return 512;default:throw new eH(`Unsupported JWE Algorithm: ${e}`)}}let e2=e=>crypto.getRandomValues(new Uint8Array(e1(e)>>3));function e6(e,t){let r=e.byteLength<<3;if(r!==t)throw new eV(`Invalid Content Encryption Key length. Expected ${t} bits, got ${r} bits`)}function e5(e){switch(e){case"A128GCM":case"A128GCMKW":case"A192GCM":case"A192GCMKW":case"A256GCM":case"A256GCMKW":return 96;case"A128CBC-HS256":case"A192CBC-HS384":case"A256CBC-HS512":return 128;default:throw new eH(`Unsupported JWE Algorithm: ${e}`)}}function e8(e,t){if(t.length<<3!==e5(e))throw new eV("Invalid Initialization Vector length")}async function e4(e,t,r){if(!(t instanceof Uint8Array))throw TypeError(eD(t,"Uint8Array"));let n=parseInt(e.slice(1,4),10);return{encKey:await crypto.subtle.importKey("raw",t.subarray(n>>3),"AES-CBC",!1,[r]),macKey:await crypto.subtle.importKey("raw",t.subarray(0,n>>3),{hash:`SHA-${n<<1}`,name:"HMAC"},!1,["sign"]),keySize:n}}async function e3(e,t,r){return new Uint8Array((await crypto.subtle.sign("HMAC",e,t)).slice(0,r>>3))}async function e9(e,t,r,n,i){let{encKey:a,macKey:o,keySize:s}=await e4(e,r,"encrypt"),c=new Uint8Array(await crypto.subtle.encrypt({iv:n,name:"AES-CBC"},a,t)),l=ew(i,n,c,eA(i.length<<3));return{ciphertext:c,tag:await e3(o,l,s),iv:n}}async function e7(e,t){if(!(e instanceof Uint8Array))throw TypeError("First argument must be a buffer");if(!(t instanceof Uint8Array))throw TypeError("Second argument must be a buffer");let r={name:"HMAC",hash:"SHA-256"},n=await crypto.subtle.generateKey(r,!1,["sign"]),i=new Uint8Array(await crypto.subtle.sign(r,n,e)),a=new Uint8Array(await crypto.subtle.sign(r,n,t)),o=0,s=-1;for(;++s<32;)o|=i[s]^a[s];return 0===o}async function te(e,t,r,n,i,a){let o,s,{encKey:c,macKey:l,keySize:d}=await e4(e,t,"decrypt"),u=ew(a,n,r,eA(a.length<<3)),p=await e3(l,u,d);try{o=await e7(i,p)}catch{}if(!o)throw new eB;try{s=new Uint8Array(await crypto.subtle.decrypt({iv:n,name:"AES-CBC"},c,r))}catch{}if(!s)throw new eB;return s}async function tt(e,t,r,n,i){let a;r instanceof Uint8Array?a=await crypto.subtle.importKey("raw",r,"AES-GCM",!1,["encrypt"]):(eP(r,e,"encrypt"),a=r);let o=new Uint8Array(await crypto.subtle.encrypt({additionalData:i,iv:n,name:"AES-GCM",tagLength:128},a,t)),s=o.slice(-16);return{ciphertext:o.slice(0,-16),tag:s,iv:n}}async function tr(e,t,r,n,i,a){let o;t instanceof Uint8Array?o=await crypto.subtle.importKey("raw",t,"AES-GCM",!1,["decrypt"]):(eP(t,e,"decrypt"),o=t);try{return new Uint8Array(await crypto.subtle.decrypt({additionalData:a,iv:n,name:"AES-GCM",tagLength:128},o,ew(r,i)))}catch{throw new eB}}let tn="Unsupported JWE Content Encryption Algorithm";async function ti(e,t,r,n,i){if(!eY(r)&&!(r instanceof Uint8Array))throw TypeError(eD(r,"CryptoKey","KeyObject","Uint8Array","JSON Web Key"));if(n)e8(e,n);else n=crypto.getRandomValues(new Uint8Array(e5(e)>>3));switch(e){case"A128CBC-HS256":case"A192CBC-HS384":case"A256CBC-HS512":return r instanceof Uint8Array&&e6(r,parseInt(e.slice(-3),10)),e9(e,t,r,n,i);case"A128GCM":case"A192GCM":case"A256GCM":return r instanceof Uint8Array&&e6(r,parseInt(e.slice(1,4),10)),tt(e,t,r,n,i);default:throw new eH(tn)}}async function ta(e,t,r,n,i,a){if(!eY(t)&&!(t instanceof Uint8Array))throw TypeError(eD(t,"CryptoKey","KeyObject","Uint8Array","JSON Web Key"));if(!n)throw new eV("JWE Initialization Vector missing");if(!i)throw new eV("JWE Authentication Tag missing");switch(e8(e,n),e){case"A128CBC-HS256":case"A192CBC-HS384":case"A256CBC-HS512":return t instanceof Uint8Array&&e6(t,parseInt(e.slice(-3),10)),te(e,t,r,n,i,a);case"A128GCM":case"A192GCM":case"A256GCM":return t instanceof Uint8Array&&e6(t,parseInt(e.slice(1,4),10)),tr(e,t,r,n,i,a);default:throw new eH(tn)}}function to(e,t){if(e.algorithm.length!==parseInt(t.slice(1,4),10))throw TypeError(`Invalid key size for alg: ${t}`)}function ts(e,t,r){return e instanceof Uint8Array?crypto.subtle.importKey("raw",e,"AES-KW",!0,[r]):(eP(e,t,r),e)}async function tc(e,t,r){let n=await ts(t,e,"wrapKey");to(n,e);let i=await crypto.subtle.importKey("raw",r,{hash:"SHA-256",name:"HMAC"},!0,["sign"]);return new Uint8Array(await crypto.subtle.wrapKey("raw",i,n,"AES-KW"))}async function tl(e,t,r){let n=await ts(t,e,"unwrapKey");to(n,e);let i=await crypto.subtle.unwrapKey("raw",r,n,"AES-KW",{hash:"SHA-256",name:"HMAC"},!0,["sign"]);return new Uint8Array(await crypto.subtle.exportKey("raw",i))}function td(e){return ew(eE(e.length),e)}async function tu(e,t,r){let n=t>>3,i=Math.ceil(n/32),a=new Uint8Array(32*i);for(let t=1;t<=i;t++){let n=new Uint8Array(4+e.length+r.length);n.set(eE(t),0),n.set(e,4),n.set(r,4+e.length);let i=await eR("sha256",n);a.set(i,(t-1)*32)}return a.slice(0,n)}async function tp(e,t,r,n,i=new Uint8Array,a=new Uint8Array){var o;eP(e,"ECDH"),eP(t,"ECDH","deriveBits");let s=ew(td(ev(r)),td(i),td(a),eE(n),new Uint8Array);return tu(new Uint8Array(await crypto.subtle.deriveBits({name:e.algorithm.name,public:e},t,"X25519"===(o=e).algorithm.name?256:Math.ceil(parseInt(o.algorithm.namedCurve.slice(-3),10)/8)<<3)),n,s)}function tf(e){switch(e.algorithm.namedCurve){case"P-256":case"P-384":case"P-521":return!0;default:return"X25519"===e.algorithm.name}}async function th(e,t,r,n){if(!(e instanceof Uint8Array)||e.length<8)throw new eV("PBES2 Salt Input must be 8 or more octets");if(!Number.isSafeInteger(r)||1!==Math.sign(r))throw new eV("PBES2 Count Input must be a positive integer");let i=ew(ev(t),Uint8Array.of(0),e),a=parseInt(t.slice(13,16),10),o={hash:`SHA-${t.slice(8,11)}`,iterations:r,name:"PBKDF2",salt:i},s=await (n instanceof Uint8Array?crypto.subtle.importKey("raw",n,"PBKDF2",!1,["deriveBits"]):(eP(n,t,"deriveBits"),n));return new Uint8Array(await crypto.subtle.deriveBits(o,s,a))}async function tm(e,t,r,n=2048,i=crypto.getRandomValues(new Uint8Array(16))){let a=await th(i,e,n,t);return{encryptedKey:await tc(e.slice(-6),a,r),p2c:n,p2s:e_(i)}}async function ty(e,t,r,n,i){let a=await th(i,e,n,t);return tl(e.slice(-6),a,r)}function tg(e,t){if(e.startsWith("RS")||e.startsWith("PS")){let{modulusLength:r}=t.algorithm;if("number"!=typeof r||r<2048)throw TypeError(`${e} requires key modulusLength to be 2048 bits or larger`)}}function tw(e,t){let r=`SHA-${e.slice(-3)}`;switch(e){case"HS256":case"HS384":case"HS512":return{hash:r,name:"HMAC"};case"PS256":case"PS384":case"PS512":return{hash:r,name:"RSA-PSS",saltLength:parseInt(e.slice(-3),10)>>3};case"RS256":case"RS384":case"RS512":return{hash:r,name:"RSASSA-PKCS1-v1_5"};case"ES256":case"ES384":case"ES512":return{hash:r,name:"ECDSA",namedCurve:t.namedCurve};case"Ed25519":case"EdDSA":return{name:"Ed25519"};case"ML-DSA-44":case"ML-DSA-65":case"ML-DSA-87":return{name:e};default:throw new eH(`alg ${e} is not supported either by JOSE or your javascript runtime`)}}async function tb(e,t,r){if(t instanceof Uint8Array){if(!e.startsWith("HS"))throw TypeError(eD(t,"CryptoKey","KeyObject","JSON Web Key"));return crypto.subtle.importKey("raw",t,{hash:`SHA-${e.slice(-3)}`,name:"HMAC"},!1,[r])}switch(e){case"HS256":case"HS384":case"HS512":if("HMAC"!==t.algorithm.name)throw eI("HMAC");eU(t.algorithm,parseInt(e.slice(2),10));break;case"RS256":case"RS384":case"RS512":if("RSASSA-PKCS1-v1_5"!==t.algorithm.name)throw eI("RSASSA-PKCS1-v1_5");eU(t.algorithm,parseInt(e.slice(2),10));break;case"PS256":case"PS384":case"PS512":if("RSA-PSS"!==t.algorithm.name)throw eI("RSA-PSS");eU(t.algorithm,parseInt(e.slice(2),10));break;case"Ed25519":case"EdDSA":if("Ed25519"!==t.algorithm.name)throw eI("Ed25519");break;case"ML-DSA-44":case"ML-DSA-65":case"ML-DSA-87":let n;if(n=t.algorithm,n.name!==e)throw eI(e);break;case"ES256":case"ES384":case"ES512":{if("ECDSA"!==t.algorithm.name)throw eI("ECDSA");let r=function(e){switch(e){case"ES256":return"P-256";case"ES384":return"P-384";case"ES512":return"P-521";default:throw Error("unreachable")}}(e);if(t.algorithm.namedCurve!==r)throw eI(r,"algorithm.namedCurve");break}default:throw TypeError("CryptoKey does not support this operation")}return eO(t,r),t}async function tA(e,t,r){let n=await tb(e,t,"sign");return tg(e,n),new Uint8Array(await crypto.subtle.sign(tw(e,n.algorithm),n,r))}async function tE(e,t,r,n){let i=await tb(e,t,"verify");tg(e,i);let a=tw(e,i.algorithm);try{return await crypto.subtle.verify(a,i,r,n)}catch{return!1}}let tv=e=>{switch(e){case"RSA-OAEP":case"RSA-OAEP-256":case"RSA-OAEP-384":case"RSA-OAEP-512":return"RSA-OAEP";default:throw new eH(`alg ${e} is not supported either by JOSE or your javascript runtime`)}};async function tk(e,t,r){return eP(t,e,"encrypt"),tg(e,t),new Uint8Array(await crypto.subtle.encrypt(tv(e),t,r))}async function t_(e,t,r){return eP(t,e,"decrypt"),tg(e,t),new Uint8Array(await crypto.subtle.decrypt(tv(e),t,r))}function tS(e){if("object"!=typeof e||null===e||"[object Object]"!==Object.prototype.toString.call(e))return!1;if(null===Object.getPrototypeOf(e))return!0;let t=e;for(;null!==Object.getPrototypeOf(t);)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t}function tx(...e){let t,r=e.filter(Boolean);if(0===r.length||1===r.length)return!0;for(let e of r){let r=Object.keys(e);if(!t||0===t.size){t=new Set(r);continue}for(let e of r){if(t.has(e))return!1;t.add(e)}}return!0}let tT=e=>tS(e)&&"string"==typeof e.kty,tR='Invalid or unsupported JWK "alg" (Algorithm) Parameter value';async function tI(e){if(!e.alg)throw TypeError('"alg" argument is required when "jwk.alg" is not present');let{algorithm:t,keyUsages:r}=function(e){let t,r;switch(e.kty){case"AKP":switch(e.alg){case"ML-DSA-44":case"ML-DSA-65":case"ML-DSA-87":t={name:e.alg},r=e.priv?["sign"]:["verify"];break;default:throw new eH(tR)}break;case"RSA":switch(e.alg){case"PS256":case"PS384":case"PS512":t={name:"RSA-PSS",hash:`SHA-${e.alg.slice(-3)}`},r=e.d?["sign"]:["verify"];break;case"RS256":case"RS384":case"RS512":t={name:"RSASSA-PKCS1-v1_5",hash:`SHA-${e.alg.slice(-3)}`},r=e.d?["sign"]:["verify"];break;case"RSA-OAEP":case"RSA-OAEP-256":case"RSA-OAEP-384":case"RSA-OAEP-512":t={name:"RSA-OAEP",hash:`SHA-${parseInt(e.alg.slice(-3),10)||1}`},r=e.d?["decrypt","unwrapKey"]:["encrypt","wrapKey"];break;default:throw new eH(tR)}break;case"EC":switch(e.alg){case"ES256":case"ES384":case"ES512":t={name:"ECDSA",namedCurve:({ES256:"P-256",ES384:"P-384",ES512:"P-521"})[e.alg]},r=e.d?["sign"]:["verify"];break;case"ECDH-ES":case"ECDH-ES+A128KW":case"ECDH-ES+A192KW":case"ECDH-ES+A256KW":t={name:"ECDH",namedCurve:e.crv},r=e.d?["deriveBits"]:[];break;default:throw new eH(tR)}break;case"OKP":switch(e.alg){case"Ed25519":case"EdDSA":t={name:"Ed25519"},r=e.d?["sign"]:["verify"];break;case"ECDH-ES":case"ECDH-ES+A128KW":case"ECDH-ES+A192KW":case"ECDH-ES+A256KW":t={name:e.crv},r=e.d?["deriveBits"]:[];break;default:throw new eH(tR)}break;default:throw new eH('Invalid or unsupported JWK "kty" (Key Type) Parameter value')}return{algorithm:t,keyUsages:r}}(e),n={...e};return"AKP"!==n.kty&&delete n.alg,delete n.use,crypto.subtle.importKey("jwk",n,t,e.ext??(!e.d&&!e.priv),e.key_ops??r)}let tU="given KeyObject instance cannot be used for this algorithm",tO=async(e,r,n,i=!1)=>{let a=(t||=new WeakMap).get(e);if(a?.[n])return a[n];let o=await tI({...r,alg:n});return i&&Object.freeze(e),a?a[n]=o:t.set(e,{[n]:o}),o};async function tP(e,r){if(e instanceof Uint8Array||eY(e))return e;if(eX(e)){if("secret"===e.type)return e.export();if("toCryptoKey"in e&&"function"==typeof e.toCryptoKey)try{return((e,r)=>{let n,i=(t||=new WeakMap).get(e);if(i?.[r])return i[r];let a="public"===e.type,o=!!a;if("x25519"===e.asymmetricKeyType){switch(r){case"ECDH-ES":case"ECDH-ES+A128KW":case"ECDH-ES+A192KW":case"ECDH-ES+A256KW":break;default:throw TypeError(tU)}n=e.toCryptoKey(e.asymmetricKeyType,o,a?[]:["deriveBits"])}if("ed25519"===e.asymmetricKeyType){if("EdDSA"!==r&&"Ed25519"!==r)throw TypeError(tU);n=e.toCryptoKey(e.asymmetricKeyType,o,[a?"verify":"sign"])}switch(e.asymmetricKeyType){case"ml-dsa-44":case"ml-dsa-65":case"ml-dsa-87":if(r!==e.asymmetricKeyType.toUpperCase())throw TypeError(tU);n=e.toCryptoKey(e.asymmetricKeyType,o,[a?"verify":"sign"])}if("rsa"===e.asymmetricKeyType){let t;switch(r){case"RSA-OAEP":t="SHA-1";break;case"RS256":case"PS256":case"RSA-OAEP-256":t="SHA-256";break;case"RS384":case"PS384":case"RSA-OAEP-384":t="SHA-384";break;case"RS512":case"PS512":case"RSA-OAEP-512":t="SHA-512";break;default:throw TypeError(tU)}if(r.startsWith("RSA-OAEP"))return e.toCryptoKey({name:"RSA-OAEP",hash:t},o,a?["encrypt"]:["decrypt"]);n=e.toCryptoKey({name:r.startsWith("PS")?"RSA-PSS":"RSASSA-PKCS1-v1_5",hash:t},o,[a?"verify":"sign"])}if("ec"===e.asymmetricKeyType){let t=new Map([["prime256v1","P-256"],["secp384r1","P-384"],["secp521r1","P-521"]]).get(e.asymmetricKeyDetails?.namedCurve);if(!t)throw TypeError(tU);let i={ES256:"P-256",ES384:"P-384",ES512:"P-521"};i[r]&&t===i[r]&&(n=e.toCryptoKey({name:"ECDSA",namedCurve:t},o,[a?"verify":"sign"])),r.startsWith("ECDH-ES")&&(n=e.toCryptoKey({name:"ECDH",namedCurve:t},o,a?[]:["deriveBits"]))}if(!n)throw TypeError(tU);return i?i[r]=n:t.set(e,{[r]:n}),n})(e,r)}catch(e){if(e instanceof TypeError)throw e}let n=e.export({format:"jwk"});return tO(e,n,r)}if(tT(e))return e.k?ek(e.k):tO(e,e,r,!0);throw Error("unreachable")}async function tC(e,t,r){let n;if(!tS(e))throw TypeError("JWK must be an object");switch(t??=e.alg,n??=r?.extractable??e.ext,e.kty){case"oct":if("string"!=typeof e.k||!e.k)throw TypeError('missing "k" (Key Value) Parameter value');return ek(e.k);case"RSA":if("oth"in e&&void 0!==e.oth)throw new eH('RSA JWK "oth" (Other Primes Info) Parameter value is not supported');return tI({...e,alg:t,ext:n});case"AKP":if("string"!=typeof e.alg||!e.alg)throw TypeError('missing "alg" (Algorithm) Parameter value');if(void 0!==t&&t!==e.alg)throw TypeError("JWK alg and alg option value mismatch");return tI({...e,ext:n});case"EC":case"OKP":return tI({...e,alg:t,ext:n});default:throw new eH('Unsupported "kty" (Key Type) Parameter value')}}async function tD(e){if(eX(e))if("secret"!==e.type)return e.export({format:"jwk"});else e=e.export();if(e instanceof Uint8Array)return{kty:"oct",k:e_(e)};if(!eY(e))throw TypeError(eD(e,"CryptoKey","KeyObject","Uint8Array"));if(!e.extractable)throw TypeError("non-extractable CryptoKey cannot be exported as a JWK");let{ext:t,key_ops:r,alg:n,use:i,...a}=await crypto.subtle.exportKey("jwk",e);return"AKP"===a.kty&&(a.alg=n),a}async function tL(e){return tD(e)}async function tz(e,t,r,n){let i=e.slice(0,7),a=await ti(i,r,t,n,new Uint8Array);return{encryptedKey:a.ciphertext,iv:e_(a.iv),tag:e_(a.tag)}}async function t$(e,t,r,n,i){return ta(e.slice(0,7),t,r,n,i,new Uint8Array)}let tN='Invalid or unsupported "alg" (JWE Algorithm) header value';function tj(e){if(void 0===e)throw new eV("JWE Encrypted Key missing")}async function tH(e,t,r,n,i){switch(e){case"dir":if(void 0!==r)throw new eV("Encountered unexpected JWE Encrypted Key");return t;case"ECDH-ES":if(void 0!==r)throw new eV("Encountered unexpected JWE Encrypted Key");case"ECDH-ES+A128KW":case"ECDH-ES+A192KW":case"ECDH-ES+A256KW":{let i,a;if(!tS(n.epk))throw new eV('JOSE Header "epk" (Ephemeral Public Key) missing or invalid');if(eQ(t),!tf(t))throw new eH("ECDH with the provided key is not allowed or not supported by your javascript runtime");let o=await tC(n.epk,e);if(eQ(o),void 0!==n.apu){if("string"!=typeof n.apu)throw new eV('JOSE Header "apu" (Agreement PartyUInfo) invalid');i=eT(n.apu,"apu",eV)}if(void 0!==n.apv){if("string"!=typeof n.apv)throw new eV('JOSE Header "apv" (Agreement PartyVInfo) invalid');a=eT(n.apv,"apv",eV)}let s=await tp(o,t,"ECDH-ES"===e?n.enc:e,"ECDH-ES"===e?e1(n.enc):parseInt(e.slice(-5,-2),10),i,a);if("ECDH-ES"===e)return s;return tj(r),tl(e.slice(-6),s,r)}case"RSA-OAEP":case"RSA-OAEP-256":case"RSA-OAEP-384":case"RSA-OAEP-512":return tj(r),eQ(t),t_(e,t,r);case"PBES2-HS256+A128KW":case"PBES2-HS384+A192KW":case"PBES2-HS512+A256KW":{let a;if(tj(r),"number"!=typeof n.p2c)throw new eV('JOSE Header "p2c" (PBES2 Count) missing or invalid');let o=i?.maxPBES2Count||1e4;if(n.p2c>o)throw new eV('JOSE Header "p2c" (PBES2 Count) out is of acceptable bounds');if("string"!=typeof n.p2s)throw new eV('JOSE Header "p2s" (PBES2 Salt) missing or invalid');return a=eT(n.p2s,"p2s",eV),ty(e,t,r,n.p2c,a)}case"A128KW":case"A192KW":case"A256KW":return tj(r),tl(e,t,r);case"A128GCMKW":case"A192GCMKW":case"A256GCMKW":if(tj(r),"string"!=typeof n.iv)throw new eV('JOSE Header "iv" (Initialization Vector) missing or invalid');if("string"!=typeof n.tag)throw new eV('JOSE Header "tag" (Authentication Tag) missing or invalid');return t$(e,t,r,eT(n.iv,"iv",eV),eT(n.tag,"tag",eV));default:throw new eH(tN)}}async function tB(e,t,r,n,i={}){let a,o,s;switch(e){case"dir":s=r;break;case"ECDH-ES":case"ECDH-ES+A128KW":case"ECDH-ES+A192KW":case"ECDH-ES+A256KW":{let c;if(eQ(r),!tf(r))throw new eH("ECDH with the provided key is not allowed or not supported by your javascript runtime");let{apu:l,apv:d}=i;c=i.epk?await tP(i.epk,e):(await crypto.subtle.generateKey(r.algorithm,!0,["deriveBits"])).privateKey;let{x:u,y:p,crv:f,kty:h}=await tL(c),m=await tp(r,c,"ECDH-ES"===e?t:e,"ECDH-ES"===e?e1(t):parseInt(e.slice(-5,-2),10),l,d);if(o={epk:{x:u,crv:f,kty:h}},"EC"===h&&(o.epk.y=p),l&&(o.apu=e_(l)),d&&(o.apv=e_(d)),"ECDH-ES"===e){s=m;break}s=n||e2(t);let y=e.slice(-6);a=await tc(y,m,s);break}case"RSA-OAEP":case"RSA-OAEP-256":case"RSA-OAEP-384":case"RSA-OAEP-512":s=n||e2(t),eQ(r),a=await tk(e,r,s);break;case"PBES2-HS256+A128KW":case"PBES2-HS384+A192KW":case"PBES2-HS512+A256KW":{s=n||e2(t);let{p2c:c,p2s:l}=i;({encryptedKey:a,...o}=await tm(e,r,s,c,l));break}case"A128KW":case"A192KW":case"A256KW":s=n||e2(t),a=await tc(e,r,s);break;case"A128GCMKW":case"A192GCMKW":case"A256GCMKW":{s=n||e2(t);let{iv:c}=i;({encryptedKey:a,...o}=await tz(e,r,s,c));break}default:throw new eH(tN)}return{cek:s,encryptedKey:a,parameters:o}}function tV(e,t,r,n,i){let a;if(void 0!==i.crit&&n?.crit===void 0)throw new e('"crit" (Critical) Header Parameter MUST be integrity protected');if(!n||void 0===n.crit)return new Set;if(!Array.isArray(n.crit)||0===n.crit.length||n.crit.some(e=>"string"!=typeof e||0===e.length))throw new e('"crit" (Critical) Header Parameter MUST be an array of non-empty strings when present');for(let o of(a=void 0!==r?new Map([...Object.entries(r),...t.entries()]):t,n.crit)){if(!a.has(o))throw new eH(`Extension Header Parameter "${o}" is not recognized`);if(void 0===i[o])throw new e(`Extension Header Parameter "${o}" is missing`);if(a.get(o)&&void 0===n[o])throw new e(`Extension Header Parameter "${o}" MUST be integrity protected`)}return new Set(n.crit)}let tM=e=>e?.[Symbol.toStringTag],tK=(e,t,r)=>{if(void 0!==t.use){let e;switch(r){case"sign":case"verify":e="sig";break;case"encrypt":case"decrypt":e="enc"}if(t.use!==e)throw TypeError(`Invalid key for this operation, its "use" must be "${e}" when present`)}if(void 0!==t.alg&&t.alg!==e)throw TypeError(`Invalid key for this operation, its "alg" must be "${e}" when present`);if(Array.isArray(t.key_ops)){let n;switch(!0){case"sign"===r||"verify"===r:case"dir"===e:case e.includes("CBC-HS"):n=r;break;case e.startsWith("PBES2"):n="deriveBits";break;case/^A\d{3}(?:GCM)?(?:KW)?$/.test(e):n=!e.includes("GCM")&&e.endsWith("KW")?"encrypt"===r?"wrapKey":"unwrapKey":r;break;case"encrypt"===r&&e.startsWith("RSA"):n="wrapKey";break;case"decrypt"===r:n=e.startsWith("RSA")?"unwrapKey":"deriveBits"}if(n&&t.key_ops?.includes?.(n)===!1)throw TypeError(`Invalid key for this operation, its "key_ops" must include "${n}" when present`)}return!0};function tW(e,t,r){switch(e.substring(0,2)){case"A1":case"A2":case"di":case"HS":case"PB":((e,t,r)=>{if(!(t instanceof Uint8Array)){if(tT(t)){if("oct"===t.kty&&"string"==typeof t.k&&tK(e,t,r))return;throw TypeError('JSON Web Key for symmetric algorithms must have JWK "kty" (Key Type) equal to "oct" and the JWK "k" (Key Value) present')}if(!e0(t))throw TypeError(eL(e,t,"CryptoKey","KeyObject","JSON Web Key","Uint8Array"));if("secret"!==t.type)throw TypeError(`${tM(t)} instances for symmetric algorithms must be of type "secret"`)}})(e,t,r);break;default:((e,t,r)=>{if(tT(t))switch(r){case"decrypt":case"sign":if("oct"!==t.kty&&("AKP"===t.kty&&"string"==typeof t.priv||"string"==typeof t.d)&&tK(e,t,r))return;throw TypeError("JSON Web Key for this operation must be a private JWK");case"encrypt":case"verify":if("oct"!==t.kty&&void 0===t.d&&void 0===t.priv&&tK(e,t,r))return;throw TypeError("JSON Web Key for this operation must be a public JWK")}if(!e0(t))throw TypeError(eL(e,t,"CryptoKey","KeyObject","JSON Web Key"));if("secret"===t.type)throw TypeError(`${tM(t)} instances for asymmetric algorithms must not be of type "secret"`);if("public"===t.type)switch(r){case"sign":throw TypeError(`${tM(t)} instances for asymmetric algorithm signing must be of type "private"`);case"decrypt":throw TypeError(`${tM(t)} instances for asymmetric algorithm decryption must be of type "private"`)}if("private"===t.type)switch(r){case"verify":throw TypeError(`${tM(t)} instances for asymmetric algorithm verifying must be of type "public"`);case"encrypt":throw TypeError(`${tM(t)} instances for asymmetric algorithm encryption must be of type "public"`)}})(e,t,r)}}function tq(e){if(void 0===globalThis[e])throw new eH(`JWE "zip" (Compression Algorithm) Header Parameter requires the ${e} API.`)}async function tF(e){tq("CompressionStream");let t=new CompressionStream("deflate-raw"),r=t.writable.getWriter();r.write(e).catch(()=>{}),r.close().catch(()=>{});let n=[],i=t.readable.getReader();for(;;){let{value:e,done:t}=await i.read();if(t)break;n.push(e)}return ew(...n)}async function tJ(e,t){tq("DecompressionStream");let r=new DecompressionStream("deflate-raw"),n=r.writable.getWriter();n.write(e).catch(()=>{}),n.close().catch(()=>{});let i=[],a=0,o=r.readable.getReader();for(;;){let{value:e,done:r}=await o.read();if(r)break;if(i.push(e),a+=e.byteLength,t!==1/0&&a>t)throw new eV("Decompressed plaintext exceeded the configured limit")}return ew(...i)}class tZ{#e;#t;#r;#n;#i;#a;#o;#s;constructor(e){if(!(e instanceof Uint8Array))throw TypeError("plaintext must be an instance of Uint8Array");this.#e=e}setKeyManagementParameters(e){return ex(this.#s,"setKeyManagementParameters"),this.#s=e,this}setProtectedHeader(e){return ex(this.#t,"setProtectedHeader"),this.#t=e,this}setSharedUnprotectedHeader(e){return ex(this.#r,"setSharedUnprotectedHeader"),this.#r=e,this}setUnprotectedHeader(e){return ex(this.#n,"setUnprotectedHeader"),this.#n=e,this}setAdditionalAuthenticatedData(e){return this.#i=e,this}setContentEncryptionKey(e){return ex(this.#a,"setContentEncryptionKey"),this.#a=e,this}setInitializationVector(e){return ex(this.#o,"setInitializationVector"),this.#o=e,this}async encrypt(e,t){let r,n,i,a,o,s;if(!this.#t&&!this.#n&&!this.#r)throw new eV("either setProtectedHeader, setUnprotectedHeader, or sharedUnprotectedHeader must be called before #encrypt()");if(!tx(this.#t,this.#n,this.#r))throw new eV("JWE Protected, JWE Shared Unprotected and JWE Per-Recipient Header Parameter names must be disjoint");let c={...this.#t,...this.#n,...this.#r};if(tV(eV,new Map,t?.crit,this.#t,c),void 0!==c.zip&&"DEF"!==c.zip)throw new eH('Unsupported JWE "zip" (Compression Algorithm) Header Parameter value.');if(void 0!==c.zip&&!this.#t?.zip)throw new eV('JWE "zip" (Compression Algorithm) Header Parameter MUST be in a protected header.');let{alg:l,enc:d}=c;if("string"!=typeof l||!l)throw new eV('JWE "alg" (Algorithm) Header Parameter missing or invalid');if("string"!=typeof d||!d)throw new eV('JWE "enc" (Encryption Algorithm) Header Parameter missing or invalid');if(this.#a&&("dir"===l||"ECDH-ES"===l))throw TypeError(`setContentEncryptionKey cannot be called with JWE "alg" (Algorithm) Header ${l}`);tW("dir"===l?d:l,e,"encrypt");{let i,a=await tP(e,l);({cek:n,encryptedKey:r,parameters:i}=await tB(l,d,a,this.#a,this.#s)),i&&(t&&eS in t?this.#n?this.#n={...this.#n,...i}:this.setUnprotectedHeader(i):this.#t?this.#t={...this.#t,...i}:this.setProtectedHeader(i))}if(this.#t?o=ev(a=e_(JSON.stringify(this.#t))):(a="",o=new Uint8Array),this.#i){let e=ev(s=e_(this.#i));i=ew(o,ev("."),e)}else i=o;let u=this.#e;"DEF"===c.zip&&(u=await tF(u).catch(e=>{throw new eV("Failed to compress plaintext",{cause:e})}));let{ciphertext:p,tag:f,iv:h}=await ti(d,u,n,this.#o,i),m={ciphertext:e_(p)};return h&&(m.iv=e_(h)),f&&(m.tag=e_(f)),r&&(m.encrypted_key=e_(r)),s&&(m.aad=s),this.#t&&(m.protected=a),this.#r&&(m.unprotected=this.#r),this.#n&&(m.header=this.#n),m}}class tG{#c;constructor(e){this.#c=new tZ(e)}setContentEncryptionKey(e){return this.#c.setContentEncryptionKey(e),this}setInitializationVector(e){return this.#c.setInitializationVector(e),this}setProtectedHeader(e){return this.#c.setProtectedHeader(e),this}setKeyManagementParameters(e){return this.#c.setKeyManagementParameters(e),this}async encrypt(e,t){let r=await this.#c.encrypt(e,t);return[r.protected,r.encrypted_key,r.iv,r.ciphertext,r.tag].join(".")}}let tQ=e=>Math.floor(e.getTime()/1e3),tY=/^(\+|\-)? ?(\d+|\d+\.\d+) ?(seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)(?: (ago|from now))?$/i;function tX(e){let t,r=tY.exec(e);if(!r||r[4]&&r[1])throw TypeError("Invalid time period format");let n=parseFloat(r[2]);switch(r[3].toLowerCase()){case"sec":case"secs":case"second":case"seconds":case"s":t=Math.round(n);break;case"minute":case"minutes":case"min":case"mins":case"m":t=Math.round(60*n);break;case"hour":case"hours":case"hr":case"hrs":case"h":t=Math.round(3600*n);break;case"day":case"days":case"d":t=Math.round(86400*n);break;case"week":case"weeks":case"w":t=Math.round(604800*n);break;default:t=Math.round(0x1e187e0*n)}return"-"===r[1]||"ago"===r[4]?-t:t}function t0(e,t){if(!Number.isFinite(t))throw TypeError(`Invalid ${e} input`);return t}let t1=e=>e.includes("/")?e.toLowerCase():`application/${e.toLowerCase()}`;function t2(e,t,r={}){var n,i;let a,o;try{a=JSON.parse(eg.decode(t))}catch{}if(!tS(a))throw new eK("JWT Claims Set must be a top-level JSON object");let{typ:s}=r;if(s&&("string"!=typeof e.typ||t1(e.typ)!==t1(s)))throw new e$('unexpected "typ" JWT header value',a,"typ","check_failed");let{requiredClaims:c=[],issuer:l,subject:d,audience:u,maxTokenAge:p}=r,f=[...c];for(let e of(void 0!==p&&f.push("iat"),void 0!==u&&f.push("aud"),void 0!==d&&f.push("sub"),void 0!==l&&f.push("iss"),new Set(f.reverse())))if(!(e in a))throw new e$(`missing required "${e}" claim`,a,e,"missing");if(l&&!(Array.isArray(l)?l:[l]).includes(a.iss))throw new e$('unexpected "iss" claim value',a,"iss","check_failed");if(d&&a.sub!==d)throw new e$('unexpected "sub" claim value',a,"sub","check_failed");if(u&&(n=a.aud,i="string"==typeof u?[u]:u,"string"==typeof n?!i.includes(n):!(Array.isArray(n)&&i.some(Set.prototype.has.bind(new Set(n))))))throw new e$('unexpected "aud" claim value',a,"aud","check_failed");switch(typeof r.clockTolerance){case"string":o=tX(r.clockTolerance);break;case"number":o=r.clockTolerance;break;case"undefined":o=0;break;default:throw TypeError("Invalid clockTolerance option type")}let{currentDate:h}=r,m=tQ(h||new Date);if((void 0!==a.iat||p)&&"number"!=typeof a.iat)throw new e$('"iat" claim must be a number',a,"iat","invalid");if(void 0!==a.nbf){if("number"!=typeof a.nbf)throw new e$('"nbf" claim must be a number',a,"nbf","invalid");if(a.nbf>m+o)throw new e$('"nbf" claim timestamp check failed',a,"nbf","check_failed")}if(void 0!==a.exp){if("number"!=typeof a.exp)throw new e$('"exp" claim must be a number',a,"exp","invalid");if(a.exp<=m-o)throw new eN('"exp" claim timestamp check failed',a,"exp","check_failed")}if(p){let e=m-a.iat;if(e-o>("number"==typeof p?p:tX(p)))throw new eN('"iat" claim timestamp check failed (too far in the past)',a,"iat","check_failed");if(e<0-o)throw new e$('"iat" claim timestamp check failed (it should be in the past)',a,"iat","check_failed")}return a}class t6{#l;constructor(e){if(!tS(e))throw TypeError("JWT Claims Set MUST be an object");this.#l=structuredClone(e)}data(){return ey.encode(JSON.stringify(this.#l))}get iss(){return this.#l.iss}set iss(e){this.#l.iss=e}get sub(){return this.#l.sub}set sub(e){this.#l.sub=e}get aud(){return this.#l.aud}set aud(e){this.#l.aud=e}set jti(e){this.#l.jti=e}set nbf(e){"number"==typeof e?this.#l.nbf=t0("setNotBefore",e):e instanceof Date?this.#l.nbf=t0("setNotBefore",tQ(e)):this.#l.nbf=tQ(new Date)+tX(e)}set exp(e){"number"==typeof e?this.#l.exp=t0("setExpirationTime",e):e instanceof Date?this.#l.exp=t0("setExpirationTime",tQ(e)):this.#l.exp=tQ(new Date)+tX(e)}set iat(e){void 0===e?this.#l.iat=tQ(new Date):e instanceof Date?this.#l.iat=t0("setIssuedAt",tQ(e)):"string"==typeof e?this.#l.iat=t0("setIssuedAt",tQ(new Date)+tX(e)):this.#l.iat=t0("setIssuedAt",e)}}class t5{#a;#o;#s;#t;#d;#u;#p;#f;constructor(e={}){this.#f=new t6(e)}setIssuer(e){return this.#f.iss=e,this}setSubject(e){return this.#f.sub=e,this}setAudience(e){return this.#f.aud=e,this}setJti(e){return this.#f.jti=e,this}setNotBefore(e){return this.#f.nbf=e,this}setExpirationTime(e){return this.#f.exp=e,this}setIssuedAt(e){return this.#f.iat=e,this}setProtectedHeader(e){return ex(this.#t,"setProtectedHeader"),this.#t=e,this}setKeyManagementParameters(e){return ex(this.#s,"setKeyManagementParameters"),this.#s=e,this}setContentEncryptionKey(e){return ex(this.#a,"setContentEncryptionKey"),this.#a=e,this}setInitializationVector(e){return ex(this.#o,"setInitializationVector"),this.#o=e,this}replicateIssuerAsHeader(){return this.#d=!0,this}replicateSubjectAsHeader(){return this.#u=!0,this}replicateAudienceAsHeader(){return this.#p=!0,this}async encrypt(e,t){let r=new tG(this.#f.data());return this.#t&&(this.#d||this.#u||this.#p)&&(this.#t={...this.#t,iss:this.#d?this.#f.iss:void 0,sub:this.#u?this.#f.sub:void 0,aud:this.#p?this.#f.aud:void 0}),r.setProtectedHeader(this.#t),this.#o&&r.setInitializationVector(this.#o),this.#a&&r.setContentEncryptionKey(this.#a),this.#s&&r.setKeyManagementParameters(this.#s),r.encrypt(e,t)}}class t8{#l;#t;#n;constructor(e){if(!(e instanceof Uint8Array))throw TypeError("payload must be an instance of Uint8Array");this.#l=e}setProtectedHeader(e){return ex(this.#t,"setProtectedHeader"),this.#t=e,this}setUnprotectedHeader(e){return ex(this.#n,"setUnprotectedHeader"),this.#n=e,this}async sign(e,t){let r,n,i,a;if(!this.#t&&!this.#n)throw new eM("either setProtectedHeader or setUnprotectedHeader must be called before #sign()");if(!tx(this.#t,this.#n))throw new eM("JWS Protected and JWS Unprotected Header Parameter names must be disjoint");let o={...this.#t,...this.#n},s=tV(eM,new Map([["b64",!0]]),t?.crit,this.#t,o),c=!0;if(s.has("b64")&&"boolean"!=typeof(c=this.#t.b64))throw new eM('The "b64" (base64url-encode payload) Header Parameter must be a boolean');let{alg:l}=o;if("string"!=typeof l||!l)throw new eM('JWS "alg" (Algorithm) Header Parameter missing or invalid');tW(l,e,"sign"),c?n=ev(r=e_(this.#l)):(n=this.#l,r=""),this.#t?a=ev(i=e_(JSON.stringify(this.#t))):(i="",a=new Uint8Array);let d=ew(a,ev("."),n),u=await tP(e,l),p={signature:e_(await tA(l,u,d)),payload:r};return this.#n&&(p.header=this.#n),this.#t&&(p.protected=i),p}}class t4{#c;constructor(e){this.#c=new t8(e)}setProtectedHeader(e){return this.#c.setProtectedHeader(e),this}async sign(e,t){let r=await this.#c.sign(e,t);if(void 0===r.payload)throw TypeError("use the flattened module for creating JWS with b64: false");return`${r.protected}.${r.payload}.${r.signature}`}}class t3{#t;#f;constructor(e={}){this.#f=new t6(e)}setIssuer(e){return this.#f.iss=e,this}setSubject(e){return this.#f.sub=e,this}setAudience(e){return this.#f.aud=e,this}setJti(e){return this.#f.jti=e,this}setNotBefore(e){return this.#f.nbf=e,this}setExpirationTime(e){return this.#f.exp=e,this}setIssuedAt(e){return this.#f.iat=e,this}setProtectedHeader(e){return this.#t=e,this}async sign(e,t){let r=new t4(this.#f.data());if(r.setProtectedHeader(this.#t),Array.isArray(this.#t?.crit)&&this.#t.crit.includes("b64")&&!1===this.#t.b64)throw new eK("JWTs MUST NOT use unencoded payload");return r.sign(e,t)}}var t9=e.i(797379),t9=t9;let t7=(e,t)=>{if("string"!=typeof e||!e)throw new eW(`${t} missing or invalid`)};async function re(e,t){let r,n;if(tT(e))r=e;else if(e0(e))r=await tL(e);else throw TypeError(eD(e,"CryptoKey","KeyObject","JSON Web Key"));if("sha256"!==(t??="sha256")&&"sha384"!==t&&"sha512"!==t)throw TypeError('digestAlgorithm must one of "sha256", "sha384", or "sha512"');switch(r.kty){case"AKP":t7(r.alg,'"alg" (Algorithm) Parameter'),t7(r.pub,'"pub" (Public key) Parameter'),n={alg:r.alg,kty:r.kty,pub:r.pub};break;case"EC":t7(r.crv,'"crv" (Curve) Parameter'),t7(r.x,'"x" (X Coordinate) Parameter'),t7(r.y,'"y" (Y Coordinate) Parameter'),n={crv:r.crv,kty:r.kty,x:r.x,y:r.y};break;case"OKP":t7(r.crv,'"crv" (Subtype of Key Pair) Parameter'),t7(r.x,'"x" (Public Key) Parameter'),n={crv:r.crv,kty:r.kty,x:r.x};break;case"RSA":t7(r.e,'"e" (Exponent) Parameter'),t7(r.n,'"n" (Modulus) Parameter'),n={e:r.e,kty:r.kty,n:r.n};break;case"oct":t7(r.k,'"k" (Key Value) Parameter'),n={k:r.k,kty:r.kty};break;default:throw new eH('"kty" (Key Type) Parameter missing or unsupported')}let i=ev(JSON.stringify(n));return e_(await eR(t,i))}function rt(e){let t;if("string"==typeof e){let r=e.split(".");(3===r.length||5===r.length)&&([t]=r)}else if("object"==typeof e&&e)if("protected"in e)t=e.protected;else throw TypeError("Token does not contain a Protected Header");try{if("string"!=typeof t||!t)throw Error();let e=JSON.parse(eg.decode(ek(t)));if(!tS(e))throw Error();return e}catch{throw TypeError("Invalid Token or Protected Header formatting")}}function rr(e,t){if(void 0!==t&&(!Array.isArray(t)||t.some(e=>"string"!=typeof e)))throw TypeError(`"${e}" option must be an array of strings`);if(t)return new Set(t)}async function rn(e,t,r){let n,i,a,o,s,c;if(!tS(e))throw new eV("Flattened JWE must be an object");if(void 0===e.protected&&void 0===e.header&&void 0===e.unprotected)throw new eV("JOSE Header missing");if(void 0!==e.iv&&"string"!=typeof e.iv)throw new eV("JWE Initialization Vector incorrect type");if("string"!=typeof e.ciphertext)throw new eV("JWE Ciphertext missing or incorrect type");if(void 0!==e.tag&&"string"!=typeof e.tag)throw new eV("JWE Authentication Tag incorrect type");if(void 0!==e.protected&&"string"!=typeof e.protected)throw new eV("JWE Protected Header incorrect type");if(void 0!==e.encrypted_key&&"string"!=typeof e.encrypted_key)throw new eV("JWE Encrypted Key incorrect type");if(void 0!==e.aad&&"string"!=typeof e.aad)throw new eV("JWE AAD incorrect type");if(void 0!==e.header&&!tS(e.header))throw new eV("JWE Shared Unprotected Header incorrect type");if(void 0!==e.unprotected&&!tS(e.unprotected))throw new eV("JWE Per-Recipient Unprotected Header incorrect type");if(e.protected)try{let t=ek(e.protected);n=JSON.parse(eg.decode(t))}catch{throw new eV("JWE Protected Header is invalid")}if(!tx(n,e.header,e.unprotected))throw new eV("JWE Protected, JWE Unprotected Header, and JWE Per-Recipient Unprotected Header Parameter names must be disjoint");let l={...n,...e.header,...e.unprotected};if(tV(eV,new Map,r?.crit,n,l),void 0!==l.zip&&"DEF"!==l.zip)throw new eH('Unsupported JWE "zip" (Compression Algorithm) Header Parameter value.');if(void 0!==l.zip&&!n?.zip)throw new eV('JWE "zip" (Compression Algorithm) Header Parameter MUST be in a protected header.');let{alg:d,enc:u}=l;if("string"!=typeof d||!d)throw new eV("missing JWE Algorithm (alg) in JWE Header");if("string"!=typeof u||!u)throw new eV("missing JWE Encryption Algorithm (enc) in JWE Header");let p=r&&rr("keyManagementAlgorithms",r.keyManagementAlgorithms),f=r&&rr("contentEncryptionAlgorithms",r.contentEncryptionAlgorithms);if(p&&!p.has(d)||!p&&d.startsWith("PBES2"))throw new ej('"alg" (Algorithm) Header Parameter value not allowed');if(f&&!f.has(u))throw new ej('"enc" (Encryption Algorithm) Header Parameter value not allowed');void 0!==e.encrypted_key&&(i=eT(e.encrypted_key,"encrypted_key",eV));let h=!1;"function"==typeof t&&(t=await t(n,e),h=!0),tW("dir"===d?u:d,t,"decrypt");let m=await tP(t,d);try{a=await tH(d,m,i,l,r)}catch(e){if(e instanceof TypeError||e instanceof eV||e instanceof eH)throw e;a=e2(u)}void 0!==e.iv&&(o=eT(e.iv,"iv",eV)),void 0!==e.tag&&(s=eT(e.tag,"tag",eV));let y=void 0!==e.protected?ev(e.protected):new Uint8Array;c=void 0!==e.aad?ew(y,ev("."),ev(e.aad)):y;let g=eT(e.ciphertext,"ciphertext",eV),w=await ta(u,a,g,o,s,c),b={plaintext:w};if("DEF"===l.zip){let e=r?.maxDecompressedLength??25e4;if(0===e)throw new eH('JWE "zip" (Compression Algorithm) Header Parameter is not supported.');if(e!==1/0&&(!Number.isSafeInteger(e)||e<1))throw TypeError("maxDecompressedLength must be 0, a positive safe integer, or Infinity");b.plaintext=await tJ(w,e).catch(e=>{if(e instanceof eV)throw e;throw new eV("Failed to decompress plaintext",{cause:e})})}return(void 0!==e.protected&&(b.protectedHeader=n),void 0!==e.aad&&(b.additionalAuthenticatedData=eT(e.aad,"aad",eV)),void 0!==e.unprotected&&(b.sharedUnprotectedHeader=e.unprotected),void 0!==e.header&&(b.unprotectedHeader=e.header),h)?{...b,key:m}:b}async function ri(e,t,r){if(e instanceof Uint8Array&&(e=eg.decode(e)),"string"!=typeof e)throw new eV("Compact JWE must be a string or Uint8Array");let{0:n,1:i,2:a,3:o,4:s,length:c}=e.split(".");if(5!==c)throw new eV("Invalid Compact JWE");let l=await rn({ciphertext:o,iv:a||void 0,protected:n,tag:s||void 0,encrypted_key:i||void 0},t,r),d={plaintext:l.plaintext,protectedHeader:l.protectedHeader};return"function"==typeof t?{...d,key:l.key}:d}async function ra(e,t,r){let n=await ri(e,t,r),i=t2(n.protectedHeader,n.plaintext,r),{protectedHeader:a}=n;if(void 0!==a.iss&&a.iss!==i.iss)throw new e$('replicated "iss" claim header parameter mismatch',i,"iss","mismatch");if(void 0!==a.sub&&a.sub!==i.sub)throw new e$('replicated "sub" claim header parameter mismatch',i,"sub","mismatch");if(void 0!==a.aud&&JSON.stringify(a.aud)!==JSON.stringify(i.aud))throw new e$('replicated "aud" claim header parameter mismatch',i,"aud","mismatch");let o={payload:i,protectedHeader:a};return"function"==typeof t?{...o,key:n.key}:o}async function ro(e,t,r){if(!tS(e))throw new eM("Flattened JWS must be an object");if(void 0===e.protected&&void 0===e.header)throw new eM('Flattened JWS must have either of the "protected" or "header" members');if(void 0!==e.protected&&"string"!=typeof e.protected)throw new eM("JWS Protected Header incorrect type");if(void 0===e.payload)throw new eM("JWS Payload missing");if("string"!=typeof e.signature)throw new eM("JWS Signature missing or incorrect type");if(void 0!==e.header&&!tS(e.header))throw new eM("JWS Unprotected Header incorrect type");let n={};if(e.protected)try{let t=ek(e.protected);n=JSON.parse(eg.decode(t))}catch{throw new eM("JWS Protected Header is invalid")}if(!tx(n,e.header))throw new eM("JWS Protected and JWS Unprotected Header Parameter names must be disjoint");let i={...n,...e.header},a=tV(eM,new Map([["b64",!0]]),r?.crit,n,i),o=!0;if(a.has("b64")&&"boolean"!=typeof(o=n.b64))throw new eM('The "b64" (base64url-encode payload) Header Parameter must be a boolean');let{alg:s}=i;if("string"!=typeof s||!s)throw new eM('JWS "alg" (Algorithm) Header Parameter missing or invalid');let c=r&&rr("algorithms",r.algorithms);if(c&&!c.has(s))throw new ej('"alg" (Algorithm) Header Parameter value not allowed');if(o){if("string"!=typeof e.payload)throw new eM("JWS Payload must be a string")}else if("string"!=typeof e.payload&&!(e.payload instanceof Uint8Array))throw new eM("JWS Payload must be a string or an Uint8Array instance");let l=!1;"function"==typeof t&&(t=await t(n,e),l=!0),tW(s,t,"verify");let d=ew(void 0!==e.protected?ev(e.protected):new Uint8Array,ev("."),"string"==typeof e.payload?o?ev(e.payload):ey.encode(e.payload):e.payload),u=eT(e.signature,"signature",eM),p=await tP(t,s);if(!await tE(s,p,u,d))throw new eG;let f={payload:o?eT(e.payload,"payload",eM):"string"==typeof e.payload?ey.encode(e.payload):e.payload};return(void 0!==e.protected&&(f.protectedHeader=n),void 0!==e.header&&(f.unprotectedHeader=e.header),l)?{...f,key:p}:f}async function rs(e,t,r){if(e instanceof Uint8Array&&(e=eg.decode(e)),"string"!=typeof e)throw new eM("Compact JWS must be a string or Uint8Array");let{0:n,1:i,2:a,length:o}=e.split(".");if(3!==o)throw new eM("Invalid Compact JWS");let s=await ro({payload:i,protected:n,signature:a},t,r),c={payload:s.payload,protectedHeader:s.protectedHeader};return"function"==typeof t?{...c,key:s.key}:c}async function rc(e,t,r){let n=await rs(e,t,r);if(n.protectedHeader.crit?.includes("b64")&&!1===n.protectedHeader.b64)throw new eK("JWTs MUST NOT use unencoded payload");let i={payload:t2(n.protectedHeader,n.payload,r),protectedHeader:n.protectedHeader};return"function"==typeof t?{...i,key:n.key}:i}async function rl(e,t,r=3600){return await new t3(e).setProtectedHeader({alg:"HS256"}).setIssuedAt().setExpirationTime(Math.floor(Date.now()/1e3)+r).sign(new TextEncoder().encode(t))}async function rd(e,t){try{return(await rc(e,new TextEncoder().encode(t))).payload}catch{return null}}let ru=new Uint8Array([66,101,116,116,101,114,65,117,116,104,46,106,115,32,71,101,110,101,114,97,116,101,100,32,69,110,99,114,121,112,116,105,111,110,32,75,101,121]),rp="A256CBC-HS512";function rf(e,t){var r,n,i;return r=new TextEncoder().encode(e),n=new TextEncoder().encode(t),function(e,t,r,n=32){M(e),B(n,"length"),V(t,void 0,"prk");let i=e.outputLen;if(t.length<i)throw Error('"prk" must be at least HashLen octets');if(n>255*i)throw Error("Length must be <= 255*HashLen");let a=Math.ceil(n/i);void 0===r?r=Y:V(r,void 0,"info");let o=new Uint8Array(a*i),s=G.create(e,t),c=s._cloneInto(),l=new Uint8Array(s.outputLen);for(let e=0;e<a;e++)Q[0]=e+1,c.update(0===e?Y:l).update(r).update(Q).digestInto(l),o.set(l,i*e),s._cloneInto(c);return s.destroy(),c.destroy(),q(l,Q),o.slice(0,n)}(em,(i=n,M(em),void 0===i&&(i=new Uint8Array(em.outputLen)),G(em,i,r)),ru,64)}function rh(e){if("string"==typeof e)return[{version:0,value:e}];let t=[];for(let[r,n]of e.keys)t.push({version:r,value:n});return e.legacySecret&&!t.some(t=>t.value===e.legacySecret)&&t.push({version:-1,value:e.legacySecret}),t}async function rm(e,t,r,n=3600){let i=rf(function(e){if("string"==typeof e)return e;let t=e.keys.get(e.currentVersion);if(!t)throw Error(`Secret version ${e.currentVersion} not found in keys`);return t}(t),r),a=await re({kty:"oct",k:t9.encode(i)},"sha256");return await new t5(e).setProtectedHeader({alg:"dir",enc:rp,kid:a}).setIssuedAt().setExpirationTime((Date.now()/1e3|0)+n).setJti(crypto.randomUUID()).encrypt(i)}let ry={clockTolerance:15,keyManagementAlgorithms:["dir"],contentEncryptionAlgorithms:[rp,"A256GCM"]};async function rg(e,t,r){if(!e)return null;let n=!1;try{n=void 0!==rt(e).kid}catch{return null}try{let n=rh(t),{payload:i}=await ra(e,async e=>{let t=e.kid;if(void 0!==t){for(let e of n){let n=rf(e.value,r);if(t===await re({kty:"oct",k:t9.encode(n)},"sha256"))return n}throw Error("no matching decryption secret")}return n.length,rf(n[0].value,r)},ry);return i}catch{if(n)return null;let i=rh(t);if(i.length<=1)return null;for(let t=1;t<i.length;t++)try{let n=i[t],{payload:a}=await ra(e,rf(n.value,r),ry);return a}catch{continue}return null}}var rw=e.i(163738);function rb(e,t){if(!e||!t)return e;let r=Object.entries(t).filter(([,{returned:e}])=>!1===e).map(([e])=>e);return Object.entries(structuredClone(e)).filter(([e])=>!r.includes(e)).reduce((e,[t,r])=>({...e,[t]:r}),{})}let rA=new WeakMap;function rE(e,t,r){let n=`${t}:${r}`;rA.has(e)||rA.set(e,new Map);let i=rA.get(e);if(i.has(n))return i.get(n);let a="output"===r?(0,y.getAuthTables)(e)[t]?.fields??{}:{},o="user"===t||"session"===t||"account"===t?e[t]?.additionalFields:void 0,s={...a,...o??{}};for(let r of e.plugins||[])r.schema&&r.schema[t]&&(s={...s,...r.schema[t].fields});return i.set(n,s),s}function rv(e,t){return rb(t,rE(e,"user","output"))}function rk(e,t){let r=rE(e,"user","output"),n={};for(let e in r){let i=r[e];!1!==i.returned&&(e in t&&void 0!==t[e]?n[e]=t[e]:void 0!==i.defaultValue?n[e]="function"==typeof i.defaultValue?i.defaultValue():i.defaultValue:i.required||(n[e]=null))}return"id"in t&&(n.id=t.id),n}function r_(e,t){return rb(t,rE(e,"session","output"))}function rS(e,t){let r=t.action||"create",n=t.fields,i=Object.create(null);for(let t in n){if(t in e){if(!1===n[t].input){if(void 0!==n[t].defaultValue&&"update"!==r){i[t]=n[t].defaultValue;continue}if(e[t])throw b.APIError.from("BAD_REQUEST",{...rw.BASE_ERROR_CODES.FIELD_NOT_ALLOWED,message:`${t} is not allowed to be set`});continue}if(n[t].validator?.input&&void 0!==e[t]){let r=n[t].validator.input["~standard"].validate(e[t]);if(r instanceof Promise)throw b.APIError.from("INTERNAL_SERVER_ERROR",rw.BASE_ERROR_CODES.ASYNC_VALIDATION_NOT_SUPPORTED);if("issues"in r&&r.issues)throw b.APIError.from("BAD_REQUEST",{...rw.BASE_ERROR_CODES.VALIDATION_ERROR,message:r.issues[0]?.message||"Validation Error"});i[t]=r.value;continue}if(n[t].transform?.input&&void 0!==e[t]){i[t]=n[t].transform?.input(e[t]);continue}i[t]=e[t];continue}if(void 0!==n[t].defaultValue&&"create"===r){if("function"==typeof n[t].defaultValue){i[t]=n[t].defaultValue();continue}i[t]=n[t].defaultValue;continue}if(n[t].required&&"create"===r)throw b.APIError.from("BAD_REQUEST",{...rw.BASE_ERROR_CODES.MISSING_FIELD,message:`${t} is required`})}return i}function rx(e,t={},r){return rS(t,{fields:rE(e,"user","input"),action:r})}let rT=(e,t="ms")=>new Date(Date.now()+("sec"===t?1e3*e:e)),rR=/^(\+|\-)? ?(\d+|\d+\.\d+) ?(seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|months?|mo|years?|yrs?|y)(?: (ago|from now))?$/i;function rI(e){if(-1===e.indexOf("%"))return e;try{return decodeURIComponent(e)}catch{return e}}function rU(e){if(!e)return[];let t=[],r=0,n=0;for(;n<e.length;){if(","===e[n]){let i=n+1;for(;i<e.length&&" "===e[i];)i++;for(;i<e.length&&"="!==e[i]&&";"!==e[i]&&","!==e[i];)i++;if(i<e.length&&"="===e[i]){let i=e.slice(r,n).trim();for(i&&t.push(i),r=n+1;r<e.length&&" "===e[r];)r++;n=r;continue}}n++}let i=e.slice(r).trim();return i&&t.push(i),t}let rO=/^[\w!#$%&'*.^`|~+-]+$/,rP=/^[ !#-:<-[\]-~]*$/;function rC(e){return!(e.length<2)&&e.startsWith('"')&&e.endsWith('"')?e.slice(1,-1):e}function rD(e){let t=0,r=e.length;for(;t<r;){let r=e.charCodeAt(t);if(32!==r&&9!==r)break;t++}for(;r>t;){let t=e.charCodeAt(r-1);if(32!==t&&9!==t)break;r--}return 0===t&&r===e.length?e:e.slice(t,r)}function rL(e){let t=new Map;if(e.length<2)return t;for(let r of e.split(";")){let e=r.indexOf("=");if(-1===e)continue;let n=rD(r.slice(0,e)),i=rC(rD(r.slice(e+1)));rO.test(n)&&rP.test(i)&&t.set(n,rI(i))}return t}var rz=e.i(858544);function r$(e,t,r){function n(r,n){if(r._zod||Object.defineProperty(r,"_zod",{value:{def:n,constr:o,traits:new Set},enumerable:!1}),r._zod.traits.has(e))return;r._zod.traits.add(e),t(r,n);let i=o.prototype,a=Object.keys(i);for(let e=0;e<a.length;e++){let t=a[e];t in r||(r[t]=i[t].bind(r))}}let i=r?.Parent??Object;class a extends i{}function o(e){var t;let i=r?.Parent?new a:this;for(let r of(n(i,e),(t=i._zod).deferred??(t.deferred=[]),i._zod.deferred))r();return i}return Object.defineProperty(a,"name",{value:e}),Object.defineProperty(o,"init",{value:n}),Object.defineProperty(o,Symbol.hasInstance,{value:t=>!!r?.Parent&&t instanceof r.Parent||t?._zod?.traits?.has(e)}),Object.defineProperty(o,"name",{value:e}),o}Symbol("zod_brand");class rN extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class rj extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name="ZodEncodeError"}}(h=globalThis).__zod_globalConfig??(h.__zod_globalConfig={});let rH=globalThis.__zod_globalConfig;function rB(e){return e&&Object.assign(rH,e),rH}function rV(e){let t=Object.values(e).filter(e=>"number"==typeof e);return Object.entries(e).filter(([e,r])=>-1===t.indexOf(+e)).map(([e,t])=>t)}function rM(e,t){return"bigint"==typeof t?t.toString():t}function rK(e){return{get value(){{let t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function rW(e){return null==e}function rq(e){let t=+!!e.startsWith("^"),r=e.endsWith("$")?e.length-1:e.length;return e.slice(t,r)}function rF(e,t){let r=e/t,n=Math.round(r),i=Number.EPSILON*Math.max(Math.abs(r),1);return Math.abs(r-n)<i?0:r-n}let rJ=Symbol("evaluating");function rZ(e,t,r){let n;Object.defineProperty(e,t,{get(){if(n!==rJ)return void 0===n&&(n=rJ,n=r()),n},set(r){Object.defineProperty(e,t,{value:r})},configurable:!0})}function rG(e,t,r){Object.defineProperty(e,t,{value:r,writable:!0,enumerable:!0,configurable:!0})}function rQ(...e){let t={};for(let r of e)Object.assign(t,Object.getOwnPropertyDescriptors(r));return Object.defineProperties({},t)}function rY(e){return JSON.stringify(e)}function rX(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}let r0="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function r1(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)}let r2=rK(()=>{if(rH.jitless||"u">typeof navigator&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{return Function(""),!0}catch(e){return!1}});function r6(e){if(!1===r1(e))return!1;let t=e.constructor;if(void 0===t||"function"!=typeof t)return!0;let r=t.prototype;return!1!==r1(r)&&!1!==Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")}let r5=new Set(["string","number","symbol"]),r8=new Set(["string","number","bigint","boolean","symbol","undefined"]);function r4(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function r3(e,t,r){let n=new e._zod.constr(t??e._zod.def);return(!t||r?.parent)&&(n._zod.parent=e),n}function r9(e){if(!e)return{};if("string"==typeof e)return{error:()=>e};if(e?.message!==void 0){if(e?.error!==void 0)throw Error("Cannot specify both `message` and `error` params");e.error=e.message}return(delete e.message,"string"==typeof e.error)?{...e,error:()=>e.error}:e}function r7(e){return"bigint"==typeof e?e.toString()+"n":"string"==typeof e?`"${e}"`:`${e}`}function ne(e){return Object.keys(e).filter(t=>"optional"===e[t]._zod.optin&&"optional"===e[t]._zod.optout)}let nt={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-0x80000000,0x7fffffff],uint32:[0,0xffffffff],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]},nr={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function nn(e,t=0){if(!0===e.aborted)return!0;for(let r=t;r<e.issues.length;r++)if(e.issues[r]?.continue!==!0)return!0;return!1}function ni(e,t=0){if(!0===e.aborted)return!0;for(let r=t;r<e.issues.length;r++)if(e.issues[r]?.continue===!1)return!0;return!1}function na(e,t){return t.map(t=>(t.path??(t.path=[]),t.path.unshift(e),t))}function no(e){return"string"==typeof e?e:e?.message}function ns(e,t,r){let n=e.message?e.message:no(e.inst?._zod.def?.error?.(e))??no(t?.error?.(e))??no(r.customError?.(e))??no(r.localeError?.(e))??"Invalid input",{inst:i,continue:a,input:o,...s}=e;return s.path??(s.path=[]),s.message=n,t?.reportInput&&(s.input=o),s}function nc(e){return e instanceof Set?"set":e instanceof Map?"map":e instanceof File?"file":"unknown"}function nl(e){return Array.isArray(e)?"array":"string"==typeof e?"string":"unknown"}function nd(...e){let[t,r,n]=e;return"string"==typeof t?{message:t,code:"custom",input:r,inst:n}:{...t}}function nu(e){let t=atob(e),r=new Uint8Array(t.length);for(let e=0;e<t.length;e++)r[e]=t.charCodeAt(e);return r}function np(e){let t="";for(let r=0;r<e.length;r++)t+=String.fromCharCode(e[r]);return btoa(t)}e.s(["BIGINT_FORMAT_RANGES",0,nr,"Class",0,class{constructor(...e){}},"NUMBER_FORMAT_RANGES",0,nt,"aborted",0,nn,"allowsEval",0,r2,"assert",0,function(e){},"assertEqual",0,function(e){return e},"assertIs",0,function(e){},"assertNever",0,function(e){throw Error("Unexpected value in exhaustive check")},"assertNotEqual",0,function(e){return e},"assignProp",0,rG,"base64ToUint8Array",0,nu,"base64urlToUint8Array",0,function(e){let t=e.replace(/-/g,"+").replace(/_/g,"/"),r="=".repeat((4-t.length%4)%4);return nu(t+r)},"cached",0,rK,"captureStackTrace",0,r0,"cleanEnum",0,function(e){return Object.entries(e).filter(([e,t])=>Number.isNaN(Number.parseInt(e,10))).map(e=>e[1])},"cleanRegex",0,rq,"clone",0,r3,"cloneDef",0,function(e){return rQ(e._zod.def)},"createTransparentProxy",0,function(e){let t;return new Proxy({},{get:(r,n,i)=>(t??(t=e()),Reflect.get(t,n,i)),set:(r,n,i,a)=>(t??(t=e()),Reflect.set(t,n,i,a)),has:(r,n)=>(t??(t=e()),Reflect.has(t,n)),deleteProperty:(r,n)=>(t??(t=e()),Reflect.deleteProperty(t,n)),ownKeys:r=>(t??(t=e()),Reflect.ownKeys(t)),getOwnPropertyDescriptor:(r,n)=>(t??(t=e()),Reflect.getOwnPropertyDescriptor(t,n)),defineProperty:(r,n,i)=>(t??(t=e()),Reflect.defineProperty(t,n,i))})},"defineLazy",0,rZ,"esc",0,rY,"escapeRegex",0,r4,"explicitlyAborted",0,ni,"extend",0,function(e,t){if(!r6(t))throw Error("Invalid input to extend: expected a plain object");let r=e._zod.def.checks;if(r&&r.length>0){let r=e._zod.def.shape;for(let e in t)if(void 0!==Object.getOwnPropertyDescriptor(r,e))throw Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}let n=rQ(e._zod.def,{get shape(){let r={...e._zod.def.shape,...t};return rG(this,"shape",r),r}});return r3(e,n)},"finalizeIssue",0,ns,"floatSafeRemainder",0,rF,"getElementAtPath",0,function(e,t){return t?t.reduce((e,t)=>e?.[t],e):e},"getEnumValues",0,rV,"getLengthableOrigin",0,nl,"getParsedType",0,e=>{let t=typeof e;switch(t){case"undefined":return"undefined";case"string":return"string";case"number":return Number.isNaN(e)?"nan":"number";case"boolean":return"boolean";case"function":return"function";case"bigint":return"bigint";case"symbol":return"symbol";case"object":if(Array.isArray(e))return"array";if(null===e)return"null";if(e.then&&"function"==typeof e.then&&e.catch&&"function"==typeof e.catch)return"promise";if("u">typeof Map&&e instanceof Map)return"map";if("u">typeof Set&&e instanceof Set)return"set";if("u">typeof Date&&e instanceof Date)return"date";if("u">typeof File&&e instanceof File)return"file";return"object";default:throw Error(`Unknown data type: ${t}`)}},"getSizableOrigin",0,nc,"hexToUint8Array",0,function(e){let t=e.replace(/^0x/,"");if(t.length%2!=0)throw Error("Invalid hex string length");let r=new Uint8Array(t.length/2);for(let e=0;e<t.length;e+=2)r[e/2]=Number.parseInt(t.slice(e,e+2),16);return r},"isObject",0,r1,"isPlainObject",0,r6,"issue",0,nd,"joinValues",0,function(e,t="|"){return e.map(e=>r7(e)).join(t)},"jsonStringifyReplacer",0,rM,"merge",0,function(e,t){if(e._zod.def.checks?.length)throw Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");let r=rQ(e._zod.def,{get shape(){let r={...e._zod.def.shape,...t._zod.def.shape};return rG(this,"shape",r),r},get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]});return r3(e,r)},"mergeDefs",0,rQ,"normalizeParams",0,r9,"nullish",0,rW,"numKeys",0,function(e){let t=0;for(let r in e)Object.prototype.hasOwnProperty.call(e,r)&&t++;return t},"objectClone",0,function(e){return Object.create(Object.getPrototypeOf(e),Object.getOwnPropertyDescriptors(e))},"omit",0,function(e,t){let r=e._zod.def,n=r.checks;if(n&&n.length>0)throw Error(".omit() cannot be used on object schemas containing refinements");let i=rQ(e._zod.def,{get shape(){let n={...e._zod.def.shape};for(let e in t){if(!(e in r.shape))throw Error(`Unrecognized key: "${e}"`);t[e]&&delete n[e]}return rG(this,"shape",n),n},checks:[]});return r3(e,i)},"optionalKeys",0,ne,"parsedType",0,function(e){let t=typeof e;switch(t){case"number":return Number.isNaN(e)?"nan":"number";case"object":if(null===e)return"null";if(Array.isArray(e))return"array";if(e&&Object.getPrototypeOf(e)!==Object.prototype&&"constructor"in e&&e.constructor)return e.constructor.name}return t},"partial",0,function(e,t,r){let n=t._zod.def.checks;if(n&&n.length>0)throw Error(".partial() cannot be used on object schemas containing refinements");let i=rQ(t._zod.def,{get shape(){let n=t._zod.def.shape,i={...n};if(r)for(let t in r){if(!(t in n))throw Error(`Unrecognized key: "${t}"`);r[t]&&(i[t]=e?new e({type:"optional",innerType:n[t]}):n[t])}else for(let t in n)i[t]=e?new e({type:"optional",innerType:n[t]}):n[t];return rG(this,"shape",i),i},checks:[]});return r3(t,i)},"pick",0,function(e,t){let r=e._zod.def,n=r.checks;if(n&&n.length>0)throw Error(".pick() cannot be used on object schemas containing refinements");let i=rQ(e._zod.def,{get shape(){let e={};for(let n in t){if(!(n in r.shape))throw Error(`Unrecognized key: "${n}"`);t[n]&&(e[n]=r.shape[n])}return rG(this,"shape",e),e},checks:[]});return r3(e,i)},"prefixIssues",0,na,"primitiveTypes",0,r8,"promiseAllObject",0,function(e){let t=Object.keys(e);return Promise.all(t.map(t=>e[t])).then(e=>{let r={};for(let n=0;n<t.length;n++)r[t[n]]=e[n];return r})},"propertyKeyTypes",0,r5,"randomString",0,function(e=10){let t="abcdefghijklmnopqrstuvwxyz",r="";for(let n=0;n<e;n++)r+=t[Math.floor(Math.random()*t.length)];return r},"required",0,function(e,t,r){let n=rQ(t._zod.def,{get shape(){let n=t._zod.def.shape,i={...n};if(r)for(let t in r){if(!(t in i))throw Error(`Unrecognized key: "${t}"`);r[t]&&(i[t]=new e({type:"nonoptional",innerType:n[t]}))}else for(let t in n)i[t]=new e({type:"nonoptional",innerType:n[t]});return rG(this,"shape",i),i}});return r3(t,n)},"safeExtend",0,function(e,t){if(!r6(t))throw Error("Invalid input to safeExtend: expected a plain object");let r=rQ(e._zod.def,{get shape(){let r={...e._zod.def.shape,...t};return rG(this,"shape",r),r}});return r3(e,r)},"shallowClone",0,function(e){return r6(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e},"slugify",0,rX,"stringifyPrimitive",0,r7,"uint8ArrayToBase64",0,np,"uint8ArrayToBase64url",0,function(e){return np(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")},"uint8ArrayToHex",0,function(e){return Array.from(e).map(e=>e.toString(16).padStart(2,"0")).join("")},"unwrapMessage",0,no],202721);let nf=/^[cC][0-9a-z]{6,}$/,nh=/^[0-9a-z]+$/,nm=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,ny=/^[0-9a-vA-V]{20}$/,ng=/^[A-Za-z0-9]{27}$/,nw=/^[a-zA-Z0-9_-]{21}$/,nb=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,nA=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,nE=e=>e?RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,nv=nE(4),nk=nE(6),n_=nE(7),nS=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,nx=/^[^\s@"]{1,64}@[^\s@]{1,255}$/u;function nT(){return RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")}let nR=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,nI=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,nU=e=>{let t=r4(e??":");return RegExp(`^(?:[0-9A-F]{2}${t}){5}[0-9A-F]{2}$|^(?:[0-9a-f]{2}${t}){5}[0-9a-f]{2}$`)},nO=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,nP=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,nC=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,nD=/^[A-Za-z0-9_-]*$/,nL=/^https?$/,nz=/^\+[1-9]\d{6,14}$/,n$="(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))",nN=RegExp(`^${n$}$`);function nj(e){let t="(?:[01]\\d|2[0-3]):[0-5]\\d";return"number"==typeof e.precision?-1===e.precision?`${t}`:0===e.precision?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function nH(e){return RegExp(`^${nj(e)}$`)}function nB(e){let t=nj({precision:e.precision}),r=["Z"];e.local&&r.push(""),e.offset&&r.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");let n=`${t}(?:${r.join("|")})`;return RegExp(`^${n$}T(?:${n})$`)}let nV=e=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return RegExp(`^${t}$`)},nM=/^-?\d+n?$/,nK=/^-?\d+$/,nW=/^-?\d+(?:\.\d+)?$/,nq=/^(?:true|false)$/i,nF=/^null$/i,nJ=/^undefined$/i,nZ=/^[^A-Z]*$/,nG=/^[^a-z]*$/;function nQ(e,t){return RegExp(`^[A-Za-z0-9+/]{${e}}${t}$`)}function nY(e){return RegExp(`^[A-Za-z0-9_-]{${e}}$`)}let nX=nQ(22,"=="),n0=nY(22),n1=nQ(27,"="),n2=nY(27),n6=nQ(43,"="),n5=nY(43),n8=nQ(64,""),n4=nY(64),n3=nQ(86,"=="),n9=nY(86);e.s(["base64",0,nC,"base64url",0,nD,"bigint",0,nM,"boolean",0,nq,"browserEmail",0,/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/,"cidrv4",0,nO,"cidrv6",0,nP,"cuid",0,nf,"cuid2",0,nh,"date",0,nN,"datetime",0,nB,"domain",0,/^([a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,}$/,"duration",0,nb,"e164",0,nz,"email",0,nS,"emoji",0,nT,"extendedDuration",0,/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,"guid",0,nA,"hex",0,/^[0-9a-fA-F]*$/,"hostname",0,/^(?=.{1,253}\.?$)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[-0-9a-zA-Z]{0,61}[0-9a-zA-Z])?)*\.?$/,"html5Email",0,/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/,"httpProtocol",0,nL,"idnEmail",0,nx,"integer",0,nK,"ipv4",0,nR,"ipv6",0,nI,"ksuid",0,ng,"lowercase",0,nZ,"mac",0,nU,"md5_base64",0,nX,"md5_base64url",0,n0,"md5_hex",0,/^[0-9a-fA-F]{32}$/,"nanoid",0,nw,"null",0,nF,"number",0,nW,"rfc5322Email",0,/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/,"sha1_base64",0,n1,"sha1_base64url",0,n2,"sha1_hex",0,/^[0-9a-fA-F]{40}$/,"sha256_base64",0,n6,"sha256_base64url",0,n5,"sha256_hex",0,/^[0-9a-fA-F]{64}$/,"sha384_base64",0,n8,"sha384_base64url",0,n4,"sha384_hex",0,/^[0-9a-fA-F]{96}$/,"sha512_base64",0,n3,"sha512_base64url",0,n9,"sha512_hex",0,/^[0-9a-fA-F]{128}$/,"string",0,nV,"time",0,nH,"ulid",0,nm,"undefined",0,nJ,"unicodeEmail",0,nx,"uppercase",0,nG,"uuid",0,nE,"uuid4",0,nv,"uuid6",0,nk,"uuid7",0,n_,"xid",0,ny],110107);let n7=r$("$ZodCheck",(e,t)=>{var r;e._zod??(e._zod={}),e._zod.def=t,(r=e._zod).onattach??(r.onattach=[])}),ie={number:"number",bigint:"bigint",object:"date"},it=r$("$ZodCheckLessThan",(e,t)=>{n7.init(e,t);let r=ie[typeof t.value];e._zod.onattach.push(e=>{let r=e._zod.bag,n=(t.inclusive?r.maximum:r.exclusiveMaximum)??1/0;t.value<n&&(t.inclusive?r.maximum=t.value:r.exclusiveMaximum=t.value)}),e._zod.check=n=>{(t.inclusive?n.value<=t.value:n.value<t.value)||n.issues.push({origin:r,code:"too_big",maximum:"object"==typeof t.value?t.value.getTime():t.value,input:n.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),ir=r$("$ZodCheckGreaterThan",(e,t)=>{n7.init(e,t);let r=ie[typeof t.value];e._zod.onattach.push(e=>{let r=e._zod.bag,n=(t.inclusive?r.minimum:r.exclusiveMinimum)??-1/0;t.value>n&&(t.inclusive?r.minimum=t.value:r.exclusiveMinimum=t.value)}),e._zod.check=n=>{(t.inclusive?n.value>=t.value:n.value>t.value)||n.issues.push({origin:r,code:"too_small",minimum:"object"==typeof t.value?t.value.getTime():t.value,input:n.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),ii=r$("$ZodCheckMultipleOf",(e,t)=>{n7.init(e,t),e._zod.onattach.push(e=>{var r;(r=e._zod.bag).multipleOf??(r.multipleOf=t.value)}),e._zod.check=r=>{if(typeof r.value!=typeof t.value)throw Error("Cannot mix number and bigint in multiple_of check.");("bigint"==typeof r.value?r.value%t.value===BigInt(0):0===rF(r.value,t.value))||r.issues.push({origin:typeof r.value,code:"not_multiple_of",divisor:t.value,input:r.value,inst:e,continue:!t.abort})}}),ia=r$("$ZodCheckNumberFormat",(e,t)=>{n7.init(e,t),t.format=t.format||"float64";let r=t.format?.includes("int"),n=r?"int":"number",[i,a]=nt[t.format];e._zod.onattach.push(e=>{let n=e._zod.bag;n.format=t.format,n.minimum=i,n.maximum=a,r&&(n.pattern=nK)}),e._zod.check=o=>{let s=o.value;if(r){if(!Number.isInteger(s))return void o.issues.push({expected:n,format:t.format,code:"invalid_type",continue:!1,input:s,inst:e});if(!Number.isSafeInteger(s))return void(s>0?o.issues.push({input:s,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:n,inclusive:!0,continue:!t.abort}):o.issues.push({input:s,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:n,inclusive:!0,continue:!t.abort}))}s<i&&o.issues.push({origin:"number",input:s,code:"too_small",minimum:i,inclusive:!0,inst:e,continue:!t.abort}),s>a&&o.issues.push({origin:"number",input:s,code:"too_big",maximum:a,inclusive:!0,inst:e,continue:!t.abort})}}),io=r$("$ZodCheckBigIntFormat",(e,t)=>{n7.init(e,t);let[r,n]=nr[t.format];e._zod.onattach.push(e=>{let i=e._zod.bag;i.format=t.format,i.minimum=r,i.maximum=n}),e._zod.check=i=>{let a=i.value;a<r&&i.issues.push({origin:"bigint",input:a,code:"too_small",minimum:r,inclusive:!0,inst:e,continue:!t.abort}),a>n&&i.issues.push({origin:"bigint",input:a,code:"too_big",maximum:n,inclusive:!0,inst:e,continue:!t.abort})}}),is=r$("$ZodCheckMaxSize",(e,t)=>{var r;n7.init(e,t),(r=e._zod.def).when??(r.when=e=>{let t=e.value;return!rW(t)&&void 0!==t.size}),e._zod.onattach.push(e=>{let r=e._zod.bag.maximum??1/0;t.maximum<r&&(e._zod.bag.maximum=t.maximum)}),e._zod.check=r=>{let n=r.value;n.size<=t.maximum||r.issues.push({origin:nc(n),code:"too_big",maximum:t.maximum,inclusive:!0,input:n,inst:e,continue:!t.abort})}}),ic=r$("$ZodCheckMinSize",(e,t)=>{var r;n7.init(e,t),(r=e._zod.def).when??(r.when=e=>{let t=e.value;return!rW(t)&&void 0!==t.size}),e._zod.onattach.push(e=>{let r=e._zod.bag.minimum??-1/0;t.minimum>r&&(e._zod.bag.minimum=t.minimum)}),e._zod.check=r=>{let n=r.value;n.size>=t.minimum||r.issues.push({origin:nc(n),code:"too_small",minimum:t.minimum,inclusive:!0,input:n,inst:e,continue:!t.abort})}}),il=r$("$ZodCheckSizeEquals",(e,t)=>{var r;n7.init(e,t),(r=e._zod.def).when??(r.when=e=>{let t=e.value;return!rW(t)&&void 0!==t.size}),e._zod.onattach.push(e=>{let r=e._zod.bag;r.minimum=t.size,r.maximum=t.size,r.size=t.size}),e._zod.check=r=>{let n=r.value,i=n.size;if(i===t.size)return;let a=i>t.size;r.issues.push({origin:nc(n),...a?{code:"too_big",maximum:t.size}:{code:"too_small",minimum:t.size},inclusive:!0,exact:!0,input:r.value,inst:e,continue:!t.abort})}}),id=r$("$ZodCheckMaxLength",(e,t)=>{var r;n7.init(e,t),(r=e._zod.def).when??(r.when=e=>{let t=e.value;return!rW(t)&&void 0!==t.length}),e._zod.onattach.push(e=>{let r=e._zod.bag.maximum??1/0;t.maximum<r&&(e._zod.bag.maximum=t.maximum)}),e._zod.check=r=>{let n=r.value;if(n.length<=t.maximum)return;let i=nl(n);r.issues.push({origin:i,code:"too_big",maximum:t.maximum,inclusive:!0,input:n,inst:e,continue:!t.abort})}}),iu=r$("$ZodCheckMinLength",(e,t)=>{var r;n7.init(e,t),(r=e._zod.def).when??(r.when=e=>{let t=e.value;return!rW(t)&&void 0!==t.length}),e._zod.onattach.push(e=>{let r=e._zod.bag.minimum??-1/0;t.minimum>r&&(e._zod.bag.minimum=t.minimum)}),e._zod.check=r=>{let n=r.value;if(n.length>=t.minimum)return;let i=nl(n);r.issues.push({origin:i,code:"too_small",minimum:t.minimum,inclusive:!0,input:n,inst:e,continue:!t.abort})}}),ip=r$("$ZodCheckLengthEquals",(e,t)=>{var r;n7.init(e,t),(r=e._zod.def).when??(r.when=e=>{let t=e.value;return!rW(t)&&void 0!==t.length}),e._zod.onattach.push(e=>{let r=e._zod.bag;r.minimum=t.length,r.maximum=t.length,r.length=t.length}),e._zod.check=r=>{let n=r.value,i=n.length;if(i===t.length)return;let a=nl(n),o=i>t.length;r.issues.push({origin:a,...o?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:r.value,inst:e,continue:!t.abort})}}),ih=r$("$ZodCheckStringFormat",(e,t)=>{var r,n;n7.init(e,t),e._zod.onattach.push(e=>{let r=e._zod.bag;r.format=t.format,t.pattern&&(r.patterns??(r.patterns=new Set),r.patterns.add(t.pattern))}),t.pattern?(r=e._zod).check??(r.check=r=>{t.pattern.lastIndex=0,t.pattern.test(r.value)||r.issues.push({origin:"string",code:"invalid_format",format:t.format,input:r.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(n=e._zod).check??(n.check=()=>{})}),im=r$("$ZodCheckRegex",(e,t)=>{ih.init(e,t),e._zod.check=r=>{t.pattern.lastIndex=0,t.pattern.test(r.value)||r.issues.push({origin:"string",code:"invalid_format",format:"regex",input:r.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),iy=r$("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=nZ),ih.init(e,t)}),ig=r$("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=nG),ih.init(e,t)}),iw=r$("$ZodCheckIncludes",(e,t)=>{n7.init(e,t);let r=r4(t.includes),n=new RegExp("number"==typeof t.position?`^.{${t.position}}${r}`:r);t.pattern=n,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??(t.patterns=new Set),t.patterns.add(n)}),e._zod.check=r=>{r.value.includes(t.includes,t.position)||r.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:r.value,inst:e,continue:!t.abort})}}),ib=r$("$ZodCheckStartsWith",(e,t)=>{n7.init(e,t);let r=RegExp(`^${r4(t.prefix)}.*`);t.pattern??(t.pattern=r),e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??(t.patterns=new Set),t.patterns.add(r)}),e._zod.check=r=>{r.value.startsWith(t.prefix)||r.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:r.value,inst:e,continue:!t.abort})}}),iA=r$("$ZodCheckEndsWith",(e,t)=>{n7.init(e,t);let r=RegExp(`.*${r4(t.suffix)}$`);t.pattern??(t.pattern=r),e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??(t.patterns=new Set),t.patterns.add(r)}),e._zod.check=r=>{r.value.endsWith(t.suffix)||r.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:r.value,inst:e,continue:!t.abort})}});(e,t)=>{n7.init(e,t);let r=new Set(t.mime);e._zod.onattach.push(e=>{e._zod.bag.mime=t.mime}),e._zod.check=n=>{r.has(n.value.type)||n.issues.push({code:"invalid_value",values:t.mime,input:n.value.type,inst:e,continue:!t.abort})}};let iE=r$("$ZodCheckOverwrite",(e,t)=>{n7.init(e,t),e._zod.check=e=>{e.value=t.tx(e.value)}});class iv{constructor(e=[]){this.content=[],this.indent=0,this&&(this.args=e)}indented(e){this.indent+=1,e(this),this.indent-=1}write(e){if("function"==typeof e){e(this,{execution:"sync"}),e(this,{execution:"async"});return}let t=e.split("\n").filter(e=>e),r=Math.min(...t.map(e=>e.length-e.trimStart().length));for(let e of t.map(e=>e.slice(r)).map(e=>" ".repeat(2*this.indent)+e))this.content.push(e)}compile(){return Function(...this?.args,[...(this?.content??[""]).map(e=>` ${e}`)].join("\n"))}}let ik=(e,t)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),e.message=JSON.stringify(t,rM,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},i_=r$("$ZodError",ik),iS=r$("$ZodError",ik,{Parent:Error}),ix=e=>(t,r,n,i)=>{let a=n?{...n,async:!1}:{async:!1},o=t._zod.run({value:r,issues:[]},a);if(o instanceof Promise)throw new rN;if(o.issues.length){let t=new(i?.Err??e)(o.issues.map(e=>ns(e,a,rB())));throw r0(t,i?.callee),t}return o.value},iT=ix(iS),iR=e=>async(t,r,n,i)=>{let a=n?{...n,async:!0}:{async:!0},o=t._zod.run({value:r,issues:[]},a);if(o instanceof Promise&&(o=await o),o.issues.length){let t=new(i?.Err??e)(o.issues.map(e=>ns(e,a,rB())));throw r0(t,i?.callee),t}return o.value},iI=iR(iS),iU=e=>(t,r,n)=>{let i=n?{...n,async:!1}:{async:!1},a=t._zod.run({value:r,issues:[]},i);if(a instanceof Promise)throw new rN;return a.issues.length?{success:!1,error:new(e??i_)(a.issues.map(e=>ns(e,i,rB())))}:{success:!0,data:a.value}},iO=iU(iS),iP=e=>async(t,r,n)=>{let i=n?{...n,async:!0}:{async:!0},a=t._zod.run({value:r,issues:[]},i);return a instanceof Promise&&(a=await a),a.issues.length?{success:!1,error:new e(a.issues.map(e=>ns(e,i,rB())))}:{success:!0,data:a.value}},iC=iP(iS),iD={major:4,minor:4,patch:3},iL=r$("$ZodType",(e,t)=>{var r;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=iD;let n=[...e._zod.def.checks??[]];for(let t of(e._zod.traits.has("$ZodCheck")&&n.unshift(e),n))for(let r of t._zod.onattach)r(e);if(0===n.length)(r=e._zod).deferred??(r.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let t=(e,t,r)=>{let n,i=nn(e);for(let a of t){if(a._zod.def.when){if(ni(e)||!a._zod.def.when(e))continue}else if(i)continue;let t=e.issues.length,o=a._zod.check(e);if(o instanceof Promise&&r?.async===!1)throw new rN;if(n||o instanceof Promise)n=(n??Promise.resolve()).then(async()=>{await o,e.issues.length!==t&&(i||(i=nn(e,t)))});else{if(e.issues.length===t)continue;i||(i=nn(e,t))}}return n?n.then(()=>e):e},r=(r,i,a)=>{if(nn(r))return r.aborted=!0,r;let o=t(i,n,a);if(o instanceof Promise){if(!1===a.async)throw new rN;return o.then(t=>e._zod.parse(t,a))}return e._zod.parse(o,a)};e._zod.run=(i,a)=>{if(a.skipChecks)return e._zod.parse(i,a);if("backward"===a.direction){let t=e._zod.parse({value:i.value,issues:[]},{...a,skipChecks:!0});return t instanceof Promise?t.then(e=>r(e,i,a)):r(t,i,a)}let o=e._zod.parse(i,a);if(o instanceof Promise){if(!1===a.async)throw new rN;return o.then(e=>t(e,n,a))}return t(o,n,a)}}rZ(e,"~standard",()=>({validate:t=>{try{let r=iO(e,t);return r.success?{value:r.data}:{issues:r.error?.issues}}catch(r){return iC(e,t).then(e=>e.success?{value:e.data}:{issues:e.error?.issues})}},vendor:"zod",version:1}))}),iz=r$("$ZodString",(e,t)=>{iL.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??nV(e._zod.bag),e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=String(r.value)}catch(e){}return"string"==typeof r.value||r.issues.push({expected:"string",code:"invalid_type",input:r.value,inst:e}),r}}),i$=r$("$ZodStringFormat",(e,t)=>{ih.init(e,t),iz.init(e,t)}),iN=r$("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=nA),i$.init(e,t)}),ij=r$("$ZodUUID",(e,t)=>{if(t.version){let e={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(void 0===e)throw Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=nE(e))}else t.pattern??(t.pattern=nE());i$.init(e,t)}),iH=r$("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=nS),i$.init(e,t)}),iB=r$("$ZodURL",(e,t)=>{i$.init(e,t),e._zod.check=r=>{try{let n=r.value.trim();if(!t.normalize&&t.protocol?.source===nL.source&&!/^https?:\/\//i.test(n))return void r.issues.push({code:"invalid_format",format:"url",note:"Invalid URL format",input:r.value,inst:e,continue:!t.abort});let i=new URL(n);t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(i.hostname)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:t.hostname.source,input:r.value,inst:e,continue:!t.abort})),t.protocol&&(t.protocol.lastIndex=0,t.protocol.test(i.protocol.endsWith(":")?i.protocol.slice(0,-1):i.protocol)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:r.value,inst:e,continue:!t.abort})),t.normalize?r.value=i.href:r.value=n;return}catch(n){r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:e,continue:!t.abort})}}}),iV=r$("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=nT()),i$.init(e,t)}),iM=r$("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=nw),i$.init(e,t)}),iK=r$("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=nf),i$.init(e,t)}),iW=r$("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=nh),i$.init(e,t)}),iq=r$("$ZodULID",(e,t)=>{t.pattern??(t.pattern=nm),i$.init(e,t)}),iF=r$("$ZodXID",(e,t)=>{t.pattern??(t.pattern=ny),i$.init(e,t)}),iJ=r$("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=ng),i$.init(e,t)}),iZ=r$("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=nB(t)),i$.init(e,t)}),iG=r$("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=nN),i$.init(e,t)}),iQ=r$("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=nH(t)),i$.init(e,t)}),iY=r$("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=nb),i$.init(e,t)}),iX=r$("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=nR),i$.init(e,t),e._zod.bag.format="ipv4"}),i0=r$("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=nI),i$.init(e,t),e._zod.bag.format="ipv6",e._zod.check=r=>{try{new URL(`http://[${r.value}]`)}catch{r.issues.push({code:"invalid_format",format:"ipv6",input:r.value,inst:e,continue:!t.abort})}}}),i1=((e,t)=>{t.pattern??(t.pattern=nU(t.delimiter)),i$.init(e,t),e._zod.bag.format="mac"},r$("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=nO),i$.init(e,t)})),i2=r$("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=nP),i$.init(e,t),e._zod.check=r=>{let n=r.value.split("/");try{if(2!==n.length)throw Error();let[e,t]=n;if(!t)throw Error();let r=Number(t);if(`${r}`!==t||r<0||r>128)throw Error();new URL(`http://[${e}]`)}catch{r.issues.push({code:"invalid_format",format:"cidrv6",input:r.value,inst:e,continue:!t.abort})}}});function i6(e){if(""===e)return!0;if(/\s/.test(e)||e.length%4!=0)return!1;try{return atob(e),!0}catch{return!1}}let i5=r$("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=nC),i$.init(e,t),e._zod.bag.contentEncoding="base64",e._zod.check=r=>{i6(r.value)||r.issues.push({code:"invalid_format",format:"base64",input:r.value,inst:e,continue:!t.abort})}}),i8=r$("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=nD),i$.init(e,t),e._zod.bag.contentEncoding="base64url",e._zod.check=r=>{!function(e){if(!nD.test(e))return!1;let t=e.replace(/[-_]/g,e=>"-"===e?"+":"/");return i6(t.padEnd(4*Math.ceil(t.length/4),"="))}(r.value)&&r.issues.push({code:"invalid_format",format:"base64url",input:r.value,inst:e,continue:!t.abort})}}),i4=r$("$ZodE164",(e,t)=>{t.pattern??(t.pattern=nz),i$.init(e,t)}),i3=r$("$ZodJWT",(e,t)=>{i$.init(e,t),e._zod.check=r=>{!function(e,t=null){try{let r=e.split(".");if(3!==r.length)return!1;let[n]=r;if(!n)return!1;let i=JSON.parse(atob(n));if("typ"in i&&i?.typ!=="JWT"||!i.alg||t&&(!("alg"in i)||i.alg!==t))return!1;return!0}catch{return!1}}(r.value,t.alg)&&r.issues.push({code:"invalid_format",format:"jwt",input:r.value,inst:e,continue:!t.abort})}}),i9=((e,t)=>{i$.init(e,t),e._zod.check=r=>{t.fn(r.value)||r.issues.push({code:"invalid_format",format:t.format,input:r.value,inst:e,continue:!t.abort})}},r$("$ZodNumber",(e,t)=>{iL.init(e,t),e._zod.pattern=e._zod.bag.pattern??nW,e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=Number(r.value)}catch(e){}let i=r.value;if("number"==typeof i&&!Number.isNaN(i)&&Number.isFinite(i))return r;let a="number"==typeof i?Number.isNaN(i)?"NaN":Number.isFinite(i)?void 0:"Infinity":void 0;return r.issues.push({expected:"number",code:"invalid_type",input:i,inst:e,...a?{received:a}:{}}),r}})),i7=r$("$ZodNumberFormat",(e,t)=>{ia.init(e,t),i9.init(e,t)}),ae=r$("$ZodBoolean",(e,t)=>{iL.init(e,t),e._zod.pattern=nq,e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=!!r.value}catch(e){}let i=r.value;return"boolean"==typeof i||r.issues.push({expected:"boolean",code:"invalid_type",input:i,inst:e}),r}}),at=r$("$ZodBigInt",(e,t)=>{iL.init(e,t),e._zod.pattern=nM,e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=BigInt(r.value)}catch(e){}return"bigint"==typeof r.value||r.issues.push({expected:"bigint",code:"invalid_type",input:r.value,inst:e}),r}}),ar=((e,t)=>{io.init(e,t),at.init(e,t)},r$("$ZodAny",(e,t)=>{iL.init(e,t),e._zod.parse=e=>e})),an=r$("$ZodUnknown",(e,t)=>{iL.init(e,t),e._zod.parse=e=>e}),ai=r$("$ZodNever",(e,t)=>{iL.init(e,t),e._zod.parse=(t,r)=>(t.issues.push({expected:"never",code:"invalid_type",input:t.value,inst:e}),t)}),aa=((e,t)=>{iL.init(e,t),e._zod.parse=(t,r)=>{let n=t.value;return void 0===n||t.issues.push({expected:"void",code:"invalid_type",input:n,inst:e}),t}},r$("$ZodDate",(e,t)=>{iL.init(e,t),e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=new Date(r.value)}catch(e){}let i=r.value,a=i instanceof Date;return a&&!Number.isNaN(i.getTime())||r.issues.push({expected:"date",code:"invalid_type",input:i,...a?{received:"Invalid Date"}:{},inst:e}),r}}));function ao(e,t,r){e.issues.length&&t.issues.push(...na(r,e.issues)),t.value[r]=e.value}let as=r$("$ZodArray",(e,t)=>{iL.init(e,t),e._zod.parse=(r,n)=>{let i=r.value;if(!Array.isArray(i))return r.issues.push({expected:"array",code:"invalid_type",input:i,inst:e}),r;r.value=Array(i.length);let a=[];for(let e=0;e<i.length;e++){let o=i[e],s=t.element._zod.run({value:o,issues:[]},n);s instanceof Promise?a.push(s.then(t=>ao(t,r,e))):ao(s,r,e)}return a.length?Promise.all(a).then(()=>r):r}});function ac(e,t,r,n,i,a){let o=r in n;if(e.issues.length){if(i&&a&&!o)return;t.issues.push(...na(r,e.issues))}if(!o&&!i){e.issues.length||t.issues.push({code:"invalid_type",expected:"nonoptional",input:void 0,path:[r]});return}void 0===e.value?o&&(t.value[r]=void 0):t.value[r]=e.value}function al(e){let t=Object.keys(e.shape);for(let r of t)if(!e.shape?.[r]?._zod?.traits?.has("$ZodType"))throw Error(`Invalid element at key "${r}": expected a Zod schema`);let r=ne(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(r)}}function ad(e,t,r,n,i,a){let o=[],s=i.keySet,c=i.catchall._zod,l=c.def.type,d="optional"===c.optin,u="optional"===c.optout;for(let i in t){if("__proto__"===i||s.has(i))continue;if("never"===l){o.push(i);continue}let a=c.run({value:t[i],issues:[]},n);a instanceof Promise?e.push(a.then(e=>ac(e,r,i,t,d,u))):ac(a,r,i,t,d,u)}return(o.length&&r.issues.push({code:"unrecognized_keys",keys:o,input:t,inst:a}),e.length)?Promise.all(e).then(()=>r):r}let au=r$("$ZodObject",(e,t)=>{let r;iL.init(e,t);let n=Object.getOwnPropertyDescriptor(t,"shape");if(!n?.get){let e=t.shape;Object.defineProperty(t,"shape",{get:()=>{let r={...e};return Object.defineProperty(t,"shape",{value:r}),r}})}let i=rK(()=>al(t));rZ(e._zod,"propValues",()=>{let e=t.shape,r={};for(let t in e){let n=e[t]._zod;if(n.values)for(let e of(r[t]??(r[t]=new Set),n.values))r[t].add(e)}return r});let a=t.catchall;e._zod.parse=(t,n)=>{r??(r=i.value);let o=t.value;if(!r1(o))return t.issues.push({expected:"object",code:"invalid_type",input:o,inst:e}),t;t.value={};let s=[],c=r.shape;for(let e of r.keys){let r=c[e],i="optional"===r._zod.optin,a="optional"===r._zod.optout,l=r._zod.run({value:o[e],issues:[]},n);l instanceof Promise?s.push(l.then(r=>ac(r,t,e,o,i,a))):ac(l,t,e,o,i,a)}return a?ad(s,o,t,n,i.value,e):s.length?Promise.all(s).then(()=>t):t}}),ap=r$("$ZodObjectJIT",(e,t)=>{let r,n;au.init(e,t);let i=e._zod.parse,a=rK(()=>al(t)),o=!rH.jitless,s=o&&r2.value,c=t.catchall;e._zod.parse=(l,d)=>{n??(n=a.value);let u=l.value;return r1(u)?o&&s&&d?.async===!1&&!0!==d.jitless?(r||(r=(e=>{let t=new iv(["shape","payload","ctx"]),r=a.value,n=e=>{let t=rY(e);return`shape[${t}]._zod.run({ value: input[${t}], issues: [] }, ctx)`};t.write("const input = payload.value;");let i=Object.create(null),o=0;for(let e of r.keys)i[e]=`key_${o++}`;for(let a of(t.write("const newResult = {};"),r.keys)){let r=i[a],o=rY(a),s=e[a],c=s?._zod?.optin==="optional",l=s?._zod?.optout==="optional";t.write(`const ${r} = ${n(a)};`),c&&l?t.write(`
2
2
  if (${r}.issues.length) {
3
3
  if (${o} in input) {
4
4
  payload.issues = payload.issues.concat(${r}.issues.map(iss => ({
@@ -1,3 +1,3 @@
1
- module.exports=[242663,s=>{"use strict";s.s([])}];
1
+ module.exports=[158493,s=>{"use strict";s.s([])}];
2
2
 
3
3
  //# sourceMappingURL=_next-internal_server_app_api_system_workspaces_%5Bid%5D_open_route_actions_1087xu7.js.map
@@ -0,0 +1,3 @@
1
+ module.exports=[323612,s=>{"use strict";s.s([])}];
2
+
3
+ //# sourceMappingURL=_next-internal_server_app_api_wiki_git-branches_route_actions_05b396c.js.map