wiki-viewer 2.8.0 → 2.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (297) hide show
  1. package/.next/standalone/.next/BUILD_ID +1 -1
  2. package/.next/standalone/.next/build-manifest.json +5 -5
  3. package/.next/standalone/.next/prerender-manifest.json +3 -3
  4. package/.next/standalone/.next/required-server-files.json +4 -4
  5. package/.next/standalone/.next/server/app/_global-error/page/build-manifest.json +2 -2
  6. package/.next/standalone/.next/server/app/_global-error.html +1 -1
  7. package/.next/standalone/.next/server/app/_global-error.rsc +1 -1
  8. package/.next/standalone/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +1 -1
  9. package/.next/standalone/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
  10. package/.next/standalone/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
  11. package/.next/standalone/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
  12. package/.next/standalone/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  13. package/.next/standalone/.next/server/app/_not-found/page/build-manifest.json +2 -2
  14. package/.next/standalone/.next/server/app/api/agent/activity/route.js +7 -7
  15. package/.next/standalone/.next/server/app/api/agent/activity/route.js.nft.json +1 -1
  16. package/.next/standalone/.next/server/app/api/agent/admin/agents/[agentId]/revoke/route.js +6 -6
  17. package/.next/standalone/.next/server/app/api/agent/admin/agents/[agentId]/revoke/route.js.nft.json +1 -1
  18. package/.next/standalone/.next/server/app/api/agent/admin/agents/route.js +6 -6
  19. package/.next/standalone/.next/server/app/api/agent/admin/agents/route.js.nft.json +1 -1
  20. package/.next/standalone/.next/server/app/api/agent/admin/registrations/[regId]/approve/route.js +7 -7
  21. package/.next/standalone/.next/server/app/api/agent/admin/registrations/[regId]/approve/route.js.nft.json +1 -1
  22. package/.next/standalone/.next/server/app/api/agent/admin/registrations/[regId]/deny/route.js +7 -7
  23. package/.next/standalone/.next/server/app/api/agent/admin/registrations/[regId]/deny/route.js.nft.json +1 -1
  24. package/.next/standalone/.next/server/app/api/agent/admin/registrations/route.js +7 -7
  25. package/.next/standalone/.next/server/app/api/agent/admin/registrations/route.js.nft.json +1 -1
  26. package/.next/standalone/.next/server/app/api/agent/events/[...path]/route.js +7 -7
  27. package/.next/standalone/.next/server/app/api/agent/events/[...path]/route.js.nft.json +1 -1
  28. package/.next/standalone/.next/server/app/api/agent/files/[...path]/route.js +8 -8
  29. package/.next/standalone/.next/server/app/api/agent/files/[...path]/route.js.nft.json +1 -1
  30. package/.next/standalone/.next/server/app/api/agent/fs/file/[...path]/route.js +8 -8
  31. package/.next/standalone/.next/server/app/api/agent/fs/file/[...path]/route.js.nft.json +1 -1
  32. package/.next/standalone/.next/server/app/api/agent/fs/ls/[[...path]]/route.js +8 -8
  33. package/.next/standalone/.next/server/app/api/agent/fs/ls/[[...path]]/route.js.nft.json +1 -1
  34. package/.next/standalone/.next/server/app/api/agent/fs/move/route.js +5 -5
  35. package/.next/standalone/.next/server/app/api/agent/fs/move/route.js.nft.json +1 -1
  36. package/.next/standalone/.next/server/app/api/agent/fs/search/route.js +7 -7
  37. package/.next/standalone/.next/server/app/api/agent/fs/search/route.js.nft.json +1 -1
  38. package/.next/standalone/.next/server/app/api/agent/internal/span/route.js +6 -6
  39. package/.next/standalone/.next/server/app/api/agent/internal/span/route.js.nft.json +1 -1
  40. package/.next/standalone/.next/server/app/api/agent/settings/route.js +7 -7
  41. package/.next/standalone/.next/server/app/api/agent/settings/route.js.nft.json +1 -1
  42. package/.next/standalone/.next/server/app/api/agent/sidecar/[...path]/route.js +8 -8
  43. package/.next/standalone/.next/server/app/api/agent/sidecar/[...path]/route.js.nft.json +1 -1
  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 +6 -6
  46. package/.next/standalone/.next/server/app/api/assets/[...path]/route.js.nft.json +1 -1
  47. package/.next/standalone/.next/server/app/api/auth/[...all]/route.js +2 -2
  48. package/.next/standalone/.next/server/app/api/auth/[...all]/route.js.nft.json +1 -1
  49. package/.next/standalone/.next/server/app/api/pdf/save/route.js +6 -6
  50. package/.next/standalone/.next/server/app/api/pdf/save/route.js.nft.json +1 -1
  51. package/.next/standalone/.next/server/app/api/share/[token]/asset/route.js +2 -2
  52. package/.next/standalone/.next/server/app/api/share/[token]/asset/route.js.nft.json +1 -1
  53. package/.next/standalone/.next/server/app/api/share/[token]/route.js +5 -5
  54. package/.next/standalone/.next/server/app/api/share/[token]/route.js.nft.json +1 -1
  55. package/.next/standalone/.next/server/app/api/share/route.js +6 -6
  56. package/.next/standalone/.next/server/app/api/share/route.js.nft.json +1 -1
  57. package/.next/standalone/.next/server/app/api/system/admins/route.js +4 -4
  58. package/.next/standalone/.next/server/app/api/system/admins/route.js.nft.json +1 -1
  59. package/.next/standalone/.next/server/app/api/system/api-key/route.js +4 -4
  60. package/.next/standalone/.next/server/app/api/system/api-key/route.js.nft.json +1 -1
  61. package/.next/standalone/.next/server/app/api/system/auth-config/route.js +4 -4
  62. package/.next/standalone/.next/server/app/api/system/auth-config/route.js.nft.json +1 -1
  63. package/.next/standalone/.next/server/app/api/system/auth-settings/route.js +4 -4
  64. package/.next/standalone/.next/server/app/api/system/auth-settings/route.js.nft.json +1 -1
  65. package/.next/standalone/.next/server/app/api/system/browse/route.js +5 -5
  66. package/.next/standalone/.next/server/app/api/system/browse/route.js.nft.json +1 -1
  67. package/.next/standalone/.next/server/app/api/system/clear-root/route.js +5 -5
  68. package/.next/standalone/.next/server/app/api/system/clear-root/route.js.nft.json +1 -1
  69. package/.next/standalone/.next/server/app/api/system/config/route.js +4 -4
  70. package/.next/standalone/.next/server/app/api/system/config/route.js.nft.json +1 -1
  71. package/.next/standalone/.next/server/app/api/system/pins/route.js +6 -6
  72. package/.next/standalone/.next/server/app/api/system/pins/route.js.nft.json +1 -1
  73. package/.next/standalone/.next/server/app/api/system/reveal/route.js +7 -7
  74. package/.next/standalone/.next/server/app/api/system/reveal/route.js.nft.json +1 -1
  75. package/.next/standalone/.next/server/app/api/system/root-status/route.js +7 -7
  76. package/.next/standalone/.next/server/app/api/system/root-status/route.js.nft.json +1 -1
  77. package/.next/standalone/.next/server/app/api/system/set-root/route.js +6 -6
  78. package/.next/standalone/.next/server/app/api/system/set-root/route.js.nft.json +1 -1
  79. package/.next/standalone/.next/server/app/api/system/users/route.js +3 -3
  80. package/.next/standalone/.next/server/app/api/system/users/route.js.nft.json +1 -1
  81. package/.next/standalone/.next/server/app/api/system/workspaces/[id]/branch/route.js +3 -3
  82. package/.next/standalone/.next/server/app/api/system/workspaces/[id]/branch/route.js.nft.json +1 -1
  83. package/.next/standalone/.next/server/app/api/system/workspaces/[id]/open/route.js +5 -5
  84. package/.next/standalone/.next/server/app/api/system/workspaces/[id]/open/route.js.nft.json +1 -1
  85. package/.next/standalone/.next/server/app/api/system/workspaces/[id]/refresh/route.js +3 -3
  86. package/.next/standalone/.next/server/app/api/system/workspaces/[id]/refresh/route.js.nft.json +1 -1
  87. package/.next/standalone/.next/server/app/api/system/workspaces/[id]/route.js +5 -5
  88. package/.next/standalone/.next/server/app/api/system/workspaces/[id]/route.js.nft.json +1 -1
  89. package/.next/standalone/.next/server/app/api/system/workspaces/route.js +5 -5
  90. package/.next/standalone/.next/server/app/api/system/workspaces/route.js.nft.json +1 -1
  91. package/.next/standalone/.next/server/app/api/upload/[...path]/route.js +6 -6
  92. package/.next/standalone/.next/server/app/api/upload/[...path]/route.js.nft.json +1 -1
  93. package/.next/standalone/.next/server/app/api/wiki/app/route.js +4 -4
  94. package/.next/standalone/.next/server/app/api/wiki/app/route.js.nft.json +1 -1
  95. package/.next/standalone/.next/server/app/api/wiki/backlinks/route.js +7 -7
  96. package/.next/standalone/.next/server/app/api/wiki/backlinks/route.js.nft.json +1 -1
  97. package/.next/standalone/.next/server/app/api/wiki/content/route.js +6 -6
  98. package/.next/standalone/.next/server/app/api/wiki/content/route.js.nft.json +1 -1
  99. package/.next/standalone/.next/server/app/api/wiki/download/route.js +7 -7
  100. package/.next/standalone/.next/server/app/api/wiki/download/route.js.nft.json +1 -1
  101. package/.next/standalone/.next/server/app/api/wiki/file/route.js +6 -6
  102. package/.next/standalone/.next/server/app/api/wiki/file/route.js.nft.json +1 -1
  103. package/.next/standalone/.next/server/app/api/wiki/folder/route.js +6 -6
  104. package/.next/standalone/.next/server/app/api/wiki/folder/route.js.nft.json +1 -1
  105. package/.next/standalone/.next/server/app/api/wiki/git-branches/route.js +7 -7
  106. package/.next/standalone/.next/server/app/api/wiki/git-branches/route.js.nft.json +1 -1
  107. package/.next/standalone/.next/server/app/api/wiki/git-checkout/route.js +4 -4
  108. package/.next/standalone/.next/server/app/api/wiki/git-checkout/route.js.nft.json +1 -1
  109. package/.next/standalone/.next/server/app/api/wiki/git-diff/route.js +7 -7
  110. package/.next/standalone/.next/server/app/api/wiki/git-diff/route.js.nft.json +1 -1
  111. package/.next/standalone/.next/server/app/api/wiki/git-file-info/route.js +7 -7
  112. package/.next/standalone/.next/server/app/api/wiki/git-file-info/route.js.nft.json +1 -1
  113. package/.next/standalone/.next/server/app/api/wiki/git-history/route.js +7 -7
  114. package/.next/standalone/.next/server/app/api/wiki/git-history/route.js.nft.json +1 -1
  115. package/.next/standalone/.next/server/app/api/wiki/git-pull/route.js +6 -6
  116. package/.next/standalone/.next/server/app/api/wiki/git-pull/route.js.nft.json +1 -1
  117. package/.next/standalone/.next/server/app/api/wiki/move/route.js +6 -6
  118. package/.next/standalone/.next/server/app/api/wiki/move/route.js.nft.json +1 -1
  119. package/.next/standalone/.next/server/app/api/wiki/new-file/route.js +6 -6
  120. package/.next/standalone/.next/server/app/api/wiki/new-file/route.js.nft.json +1 -1
  121. package/.next/standalone/.next/server/app/api/wiki/outlinks/route.js +6 -6
  122. package/.next/standalone/.next/server/app/api/wiki/outlinks/route.js.nft.json +1 -1
  123. package/.next/standalone/.next/server/app/api/wiki/page/route.js +6 -6
  124. package/.next/standalone/.next/server/app/api/wiki/page/route.js.nft.json +1 -1
  125. package/.next/standalone/.next/server/app/api/wiki/presence/route.js +6 -6
  126. package/.next/standalone/.next/server/app/api/wiki/presence/route.js.nft.json +1 -1
  127. package/.next/standalone/.next/server/app/api/wiki/route.js +6 -6
  128. package/.next/standalone/.next/server/app/api/wiki/route.js.nft.json +1 -1
  129. package/.next/standalone/.next/server/app/api/wiki/search/route.js +7 -7
  130. package/.next/standalone/.next/server/app/api/wiki/search/route.js.nft.json +1 -1
  131. package/.next/standalone/.next/server/app/api/wiki/slugs/route.js +6 -6
  132. package/.next/standalone/.next/server/app/api/wiki/slugs/route.js.nft.json +1 -1
  133. package/.next/standalone/.next/server/app/api/wiki/upload/route.js +6 -6
  134. package/.next/standalone/.next/server/app/api/wiki/upload/route.js.nft.json +1 -1
  135. package/.next/standalone/.next/server/app/api/wiki/watch/route.js +5 -5
  136. package/.next/standalone/.next/server/app/api/wiki/watch/route.js.nft.json +1 -1
  137. package/.next/standalone/.next/server/app/page/build-manifest.json +2 -2
  138. package/.next/standalone/.next/server/app/page.js.nft.json +1 -1
  139. package/.next/standalone/.next/server/app/page_client-reference-manifest.js +1 -1
  140. package/.next/standalone/.next/server/app/s/[token]/page/build-manifest.json +2 -2
  141. package/.next/standalone/.next/server/app/s/[token]/page_client-reference-manifest.js +1 -1
  142. package/.next/standalone/.next/server/app/signin/page/build-manifest.json +2 -2
  143. package/.next/standalone/.next/server/app/signin/page.js +1 -1
  144. package/.next/standalone/.next/server/app/signin/page.js.nft.json +1 -1
  145. package/.next/standalone/.next/server/chunks/032z_better-auth_dist_adapters_kysely-adapter_index_mjs_0.uqexi._.js +3 -0
  146. package/.next/standalone/.next/server/chunks/{[root-of-the-server]__0qh1ixf._.js → [root-of-the-server]__0-3eby~._.js} +2 -2
  147. package/.next/standalone/.next/server/chunks/{[root-of-the-server]__0-qz_3c._.js → [root-of-the-server]__0-bd36s._.js} +2 -2
  148. package/.next/standalone/.next/server/chunks/{[root-of-the-server]__0a2xlp5._.js → [root-of-the-server]__0._o62m._.js} +2 -2
  149. package/.next/standalone/.next/server/chunks/{[root-of-the-server]__0d620xp._.js → [root-of-the-server]__0.f~mr1._.js} +2 -2
  150. package/.next/standalone/.next/server/chunks/{[root-of-the-server]__0pigocu._.js → [root-of-the-server]__0.xsx4e._.js} +2 -2
  151. package/.next/standalone/.next/server/chunks/{[root-of-the-server]__0.uhsjk._.js → [root-of-the-server]__0002pqj._.js} +2 -2
  152. package/.next/standalone/.next/server/chunks/{[root-of-the-server]__0epcyks._.js → [root-of-the-server]__01w5s-4._.js} +2 -2
  153. package/.next/standalone/.next/server/chunks/{[root-of-the-server]__0202z9f._.js → [root-of-the-server]__020sc-x._.js} +2 -2
  154. package/.next/standalone/.next/server/chunks/{[root-of-the-server]__0y0kxa~._.js → [root-of-the-server]__02hiw0n._.js} +2 -2
  155. package/.next/standalone/.next/server/chunks/[root-of-the-server]__037g~yp._.js +20 -0
  156. package/.next/standalone/.next/server/chunks/{[root-of-the-server]__0d8xqo8._.js → [root-of-the-server]__04mie79._.js} +2 -2
  157. package/.next/standalone/.next/server/chunks/{[root-of-the-server]__0_7vimt._.js → [root-of-the-server]__04yzrn9._.js} +2 -2
  158. package/.next/standalone/.next/server/chunks/{[root-of-the-server]__138gjuw._.js → [root-of-the-server]__05dk_5q._.js} +2 -2
  159. package/.next/standalone/.next/server/chunks/{[root-of-the-server]__11t.sry._.js → [root-of-the-server]__05wicn_._.js} +2 -2
  160. package/.next/standalone/.next/server/chunks/{[root-of-the-server]__08_y49c._.js → [root-of-the-server]__086~~78._.js} +2 -2
  161. package/.next/standalone/.next/server/chunks/{[root-of-the-server]__02wzxsf._.js → [root-of-the-server]__08h0txl._.js} +2 -2
  162. package/.next/standalone/.next/server/chunks/{[root-of-the-server]__0o1k3fi._.js → [root-of-the-server]__08xiuca._.js} +2 -2
  163. package/.next/standalone/.next/server/chunks/{[root-of-the-server]__07lzlrr._.js → [root-of-the-server]__0915i_~._.js} +2 -2
  164. package/.next/standalone/.next/server/chunks/{[root-of-the-server]__0g3udh8._.js → [root-of-the-server]__09ezcba._.js} +2 -2
  165. package/.next/standalone/.next/server/chunks/{[root-of-the-server]__05i.wh.._.js → [root-of-the-server]__0_h4.il._.js} +3 -3
  166. package/.next/standalone/.next/server/chunks/{[root-of-the-server]__0qe859g._.js → [root-of-the-server]__0a7c~hj._.js} +2 -2
  167. package/.next/standalone/.next/server/chunks/{[root-of-the-server]__01e574b._.js → [root-of-the-server]__0au~ncj._.js} +2 -2
  168. package/.next/standalone/.next/server/chunks/{[root-of-the-server]__0cdtp8a._.js → [root-of-the-server]__0c-49tx._.js} +2 -2
  169. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0c1~r8t._.js +2 -2
  170. package/.next/standalone/.next/server/chunks/{[root-of-the-server]__12d.iws._.js → [root-of-the-server]__0d8j9pv._.js} +2 -2
  171. package/.next/standalone/.next/server/chunks/{[root-of-the-server]__0vijyiu._.js → [root-of-the-server]__0di13ue._.js} +2 -2
  172. package/.next/standalone/.next/server/chunks/{[root-of-the-server]__0bjzl0a._.js → [root-of-the-server]__0dkxp4y._.js} +2 -2
  173. package/.next/standalone/.next/server/chunks/{[root-of-the-server]__0r91ni0._.js → [root-of-the-server]__0e_irm6._.js} +2 -2
  174. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0egcl8n._.js +12 -0
  175. package/.next/standalone/.next/server/chunks/{[root-of-the-server]__0ij7xum._.js → [root-of-the-server]__0imefb9._.js} +2 -2
  176. package/.next/standalone/.next/server/chunks/{[root-of-the-server]__0t.n7ho._.js → [root-of-the-server]__0jhwupj._.js} +2 -2
  177. package/.next/standalone/.next/server/chunks/{[root-of-the-server]__006okq3._.js → [root-of-the-server]__0ker6~l._.js} +2 -2
  178. package/.next/standalone/.next/server/chunks/{[root-of-the-server]__0zryblt._.js → [root-of-the-server]__0l6bj_u._.js} +2 -2
  179. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0mjux2y._.js +3 -0
  180. package/.next/standalone/.next/server/chunks/{[root-of-the-server]__07sj3y5._.js → [root-of-the-server]__0mkrdf0._.js} +2 -2
  181. package/.next/standalone/.next/server/chunks/{[root-of-the-server]__0s6nb4u._.js → [root-of-the-server]__0mw1brk._.js} +2 -2
  182. package/.next/standalone/.next/server/chunks/{[root-of-the-server]__0j~yfb8._.js → [root-of-the-server]__0n7uto3._.js} +2 -2
  183. package/.next/standalone/.next/server/chunks/{[root-of-the-server]__0mvpu2b._.js → [root-of-the-server]__0nzjsw9._.js} +2 -2
  184. package/.next/standalone/.next/server/chunks/{[root-of-the-server]__0_g14o1._.js → [root-of-the-server]__0o0lsmx._.js} +2 -2
  185. package/.next/standalone/.next/server/chunks/{[root-of-the-server]__0x0z_oi._.js → [root-of-the-server]__0omc1-s._.js} +4 -4
  186. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0os3ej1._.js +16 -0
  187. package/.next/standalone/.next/server/chunks/{[root-of-the-server]__0s7-nm1._.js → [root-of-the-server]__0px8._m._.js} +2 -2
  188. package/.next/standalone/.next/server/chunks/{[root-of-the-server]__0~w23al._.js → [root-of-the-server]__0qe7kxb._.js} +2 -2
  189. package/.next/standalone/.next/server/chunks/{[root-of-the-server]__0t-buqi._.js → [root-of-the-server]__0qe8lje._.js} +2 -2
  190. package/.next/standalone/.next/server/chunks/{[root-of-the-server]__06ag0hv._.js → [root-of-the-server]__0qox302._.js} +2 -2
  191. package/.next/standalone/.next/server/chunks/{[root-of-the-server]__0zireda._.js → [root-of-the-server]__0s5ns33._.js} +2 -2
  192. package/.next/standalone/.next/server/chunks/{[root-of-the-server]__07twyrn._.js → [root-of-the-server]__0s6kt0y._.js} +2 -2
  193. package/.next/standalone/.next/server/chunks/{[root-of-the-server]__13g7bwf._.js → [root-of-the-server]__0sl86.1._.js} +2 -2
  194. package/.next/standalone/.next/server/chunks/{[root-of-the-server]__0ro.26e._.js → [root-of-the-server]__0t_s2dg._.js} +4 -4
  195. package/.next/standalone/.next/server/chunks/{[root-of-the-server]__02b3m59._.js → [root-of-the-server]__0tchvup._.js} +2 -2
  196. package/.next/standalone/.next/server/chunks/{[root-of-the-server]__020jdr7._.js → [root-of-the-server]__0tw6h_5._.js} +2 -2
  197. package/.next/standalone/.next/server/chunks/{[root-of-the-server]__0v4g9el._.js → [root-of-the-server]__0ujzwde._.js} +2 -2
  198. package/.next/standalone/.next/server/chunks/{[root-of-the-server]__0jigd36._.js → [root-of-the-server]__0uxn5_c._.js} +2 -2
  199. package/.next/standalone/.next/server/chunks/{[root-of-the-server]__12aful9._.js → [root-of-the-server]__0vxdtn~._.js} +2 -2
  200. package/.next/standalone/.next/server/chunks/{[root-of-the-server]__0ofr1kg._.js → [root-of-the-server]__0wmp13_._.js} +2 -2
  201. package/.next/standalone/.next/server/chunks/{[root-of-the-server]__0cbr5tn._.js → [root-of-the-server]__0z8qb~s._.js} +2 -2
  202. package/.next/standalone/.next/server/chunks/{[root-of-the-server]__10ui429._.js → [root-of-the-server]__0zy2f8y._.js} +3 -3
  203. package/.next/standalone/.next/server/chunks/{[root-of-the-server]__11wskj0._.js → [root-of-the-server]__0~p29-i._.js} +2 -2
  204. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0~s~szv._.js +16 -0
  205. package/.next/standalone/.next/server/chunks/{[root-of-the-server]__08gf7vl._.js → [root-of-the-server]__1024gkd._.js} +2 -2
  206. package/.next/standalone/.next/server/chunks/{[root-of-the-server]__04atpe0._.js → [root-of-the-server]__10c4_fo._.js} +2 -2
  207. package/.next/standalone/.next/server/chunks/{[root-of-the-server]__08ayj9k._.js → [root-of-the-server]__11mhei8._.js} +2 -2
  208. package/.next/standalone/.next/server/chunks/{[root-of-the-server]__04_l24g._.js → [root-of-the-server]__12abg.4._.js} +2 -2
  209. package/.next/standalone/.next/server/chunks/{[root-of-the-server]__0pjnlq6._.js → [root-of-the-server]__12jdw86._.js} +2 -2
  210. package/.next/standalone/.next/server/chunks/_next-internal_server_app_api_system_workspaces_[id]_open_route_actions_1087xu7.js +1 -1
  211. package/.next/standalone/.next/server/chunks/src_lib_auth_server_ts_00f4e0h._.js +3 -3
  212. package/.next/standalone/.next/server/chunks/ssr/032z_better-auth_dist_adapters_kysely-adapter_index_mjs_0z7xdrs._.js +3 -0
  213. package/.next/standalone/.next/server/chunks/ssr/0p91_next_0f40gy0._.js +2 -2
  214. package/.next/standalone/.next/server/chunks/ssr/{0~w0_katex_dist_katex_mjs_0ad8sxj._.js → 0~w0_katex_dist_katex_mjs_0p7ph25._.js} +1 -1
  215. package/.next/standalone/.next/server/chunks/ssr/12y~_mermaid_dist_chunks_mermaid_core_chunk-5ZQYHXKU_mjs_0z1.978._.js +1 -1
  216. package/.next/standalone/.next/server/chunks/ssr/12y~_mermaid_dist_chunks_mermaid_core_chunk-KSCS5N6A_mjs_0v4oeem._.js +1 -1
  217. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__09ut-wj._.js +12 -0
  218. package/.next/standalone/.next/server/chunks/ssr/{[root-of-the-server]__00m334i._.js → [root-of-the-server]__13k6~ax._.js} +2 -2
  219. package/.next/standalone/.next/server/chunks/ssr/_03xt0rl._.js +2 -2
  220. package/.next/standalone/.next/server/chunks/ssr/_0i3r51-._.js +2 -2
  221. package/.next/standalone/.next/server/chunks/ssr/_0v4uz-4._.js +1 -1
  222. package/.next/standalone/.next/server/chunks/ssr/{node_modules__pnpm_0w.8oky._.js → node_modules__pnpm_03ciu.l._.js} +1 -1
  223. package/.next/standalone/.next/server/chunks/ssr/{node_modules__pnpm_0gjtsn.._.js → node_modules__pnpm_03jchtd._.js} +1 -1
  224. package/.next/standalone/.next/server/chunks/ssr/{node_modules__pnpm_0_147lg._.js → node_modules__pnpm_04qqrjr._.js} +2 -2
  225. package/.next/standalone/.next/server/chunks/ssr/{node_modules__pnpm_10e6442._.js → node_modules__pnpm_04xh4re._.js} +1 -1
  226. package/.next/standalone/.next/server/chunks/ssr/{node_modules__pnpm_0x0g0os._.js → node_modules__pnpm_06usij4._.js} +1 -1
  227. package/.next/standalone/.next/server/chunks/ssr/{node_modules__pnpm_0d7vbro._.js → node_modules__pnpm_0819uyi._.js} +2 -2
  228. package/.next/standalone/.next/server/chunks/ssr/{node_modules__pnpm_05e0bk~._.js → node_modules__pnpm_09c3lg3._.js} +1 -1
  229. package/.next/standalone/.next/server/chunks/ssr/{node_modules__pnpm_01t3sq6._.js → node_modules__pnpm_09k0q18._.js} +1 -1
  230. package/.next/standalone/.next/server/chunks/ssr/{node_modules__pnpm_05t9ax3._.js → node_modules__pnpm_09ybwhl._.js} +1 -1
  231. package/.next/standalone/.next/server/chunks/ssr/{node_modules__pnpm_0v2okl2._.js → node_modules__pnpm_0a-f4gi._.js} +1 -1
  232. package/.next/standalone/.next/server/chunks/ssr/node_modules__pnpm_0a4su30._.js +1 -1
  233. package/.next/standalone/.next/server/chunks/ssr/{node_modules__pnpm_04wum0.._.js → node_modules__pnpm_0b3l3b4._.js} +1 -1
  234. package/.next/standalone/.next/server/chunks/ssr/{node_modules__pnpm_0-1ss1p._.js → node_modules__pnpm_0c.b4rt._.js} +1 -1
  235. package/.next/standalone/.next/server/chunks/ssr/{node_modules__pnpm_0dl2oqy._.js → node_modules__pnpm_0dsnv76._.js} +1 -1
  236. package/.next/standalone/.next/server/chunks/ssr/{node_modules__pnpm_10teun9._.js → node_modules__pnpm_0eiz-8_._.js} +1 -1
  237. package/.next/standalone/.next/server/chunks/ssr/{node_modules__pnpm_13ldydj._.js → node_modules__pnpm_0gnc95r._.js} +2 -2
  238. package/.next/standalone/.next/server/chunks/ssr/{node_modules__pnpm_03xabl9._.js → node_modules__pnpm_0iuzd3o._.js} +1 -1
  239. package/.next/standalone/.next/server/chunks/ssr/{node_modules__pnpm_0--p4nj._.js → node_modules__pnpm_0kli5~f._.js} +1 -1
  240. package/.next/standalone/.next/server/chunks/ssr/{node_modules__pnpm_0vr89s3._.js → node_modules__pnpm_0ldft78._.js} +1 -1
  241. package/.next/standalone/.next/server/chunks/ssr/{node_modules__pnpm_0.9b4fh._.js → node_modules__pnpm_0m2hb6k._.js} +1 -1
  242. package/.next/standalone/.next/server/chunks/ssr/{node_modules__pnpm_0u3x9vb._.js → node_modules__pnpm_0ov9ih8._.js} +1 -1
  243. package/.next/standalone/.next/server/chunks/ssr/node_modules__pnpm_0o~d81.._.js +1 -1
  244. package/.next/standalone/.next/server/chunks/ssr/{node_modules__pnpm_0.57ebn._.js → node_modules__pnpm_0qhs4r2._.js} +1 -1
  245. package/.next/standalone/.next/server/chunks/ssr/{node_modules__pnpm_0kn.dtv._.js → node_modules__pnpm_0umkew~._.js} +2 -2
  246. package/.next/standalone/.next/server/chunks/ssr/{node_modules__pnpm_0nrgzso._.js → node_modules__pnpm_0wjizot._.js} +2 -2
  247. package/.next/standalone/.next/server/chunks/ssr/{node_modules__pnpm_0b.~9qt._.js → node_modules__pnpm_0yfe2s1._.js} +1 -1
  248. package/.next/standalone/.next/server/chunks/ssr/{node_modules__pnpm_006-aus._.js → node_modules__pnpm_0ypcps.._.js} +2 -2
  249. package/.next/standalone/.next/server/chunks/ssr/{node_modules__pnpm_00r.2o_._.js → node_modules__pnpm_0~ovwm1._.js} +1 -1
  250. package/.next/standalone/.next/server/chunks/ssr/{node_modules__pnpm_0ilobyl._.js → node_modules__pnpm_12dmj0l._.js} +2 -2
  251. package/.next/standalone/.next/server/chunks/ssr/src_app_signin_00yk0vm._.js +3 -3
  252. package/.next/standalone/.next/server/middleware-build-manifest.js +5 -5
  253. package/.next/standalone/.next/server/pages/500.html +1 -1
  254. package/.next/standalone/.next/server/server-reference-manifest.js +1 -1
  255. package/.next/standalone/.next/server/server-reference-manifest.json +1 -1
  256. package/.next/standalone/.next/static/chunks/{0geo.l55~q1t..js → 0-lsw0io13aha.js} +1 -1
  257. package/.next/standalone/.next/static/chunks/{0k31ncl7m_j9q.js → 08usk_~k6d0yf.js} +2 -2
  258. package/.next/standalone/.next/static/chunks/{0ifmz0_uejmux.js → 08yt220_vis~5.js} +2 -2
  259. package/.next/standalone/.next/static/chunks/{01.uz2n6027x~.js → 0a~z4.g.dtxjm.js} +2 -2
  260. package/.next/standalone/.next/static/chunks/0mn.-bl.si~im.js +1 -0
  261. package/.next/standalone/.next/static/chunks/{10pggl9dpt6bj.js → 0t5bc7buy7sx9.js} +2 -2
  262. package/.next/standalone/.next/static/chunks/{turbopack-1105gjd__15ti.js → turbopack-0~8fsjmdvb_1i.js} +1 -1
  263. package/.next/standalone/package.json +129 -131
  264. package/.next/standalone/server.js +1 -1
  265. package/bin/postbuild.js +3 -3
  266. package/package.json +129 -131
  267. package/.next/standalone/.next/server/chunks/0dhv_better-auth_dist_adapters_kysely-adapter_index_mjs_0t4t4z8._.js +0 -3
  268. package/.next/standalone/.next/server/chunks/[root-of-the-server]__00vbqtx._.js +0 -12
  269. package/.next/standalone/.next/server/chunks/[root-of-the-server]__024xlhl._.js +0 -3
  270. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0i.8g~9._.js +0 -20
  271. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0ll9j_l._.js +0 -16
  272. package/.next/standalone/.next/server/chunks/[root-of-the-server]__13.6kr3._.js +0 -16
  273. package/.next/standalone/.next/server/chunks/ssr/0dhv_better-auth_dist_adapters_kysely-adapter_index_mjs_08ymlcb._.js +0 -3
  274. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0~~1h_p._.js +0 -12
  275. package/.next/standalone/.next/static/chunks/0g5dv59skfo1z.js +0 -1
  276. package/.next/standalone/node_modules/better-sqlite3/build/Release/better_sqlite3.node +0 -0
  277. package/.next/standalone/node_modules/better-sqlite3/lib/database.js +0 -90
  278. package/.next/standalone/node_modules/better-sqlite3/lib/index.js +0 -3
  279. package/.next/standalone/node_modules/better-sqlite3/lib/methods/aggregate.js +0 -43
  280. package/.next/standalone/node_modules/better-sqlite3/lib/methods/backup.js +0 -67
  281. package/.next/standalone/node_modules/better-sqlite3/lib/methods/function.js +0 -31
  282. package/.next/standalone/node_modules/better-sqlite3/lib/methods/inspect.js +0 -7
  283. package/.next/standalone/node_modules/better-sqlite3/lib/methods/pragma.js +0 -12
  284. package/.next/standalone/node_modules/better-sqlite3/lib/methods/serialize.js +0 -16
  285. package/.next/standalone/node_modules/better-sqlite3/lib/methods/table.js +0 -189
  286. package/.next/standalone/node_modules/better-sqlite3/lib/methods/transaction.js +0 -78
  287. package/.next/standalone/node_modules/better-sqlite3/lib/methods/wrappers.js +0 -54
  288. package/.next/standalone/node_modules/better-sqlite3/lib/sqlite-error.js +0 -20
  289. package/.next/standalone/node_modules/better-sqlite3/lib/util.js +0 -12
  290. package/.next/standalone/node_modules/better-sqlite3/package.json +0 -59
  291. package/.next/standalone/node_modules/bindings/bindings.js +0 -221
  292. package/.next/standalone/node_modules/bindings/package.json +0 -28
  293. package/.next/standalone/node_modules/file-uri-to-path/index.js +0 -66
  294. package/.next/standalone/node_modules/file-uri-to-path/package.json +0 -32
  295. /package/.next/standalone/.next/static/{xtVS5qoS5iRoHvlKPKilq → 014EirzgOgUjO57zMiZrA}/_buildManifest.js +0 -0
  296. /package/.next/standalone/.next/static/{xtVS5qoS5iRoHvlKPKilq → 014EirzgOgUjO57zMiZrA}/_clientMiddlewareManifest.js +0 -0
  297. /package/.next/standalone/.next/static/{xtVS5qoS5iRoHvlKPKilq → 014EirzgOgUjO57zMiZrA}/_ssgManifest.js +0 -0
@@ -1,4 +1,4 @@
1
- module.exports=[211730,a=>{"use strict";a.s(["default",()=>b]);let b=(0,a.i(413981).registerClientReference)(function(){throw Error("Attempted to call the default export of [project]/src/app/signin/signin-form.tsx <module evaluation> from the server, but it's on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"[project]/src/app/signin/signin-form.tsx <module evaluation>","default")},465274,a=>{"use strict";a.s(["default",()=>b]);let b=(0,a.i(413981).registerClientReference)(function(){throw Error("Attempted to call the default export of [project]/src/app/signin/signin-form.tsx from the server, but it's on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"[project]/src/app/signin/signin-form.tsx","default")},961603,a=>{"use strict";a.i(211730);var b=a.i(465274);a.n(b)},244925,a=>{"use strict";let b,c,d,e,f,g,h,i,j,k,l,m,n,o;var p,q,r,s,t=a.i(616842),u=a.i(961603),v=a.i(237976),w=a.i(672919);async function x(b,c){let d;if(b.database)d="function"==typeof b.database?b.database(b):await c(b);else{let c=Object.keys((0,v.getAuthTables)(b)).reduce((a,b)=>(a[b]=[],a),{}),{memoryAdapter:e}=await a.A(165483);d=e(c)(b)}return d.transaction||(w.logger.warn("Adapter does not correctly implement transaction function, patching it automatically. Please update your adapter implementation."),d.transaction=async a=>a(d)),d}var y=a.i(35021);async function z(b){return x(b,async b=>{let{createKyselyAdapter:c}=await a.A(18187),{kysely:d,databaseType:e,transaction:f}=await c(b);if(!d)throw new y.BetterAuthError("Failed to initialize database adapter");let{kyselyAdapter:g}=await a.A(18187);return g(d,{type:e||"sqlite",debugLogs:!!b.database&&"debugLogs"in b.database&&b.database.debugLogs,transaction:f})(b)})}var A=a.i(175544);function B(a){return"-"===a||"^"===a||"$"===a||"+"===a||"."===a||"("===a||")"===a||"|"===a||"["===a||"]"===a||"{"===a||"}"===a||"*"===a||"?"===a||"\\"===a?`\\${a}`:a}function C(a,b){if("string"!=typeof b)throw TypeError(`Sample must be a string, but ${typeof b} given`);return a.test(b)}function D(a,b){if("string"!=typeof a&&!Array.isArray(a))throw TypeError(`The first argument must be a single pattern string or an array of patterns, but ${typeof a} given`);if(("string"==typeof b||"boolean"==typeof b)&&(b={separator:b}),2==arguments.length&&!(void 0===b||"object"==typeof b&&null!==b&&!Array.isArray(b)))throw TypeError(`The second argument must be an options object or a string/boolean separator, but ${typeof b} given`);if("\\"===(b=b||{}).separator)throw Error("\\ is not a valid separator because it is used for escaping. Try setting the separator to `true` instead");let c=function a(b,c=!0){if(Array.isArray(b))return`(?:${b.map(b=>`^${a(b,c)}$`).join("|")})`;let d="",e="",f=".";!0===c?(d="/",e="[/\\\\]",f="[^/\\\\]"):c&&((e=function(a){let b="";for(let c=0;c<a.length;c++)b+=B(a[c]);return b}(d=c)).length>1?(e=`(?:${e})`,f=`((?!${e}).)`):f=`[^${e}]`);let g=c?`${e}+?`:"",h=c?`${e}*?`:"",i=c?b.split(d):[b],j="";for(let a=0;a<i.length;a++){let b=i[a],d=i[a+1],e="";if(b||!(a>0)){if(c&&(e=a===i.length-1?h:"**"!==d?g:""),c&&"**"===b){e&&(j+=0===a?"":e,j+=`(?:${f}*?${e})*?`);continue}for(let a=0;a<b.length;a++){let c=b[a];"\\"===c?a<b.length-1&&(j+=B(b[a+1]),a++):"?"===c?j+=f:"*"===c?j+=`${f}*?`:j+=B(c)}j+=e}}return j}(a,b.separator),d=RegExp(`^${c}$`,b.flags),e=C.bind(null,d);return e.options=b,e.pattern=a,e.regexp=d,e}var E=a.i(125039);function F(a){let b=a.length;for(;b>0&&47===a.charCodeAt(b-1);)b--;return b===a.length?a:a.slice(0,b)}function G(a,b="/api/auth"){try{let b=new URL(a);if("http:"!==b.protocol&&"https:"!==b.protocol)throw new y.BetterAuthError(`Invalid base URL: ${a}. URL must include 'http://' or 'https://'`)}catch(b){if(b instanceof y.BetterAuthError)throw b;throw new y.BetterAuthError(`Invalid base URL: ${a}. Please provide a valid base URL.`,{cause:b})}if(function(a){try{return"/"!==(F(new URL(a).pathname)||"/")}catch{throw new y.BetterAuthError(`Invalid base URL: ${a}. Please provide a valid base URL.`)}}(a))return a;let c=F(a);return b&&"/"!==b?(b=b.startsWith("/")?b:`/${b}`,`${c}${b}`):c}function H(a,b){return!!a&&""!==a.trim()&&("proto"===b?"http"===a||"https"===a:"host"===b&&![/\.\./,/\0/,/[\s]/,/^[.]/,/[<>'"]/,/javascript:/i,/file:/i,/data:/i].some(b=>b.test(a))&&(/^[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(a)||/^(\d{1,3}\.){3}\d{1,3}(:[0-9]{1,5})?$/.test(a)||/^\[[0-9a-fA-F:]+\](:[0-9]{1,5})?$/.test(a)||/^localhost(:[0-9]{1,5})?$/i.test(a)))}function I(a,b,c,d,e){if(a)return G(a,b);if(!1!==d){let a=E.env.BETTER_AUTH_URL||E.env.NEXT_PUBLIC_BETTER_AUTH_URL||E.env.PUBLIC_BETTER_AUTH_URL||E.env.NUXT_PUBLIC_BETTER_AUTH_URL||E.env.NUXT_PUBLIC_AUTH_URL||("/"!==E.env.BASE_URL?E.env.BASE_URL:void 0);if(a)return G(a,b)}let f=c?.headers.get("x-forwarded-host"),g=c?.headers.get("x-forwarded-proto");if(f&&g&&e&&H(g,"proto")&&H(f,"host"))try{return G(`${g}://${f}`,b)}catch(a){}if(c){let a=J(c.url);if(!a)throw new y.BetterAuthError("Could not get origin from request. Please provide a valid base URL.");return G(a,b)}}function J(a){try{let b=new URL(a);return"null"===b.origin?null:b.origin}catch{return null}}function K(a){return"object"==typeof a&&null!==a&&"allowedHosts"in a&&Array.isArray(a.allowedHosts)}function L(a){return a instanceof Request||"object"==typeof a&&null!==a&&"[object Request]"===Object.prototype.toString.call(a)&&"string"==typeof a.url&&"object"==typeof a.headers&&null!==a.headers&&"function"==typeof a.headers.get}function M(a,b){let c=L(a)?a.headers:a;if(b){let a=c.get("x-forwarded-host");if(a&&H(a,"host"))return a}let d=c.get("host");if(d&&H(d,"host"))return d;if(L(a))try{return new URL(a.url).host}catch{}return null}let N=(a,b,c)=>{if(a.startsWith("/"))return!!c?.allowRelativePaths&&a.startsWith("/")&&/^\/(?!\/|\\|%2f|%5c)[\w\-.\+/@]*(?:\?[\w\-.\+/=&%@]*)?$/.test(a);if(b.includes("*")||b.includes("?")){if(b.includes("://"))return D(b)(J(a)||a);let c=function(a){try{return new URL(a).host}catch{return null}}(a);return!!c&&D(b)(c)}let d=function(a){try{return new URL(a).protocol}catch{return null}}(a);return"http:"!==d&&"https:"!==d&&d?a.startsWith(b):b===J(a)};function O(a){return!!a&&("object"==typeof a||"function"==typeof a)&&"function"==typeof a.then}var P=a.i(666680);function Q(a,b){return new Promise((c,d)=>{(0,P.scrypt)(a.normalize("NFKC"),b,64,{N:16384,r:16,p:1,maxmem:0x4000000},(a,b)=>{a?d(a):c(b)})})}async function R(a){let b=(0,P.randomBytes)(16).toString("hex"),c=await Q(a,b);return`${b}:${c.toString("hex")}`}async function S(a,b){let[c,d]=a.split(":");if(!c||!d)throw Error("Invalid password hash");return(await Q(b,c)).toString("hex")===d}let T=async({hash:a,password:b})=>S(a,b);function U(a,b=""){if("number"!=typeof a){let c=b&&`"${b}" `;throw TypeError(`${c}expected number, got ${typeof a}`)}if(!Number.isSafeInteger(a)||a<0){let c=b&&`"${b}" `;throw RangeError(`${c}expected integer >= 0, got ${a}`)}}function V(a,b,c=""){let d=a instanceof Uint8Array||ArrayBuffer.isView(a)&&"Uint8Array"===a.constructor.name&&"BYTES_PER_ELEMENT"in a&&1===a.BYTES_PER_ELEMENT,e=a?.length,f=void 0!==b;if(!d||f&&e!==b){let g=(c&&`"${c}" `)+"expected Uint8Array"+(f?` of length ${b}`:"")+", got "+(d?`length=${e}`:`type=${typeof a}`);if(!d)throw TypeError(g);throw RangeError(g)}return a}function W(a){if("function"!=typeof a||"function"!=typeof a.create)throw TypeError("Hash must wrapped by utils.createHasher");if(U(a.outputLen),U(a.blockLen),a.outputLen<1)throw Error('"outputLen" must be >= 1');if(a.blockLen<1)throw Error('"blockLen" must be >= 1')}function X(a,b=!0){if(a.destroyed)throw Error("Hash instance has been destroyed");if(b&&a.finished)throw Error("Hash#digest() has already been called")}function Y(a,b){V(a,void 0,"digestInto() output");let c=b.outputLen;if(a.length<c)throw RangeError('"digestInto() output" expected to be of length >='+c)}function Z(...a){for(let b=0;b<a.length;b++)a[b].fill(0)}function $(a){return new DataView(a.buffer,a.byteOffset,a.byteLength)}function _(a,b){return a<<32-b|a>>>b}class aa{oHash;iHash;blockLen;outputLen;canXOF=!1;finished=!1;destroyed=!1;constructor(a,b){if(W(a),V(b,void 0,"key"),this.iHash=a.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 c=this.blockLen,d=new Uint8Array(c);d.set(b.length>c?a.create().update(b).digest():b);for(let a=0;a<d.length;a++)d[a]^=54;this.iHash.update(d),this.oHash=a.create();for(let a=0;a<d.length;a++)d[a]^=106;this.oHash.update(d),Z(d)}update(a){return X(this),this.iHash.update(a),this}digestInto(a){X(this),Y(a,this),this.finished=!0;let b=a.subarray(0,this.outputLen);this.iHash.digestInto(b),this.oHash.update(b),this.oHash.digestInto(b),this.destroy()}digest(){let a=new Uint8Array(this.oHash.outputLen);return this.digestInto(a),a}_cloneInto(a){a||=Object.create(Object.getPrototypeOf(this),{});let{oHash:b,iHash:c,finished:d,destroyed:e,blockLen:f,outputLen:g}=this;return a.finished=d,a.destroyed=e,a.blockLen=f,a.outputLen=g,a.oHash=b._cloneInto(a.oHash),a.iHash=c._cloneInto(a.iHash),a}clone(){return this._cloneInto()}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}}let ab=((g=(a,b,c)=>new aa(a,b).update(c).digest()).create=(a,b)=>new aa(a,b),g),ac=Uint8Array.of(0),ad=Uint8Array.of();class ae{blockLen;outputLen;canXOF=!1;padOffset;isLE;buffer;view;finished=!1;length=0;pos=0;destroyed=!1;constructor(a,b,c,d){this.blockLen=a,this.outputLen=b,this.padOffset=c,this.isLE=d,this.buffer=new Uint8Array(a),this.view=$(this.buffer)}update(a){X(this),V(a);let{view:b,buffer:c,blockLen:d}=this,e=a.length;for(let f=0;f<e;){let g=Math.min(d-this.pos,e-f);if(g===d){let b=$(a);for(;d<=e-f;f+=d)this.process(b,f);continue}c.set(a.subarray(f,f+g),this.pos),this.pos+=g,f+=g,this.pos===d&&(this.process(b,0),this.pos=0)}return this.length+=a.length,this.roundClean(),this}digestInto(a){X(this),Y(a,this),this.finished=!0;let{buffer:b,view:c,blockLen:d,isLE:e}=this,{pos:f}=this;b[f++]=128,Z(this.buffer.subarray(f)),this.padOffset>d-f&&(this.process(c,0),f=0);for(let a=f;a<d;a++)b[a]=0;c.setBigUint64(d-8,BigInt(8*this.length),e),this.process(c,0);let g=$(a),h=this.outputLen;if(h%4)throw Error("_sha2: outputLen must be aligned to 32bit");let i=h/4,j=this.get();if(i>j.length)throw Error("_sha2: outputLen bigger than state");for(let a=0;a<i;a++)g.setUint32(4*a,j[a],e)}digest(){let{buffer:a,outputLen:b}=this;this.digestInto(a);let c=a.slice(0,b);return this.destroy(),c}_cloneInto(a){(a||=new this.constructor).set(...this.get());let{blockLen:b,buffer:c,length:d,finished:e,destroyed:f,pos:g}=this;return a.destroyed=f,a.finished=e,a.length=d,a.pos=g,d%b&&a.buffer.set(c),a}clone(){return this._cloneInto()}}let af=Uint32Array.from([0x6a09e667,0xbb67ae85,0x3c6ef372,0xa54ff53a,0x510e527f,0x9b05688c,0x1f83d9ab,0x5be0cd19]),ag=Uint32Array.from([0xc1059ed8,0x367cd507,0x3070dd17,0xf70e5939,0xffc00b31,0x68581511,0x64f98fa7,0xbefa4fa4]),ah=Uint32Array.from([0xcbbb9d5d,0xc1059ed8,0x629a292a,0x367cd507,0x9159015a,0x3070dd17,0x152fecd8,0xf70e5939,0x67332667,0xffc00b31,0x8eb44a87,0x68581511,0xdb0c2e0d,0x64f98fa7,0x47b5481d,0xbefa4fa4]),ai=Uint32Array.from([0x6a09e667,0xf3bcc908,0xbb67ae85,0x84caa73b,0x3c6ef372,0xfe94f82b,0xa54ff53a,0x5f1d36f1,0x510e527f,0xade682d1,0x9b05688c,0x2b3e6c1f,0x1f83d9ab,0xfb41bd6b,0x5be0cd19,0x137e2179]),aj=BigInt(0x100000000-1),ak=BigInt(32),al=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]),am=new Uint32Array(64);class an extends ae{constructor(a){super(64,a,8,!1)}get(){let{A:a,B:b,C:c,D:d,E:e,F:f,G:g,H:h}=this;return[a,b,c,d,e,f,g,h]}set(a,b,c,d,e,f,g,h){this.A=0|a,this.B=0|b,this.C=0|c,this.D=0|d,this.E=0|e,this.F=0|f,this.G=0|g,this.H=0|h}process(a,b){for(let c=0;c<16;c++,b+=4)am[c]=a.getUint32(b,!1);for(let a=16;a<64;a++){let b=am[a-15],c=am[a-2],d=_(b,7)^_(b,18)^b>>>3,e=_(c,17)^_(c,19)^c>>>10;am[a]=e+am[a-7]+d+am[a-16]|0}let{A:c,B:d,C:e,D:f,E:g,F:h,G:i,H:j}=this;for(let a=0;a<64;a++){var k,l,m,n;let b=j+(_(g,6)^_(g,11)^_(g,25))+((k=g)&h^~k&i)+al[a]+am[a]|0,o=(_(c,2)^_(c,13)^_(c,22))+((l=c)&(m=d)^l&(n=e)^m&n)|0;j=i,i=h,h=g,g=f+b|0,f=e,e=d,d=c,c=b+o|0}c=c+this.A|0,d=d+this.B|0,e=e+this.C|0,f=f+this.D|0,g=g+this.E|0,h=h+this.F|0,i=i+this.G|0,j=j+this.H|0,this.set(c,d,e,f,g,h,i,j)}roundClean(){Z(am)}destroy(){this.destroyed=!0,this.set(0,0,0,0,0,0,0,0),Z(this.buffer)}}class ao extends an{A=0|af[0];B=0|af[1];C=0|af[2];D=0|af[3];E=0|af[4];F=0|af[5];G=0|af[6];H=0|af[7];constructor(){super(32)}}let ap=function(a,b=!1){let c=a.length,d=new Uint32Array(c),e=new Uint32Array(c);for(let f=0;f<c;f++){let{h:c,l:g}=function(a,b=!1){return b?{h:Number(a&aj),l:Number(a>>ak&aj)}:{h:0|Number(a>>ak&aj),l:0|Number(a&aj)}}(a[f],b);[d[f],e[f]]=[c,g]}return[d,e]}(["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(a=>BigInt(a))),aq=ap[0],ar=ap[1],as=new Uint32Array(80),at=new Uint32Array(80),au=function(a,b={}){let c=(b,c)=>a(c).update(b).digest(),d=a(void 0);return c.outputLen=d.outputLen,c.blockLen=d.blockLen,c.canXOF=d.canXOF,c.create=b=>a(b),Object.assign(c,b),Object.freeze(c)}(()=>new ao,{oid:Uint8Array.from([6,9,96,134,72,1,101,3,4,2,1])}),av=new TextEncoder,aw=new TextDecoder;function ax(...a){let b=new Uint8Array(a.reduce((a,{length:b})=>a+b,0)),c=0;for(let d of a)b.set(d,c),c+=d.length;return b}function ay(a,b,c){if(b<0||b>=0x100000000)throw RangeError(`value must be >= 0 and <= ${0x100000000-1}. Received ${b}`);a.set([b>>>24,b>>>16,b>>>8,255&b],c)}function az(a){let b=Math.floor(a/0x100000000),c=new Uint8Array(8);return ay(c,b,0),ay(c,a%0x100000000,4),c}function aA(a){let b=new Uint8Array(4);return ay(b,a),b}function aB(a){let b=new Uint8Array(a.length);for(let c=0;c<a.length;c++){let d=a.charCodeAt(c);if(d>127)throw TypeError("non-ASCII string encountered in encode()");b[c]=d}return b}function aC(a){if(Uint8Array.fromBase64)return Uint8Array.fromBase64("string"==typeof a?a:aw.decode(a),{alphabet:"base64url"});let b=a;b instanceof Uint8Array&&(b=aw.decode(b)),b=b.replace(/-/g,"+").replace(/_/g,"/");try{var c=b;if(Uint8Array.fromBase64)return Uint8Array.fromBase64(c);let a=atob(c),d=new Uint8Array(a.length);for(let b=0;b<a.length;b++)d[b]=a.charCodeAt(b);return d}catch{throw TypeError("The input to be decoded is not correctly encoded.")}}function aD(a){let b=a;return("string"==typeof b&&(b=av.encode(b)),Uint8Array.prototype.toBase64)?b.toBase64({alphabet:"base64url",omitPadding:!0}):(function(a){if(Uint8Array.prototype.toBase64)return a.toBase64();let b=[];for(let c=0;c<a.length;c+=32768)b.push(String.fromCharCode.apply(null,a.subarray(c,c+32768)));return btoa(b.join(""))})(b).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}a.s(["decode",0,aC,"encode",0,aD],736256);let aE=Symbol();function aF(a,b){if(a)throw TypeError(`${b} can only be called once`)}function aG(a,b,c){try{return aC(a)}catch{throw new c(`Failed to base64url decode the ${b}`)}}async function aH(a,b){let c=`SHA-${a.slice(-3)}`;return new Uint8Array(await crypto.subtle.digest(c,b))}let aI=(a,b="algorithm.name")=>TypeError(`CryptoKey does not support this operation, its ${b} must be ${a}`);function aJ(a,b){if(parseInt(a.hash.name.slice(4),10)!==b)throw aI(`SHA-${b}`,"algorithm.hash")}function aK(a,b){if(b&&!a.usages.includes(b))throw TypeError(`CryptoKey does not support this operation, its usages must include ${b}.`)}function aL(a,b,c){switch(b){case"A128GCM":case"A192GCM":case"A256GCM":{if("AES-GCM"!==a.algorithm.name)throw aI("AES-GCM");let c=parseInt(b.slice(1,4),10);if(a.algorithm.length!==c)throw aI(c,"algorithm.length");break}case"A128KW":case"A192KW":case"A256KW":{if("AES-KW"!==a.algorithm.name)throw aI("AES-KW");let c=parseInt(b.slice(1,4),10);if(a.algorithm.length!==c)throw aI(c,"algorithm.length");break}case"ECDH":switch(a.algorithm.name){case"ECDH":case"X25519":break;default:throw aI("ECDH or X25519")}break;case"PBES2-HS256+A128KW":case"PBES2-HS384+A192KW":case"PBES2-HS512+A256KW":if("PBKDF2"!==a.algorithm.name)throw aI("PBKDF2");break;case"RSA-OAEP":case"RSA-OAEP-256":case"RSA-OAEP-384":case"RSA-OAEP-512":if("RSA-OAEP"!==a.algorithm.name)throw aI("RSA-OAEP");aJ(a.algorithm,parseInt(b.slice(9),10)||1);break;default:throw TypeError("CryptoKey does not support this operation")}aK(a,c)}function aM(a,b,...c){if((c=c.filter(Boolean)).length>2){let b=c.pop();a+=`one of type ${c.join(", ")}, or ${b}.`}else 2===c.length?a+=`one of type ${c[0]} or ${c[1]}.`:a+=`of type ${c[0]}.`;return null==b?a+=` Received ${b}`:"function"==typeof b&&b.name?a+=` Received function ${b.name}`:"object"==typeof b&&null!=b&&b.constructor?.name&&(a+=` Received an instance of ${b.constructor.name}`),a}let aN=(a,...b)=>aM("Key must be ",a,...b),aO=(a,b,...c)=>aM(`Key for the ${a} algorithm must be `,b,...c);class aP extends Error{static code="ERR_JOSE_GENERIC";code="ERR_JOSE_GENERIC";constructor(a,b){super(a,b),this.name=this.constructor.name,Error.captureStackTrace?.(this,this.constructor)}}class aQ extends aP{static code="ERR_JWT_CLAIM_VALIDATION_FAILED";code="ERR_JWT_CLAIM_VALIDATION_FAILED";claim;reason;payload;constructor(a,b,c="unspecified",d="unspecified"){super(a,{cause:{claim:c,reason:d,payload:b}}),this.claim=c,this.reason=d,this.payload=b}}class aR extends aP{static code="ERR_JWT_EXPIRED";code="ERR_JWT_EXPIRED";claim;reason;payload;constructor(a,b,c="unspecified",d="unspecified"){super(a,{cause:{claim:c,reason:d,payload:b}}),this.claim=c,this.reason=d,this.payload=b}}class aS extends aP{static code="ERR_JOSE_ALG_NOT_ALLOWED";code="ERR_JOSE_ALG_NOT_ALLOWED"}class aT extends aP{static code="ERR_JOSE_NOT_SUPPORTED";code="ERR_JOSE_NOT_SUPPORTED"}class aU extends aP{static code="ERR_JWE_DECRYPTION_FAILED";code="ERR_JWE_DECRYPTION_FAILED";constructor(a="decryption operation failed",b){super(a,b)}}class aV extends aP{static code="ERR_JWE_INVALID";code="ERR_JWE_INVALID"}class aW extends aP{static code="ERR_JWS_INVALID";code="ERR_JWS_INVALID"}class aX extends aP{static code="ERR_JWT_INVALID";code="ERR_JWT_INVALID"}class aY extends aP{static code="ERR_JWK_INVALID";code="ERR_JWK_INVALID"}class aZ extends aP{static code="ERR_JWKS_INVALID";code="ERR_JWKS_INVALID"}class a$ extends aP{static code="ERR_JWKS_NO_MATCHING_KEY";code="ERR_JWKS_NO_MATCHING_KEY";constructor(a="no applicable key found in the JSON Web Key Set",b){super(a,b)}}class a_ extends aP{[Symbol.asyncIterator];static code="ERR_JWKS_MULTIPLE_MATCHING_KEYS";code="ERR_JWKS_MULTIPLE_MATCHING_KEYS";constructor(a="multiple matching keys found in the JSON Web Key Set",b){super(a,b)}}class a0 extends aP{static code="ERR_JWKS_TIMEOUT";code="ERR_JWKS_TIMEOUT";constructor(a="request timed out",b){super(a,b)}}class a1 extends aP{static code="ERR_JWS_SIGNATURE_VERIFICATION_FAILED";code="ERR_JWS_SIGNATURE_VERIFICATION_FAILED";constructor(a="signature verification failed",b){super(a,b)}}function a2(a){if(!a3(a))throw Error("CryptoKey instance expected")}let a3=a=>{if(a?.[Symbol.toStringTag]==="CryptoKey")return!0;try{return a instanceof CryptoKey}catch{return!1}},a4=a=>a?.[Symbol.toStringTag]==="KeyObject",a5=a=>a3(a)||a4(a);function a6(a){switch(a){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 aT(`Unsupported JWE Algorithm: ${a}`)}}let a7=a=>crypto.getRandomValues(new Uint8Array(a6(a)>>3));function a8(a,b){let c=a.byteLength<<3;if(c!==b)throw new aV(`Invalid Content Encryption Key length. Expected ${b} bits, got ${c} bits`)}function a9(a){switch(a){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 aT(`Unsupported JWE Algorithm: ${a}`)}}function ba(a,b){if(b.length<<3!==a9(a))throw new aV("Invalid Initialization Vector length")}async function bb(a,b,c){if(!(b instanceof Uint8Array))throw TypeError(aN(b,"Uint8Array"));let d=parseInt(a.slice(1,4),10);return{encKey:await crypto.subtle.importKey("raw",b.subarray(d>>3),"AES-CBC",!1,[c]),macKey:await crypto.subtle.importKey("raw",b.subarray(0,d>>3),{hash:`SHA-${d<<1}`,name:"HMAC"},!1,["sign"]),keySize:d}}async function bc(a,b,c){return new Uint8Array((await crypto.subtle.sign("HMAC",a,b)).slice(0,c>>3))}async function bd(a,b,c,d,e){let{encKey:f,macKey:g,keySize:h}=await bb(a,c,"encrypt"),i=new Uint8Array(await crypto.subtle.encrypt({iv:d,name:"AES-CBC"},f,b)),j=ax(e,d,i,az(e.length<<3));return{ciphertext:i,tag:await bc(g,j,h),iv:d}}async function be(a,b){if(!(a instanceof Uint8Array))throw TypeError("First argument must be a buffer");if(!(b instanceof Uint8Array))throw TypeError("Second argument must be a buffer");let c={name:"HMAC",hash:"SHA-256"},d=await crypto.subtle.generateKey(c,!1,["sign"]),e=new Uint8Array(await crypto.subtle.sign(c,d,a)),f=new Uint8Array(await crypto.subtle.sign(c,d,b)),g=0,h=-1;for(;++h<32;)g|=e[h]^f[h];return 0===g}async function bf(a,b,c,d,e,f){let g,h,{encKey:i,macKey:j,keySize:k}=await bb(a,b,"decrypt"),l=ax(f,d,c,az(f.length<<3)),m=await bc(j,l,k);try{g=await be(e,m)}catch{}if(!g)throw new aU;try{h=new Uint8Array(await crypto.subtle.decrypt({iv:d,name:"AES-CBC"},i,c))}catch{}if(!h)throw new aU;return h}async function bg(a,b,c,d,e){let f;c instanceof Uint8Array?f=await crypto.subtle.importKey("raw",c,"AES-GCM",!1,["encrypt"]):(aL(c,a,"encrypt"),f=c);let g=new Uint8Array(await crypto.subtle.encrypt({additionalData:e,iv:d,name:"AES-GCM",tagLength:128},f,b)),h=g.slice(-16);return{ciphertext:g.slice(0,-16),tag:h,iv:d}}async function bh(a,b,c,d,e,f){let g;b instanceof Uint8Array?g=await crypto.subtle.importKey("raw",b,"AES-GCM",!1,["decrypt"]):(aL(b,a,"decrypt"),g=b);try{return new Uint8Array(await crypto.subtle.decrypt({additionalData:f,iv:d,name:"AES-GCM",tagLength:128},g,ax(c,e)))}catch{throw new aU}}let bi="Unsupported JWE Content Encryption Algorithm";async function bj(a,b,c,d,e){if(!a3(c)&&!(c instanceof Uint8Array))throw TypeError(aN(c,"CryptoKey","KeyObject","Uint8Array","JSON Web Key"));if(d)ba(a,d);else d=crypto.getRandomValues(new Uint8Array(a9(a)>>3));switch(a){case"A128CBC-HS256":case"A192CBC-HS384":case"A256CBC-HS512":return c instanceof Uint8Array&&a8(c,parseInt(a.slice(-3),10)),bd(a,b,c,d,e);case"A128GCM":case"A192GCM":case"A256GCM":return c instanceof Uint8Array&&a8(c,parseInt(a.slice(1,4),10)),bg(a,b,c,d,e);default:throw new aT(bi)}}async function bk(a,b,c,d,e,f){if(!a3(b)&&!(b instanceof Uint8Array))throw TypeError(aN(b,"CryptoKey","KeyObject","Uint8Array","JSON Web Key"));if(!d)throw new aV("JWE Initialization Vector missing");if(!e)throw new aV("JWE Authentication Tag missing");switch(ba(a,d),a){case"A128CBC-HS256":case"A192CBC-HS384":case"A256CBC-HS512":return b instanceof Uint8Array&&a8(b,parseInt(a.slice(-3),10)),bf(a,b,c,d,e,f);case"A128GCM":case"A192GCM":case"A256GCM":return b instanceof Uint8Array&&a8(b,parseInt(a.slice(1,4),10)),bh(a,b,c,d,e,f);default:throw new aT(bi)}}function bl(a,b){if(a.algorithm.length!==parseInt(b.slice(1,4),10))throw TypeError(`Invalid key size for alg: ${b}`)}function bm(a,b,c){return a instanceof Uint8Array?crypto.subtle.importKey("raw",a,"AES-KW",!0,[c]):(aL(a,b,c),a)}async function bn(a,b,c){let d=await bm(b,a,"wrapKey");bl(d,a);let e=await crypto.subtle.importKey("raw",c,{hash:"SHA-256",name:"HMAC"},!0,["sign"]);return new Uint8Array(await crypto.subtle.wrapKey("raw",e,d,"AES-KW"))}async function bo(a,b,c){let d=await bm(b,a,"unwrapKey");bl(d,a);let e=await crypto.subtle.unwrapKey("raw",c,d,"AES-KW",{hash:"SHA-256",name:"HMAC"},!0,["sign"]);return new Uint8Array(await crypto.subtle.exportKey("raw",e))}function bp(a){return ax(aA(a.length),a)}async function bq(a,b,c){let d=b>>3,e=Math.ceil(d/32),f=new Uint8Array(32*e);for(let b=1;b<=e;b++){let d=new Uint8Array(4+a.length+c.length);d.set(aA(b),0),d.set(a,4),d.set(c,4+a.length);let e=await aH("sha256",d);f.set(e,(b-1)*32)}return f.slice(0,d)}async function br(a,b,c,d,e=new Uint8Array,f=new Uint8Array){var g;aL(a,"ECDH"),aL(b,"ECDH","deriveBits");let h=ax(bp(aB(c)),bp(e),bp(f),aA(d),new Uint8Array);return bq(new Uint8Array(await crypto.subtle.deriveBits({name:a.algorithm.name,public:a},b,"X25519"===(g=a).algorithm.name?256:Math.ceil(parseInt(g.algorithm.namedCurve.slice(-3),10)/8)<<3)),d,h)}function bs(a){switch(a.algorithm.namedCurve){case"P-256":case"P-384":case"P-521":return!0;default:return"X25519"===a.algorithm.name}}async function bt(a,b,c,d){if(!(a instanceof Uint8Array)||a.length<8)throw new aV("PBES2 Salt Input must be 8 or more octets");if(!Number.isSafeInteger(c)||1!==Math.sign(c))throw new aV("PBES2 Count Input must be a positive integer");let e=ax(aB(b),Uint8Array.of(0),a),f=parseInt(b.slice(13,16),10),g={hash:`SHA-${b.slice(8,11)}`,iterations:c,name:"PBKDF2",salt:e},h=await (d instanceof Uint8Array?crypto.subtle.importKey("raw",d,"PBKDF2",!1,["deriveBits"]):(aL(d,b,"deriveBits"),d));return new Uint8Array(await crypto.subtle.deriveBits(g,h,f))}async function bu(a,b,c,d=2048,e=crypto.getRandomValues(new Uint8Array(16))){let f=await bt(e,a,d,b);return{encryptedKey:await bn(a.slice(-6),f,c),p2c:d,p2s:aD(e)}}async function bv(a,b,c,d,e){let f=await bt(e,a,d,b);return bo(a.slice(-6),f,c)}function bw(a,b){if(a.startsWith("RS")||a.startsWith("PS")){let{modulusLength:c}=b.algorithm;if("number"!=typeof c||c<2048)throw TypeError(`${a} requires key modulusLength to be 2048 bits or larger`)}}function bx(a,b){let c=`SHA-${a.slice(-3)}`;switch(a){case"HS256":case"HS384":case"HS512":return{hash:c,name:"HMAC"};case"PS256":case"PS384":case"PS512":return{hash:c,name:"RSA-PSS",saltLength:parseInt(a.slice(-3),10)>>3};case"RS256":case"RS384":case"RS512":return{hash:c,name:"RSASSA-PKCS1-v1_5"};case"ES256":case"ES384":case"ES512":return{hash:c,name:"ECDSA",namedCurve:b.namedCurve};case"Ed25519":case"EdDSA":return{name:"Ed25519"};case"ML-DSA-44":case"ML-DSA-65":case"ML-DSA-87":return{name:a};default:throw new aT(`alg ${a} is not supported either by JOSE or your javascript runtime`)}}async function by(a,b,c){if(b instanceof Uint8Array){if(!a.startsWith("HS"))throw TypeError(aN(b,"CryptoKey","KeyObject","JSON Web Key"));return crypto.subtle.importKey("raw",b,{hash:`SHA-${a.slice(-3)}`,name:"HMAC"},!1,[c])}switch(a){case"HS256":case"HS384":case"HS512":if("HMAC"!==b.algorithm.name)throw aI("HMAC");aJ(b.algorithm,parseInt(a.slice(2),10));break;case"RS256":case"RS384":case"RS512":if("RSASSA-PKCS1-v1_5"!==b.algorithm.name)throw aI("RSASSA-PKCS1-v1_5");aJ(b.algorithm,parseInt(a.slice(2),10));break;case"PS256":case"PS384":case"PS512":if("RSA-PSS"!==b.algorithm.name)throw aI("RSA-PSS");aJ(b.algorithm,parseInt(a.slice(2),10));break;case"Ed25519":case"EdDSA":if("Ed25519"!==b.algorithm.name)throw aI("Ed25519");break;case"ML-DSA-44":case"ML-DSA-65":case"ML-DSA-87":let d;if(d=b.algorithm,d.name!==a)throw aI(a);break;case"ES256":case"ES384":case"ES512":{if("ECDSA"!==b.algorithm.name)throw aI("ECDSA");let c=function(a){switch(a){case"ES256":return"P-256";case"ES384":return"P-384";case"ES512":return"P-521";default:throw Error("unreachable")}}(a);if(b.algorithm.namedCurve!==c)throw aI(c,"algorithm.namedCurve");break}default:throw TypeError("CryptoKey does not support this operation")}return aK(b,c),b}async function bz(a,b,c){let d=await by(a,b,"sign");return bw(a,d),new Uint8Array(await crypto.subtle.sign(bx(a,d.algorithm),d,c))}async function bA(a,b,c,d){let e=await by(a,b,"verify");bw(a,e);let f=bx(a,e.algorithm);try{return await crypto.subtle.verify(f,e,c,d)}catch{return!1}}let bB=a=>{switch(a){case"RSA-OAEP":case"RSA-OAEP-256":case"RSA-OAEP-384":case"RSA-OAEP-512":return"RSA-OAEP";default:throw new aT(`alg ${a} is not supported either by JOSE or your javascript runtime`)}};async function bC(a,b,c){return aL(b,a,"encrypt"),bw(a,b),new Uint8Array(await crypto.subtle.encrypt(bB(a),b,c))}async function bD(a,b,c){return aL(b,a,"decrypt"),bw(a,b),new Uint8Array(await crypto.subtle.decrypt(bB(a),b,c))}function bE(a){if("object"!=typeof a||null===a||"[object Object]"!==Object.prototype.toString.call(a))return!1;if(null===Object.getPrototypeOf(a))return!0;let b=a;for(;null!==Object.getPrototypeOf(b);)b=Object.getPrototypeOf(b);return Object.getPrototypeOf(a)===b}function bF(...a){let b,c=a.filter(Boolean);if(0===c.length||1===c.length)return!0;for(let a of c){let c=Object.keys(a);if(!b||0===b.size){b=new Set(c);continue}for(let a of c){if(b.has(a))return!1;b.add(a)}}return!0}let bG=a=>bE(a)&&"string"==typeof a.kty,bH='Invalid or unsupported JWK "alg" (Algorithm) Parameter value';async function bI(a){if(!a.alg)throw TypeError('"alg" argument is required when "jwk.alg" is not present');let{algorithm:b,keyUsages:c}=function(a){let b,c;switch(a.kty){case"AKP":switch(a.alg){case"ML-DSA-44":case"ML-DSA-65":case"ML-DSA-87":b={name:a.alg},c=a.priv?["sign"]:["verify"];break;default:throw new aT(bH)}break;case"RSA":switch(a.alg){case"PS256":case"PS384":case"PS512":b={name:"RSA-PSS",hash:`SHA-${a.alg.slice(-3)}`},c=a.d?["sign"]:["verify"];break;case"RS256":case"RS384":case"RS512":b={name:"RSASSA-PKCS1-v1_5",hash:`SHA-${a.alg.slice(-3)}`},c=a.d?["sign"]:["verify"];break;case"RSA-OAEP":case"RSA-OAEP-256":case"RSA-OAEP-384":case"RSA-OAEP-512":b={name:"RSA-OAEP",hash:`SHA-${parseInt(a.alg.slice(-3),10)||1}`},c=a.d?["decrypt","unwrapKey"]:["encrypt","wrapKey"];break;default:throw new aT(bH)}break;case"EC":switch(a.alg){case"ES256":case"ES384":case"ES512":b={name:"ECDSA",namedCurve:({ES256:"P-256",ES384:"P-384",ES512:"P-521"})[a.alg]},c=a.d?["sign"]:["verify"];break;case"ECDH-ES":case"ECDH-ES+A128KW":case"ECDH-ES+A192KW":case"ECDH-ES+A256KW":b={name:"ECDH",namedCurve:a.crv},c=a.d?["deriveBits"]:[];break;default:throw new aT(bH)}break;case"OKP":switch(a.alg){case"Ed25519":case"EdDSA":b={name:"Ed25519"},c=a.d?["sign"]:["verify"];break;case"ECDH-ES":case"ECDH-ES+A128KW":case"ECDH-ES+A192KW":case"ECDH-ES+A256KW":b={name:a.crv},c=a.d?["deriveBits"]:[];break;default:throw new aT(bH)}break;default:throw new aT('Invalid or unsupported JWK "kty" (Key Type) Parameter value')}return{algorithm:b,keyUsages:c}}(a),d={...a};return"AKP"!==d.kty&&delete d.alg,delete d.use,crypto.subtle.importKey("jwk",d,b,a.ext??(!a.d&&!a.priv),a.key_ops??c)}let bJ="given KeyObject instance cannot be used for this algorithm",bK=async(a,c,d,e=!1)=>{let f=(b||=new WeakMap).get(a);if(f?.[d])return f[d];let g=await bI({...c,alg:d});return e&&Object.freeze(a),f?f[d]=g:b.set(a,{[d]:g}),g};async function bL(a,c){if(a instanceof Uint8Array||a3(a))return a;if(a4(a)){if("secret"===a.type)return a.export();if("toCryptoKey"in a&&"function"==typeof a.toCryptoKey)try{return((a,c)=>{let d,e=(b||=new WeakMap).get(a);if(e?.[c])return e[c];let f="public"===a.type,g=!!f;if("x25519"===a.asymmetricKeyType){switch(c){case"ECDH-ES":case"ECDH-ES+A128KW":case"ECDH-ES+A192KW":case"ECDH-ES+A256KW":break;default:throw TypeError(bJ)}d=a.toCryptoKey(a.asymmetricKeyType,g,f?[]:["deriveBits"])}if("ed25519"===a.asymmetricKeyType){if("EdDSA"!==c&&"Ed25519"!==c)throw TypeError(bJ);d=a.toCryptoKey(a.asymmetricKeyType,g,[f?"verify":"sign"])}switch(a.asymmetricKeyType){case"ml-dsa-44":case"ml-dsa-65":case"ml-dsa-87":if(c!==a.asymmetricKeyType.toUpperCase())throw TypeError(bJ);d=a.toCryptoKey(a.asymmetricKeyType,g,[f?"verify":"sign"])}if("rsa"===a.asymmetricKeyType){let b;switch(c){case"RSA-OAEP":b="SHA-1";break;case"RS256":case"PS256":case"RSA-OAEP-256":b="SHA-256";break;case"RS384":case"PS384":case"RSA-OAEP-384":b="SHA-384";break;case"RS512":case"PS512":case"RSA-OAEP-512":b="SHA-512";break;default:throw TypeError(bJ)}if(c.startsWith("RSA-OAEP"))return a.toCryptoKey({name:"RSA-OAEP",hash:b},g,f?["encrypt"]:["decrypt"]);d=a.toCryptoKey({name:c.startsWith("PS")?"RSA-PSS":"RSASSA-PKCS1-v1_5",hash:b},g,[f?"verify":"sign"])}if("ec"===a.asymmetricKeyType){let b=new Map([["prime256v1","P-256"],["secp384r1","P-384"],["secp521r1","P-521"]]).get(a.asymmetricKeyDetails?.namedCurve);if(!b)throw TypeError(bJ);let e={ES256:"P-256",ES384:"P-384",ES512:"P-521"};e[c]&&b===e[c]&&(d=a.toCryptoKey({name:"ECDSA",namedCurve:b},g,[f?"verify":"sign"])),c.startsWith("ECDH-ES")&&(d=a.toCryptoKey({name:"ECDH",namedCurve:b},g,f?[]:["deriveBits"]))}if(!d)throw TypeError(bJ);return e?e[c]=d:b.set(a,{[c]:d}),d})(a,c)}catch(a){if(a instanceof TypeError)throw a}let d=a.export({format:"jwk"});return bK(a,d,c)}if(bG(a))return a.k?aC(a.k):bK(a,a,c,!0);throw Error("unreachable")}async function bM(a,b,c){let d;if(!bE(a))throw TypeError("JWK must be an object");switch(b??=a.alg,d??=c?.extractable??a.ext,a.kty){case"oct":if("string"!=typeof a.k||!a.k)throw TypeError('missing "k" (Key Value) Parameter value');return aC(a.k);case"RSA":if("oth"in a&&void 0!==a.oth)throw new aT('RSA JWK "oth" (Other Primes Info) Parameter value is not supported');return bI({...a,alg:b,ext:d});case"AKP":if("string"!=typeof a.alg||!a.alg)throw TypeError('missing "alg" (Algorithm) Parameter value');if(void 0!==b&&b!==a.alg)throw TypeError("JWK alg and alg option value mismatch");return bI({...a,ext:d});case"EC":case"OKP":return bI({...a,alg:b,ext:d});default:throw new aT('Unsupported "kty" (Key Type) Parameter value')}}async function bN(a){if(a4(a))if("secret"!==a.type)return a.export({format:"jwk"});else a=a.export();if(a instanceof Uint8Array)return{kty:"oct",k:aD(a)};if(!a3(a))throw TypeError(aN(a,"CryptoKey","KeyObject","Uint8Array"));if(!a.extractable)throw TypeError("non-extractable CryptoKey cannot be exported as a JWK");let{ext:b,key_ops:c,alg:d,use:e,...f}=await crypto.subtle.exportKey("jwk",a);return"AKP"===f.kty&&(f.alg=d),f}async function bO(a){return bN(a)}async function bP(a,b,c,d){let e=a.slice(0,7),f=await bj(e,c,b,d,new Uint8Array);return{encryptedKey:f.ciphertext,iv:aD(f.iv),tag:aD(f.tag)}}async function bQ(a,b,c,d,e){return bk(a.slice(0,7),b,c,d,e,new Uint8Array)}let bR='Invalid or unsupported "alg" (JWE Algorithm) header value';function bS(a){if(void 0===a)throw new aV("JWE Encrypted Key missing")}async function bT(a,b,c,d,e){switch(a){case"dir":if(void 0!==c)throw new aV("Encountered unexpected JWE Encrypted Key");return b;case"ECDH-ES":if(void 0!==c)throw new aV("Encountered unexpected JWE Encrypted Key");case"ECDH-ES+A128KW":case"ECDH-ES+A192KW":case"ECDH-ES+A256KW":{let e,f;if(!bE(d.epk))throw new aV('JOSE Header "epk" (Ephemeral Public Key) missing or invalid');if(a2(b),!bs(b))throw new aT("ECDH with the provided key is not allowed or not supported by your javascript runtime");let g=await bM(d.epk,a);if(a2(g),void 0!==d.apu){if("string"!=typeof d.apu)throw new aV('JOSE Header "apu" (Agreement PartyUInfo) invalid');e=aG(d.apu,"apu",aV)}if(void 0!==d.apv){if("string"!=typeof d.apv)throw new aV('JOSE Header "apv" (Agreement PartyVInfo) invalid');f=aG(d.apv,"apv",aV)}let h=await br(g,b,"ECDH-ES"===a?d.enc:a,"ECDH-ES"===a?a6(d.enc):parseInt(a.slice(-5,-2),10),e,f);if("ECDH-ES"===a)return h;return bS(c),bo(a.slice(-6),h,c)}case"RSA-OAEP":case"RSA-OAEP-256":case"RSA-OAEP-384":case"RSA-OAEP-512":return bS(c),a2(b),bD(a,b,c);case"PBES2-HS256+A128KW":case"PBES2-HS384+A192KW":case"PBES2-HS512+A256KW":{let f;if(bS(c),"number"!=typeof d.p2c)throw new aV('JOSE Header "p2c" (PBES2 Count) missing or invalid');let g=e?.maxPBES2Count||1e4;if(d.p2c>g)throw new aV('JOSE Header "p2c" (PBES2 Count) out is of acceptable bounds');if("string"!=typeof d.p2s)throw new aV('JOSE Header "p2s" (PBES2 Salt) missing or invalid');return f=aG(d.p2s,"p2s",aV),bv(a,b,c,d.p2c,f)}case"A128KW":case"A192KW":case"A256KW":return bS(c),bo(a,b,c);case"A128GCMKW":case"A192GCMKW":case"A256GCMKW":if(bS(c),"string"!=typeof d.iv)throw new aV('JOSE Header "iv" (Initialization Vector) missing or invalid');if("string"!=typeof d.tag)throw new aV('JOSE Header "tag" (Authentication Tag) missing or invalid');return bQ(a,b,c,aG(d.iv,"iv",aV),aG(d.tag,"tag",aV));default:throw new aT(bR)}}async function bU(a,b,c,d,e={}){let f,g,h;switch(a){case"dir":h=c;break;case"ECDH-ES":case"ECDH-ES+A128KW":case"ECDH-ES+A192KW":case"ECDH-ES+A256KW":{let i;if(a2(c),!bs(c))throw new aT("ECDH with the provided key is not allowed or not supported by your javascript runtime");let{apu:j,apv:k}=e;i=e.epk?await bL(e.epk,a):(await crypto.subtle.generateKey(c.algorithm,!0,["deriveBits"])).privateKey;let{x:l,y:m,crv:n,kty:o}=await bO(i),p=await br(c,i,"ECDH-ES"===a?b:a,"ECDH-ES"===a?a6(b):parseInt(a.slice(-5,-2),10),j,k);if(g={epk:{x:l,crv:n,kty:o}},"EC"===o&&(g.epk.y=m),j&&(g.apu=aD(j)),k&&(g.apv=aD(k)),"ECDH-ES"===a){h=p;break}h=d||a7(b);let q=a.slice(-6);f=await bn(q,p,h);break}case"RSA-OAEP":case"RSA-OAEP-256":case"RSA-OAEP-384":case"RSA-OAEP-512":h=d||a7(b),a2(c),f=await bC(a,c,h);break;case"PBES2-HS256+A128KW":case"PBES2-HS384+A192KW":case"PBES2-HS512+A256KW":{h=d||a7(b);let{p2c:i,p2s:j}=e;({encryptedKey:f,...g}=await bu(a,c,h,i,j));break}case"A128KW":case"A192KW":case"A256KW":h=d||a7(b),f=await bn(a,c,h);break;case"A128GCMKW":case"A192GCMKW":case"A256GCMKW":{h=d||a7(b);let{iv:i}=e;({encryptedKey:f,...g}=await bP(a,c,h,i));break}default:throw new aT(bR)}return{cek:h,encryptedKey:f,parameters:g}}function bV(a,b,c,d,e){let f;if(void 0!==e.crit&&d?.crit===void 0)throw new a('"crit" (Critical) Header Parameter MUST be integrity protected');if(!d||void 0===d.crit)return new Set;if(!Array.isArray(d.crit)||0===d.crit.length||d.crit.some(a=>"string"!=typeof a||0===a.length))throw new a('"crit" (Critical) Header Parameter MUST be an array of non-empty strings when present');for(let g of(f=void 0!==c?new Map([...Object.entries(c),...b.entries()]):b,d.crit)){if(!f.has(g))throw new aT(`Extension Header Parameter "${g}" is not recognized`);if(void 0===e[g])throw new a(`Extension Header Parameter "${g}" is missing`);if(f.get(g)&&void 0===d[g])throw new a(`Extension Header Parameter "${g}" MUST be integrity protected`)}return new Set(d.crit)}let bW=a=>a?.[Symbol.toStringTag],bX=(a,b,c)=>{if(void 0!==b.use){let a;switch(c){case"sign":case"verify":a="sig";break;case"encrypt":case"decrypt":a="enc"}if(b.use!==a)throw TypeError(`Invalid key for this operation, its "use" must be "${a}" when present`)}if(void 0!==b.alg&&b.alg!==a)throw TypeError(`Invalid key for this operation, its "alg" must be "${a}" when present`);if(Array.isArray(b.key_ops)){let d;switch(!0){case"sign"===c||"verify"===c:case"dir"===a:case a.includes("CBC-HS"):d=c;break;case a.startsWith("PBES2"):d="deriveBits";break;case/^A\d{3}(?:GCM)?(?:KW)?$/.test(a):d=!a.includes("GCM")&&a.endsWith("KW")?"encrypt"===c?"wrapKey":"unwrapKey":c;break;case"encrypt"===c&&a.startsWith("RSA"):d="wrapKey";break;case"decrypt"===c:d=a.startsWith("RSA")?"unwrapKey":"deriveBits"}if(d&&b.key_ops?.includes?.(d)===!1)throw TypeError(`Invalid key for this operation, its "key_ops" must include "${d}" when present`)}return!0};function bY(a,b,c){switch(a.substring(0,2)){case"A1":case"A2":case"di":case"HS":case"PB":((a,b,c)=>{if(!(b instanceof Uint8Array)){if(bG(b)){if("oct"===b.kty&&"string"==typeof b.k&&bX(a,b,c))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(!a5(b))throw TypeError(aO(a,b,"CryptoKey","KeyObject","JSON Web Key","Uint8Array"));if("secret"!==b.type)throw TypeError(`${bW(b)} instances for symmetric algorithms must be of type "secret"`)}})(a,b,c);break;default:((a,b,c)=>{if(bG(b))switch(c){case"decrypt":case"sign":if("oct"!==b.kty&&("AKP"===b.kty&&"string"==typeof b.priv||"string"==typeof b.d)&&bX(a,b,c))return;throw TypeError("JSON Web Key for this operation must be a private JWK");case"encrypt":case"verify":if("oct"!==b.kty&&void 0===b.d&&void 0===b.priv&&bX(a,b,c))return;throw TypeError("JSON Web Key for this operation must be a public JWK")}if(!a5(b))throw TypeError(aO(a,b,"CryptoKey","KeyObject","JSON Web Key"));if("secret"===b.type)throw TypeError(`${bW(b)} instances for asymmetric algorithms must not be of type "secret"`);if("public"===b.type)switch(c){case"sign":throw TypeError(`${bW(b)} instances for asymmetric algorithm signing must be of type "private"`);case"decrypt":throw TypeError(`${bW(b)} instances for asymmetric algorithm decryption must be of type "private"`)}if("private"===b.type)switch(c){case"verify":throw TypeError(`${bW(b)} instances for asymmetric algorithm verifying must be of type "public"`);case"encrypt":throw TypeError(`${bW(b)} instances for asymmetric algorithm encryption must be of type "public"`)}})(a,b,c)}}function bZ(a){if(void 0===globalThis[a])throw new aT(`JWE "zip" (Compression Algorithm) Header Parameter requires the ${a} API.`)}async function b$(a){bZ("CompressionStream");let b=new CompressionStream("deflate-raw"),c=b.writable.getWriter();c.write(a).catch(()=>{}),c.close().catch(()=>{});let d=[],e=b.readable.getReader();for(;;){let{value:a,done:b}=await e.read();if(b)break;d.push(a)}return ax(...d)}async function b_(a,b){bZ("DecompressionStream");let c=new DecompressionStream("deflate-raw"),d=c.writable.getWriter();d.write(a).catch(()=>{}),d.close().catch(()=>{});let e=[],f=0,g=c.readable.getReader();for(;;){let{value:a,done:c}=await g.read();if(c)break;if(e.push(a),f+=a.byteLength,b!==1/0&&f>b)throw new aV("Decompressed plaintext exceeded the configured limit")}return ax(...e)}class b0{#a;#b;#c;#d;#e;#f;#g;#h;constructor(a){if(!(a instanceof Uint8Array))throw TypeError("plaintext must be an instance of Uint8Array");this.#a=a}setKeyManagementParameters(a){return aF(this.#h,"setKeyManagementParameters"),this.#h=a,this}setProtectedHeader(a){return aF(this.#b,"setProtectedHeader"),this.#b=a,this}setSharedUnprotectedHeader(a){return aF(this.#c,"setSharedUnprotectedHeader"),this.#c=a,this}setUnprotectedHeader(a){return aF(this.#d,"setUnprotectedHeader"),this.#d=a,this}setAdditionalAuthenticatedData(a){return this.#e=a,this}setContentEncryptionKey(a){return aF(this.#f,"setContentEncryptionKey"),this.#f=a,this}setInitializationVector(a){return aF(this.#g,"setInitializationVector"),this.#g=a,this}async encrypt(a,b){let c,d,e,f,g,h;if(!this.#b&&!this.#d&&!this.#c)throw new aV("either setProtectedHeader, setUnprotectedHeader, or sharedUnprotectedHeader must be called before #encrypt()");if(!bF(this.#b,this.#d,this.#c))throw new aV("JWE Protected, JWE Shared Unprotected and JWE Per-Recipient Header Parameter names must be disjoint");let i={...this.#b,...this.#d,...this.#c};if(bV(aV,new Map,b?.crit,this.#b,i),void 0!==i.zip&&"DEF"!==i.zip)throw new aT('Unsupported JWE "zip" (Compression Algorithm) Header Parameter value.');if(void 0!==i.zip&&!this.#b?.zip)throw new aV('JWE "zip" (Compression Algorithm) Header Parameter MUST be in a protected header.');let{alg:j,enc:k}=i;if("string"!=typeof j||!j)throw new aV('JWE "alg" (Algorithm) Header Parameter missing or invalid');if("string"!=typeof k||!k)throw new aV('JWE "enc" (Encryption Algorithm) Header Parameter missing or invalid');if(this.#f&&("dir"===j||"ECDH-ES"===j))throw TypeError(`setContentEncryptionKey cannot be called with JWE "alg" (Algorithm) Header ${j}`);bY("dir"===j?k:j,a,"encrypt");{let e,f=await bL(a,j);({cek:d,encryptedKey:c,parameters:e}=await bU(j,k,f,this.#f,this.#h)),e&&(b&&aE in b?this.#d?this.#d={...this.#d,...e}:this.setUnprotectedHeader(e):this.#b?this.#b={...this.#b,...e}:this.setProtectedHeader(e))}if(this.#b?g=aB(f=aD(JSON.stringify(this.#b))):(f="",g=new Uint8Array),this.#e){let a=aB(h=aD(this.#e));e=ax(g,aB("."),a)}else e=g;let l=this.#a;"DEF"===i.zip&&(l=await b$(l).catch(a=>{throw new aV("Failed to compress plaintext",{cause:a})}));let{ciphertext:m,tag:n,iv:o}=await bj(k,l,d,this.#g,e),p={ciphertext:aD(m)};return o&&(p.iv=aD(o)),n&&(p.tag=aD(n)),c&&(p.encrypted_key=aD(c)),h&&(p.aad=h),this.#b&&(p.protected=f),this.#c&&(p.unprotected=this.#c),this.#d&&(p.header=this.#d),p}}class b1{#i;constructor(a){this.#i=new b0(a)}setContentEncryptionKey(a){return this.#i.setContentEncryptionKey(a),this}setInitializationVector(a){return this.#i.setInitializationVector(a),this}setProtectedHeader(a){return this.#i.setProtectedHeader(a),this}setKeyManagementParameters(a){return this.#i.setKeyManagementParameters(a),this}async encrypt(a,b){let c=await this.#i.encrypt(a,b);return[c.protected,c.encrypted_key,c.iv,c.ciphertext,c.tag].join(".")}}let b2=a=>Math.floor(a.getTime()/1e3),b3=/^(\+|\-)? ?(\d+|\d+\.\d+) ?(seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)(?: (ago|from now))?$/i;function b4(a){let b,c=b3.exec(a);if(!c||c[4]&&c[1])throw TypeError("Invalid time period format");let d=parseFloat(c[2]);switch(c[3].toLowerCase()){case"sec":case"secs":case"second":case"seconds":case"s":b=Math.round(d);break;case"minute":case"minutes":case"min":case"mins":case"m":b=Math.round(60*d);break;case"hour":case"hours":case"hr":case"hrs":case"h":b=Math.round(3600*d);break;case"day":case"days":case"d":b=Math.round(86400*d);break;case"week":case"weeks":case"w":b=Math.round(604800*d);break;default:b=Math.round(0x1e187e0*d)}return"-"===c[1]||"ago"===c[4]?-b:b}function b5(a,b){if(!Number.isFinite(b))throw TypeError(`Invalid ${a} input`);return b}let b6=a=>a.includes("/")?a.toLowerCase():`application/${a.toLowerCase()}`;function b7(a,b,c={}){var d,e;let f,g;try{f=JSON.parse(aw.decode(b))}catch{}if(!bE(f))throw new aX("JWT Claims Set must be a top-level JSON object");let{typ:h}=c;if(h&&("string"!=typeof a.typ||b6(a.typ)!==b6(h)))throw new aQ('unexpected "typ" JWT header value',f,"typ","check_failed");let{requiredClaims:i=[],issuer:j,subject:k,audience:l,maxTokenAge:m}=c,n=[...i];for(let a of(void 0!==m&&n.push("iat"),void 0!==l&&n.push("aud"),void 0!==k&&n.push("sub"),void 0!==j&&n.push("iss"),new Set(n.reverse())))if(!(a in f))throw new aQ(`missing required "${a}" claim`,f,a,"missing");if(j&&!(Array.isArray(j)?j:[j]).includes(f.iss))throw new aQ('unexpected "iss" claim value',f,"iss","check_failed");if(k&&f.sub!==k)throw new aQ('unexpected "sub" claim value',f,"sub","check_failed");if(l&&(d=f.aud,e="string"==typeof l?[l]:l,"string"==typeof d?!e.includes(d):!(Array.isArray(d)&&e.some(Set.prototype.has.bind(new Set(d))))))throw new aQ('unexpected "aud" claim value',f,"aud","check_failed");switch(typeof c.clockTolerance){case"string":g=b4(c.clockTolerance);break;case"number":g=c.clockTolerance;break;case"undefined":g=0;break;default:throw TypeError("Invalid clockTolerance option type")}let{currentDate:o}=c,p=b2(o||new Date);if((void 0!==f.iat||m)&&"number"!=typeof f.iat)throw new aQ('"iat" claim must be a number',f,"iat","invalid");if(void 0!==f.nbf){if("number"!=typeof f.nbf)throw new aQ('"nbf" claim must be a number',f,"nbf","invalid");if(f.nbf>p+g)throw new aQ('"nbf" claim timestamp check failed',f,"nbf","check_failed")}if(void 0!==f.exp){if("number"!=typeof f.exp)throw new aQ('"exp" claim must be a number',f,"exp","invalid");if(f.exp<=p-g)throw new aR('"exp" claim timestamp check failed',f,"exp","check_failed")}if(m){let a=p-f.iat;if(a-g>("number"==typeof m?m:b4(m)))throw new aR('"iat" claim timestamp check failed (too far in the past)',f,"iat","check_failed");if(a<0-g)throw new aQ('"iat" claim timestamp check failed (it should be in the past)',f,"iat","check_failed")}return f}class b8{#j;constructor(a){if(!bE(a))throw TypeError("JWT Claims Set MUST be an object");this.#j=structuredClone(a)}data(){return av.encode(JSON.stringify(this.#j))}get iss(){return this.#j.iss}set iss(a){this.#j.iss=a}get sub(){return this.#j.sub}set sub(a){this.#j.sub=a}get aud(){return this.#j.aud}set aud(a){this.#j.aud=a}set jti(a){this.#j.jti=a}set nbf(a){"number"==typeof a?this.#j.nbf=b5("setNotBefore",a):a instanceof Date?this.#j.nbf=b5("setNotBefore",b2(a)):this.#j.nbf=b2(new Date)+b4(a)}set exp(a){"number"==typeof a?this.#j.exp=b5("setExpirationTime",a):a instanceof Date?this.#j.exp=b5("setExpirationTime",b2(a)):this.#j.exp=b2(new Date)+b4(a)}set iat(a){void 0===a?this.#j.iat=b2(new Date):a instanceof Date?this.#j.iat=b5("setIssuedAt",b2(a)):"string"==typeof a?this.#j.iat=b5("setIssuedAt",b2(new Date)+b4(a)):this.#j.iat=b5("setIssuedAt",a)}}class b9{#f;#g;#h;#b;#k;#l;#m;#n;constructor(a={}){this.#n=new b8(a)}setIssuer(a){return this.#n.iss=a,this}setSubject(a){return this.#n.sub=a,this}setAudience(a){return this.#n.aud=a,this}setJti(a){return this.#n.jti=a,this}setNotBefore(a){return this.#n.nbf=a,this}setExpirationTime(a){return this.#n.exp=a,this}setIssuedAt(a){return this.#n.iat=a,this}setProtectedHeader(a){return aF(this.#b,"setProtectedHeader"),this.#b=a,this}setKeyManagementParameters(a){return aF(this.#h,"setKeyManagementParameters"),this.#h=a,this}setContentEncryptionKey(a){return aF(this.#f,"setContentEncryptionKey"),this.#f=a,this}setInitializationVector(a){return aF(this.#g,"setInitializationVector"),this.#g=a,this}replicateIssuerAsHeader(){return this.#k=!0,this}replicateSubjectAsHeader(){return this.#l=!0,this}replicateAudienceAsHeader(){return this.#m=!0,this}async encrypt(a,b){let c=new b1(this.#n.data());return this.#b&&(this.#k||this.#l||this.#m)&&(this.#b={...this.#b,iss:this.#k?this.#n.iss:void 0,sub:this.#l?this.#n.sub:void 0,aud:this.#m?this.#n.aud:void 0}),c.setProtectedHeader(this.#b),this.#g&&c.setInitializationVector(this.#g),this.#f&&c.setContentEncryptionKey(this.#f),this.#h&&c.setKeyManagementParameters(this.#h),c.encrypt(a,b)}}class ca{#j;#b;#d;constructor(a){if(!(a instanceof Uint8Array))throw TypeError("payload must be an instance of Uint8Array");this.#j=a}setProtectedHeader(a){return aF(this.#b,"setProtectedHeader"),this.#b=a,this}setUnprotectedHeader(a){return aF(this.#d,"setUnprotectedHeader"),this.#d=a,this}async sign(a,b){let c,d,e,f;if(!this.#b&&!this.#d)throw new aW("either setProtectedHeader or setUnprotectedHeader must be called before #sign()");if(!bF(this.#b,this.#d))throw new aW("JWS Protected and JWS Unprotected Header Parameter names must be disjoint");let g={...this.#b,...this.#d},h=bV(aW,new Map([["b64",!0]]),b?.crit,this.#b,g),i=!0;if(h.has("b64")&&"boolean"!=typeof(i=this.#b.b64))throw new aW('The "b64" (base64url-encode payload) Header Parameter must be a boolean');let{alg:j}=g;if("string"!=typeof j||!j)throw new aW('JWS "alg" (Algorithm) Header Parameter missing or invalid');bY(j,a,"sign"),i?d=aB(c=aD(this.#j)):(d=this.#j,c=""),this.#b?f=aB(e=aD(JSON.stringify(this.#b))):(e="",f=new Uint8Array);let k=ax(f,aB("."),d),l=await bL(a,j),m={signature:aD(await bz(j,l,k)),payload:c};return this.#d&&(m.header=this.#d),this.#b&&(m.protected=e),m}}class cb{#i;constructor(a){this.#i=new ca(a)}setProtectedHeader(a){return this.#i.setProtectedHeader(a),this}async sign(a,b){let c=await this.#i.sign(a,b);if(void 0===c.payload)throw TypeError("use the flattened module for creating JWS with b64: false");return`${c.protected}.${c.payload}.${c.signature}`}}class cc{#b;#n;constructor(a={}){this.#n=new b8(a)}setIssuer(a){return this.#n.iss=a,this}setSubject(a){return this.#n.sub=a,this}setAudience(a){return this.#n.aud=a,this}setJti(a){return this.#n.jti=a,this}setNotBefore(a){return this.#n.nbf=a,this}setExpirationTime(a){return this.#n.exp=a,this}setIssuedAt(a){return this.#n.iat=a,this}setProtectedHeader(a){return this.#b=a,this}async sign(a,b){let c=new cb(this.#n.data());if(c.setProtectedHeader(this.#b),Array.isArray(this.#b?.crit)&&this.#b.crit.includes("b64")&&!1===this.#b.b64)throw new aX("JWTs MUST NOT use unencoded payload");return c.sign(a,b)}}var cd=a.i(736256),cd=cd;let ce=(a,b)=>{if("string"!=typeof a||!a)throw new aY(`${b} missing or invalid`)};async function cf(a,b){let c,d;if(bG(a))c=a;else if(a5(a))c=await bO(a);else throw TypeError(aN(a,"CryptoKey","KeyObject","JSON Web Key"));if("sha256"!==(b??="sha256")&&"sha384"!==b&&"sha512"!==b)throw TypeError('digestAlgorithm must one of "sha256", "sha384", or "sha512"');switch(c.kty){case"AKP":ce(c.alg,'"alg" (Algorithm) Parameter'),ce(c.pub,'"pub" (Public key) Parameter'),d={alg:c.alg,kty:c.kty,pub:c.pub};break;case"EC":ce(c.crv,'"crv" (Curve) Parameter'),ce(c.x,'"x" (X Coordinate) Parameter'),ce(c.y,'"y" (Y Coordinate) Parameter'),d={crv:c.crv,kty:c.kty,x:c.x,y:c.y};break;case"OKP":ce(c.crv,'"crv" (Subtype of Key Pair) Parameter'),ce(c.x,'"x" (Public Key) Parameter'),d={crv:c.crv,kty:c.kty,x:c.x};break;case"RSA":ce(c.e,'"e" (Exponent) Parameter'),ce(c.n,'"n" (Modulus) Parameter'),d={e:c.e,kty:c.kty,n:c.n};break;case"oct":ce(c.k,'"k" (Key Value) Parameter'),d={k:c.k,kty:c.kty};break;default:throw new aT('"kty" (Key Type) Parameter missing or unsupported')}let e=aB(JSON.stringify(d));return aD(await aH(b,e))}function cg(a){let b;if("string"==typeof a){let c=a.split(".");(3===c.length||5===c.length)&&([b]=c)}else if("object"==typeof a&&a)if("protected"in a)b=a.protected;else throw TypeError("Token does not contain a Protected Header");try{if("string"!=typeof b||!b)throw Error();let a=JSON.parse(aw.decode(aC(b)));if(!bE(a))throw Error();return a}catch{throw TypeError("Invalid Token or Protected Header formatting")}}function ch(a,b){if(void 0!==b&&(!Array.isArray(b)||b.some(a=>"string"!=typeof a)))throw TypeError(`"${a}" option must be an array of strings`);if(b)return new Set(b)}async function ci(a,b,c){let d,e,f,g,h,i;if(!bE(a))throw new aV("Flattened JWE must be an object");if(void 0===a.protected&&void 0===a.header&&void 0===a.unprotected)throw new aV("JOSE Header missing");if(void 0!==a.iv&&"string"!=typeof a.iv)throw new aV("JWE Initialization Vector incorrect type");if("string"!=typeof a.ciphertext)throw new aV("JWE Ciphertext missing or incorrect type");if(void 0!==a.tag&&"string"!=typeof a.tag)throw new aV("JWE Authentication Tag incorrect type");if(void 0!==a.protected&&"string"!=typeof a.protected)throw new aV("JWE Protected Header incorrect type");if(void 0!==a.encrypted_key&&"string"!=typeof a.encrypted_key)throw new aV("JWE Encrypted Key incorrect type");if(void 0!==a.aad&&"string"!=typeof a.aad)throw new aV("JWE AAD incorrect type");if(void 0!==a.header&&!bE(a.header))throw new aV("JWE Shared Unprotected Header incorrect type");if(void 0!==a.unprotected&&!bE(a.unprotected))throw new aV("JWE Per-Recipient Unprotected Header incorrect type");if(a.protected)try{let b=aC(a.protected);d=JSON.parse(aw.decode(b))}catch{throw new aV("JWE Protected Header is invalid")}if(!bF(d,a.header,a.unprotected))throw new aV("JWE Protected, JWE Unprotected Header, and JWE Per-Recipient Unprotected Header Parameter names must be disjoint");let j={...d,...a.header,...a.unprotected};if(bV(aV,new Map,c?.crit,d,j),void 0!==j.zip&&"DEF"!==j.zip)throw new aT('Unsupported JWE "zip" (Compression Algorithm) Header Parameter value.');if(void 0!==j.zip&&!d?.zip)throw new aV('JWE "zip" (Compression Algorithm) Header Parameter MUST be in a protected header.');let{alg:k,enc:l}=j;if("string"!=typeof k||!k)throw new aV("missing JWE Algorithm (alg) in JWE Header");if("string"!=typeof l||!l)throw new aV("missing JWE Encryption Algorithm (enc) in JWE Header");let m=c&&ch("keyManagementAlgorithms",c.keyManagementAlgorithms),n=c&&ch("contentEncryptionAlgorithms",c.contentEncryptionAlgorithms);if(m&&!m.has(k)||!m&&k.startsWith("PBES2"))throw new aS('"alg" (Algorithm) Header Parameter value not allowed');if(n&&!n.has(l))throw new aS('"enc" (Encryption Algorithm) Header Parameter value not allowed');void 0!==a.encrypted_key&&(e=aG(a.encrypted_key,"encrypted_key",aV));let o=!1;"function"==typeof b&&(b=await b(d,a),o=!0),bY("dir"===k?l:k,b,"decrypt");let p=await bL(b,k);try{f=await bT(k,p,e,j,c)}catch(a){if(a instanceof TypeError||a instanceof aV||a instanceof aT)throw a;f=a7(l)}void 0!==a.iv&&(g=aG(a.iv,"iv",aV)),void 0!==a.tag&&(h=aG(a.tag,"tag",aV));let q=void 0!==a.protected?aB(a.protected):new Uint8Array;i=void 0!==a.aad?ax(q,aB("."),aB(a.aad)):q;let r=aG(a.ciphertext,"ciphertext",aV),s=await bk(l,f,r,g,h,i),t={plaintext:s};if("DEF"===j.zip){let a=c?.maxDecompressedLength??25e4;if(0===a)throw new aT('JWE "zip" (Compression Algorithm) Header Parameter is not supported.');if(a!==1/0&&(!Number.isSafeInteger(a)||a<1))throw TypeError("maxDecompressedLength must be 0, a positive safe integer, or Infinity");t.plaintext=await b_(s,a).catch(a=>{if(a instanceof aV)throw a;throw new aV("Failed to decompress plaintext",{cause:a})})}return(void 0!==a.protected&&(t.protectedHeader=d),void 0!==a.aad&&(t.additionalAuthenticatedData=aG(a.aad,"aad",aV)),void 0!==a.unprotected&&(t.sharedUnprotectedHeader=a.unprotected),void 0!==a.header&&(t.unprotectedHeader=a.header),o)?{...t,key:p}:t}async function cj(a,b,c){if(a instanceof Uint8Array&&(a=aw.decode(a)),"string"!=typeof a)throw new aV("Compact JWE must be a string or Uint8Array");let{0:d,1:e,2:f,3:g,4:h,length:i}=a.split(".");if(5!==i)throw new aV("Invalid Compact JWE");let j=await ci({ciphertext:g,iv:f||void 0,protected:d,tag:h||void 0,encrypted_key:e||void 0},b,c),k={plaintext:j.plaintext,protectedHeader:j.protectedHeader};return"function"==typeof b?{...k,key:j.key}:k}async function ck(a,b,c){let d=await cj(a,b,c),e=b7(d.protectedHeader,d.plaintext,c),{protectedHeader:f}=d;if(void 0!==f.iss&&f.iss!==e.iss)throw new aQ('replicated "iss" claim header parameter mismatch',e,"iss","mismatch");if(void 0!==f.sub&&f.sub!==e.sub)throw new aQ('replicated "sub" claim header parameter mismatch',e,"sub","mismatch");if(void 0!==f.aud&&JSON.stringify(f.aud)!==JSON.stringify(e.aud))throw new aQ('replicated "aud" claim header parameter mismatch',e,"aud","mismatch");let g={payload:e,protectedHeader:f};return"function"==typeof b?{...g,key:d.key}:g}async function cl(a,b,c){if(!bE(a))throw new aW("Flattened JWS must be an object");if(void 0===a.protected&&void 0===a.header)throw new aW('Flattened JWS must have either of the "protected" or "header" members');if(void 0!==a.protected&&"string"!=typeof a.protected)throw new aW("JWS Protected Header incorrect type");if(void 0===a.payload)throw new aW("JWS Payload missing");if("string"!=typeof a.signature)throw new aW("JWS Signature missing or incorrect type");if(void 0!==a.header&&!bE(a.header))throw new aW("JWS Unprotected Header incorrect type");let d={};if(a.protected)try{let b=aC(a.protected);d=JSON.parse(aw.decode(b))}catch{throw new aW("JWS Protected Header is invalid")}if(!bF(d,a.header))throw new aW("JWS Protected and JWS Unprotected Header Parameter names must be disjoint");let e={...d,...a.header},f=bV(aW,new Map([["b64",!0]]),c?.crit,d,e),g=!0;if(f.has("b64")&&"boolean"!=typeof(g=d.b64))throw new aW('The "b64" (base64url-encode payload) Header Parameter must be a boolean');let{alg:h}=e;if("string"!=typeof h||!h)throw new aW('JWS "alg" (Algorithm) Header Parameter missing or invalid');let i=c&&ch("algorithms",c.algorithms);if(i&&!i.has(h))throw new aS('"alg" (Algorithm) Header Parameter value not allowed');if(g){if("string"!=typeof a.payload)throw new aW("JWS Payload must be a string")}else if("string"!=typeof a.payload&&!(a.payload instanceof Uint8Array))throw new aW("JWS Payload must be a string or an Uint8Array instance");let j=!1;"function"==typeof b&&(b=await b(d,a),j=!0),bY(h,b,"verify");let k=ax(void 0!==a.protected?aB(a.protected):new Uint8Array,aB("."),"string"==typeof a.payload?g?aB(a.payload):av.encode(a.payload):a.payload),l=aG(a.signature,"signature",aW),m=await bL(b,h);if(!await bA(h,m,l,k))throw new a1;let n={payload:g?aG(a.payload,"payload",aW):"string"==typeof a.payload?av.encode(a.payload):a.payload};return(void 0!==a.protected&&(n.protectedHeader=d),void 0!==a.header&&(n.unprotectedHeader=a.header),j)?{...n,key:m}:n}async function cm(a,b,c){if(a instanceof Uint8Array&&(a=aw.decode(a)),"string"!=typeof a)throw new aW("Compact JWS must be a string or Uint8Array");let{0:d,1:e,2:f,length:g}=a.split(".");if(3!==g)throw new aW("Invalid Compact JWS");let h=await cl({payload:e,protected:d,signature:f},b,c),i={payload:h.payload,protectedHeader:h.protectedHeader};return"function"==typeof b?{...i,key:h.key}:i}async function cn(a,b,c){let d=await cm(a,b,c);if(d.protectedHeader.crit?.includes("b64")&&!1===d.protectedHeader.b64)throw new aX("JWTs MUST NOT use unencoded payload");let e={payload:b7(d.protectedHeader,d.payload,c),protectedHeader:d.protectedHeader};return"function"==typeof b?{...e,key:d.key}:e}async function co(a,b,c=3600){return await new cc(a).setProtectedHeader({alg:"HS256"}).setIssuedAt().setExpirationTime(Math.floor(Date.now()/1e3)+c).sign(new TextEncoder().encode(b))}async function cp(a,b){try{return(await cn(a,new TextEncoder().encode(b))).payload}catch{return null}}let cq=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]),cr="A256CBC-HS512";function cs(a,b){var c,d,e;return c=new TextEncoder().encode(a),d=new TextEncoder().encode(b),function(a,b,c,d=32){W(a),U(d,"length"),V(b,void 0,"prk");let e=a.outputLen;if(b.length<e)throw Error('"prk" must be at least HashLen octets');if(d>255*e)throw Error("Length must be <= 255*HashLen");let f=Math.ceil(d/e);void 0===c?c=ad:V(c,void 0,"info");let g=new Uint8Array(f*e),h=ab.create(a,b),i=h._cloneInto(),j=new Uint8Array(h.outputLen);for(let a=0;a<f;a++)ac[0]=a+1,i.update(0===a?ad:j).update(c).update(ac).digestInto(j),g.set(j,e*a),h._cloneInto(i);return h.destroy(),i.destroy(),Z(j,ac),g.slice(0,d)}(au,(e=d,W(au),void 0===e&&(e=new Uint8Array(au.outputLen)),ab(au,e,c)),cq,64)}function ct(a){if("string"==typeof a)return[{version:0,value:a}];let b=[];for(let[c,d]of a.keys)b.push({version:c,value:d});return a.legacySecret&&!b.some(b=>b.value===a.legacySecret)&&b.push({version:-1,value:a.legacySecret}),b}async function cu(a,b,c,d=3600){let e=cs(function(a){if("string"==typeof a)return a;let b=a.keys.get(a.currentVersion);if(!b)throw Error(`Secret version ${a.currentVersion} not found in keys`);return b}(b),c),f=await cf({kty:"oct",k:cd.encode(e)},"sha256");return await new b9(a).setProtectedHeader({alg:"dir",enc:cr,kid:f}).setIssuedAt().setExpirationTime((Date.now()/1e3|0)+d).setJti(crypto.randomUUID()).encrypt(e)}let cv={clockTolerance:15,keyManagementAlgorithms:["dir"],contentEncryptionAlgorithms:[cr,"A256GCM"]};async function cw(a,b,c){if(!a)return null;let d=!1;try{d=void 0!==cg(a).kid}catch{return null}try{let d=ct(b),{payload:e}=await ck(a,async a=>{let b=a.kid;if(void 0!==b){for(let a of d){let d=cs(a.value,c);if(b===await cf({kty:"oct",k:cd.encode(d)},"sha256"))return d}throw Error("no matching decryption secret")}return d.length,cs(d[0].value,c)},cv);return e}catch{if(d)return null;let e=ct(b);if(e.length<=1)return null;for(let b=1;b<e.length;b++)try{let d=e[b],{payload:f}=await ck(a,cs(d.value,c),cv);return f}catch{continue}return null}}var cx=a.i(238696);function cy(a,b){if(!a||!b)return a;let c=Object.entries(b).filter(([,{returned:a}])=>!1===a).map(([a])=>a);return Object.entries(structuredClone(a)).filter(([a])=>!c.includes(a)).reduce((a,[b,c])=>({...a,[b]:c}),{})}let cz=new WeakMap;function cA(a,b,c){let d=`${b}:${c}`;cz.has(a)||cz.set(a,new Map);let e=cz.get(a);if(e.has(d))return e.get(d);let f="output"===c?(0,v.getAuthTables)(a)[b]?.fields??{}:{},g="user"===b||"session"===b||"account"===b?a[b]?.additionalFields:void 0,h={...f,...g??{}};for(let c of a.plugins||[])c.schema&&c.schema[b]&&(h={...h,...c.schema[b].fields});return e.set(d,h),h}function cB(a,b){return cy(b,cA(a,"user","output"))}function cC(a,b){let c=cA(a,"user","output"),d={};for(let a in c){let e=c[a];!1!==e.returned&&(a in b&&void 0!==b[a]?d[a]=b[a]:void 0!==e.defaultValue?d[a]="function"==typeof e.defaultValue?e.defaultValue():e.defaultValue:e.required||(d[a]=null))}return"id"in b&&(d.id=b.id),d}function cD(a,b){return cy(b,cA(a,"session","output"))}function cE(a,b){let c=b.action||"create",d=b.fields,e=Object.create(null);for(let b in d){if(b in a){if(!1===d[b].input){if(void 0!==d[b].defaultValue&&"update"!==c){e[b]=d[b].defaultValue;continue}if(a[b])throw y.APIError.from("BAD_REQUEST",{...cx.BASE_ERROR_CODES.FIELD_NOT_ALLOWED,message:`${b} is not allowed to be set`});continue}if(d[b].validator?.input&&void 0!==a[b]){let c=d[b].validator.input["~standard"].validate(a[b]);if(c instanceof Promise)throw y.APIError.from("INTERNAL_SERVER_ERROR",cx.BASE_ERROR_CODES.ASYNC_VALIDATION_NOT_SUPPORTED);if("issues"in c&&c.issues)throw y.APIError.from("BAD_REQUEST",{...cx.BASE_ERROR_CODES.VALIDATION_ERROR,message:c.issues[0]?.message||"Validation Error"});e[b]=c.value;continue}if(d[b].transform?.input&&void 0!==a[b]){e[b]=d[b].transform?.input(a[b]);continue}e[b]=a[b];continue}if(void 0!==d[b].defaultValue&&"create"===c){if("function"==typeof d[b].defaultValue){e[b]=d[b].defaultValue();continue}e[b]=d[b].defaultValue;continue}if(d[b].required&&"create"===c)throw y.APIError.from("BAD_REQUEST",{...cx.BASE_ERROR_CODES.MISSING_FIELD,message:`${b} is required`})}return e}function cF(a,b={},c){return cE(b,{fields:cA(a,"user","input"),action:c})}let cG=(a,b="ms")=>new Date(Date.now()+("sec"===b?1e3*a:a)),cH=/^(\+|\-)? ?(\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 cI(a){if(-1===a.indexOf("%"))return a;try{return decodeURIComponent(a)}catch{return a}}function cJ(a){if(!a)return[];let b=[],c=0,d=0;for(;d<a.length;){if(","===a[d]){let e=d+1;for(;e<a.length&&" "===a[e];)e++;for(;e<a.length&&"="!==a[e]&&";"!==a[e]&&","!==a[e];)e++;if(e<a.length&&"="===a[e]){let e=a.slice(c,d).trim();for(e&&b.push(e),c=d+1;c<a.length&&" "===a[c];)c++;d=c;continue}}d++}let e=a.slice(c).trim();return e&&b.push(e),b}let cK=/^[\w!#$%&'*.^`|~+-]+$/,cL=/^[ !#-:<-[\]-~]*$/;function cM(a){return!(a.length<2)&&a.startsWith('"')&&a.endsWith('"')?a.slice(1,-1):a}function cN(a){let b=0,c=a.length;for(;b<c;){let c=a.charCodeAt(b);if(32!==c&&9!==c)break;b++}for(;c>b;){let b=a.charCodeAt(c-1);if(32!==b&&9!==b)break;c--}return 0===b&&c===a.length?a:a.slice(b,c)}function cO(a){let b=new Map;if(a.length<2)return b;for(let c of a.split(";")){let a=c.indexOf("=");if(-1===a)continue;let d=cN(c.slice(0,a)),e=cM(cN(c.slice(a+1)));cK.test(d)&&cL.test(e)&&b.set(d,cI(e))}return b}var cP=a.i(92929);function cQ(a,b,c){function d(c,d){if(c._zod||Object.defineProperty(c,"_zod",{value:{def:d,constr:g,traits:new Set},enumerable:!1}),c._zod.traits.has(a))return;c._zod.traits.add(a),b(c,d);let e=g.prototype,f=Object.keys(e);for(let a=0;a<f.length;a++){let b=f[a];b in c||(c[b]=e[b].bind(c))}}let e=c?.Parent??Object;class f extends e{}function g(a){var b;let e=c?.Parent?new f:this;for(let c of(d(e,a),(b=e._zod).deferred??(b.deferred=[]),e._zod.deferred))c();return e}return Object.defineProperty(f,"name",{value:a}),Object.defineProperty(g,"init",{value:d}),Object.defineProperty(g,Symbol.hasInstance,{value:b=>!!c?.Parent&&b instanceof c.Parent||b?._zod?.traits?.has(a)}),Object.defineProperty(g,"name",{value:a}),g}Symbol("zod_brand");class cR extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class cS extends Error{constructor(a){super(`Encountered unidirectional transform during encode: ${a}`),this.name="ZodEncodeError"}}(r=globalThis).__zod_globalConfig??(r.__zod_globalConfig={});let cT=globalThis.__zod_globalConfig;function cU(a){return a&&Object.assign(cT,a),cT}function cV(a){let b=Object.values(a).filter(a=>"number"==typeof a);return Object.entries(a).filter(([a,c])=>-1===b.indexOf(+a)).map(([a,b])=>b)}function cW(a,b){return"bigint"==typeof b?b.toString():b}function cX(a){return{get value(){{let b=a();return Object.defineProperty(this,"value",{value:b}),b}}}}function cY(a){return null==a}function cZ(a){let b=+!!a.startsWith("^"),c=a.endsWith("$")?a.length-1:a.length;return a.slice(b,c)}function c$(a,b){let c=a/b,d=Math.round(c),e=Number.EPSILON*Math.max(Math.abs(c),1);return Math.abs(c-d)<e?0:c-d}let c_=Symbol("evaluating");function c0(a,b,c){let d;Object.defineProperty(a,b,{get(){if(d!==c_)return void 0===d&&(d=c_,d=c()),d},set(c){Object.defineProperty(a,b,{value:c})},configurable:!0})}function c1(a,b,c){Object.defineProperty(a,b,{value:c,writable:!0,enumerable:!0,configurable:!0})}function c2(...a){let b={};for(let c of a)Object.assign(b,Object.getOwnPropertyDescriptors(c));return Object.defineProperties({},b)}function c3(a){return JSON.stringify(a)}function c4(a){return a.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}let c5="captureStackTrace"in Error?Error.captureStackTrace:(...a)=>{};function c6(a){return"object"==typeof a&&null!==a&&!Array.isArray(a)}let c7=cX(()=>{if(cT.jitless||"u">typeof navigator&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{return Function(""),!0}catch(a){return!1}});function c8(a){if(!1===c6(a))return!1;let b=a.constructor;if(void 0===b||"function"!=typeof b)return!0;let c=b.prototype;return!1!==c6(c)&&!1!==Object.prototype.hasOwnProperty.call(c,"isPrototypeOf")}let c9=new Set(["string","number","symbol"]),da=new Set(["string","number","bigint","boolean","symbol","undefined"]);function db(a){return a.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function dc(a,b,c){let d=new a._zod.constr(b??a._zod.def);return(!b||c?.parent)&&(d._zod.parent=a),d}function dd(a){if(!a)return{};if("string"==typeof a)return{error:()=>a};if(a?.message!==void 0){if(a?.error!==void 0)throw Error("Cannot specify both `message` and `error` params");a.error=a.message}return(delete a.message,"string"==typeof a.error)?{...a,error:()=>a.error}:a}function de(a){return"bigint"==typeof a?a.toString()+"n":"string"==typeof a?`"${a}"`:`${a}`}function df(a){return Object.keys(a).filter(b=>"optional"===a[b]._zod.optin&&"optional"===a[b]._zod.optout)}let dg={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]},dh={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function di(a,b=0){if(!0===a.aborted)return!0;for(let c=b;c<a.issues.length;c++)if(a.issues[c]?.continue!==!0)return!0;return!1}function dj(a,b=0){if(!0===a.aborted)return!0;for(let c=b;c<a.issues.length;c++)if(a.issues[c]?.continue===!1)return!0;return!1}function dk(a,b){return b.map(b=>(b.path??(b.path=[]),b.path.unshift(a),b))}function dl(a){return"string"==typeof a?a:a?.message}function dm(a,b,c){let d=a.message?a.message:dl(a.inst?._zod.def?.error?.(a))??dl(b?.error?.(a))??dl(c.customError?.(a))??dl(c.localeError?.(a))??"Invalid input",{inst:e,continue:f,input:g,...h}=a;return h.path??(h.path=[]),h.message=d,b?.reportInput&&(h.input=g),h}function dn(a){return a instanceof Set?"set":a instanceof Map?"map":a instanceof File?"file":"unknown"}function dp(a){return Array.isArray(a)?"array":"string"==typeof a?"string":"unknown"}function dq(...a){let[b,c,d]=a;return"string"==typeof b?{message:b,code:"custom",input:c,inst:d}:{...b}}function dr(a){let b=atob(a),c=new Uint8Array(b.length);for(let a=0;a<b.length;a++)c[a]=b.charCodeAt(a);return c}function ds(a){let b="";for(let c=0;c<a.length;c++)b+=String.fromCharCode(a[c]);return btoa(b)}a.s(["BIGINT_FORMAT_RANGES",0,dh,"Class",0,class{constructor(...a){}},"NUMBER_FORMAT_RANGES",0,dg,"aborted",0,di,"allowsEval",0,c7,"assert",0,function(a){},"assertEqual",0,function(a){return a},"assertIs",0,function(a){},"assertNever",0,function(a){throw Error("Unexpected value in exhaustive check")},"assertNotEqual",0,function(a){return a},"assignProp",0,c1,"base64ToUint8Array",0,dr,"base64urlToUint8Array",0,function(a){let b=a.replace(/-/g,"+").replace(/_/g,"/"),c="=".repeat((4-b.length%4)%4);return dr(b+c)},"cached",0,cX,"captureStackTrace",0,c5,"cleanEnum",0,function(a){return Object.entries(a).filter(([a,b])=>Number.isNaN(Number.parseInt(a,10))).map(a=>a[1])},"cleanRegex",0,cZ,"clone",0,dc,"cloneDef",0,function(a){return c2(a._zod.def)},"createTransparentProxy",0,function(a){let b;return new Proxy({},{get:(c,d,e)=>(b??(b=a()),Reflect.get(b,d,e)),set:(c,d,e,f)=>(b??(b=a()),Reflect.set(b,d,e,f)),has:(c,d)=>(b??(b=a()),Reflect.has(b,d)),deleteProperty:(c,d)=>(b??(b=a()),Reflect.deleteProperty(b,d)),ownKeys:c=>(b??(b=a()),Reflect.ownKeys(b)),getOwnPropertyDescriptor:(c,d)=>(b??(b=a()),Reflect.getOwnPropertyDescriptor(b,d)),defineProperty:(c,d,e)=>(b??(b=a()),Reflect.defineProperty(b,d,e))})},"defineLazy",0,c0,"esc",0,c3,"escapeRegex",0,db,"explicitlyAborted",0,dj,"extend",0,function(a,b){if(!c8(b))throw Error("Invalid input to extend: expected a plain object");let c=a._zod.def.checks;if(c&&c.length>0){let c=a._zod.def.shape;for(let a in b)if(void 0!==Object.getOwnPropertyDescriptor(c,a))throw Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}let d=c2(a._zod.def,{get shape(){let c={...a._zod.def.shape,...b};return c1(this,"shape",c),c}});return dc(a,d)},"finalizeIssue",0,dm,"floatSafeRemainder",0,c$,"getElementAtPath",0,function(a,b){return b?b.reduce((a,b)=>a?.[b],a):a},"getEnumValues",0,cV,"getLengthableOrigin",0,dp,"getParsedType",0,a=>{let b=typeof a;switch(b){case"undefined":return"undefined";case"string":return"string";case"number":return Number.isNaN(a)?"nan":"number";case"boolean":return"boolean";case"function":return"function";case"bigint":return"bigint";case"symbol":return"symbol";case"object":if(Array.isArray(a))return"array";if(null===a)return"null";if(a.then&&"function"==typeof a.then&&a.catch&&"function"==typeof a.catch)return"promise";if("u">typeof Map&&a instanceof Map)return"map";if("u">typeof Set&&a instanceof Set)return"set";if("u">typeof Date&&a instanceof Date)return"date";if("u">typeof File&&a instanceof File)return"file";return"object";default:throw Error(`Unknown data type: ${b}`)}},"getSizableOrigin",0,dn,"hexToUint8Array",0,function(a){let b=a.replace(/^0x/,"");if(b.length%2!=0)throw Error("Invalid hex string length");let c=new Uint8Array(b.length/2);for(let a=0;a<b.length;a+=2)c[a/2]=Number.parseInt(b.slice(a,a+2),16);return c},"isObject",0,c6,"isPlainObject",0,c8,"issue",0,dq,"joinValues",0,function(a,b="|"){return a.map(a=>de(a)).join(b)},"jsonStringifyReplacer",0,cW,"merge",0,function(a,b){if(a._zod.def.checks?.length)throw Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");let c=c2(a._zod.def,{get shape(){let c={...a._zod.def.shape,...b._zod.def.shape};return c1(this,"shape",c),c},get catchall(){return b._zod.def.catchall},checks:b._zod.def.checks??[]});return dc(a,c)},"mergeDefs",0,c2,"normalizeParams",0,dd,"nullish",0,cY,"numKeys",0,function(a){let b=0;for(let c in a)Object.prototype.hasOwnProperty.call(a,c)&&b++;return b},"objectClone",0,function(a){return Object.create(Object.getPrototypeOf(a),Object.getOwnPropertyDescriptors(a))},"omit",0,function(a,b){let c=a._zod.def,d=c.checks;if(d&&d.length>0)throw Error(".omit() cannot be used on object schemas containing refinements");let e=c2(a._zod.def,{get shape(){let d={...a._zod.def.shape};for(let a in b){if(!(a in c.shape))throw Error(`Unrecognized key: "${a}"`);b[a]&&delete d[a]}return c1(this,"shape",d),d},checks:[]});return dc(a,e)},"optionalKeys",0,df,"parsedType",0,function(a){let b=typeof a;switch(b){case"number":return Number.isNaN(a)?"nan":"number";case"object":if(null===a)return"null";if(Array.isArray(a))return"array";if(a&&Object.getPrototypeOf(a)!==Object.prototype&&"constructor"in a&&a.constructor)return a.constructor.name}return b},"partial",0,function(a,b,c){let d=b._zod.def.checks;if(d&&d.length>0)throw Error(".partial() cannot be used on object schemas containing refinements");let e=c2(b._zod.def,{get shape(){let d=b._zod.def.shape,e={...d};if(c)for(let b in c){if(!(b in d))throw Error(`Unrecognized key: "${b}"`);c[b]&&(e[b]=a?new a({type:"optional",innerType:d[b]}):d[b])}else for(let b in d)e[b]=a?new a({type:"optional",innerType:d[b]}):d[b];return c1(this,"shape",e),e},checks:[]});return dc(b,e)},"pick",0,function(a,b){let c=a._zod.def,d=c.checks;if(d&&d.length>0)throw Error(".pick() cannot be used on object schemas containing refinements");let e=c2(a._zod.def,{get shape(){let a={};for(let d in b){if(!(d in c.shape))throw Error(`Unrecognized key: "${d}"`);b[d]&&(a[d]=c.shape[d])}return c1(this,"shape",a),a},checks:[]});return dc(a,e)},"prefixIssues",0,dk,"primitiveTypes",0,da,"promiseAllObject",0,function(a){let b=Object.keys(a);return Promise.all(b.map(b=>a[b])).then(a=>{let c={};for(let d=0;d<b.length;d++)c[b[d]]=a[d];return c})},"propertyKeyTypes",0,c9,"randomString",0,function(a=10){let b="abcdefghijklmnopqrstuvwxyz",c="";for(let d=0;d<a;d++)c+=b[Math.floor(Math.random()*b.length)];return c},"required",0,function(a,b,c){let d=c2(b._zod.def,{get shape(){let d=b._zod.def.shape,e={...d};if(c)for(let b in c){if(!(b in e))throw Error(`Unrecognized key: "${b}"`);c[b]&&(e[b]=new a({type:"nonoptional",innerType:d[b]}))}else for(let b in d)e[b]=new a({type:"nonoptional",innerType:d[b]});return c1(this,"shape",e),e}});return dc(b,d)},"safeExtend",0,function(a,b){if(!c8(b))throw Error("Invalid input to safeExtend: expected a plain object");let c=c2(a._zod.def,{get shape(){let c={...a._zod.def.shape,...b};return c1(this,"shape",c),c}});return dc(a,c)},"shallowClone",0,function(a){return c8(a)?{...a}:Array.isArray(a)?[...a]:a instanceof Map?new Map(a):a instanceof Set?new Set(a):a},"slugify",0,c4,"stringifyPrimitive",0,de,"uint8ArrayToBase64",0,ds,"uint8ArrayToBase64url",0,function(a){return ds(a).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")},"uint8ArrayToHex",0,function(a){return Array.from(a).map(a=>a.toString(16).padStart(2,"0")).join("")},"unwrapMessage",0,dl],549230);let dt=/^[cC][0-9a-z]{6,}$/,du=/^[0-9a-z]+$/,dv=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,dw=/^[0-9a-vA-V]{20}$/,dx=/^[A-Za-z0-9]{27}$/,dy=/^[a-zA-Z0-9_-]{21}$/,dz=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,dA=/^([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})$/,dB=a=>a?RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${a}[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)$/,dC=dB(4),dD=dB(6),dE=dB(7),dF=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,dG=/^[^\s@"]{1,64}@[^\s@]{1,255}$/u;function dH(){return RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")}let dI=/^(?:(?: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])$/,dJ=/^(([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}|:))$/,dK=a=>{let b=db(a??":");return RegExp(`^(?:[0-9A-F]{2}${b}){5}[0-9A-F]{2}$|^(?:[0-9a-f]{2}${b}){5}[0-9a-f]{2}$`)},dL=/^((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])$/,dM=/^(([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])$/,dN=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,dO=/^[A-Za-z0-9_-]*$/,dP=/^https?$/,dQ=/^\+[1-9]\d{6,14}$/,dR="(?:(?:\\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])))",dS=RegExp(`^${dR}$`);function dT(a){let b="(?:[01]\\d|2[0-3]):[0-5]\\d";return"number"==typeof a.precision?-1===a.precision?`${b}`:0===a.precision?`${b}:[0-5]\\d`:`${b}:[0-5]\\d\\.\\d{${a.precision}}`:`${b}(?::[0-5]\\d(?:\\.\\d+)?)?`}function dU(a){return RegExp(`^${dT(a)}$`)}function dV(a){let b=dT({precision:a.precision}),c=["Z"];a.local&&c.push(""),a.offset&&c.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");let d=`${b}(?:${c.join("|")})`;return RegExp(`^${dR}T(?:${d})$`)}let dW=a=>{let b=a?`[\\s\\S]{${a?.minimum??0},${a?.maximum??""}}`:"[\\s\\S]*";return RegExp(`^${b}$`)},dX=/^-?\d+n?$/,dY=/^-?\d+$/,dZ=/^-?\d+(?:\.\d+)?$/,d$=/^(?:true|false)$/i,d_=/^null$/i,d0=/^undefined$/i,d1=/^[^A-Z]*$/,d2=/^[^a-z]*$/;function d3(a,b){return RegExp(`^[A-Za-z0-9+/]{${a}}${b}$`)}function d4(a){return RegExp(`^[A-Za-z0-9_-]{${a}}$`)}let d5=d3(22,"=="),d6=d4(22),d7=d3(27,"="),d8=d4(27),d9=d3(43,"="),ea=d4(43),eb=d3(64,""),ec=d4(64),ed=d3(86,"=="),ee=d4(86);a.s(["base64",0,dN,"base64url",0,dO,"bigint",0,dX,"boolean",0,d$,"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,dL,"cidrv6",0,dM,"cuid",0,dt,"cuid2",0,du,"date",0,dS,"datetime",0,dV,"domain",0,/^([a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,}$/,"duration",0,dz,"e164",0,dQ,"email",0,dF,"emoji",0,dH,"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,dA,"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,dP,"idnEmail",0,dG,"integer",0,dY,"ipv4",0,dI,"ipv6",0,dJ,"ksuid",0,dx,"lowercase",0,d1,"mac",0,dK,"md5_base64",0,d5,"md5_base64url",0,d6,"md5_hex",0,/^[0-9a-fA-F]{32}$/,"nanoid",0,dy,"null",0,d_,"number",0,dZ,"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,d7,"sha1_base64url",0,d8,"sha1_hex",0,/^[0-9a-fA-F]{40}$/,"sha256_base64",0,d9,"sha256_base64url",0,ea,"sha256_hex",0,/^[0-9a-fA-F]{64}$/,"sha384_base64",0,eb,"sha384_base64url",0,ec,"sha384_hex",0,/^[0-9a-fA-F]{96}$/,"sha512_base64",0,ed,"sha512_base64url",0,ee,"sha512_hex",0,/^[0-9a-fA-F]{128}$/,"string",0,dW,"time",0,dU,"ulid",0,dv,"undefined",0,d0,"unicodeEmail",0,dG,"uppercase",0,d2,"uuid",0,dB,"uuid4",0,dC,"uuid6",0,dD,"uuid7",0,dE,"xid",0,dw],854018);let ef=cQ("$ZodCheck",(a,b)=>{var c;a._zod??(a._zod={}),a._zod.def=b,(c=a._zod).onattach??(c.onattach=[])}),eg={number:"number",bigint:"bigint",object:"date"},eh=cQ("$ZodCheckLessThan",(a,b)=>{ef.init(a,b);let c=eg[typeof b.value];a._zod.onattach.push(a=>{let c=a._zod.bag,d=(b.inclusive?c.maximum:c.exclusiveMaximum)??1/0;b.value<d&&(b.inclusive?c.maximum=b.value:c.exclusiveMaximum=b.value)}),a._zod.check=d=>{(b.inclusive?d.value<=b.value:d.value<b.value)||d.issues.push({origin:c,code:"too_big",maximum:"object"==typeof b.value?b.value.getTime():b.value,input:d.value,inclusive:b.inclusive,inst:a,continue:!b.abort})}}),ei=cQ("$ZodCheckGreaterThan",(a,b)=>{ef.init(a,b);let c=eg[typeof b.value];a._zod.onattach.push(a=>{let c=a._zod.bag,d=(b.inclusive?c.minimum:c.exclusiveMinimum)??-1/0;b.value>d&&(b.inclusive?c.minimum=b.value:c.exclusiveMinimum=b.value)}),a._zod.check=d=>{(b.inclusive?d.value>=b.value:d.value>b.value)||d.issues.push({origin:c,code:"too_small",minimum:"object"==typeof b.value?b.value.getTime():b.value,input:d.value,inclusive:b.inclusive,inst:a,continue:!b.abort})}}),ej=cQ("$ZodCheckMultipleOf",(a,b)=>{ef.init(a,b),a._zod.onattach.push(a=>{var c;(c=a._zod.bag).multipleOf??(c.multipleOf=b.value)}),a._zod.check=c=>{if(typeof c.value!=typeof b.value)throw Error("Cannot mix number and bigint in multiple_of check.");("bigint"==typeof c.value?c.value%b.value===BigInt(0):0===c$(c.value,b.value))||c.issues.push({origin:typeof c.value,code:"not_multiple_of",divisor:b.value,input:c.value,inst:a,continue:!b.abort})}}),ek=cQ("$ZodCheckNumberFormat",(a,b)=>{ef.init(a,b),b.format=b.format||"float64";let c=b.format?.includes("int"),d=c?"int":"number",[e,f]=dg[b.format];a._zod.onattach.push(a=>{let d=a._zod.bag;d.format=b.format,d.minimum=e,d.maximum=f,c&&(d.pattern=dY)}),a._zod.check=g=>{let h=g.value;if(c){if(!Number.isInteger(h))return void g.issues.push({expected:d,format:b.format,code:"invalid_type",continue:!1,input:h,inst:a});if(!Number.isSafeInteger(h))return void(h>0?g.issues.push({input:h,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:a,origin:d,inclusive:!0,continue:!b.abort}):g.issues.push({input:h,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:a,origin:d,inclusive:!0,continue:!b.abort}))}h<e&&g.issues.push({origin:"number",input:h,code:"too_small",minimum:e,inclusive:!0,inst:a,continue:!b.abort}),h>f&&g.issues.push({origin:"number",input:h,code:"too_big",maximum:f,inclusive:!0,inst:a,continue:!b.abort})}}),el=cQ("$ZodCheckBigIntFormat",(a,b)=>{ef.init(a,b);let[c,d]=dh[b.format];a._zod.onattach.push(a=>{let e=a._zod.bag;e.format=b.format,e.minimum=c,e.maximum=d}),a._zod.check=e=>{let f=e.value;f<c&&e.issues.push({origin:"bigint",input:f,code:"too_small",minimum:c,inclusive:!0,inst:a,continue:!b.abort}),f>d&&e.issues.push({origin:"bigint",input:f,code:"too_big",maximum:d,inclusive:!0,inst:a,continue:!b.abort})}}),em=cQ("$ZodCheckMaxSize",(a,b)=>{var c;ef.init(a,b),(c=a._zod.def).when??(c.when=a=>{let b=a.value;return!cY(b)&&void 0!==b.size}),a._zod.onattach.push(a=>{let c=a._zod.bag.maximum??1/0;b.maximum<c&&(a._zod.bag.maximum=b.maximum)}),a._zod.check=c=>{let d=c.value;d.size<=b.maximum||c.issues.push({origin:dn(d),code:"too_big",maximum:b.maximum,inclusive:!0,input:d,inst:a,continue:!b.abort})}}),en=cQ("$ZodCheckMinSize",(a,b)=>{var c;ef.init(a,b),(c=a._zod.def).when??(c.when=a=>{let b=a.value;return!cY(b)&&void 0!==b.size}),a._zod.onattach.push(a=>{let c=a._zod.bag.minimum??-1/0;b.minimum>c&&(a._zod.bag.minimum=b.minimum)}),a._zod.check=c=>{let d=c.value;d.size>=b.minimum||c.issues.push({origin:dn(d),code:"too_small",minimum:b.minimum,inclusive:!0,input:d,inst:a,continue:!b.abort})}}),eo=cQ("$ZodCheckSizeEquals",(a,b)=>{var c;ef.init(a,b),(c=a._zod.def).when??(c.when=a=>{let b=a.value;return!cY(b)&&void 0!==b.size}),a._zod.onattach.push(a=>{let c=a._zod.bag;c.minimum=b.size,c.maximum=b.size,c.size=b.size}),a._zod.check=c=>{let d=c.value,e=d.size;if(e===b.size)return;let f=e>b.size;c.issues.push({origin:dn(d),...f?{code:"too_big",maximum:b.size}:{code:"too_small",minimum:b.size},inclusive:!0,exact:!0,input:c.value,inst:a,continue:!b.abort})}}),ep=cQ("$ZodCheckMaxLength",(a,b)=>{var c;ef.init(a,b),(c=a._zod.def).when??(c.when=a=>{let b=a.value;return!cY(b)&&void 0!==b.length}),a._zod.onattach.push(a=>{let c=a._zod.bag.maximum??1/0;b.maximum<c&&(a._zod.bag.maximum=b.maximum)}),a._zod.check=c=>{let d=c.value;if(d.length<=b.maximum)return;let e=dp(d);c.issues.push({origin:e,code:"too_big",maximum:b.maximum,inclusive:!0,input:d,inst:a,continue:!b.abort})}}),eq=cQ("$ZodCheckMinLength",(a,b)=>{var c;ef.init(a,b),(c=a._zod.def).when??(c.when=a=>{let b=a.value;return!cY(b)&&void 0!==b.length}),a._zod.onattach.push(a=>{let c=a._zod.bag.minimum??-1/0;b.minimum>c&&(a._zod.bag.minimum=b.minimum)}),a._zod.check=c=>{let d=c.value;if(d.length>=b.minimum)return;let e=dp(d);c.issues.push({origin:e,code:"too_small",minimum:b.minimum,inclusive:!0,input:d,inst:a,continue:!b.abort})}}),er=cQ("$ZodCheckLengthEquals",(a,b)=>{var c;ef.init(a,b),(c=a._zod.def).when??(c.when=a=>{let b=a.value;return!cY(b)&&void 0!==b.length}),a._zod.onattach.push(a=>{let c=a._zod.bag;c.minimum=b.length,c.maximum=b.length,c.length=b.length}),a._zod.check=c=>{let d=c.value,e=d.length;if(e===b.length)return;let f=dp(d),g=e>b.length;c.issues.push({origin:f,...g?{code:"too_big",maximum:b.length}:{code:"too_small",minimum:b.length},inclusive:!0,exact:!0,input:c.value,inst:a,continue:!b.abort})}}),es=cQ("$ZodCheckStringFormat",(a,b)=>{var c,d;ef.init(a,b),a._zod.onattach.push(a=>{let c=a._zod.bag;c.format=b.format,b.pattern&&(c.patterns??(c.patterns=new Set),c.patterns.add(b.pattern))}),b.pattern?(c=a._zod).check??(c.check=c=>{b.pattern.lastIndex=0,b.pattern.test(c.value)||c.issues.push({origin:"string",code:"invalid_format",format:b.format,input:c.value,...b.pattern?{pattern:b.pattern.toString()}:{},inst:a,continue:!b.abort})}):(d=a._zod).check??(d.check=()=>{})}),et=cQ("$ZodCheckRegex",(a,b)=>{es.init(a,b),a._zod.check=c=>{b.pattern.lastIndex=0,b.pattern.test(c.value)||c.issues.push({origin:"string",code:"invalid_format",format:"regex",input:c.value,pattern:b.pattern.toString(),inst:a,continue:!b.abort})}}),eu=cQ("$ZodCheckLowerCase",(a,b)=>{b.pattern??(b.pattern=d1),es.init(a,b)}),ev=cQ("$ZodCheckUpperCase",(a,b)=>{b.pattern??(b.pattern=d2),es.init(a,b)}),ew=cQ("$ZodCheckIncludes",(a,b)=>{ef.init(a,b);let c=db(b.includes),d=new RegExp("number"==typeof b.position?`^.{${b.position}}${c}`:c);b.pattern=d,a._zod.onattach.push(a=>{let b=a._zod.bag;b.patterns??(b.patterns=new Set),b.patterns.add(d)}),a._zod.check=c=>{c.value.includes(b.includes,b.position)||c.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:b.includes,input:c.value,inst:a,continue:!b.abort})}}),ex=cQ("$ZodCheckStartsWith",(a,b)=>{ef.init(a,b);let c=RegExp(`^${db(b.prefix)}.*`);b.pattern??(b.pattern=c),a._zod.onattach.push(a=>{let b=a._zod.bag;b.patterns??(b.patterns=new Set),b.patterns.add(c)}),a._zod.check=c=>{c.value.startsWith(b.prefix)||c.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:b.prefix,input:c.value,inst:a,continue:!b.abort})}}),ey=cQ("$ZodCheckEndsWith",(a,b)=>{ef.init(a,b);let c=RegExp(`.*${db(b.suffix)}$`);b.pattern??(b.pattern=c),a._zod.onattach.push(a=>{let b=a._zod.bag;b.patterns??(b.patterns=new Set),b.patterns.add(c)}),a._zod.check=c=>{c.value.endsWith(b.suffix)||c.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:b.suffix,input:c.value,inst:a,continue:!b.abort})}});(a,b)=>{ef.init(a,b);let c=new Set(b.mime);a._zod.onattach.push(a=>{a._zod.bag.mime=b.mime}),a._zod.check=d=>{c.has(d.value.type)||d.issues.push({code:"invalid_value",values:b.mime,input:d.value.type,inst:a,continue:!b.abort})}};let ez=cQ("$ZodCheckOverwrite",(a,b)=>{ef.init(a,b),a._zod.check=a=>{a.value=b.tx(a.value)}});class eA{constructor(a=[]){this.content=[],this.indent=0,this&&(this.args=a)}indented(a){this.indent+=1,a(this),this.indent-=1}write(a){if("function"==typeof a){a(this,{execution:"sync"}),a(this,{execution:"async"});return}let b=a.split("\n").filter(a=>a),c=Math.min(...b.map(a=>a.length-a.trimStart().length));for(let a of b.map(a=>a.slice(c)).map(a=>" ".repeat(2*this.indent)+a))this.content.push(a)}compile(){return Function(...this?.args,[...(this?.content??[""]).map(a=>` ${a}`)].join("\n"))}}let eB=(a,b)=>{a.name="$ZodError",Object.defineProperty(a,"_zod",{value:a._zod,enumerable:!1}),Object.defineProperty(a,"issues",{value:b,enumerable:!1}),a.message=JSON.stringify(b,cW,2),Object.defineProperty(a,"toString",{value:()=>a.message,enumerable:!1})},eC=cQ("$ZodError",eB),eD=cQ("$ZodError",eB,{Parent:Error}),eE=a=>(b,c,d,e)=>{let f=d?{...d,async:!1}:{async:!1},g=b._zod.run({value:c,issues:[]},f);if(g instanceof Promise)throw new cR;if(g.issues.length){let b=new(e?.Err??a)(g.issues.map(a=>dm(a,f,cU())));throw c5(b,e?.callee),b}return g.value},eF=eE(eD),eG=a=>async(b,c,d,e)=>{let f=d?{...d,async:!0}:{async:!0},g=b._zod.run({value:c,issues:[]},f);if(g instanceof Promise&&(g=await g),g.issues.length){let b=new(e?.Err??a)(g.issues.map(a=>dm(a,f,cU())));throw c5(b,e?.callee),b}return g.value},eH=eG(eD),eI=a=>(b,c,d)=>{let e=d?{...d,async:!1}:{async:!1},f=b._zod.run({value:c,issues:[]},e);if(f instanceof Promise)throw new cR;return f.issues.length?{success:!1,error:new(a??eC)(f.issues.map(a=>dm(a,e,cU())))}:{success:!0,data:f.value}},eJ=eI(eD),eK=a=>async(b,c,d)=>{let e=d?{...d,async:!0}:{async:!0},f=b._zod.run({value:c,issues:[]},e);return f instanceof Promise&&(f=await f),f.issues.length?{success:!1,error:new a(f.issues.map(a=>dm(a,e,cU())))}:{success:!0,data:f.value}},eL=eK(eD),eM={major:4,minor:4,patch:3},eN=cQ("$ZodType",(a,b)=>{var c;a??(a={}),a._zod.def=b,a._zod.bag=a._zod.bag||{},a._zod.version=eM;let d=[...a._zod.def.checks??[]];for(let b of(a._zod.traits.has("$ZodCheck")&&d.unshift(a),d))for(let c of b._zod.onattach)c(a);if(0===d.length)(c=a._zod).deferred??(c.deferred=[]),a._zod.deferred?.push(()=>{a._zod.run=a._zod.parse});else{let b=(a,b,c)=>{let d,e=di(a);for(let f of b){if(f._zod.def.when){if(dj(a)||!f._zod.def.when(a))continue}else if(e)continue;let b=a.issues.length,g=f._zod.check(a);if(g instanceof Promise&&c?.async===!1)throw new cR;if(d||g instanceof Promise)d=(d??Promise.resolve()).then(async()=>{await g,a.issues.length!==b&&(e||(e=di(a,b)))});else{if(a.issues.length===b)continue;e||(e=di(a,b))}}return d?d.then(()=>a):a},c=(c,e,f)=>{if(di(c))return c.aborted=!0,c;let g=b(e,d,f);if(g instanceof Promise){if(!1===f.async)throw new cR;return g.then(b=>a._zod.parse(b,f))}return a._zod.parse(g,f)};a._zod.run=(e,f)=>{if(f.skipChecks)return a._zod.parse(e,f);if("backward"===f.direction){let b=a._zod.parse({value:e.value,issues:[]},{...f,skipChecks:!0});return b instanceof Promise?b.then(a=>c(a,e,f)):c(b,e,f)}let g=a._zod.parse(e,f);if(g instanceof Promise){if(!1===f.async)throw new cR;return g.then(a=>b(a,d,f))}return b(g,d,f)}}c0(a,"~standard",()=>({validate:b=>{try{let c=eJ(a,b);return c.success?{value:c.data}:{issues:c.error?.issues}}catch(c){return eL(a,b).then(a=>a.success?{value:a.data}:{issues:a.error?.issues})}},vendor:"zod",version:1}))}),eO=cQ("$ZodString",(a,b)=>{eN.init(a,b),a._zod.pattern=[...a?._zod.bag?.patterns??[]].pop()??dW(a._zod.bag),a._zod.parse=(c,d)=>{if(b.coerce)try{c.value=String(c.value)}catch(a){}return"string"==typeof c.value||c.issues.push({expected:"string",code:"invalid_type",input:c.value,inst:a}),c}}),eP=cQ("$ZodStringFormat",(a,b)=>{es.init(a,b),eO.init(a,b)}),eQ=cQ("$ZodGUID",(a,b)=>{b.pattern??(b.pattern=dA),eP.init(a,b)}),eR=cQ("$ZodUUID",(a,b)=>{if(b.version){let a={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[b.version];if(void 0===a)throw Error(`Invalid UUID version: "${b.version}"`);b.pattern??(b.pattern=dB(a))}else b.pattern??(b.pattern=dB());eP.init(a,b)}),eS=cQ("$ZodEmail",(a,b)=>{b.pattern??(b.pattern=dF),eP.init(a,b)}),eT=cQ("$ZodURL",(a,b)=>{eP.init(a,b),a._zod.check=c=>{try{let d=c.value.trim();if(!b.normalize&&b.protocol?.source===dP.source&&!/^https?:\/\//i.test(d))return void c.issues.push({code:"invalid_format",format:"url",note:"Invalid URL format",input:c.value,inst:a,continue:!b.abort});let e=new URL(d);b.hostname&&(b.hostname.lastIndex=0,b.hostname.test(e.hostname)||c.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:b.hostname.source,input:c.value,inst:a,continue:!b.abort})),b.protocol&&(b.protocol.lastIndex=0,b.protocol.test(e.protocol.endsWith(":")?e.protocol.slice(0,-1):e.protocol)||c.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:b.protocol.source,input:c.value,inst:a,continue:!b.abort})),b.normalize?c.value=e.href:c.value=d;return}catch(d){c.issues.push({code:"invalid_format",format:"url",input:c.value,inst:a,continue:!b.abort})}}}),eU=cQ("$ZodEmoji",(a,b)=>{b.pattern??(b.pattern=dH()),eP.init(a,b)}),eV=cQ("$ZodNanoID",(a,b)=>{b.pattern??(b.pattern=dy),eP.init(a,b)}),eW=cQ("$ZodCUID",(a,b)=>{b.pattern??(b.pattern=dt),eP.init(a,b)}),eX=cQ("$ZodCUID2",(a,b)=>{b.pattern??(b.pattern=du),eP.init(a,b)}),eY=cQ("$ZodULID",(a,b)=>{b.pattern??(b.pattern=dv),eP.init(a,b)}),eZ=cQ("$ZodXID",(a,b)=>{b.pattern??(b.pattern=dw),eP.init(a,b)}),e$=cQ("$ZodKSUID",(a,b)=>{b.pattern??(b.pattern=dx),eP.init(a,b)}),e_=cQ("$ZodISODateTime",(a,b)=>{b.pattern??(b.pattern=dV(b)),eP.init(a,b)}),e0=cQ("$ZodISODate",(a,b)=>{b.pattern??(b.pattern=dS),eP.init(a,b)}),e1=cQ("$ZodISOTime",(a,b)=>{b.pattern??(b.pattern=dU(b)),eP.init(a,b)}),e2=cQ("$ZodISODuration",(a,b)=>{b.pattern??(b.pattern=dz),eP.init(a,b)}),e3=cQ("$ZodIPv4",(a,b)=>{b.pattern??(b.pattern=dI),eP.init(a,b),a._zod.bag.format="ipv4"}),e4=cQ("$ZodIPv6",(a,b)=>{b.pattern??(b.pattern=dJ),eP.init(a,b),a._zod.bag.format="ipv6",a._zod.check=c=>{try{new URL(`http://[${c.value}]`)}catch{c.issues.push({code:"invalid_format",format:"ipv6",input:c.value,inst:a,continue:!b.abort})}}}),e5=((a,b)=>{b.pattern??(b.pattern=dK(b.delimiter)),eP.init(a,b),a._zod.bag.format="mac"},cQ("$ZodCIDRv4",(a,b)=>{b.pattern??(b.pattern=dL),eP.init(a,b)})),e6=cQ("$ZodCIDRv6",(a,b)=>{b.pattern??(b.pattern=dM),eP.init(a,b),a._zod.check=c=>{let d=c.value.split("/");try{if(2!==d.length)throw Error();let[a,b]=d;if(!b)throw Error();let c=Number(b);if(`${c}`!==b||c<0||c>128)throw Error();new URL(`http://[${a}]`)}catch{c.issues.push({code:"invalid_format",format:"cidrv6",input:c.value,inst:a,continue:!b.abort})}}});function e7(a){if(""===a)return!0;if(/\s/.test(a)||a.length%4!=0)return!1;try{return atob(a),!0}catch{return!1}}let e8=cQ("$ZodBase64",(a,b)=>{b.pattern??(b.pattern=dN),eP.init(a,b),a._zod.bag.contentEncoding="base64",a._zod.check=c=>{e7(c.value)||c.issues.push({code:"invalid_format",format:"base64",input:c.value,inst:a,continue:!b.abort})}}),e9=cQ("$ZodBase64URL",(a,b)=>{b.pattern??(b.pattern=dO),eP.init(a,b),a._zod.bag.contentEncoding="base64url",a._zod.check=c=>{!function(a){if(!dO.test(a))return!1;let b=a.replace(/[-_]/g,a=>"-"===a?"+":"/");return e7(b.padEnd(4*Math.ceil(b.length/4),"="))}(c.value)&&c.issues.push({code:"invalid_format",format:"base64url",input:c.value,inst:a,continue:!b.abort})}}),fa=cQ("$ZodE164",(a,b)=>{b.pattern??(b.pattern=dQ),eP.init(a,b)}),fb=cQ("$ZodJWT",(a,b)=>{eP.init(a,b),a._zod.check=c=>{!function(a,b=null){try{let c=a.split(".");if(3!==c.length)return!1;let[d]=c;if(!d)return!1;let e=JSON.parse(atob(d));if("typ"in e&&e?.typ!=="JWT"||!e.alg||b&&(!("alg"in e)||e.alg!==b))return!1;return!0}catch{return!1}}(c.value,b.alg)&&c.issues.push({code:"invalid_format",format:"jwt",input:c.value,inst:a,continue:!b.abort})}}),fc=((a,b)=>{eP.init(a,b),a._zod.check=c=>{b.fn(c.value)||c.issues.push({code:"invalid_format",format:b.format,input:c.value,inst:a,continue:!b.abort})}},cQ("$ZodNumber",(a,b)=>{eN.init(a,b),a._zod.pattern=a._zod.bag.pattern??dZ,a._zod.parse=(c,d)=>{if(b.coerce)try{c.value=Number(c.value)}catch(a){}let e=c.value;if("number"==typeof e&&!Number.isNaN(e)&&Number.isFinite(e))return c;let f="number"==typeof e?Number.isNaN(e)?"NaN":Number.isFinite(e)?void 0:"Infinity":void 0;return c.issues.push({expected:"number",code:"invalid_type",input:e,inst:a,...f?{received:f}:{}}),c}})),fd=cQ("$ZodNumberFormat",(a,b)=>{ek.init(a,b),fc.init(a,b)}),fe=cQ("$ZodBoolean",(a,b)=>{eN.init(a,b),a._zod.pattern=d$,a._zod.parse=(c,d)=>{if(b.coerce)try{c.value=!!c.value}catch(a){}let e=c.value;return"boolean"==typeof e||c.issues.push({expected:"boolean",code:"invalid_type",input:e,inst:a}),c}}),ff=cQ("$ZodBigInt",(a,b)=>{eN.init(a,b),a._zod.pattern=dX,a._zod.parse=(c,d)=>{if(b.coerce)try{c.value=BigInt(c.value)}catch(a){}return"bigint"==typeof c.value||c.issues.push({expected:"bigint",code:"invalid_type",input:c.value,inst:a}),c}}),fg=((a,b)=>{el.init(a,b),ff.init(a,b)},cQ("$ZodAny",(a,b)=>{eN.init(a,b),a._zod.parse=a=>a})),fh=cQ("$ZodUnknown",(a,b)=>{eN.init(a,b),a._zod.parse=a=>a}),fi=cQ("$ZodNever",(a,b)=>{eN.init(a,b),a._zod.parse=(b,c)=>(b.issues.push({expected:"never",code:"invalid_type",input:b.value,inst:a}),b)}),fj=((a,b)=>{eN.init(a,b),a._zod.parse=(b,c)=>{let d=b.value;return void 0===d||b.issues.push({expected:"void",code:"invalid_type",input:d,inst:a}),b}},cQ("$ZodDate",(a,b)=>{eN.init(a,b),a._zod.parse=(c,d)=>{if(b.coerce)try{c.value=new Date(c.value)}catch(a){}let e=c.value,f=e instanceof Date;return f&&!Number.isNaN(e.getTime())||c.issues.push({expected:"date",code:"invalid_type",input:e,...f?{received:"Invalid Date"}:{},inst:a}),c}}));function fk(a,b,c){a.issues.length&&b.issues.push(...dk(c,a.issues)),b.value[c]=a.value}let fl=cQ("$ZodArray",(a,b)=>{eN.init(a,b),a._zod.parse=(c,d)=>{let e=c.value;if(!Array.isArray(e))return c.issues.push({expected:"array",code:"invalid_type",input:e,inst:a}),c;c.value=Array(e.length);let f=[];for(let a=0;a<e.length;a++){let g=e[a],h=b.element._zod.run({value:g,issues:[]},d);h instanceof Promise?f.push(h.then(b=>fk(b,c,a))):fk(h,c,a)}return f.length?Promise.all(f).then(()=>c):c}});function fm(a,b,c,d,e,f){let g=c in d;if(a.issues.length){if(e&&f&&!g)return;b.issues.push(...dk(c,a.issues))}if(!g&&!e){a.issues.length||b.issues.push({code:"invalid_type",expected:"nonoptional",input:void 0,path:[c]});return}void 0===a.value?g&&(b.value[c]=void 0):b.value[c]=a.value}function fn(a){let b=Object.keys(a.shape);for(let c of b)if(!a.shape?.[c]?._zod?.traits?.has("$ZodType"))throw Error(`Invalid element at key "${c}": expected a Zod schema`);let c=df(a.shape);return{...a,keys:b,keySet:new Set(b),numKeys:b.length,optionalKeys:new Set(c)}}function fo(a,b,c,d,e,f){let g=[],h=e.keySet,i=e.catchall._zod,j=i.def.type,k="optional"===i.optin,l="optional"===i.optout;for(let e in b){if("__proto__"===e||h.has(e))continue;if("never"===j){g.push(e);continue}let f=i.run({value:b[e],issues:[]},d);f instanceof Promise?a.push(f.then(a=>fm(a,c,e,b,k,l))):fm(f,c,e,b,k,l)}return(g.length&&c.issues.push({code:"unrecognized_keys",keys:g,input:b,inst:f}),a.length)?Promise.all(a).then(()=>c):c}let fp=cQ("$ZodObject",(a,b)=>{let c;eN.init(a,b);let d=Object.getOwnPropertyDescriptor(b,"shape");if(!d?.get){let a=b.shape;Object.defineProperty(b,"shape",{get:()=>{let c={...a};return Object.defineProperty(b,"shape",{value:c}),c}})}let e=cX(()=>fn(b));c0(a._zod,"propValues",()=>{let a=b.shape,c={};for(let b in a){let d=a[b]._zod;if(d.values)for(let a of(c[b]??(c[b]=new Set),d.values))c[b].add(a)}return c});let f=b.catchall;a._zod.parse=(b,d)=>{c??(c=e.value);let g=b.value;if(!c6(g))return b.issues.push({expected:"object",code:"invalid_type",input:g,inst:a}),b;b.value={};let h=[],i=c.shape;for(let a of c.keys){let c=i[a],e="optional"===c._zod.optin,f="optional"===c._zod.optout,j=c._zod.run({value:g[a],issues:[]},d);j instanceof Promise?h.push(j.then(c=>fm(c,b,a,g,e,f))):fm(j,b,a,g,e,f)}return f?fo(h,g,b,d,e.value,a):h.length?Promise.all(h).then(()=>b):b}}),fq=cQ("$ZodObjectJIT",(a,b)=>{let c,d;fp.init(a,b);let e=a._zod.parse,f=cX(()=>fn(b)),g=!cT.jitless,h=g&&c7.value,i=b.catchall;a._zod.parse=(j,k)=>{d??(d=f.value);let l=j.value;return c6(l)?g&&h&&k?.async===!1&&!0!==k.jitless?(c||(c=(a=>{let b=new eA(["shape","payload","ctx"]),c=f.value,d=a=>{let b=c3(a);return`shape[${b}]._zod.run({ value: input[${b}], issues: [] }, ctx)`};b.write("const input = payload.value;");let e=Object.create(null),g=0;for(let a of c.keys)e[a]=`key_${g++}`;for(let f of(b.write("const newResult = {};"),c.keys)){let c=e[f],g=c3(f),h=a[f],i=h?._zod?.optin==="optional",j=h?._zod?.optout==="optional";b.write(`const ${c} = ${d(f)};`),i&&j?b.write(`
1
+ module.exports=[211730,a=>{"use strict";a.s(["default",()=>b]);let b=(0,a.i(413981).registerClientReference)(function(){throw Error("Attempted to call the default export of [project]/src/app/signin/signin-form.tsx <module evaluation> from the server, but it's on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"[project]/src/app/signin/signin-form.tsx <module evaluation>","default")},465274,a=>{"use strict";a.s(["default",()=>b]);let b=(0,a.i(413981).registerClientReference)(function(){throw Error("Attempted to call the default export of [project]/src/app/signin/signin-form.tsx from the server, but it's on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"[project]/src/app/signin/signin-form.tsx","default")},961603,a=>{"use strict";a.i(211730);var b=a.i(465274);a.n(b)},244925,a=>{"use strict";let b,c,d,e,f,g,h,i,j,k,l,m,n,o;var p,q,r,s,t=a.i(616842),u=a.i(961603),v=a.i(237976),w=a.i(672919);async function x(b,c){let d;if(b.database)d="function"==typeof b.database?b.database(b):await c(b);else{let c=Object.keys((0,v.getAuthTables)(b)).reduce((a,b)=>(a[b]=[],a),{}),{memoryAdapter:e}=await a.A(165483);d=e(c)(b)}return d.transaction||(w.logger.warn("Adapter does not correctly implement transaction function, patching it automatically. Please update your adapter implementation."),d.transaction=async a=>a(d)),d}var y=a.i(35021);async function z(b){return x(b,async b=>{let{createKyselyAdapter:c}=await a.A(883481),{kysely:d,databaseType:e,transaction:f}=await c(b);if(!d)throw new y.BetterAuthError("Failed to initialize database adapter");let{kyselyAdapter:g}=await a.A(883481);return g(d,{type:e||"sqlite",debugLogs:!!b.database&&"debugLogs"in b.database&&b.database.debugLogs,transaction:f})(b)})}var A=a.i(774982);function B(a){return"-"===a||"^"===a||"$"===a||"+"===a||"."===a||"("===a||")"===a||"|"===a||"["===a||"]"===a||"{"===a||"}"===a||"*"===a||"?"===a||"\\"===a?`\\${a}`:a}function C(a,b){if("string"!=typeof b)throw TypeError(`Sample must be a string, but ${typeof b} given`);return a.test(b)}function D(a,b){if("string"!=typeof a&&!Array.isArray(a))throw TypeError(`The first argument must be a single pattern string or an array of patterns, but ${typeof a} given`);if(("string"==typeof b||"boolean"==typeof b)&&(b={separator:b}),2==arguments.length&&!(void 0===b||"object"==typeof b&&null!==b&&!Array.isArray(b)))throw TypeError(`The second argument must be an options object or a string/boolean separator, but ${typeof b} given`);if("\\"===(b=b||{}).separator)throw Error("\\ is not a valid separator because it is used for escaping. Try setting the separator to `true` instead");let c=function a(b,c=!0){if(Array.isArray(b))return`(?:${b.map(b=>`^${a(b,c)}$`).join("|")})`;let d="",e="",f=".";!0===c?(d="/",e="[/\\\\]",f="[^/\\\\]"):c&&((e=function(a){let b="";for(let c=0;c<a.length;c++)b+=B(a[c]);return b}(d=c)).length>1?(e=`(?:${e})`,f=`((?!${e}).)`):f=`[^${e}]`);let g=c?`${e}+?`:"",h=c?`${e}*?`:"",i=c?b.split(d):[b],j="";for(let a=0;a<i.length;a++){let b=i[a],d=i[a+1],e="";if(b||!(a>0)){if(c&&(e=a===i.length-1?h:"**"!==d?g:""),c&&"**"===b){e&&(j+=0===a?"":e,j+=`(?:${f}*?${e})*?`);continue}for(let a=0;a<b.length;a++){let c=b[a];"\\"===c?a<b.length-1&&(j+=B(b[a+1]),a++):"?"===c?j+=f:"*"===c?j+=`${f}*?`:j+=B(c)}j+=e}}return j}(a,b.separator),d=RegExp(`^${c}$`,b.flags),e=C.bind(null,d);return e.options=b,e.pattern=a,e.regexp=d,e}var E=a.i(125039);function F(a){let b=a.length;for(;b>0&&47===a.charCodeAt(b-1);)b--;return b===a.length?a:a.slice(0,b)}function G(a,b="/api/auth"){try{let b=new URL(a);if("http:"!==b.protocol&&"https:"!==b.protocol)throw new y.BetterAuthError(`Invalid base URL: ${a}. URL must include 'http://' or 'https://'`)}catch(b){if(b instanceof y.BetterAuthError)throw b;throw new y.BetterAuthError(`Invalid base URL: ${a}. Please provide a valid base URL.`,{cause:b})}if(function(a){try{return"/"!==(F(new URL(a).pathname)||"/")}catch{throw new y.BetterAuthError(`Invalid base URL: ${a}. Please provide a valid base URL.`)}}(a))return a;let c=F(a);return b&&"/"!==b?(b=b.startsWith("/")?b:`/${b}`,`${c}${b}`):c}function H(a,b){return!!a&&""!==a.trim()&&("proto"===b?"http"===a||"https"===a:"host"===b&&![/\.\./,/\0/,/[\s]/,/^[.]/,/[<>'"]/,/javascript:/i,/file:/i,/data:/i].some(b=>b.test(a))&&(/^[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(a)||/^(\d{1,3}\.){3}\d{1,3}(:[0-9]{1,5})?$/.test(a)||/^\[[0-9a-fA-F:]+\](:[0-9]{1,5})?$/.test(a)||/^localhost(:[0-9]{1,5})?$/i.test(a)))}function I(a,b,c,d,e){if(a)return G(a,b);if(!1!==d){let a=E.env.BETTER_AUTH_URL||E.env.NEXT_PUBLIC_BETTER_AUTH_URL||E.env.PUBLIC_BETTER_AUTH_URL||E.env.NUXT_PUBLIC_BETTER_AUTH_URL||E.env.NUXT_PUBLIC_AUTH_URL||("/"!==E.env.BASE_URL?E.env.BASE_URL:void 0);if(a)return G(a,b)}let f=c?.headers.get("x-forwarded-host"),g=c?.headers.get("x-forwarded-proto");if(f&&g&&e&&H(g,"proto")&&H(f,"host"))try{return G(`${g}://${f}`,b)}catch(a){}if(c){let a=J(c.url);if(!a)throw new y.BetterAuthError("Could not get origin from request. Please provide a valid base URL.");return G(a,b)}}function J(a){try{let b=new URL(a);return"null"===b.origin?null:b.origin}catch{return null}}function K(a){return"object"==typeof a&&null!==a&&"allowedHosts"in a&&Array.isArray(a.allowedHosts)}function L(a){return a instanceof Request||"object"==typeof a&&null!==a&&"[object Request]"===Object.prototype.toString.call(a)&&"string"==typeof a.url&&"object"==typeof a.headers&&null!==a.headers&&"function"==typeof a.headers.get}function M(a,b){let c=L(a)?a.headers:a;if(b){let a=c.get("x-forwarded-host");if(a&&H(a,"host"))return a}let d=c.get("host");if(d&&H(d,"host"))return d;if(L(a))try{return new URL(a.url).host}catch{}return null}let N=(a,b,c)=>{if(a.startsWith("/"))return!!c?.allowRelativePaths&&a.startsWith("/")&&/^\/(?!\/|\\|%2f|%5c)[\w\-.\+/@]*(?:\?[\w\-.\+/=&%@]*)?$/.test(a);if(b.includes("*")||b.includes("?")){if(b.includes("://"))return D(b)(J(a)||a);let c=function(a){try{return new URL(a).host}catch{return null}}(a);return!!c&&D(b)(c)}let d=function(a){try{return new URL(a).protocol}catch{return null}}(a);return"http:"!==d&&"https:"!==d&&d?a.startsWith(b):b===J(a)};function O(a){return!!a&&("object"==typeof a||"function"==typeof a)&&"function"==typeof a.then}var P=a.i(666680);function Q(a,b){return new Promise((c,d)=>{(0,P.scrypt)(a.normalize("NFKC"),b,64,{N:16384,r:16,p:1,maxmem:0x4000000},(a,b)=>{a?d(a):c(b)})})}async function R(a){let b=(0,P.randomBytes)(16).toString("hex"),c=await Q(a,b);return`${b}:${c.toString("hex")}`}async function S(a,b){let[c,d]=a.split(":");if(!c||!d)throw Error("Invalid password hash");return(await Q(b,c)).toString("hex")===d}let T=async({hash:a,password:b})=>S(a,b);function U(a,b=""){if("number"!=typeof a){let c=b&&`"${b}" `;throw TypeError(`${c}expected number, got ${typeof a}`)}if(!Number.isSafeInteger(a)||a<0){let c=b&&`"${b}" `;throw RangeError(`${c}expected integer >= 0, got ${a}`)}}function V(a,b,c=""){let d=a instanceof Uint8Array||ArrayBuffer.isView(a)&&"Uint8Array"===a.constructor.name&&"BYTES_PER_ELEMENT"in a&&1===a.BYTES_PER_ELEMENT,e=a?.length,f=void 0!==b;if(!d||f&&e!==b){let g=(c&&`"${c}" `)+"expected Uint8Array"+(f?` of length ${b}`:"")+", got "+(d?`length=${e}`:`type=${typeof a}`);if(!d)throw TypeError(g);throw RangeError(g)}return a}function W(a){if("function"!=typeof a||"function"!=typeof a.create)throw TypeError("Hash must wrapped by utils.createHasher");if(U(a.outputLen),U(a.blockLen),a.outputLen<1)throw Error('"outputLen" must be >= 1');if(a.blockLen<1)throw Error('"blockLen" must be >= 1')}function X(a,b=!0){if(a.destroyed)throw Error("Hash instance has been destroyed");if(b&&a.finished)throw Error("Hash#digest() has already been called")}function Y(a,b){V(a,void 0,"digestInto() output");let c=b.outputLen;if(a.length<c)throw RangeError('"digestInto() output" expected to be of length >='+c)}function Z(...a){for(let b=0;b<a.length;b++)a[b].fill(0)}function $(a){return new DataView(a.buffer,a.byteOffset,a.byteLength)}function _(a,b){return a<<32-b|a>>>b}class aa{oHash;iHash;blockLen;outputLen;canXOF=!1;finished=!1;destroyed=!1;constructor(a,b){if(W(a),V(b,void 0,"key"),this.iHash=a.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 c=this.blockLen,d=new Uint8Array(c);d.set(b.length>c?a.create().update(b).digest():b);for(let a=0;a<d.length;a++)d[a]^=54;this.iHash.update(d),this.oHash=a.create();for(let a=0;a<d.length;a++)d[a]^=106;this.oHash.update(d),Z(d)}update(a){return X(this),this.iHash.update(a),this}digestInto(a){X(this),Y(a,this),this.finished=!0;let b=a.subarray(0,this.outputLen);this.iHash.digestInto(b),this.oHash.update(b),this.oHash.digestInto(b),this.destroy()}digest(){let a=new Uint8Array(this.oHash.outputLen);return this.digestInto(a),a}_cloneInto(a){a||=Object.create(Object.getPrototypeOf(this),{});let{oHash:b,iHash:c,finished:d,destroyed:e,blockLen:f,outputLen:g}=this;return a.finished=d,a.destroyed=e,a.blockLen=f,a.outputLen=g,a.oHash=b._cloneInto(a.oHash),a.iHash=c._cloneInto(a.iHash),a}clone(){return this._cloneInto()}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}}let ab=((g=(a,b,c)=>new aa(a,b).update(c).digest()).create=(a,b)=>new aa(a,b),g),ac=Uint8Array.of(0),ad=Uint8Array.of();class ae{blockLen;outputLen;canXOF=!1;padOffset;isLE;buffer;view;finished=!1;length=0;pos=0;destroyed=!1;constructor(a,b,c,d){this.blockLen=a,this.outputLen=b,this.padOffset=c,this.isLE=d,this.buffer=new Uint8Array(a),this.view=$(this.buffer)}update(a){X(this),V(a);let{view:b,buffer:c,blockLen:d}=this,e=a.length;for(let f=0;f<e;){let g=Math.min(d-this.pos,e-f);if(g===d){let b=$(a);for(;d<=e-f;f+=d)this.process(b,f);continue}c.set(a.subarray(f,f+g),this.pos),this.pos+=g,f+=g,this.pos===d&&(this.process(b,0),this.pos=0)}return this.length+=a.length,this.roundClean(),this}digestInto(a){X(this),Y(a,this),this.finished=!0;let{buffer:b,view:c,blockLen:d,isLE:e}=this,{pos:f}=this;b[f++]=128,Z(this.buffer.subarray(f)),this.padOffset>d-f&&(this.process(c,0),f=0);for(let a=f;a<d;a++)b[a]=0;c.setBigUint64(d-8,BigInt(8*this.length),e),this.process(c,0);let g=$(a),h=this.outputLen;if(h%4)throw Error("_sha2: outputLen must be aligned to 32bit");let i=h/4,j=this.get();if(i>j.length)throw Error("_sha2: outputLen bigger than state");for(let a=0;a<i;a++)g.setUint32(4*a,j[a],e)}digest(){let{buffer:a,outputLen:b}=this;this.digestInto(a);let c=a.slice(0,b);return this.destroy(),c}_cloneInto(a){(a||=new this.constructor).set(...this.get());let{blockLen:b,buffer:c,length:d,finished:e,destroyed:f,pos:g}=this;return a.destroyed=f,a.finished=e,a.length=d,a.pos=g,d%b&&a.buffer.set(c),a}clone(){return this._cloneInto()}}let af=Uint32Array.from([0x6a09e667,0xbb67ae85,0x3c6ef372,0xa54ff53a,0x510e527f,0x9b05688c,0x1f83d9ab,0x5be0cd19]),ag=Uint32Array.from([0xc1059ed8,0x367cd507,0x3070dd17,0xf70e5939,0xffc00b31,0x68581511,0x64f98fa7,0xbefa4fa4]),ah=Uint32Array.from([0xcbbb9d5d,0xc1059ed8,0x629a292a,0x367cd507,0x9159015a,0x3070dd17,0x152fecd8,0xf70e5939,0x67332667,0xffc00b31,0x8eb44a87,0x68581511,0xdb0c2e0d,0x64f98fa7,0x47b5481d,0xbefa4fa4]),ai=Uint32Array.from([0x6a09e667,0xf3bcc908,0xbb67ae85,0x84caa73b,0x3c6ef372,0xfe94f82b,0xa54ff53a,0x5f1d36f1,0x510e527f,0xade682d1,0x9b05688c,0x2b3e6c1f,0x1f83d9ab,0xfb41bd6b,0x5be0cd19,0x137e2179]),aj=BigInt(0x100000000-1),ak=BigInt(32),al=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]),am=new Uint32Array(64);class an extends ae{constructor(a){super(64,a,8,!1)}get(){let{A:a,B:b,C:c,D:d,E:e,F:f,G:g,H:h}=this;return[a,b,c,d,e,f,g,h]}set(a,b,c,d,e,f,g,h){this.A=0|a,this.B=0|b,this.C=0|c,this.D=0|d,this.E=0|e,this.F=0|f,this.G=0|g,this.H=0|h}process(a,b){for(let c=0;c<16;c++,b+=4)am[c]=a.getUint32(b,!1);for(let a=16;a<64;a++){let b=am[a-15],c=am[a-2],d=_(b,7)^_(b,18)^b>>>3,e=_(c,17)^_(c,19)^c>>>10;am[a]=e+am[a-7]+d+am[a-16]|0}let{A:c,B:d,C:e,D:f,E:g,F:h,G:i,H:j}=this;for(let a=0;a<64;a++){var k,l,m,n;let b=j+(_(g,6)^_(g,11)^_(g,25))+((k=g)&h^~k&i)+al[a]+am[a]|0,o=(_(c,2)^_(c,13)^_(c,22))+((l=c)&(m=d)^l&(n=e)^m&n)|0;j=i,i=h,h=g,g=f+b|0,f=e,e=d,d=c,c=b+o|0}c=c+this.A|0,d=d+this.B|0,e=e+this.C|0,f=f+this.D|0,g=g+this.E|0,h=h+this.F|0,i=i+this.G|0,j=j+this.H|0,this.set(c,d,e,f,g,h,i,j)}roundClean(){Z(am)}destroy(){this.destroyed=!0,this.set(0,0,0,0,0,0,0,0),Z(this.buffer)}}class ao extends an{A=0|af[0];B=0|af[1];C=0|af[2];D=0|af[3];E=0|af[4];F=0|af[5];G=0|af[6];H=0|af[7];constructor(){super(32)}}let ap=function(a,b=!1){let c=a.length,d=new Uint32Array(c),e=new Uint32Array(c);for(let f=0;f<c;f++){let{h:c,l:g}=function(a,b=!1){return b?{h:Number(a&aj),l:Number(a>>ak&aj)}:{h:0|Number(a>>ak&aj),l:0|Number(a&aj)}}(a[f],b);[d[f],e[f]]=[c,g]}return[d,e]}(["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(a=>BigInt(a))),aq=ap[0],ar=ap[1],as=new Uint32Array(80),at=new Uint32Array(80),au=function(a,b={}){let c=(b,c)=>a(c).update(b).digest(),d=a(void 0);return c.outputLen=d.outputLen,c.blockLen=d.blockLen,c.canXOF=d.canXOF,c.create=b=>a(b),Object.assign(c,b),Object.freeze(c)}(()=>new ao,{oid:Uint8Array.from([6,9,96,134,72,1,101,3,4,2,1])}),av=new TextEncoder,aw=new TextDecoder;function ax(...a){let b=new Uint8Array(a.reduce((a,{length:b})=>a+b,0)),c=0;for(let d of a)b.set(d,c),c+=d.length;return b}function ay(a,b,c){if(b<0||b>=0x100000000)throw RangeError(`value must be >= 0 and <= ${0x100000000-1}. Received ${b}`);a.set([b>>>24,b>>>16,b>>>8,255&b],c)}function az(a){let b=Math.floor(a/0x100000000),c=new Uint8Array(8);return ay(c,b,0),ay(c,a%0x100000000,4),c}function aA(a){let b=new Uint8Array(4);return ay(b,a),b}function aB(a){let b=new Uint8Array(a.length);for(let c=0;c<a.length;c++){let d=a.charCodeAt(c);if(d>127)throw TypeError("non-ASCII string encountered in encode()");b[c]=d}return b}function aC(a){if(Uint8Array.fromBase64)return Uint8Array.fromBase64("string"==typeof a?a:aw.decode(a),{alphabet:"base64url"});let b=a;b instanceof Uint8Array&&(b=aw.decode(b)),b=b.replace(/-/g,"+").replace(/_/g,"/");try{var c=b;if(Uint8Array.fromBase64)return Uint8Array.fromBase64(c);let a=atob(c),d=new Uint8Array(a.length);for(let b=0;b<a.length;b++)d[b]=a.charCodeAt(b);return d}catch{throw TypeError("The input to be decoded is not correctly encoded.")}}function aD(a){let b=a;return("string"==typeof b&&(b=av.encode(b)),Uint8Array.prototype.toBase64)?b.toBase64({alphabet:"base64url",omitPadding:!0}):(function(a){if(Uint8Array.prototype.toBase64)return a.toBase64();let b=[];for(let c=0;c<a.length;c+=32768)b.push(String.fromCharCode.apply(null,a.subarray(c,c+32768)));return btoa(b.join(""))})(b).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}a.s(["decode",0,aC,"encode",0,aD],736256);let aE=Symbol();function aF(a,b){if(a)throw TypeError(`${b} can only be called once`)}function aG(a,b,c){try{return aC(a)}catch{throw new c(`Failed to base64url decode the ${b}`)}}async function aH(a,b){let c=`SHA-${a.slice(-3)}`;return new Uint8Array(await crypto.subtle.digest(c,b))}let aI=(a,b="algorithm.name")=>TypeError(`CryptoKey does not support this operation, its ${b} must be ${a}`);function aJ(a,b){if(parseInt(a.hash.name.slice(4),10)!==b)throw aI(`SHA-${b}`,"algorithm.hash")}function aK(a,b){if(b&&!a.usages.includes(b))throw TypeError(`CryptoKey does not support this operation, its usages must include ${b}.`)}function aL(a,b,c){switch(b){case"A128GCM":case"A192GCM":case"A256GCM":{if("AES-GCM"!==a.algorithm.name)throw aI("AES-GCM");let c=parseInt(b.slice(1,4),10);if(a.algorithm.length!==c)throw aI(c,"algorithm.length");break}case"A128KW":case"A192KW":case"A256KW":{if("AES-KW"!==a.algorithm.name)throw aI("AES-KW");let c=parseInt(b.slice(1,4),10);if(a.algorithm.length!==c)throw aI(c,"algorithm.length");break}case"ECDH":switch(a.algorithm.name){case"ECDH":case"X25519":break;default:throw aI("ECDH or X25519")}break;case"PBES2-HS256+A128KW":case"PBES2-HS384+A192KW":case"PBES2-HS512+A256KW":if("PBKDF2"!==a.algorithm.name)throw aI("PBKDF2");break;case"RSA-OAEP":case"RSA-OAEP-256":case"RSA-OAEP-384":case"RSA-OAEP-512":if("RSA-OAEP"!==a.algorithm.name)throw aI("RSA-OAEP");aJ(a.algorithm,parseInt(b.slice(9),10)||1);break;default:throw TypeError("CryptoKey does not support this operation")}aK(a,c)}function aM(a,b,...c){if((c=c.filter(Boolean)).length>2){let b=c.pop();a+=`one of type ${c.join(", ")}, or ${b}.`}else 2===c.length?a+=`one of type ${c[0]} or ${c[1]}.`:a+=`of type ${c[0]}.`;return null==b?a+=` Received ${b}`:"function"==typeof b&&b.name?a+=` Received function ${b.name}`:"object"==typeof b&&null!=b&&b.constructor?.name&&(a+=` Received an instance of ${b.constructor.name}`),a}let aN=(a,...b)=>aM("Key must be ",a,...b),aO=(a,b,...c)=>aM(`Key for the ${a} algorithm must be `,b,...c);class aP extends Error{static code="ERR_JOSE_GENERIC";code="ERR_JOSE_GENERIC";constructor(a,b){super(a,b),this.name=this.constructor.name,Error.captureStackTrace?.(this,this.constructor)}}class aQ extends aP{static code="ERR_JWT_CLAIM_VALIDATION_FAILED";code="ERR_JWT_CLAIM_VALIDATION_FAILED";claim;reason;payload;constructor(a,b,c="unspecified",d="unspecified"){super(a,{cause:{claim:c,reason:d,payload:b}}),this.claim=c,this.reason=d,this.payload=b}}class aR extends aP{static code="ERR_JWT_EXPIRED";code="ERR_JWT_EXPIRED";claim;reason;payload;constructor(a,b,c="unspecified",d="unspecified"){super(a,{cause:{claim:c,reason:d,payload:b}}),this.claim=c,this.reason=d,this.payload=b}}class aS extends aP{static code="ERR_JOSE_ALG_NOT_ALLOWED";code="ERR_JOSE_ALG_NOT_ALLOWED"}class aT extends aP{static code="ERR_JOSE_NOT_SUPPORTED";code="ERR_JOSE_NOT_SUPPORTED"}class aU extends aP{static code="ERR_JWE_DECRYPTION_FAILED";code="ERR_JWE_DECRYPTION_FAILED";constructor(a="decryption operation failed",b){super(a,b)}}class aV extends aP{static code="ERR_JWE_INVALID";code="ERR_JWE_INVALID"}class aW extends aP{static code="ERR_JWS_INVALID";code="ERR_JWS_INVALID"}class aX extends aP{static code="ERR_JWT_INVALID";code="ERR_JWT_INVALID"}class aY extends aP{static code="ERR_JWK_INVALID";code="ERR_JWK_INVALID"}class aZ extends aP{static code="ERR_JWKS_INVALID";code="ERR_JWKS_INVALID"}class a$ extends aP{static code="ERR_JWKS_NO_MATCHING_KEY";code="ERR_JWKS_NO_MATCHING_KEY";constructor(a="no applicable key found in the JSON Web Key Set",b){super(a,b)}}class a_ extends aP{[Symbol.asyncIterator];static code="ERR_JWKS_MULTIPLE_MATCHING_KEYS";code="ERR_JWKS_MULTIPLE_MATCHING_KEYS";constructor(a="multiple matching keys found in the JSON Web Key Set",b){super(a,b)}}class a0 extends aP{static code="ERR_JWKS_TIMEOUT";code="ERR_JWKS_TIMEOUT";constructor(a="request timed out",b){super(a,b)}}class a1 extends aP{static code="ERR_JWS_SIGNATURE_VERIFICATION_FAILED";code="ERR_JWS_SIGNATURE_VERIFICATION_FAILED";constructor(a="signature verification failed",b){super(a,b)}}function a2(a){if(!a3(a))throw Error("CryptoKey instance expected")}let a3=a=>{if(a?.[Symbol.toStringTag]==="CryptoKey")return!0;try{return a instanceof CryptoKey}catch{return!1}},a4=a=>a?.[Symbol.toStringTag]==="KeyObject",a5=a=>a3(a)||a4(a);function a6(a){switch(a){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 aT(`Unsupported JWE Algorithm: ${a}`)}}let a7=a=>crypto.getRandomValues(new Uint8Array(a6(a)>>3));function a8(a,b){let c=a.byteLength<<3;if(c!==b)throw new aV(`Invalid Content Encryption Key length. Expected ${b} bits, got ${c} bits`)}function a9(a){switch(a){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 aT(`Unsupported JWE Algorithm: ${a}`)}}function ba(a,b){if(b.length<<3!==a9(a))throw new aV("Invalid Initialization Vector length")}async function bb(a,b,c){if(!(b instanceof Uint8Array))throw TypeError(aN(b,"Uint8Array"));let d=parseInt(a.slice(1,4),10);return{encKey:await crypto.subtle.importKey("raw",b.subarray(d>>3),"AES-CBC",!1,[c]),macKey:await crypto.subtle.importKey("raw",b.subarray(0,d>>3),{hash:`SHA-${d<<1}`,name:"HMAC"},!1,["sign"]),keySize:d}}async function bc(a,b,c){return new Uint8Array((await crypto.subtle.sign("HMAC",a,b)).slice(0,c>>3))}async function bd(a,b,c,d,e){let{encKey:f,macKey:g,keySize:h}=await bb(a,c,"encrypt"),i=new Uint8Array(await crypto.subtle.encrypt({iv:d,name:"AES-CBC"},f,b)),j=ax(e,d,i,az(e.length<<3));return{ciphertext:i,tag:await bc(g,j,h),iv:d}}async function be(a,b){if(!(a instanceof Uint8Array))throw TypeError("First argument must be a buffer");if(!(b instanceof Uint8Array))throw TypeError("Second argument must be a buffer");let c={name:"HMAC",hash:"SHA-256"},d=await crypto.subtle.generateKey(c,!1,["sign"]),e=new Uint8Array(await crypto.subtle.sign(c,d,a)),f=new Uint8Array(await crypto.subtle.sign(c,d,b)),g=0,h=-1;for(;++h<32;)g|=e[h]^f[h];return 0===g}async function bf(a,b,c,d,e,f){let g,h,{encKey:i,macKey:j,keySize:k}=await bb(a,b,"decrypt"),l=ax(f,d,c,az(f.length<<3)),m=await bc(j,l,k);try{g=await be(e,m)}catch{}if(!g)throw new aU;try{h=new Uint8Array(await crypto.subtle.decrypt({iv:d,name:"AES-CBC"},i,c))}catch{}if(!h)throw new aU;return h}async function bg(a,b,c,d,e){let f;c instanceof Uint8Array?f=await crypto.subtle.importKey("raw",c,"AES-GCM",!1,["encrypt"]):(aL(c,a,"encrypt"),f=c);let g=new Uint8Array(await crypto.subtle.encrypt({additionalData:e,iv:d,name:"AES-GCM",tagLength:128},f,b)),h=g.slice(-16);return{ciphertext:g.slice(0,-16),tag:h,iv:d}}async function bh(a,b,c,d,e,f){let g;b instanceof Uint8Array?g=await crypto.subtle.importKey("raw",b,"AES-GCM",!1,["decrypt"]):(aL(b,a,"decrypt"),g=b);try{return new Uint8Array(await crypto.subtle.decrypt({additionalData:f,iv:d,name:"AES-GCM",tagLength:128},g,ax(c,e)))}catch{throw new aU}}let bi="Unsupported JWE Content Encryption Algorithm";async function bj(a,b,c,d,e){if(!a3(c)&&!(c instanceof Uint8Array))throw TypeError(aN(c,"CryptoKey","KeyObject","Uint8Array","JSON Web Key"));if(d)ba(a,d);else d=crypto.getRandomValues(new Uint8Array(a9(a)>>3));switch(a){case"A128CBC-HS256":case"A192CBC-HS384":case"A256CBC-HS512":return c instanceof Uint8Array&&a8(c,parseInt(a.slice(-3),10)),bd(a,b,c,d,e);case"A128GCM":case"A192GCM":case"A256GCM":return c instanceof Uint8Array&&a8(c,parseInt(a.slice(1,4),10)),bg(a,b,c,d,e);default:throw new aT(bi)}}async function bk(a,b,c,d,e,f){if(!a3(b)&&!(b instanceof Uint8Array))throw TypeError(aN(b,"CryptoKey","KeyObject","Uint8Array","JSON Web Key"));if(!d)throw new aV("JWE Initialization Vector missing");if(!e)throw new aV("JWE Authentication Tag missing");switch(ba(a,d),a){case"A128CBC-HS256":case"A192CBC-HS384":case"A256CBC-HS512":return b instanceof Uint8Array&&a8(b,parseInt(a.slice(-3),10)),bf(a,b,c,d,e,f);case"A128GCM":case"A192GCM":case"A256GCM":return b instanceof Uint8Array&&a8(b,parseInt(a.slice(1,4),10)),bh(a,b,c,d,e,f);default:throw new aT(bi)}}function bl(a,b){if(a.algorithm.length!==parseInt(b.slice(1,4),10))throw TypeError(`Invalid key size for alg: ${b}`)}function bm(a,b,c){return a instanceof Uint8Array?crypto.subtle.importKey("raw",a,"AES-KW",!0,[c]):(aL(a,b,c),a)}async function bn(a,b,c){let d=await bm(b,a,"wrapKey");bl(d,a);let e=await crypto.subtle.importKey("raw",c,{hash:"SHA-256",name:"HMAC"},!0,["sign"]);return new Uint8Array(await crypto.subtle.wrapKey("raw",e,d,"AES-KW"))}async function bo(a,b,c){let d=await bm(b,a,"unwrapKey");bl(d,a);let e=await crypto.subtle.unwrapKey("raw",c,d,"AES-KW",{hash:"SHA-256",name:"HMAC"},!0,["sign"]);return new Uint8Array(await crypto.subtle.exportKey("raw",e))}function bp(a){return ax(aA(a.length),a)}async function bq(a,b,c){let d=b>>3,e=Math.ceil(d/32),f=new Uint8Array(32*e);for(let b=1;b<=e;b++){let d=new Uint8Array(4+a.length+c.length);d.set(aA(b),0),d.set(a,4),d.set(c,4+a.length);let e=await aH("sha256",d);f.set(e,(b-1)*32)}return f.slice(0,d)}async function br(a,b,c,d,e=new Uint8Array,f=new Uint8Array){var g;aL(a,"ECDH"),aL(b,"ECDH","deriveBits");let h=ax(bp(aB(c)),bp(e),bp(f),aA(d),new Uint8Array);return bq(new Uint8Array(await crypto.subtle.deriveBits({name:a.algorithm.name,public:a},b,"X25519"===(g=a).algorithm.name?256:Math.ceil(parseInt(g.algorithm.namedCurve.slice(-3),10)/8)<<3)),d,h)}function bs(a){switch(a.algorithm.namedCurve){case"P-256":case"P-384":case"P-521":return!0;default:return"X25519"===a.algorithm.name}}async function bt(a,b,c,d){if(!(a instanceof Uint8Array)||a.length<8)throw new aV("PBES2 Salt Input must be 8 or more octets");if(!Number.isSafeInteger(c)||1!==Math.sign(c))throw new aV("PBES2 Count Input must be a positive integer");let e=ax(aB(b),Uint8Array.of(0),a),f=parseInt(b.slice(13,16),10),g={hash:`SHA-${b.slice(8,11)}`,iterations:c,name:"PBKDF2",salt:e},h=await (d instanceof Uint8Array?crypto.subtle.importKey("raw",d,"PBKDF2",!1,["deriveBits"]):(aL(d,b,"deriveBits"),d));return new Uint8Array(await crypto.subtle.deriveBits(g,h,f))}async function bu(a,b,c,d=2048,e=crypto.getRandomValues(new Uint8Array(16))){let f=await bt(e,a,d,b);return{encryptedKey:await bn(a.slice(-6),f,c),p2c:d,p2s:aD(e)}}async function bv(a,b,c,d,e){let f=await bt(e,a,d,b);return bo(a.slice(-6),f,c)}function bw(a,b){if(a.startsWith("RS")||a.startsWith("PS")){let{modulusLength:c}=b.algorithm;if("number"!=typeof c||c<2048)throw TypeError(`${a} requires key modulusLength to be 2048 bits or larger`)}}function bx(a,b){let c=`SHA-${a.slice(-3)}`;switch(a){case"HS256":case"HS384":case"HS512":return{hash:c,name:"HMAC"};case"PS256":case"PS384":case"PS512":return{hash:c,name:"RSA-PSS",saltLength:parseInt(a.slice(-3),10)>>3};case"RS256":case"RS384":case"RS512":return{hash:c,name:"RSASSA-PKCS1-v1_5"};case"ES256":case"ES384":case"ES512":return{hash:c,name:"ECDSA",namedCurve:b.namedCurve};case"Ed25519":case"EdDSA":return{name:"Ed25519"};case"ML-DSA-44":case"ML-DSA-65":case"ML-DSA-87":return{name:a};default:throw new aT(`alg ${a} is not supported either by JOSE or your javascript runtime`)}}async function by(a,b,c){if(b instanceof Uint8Array){if(!a.startsWith("HS"))throw TypeError(aN(b,"CryptoKey","KeyObject","JSON Web Key"));return crypto.subtle.importKey("raw",b,{hash:`SHA-${a.slice(-3)}`,name:"HMAC"},!1,[c])}switch(a){case"HS256":case"HS384":case"HS512":if("HMAC"!==b.algorithm.name)throw aI("HMAC");aJ(b.algorithm,parseInt(a.slice(2),10));break;case"RS256":case"RS384":case"RS512":if("RSASSA-PKCS1-v1_5"!==b.algorithm.name)throw aI("RSASSA-PKCS1-v1_5");aJ(b.algorithm,parseInt(a.slice(2),10));break;case"PS256":case"PS384":case"PS512":if("RSA-PSS"!==b.algorithm.name)throw aI("RSA-PSS");aJ(b.algorithm,parseInt(a.slice(2),10));break;case"Ed25519":case"EdDSA":if("Ed25519"!==b.algorithm.name)throw aI("Ed25519");break;case"ML-DSA-44":case"ML-DSA-65":case"ML-DSA-87":let d;if(d=b.algorithm,d.name!==a)throw aI(a);break;case"ES256":case"ES384":case"ES512":{if("ECDSA"!==b.algorithm.name)throw aI("ECDSA");let c=function(a){switch(a){case"ES256":return"P-256";case"ES384":return"P-384";case"ES512":return"P-521";default:throw Error("unreachable")}}(a);if(b.algorithm.namedCurve!==c)throw aI(c,"algorithm.namedCurve");break}default:throw TypeError("CryptoKey does not support this operation")}return aK(b,c),b}async function bz(a,b,c){let d=await by(a,b,"sign");return bw(a,d),new Uint8Array(await crypto.subtle.sign(bx(a,d.algorithm),d,c))}async function bA(a,b,c,d){let e=await by(a,b,"verify");bw(a,e);let f=bx(a,e.algorithm);try{return await crypto.subtle.verify(f,e,c,d)}catch{return!1}}let bB=a=>{switch(a){case"RSA-OAEP":case"RSA-OAEP-256":case"RSA-OAEP-384":case"RSA-OAEP-512":return"RSA-OAEP";default:throw new aT(`alg ${a} is not supported either by JOSE or your javascript runtime`)}};async function bC(a,b,c){return aL(b,a,"encrypt"),bw(a,b),new Uint8Array(await crypto.subtle.encrypt(bB(a),b,c))}async function bD(a,b,c){return aL(b,a,"decrypt"),bw(a,b),new Uint8Array(await crypto.subtle.decrypt(bB(a),b,c))}function bE(a){if("object"!=typeof a||null===a||"[object Object]"!==Object.prototype.toString.call(a))return!1;if(null===Object.getPrototypeOf(a))return!0;let b=a;for(;null!==Object.getPrototypeOf(b);)b=Object.getPrototypeOf(b);return Object.getPrototypeOf(a)===b}function bF(...a){let b,c=a.filter(Boolean);if(0===c.length||1===c.length)return!0;for(let a of c){let c=Object.keys(a);if(!b||0===b.size){b=new Set(c);continue}for(let a of c){if(b.has(a))return!1;b.add(a)}}return!0}let bG=a=>bE(a)&&"string"==typeof a.kty,bH='Invalid or unsupported JWK "alg" (Algorithm) Parameter value';async function bI(a){if(!a.alg)throw TypeError('"alg" argument is required when "jwk.alg" is not present');let{algorithm:b,keyUsages:c}=function(a){let b,c;switch(a.kty){case"AKP":switch(a.alg){case"ML-DSA-44":case"ML-DSA-65":case"ML-DSA-87":b={name:a.alg},c=a.priv?["sign"]:["verify"];break;default:throw new aT(bH)}break;case"RSA":switch(a.alg){case"PS256":case"PS384":case"PS512":b={name:"RSA-PSS",hash:`SHA-${a.alg.slice(-3)}`},c=a.d?["sign"]:["verify"];break;case"RS256":case"RS384":case"RS512":b={name:"RSASSA-PKCS1-v1_5",hash:`SHA-${a.alg.slice(-3)}`},c=a.d?["sign"]:["verify"];break;case"RSA-OAEP":case"RSA-OAEP-256":case"RSA-OAEP-384":case"RSA-OAEP-512":b={name:"RSA-OAEP",hash:`SHA-${parseInt(a.alg.slice(-3),10)||1}`},c=a.d?["decrypt","unwrapKey"]:["encrypt","wrapKey"];break;default:throw new aT(bH)}break;case"EC":switch(a.alg){case"ES256":case"ES384":case"ES512":b={name:"ECDSA",namedCurve:({ES256:"P-256",ES384:"P-384",ES512:"P-521"})[a.alg]},c=a.d?["sign"]:["verify"];break;case"ECDH-ES":case"ECDH-ES+A128KW":case"ECDH-ES+A192KW":case"ECDH-ES+A256KW":b={name:"ECDH",namedCurve:a.crv},c=a.d?["deriveBits"]:[];break;default:throw new aT(bH)}break;case"OKP":switch(a.alg){case"Ed25519":case"EdDSA":b={name:"Ed25519"},c=a.d?["sign"]:["verify"];break;case"ECDH-ES":case"ECDH-ES+A128KW":case"ECDH-ES+A192KW":case"ECDH-ES+A256KW":b={name:a.crv},c=a.d?["deriveBits"]:[];break;default:throw new aT(bH)}break;default:throw new aT('Invalid or unsupported JWK "kty" (Key Type) Parameter value')}return{algorithm:b,keyUsages:c}}(a),d={...a};return"AKP"!==d.kty&&delete d.alg,delete d.use,crypto.subtle.importKey("jwk",d,b,a.ext??(!a.d&&!a.priv),a.key_ops??c)}let bJ="given KeyObject instance cannot be used for this algorithm",bK=async(a,c,d,e=!1)=>{let f=(b||=new WeakMap).get(a);if(f?.[d])return f[d];let g=await bI({...c,alg:d});return e&&Object.freeze(a),f?f[d]=g:b.set(a,{[d]:g}),g};async function bL(a,c){if(a instanceof Uint8Array||a3(a))return a;if(a4(a)){if("secret"===a.type)return a.export();if("toCryptoKey"in a&&"function"==typeof a.toCryptoKey)try{return((a,c)=>{let d,e=(b||=new WeakMap).get(a);if(e?.[c])return e[c];let f="public"===a.type,g=!!f;if("x25519"===a.asymmetricKeyType){switch(c){case"ECDH-ES":case"ECDH-ES+A128KW":case"ECDH-ES+A192KW":case"ECDH-ES+A256KW":break;default:throw TypeError(bJ)}d=a.toCryptoKey(a.asymmetricKeyType,g,f?[]:["deriveBits"])}if("ed25519"===a.asymmetricKeyType){if("EdDSA"!==c&&"Ed25519"!==c)throw TypeError(bJ);d=a.toCryptoKey(a.asymmetricKeyType,g,[f?"verify":"sign"])}switch(a.asymmetricKeyType){case"ml-dsa-44":case"ml-dsa-65":case"ml-dsa-87":if(c!==a.asymmetricKeyType.toUpperCase())throw TypeError(bJ);d=a.toCryptoKey(a.asymmetricKeyType,g,[f?"verify":"sign"])}if("rsa"===a.asymmetricKeyType){let b;switch(c){case"RSA-OAEP":b="SHA-1";break;case"RS256":case"PS256":case"RSA-OAEP-256":b="SHA-256";break;case"RS384":case"PS384":case"RSA-OAEP-384":b="SHA-384";break;case"RS512":case"PS512":case"RSA-OAEP-512":b="SHA-512";break;default:throw TypeError(bJ)}if(c.startsWith("RSA-OAEP"))return a.toCryptoKey({name:"RSA-OAEP",hash:b},g,f?["encrypt"]:["decrypt"]);d=a.toCryptoKey({name:c.startsWith("PS")?"RSA-PSS":"RSASSA-PKCS1-v1_5",hash:b},g,[f?"verify":"sign"])}if("ec"===a.asymmetricKeyType){let b=new Map([["prime256v1","P-256"],["secp384r1","P-384"],["secp521r1","P-521"]]).get(a.asymmetricKeyDetails?.namedCurve);if(!b)throw TypeError(bJ);let e={ES256:"P-256",ES384:"P-384",ES512:"P-521"};e[c]&&b===e[c]&&(d=a.toCryptoKey({name:"ECDSA",namedCurve:b},g,[f?"verify":"sign"])),c.startsWith("ECDH-ES")&&(d=a.toCryptoKey({name:"ECDH",namedCurve:b},g,f?[]:["deriveBits"]))}if(!d)throw TypeError(bJ);return e?e[c]=d:b.set(a,{[c]:d}),d})(a,c)}catch(a){if(a instanceof TypeError)throw a}let d=a.export({format:"jwk"});return bK(a,d,c)}if(bG(a))return a.k?aC(a.k):bK(a,a,c,!0);throw Error("unreachable")}async function bM(a,b,c){let d;if(!bE(a))throw TypeError("JWK must be an object");switch(b??=a.alg,d??=c?.extractable??a.ext,a.kty){case"oct":if("string"!=typeof a.k||!a.k)throw TypeError('missing "k" (Key Value) Parameter value');return aC(a.k);case"RSA":if("oth"in a&&void 0!==a.oth)throw new aT('RSA JWK "oth" (Other Primes Info) Parameter value is not supported');return bI({...a,alg:b,ext:d});case"AKP":if("string"!=typeof a.alg||!a.alg)throw TypeError('missing "alg" (Algorithm) Parameter value');if(void 0!==b&&b!==a.alg)throw TypeError("JWK alg and alg option value mismatch");return bI({...a,ext:d});case"EC":case"OKP":return bI({...a,alg:b,ext:d});default:throw new aT('Unsupported "kty" (Key Type) Parameter value')}}async function bN(a){if(a4(a))if("secret"!==a.type)return a.export({format:"jwk"});else a=a.export();if(a instanceof Uint8Array)return{kty:"oct",k:aD(a)};if(!a3(a))throw TypeError(aN(a,"CryptoKey","KeyObject","Uint8Array"));if(!a.extractable)throw TypeError("non-extractable CryptoKey cannot be exported as a JWK");let{ext:b,key_ops:c,alg:d,use:e,...f}=await crypto.subtle.exportKey("jwk",a);return"AKP"===f.kty&&(f.alg=d),f}async function bO(a){return bN(a)}async function bP(a,b,c,d){let e=a.slice(0,7),f=await bj(e,c,b,d,new Uint8Array);return{encryptedKey:f.ciphertext,iv:aD(f.iv),tag:aD(f.tag)}}async function bQ(a,b,c,d,e){return bk(a.slice(0,7),b,c,d,e,new Uint8Array)}let bR='Invalid or unsupported "alg" (JWE Algorithm) header value';function bS(a){if(void 0===a)throw new aV("JWE Encrypted Key missing")}async function bT(a,b,c,d,e){switch(a){case"dir":if(void 0!==c)throw new aV("Encountered unexpected JWE Encrypted Key");return b;case"ECDH-ES":if(void 0!==c)throw new aV("Encountered unexpected JWE Encrypted Key");case"ECDH-ES+A128KW":case"ECDH-ES+A192KW":case"ECDH-ES+A256KW":{let e,f;if(!bE(d.epk))throw new aV('JOSE Header "epk" (Ephemeral Public Key) missing or invalid');if(a2(b),!bs(b))throw new aT("ECDH with the provided key is not allowed or not supported by your javascript runtime");let g=await bM(d.epk,a);if(a2(g),void 0!==d.apu){if("string"!=typeof d.apu)throw new aV('JOSE Header "apu" (Agreement PartyUInfo) invalid');e=aG(d.apu,"apu",aV)}if(void 0!==d.apv){if("string"!=typeof d.apv)throw new aV('JOSE Header "apv" (Agreement PartyVInfo) invalid');f=aG(d.apv,"apv",aV)}let h=await br(g,b,"ECDH-ES"===a?d.enc:a,"ECDH-ES"===a?a6(d.enc):parseInt(a.slice(-5,-2),10),e,f);if("ECDH-ES"===a)return h;return bS(c),bo(a.slice(-6),h,c)}case"RSA-OAEP":case"RSA-OAEP-256":case"RSA-OAEP-384":case"RSA-OAEP-512":return bS(c),a2(b),bD(a,b,c);case"PBES2-HS256+A128KW":case"PBES2-HS384+A192KW":case"PBES2-HS512+A256KW":{let f;if(bS(c),"number"!=typeof d.p2c)throw new aV('JOSE Header "p2c" (PBES2 Count) missing or invalid');let g=e?.maxPBES2Count||1e4;if(d.p2c>g)throw new aV('JOSE Header "p2c" (PBES2 Count) out is of acceptable bounds');if("string"!=typeof d.p2s)throw new aV('JOSE Header "p2s" (PBES2 Salt) missing or invalid');return f=aG(d.p2s,"p2s",aV),bv(a,b,c,d.p2c,f)}case"A128KW":case"A192KW":case"A256KW":return bS(c),bo(a,b,c);case"A128GCMKW":case"A192GCMKW":case"A256GCMKW":if(bS(c),"string"!=typeof d.iv)throw new aV('JOSE Header "iv" (Initialization Vector) missing or invalid');if("string"!=typeof d.tag)throw new aV('JOSE Header "tag" (Authentication Tag) missing or invalid');return bQ(a,b,c,aG(d.iv,"iv",aV),aG(d.tag,"tag",aV));default:throw new aT(bR)}}async function bU(a,b,c,d,e={}){let f,g,h;switch(a){case"dir":h=c;break;case"ECDH-ES":case"ECDH-ES+A128KW":case"ECDH-ES+A192KW":case"ECDH-ES+A256KW":{let i;if(a2(c),!bs(c))throw new aT("ECDH with the provided key is not allowed or not supported by your javascript runtime");let{apu:j,apv:k}=e;i=e.epk?await bL(e.epk,a):(await crypto.subtle.generateKey(c.algorithm,!0,["deriveBits"])).privateKey;let{x:l,y:m,crv:n,kty:o}=await bO(i),p=await br(c,i,"ECDH-ES"===a?b:a,"ECDH-ES"===a?a6(b):parseInt(a.slice(-5,-2),10),j,k);if(g={epk:{x:l,crv:n,kty:o}},"EC"===o&&(g.epk.y=m),j&&(g.apu=aD(j)),k&&(g.apv=aD(k)),"ECDH-ES"===a){h=p;break}h=d||a7(b);let q=a.slice(-6);f=await bn(q,p,h);break}case"RSA-OAEP":case"RSA-OAEP-256":case"RSA-OAEP-384":case"RSA-OAEP-512":h=d||a7(b),a2(c),f=await bC(a,c,h);break;case"PBES2-HS256+A128KW":case"PBES2-HS384+A192KW":case"PBES2-HS512+A256KW":{h=d||a7(b);let{p2c:i,p2s:j}=e;({encryptedKey:f,...g}=await bu(a,c,h,i,j));break}case"A128KW":case"A192KW":case"A256KW":h=d||a7(b),f=await bn(a,c,h);break;case"A128GCMKW":case"A192GCMKW":case"A256GCMKW":{h=d||a7(b);let{iv:i}=e;({encryptedKey:f,...g}=await bP(a,c,h,i));break}default:throw new aT(bR)}return{cek:h,encryptedKey:f,parameters:g}}function bV(a,b,c,d,e){let f;if(void 0!==e.crit&&d?.crit===void 0)throw new a('"crit" (Critical) Header Parameter MUST be integrity protected');if(!d||void 0===d.crit)return new Set;if(!Array.isArray(d.crit)||0===d.crit.length||d.crit.some(a=>"string"!=typeof a||0===a.length))throw new a('"crit" (Critical) Header Parameter MUST be an array of non-empty strings when present');for(let g of(f=void 0!==c?new Map([...Object.entries(c),...b.entries()]):b,d.crit)){if(!f.has(g))throw new aT(`Extension Header Parameter "${g}" is not recognized`);if(void 0===e[g])throw new a(`Extension Header Parameter "${g}" is missing`);if(f.get(g)&&void 0===d[g])throw new a(`Extension Header Parameter "${g}" MUST be integrity protected`)}return new Set(d.crit)}let bW=a=>a?.[Symbol.toStringTag],bX=(a,b,c)=>{if(void 0!==b.use){let a;switch(c){case"sign":case"verify":a="sig";break;case"encrypt":case"decrypt":a="enc"}if(b.use!==a)throw TypeError(`Invalid key for this operation, its "use" must be "${a}" when present`)}if(void 0!==b.alg&&b.alg!==a)throw TypeError(`Invalid key for this operation, its "alg" must be "${a}" when present`);if(Array.isArray(b.key_ops)){let d;switch(!0){case"sign"===c||"verify"===c:case"dir"===a:case a.includes("CBC-HS"):d=c;break;case a.startsWith("PBES2"):d="deriveBits";break;case/^A\d{3}(?:GCM)?(?:KW)?$/.test(a):d=!a.includes("GCM")&&a.endsWith("KW")?"encrypt"===c?"wrapKey":"unwrapKey":c;break;case"encrypt"===c&&a.startsWith("RSA"):d="wrapKey";break;case"decrypt"===c:d=a.startsWith("RSA")?"unwrapKey":"deriveBits"}if(d&&b.key_ops?.includes?.(d)===!1)throw TypeError(`Invalid key for this operation, its "key_ops" must include "${d}" when present`)}return!0};function bY(a,b,c){switch(a.substring(0,2)){case"A1":case"A2":case"di":case"HS":case"PB":((a,b,c)=>{if(!(b instanceof Uint8Array)){if(bG(b)){if("oct"===b.kty&&"string"==typeof b.k&&bX(a,b,c))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(!a5(b))throw TypeError(aO(a,b,"CryptoKey","KeyObject","JSON Web Key","Uint8Array"));if("secret"!==b.type)throw TypeError(`${bW(b)} instances for symmetric algorithms must be of type "secret"`)}})(a,b,c);break;default:((a,b,c)=>{if(bG(b))switch(c){case"decrypt":case"sign":if("oct"!==b.kty&&("AKP"===b.kty&&"string"==typeof b.priv||"string"==typeof b.d)&&bX(a,b,c))return;throw TypeError("JSON Web Key for this operation must be a private JWK");case"encrypt":case"verify":if("oct"!==b.kty&&void 0===b.d&&void 0===b.priv&&bX(a,b,c))return;throw TypeError("JSON Web Key for this operation must be a public JWK")}if(!a5(b))throw TypeError(aO(a,b,"CryptoKey","KeyObject","JSON Web Key"));if("secret"===b.type)throw TypeError(`${bW(b)} instances for asymmetric algorithms must not be of type "secret"`);if("public"===b.type)switch(c){case"sign":throw TypeError(`${bW(b)} instances for asymmetric algorithm signing must be of type "private"`);case"decrypt":throw TypeError(`${bW(b)} instances for asymmetric algorithm decryption must be of type "private"`)}if("private"===b.type)switch(c){case"verify":throw TypeError(`${bW(b)} instances for asymmetric algorithm verifying must be of type "public"`);case"encrypt":throw TypeError(`${bW(b)} instances for asymmetric algorithm encryption must be of type "public"`)}})(a,b,c)}}function bZ(a){if(void 0===globalThis[a])throw new aT(`JWE "zip" (Compression Algorithm) Header Parameter requires the ${a} API.`)}async function b$(a){bZ("CompressionStream");let b=new CompressionStream("deflate-raw"),c=b.writable.getWriter();c.write(a).catch(()=>{}),c.close().catch(()=>{});let d=[],e=b.readable.getReader();for(;;){let{value:a,done:b}=await e.read();if(b)break;d.push(a)}return ax(...d)}async function b_(a,b){bZ("DecompressionStream");let c=new DecompressionStream("deflate-raw"),d=c.writable.getWriter();d.write(a).catch(()=>{}),d.close().catch(()=>{});let e=[],f=0,g=c.readable.getReader();for(;;){let{value:a,done:c}=await g.read();if(c)break;if(e.push(a),f+=a.byteLength,b!==1/0&&f>b)throw new aV("Decompressed plaintext exceeded the configured limit")}return ax(...e)}class b0{#a;#b;#c;#d;#e;#f;#g;#h;constructor(a){if(!(a instanceof Uint8Array))throw TypeError("plaintext must be an instance of Uint8Array");this.#a=a}setKeyManagementParameters(a){return aF(this.#h,"setKeyManagementParameters"),this.#h=a,this}setProtectedHeader(a){return aF(this.#b,"setProtectedHeader"),this.#b=a,this}setSharedUnprotectedHeader(a){return aF(this.#c,"setSharedUnprotectedHeader"),this.#c=a,this}setUnprotectedHeader(a){return aF(this.#d,"setUnprotectedHeader"),this.#d=a,this}setAdditionalAuthenticatedData(a){return this.#e=a,this}setContentEncryptionKey(a){return aF(this.#f,"setContentEncryptionKey"),this.#f=a,this}setInitializationVector(a){return aF(this.#g,"setInitializationVector"),this.#g=a,this}async encrypt(a,b){let c,d,e,f,g,h;if(!this.#b&&!this.#d&&!this.#c)throw new aV("either setProtectedHeader, setUnprotectedHeader, or sharedUnprotectedHeader must be called before #encrypt()");if(!bF(this.#b,this.#d,this.#c))throw new aV("JWE Protected, JWE Shared Unprotected and JWE Per-Recipient Header Parameter names must be disjoint");let i={...this.#b,...this.#d,...this.#c};if(bV(aV,new Map,b?.crit,this.#b,i),void 0!==i.zip&&"DEF"!==i.zip)throw new aT('Unsupported JWE "zip" (Compression Algorithm) Header Parameter value.');if(void 0!==i.zip&&!this.#b?.zip)throw new aV('JWE "zip" (Compression Algorithm) Header Parameter MUST be in a protected header.');let{alg:j,enc:k}=i;if("string"!=typeof j||!j)throw new aV('JWE "alg" (Algorithm) Header Parameter missing or invalid');if("string"!=typeof k||!k)throw new aV('JWE "enc" (Encryption Algorithm) Header Parameter missing or invalid');if(this.#f&&("dir"===j||"ECDH-ES"===j))throw TypeError(`setContentEncryptionKey cannot be called with JWE "alg" (Algorithm) Header ${j}`);bY("dir"===j?k:j,a,"encrypt");{let e,f=await bL(a,j);({cek:d,encryptedKey:c,parameters:e}=await bU(j,k,f,this.#f,this.#h)),e&&(b&&aE in b?this.#d?this.#d={...this.#d,...e}:this.setUnprotectedHeader(e):this.#b?this.#b={...this.#b,...e}:this.setProtectedHeader(e))}if(this.#b?g=aB(f=aD(JSON.stringify(this.#b))):(f="",g=new Uint8Array),this.#e){let a=aB(h=aD(this.#e));e=ax(g,aB("."),a)}else e=g;let l=this.#a;"DEF"===i.zip&&(l=await b$(l).catch(a=>{throw new aV("Failed to compress plaintext",{cause:a})}));let{ciphertext:m,tag:n,iv:o}=await bj(k,l,d,this.#g,e),p={ciphertext:aD(m)};return o&&(p.iv=aD(o)),n&&(p.tag=aD(n)),c&&(p.encrypted_key=aD(c)),h&&(p.aad=h),this.#b&&(p.protected=f),this.#c&&(p.unprotected=this.#c),this.#d&&(p.header=this.#d),p}}class b1{#i;constructor(a){this.#i=new b0(a)}setContentEncryptionKey(a){return this.#i.setContentEncryptionKey(a),this}setInitializationVector(a){return this.#i.setInitializationVector(a),this}setProtectedHeader(a){return this.#i.setProtectedHeader(a),this}setKeyManagementParameters(a){return this.#i.setKeyManagementParameters(a),this}async encrypt(a,b){let c=await this.#i.encrypt(a,b);return[c.protected,c.encrypted_key,c.iv,c.ciphertext,c.tag].join(".")}}let b2=a=>Math.floor(a.getTime()/1e3),b3=/^(\+|\-)? ?(\d+|\d+\.\d+) ?(seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)(?: (ago|from now))?$/i;function b4(a){let b,c=b3.exec(a);if(!c||c[4]&&c[1])throw TypeError("Invalid time period format");let d=parseFloat(c[2]);switch(c[3].toLowerCase()){case"sec":case"secs":case"second":case"seconds":case"s":b=Math.round(d);break;case"minute":case"minutes":case"min":case"mins":case"m":b=Math.round(60*d);break;case"hour":case"hours":case"hr":case"hrs":case"h":b=Math.round(3600*d);break;case"day":case"days":case"d":b=Math.round(86400*d);break;case"week":case"weeks":case"w":b=Math.round(604800*d);break;default:b=Math.round(0x1e187e0*d)}return"-"===c[1]||"ago"===c[4]?-b:b}function b5(a,b){if(!Number.isFinite(b))throw TypeError(`Invalid ${a} input`);return b}let b6=a=>a.includes("/")?a.toLowerCase():`application/${a.toLowerCase()}`;function b7(a,b,c={}){var d,e;let f,g;try{f=JSON.parse(aw.decode(b))}catch{}if(!bE(f))throw new aX("JWT Claims Set must be a top-level JSON object");let{typ:h}=c;if(h&&("string"!=typeof a.typ||b6(a.typ)!==b6(h)))throw new aQ('unexpected "typ" JWT header value',f,"typ","check_failed");let{requiredClaims:i=[],issuer:j,subject:k,audience:l,maxTokenAge:m}=c,n=[...i];for(let a of(void 0!==m&&n.push("iat"),void 0!==l&&n.push("aud"),void 0!==k&&n.push("sub"),void 0!==j&&n.push("iss"),new Set(n.reverse())))if(!(a in f))throw new aQ(`missing required "${a}" claim`,f,a,"missing");if(j&&!(Array.isArray(j)?j:[j]).includes(f.iss))throw new aQ('unexpected "iss" claim value',f,"iss","check_failed");if(k&&f.sub!==k)throw new aQ('unexpected "sub" claim value',f,"sub","check_failed");if(l&&(d=f.aud,e="string"==typeof l?[l]:l,"string"==typeof d?!e.includes(d):!(Array.isArray(d)&&e.some(Set.prototype.has.bind(new Set(d))))))throw new aQ('unexpected "aud" claim value',f,"aud","check_failed");switch(typeof c.clockTolerance){case"string":g=b4(c.clockTolerance);break;case"number":g=c.clockTolerance;break;case"undefined":g=0;break;default:throw TypeError("Invalid clockTolerance option type")}let{currentDate:o}=c,p=b2(o||new Date);if((void 0!==f.iat||m)&&"number"!=typeof f.iat)throw new aQ('"iat" claim must be a number',f,"iat","invalid");if(void 0!==f.nbf){if("number"!=typeof f.nbf)throw new aQ('"nbf" claim must be a number',f,"nbf","invalid");if(f.nbf>p+g)throw new aQ('"nbf" claim timestamp check failed',f,"nbf","check_failed")}if(void 0!==f.exp){if("number"!=typeof f.exp)throw new aQ('"exp" claim must be a number',f,"exp","invalid");if(f.exp<=p-g)throw new aR('"exp" claim timestamp check failed',f,"exp","check_failed")}if(m){let a=p-f.iat;if(a-g>("number"==typeof m?m:b4(m)))throw new aR('"iat" claim timestamp check failed (too far in the past)',f,"iat","check_failed");if(a<0-g)throw new aQ('"iat" claim timestamp check failed (it should be in the past)',f,"iat","check_failed")}return f}class b8{#j;constructor(a){if(!bE(a))throw TypeError("JWT Claims Set MUST be an object");this.#j=structuredClone(a)}data(){return av.encode(JSON.stringify(this.#j))}get iss(){return this.#j.iss}set iss(a){this.#j.iss=a}get sub(){return this.#j.sub}set sub(a){this.#j.sub=a}get aud(){return this.#j.aud}set aud(a){this.#j.aud=a}set jti(a){this.#j.jti=a}set nbf(a){"number"==typeof a?this.#j.nbf=b5("setNotBefore",a):a instanceof Date?this.#j.nbf=b5("setNotBefore",b2(a)):this.#j.nbf=b2(new Date)+b4(a)}set exp(a){"number"==typeof a?this.#j.exp=b5("setExpirationTime",a):a instanceof Date?this.#j.exp=b5("setExpirationTime",b2(a)):this.#j.exp=b2(new Date)+b4(a)}set iat(a){void 0===a?this.#j.iat=b2(new Date):a instanceof Date?this.#j.iat=b5("setIssuedAt",b2(a)):"string"==typeof a?this.#j.iat=b5("setIssuedAt",b2(new Date)+b4(a)):this.#j.iat=b5("setIssuedAt",a)}}class b9{#f;#g;#h;#b;#k;#l;#m;#n;constructor(a={}){this.#n=new b8(a)}setIssuer(a){return this.#n.iss=a,this}setSubject(a){return this.#n.sub=a,this}setAudience(a){return this.#n.aud=a,this}setJti(a){return this.#n.jti=a,this}setNotBefore(a){return this.#n.nbf=a,this}setExpirationTime(a){return this.#n.exp=a,this}setIssuedAt(a){return this.#n.iat=a,this}setProtectedHeader(a){return aF(this.#b,"setProtectedHeader"),this.#b=a,this}setKeyManagementParameters(a){return aF(this.#h,"setKeyManagementParameters"),this.#h=a,this}setContentEncryptionKey(a){return aF(this.#f,"setContentEncryptionKey"),this.#f=a,this}setInitializationVector(a){return aF(this.#g,"setInitializationVector"),this.#g=a,this}replicateIssuerAsHeader(){return this.#k=!0,this}replicateSubjectAsHeader(){return this.#l=!0,this}replicateAudienceAsHeader(){return this.#m=!0,this}async encrypt(a,b){let c=new b1(this.#n.data());return this.#b&&(this.#k||this.#l||this.#m)&&(this.#b={...this.#b,iss:this.#k?this.#n.iss:void 0,sub:this.#l?this.#n.sub:void 0,aud:this.#m?this.#n.aud:void 0}),c.setProtectedHeader(this.#b),this.#g&&c.setInitializationVector(this.#g),this.#f&&c.setContentEncryptionKey(this.#f),this.#h&&c.setKeyManagementParameters(this.#h),c.encrypt(a,b)}}class ca{#j;#b;#d;constructor(a){if(!(a instanceof Uint8Array))throw TypeError("payload must be an instance of Uint8Array");this.#j=a}setProtectedHeader(a){return aF(this.#b,"setProtectedHeader"),this.#b=a,this}setUnprotectedHeader(a){return aF(this.#d,"setUnprotectedHeader"),this.#d=a,this}async sign(a,b){let c,d,e,f;if(!this.#b&&!this.#d)throw new aW("either setProtectedHeader or setUnprotectedHeader must be called before #sign()");if(!bF(this.#b,this.#d))throw new aW("JWS Protected and JWS Unprotected Header Parameter names must be disjoint");let g={...this.#b,...this.#d},h=bV(aW,new Map([["b64",!0]]),b?.crit,this.#b,g),i=!0;if(h.has("b64")&&"boolean"!=typeof(i=this.#b.b64))throw new aW('The "b64" (base64url-encode payload) Header Parameter must be a boolean');let{alg:j}=g;if("string"!=typeof j||!j)throw new aW('JWS "alg" (Algorithm) Header Parameter missing or invalid');bY(j,a,"sign"),i?d=aB(c=aD(this.#j)):(d=this.#j,c=""),this.#b?f=aB(e=aD(JSON.stringify(this.#b))):(e="",f=new Uint8Array);let k=ax(f,aB("."),d),l=await bL(a,j),m={signature:aD(await bz(j,l,k)),payload:c};return this.#d&&(m.header=this.#d),this.#b&&(m.protected=e),m}}class cb{#i;constructor(a){this.#i=new ca(a)}setProtectedHeader(a){return this.#i.setProtectedHeader(a),this}async sign(a,b){let c=await this.#i.sign(a,b);if(void 0===c.payload)throw TypeError("use the flattened module for creating JWS with b64: false");return`${c.protected}.${c.payload}.${c.signature}`}}class cc{#b;#n;constructor(a={}){this.#n=new b8(a)}setIssuer(a){return this.#n.iss=a,this}setSubject(a){return this.#n.sub=a,this}setAudience(a){return this.#n.aud=a,this}setJti(a){return this.#n.jti=a,this}setNotBefore(a){return this.#n.nbf=a,this}setExpirationTime(a){return this.#n.exp=a,this}setIssuedAt(a){return this.#n.iat=a,this}setProtectedHeader(a){return this.#b=a,this}async sign(a,b){let c=new cb(this.#n.data());if(c.setProtectedHeader(this.#b),Array.isArray(this.#b?.crit)&&this.#b.crit.includes("b64")&&!1===this.#b.b64)throw new aX("JWTs MUST NOT use unencoded payload");return c.sign(a,b)}}var cd=a.i(736256),cd=cd;let ce=(a,b)=>{if("string"!=typeof a||!a)throw new aY(`${b} missing or invalid`)};async function cf(a,b){let c,d;if(bG(a))c=a;else if(a5(a))c=await bO(a);else throw TypeError(aN(a,"CryptoKey","KeyObject","JSON Web Key"));if("sha256"!==(b??="sha256")&&"sha384"!==b&&"sha512"!==b)throw TypeError('digestAlgorithm must one of "sha256", "sha384", or "sha512"');switch(c.kty){case"AKP":ce(c.alg,'"alg" (Algorithm) Parameter'),ce(c.pub,'"pub" (Public key) Parameter'),d={alg:c.alg,kty:c.kty,pub:c.pub};break;case"EC":ce(c.crv,'"crv" (Curve) Parameter'),ce(c.x,'"x" (X Coordinate) Parameter'),ce(c.y,'"y" (Y Coordinate) Parameter'),d={crv:c.crv,kty:c.kty,x:c.x,y:c.y};break;case"OKP":ce(c.crv,'"crv" (Subtype of Key Pair) Parameter'),ce(c.x,'"x" (Public Key) Parameter'),d={crv:c.crv,kty:c.kty,x:c.x};break;case"RSA":ce(c.e,'"e" (Exponent) Parameter'),ce(c.n,'"n" (Modulus) Parameter'),d={e:c.e,kty:c.kty,n:c.n};break;case"oct":ce(c.k,'"k" (Key Value) Parameter'),d={k:c.k,kty:c.kty};break;default:throw new aT('"kty" (Key Type) Parameter missing or unsupported')}let e=aB(JSON.stringify(d));return aD(await aH(b,e))}function cg(a){let b;if("string"==typeof a){let c=a.split(".");(3===c.length||5===c.length)&&([b]=c)}else if("object"==typeof a&&a)if("protected"in a)b=a.protected;else throw TypeError("Token does not contain a Protected Header");try{if("string"!=typeof b||!b)throw Error();let a=JSON.parse(aw.decode(aC(b)));if(!bE(a))throw Error();return a}catch{throw TypeError("Invalid Token or Protected Header formatting")}}function ch(a,b){if(void 0!==b&&(!Array.isArray(b)||b.some(a=>"string"!=typeof a)))throw TypeError(`"${a}" option must be an array of strings`);if(b)return new Set(b)}async function ci(a,b,c){let d,e,f,g,h,i;if(!bE(a))throw new aV("Flattened JWE must be an object");if(void 0===a.protected&&void 0===a.header&&void 0===a.unprotected)throw new aV("JOSE Header missing");if(void 0!==a.iv&&"string"!=typeof a.iv)throw new aV("JWE Initialization Vector incorrect type");if("string"!=typeof a.ciphertext)throw new aV("JWE Ciphertext missing or incorrect type");if(void 0!==a.tag&&"string"!=typeof a.tag)throw new aV("JWE Authentication Tag incorrect type");if(void 0!==a.protected&&"string"!=typeof a.protected)throw new aV("JWE Protected Header incorrect type");if(void 0!==a.encrypted_key&&"string"!=typeof a.encrypted_key)throw new aV("JWE Encrypted Key incorrect type");if(void 0!==a.aad&&"string"!=typeof a.aad)throw new aV("JWE AAD incorrect type");if(void 0!==a.header&&!bE(a.header))throw new aV("JWE Shared Unprotected Header incorrect type");if(void 0!==a.unprotected&&!bE(a.unprotected))throw new aV("JWE Per-Recipient Unprotected Header incorrect type");if(a.protected)try{let b=aC(a.protected);d=JSON.parse(aw.decode(b))}catch{throw new aV("JWE Protected Header is invalid")}if(!bF(d,a.header,a.unprotected))throw new aV("JWE Protected, JWE Unprotected Header, and JWE Per-Recipient Unprotected Header Parameter names must be disjoint");let j={...d,...a.header,...a.unprotected};if(bV(aV,new Map,c?.crit,d,j),void 0!==j.zip&&"DEF"!==j.zip)throw new aT('Unsupported JWE "zip" (Compression Algorithm) Header Parameter value.');if(void 0!==j.zip&&!d?.zip)throw new aV('JWE "zip" (Compression Algorithm) Header Parameter MUST be in a protected header.');let{alg:k,enc:l}=j;if("string"!=typeof k||!k)throw new aV("missing JWE Algorithm (alg) in JWE Header");if("string"!=typeof l||!l)throw new aV("missing JWE Encryption Algorithm (enc) in JWE Header");let m=c&&ch("keyManagementAlgorithms",c.keyManagementAlgorithms),n=c&&ch("contentEncryptionAlgorithms",c.contentEncryptionAlgorithms);if(m&&!m.has(k)||!m&&k.startsWith("PBES2"))throw new aS('"alg" (Algorithm) Header Parameter value not allowed');if(n&&!n.has(l))throw new aS('"enc" (Encryption Algorithm) Header Parameter value not allowed');void 0!==a.encrypted_key&&(e=aG(a.encrypted_key,"encrypted_key",aV));let o=!1;"function"==typeof b&&(b=await b(d,a),o=!0),bY("dir"===k?l:k,b,"decrypt");let p=await bL(b,k);try{f=await bT(k,p,e,j,c)}catch(a){if(a instanceof TypeError||a instanceof aV||a instanceof aT)throw a;f=a7(l)}void 0!==a.iv&&(g=aG(a.iv,"iv",aV)),void 0!==a.tag&&(h=aG(a.tag,"tag",aV));let q=void 0!==a.protected?aB(a.protected):new Uint8Array;i=void 0!==a.aad?ax(q,aB("."),aB(a.aad)):q;let r=aG(a.ciphertext,"ciphertext",aV),s=await bk(l,f,r,g,h,i),t={plaintext:s};if("DEF"===j.zip){let a=c?.maxDecompressedLength??25e4;if(0===a)throw new aT('JWE "zip" (Compression Algorithm) Header Parameter is not supported.');if(a!==1/0&&(!Number.isSafeInteger(a)||a<1))throw TypeError("maxDecompressedLength must be 0, a positive safe integer, or Infinity");t.plaintext=await b_(s,a).catch(a=>{if(a instanceof aV)throw a;throw new aV("Failed to decompress plaintext",{cause:a})})}return(void 0!==a.protected&&(t.protectedHeader=d),void 0!==a.aad&&(t.additionalAuthenticatedData=aG(a.aad,"aad",aV)),void 0!==a.unprotected&&(t.sharedUnprotectedHeader=a.unprotected),void 0!==a.header&&(t.unprotectedHeader=a.header),o)?{...t,key:p}:t}async function cj(a,b,c){if(a instanceof Uint8Array&&(a=aw.decode(a)),"string"!=typeof a)throw new aV("Compact JWE must be a string or Uint8Array");let{0:d,1:e,2:f,3:g,4:h,length:i}=a.split(".");if(5!==i)throw new aV("Invalid Compact JWE");let j=await ci({ciphertext:g,iv:f||void 0,protected:d,tag:h||void 0,encrypted_key:e||void 0},b,c),k={plaintext:j.plaintext,protectedHeader:j.protectedHeader};return"function"==typeof b?{...k,key:j.key}:k}async function ck(a,b,c){let d=await cj(a,b,c),e=b7(d.protectedHeader,d.plaintext,c),{protectedHeader:f}=d;if(void 0!==f.iss&&f.iss!==e.iss)throw new aQ('replicated "iss" claim header parameter mismatch',e,"iss","mismatch");if(void 0!==f.sub&&f.sub!==e.sub)throw new aQ('replicated "sub" claim header parameter mismatch',e,"sub","mismatch");if(void 0!==f.aud&&JSON.stringify(f.aud)!==JSON.stringify(e.aud))throw new aQ('replicated "aud" claim header parameter mismatch',e,"aud","mismatch");let g={payload:e,protectedHeader:f};return"function"==typeof b?{...g,key:d.key}:g}async function cl(a,b,c){if(!bE(a))throw new aW("Flattened JWS must be an object");if(void 0===a.protected&&void 0===a.header)throw new aW('Flattened JWS must have either of the "protected" or "header" members');if(void 0!==a.protected&&"string"!=typeof a.protected)throw new aW("JWS Protected Header incorrect type");if(void 0===a.payload)throw new aW("JWS Payload missing");if("string"!=typeof a.signature)throw new aW("JWS Signature missing or incorrect type");if(void 0!==a.header&&!bE(a.header))throw new aW("JWS Unprotected Header incorrect type");let d={};if(a.protected)try{let b=aC(a.protected);d=JSON.parse(aw.decode(b))}catch{throw new aW("JWS Protected Header is invalid")}if(!bF(d,a.header))throw new aW("JWS Protected and JWS Unprotected Header Parameter names must be disjoint");let e={...d,...a.header},f=bV(aW,new Map([["b64",!0]]),c?.crit,d,e),g=!0;if(f.has("b64")&&"boolean"!=typeof(g=d.b64))throw new aW('The "b64" (base64url-encode payload) Header Parameter must be a boolean');let{alg:h}=e;if("string"!=typeof h||!h)throw new aW('JWS "alg" (Algorithm) Header Parameter missing or invalid');let i=c&&ch("algorithms",c.algorithms);if(i&&!i.has(h))throw new aS('"alg" (Algorithm) Header Parameter value not allowed');if(g){if("string"!=typeof a.payload)throw new aW("JWS Payload must be a string")}else if("string"!=typeof a.payload&&!(a.payload instanceof Uint8Array))throw new aW("JWS Payload must be a string or an Uint8Array instance");let j=!1;"function"==typeof b&&(b=await b(d,a),j=!0),bY(h,b,"verify");let k=ax(void 0!==a.protected?aB(a.protected):new Uint8Array,aB("."),"string"==typeof a.payload?g?aB(a.payload):av.encode(a.payload):a.payload),l=aG(a.signature,"signature",aW),m=await bL(b,h);if(!await bA(h,m,l,k))throw new a1;let n={payload:g?aG(a.payload,"payload",aW):"string"==typeof a.payload?av.encode(a.payload):a.payload};return(void 0!==a.protected&&(n.protectedHeader=d),void 0!==a.header&&(n.unprotectedHeader=a.header),j)?{...n,key:m}:n}async function cm(a,b,c){if(a instanceof Uint8Array&&(a=aw.decode(a)),"string"!=typeof a)throw new aW("Compact JWS must be a string or Uint8Array");let{0:d,1:e,2:f,length:g}=a.split(".");if(3!==g)throw new aW("Invalid Compact JWS");let h=await cl({payload:e,protected:d,signature:f},b,c),i={payload:h.payload,protectedHeader:h.protectedHeader};return"function"==typeof b?{...i,key:h.key}:i}async function cn(a,b,c){let d=await cm(a,b,c);if(d.protectedHeader.crit?.includes("b64")&&!1===d.protectedHeader.b64)throw new aX("JWTs MUST NOT use unencoded payload");let e={payload:b7(d.protectedHeader,d.payload,c),protectedHeader:d.protectedHeader};return"function"==typeof b?{...e,key:d.key}:e}async function co(a,b,c=3600){return await new cc(a).setProtectedHeader({alg:"HS256"}).setIssuedAt().setExpirationTime(Math.floor(Date.now()/1e3)+c).sign(new TextEncoder().encode(b))}async function cp(a,b){try{return(await cn(a,new TextEncoder().encode(b))).payload}catch{return null}}let cq=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]),cr="A256CBC-HS512";function cs(a,b){var c,d,e;return c=new TextEncoder().encode(a),d=new TextEncoder().encode(b),function(a,b,c,d=32){W(a),U(d,"length"),V(b,void 0,"prk");let e=a.outputLen;if(b.length<e)throw Error('"prk" must be at least HashLen octets');if(d>255*e)throw Error("Length must be <= 255*HashLen");let f=Math.ceil(d/e);void 0===c?c=ad:V(c,void 0,"info");let g=new Uint8Array(f*e),h=ab.create(a,b),i=h._cloneInto(),j=new Uint8Array(h.outputLen);for(let a=0;a<f;a++)ac[0]=a+1,i.update(0===a?ad:j).update(c).update(ac).digestInto(j),g.set(j,e*a),h._cloneInto(i);return h.destroy(),i.destroy(),Z(j,ac),g.slice(0,d)}(au,(e=d,W(au),void 0===e&&(e=new Uint8Array(au.outputLen)),ab(au,e,c)),cq,64)}function ct(a){if("string"==typeof a)return[{version:0,value:a}];let b=[];for(let[c,d]of a.keys)b.push({version:c,value:d});return a.legacySecret&&!b.some(b=>b.value===a.legacySecret)&&b.push({version:-1,value:a.legacySecret}),b}async function cu(a,b,c,d=3600){let e=cs(function(a){if("string"==typeof a)return a;let b=a.keys.get(a.currentVersion);if(!b)throw Error(`Secret version ${a.currentVersion} not found in keys`);return b}(b),c),f=await cf({kty:"oct",k:cd.encode(e)},"sha256");return await new b9(a).setProtectedHeader({alg:"dir",enc:cr,kid:f}).setIssuedAt().setExpirationTime((Date.now()/1e3|0)+d).setJti(crypto.randomUUID()).encrypt(e)}let cv={clockTolerance:15,keyManagementAlgorithms:["dir"],contentEncryptionAlgorithms:[cr,"A256GCM"]};async function cw(a,b,c){if(!a)return null;let d=!1;try{d=void 0!==cg(a).kid}catch{return null}try{let d=ct(b),{payload:e}=await ck(a,async a=>{let b=a.kid;if(void 0!==b){for(let a of d){let d=cs(a.value,c);if(b===await cf({kty:"oct",k:cd.encode(d)},"sha256"))return d}throw Error("no matching decryption secret")}return d.length,cs(d[0].value,c)},cv);return e}catch{if(d)return null;let e=ct(b);if(e.length<=1)return null;for(let b=1;b<e.length;b++)try{let d=e[b],{payload:f}=await ck(a,cs(d.value,c),cv);return f}catch{continue}return null}}var cx=a.i(238696);function cy(a,b){if(!a||!b)return a;let c=Object.entries(b).filter(([,{returned:a}])=>!1===a).map(([a])=>a);return Object.entries(structuredClone(a)).filter(([a])=>!c.includes(a)).reduce((a,[b,c])=>({...a,[b]:c}),{})}let cz=new WeakMap;function cA(a,b,c){let d=`${b}:${c}`;cz.has(a)||cz.set(a,new Map);let e=cz.get(a);if(e.has(d))return e.get(d);let f="output"===c?(0,v.getAuthTables)(a)[b]?.fields??{}:{},g="user"===b||"session"===b||"account"===b?a[b]?.additionalFields:void 0,h={...f,...g??{}};for(let c of a.plugins||[])c.schema&&c.schema[b]&&(h={...h,...c.schema[b].fields});return e.set(d,h),h}function cB(a,b){return cy(b,cA(a,"user","output"))}function cC(a,b){let c=cA(a,"user","output"),d={};for(let a in c){let e=c[a];!1!==e.returned&&(a in b&&void 0!==b[a]?d[a]=b[a]:void 0!==e.defaultValue?d[a]="function"==typeof e.defaultValue?e.defaultValue():e.defaultValue:e.required||(d[a]=null))}return"id"in b&&(d.id=b.id),d}function cD(a,b){return cy(b,cA(a,"session","output"))}function cE(a,b){let c=b.action||"create",d=b.fields,e=Object.create(null);for(let b in d){if(b in a){if(!1===d[b].input){if(void 0!==d[b].defaultValue&&"update"!==c){e[b]=d[b].defaultValue;continue}if(a[b])throw y.APIError.from("BAD_REQUEST",{...cx.BASE_ERROR_CODES.FIELD_NOT_ALLOWED,message:`${b} is not allowed to be set`});continue}if(d[b].validator?.input&&void 0!==a[b]){let c=d[b].validator.input["~standard"].validate(a[b]);if(c instanceof Promise)throw y.APIError.from("INTERNAL_SERVER_ERROR",cx.BASE_ERROR_CODES.ASYNC_VALIDATION_NOT_SUPPORTED);if("issues"in c&&c.issues)throw y.APIError.from("BAD_REQUEST",{...cx.BASE_ERROR_CODES.VALIDATION_ERROR,message:c.issues[0]?.message||"Validation Error"});e[b]=c.value;continue}if(d[b].transform?.input&&void 0!==a[b]){e[b]=d[b].transform?.input(a[b]);continue}e[b]=a[b];continue}if(void 0!==d[b].defaultValue&&"create"===c){if("function"==typeof d[b].defaultValue){e[b]=d[b].defaultValue();continue}e[b]=d[b].defaultValue;continue}if(d[b].required&&"create"===c)throw y.APIError.from("BAD_REQUEST",{...cx.BASE_ERROR_CODES.MISSING_FIELD,message:`${b} is required`})}return e}function cF(a,b={},c){return cE(b,{fields:cA(a,"user","input"),action:c})}let cG=(a,b="ms")=>new Date(Date.now()+("sec"===b?1e3*a:a)),cH=/^(\+|\-)? ?(\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 cI(a){if(-1===a.indexOf("%"))return a;try{return decodeURIComponent(a)}catch{return a}}function cJ(a){if(!a)return[];let b=[],c=0,d=0;for(;d<a.length;){if(","===a[d]){let e=d+1;for(;e<a.length&&" "===a[e];)e++;for(;e<a.length&&"="!==a[e]&&";"!==a[e]&&","!==a[e];)e++;if(e<a.length&&"="===a[e]){let e=a.slice(c,d).trim();for(e&&b.push(e),c=d+1;c<a.length&&" "===a[c];)c++;d=c;continue}}d++}let e=a.slice(c).trim();return e&&b.push(e),b}let cK=/^[\w!#$%&'*.^`|~+-]+$/,cL=/^[ !#-:<-[\]-~]*$/;function cM(a){return!(a.length<2)&&a.startsWith('"')&&a.endsWith('"')?a.slice(1,-1):a}function cN(a){let b=0,c=a.length;for(;b<c;){let c=a.charCodeAt(b);if(32!==c&&9!==c)break;b++}for(;c>b;){let b=a.charCodeAt(c-1);if(32!==b&&9!==b)break;c--}return 0===b&&c===a.length?a:a.slice(b,c)}function cO(a){let b=new Map;if(a.length<2)return b;for(let c of a.split(";")){let a=c.indexOf("=");if(-1===a)continue;let d=cN(c.slice(0,a)),e=cM(cN(c.slice(a+1)));cK.test(d)&&cL.test(e)&&b.set(d,cI(e))}return b}var cP=a.i(92929);function cQ(a,b,c){function d(c,d){if(c._zod||Object.defineProperty(c,"_zod",{value:{def:d,constr:g,traits:new Set},enumerable:!1}),c._zod.traits.has(a))return;c._zod.traits.add(a),b(c,d);let e=g.prototype,f=Object.keys(e);for(let a=0;a<f.length;a++){let b=f[a];b in c||(c[b]=e[b].bind(c))}}let e=c?.Parent??Object;class f extends e{}function g(a){var b;let e=c?.Parent?new f:this;for(let c of(d(e,a),(b=e._zod).deferred??(b.deferred=[]),e._zod.deferred))c();return e}return Object.defineProperty(f,"name",{value:a}),Object.defineProperty(g,"init",{value:d}),Object.defineProperty(g,Symbol.hasInstance,{value:b=>!!c?.Parent&&b instanceof c.Parent||b?._zod?.traits?.has(a)}),Object.defineProperty(g,"name",{value:a}),g}Symbol("zod_brand");class cR extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class cS extends Error{constructor(a){super(`Encountered unidirectional transform during encode: ${a}`),this.name="ZodEncodeError"}}(r=globalThis).__zod_globalConfig??(r.__zod_globalConfig={});let cT=globalThis.__zod_globalConfig;function cU(a){return a&&Object.assign(cT,a),cT}function cV(a){let b=Object.values(a).filter(a=>"number"==typeof a);return Object.entries(a).filter(([a,c])=>-1===b.indexOf(+a)).map(([a,b])=>b)}function cW(a,b){return"bigint"==typeof b?b.toString():b}function cX(a){return{get value(){{let b=a();return Object.defineProperty(this,"value",{value:b}),b}}}}function cY(a){return null==a}function cZ(a){let b=+!!a.startsWith("^"),c=a.endsWith("$")?a.length-1:a.length;return a.slice(b,c)}function c$(a,b){let c=a/b,d=Math.round(c),e=Number.EPSILON*Math.max(Math.abs(c),1);return Math.abs(c-d)<e?0:c-d}let c_=Symbol("evaluating");function c0(a,b,c){let d;Object.defineProperty(a,b,{get(){if(d!==c_)return void 0===d&&(d=c_,d=c()),d},set(c){Object.defineProperty(a,b,{value:c})},configurable:!0})}function c1(a,b,c){Object.defineProperty(a,b,{value:c,writable:!0,enumerable:!0,configurable:!0})}function c2(...a){let b={};for(let c of a)Object.assign(b,Object.getOwnPropertyDescriptors(c));return Object.defineProperties({},b)}function c3(a){return JSON.stringify(a)}function c4(a){return a.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}let c5="captureStackTrace"in Error?Error.captureStackTrace:(...a)=>{};function c6(a){return"object"==typeof a&&null!==a&&!Array.isArray(a)}let c7=cX(()=>{if(cT.jitless||"u">typeof navigator&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{return Function(""),!0}catch(a){return!1}});function c8(a){if(!1===c6(a))return!1;let b=a.constructor;if(void 0===b||"function"!=typeof b)return!0;let c=b.prototype;return!1!==c6(c)&&!1!==Object.prototype.hasOwnProperty.call(c,"isPrototypeOf")}let c9=new Set(["string","number","symbol"]),da=new Set(["string","number","bigint","boolean","symbol","undefined"]);function db(a){return a.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function dc(a,b,c){let d=new a._zod.constr(b??a._zod.def);return(!b||c?.parent)&&(d._zod.parent=a),d}function dd(a){if(!a)return{};if("string"==typeof a)return{error:()=>a};if(a?.message!==void 0){if(a?.error!==void 0)throw Error("Cannot specify both `message` and `error` params");a.error=a.message}return(delete a.message,"string"==typeof a.error)?{...a,error:()=>a.error}:a}function de(a){return"bigint"==typeof a?a.toString()+"n":"string"==typeof a?`"${a}"`:`${a}`}function df(a){return Object.keys(a).filter(b=>"optional"===a[b]._zod.optin&&"optional"===a[b]._zod.optout)}let dg={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]},dh={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function di(a,b=0){if(!0===a.aborted)return!0;for(let c=b;c<a.issues.length;c++)if(a.issues[c]?.continue!==!0)return!0;return!1}function dj(a,b=0){if(!0===a.aborted)return!0;for(let c=b;c<a.issues.length;c++)if(a.issues[c]?.continue===!1)return!0;return!1}function dk(a,b){return b.map(b=>(b.path??(b.path=[]),b.path.unshift(a),b))}function dl(a){return"string"==typeof a?a:a?.message}function dm(a,b,c){let d=a.message?a.message:dl(a.inst?._zod.def?.error?.(a))??dl(b?.error?.(a))??dl(c.customError?.(a))??dl(c.localeError?.(a))??"Invalid input",{inst:e,continue:f,input:g,...h}=a;return h.path??(h.path=[]),h.message=d,b?.reportInput&&(h.input=g),h}function dn(a){return a instanceof Set?"set":a instanceof Map?"map":a instanceof File?"file":"unknown"}function dp(a){return Array.isArray(a)?"array":"string"==typeof a?"string":"unknown"}function dq(...a){let[b,c,d]=a;return"string"==typeof b?{message:b,code:"custom",input:c,inst:d}:{...b}}function dr(a){let b=atob(a),c=new Uint8Array(b.length);for(let a=0;a<b.length;a++)c[a]=b.charCodeAt(a);return c}function ds(a){let b="";for(let c=0;c<a.length;c++)b+=String.fromCharCode(a[c]);return btoa(b)}a.s(["BIGINT_FORMAT_RANGES",0,dh,"Class",0,class{constructor(...a){}},"NUMBER_FORMAT_RANGES",0,dg,"aborted",0,di,"allowsEval",0,c7,"assert",0,function(a){},"assertEqual",0,function(a){return a},"assertIs",0,function(a){},"assertNever",0,function(a){throw Error("Unexpected value in exhaustive check")},"assertNotEqual",0,function(a){return a},"assignProp",0,c1,"base64ToUint8Array",0,dr,"base64urlToUint8Array",0,function(a){let b=a.replace(/-/g,"+").replace(/_/g,"/"),c="=".repeat((4-b.length%4)%4);return dr(b+c)},"cached",0,cX,"captureStackTrace",0,c5,"cleanEnum",0,function(a){return Object.entries(a).filter(([a,b])=>Number.isNaN(Number.parseInt(a,10))).map(a=>a[1])},"cleanRegex",0,cZ,"clone",0,dc,"cloneDef",0,function(a){return c2(a._zod.def)},"createTransparentProxy",0,function(a){let b;return new Proxy({},{get:(c,d,e)=>(b??(b=a()),Reflect.get(b,d,e)),set:(c,d,e,f)=>(b??(b=a()),Reflect.set(b,d,e,f)),has:(c,d)=>(b??(b=a()),Reflect.has(b,d)),deleteProperty:(c,d)=>(b??(b=a()),Reflect.deleteProperty(b,d)),ownKeys:c=>(b??(b=a()),Reflect.ownKeys(b)),getOwnPropertyDescriptor:(c,d)=>(b??(b=a()),Reflect.getOwnPropertyDescriptor(b,d)),defineProperty:(c,d,e)=>(b??(b=a()),Reflect.defineProperty(b,d,e))})},"defineLazy",0,c0,"esc",0,c3,"escapeRegex",0,db,"explicitlyAborted",0,dj,"extend",0,function(a,b){if(!c8(b))throw Error("Invalid input to extend: expected a plain object");let c=a._zod.def.checks;if(c&&c.length>0){let c=a._zod.def.shape;for(let a in b)if(void 0!==Object.getOwnPropertyDescriptor(c,a))throw Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}let d=c2(a._zod.def,{get shape(){let c={...a._zod.def.shape,...b};return c1(this,"shape",c),c}});return dc(a,d)},"finalizeIssue",0,dm,"floatSafeRemainder",0,c$,"getElementAtPath",0,function(a,b){return b?b.reduce((a,b)=>a?.[b],a):a},"getEnumValues",0,cV,"getLengthableOrigin",0,dp,"getParsedType",0,a=>{let b=typeof a;switch(b){case"undefined":return"undefined";case"string":return"string";case"number":return Number.isNaN(a)?"nan":"number";case"boolean":return"boolean";case"function":return"function";case"bigint":return"bigint";case"symbol":return"symbol";case"object":if(Array.isArray(a))return"array";if(null===a)return"null";if(a.then&&"function"==typeof a.then&&a.catch&&"function"==typeof a.catch)return"promise";if("u">typeof Map&&a instanceof Map)return"map";if("u">typeof Set&&a instanceof Set)return"set";if("u">typeof Date&&a instanceof Date)return"date";if("u">typeof File&&a instanceof File)return"file";return"object";default:throw Error(`Unknown data type: ${b}`)}},"getSizableOrigin",0,dn,"hexToUint8Array",0,function(a){let b=a.replace(/^0x/,"");if(b.length%2!=0)throw Error("Invalid hex string length");let c=new Uint8Array(b.length/2);for(let a=0;a<b.length;a+=2)c[a/2]=Number.parseInt(b.slice(a,a+2),16);return c},"isObject",0,c6,"isPlainObject",0,c8,"issue",0,dq,"joinValues",0,function(a,b="|"){return a.map(a=>de(a)).join(b)},"jsonStringifyReplacer",0,cW,"merge",0,function(a,b){if(a._zod.def.checks?.length)throw Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");let c=c2(a._zod.def,{get shape(){let c={...a._zod.def.shape,...b._zod.def.shape};return c1(this,"shape",c),c},get catchall(){return b._zod.def.catchall},checks:b._zod.def.checks??[]});return dc(a,c)},"mergeDefs",0,c2,"normalizeParams",0,dd,"nullish",0,cY,"numKeys",0,function(a){let b=0;for(let c in a)Object.prototype.hasOwnProperty.call(a,c)&&b++;return b},"objectClone",0,function(a){return Object.create(Object.getPrototypeOf(a),Object.getOwnPropertyDescriptors(a))},"omit",0,function(a,b){let c=a._zod.def,d=c.checks;if(d&&d.length>0)throw Error(".omit() cannot be used on object schemas containing refinements");let e=c2(a._zod.def,{get shape(){let d={...a._zod.def.shape};for(let a in b){if(!(a in c.shape))throw Error(`Unrecognized key: "${a}"`);b[a]&&delete d[a]}return c1(this,"shape",d),d},checks:[]});return dc(a,e)},"optionalKeys",0,df,"parsedType",0,function(a){let b=typeof a;switch(b){case"number":return Number.isNaN(a)?"nan":"number";case"object":if(null===a)return"null";if(Array.isArray(a))return"array";if(a&&Object.getPrototypeOf(a)!==Object.prototype&&"constructor"in a&&a.constructor)return a.constructor.name}return b},"partial",0,function(a,b,c){let d=b._zod.def.checks;if(d&&d.length>0)throw Error(".partial() cannot be used on object schemas containing refinements");let e=c2(b._zod.def,{get shape(){let d=b._zod.def.shape,e={...d};if(c)for(let b in c){if(!(b in d))throw Error(`Unrecognized key: "${b}"`);c[b]&&(e[b]=a?new a({type:"optional",innerType:d[b]}):d[b])}else for(let b in d)e[b]=a?new a({type:"optional",innerType:d[b]}):d[b];return c1(this,"shape",e),e},checks:[]});return dc(b,e)},"pick",0,function(a,b){let c=a._zod.def,d=c.checks;if(d&&d.length>0)throw Error(".pick() cannot be used on object schemas containing refinements");let e=c2(a._zod.def,{get shape(){let a={};for(let d in b){if(!(d in c.shape))throw Error(`Unrecognized key: "${d}"`);b[d]&&(a[d]=c.shape[d])}return c1(this,"shape",a),a},checks:[]});return dc(a,e)},"prefixIssues",0,dk,"primitiveTypes",0,da,"promiseAllObject",0,function(a){let b=Object.keys(a);return Promise.all(b.map(b=>a[b])).then(a=>{let c={};for(let d=0;d<b.length;d++)c[b[d]]=a[d];return c})},"propertyKeyTypes",0,c9,"randomString",0,function(a=10){let b="abcdefghijklmnopqrstuvwxyz",c="";for(let d=0;d<a;d++)c+=b[Math.floor(Math.random()*b.length)];return c},"required",0,function(a,b,c){let d=c2(b._zod.def,{get shape(){let d=b._zod.def.shape,e={...d};if(c)for(let b in c){if(!(b in e))throw Error(`Unrecognized key: "${b}"`);c[b]&&(e[b]=new a({type:"nonoptional",innerType:d[b]}))}else for(let b in d)e[b]=new a({type:"nonoptional",innerType:d[b]});return c1(this,"shape",e),e}});return dc(b,d)},"safeExtend",0,function(a,b){if(!c8(b))throw Error("Invalid input to safeExtend: expected a plain object");let c=c2(a._zod.def,{get shape(){let c={...a._zod.def.shape,...b};return c1(this,"shape",c),c}});return dc(a,c)},"shallowClone",0,function(a){return c8(a)?{...a}:Array.isArray(a)?[...a]:a instanceof Map?new Map(a):a instanceof Set?new Set(a):a},"slugify",0,c4,"stringifyPrimitive",0,de,"uint8ArrayToBase64",0,ds,"uint8ArrayToBase64url",0,function(a){return ds(a).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")},"uint8ArrayToHex",0,function(a){return Array.from(a).map(a=>a.toString(16).padStart(2,"0")).join("")},"unwrapMessage",0,dl],549230);let dt=/^[cC][0-9a-z]{6,}$/,du=/^[0-9a-z]+$/,dv=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,dw=/^[0-9a-vA-V]{20}$/,dx=/^[A-Za-z0-9]{27}$/,dy=/^[a-zA-Z0-9_-]{21}$/,dz=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,dA=/^([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})$/,dB=a=>a?RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${a}[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)$/,dC=dB(4),dD=dB(6),dE=dB(7),dF=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,dG=/^[^\s@"]{1,64}@[^\s@]{1,255}$/u;function dH(){return RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")}let dI=/^(?:(?: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])$/,dJ=/^(([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}|:))$/,dK=a=>{let b=db(a??":");return RegExp(`^(?:[0-9A-F]{2}${b}){5}[0-9A-F]{2}$|^(?:[0-9a-f]{2}${b}){5}[0-9a-f]{2}$`)},dL=/^((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])$/,dM=/^(([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])$/,dN=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,dO=/^[A-Za-z0-9_-]*$/,dP=/^https?$/,dQ=/^\+[1-9]\d{6,14}$/,dR="(?:(?:\\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])))",dS=RegExp(`^${dR}$`);function dT(a){let b="(?:[01]\\d|2[0-3]):[0-5]\\d";return"number"==typeof a.precision?-1===a.precision?`${b}`:0===a.precision?`${b}:[0-5]\\d`:`${b}:[0-5]\\d\\.\\d{${a.precision}}`:`${b}(?::[0-5]\\d(?:\\.\\d+)?)?`}function dU(a){return RegExp(`^${dT(a)}$`)}function dV(a){let b=dT({precision:a.precision}),c=["Z"];a.local&&c.push(""),a.offset&&c.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");let d=`${b}(?:${c.join("|")})`;return RegExp(`^${dR}T(?:${d})$`)}let dW=a=>{let b=a?`[\\s\\S]{${a?.minimum??0},${a?.maximum??""}}`:"[\\s\\S]*";return RegExp(`^${b}$`)},dX=/^-?\d+n?$/,dY=/^-?\d+$/,dZ=/^-?\d+(?:\.\d+)?$/,d$=/^(?:true|false)$/i,d_=/^null$/i,d0=/^undefined$/i,d1=/^[^A-Z]*$/,d2=/^[^a-z]*$/;function d3(a,b){return RegExp(`^[A-Za-z0-9+/]{${a}}${b}$`)}function d4(a){return RegExp(`^[A-Za-z0-9_-]{${a}}$`)}let d5=d3(22,"=="),d6=d4(22),d7=d3(27,"="),d8=d4(27),d9=d3(43,"="),ea=d4(43),eb=d3(64,""),ec=d4(64),ed=d3(86,"=="),ee=d4(86);a.s(["base64",0,dN,"base64url",0,dO,"bigint",0,dX,"boolean",0,d$,"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,dL,"cidrv6",0,dM,"cuid",0,dt,"cuid2",0,du,"date",0,dS,"datetime",0,dV,"domain",0,/^([a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,}$/,"duration",0,dz,"e164",0,dQ,"email",0,dF,"emoji",0,dH,"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,dA,"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,dP,"idnEmail",0,dG,"integer",0,dY,"ipv4",0,dI,"ipv6",0,dJ,"ksuid",0,dx,"lowercase",0,d1,"mac",0,dK,"md5_base64",0,d5,"md5_base64url",0,d6,"md5_hex",0,/^[0-9a-fA-F]{32}$/,"nanoid",0,dy,"null",0,d_,"number",0,dZ,"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,d7,"sha1_base64url",0,d8,"sha1_hex",0,/^[0-9a-fA-F]{40}$/,"sha256_base64",0,d9,"sha256_base64url",0,ea,"sha256_hex",0,/^[0-9a-fA-F]{64}$/,"sha384_base64",0,eb,"sha384_base64url",0,ec,"sha384_hex",0,/^[0-9a-fA-F]{96}$/,"sha512_base64",0,ed,"sha512_base64url",0,ee,"sha512_hex",0,/^[0-9a-fA-F]{128}$/,"string",0,dW,"time",0,dU,"ulid",0,dv,"undefined",0,d0,"unicodeEmail",0,dG,"uppercase",0,d2,"uuid",0,dB,"uuid4",0,dC,"uuid6",0,dD,"uuid7",0,dE,"xid",0,dw],854018);let ef=cQ("$ZodCheck",(a,b)=>{var c;a._zod??(a._zod={}),a._zod.def=b,(c=a._zod).onattach??(c.onattach=[])}),eg={number:"number",bigint:"bigint",object:"date"},eh=cQ("$ZodCheckLessThan",(a,b)=>{ef.init(a,b);let c=eg[typeof b.value];a._zod.onattach.push(a=>{let c=a._zod.bag,d=(b.inclusive?c.maximum:c.exclusiveMaximum)??1/0;b.value<d&&(b.inclusive?c.maximum=b.value:c.exclusiveMaximum=b.value)}),a._zod.check=d=>{(b.inclusive?d.value<=b.value:d.value<b.value)||d.issues.push({origin:c,code:"too_big",maximum:"object"==typeof b.value?b.value.getTime():b.value,input:d.value,inclusive:b.inclusive,inst:a,continue:!b.abort})}}),ei=cQ("$ZodCheckGreaterThan",(a,b)=>{ef.init(a,b);let c=eg[typeof b.value];a._zod.onattach.push(a=>{let c=a._zod.bag,d=(b.inclusive?c.minimum:c.exclusiveMinimum)??-1/0;b.value>d&&(b.inclusive?c.minimum=b.value:c.exclusiveMinimum=b.value)}),a._zod.check=d=>{(b.inclusive?d.value>=b.value:d.value>b.value)||d.issues.push({origin:c,code:"too_small",minimum:"object"==typeof b.value?b.value.getTime():b.value,input:d.value,inclusive:b.inclusive,inst:a,continue:!b.abort})}}),ej=cQ("$ZodCheckMultipleOf",(a,b)=>{ef.init(a,b),a._zod.onattach.push(a=>{var c;(c=a._zod.bag).multipleOf??(c.multipleOf=b.value)}),a._zod.check=c=>{if(typeof c.value!=typeof b.value)throw Error("Cannot mix number and bigint in multiple_of check.");("bigint"==typeof c.value?c.value%b.value===BigInt(0):0===c$(c.value,b.value))||c.issues.push({origin:typeof c.value,code:"not_multiple_of",divisor:b.value,input:c.value,inst:a,continue:!b.abort})}}),ek=cQ("$ZodCheckNumberFormat",(a,b)=>{ef.init(a,b),b.format=b.format||"float64";let c=b.format?.includes("int"),d=c?"int":"number",[e,f]=dg[b.format];a._zod.onattach.push(a=>{let d=a._zod.bag;d.format=b.format,d.minimum=e,d.maximum=f,c&&(d.pattern=dY)}),a._zod.check=g=>{let h=g.value;if(c){if(!Number.isInteger(h))return void g.issues.push({expected:d,format:b.format,code:"invalid_type",continue:!1,input:h,inst:a});if(!Number.isSafeInteger(h))return void(h>0?g.issues.push({input:h,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:a,origin:d,inclusive:!0,continue:!b.abort}):g.issues.push({input:h,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:a,origin:d,inclusive:!0,continue:!b.abort}))}h<e&&g.issues.push({origin:"number",input:h,code:"too_small",minimum:e,inclusive:!0,inst:a,continue:!b.abort}),h>f&&g.issues.push({origin:"number",input:h,code:"too_big",maximum:f,inclusive:!0,inst:a,continue:!b.abort})}}),el=cQ("$ZodCheckBigIntFormat",(a,b)=>{ef.init(a,b);let[c,d]=dh[b.format];a._zod.onattach.push(a=>{let e=a._zod.bag;e.format=b.format,e.minimum=c,e.maximum=d}),a._zod.check=e=>{let f=e.value;f<c&&e.issues.push({origin:"bigint",input:f,code:"too_small",minimum:c,inclusive:!0,inst:a,continue:!b.abort}),f>d&&e.issues.push({origin:"bigint",input:f,code:"too_big",maximum:d,inclusive:!0,inst:a,continue:!b.abort})}}),em=cQ("$ZodCheckMaxSize",(a,b)=>{var c;ef.init(a,b),(c=a._zod.def).when??(c.when=a=>{let b=a.value;return!cY(b)&&void 0!==b.size}),a._zod.onattach.push(a=>{let c=a._zod.bag.maximum??1/0;b.maximum<c&&(a._zod.bag.maximum=b.maximum)}),a._zod.check=c=>{let d=c.value;d.size<=b.maximum||c.issues.push({origin:dn(d),code:"too_big",maximum:b.maximum,inclusive:!0,input:d,inst:a,continue:!b.abort})}}),en=cQ("$ZodCheckMinSize",(a,b)=>{var c;ef.init(a,b),(c=a._zod.def).when??(c.when=a=>{let b=a.value;return!cY(b)&&void 0!==b.size}),a._zod.onattach.push(a=>{let c=a._zod.bag.minimum??-1/0;b.minimum>c&&(a._zod.bag.minimum=b.minimum)}),a._zod.check=c=>{let d=c.value;d.size>=b.minimum||c.issues.push({origin:dn(d),code:"too_small",minimum:b.minimum,inclusive:!0,input:d,inst:a,continue:!b.abort})}}),eo=cQ("$ZodCheckSizeEquals",(a,b)=>{var c;ef.init(a,b),(c=a._zod.def).when??(c.when=a=>{let b=a.value;return!cY(b)&&void 0!==b.size}),a._zod.onattach.push(a=>{let c=a._zod.bag;c.minimum=b.size,c.maximum=b.size,c.size=b.size}),a._zod.check=c=>{let d=c.value,e=d.size;if(e===b.size)return;let f=e>b.size;c.issues.push({origin:dn(d),...f?{code:"too_big",maximum:b.size}:{code:"too_small",minimum:b.size},inclusive:!0,exact:!0,input:c.value,inst:a,continue:!b.abort})}}),ep=cQ("$ZodCheckMaxLength",(a,b)=>{var c;ef.init(a,b),(c=a._zod.def).when??(c.when=a=>{let b=a.value;return!cY(b)&&void 0!==b.length}),a._zod.onattach.push(a=>{let c=a._zod.bag.maximum??1/0;b.maximum<c&&(a._zod.bag.maximum=b.maximum)}),a._zod.check=c=>{let d=c.value;if(d.length<=b.maximum)return;let e=dp(d);c.issues.push({origin:e,code:"too_big",maximum:b.maximum,inclusive:!0,input:d,inst:a,continue:!b.abort})}}),eq=cQ("$ZodCheckMinLength",(a,b)=>{var c;ef.init(a,b),(c=a._zod.def).when??(c.when=a=>{let b=a.value;return!cY(b)&&void 0!==b.length}),a._zod.onattach.push(a=>{let c=a._zod.bag.minimum??-1/0;b.minimum>c&&(a._zod.bag.minimum=b.minimum)}),a._zod.check=c=>{let d=c.value;if(d.length>=b.minimum)return;let e=dp(d);c.issues.push({origin:e,code:"too_small",minimum:b.minimum,inclusive:!0,input:d,inst:a,continue:!b.abort})}}),er=cQ("$ZodCheckLengthEquals",(a,b)=>{var c;ef.init(a,b),(c=a._zod.def).when??(c.when=a=>{let b=a.value;return!cY(b)&&void 0!==b.length}),a._zod.onattach.push(a=>{let c=a._zod.bag;c.minimum=b.length,c.maximum=b.length,c.length=b.length}),a._zod.check=c=>{let d=c.value,e=d.length;if(e===b.length)return;let f=dp(d),g=e>b.length;c.issues.push({origin:f,...g?{code:"too_big",maximum:b.length}:{code:"too_small",minimum:b.length},inclusive:!0,exact:!0,input:c.value,inst:a,continue:!b.abort})}}),es=cQ("$ZodCheckStringFormat",(a,b)=>{var c,d;ef.init(a,b),a._zod.onattach.push(a=>{let c=a._zod.bag;c.format=b.format,b.pattern&&(c.patterns??(c.patterns=new Set),c.patterns.add(b.pattern))}),b.pattern?(c=a._zod).check??(c.check=c=>{b.pattern.lastIndex=0,b.pattern.test(c.value)||c.issues.push({origin:"string",code:"invalid_format",format:b.format,input:c.value,...b.pattern?{pattern:b.pattern.toString()}:{},inst:a,continue:!b.abort})}):(d=a._zod).check??(d.check=()=>{})}),et=cQ("$ZodCheckRegex",(a,b)=>{es.init(a,b),a._zod.check=c=>{b.pattern.lastIndex=0,b.pattern.test(c.value)||c.issues.push({origin:"string",code:"invalid_format",format:"regex",input:c.value,pattern:b.pattern.toString(),inst:a,continue:!b.abort})}}),eu=cQ("$ZodCheckLowerCase",(a,b)=>{b.pattern??(b.pattern=d1),es.init(a,b)}),ev=cQ("$ZodCheckUpperCase",(a,b)=>{b.pattern??(b.pattern=d2),es.init(a,b)}),ew=cQ("$ZodCheckIncludes",(a,b)=>{ef.init(a,b);let c=db(b.includes),d=new RegExp("number"==typeof b.position?`^.{${b.position}}${c}`:c);b.pattern=d,a._zod.onattach.push(a=>{let b=a._zod.bag;b.patterns??(b.patterns=new Set),b.patterns.add(d)}),a._zod.check=c=>{c.value.includes(b.includes,b.position)||c.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:b.includes,input:c.value,inst:a,continue:!b.abort})}}),ex=cQ("$ZodCheckStartsWith",(a,b)=>{ef.init(a,b);let c=RegExp(`^${db(b.prefix)}.*`);b.pattern??(b.pattern=c),a._zod.onattach.push(a=>{let b=a._zod.bag;b.patterns??(b.patterns=new Set),b.patterns.add(c)}),a._zod.check=c=>{c.value.startsWith(b.prefix)||c.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:b.prefix,input:c.value,inst:a,continue:!b.abort})}}),ey=cQ("$ZodCheckEndsWith",(a,b)=>{ef.init(a,b);let c=RegExp(`.*${db(b.suffix)}$`);b.pattern??(b.pattern=c),a._zod.onattach.push(a=>{let b=a._zod.bag;b.patterns??(b.patterns=new Set),b.patterns.add(c)}),a._zod.check=c=>{c.value.endsWith(b.suffix)||c.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:b.suffix,input:c.value,inst:a,continue:!b.abort})}});(a,b)=>{ef.init(a,b);let c=new Set(b.mime);a._zod.onattach.push(a=>{a._zod.bag.mime=b.mime}),a._zod.check=d=>{c.has(d.value.type)||d.issues.push({code:"invalid_value",values:b.mime,input:d.value.type,inst:a,continue:!b.abort})}};let ez=cQ("$ZodCheckOverwrite",(a,b)=>{ef.init(a,b),a._zod.check=a=>{a.value=b.tx(a.value)}});class eA{constructor(a=[]){this.content=[],this.indent=0,this&&(this.args=a)}indented(a){this.indent+=1,a(this),this.indent-=1}write(a){if("function"==typeof a){a(this,{execution:"sync"}),a(this,{execution:"async"});return}let b=a.split("\n").filter(a=>a),c=Math.min(...b.map(a=>a.length-a.trimStart().length));for(let a of b.map(a=>a.slice(c)).map(a=>" ".repeat(2*this.indent)+a))this.content.push(a)}compile(){return Function(...this?.args,[...(this?.content??[""]).map(a=>` ${a}`)].join("\n"))}}let eB=(a,b)=>{a.name="$ZodError",Object.defineProperty(a,"_zod",{value:a._zod,enumerable:!1}),Object.defineProperty(a,"issues",{value:b,enumerable:!1}),a.message=JSON.stringify(b,cW,2),Object.defineProperty(a,"toString",{value:()=>a.message,enumerable:!1})},eC=cQ("$ZodError",eB),eD=cQ("$ZodError",eB,{Parent:Error}),eE=a=>(b,c,d,e)=>{let f=d?{...d,async:!1}:{async:!1},g=b._zod.run({value:c,issues:[]},f);if(g instanceof Promise)throw new cR;if(g.issues.length){let b=new(e?.Err??a)(g.issues.map(a=>dm(a,f,cU())));throw c5(b,e?.callee),b}return g.value},eF=eE(eD),eG=a=>async(b,c,d,e)=>{let f=d?{...d,async:!0}:{async:!0},g=b._zod.run({value:c,issues:[]},f);if(g instanceof Promise&&(g=await g),g.issues.length){let b=new(e?.Err??a)(g.issues.map(a=>dm(a,f,cU())));throw c5(b,e?.callee),b}return g.value},eH=eG(eD),eI=a=>(b,c,d)=>{let e=d?{...d,async:!1}:{async:!1},f=b._zod.run({value:c,issues:[]},e);if(f instanceof Promise)throw new cR;return f.issues.length?{success:!1,error:new(a??eC)(f.issues.map(a=>dm(a,e,cU())))}:{success:!0,data:f.value}},eJ=eI(eD),eK=a=>async(b,c,d)=>{let e=d?{...d,async:!0}:{async:!0},f=b._zod.run({value:c,issues:[]},e);return f instanceof Promise&&(f=await f),f.issues.length?{success:!1,error:new a(f.issues.map(a=>dm(a,e,cU())))}:{success:!0,data:f.value}},eL=eK(eD),eM={major:4,minor:4,patch:3},eN=cQ("$ZodType",(a,b)=>{var c;a??(a={}),a._zod.def=b,a._zod.bag=a._zod.bag||{},a._zod.version=eM;let d=[...a._zod.def.checks??[]];for(let b of(a._zod.traits.has("$ZodCheck")&&d.unshift(a),d))for(let c of b._zod.onattach)c(a);if(0===d.length)(c=a._zod).deferred??(c.deferred=[]),a._zod.deferred?.push(()=>{a._zod.run=a._zod.parse});else{let b=(a,b,c)=>{let d,e=di(a);for(let f of b){if(f._zod.def.when){if(dj(a)||!f._zod.def.when(a))continue}else if(e)continue;let b=a.issues.length,g=f._zod.check(a);if(g instanceof Promise&&c?.async===!1)throw new cR;if(d||g instanceof Promise)d=(d??Promise.resolve()).then(async()=>{await g,a.issues.length!==b&&(e||(e=di(a,b)))});else{if(a.issues.length===b)continue;e||(e=di(a,b))}}return d?d.then(()=>a):a},c=(c,e,f)=>{if(di(c))return c.aborted=!0,c;let g=b(e,d,f);if(g instanceof Promise){if(!1===f.async)throw new cR;return g.then(b=>a._zod.parse(b,f))}return a._zod.parse(g,f)};a._zod.run=(e,f)=>{if(f.skipChecks)return a._zod.parse(e,f);if("backward"===f.direction){let b=a._zod.parse({value:e.value,issues:[]},{...f,skipChecks:!0});return b instanceof Promise?b.then(a=>c(a,e,f)):c(b,e,f)}let g=a._zod.parse(e,f);if(g instanceof Promise){if(!1===f.async)throw new cR;return g.then(a=>b(a,d,f))}return b(g,d,f)}}c0(a,"~standard",()=>({validate:b=>{try{let c=eJ(a,b);return c.success?{value:c.data}:{issues:c.error?.issues}}catch(c){return eL(a,b).then(a=>a.success?{value:a.data}:{issues:a.error?.issues})}},vendor:"zod",version:1}))}),eO=cQ("$ZodString",(a,b)=>{eN.init(a,b),a._zod.pattern=[...a?._zod.bag?.patterns??[]].pop()??dW(a._zod.bag),a._zod.parse=(c,d)=>{if(b.coerce)try{c.value=String(c.value)}catch(a){}return"string"==typeof c.value||c.issues.push({expected:"string",code:"invalid_type",input:c.value,inst:a}),c}}),eP=cQ("$ZodStringFormat",(a,b)=>{es.init(a,b),eO.init(a,b)}),eQ=cQ("$ZodGUID",(a,b)=>{b.pattern??(b.pattern=dA),eP.init(a,b)}),eR=cQ("$ZodUUID",(a,b)=>{if(b.version){let a={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[b.version];if(void 0===a)throw Error(`Invalid UUID version: "${b.version}"`);b.pattern??(b.pattern=dB(a))}else b.pattern??(b.pattern=dB());eP.init(a,b)}),eS=cQ("$ZodEmail",(a,b)=>{b.pattern??(b.pattern=dF),eP.init(a,b)}),eT=cQ("$ZodURL",(a,b)=>{eP.init(a,b),a._zod.check=c=>{try{let d=c.value.trim();if(!b.normalize&&b.protocol?.source===dP.source&&!/^https?:\/\//i.test(d))return void c.issues.push({code:"invalid_format",format:"url",note:"Invalid URL format",input:c.value,inst:a,continue:!b.abort});let e=new URL(d);b.hostname&&(b.hostname.lastIndex=0,b.hostname.test(e.hostname)||c.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:b.hostname.source,input:c.value,inst:a,continue:!b.abort})),b.protocol&&(b.protocol.lastIndex=0,b.protocol.test(e.protocol.endsWith(":")?e.protocol.slice(0,-1):e.protocol)||c.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:b.protocol.source,input:c.value,inst:a,continue:!b.abort})),b.normalize?c.value=e.href:c.value=d;return}catch(d){c.issues.push({code:"invalid_format",format:"url",input:c.value,inst:a,continue:!b.abort})}}}),eU=cQ("$ZodEmoji",(a,b)=>{b.pattern??(b.pattern=dH()),eP.init(a,b)}),eV=cQ("$ZodNanoID",(a,b)=>{b.pattern??(b.pattern=dy),eP.init(a,b)}),eW=cQ("$ZodCUID",(a,b)=>{b.pattern??(b.pattern=dt),eP.init(a,b)}),eX=cQ("$ZodCUID2",(a,b)=>{b.pattern??(b.pattern=du),eP.init(a,b)}),eY=cQ("$ZodULID",(a,b)=>{b.pattern??(b.pattern=dv),eP.init(a,b)}),eZ=cQ("$ZodXID",(a,b)=>{b.pattern??(b.pattern=dw),eP.init(a,b)}),e$=cQ("$ZodKSUID",(a,b)=>{b.pattern??(b.pattern=dx),eP.init(a,b)}),e_=cQ("$ZodISODateTime",(a,b)=>{b.pattern??(b.pattern=dV(b)),eP.init(a,b)}),e0=cQ("$ZodISODate",(a,b)=>{b.pattern??(b.pattern=dS),eP.init(a,b)}),e1=cQ("$ZodISOTime",(a,b)=>{b.pattern??(b.pattern=dU(b)),eP.init(a,b)}),e2=cQ("$ZodISODuration",(a,b)=>{b.pattern??(b.pattern=dz),eP.init(a,b)}),e3=cQ("$ZodIPv4",(a,b)=>{b.pattern??(b.pattern=dI),eP.init(a,b),a._zod.bag.format="ipv4"}),e4=cQ("$ZodIPv6",(a,b)=>{b.pattern??(b.pattern=dJ),eP.init(a,b),a._zod.bag.format="ipv6",a._zod.check=c=>{try{new URL(`http://[${c.value}]`)}catch{c.issues.push({code:"invalid_format",format:"ipv6",input:c.value,inst:a,continue:!b.abort})}}}),e5=((a,b)=>{b.pattern??(b.pattern=dK(b.delimiter)),eP.init(a,b),a._zod.bag.format="mac"},cQ("$ZodCIDRv4",(a,b)=>{b.pattern??(b.pattern=dL),eP.init(a,b)})),e6=cQ("$ZodCIDRv6",(a,b)=>{b.pattern??(b.pattern=dM),eP.init(a,b),a._zod.check=c=>{let d=c.value.split("/");try{if(2!==d.length)throw Error();let[a,b]=d;if(!b)throw Error();let c=Number(b);if(`${c}`!==b||c<0||c>128)throw Error();new URL(`http://[${a}]`)}catch{c.issues.push({code:"invalid_format",format:"cidrv6",input:c.value,inst:a,continue:!b.abort})}}});function e7(a){if(""===a)return!0;if(/\s/.test(a)||a.length%4!=0)return!1;try{return atob(a),!0}catch{return!1}}let e8=cQ("$ZodBase64",(a,b)=>{b.pattern??(b.pattern=dN),eP.init(a,b),a._zod.bag.contentEncoding="base64",a._zod.check=c=>{e7(c.value)||c.issues.push({code:"invalid_format",format:"base64",input:c.value,inst:a,continue:!b.abort})}}),e9=cQ("$ZodBase64URL",(a,b)=>{b.pattern??(b.pattern=dO),eP.init(a,b),a._zod.bag.contentEncoding="base64url",a._zod.check=c=>{!function(a){if(!dO.test(a))return!1;let b=a.replace(/[-_]/g,a=>"-"===a?"+":"/");return e7(b.padEnd(4*Math.ceil(b.length/4),"="))}(c.value)&&c.issues.push({code:"invalid_format",format:"base64url",input:c.value,inst:a,continue:!b.abort})}}),fa=cQ("$ZodE164",(a,b)=>{b.pattern??(b.pattern=dQ),eP.init(a,b)}),fb=cQ("$ZodJWT",(a,b)=>{eP.init(a,b),a._zod.check=c=>{!function(a,b=null){try{let c=a.split(".");if(3!==c.length)return!1;let[d]=c;if(!d)return!1;let e=JSON.parse(atob(d));if("typ"in e&&e?.typ!=="JWT"||!e.alg||b&&(!("alg"in e)||e.alg!==b))return!1;return!0}catch{return!1}}(c.value,b.alg)&&c.issues.push({code:"invalid_format",format:"jwt",input:c.value,inst:a,continue:!b.abort})}}),fc=((a,b)=>{eP.init(a,b),a._zod.check=c=>{b.fn(c.value)||c.issues.push({code:"invalid_format",format:b.format,input:c.value,inst:a,continue:!b.abort})}},cQ("$ZodNumber",(a,b)=>{eN.init(a,b),a._zod.pattern=a._zod.bag.pattern??dZ,a._zod.parse=(c,d)=>{if(b.coerce)try{c.value=Number(c.value)}catch(a){}let e=c.value;if("number"==typeof e&&!Number.isNaN(e)&&Number.isFinite(e))return c;let f="number"==typeof e?Number.isNaN(e)?"NaN":Number.isFinite(e)?void 0:"Infinity":void 0;return c.issues.push({expected:"number",code:"invalid_type",input:e,inst:a,...f?{received:f}:{}}),c}})),fd=cQ("$ZodNumberFormat",(a,b)=>{ek.init(a,b),fc.init(a,b)}),fe=cQ("$ZodBoolean",(a,b)=>{eN.init(a,b),a._zod.pattern=d$,a._zod.parse=(c,d)=>{if(b.coerce)try{c.value=!!c.value}catch(a){}let e=c.value;return"boolean"==typeof e||c.issues.push({expected:"boolean",code:"invalid_type",input:e,inst:a}),c}}),ff=cQ("$ZodBigInt",(a,b)=>{eN.init(a,b),a._zod.pattern=dX,a._zod.parse=(c,d)=>{if(b.coerce)try{c.value=BigInt(c.value)}catch(a){}return"bigint"==typeof c.value||c.issues.push({expected:"bigint",code:"invalid_type",input:c.value,inst:a}),c}}),fg=((a,b)=>{el.init(a,b),ff.init(a,b)},cQ("$ZodAny",(a,b)=>{eN.init(a,b),a._zod.parse=a=>a})),fh=cQ("$ZodUnknown",(a,b)=>{eN.init(a,b),a._zod.parse=a=>a}),fi=cQ("$ZodNever",(a,b)=>{eN.init(a,b),a._zod.parse=(b,c)=>(b.issues.push({expected:"never",code:"invalid_type",input:b.value,inst:a}),b)}),fj=((a,b)=>{eN.init(a,b),a._zod.parse=(b,c)=>{let d=b.value;return void 0===d||b.issues.push({expected:"void",code:"invalid_type",input:d,inst:a}),b}},cQ("$ZodDate",(a,b)=>{eN.init(a,b),a._zod.parse=(c,d)=>{if(b.coerce)try{c.value=new Date(c.value)}catch(a){}let e=c.value,f=e instanceof Date;return f&&!Number.isNaN(e.getTime())||c.issues.push({expected:"date",code:"invalid_type",input:e,...f?{received:"Invalid Date"}:{},inst:a}),c}}));function fk(a,b,c){a.issues.length&&b.issues.push(...dk(c,a.issues)),b.value[c]=a.value}let fl=cQ("$ZodArray",(a,b)=>{eN.init(a,b),a._zod.parse=(c,d)=>{let e=c.value;if(!Array.isArray(e))return c.issues.push({expected:"array",code:"invalid_type",input:e,inst:a}),c;c.value=Array(e.length);let f=[];for(let a=0;a<e.length;a++){let g=e[a],h=b.element._zod.run({value:g,issues:[]},d);h instanceof Promise?f.push(h.then(b=>fk(b,c,a))):fk(h,c,a)}return f.length?Promise.all(f).then(()=>c):c}});function fm(a,b,c,d,e,f){let g=c in d;if(a.issues.length){if(e&&f&&!g)return;b.issues.push(...dk(c,a.issues))}if(!g&&!e){a.issues.length||b.issues.push({code:"invalid_type",expected:"nonoptional",input:void 0,path:[c]});return}void 0===a.value?g&&(b.value[c]=void 0):b.value[c]=a.value}function fn(a){let b=Object.keys(a.shape);for(let c of b)if(!a.shape?.[c]?._zod?.traits?.has("$ZodType"))throw Error(`Invalid element at key "${c}": expected a Zod schema`);let c=df(a.shape);return{...a,keys:b,keySet:new Set(b),numKeys:b.length,optionalKeys:new Set(c)}}function fo(a,b,c,d,e,f){let g=[],h=e.keySet,i=e.catchall._zod,j=i.def.type,k="optional"===i.optin,l="optional"===i.optout;for(let e in b){if("__proto__"===e||h.has(e))continue;if("never"===j){g.push(e);continue}let f=i.run({value:b[e],issues:[]},d);f instanceof Promise?a.push(f.then(a=>fm(a,c,e,b,k,l))):fm(f,c,e,b,k,l)}return(g.length&&c.issues.push({code:"unrecognized_keys",keys:g,input:b,inst:f}),a.length)?Promise.all(a).then(()=>c):c}let fp=cQ("$ZodObject",(a,b)=>{let c;eN.init(a,b);let d=Object.getOwnPropertyDescriptor(b,"shape");if(!d?.get){let a=b.shape;Object.defineProperty(b,"shape",{get:()=>{let c={...a};return Object.defineProperty(b,"shape",{value:c}),c}})}let e=cX(()=>fn(b));c0(a._zod,"propValues",()=>{let a=b.shape,c={};for(let b in a){let d=a[b]._zod;if(d.values)for(let a of(c[b]??(c[b]=new Set),d.values))c[b].add(a)}return c});let f=b.catchall;a._zod.parse=(b,d)=>{c??(c=e.value);let g=b.value;if(!c6(g))return b.issues.push({expected:"object",code:"invalid_type",input:g,inst:a}),b;b.value={};let h=[],i=c.shape;for(let a of c.keys){let c=i[a],e="optional"===c._zod.optin,f="optional"===c._zod.optout,j=c._zod.run({value:g[a],issues:[]},d);j instanceof Promise?h.push(j.then(c=>fm(c,b,a,g,e,f))):fm(j,b,a,g,e,f)}return f?fo(h,g,b,d,e.value,a):h.length?Promise.all(h).then(()=>b):b}}),fq=cQ("$ZodObjectJIT",(a,b)=>{let c,d;fp.init(a,b);let e=a._zod.parse,f=cX(()=>fn(b)),g=!cT.jitless,h=g&&c7.value,i=b.catchall;a._zod.parse=(j,k)=>{d??(d=f.value);let l=j.value;return c6(l)?g&&h&&k?.async===!1&&!0!==k.jitless?(c||(c=(a=>{let b=new eA(["shape","payload","ctx"]),c=f.value,d=a=>{let b=c3(a);return`shape[${b}]._zod.run({ value: input[${b}], issues: [] }, ctx)`};b.write("const input = payload.value;");let e=Object.create(null),g=0;for(let a of c.keys)e[a]=`key_${g++}`;for(let f of(b.write("const newResult = {};"),c.keys)){let c=e[f],g=c3(f),h=a[f],i=h?._zod?.optin==="optional",j=h?._zod?.optout==="optional";b.write(`const ${c} = ${d(f)};`),i&&j?b.write(`
2
2
  if (${c}.issues.length) {
3
3
  if (${g} in input) {
4
4
  payload.issues = payload.issues.concat(${c}.issues.map(iss => ({
@@ -418,7 +418,7 @@ To resolve this, you can:
418
418
  1. Use only one of the conflicting plugins
419
419
  2. Configure the plugins to use different paths (if supported)
420
420
  3. Ensure plugins use different HTTP methods for the same path
421
- `)}}(b={...b,secret:d,baseURL:k?b.baseURL:l?new URL(l).origin:"",basePath:b.basePath||"/api/auth",plugins:h.concat(i)},j);let r=hR(b),s=(0,v.getAuthTables)(b),t=(await Promise.all(Object.entries(b.socialProviders||{}).map(async([a,b])=>{let c="function"==typeof b?await b():b;if(null==c||!1===c.enabled)return null;c.clientId||j.warn(`Social provider ${a} is missing clientId or clientSecret`);let d=lj[a](c);return d.disableImplicitSignUp=c.disableImplicitSignUp,d}))).filter(a=>null!==a),u=({model:a,size:c})=>{if("function"==typeof b.advanced?.generateId)return b.advanced.generateId({model:a,size:c});let d=b?.advanced?.database?.generateId;return"function"==typeof d?d({model:a,size:c}):"uuid"===d?crypto.randomUUID():"serial"!==d&&!1!==d&&(0,io.generateId)(c)},{publish:x}=await mh(b,{adapter:a.id,database:"function"==typeof b.database?"adapter":c(b.database)}),z=new Set(b.plugins.map(a=>a.id)),A=await iB(b),B=await iF(b),C={appName:b.appName||"Better Auth",baseURL:l||"",version:h6().version,socialProviders:t,options:b,oauthConfig:{storeStateStrategy:b.account?.storeStateStrategy||(b.database?"database":"cookie"),skipStateCookieCheck:!!b.account?.skipStateCookieCheck},tables:s,trustedOrigins:A,trustedProviders:B,isTrustedOrigin(a,b){return this.trustedOrigins.some(c=>N(a,c,b))},sessionConfig:{updateAge:b.session?.updateAge!==void 0?b.session.updateAge:86400,expiresIn:b.session?.expiresIn||604800,freshAge:b.session?.freshAge===void 0?86400:b.session.freshAge,cookieRefreshCache:(f=b.session?.cookieCache?.refreshCache,g=b.session?.cookieCache?.maxAge||300,(b.database||b.secondaryStorage)&&f?(j.warn("[better-auth] `session.cookieCache.refreshCache` is enabled while `database` or `secondaryStorage` is configured. `refreshCache` is meant for stateless (DB-less) setups. Disabling `refreshCache` — remove it from your config to silence this warning."),!1):!1!==f&&void 0!==f&&(!0===f?{enabled:!0,updateAge:Math.floor(.2*g)}:{enabled:!0,updateAge:void 0!==f.updateAge?f.updateAge:Math.floor(.2*g)}))},secret:d,secretConfig:e,rateLimit:{...b.rateLimit,enabled:b.rateLimit?.enabled??E.isProduction,window:b.rateLimit?.window||10,max:b.rateLimit?.max||100,storage:b.rateLimit?.storage||(b.secondaryStorage?"secondary-storage":"memory")},authCookies:r,logger:j,generateId:u,session:null,secondaryStorage:b.secondaryStorage,password:{hash:b.emailAndPassword?.password?.hash||R,verify:b.emailAndPassword?.password?.verify||T,config:{minPasswordLength:b.emailAndPassword?.minPasswordLength||8,maxPasswordLength:b.emailAndPassword?.maxPasswordLength||128},checkPassword:iH},setNewSession(a){this.newSession=a},newSession:null,adapter:a,internalAdapter:iq(a,{options:b,logger:j,hooks:b.databaseHooks?[{source:"user",hooks:b.databaseHooks}]:[],generateId:u}),createAuthCookie:hQ(b),async runMigrations(){throw new y.BetterAuthError("runMigrations will be set by the specific init implementation")},publishTelemetry:x,skipCSRFCheck:!!b.advanced?.disableCSRFCheck,skipOriginCheck:b.advanced?.disableOriginCheck!==void 0?b.advanced.disableOriginCheck:!!(0,E.isTest)(),runInBackground:b.advanced?.backgroundTasks?.handler??(a=>{a.catch(()=>{})}),async runInBackgroundOrAwait(a){try{b.advanced?.backgroundTasks?.handler?a instanceof Promise&&b.advanced.backgroundTasks.handler(a.catch(a=>{j.error("Failed to run background task:",a)})):await a}catch(a){j.error("Failed to run background task:",a)}},getPlugin:a=>b.plugins.find(b=>b.id===a)??null,hasPlugin:a=>z.has(a)},D=iA(C);return O(D)&&await D,C}var mj=a.i(607669);let mk=async a=>{let b=await z(a),c=await mi(b,a,a=>(0,mj.getKyselyDatabaseType)(a)||"unknown");return c.runMigrations=async function(){if(!a.database||"updateMany"in a.database)throw new y.BetterAuthError("Database is not provided or it's an adapter. Migrations are only supported with a database instance.");let{runMigrations:b}=await (0,A.getMigrations)(a);await b()},c};var ml=a.i(286607),mm=a.i(478500);async function mn(){try{let a=await (0,lY.readFile)(l$.default.join(lZ.default.homedir(),".wiki-viewer","config.json"),"utf8");return JSON.parse(a)}catch{return{}}}function mo(a){return(a??"").split(",").map(a=>a.trim().toLowerCase()).filter(Boolean)}async function mp(){let a=await mn();return{emails:a.allowedEmails&&a.allowedEmails.length>0?a.allowedEmails.map(a=>a.trim().toLowerCase()).filter(Boolean):mo(process.env.AUTH_ALLOWED_EMAILS),domains:a.allowedDomains&&a.allowedDomains.length>0?a.allowedDomains.map(a=>a.trim().toLowerCase()).filter(Boolean):mo(process.env.AUTH_ALLOWED_DOMAIN)}}async function mq(a){let{emails:b,domains:c}=await mp();if(0===b.length&&0===c.length)return!0;let d=a.toLowerCase();if(b.includes(d))return!0;let e=d.lastIndexOf("@");return!!(e>=0&&c.includes(d.slice(e+1)))}Promise.resolve();let mr=new mm.AsyncLocalStorage;if("phase-production-build"!==process.env.NEXT_PHASE&&"1"!==process.env.WIKI_ALLOW_INSECURE){let a=process.env.BETTER_AUTH_URL??"";if(!a)throw Error("BETTER_AUTH_URL is required in production. Set it to https://your-domain so cookies and OAuth callbacks resolve correctly. Set WIKI_ALLOW_INSECURE=1 to bypass (development only).");if(!a.startsWith("https://"))throw Error(`BETTER_AUTH_URL must be https:// in production (got: ${a}). Set WIKI_ALLOW_INSECURE=1 to bypass (development only).`)}let ms=l$.default.join(process.env.HOME??lZ.default.homedir(),".wiki-viewer");(0,lX.mkdirSync)(ms,{recursive:!0});let mt=l$.default.join(ms,"auth.db"),mu=l$.default.join(ms,"auth.secret"),mv=new ml.default(mt);mv.pragma("journal_mode = WAL");let mw={};process.env.GOOGLE_CLIENT_ID&&process.env.GOOGLE_CLIENT_SECRET&&(mw.google={clientId:process.env.GOOGLE_CLIENT_ID,clientSecret:process.env.GOOGLE_CLIENT_SECRET});let mx=Object.keys(mw).length>0,my="1"===process.env.AUTH_DISABLE_PASSWORD||"true"===process.env.AUTH_DISABLE_PASSWORD,mz=!(my&&mx);my&&!mx&&console.warn("[wiki-viewer] AUTH_DISABLE_PASSWORD is set but no social provider is configured. Keeping email/password enabled so you are not locked out. Configure GOOGLE_CLIENT_ID/GOOGLE_CLIENT_SECRET to disable password auth.");let mA=(process.env.AUTH_TRUSTED_PROVIDERS??"").split(",").map(a=>a.trim()).filter(Boolean),mB=((a,b)=>{let c=b(a),{api:d}=lW(c,a);return{handler:async b=>{let d,e=await c,f=e.options.basePath||"/api/auth";if(K(a.baseURL))d=await iD(e,b,iC(e.options));else{if(d=e,!e.options.baseURL){let a=I(void 0,f,b,void 0,e.options.advanced?.trustedProxyHeaders);if(a)e.baseURL=a,e.options.baseURL=J(e.baseURL)||void 0;else throw new y.BetterAuthError("Could not get base URL from request. Please provide a valid base URL.")}d.trustedOrigins=await iB(e.options,b),d.trustedProviders=await iF(e.options,b)}let{handler:g}=((a,b)=>{let{api:c,middlewares:d}=lW(a,b),e=new URL(a.baseURL).pathname;return((a,b)=>{if(!b?.openapi?.disabled){let c={path:"/api/reference",...b?.openapi};a.openapi=i0(c.path,{method:"GET"},async b=>{let d,e;return new Response((d=await i6(a),e=c.scalar,`<!doctype html>
421
+ `)}}(b={...b,secret:d,baseURL:k?b.baseURL:l?new URL(l).origin:"",basePath:b.basePath||"/api/auth",plugins:h.concat(i)},j);let r=hR(b),s=(0,v.getAuthTables)(b),t=(await Promise.all(Object.entries(b.socialProviders||{}).map(async([a,b])=>{let c="function"==typeof b?await b():b;if(null==c||!1===c.enabled)return null;c.clientId||j.warn(`Social provider ${a} is missing clientId or clientSecret`);let d=lj[a](c);return d.disableImplicitSignUp=c.disableImplicitSignUp,d}))).filter(a=>null!==a),u=({model:a,size:c})=>{if("function"==typeof b.advanced?.generateId)return b.advanced.generateId({model:a,size:c});let d=b?.advanced?.database?.generateId;return"function"==typeof d?d({model:a,size:c}):"uuid"===d?crypto.randomUUID():"serial"!==d&&!1!==d&&(0,io.generateId)(c)},{publish:x}=await mh(b,{adapter:a.id,database:"function"==typeof b.database?"adapter":c(b.database)}),z=new Set(b.plugins.map(a=>a.id)),A=await iB(b),B=await iF(b),C={appName:b.appName||"Better Auth",baseURL:l||"",version:h6().version,socialProviders:t,options:b,oauthConfig:{storeStateStrategy:b.account?.storeStateStrategy||(b.database?"database":"cookie"),skipStateCookieCheck:!!b.account?.skipStateCookieCheck},tables:s,trustedOrigins:A,trustedProviders:B,isTrustedOrigin(a,b){return this.trustedOrigins.some(c=>N(a,c,b))},sessionConfig:{updateAge:b.session?.updateAge!==void 0?b.session.updateAge:86400,expiresIn:b.session?.expiresIn||604800,freshAge:b.session?.freshAge===void 0?86400:b.session.freshAge,cookieRefreshCache:(f=b.session?.cookieCache?.refreshCache,g=b.session?.cookieCache?.maxAge||300,(b.database||b.secondaryStorage)&&f?(j.warn("[better-auth] `session.cookieCache.refreshCache` is enabled while `database` or `secondaryStorage` is configured. `refreshCache` is meant for stateless (DB-less) setups. Disabling `refreshCache` — remove it from your config to silence this warning."),!1):!1!==f&&void 0!==f&&(!0===f?{enabled:!0,updateAge:Math.floor(.2*g)}:{enabled:!0,updateAge:void 0!==f.updateAge?f.updateAge:Math.floor(.2*g)}))},secret:d,secretConfig:e,rateLimit:{...b.rateLimit,enabled:b.rateLimit?.enabled??E.isProduction,window:b.rateLimit?.window||10,max:b.rateLimit?.max||100,storage:b.rateLimit?.storage||(b.secondaryStorage?"secondary-storage":"memory")},authCookies:r,logger:j,generateId:u,session:null,secondaryStorage:b.secondaryStorage,password:{hash:b.emailAndPassword?.password?.hash||R,verify:b.emailAndPassword?.password?.verify||T,config:{minPasswordLength:b.emailAndPassword?.minPasswordLength||8,maxPasswordLength:b.emailAndPassword?.maxPasswordLength||128},checkPassword:iH},setNewSession(a){this.newSession=a},newSession:null,adapter:a,internalAdapter:iq(a,{options:b,logger:j,hooks:b.databaseHooks?[{source:"user",hooks:b.databaseHooks}]:[],generateId:u}),createAuthCookie:hQ(b),async runMigrations(){throw new y.BetterAuthError("runMigrations will be set by the specific init implementation")},publishTelemetry:x,skipCSRFCheck:!!b.advanced?.disableCSRFCheck,skipOriginCheck:b.advanced?.disableOriginCheck!==void 0?b.advanced.disableOriginCheck:!!(0,E.isTest)(),runInBackground:b.advanced?.backgroundTasks?.handler??(a=>{a.catch(()=>{})}),async runInBackgroundOrAwait(a){try{b.advanced?.backgroundTasks?.handler?a instanceof Promise&&b.advanced.backgroundTasks.handler(a.catch(a=>{j.error("Failed to run background task:",a)})):await a}catch(a){j.error("Failed to run background task:",a)}},getPlugin:a=>b.plugins.find(b=>b.id===a)??null,hasPlugin:a=>z.has(a)},D=iA(C);return O(D)&&await D,C}var mj=a.i(607669);let mk=async a=>{let b=await z(a),c=await mi(b,a,a=>(0,mj.getKyselyDatabaseType)(a)||"unknown");return c.runMigrations=async function(){if(!a.database||"updateMany"in a.database)throw new y.BetterAuthError("Database is not provided or it's an adapter. Migrations are only supported with a database instance.");let{runMigrations:b}=await (0,A.getMigrations)(a);await b()},c};var ml=a.x("node:sqlite",()=>require("node:sqlite"),!0),mm=a.i(478500);async function mn(){try{let a=await (0,lY.readFile)(l$.default.join(lZ.default.homedir(),".wiki-viewer","config.json"),"utf8");return JSON.parse(a)}catch{return{}}}function mo(a){return(a??"").split(",").map(a=>a.trim().toLowerCase()).filter(Boolean)}async function mp(){let a=await mn();return{emails:a.allowedEmails&&a.allowedEmails.length>0?a.allowedEmails.map(a=>a.trim().toLowerCase()).filter(Boolean):mo(process.env.AUTH_ALLOWED_EMAILS),domains:a.allowedDomains&&a.allowedDomains.length>0?a.allowedDomains.map(a=>a.trim().toLowerCase()).filter(Boolean):mo(process.env.AUTH_ALLOWED_DOMAIN)}}async function mq(a){let{emails:b,domains:c}=await mp();if(0===b.length&&0===c.length)return!0;let d=a.toLowerCase();if(b.includes(d))return!0;let e=d.lastIndexOf("@");return!!(e>=0&&c.includes(d.slice(e+1)))}Promise.resolve();let mr=new mm.AsyncLocalStorage;if("phase-production-build"!==process.env.NEXT_PHASE&&"1"!==process.env.WIKI_ALLOW_INSECURE){let a=process.env.BETTER_AUTH_URL??"";if(!a)throw Error("BETTER_AUTH_URL is required in production. Set it to https://your-domain so cookies and OAuth callbacks resolve correctly. Set WIKI_ALLOW_INSECURE=1 to bypass (development only).");if(!a.startsWith("https://"))throw Error(`BETTER_AUTH_URL must be https:// in production (got: ${a}). Set WIKI_ALLOW_INSECURE=1 to bypass (development only).`)}let ms=l$.default.join(process.env.HOME??lZ.default.homedir(),".wiki-viewer");(0,lX.mkdirSync)(ms,{recursive:!0});let mt=l$.default.join(ms,"auth.db"),mu=l$.default.join(ms,"auth.secret"),mv=new ml.DatabaseSync(mt);mv.exec("PRAGMA journal_mode = WAL");let mw={};process.env.GOOGLE_CLIENT_ID&&process.env.GOOGLE_CLIENT_SECRET&&(mw.google={clientId:process.env.GOOGLE_CLIENT_ID,clientSecret:process.env.GOOGLE_CLIENT_SECRET});let mx=Object.keys(mw).length>0,my="1"===process.env.AUTH_DISABLE_PASSWORD||"true"===process.env.AUTH_DISABLE_PASSWORD,mz=!(my&&mx);my&&!mx&&console.warn("[wiki-viewer] AUTH_DISABLE_PASSWORD is set but no social provider is configured. Keeping email/password enabled so you are not locked out. Configure GOOGLE_CLIENT_ID/GOOGLE_CLIENT_SECRET to disable password auth.");let mA=(process.env.AUTH_TRUSTED_PROVIDERS??"").split(",").map(a=>a.trim()).filter(Boolean),mB=((a,b)=>{let c=b(a),{api:d}=lW(c,a);return{handler:async b=>{let d,e=await c,f=e.options.basePath||"/api/auth";if(K(a.baseURL))d=await iD(e,b,iC(e.options));else{if(d=e,!e.options.baseURL){let a=I(void 0,f,b,void 0,e.options.advanced?.trustedProxyHeaders);if(a)e.baseURL=a,e.options.baseURL=J(e.baseURL)||void 0;else throw new y.BetterAuthError("Could not get base URL from request. Please provide a valid base URL.")}d.trustedOrigins=await iB(e.options,b),d.trustedProviders=await iF(e.options,b)}let{handler:g}=((a,b)=>{let{api:c,middlewares:d}=lW(a,b),e=new URL(a.baseURL).pathname;return((a,b)=>{if(!b?.openapi?.disabled){let c={path:"/api/reference",...b?.openapi};a.openapi=i0(c.path,{method:"GET"},async b=>{let d,e;return new Response((d=await i6(a),e=c.scalar,`<!doctype html>
422
422
  <html>
423
423
  <head>
424
424
  <title>Scalar API Reference</title>
@@ -447,6 +447,6 @@ To resolve this, you can:
447
447
  </script>
448
448
  <script src="https://cdn.jsdelivr.net/npm/@scalar/api-reference"></script>
449
449
  </body>
450
- </html>`),{headers:{"Content-Type":"text/html"}})})}let c=i8(),d=i8();for(let b of Object.values(a))if(!(!b.options||!b.path||b.options?.metadata?.SERVER_ONLY))for(let a of Array.isArray(b.options?.method)?b.options.method:[b.options?.method])jb(c,a,b.path,b);if(b?.routerMiddleware?.length)for(let{path:a,middleware:c}of b.routerMiddleware)jb(d,"*",a,c);let e=async a=>{let e=new URL(a.url),f=e.pathname,g=b?.basePath&&"/"!==b.basePath?f.split(b.basePath).reduce((a,c,d)=>(0!==d&&(d>1?a.push(`${b.basePath}${c}`):a.push(c)),a),[]).join(""):e.pathname;if(!g?.length||/\/{2,}/.test(g))return new Response(null,{status:404,statusText:"Not Found"});let h=function(a,b="",c){47===c.charCodeAt(c.length-1)&&(c=c.slice(0,-1));let d=a.static[c];if(d&&d.methods){let a=d.methods[b]||d.methods[""];if(void 0!==a)return a[0]}let e=i9(c),f=function a(b,c,d,e,f){if(f===e.length){if(c.methods){let a=c.methods[d]||c.methods[""];if(a)return a}if(c.param&&c.param.methods){let a=c.param.methods[d]||c.param.methods[""];if(a){let b=a[0].paramsMap;if(b?.[b?.length-1]?.[2])return a}}if(c.wildcard&&c.wildcard.methods){let a=c.wildcard.methods[d]||c.wildcard.methods[""];if(a){let b=a[0].paramsMap;if(b?.[b?.length-1]?.[2])return a}}return}let g=e[f];if(c.static){let h=c.static[g];if(h){let c=a(b,h,d,e,f+1);if(c)return c}}if(c.param){let h=a(b,c.param,d,e,f+1);if(h){if(c.param.hasRegexParam){let a=h.find(a=>a.paramsRegexp[f]?.test(g))||h.find(a=>!a.paramsRegexp[f]);return a?[a]:void 0}return h}}if(c.wildcard&&c.wildcard.methods)return c.wildcard.methods[d]||c.wildcard.methods[""]}(a,a.root,b,e,0)?.[0];if(void 0!==f)return{data:f.data,params:f.paramsMap?ja(e,f.paramsMap):void 0}}(c,a.method,g);if(g.endsWith("/")!==h?.data?.path?.endsWith("/")&&!b?.skipTrailingSlashes||!h?.data)return new Response(null,{status:404,statusText:"Not Found"});let i={};e.searchParams.forEach((a,b)=>{b in i?Array.isArray(i[b])?i[b].push(a):i[b]=[i[b],a]:i[b]=a});let j=h.data;try{let c=j.options.metadata?.allowedMediaTypes||b?.allowedMediaTypes,e={path:g,method:a.method,headers:a.headers,params:h.params?JSON.parse(JSON.stringify(h.params)):{},request:a,body:j.options.disableBody?void 0:await iK(j.options.cloneRequest?a.clone():a,c),query:i,_flag:"router",asResponse:!0,context:b?.routerContext},f=function(a,b="",c){47===c.charCodeAt(c.length-1)&&(c=c.slice(0,-1));let d=i9(c);return(function a(b,c,d,e,f,g=[]){let h=e[f];if(c.wildcard&&c.wildcard.methods){let a=c.wildcard.methods[d]||c.wildcard.methods[""];a&&g.push(...a)}if(c.param&&(a(b,c.param,d,e,f+1,g),f===e.length&&c.param.methods)){let a=c.param.methods[d]||c.param.methods[""];if(a){let b=a[0].paramsMap;b?.[b?.length-1]?.[2]&&g.push(...a)}}let i=c.static?.[h];if(i&&a(b,i,d,e,f+1,g),f===e.length&&c.methods){let a=c.methods[d]||c.methods[""];a&&g.push(...a)}return g})(a,a.root,b,d,0).map(a=>({data:a.data,params:a.paramsMap?ja(d,a.paramsMap):void 0}))}(d,"*",g);if(f?.length)for(let{data:a,params:b}of f){let c=await a({...e,params:b,asResponse:!1});if(c instanceof Response)return c}return await j(e)}catch(c){if(b?.onError)try{let d=await b.onError(c,a);if(d instanceof Response)return iQ(d)}catch(a){if(iL(a))return iQ(a);throw a}if(b?.throwError)throw c;if(iL(c))return iQ(c);return console.error("# SERVER_ERROR: ",c),new Response(null,{status:500,statusText:"Internal Server Error"})}};return{handler:async a=>{let c=await b?.onRequest?.(a);if(c instanceof Response)return c;let d=iN(c)?c:a,f=await e(d),g=await b?.onResponse?.(f,d);return g instanceof Response?g:f},endpoints:a}})(c,{routerContext:a,openapi:{disabled:!0},basePath:e,routerMiddleware:[{path:"/**",middleware:jl},...d],allowedMediaTypes:["application/json"],skipTrailingSlashes:b.advanced?.skipTrailingSlashes??!1,async onRequest(b){let c=a.options.disabledPaths||[],d=jh(b.url,e);if(c.includes(d))return new Response("Not Found",{status:404});let f=b;for(let b of a.options.plugins||[])if(b.onRequest){let c=await (0,im.withSpan)(`onRequest ${b.id}`,{[ik]:"onRequest",[il]:`plugin:${b.id}`},()=>b.onRequest(f,a));if(c&&"response"in c)return c.response;c&&"request"in c&&(f=c.request)}return await ju(f,a)||f},async onResponse(b,c){for(let d of(await jv(c,a),a.options.plugins||[]))if(d.onResponse){let c=await (0,im.withSpan)(`onResponse ${d.id}`,{[ik]:"onResponse",[il]:`plugin:${d.id}`,[ii.ATTR_HTTP_RESPONSE_STATUS_CODE]:b.status},()=>d.onResponse(b,a));if(c)return c.response}return b},onError(c){if(jc(c)&&"FOUND"===c.status)return;if(b.onAPIError?.throw)throw c;if(b.onAPIError?.onError)return void b.onAPIError.onError(c,a);let d=b.logger?.level,e="error"===d||"warn"===d||"debug"===d?w.logger:void 0;if(b.logger?.disabled!==!0){if(c&&"object"==typeof c&&"message"in c&&"string"==typeof c.message&&(c.message.includes("no column")||c.message.includes("column")||c.message.includes("relation")||c.message.includes("table")||c.message.includes("does not exist")))return void a.logger?.error(c.message);jc(c)?("INTERNAL_SERVER_ERROR"===c.status&&a.logger.error(c.status,c),e?.error(c.message)):a.logger?.error(c&&"object"==typeof c&&"name"in c?c.name:"",c)}}})})(d,a);return ib(d.adapter,()=>g(b))},api:d,options:a,$context:c,$ERROR_CODES:{...a.plugins?.reduce((a,b)=>b.$ERROR_CODES?{...a,...b.$ERROR_CODES}:a,{}),...cx.BASE_ERROR_CODES}}})({database:mv,secret:function(){if(process.env.BETTER_AUTH_SECRET)return process.env.BETTER_AUTH_SECRET;if((0,lX.existsSync)(mu))return(0,lX.readFileSync)(mu,"utf-8").trim();let a=(0,P.randomBytes)(32).toString("base64");(0,lX.writeFileSync)(mu,a,{mode:384});try{(0,lX.chmodSync)(mu,384)}catch{}return a}(),baseURL:process.env.BETTER_AUTH_URL,account:{accountLinking:{enabled:!0,...mA.length?{trustedProviders:mA,requireLocalEmailVerified:!1}:{}}},emailAndPassword:{enabled:mz,requireEmailVerification:!1,autoSignIn:!0},rateLimit:{enabled:!0,window:60,max:100,customRules:{"/sign-in/email":{window:60,max:20},"/sign-up/email":{window:60,max:10}}},socialProviders:mw,databaseHooks:{user:{create:{before:async a=>{if(!mr.getStore()&&!await mq(a.email))throw Error("SIGNUP_NOT_ALLOWED");return{data:a}}}}},plugins:[(m=!1,{id:"next-cookies",version:"1.6.12",hooks:{before:[{matcher:a=>"/get-session"===a.path,handler:je(async b=>{let c;if(m||(!function(a,b){let c=a.options.plugins||[];if(0===c.length)return;let d=c.findIndex(a=>a.id===b);-1===d||c.slice(d+1).some(a=>a.hooks&&Array.isArray(a.hooks.after)&&a.hooks.after.length>0)&&a.logger.warn(`[better-auth] Cookie integration plugin "${b}" should be placed last in the plugins array. Plugins with \`hooks.after\` running after it may set cookies that are not forwarded to the framework cookie store. Move your cookie integration plugin to the end of the \`plugins\` array to avoid missing \`Set-Cookie\` headers.`)}(b.context,"next-cookies"),m=!0),"_flag"in b&&"router"===b._flag)return;try{let{headers:b}=await a.A(793033);c=await b()}catch{return}let d="1"===c.get("RSC"),e=!!c.get("next-action");d&&!e&&await jE(!0)})}],after:[{matcher:a=>!0,handler:je(async b=>{let c=b.context.responseHeaders;if((!("_flag"in b)||"router"!==b._flag)&&c instanceof Headers){let b,d,e=c?.get("set-cookie");if(!e)return;let f=(d=new Map,cJ(e).forEach(a=>{let[b,...c]=a.split(";").map(a=>a.trim()),[e,...f]=(b||"").split("="),g=cM(f.join("="));if(!e)return;let h={value:cI(g)};c.forEach(a=>{let[b,...c]=a.split("="),d=c.join("="),e=b.trim().toLowerCase();switch(e){case"max-age":h["max-age"]=d?parseInt(d.trim(),10):void 0;break;case"expires":h.expires=d?new Date(d.trim()):void 0;break;case"domain":h.domain=d?d.trim():void 0;break;case"path":h.path=d?d.trim():void 0;break;case"secure":h.secure=!0;break;case"httponly":h.httponly=!0;break;case"samesite":h.samesite=d?d.trim().toLowerCase():void 0;break;case"partitioned":h.partitioned=!0;break;default:h[e]=!d||d.trim()}}),d.set(e,h)}),d);try{let{cookies:c}=await a.A(793033);b=await c()}catch(a){if(a instanceof Error&&(a.message.startsWith("`cookies` was called outside a request scope.")||a.message.includes("Cannot find module")))return;throw a}f.forEach((a,c)=>{if(c)try{b.set(c,a.value,{maxAge:a["max-age"],expires:a.expires,domain:a.domain,path:a.path,secure:a.secure,httpOnly:a.httponly,sameSite:a.samesite,partitioned:a.partitioned})}catch{}});return}})}]}})],trustedOrigins:(n=(process.env.WIKI_OWNER_HOSTS??"").split(",").map(a=>a.trim()).filter(Boolean),o=["",":3000",":3003"],Array.from(new Set(["http://localhost:3000","http://localhost:3003",...n.flatMap(a=>o.flatMap(b=>[`http://${a}${b}`,`https://${a}${b}`]))])))},mk),mC=Symbol.for("wiki-viewer.better-auth.migration-promise"),mD=globalThis;mD[mC]||(mD[mC]=(async()=>{let b=await a.A(160417),{runMigrations:c}=await b.getMigrations(mB.options);await c()})()),a.s(["default",0,function(){let a=!!(process.env.GOOGLE_CLIENT_ID&&process.env.GOOGLE_CLIENT_SECRET);return(0,t.jsx)(u.default,{initialPasswordAuth:mz,initialGoogle:a})},"dynamic",0,"force-dynamic"],244925)},101289,a=>{a.n(a.i(244925))}];
450
+ </html>`),{headers:{"Content-Type":"text/html"}})})}let c=i8(),d=i8();for(let b of Object.values(a))if(!(!b.options||!b.path||b.options?.metadata?.SERVER_ONLY))for(let a of Array.isArray(b.options?.method)?b.options.method:[b.options?.method])jb(c,a,b.path,b);if(b?.routerMiddleware?.length)for(let{path:a,middleware:c}of b.routerMiddleware)jb(d,"*",a,c);let e=async a=>{let e=new URL(a.url),f=e.pathname,g=b?.basePath&&"/"!==b.basePath?f.split(b.basePath).reduce((a,c,d)=>(0!==d&&(d>1?a.push(`${b.basePath}${c}`):a.push(c)),a),[]).join(""):e.pathname;if(!g?.length||/\/{2,}/.test(g))return new Response(null,{status:404,statusText:"Not Found"});let h=function(a,b="",c){47===c.charCodeAt(c.length-1)&&(c=c.slice(0,-1));let d=a.static[c];if(d&&d.methods){let a=d.methods[b]||d.methods[""];if(void 0!==a)return a[0]}let e=i9(c),f=function a(b,c,d,e,f){if(f===e.length){if(c.methods){let a=c.methods[d]||c.methods[""];if(a)return a}if(c.param&&c.param.methods){let a=c.param.methods[d]||c.param.methods[""];if(a){let b=a[0].paramsMap;if(b?.[b?.length-1]?.[2])return a}}if(c.wildcard&&c.wildcard.methods){let a=c.wildcard.methods[d]||c.wildcard.methods[""];if(a){let b=a[0].paramsMap;if(b?.[b?.length-1]?.[2])return a}}return}let g=e[f];if(c.static){let h=c.static[g];if(h){let c=a(b,h,d,e,f+1);if(c)return c}}if(c.param){let h=a(b,c.param,d,e,f+1);if(h){if(c.param.hasRegexParam){let a=h.find(a=>a.paramsRegexp[f]?.test(g))||h.find(a=>!a.paramsRegexp[f]);return a?[a]:void 0}return h}}if(c.wildcard&&c.wildcard.methods)return c.wildcard.methods[d]||c.wildcard.methods[""]}(a,a.root,b,e,0)?.[0];if(void 0!==f)return{data:f.data,params:f.paramsMap?ja(e,f.paramsMap):void 0}}(c,a.method,g);if(g.endsWith("/")!==h?.data?.path?.endsWith("/")&&!b?.skipTrailingSlashes||!h?.data)return new Response(null,{status:404,statusText:"Not Found"});let i={};e.searchParams.forEach((a,b)=>{b in i?Array.isArray(i[b])?i[b].push(a):i[b]=[i[b],a]:i[b]=a});let j=h.data;try{let c=j.options.metadata?.allowedMediaTypes||b?.allowedMediaTypes,e={path:g,method:a.method,headers:a.headers,params:h.params?JSON.parse(JSON.stringify(h.params)):{},request:a,body:j.options.disableBody?void 0:await iK(j.options.cloneRequest?a.clone():a,c),query:i,_flag:"router",asResponse:!0,context:b?.routerContext},f=function(a,b="",c){47===c.charCodeAt(c.length-1)&&(c=c.slice(0,-1));let d=i9(c);return(function a(b,c,d,e,f,g=[]){let h=e[f];if(c.wildcard&&c.wildcard.methods){let a=c.wildcard.methods[d]||c.wildcard.methods[""];a&&g.push(...a)}if(c.param&&(a(b,c.param,d,e,f+1,g),f===e.length&&c.param.methods)){let a=c.param.methods[d]||c.param.methods[""];if(a){let b=a[0].paramsMap;b?.[b?.length-1]?.[2]&&g.push(...a)}}let i=c.static?.[h];if(i&&a(b,i,d,e,f+1,g),f===e.length&&c.methods){let a=c.methods[d]||c.methods[""];a&&g.push(...a)}return g})(a,a.root,b,d,0).map(a=>({data:a.data,params:a.paramsMap?ja(d,a.paramsMap):void 0}))}(d,"*",g);if(f?.length)for(let{data:a,params:b}of f){let c=await a({...e,params:b,asResponse:!1});if(c instanceof Response)return c}return await j(e)}catch(c){if(b?.onError)try{let d=await b.onError(c,a);if(d instanceof Response)return iQ(d)}catch(a){if(iL(a))return iQ(a);throw a}if(b?.throwError)throw c;if(iL(c))return iQ(c);return console.error("# SERVER_ERROR: ",c),new Response(null,{status:500,statusText:"Internal Server Error"})}};return{handler:async a=>{let c=await b?.onRequest?.(a);if(c instanceof Response)return c;let d=iN(c)?c:a,f=await e(d),g=await b?.onResponse?.(f,d);return g instanceof Response?g:f},endpoints:a}})(c,{routerContext:a,openapi:{disabled:!0},basePath:e,routerMiddleware:[{path:"/**",middleware:jl},...d],allowedMediaTypes:["application/json"],skipTrailingSlashes:b.advanced?.skipTrailingSlashes??!1,async onRequest(b){let c=a.options.disabledPaths||[],d=jh(b.url,e);if(c.includes(d))return new Response("Not Found",{status:404});let f=b;for(let b of a.options.plugins||[])if(b.onRequest){let c=await (0,im.withSpan)(`onRequest ${b.id}`,{[ik]:"onRequest",[il]:`plugin:${b.id}`},()=>b.onRequest(f,a));if(c&&"response"in c)return c.response;c&&"request"in c&&(f=c.request)}return await ju(f,a)||f},async onResponse(b,c){for(let d of(await jv(c,a),a.options.plugins||[]))if(d.onResponse){let c=await (0,im.withSpan)(`onResponse ${d.id}`,{[ik]:"onResponse",[il]:`plugin:${d.id}`,[ii.ATTR_HTTP_RESPONSE_STATUS_CODE]:b.status},()=>d.onResponse(b,a));if(c)return c.response}return b},onError(c){if(jc(c)&&"FOUND"===c.status)return;if(b.onAPIError?.throw)throw c;if(b.onAPIError?.onError)return void b.onAPIError.onError(c,a);let d=b.logger?.level,e="error"===d||"warn"===d||"debug"===d?w.logger:void 0;if(b.logger?.disabled!==!0){if(c&&"object"==typeof c&&"message"in c&&"string"==typeof c.message&&(c.message.includes("no column")||c.message.includes("column")||c.message.includes("relation")||c.message.includes("table")||c.message.includes("does not exist")))return void a.logger?.error(c.message);jc(c)?("INTERNAL_SERVER_ERROR"===c.status&&a.logger.error(c.status,c),e?.error(c.message)):a.logger?.error(c&&"object"==typeof c&&"name"in c?c.name:"",c)}}})})(d,a);return ib(d.adapter,()=>g(b))},api:d,options:a,$context:c,$ERROR_CODES:{...a.plugins?.reduce((a,b)=>b.$ERROR_CODES?{...a,...b.$ERROR_CODES}:a,{}),...cx.BASE_ERROR_CODES}}})({database:mv,secret:function(){if(process.env.BETTER_AUTH_SECRET)return process.env.BETTER_AUTH_SECRET;if((0,lX.existsSync)(mu))return(0,lX.readFileSync)(mu,"utf-8").trim();let a=(0,P.randomBytes)(32).toString("base64");(0,lX.writeFileSync)(mu,a,{mode:384});try{(0,lX.chmodSync)(mu,384)}catch{}return a}(),baseURL:process.env.BETTER_AUTH_URL,account:{accountLinking:{enabled:!0,...mA.length?{trustedProviders:mA,requireLocalEmailVerified:!1}:{}}},emailAndPassword:{enabled:mz,requireEmailVerification:!1,autoSignIn:!0},rateLimit:{enabled:!0,window:60,max:100,customRules:{"/sign-in/email":{window:60,max:20},"/sign-up/email":{window:60,max:10}}},socialProviders:mw,databaseHooks:{user:{create:{before:async a=>{if(!mr.getStore()&&!await mq(a.email))throw Error("SIGNUP_NOT_ALLOWED");return{data:a}}}}},plugins:[(m=!1,{id:"next-cookies",version:"1.6.12",hooks:{before:[{matcher:a=>"/get-session"===a.path,handler:je(async b=>{let c;if(m||(!function(a,b){let c=a.options.plugins||[];if(0===c.length)return;let d=c.findIndex(a=>a.id===b);-1===d||c.slice(d+1).some(a=>a.hooks&&Array.isArray(a.hooks.after)&&a.hooks.after.length>0)&&a.logger.warn(`[better-auth] Cookie integration plugin "${b}" should be placed last in the plugins array. Plugins with \`hooks.after\` running after it may set cookies that are not forwarded to the framework cookie store. Move your cookie integration plugin to the end of the \`plugins\` array to avoid missing \`Set-Cookie\` headers.`)}(b.context,"next-cookies"),m=!0),"_flag"in b&&"router"===b._flag)return;try{let{headers:b}=await a.A(793033);c=await b()}catch{return}let d="1"===c.get("RSC"),e=!!c.get("next-action");d&&!e&&await jE(!0)})}],after:[{matcher:a=>!0,handler:je(async b=>{let c=b.context.responseHeaders;if((!("_flag"in b)||"router"!==b._flag)&&c instanceof Headers){let b,d,e=c?.get("set-cookie");if(!e)return;let f=(d=new Map,cJ(e).forEach(a=>{let[b,...c]=a.split(";").map(a=>a.trim()),[e,...f]=(b||"").split("="),g=cM(f.join("="));if(!e)return;let h={value:cI(g)};c.forEach(a=>{let[b,...c]=a.split("="),d=c.join("="),e=b.trim().toLowerCase();switch(e){case"max-age":h["max-age"]=d?parseInt(d.trim(),10):void 0;break;case"expires":h.expires=d?new Date(d.trim()):void 0;break;case"domain":h.domain=d?d.trim():void 0;break;case"path":h.path=d?d.trim():void 0;break;case"secure":h.secure=!0;break;case"httponly":h.httponly=!0;break;case"samesite":h.samesite=d?d.trim().toLowerCase():void 0;break;case"partitioned":h.partitioned=!0;break;default:h[e]=!d||d.trim()}}),d.set(e,h)}),d);try{let{cookies:c}=await a.A(793033);b=await c()}catch(a){if(a instanceof Error&&(a.message.startsWith("`cookies` was called outside a request scope.")||a.message.includes("Cannot find module")))return;throw a}f.forEach((a,c)=>{if(c)try{b.set(c,a.value,{maxAge:a["max-age"],expires:a.expires,domain:a.domain,path:a.path,secure:a.secure,httpOnly:a.httponly,sameSite:a.samesite,partitioned:a.partitioned})}catch{}});return}})}]}})],trustedOrigins:(n=(process.env.WIKI_OWNER_HOSTS??"").split(",").map(a=>a.trim()).filter(Boolean),o=["",":3000",":3003"],Array.from(new Set(["http://localhost:3000","http://localhost:3003",...n.flatMap(a=>o.flatMap(b=>[`http://${a}${b}`,`https://${a}${b}`]))])))},mk),mC=Symbol.for("wiki-viewer.better-auth.migration-promise"),mD=globalThis;mD[mC]||(mD[mC]=(async()=>{let b=await a.A(352051),{runMigrations:c}=await b.getMigrations(mB.options);await c()})()),a.s(["default",0,function(){let a=!!(process.env.GOOGLE_CLIENT_ID&&process.env.GOOGLE_CLIENT_SECRET);return(0,t.jsx)(u.default,{initialPasswordAuth:mz,initialGoogle:a})},"dynamic",0,"force-dynamic"],244925)},101289,a=>{a.n(a.i(244925))}];
451
451
 
452
452
  //# sourceMappingURL=src_app_signin_00yk0vm._.js.map