@tempoxyz/id 0.0.0-stage → 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (1096) hide show
  1. package/README.md +121 -2
  2. package/dist/App.d.ts +121 -0
  3. package/dist/App.d.ts.map +1 -0
  4. package/dist/App.js +132 -0
  5. package/dist/App.js.map +1 -0
  6. package/dist/app/client/.assetsignore +2 -0
  7. package/dist/app/client/_headers +4 -0
  8. package/dist/app/client/assets/Account-BYLpNFf3.css +1 -0
  9. package/dist/app/client/assets/Account-BllJah07.js +1 -0
  10. package/dist/app/client/assets/Amount-E_7snI0-.js +1 -0
  11. package/dist/app/client/assets/Amount-ZdtluGf-.css +1 -0
  12. package/dist/app/client/assets/Approval-CgV5JHlb.css +1 -0
  13. package/dist/app/client/assets/Approval-yKflypU2.js +1 -0
  14. package/dist/app/client/assets/ArrowUp-CRvqfMNU.js +1 -0
  15. package/dist/app/client/assets/Authentication-BAXhOh_4.js +2 -0
  16. package/dist/app/client/assets/BRLA-CZvVDNYr.png +0 -0
  17. package/dist/app/client/assets/BRZ-Cn3jEi9t.svg +1 -0
  18. package/dist/app/client/assets/CHFAU-DCedc4aH.png +0 -0
  19. package/dist/app/client/assets/Callout-B736759d.js +1 -0
  20. package/dist/app/client/assets/Callout-DBfEmP7q.css +1 -0
  21. package/dist/app/client/assets/Check-DVgD8tDG.js +1 -0
  22. package/dist/app/client/assets/ChevronRight-CsXtIZCB.js +1 -0
  23. package/dist/app/client/assets/ChooseAccount-BjxfQjPK.js +1 -0
  24. package/dist/app/client/assets/ChooseAccount-DL3wgJhE.css +1 -0
  25. package/dist/app/client/assets/Client-JrABNovb.js +1 -0
  26. package/dist/app/client/assets/Close-CRvWlhqc.js +1 -0
  27. package/dist/app/client/assets/Cloud-DgJsrqpQ.js +1 -0
  28. package/dist/app/client/assets/CodeInput-79Ctx8ZA.js +1 -0
  29. package/dist/app/client/assets/CodeInput-BqRteSwD.css +1 -0
  30. package/dist/app/client/assets/DLUSD-BnRXm3EI.png +0 -0
  31. package/dist/app/client/assets/Deposit-CclrAoXL.css +1 -0
  32. package/dist/app/client/assets/Deposit-c7uYn2Eb.js +1 -0
  33. package/dist/app/client/assets/DevTools-BYkmtuV5.css +1 -0
  34. package/dist/app/client/assets/DevTools-BgnzDGo2.js +1 -0
  35. package/dist/app/client/assets/DeviceApproval-BBUVv58e.js +1 -0
  36. package/dist/app/client/assets/DeviceApproval-BffFLD8F.css +1 -0
  37. package/dist/app/client/assets/EURAU-sjieTTB9.svg +1 -0
  38. package/dist/app/client/assets/EURC.e-CxYiiwkz.svg +1 -0
  39. package/dist/app/client/assets/Fingerprint-BNCA6qOJ.js +1 -0
  40. package/dist/app/client/assets/GBPA-DI_25xSG.svg +4 -0
  41. package/dist/app/client/assets/GUSD-BDEP2Qb-.svg +1 -0
  42. package/dist/app/client/assets/GeistMono-Variable-BRXCGrxA.woff2 +0 -0
  43. package/dist/app/client/assets/Globe-f0eWzcEI.js +1 -0
  44. package/dist/app/client/assets/Grant-5a-n1gJH.css +1 -0
  45. package/dist/app/client/assets/Grant-Dp7mpcEi.js +1 -0
  46. package/dist/app/client/assets/Hex-C9KeV7_9.css +1 -0
  47. package/dist/app/client/assets/Hex-CSp2U46W.js +10 -0
  48. package/dist/app/client/assets/IconChip-DpZHa1JW.js +1 -0
  49. package/dist/app/client/assets/IconChip-yqaQ2y_d.css +1 -0
  50. package/dist/app/client/assets/InputGroup-BlZvt9In.css +1 -0
  51. package/dist/app/client/assets/InputGroup-CsOeBnpB.js +1 -0
  52. package/dist/app/client/assets/Inter-cyrillic-e3OmmzmJ.woff2 +0 -0
  53. package/dist/app/client/assets/Inter-cyrillic-ext-DOWZeO4Q.woff2 +0 -0
  54. package/dist/app/client/assets/Inter-greek-BD3ujQlX.woff2 +0 -0
  55. package/dist/app/client/assets/Inter-greek-ext-CXEwbus4.woff2 +0 -0
  56. package/dist/app/client/assets/Inter-latin-BDFm4vTb.woff2 +0 -0
  57. package/dist/app/client/assets/Inter-latin-ext-E7a9JEPe.woff2 +0 -0
  58. package/dist/app/client/assets/Inter-symbols-DEch7Rxr.woff2 +0 -0
  59. package/dist/app/client/assets/Inter-vietnamese-Bg9723vR.woff2 +0 -0
  60. package/dist/app/client/assets/Loader-Cm9YJNNJ.js +1 -0
  61. package/dist/app/client/assets/MACH-sK0r79kQ.svg +4 -0
  62. package/dist/app/client/assets/OUSD-BFXgVo-Z.svg +5 -0
  63. package/dist/app/client/assets/OUSD.dark-BbbjMvA1.svg +17 -0
  64. package/dist/app/client/assets/OUSD.light-B_zpSz_c.svg +17 -0
  65. package/dist/app/client/assets/PRIME-CiFp2-3e.svg +14 -0
  66. package/dist/app/client/assets/PopoverPopup-DprRXRQe.js +1 -0
  67. package/dist/app/client/assets/Rows-DPGTUdA8.css +1 -0
  68. package/dist/app/client/assets/Rows-Qqo3evtk.js +1 -0
  69. package/dist/app/client/assets/SBC-BTYkbkiD.svg +1 -0
  70. package/dist/app/client/assets/SEKAU-CB5Fc6o8.svg +5 -0
  71. package/dist/app/client/assets/Separator-CZUjVQOL.js +1 -0
  72. package/dist/app/client/assets/SignIn-HdaDzFmq.js +1 -0
  73. package/dist/app/client/assets/SignIn-mlBTwUq4.css +1 -0
  74. package/dist/app/client/assets/Stack-CkkvkOzj.js +1 -0
  75. package/dist/app/client/assets/Stack-D7Yt22Ed.css +1 -0
  76. package/dist/app/client/assets/Tag-BMh6ajrW.css +1 -0
  77. package/dist/app/client/assets/Tag-CLOVANTX.js +1 -0
  78. package/dist/app/client/assets/ToolbarRootContext-Zty_Dh3J.js +1 -0
  79. package/dist/app/client/assets/Tooltip-CLATV6YU.js +1 -0
  80. package/dist/app/client/assets/Tooltip-d3y9ESUJ.css +1 -0
  81. package/dist/app/client/assets/USD1-COVcO_PB.svg +30 -0
  82. package/dist/app/client/assets/USDB-Ckwb6UQw.svg +11 -0
  83. package/dist/app/client/assets/USDC.e-3nMsKAMC.svg +1 -0
  84. package/dist/app/client/assets/USDT0-ia60Dw0e.svg +1 -0
  85. package/dist/app/client/assets/USDY-CB4iet2q.svg +16 -0
  86. package/dist/app/client/assets/USDe-BXHQCd92.svg +1 -0
  87. package/dist/app/client/assets/Upgrade-D0_aO5AP.js +1 -0
  88. package/dist/app/client/assets/WalletUpgrade-BPsPNQsd.js +1 -0
  89. package/dist/app/client/assets/WalletUpgrade-C04kW0Jl.css +1 -0
  90. package/dist/app/client/assets/YLDS-CRh8Zw0g.svg +3 -0
  91. package/dist/app/client/assets/___-I98bns4o.css +1 -0
  92. package/dist/app/client/assets/___.flows-XOlLwMIy.js +5 -0
  93. package/dist/app/client/assets/alphaUSD-CpCFoVuh.svg +1 -0
  94. package/dist/app/client/assets/authorize-C-MlCyaM.js +1 -0
  95. package/dist/app/client/assets/betaUSD-9A8AjgYg.svg +1 -0
  96. package/dist/app/client/assets/cUSD-WsQfa-iC.svg +1 -0
  97. package/dist/app/client/assets/cbBTC-DvUDqrDi.svg +1 -0
  98. package/dist/app/client/assets/choose-account-nXR-SKa2.js +1 -0
  99. package/dist/app/client/assets/deposit-G8tiLPN4.js +1 -0
  100. package/dist/app/client/assets/device-BojBF7hZ.js +1 -0
  101. package/dist/app/client/assets/error-KiOpX7GD.js +1 -0
  102. package/dist/app/client/assets/frxUSD-n9pTpinR.svg +1 -0
  103. package/dist/app/client/assets/getPseudoElementBounds-BsLy4zf_.js +1 -0
  104. package/dist/app/client/assets/goUSD-D9kUvHsF.svg +5 -0
  105. package/dist/app/client/assets/iUSD-CWCJAq9X.svg +1 -0
  106. package/dist/app/client/assets/index-BZH0M7Nf.js +13 -0
  107. package/dist/app/client/assets/index-CIYxHmYA.css +1 -0
  108. package/dist/app/client/assets/login-DUjpk60p.js +1 -0
  109. package/dist/app/client/assets/pathUSD-BvaO6ooS.svg +25 -0
  110. package/dist/app/client/assets/preload-helper-Bs9KvdYl.js +1 -0
  111. package/dist/app/client/assets/rUSD-B-xuFS7T.svg +1 -0
  112. package/dist/app/client/assets/reUSD-CkIUs0Lx.svg +1 -0
  113. package/dist/app/client/assets/removable-DMiA3t_o.js +1 -0
  114. package/dist/app/client/assets/reset-co-CHrff.css +1 -0
  115. package/dist/app/client/assets/rolldown-runtime-WkwZ5CU-.js +1 -0
  116. package/dist/app/client/assets/routes-CK8cthzA.js +1 -0
  117. package/dist/app/client/assets/sUSDe-j9GOnH7I.svg +1 -0
  118. package/dist/app/client/assets/siUSD-C10QUNYS.svg +1 -0
  119. package/dist/app/client/assets/stcUSD-DIntDJeh.svg +1 -0
  120. package/dist/app/client/assets/syrupUSDC-DhYwZqdM.svg +5 -0
  121. package/dist/app/client/assets/thetaUSD-Dgmksf6G.svg +1 -0
  122. package/dist/app/client/assets/useNavigate-CB6S2u4J.js +1 -0
  123. package/dist/app/client/assets/useQuery-BpHfPhTT.js +1 -0
  124. package/dist/app/client/assets/useRegisterFieldControl-DsslqY-V.js +1 -0
  125. package/dist/app/client/assets/wYLDS-CaCKDrO-.svg +10 -0
  126. package/dist/app/client/assets/wsrUSD-B2Ey0bDQ.svg +1 -0
  127. package/dist/app/client/assets/zyzz-DYC-X0_B.css +1 -0
  128. package/dist/app/client/assets/zyzz.config-DX_D_7j3.js +2 -0
  129. package/dist/app/db/auth.d.ts +3412 -0
  130. package/dist/app/db/auth.d.ts.map +1 -0
  131. package/dist/app/db/auth.js +349 -0
  132. package/dist/app/db/auth.js.map +1 -0
  133. package/dist/app/db/schema.d.ts +1091 -0
  134. package/dist/app/db/schema.d.ts.map +1 -0
  135. package/dist/app/db/schema.js +183 -0
  136. package/dist/app/db/schema.js.map +1 -0
  137. package/dist/app/db/table.d.ts +8 -0
  138. package/dist/app/db/table.d.ts.map +1 -0
  139. package/dist/app/db/table.js +28 -0
  140. package/dist/app/db/table.js.map +1 -0
  141. package/dist/app/server/.vite/manifest.json +2093 -0
  142. package/dist/app/server/assets/Account-BYLpNFf3.css +1 -0
  143. package/dist/app/server/assets/Account-G_SUeRU3.js +2 -0
  144. package/dist/app/server/assets/Account-G_SUeRU3.js.map +1 -0
  145. package/dist/app/server/assets/Amount-Cgwdr3Xt.js +2 -0
  146. package/dist/app/server/assets/Amount-Cgwdr3Xt.js.map +1 -0
  147. package/dist/app/server/assets/Amount-ZdtluGf-.css +1 -0
  148. package/dist/app/server/assets/Approval-CgV5JHlb.css +1 -0
  149. package/dist/app/server/assets/Approval-DvkB9tWA.js +2 -0
  150. package/dist/app/server/assets/Approval-DvkB9tWA.js.map +1 -0
  151. package/dist/app/server/assets/ArrowUp-DpK_zNgZ.js +2 -0
  152. package/dist/app/server/assets/ArrowUp-DpK_zNgZ.js.map +1 -0
  153. package/dist/app/server/assets/Authentication-BOkhlNQu.js +2 -0
  154. package/dist/app/server/assets/Authentication-BOkhlNQu.js.map +1 -0
  155. package/dist/app/server/assets/Authentication-C3oNZAVX.js +2 -0
  156. package/dist/app/server/assets/Authentication-C3oNZAVX.js.map +1 -0
  157. package/dist/app/server/assets/BRLA-CZvVDNYr.png +0 -0
  158. package/dist/app/server/assets/BRZ-Cn3jEi9t.svg +1 -0
  159. package/dist/app/server/assets/Bytes-C7CRVS3J.js +4 -0
  160. package/dist/app/server/assets/Bytes-C7CRVS3J.js.map +1 -0
  161. package/dist/app/server/assets/CHFAU-DCedc4aH.png +0 -0
  162. package/dist/app/server/assets/Callout-DBfEmP7q.css +1 -0
  163. package/dist/app/server/assets/Callout-tQoAitWq.js +2 -0
  164. package/dist/app/server/assets/Callout-tQoAitWq.js.map +1 -0
  165. package/dist/app/server/assets/ChainList-C4A_7e-9.js +6 -0
  166. package/dist/app/server/assets/ChainList-C4A_7e-9.js.map +1 -0
  167. package/dist/app/server/assets/ChainName-BMnJyJrd.js +2 -0
  168. package/dist/app/server/assets/ChainName-BMnJyJrd.js.map +1 -0
  169. package/dist/app/server/assets/Check-DU_oR3Ev.js +2 -0
  170. package/dist/app/server/assets/Check-DU_oR3Ev.js.map +1 -0
  171. package/dist/app/server/assets/ChevronRight-DTBnw-W6.js +2 -0
  172. package/dist/app/server/assets/ChevronRight-DTBnw-W6.js.map +1 -0
  173. package/dist/app/server/assets/ChooseAccount-BizJvMrY.js +2 -0
  174. package/dist/app/server/assets/ChooseAccount-BizJvMrY.js.map +1 -0
  175. package/dist/app/server/assets/ChooseAccount-DL3wgJhE.css +1 -0
  176. package/dist/app/server/assets/Client-Dx3KrpJZ.js +2 -0
  177. package/dist/app/server/assets/Client-Dx3KrpJZ.js.map +1 -0
  178. package/dist/app/server/assets/ClientOnly-CKLiu67O.js +2 -0
  179. package/dist/app/server/assets/ClientOnly-CKLiu67O.js.map +1 -0
  180. package/dist/app/server/assets/Close-DUeE37ev.js +2 -0
  181. package/dist/app/server/assets/Close-DUeE37ev.js.map +1 -0
  182. package/dist/app/server/assets/Cloud-CLB3rTTy.js +2 -0
  183. package/dist/app/server/assets/Cloud-CLB3rTTy.js.map +1 -0
  184. package/dist/app/server/assets/CodeInput-BqRteSwD.css +1 -0
  185. package/dist/app/server/assets/CodeInput-FsPzVuLU.js +2 -0
  186. package/dist/app/server/assets/CodeInput-FsPzVuLU.js.map +1 -0
  187. package/dist/app/server/assets/Credential-DFjcrdyI.js +2 -0
  188. package/dist/app/server/assets/Credential-DFjcrdyI.js.map +1 -0
  189. package/dist/app/server/assets/DLUSD-BnRXm3EI.png +0 -0
  190. package/dist/app/server/assets/Deposit-CclrAoXL.css +1 -0
  191. package/dist/app/server/assets/Deposit-ChYGRfW2.js +2 -0
  192. package/dist/app/server/assets/Deposit-ChYGRfW2.js.map +1 -0
  193. package/dist/app/server/assets/DevTools-BYkmtuV5.css +1 -0
  194. package/dist/app/server/assets/DevTools-ZJVXqrIK.js +2 -0
  195. package/dist/app/server/assets/DevTools-ZJVXqrIK.js.map +1 -0
  196. package/dist/app/server/assets/DeviceApproval-BffFLD8F.css +1 -0
  197. package/dist/app/server/assets/DeviceApproval-Bqe3Mi78.js +2 -0
  198. package/dist/app/server/assets/DeviceApproval-Bqe3Mi78.js.map +1 -0
  199. package/dist/app/server/assets/EURAU-sjieTTB9.svg +1 -0
  200. package/dist/app/server/assets/EURC.e-CxYiiwkz.svg +1 -0
  201. package/dist/app/server/assets/ExecutionError-CDszGSF1.js +9 -0
  202. package/dist/app/server/assets/ExecutionError-CDszGSF1.js.map +1 -0
  203. package/dist/app/server/assets/Fingerprint-DhOPOdRr.js +2 -0
  204. package/dist/app/server/assets/Fingerprint-DhOPOdRr.js.map +1 -0
  205. package/dist/app/server/assets/GBPA-DI_25xSG.svg +4 -0
  206. package/dist/app/server/assets/GUSD-BDEP2Qb-.svg +1 -0
  207. package/dist/app/server/assets/GeistMono-Variable-BRXCGrxA.woff2 +0 -0
  208. package/dist/app/server/assets/Globe-2CxqxU-7.js +2 -0
  209. package/dist/app/server/assets/Globe-2CxqxU-7.js.map +1 -0
  210. package/dist/app/server/assets/Grant-5a-n1gJH.css +1 -0
  211. package/dist/app/server/assets/Grant-D_tun0mF.js +2 -0
  212. package/dist/app/server/assets/Grant-D_tun0mF.js.map +1 -0
  213. package/dist/app/server/assets/Hex-C9KeV7_9.css +1 -0
  214. package/dist/app/server/assets/Hex-Z6m_0Y0m.js +11 -0
  215. package/dist/app/server/assets/Hex-Z6m_0Y0m.js.map +1 -0
  216. package/dist/app/server/assets/IconChip-C9ZrmGB5.js +2 -0
  217. package/dist/app/server/assets/IconChip-C9ZrmGB5.js.map +1 -0
  218. package/dist/app/server/assets/IconChip-yqaQ2y_d.css +1 -0
  219. package/dist/app/server/assets/InputGroup-BlZvt9In.css +1 -0
  220. package/dist/app/server/assets/InputGroup-hpjuLuR7.js +2 -0
  221. package/dist/app/server/assets/InputGroup-hpjuLuR7.js.map +1 -0
  222. package/dist/app/server/assets/Inter-cyrillic-e3OmmzmJ.woff2 +0 -0
  223. package/dist/app/server/assets/Inter-cyrillic-ext-DOWZeO4Q.woff2 +0 -0
  224. package/dist/app/server/assets/Inter-greek-BD3ujQlX.woff2 +0 -0
  225. package/dist/app/server/assets/Inter-greek-ext-CXEwbus4.woff2 +0 -0
  226. package/dist/app/server/assets/Inter-latin-BDFm4vTb.woff2 +0 -0
  227. package/dist/app/server/assets/Inter-latin-ext-E7a9JEPe.woff2 +0 -0
  228. package/dist/app/server/assets/Inter-symbols-DEch7Rxr.woff2 +0 -0
  229. package/dist/app/server/assets/Inter-vietnamese-Bg9723vR.woff2 +0 -0
  230. package/dist/app/server/assets/Loader-DnKC9P5p.js +2 -0
  231. package/dist/app/server/assets/Loader-DnKC9P5p.js.map +1 -0
  232. package/dist/app/server/assets/MACH-sK0r79kQ.svg +4 -0
  233. package/dist/app/server/assets/Match-CyVdYcSf.js +2 -0
  234. package/dist/app/server/assets/Match-CyVdYcSf.js.map +1 -0
  235. package/dist/app/server/assets/OUSD-BFXgVo-Z.svg +5 -0
  236. package/dist/app/server/assets/OUSD.dark-BbbjMvA1.svg +17 -0
  237. package/dist/app/server/assets/OUSD.light-B_zpSz_c.svg +17 -0
  238. package/dist/app/server/assets/PRIME-CiFp2-3e.svg +14 -0
  239. package/dist/app/server/assets/PopoverPopup-CwqeQelI.js +2 -0
  240. package/dist/app/server/assets/PopoverPopup-CwqeQelI.js.map +1 -0
  241. package/dist/app/server/assets/Rows-CQKQwTI1.js +2 -0
  242. package/dist/app/server/assets/Rows-CQKQwTI1.js.map +1 -0
  243. package/dist/app/server/assets/Rows-DPGTUdA8.css +1 -0
  244. package/dist/app/server/assets/SBC-BTYkbkiD.svg +1 -0
  245. package/dist/app/server/assets/SEKAU-CB5Fc6o8.svg +5 -0
  246. package/dist/app/server/assets/Separator-DrI7KRAs.js +2 -0
  247. package/dist/app/server/assets/Separator-DrI7KRAs.js.map +1 -0
  248. package/dist/app/server/assets/SignIn-DfeeLEmN.js +2 -0
  249. package/dist/app/server/assets/SignIn-DfeeLEmN.js.map +1 -0
  250. package/dist/app/server/assets/SignIn-mlBTwUq4.css +1 -0
  251. package/dist/app/server/assets/Stack-D7Yt22Ed.css +1 -0
  252. package/dist/app/server/assets/Stack-DGktaLZc.js +2 -0
  253. package/dist/app/server/assets/Stack-DGktaLZc.js.map +1 -0
  254. package/dist/app/server/assets/Tag-9vSRBpph.js +2 -0
  255. package/dist/app/server/assets/Tag-9vSRBpph.js.map +1 -0
  256. package/dist/app/server/assets/Tag-BMh6ajrW.css +1 -0
  257. package/dist/app/server/assets/ToolbarRootContext-BH_CFSWd.js +2 -0
  258. package/dist/app/server/assets/ToolbarRootContext-BH_CFSWd.js.map +1 -0
  259. package/dist/app/server/assets/Tooltip-DLX41peb.js +2 -0
  260. package/dist/app/server/assets/Tooltip-DLX41peb.js.map +1 -0
  261. package/dist/app/server/assets/Tooltip-d3y9ESUJ.css +1 -0
  262. package/dist/app/server/assets/USD1-COVcO_PB.svg +30 -0
  263. package/dist/app/server/assets/USDB-Ckwb6UQw.svg +11 -0
  264. package/dist/app/server/assets/USDC.e-3nMsKAMC.svg +1 -0
  265. package/dist/app/server/assets/USDT0-ia60Dw0e.svg +1 -0
  266. package/dist/app/server/assets/USDY-CB4iet2q.svg +16 -0
  267. package/dist/app/server/assets/USDe-BXHQCd92.svg +1 -0
  268. package/dist/app/server/assets/Upgrade-Dbfm2nm0.js +2 -0
  269. package/dist/app/server/assets/Upgrade-Dbfm2nm0.js.map +1 -0
  270. package/dist/app/server/assets/WalletUpgrade-C04kW0Jl.css +1 -0
  271. package/dist/app/server/assets/WalletUpgrade-CWKc5fYt.js +2 -0
  272. package/dist/app/server/assets/WalletUpgrade-CWKc5fYt.js.map +1 -0
  273. package/dist/app/server/assets/YLDS-CRh8Zw0g.svg +3 -0
  274. package/dist/app/server/assets/___-I98bns4o.css +1 -0
  275. package/dist/app/server/assets/___.flows-Cc-awUoC.js +6 -0
  276. package/dist/app/server/assets/___.flows-Cc-awUoC.js.map +1 -0
  277. package/dist/app/server/assets/_tanstack-start-manifest_v-U7TrtUSA.js +1 -0
  278. package/dist/app/server/assets/_zyzz__2Fhome_2Frunner_2Fwork_2Fid_2Fid_2Fsrc_2Fapp_2Froutes_2F_5B__5D.flows-B1pPOqsM.css +1 -0
  279. package/dist/app/server/assets/_zyzz__2Fhome_2Frunner_2Fwork_2Fid_2Fid_2Fsrc_2Fapp_2Froutes_2F_5B__5D.flows.tsx-CKALi9oD.js +2 -0
  280. package/dist/app/server/assets/_zyzz__2Fhome_2Frunner_2Fwork_2Fid_2Fid_2Fsrc_2Fapp_2Froutes_2F_5B__5D.flows.tsx-CKALi9oD.js.map +1 -0
  281. package/dist/app/server/assets/_zyzz_shared-BbDIEd_j.css +1 -0
  282. package/dist/app/server/assets/alphaUSD-CpCFoVuh.svg +1 -0
  283. package/dist/app/server/assets/arktype-aI7TBD0R-D1R3Byo5.js +2 -0
  284. package/dist/app/server/assets/arktype-aI7TBD0R-D1R3Byo5.js.map +1 -0
  285. package/dist/app/server/assets/async-local-storage-DlOvwxXd.js +2 -0
  286. package/dist/app/server/assets/async-local-storage-DlOvwxXd.js.map +1 -0
  287. package/dist/app/server/assets/authorize-BXzTo2Pb.js +2 -0
  288. package/dist/app/server/assets/authorize-BXzTo2Pb.js.map +1 -0
  289. package/dist/app/server/assets/authorize-BzoUqOdA.js +2 -0
  290. package/dist/app/server/assets/authorize-BzoUqOdA.js.map +1 -0
  291. package/dist/app/server/assets/authorize-DXYo-K2n-rmQQ42x1.js +56 -0
  292. package/dist/app/server/assets/authorize-DXYo-K2n-rmQQ42x1.js.map +1 -0
  293. package/dist/app/server/assets/authorize-DfjPYJqS.css +1 -0
  294. package/dist/app/server/assets/betaUSD-9A8AjgYg.svg +1 -0
  295. package/dist/app/server/assets/bun-sqlite-dialect-DoOVo4ja-CtyBkVMb.js +2 -0
  296. package/dist/app/server/assets/bun-sqlite-dialect-DoOVo4ja-CtyBkVMb.js.map +1 -0
  297. package/dist/app/server/assets/cUSD-WsQfa-iC.svg +1 -0
  298. package/dist/app/server/assets/call-dzi0xjZd.js +31 -0
  299. package/dist/app/server/assets/call-dzi0xjZd.js.map +1 -0
  300. package/dist/app/server/assets/cbBTC-DvUDqrDi.svg +1 -0
  301. package/dist/app/server/assets/ccip-DjD8z_3B.js +2 -0
  302. package/dist/app/server/assets/ccip-DjD8z_3B.js.map +1 -0
  303. package/dist/app/server/assets/choose-account-_X7xq5am.js +2 -0
  304. package/dist/app/server/assets/choose-account-_X7xq5am.js.map +1 -0
  305. package/dist/app/server/assets/choose-account-lqA5SLx9.css +1 -0
  306. package/dist/app/server/assets/choose-account-zm-5Qs3e.js +2 -0
  307. package/dist/app/server/assets/choose-account-zm-5Qs3e.js.map +1 -0
  308. package/dist/app/server/assets/compiled-query-Ds2NVcFT.js +2 -0
  309. package/dist/app/server/assets/compiled-query-Ds2NVcFT.js.map +1 -0
  310. package/dist/app/server/assets/convert-BIC8n32x.js +2 -0
  311. package/dist/app/server/assets/convert-BIC8n32x.js.map +1 -0
  312. package/dist/app/server/assets/cookie-DxViaO10.js +2 -0
  313. package/dist/app/server/assets/cookie-DxViaO10.js.map +1 -0
  314. package/dist/app/server/assets/core-BBrZXfrB.js +56 -0
  315. package/dist/app/server/assets/core-BBrZXfrB.js.map +1 -0
  316. package/dist/app/server/assets/d1-sqlite-dialect-m0f01-4z-Cv-csE1u.js +2 -0
  317. package/dist/app/server/assets/d1-sqlite-dialect-m0f01-4z-Cv-csE1u.js.map +1 -0
  318. package/dist/app/server/assets/decodeFunctionData-bP6V2ai4.js +2 -0
  319. package/dist/app/server/assets/decodeFunctionData-bP6V2ai4.js.map +1 -0
  320. package/dist/app/server/assets/default-u_dwuiYb-DOrMMcg9.js +2 -0
  321. package/dist/app/server/assets/default-u_dwuiYb-DOrMMcg9.js.map +1 -0
  322. package/dist/app/server/assets/deposit-BBaNI01u.js +2 -0
  323. package/dist/app/server/assets/deposit-BBaNI01u.js.map +1 -0
  324. package/dist/app/server/assets/deposit-LWS6ZTuf.js +2 -0
  325. package/dist/app/server/assets/deposit-LWS6ZTuf.js.map +1 -0
  326. package/dist/app/server/assets/deposit-oFx15XCA.css +1 -0
  327. package/dist/app/server/assets/device-CrXlusjr.js +2 -0
  328. package/dist/app/server/assets/device-CrXlusjr.js.map +1 -0
  329. package/dist/app/server/assets/device-DdFMgYe2.js +2 -0
  330. package/dist/app/server/assets/device-DdFMgYe2.js.map +1 -0
  331. package/dist/app/server/assets/device-tMCpu5zk.css +1 -0
  332. package/dist/app/server/assets/dist-CR6FW-yS.js +1 -0
  333. package/dist/app/server/assets/dist-CoH0hD1s.js +15 -0
  334. package/dist/app/server/assets/dist-CoH0hD1s.js.map +1 -0
  335. package/dist/app/server/assets/dist-DcICI3fd.js +2 -0
  336. package/dist/app/server/assets/dist-DcICI3fd.js.map +1 -0
  337. package/dist/app/server/assets/effect-QlVUlMFu-mXPkuQTb.js +2 -0
  338. package/dist/app/server/assets/effect-QlVUlMFu-mXPkuQTb.js.map +1 -0
  339. package/dist/app/server/assets/empty-plugin-adapters-BaGcmrjC.js +2 -0
  340. package/dist/app/server/assets/empty-plugin-adapters-BaGcmrjC.js.map +1 -0
  341. package/dist/app/server/assets/error-CXy8gqdE.css +1 -0
  342. package/dist/app/server/assets/error-DXDT2AHy.js +2 -0
  343. package/dist/app/server/assets/error-DXDT2AHy.js.map +1 -0
  344. package/dist/app/server/assets/error-bnVzy9tx.js +2 -0
  345. package/dist/app/server/assets/error-bnVzy9tx.js.map +1 -0
  346. package/dist/app/server/assets/esm-C6SW--yt.js +4 -0
  347. package/dist/app/server/assets/esm-C6SW--yt.js.map +1 -0
  348. package/dist/app/server/assets/factory-dvoOlKer.js +5 -0
  349. package/dist/app/server/assets/factory-dvoOlKer.js.map +1 -0
  350. package/dist/app/server/assets/frxUSD-n9pTpinR.svg +1 -0
  351. package/dist/app/server/assets/get-id-field-OwLpfjj2.js +6 -0
  352. package/dist/app/server/assets/get-id-field-OwLpfjj2.js.map +1 -0
  353. package/dist/app/server/assets/getPseudoElementBounds-PkWU72kn.js +2 -0
  354. package/dist/app/server/assets/getPseudoElementBounds-PkWU72kn.js.map +1 -0
  355. package/dist/app/server/assets/goUSD-D9kUvHsF.svg +5 -0
  356. package/dist/app/server/assets/iUSD-CWCJAq9X.svg +1 -0
  357. package/dist/app/server/assets/index-CLddUTqr-CC33CMvS.js +2 -0
  358. package/dist/app/server/assets/index-CLddUTqr-CC33CMvS.js.map +1 -0
  359. package/dist/app/server/assets/index-DZEfthgZ-Ec2MMQ_e.js +2 -0
  360. package/dist/app/server/assets/index-DZEfthgZ-Ec2MMQ_e.js.map +1 -0
  361. package/dist/app/server/assets/kysely-adapter-B8tQwTcu.js +1 -0
  362. package/dist/app/server/assets/lazyRouteComponent-DPOOPZw_.js +2 -0
  363. package/dist/app/server/assets/lazyRouteComponent-DPOOPZw_.js.map +1 -0
  364. package/dist/app/server/assets/load-server-Dr0IlySo.js +3 -0
  365. package/dist/app/server/assets/load-server-Dr0IlySo.js.map +1 -0
  366. package/dist/app/server/assets/login-BLq3tEEr.js +2 -0
  367. package/dist/app/server/assets/login-BLq3tEEr.js.map +1 -0
  368. package/dist/app/server/assets/login-DCIrAbED.js +2 -0
  369. package/dist/app/server/assets/login-DCIrAbED.js.map +1 -0
  370. package/dist/app/server/assets/login-msDnt3yT.css +1 -0
  371. package/dist/app/server/assets/matchContext-ByrIUj4L.js +2 -0
  372. package/dist/app/server/assets/matchContext-ByrIUj4L.js.map +1 -0
  373. package/dist/app/server/assets/node-sqlite-dialect-BowWLXvK.js +2 -0
  374. package/dist/app/server/assets/node-sqlite-dialect-BowWLXvK.js.map +1 -0
  375. package/dist/app/server/assets/pathUSD-BvaO6ooS.svg +25 -0
  376. package/dist/app/server/assets/rUSD-B-xuFS7T.svg +1 -0
  377. package/dist/app/server/assets/reUSD-CkIUs0Lx.svg +1 -0
  378. package/dist/app/server/assets/react-dom-DYzj0HXX.js +2 -0
  379. package/dist/app/server/assets/react-dom-DYzj0HXX.js.map +1 -0
  380. package/dist/app/server/assets/removable-BCLTvPOx.js +2 -0
  381. package/dist/app/server/assets/removable-BCLTvPOx.js.map +1 -0
  382. package/dist/app/server/assets/reset-DZWeTZeQ.js +2 -0
  383. package/dist/app/server/assets/reset-DZWeTZeQ.js.map +1 -0
  384. package/dist/app/server/assets/reset-co-CHrff.css +1 -0
  385. package/dist/app/server/assets/resolveError-CZXXvCJR.js +2 -0
  386. package/dist/app/server/assets/resolveError-CZXXvCJR.js.map +1 -0
  387. package/dist/app/server/assets/rolldown-runtime-BWaJ3C7D.js +1 -0
  388. package/dist/app/server/assets/router-Bqz5X4Qw.js +2 -0
  389. package/dist/app/server/assets/router-Bqz5X4Qw.js.map +1 -0
  390. package/dist/app/server/assets/router-CclzitkY.css +1 -0
  391. package/dist/app/server/assets/routes-BLQdKqcZ.js +2 -0
  392. package/dist/app/server/assets/routes-BLQdKqcZ.js.map +1 -0
  393. package/dist/app/server/assets/routes-BgiIzrOt.css +1 -0
  394. package/dist/app/server/assets/routes-Bv6WzsSR.js +2 -0
  395. package/dist/app/server/assets/routes-Bv6WzsSR.js.map +1 -0
  396. package/dist/app/server/assets/sUSDe-j9GOnH7I.svg +1 -0
  397. package/dist/app/server/assets/schema-check-oLqvHR8y.js +9 -0
  398. package/dist/app/server/assets/schema-check-oLqvHR8y.js.map +1 -0
  399. package/dist/app/server/assets/secp256k1-yg8eeIYU.js +2 -0
  400. package/dist/app/server/assets/secp256k1-yg8eeIYU.js.map +1 -0
  401. package/dist/app/server/assets/server-RRUiOef2.js +76 -0
  402. package/dist/app/server/assets/server-RRUiOef2.js.map +1 -0
  403. package/dist/app/server/assets/siUSD-C10QUNYS.svg +1 -0
  404. package/dist/app/server/assets/sqlite-adapter-C_LAV4e3.js +2 -0
  405. package/dist/app/server/assets/sqlite-adapter-C_LAV4e3.js.map +1 -0
  406. package/dist/app/server/assets/sqlite-introspector-DSCAP82F-Crx7Ny14.js +6 -0
  407. package/dist/app/server/assets/sqlite-introspector-DSCAP82F-Crx7Ny14.js.map +1 -0
  408. package/dist/app/server/assets/standard-json-DY77efq0.js +2 -0
  409. package/dist/app/server/assets/standard-json-DY77efq0.js.map +1 -0
  410. package/dist/app/server/assets/standard-json-ig2t0wRt.js +2 -0
  411. package/dist/app/server/assets/standard-json-ig2t0wRt.js.map +1 -0
  412. package/dist/app/server/assets/standard-json-t-LNckA6.js +2 -0
  413. package/dist/app/server/assets/standard-json-t-LNckA6.js.map +1 -0
  414. package/dist/app/server/assets/standard-openapi-CONmVRl8.js +2 -0
  415. package/dist/app/server/assets/standard-openapi-CONmVRl8.js.map +1 -0
  416. package/dist/app/server/assets/start-C63VetBp.js +2 -0
  417. package/dist/app/server/assets/start-C63VetBp.js.map +1 -0
  418. package/dist/app/server/assets/stcUSD-DIntDJeh.svg +1 -0
  419. package/dist/app/server/assets/sury-CWZTCd75-CDaOS2oM.js +2 -0
  420. package/dist/app/server/assets/sury-CWZTCd75-CDaOS2oM.js.map +1 -0
  421. package/dist/app/server/assets/syrupUSDC-DhYwZqdM.svg +5 -0
  422. package/dist/app/server/assets/thetaUSD-Dgmksf6G.svg +1 -0
  423. package/dist/app/server/assets/typebox-Dei93FPO-D_lCVdAz.js +2 -0
  424. package/dist/app/server/assets/typebox-Dei93FPO-D_lCVdAz.js.map +1 -0
  425. package/dist/app/server/assets/useNavigate-D6d1w7KE.js +2 -0
  426. package/dist/app/server/assets/useNavigate-D6d1w7KE.js.map +1 -0
  427. package/dist/app/server/assets/useQuery-BRpCr5vj.js +2 -0
  428. package/dist/app/server/assets/useQuery-BRpCr5vj.js.map +1 -0
  429. package/dist/app/server/assets/useRegisterFieldControl-cJesrOWK.js +2 -0
  430. package/dist/app/server/assets/useRegisterFieldControl-cJesrOWK.js.map +1 -0
  431. package/dist/app/server/assets/utils-C4ZXZIZW.js +2 -0
  432. package/dist/app/server/assets/utils-C4ZXZIZW.js.map +1 -0
  433. package/dist/app/server/assets/utils-D57zfcg-.js +2 -0
  434. package/dist/app/server/assets/utils-D57zfcg-.js.map +1 -0
  435. package/dist/app/server/assets/valibot--1zFm7rT-CIKoH3MS.js +2 -0
  436. package/dist/app/server/assets/valibot--1zFm7rT-CIKoH3MS.js.map +1 -0
  437. package/dist/app/server/assets/valibot-D_HTw1Gn-BdPyLkXt.js +2 -0
  438. package/dist/app/server/assets/valibot-D_HTw1Gn-BdPyLkXt.js.map +1 -0
  439. package/dist/app/server/assets/wYLDS-CaCKDrO-.svg +10 -0
  440. package/dist/app/server/assets/wsrUSD-B2Ey0bDQ.svg +1 -0
  441. package/dist/app/server/assets/zod-Bwrt9trS-BezI5Gi1.js +2 -0
  442. package/dist/app/server/assets/zod-Bwrt9trS-BezI5Gi1.js.map +1 -0
  443. package/dist/app/server/assets/zod-DSgpEGAE-DZ7M_Q33.js +2 -0
  444. package/dist/app/server/assets/zod-DSgpEGAE-DZ7M_Q33.js.map +1 -0
  445. package/dist/app/server/assets/zyzz-6R2K52xP.css +1 -0
  446. package/dist/app/server/assets/zyzz.config-CJRpjn0E.js +3 -0
  447. package/dist/app/server/assets/zyzz.config-CJRpjn0E.js.map +1 -0
  448. package/dist/app/server/index.js +532 -0
  449. package/dist/app/server/index.js.map +1 -0
  450. package/dist/app/server/wrangler.json +1 -0
  451. package/dist/cli/Admin.d.ts +34 -0
  452. package/dist/cli/Admin.d.ts.map +1 -0
  453. package/dist/cli/Admin.js +61 -0
  454. package/dist/cli/Admin.js.map +1 -0
  455. package/dist/cli/Apps.d.ts +9 -0
  456. package/dist/cli/Apps.d.ts.map +1 -0
  457. package/dist/cli/Apps.js +34 -0
  458. package/dist/cli/Apps.js.map +1 -0
  459. package/dist/cli/Cli.d.ts +13 -0
  460. package/dist/cli/Cli.d.ts.map +1 -0
  461. package/dist/cli/Cli.js +26 -0
  462. package/dist/cli/Cli.js.map +1 -0
  463. package/dist/cli/Project.d.ts +17 -0
  464. package/dist/cli/Project.d.ts.map +1 -0
  465. package/dist/cli/Project.js +90 -0
  466. package/dist/cli/Project.js.map +1 -0
  467. package/dist/cli/Realms.d.ts +24 -0
  468. package/dist/cli/Realms.d.ts.map +1 -0
  469. package/dist/cli/Realms.js +48 -0
  470. package/dist/cli/Realms.js.map +1 -0
  471. package/dist/cli/Session.d.ts +79 -0
  472. package/dist/cli/Session.d.ts.map +1 -0
  473. package/dist/cli/Session.js +229 -0
  474. package/dist/cli/Session.js.map +1 -0
  475. package/dist/cli/User.d.ts +24 -0
  476. package/dist/cli/User.d.ts.map +1 -0
  477. package/dist/cli/User.js +34 -0
  478. package/dist/cli/User.js.map +1 -0
  479. package/dist/cli/V1.d.ts +32 -0
  480. package/dist/cli/V1.d.ts.map +1 -0
  481. package/dist/cli/V1.js +38 -0
  482. package/dist/cli/V1.js.map +1 -0
  483. package/dist/cli/bin.d.ts +3 -0
  484. package/dist/cli/bin.d.ts.map +1 -0
  485. package/dist/cli/bin.js +46 -0
  486. package/dist/cli/bin.js.map +1 -0
  487. package/dist/cli/commands/admin/apps/create.d.ts +23 -0
  488. package/dist/cli/commands/admin/apps/create.d.ts.map +1 -0
  489. package/dist/cli/commands/admin/apps/create.js +84 -0
  490. package/dist/cli/commands/admin/apps/create.js.map +1 -0
  491. package/dist/cli/commands/admin/apps/delete.d.ts +15 -0
  492. package/dist/cli/commands/admin/apps/delete.d.ts.map +1 -0
  493. package/dist/cli/commands/admin/apps/delete.js +41 -0
  494. package/dist/cli/commands/admin/apps/delete.js.map +1 -0
  495. package/dist/cli/commands/admin/apps/index.d.ts +5 -0
  496. package/dist/cli/commands/admin/apps/index.d.ts.map +1 -0
  497. package/dist/cli/commands/admin/apps/index.js +14 -0
  498. package/dist/cli/commands/admin/apps/index.js.map +1 -0
  499. package/dist/cli/commands/admin/apps/list.d.ts +10 -0
  500. package/dist/cli/commands/admin/apps/list.d.ts.map +1 -0
  501. package/dist/cli/commands/admin/apps/list.js +26 -0
  502. package/dist/cli/commands/admin/apps/list.js.map +1 -0
  503. package/dist/cli/commands/admin/apps/rotate-secret.d.ts +17 -0
  504. package/dist/cli/commands/admin/apps/rotate-secret.d.ts.map +1 -0
  505. package/dist/cli/commands/admin/apps/rotate-secret.js +47 -0
  506. package/dist/cli/commands/admin/apps/rotate-secret.js.map +1 -0
  507. package/dist/cli/commands/admin/apps/update.d.ts +20 -0
  508. package/dist/cli/commands/admin/apps/update.d.ts.map +1 -0
  509. package/dist/cli/commands/admin/apps/update.js +71 -0
  510. package/dist/cli/commands/admin/apps/update.js.map +1 -0
  511. package/dist/cli/commands/admin/index.d.ts +5 -0
  512. package/dist/cli/commands/admin/index.d.ts.map +1 -0
  513. package/dist/cli/commands/admin/index.js +13 -0
  514. package/dist/cli/commands/admin/index.js.map +1 -0
  515. package/dist/cli/commands/admin/migrate.d.ts +10 -0
  516. package/dist/cli/commands/admin/migrate.d.ts.map +1 -0
  517. package/dist/cli/commands/admin/migrate.js +20 -0
  518. package/dist/cli/commands/admin/migrate.js.map +1 -0
  519. package/dist/cli/commands/admin/realms/add.d.ts +13 -0
  520. package/dist/cli/commands/admin/realms/add.d.ts.map +1 -0
  521. package/dist/cli/commands/admin/realms/add.js +42 -0
  522. package/dist/cli/commands/admin/realms/add.js.map +1 -0
  523. package/dist/cli/commands/admin/realms/index.d.ts +5 -0
  524. package/dist/cli/commands/admin/realms/index.d.ts.map +1 -0
  525. package/dist/cli/commands/admin/realms/index.js +13 -0
  526. package/dist/cli/commands/admin/realms/index.js.map +1 -0
  527. package/dist/cli/commands/admin/realms/list.d.ts +14 -0
  528. package/dist/cli/commands/admin/realms/list.d.ts.map +1 -0
  529. package/dist/cli/commands/admin/realms/list.js +36 -0
  530. package/dist/cli/commands/admin/realms/list.js.map +1 -0
  531. package/dist/cli/commands/admin/realms/passkeys/index.d.ts +5 -0
  532. package/dist/cli/commands/admin/realms/passkeys/index.d.ts.map +1 -0
  533. package/dist/cli/commands/admin/realms/passkeys/index.js +13 -0
  534. package/dist/cli/commands/admin/realms/passkeys/index.js.map +1 -0
  535. package/dist/cli/commands/admin/realms/passkeys/set.d.ts +17 -0
  536. package/dist/cli/commands/admin/realms/passkeys/set.d.ts.map +1 -0
  537. package/dist/cli/commands/admin/realms/passkeys/set.js +46 -0
  538. package/dist/cli/commands/admin/realms/passkeys/set.js.map +1 -0
  539. package/dist/cli/commands/admin/realms/privy/index.d.ts +5 -0
  540. package/dist/cli/commands/admin/realms/privy/index.d.ts.map +1 -0
  541. package/dist/cli/commands/admin/realms/privy/index.js +13 -0
  542. package/dist/cli/commands/admin/realms/privy/index.js.map +1 -0
  543. package/dist/cli/commands/admin/realms/privy/set.d.ts +19 -0
  544. package/dist/cli/commands/admin/realms/privy/set.d.ts.map +1 -0
  545. package/dist/cli/commands/admin/realms/privy/set.js +66 -0
  546. package/dist/cli/commands/admin/realms/privy/set.js.map +1 -0
  547. package/dist/cli/commands/admin/realms/remove.d.ts +12 -0
  548. package/dist/cli/commands/admin/realms/remove.d.ts.map +1 -0
  549. package/dist/cli/commands/admin/realms/remove.js +35 -0
  550. package/dist/cli/commands/admin/realms/remove.js.map +1 -0
  551. package/dist/cli/commands/admin/realms/secp256k1/disable.d.ts +16 -0
  552. package/dist/cli/commands/admin/realms/secp256k1/disable.d.ts.map +1 -0
  553. package/dist/cli/commands/admin/realms/secp256k1/disable.js +42 -0
  554. package/dist/cli/commands/admin/realms/secp256k1/disable.js.map +1 -0
  555. package/dist/cli/commands/admin/realms/secp256k1/enable.d.ts +16 -0
  556. package/dist/cli/commands/admin/realms/secp256k1/enable.d.ts.map +1 -0
  557. package/dist/cli/commands/admin/realms/secp256k1/enable.js +42 -0
  558. package/dist/cli/commands/admin/realms/secp256k1/enable.js.map +1 -0
  559. package/dist/cli/commands/admin/realms/secp256k1/index.d.ts +9 -0
  560. package/dist/cli/commands/admin/realms/secp256k1/index.d.ts.map +1 -0
  561. package/dist/cli/commands/admin/realms/secp256k1/index.js +17 -0
  562. package/dist/cli/commands/admin/realms/secp256k1/index.js.map +1 -0
  563. package/dist/cli/commands/admin/realms/set.d.ts +17 -0
  564. package/dist/cli/commands/admin/realms/set.d.ts.map +1 -0
  565. package/dist/cli/commands/admin/realms/set.js +46 -0
  566. package/dist/cli/commands/admin/realms/set.js.map +1 -0
  567. package/dist/cli/commands/admin/rotate-key.d.ts +16 -0
  568. package/dist/cli/commands/admin/rotate-key.d.ts.map +1 -0
  569. package/dist/cli/commands/admin/rotate-key.js +46 -0
  570. package/dist/cli/commands/admin/rotate-key.js.map +1 -0
  571. package/dist/cli/commands/init.d.ts +11 -0
  572. package/dist/cli/commands/init.d.ts.map +1 -0
  573. package/dist/cli/commands/init.js +34 -0
  574. package/dist/cli/commands/init.js.map +1 -0
  575. package/dist/cli/commands/login.d.ts +12 -0
  576. package/dist/cli/commands/login.d.ts.map +1 -0
  577. package/dist/cli/commands/login.js +29 -0
  578. package/dist/cli/commands/login.js.map +1 -0
  579. package/dist/cli/commands/logout.d.ts +8 -0
  580. package/dist/cli/commands/logout.d.ts.map +1 -0
  581. package/dist/cli/commands/logout.js +19 -0
  582. package/dist/cli/commands/logout.js.map +1 -0
  583. package/dist/cli/commands/whoami.d.ts +12 -0
  584. package/dist/cli/commands/whoami.d.ts.map +1 -0
  585. package/dist/cli/commands/whoami.js +24 -0
  586. package/dist/cli/commands/whoami.js.map +1 -0
  587. package/dist/client/Actions.d.ts +108 -0
  588. package/dist/client/Actions.d.ts.map +1 -0
  589. package/dist/client/Actions.js +94 -0
  590. package/dist/client/Actions.js.map +1 -0
  591. package/dist/client/Auth.d.ts +143 -0
  592. package/dist/client/Auth.d.ts.map +1 -0
  593. package/dist/client/Auth.js +106 -0
  594. package/dist/client/Auth.js.map +1 -0
  595. package/dist/client/Authorization.d.ts +29 -0
  596. package/dist/client/Authorization.d.ts.map +1 -0
  597. package/dist/client/Authorization.js +12 -0
  598. package/dist/client/Authorization.js.map +1 -0
  599. package/dist/client/Decorator.d.ts +172 -0
  600. package/dist/client/Decorator.d.ts.map +1 -0
  601. package/dist/client/Decorator.js +241 -0
  602. package/dist/client/Decorator.js.map +1 -0
  603. package/dist/client/Key.d.ts +82 -0
  604. package/dist/client/Key.d.ts.map +1 -0
  605. package/dist/client/Key.js +81 -0
  606. package/dist/client/Key.js.map +1 -0
  607. package/dist/client/Pending.d.ts +38 -0
  608. package/dist/client/Pending.d.ts.map +1 -0
  609. package/dist/client/Pending.js +12 -0
  610. package/dist/client/Pending.js.map +1 -0
  611. package/dist/client/Permissions.d.ts +36 -0
  612. package/dist/client/Permissions.d.ts.map +1 -0
  613. package/dist/client/Permissions.js +16 -0
  614. package/dist/client/Permissions.js.map +1 -0
  615. package/dist/client/Storage.d.ts +27 -0
  616. package/dist/client/Storage.d.ts.map +1 -0
  617. package/dist/client/Storage.js +16 -0
  618. package/dist/client/Storage.js.map +1 -0
  619. package/dist/client/TempoAccount.d.ts +52 -0
  620. package/dist/client/TempoAccount.d.ts.map +1 -0
  621. package/dist/client/TempoAccount.js +17 -0
  622. package/dist/client/TempoAccount.js.map +1 -0
  623. package/dist/client/Tokens.d.ts +25 -0
  624. package/dist/client/Tokens.d.ts.map +1 -0
  625. package/dist/client/Tokens.js +12 -0
  626. package/dist/client/Tokens.js.map +1 -0
  627. package/dist/client/User.d.ts +21 -0
  628. package/dist/client/User.d.ts.map +1 -0
  629. package/dist/client/User.js +12 -0
  630. package/dist/client/User.js.map +1 -0
  631. package/dist/client/actions/account.d.ts +75 -0
  632. package/dist/client/actions/account.d.ts.map +1 -0
  633. package/dist/client/actions/account.js +102 -0
  634. package/dist/client/actions/account.js.map +1 -0
  635. package/dist/client/actions/device.d.ts +52 -0
  636. package/dist/client/actions/device.d.ts.map +1 -0
  637. package/dist/client/actions/device.js +103 -0
  638. package/dist/client/actions/device.js.map +1 -0
  639. package/dist/client/actions/email.d.ts +89 -0
  640. package/dist/client/actions/email.d.ts.map +1 -0
  641. package/dist/client/actions/email.js +86 -0
  642. package/dist/client/actions/email.js.map +1 -0
  643. package/dist/client/actions/oauth.d.ts +112 -0
  644. package/dist/client/actions/oauth.d.ts.map +1 -0
  645. package/dist/client/actions/oauth.js +103 -0
  646. package/dist/client/actions/oauth.js.map +1 -0
  647. package/dist/client/actions/passkey.d.ts +140 -0
  648. package/dist/client/actions/passkey.d.ts.map +1 -0
  649. package/dist/client/actions/passkey.js +170 -0
  650. package/dist/client/actions/passkey.js.map +1 -0
  651. package/dist/client/actions/realm.d.ts +25 -0
  652. package/dist/client/actions/realm.d.ts.map +1 -0
  653. package/dist/client/actions/realm.js +16 -0
  654. package/dist/client/actions/realm.js.map +1 -0
  655. package/dist/client/actions/redirect.d.ts +152 -0
  656. package/dist/client/actions/redirect.d.ts.map +1 -0
  657. package/dist/client/actions/redirect.js +311 -0
  658. package/dist/client/actions/redirect.js.map +1 -0
  659. package/dist/client/internal/accessKey.d.ts +21 -0
  660. package/dist/client/internal/accessKey.d.ts.map +1 -0
  661. package/dist/client/internal/accessKey.js +38 -0
  662. package/dist/client/internal/accessKey.js.map +1 -0
  663. package/dist/client/internal/account.d.ts +17 -0
  664. package/dist/client/internal/account.d.ts.map +1 -0
  665. package/dist/client/internal/account.js +3 -0
  666. package/dist/client/internal/account.js.map +1 -0
  667. package/dist/client/internal/api.d.ts +110 -0
  668. package/dist/client/internal/api.d.ts.map +1 -0
  669. package/dist/client/internal/api.js +136 -0
  670. package/dist/client/internal/api.js.map +1 -0
  671. package/dist/client/internal/headless.d.ts +159 -0
  672. package/dist/client/internal/headless.d.ts.map +1 -0
  673. package/dist/client/internal/headless.js +196 -0
  674. package/dist/client/internal/headless.js.map +1 -0
  675. package/dist/client/internal/indexedDb.d.ts +8 -0
  676. package/dist/client/internal/indexedDb.d.ts.map +1 -0
  677. package/dist/client/internal/indexedDb.js +32 -0
  678. package/dist/client/internal/indexedDb.js.map +1 -0
  679. package/dist/client/internal/request.d.ts +56 -0
  680. package/dist/client/internal/request.d.ts.map +1 -0
  681. package/dist/client/internal/request.js +44 -0
  682. package/dist/client/internal/request.js.map +1 -0
  683. package/dist/client/internal/store.d.ts +12 -0
  684. package/dist/client/internal/store.d.ts.map +1 -0
  685. package/dist/client/internal/store.js +15 -0
  686. package/dist/client/internal/store.js.map +1 -0
  687. package/dist/client/internal/verifier.d.ts +25 -0
  688. package/dist/client/internal/verifier.d.ts.map +1 -0
  689. package/dist/client/internal/verifier.js +52 -0
  690. package/dist/client/internal/verifier.js.map +1 -0
  691. package/dist/client.d.ts +18 -0
  692. package/dist/client.d.ts.map +1 -0
  693. package/dist/client.js +18 -0
  694. package/dist/client.js.map +1 -0
  695. package/dist/index.d.ts +6 -0
  696. package/dist/index.d.ts.map +1 -0
  697. package/dist/index.js +6 -0
  698. package/dist/index.js.map +1 -0
  699. package/dist/internal/Apps.d.ts +3169 -0
  700. package/dist/internal/Apps.d.ts.map +1 -0
  701. package/dist/internal/Apps.js +948 -0
  702. package/dist/internal/Apps.js.map +1 -0
  703. package/dist/internal/Auth.d.ts +4287 -0
  704. package/dist/internal/Auth.d.ts.map +1 -0
  705. package/dist/internal/Auth.js +185 -0
  706. package/dist/internal/Auth.js.map +1 -0
  707. package/dist/internal/Authorize.d.ts +526 -0
  708. package/dist/internal/Authorize.d.ts.map +1 -0
  709. package/dist/internal/Authorize.js +330 -0
  710. package/dist/internal/Authorize.js.map +1 -0
  711. package/dist/internal/Cache.d.ts +56 -0
  712. package/dist/internal/Cache.d.ts.map +1 -0
  713. package/dist/internal/Cache.js +65 -0
  714. package/dist/internal/Cache.js.map +1 -0
  715. package/dist/internal/Chain.d.ts +738 -0
  716. package/dist/internal/Chain.d.ts.map +1 -0
  717. package/dist/internal/Chain.js +65 -0
  718. package/dist/internal/Chain.js.map +1 -0
  719. package/dist/internal/ChainList.d.ts +117 -0
  720. package/dist/internal/ChainList.d.ts.map +1 -0
  721. package/dist/internal/ChainList.js +148 -0
  722. package/dist/internal/ChainList.js.map +1 -0
  723. package/dist/internal/ChainName.d.ts +11 -0
  724. package/dist/internal/ChainName.d.ts.map +1 -0
  725. package/dist/internal/ChainName.js +13 -0
  726. package/dist/internal/ChainName.js.map +1 -0
  727. package/dist/internal/CodeEmail.d.ts +38 -0
  728. package/dist/internal/CodeEmail.d.ts.map +1 -0
  729. package/dist/internal/CodeEmail.js +85 -0
  730. package/dist/internal/CodeEmail.js.map +1 -0
  731. package/dist/internal/ConfigurableAccount.d.ts +600 -0
  732. package/dist/internal/ConfigurableAccount.d.ts.map +1 -0
  733. package/dist/internal/ConfigurableAccount.js +795 -0
  734. package/dist/internal/ConfigurableAccount.js.map +1 -0
  735. package/dist/internal/Device.d.ts +246 -0
  736. package/dist/internal/Device.d.ts.map +1 -0
  737. package/dist/internal/Device.js +257 -0
  738. package/dist/internal/Device.js.map +1 -0
  739. package/dist/internal/Env.d.ts +97 -0
  740. package/dist/internal/Env.d.ts.map +1 -0
  741. package/dist/internal/Env.js +2 -0
  742. package/dist/internal/Env.js.map +1 -0
  743. package/dist/internal/ErrorResponse.d.ts +608 -0
  744. package/dist/internal/ErrorResponse.d.ts.map +1 -0
  745. package/dist/internal/ErrorResponse.js +701 -0
  746. package/dist/internal/ErrorResponse.js.map +1 -0
  747. package/dist/internal/Id.d.ts +10 -0
  748. package/dist/internal/Id.d.ts.map +1 -0
  749. package/dist/internal/Id.js +34 -0
  750. package/dist/internal/Id.js.map +1 -0
  751. package/dist/internal/KeyAuthorization.d.ts +1650 -0
  752. package/dist/internal/KeyAuthorization.d.ts.map +1 -0
  753. package/dist/internal/KeyAuthorization.js +1187 -0
  754. package/dist/internal/KeyAuthorization.js.map +1 -0
  755. package/dist/internal/Limits.d.ts +70 -0
  756. package/dist/internal/Limits.d.ts.map +1 -0
  757. package/dist/internal/Limits.js +36 -0
  758. package/dist/internal/Limits.js.map +1 -0
  759. package/dist/internal/Log.d.ts +34 -0
  760. package/dist/internal/Log.d.ts.map +1 -0
  761. package/dist/internal/Log.js +99 -0
  762. package/dist/internal/Log.js.map +1 -0
  763. package/dist/internal/LogLine.d.ts +29 -0
  764. package/dist/internal/LogLine.d.ts.map +1 -0
  765. package/dist/internal/LogLine.js +50 -0
  766. package/dist/internal/LogLine.js.map +1 -0
  767. package/dist/internal/Migrations.d.ts +28 -0
  768. package/dist/internal/Migrations.d.ts.map +1 -0
  769. package/dist/internal/Migrations.js +82 -0
  770. package/dist/internal/Migrations.js.map +1 -0
  771. package/dist/internal/Owner.d.ts +230 -0
  772. package/dist/internal/Owner.d.ts.map +1 -0
  773. package/dist/internal/Owner.js +101 -0
  774. package/dist/internal/Owner.js.map +1 -0
  775. package/dist/internal/Passkey.d.ts +901 -0
  776. package/dist/internal/Passkey.d.ts.map +1 -0
  777. package/dist/internal/Passkey.js +1185 -0
  778. package/dist/internal/Passkey.js.map +1 -0
  779. package/dist/internal/PendingKey.d.ts +49 -0
  780. package/dist/internal/PendingKey.d.ts.map +1 -0
  781. package/dist/internal/PendingKey.js +58 -0
  782. package/dist/internal/PendingKey.js.map +1 -0
  783. package/dist/internal/Privy.d.ts +138 -0
  784. package/dist/internal/Privy.d.ts.map +1 -0
  785. package/dist/internal/Privy.js +285 -0
  786. package/dist/internal/Privy.js.map +1 -0
  787. package/dist/internal/RateLimit.d.ts +218 -0
  788. package/dist/internal/RateLimit.d.ts.map +1 -0
  789. package/dist/internal/RateLimit.js +209 -0
  790. package/dist/internal/RateLimit.js.map +1 -0
  791. package/dist/internal/Realm.d.ts +290 -0
  792. package/dist/internal/Realm.d.ts.map +1 -0
  793. package/dist/internal/Realm.js +502 -0
  794. package/dist/internal/Realm.js.map +1 -0
  795. package/dist/internal/RequestId.d.ts +16 -0
  796. package/dist/internal/RequestId.d.ts.map +1 -0
  797. package/dist/internal/RequestId.js +78 -0
  798. package/dist/internal/RequestId.js.map +1 -0
  799. package/dist/internal/SigningKey.d.ts +126 -0
  800. package/dist/internal/SigningKey.d.ts.map +1 -0
  801. package/dist/internal/SigningKey.js +221 -0
  802. package/dist/internal/SigningKey.js.map +1 -0
  803. package/dist/internal/TempoAccount.d.ts +181 -0
  804. package/dist/internal/TempoAccount.d.ts.map +1 -0
  805. package/dist/internal/TempoAccount.js +369 -0
  806. package/dist/internal/TempoAccount.js.map +1 -0
  807. package/dist/internal/TestInbox.d.ts +42 -0
  808. package/dist/internal/TestInbox.d.ts.map +1 -0
  809. package/dist/internal/TestInbox.js +20 -0
  810. package/dist/internal/TestInbox.js.map +1 -0
  811. package/dist/internal/Timing.d.ts +52 -0
  812. package/dist/internal/Timing.d.ts.map +1 -0
  813. package/dist/internal/Timing.js +116 -0
  814. package/dist/internal/Timing.js.map +1 -0
  815. package/dist/internal/Validation.d.ts +52 -0
  816. package/dist/internal/Validation.d.ts.map +1 -0
  817. package/dist/internal/Validation.js +22 -0
  818. package/dist/internal/Validation.js.map +1 -0
  819. package/dist/internal/Verification.d.ts +24 -0
  820. package/dist/internal/Verification.d.ts.map +1 -0
  821. package/dist/internal/Verification.js +37 -0
  822. package/dist/internal/Verification.js.map +1 -0
  823. package/dist/internal/Wallet.d.ts +66 -0
  824. package/dist/internal/Wallet.d.ts.map +1 -0
  825. package/dist/internal/Wallet.js +59 -0
  826. package/dist/internal/Wallet.js.map +1 -0
  827. package/dist/internal/owners/Passkey.d.ts +9 -0
  828. package/dist/internal/owners/Passkey.d.ts.map +1 -0
  829. package/dist/internal/owners/Passkey.js +58 -0
  830. package/dist/internal/owners/Passkey.js.map +1 -0
  831. package/dist/internal/owners/Privy.d.ts +13 -0
  832. package/dist/internal/owners/Privy.d.ts.map +1 -0
  833. package/dist/internal/owners/Privy.js +59 -0
  834. package/dist/internal/owners/Privy.js.map +1 -0
  835. package/dist/internal/owners/Secp256k1.d.ts +12 -0
  836. package/dist/internal/owners/Secp256k1.d.ts.map +1 -0
  837. package/dist/internal/owners/Secp256k1.js +99 -0
  838. package/dist/internal/owners/Secp256k1.js.map +1 -0
  839. package/dist/worker.d.ts +18 -0
  840. package/dist/worker.d.ts.map +1 -0
  841. package/dist/worker.js +18 -0
  842. package/dist/worker.js.map +1 -0
  843. package/package.json +83 -3
  844. package/src/Api.ts +157 -0
  845. package/src/App.ts +316 -0
  846. package/src/api/account.ts +2266 -0
  847. package/src/api/authenticate.ts +1662 -0
  848. package/src/api/authorize.ts +1086 -0
  849. package/src/api/device.ts +516 -0
  850. package/src/api/health.ts +72 -0
  851. package/src/api/lib/AccountStep.ts +485 -0
  852. package/src/api/lib/Auth.ts +164 -0
  853. package/src/api/lib/Configure.ts +921 -0
  854. package/src/api/lib/Consent.ts +388 -0
  855. package/src/api/lib/Cors.ts +160 -0
  856. package/src/api/lib/Database.ts +10 -0
  857. package/src/api/lib/DeviceRequest.ts +244 -0
  858. package/src/api/lib/FirstAccount.ts +136 -0
  859. package/src/api/lib/Headless.ts +616 -0
  860. package/src/api/lib/IsolateCache.ts +28 -0
  861. package/src/api/lib/KeySigner.ts +690 -0
  862. package/src/api/lib/PasskeyLink.ts +162 -0
  863. package/src/api/lib/Session.ts +64 -0
  864. package/src/api/lib/SignInConsent.ts +393 -0
  865. package/src/api/oauth.ts +1796 -0
  866. package/src/app/components/CodeInput.tsx +153 -0
  867. package/src/app/components/DevTools.tsx +1071 -0
  868. package/src/app/components/Grant.tsx +476 -0
  869. package/src/app/components/icons/BRLA.png +0 -0
  870. package/src/app/components/icons/BRZ.svg +1 -0
  871. package/src/app/components/icons/CHFAU.png +0 -0
  872. package/src/app/components/icons/DLUSD.png +0 -0
  873. package/src/app/components/icons/EURAU.svg +1 -0
  874. package/src/app/components/icons/EURC.e.svg +1 -0
  875. package/src/app/components/icons/GBPA.svg +4 -0
  876. package/src/app/components/icons/GUSD.svg +1 -0
  877. package/src/app/components/icons/MACH.svg +4 -0
  878. package/src/app/components/icons/OUSD.svg +5 -0
  879. package/src/app/components/icons/PRIME.svg +14 -0
  880. package/src/app/components/icons/SBC.svg +1 -0
  881. package/src/app/components/icons/SEKAU.svg +5 -0
  882. package/src/app/components/icons/USD1.svg +30 -0
  883. package/src/app/components/icons/USDB.svg +11 -0
  884. package/src/app/components/icons/USDC.e.svg +1 -0
  885. package/src/app/components/icons/USDT0.svg +1 -0
  886. package/src/app/components/icons/USDY.svg +16 -0
  887. package/src/app/components/icons/USDe.svg +1 -0
  888. package/src/app/components/icons/YLDS.svg +3 -0
  889. package/src/app/components/icons/alphaUSD.svg +1 -0
  890. package/src/app/components/icons/betaUSD.svg +1 -0
  891. package/src/app/components/icons/cUSD.svg +1 -0
  892. package/src/app/components/icons/cbBTC.svg +1 -0
  893. package/src/app/components/icons/frxUSD.svg +1 -0
  894. package/src/app/components/icons/goUSD.svg +5 -0
  895. package/src/app/components/icons/iUSD.svg +1 -0
  896. package/src/app/components/icons/pathUSD.svg +25 -0
  897. package/src/app/components/icons/rUSD.svg +1 -0
  898. package/src/app/components/icons/reUSD.svg +1 -0
  899. package/src/app/components/icons/sUSDe.svg +1 -0
  900. package/src/app/components/icons/siUSD.svg +1 -0
  901. package/src/app/components/icons/stcUSD.svg +1 -0
  902. package/src/app/components/icons/syrupUSDC.svg +5 -0
  903. package/src/app/components/icons/thetaUSD.svg +1 -0
  904. package/src/app/components/icons/wYLDS.svg +10 -0
  905. package/src/app/components/icons/wsrUSD.svg +1 -0
  906. package/src/app/components/logos/OUSD.dark.svg +17 -0
  907. package/src/app/components/logos/OUSD.light.svg +17 -0
  908. package/src/app/coverage.server.ts +73 -0
  909. package/src/app/coverage.ts +69 -0
  910. package/src/app/crons/cleanup.ts +104 -0
  911. package/src/app/db/auth.ts +440 -0
  912. package/src/app/db/migrations/0000_better_auth.sql +53 -0
  913. package/src/app/db/migrations/0001_oauth_provider.sql +162 -0
  914. package/src/app/db/migrations/0002_device_code.sql +17 -0
  915. package/src/app/db/migrations/0003_realms.sql +27 -0
  916. package/src/app/db/migrations/0004_default_realm.sql +2 -0
  917. package/src/app/db/migrations/0005_passkeys.sql +30 -0
  918. package/src/app/db/migrations/0006_first_accounts.sql +9 -0
  919. package/src/app/db/migrations/0007_pending_keys.sql +13 -0
  920. package/src/app/db/migrations/0008_secp256k1_owners.sql +18 -0
  921. package/src/app/db/migrations/0009_device_requests.sql +8 -0
  922. package/src/app/db/migrations/0010_device_keys.sql +4 -0
  923. package/src/app/db/migrations/0011_registered_passkeys.sql +2 -0
  924. package/src/app/db/migrations/0012_passkey_accounts.sql +7 -0
  925. package/src/app/db/migrations/0013_first_party_apps.sql +4 -0
  926. package/src/app/db/migrations/0014_logout_revokes_tokens.sql +17 -0
  927. package/src/app/db/migrations/0015_expiry_indexes.sql +9 -0
  928. package/src/app/db/migrations/0016_configurable_accounts.sql +15 -0
  929. package/src/app/db/migrations/0017_account_config_keys.sql +3 -0
  930. package/src/app/db/migrations/0018_better_auth_1_8.sql +9 -0
  931. package/src/app/db/migrations/0019_drop_provider_account_index.sql +1 -0
  932. package/src/app/db/migrations/meta/0000_snapshot.json +362 -0
  933. package/src/app/db/migrations/meta/0001_snapshot.json +1487 -0
  934. package/src/app/db/migrations/meta/0002_snapshot.json +1603 -0
  935. package/src/app/db/migrations/meta/0003_snapshot.json +1760 -0
  936. package/src/app/db/migrations/meta/0004_snapshot.json +1760 -0
  937. package/src/app/db/migrations/meta/0005_snapshot.json +1911 -0
  938. package/src/app/db/migrations/meta/0006_snapshot.json +1967 -0
  939. package/src/app/db/migrations/meta/0007_snapshot.json +2047 -0
  940. package/src/app/db/migrations/meta/0008_snapshot.json +2157 -0
  941. package/src/app/db/migrations/meta/0009_snapshot.json +2207 -0
  942. package/src/app/db/migrations/meta/0010_snapshot.json +2231 -0
  943. package/src/app/db/migrations/meta/0011_snapshot.json +2231 -0
  944. package/src/app/db/migrations/meta/0012_snapshot.json +2231 -0
  945. package/src/app/db/migrations/meta/0013_snapshot.json +2231 -0
  946. package/src/app/db/migrations/meta/0014_snapshot.json +2231 -0
  947. package/src/app/db/migrations/meta/0015_snapshot.json +2375 -0
  948. package/src/app/db/migrations/meta/0016_snapshot.json +2475 -0
  949. package/src/app/db/migrations/meta/0017_snapshot.json +2481 -0
  950. package/src/app/db/migrations/meta/0018_snapshot.json +2535 -0
  951. package/src/app/db/migrations/meta/0019_snapshot.json +2514 -0
  952. package/src/app/db/migrations/meta/_journal.json +146 -0
  953. package/src/app/db/schema.ts +241 -0
  954. package/src/app/db/table.ts +31 -0
  955. package/src/app/env.ts +57 -0
  956. package/src/app/inbox.ts +190 -0
  957. package/src/app/lib/Client.ts +82 -0
  958. package/src/app/lib/Inbox.ts +11 -0
  959. package/src/app/lib/Loader.ts +21 -0
  960. package/src/app/lib/Upgrade.ts +221 -0
  961. package/src/app/package.json +8 -0
  962. package/src/app/public/_headers +4 -0
  963. package/src/app/routeTree.gen.ts +219 -0
  964. package/src/app/router.tsx +47 -0
  965. package/src/app/routes/[_].flows.tsx +4254 -0
  966. package/src/app/routes/__root.tsx +172 -0
  967. package/src/app/routes/authorize.tsx +379 -0
  968. package/src/app/routes/choose-account.tsx +144 -0
  969. package/src/app/routes/deposit.tsx +107 -0
  970. package/src/app/routes/device.tsx +273 -0
  971. package/src/app/routes/error.tsx +62 -0
  972. package/src/app/routes/index.tsx +511 -0
  973. package/src/app/routes/login.tsx +577 -0
  974. package/src/app/screens/Account.tsx +559 -0
  975. package/src/app/screens/Approval.tsx +444 -0
  976. package/src/app/screens/ChooseAccount.tsx +206 -0
  977. package/src/app/screens/Deposit.tsx +523 -0
  978. package/src/app/screens/DeviceApproval.tsx +500 -0
  979. package/src/app/screens/NotFound.tsx +62 -0
  980. package/src/app/screens/SignIn.tsx +372 -0
  981. package/src/app/screens/WalletUpgrade.tsx +121 -0
  982. package/src/app/screens/chains/base.svg +3 -0
  983. package/src/app/screens/chains/ethereum.svg +11 -0
  984. package/src/app/screens/chains/solana.svg +4 -0
  985. package/src/app/screens/chains/tempo.svg +4 -0
  986. package/src/app/server.ts +342 -0
  987. package/src/app/vite.config.ts +128 -0
  988. package/src/app/void.config.ts +36 -0
  989. package/src/app/wallet.ts +69 -0
  990. package/src/app/zyzz.config.ts +52 -0
  991. package/src/cli/Admin.ts +74 -0
  992. package/src/cli/Apps.ts +27 -0
  993. package/src/cli/Cli.ts +41 -0
  994. package/src/cli/Project.ts +119 -0
  995. package/src/cli/Realms.ts +49 -0
  996. package/src/cli/Session.ts +290 -0
  997. package/src/cli/User.ts +40 -0
  998. package/src/cli/V1.ts +54 -0
  999. package/src/cli/bin.ts +44 -0
  1000. package/src/cli/commands/admin/apps/create.ts +96 -0
  1001. package/src/cli/commands/admin/apps/delete.ts +38 -0
  1002. package/src/cli/commands/admin/apps/index.ts +15 -0
  1003. package/src/cli/commands/admin/apps/list.ts +25 -0
  1004. package/src/cli/commands/admin/apps/rotate-secret.ts +47 -0
  1005. package/src/cli/commands/admin/apps/update.ts +79 -0
  1006. package/src/cli/commands/admin/index.ts +14 -0
  1007. package/src/cli/commands/admin/migrate.ts +19 -0
  1008. package/src/cli/commands/admin/realms/add.ts +40 -0
  1009. package/src/cli/commands/admin/realms/index.ts +14 -0
  1010. package/src/cli/commands/admin/realms/list.ts +38 -0
  1011. package/src/cli/commands/admin/realms/passkeys/index.ts +15 -0
  1012. package/src/cli/commands/admin/realms/passkeys/set.ts +44 -0
  1013. package/src/cli/commands/admin/realms/privy/index.ts +14 -0
  1014. package/src/cli/commands/admin/realms/privy/set.ts +69 -0
  1015. package/src/cli/commands/admin/realms/remove.ts +33 -0
  1016. package/src/cli/commands/admin/realms/secp256k1/disable.ts +40 -0
  1017. package/src/cli/commands/admin/realms/secp256k1/enable.ts +40 -0
  1018. package/src/cli/commands/admin/realms/secp256k1/index.ts +19 -0
  1019. package/src/cli/commands/admin/realms/set.ts +46 -0
  1020. package/src/cli/commands/admin/rotate-key.ts +47 -0
  1021. package/src/cli/commands/init.ts +42 -0
  1022. package/src/cli/commands/login.ts +32 -0
  1023. package/src/cli/commands/logout.ts +19 -0
  1024. package/src/cli/commands/whoami.ts +23 -0
  1025. package/src/client/Actions.ts +180 -0
  1026. package/src/client/Auth.ts +267 -0
  1027. package/src/client/Authorization.ts +34 -0
  1028. package/src/client/Decorator.ts +444 -0
  1029. package/src/client/Key.ts +137 -0
  1030. package/src/client/Pending.ts +45 -0
  1031. package/src/client/Permissions.ts +41 -0
  1032. package/src/client/Storage.ts +29 -0
  1033. package/src/client/TempoAccount.ts +55 -0
  1034. package/src/client/Tokens.ts +27 -0
  1035. package/src/client/User.ts +23 -0
  1036. package/src/client/actions/account.ts +171 -0
  1037. package/src/client/actions/device.ts +166 -0
  1038. package/src/client/actions/email.ts +164 -0
  1039. package/src/client/actions/oauth.ts +179 -0
  1040. package/src/client/actions/passkey.ts +333 -0
  1041. package/src/client/actions/realm.ts +37 -0
  1042. package/src/client/actions/redirect.ts +502 -0
  1043. package/src/client/internal/accessKey.ts +54 -0
  1044. package/src/client/internal/account.ts +18 -0
  1045. package/src/client/internal/api.ts +242 -0
  1046. package/src/client/internal/headless.ts +308 -0
  1047. package/src/client/internal/indexedDb.ts +44 -0
  1048. package/src/client/internal/request.ts +70 -0
  1049. package/src/client/internal/store.ts +20 -0
  1050. package/src/client/internal/verifier.ts +75 -0
  1051. package/src/client.ts +17 -0
  1052. package/src/index.ts +5 -0
  1053. package/src/internal/Apps.ts +1283 -0
  1054. package/src/internal/Auth.ts +273 -0
  1055. package/src/internal/Authorize.ts +433 -0
  1056. package/src/internal/Balance.ts +144 -0
  1057. package/src/internal/BodyLimit.ts +31 -0
  1058. package/src/internal/Cache.ts +119 -0
  1059. package/src/internal/Chain.ts +99 -0
  1060. package/src/internal/ChainList.ts +270 -0
  1061. package/src/internal/ChainName.ts +14 -0
  1062. package/src/internal/ChainStatus.ts +65 -0
  1063. package/src/internal/CodeEmail.ts +138 -0
  1064. package/src/internal/ConfigurableAccount.ts +1315 -0
  1065. package/src/internal/Device.ts +471 -0
  1066. package/src/internal/Env.ts +92 -0
  1067. package/src/internal/ErrorResponse.ts +896 -0
  1068. package/src/internal/Faucet.ts +43 -0
  1069. package/src/internal/Id.ts +41 -0
  1070. package/src/internal/KeyAuthorization.ts +1536 -0
  1071. package/src/internal/Limits.ts +40 -0
  1072. package/src/internal/Log.ts +166 -0
  1073. package/src/internal/LogLine.ts +81 -0
  1074. package/src/internal/Logout.ts +356 -0
  1075. package/src/internal/Migrations.ts +120 -0
  1076. package/src/internal/OpenApi.ts +300 -0
  1077. package/src/internal/Owner.ts +310 -0
  1078. package/src/internal/Passkey.ts +1904 -0
  1079. package/src/internal/PendingKey.ts +104 -0
  1080. package/src/internal/Privy.ts +536 -0
  1081. package/src/internal/RateLimit.ts +346 -0
  1082. package/src/internal/Realm.ts +814 -0
  1083. package/src/internal/RequestId.ts +118 -0
  1084. package/src/internal/SignInGrant.ts +175 -0
  1085. package/src/internal/SigningKey.ts +319 -0
  1086. package/src/internal/TempoAccount.ts +545 -0
  1087. package/src/internal/TestInbox.ts +51 -0
  1088. package/src/internal/Timing.ts +172 -0
  1089. package/src/internal/Validation.ts +52 -0
  1090. package/src/internal/Verification.ts +58 -0
  1091. package/src/internal/Wallet.ts +101 -0
  1092. package/src/internal/owners/Passkey.ts +76 -0
  1093. package/src/internal/owners/Privy.ts +82 -0
  1094. package/src/internal/owners/Secp256k1.ts +139 -0
  1095. package/src/types/app.d.ts +39 -0
  1096. package/src/worker.ts +17 -0
@@ -0,0 +1,532 @@
1
+ import{a as e,i as t,n,r,t as i}from"./assets/rolldown-runtime-BWaJ3C7D.js";/* empty css */import{t as a}from"./assets/reset-DZWeTZeQ.js";import{a as o,c as s,d as c,f as l,i as u,l as d,n as f,o as p,p as m,r as h,s as g,t as _,u as v}from"./assets/cookie-DxViaO10.js";import{$ as y,$t as b,A as x,An as S,At as C,Bt as w,Cn as T,Ct as E,D,Dn as ee,Dt as te,E as ne,En as re,Et as ie,Fn as ae,Ft as O,G as oe,Gt as se,H as ce,It as le,J as ue,Jt as de,K as fe,Kt as pe,L as me,Ln as he,Lt as ge,M as _e,Mt as ve,N as ye,Nn as be,Nt as xe,O as Se,On as Ce,Ot as we,Pn as Te,Pt as Ee,Q as De,Qt as Oe,Rn as ke,Rt as Ae,S as je,Sn as Me,St as Ne,Tn as Pe,Tt as Fe,W as Ie,Wt as Le,X as Re,Y as ze,Yt as Be,Z as Ve,_n as He,_t as Ue,an as We,at as Ge,b as Ke,bn as qe,bt as Je,c as Ye,cn as Xe,ct as Ze,d as Qe,dn as $e,dt as et,en as tt,et as nt,f as rt,fn as it,ft as at,g as ot,gn as st,gt as ct,hn as lt,ht as ut,i as dt,in as ft,it as pt,j as mt,jn as ht,jt as gt,k as _t,kn as vt,kt as yt,ln as bt,lt as xt,mn as St,mt as Ct,nn as wt,nt as Tt,o as Et,on as Dt,ot as Ot,pn as kt,pt as At,q as jt,qt as Mt,rn as Nt,rt as Pt,s as Ft,sn as It,st as Lt,t as Rt,tn as zt,tt as Bt,u as Vt,un as Ht,ut as Ut,v as Wt,vn as Gt,vt as Kt,w as qt,wn as Jt,wt as Yt,xn as Xt,xt as Zt,y as Qt,yn as $t,yt as en,z as tn,zn as nn,zt as rn}from"./assets/ExecutionError-CDszGSF1.js";import{A as an,D as on,F as sn,M as cn,O as ln,R as un,S as k,T as dn,_ as fn,h as pn,i as mn,j as hn,k as gn,o as _n,t as vn,v as yn,w as bn,x as xn}from"./assets/Bytes-C7CRVS3J.js";import{H as Sn,K as Cn,V as wn,W as Tn,X as En,Y as Dn,Z as On,z as kn}from"./assets/utils-C4ZXZIZW.js";import{a as An,c as jn,o as Mn,s as Nn,t as Pn}from"./assets/secp256k1-yg8eeIYU.js";import{A as Fn,B as In,C as Ln,D as Rn,E as zn,F as Bn,H as Vn,K as Hn,N as Un,S as Wn,T as Gn,V as Kn,W as qn,b as Jn,d as Yn,f as Xn,i as Zn,k as Qn,n as $n,p as er,q as tr,r as nr,s as rr,u as ir,v as ar,w as or,x as sr}from"./assets/Authentication-BOkhlNQu.js";import{A as cr,B as lr,C as ur,Ct as dr,Dt as fr,F as pr,Ft as mr,Gt as hr,It as gr,L as _r,Lt as vr,M as yr,Mt as br,N as xr,O as Sr,Ot as Cr,P as wr,Pt as Tr,Q as Er,R as Dr,S as Or,T as kr,Tt as Ar,X as jr,Y as Mr,Z as Nr,_ as Pr,a as Fr,an as Ir,b as Lr,bt as Rr,dt as zr,f as Br,g as Vr,h as Hr,it as Ur,j as Wr,jt as Gr,k as Kr,l as qr,m as Jr,mt as Yr,n as Xr,ot as Zr,p as Qr,r as $r,rn as ei,sn as ti,t as ni,u as ri,ut as ii,v as ai,wt as oi,x as si,xt as ci,y as li,yt as ui}from"./assets/call-dzi0xjZd.js";import{t as di}from"./assets/Credential-DFjcrdyI.js";import{A as fi,At as pi,C as mi,Ct as A,Dt as j,Et as hi,F as gi,H as _i,I as vi,L as yi,M as bi,N as xi,O as Si,Ot as Ci,P as wi,St as Ti,Tt as Ei,V as Di,W as Oi,X as ki,_ as Ai,a as ji,b as M,bt as Mi,ct as Ni,dt as Pi,ft as Fi,g as Ii,gt as Li,h as Ri,ht as zi,i as Bi,j as Vi,jt as Hi,kt as Ui,l as Wi,lt as Gi,m as Ki,mt as qi,nt as Ji,o as Yi,pt as Xi,s as Zi,st as Qi,t as $i,u as ea,ut as ta,v as na,w as ra,wt as ia,x as N,y as aa,yt as oa}from"./assets/get-id-field-OwLpfjj2.js";import{$ as sa,$t as ca,A as la,At as ua,B as da,Bt as fa,C as pa,Cn as ma,Ct as ha,D as ga,Dt as _a,E as va,Et as ya,F as ba,Ft as xa,G as Sa,Gt as Ca,H as wa,Ht as Ta,I as Ea,It as Da,J as Oa,Jt as ka,K as Aa,Kt as ja,L as Ma,Lt as Na,M as Pa,Mt as Fa,N as Ia,Nt as La,O as Ra,Ot as za,P as Ba,Pt as Va,Q as Ha,Qt as P,R as Ua,Rt as Wa,S as Ga,Sn as Ka,St as qa,T as Ja,Tt as Ya,U as Xa,Ut as Za,V as Qa,Vt as $a,W as eo,Wt as to,X as no,Xt as ro,Y as io,Yt as ao,Z as oo,Zt as so,_ as co,_n as lo,_t as uo,a as fo,an as po,at as mo,b as ho,bn as go,bt as _o,c as vo,cn as yo,ct as bo,d as xo,dn as So,dt as Co,en as wo,et as To,f as Eo,fn as Do,ft as Oo,g as ko,gn as Ao,gt as jo,h as Mo,hn as No,ht as Po,i as Fo,in as Io,it as Lo,j as Ro,jt as zo,k as Bo,kt as Vo,l as Ho,ln as Uo,lt as Wo,m as Go,mn as Ko,mt as qo,n as Jo,nn as Yo,nt as Xo,o as Zo,on as Qo,ot as $o,p as es,pn as ts,pt as ns,q as rs,qt as is,r as as,rn as os,rt as ss,s as cs,sn as ls,st as us,t as ds,tn as fs,tt as ps,u as ms,un as hs,ut as gs,v as _s,vn as vs,vt as ys,w as bs,wn as xs,wt as Ss,x as Cs,xn as ws,xt as Ts,y as Es,yn as Ds,yt as Os,z as ks,zt as As}from"./assets/authorize-DXYo-K2n-rmQQ42x1.js";import{a as js,c as Ms,i as Ns,l as Ps,n as Fs,o as Is,r as Ls,s as Rs,t as zs,u as Bs}from"./assets/schema-check-oLqvHR8y.js";import{n as Vs,r as Hs,t as Us}from"./assets/factory-dvoOlKer.js";import{a as Ws,c as Gs,i as Ks,l as qs,n as Js,o as Ys,r as Xs,s as Zs,t as Qs,u as $s}from"./assets/ChainList-C4A_7e-9.js";import{t as ec}from"./assets/decodeFunctionData-bP6V2ai4.js";import{t as tc}from"./assets/ChainName-BMnJyJrd.js";import{n as nc}from"./assets/index-CLddUTqr-CC33CMvS.js";import"./assets/dist-CR6FW-yS.js";import{n as rc}from"./assets/index-DZEfthgZ-Ec2MMQ_e.js";import{c as ic}from"./assets/sqlite-introspector-DSCAP82F-Crx7Ny14.js";import{i as ac,n as oc,o as sc,r as cc,s as lc,t as uc}from"./assets/dist-CoH0hD1s.js";import"cloudflare:workers";import{AsyncLocalStorage as dc}from"node:async_hooks";import fc,{randomBytes as pc,scrypt as mc}from"node:crypto";import hc from"node:events";import gc from"node:util";import _c from"node:util/types";import vc from"node:dns";import yc from"node:fs";import bc from"node:net";import xc from"node:tls";import Sc from"node:path";import Cc from"node:stream";import wc from"node:string_decoder";function Tc(e){return Error(`[unenv] ${e} is not implemented yet!`)}var Ec=globalThis.performance?.timeOrigin??Date.now(),Dc=globalThis.performance?.now?globalThis.performance.now.bind(globalThis.performance):()=>Date.now()-Ec,Oc={name:`node`,entryType:`node`,startTime:0,duration:0,nodeStart:0,v8Start:0,bootstrapComplete:0,environment:0,loopStart:0,loopExit:0,idleTime:0,uvMetricsInfo:{loopCount:0,events:0,eventsWaiting:0},detail:void 0,toJSON(){return this}},kc=class{__unenv__=!0;detail;entryType=`event`;name;startTime;constructor(e,t){this.name=e,this.startTime=t?.startTime||Dc(),this.detail=t?.detail}get duration(){return Dc()-this.startTime}toJSON(){return{name:this.name,entryType:this.entryType,startTime:this.startTime,duration:this.duration,detail:this.detail}}},Ac=class extends kc{entryType=`mark`;constructor(){super(...arguments)}get duration(){return 0}},jc=class extends kc{entryType=`measure`},Mc=class extends kc{entryType=`resource`;serverTiming=[];connectEnd=0;connectStart=0;decodedBodySize=0;domainLookupEnd=0;domainLookupStart=0;encodedBodySize=0;fetchStart=0;initiatorType=``;name=``;nextHopProtocol=``;redirectEnd=0;redirectStart=0;requestStart=0;responseEnd=0;responseStart=0;secureConnectionStart=0;startTime=0;transferSize=0;workerStart=0;responseStatus=0},Nc=class{__unenv__=!0;getEntries(){return[]}getEntriesByName(e,t){return[]}getEntriesByType(e){return[]}},Pc=class{__unenv__=!0;timeOrigin=Ec;eventCounts=new Map;_entries=[];_resourceTimingBufferSize=0;navigation=void 0;timing=void 0;timerify(e,t){throw Tc(`Performance.timerify`)}get nodeTiming(){return Oc}eventLoopUtilization(){return{}}markResourceTiming(){return new Mc(``)}onresourcetimingbufferfull=null;now(){return this.timeOrigin===Ec?Dc():Date.now()-this.timeOrigin}clearMarks(e){this._entries=e?this._entries.filter(t=>t.name!==e):this._entries.filter(e=>e.entryType!==`mark`)}clearMeasures(e){this._entries=e?this._entries.filter(t=>t.name!==e):this._entries.filter(e=>e.entryType!==`measure`)}clearResourceTimings(){this._entries=this._entries.filter(e=>e.entryType!==`resource`||e.entryType!==`navigation`)}getEntries(){return this._entries}getEntriesByName(e,t){return this._entries.filter(n=>n.name===e&&(!t||n.entryType===t))}getEntriesByType(e){return this._entries.filter(t=>t.entryType===e)}mark(e,t){let n=new Ac(e,t);return this._entries.push(n),n}measure(e,t,n){let r,i;typeof t==`string`?(r=this.getEntriesByName(t,`mark`)[0]?.startTime,i=this.getEntriesByName(n,`mark`)[0]?.startTime):(r=Number.parseFloat(t?.start)||this.now(),i=Number.parseFloat(t?.end)||this.now());let a=new jc(e,{startTime:r,detail:{start:r,end:i}});return this._entries.push(a),a}setResourceTimingBufferSize(e){this._resourceTimingBufferSize=e}addEventListener(e,t,n){throw Tc(`Performance.addEventListener`)}removeEventListener(e,t,n){throw Tc(`Performance.removeEventListener`)}dispatchEvent(e){throw Tc(`Performance.dispatchEvent`)}toJSON(){return this}},Fc=class{__unenv__=!0;static supportedEntryTypes=[];_callback=null;constructor(e){this._callback=e}takeRecords(){return[]}disconnect(){throw Tc(`PerformanceObserver.disconnect`)}observe(e){throw Tc(`PerformanceObserver.observe`)}bind(e){return e}runInAsyncScope(e,t,...n){return e.call(t,...n)}asyncId(){return 0}triggerAsyncId(){return 0}emitDestroy(){return this}},Ic=globalThis.performance&&`addEventListener`in globalThis.performance?globalThis.performance:new Pc;if(!(`__unenv__`in Ic)){let e=Pc.prototype;for(let t of Object.getOwnPropertyNames(e))if(t!==`constructor`&&!(t in Ic)){let n=Object.getOwnPropertyDescriptor(e,t);n&&Object.defineProperty(Ic,t,n)}}globalThis.performance=Ic,globalThis.Performance=Pc,globalThis.PerformanceEntry=kc,globalThis.PerformanceMark=Ac,globalThis.PerformanceMeasure=jc,globalThis.PerformanceObserver=Fc,globalThis.PerformanceObserverEntryList=Nc,globalThis.PerformanceResourceTiming=Mc;var Lc=[`__VOID_`,`__PROJECT_`],Rc=[`ISR_CACHE`];function zc(e){return e.__VOID_ISR_DEPLOYMENT_ID!=null}var Bc=Symbol.for(`void.envContext.v1`),Vc=globalThis;Vc[Bc]??=new dc;var Hc=Vc[Bc],Uc;typeof navigator<`u`&&navigator.userAgent===`Cloudflare-Workers`&&import(`cloudflare:workers`).then(e=>{Uc=Wc(e.env)??void 0}).catch(()=>{});function Wc(e){return typeof e!=`object`||!e||`then`in e&&typeof e.then==`function`?null:e}function Gc(){return Wc(globalThis.__env__)}function Kc(){return Hc.getStore()??Gc()??Uc??(()=>{throw Error(`env: Cloudflare env is unavailable. Use void runtime bindings inside Nuxt/SvelteKit/Analog server request handlers or Worker handlers.`)})()}var qc=Symbol.for(`void.runtimeRequestScope.v1`),Jc=globalThis;Jc[qc]??=new dc;var Yc=Jc[qc];function Xc(e,t,n){let r=Yc.getStore();if(!r){if(n)return n();throw Error(`env: Request-scoped resource is unavailable outside a runtime handler.`)}if(r.resources.has(e))return r.resources.get(e);let i=t();return r.resources.set(e,i),i}function Zc(e,t){let n=Wc(e);if(!n)return t();if(Yc.getStore())return Hc.run(n,t);let r={resources:new Map};return Hc.run(n,()=>Yc.run(r,t))}function Qc(e,t){return Lc.some(t=>e.startsWith(t))?!0:zc(t)&&Rc.includes(e)}function $c(e){return new Proxy(e,{get(e,t,n){if(!(typeof t==`string`&&Qc(t,e)))return Reflect.get(e,t,n)},has(e,t){return typeof t==`string`&&Qc(t,e)?!1:Reflect.has(e,t)},ownKeys(e){return Reflect.ownKeys(e).filter(t=>typeof t!=`string`||!Qc(t,e))},getOwnPropertyDescriptor(e,t){if(!(typeof t==`string`&&Qc(t,e)))return Reflect.getOwnPropertyDescriptor(e,t)}})}function el(){return $c(Kc())}function tl(e){let t=Kc();if(!Qc(e,t))return t[e]}var nl=class extends Error{res;status;constructor(e=500,t){super(t?.message,{cause:t?.cause}),this.res=t?.res,this.status=e}getResponse(){return this.res?new Response(this.res.body,{status:this.status,headers:this.res.headers}):new Response(this.message,{status:this.status})}},rl=Symbol(),il=(e,t)=>new Response(e,{headers:{"Content-Type":t.replace(/^[^;]+/,e=>e.toLowerCase())}}).formData(),al=1e4,ol=e=>`headers`in e,sl=async(e,t=Object.create(null))=>{let{all:n=!1,dot:r=!1}=t,i=(ol(e)?e.headers:e.raw.headers).get(`Content-Type`)?.split(`;`)[0].trim().toLowerCase();return i===`multipart/form-data`||i===`application/x-www-form-urlencoded`?cl(e,{all:n,dot:r}):{}};async function cl(e,t){if(!ol(e)&&e.bodyCache.formData)return ll(await e.bodyCache.formData,t);let n=ol(e)?e.headers:e.raw.headers,r=il(await e.arrayBuffer(),n.get(`Content-Type`)||``);ol(e)||(e.bodyCache.formData=r);let i=await r;return i?ll(i,t):{}}function ll(e,t){let n=Object.create(null),r={count:0};return e.forEach((e,r)=>{t.all||r.endsWith(`[]`)?ul(n,r,e):n[r]=e}),t.dot&&Object.entries(n).forEach(([e,t])=>{e.includes(`.`)&&(dl(n,e,t,r),delete n[e])}),n}var ul=(e,t,n)=>{e[t]===void 0?e[t]=t.endsWith(`[]`)?[n]:n:Array.isArray(e[t])?e[t].push(n):e[t]=[e[t],n]},dl=(e,t,n,r)=>{if(/(?:^|\.)__proto__\./.test(t))return;let i=e,a=t.split(`.`,34);a.length>33&&fl(),a.forEach((e,t)=>{t===a.length-1?i[e]=n:((!i[e]||typeof i[e]!=`object`||Array.isArray(i[e])||i[e]instanceof File)&&(r.count++>=al&&fl(),i[e]=Object.create(null)),i=i[e])})},fl=()=>{throw Error(`Nesting limit exceeded`)},pl=class{raw;#e;#t;routeIndex=0;path;bodyCache={};constructor(e,t=`/`,n=[[]]){this.raw=e,this.path=t,this.#t=n}param(e){return e?this.#n(e):this.#r()}#n(e){let t=this.#t[0][this.routeIndex]?.[1][e],n=this.#i(t);return n&&m(n)}#r(){let e={},t=Object.keys(this.#t[0][this.routeIndex]?.[1]??{});for(let n of t){let t=this.#i(this.#t[0][this.routeIndex][1][n]);t!==void 0&&(e[n]=m(t))}return e}#i(e){return this.#t[1]?this.#t[1][e]:e}query(e){return s(this.url,e)}queries(e){return d(this.url,e)}header(e){if(e)return this.raw.headers.get(e)??void 0;let t=Object.create(null);return this.raw.headers.forEach((e,n)=>{t[n]=e}),t}async parseBody(e){return sl(this,e)}#a=e=>{let{bodyCache:t,raw:n}=this,r=t[e];if(r)return r;for(let r in t)return t[r].then(t=>{r===`json`&&(t=JSON.stringify(t));let i=r===`formData`?void 0:n.headers.get(`content-type`);return new Response(t,{headers:i?{"Content-Type":i}:void 0})[e]()});return t[e]=n[e]()};json(){return this.#a(`text`).then(e=>JSON.parse(e))}text(){return this.#a(`text`)}arrayBuffer(){return this.#a(`arrayBuffer`)}bytes(){return this.#a(`arrayBuffer`).then(e=>new Uint8Array(e))}blob(){return this.#a(`blob`)}formData(){return this.#a(`formData`)}addValidatedData(e,t){(this.#e??={})[e]=t}valid(e){return this.#e?.[e]}get url(){return this.raw.url}get method(){return this.raw.method}get[rl](){return this.#t}get matchedRoutes(){return this.#t[0].map(([[,e]])=>e)}get routePath(){return this.#t[0].map(([[,e]])=>e)[this.routeIndex].path}},ml={Stringify:1,BeforeStream:2,Stream:3},hl=(e,t)=>{let n=new String(e);return n.isEscaped=!0,n.callbacks=t,n},gl=async(e,t,n,r,i)=>{typeof e==`object`&&!(e instanceof String)&&(e instanceof Promise||(e=e.toString()),e instanceof Promise&&(e=await e));let a=e.callbacks;if(!a?.length)return Promise.resolve(e);i?i[0]+=e:i=[e];let o=Promise.all(a.map(e=>e({phase:t,buffer:i,context:r}))).then(e=>Promise.all(e.filter(Boolean).map(e=>gl(e,t,!1,r,i))).then(()=>i[0]));return n?hl(await o,a):o},_l=`text/plain; charset=UTF-8`,vl=(e,t)=>({"Content-Type":e,...t}),yl=(e,t)=>new Response(e,t),bl=class{#e;#t;env={};#n;finalized=!1;error;#r;#i;#a;#o;#s;#c;#l;#u;#d;constructor(e,t){this.#e=e,t&&(this.#i=t.executionCtx,this.env=t.env,this.#c=t.notFoundHandler,this.#d=t.path,this.#u=t.matchResult)}get req(){return this.#t??=new pl(this.#e,this.#d,this.#u),this.#t}get event(){if(this.#i&&`respondWith`in this.#i)return this.#i;throw Error(`This context has no FetchEvent`)}get executionCtx(){if(this.#i)return this.#i;throw Error(`This context has no ExecutionContext`)}get res(){return this.#a||=yl(null,{headers:this.#l??=new Headers})}set res(e){if(this.#a&&e){e=yl(e.body,e);for(let[t,n]of this.#a.headers.entries())if(t!==`content-type`){if(t===`set-cookie`){let t=this.#a.headers.getSetCookie();e.headers.delete(`set-cookie`);for(let n of t)e.headers.append(`set-cookie`,n)}else e.headers.set(t,n)}}this.#a=e,this.finalized=!0}render=(...e)=>(this.#s??=e=>this.html(e),this.#s(...e));setLayout=e=>this.#o=e;getLayout=()=>this.#o;setRenderer=e=>{this.#s=e};header=(e,t,n)=>{this.finalized&&(this.#a=yl(this.#a.body,this.#a));let r=this.#a?this.#a.headers:this.#l??=new Headers;t===void 0?r.delete(e):n?.append?r.append(e,t):r.set(e,t)};status=e=>{this.#r=e};set=(e,t)=>{this.#n??=new Map,this.#n.set(e,t)};get=e=>this.#n?this.#n.get(e):void 0;get var(){return this.#n?Object.fromEntries(this.#n):{}}#f(e,t,n){let r=this.#a?new Headers(this.#a.headers):this.#l;if(typeof t==`object`&&t.headers){r??=new Headers;for(let[e,n]of new Headers(t.headers))e===`set-cookie`?r.append(e,n):r.set(e,n)}if(n){if(!r){let e=0;for(let t in n)if(++e>1||typeof n[t]!=`string`){r=new Headers;break}}if(r)for(let e in n){let t=n[e];if(typeof t==`string`)r.set(e,t);else{r.delete(e);for(let n of t)r.append(e,n)}}}return yl(e,{status:typeof t==`number`?t:t?.status??this.#r,headers:r??n})}newResponse=(...e)=>this.#f(...e);body=(e,t,n)=>this.#f(e,t,n);text=(e,t,n)=>!this.#l&&!this.#r&&!t&&!n&&!this.finalized?new Response(e):this.#f(e,t,vl(_l,n));json=(e,t,n)=>this.#f(JSON.stringify(e),t,vl(`application/json`,n));html=(e,t,n)=>{let r=e=>this.#f(e,t,vl(`text/html; charset=UTF-8`,n));return typeof e==`object`?gl(e,ml.Stringify,!1,{}).then(r):r(e)};redirect=(e,t)=>{let n=String(e);return this.header(`Location`,/[^\x00-\xFF]/.test(n)?encodeURI(n):n),this.newResponse(null,t??302)};notFound=()=>(this.#c??=()=>yl(),this.#c(this))},xl=(e,t,n)=>(r,i)=>{let a=-1;return o(0);async function o(s){if(s<=a)throw Error(`next() called multiple times`);a=s;let c,l=!1,u;if(e[s]?(u=e[s][0][0],r.req.routeIndex=s):u=s===e.length&&i||void 0,u)try{c=await u(r,()=>o(s+1))}catch(e){if(e instanceof Error&&t)r.error=e,c=await t(e,r),l=!0;else throw e}else r.finalized===!1&&n&&(c=await n(r));return c&&(r.finalized===!1||l)&&(r.res=c),r}},Sl=[`get`,`post`,`put`,`delete`,`options`,`patch`,`query`],Cl=`Can not add a route since the matcher is already built.`,wl=class extends Error{},Tl=`__COMPOSED_HANDLER`,El=e=>e.text(`404 Not Found`,404),Dl=(e,t)=>{if(`getResponse`in e){let n=e.getResponse();return t.newResponse(n.body,n)}return console.error(e),t.text(`Internal Server Error`,500)},Ol=class e{get;post;put;delete;options;patch;query;all;on;use;router;getPath;_basePath=`/`;#e=`/`;routes=[];constructor(e={}){[...Sl,`all`].forEach(e=>{this[e]=(t,...n)=>{let r=e.toUpperCase();return typeof t==`string`?this.#e=t:this.#r(r,this.#e,t),n.forEach(e=>{this.#r(r,this.#e,e)}),this}}),this.on=(e,t,...n)=>{for(let r of[t].flat()){this.#e=r;for(let t of[e].flat()){let e=t.toUpperCase();for(let t of n)this.#r(e,this.#e,t)}}return this},this.use=(e,...t)=>(typeof e==`string`?this.#e=e:(this.#e=`*`,t.unshift(e)),t.forEach(e=>{this.#r(`ALL`,this.#e,e)}),this);let{strict:t,...n}=e;Object.assign(this,n),this.getPath=t??!0?e.getPath??o:p}#t(){let t=new e({router:this.router,getPath:this.getPath});return t.errorHandler=this.errorHandler,t.#n=this.#n,t.routes=this.routes,t}#n=El;errorHandler=Dl;route(e,t){let n=this.basePath(e);return t.routes.map(e=>{let r;t.errorHandler===Dl?r=e.handler:(r=async(n,r)=>(await xl([],t.errorHandler)(n,()=>e.handler(n,r))).res,r[Tl]=e.handler),n.#r(e.method,e.path,r,e.basePath)}),this}basePath(e){let t=this.#t();return t._basePath=v(this._basePath,e),t}onError=e=>(this.errorHandler=e,this);notFound=e=>(this.#n=e,this);mount(e,t,n){let r,i;n&&(typeof n==`function`?i=n:(i=n.optionHandler,r=n.replaceRequest===!1?e=>e:n.replaceRequest));let a=i?e=>{let t=i(e);return Array.isArray(t)?t:[t]}:e=>{let t;try{t=e.executionCtx}catch{}return[e.env,t]};return r||=(()=>{let t=v(this._basePath,e),n=t===`/`?0:t.length;return e=>{let t=new URL(e.url);return t.pathname=this.getPath(e).slice(n)||`/`,new Request(t,e)}})(),this.#r(`ALL`,v(e,`*`),async(e,n)=>{let i=await t(r(e.req.raw),...a(e));if(i)return i;await n()}),this}#r(e,t,n,r){t=v(this._basePath,t);let i={basePath:r===void 0?this._basePath:v(this._basePath,r),path:t,method:e,handler:n};this.router.add(e,t,[n,i]),this.routes.push(i)}#i(e,t){if(e instanceof Error)return this.errorHandler(e,t);throw e}#a(e,t,n,r){if(r===`HEAD`)return(async()=>new Response(null,await this.#a(e,t,n,`GET`)))();let i=this.getPath(e,{env:n}),a=this.router.match(r,i),o=new bl(e,{path:i,matchResult:a,env:n,executionCtx:t,notFoundHandler:this.#n});if(a[0].length===1){let e;try{e=a[0][0][0][0](o,async()=>{o.res=await this.#n(o)})}catch(e){return this.#i(e,o)}return e instanceof Promise?e.then(e=>e||(o.finalized?o.res:this.#n(o))).catch(e=>this.#i(e,o)):e??this.#n(o)}let s=xl(a[0],this.errorHandler,this.#n);return(async()=>{try{let e=await s(o);if(!e.finalized)throw Error("Context is not finalized. Did you forget to return a Response object or `await next()`?");return e.res}catch(e){return this.#i(e,o)}})()}fetch=(e,...t)=>this.#a(e,t[1],t[0],e.method);request=(e,t,n,r)=>e instanceof Request?this.fetch(t?new Request(e,t):e,n,r):(e=e.toString(),this.fetch(new Request(/^https?:\/\//.test(e)?e:`http://localhost${v(`/`,e)}`,t),n,r));fire=()=>{addEventListener(`fetch`,e=>{e.respondWith(this.#a(e.request,e,void 0,e.request.method))})}},kl=()=>Object.create(null),Al=[];function jl(e,t){let n=this.buildAllMatchers(),r=((e,t)=>{let r=n[e]||n.ALL,i=r[2][t];if(i)return i;let a=t.match(r[0]);if(!a)return[[],Al];let o=a.indexOf(``,1);return[r[1][o],a]});return this.match=r,r(e,t)}var Ml=`[^/]+`,Nl=`(?:|/.*)`,Pl=Symbol(),Fl=new Set(`.\\+*[^]$()`);function Il(e,t){return e.length===1?t.length===1?e<t?-1:1:-1:t.length===1?1:e===`.*`||e===`(?:|/.*)`?t===`(?:|/.*)`?-1:1:t===`.*`||t===`(?:|/.*)`?-1:e===`[^/]+`?1:t===`[^/]+`?-1:e.length===t.length?e<t?-1:1:t.length-e.length}var Ll=class e{#e;#t;#n=kl();insert(t,n,r,i,a){let o=this;for(let n=0,a=t.length;n<a;n++){let s=t[n],c=s.length===1?s===`*`?n===a-1?[``,``,`.*`]:[``,``,Ml]:null:s===`/*`?[``,``,Nl]:s.match(/^\:([^\{\}]+)(?:\{(.+)\})?$/),l;if(c){let t=c[1],n=c[2]||`[^/]+`;if(t&&c[2]&&(n===`.*`||(n=n.replace(/^\((?!\?:)(?=[^)]+\)$)/,`(?:`),/\((?!\?:)/.test(n))||n.length===1&&Fl.has(n)))throw Pl;if(l=o.#n[n],!l){if(n!==`.*`&&n!==`(?:|/.*)`){for(let e in o.#n)if((n.length>1||e.length>1)&&e!==`.*`&&e!==`(?:|/.*)`)throw Pl}l=o.#n[n]=new e}t!==``&&(l.#t??=i.varIndex++,r.push([t,l.#t]))}else if(l=o.#n[s],!l){for(let e in o.#n)if(e.length>1&&e!==`.*`&&e!==`(?:|/.*)`)throw Pl;l=o.#n[s]=new e}o=l}if(o.#e!==void 0)throw Pl;o.#e=a?-1:n}buildRegExpStr(){let e=Object.keys(this.#n).sort(Il).map(e=>{let t=this.#n[e],n=t.buildRegExpStr();return n===``?``:(typeof t.#t==`number`?`(${e})@${t.#t}`:Fl.has(e)?`\\${e}`:e)+n}).filter(Boolean);return typeof this.#e==`number`&&this.#e!==-1&&e.unshift(`#${this.#e}`),e.length===0?``:e.length===1?e[0]:`(?:`+e.join(`|`)+`)`}},Rl=class{#e={varIndex:0};#t=new Ll;#n=0;paths=kl();insert(e,t){if(t){this.#t.insert(e.split(``),0,[],this.#e,!0);return}let n=[],r=[],i=e;for(let e=0;;){let t=!1;if(i=i.replace(/\{[^}]+\}/g,n=>{let i=`@\\${e}`;return r[e]=[i,n],e++,t=!0,i}),!t)break}let a=i.match(/(?::[^\/]+)|(?:\/\*$)|./g)||[];for(let e=r.length-1;e>=0;e--){let[t]=r[e];for(let n=a.length-1;n>=0;n--)if(a[n].indexOf(t)!==-1){a[n]=a[n].replace(t,r[e][1]);break}}this.#t.insert(a,this.#n,n,this.#e,!1),this.paths[e]=[this.#n++,n]}buildRegExp(){let e=this.#t.buildRegExpStr();if(e===``)return[/^$/,[],[]];let t=0,n=[],r=[];return e=e.replace(/#(\d+)|@(\d+)|\.\*\$/g,(e,i,a)=>i===void 0?(a===void 0||(r[Number(a)]=++t),``):(n[++t]=Number(i),`$()`)),[RegExp(`^${e}`),n,r]}},zl=kl();function Bl(e){return zl[e]??=RegExp(`^${e.replace(/\/:[^/{}]+(?:\{\[\^\/]\+})?(?=[/{]|$)|\/?\*$|([.\\+*[^\]$()?{}|])/g,(e,t)=>t?`\\${t}`:e===`/*`?Nl:e===`*`?`.*`:`/:${Ml}`)}$`)}function Vl(e,t){for(let n of Object.keys(e).sort((e,t)=>t.length-e.length))if(Bl(n).test(t))return[...e[n]]}var Hl=class{name=`RegExpRouter`;#e;#t;#n;constructor(){this.#e={ALL:kl()},this.#t={ALL:kl()},this.#n={ALL:new Rl}}#r(e,t){try{this.#n[e].insert(t,!/\*|\/:/.test(t))}catch(e){throw e===Pl?new wl(t):e}}add(e,t,n){let r=this.#e,i=this.#t;if(!r)throw Error(Cl);if(!r[e]){this.#n[e]=new Rl;for(let t of[r,i]){t[e]=kl();for(let n in t.ALL)t[e][n]=[...t.ALL[n]],this.#r(e,n)}}t===`/*`&&(t=`*`);let a=e===`ALL`?Object.keys(r):[e];if(/\*$/.test(t)){let e=Bl(t);for(let e of a)r[e][t]||(this.#r(e,t),r[e][t]=Vl(r[e],t)||Vl(r.ALL,t)||[]);for(let o of[r,i])for(let r of a)for(let i in o[r])e.test(i)&&o[r][i].push([n,t]);return}let o=u(t)||[t];for(let e of o)for(let t of a)i[t][e]||(this.#r(t,e),i[t][e]=Vl(r[t],e)||Vl(r.ALL,e)||[]),i[t][e].push([n,e])}match=jl;buildAllMatchers(){let e=kl();for(let t of Object.keys(this.#t))e[t]=this.#i(t);return this.#e=this.#t=this.#n=void 0,zl=kl(),e}#i(e){let t=this.#e[e],n=this.#t[e],r=this.#n[e],i=kl(),a=[],[o,s,c]=r.buildRegExp();for(let e of[t,n])for(let t in e){let n=e[t],o=r.paths[t];o?a[o[0]]=n.map(([e,t])=>[e,r.paths[t][1].reduceRight((e,[t],n)=>(e[t]=c[o[1][n][1]],e),kl())]):i[t]=[n.map(([e])=>[e,kl()]),Al]}return[o,s.map(e=>a[e]),i]}},Ul=class{name=`SmartRouter`;#e=[];#t=[];constructor(e){this.#e=e.routers}add(e,t,n){if(!this.#t)throw Error(Cl);this.#t.push([e,t,n])}match(e,t){if(!this.#t)throw Error(`Fatal error`);let n=this.#e,r=this.#t,i=n.length,a=0,o;for(;a<i;a++){let i=n[a];try{for(let e=0,t=r.length;e<t;e++)i.add(...r[e]);o=i.match(e,t)}catch(e){if(e instanceof wl)continue;throw e}this.match=i.match.bind(i),this.#e=[i],this.#t=void 0;break}if(a===i)throw Error(`Fatal error`);return this.name=`SmartRouter + ${this.activeRouter.name}`,o}get activeRouter(){if(this.#t||this.#e.length!==1)throw Error(`No active router has been determined yet.`);return this.#e[0]}},Wl=kl(),Gl=0,Kl=class e{#e=[];#t=kl();#n=[];#r;#i=Wl;insert(t,n,r){let i=this,a=l(n),o=new Set,s=0;for(let t of a){let n=a[++s],r=g(t,n)||(n===void 0&&t&&t.indexOf(`*`)===t.length-1?t:null),c=Array.isArray(r),l=c?r[0]:r||t,u=i.#t[l]||=new e;r&&!u.#r&&(u.#r=r,i.#n.push(u)),i=u,c&&o.add(r[1])}i.#e.push({[t]:{handler:r,possibleKeys:[...o],score:++Gl}})}#a(e,t,n,r,i){for(let a=0,o=t.#e.length;a<o;a++){let o=t.#e[a],s=o[n]||o.ALL;if(s){s.params=kl(),e.push(s);for(let e=0,t=s.possibleKeys.length;e<t;e++){let t=s.possibleKeys[e];s.params[t]=i?.[t]&&!e?i[t]:r[t]??i?.[t]}}}}search(e,t){let n=[];this.#i=Wl;let r=[this],i=c(t),a=[],o=i.length,s=null;for(let c=0;c<o;c++){let l=i[c],u=c===o-1,d=[];for(let f=0,p=r.length;f<p;f++){let p=r[f],m=p.#t[l];m&&(m.#i=p.#i,u?(m.#t[`*`]&&this.#a(n,m.#t[`*`],e,p.#i),this.#a(n,m,e,p.#i)):d.push(m));for(let r of p.#n){let f=r.#r,m=p.#i===Wl?{}:{...p.#i};if(typeof f==`string`){(f===`*`||l.startsWith(f.slice(0,-1)))&&(this.#a(n,r,e,p.#i),f===`*`&&(r.#i=m,d.push(r)));continue}let[,h,g]=f;if(l||g!==!0){if(g!==!0){if(!s){s=[];let e=+(t[0]===`/`);for(let t=0;t<o;t++)s[t]=e,e+=i[t].length+1}let l=t.slice(s[c]),u=g.exec(l);if(u){m[h]=u[0],this.#a(n,r,e,p.#i,m),u[0].length===l.length&&r.#t[`*`]&&this.#a(n,r.#t[`*`],e,p.#i,m);for(let e in r.#t){r.#i=m;let e=u[0].match(/\//g)?.length??0;(a[e]||=[]).push(r);break}continue}}(g===!0||g.test(l))&&(m[h]=l,u?(this.#a(n,r,e,m,p.#i),r.#t[`*`]&&this.#a(n,r.#t[`*`],e,m,p.#i)):(r.#i=m,d.push(r)))}}}let f=a.shift();r=f?d.concat(f):d}return n[1]&&n.sort((e,t)=>e.score-t.score),[n.map(({handler:e,params:t})=>[e,t])]}},ql=class{name=`TrieRouter`;#e=new Kl;add(e,t,n){for(let r of u(t)||[t])this.#e.insert(e,r,n)}match(e,t){return this.#e.search(e,t)}},Jl=class extends Ol{constructor(e={}){super(e),this.router=e.router??new Ul({routers:[new Hl,new ql]})}},Yl=(...e)=>async function(t,n){let r=!1,i=()=>(r=!0,n()),a,o;for(let n of e)try{let e=await n(t,i);if(e===!0&&!t.finalized)await i();else if(e===!1){a=Error(`No successful middleware found`);continue}else e&&e!==!0&&(o=e);a=void 0;break}catch(e){if(a=e,r)break}if(a)throw a;return o},Xl=(...e)=>async function(t,n){let r=t.req.routeIndex;await xl(e.map(e=>[[async(t,n)=>{t.req.routeIndex=r;let i=await e(t,n);if(i===!1)throw Error(`Unmet condition`);return i}]]))(t,n)},Zl=(e,...t)=>{let n,r=(Array.isArray(e)?e:[e]).map(e=>{if(typeof e==`string`)n||=new ql,n.add(`ALL`,e,!0);else return e}).filter(Boolean);n&&r.unshift(e=>!!n?.match(`ALL`,e.req.path)?.[0]?.[0]?.[0]);let i=Yl(e=>r.some(t=>t(e)),Xl(...t));return async function(e,t){await i(e,t)}},Ql=[`same-origin`,`same-site`,`none`,`cross-site`],$l=e=>Ql.includes(e),eu=/^(GET|HEAD|OPTIONS)$/,tu=/^\b(application\/x-www-form-urlencoded|multipart\/form-data|text\/plain)\b/i,nu=e=>{let t=(e=>e?typeof e==`string`?t=>t===e:typeof e==`function`?e:t=>e.includes(t):(e,t)=>e===new URL(t.req.url).origin)(e?.origin),n=async(e,n)=>e!==void 0&&await t(e,n),r=(e=>e?typeof e==`string`?t=>t===e:typeof e==`function`?e:t=>e.includes(t):e=>e===`same-origin`)(e?.secFetchSite),i=async(e,t)=>e===void 0||!$l(e)?!1:await r(e,t);return async function(e,t){if(!eu.test(e.req.method)&&tu.test(e.req.header(`content-type`)||`text/plain`)&&!await i(e.req.header(`sec-fetch-site`),e)&&!await n(e.req.header(`origin`),e))throw new nl(403,{res:new Response(`Forbidden`,{status:403})});await t()}},ru={crossOriginEmbedderPolicy:[`Cross-Origin-Embedder-Policy`,`require-corp`],crossOriginResourcePolicy:[`Cross-Origin-Resource-Policy`,`same-origin`],crossOriginOpenerPolicy:[`Cross-Origin-Opener-Policy`,`same-origin`],originAgentCluster:[`Origin-Agent-Cluster`,`?1`],referrerPolicy:[`Referrer-Policy`,`no-referrer`],strictTransportSecurity:[`Strict-Transport-Security`,`max-age=15552000; includeSubDomains`],xContentTypeOptions:[`X-Content-Type-Options`,`nosniff`],xDnsPrefetchControl:[`X-DNS-Prefetch-Control`,`off`],xDownloadOptions:[`X-Download-Options`,`noopen`],xFrameOptions:[`X-Frame-Options`,`SAMEORIGIN`],xPermittedCrossDomainPolicies:[`X-Permitted-Cross-Domain-Policies`,`none`],xXssProtection:[`X-XSS-Protection`,`0`]},iu={crossOriginEmbedderPolicy:!1,crossOriginResourcePolicy:!0,crossOriginOpenerPolicy:!0,originAgentCluster:!0,referrerPolicy:!0,strictTransportSecurity:!0,xContentTypeOptions:!0,xDnsPrefetchControl:!0,xDownloadOptions:!0,xFrameOptions:!0,xPermittedCrossDomainPolicies:!0,xXssProtection:!0,removePoweredBy:!0,permissionsPolicy:{}},au=e=>{let t={...iu,...e},n=ou(t),r=[];if(t.contentSecurityPolicy){let[e,i]=su(t.contentSecurityPolicy,`Content-Security-Policy`);e&&r.push(e),n.push([`Content-Security-Policy`,i])}if(t.contentSecurityPolicyReportOnly){let[e,i]=su(t.contentSecurityPolicyReportOnly,`Content-Security-Policy-Report-Only`);e&&r.push(e),n.push([`Content-Security-Policy-Report-Only`,i])}return t.permissionsPolicy&&Object.keys(t.permissionsPolicy).length>0&&n.push([`Permissions-Policy`,cu(t.permissionsPolicy)]),t.reportingEndpoints&&n.push([`Reporting-Endpoints`,uu(t.reportingEndpoints)]),t.reportTo&&n.push([`Report-To`,du(t.reportTo)]),async function(e,i){let a=r.length===0?n:r.reduce((t,n)=>n(e,t),n);await i(),fu(e,a),t?.removePoweredBy&&e.res.headers.delete(`X-Powered-By`)}};function ou(e){return Object.entries(ru).filter(([t])=>e[t]).map(([t,n])=>{let r=e[t];return typeof r==`string`?[n[0],r]:n})}function su(e,t){let n=[],r=[];for(let[t,i]of Object.entries(e)){let e=Array.isArray(i)?i:[i];e.forEach((e,i)=>{if(typeof e==`function`){let a=i*2+2+r.length;n.push((n,r)=>{r[a]=e(n,t)})}}),r.push(t.replace(/[A-Z]+(?![a-z])|[A-Z]/g,(e,t)=>t?`-`+e.toLowerCase():e.toLowerCase()),...e.flatMap(e=>[` `,e]),`; `)}return r.pop(),n.length===0?[void 0,r.join(``)]:[(e,r)=>r.map(r=>{if(r[0]===t){let t=r[1].slice();return n.forEach(n=>{n(e,t)}),[r[0],t.join(``)]}return r}),r]}function cu(e){return Object.entries(e).map(([e,t])=>{let n=lu(e);return typeof t==`boolean`?`${n}=${t?`*`:`()`}`:Array.isArray(t)?t.length===0?`${n}=()`:t.length===1&&t[0]===`*`?`${n}=*`:t.length===1&&t[0]===`none`?`${n}=()`:`${n}=(${t.map(e=>[`self`,`src`].includes(e)?e:`"${e}"`).join(` `)})`:``}).filter(Boolean).join(`, `)}function lu(e){return e.replace(/([a-z\d])([A-Z])/g,`$1-$2`).toLowerCase()}function uu(e=[]){return e.map(e=>`${e.name}="${e.url}"`).join(`, `)}function du(e=[]){return e.map(e=>JSON.stringify(e)).join(`, `)}function fu(e,t){t.forEach(([t,n])=>{e.res.headers.set(t,n)})}var pu=e=>async function(t,n){if(e?.alwaysRedirect&&(t.req.method===`GET`||t.req.method===`HEAD`)&&t.req.path!==`/`&&t.req.path.at(-1)===`/`){let e=new URL(t.req.url);return e.pathname=e.pathname.substring(0,e.pathname.length-1),t.redirect(e.toString(),301)}if(await n(),!e?.alwaysRedirect&&t.res.status===404&&(t.req.method===`GET`||t.req.method===`HEAD`)&&t.req.path!==`/`&&t.req.path.at(-1)===`/`){let e=new URL(t.req.url);e.pathname=e.pathname.substring(0,e.pathname.length-1),t.res=t.redirect(e.toString(),301)}};function mu(e,t,n){let r=Ce(e,t,n);if(r.type!==`event`)throw new ee({name:t,type:`event`});return r}function hu(e){return vt(e)}function gu(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name===`Uint8Array`}function _u(e,t){return Array.isArray(t)?t.length===0?!0:e?t.every(e=>typeof e==`string`):t.every(e=>Number.isSafeInteger(e)):!1}function vu(e){if(typeof e!=`function`)throw Error(`function expected`);return!0}function yu(e,t){if(typeof t!=`string`)throw Error(`${e}: string expected`);return!0}function bu(e){if(!Number.isSafeInteger(e))throw Error(`invalid integer: ${e}`)}function xu(e){if(!Array.isArray(e))throw Error(`array expected`)}function Su(e,t){if(!_u(!0,t))throw Error(`${e}: array of strings expected`)}function Cu(e,t){if(!_u(!1,t))throw Error(`${e}: array of numbers expected`)}function wu(...e){let t=e=>e,n=(e,t)=>n=>e(t(n));return{encode:e.map(e=>e.encode).reduceRight(n,t),decode:e.map(e=>e.decode).reduce(n,t)}}function Tu(e){let t=typeof e==`string`?e.split(``):e,n=t.length;Su(`alphabet`,t);let r=new Map(t.map((e,t)=>[e,t]));return{encode:r=>(xu(r),r.map(r=>{if(!Number.isSafeInteger(r)||r<0||r>=n)throw Error(`alphabet.encode: digit index outside alphabet "${r}". Allowed: ${e}`);return t[r]})),decode:t=>(xu(t),t.map(t=>{yu(`alphabet.decode`,t);let n=r.get(t);if(n===void 0)throw Error(`Unknown letter: "${t}". Allowed: ${e}`);return n}))}}function Eu(e=``){return yu(`join`,e),{encode:t=>(Su(`join.decode`,t),t.join(e)),decode:t=>(yu(`join.decode`,t),t.split(e))}}function Du(e,t=`=`){return bu(e),yu(`padding`,t),{encode(n){for(Su(`padding.encode`,n);n.length*e%8;)n.push(t);return n},decode(n){Su(`padding.decode`,n);let r=n.length;if(r*e%8)throw Error(`padding: invalid, string should have whole number of bytes`);for(;r>0&&n[r-1]===t;r--)if((r-1)*e%8==0)throw Error(`padding: invalid, string has too much padding`);return n.slice(0,r)}}}function Ou(e){return vu(e),{encode:e=>e,decode:t=>e(t)}}function ku(e,t,n){if(t<2)throw Error(`convertRadix: invalid from=${t}, base cannot be less than 2`);if(n<2)throw Error(`convertRadix: invalid to=${n}, base cannot be less than 2`);if(xu(e),!e.length)return[];let r=0,i=[],a=Array.from(e,e=>{if(bu(e),e<0||e>=t)throw Error(`invalid integer: ${e}`);return e}),o=a.length;for(;;){let e=0,s=!0;for(let i=r;i<o;i++){let o=a[i],c=t*e,l=c+o;if(!Number.isSafeInteger(l)||c/t!==e||l-o!==c)throw Error(`convertRadix: carry overflow`);let u=l/n;e=l%n;let d=Math.floor(u);if(a[i]=d,!Number.isSafeInteger(d)||d*n+e!==l)throw Error(`convertRadix: carry overflow`);if(s)d?s=!1:r=i;else continue}if(i.push(e),s)break}for(let t=0;t<e.length-1&&e[t]===0;t++)i.push(0);return i.reverse()}var Au=(e,t)=>t===0?e:Au(t,e%t),ju=(e,t)=>e+(t-Au(e,t)),Mu=(()=>{let e=[];for(let t=0;t<40;t++)e.push(2**t);return e})();function Nu(e,t,n,r){if(xu(e),t<=0||t>32)throw Error(`convertRadix2: wrong from=${t}`);if(n<=0||n>32)throw Error(`convertRadix2: wrong to=${n}`);if(ju(t,n)>32)throw Error(`convertRadix2: carry overflow from=${t} to=${n} carryBits=${ju(t,n)}`);let i=0,a=0,o=Mu[t],s=Mu[n]-1,c=[];for(let r of e){if(bu(r),r>=o)throw Error(`convertRadix2: invalid data word=${r} from=${t}`);if(i=i<<t|r,a+t>32)throw Error(`convertRadix2: carry overflow pos=${a} from=${t}`);for(a+=t;a>=n;a-=n)c.push((i>>a-n&s)>>>0);let e=Mu[a];if(e===void 0)throw Error(`invalid carry`);i&=e-1}if(i=i<<n-a&s,!r&&a>=t)throw Error(`Excess padding`);if(!r&&i>0)throw Error(`Non-zero padding: ${i}`);return r&&a>0&&c.push(i>>>0),c}function Pu(e){return bu(e),{encode:t=>{if(!gu(t))throw Error(`radix.encode input should be Uint8Array`);return ku(Array.from(t),256,e)},decode:t=>(Cu(`radix.decode`,t),Uint8Array.from(ku(t,e,256)))}}function Fu(e,t=!1){if(bu(e),e<=0||e>32)throw Error(`radix2: bits should be in (0..32]`);if(ju(8,e)>32||ju(e,8)>32)throw Error(`radix2: carry overflow`);return{encode:n=>{if(!gu(n))throw Error(`radix2.encode input should be Uint8Array`);return Nu(Array.from(n),8,e,!t)},decode:n=>(Cu(`radix2.decode`,n),Uint8Array.from(Nu(n,e,8,t)))}}function Iu(e){return vu(e),function(...t){try{return e.apply(null,t)}catch{}}}wu(Fu(4),Tu(`0123456789ABCDEF`),Eu(``));var Lu=wu(Fu(5),Tu(`ABCDEFGHIJKLMNOPQRSTUVWXYZ234567`),Du(5),Eu(``));wu(Fu(5),Tu(`ABCDEFGHIJKLMNOPQRSTUVWXYZ234567`),Eu(``)),wu(Fu(5),Tu(`0123456789ABCDEFGHIJKLMNOPQRSTUV`),Du(5),Eu(``)),wu(Fu(5),Tu(`0123456789ABCDEFGHIJKLMNOPQRSTUV`),Eu(``)),wu(Fu(5),Tu(`0123456789ABCDEFGHJKMNPQRSTVWXYZ`),Eu(``),Ou(e=>e.toUpperCase().replace(/O/g,`0`).replace(/[IL]/g,`1`)));var Ru=typeof Uint8Array.from([]).toBase64==`function`&&typeof Uint8Array.fromBase64==`function`;Ru||wu(Fu(6),Tu(`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/`),Du(6),Eu(``)),wu(Fu(6),Tu(`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/`),Eu(``)),Ru||wu(Fu(6),Tu(`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_`),Du(6),Eu(``)),wu(Fu(6),Tu(`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_`),Eu(``));var zu=(e=>wu(Pu(58),Tu(e),Eu(``)))(`123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz`),Bu=wu(Tu(`qpzry9x8gf2tvdw0s3jn54khce6mua7l`),Eu(``)),Vu=[996825010,642813549,513874426,1027748829,705979059];function Hu(e){let t=e>>25,n=(e&33554431)<<5;for(let e=0;e<Vu.length;e++)(t>>e&1)==1&&(n^=Vu[e]);return n}function Uu(e,t,n=1){let r=e.length,i=1;for(let t=0;t<r;t++){let n=e.charCodeAt(t);if(n<33||n>126)throw Error(`Invalid prefix (${e})`);i=Hu(i)^n>>5}i=Hu(i);for(let t=0;t<r;t++)i=Hu(i)^e.charCodeAt(t)&31;for(let e of t)i=Hu(i)^e;for(let e=0;e<6;e++)i=Hu(i);return i^=n,Bu.encode(Nu([i%Mu[30]],30,5,!1))}function Wu(e){let t=e===`bech32`?1:734539939,n=Fu(5),r=n.decode,i=n.encode,a=Iu(r);function o(e,n,r=90){yu(`bech32.encode prefix`,e),gu(n)&&(n=Array.from(n)),Cu(`bech32.encode`,n);let i=e.length;if(i===0)throw TypeError(`Invalid prefix length ${i}`);let a=i+7+n.length;if(r!==!1&&a>r)throw TypeError(`Length ${a} exceeds limit ${r}`);let o=e.toLowerCase(),s=Uu(o,n,t);return`${o}1${Bu.encode(n)}${s}`}function s(e,n=90){yu(`bech32.decode input`,e);let r=e.length;if(r<8||n!==!1&&r>n)throw TypeError(`invalid string length: ${r} (${e}). Expected (8..${n})`);let i=e.toLowerCase();if(e!==i&&e!==e.toUpperCase())throw Error(`String must be lowercase or uppercase`);let a=i.lastIndexOf(`1`);if(a===0||a===-1)throw Error(`Letter "1" must be present between prefix and data only`);let o=i.slice(0,a),s=i.slice(a+1);if(s.length<6)throw Error(`Data must be at least 6 characters long`);let c=Bu.decode(s).slice(0,-6),l=Uu(o,c,t);if(!s.endsWith(l))throw Error(`Invalid checksum in ${e}: expected "${l}"`);return{prefix:o,words:c}}let c=Iu(s);function l(e){let{prefix:t,words:n}=s(e,!1);return{prefix:t,words:n,bytes:r(n)}}function u(e,t){return o(e,i(t))}return{encode:o,decode:s,encodeFromBytes:u,decodeToBytes:l,decodeUnsafe:c,fromWords:r,fromWordsUnsafe:a,toWords:i}}Wu(`bech32`),Wu(`bech32m`),typeof Uint8Array.from([]).toHex==`function`&&typeof Uint8Array.fromHex==`function`||wu(Fu(4),Tu(`0123456789abcdef`),Eu(``),Ou(e=>{if(typeof e!=`string`||e.length%2!=0)throw TypeError(`hex.decode: expected string, got ${typeof e} with length ${e.length}`);return e.toLowerCase()}));var Gu=BigInt(0),Ku=BigInt(1);function qu(e,t=``){if(typeof e!=`boolean`){let n=t&&`"${t}"`;throw Error(n+`expected boolean, got type=`+typeof e)}return e}function Ju(e,t,n=``){let r=En(e),i=e?.length,a=t!==void 0;if(!r||a&&i!==t){let o=n&&`"${n}" `,s=a?` of length ${t}`:``,c=r?`length=${i}`:`type=${typeof e}`;throw Error(o+`expected Uint8Array`+s+`, got `+c)}return e}function Yu(e){let t=e.toString(16);return t.length&1?`0`+t:t}function Xu(e){if(typeof e!=`string`)throw Error(`hex string expected, got `+typeof e);return e===``?Gu:BigInt(`0x`+e)}function Zu(e){return Xu(Tn(e))}function Qu(e){return kn(e),Xu(Tn(Uint8Array.from(e).reverse()))}function $u(e,t){return Dn(e.toString(16).padStart(t*2,`0`))}function ed(e,t){return $u(e,t).reverse()}function td(e,t,n){let r;if(typeof t==`string`)try{r=Dn(t)}catch(t){throw Error(e+` must be hex string or Uint8Array, cause: `+t)}else if(En(t))r=Uint8Array.from(t);else throw Error(e+` must be hex string or Uint8Array`);let i=r.length;if(typeof n==`number`&&i!==n)throw Error(e+` of length `+n+` expected, got `+i);return r}var nd=e=>typeof e==`bigint`&&Gu<=e;function rd(e,t,n){return nd(e)&&nd(t)&&nd(n)&&t<=e&&e<n}function id(e,t,n,r){if(!rd(t,n,r))throw Error(`expected valid `+e+`: `+n+` <= n < `+r+`, got `+t)}function ad(e){let t=0;for(;e>Gu;e>>=Ku,t+=1);return t}var od=e=>(Ku<<BigInt(e))-Ku;function sd(e,t,n){if(typeof e!=`number`||e<2)throw Error(`hashLen must be a number`);if(typeof t!=`number`||t<2)throw Error(`qByteLen must be a number`);if(typeof n!=`function`)throw Error(`hmacFn must be a function`);let r=e=>new Uint8Array(e),i=e=>Uint8Array.of(e),a=r(e),o=r(e),s=0,c=()=>{a.fill(1),o.fill(0),s=0},l=(...e)=>n(o,a,...e),u=(e=r(0))=>{o=l(i(0),e),a=l(),e.length!==0&&(o=l(i(1),e),a=l())},d=()=>{if(s++>=1e3)throw Error(`drbg: tried 1000 values`);let e=0,n=[];for(;e<t;){a=l();let t=a.slice();n.push(t),e+=a.length}return Cn(...n)};return(e,t)=>{c(),u(e);let n;for(;!(n=t(d()));)u();return c(),n}}function cd(e,t,n={}){if(!e||typeof e!=`object`)throw Error(`expected valid options object`);function r(t,n,r){let i=e[t];if(r&&i===void 0)return;let a=typeof i;if(a!==n||i===null)throw Error(`param "${t}" is invalid: expected ${n}, got ${a}`)}Object.entries(t).forEach(([e,t])=>r(e,t,!1)),Object.entries(n).forEach(([e,t])=>r(e,t,!0))}function ld(e){let t=new WeakMap;return(n,...r)=>{let i=t.get(n);if(i!==void 0)return i;let a=e(n,...r);return t.set(n,a),a}}var ud=BigInt(0),dd=BigInt(1),fd=BigInt(2),pd=BigInt(3),md=BigInt(4),hd=BigInt(5),gd=BigInt(7),_d=BigInt(8),vd=BigInt(9),yd=BigInt(16);function bd(e,t){let n=e%t;return n>=ud?n:t+n}function xd(e,t){if(e===ud)throw Error(`invert: expected non-zero number`);if(t<=ud)throw Error(`invert: expected positive modulus, got `+t);let n=bd(e,t),r=t,i=ud,a=dd,o=dd,s=ud;for(;n!==ud;){let e=r/n,t=r%n,c=i-o*e,l=a-s*e;r=n,n=t,i=o,a=s,o=c,s=l}if(r!==dd)throw Error(`invert: does not exist`);return bd(i,t)}function Sd(e,t,n){if(!e.eql(e.sqr(t),n))throw Error(`Cannot find square root`)}function Cd(e,t){let n=(e.ORDER+dd)/md,r=e.pow(t,n);return Sd(e,r,t),r}function wd(e,t){let n=(e.ORDER-hd)/_d,r=e.mul(t,fd),i=e.pow(r,n),a=e.mul(t,i),o=e.mul(e.mul(a,fd),i),s=e.mul(a,e.sub(o,e.ONE));return Sd(e,s,t),s}function Td(e){let t=Pd(e),n=Ed(e),r=n(t,t.neg(t.ONE)),i=n(t,r),a=n(t,t.neg(r)),o=(e+gd)/yd;return(e,t)=>{let n=e.pow(t,o),s=e.mul(n,r),c=e.mul(n,i),l=e.mul(n,a),u=e.eql(e.sqr(s),t),d=e.eql(e.sqr(c),t);n=e.cmov(n,s,u),s=e.cmov(l,c,d);let f=e.eql(e.sqr(s),t),p=e.cmov(n,s,f);return Sd(e,p,t),p}}function Ed(e){if(e<pd)throw Error(`sqrt is not defined for small field`);let t=e-dd,n=0;for(;t%fd===ud;)t/=fd,n++;let r=fd,i=Pd(e);for(;Md(i,r)===1;)if(r++>1e3)throw Error(`Cannot find square root: probably non-prime P`);if(n===1)return Cd;let a=i.pow(r,t),o=(t+dd)/fd;return function(e,r){if(e.is0(r))return r;if(Md(e,r)!==1)throw Error(`Cannot find square root`);let i=n,s=e.mul(e.ONE,a),c=e.pow(r,t),l=e.pow(r,o);for(;!e.eql(c,e.ONE);){if(e.is0(c))return e.ZERO;let t=1,n=e.sqr(c);for(;!e.eql(n,e.ONE);)if(t++,n=e.sqr(n),t===i)throw Error(`Cannot find square root`);let r=dd<<BigInt(i-t-1),a=e.pow(s,r);i=t,s=e.sqr(a),c=e.mul(c,s),l=e.mul(l,a)}return l}}function Dd(e){return e%md===pd?Cd:e%_d===hd?wd:e%yd===vd?Td(e):Ed(e)}var Od=[`create`,`isValid`,`is0`,`neg`,`inv`,`sqrt`,`sqr`,`eql`,`add`,`sub`,`mul`,`pow`,`div`,`addN`,`subN`,`mulN`,`sqrN`];function kd(e){return cd(e,Od.reduce((e,t)=>(e[t]=`function`,e),{ORDER:`bigint`,MASK:`bigint`,BYTES:`number`,BITS:`number`})),e}function Ad(e,t,n){if(n<ud)throw Error(`invalid exponent, negatives unsupported`);if(n===ud)return e.ONE;if(n===dd)return t;let r=e.ONE,i=t;for(;n>ud;)n&dd&&(r=e.mul(r,i)),i=e.sqr(i),n>>=dd;return r}function jd(e,t,n=!1){let r=Array(t.length).fill(n?e.ZERO:void 0),i=t.reduce((t,n,i)=>e.is0(n)?t:(r[i]=t,e.mul(t,n)),e.ONE),a=e.inv(i);return t.reduceRight((t,n,i)=>e.is0(n)?t:(r[i]=e.mul(t,r[i]),e.mul(t,n)),a),r}function Md(e,t){let n=(e.ORDER-dd)/fd,r=e.pow(t,n),i=e.eql(r,e.ONE),a=e.eql(r,e.ZERO),o=e.eql(r,e.neg(e.ONE));if(!i&&!a&&!o)throw Error(`invalid Legendre symbol result`);return i?1:a?0:-1}function Nd(e,t){t!==void 0&&Sn(t);let n=t===void 0?e.toString(2).length:t;return{nBitLength:n,nByteLength:Math.ceil(n/8)}}function Pd(e,t,n=!1,r={}){if(e<=ud)throw Error(`invalid field: expected ORDER > 0, got `+e);let i,a,o=!1,s;if(typeof t==`object`&&t){if(r.sqrt||n)throw Error(`cannot specify opts in two arguments`);let e=t;e.BITS&&(i=e.BITS),e.sqrt&&(a=e.sqrt),typeof e.isLE==`boolean`&&(n=e.isLE),typeof e.modFromBytes==`boolean`&&(o=e.modFromBytes),s=e.allowedLengths}else typeof t==`number`&&(i=t),r.sqrt&&(a=r.sqrt);let{nBitLength:c,nByteLength:l}=Nd(e,i);if(l>2048)throw Error(`invalid field: expected ORDER of <= 2048 bytes`);let u,d=Object.freeze({ORDER:e,isLE:n,BITS:c,BYTES:l,MASK:od(c),ZERO:ud,ONE:dd,allowedLengths:s,create:t=>bd(t,e),isValid:t=>{if(typeof t!=`bigint`)throw Error(`invalid field element: expected bigint, got `+typeof t);return ud<=t&&t<e},is0:e=>e===ud,isValidNot0:e=>!d.is0(e)&&d.isValid(e),isOdd:e=>(e&dd)===dd,neg:t=>bd(-t,e),eql:(e,t)=>e===t,sqr:t=>bd(t*t,e),add:(t,n)=>bd(t+n,e),sub:(t,n)=>bd(t-n,e),mul:(t,n)=>bd(t*n,e),pow:(e,t)=>Ad(d,e,t),div:(t,n)=>bd(t*xd(n,e),e),sqrN:e=>e*e,addN:(e,t)=>e+t,subN:(e,t)=>e-t,mulN:(e,t)=>e*t,inv:t=>xd(t,e),sqrt:a||(t=>(u||=Dd(e),u(d,t))),toBytes:e=>n?ed(e,l):$u(e,l),fromBytes:(t,r=!0)=>{if(s){if(!s.includes(t.length)||t.length>l)throw Error(`Field.fromBytes: expected `+s+` bytes, got `+t.length);let e=new Uint8Array(l);e.set(t,n?0:e.length-t.length),t=e}if(t.length!==l)throw Error(`Field.fromBytes: expected `+l+` bytes, got `+t.length);let i=n?Qu(t):Zu(t);if(o&&(i=bd(i,e)),!r&&!d.isValid(i))throw Error(`invalid field element: outside of range 0..ORDER`);return i},invertBatch:e=>jd(d,e),cmov:(e,t,n)=>n?t:e});return Object.freeze(d)}function Fd(e){if(typeof e!=`bigint`)throw Error(`field order must be bigint`);let t=e.toString(2).length;return Math.ceil(t/8)}function Id(e){let t=Fd(e);return t+Math.ceil(t/2)}function Ld(e,t,n=!1){let r=e.length,i=Fd(t),a=Id(t);if(r<16||r<a||r>1024)throw Error(`expected `+a+`-1024 bytes of input, got `+r);let o=bd(n?Qu(e):Zu(e),t-dd)+dd;return n?ed(o,i):$u(o,i)}var Rd=BigInt(0),zd=BigInt(1);function Bd(e,t){let n=t.negate();return e?n:t}function Vd(e,t){let n=jd(e.Fp,t.map(e=>e.Z));return t.map((t,r)=>e.fromAffine(t.toAffine(n[r])))}function Hd(e,t){if(!Number.isSafeInteger(e)||e<=0||e>t)throw Error(`invalid window size, expected [1..`+t+`], got W=`+e)}function Ud(e,t){Hd(e,t);let n=Math.ceil(t/e)+1,r=2**(e-1),i=2**e;return{windows:n,windowSize:r,mask:od(e),maxNumber:i,shiftBy:BigInt(e)}}function Wd(e,t,n){let{windowSize:r,mask:i,maxNumber:a,shiftBy:o}=n,s=Number(e&i),c=e>>o;s>r&&(s-=a,c+=zd);let l=t*r,u=l+Math.abs(s)-1,d=s===0,f=s<0,p=t%2!=0;return{nextN:c,offset:u,isZero:d,isNeg:f,isNegF:p,offsetF:l}}function Gd(e,t){if(!Array.isArray(e))throw Error(`array expected`);e.forEach((e,n)=>{if(!(e instanceof t))throw Error(`invalid point at index `+n)})}function Kd(e,t){if(!Array.isArray(e))throw Error(`array of scalars expected`);e.forEach((e,n)=>{if(!t.isValid(e))throw Error(`invalid scalar at index `+n)})}var qd=new WeakMap,Jd=new WeakMap;function Yd(e){return Jd.get(e)||1}function Xd(e){if(e!==Rd)throw Error(`invalid wNAF`)}var Zd=class{constructor(e,t){this.BASE=e.BASE,this.ZERO=e.ZERO,this.Fn=e.Fn,this.bits=t}_unsafeLadder(e,t,n=this.ZERO){let r=e;for(;t>Rd;)t&zd&&(n=n.add(r)),r=r.double(),t>>=zd;return n}precomputeWindow(e,t){let{windows:n,windowSize:r}=Ud(t,this.bits),i=[],a=e,o=a;for(let e=0;e<n;e++){o=a,i.push(o);for(let e=1;e<r;e++)o=o.add(a),i.push(o);a=o.double()}return i}wNAF(e,t,n){if(!this.Fn.isValid(n))throw Error(`invalid scalar`);let r=this.ZERO,i=this.BASE,a=Ud(e,this.bits);for(let e=0;e<a.windows;e++){let{nextN:o,offset:s,isZero:c,isNeg:l,isNegF:u,offsetF:d}=Wd(n,e,a);n=o,c?i=i.add(Bd(u,t[d])):r=r.add(Bd(l,t[s]))}return Xd(n),{p:r,f:i}}wNAFUnsafe(e,t,n,r=this.ZERO){let i=Ud(e,this.bits);for(let e=0;e<i.windows&&n!==Rd;e++){let{nextN:a,offset:o,isZero:s,isNeg:c}=Wd(n,e,i);if(n=a,!s){let e=t[o];r=r.add(c?e.negate():e)}}return Xd(n),r}getPrecomputes(e,t,n){let r=qd.get(t);return r||(r=this.precomputeWindow(t,e),e!==1&&(typeof n==`function`&&(r=n(r)),qd.set(t,r))),r}cached(e,t,n){let r=Yd(e);return this.wNAF(r,this.getPrecomputes(r,e,n),t)}unsafe(e,t,n,r){let i=Yd(e);return i===1?this._unsafeLadder(e,t,r):this.wNAFUnsafe(i,this.getPrecomputes(i,e,n),t,r)}createCache(e,t){Hd(t,this.bits),Jd.set(e,t),qd.delete(e)}hasCache(e){return Yd(e)!==1}};function Qd(e,t,n,r){let i=t,a=e.ZERO,o=e.ZERO;for(;n>Rd||r>Rd;)n&zd&&(a=a.add(i)),r&zd&&(o=o.add(i)),i=i.double(),n>>=zd,r>>=zd;return{p1:a,p2:o}}function $d(e,t,n,r){Gd(n,e),Kd(r,t);let i=n.length,a=r.length;if(i!==a)throw Error(`arrays of points and scalars must have equal length`);let o=e.ZERO,s=ad(BigInt(i)),c=1;s>12?c=s-3:s>4?c=s-2:s>0&&(c=2);let l=od(c),u=Array(Number(l)+1).fill(o),d=Math.floor((t.BITS-1)/c)*c,f=o;for(let e=d;e>=0;e-=c){u.fill(o);for(let t=0;t<a;t++){let i=r[t],a=Number(i>>BigInt(e)&l);u[a]=u[a].add(n[t])}let t=o;for(let e=u.length-1,n=o;e>0;e--)n=n.add(u[e]),t=t.add(n);if(f=f.add(t),e!==0)for(let e=0;e<c;e++)f=f.double()}return f}function ef(e,t,n){if(t){if(t.ORDER!==e)throw Error(`Field.ORDER must match order: Fp == p, Fn == n`);return kd(t),t}return Pd(e,{isLE:n})}function tf(e,t,n={},r){if(r===void 0&&(r=e===`edwards`),!t||typeof t!=`object`)throw Error(`expected valid ${e} CURVE object`);for(let e of[`p`,`n`,`h`]){let n=t[e];if(!(typeof n==`bigint`&&n>Rd))throw Error(`CURVE.${e} must be positive bigint`)}let i=ef(t.p,n.Fp,r),a=ef(t.n,n.Fn,r),o=[`Gx`,`Gy`,`a`,e===`weierstrass`?`b`:`d`];for(let e of o)if(!i.isValid(t[e]))throw Error(`CURVE.${e} must be valid field element of CURVE.Fp`);return t=Object.freeze(Object.assign({},t)),{CURVE:t,Fp:i,Fn:a}}var nf=(e,t)=>(e+(e>=0?t:-t)/uf)/t;function rf(e,t,n){let[[r,i],[a,o]]=t,s=nf(o*e,n),c=nf(-i*e,n),l=e-s*r-c*a,u=-s*i-c*o,d=l<cf,f=u<cf;d&&(l=-l),f&&(u=-u);let p=od(Math.ceil(ad(n)/2))+lf;if(l<cf||l>=p||u<cf||u>=p)throw Error(`splitScalar (endomorphism): failed, k=`+e);return{k1neg:d,k1:l,k2neg:f,k2:u}}function af(e){if(![`compact`,`recovered`,`der`].includes(e))throw Error(`Signature format must be "compact", "recovered", or "der"`);return e}function of(e,t){let n={};for(let r of Object.keys(t))n[r]=e[r]===void 0?t[r]:e[r];return qu(n.lowS,`lowS`),qu(n.prehash,`prehash`),n.format!==void 0&&af(n.format),n}var sf={Err:class extends Error{constructor(e=``){super(e)}},_tlv:{encode:(e,t)=>{let{Err:n}=sf;if(e<0||e>256)throw new n(`tlv.encode: wrong tag`);if(t.length&1)throw new n(`tlv.encode: unpadded data`);let r=t.length/2,i=Yu(r);if(i.length/2&128)throw new n(`tlv.encode: long form length too big`);let a=r>127?Yu(i.length/2|128):``;return Yu(e)+a+i+t},decode(e,t){let{Err:n}=sf,r=0;if(e<0||e>256)throw new n(`tlv.encode: wrong tag`);if(t.length<2||t[r++]!==e)throw new n(`tlv.decode: wrong tlv`);let i=t[r++],a=!!(i&128),o=0;if(!a)o=i;else{let e=i&127;if(!e)throw new n(`tlv.decode(long): indefinite length not supported`);if(e>4)throw new n(`tlv.decode(long): byte length is too big`);let a=t.subarray(r,r+e);if(a.length!==e)throw new n(`tlv.decode: length bytes not complete`);if(a[0]===0)throw new n(`tlv.decode(long): zero leftmost byte`);for(let e of a)o=o<<8|e;if(r+=e,o<128)throw new n(`tlv.decode(long): not minimal encoding`)}let s=t.subarray(r,r+o);if(s.length!==o)throw new n(`tlv.decode: wrong value length`);return{v:s,l:t.subarray(r+o)}}},_int:{encode(e){let{Err:t}=sf;if(e<cf)throw new t(`integer: negative integers are not allowed`);let n=Yu(e);if(Number.parseInt(n[0],16)&8&&(n=`00`+n),n.length&1)throw new t(`unexpected DER parsing assertion: unpadded hex`);return n},decode(e){let{Err:t}=sf;if(e[0]&128)throw new t(`invalid signature integer: negative`);if(e[0]===0&&!(e[1]&128))throw new t(`invalid signature integer: unnecessary leading zero`);return Zu(e)}},toSig(e){let{Err:t,_int:n,_tlv:r}=sf,i=td(`signature`,e),{v:a,l:o}=r.decode(48,i);if(o.length)throw new t(`invalid signature: left bytes after parsing`);let{v:s,l:c}=r.decode(2,a),{v:l,l:u}=r.decode(2,c);if(u.length)throw new t(`invalid signature: left bytes after parsing`);return{r:n.decode(s),s:n.decode(l)}},hexFromSig(e){let{_tlv:t,_int:n}=sf,r=t.encode(2,n.encode(e.r))+t.encode(2,n.encode(e.s));return t.encode(48,r)}},cf=BigInt(0),lf=BigInt(1),uf=BigInt(2),df=BigInt(3),ff=BigInt(4);function pf(e,t){let{BYTES:n}=e,r;if(typeof t==`bigint`)r=t;else{let i=td(`private key`,t);try{r=e.fromBytes(i)}catch{throw Error(`invalid private key: expected ui8a of size ${n}, got ${typeof t}`)}}if(!e.isValidNot0(r))throw Error(`invalid private key: out of range [1..N-1]`);return r}function mf(e,t={}){let n=tf(`weierstrass`,e,t),{Fp:r,Fn:i}=n,a=n.CURVE,{h:o,n:s}=a;cd(t,{},{allowInfinityPoint:`boolean`,clearCofactor:`function`,isTorsionFree:`function`,fromBytes:`function`,toBytes:`function`,endo:`object`,wrapPrivateKey:`boolean`});let{endo:c}=t;if(c&&(!r.is0(a.a)||typeof c.beta!=`bigint`||!Array.isArray(c.basises)))throw Error(`invalid endo: expected "beta": bigint and "basises": array`);let l=gf(r,i);function u(){if(!r.isOdd)throw Error(`compression is not supported: Field does not have .isOdd()`)}function d(e,t,n){let{x:i,y:a}=t.toAffine(),o=r.toBytes(i);if(qu(n,`isCompressed`),n){u();let e=!r.isOdd(a);return Cn(hf(e),o)}return Cn(Uint8Array.of(4),o,r.toBytes(a))}function f(e){Ju(e,void 0,`Point`);let{publicKey:t,publicKeyUncompressed:n}=l,i=e.length,a=e[0],o=e.subarray(1);if(i===t&&(a===2||a===3)){let e=r.fromBytes(o);if(!r.isValid(e))throw Error(`bad point: is not on curve, wrong x`);let t=h(e),n;try{n=r.sqrt(t)}catch(e){let t=e instanceof Error?`: `+e.message:``;throw Error(`bad point: is not on curve, sqrt error`+t)}u();let i=r.isOdd(n);return(a&1)==1!==i&&(n=r.neg(n)),{x:e,y:n}}if(i===n&&a===4){let e=r.BYTES,t=r.fromBytes(o.subarray(0,e)),n=r.fromBytes(o.subarray(e,e*2));if(!g(t,n))throw Error(`bad point: is not on curve`);return{x:t,y:n}}throw Error(`bad point: got length ${i}, expected compressed=${t} or uncompressed=${n}`)}let p=t.toBytes||d,m=t.fromBytes||f;function h(e){let t=r.sqr(e),n=r.mul(t,e);return r.add(r.add(n,r.mul(e,a.a)),a.b)}function g(e,t){let n=r.sqr(t),i=h(e);return r.eql(n,i)}if(!g(a.Gx,a.Gy))throw Error(`bad curve params: generator point`);let _=r.mul(r.pow(a.a,df),ff),v=r.mul(r.sqr(a.b),BigInt(27));if(r.is0(r.add(_,v)))throw Error(`bad curve params: a or b`);function y(e,t,n=!1){if(!r.isValid(t)||n&&r.is0(t))throw Error(`bad point coordinate ${e}`);return t}function b(e){if(!(e instanceof T))throw Error(`ProjectivePoint expected`)}function x(e){if(!c||!c.basises)throw Error(`no endo`);return rf(e,c.basises,i.ORDER)}let S=ld((e,t)=>{let{X:n,Y:i,Z:a}=e;if(r.eql(a,r.ONE))return{x:n,y:i};let o=e.is0();t??=o?r.ONE:r.inv(a);let s=r.mul(n,t),c=r.mul(i,t),l=r.mul(a,t);if(o)return{x:r.ZERO,y:r.ZERO};if(!r.eql(l,r.ONE))throw Error(`invZ was invalid`);return{x:s,y:c}}),C=ld(e=>{if(e.is0()){if(t.allowInfinityPoint&&!r.is0(e.Y))return;throw Error(`bad point: ZERO`)}let{x:n,y:i}=e.toAffine();if(!r.isValid(n)||!r.isValid(i))throw Error(`bad point: x or y not field elements`);if(!g(n,i))throw Error(`bad point: equation left != right`);if(!e.isTorsionFree())throw Error(`bad point: not in prime-order subgroup`);return!0});function w(e,t,n,i,a){return n=new T(r.mul(n.X,e),n.Y,n.Z),t=Bd(i,t),n=Bd(a,n),t.add(n)}class T{constructor(e,t,n){this.X=y(`x`,e),this.Y=y(`y`,t,!0),this.Z=y(`z`,n),Object.freeze(this)}static CURVE(){return a}static fromAffine(e){let{x:t,y:n}=e||{};if(!e||!r.isValid(t)||!r.isValid(n))throw Error(`invalid affine point`);if(e instanceof T)throw Error(`projective point not allowed`);return r.is0(t)&&r.is0(n)?T.ZERO:new T(t,n,r.ONE)}static fromBytes(e){let t=T.fromAffine(m(Ju(e,void 0,`point`)));return t.assertValidity(),t}static fromHex(e){return T.fromBytes(td(`pointHex`,e))}get x(){return this.toAffine().x}get y(){return this.toAffine().y}precompute(e=8,t=!0){return D.createCache(this,e),t||this.multiply(df),this}assertValidity(){C(this)}hasEvenY(){let{y:e}=this.toAffine();if(!r.isOdd)throw Error(`Field doesn't support isOdd`);return!r.isOdd(e)}equals(e){b(e);let{X:t,Y:n,Z:i}=this,{X:a,Y:o,Z:s}=e,c=r.eql(r.mul(t,s),r.mul(a,i)),l=r.eql(r.mul(n,s),r.mul(o,i));return c&&l}negate(){return new T(this.X,r.neg(this.Y),this.Z)}double(){let{a:e,b:t}=a,n=r.mul(t,df),{X:i,Y:o,Z:s}=this,c=r.ZERO,l=r.ZERO,u=r.ZERO,d=r.mul(i,i),f=r.mul(o,o),p=r.mul(s,s),m=r.mul(i,o);return m=r.add(m,m),u=r.mul(i,s),u=r.add(u,u),c=r.mul(e,u),l=r.mul(n,p),l=r.add(c,l),c=r.sub(f,l),l=r.add(f,l),l=r.mul(c,l),c=r.mul(m,c),u=r.mul(n,u),p=r.mul(e,p),m=r.sub(d,p),m=r.mul(e,m),m=r.add(m,u),u=r.add(d,d),d=r.add(u,d),d=r.add(d,p),d=r.mul(d,m),l=r.add(l,d),p=r.mul(o,s),p=r.add(p,p),d=r.mul(p,m),c=r.sub(c,d),u=r.mul(p,f),u=r.add(u,u),u=r.add(u,u),new T(c,l,u)}add(e){b(e);let{X:t,Y:n,Z:i}=this,{X:o,Y:s,Z:c}=e,l=r.ZERO,u=r.ZERO,d=r.ZERO,f=a.a,p=r.mul(a.b,df),m=r.mul(t,o),h=r.mul(n,s),g=r.mul(i,c),_=r.add(t,n),v=r.add(o,s);_=r.mul(_,v),v=r.add(m,h),_=r.sub(_,v),v=r.add(t,i);let y=r.add(o,c);return v=r.mul(v,y),y=r.add(m,g),v=r.sub(v,y),y=r.add(n,i),l=r.add(s,c),y=r.mul(y,l),l=r.add(h,g),y=r.sub(y,l),d=r.mul(f,v),l=r.mul(p,g),d=r.add(l,d),l=r.sub(h,d),d=r.add(h,d),u=r.mul(l,d),h=r.add(m,m),h=r.add(h,m),g=r.mul(f,g),v=r.mul(p,v),h=r.add(h,g),g=r.sub(m,g),g=r.mul(f,g),v=r.add(v,g),m=r.mul(h,v),u=r.add(u,m),m=r.mul(y,v),l=r.mul(_,l),l=r.sub(l,m),m=r.mul(_,h),d=r.mul(y,d),d=r.add(d,m),new T(l,u,d)}subtract(e){return this.add(e.negate())}is0(){return this.equals(T.ZERO)}multiply(e){let{endo:n}=t;if(!i.isValidNot0(e))throw Error(`invalid scalar: out of range`);let r,a,o=e=>D.cached(this,e,e=>Vd(T,e));if(n){let{k1neg:t,k1:i,k2neg:s,k2:c}=x(e),{p:l,f:u}=o(i),{p:d,f}=o(c);a=u.add(f),r=w(n.beta,l,d,t,s)}else{let{p:t,f:n}=o(e);r=t,a=n}return Vd(T,[r,a])[0]}multiplyUnsafe(e){let{endo:n}=t,r=this;if(!i.isValid(e))throw Error(`invalid scalar: out of range`);if(e===cf||r.is0())return T.ZERO;if(e===lf)return r;if(D.hasCache(this))return this.multiply(e);if(n){let{k1neg:t,k1:i,k2neg:a,k2:o}=x(e),{p1:s,p2:c}=Qd(T,r,i,o);return w(n.beta,s,c,t,a)}return D.unsafe(r,e)}multiplyAndAddUnsafe(e,t,n){let r=this.multiplyUnsafe(t).add(e.multiplyUnsafe(n));return r.is0()?void 0:r}toAffine(e){return S(this,e)}isTorsionFree(){let{isTorsionFree:e}=t;return o===lf?!0:e?e(T,this):D.unsafe(this,s).is0()}clearCofactor(){let{clearCofactor:e}=t;return o===lf?this:e?e(T,this):this.multiplyUnsafe(o)}isSmallOrder(){return this.multiplyUnsafe(o).is0()}toBytes(e=!0){return qu(e,`isCompressed`),this.assertValidity(),p(T,this,e)}toHex(e=!0){return Tn(this.toBytes(e))}toString(){return`<Point ${this.is0()?`ZERO`:this.toHex()}>`}get px(){return this.X}get py(){return this.X}get pz(){return this.Z}toRawBytes(e=!0){return this.toBytes(e)}_setWindowSize(e){this.precompute(e)}static normalizeZ(e){return Vd(T,e)}static msm(e,t){return $d(T,i,e,t)}static fromPrivateKey(e){return T.BASE.multiply(pf(i,e))}}T.BASE=new T(a.Gx,a.Gy,r.ONE),T.ZERO=new T(r.ZERO,r.ONE,r.ZERO),T.Fp=r,T.Fn=i;let E=i.BITS,D=new Zd(T,t.endo?Math.ceil(E/2):E);return T.BASE.precompute(8),T}function hf(e){return Uint8Array.of(e?2:3)}function gf(e,t){return{secretKey:t.BYTES,publicKey:1+e.BYTES,publicKeyUncompressed:1+2*e.BYTES,publicKeyHasPrefix:!0,signature:2*t.BYTES}}function _f(e,t={}){let{Fn:n}=e,r=t.randomBytes||On,i=Object.assign(gf(e.Fp,n),{seed:Id(n.ORDER)});function a(e){try{return!!pf(n,e)}catch{return!1}}function o(t,n){let{publicKey:r,publicKeyUncompressed:a}=i;try{let i=t.length;return n===!0&&i!==r||n===!1&&i!==a?!1:!!e.fromBytes(t)}catch{return!1}}function s(e=r(i.seed)){return Ld(Ju(e,i.seed,`seed`),n.ORDER)}function c(t,r=!0){return e.BASE.multiply(pf(n,t)).toBytes(r)}function l(e){let t=s(e);return{secretKey:t,publicKey:c(t)}}function u(t){if(typeof t==`bigint`)return!1;if(t instanceof e)return!0;let{secretKey:r,publicKey:a,publicKeyUncompressed:o}=i;if(n.allowedLengths||r===a)return;let s=td(`key`,t).length;return s===a||s===o}function d(t,r,i=!0){if(u(t)===!0)throw Error(`first arg must be private key`);if(u(r)===!1)throw Error(`second arg must be public key`);let a=pf(n,t);return e.fromHex(r).multiply(a).toBytes(i)}return Object.freeze({getPublicKey:c,getSharedSecret:d,keygen:l,Point:e,utils:{isValidSecretKey:a,isValidPublicKey:o,randomSecretKey:s,isValidPrivateKey:a,randomPrivateKey:s,normPrivateKeyToScalar:e=>pf(n,e),precompute(t=8,n=e.BASE){return n.precompute(t,!1)}},lengths:i})}function vf(e,t,n={}){wn(t),cd(n,{},{hmac:`function`,lowS:`boolean`,randomBytes:`function`,bits2int:`function`,bits2int_modN:`function`});let r=n.randomBytes||On,i=n.hmac||((e,...n)=>jn(t,e,Cn(...n))),{Fp:a,Fn:o}=e,{ORDER:s,BITS:c}=o,{keygen:l,getPublicKey:u,getSharedSecret:d,utils:f,lengths:p}=_f(e,n),m={prehash:!1,lowS:typeof n.lowS==`boolean`&&n.lowS,format:void 0,extraEntropy:!1},h=`compact`;function g(e){return e>s>>lf}function _(e,t){if(!o.isValidNot0(t))throw Error(`invalid signature ${e}: out of range 1..Point.Fn.ORDER`);return t}function v(e,t){af(t);let n=p.signature;return Ju(e,t===`compact`?n:t===`recovered`?n+1:void 0,`${t} signature`)}class y{constructor(e,t,n){this.r=_(`r`,e),this.s=_(`s`,t),n!=null&&(this.recovery=n),Object.freeze(this)}static fromBytes(e,t=h){v(e,t);let n;if(t===`der`){let{r:t,s:n}=sf.toSig(Ju(e));return new y(t,n)}t===`recovered`&&(n=e[0],t=`compact`,e=e.subarray(1));let r=o.BYTES,i=e.subarray(0,r),a=e.subarray(r,r*2);return new y(o.fromBytes(i),o.fromBytes(a),n)}static fromHex(e,t){return this.fromBytes(Dn(e),t)}addRecoveryBit(e){return new y(this.r,this.s,e)}recoverPublicKey(t){let n=a.ORDER,{r,s:i,recovery:c}=this;if(c==null||![0,1,2,3].includes(c))throw Error(`recovery id invalid`);if(s*uf<n&&c>1)throw Error(`recovery id is ambiguous for h>1 curve`);let l=c===2||c===3?r+s:r;if(!a.isValid(l))throw Error(`recovery id 2 or 3 invalid`);let u=a.toBytes(l),d=e.fromBytes(Cn(hf(!(c&1)),u)),f=o.inv(l),p=x(td(`msgHash`,t)),m=o.create(-p*f),h=o.create(i*f),g=e.BASE.multiplyUnsafe(m).add(d.multiplyUnsafe(h));if(g.is0())throw Error(`point at infinify`);return g.assertValidity(),g}hasHighS(){return g(this.s)}toBytes(e=h){if(af(e),e===`der`)return Dn(sf.hexFromSig(this));let t=o.toBytes(this.r),n=o.toBytes(this.s);if(e===`recovered`){if(this.recovery==null)throw Error(`recovery bit must be present`);return Cn(Uint8Array.of(this.recovery),t,n)}return Cn(t,n)}toHex(e){return Tn(this.toBytes(e))}assertValidity(){}static fromCompact(e){return y.fromBytes(td(`sig`,e),`compact`)}static fromDER(e){return y.fromBytes(td(`sig`,e),`der`)}normalizeS(){return this.hasHighS()?new y(this.r,o.neg(this.s),this.recovery):this}toDERRawBytes(){return this.toBytes(`der`)}toDERHex(){return Tn(this.toBytes(`der`))}toCompactRawBytes(){return this.toBytes(`compact`)}toCompactHex(){return Tn(this.toBytes(`compact`))}}let b=n.bits2int||function(e){if(e.length>8192)throw Error(`input is too large`);let t=Zu(e),n=e.length*8-c;return n>0?t>>BigInt(n):t},x=n.bits2int_modN||function(e){return o.create(b(e))},S=od(c);function C(e){return id(`num < 2^`+c,e,cf,S),o.toBytes(e)}function w(e,n){return Ju(e,void 0,`message`),n?Ju(t(e),void 0,`prehashed message`):e}function T(t,n,i){if([`recovered`,`canonical`].some(e=>e in i))throw Error(`sign() legacy options not supported`);let{lowS:a,prehash:s,extraEntropy:c}=of(i,m);t=w(t,s);let l=x(t),u=pf(o,n),d=[C(u),C(l)];if(c!=null&&c!==!1){let e=c===!0?r(p.secretKey):c;d.push(td(`extraEntropy`,e))}let f=Cn(...d),h=l;function _(t){let n=b(t);if(!o.isValidNot0(n))return;let r=o.inv(n),i=e.BASE.multiply(n).toAffine(),s=o.create(i.x);if(s===cf)return;let c=o.create(r*o.create(h+s*u));if(c===cf)return;let l=(i.x===s?0:2)|Number(i.y&lf),d=c;return a&&g(c)&&(d=o.neg(c),l^=1),new y(s,d,l)}return{seed:f,k2sig:_}}function E(e,n,r={}){e=td(`message`,e);let{seed:a,k2sig:s}=T(e,n,r);return sd(t.outputLen,o.BYTES,i)(a,s)}function D(e){let t,n=typeof e==`string`||En(e),r=!n&&typeof e==`object`&&!!e&&typeof e.r==`bigint`&&typeof e.s==`bigint`;if(!n&&!r)throw Error(`invalid signature, expected Uint8Array, hex string or Signature instance`);if(r)t=new y(e.r,e.s);else if(n){try{t=y.fromBytes(td(`sig`,e),`der`)}catch(e){if(!(e instanceof sf.Err))throw e}if(!t)try{t=y.fromBytes(td(`sig`,e),`compact`)}catch{return!1}}return t||!1}function ee(t,n,r,i={}){let{lowS:a,prehash:s,format:c}=of(i,m);if(r=td(`publicKey`,r),n=w(td(`message`,n),s),`strict`in i)throw Error(`options.strict was renamed to lowS`);let l=c===void 0?D(t):y.fromBytes(td(`sig`,t),c);if(l===!1)return!1;try{let t=e.fromBytes(r);if(a&&l.hasHighS())return!1;let{r:i,s}=l,c=x(n),u=o.inv(s),d=o.create(c*u),f=o.create(i*u),p=e.BASE.multiplyUnsafe(d).add(t.multiplyUnsafe(f));return!p.is0()&&o.create(p.x)===i}catch{return!1}}function te(e,t,n={}){let{prehash:r}=of(n,m);return t=w(t,r),y.fromBytes(e,`recovered`).recoverPublicKey(t).toBytes()}return Object.freeze({keygen:l,getPublicKey:u,getSharedSecret:d,utils:f,lengths:p,Point:e,sign:E,verify:ee,recoverPublicKey:te,Signature:y,hash:t})}function yf(e){let t={a:e.a,b:e.b,p:e.Fp.ORDER,n:e.n,h:e.h,Gx:e.Gx,Gy:e.Gy},n=e.Fp,r=e.allowedPrivateKeyLengths?Array.from(new Set(e.allowedPrivateKeyLengths.map(e=>Math.ceil(e/2)))):void 0;return{CURVE:t,curveOpts:{Fp:n,Fn:Pd(t.n,{BITS:e.nBitLength,allowedLengths:r,modFromBytes:e.wrapPrivateKey}),allowInfinityPoint:e.allowInfinityPoint,endo:e.endo,isTorsionFree:e.isTorsionFree,clearCofactor:e.clearCofactor,fromBytes:e.fromBytes,toBytes:e.toBytes}}}function bf(e){let{CURVE:t,curveOpts:n}=yf(e),r={hmac:e.hmac,randomBytes:e.randomBytes,lowS:e.lowS,bits2int:e.bits2int,bits2int_modN:e.bits2int_modN};return{CURVE:t,curveOpts:n,hash:e.hash,ecdsaOpts:r}}function xf(e,t){let n=t.Point;return Object.assign({},t,{ProjectivePoint:n,CURVE:Object.assign({},e,Nd(n.Fn.ORDER,n.Fn.BITS))})}function Sf(e){let{CURVE:t,curveOpts:n,hash:r,ecdsaOpts:i}=bf(e);return xf(e,vf(mf(t,n),r,i))}function Cf(e,t){let n=t=>Sf({...e,hash:t});return{...n(t),create:n}}function wf(e,t={}){return typeof e.chainId==`string`?Tf(e):{...e,...t.signature}}function Tf(e){let{address:t,chainId:n,nonce:r}=e,i=Fn(e);return zn({r:i.r,s:i.s}),kf(i.yParity),{address:t,chainId:Number(n),nonce:BigInt(r),...i}}function Ef(e){return e.map(Tf)}function Df(e){let{address:t,chainId:n,nonce:r,...i}=e;return kf(i.yParity),{address:t,chainId:k(n),nonce:k(r),...Un(i),yParity:k(i.yParity)}}function Of(e){return e.map(Df)}function kf(e){if(!(Number.isInteger(e)&&e>=0&&e<256))throw new pn({max:`255`,min:`0`,signed:!1,size:1,value:`${e}`})}function Af(e,t){return typeof e==`string`?e:k(e,t)}var jf={default:0,sender:2,verify:1},Mf={approveExecution:2,approveExecutionAndPayment:3,approvePayment:1,atomicBatch:4,none:0};function Nf(e){let{data:t=`0x`,executionGas:n=0n,flags:r=0,mode:i=0,stateGas:a=0n,value:o=0n}=e,s=typeof i==`string`?jf[i]:i;if(!Number.isInteger(s)||s<0||s>2)throw new Lf(`mode must be a supported name or 0, 1, or 2.`);let c=typeof r==`string`?Mf[r]:r;if(!Number.isInteger(c)||c<0||c>7)throw new Lf(`flags must be a supported name or an integer from 0 to 7.`);if(c&Mf.atomicBatch){if(s===jf.verify)throw new Lf(`VERIFY frames cannot belong to an atomic batch.`);if(c&Mf.approveExecutionAndPayment)throw new Lf(`Atomic batch frames cannot approve execution or payment.`)}e.to!==void 0&&Te(e.to,{strict:!1});for(let[e,t]of[[`executionGas`,n],[`stateGas`,a]])if(typeof t!=`bigint`||t<0n||t>=2n**64n)throw new Lf(`${e} must be an unsigned 64-bit integer.`);if(n+a>=2n**64n)throw new Lf(`Combined frame gas must be less than 2^64.`);if(typeof o!=`bigint`||o<0n||o>=2n**256n)throw new Lf(`value must be an unsigned 256-bit integer.`);if(s!==jf.sender&&o!==0n)throw new Lf(`Only SENDER frames can transfer value.`);if(fn(t,{strict:!0}),t.length%2!=0)throw new Lf(`data must contain whole bytes.`)}function Pf(e){return Nf(e),{...e}}function Ff(e){return Pf({data:e.data,executionGas:an(e.executionGas),flags:cn(e.flags),mode:cn(e.mode),stateGas:an(e.stateGas),...e.target==null?{}:{to:e.target},value:an(e.value)})}function If(e){let{flags:t=0,mode:n=0}=e;return{data:e.data??`0x`,executionGas:Af(e.executionGas??0n),flags:k(typeof t==`string`?Mf[t]:t),mode:k(typeof n==`string`?jf[n]:n),stateGas:Af(e.stateGas??0n),...e.to===void 0?{}:{target:e.to},value:Af(e.value??0n)}}var Lf=class extends un{constructor(e){super(`Invalid frame.`,{details:e}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:`Frame.InvalidError`})}},Rf=115792089210356248762697446949407573529996955224135760342422259061068512044369n,zf=115792089237316195423570985008687907852837564279074904382605163141518161494337n,Bf={arbitrary:0,p256:2,secp256k1:1};function Vf(e,t={}){let n=typeof e.scheme==`string`?Bf[e.scheme]:e.scheme;if(!Number.isInteger(n)||n<0||n>2)throw new qf(`Unsupported signature scheme.`);if(n===0&&e.signer!==void 0)throw new qf(`Arbitrary signatures cannot specify a signer.`);e.signer!==void 0&&Te(e.signer,{strict:!1});let r=e.payload??`0x`;if(fn(r,{strict:!0}),r!==`0x`&&(r.length!==66||an(r)===0n))throw new qf(`payload must be empty or a nonzero 32-byte digest.`);switch(e.scheme){case 0:case`arbitrary`:if(fn(e.signature,{strict:!0}),e.signature.length%2!=0)throw new qf(`signature must contain whole bytes.`);return}if(e.scheme===2||e.scheme===`p256`){if(e.publicKey!==void 0){In(e.publicKey,{compressed:!1});for(let t of[e.publicKey.x,e.publicKey.y])if(typeof t!=`bigint`||t<0n||t>=2n**256n)throw new qf(`Public key coordinates must fit in 32 bytes.`)}if(e.signature!==void 0&&e.signature!==`0x`&&e.publicKey===void 0)throw new qf(`P-256 signatures require a public key.`)}if(e.signature===void 0||e.signature===`0x`){if(t.signed)throw new qf(`Signature is required.`);return}typeof e.signature==`string`&&fn(e.signature,{strict:!0});let i=typeof e.signature==`string`?Qn(e.signature):e.signature;if(typeof i.r!=`bigint`||typeof i.s!=`bigint`)throw new qf(`Signature scalars must be bigint.`);if((n===1||i.yParity!==void 0)&&i.yParity!==0&&i.yParity!==1)throw new qf(`Signature parity must be 0 or 1.`);zn(i,{recovered:n===1});let a=i.r,o=i.s,s=n===1?zf:Rf;if(a===0n||a>=s||o===0n||o>=s||n===1&&o>s/2n)throw new qf(`Signature scalars must be in range; secp256k1 requires low-s.`)}function Hf(e){let t=typeof e==`string`?{payload:`0x`,scheme:`arbitrary`,signature:e}:{...e,payload:e.payload??`0x`,scheme:e.scheme??`arbitrary`};return Vf(t),t}function Uf(e){return Gf([e.scheme===`0x0`?`0x`:k(cn(e.scheme),{size:1}),e.signer??`0x`,e.msg??`0x`,e.signature??`0x`])}function Wf(e){let[t,n,r,i]=Kf(e);return{msg:r,scheme:t===`0x`?`0x0`:k(cn(t)),...i===`0x`&&t!==`0x`?{}:{signature:i},...n===`0x`?{}:{signer:n}}}function Gf(e){if(!Array.isArray(e)||e.length!==4)throw new qf(`Expected [scheme, signer, payload, signature].`);let[t,n,r,i]=e;if(fn(n,{strict:!0}),fn(i,{strict:!0}),i.length%2!=0)throw new qf(`signature must contain whole bytes.`);if(t!==`0x`&&t!==`0x01`&&t!==`0x02`)throw new qf(`Expected a canonical scheme encoding: empty bytes, 0x01, or 0x02.`);let a={...n===`0x`?{}:{signer:n},payload:r};if(t===`0x`){if(n!==`0x`)throw new qf(`Arbitrary signatures cannot specify a signer.`);return Hf({payload:r,scheme:`arbitrary`,signature:i})}if(i===`0x`)return Hf(t===`0x01`?{...a,scheme:`secp256k1`}:{...a,scheme:`p256`});if(ln(i)!==(t===`0x01`?65:128))throw new qf(`Invalid protocol signature length.`);if(t===`0x01`){if(cn(gn(i,0,1))>1)throw new qf(`Recovery parity must be 0 or 1.`);return Hf({...a,scheme:`secp256k1`,signature:{r:an(gn(i,1,33)),s:an(gn(i,33,65)),yParity:cn(gn(i,0,1))}})}let o=an(gn(i,32,64));if(o>115792089210356248762697446949407573529996955224135760342422259061068512044369n/2n)throw new qf(`P-256 wire signatures require low-s.`);return Hf({...a,publicKey:{prefix:4,x:an(gn(i,64,96)),y:an(gn(i,96,128))},scheme:`p256`,signature:{r:an(gn(i,0,32)),s:o}})}function Kf(e){Vf(e);let t=typeof e.scheme==`string`?Bf[e.scheme]:e.scheme,n=(()=>{switch(e.scheme){case 0:case`arbitrary`:return e.signature;case 1:case`secp256k1`:{if(e.signature===void 0||e.signature===`0x`)return`0x`;let t=typeof e.signature==`string`?Qn(e.signature):e.signature;return yn(k(t.yParity,{size:1}),k(t.r,{size:32}),k(t.s,{size:32}))}case 2:case`p256`:{if(e.signature===void 0||e.signature===`0x`)return`0x`;let t=e.publicKey,n=typeof e.signature==`string`?Qn(e.signature):e.signature,r=n.s;return yn(k(n.r,{size:32}),k(r>115792089210356248762697446949407573529996955224135760342422259061068512044369n/2n?Rf-r:r,{size:32}),k(t.x,{size:32}),k(t.y,{size:32}))}}})();return[t?k(t,{size:1}):`0x`,e.signer??`0x`,e.payload??`0x`,n]}var qf=class extends un{constructor(e){super(`Invalid frame signature.`,{details:e}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:`FrameSignature.InvalidError`})}};function Jf(e,t){if(!Array.isArray(e)||e.length<1||e.length>16)throw new Zf(`Expected between 1 and 16 nonce keys.`);for(let[t,n]of e.entries()){if(typeof n!=`bigint`||n<0n||n>=2n**256n)throw new Zf(`Nonce keys must be unsigned 256-bit integers.`);if(t>0&&n<=e[t-1])throw new Zf(`Nonce keys must be strictly increasing.`)}if(e.length>1&&e[0]===0n)throw new Zf(`The zero nonce key cannot be combined with other keys.`);if(t!==void 0&&(typeof t!=`bigint`||t<0n||t>=2n**64n-1n))throw new Zf(`Nonce must be less than 2^64 - 1 and nonnegative.`)}function Yf(e,t){if(!Array.isArray(e))throw new Zf(`Expected a nonce key list.`);let n=e=>{if(typeof e!=`string`||!/^0x(?:0|[1-9a-fA-F][0-9a-fA-F]*)$/.test(e))throw new Zf(`Expected a canonical RPC nonce quantity.`);return an(e)},r=e.map(n);return Jf(r,t===void 0?void 0:n(t)),r}function Xf(e,t){if(!Array.isArray(e))throw new Zf(`Expected a nonce key list.`);let n=e.map(e=>Af(e));return Yf(n,t===void 0?void 0:Af(t)),n}var Zf=class extends un{constructor(){super(...arguments),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:`FrameNonce.InvalidError`})}},Qf={legacy:`0x0`,eip2930:`0x1`,eip1559:`0x2`,eip4844:`0x3`,eip7702:`0x4`,eip8141:`0x6`},$f={"0x0":`legacy`,"0x1":`eip2930`,"0x2":`eip1559`,"0x3":`eip4844`,"0x4":`eip7702`,"0x6":`eip8141`};function ep(e,t={}){if(!e)return null;let n=e.type===`0x6`?void 0:Rn(e),r={...e,...n};if(r.blockNumber=e.blockNumber?BigInt(e.blockNumber):null,`blockTimestamp`in e&&(r.blockTimestamp=e.blockTimestamp?BigInt(e.blockTimestamp):e.blockTimestamp===null?null:void 0),r.data=e.input,r.gas=BigInt(e.gas??0n),r.nonce=BigInt(e.nonce??0n),r.transactionIndex=e.transactionIndex?Number(e.transactionIndex):null,r.value=BigInt(e.value??0n),e.type===`0x6`&&e.nonceKeys!==void 0){if(e.nonce===void 0)throw new Zf(`A keyed transaction result requires nonce.`);r.nonceKeys=Yf(e.nonceKeys,e.nonce)}return e.frames&&(r.frames=e.frames.map(Ff)),e.signatures&&(r.signatures=e.signatures.map(Uf)),e.authorizationList&&(r.authorizationList=Ef(e.authorizationList)),e.chainId&&(r.chainId=e.type===`0x6`&&BigInt(e.chainId)>BigInt(2**53-1)?BigInt(e.chainId):Number(e.chainId)),e.gasPrice&&(r.gasPrice=BigInt(e.gasPrice)),e.maxFeePerBlobGas&&(r.maxFeePerBlobGas=BigInt(e.maxFeePerBlobGas)),e.maxFeePerGas&&(r.maxFeePerGas=BigInt(e.maxFeePerGas)),e.maxPriorityFeePerGas&&(r.maxPriorityFeePerGas=BigInt(e.maxPriorityFeePerGas)),e.type&&(r.type=$f[e.type]??e.type),n&&(r.v=Bn(n.yParity)),r}function tp(e,t){let n={};return n.blockHash=e.blockHash,n.blockNumber=typeof e.blockNumber==`bigint`?k(e.blockNumber):null,typeof e.blockTimestamp==`bigint`?n.blockTimestamp=k(e.blockTimestamp):e.blockTimestamp===null&&(n.blockTimestamp=null),n.from=e.from,n.gas=k(e.gas??0n),n.hash=e.hash,n.input=e.input,n.nonce=k(e.nonce??0n),n.to=e.to,n.transactionIndex=e.transactionIndex?k(e.transactionIndex):null,n.type=Qf[e.type]??e.type,n.value=k(e.value??0n),e.type===`eip8141`&&e.nonceKeys!==void 0&&(n.nonceKeys=Xf(e.nonceKeys,e.nonce)),e.frames&&(n.frames=e.frames.map(If)),e.signatures&&(n.signatures=e.signatures.map(Wf)),e.accessList&&(n.accessList=e.accessList),e.authorizationList&&(n.authorizationList=Of(e.authorizationList)),e.blobVersionedHashes&&(n.blobVersionedHashes=e.blobVersionedHashes),e.chainId&&(n.chainId=k(e.chainId)),typeof e.gasPrice==`bigint`&&(n.gasPrice=k(e.gasPrice)),typeof e.maxFeePerBlobGas==`bigint`&&(n.maxFeePerBlobGas=k(e.maxFeePerBlobGas)),typeof e.maxFeePerGas==`bigint`&&(n.maxFeePerGas=k(e.maxFeePerGas)),typeof e.maxPriorityFeePerGas==`bigint`&&(n.maxPriorityFeePerGas=k(e.maxPriorityFeePerGas)),typeof e.r==`bigint`&&(n.r=k(e.r,{size:32})),typeof e.s==`bigint`&&(n.s=k(e.s,{size:32})),typeof e.v==`number`&&(n.v=k(e.v,{size:1})),typeof e.yParity==`number`&&(n.yParity=e.yParity===0?`0x0`:`0x1`),n}function np(e){let{executionGas:t,stateGas:n,...r}=If(e);return{...r,...e.executionGas===void 0?{}:{executionGas:t},...e.stateGas===void 0?{}:{stateGas:n}}}var rp=class extends Error{constructor(e){let{cause:t,code:n,message:r,data:i,stack:a}=e;super(r,{cause:t}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:`RpcResponse.BaseError`}),Object.defineProperty(this,"cause",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"stack",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"code",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.cause=t,this.code=n,this.data=i,this.stack=a??``}};Object.defineProperty(class e extends rp{constructor(t={}){super({code:e.code,data:t.data,message:t.message??`Missing or invalid parameters.`}),Object.defineProperty(this,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32e3}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:`RpcResponse.InvalidInputError`})}},"code",{enumerable:!0,configurable:!0,writable:!0,value:-32e3}),Object.defineProperty(class e extends rp{constructor(t={}){super({code:e.code,data:t.data,message:t.message??`Requested resource not found.`}),Object.defineProperty(this,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32001}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:`RpcResponse.ResourceNotFoundError`})}},"code",{enumerable:!0,configurable:!0,writable:!0,value:-32001}),Object.defineProperty(class e extends rp{constructor(t={}){super({code:e.code,data:t.data,message:t.message??`Requested resource not available.`}),Object.defineProperty(this,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32002}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:`RpcResponse.ResourceUnavailableError`})}},"code",{enumerable:!0,configurable:!0,writable:!0,value:-32002});var ip=class e extends rp{constructor(t={}){super({code:e.code,data:t.data,message:t.message??`Transaction creation failed.`}),Object.defineProperty(this,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32003}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:`RpcResponse.TransactionRejectedError`})}};Object.defineProperty(ip,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32003}),Object.defineProperty(class e extends rp{constructor(t={}){super({code:e.code,data:t.data,message:t.message??`Method is not implemented.`}),Object.defineProperty(this,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32004}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:`RpcResponse.MethodNotSupportedError`})}},"code",{enumerable:!0,configurable:!0,writable:!0,value:-32004});var ap=class e extends rp{constructor(t={}){super({code:e.code,data:t.data,message:t.message??`Rate limit exceeded.`}),Object.defineProperty(this,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32005}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:`RpcResponse.LimitExceededError`})}};Object.defineProperty(ap,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32005}),Object.defineProperty(class e extends rp{constructor(t={}){super({code:e.code,data:t.data,message:t.message??`JSON-RPC version not supported.`}),Object.defineProperty(this,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32006}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:`RpcResponse.VersionNotSupportedError`})}},"code",{enumerable:!0,configurable:!0,writable:!0,value:-32006}),Object.defineProperty(class e extends rp{constructor(t={}){super({code:e.code,data:t.data,message:t.message??`Input is not a valid JSON-RPC request.`}),Object.defineProperty(this,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32600}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:`RpcResponse.InvalidRequestError`})}},"code",{enumerable:!0,configurable:!0,writable:!0,value:-32600}),Object.defineProperty(class e extends rp{constructor(t={}){super({code:e.code,data:t.data,message:t.message??`Method does not exist.`}),Object.defineProperty(this,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32601}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:`RpcResponse.MethodNotFoundError`})}},"code",{enumerable:!0,configurable:!0,writable:!0,value:-32601});var op=class e extends rp{constructor(t={}){super({code:e.code,data:t.data,message:t.message??`Invalid method parameters.`}),Object.defineProperty(this,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32602}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:`RpcResponse.InvalidParamsError`})}};Object.defineProperty(op,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32602});var sp=class e extends rp{constructor(t={}){super({cause:t.cause,code:e.code,data:t.data,message:t.message??`Internal JSON-RPC error.`,stack:t.stack}),Object.defineProperty(this,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32603}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:`RpcResponse.InternalError`})}};Object.defineProperty(sp,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32603}),Object.defineProperty(class e extends rp{constructor(t={}){super({code:e.code,data:t.data,message:t.message??`Failed to parse JSON-RPC response.`}),Object.defineProperty(this,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32700}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:`RpcResponse.ParseError`})}},"code",{enumerable:!0,configurable:!0,writable:!0,value:-32700});function cp(e){let t={};return e.accessList!==void 0&&(t.accessList=e.accessList),e.authorizationList!==void 0&&(t.authorizationList=Of(e.authorizationList)),e.blobVersionedHashes!==void 0&&(t.blobVersionedHashes=e.blobVersionedHashes),e.blobs!==void 0&&(t.blobs=e.blobs),e.chainId!==void 0&&(t.chainId=k(e.chainId)),e.data===void 0?e.input!==void 0&&(t.data=e.input,t.input=e.input):(t.data=e.data,t.input=e.data),e.from!==void 0&&(t.from=e.from),e.frames&&(t.frames=e.frames.map(np)),e.signatures&&(t.signatures=e.signatures.map(Wf)),e.gas!==void 0&&(t.gas=k(e.gas)),e.gasPrice!==void 0&&(t.gasPrice=k(e.gasPrice)),e.maxFeePerBlobGas!==void 0&&(t.maxFeePerBlobGas=k(e.maxFeePerBlobGas)),e.maxFeePerGas!==void 0&&(t.maxFeePerGas=k(e.maxFeePerGas)),e.maxPriorityFeePerGas!==void 0&&(t.maxPriorityFeePerGas=k(e.maxPriorityFeePerGas)),e.maxPriorityFeePerGas!==void 0&&(t.maxPriorityFeePerGas=k(e.maxPriorityFeePerGas)),e.nonce!==void 0&&(t.nonce=k(e.nonce)),e.nonceKeys!==void 0&&(t.nonceKeys=Xf(e.nonceKeys,e.nonce)),e.to!==void 0&&(t.to=e.to),e.type!==void 0&&(t.type=Qf[e.type]||e.type),e.value!==void 0&&(t.value=k(e.value)),t}function lp(e){let{account:t,config:n}=e,r=e.type===`transaction`?de(Le(e.transaction)):Nt(zt(e.keyAuthorization));return Gt({account:t,config:n,payload:r})}function up(e){try{let t=St(e.config);if(typeof t.threshold!=`number`||t.owners.some(e=>typeof e.weight!=`number`))throw new F({reason:`config threshold and owner weights must be numbers`});let n={...e,config:t};if(fp(n,t),n.type===`transaction`)pp(n);else if(n.type===`keyAuthorization`)mp(n,t);else throw new F({reason:`unknown operation type`});return n}catch(e){throw e instanceof F?e:new F({cause:e})}}function dp(e){try{let t=e.config?.version;if(typeof t!=`string`||!sn(t))throw new F({reason:`config.version must be a hexadecimal quantity`});let n=an(t);if(k(n)!==t)throw new F({reason:`config.version must use canonical quantity encoding`});return up({...e,config:lt(e.config)})}catch(e){throw e instanceof F?e:new F({cause:e})}}function fp(e,t){if(!nn(e.account))throw new F({reason:`account is invalid`});if(an(e.account)===0n)throw new F({reason:`account cannot be zero`});if(!tr(e.hash))throw new F({reason:`hash is invalid`});if(yp(e.createdAt,`createdAt`),yp(e.updatedAt,`updatedAt`),e.updatedAt<e.createdAt)throw new F({reason:`updatedAt cannot precede createdAt`});if(yp(e.signatureCount,`signatureCount`),yp(e.threshold,`threshold`),yp(e.weight,`weight`),e.threshold!==Number(t.threshold))throw new F({reason:`threshold must equal config.threshold`});if(e.weight>255)throw new F({reason:`weight exceeds u8 max`});if(e.signatureCount>8)throw new F({reason:`too many selected signatures`});if(!Array.isArray(e.approvals))throw new F({reason:`approvals must be an array`});if(e.approvals.length>t.owners.length)throw new F({reason:`too many retained approvals`});if(e.signatureCount>e.approvals.length)throw new F({reason:`signatureCount exceeds retained approvals`});if(e.signatureCount===0!=(e.weight===0))throw new F({reason:`signatureCount and weight must both be zero or nonzero`});let n=new Map(t.owners.map(e=>[e.owner.toLowerCase(),Number(e.weight)])),r=[],i=new Set;for(let a of e.approvals){if(typeof a!=`string`||!sn(a,{strict:!0}))throw new F({reason:`approval is invalid`});let o=hp(e.account,a,t),s=bt({payload:e.hash,signature:o}).toLowerCase(),c=n.get(s);if(c===void 0)throw new F({reason:`approval is from a non-owner`});if(i.has(s))throw new F({reason:e.type===`keyAuthorization`?`key authorization contains duplicate owner approvals`:`duplicate owner approval`});i.add(s),r.push(c)}if(!_p(r,e.signatureCount,e.weight))throw new F({reason:`weight is not reachable by signatureCount retained owner approvals`})}function pp(e){if(`keyAuthorization`in e&&e.keyAuthorization!==void 0)throw new F({reason:`transaction operations cannot contain keyAuthorization`});let t=e.expiresAt,n=e.submissionId,r=e.transactionHash;if(e.status===`pending`){if(t!==void 0||n!==void 0||r!==void 0)throw new F({reason:`pending transactions cannot contain submission fields`})}else if(e.status===`submitting`){if(yp(t,`expiresAt`),!tr(n??``))throw new F({reason:`submissionId is invalid`});if(n.toLowerCase()===e.hash.toLowerCase())throw new F({reason:`submissionId must differ from the operation hash`});if(r!==void 0)throw new F({reason:`submitting transactions cannot contain transactionHash`})}else if(e.status===`success`){if(!tr(r??``))throw new F({reason:`transactionHash is invalid`});if(t!==void 0||n!==void 0)throw new F({reason:`successful transactions cannot contain submission fields`})}else throw new F({reason:`invalid transaction status`});if(e.status!==`pending`&&(e.weight<e.threshold||e.signatureCount===0))throw new F({reason:`submitted transactions must have quorum`});if(typeof e.transaction!=`string`)throw new F({reason:`transaction is invalid`});let i=Le(e.transaction);if(i.signature)throw new F({reason:`transaction must not contain an outer sender signature`});if(i.from&&i.from.toLowerCase()!==e.account.toLowerCase())throw new F({reason:`transaction sender does not match the operation account`});vp(e,de(i));let a=e.transaction.startsWith(pe);if(Be(i,a?i.from?{format:`feePayer`,sender:i.from}:{format:`feePayer`}:{}).toLowerCase()!==e.transaction.toLowerCase())throw new F({reason:`transaction is not canonically serialized`})}function mp(e,t){let n=e;if(n.expiresAt!==void 0||n.submissionId!==void 0||n.transaction!==void 0||n.transactionHash!==void 0)throw new F({reason:`key authorization operations cannot contain transaction fields`});if(e.status!==`pending`&&e.status!==`success`)throw new F({reason:`invalid key authorization status`});if(e.status===`success`&&(e.weight<e.threshold||e.signatureCount===0))throw new F({reason:`successful key authorizations must have quorum`});if(e.status===`pending`&&e.weight>=e.threshold)throw new F({reason:`pending key authorizations cannot have quorum`});if(typeof e.keyAuthorization!=`string`)throw new F({reason:`keyAuthorization is invalid`});let r=zt(e.keyAuthorization);if(!r.account||r.account.toLowerCase()!==e.account.toLowerCase())throw new F({reason:`key authorization account does not match the operation account`});let i=r.signature;if(e.status===`pending`&&i)throw new F({reason:`pending key authorizations must be unsigned`});if(e.status===`success`){if(i?.type!==`configurable`)throw new F({reason:`successful key authorizations require a configurable account signature`});if(i.account.toLowerCase()!==e.account.toLowerCase())throw new F({reason:`key authorization signature account does not match`});if(i.signatures.length!==e.signatureCount)throw new F({reason:`key authorization signatureCount does not match its signature`});if(gp(e,i.signatures,r),!bp(i.config,t))throw new F({reason:`key authorization config does not match`})}if(vp(e,Nt(r)),ft(r).toLowerCase()!==e.keyAuthorization.toLowerCase())throw new F({reason:`keyAuthorization is not canonically serialized`})}function hp(e,t,n){let r=Xe(t);if(r.type===`keychain`||r.type===`configurable`)throw new F({reason:`only primitive owner approvals are allowed`});if(It({account:e,config:n,signatures:[r],type:`configurable`}),$e(r).toLowerCase()!==t.toLowerCase())throw new F({reason:`approval is not canonical`});return r}function gp(e,t,n){let r=e.approvals.map(e=>Xe(e));for(let e of t){let t=r.findIndex(t=>$e(t).toLowerCase()===$e(e).toLowerCase());if(t===-1)throw new F({reason:`key authorization signature is not a retained approval`});r.splice(t,1)}let i=Gt({account:e.account,config:e.config,payload:Nt(n)}),a=t.map(e=>bt({payload:i,signature:e}));for(let e=1;e<a.length;e++){let t=an(a[e-1]),n=an(a[e]);if(t===n)throw new F({reason:`key authorization contains duplicate owner approvals`});if(t>n)throw new F({reason:`key authorization approvals are not canonically ordered`})}}function _p(e,t,n){let r=Array.from({length:t+1},()=>new Set);r[0].add(0);for(let n of e)for(let e=t;e>0;e--)for(let t of r[e-1])r[e].add(t+n);return r[t].has(n)}function vp(e,t){if(Gt({account:e.account,config:e.config,payload:t}).toLowerCase()!==e.hash.toLowerCase())throw new F({reason:`hash does not match the operation payload`})}function yp(e,t){if(typeof e!=`number`||!Number.isSafeInteger(e)||e<0)throw new F({reason:`${t} must be a nonnegative safe integer`})}function bp(e,t){let n=St(e),r=St(t);return bn(n.salt??Me,r.salt??Me)&&n.threshold===r.threshold&&n.version===r.version&&n.owners.length===r.owners.length&&n.owners.every((e,t)=>{let n=r.owners[t];return ke(e.owner,n.owner)&&e.weight===n.weight})}var F=class extends un{constructor(e={}){super(e.reason?`Invalid account operation: ${e.reason}.`:`Invalid account operation.`,{cause:e.cause}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:`AccountOperation.InvalidOperationError`})}};function xp(e){let{approvals:t,config:n,signer:r}=e;return Sp(t),r!==void 0&&Te(r),{approvals:t.map(({keyData:e,keyType:t,owner:n})=>({...e===void 0?{}:{keyData:wp(e)},...t===void 0?{}:{keyType:t},owner:n})),config:Cp(n),...r===void 0?{}:{signer:r}}}function Sp(e){if(e.some(e=>typeof e!=`object`||!e||`spec`in e||`type`in e))throw new Tp({reason:`only untagged primitive owner approvals are allowed`});if(e.length>8)throw new Tp({reason:`approval count exceeds 8`})}function Cp(e){return Pe(qe(e))}function wp(e){let t=ln(e);return t===1||t===2||t===4?e:k(t,{size:2})}var Tp=class extends un{constructor(e){super(`Invalid account simulation: ${e.reason}.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:`AccountSimulation.InvalidSimulationError`})}},Ep={...Qf,tempo:`0x76`},Dp={...$f,"0x76":`tempo`};function Op(e,t={}){if(!e)return null;let n=ep(e);return n.type=Dp[e.type],e.aaAuthorizationList&&(n.authorizationList=b(e.aaAuthorizationList),delete n.aaAuthorizationList),e.calls&&(n.calls=e.calls.map(e=>({to:e.to,value:e.value&&e.value!==`0x`?BigInt(e.value):void 0,data:e.input||e.data||`0x`}))),e.feeToken&&(n.feeToken=e.feeToken),e.nonceKey&&(n.nonceKey=BigInt(e.nonceKey)),e.signature&&(n.signature=Ht(e.signature)),e.validAfter&&(n.validAfter=Number(e.validAfter)),e.validBefore&&(n.validBefore=Number(e.validBefore)),e.keyAuthorization&&(n.keyAuthorization=wt(e.keyAuthorization)),e.feePayerSignature&&(n.feePayerSignature=Fn(e.feePayerSignature),n.feePayerSignature.v=Bn(n.feePayerSignature.yParity)),n}function kp(e,t){let n=tp(e);return n.type=Ep[e.type],e.authorizationList&&(n.aaAuthorizationList=tt(e.authorizationList)),e.calls&&(n.calls=e.calls.map(e=>({to:e.to,value:e.value?k(e.value):void 0,data:e.data}))),e.feeToken&&(n.feeToken=e.feeToken),e.keyAuthorization&&(n.keyAuthorization=We(e.keyAuthorization)),typeof e.nonceKey==`bigint`&&(n.nonceKey=k(e.nonceKey)),e.feePayerSignature&&(n.feePayerSignature=Un(e.feePayerSignature),n.feePayerSignature.v=k(Bn(e.feePayerSignature?.yParity))),e.signature&&(n.signature=it(e.signature)),typeof e.validAfter==`number`&&(n.validAfter=k(e.validAfter)),typeof e.validBefore==`number`&&(n.validBefore=k(e.validBefore)),n}function Ap(e){let t=cp({...e,authorizationList:void 0});e.authorizationList&&(t.authorizationList=tt(e.authorizationList)),e.calls?t.calls=e.calls.map(e=>({to:e.to?Dt(e.to):e.to,value:e.value?k(e.value):`0x`,data:e.data??`0x`})):(e.to||e.data||e.value)&&(t.calls=[{to:e.to?Dt(e.to):void 0,value:e.value?k(e.value):`0x`,data:e.data??`0x`}]),e.feeToken!==void 0&&(t.feeToken=Oe(e.feeToken)),e.keyAuthorization&&(t.keyAuthorization=We(e.keyAuthorization)),e.keyAuthorizationSimulation&&(t.keyAuthorizationSimulation=xp(e.keyAuthorizationSimulation)),e.accountSimulation&&(t.configurableAccountSimulation=xp(e.accountSimulation)),e.validBefore!==void 0&&(t.validBefore=k(e.validBefore)),e.validAfter!==void 0&&(t.validAfter=k(e.validAfter));let n=(()=>{if(e.nonceKey===`random`)return on(6);if(typeof e.nonceKey==`bigint`)return k(e.nonceKey)})();return n&&(t.nonceKey=n),(e.accountSimulation!==void 0||e.calls!==void 0||e.feePayer!==void 0||e.feeToken!==void 0||e.keyAuthorization!==void 0||e.nonceKey!==void 0||e.validBefore!==void 0||e.validAfter!==void 0||e.type===`tempo`)&&(t.type=Ep.tempo,delete t.data,delete t.input,delete t.to,delete t.value),t}var jp=`0xfdfdfdfdfdfdfdfdfdfd`;function Mp(e){try{let t=Fp(e);return gn(t,4,14).toLowerCase()===jp}catch{return!1}}function Np(e){let t=Fp(e);if(gn(t,4,14).toLowerCase()!==`0xfdfdfdfdfdfdfdfdfdfd`)throw new Pp({address:t});return{masterId:gn(t,0,4),userTag:gn(t,14,20)}}var Pp=class extends un{constructor({address:e}){super(`Address "${e}" does not contain the TIP-1022 virtual address marker.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:`VirtualAddress.InvalidMagicError`})}};function Fp(e){let t=Dt(e);return Te(t,{strict:!1}),t}var Ip=`<redacted>`,Lp=`VOID_ENV_UNMASK`;function Rp(e,t,n={}){return n.unmask||typeof e!=`string`||e.length===0?t:t.split(e).join(Ip)}var zp=null;function Bp(){if(zp!==null)return zp;try{zp=globalThis.process?.env?.[Lp]===`1`}catch{zp=!1}return zp&&console.error(`[void/env] ${Lp}=1 is set — env validation errors will include raw values. Unset it before sharing logs.`),zp}var Vp=Symbol.for(`void.env.registry`),Hp=globalThis,Up=Hp[Vp]??={schema:null,hasDefineEnvBeenCalled:!1,bootValidation:null},Wp=new WeakMap,Gp=[];function Kp(e){let t=Wp.get(e);return t||(t=new Map,Wp.set(e,t),Gp.push(t)),t}function qp(){return Object.fromEntries(Object.entries({BASE_URL:`/`,DEV:!1,MODE:`production`,PROD:!0,SSR:!0,TSS_DEV_SERVER:`false`,TSS_DEV_SSR_STYLES_BASEPATH:`/`,TSS_DEV_SSR_STYLES_ENABLED:`true`,TSS_DISABLE_CSRF_MIDDLEWARE_WARNING:`false`,TSS_INLINE_CSS_ENABLED:`false`,TSS_ROUTER_BASEPATH:``,TSS_SERVER_FN_BASE:`/_serverFn/`}).filter(([e])=>e.startsWith(`VITE_`)))}var Jp=class extends Error{key;issues;constructor(e,t){super(`Invalid env "${e}": ${t.map(e=>e.message).join(`, `)}`),this.name=`EnvValidationError`,this.key=e,this.issues=t}};function Yp(e){let t=Kc();if(Qc(e,t))return;let n=el(),r=qp(),i=Object.hasOwn(r,e)?r[e]:n[e];if(!Up.schema)return i;let a=Up.schema[e];if(!a)return i;let o=Kp(t);if(o.has(e))return o.get(e);let s=a[`~standard`].validate(i);if(s instanceof Promise)throw Error(`env: Async validator for '${e}' cannot be resolved synchronously. Proxy property access is synchronous, so async Standard Schema validators must be pre-resolved by calling \`_validateEnvOnce(env)\` at worker boot (Void splices this into the generated entry) or by awaiting \`validateAllEnv(env)\` before the first \`env.${e}\` read. Once pre-validated, the resolved value is cached and served synchronously here.`);if(s.issues){let t=Bp();throw new Jp(e,s.issues.map(e=>({...e,message:Rp(i,e.message,{unmask:t})})))}return o.set(e,s.value),s.value}var I=new Proxy({},{get(e,t){if(typeof t!=`symbol`)return Yp(t)},has(e,t){return typeof t==`symbol`?!1:Object.hasOwn(qp(),t)||Reflect.has(el(),t)},ownKeys(){return[...new Set([...Reflect.ownKeys(el()),...Object.keys(qp())])]},getOwnPropertyDescriptor(e,t){if(typeof t!=`symbol`)return{enumerable:!0,configurable:!0,value:Yp(String(t))}}});function Xp(e={}){let t=e.challenge??on(32);return{challenge:t,options:Zn(nr({...e,challenge:t}))}}function Zp(e,t){let n=$n(e);return rr({...t,metadata:n.metadata,publicKey:Kn(t.publicKey),signature:n.signature})}function Qp(e){try{let{authData:t}=Jn(Ln(e.attestationObject));return t.length<53?void 0:$p(t.subarray(37,53))}catch{return}}function $p(e){let t=xn(e).slice(2);return[t.slice(0,8),t.slice(8,12),t.slice(12,16),t.slice(16,20),t.slice(20,32)].join(`-`)}function em(e={}){let t=e.challenge??on(32);return{challenge:t,options:Yn(ir({...e,challenge:t}))}}function tm(e,t){let n=di(e),r=er({...t,credential:n});return{...Xn(r),aaguid:Qp(e)}}function nm(){return typeof WebSocketPair<`u`||typeof navigator<`u`&&navigator.userAgent===`Cloudflare-Workers`||typeof EdgeRuntime<`u`&&EdgeRuntime===`vercel`}var rm;(typeof navigator>`u`||!navigator.userAgent?.startsWith?.(`Mozilla/5.0 `))&&(rm=`jose/v6.2.12`);var im=Symbol();async function am(e,t,n,r=fetch){let i=await r(e,{method:`GET`,signal:n,redirect:`manual`,headers:t}).catch(e=>{throw e.name===`TimeoutError`?new vs:e});if(i.status!==200)throw new Ao(`Expected 200 OK from the JSON Web Key Set HTTP response`);try{return await i.json()}catch{throw new Ao(`Failed to parse the JSON Web Key Set HTTP response as JSON`)}}var om=Symbol();function sm(e,t){return Number.isFinite(e)&&Date.now()<e+t}function cm(e,t,n){if(Number.isNaN(e))throw TypeError(`"${n}" option must not be NaN`);return typeof e==`number`?e:t}function lm(e,t){if(!(e instanceof URL))throw TypeError(`url must be an instance of URL`);let n=new URL(e.href).href,r=t??{},i=r.timeoutDuration;if(typeof i==`number`&&(!Number.isInteger(i)||i<0))throw TypeError(`"timeoutDuration" option must be a non-negative integer`);let a=typeof i==`number`?i:5e3,o=cm(r.cooldownDuration,3e4,`cooldownDuration`),s=cm(r.cacheMaxAge,6e5,`cacheMaxAge`),c=new Headers(r.headers);rm&&!c.has(`User-Agent`)&&c.set(`User-Agent`,rm),c.has(`accept`)||c.set(`accept`,`application/json, application/jwk-set+json`);let l=r[im],u=r[om],d,f,p=0,m=0,h;if(u&&typeof u==`object`){let{uat:e,jwks:t}=u;sm(e,s)&&No(t)&&(d=e,h=So(t))}let g=async()=>{if(f&&nm()&&(f=void 0),!f){let e=++p,t=f=am(n,c,AbortSignal.timeout(a),l).then(t=>{let n=So(t);if(e<=m)return;h=n;let r=Date.now();u&&(u.uat=r,u.jwks=t),d=r,m=e}).finally(()=>{f===t&&(f=void 0)})}await f};return Object.defineProperties(async(e,t)=>{(!h||!sm(d,s))&&await g();try{return await h(e,t)}catch(n){if(n instanceof lo&&!sm(d,o))return await g(),h(e,t);throw n}},{coolingDown:{get:()=>sm(d,o),enumerable:!0},fresh:{get:()=>sm(d,s),enumerable:!0},reload:{value:g,enumerable:!0},reloading:{get:()=>!!f,enumerable:!0},jwks:{value:()=>h?.jwks(),enumerable:!0}})}var um={N:16384,r:16,p:1,dkLen:64};function dm(e,t){return new Promise((n,r)=>{mc(e.normalize(`NFKC`),t,um.dkLen,{N:um.N,r:um.r,p:um.p,maxmem:128*um.N*um.r*2},(e,t)=>{e?r(e):n(t)})})}async function fm(e){let t=pc(16).toString(`hex`);return`${t}:${(await dm(e,t)).toString(`hex`)}`}async function pm(e,t){let[n,r]=e.split(`:`);if(!n||!r)throw Error(`Invalid password hash`);return(await dm(t,n)).toString(`hex`)===r}var mm=fm,hm=async({hash:e,password:t})=>pm(e,t),gm=[`state`,`client_id`,`redirect_uri`,`response_type`,`code_challenge`,`code_challenge_method`,`nonce`,`scope`],_m=new Set(gm);async function vm({id:e,options:t,authorizationEndpoint:n,state:r,codeVerifier:i,scopes:a,claims:o,redirectURI:s,duration:c,prompt:l,accessType:u,responseType:d,display:f,loginHint:p,nonce:m,hd:h,responseMode:g,additionalParams:_,scopeJoiner:v}){t=typeof t==`function`?await t():t;let y=new URL(t.authorizationEndpoint||n);y.searchParams.set(`response_type`,d||`code`);let b=ao(t.clientId);if(!b)throw Error(`OAuth provider requires clientId`);if(y.searchParams.set(`client_id`,b),y.searchParams.set(`state`,r),a?.length&&y.searchParams.set(`scope`,a.join(v||` `)),y.searchParams.set(`redirect_uri`,t.redirectURI||s),c&&y.searchParams.set(`duration`,c),f&&y.searchParams.set(`display`,f),p&&y.searchParams.set(`login_hint`,p),m&&y.searchParams.set(`nonce`,m),l&&y.searchParams.set(`prompt`,l),h&&y.searchParams.set(`hd`,h),u&&y.searchParams.set(`access_type`,u),g&&y.searchParams.set(`response_mode`,g),i){let e=await is(i);y.searchParams.set(`code_challenge_method`,`S256`),y.searchParams.set(`code_challenge`,e)}if(o){let e=o.reduce((e,t)=>(e[t]=null,e),{});y.searchParams.set(`claims`,JSON.stringify({id_token:{email:null,email_verified:null,...e}}))}if(_)for(let[e,t]of Object.entries(_))_m.has(e)||y.searchParams.set(e,t);return y}var ym=Ei(j(),j()).refine(e=>!Object.keys(e).some(e=>_m.has(e)),{message:`additionalParams cannot include reserved OAuth parameters: ${gm.join(`, `)}`}).meta({description:`Extra query parameters to append to the provider authorization URL (e.g. Cognito identity_provider, Google hd).`}).optional();function bm(e,t){return t===`basic`?{method:`client_secret_basic`}:e.clientSecret?{method:`client_secret_post`}:{method:`none`}}function xm(e,t,n){if(t.clientSecret||n.has(`client_secret`))throw Error(`${e} token endpoint authentication cannot be combined with clientSecret`)}function Sm(e,t){t&&e.set(`client_id`,t)}function Cm(e,t){if(!t.clientSecret)throw Error(`${e} token endpoint authentication requires clientSecret`)}function wm(e,t){if(!t)throw Error(`${e} token endpoint authentication requires clientId`)}function Tm({body:e,options:t,clientId:n,requireClientSecret:r}){r&&Cm(`client_secret_post`,t),t.clientSecret&&(wm(`client_secret_post`,n),Sm(e,n),e.set(`client_secret`,t.clientSecret))}function Em({headers:e,options:t,clientId:n,body:r}){if(r.has(`client_secret`))throw Error(`client_secret_basic token endpoint authentication cannot be combined with client_secret body parameters`);Cm(`client_secret_basic`,t),wm(`client_secret_basic`,n),e.authorization=ja(n,t.clientSecret)}function Dm(e){if(e.has(`client_assertion`)!==e.has(`client_assertion_type`))throw Error(`client_assertion and client_assertion_type must both be provided`)}async function Om({body:e,headers:t,options:n,tokenEndpoint:r,grantType:i,tokenEndpointAuth:a,authentication:o}){Dm(e);let s=ao(n.clientId);if(e.has(`client_assertion`)){if(a)throw Error(`client_assertion body parameters cannot be combined with tokenEndpointAuth`);xm(`private_key_jwt`,n,e),Sm(e,s);return}let c=a??bm(n,o);if(c.method===`custom`)await c.customizeRequest({body:e,headers:t,options:n,tokenEndpoint:r,grantType:i}),Dm(e);else if(c.method===`private_key_jwt`){if(xm(c.method,n,e),wm(c.method,s),!r)throw Error(`private_key_jwt token endpoint authentication requires tokenEndpoint`);let t=await to({getClientAssertion:c.getClientAssertion,context:{clientId:s,tokenEndpoint:r,grantType:i}});Sm(e,s);for(let[n,r]of Object.entries(t))e.set(n,r)}else if(c.method===`none`){if(xm(c.method,n,e),i===`client_credentials`)throw Error(`none token endpoint authentication cannot be used with client_credentials grant`);wm(c.method,s),Sm(e,s)}else c.method===`client_secret_basic`?Em({headers:t,options:n,clientId:s,body:e}):Tm({body:e,options:n,clientId:s,requireClientSecret:a?.method===`client_secret_post`})}var km=new Set([`grant_type`,`refresh_token`,`__proto__`,`constructor`,`prototype`]);async function Am({refreshToken:e,options:t,authentication:n,tokenEndpointAuth:r,tokenEndpoint:i,extraParams:a,resource:o}){t=typeof t==`function`?await t():t;let s=Mm({refreshToken:e,options:t,extraParams:a,resource:o});return await Om({body:s.body,headers:s.headers,options:t,tokenEndpoint:i??``,grantType:`refresh_token`,tokenEndpointAuth:r,authentication:n}),s}function jm(e,t){if(t)for(let[n,r]of Object.entries(t))km.has(n)||e.set(n,r)}function Mm({refreshToken:e,options:t,extraParams:n,resource:r}){let i=new URLSearchParams,a={"content-type":`application/x-www-form-urlencoded`,accept:`application/json`};if(i.set(`grant_type`,`refresh_token`),i.set(`refresh_token`,e),r){if(typeof r==`string`)i.append(`resource`,r);else for(let e of r)i.append(`resource`,e)}return n&&jm(i,n),{body:i,headers:a}}async function Nm({refreshToken:e,options:t,tokenEndpoint:n,authentication:r,tokenEndpointAuth:i,extraParams:a,resource:o}){let{body:s,headers:c}=await Am({refreshToken:e,options:t,authentication:r,tokenEndpointAuth:i,tokenEndpoint:n,extraParams:a,resource:o}),{data:l,error:u}=await Ta(n,{method:`POST`,body:s,headers:c});if(u)throw u;let d={accessToken:l.access_token,refreshToken:l.refresh_token,tokenType:l.token_type,scopes:so(l.scope),idToken:l.id_token};return l.expires_in&&(d.accessTokenExpiresAt=new Date(new Date().getTime()+l.expires_in*1e3)),l.refresh_token_expires_in&&(d.refreshTokenExpiresAt=new Date(new Date().getTime()+l.refresh_token_expires_in*1e3)),d}async function Pm({code:e,codeVerifier:t,redirectURI:n,options:r,authentication:i,tokenEndpointAuth:a,tokenEndpoint:o,deviceId:s,headers:c,additionalParams:l={},resource:u}){r=typeof r==`function`?await r():r;let d=Fm({code:e,codeVerifier:t,redirectURI:n,options:r,deviceId:s,headers:c,additionalParams:l,resource:u});return await Om({body:d.body,headers:d.headers,options:r,tokenEndpoint:o??``,grantType:`authorization_code`,tokenEndpointAuth:a,authentication:i}),d}function Fm({code:e,codeVerifier:t,redirectURI:n,options:r,deviceId:i,headers:a,additionalParams:o={},resource:s}){let c=new URLSearchParams,l={"content-type":`application/x-www-form-urlencoded`,accept:`application/json`,...a};if(c.set(`grant_type`,`authorization_code`),c.set(`code`,e),t&&c.set(`code_verifier`,t),r.clientKey&&c.set(`client_key`,r.clientKey),i&&c.set(`device_id`,i),c.set(`redirect_uri`,r.redirectURI||n),s){if(typeof s==`string`)c.append(`resource`,s);else for(let e of s)c.append(`resource`,e)}for(let[e,t]of Object.entries(o))c.has(e)||c.append(e,t);return{body:c,headers:l}}async function Im({code:e,codeVerifier:t,redirectURI:n,options:r,tokenEndpoint:i,authentication:a,tokenEndpointAuth:o,deviceId:s,headers:c,additionalParams:l={},resource:u}){let{body:d,headers:f}=await Pm({code:e,codeVerifier:t,redirectURI:n,options:r,authentication:a,tokenEndpointAuth:o,tokenEndpoint:i,deviceId:s,headers:c,additionalParams:l,resource:u}),{data:p,error:m}=await Ta(i,{method:`POST`,body:d,headers:f});if(m)throw m;return ka(p)}var Lm=30,Rm=[`iss`,`sub`,`aud`,`exp`,`iat`];function zm(e){return{issuer:e.issuer,audience:e.audience,algorithms:e.algorithms,maxTokenAge:e.maxTokenAge,requiredClaims:Rm,clockTolerance:Lm}}async function Bm(e){let t=new TextEncoder().encode(e),n=await crypto.subtle.digest(`SHA-256`,t);return Array.from(new Uint8Array(n)).map(e=>e.toString(16).padStart(2,`0`)).join(``)}async function Vm(e,t,n=`exact`){return typeof e==`string`?e===t||n===`exact-or-sha256`&&e===await Bm(t):!1}async function Hm(e,t,n){if(![t.audience].flat().some(Boolean))throw Error(`ID token audience is not configured`);let r=await ts(e,t.jwks,zm(t));if(n&&!await Vm(r.payload.nonce,n,t.nonceComparison))throw Error(`ID token nonce does not match`);if(t.verifyClaims&&!t.verifyClaims(r.payload))throw Error(`ID token claims were rejected`);return r}function Um(e){let t=e.options??{};return!t.disableIdTokenSignIn&&!!(e.idToken||t.verifyIdToken)}async function Wm(e,t,n,r){let i=e.options??{};if(i.disableIdTokenSignIn)return!1;try{if(i.verifyIdToken)return await i.verifyIdToken(t,n,r);let a=e.idToken;return a?`verify`in a?await a.verify(t,n,r):t.split(`.`).length===3?(await Hm(t,a,n),!0):a.allowOpaqueToken===!0:!1}catch{return!1}}var Gm=/[\u0000-\u001f\u007f-\u009f]/,Km=`https://better-auth.invalid`,qm=/%2[fF]|%5[cC]/,Jm=e=>{let t=e;try{t=decodeURIComponent(e)}catch{}let n=[];for(let e of t.split(`/`))e===`..`?n.pop():e!==`.`&&e!==``&&n.push(e);return n.length>0?`/${n.join(`/`)}`:``},Ym=e=>{if(Gm.test(e))return null;let t=e.indexOf(`:`);if(t<=0)return null;let n=e.slice(0,t).toLowerCase(),r=e.slice(t+1),i=``;if(r.startsWith(`//`)){r=r.slice(2);let e=r.search(/[/?#]/);e===-1?(i=r,r=``):(i=r.slice(0,e),r=r.slice(e))}let a=r.search(/[?#]/),o=Jm(a===-1?r:r.slice(0,a));return{scheme:n,authority:i.toLowerCase(),path:o}},Xm=e=>{if(!e.startsWith(`/`)||e.startsWith(`//`)||e.includes(`\\`)||Gm.test(e))return!1;let t=e.search(/[?#]/),n=t===-1?e:e.slice(0,t);if(qm.test(n))return!1;try{return new URL(e,Km).origin===Km}catch{return!1}},Zm=(e,t,n)=>{if(e.startsWith(`/`))return n?.allowRelativePaths===!0&&Xm(e);if(t.includes(`*`)||t.includes(`?`)){if(t.includes(`://`))return ha(t)(ys(e)||e);let n=uo(e);return n?ha(t)(n):!1}let r=Os(e);if(r===`http:`||r===`https:`||!r)return t===ys(e);let i=Ym(e),a=Ym(t);return!i||!a||i.scheme!==a.scheme||a.authority&&i.authority!==a.authority?!1:!a.path||i.path===a.path||i.path.startsWith(`${a.path}/`)};function Qm(e,t,n){let r=!1;return function(...i){return r||=((n?.warn??console.warn)(`[Deprecation] ${t}`),!0),e.apply(this,i)}}function $m(e){return e.context.skipOriginCheck===!0&&e.context.options.advanced?.disableCSRFCheck===void 0}function eh(e){let t=e.context.skipOriginCheck;if(t===!0)return!0;if(Array.isArray(t)&&e.request)try{let n=new URL(e.context.baseURL).pathname,r=Po(e.request.url,n);return t.some(e=>{let t=e.replace(/\/+$/,``);return r===t||r.startsWith(`${t}/`)})}catch{}return!1}var th=Qm(function(){},`disableOriginCheck: true currently also disables CSRF checks. In a future version, disableOriginCheck will ONLY disable URL validation. To keep CSRF disabled, add disableCSRFCheck: true to your config.`),nh=Ya(async e=>{if(e.request?.method===`GET`||e.request?.method===`OPTIONS`||e.request?.method===`HEAD`||!e.request||(await ih(e),eh(e)))return;let{body:t,query:n}=e,r=t?.callbackURL||n?.callbackURL,i=t?.redirectTo,a=t?.errorCallbackURL,o=t?.newUserCallbackURL,s=(t,n)=>{if(t){if(typeof t!=`string`)throw M.fromStatus(`BAD_REQUEST`,{message:`Invalid ${n}: expected a string`});if(!e.context.isTrustedOrigin(t,{allowRelativePaths:n!==`origin`}))throw e.context.logger.error(`Invalid ${n}: ${t}`),e.context.logger.info(`If it's a valid URL, please add ${t} to trustedOrigins in your auth config\n`,`Current list of trustedOrigins: ${e.context.trustedOrigins}`),n===`origin`?M.from(`FORBIDDEN`,P.INVALID_ORIGIN):n===`callbackURL`?M.from(`FORBIDDEN`,P.INVALID_CALLBACK_URL):n===`redirectURL`?M.from(`FORBIDDEN`,P.INVALID_REDIRECT_URL):n===`errorCallbackURL`?M.from(`FORBIDDEN`,P.INVALID_ERROR_CALLBACK_URL):n===`newUserCallbackURL`?M.from(`FORBIDDEN`,P.INVALID_NEW_USER_CALLBACK_URL):M.fromStatus(`FORBIDDEN`,{message:`Invalid ${n}`})}};r&&s(r,`callbackURL`),i&&s(i,`redirectURL`),a&&s(a,`errorCallbackURL`),o&&s(o,`newUserCallbackURL`)}),rh=e=>Ya(async t=>{if(!t.request||eh(t))return;let n=e(t),r=(e,n)=>{if(e&&!t.context.isTrustedOrigin(e,{allowRelativePaths:n!==`origin`}))throw t.context.logger.error(`Invalid ${n}: ${e}`),t.context.logger.info(`If it's a valid URL, please add ${e} to trustedOrigins in your auth config\n`,`Current list of trustedOrigins: ${t.context.trustedOrigins}`),n===`origin`?M.from(`FORBIDDEN`,P.INVALID_ORIGIN):n===`callbackURL`?M.from(`FORBIDDEN`,P.INVALID_CALLBACK_URL):n===`redirectURL`?M.from(`FORBIDDEN`,P.INVALID_REDIRECT_URL):n===`errorCallbackURL`?M.from(`FORBIDDEN`,P.INVALID_ERROR_CALLBACK_URL):n===`newUserCallbackURL`?M.from(`FORBIDDEN`,P.INVALID_NEW_USER_CALLBACK_URL):M.fromStatus(`FORBIDDEN`,{message:`Invalid ${n}`})},i=Array.isArray(n)?n:[n];for(let e of i)r(e,`callbackURL`)});async function ih(e,t=!1){let n=e.request?.headers;if(!n||!e.request)return;let r=n.get(`origin`),i=r||n.get(`referer`)||``,a=n.has(`cookie`);if(e.context.skipCSRFCheck)return;if($m(e)){e.context.options.advanced?.disableOriginCheck===!0&&th();return}if(eh(e)||!(t||a))return;let o=r===`null`&&n.get(`sec-fetch-site`)===`same-origin`?jo(void 0,e.context.options.basePath,e.request,!1,e.context.options.advanced?.trustedProxyHeaders):void 0,s=(o?ys(o):void 0)??i;if(!s||s===`null`)throw M.from(`FORBIDDEN`,P.MISSING_OR_NULL_ORIGIN);let c=Array.isArray(e.context.options.trustedOrigins)?e.context.trustedOrigins:[...e.context.trustedOrigins,...(await e.context.options.trustedOrigins?.(e.request))?.filter(e=>!!e)||[]];if(!c.some(e=>Zm(s,e)))throw e.context.logger.error(`Invalid origin: ${s}`),e.context.logger.info(`If it's a valid URL, please add ${s} to trustedOrigins in your auth config\n`,`Current list of trustedOrigins: ${c}`),M.from(`FORBIDDEN`,P.INVALID_ORIGIN)}var ah=Ya(async e=>{e.request&&await oh(e)});async function oh(e){let t=e.request;if(!t||e.context.skipCSRFCheck||$m(e))return;let n=t.headers;if(n.has(`cookie`))return await ih(e);let r=n.get(`Sec-Fetch-Site`),i=n.get(`Sec-Fetch-Mode`),a=n.get(`Sec-Fetch-Dest`);if(r&&r.trim()||i&&i.trim()||a&&a.trim()){if(r===`cross-site`&&i===`navigate`)throw e.context.logger.error(`Blocked cross-site navigation login attempt (CSRF protection)`,{secFetchSite:r,secFetchMode:i,secFetchDest:a}),M.from(`FORBIDDEN`,P.CROSS_SITE_NAVIGATION_LOGIN_BLOCKED);return await ih(e,!0)}if(n.get(`origin`)||n.get(`referer`))return await ih(e,!0)}var sh=new Map,ch=1e5;function lh(){let e=Date.now();for(let[t,n]of sh)e>=n.expiresAt&&sh.delete(t);if(sh.size<=ch)return;let t=sh.size-ch,n=0;for(let e of sh.keys())if(sh.delete(e),++n>=t)break}function uh(e,t,n){let r=t.window*1e3;return e?n-e.lastRequest>=r?{next:{...e,count:1,lastRequest:n},update:!0,allowed:!0,retryAfter:null}:e.count>=t.max?{next:e,update:!0,allowed:!1,retryAfter:fh(e.lastRequest,t.window)}:{next:{...e,count:e.count+1,lastRequest:n},update:!0,allowed:!0,retryAfter:null}:{next:{key:``,count:1,lastRequest:n},update:!1,allowed:!0,retryAfter:null}}function dh(e){return new Response(JSON.stringify({message:`Too many requests. Please try again later.`}),{status:429,statusText:`Too Many Requests`,headers:{"Content-Type":`application/json`,"X-Retry-After":e.toString()}})}function fh(e,t){let n=Date.now(),r=t*1e3;return Math.ceil((e+r-n)/1e3)}function ph(e){let t=`rateLimit`,n=e.adapter,r=Math.max(...mh(e)),i=async e=>{let r=(await n.findMany({model:t,where:[{field:`key`,value:e}]}))[0];return r&&(r.lastRequest=Number(r.lastRequest)),r},a=async(e,s)=>{s.window>r&&(r=s.window);let c=s.window*1e3,l=await i(e),u=Date.now();if(!l)try{return await n.create({model:t,data:{key:e,count:1,lastRequest:u}}),{allowed:!0,retryAfter:null}}catch(t){if(!await i(e))throw t;return a(e,s)}if(u-l.lastRequest>=c)return await n.incrementOne({model:t,where:[{field:`key`,value:e},{field:`lastRequest`,operator:`lte`,value:l.lastRequest}],increment:{},set:{count:1,lastRequest:u}})?(await o(u),{allowed:!0,retryAfter:null}):a(e,s);let d=u-c;if(await n.incrementOne({model:t,where:[{field:`key`,value:e},{field:`lastRequest`,operator:`gt`,value:d},{field:`count`,operator:`lt`,value:s.max}],increment:{count:1},set:{lastRequest:u}}))return{allowed:!0,retryAfter:null};let f=await i(e);return!f||u-f.lastRequest>=c?a(e,s):{allowed:!1,retryAfter:fh(f.lastRequest,s.window)}},o=async i=>{let a=i-r*1e3;await e.runInBackgroundOrAwait(n.deleteMany({model:t,where:[{field:`lastRequest`,operator:`lt`,value:a}]}).then(()=>void 0).catch(t=>e.logger.error(`Error pruning rate limit rows`,t)))};return{consume:a}}function mh(e){let t=[e.rateLimit.window,...bh().map(e=>e.window)];for(let n of e.options.plugins||[])n.rateLimit&&t.push(...n.rateLimit.map(e=>e.window));if(e.rateLimit.customRules)for(let n of Object.values(e.rateLimit.customRules))n&&typeof n!=`function`&&t.push(n.window);let n=t.filter(e=>Number.isFinite(e)&&e>0);return n.length>0?n:[e.rateLimit.window]}function hh(e,t){if(e.options.rateLimit?.customStorage)return e.options.rateLimit.customStorage;let n=e.rateLimit.storage;if(n===`secondary-storage`){let t=t=>t??e.options.rateLimit?.window??10,n=e.options.secondaryStorage?.increment;if(!n)throw new N(`Secondary-storage rate limiting requires SecondaryStorage.increment.`);return{consume:async(e,r)=>await n(e,t(r.window))<=r.max?{allowed:!0,retryAfter:null}:{allowed:!1,retryAfter:r.window}}}if(n===`memory`){let t=t=>t??e.options.rateLimit?.window??10;return{async consume(e,n){lh();let r=Date.now(),i=sh.get(e),a=uh(i&&r<i.expiresAt?i.data:void 0,n,r);return a.allowed&&sh.set(e,{data:{...a.next,key:e},expiresAt:r+t(n.window)*1e3}),{allowed:a.allowed,retryAfter:a.retryAfter}}}}return ph(e)}var gh=!1,_h=`no-trusted-ip`;async function vh(e,t){let n=new URL(t.baseURL).pathname,r=Po(e.url,n),i=t.rateLimit.window,a=t.rateLimit.max,o=ns(e,t.options);if(!o&&t.options.advanced?.ipAddress?.disableIpTracking)return null;!o&&!gh&&(t.logger.warn("Rate limiting could not determine a client IP and is falling back to a single shared per-path bucket. Ensure your runtime forwards a trusted client IP header, then set `advanced.ipAddress.ipAddressHeaders` or `advanced.ipAddress.trustedProxies` so the address can be resolved."),gh=!0);let s=Co(o??_h,r),c=bh().find(e=>e.pathMatcher(r));c&&(i=c.window,a=c.max);for(let e of t.options.plugins||[])if(e.rateLimit){let t=e.rateLimit.find(e=>e.pathMatcher(r));if(t){i=t.window,a=t.max;break}}if(t.rateLimit.customRules){let n=Object.keys(t.rateLimit.customRules).find(e=>e.includes(`*`)?ha(e)(r):e===r);if(n){let r=t.rateLimit.customRules[n],o=typeof r==`function`?await r(e,{window:i,max:a}):r;if(o&&(i=o.window,a=o.max),o===!1)return null}}return{key:s,currentWindow:i,currentMax:a}}async function yh(e,t){if(!t.rateLimit.enabled)return;let n=await vh(e,t);if(!n)return;let{key:r,currentWindow:i,currentMax:a}=n,o=hh(t,{window:i}),s={window:i,max:a},{allowed:c,retryAfter:l}=await o.consume(r,s);if(!c)return dh(l??i)}function bh(){return[{pathMatcher(e){return e.startsWith(`/sign-in`)||e.startsWith(`/sign-up`)||e.startsWith(`/change-password`)||e.startsWith(`/change-email`)},window:10,max:3},{pathMatcher(e){return e===`/request-password-reset`||e===`/send-verification-email`||e.startsWith(`/forget-password`)||e===`/email-otp/send-verification-otp`||e===`/email-otp/request-password-reset`},window:60,max:3}]}var xh=`better-auth.session-cache+jwt`,Sh=`better-auth:session-cache`;function Ch(e){let t={clockTolerance:15,audience:e?.audience??`better-auth:session-cache`};return e?.issuer&&(t.issuer=e.issuer),t}function wh(e){let t=ks(e);return!t||typeof e.iss!=`string`||!e.iss||e.sub!==t.user.id||e.sid!==t.session.token?null:{...e,...t}}function Th(e){if(!e?.method)throw new M(`FORBIDDEN`,{code:`validation_source_missing`,message:`User validation source is required`});if(e.method===`oauth`&&!e.oauth?.providerId)throw new M(`FORBIDDEN`,{code:`validation_source_missing`,message:`OAuth user validation source requires oauth.providerId`});if((e.method===`sso-oidc`||e.method===`sso-saml`)&&!e.sso?.providerId)throw new M(`FORBIDDEN`,{code:`validation_source_missing`,message:`SSO user validation source requires sso.providerId`})}async function Eh(e,t){let n=e.context.options.user?.validateUserInfo;if(!n)return;Th(t.source);let r;try{r=await n(t,e)}catch(t){throw e.context.logger.error(`validateUserInfo callback threw`,t),new M(`FORBIDDEN`,{code:`validation_failed`,message:`User validation failed`})}if(r?.error)throw new M(`FORBIDDEN`,{code:r.error,message:r.errorDescription||r.error})}var Dh=async e=>{let t=await os(`SHA-256`).digest(new TextEncoder().encode(e));return _i.encode(new Uint8Array(t),{padding:!1})};async function Oh(e,t){return!t||t===`plain`?e:t===`hashed`?Dh(e):typeof t==`object`&&`hash`in t?t.hash(e):e}function kh(e,t){if(t){if(typeof t==`object`&&`default`in t){if(t.overrides){for(let[n,r]of Object.entries(t.overrides))if(e.startsWith(n))return r}return t.default}return t}}function Ah(e,t){let n=ji(t.options),r=t.hooks;async function i(t,i,a){let o=_a(),s=t;for(let{source:e,hooks:t}of r){let r=t[i]?.create?.before;if(r){let t=await n(`db create.before ${i}`,{[Wi]:`create.before`,[Zi]:i,[Yi]:e},()=>r(s,o));if(t===!1)return null;typeof t==`object`&&`data`in t&&(s={...s,...t.data})}}let c=null;(!a||a.executeMainFn)&&(c=await(await mo(e)).create({model:i,data:s,forceAllowId:!0})),a?.fn&&(c=await a.fn(c??s));for(let{source:e,hooks:t}of r){let r=t[i]?.create?.after;r&&await $o(async()=>{await n(`db create.after ${i}`,{[Wi]:`create.after`,[Zi]:i,[Yi]:e},()=>r(c,o))})}return c}async function a(t,i,a,o){let s=_a(),c=t;for(let{source:e,hooks:i}of r){let r=i[a]?.update?.before;if(r){let i=await n(`db update.before ${a}`,{[Wi]:`update.before`,[Zi]:a,[Yi]:e},()=>r(t,s));if(i===!1)return null;typeof i==`object`&&`data`in i&&(c={...c,...i.data})}}let l=o?await o.fn(c):null,u=!o||o.executeMainFn?await(await mo(e)).update({model:a,update:c,where:i}):l;for(let{source:e,hooks:t}of r){let r=t[a]?.update?.after;r&&await $o(async()=>{await n(`db update.after ${a}`,{[Wi]:`update.after`,[Zi]:a,[Yi]:e},()=>r(u,s))})}return u}async function o(t,i,a,o){let s=_a(),c=t;for(let{source:e,hooks:i}of r){let r=i[a]?.update?.before;if(r){let i=await n(`db updateMany.before ${a}`,{[Wi]:`updateMany.before`,[Zi]:a,[Yi]:e},()=>r(t,s));if(i===!1)return null;typeof i==`object`&&`data`in i&&(c={...c,...i.data})}}let l=o?await o.fn(c):null,u=!o||o.executeMainFn?await(await mo(e)).updateMany({model:a,update:c,where:i}):l;for(let{source:e,hooks:t}of r){let r=t[a]?.update?.after;r&&await $o(async()=>{await n(`db updateMany.after ${a}`,{[Wi]:`updateMany.after`,[Zi]:a,[Yi]:e},()=>r(u,s))})}return u}async function s(t,i,a){let o=_a(),s=null;try{s=(await(await mo(e)).findMany({model:i,where:t,limit:1}))[0]||null}catch{}if(s)for(let{source:e,hooks:t}of r){let r=t[i]?.delete?.before;if(r&&await n(`db delete.before ${i}`,{"better_auth.hook.type":`delete.before`,"db.collection.name":i,"better_auth.context":e},()=>r(s,o))===!1)return null}let c=a?await a.fn(t):null,l=(!a||a.executeMainFn)&&s?await(await mo(e)).delete({model:i,where:t}):c;if(s)for(let{source:e,hooks:t}of r){let r=t[i]?.delete?.after;r&&await $o(async()=>{await n(`db delete.after ${i}`,{[Wi]:`delete.after`,[Zi]:i,[Yi]:e},()=>r(s,o))})}return l}async function c(t,i,a){let o=_a(),s=[];try{s=await(await mo(e)).findMany({model:i,where:t})}catch{}for(let e of s)for(let{source:t,hooks:a}of r){let r=a[i]?.delete?.before;if(r&&await n(`db delete.before ${i}`,{"better_auth.hook.type":`delete.before`,"db.collection.name":i,"better_auth.context":t},()=>r(e,o))===!1)return null}let c=a?await a.fn(t):null,l=!a||a.executeMainFn?await(await mo(e)).deleteMany({model:i,where:t}):c;for(let e of s)for(let{source:t,hooks:a}of r){let r=a[i]?.delete?.after;r&&await $o(async()=>{await n(`db delete.after ${i}`,{[Wi]:`delete.after`,[Zi]:i,[Yi]:t},()=>r(e,o))})}return l}async function l(t,i,a,o){let s=_a(),c=r.flatMap(({source:e,hooks:n})=>{let r=n[t]?.delete?.before;return r?[{source:e,fn:r}]:[]}),l=o??null;if(c.length){if(!l)try{l=(await(await mo(e)).findMany({model:t,where:i,limit:1}))[0]||null}catch{}if(l){for(let{source:e,fn:r}of c)if(await n(`db delete.before ${t}`,{"better_auth.hook.type":`delete.before`,"db.collection.name":t,"better_auth.context":e},()=>r(l,s))===!1)return null}}let u=await a();if(!u)return null;for(let{source:e,hooks:i}of r){let r=i[t]?.delete?.after;r&&await $o(async()=>{await n(`db delete.after ${t}`,{[Wi]:`delete.after`,[Zi]:t,[Yi]:e},()=>r(u,s))})}return u}return{createWithHooks:i,updateWithHooks:a,updateManyWithHooks:o,deleteWithHooks:s,deleteManyWithHooks:c,consumeOneWithHooks:l}}function jh(e,t=Date.now()){let n=typeof e==`number`?e:e.getTime();return Math.max(Math.floor((n-t)/1e3),0)}var Mh=(e,t)=>{let n=t.logger,r=t.options,i=r.secondaryStorage,a=new Map,o=r.session?.expiresIn||604800,s=!!i&&r.session?.storeSessionInDatabase===!0&&r.session?.preserveSessionInDatabase!==!0,{createWithHooks:c,updateWithHooks:l,updateManyWithHooks:u,deleteWithHooks:d,deleteManyWithHooks:f,consumeOneWithHooks:p}=Ah(e,t),m=t=>{let n=[...t,{field:`expiresAt`,value:new Date,operator:`gt`}];return f(n,`session`,{fn:async()=>{await(await mo(e)).updateMany({model:`session`,where:n,update:{expiresAt:new Date}})},executeMainFn:!1})};async function h(e){if(!i)return;let t=await i.get(`active-sessions-${e.id}`);if(!t)return;let n=Date.now(),r=(Ki(t)||[]).filter(e=>e.expiresAt>n);await Promise.all(r.map(async({token:t})=>{let r=await i.get(t);if(!r)return;let a=Ki(r);if(!a)return;let o=jh(a.session.expiresAt,n);await i.set(t,JSON.stringify({session:a.session,user:e}),Math.floor(o))}))}async function g(e){if(!i)return[];let t=await i.get(`active-sessions-${e}`);return t&&Ki(t)||[]}async function _(e,t){if(!i)return;let n=new Set(t.map(e=>e.token));for(let{token:e}of t)await i.delete(e);let r=`active-sessions-${e}`,a=await g(e),o=Date.now(),s=a.filter(e=>e.expiresAt>o&&!n.has(e.token));s.sort((e,t)=>e.expiresAt-t.expiresAt);let c=s.at(-1)?.expiresAt;c?await i.set(r,JSON.stringify(s),jh(c,o)):await i.delete(r)}async function v(e,t){if(!i)return;let r=t??await g(e);await $o(()=>_(e,r),{onError(e){n.error(`Failed to delete committed user sessions from secondary storage`,e)}})}async function y(e,t){let n=a.get(e)??Promise.resolve(),r,i=new Promise(e=>{r=e}),o=n.catch(()=>{}).then(()=>i);a.set(e,o),await n.catch(()=>{});try{return await t()}finally{r(),a.get(e)===o&&a.delete(e)}}return{createOAuthUser:async(t,n)=>bo(e,async()=>{let e=await c({createdAt:new Date,updatedAt:new Date,...t,email:t.email?.toLowerCase()},`user`,void 0);if(!e)throw new M(`BAD_REQUEST`,{message:`Failed to create user`});return{user:e,account:await c({...n,userId:e.id,createdAt:new Date,updatedAt:new Date},`account`,void 0)}}),createUser:async(e,t)=>{let i={createdAt:new Date,updatedAt:new Date,...e,email:e.email?.toLowerCase()};if(r.user?.validateUserInfo){let e={...t,action:`create-user`};Th(e);let r;try{r=ya()}catch(e){throw n.error(`Unable to run validateUserInfo: missing endpoint context`,e),new M(`FORBIDDEN`,{code:`validation_context_missing`,message:`User validation requires an endpoint context`})}await Eh(r,{user:i,source:e})}return await c(i,`user`,void 0)},createAccount:async e=>await c({createdAt:new Date,updatedAt:new Date,...e},`account`,void 0),listSessions:async(n,r)=>{if(s)return(await(await mo(e)).findMany({model:`session`,where:[{field:`userId`,value:n},{field:`expiresAt`,value:new Date,operator:`gt`}]})).map(e=>oo(t.options,e));if(i){let e=await i.get(`active-sessions-${n}`);if(!e)return[];let r=Ki(e)||[],a=Date.now(),o=new Set,s=[];for(let{token:e,expiresAt:n}of r){if(n<=a||o.has(e))continue;o.add(e);let r=await i.get(e);if(r)try{let e=typeof r==`string`?JSON.parse(r):r;if(!e?.session)continue;s.push(oo(t.options,{...e.session,expiresAt:new Date(e.session.expiresAt)}))}catch{continue}}return s}return await(await mo(e)).findMany({model:`session`,where:[{field:`userId`,value:n},...r?.onlyActiveSessions?[{field:`expiresAt`,value:new Date,operator:`gt`}]:[]]})},listUsers:async(t,n,r,i)=>await(await mo(e)).findMany({model:`user`,limit:t,offset:n,sortBy:r,where:i}),countTotalUsers:async t=>{let n=await(await mo(e)).count({model:`user`,where:t});return typeof n==`string`?parseInt(n):n},deleteUser:async e=>{let t=await g(e);(!i||r.session?.storeSessionInDatabase)&&await f([{field:`userId`,value:e}],`session`,void 0),await f([{field:`userId`,value:e}],`account`,void 0),await d([{field:`id`,value:e}],`user`,void 0)!==null&&await v(e,t)},createSession:async(a,l,u,d,f)=>{let p=await(async()=>{let e=_a();return e?.headers||e?.request?.headers})(),m=r.session?.storeSessionInDatabase,h=f?.deferSecondaryStorageWrites===!0&&s,{id:g,..._}=u||{},v;if(i&&!m){let e=t.generateId({model:`session`});v=e===!1?Bi():e}let y=Aa(r),b={...v?{id:v}:{},ipAddress:p&&ns(p,r)||``,userAgent:p?.get(`user-agent`)||``,..._,expiresAt:eo(l?86400:o,`sec`),userId:a,token:Bi(32),createdAt:new Date,updatedAt:new Date,...y,...d?_:{}},x=async t=>{if(!i)return t;let n=await i.get(`active-sessions-${a}`),r=[],o=Date.now();n&&(r=Ki(n)||[],r=r.filter(e=>e.expiresAt>o&&e.token!==b.token));let s=[...r,{token:b.token,expiresAt:b.expiresAt.getTime()}].sort((e,t)=>e.expiresAt-t.expiresAt),c=jh(s.at(-1)?.expiresAt??b.expiresAt.getTime(),o);c>0&&await i.set(`active-sessions-${a}`,JSON.stringify(s),c);let l=await(await mo(e)).findOne({model:`user`,where:[{field:`id`,value:a}]}),u=jh(b.expiresAt,o);return u>0&&await i.set(b.token,JSON.stringify({session:t,user:l}),u),t};return await c(b,`session`,i?{fn:async e=>h?(await $o(async()=>{await x(e)},{onError(e){n.error(`Failed to mirror committed session to secondary storage`,e)}}),e):x(e),executeMainFn:m}:void 0)},findSession:async n=>{if(i){let e=await i.get(n);if(!e&&(!r.session?.storeSessionInDatabase||t.options.session?.preserveSessionInDatabase))return null;if(e){let n=Ki(e);return n?{session:oo(t.options,{...n.session,expiresAt:new Date(n.session.expiresAt),createdAt:new Date(n.session.createdAt),updatedAt:new Date(n.session.updatedAt)}),user:sa(t.options,{...n.user,createdAt:new Date(n.user.createdAt),updatedAt:new Date(n.user.updatedAt)})}:null}}let a=await(await mo(e)).findOne({model:`session`,where:[{value:n,field:`token`}],join:{user:!0}});if(!a)return null;let{user:o,...s}=a;return o?{session:oo(t.options,s),user:sa(t.options,o)}:null},findSessions:async(t,n)=>{let r=[...new Set(t)],a=new Map,o=[];if(i)for(let e of r){let t=await i.get(e);if(t)try{let r=typeof t==`string`?JSON.parse(t):t;if(!r)continue;let i=new Date(r.session.expiresAt);if(n?.onlyActiveSessions&&i<=new Date)continue;let o={session:{...r.session,expiresAt:new Date(r.session.expiresAt)},user:{...r.user,createdAt:new Date(r.user.createdAt),updatedAt:new Date(r.user.updatedAt)}};a.set(e,o)}catch{continue}else o.push(e)}let c=i?o:r;if(c.length>0&&(!i||s)){let t=await(await mo(e)).findMany({model:`session`,limit:c.length,where:[{field:`token`,value:c,operator:`in`},...n?.onlyActiveSessions?[{field:`expiresAt`,value:new Date,operator:`gt`}]:[]],join:{user:!0}});for(let{user:e,...n}of t)e&&a.set(n.token,{session:n,user:e})}return r.flatMap(e=>{let t=a.get(e);return t?[t]:[]})},updateSession:async(e,n)=>await l(n,[{field:`token`,value:e}],`session`,i?{async fn(n){let r=await i.get(e);if(!r)return null;let a=Ki(r);if(!a)return null;let o={...a.session,...n,expiresAt:new Date(n.expiresAt??a.session.expiresAt),createdAt:new Date(a.session.createdAt),updatedAt:new Date(n.updatedAt??a.session.updatedAt)},s=oo(t.options,o),c=Date.now(),l=new Date(s.expiresAt).getTime(),u=jh(l,c);if(u>0){await i.set(e,JSON.stringify({session:s,user:a.user}),u);let t=`active-sessions-${s.userId}`,n=await i.get(t),r=(n&&Ki(n)||[]).filter(t=>t.token!==e&&t.expiresAt>c).concat([{token:e,expiresAt:l}]).sort((e,t)=>e.expiresAt-t.expiresAt),o=r.at(-1)?.expiresAt;o&&o>c?await i.set(t,JSON.stringify(r),jh(o,c)):await i.delete(t)}return s},executeMainFn:r.session?.storeSessionInDatabase}:void 0),deleteSession:async e=>{if(i){let a=await i.get(e);if(a){let{session:t}=Ki(a)??{};if(!t){n.error(`Session not found in secondary storage`);return}let r=t.userId,o=await i.get(`active-sessions-${r}`);if(o){let t=Ki(o)||[],n=Date.now(),a=t.filter(t=>t.expiresAt>n&&t.token!==e),s=a.sort((e,t)=>e.expiresAt-t.expiresAt).at(-1)?.expiresAt;a.length>0&&s&&s>Date.now()?await i.set(`active-sessions-${r}`,JSON.stringify(a),jh(s,n)):await i.delete(`active-sessions-${r}`)}else n.error(`Active sessions list not found in secondary storage`)}if(await i.delete(e),!r.session?.storeSessionInDatabase)return;if(t.options.session?.preserveSessionInDatabase){await m([{field:`token`,value:e}]);return}}await d([{field:`token`,value:e}],`session`,void 0)},deleteAccounts:async e=>{await f([{field:`userId`,value:e}],`account`,void 0)},deleteAccount:async e=>{await d([{field:`id`,value:e}],`account`,void 0)},deleteUserSessions:async e=>{let n=await g(e);if(i){if(!r.session?.storeSessionInDatabase){await v(e,n);return}if(t.options.session?.preserveSessionInDatabase){await m([{field:`userId`,value:e}])!==null&&await v(e,n);return}}await f([{field:`userId`,value:e}],`session`,void 0)!==null&&await v(e,n)},deleteSessions:async e=>{if(i){if(await Promise.all(e.map(e=>i.delete(e))),!r.session?.storeSessionInDatabase)return;if(t.options.session?.preserveSessionInDatabase){await m([{field:`token`,value:e,operator:`in`}]);return}}await f([{field:`token`,value:e,operator:`in`}],`session`,void 0)},findAccountOwnerByKey:async({providerId:t,accountId:n})=>{let r=await(await mo(e)).findMany({model:`account`,where:[{field:`providerId`,value:t},{field:`accountId`,value:n}],limit:2,join:{user:!0}});if(r.length>1)throw new N(`Multiple accounts match the same accountId for provider ${JSON.stringify(t)}. Resolve duplicate account identities before continuing.`);let i=r[0];if(!i)return null;let{user:a,...o}=i;return a?{kind:`owned`,user:a,account:o}:{kind:`orphaned`,account:o}},findUserByEmail:async(t,n)=>{let r=await(await mo(e)).findOne({model:`user`,where:[{value:t.toLowerCase(),field:`email`}],join:{...n?.includeAccounts?{account:!0}:{}}});if(!r)return null;let{account:i,...a}=r;return{user:a,accounts:i??[]}},findUserById:async t=>t?await(await mo(e)).findOne({model:`user`,where:[{field:`id`,value:t}]}):null,linkAccount:async e=>await c({createdAt:new Date,updatedAt:new Date,...e},`account`,void 0),updateUser:async(e,t)=>{let r=await l({...t,...t.email?{email:t.email.toLowerCase()}:{}},[{field:`id`,value:e}],`user`,void 0);return await $o(()=>h(r),{onError(e){n.error(`Failed to refresh committed user sessions in secondary storage`,e)}}),r},updateUserByEmail:async(e,t)=>{let r=await l({...t,...t.email?{email:t.email.toLowerCase()}:{}},[{field:`email`,value:e.toLowerCase()}],`user`,void 0);return await $o(()=>h(r),{onError(e){n.error(`Failed to refresh committed user sessions in secondary storage`,e)}}),r},updatePassword:async(e,t)=>{await u({password:t},[{field:`userId`,value:e},{field:`providerId`,value:`credential`},{field:`accountId`,value:e}],`account`,void 0)},findAccounts:async t=>await(await mo(e)).findMany({model:`account`,where:[{field:`userId`,value:t}]}),findCredentialAccount:async t=>(await mo(e)).findOne({model:`account`,where:[{field:`userId`,value:t},{field:`providerId`,value:`credential`},{field:`accountId`,value:t}]}),findAccountByKey:async({providerId:t,accountId:n})=>{let r=await(await mo(e)).findMany({model:`account`,limit:2,where:[{field:`providerId`,value:t},{field:`accountId`,value:n}]});if(r.length>1)throw new N(`Multiple accounts match the same accountId for provider ${JSON.stringify(t)}. Resolve duplicate account identities before continuing.`);return r[0]??null},findAccountByUserId:async t=>await(await mo(e)).findMany({model:`account`,where:[{field:`userId`,value:t}]}),updateAccount:async(e,t)=>await l(t,[{field:`id`,value:e}],`account`,void 0),createVerificationValue:async e=>{let t=kh(e.identifier,r.verification?.storeIdentifier),n=await Oh(e.identifier,t);return await c({createdAt:new Date,updatedAt:new Date,...e,identifier:n},`verification`,i?{async fn(e){let t=jh(e.expiresAt);return t>0&&await i.set(`verification:${n}`,JSON.stringify(e),t),e},executeMainFn:r.verification?.storeInDatabase}:void 0)},findVerificationValue:async t=>{let n=kh(t,r.verification?.storeIdentifier),a=await Oh(t,n);if(i){let e=await i.get(`verification:${a}`);if(e){let t=Ki(e);if(t)return t}if(n&&n!==`plain`){let e=await i.get(`verification:${t}`);if(e){let t=Ki(e);if(t)return t}}if(!r.verification?.storeInDatabase)return null}let o=await mo(e);async function s(e){return o.findMany({model:`verification`,where:[{field:`identifier`,value:e}],sortBy:{field:`createdAt`,direction:`desc`},limit:1})}let c=await s(a);return!c.length&&n&&n!==`plain`&&(c=await s(t)),r.verification?.disableCleanup||await f([{field:`expiresAt`,value:new Date,operator:`lt`}],`verification`,void 0),c[0]||null},deleteVerificationByIdentifier:async e=>{let t=await Oh(e,kh(e,r.verification?.storeIdentifier));i&&await i.delete(`verification:${t}`),(!i||r.verification?.storeInDatabase)&&await d([{field:`identifier`,value:t}],`verification`,void 0)},consumeVerificationValue:async t=>{let n=kh(t,r.verification?.storeIdentifier),a=await Oh(t,n),o=n&&n!==`plain`?[a,t]:[a],s=e=>{if(!e)return null;let t=typeof e==`string`?Ki(e):typeof e==`object`?e:null;if(!t)return null;let n=new Date(t.expiresAt);return Number.isFinite(n.getTime())?{...t,expiresAt:n}:null},c=null;if(i&&!r.verification?.storeInDatabase){let e=async e=>s(await i.getAndDelete(e));for(let t of o){let n=await e(`verification:${t}`);if(n){await Promise.all(o.filter(e=>e!==t).map(e=>i.delete(`verification:${e}`))),c=n;break}}}else{let t=async t=>y(`verification:${t}`,()=>bo(e,async()=>{let n=await mo(e),r=[{field:`identifier`,value:t}],i=await n.findMany({model:`verification`,where:r,sortBy:{field:`createdAt`,direction:`desc`},limit:2}),a=i[0]??null;return a?p(`verification`,[{field:`id`,value:a.id}],async()=>{let e=await n.consumeOne({model:`verification`,where:[{field:`id`,value:a.id}]});return e?(i.length>1&&await n.deleteMany({model:`verification`,where:r}),e):null},a):null}));for(let e of o)if(c=await t(e),c)break;c&&i&&await Promise.all(o.map(e=>i.delete(`verification:${e}`)))}return!c||c.expiresAt<new Date?null:c},reserveVerificationValue:async t=>{let n=$i(new Uint8Array(await os(`SHA-256`).digest(new TextEncoder().encode(`reserve:`+t.identifier))),r),a=kh(t.identifier,r.verification?.storeIdentifier),o=await Oh(t.identifier,a);if(i&&!r.verification?.storeInDatabase)throw new N(`reserveVerificationValue requires database-backed verification storage. Set verification.storeInDatabase to true for flows that reserve verification values.`);try{await e.create({model:`verification`,data:{id:n,identifier:o,value:t.value,expiresAt:t.expiresAt,createdAt:new Date,updatedAt:new Date},forceAllowId:!0})}catch(t){if(await e.findOne({model:`verification`,where:[{field:`id`,value:n}]}))return!1;throw t}if(i){let e=jh(t.expiresAt);e>0&&await i.set(`verification:${o}`,JSON.stringify({id:n,identifier:o,value:t.value,expiresAt:t.expiresAt}),e)}return!0},updateVerificationByIdentifier:async(e,t)=>{let n=await Oh(e,kh(e,r.verification?.storeIdentifier));if(i){let e=await i.get(`verification:${n}`);if(e){let a=Ki(e);if(a){let e={...a,...t},o=e.expiresAt??a.expiresAt,s=jh(o instanceof Date?o:new Date(o));if(s>0&&await i.set(`verification:${n}`,JSON.stringify(e),s),!r.verification?.storeInDatabase)return e}}}return!i||r.verification?.storeInDatabase?await l(t,[{field:`identifier`,value:n}],`verification`,void 0):t},refreshUserSessions:h}};async function Nh(e){let t=e.options,n=t.plugins||[],r=[],i=[];for(let a of n)if(a.init){let n=a.init(e),o;if(o=Qa(n)?await n:n,typeof o==`object`){if(o.options){let{databaseHooks:e,trustedOrigins:n,...s}=o.options;e&&i.push({source:`plugin:${a.id}`,hooks:e}),n&&r.push(n),t=Ga(t,s)}o.context&&Object.assign(e,o.context)}}if(r.length>0){let e=[...t.trustedOrigins?[t.trustedOrigins]:[],...r],n=e.filter(Array.isArray).flat(),i=e.filter(e=>typeof e==`function`);i.length>0?t.trustedOrigins=async e=>{let t=await Promise.all(i.map(t=>t(e)));return[...n,...t.flat()].filter(e=>typeof e==`string`&&e!==``)}:t.trustedOrigins=n}t.databaseHooks&&i.push({source:`user`,hooks:t.databaseHooks}),e.internalAdapter=Mh(e.adapter,{options:t,logger:e.logger,hooks:i,generateId:e.generateId}),e.options=t}function Ph(e){return e.advanced?.crossSubDomainCookies?.enabled,[]}async function Fh(e,t){let n=[];if(_o(e.baseURL)){let t=e.baseURL.allowedHosts,r=e.baseURL.protocol;for(let e of t)e.includes(`://`)?n.push(e):((!r||r===`https`||r===`auto`)&&n.push(`https://${e}`),(r===`http`||r===`auto`||ho(e))&&n.push(`http://${e}`));if(e.baseURL.fallback)try{n.push(new URL(e.baseURL.fallback).origin)}catch{}}else{let r=jo(typeof e.baseURL==`string`?e.baseURL:void 0,e.basePath,t);r&&n.push(new URL(r).origin)}if(e.trustedOrigins&&(Array.isArray(e.trustedOrigins)&&n.push(...e.trustedOrigins),typeof e.trustedOrigins==`function`)){let r=await e.trustedOrigins(t);n.push(...r)}let r=Vi.BETTER_AUTH_TRUSTED_ORIGINS;return r&&n.push(...r.split(`,`)),n.filter(e=>!!e)}function Ih(e){if(Ts(e?.request))return e.request;if(!e?.headers)return;let t=e.headers instanceof Headers?e.headers:new Headers(e.headers);if(t.has(`host`)||t.has(`x-forwarded-host`))return t}function Lh(e){return e.advanced?.trustedProxyHeaders??!1}async function Rh(e,t,n){let r=e.options.baseURL,i=qa(r,e.options.basePath||`/api/auth`,t,void 0,n);if(!i)throw new N(`Could not resolve base URL from request. Check your allowedHosts config.`);let a=Object.create(Object.getPrototypeOf(e),Object.getOwnPropertyDescriptors(e));a.baseURL=i,a.options={...e.options,baseURL:ys(i)||void 0};let o={...a.options,baseURL:r},s=typeof e.options.trustedOrigins==`function`||typeof e.options.account?.accountLinking?.trustedProviders==`function`,c;return c=s?Ts(t)?t:t?new Request(i,{headers:t}):void 0:void 0,a.trustedOrigins=await Fh(o,c),a.trustedProviders=await Bh(a.options,c),e.options.advanced?.crossSubDomainCookies?.enabled&&(a.authCookies=Ea(a.options),a.createAuthCookie=Ia(a.options)),a}async function zh(e,t){if(e)for(let n of e){let e=typeof n==`function`?await n():n;if(e[t.field??`id`]===t.value)return e}}async function Bh(e,t){let n=e.account?.accountLinking?.trustedProviders;return n?Array.isArray(n)?n.filter(e=>!!e):(await n(t)??[]).filter(e=>!!e):[]}function Vh(e){return e}async function Hh(e,t,n){let r={tokens:t,profile:n},i=e.accountSubject,a=await i(r),o=String(a);if(typeof a==`number`&&!Number.isFinite(a)||o.trim().length===0||o===`undefined`||o===`null`)throw new N(`OAUTH_ACCOUNT_SUBJECT_INVALID`);return{providerId:e.id,accountId:o}}async function Uh(e,t,n){try{return await Hh(e,t,n)}catch{throw M.from(`UNAUTHORIZED`,P.FAILED_TO_GET_USER_INFO)}}var Wh={NO_CODE:`no_code`,PROVIDER_NOT_FOUND:`oauth_provider_not_found`,ISSUER_MISSING:`issuer_missing`,ISSUER_MISMATCH:`issuer_mismatch`,INVALID_CODE:`invalid_code`,NONCE_BINDING_MISSING:`nonce_binding_missing`,UNABLE_TO_GET_USER_INFO:`unable_to_get_user_info`,NO_CALLBACK_URL:`no_callback_url`,UNABLE_TO_LINK_ACCOUNT:`unable_to_link_account`,EMAIL_DOES_NOT_MATCH:`email_does_not_match`,ACCOUNT_ALREADY_LINKED_TO_DIFFERENT_USER:`account_already_linked_to_different_user`,EMAIL_NOT_FOUND:`email_not_found`,EMAIL_NOT_VERIFIED:`email_not_verified`},Gh=`https://www.better-auth.com/docs/concepts/oauth#handling-providers-without-email`;function Kh(e,t,n,r){let i=new URLSearchParams({error:n});r&&i.set(`error_description`,r);let a=qo(t,i);throw e.redirect(a)}function qh(e,t){return`${t?.source===`generic`?`Generic OAuth provider "${e}"`:`Provider "${e}"`} did not return an email${t?.source===`id_token`?` in the id token`:``}. Either request the provider's email scope, or create a placeholder via \`mapProfileToUser\`. See ${Gh}`}function Jh(e){return e.startsWith(`$ba$`)?!0:e.length%2==0&&/^[0-9a-f]+$/i.test(e)}function Yh(e,t){return e&&(t.options.account?.encryptOAuthTokens&&Jh(e)?fs({key:t.secretConfig,data:e}):e)}function Xh(e,t){return t.options.account?.encryptOAuthTokens&&e?Yo({key:t.secretConfig,data:e}):e}function Zh(e){return e.callbackPath?e.callbackPath.startsWith(`/`)?e.callbackPath:`/${e.callbackPath}`:`/callback/${e.id}`}function Qh(e){if(e)try{return e.clone()}catch{return new Request(e.url,{cache:e.cache,credentials:e.credentials,headers:e.headers,integrity:e.integrity,keepalive:e.keepalive,method:e.method,mode:e.mode,redirect:e.redirect,referrer:e.referrer,referrerPolicy:e.referrerPolicy,signal:e.signal})}}async function $h(e,t,n,r=3600,i){return await Qo({email:t.toLowerCase(),updateTo:n?.toLowerCase(),...i},e,r)}async function eg(e,t){if(!e.context.options.emailVerification?.sendVerificationEmail)throw e.context.logger.error(`Verification email isn't enabled.`),M.from(`BAD_REQUEST`,P.VERIFICATION_EMAIL_NOT_ENABLED);let n=await $h(e.context.secret,t.email,void 0,e.context.options.emailVerification?.expiresIn),r=e.body.callbackURL?encodeURIComponent(e.body.callbackURL):`%2F`,i=`${e.context.baseURL}/verify-email?token=${n}&callbackURL=${r}`;await e.context.options.emailVerification.sendVerificationEmail({user:t,url:i,token:n},e.request)}var tg=Ss(`/send-verification-email`,{method:`POST`,operationId:`sendVerificationEmail`,cloneRequest:!0,body:A({email:Li().meta({description:`The email to send the verification email to`}),callbackURL:j().meta({description:`The URL to use for email verification callback`}).optional()}),metadata:{openapi:{operationId:`sendVerificationEmail`,description:`Send a verification email to the user`,requestBody:{content:{"application/json":{schema:{type:`object`,properties:{email:{type:`string`,description:`The email to send the verification email to`,example:`user@example.com`},callbackURL:{type:`string`,description:`The URL to use for email verification callback`,example:`https://example.com/callback`,nullable:!0}},required:[`email`]}}}},responses:{200:{description:`Success`,content:{"application/json":{schema:{type:`object`,properties:{status:{type:`boolean`,description:`Indicates if the email was sent successfully`,example:!0}}}}}},400:{description:`Bad Request`,content:{"application/json":{schema:{type:`object`,properties:{message:{type:`string`,description:`Error message`,example:`Verification email isn't enabled`}}}}}}}}}},async e=>{if(!e.context.options.emailVerification?.sendVerificationEmail)throw e.context.logger.error(`Verification email isn't enabled.`),M.from(`BAD_REQUEST`,P.VERIFICATION_EMAIL_NOT_ENABLED);let{email:t}=e.body,n=await Ja(e);if(!n){let n=Date.now(),r=await e.context.internalAdapter.findUserByEmail(t),i;if(!r||r.user.emailVerified)await $h(e.context.secret,t,void 0,e.context.options.emailVerification?.expiresIn);else try{await eg(e,r.user)}catch(e){i=e}let a=500-(Date.now()-n);if(a>0&&await new Promise(e=>setTimeout(e,a)),i)throw i;return e.json({status:!0})}if(n?.user.email.toLowerCase()!==t.toLowerCase())throw M.from(`BAD_REQUEST`,P.EMAIL_MISMATCH);if(n?.user.emailVerified)throw M.from(`BAD_REQUEST`,P.EMAIL_ALREADY_VERIFIED);return await eg(e,n.user),e.json({status:!0})}),ng=Ss(`/verify-email`,{method:`GET`,operationId:`verifyEmail`,query:A({token:j().meta({description:`The token to verify the email`}),callbackURL:j().meta({description:`The URL to redirect to after email verification`}).optional()}),use:[rh(e=>e.query.callbackURL)],metadata:{openapi:{description:`Verify the email of the user`,parameters:[{name:`token`,in:`query`,description:`The token to verify the email`,required:!0,schema:{type:`string`}},{name:`callbackURL`,in:`query`,description:`The URL to redirect to after email verification`,required:!1,schema:{type:`string`}}],responses:{200:{description:`Success`,content:{"application/json":{schema:{type:`object`,properties:{user:{type:`object`,$ref:`#/components/schemas/User`},status:{type:`boolean`,description:`Indicates if the email was verified successfully`}},required:[`user`,`status`]}}}}}}}},async e=>{function t(t){if(e.query.callbackURL){let n=new URLSearchParams({error:t.code}),r=qo(e.query.callbackURL,n);throw e.redirect(r)}throw M.from(`UNAUTHORIZED`,t)}let{token:n}=e.query,r;try{r=await ts(n,new TextEncoder().encode(e.context.secret),{algorithms:[`HS256`]})}catch(e){return e instanceof go?t(P.TOKEN_EXPIRED):t(P.INVALID_TOKEN)}let i=A({email:Li(),updateTo:j().optional(),requestType:j().optional()}).parse(r.payload),a=await e.context.internalAdapter.findUserByEmail(i.email);if(!a)return t(P.USER_NOT_FOUND);if(i.updateTo){let n=await Ja(e);if(n&&n.user.email!==i.email)return t(P.INVALID_USER);switch(i.requestType){case`change-email-confirmation`:{let t=await $h(e.context.secret,i.email,i.updateTo,e.context.options.emailVerification?.expiresIn,{requestType:`change-email-verification`}),n=e.query.callbackURL?encodeURIComponent(e.query.callbackURL):`%2F`,r=`${e.context.baseURL}/verify-email?token=${t}&callbackURL=${n}`;if(e.context.options.emailVerification?.sendVerificationEmail&&await e.context.runInBackgroundOrAwait(e.context.options.emailVerification.sendVerificationEmail({user:{...a.user,email:i.updateTo},url:r,token:t},Qh(e.request))),e.query.callbackURL)throw e.redirect(e.query.callbackURL);return e.json({status:!0})}case`change-email-verification`:{let t=n;if(!t){let n=await e.context.internalAdapter.createSession(a.user.id);if(!n)throw M.from(`INTERNAL_SERVER_ERROR`,P.FAILED_TO_CREATE_SESSION);t={session:n,user:a.user}}let r=await e.context.internalAdapter.updateUserByEmail(i.email,{email:i.updateTo,emailVerified:!0});if(e.context.options.emailVerification?.afterEmailVerification&&await e.context.options.emailVerification.afterEmailVerification(r,e.request),await Ua(e,{session:t.session,user:{...t.user,email:i.updateTo,emailVerified:!0}}),e.query.callbackURL)throw e.redirect(e.query.callbackURL);return e.json({status:!0,user:sa(e.context.options,r)})}default:{let t=n;if(!t){let n=await e.context.internalAdapter.createSession(a.user.id);if(!n)throw M.from(`INTERNAL_SERVER_ERROR`,P.FAILED_TO_CREATE_SESSION);t={session:n,user:a.user}}let r=await e.context.internalAdapter.updateUserByEmail(i.email,{email:i.updateTo,emailVerified:!1}),o=await $h(e.context.secret,i.updateTo),s=e.query.callbackURL?encodeURIComponent(e.query.callbackURL):`%2F`;if(e.context.options.emailVerification?.sendVerificationEmail&&await e.context.runInBackgroundOrAwait(e.context.options.emailVerification.sendVerificationEmail({user:r,url:`${e.context.baseURL}/verify-email?token=${o}&callbackURL=${s}`,token:o},Qh(e.request))),await Ua(e,{session:t.session,user:{...t.user,email:i.updateTo,emailVerified:!1}}),e.query.callbackURL)throw e.redirect(e.query.callbackURL);return e.json({status:!0,user:sa(e.context.options,r)})}}}if(a.user.emailVerified){if(e.query.callbackURL)throw e.redirect(e.query.callbackURL);return e.json({status:!0,user:null})}e.context.options.emailVerification?.beforeEmailVerification&&await e.context.options.emailVerification.beforeEmailVerification(a.user,e.request);let o=await e.context.internalAdapter.updateUserByEmail(i.email,{emailVerified:!0});if(e.context.options.emailVerification?.afterEmailVerification&&await e.context.options.emailVerification.afterEmailVerification(o,e.request),e.context.options.emailVerification?.autoSignInAfterVerification){let t=await Ja(e);if(!t||t.user.email!==i.email){let t=await e.context.internalAdapter.createSession(a.user.id);if(!t)throw M.from(`INTERNAL_SERVER_ERROR`,P.FAILED_TO_CREATE_SESSION);await Ua(e,{session:t,user:{...a.user,emailVerified:!0}})}else await Ua(e,{session:t.session,user:{...t.user,emailVerified:!0}})}if(e.query.callbackURL)throw e.redirect(e.query.callbackURL);return e.json({status:!0,user:null})});function rg(e,t){return{linked:!1,error:{code:e,message:t}}}async function ig(e,{link:t,userInfo:n,account:r,profile:i,scopes:a}){try{await Eh(e,{user:{...n,id:t.userId,email:n.email??void 0},source:{action:`link-account`,method:`oauth`,oauth:{providerId:r.providerId,profile:i}}})}catch(e){if(!za(e)||!e.body?.code)throw e;return rg(e.body.code,e.body.message)}if(!e.context.trustedProviders.includes(r.providerId)&&!n.emailVerified||e.context.options.account?.accountLinking?.enabled===!1)return e.context.logger.error(`Unable to link account - untrusted provider`),rg(Wh.UNABLE_TO_LINK_ACCOUNT);if(n.email?.toLowerCase()!==t.email.toLowerCase()&&e.context.options.account?.accountLinking?.allowDifferentEmails!==!0)return rg(Wh.EMAIL_DOES_NOT_MATCH);let o=await e.context.internalAdapter.findAccountByKey(r);if(o){if(o.userId.toString()!==t.userId.toString())return rg(Wh.ACCOUNT_ALREADY_LINKED_TO_DIFFERENT_USER);let n=ro(o.scope,a),i=Object.fromEntries(Object.entries({providerId:r.providerId,accessToken:await Xh(r.accessToken,e.context),refreshToken:await Xh(r.refreshToken,e.context),idToken:r.idToken,accessTokenExpiresAt:r.accessTokenExpiresAt,refreshTokenExpiresAt:r.refreshTokenExpiresAt,scope:n||void 0}).filter(([e,t])=>t!==void 0));await e.context.internalAdapter.updateAccount(o.id,i)}else if(!await e.context.internalAdapter.createAccount({userId:t.userId,...r,accessToken:await Xh(r.accessToken,e.context),refreshToken:await Xh(r.refreshToken,e.context),scope:a?.join(`,`)??r.scope}))return rg(Wh.UNABLE_TO_LINK_ACCOUNT);return await sg(e,t.userId,n),{linked:!0}}async function ag(e,t){let{userInfo:n,account:r,callbackURL:i,disableSignUp:a,overrideUserInfo:o}=t,s=t.source??{method:`oauth`,oauth:{providerId:r.providerId}},c=!!t.selectedUser||t.requireExactAccountBinding===!0,l=null,u=await e.context.internalAdapter.findAccountOwnerByKey({providerId:r.providerId,accountId:r.accountId}).catch(t=>{e.context.logger.error(`Better auth was unable to query your database.
2
+ Error: `,t),Kh(e,e.context.options.onAPIError?.errorURL||`${e.context.baseURL}/error`,`internal_server_error`)});if(u?.kind===`orphaned`)return e.context.logger.error(`OAuth account references a missing user. Repair the account before retrying authentication.`),{error:`unable to link account`,data:null,isRegister:!1};let d=await(async()=>{if(u?.kind===`owned`){if(t.selectedUser&&u.user.id!==t.selectedUser.userId)throw new M(`CONFLICT`,{code:`account_ownership_conflict`,message:`Account is already linked to another user`});return{user:u.user,linkedAccount:u.account,accounts:[u.account]}}if(t.selectedUser){let n=await e.context.internalAdapter.findUserById(t.selectedUser.userId);if(!n)throw new M(`NOT_FOUND`,{code:`user_not_found`,message:`User not found`});return{user:n,linkedAccount:null,accounts:[]}}let r=await e.context.internalAdapter.findUserByEmail(n.email.toLowerCase(),{includeAccounts:!0});return r?{user:r.user,linkedAccount:null,accounts:r.accounts}:null})().catch(t=>{if(za(t))throw t;e.context.logger.error(`Better auth was unable to query your database.
3
+ Error: `,t),Kh(e,e.context.options.onAPIError?.errorURL||`${e.context.baseURL}/error`,`internal_server_error`)}),f=d?.user,p=!f;if(d){let i=d.linkedAccount??d.accounts.find(e=>e.providerId===r.providerId&&e.accountId===r.accountId);if(i){let{id:a,...o}=n;await Eh(e,{user:{...o,id:d.user.id,email:n.email.toLowerCase()},source:{...s,action:`sign-in`}});let u=e.context.options.account?.updateAccountOnSignIn===!1?{}:Object.fromEntries(Object.entries({providerId:r.providerId,idToken:r.idToken,accessToken:await Xh(r.accessToken,e.context),refreshToken:await Xh(r.refreshToken,e.context),accessTokenExpiresAt:r.accessTokenExpiresAt,refreshTokenExpiresAt:r.refreshTokenExpiresAt}).filter(([e,t])=>t!==void 0));if(e.context.options.account?.storeAccountCookie){let n={...i,...u};t.deferNonDatabaseWrites?l=n:await Xa(e,n)}if(Object.keys(u).length>0){let n=await e.context.internalAdapter.updateAccount(i.id,u);if(!n)return{error:`unable to update account`,data:null};if(c&&(n.accountId!==r.accountId||n.providerId!==r.providerId||n.userId!==d.user.id))throw new M(`CONFLICT`,{code:`account_hook_binding_conflict`,message:`Account hook changed the selected authentication binding`});t.deferNonDatabaseWrites&&l&&(l=n)}!t.selectedUser&&n.emailVerified&&!d.user.emailVerified&&n.email.toLowerCase()===d.user.email&&await e.context.internalAdapter.updateUser(d.user.id,{emailVerified:!0})}else{let i=e.context.options.account?.accountLinking,a=t.isTrustedProvider||t.trustProviderByName!==!1&&e.context.trustedProviders.includes(r.providerId),o=i?.requireLocalEmailVerified??!0;if(!t.selectedUser&&(!a&&!n.emailVerified||o&&!d.user.emailVerified||i?.enabled===!1||i?.disableImplicitLinking===!0))return wi()&&e.context.logger.warn(`User already exist but account isn't linked to ${r.providerId}. To read more about how account linking works in Better Auth see https://www.better-auth.com/docs/concepts/users-accounts#account-linking.`),{error:`account not linked`,data:null};try{let{id:i,...a}=n;await Eh(e,{user:{...a,id:d.user.id,email:n.email.toLowerCase()},source:{...s,action:`link-account`}});let o=await e.context.internalAdapter.linkAccount({providerId:r.providerId,accountId:r.accountId,userId:d.user.id,accessToken:await Xh(r.accessToken,e.context),refreshToken:await Xh(r.refreshToken,e.context),idToken:r.idToken,accessTokenExpiresAt:r.accessTokenExpiresAt,refreshTokenExpiresAt:r.refreshTokenExpiresAt,scope:r.scope});if(!o)return{error:`unable to link account`,data:null};if(c&&(o.accountId!==r.accountId||o.providerId!==r.providerId||o.userId!==d.user.id))throw new M(`CONFLICT`,{code:`account_hook_binding_conflict`,message:`Account hook changed the selected authentication binding`});e.context.options.account?.storeAccountCookie&&(t.deferNonDatabaseWrites?l=o:await Xa(e,o))}catch(t){if(za(t))throw t;return e.context.logger.error(`Unable to link account`,t),{error:`unable to link account`,data:null}}!t.selectedUser&&n.emailVerified&&!d.user.emailVerified&&n.email.toLowerCase()===d.user.email&&await e.context.internalAdapter.updateUser(d.user.id,{emailVerified:!0}),t.selectedUser||(f=await sg(e,d.user.id,n)??f)}if(t.selectedUser?t.selectedUser.profile===`update`:o){let{id:r,email:i,emailVerified:a,name:o,image:s,...c}=n,l=io(e.context.options,c,`update`),u=await e.context.internalAdapter.updateUser(d.user.id,{name:o,image:s,...l,email:n.email.toLowerCase(),emailVerified:n.email.toLowerCase()===d.user.email&&d.user.emailVerified||n.emailVerified});if(u??e.context.logger.warn(`Could not update user info during OAuth sign in; preserving existing user for session.`),t.selectedUser&&u&&u.id!==t.selectedUser.userId)throw new M(`CONFLICT`,{code:`user_hook_selection_conflict`,message:`User hook changed the selected user`});f=u??f}}else{if(a)return{error:`signup disabled`,data:null,isRegister:!1};try{let{id:i,email:a,emailVerified:o,name:u,image:d,...p}=n,m=io(e.context.options,p,`create`),h={accessToken:await Xh(r.accessToken,e.context),refreshToken:await Xh(r.refreshToken,e.context),idToken:r.idToken,accessTokenExpiresAt:r.accessTokenExpiresAt,refreshTokenExpiresAt:r.refreshTokenExpiresAt,scope:r.scope,providerId:r.providerId,accountId:r.accountId},{createdUser:g,createdAccount:_}=await bo(e.context.adapter,async()=>{let t=await e.context.internalAdapter.createUser({name:u,image:d,...m,email:n.email.toLowerCase(),emailVerified:n.emailVerified},s);return{createdUser:t,createdAccount:await e.context.internalAdapter.createAccount({...h,userId:t.id})}});if(c&&(_.accountId!==r.accountId||_.providerId!==r.providerId||_.userId!==g.id))throw new M(`CONFLICT`,{code:`account_hook_binding_conflict`,message:`Account hook changed the selected authentication binding`});f=g,e.context.options.account?.storeAccountCookie&&(t.deferNonDatabaseWrites?l=_:await Xa(e,_))}catch(t){if(za(t))throw t;return e.context.logger.error(`Unable to create OAuth user`,t),{error:`unable to create user`,data:null,isRegister:!1}}}if(!f)return{error:`unable to create user`,data:null,isRegister:!1};let m=e.context.socialProviders.find(e=>e.id===r.providerId)?.options?.requireEmailVerification;if(p&&!f.emailVerified&&(e.context.options.emailVerification?.sendOnSignUp??m)&&await og(e,f,i),m&&!f.emailVerified)return!p&&e.context.options.emailVerification?.sendOnSignIn&&await og(e,f,i),{error:Wh.EMAIL_NOT_VERIFIED,data:null,isRegister:p};let h=await e.context.internalAdapter.createSession(f.id,void 0,void 0,void 0,{deferSecondaryStorageWrites:!0});if(!h)return{error:`unable to create session`,data:null,isRegister:!1};if(c&&h.userId!==(t.selectedUser?.userId??f.id))throw new M(`CONFLICT`,{code:`session_hook_user_conflict`,message:`Session hook changed the selected user`});return{data:{session:h,user:f},error:null,isRegister:p,accountCookie:l}}async function og(e,t,n){let r=e.context.options.emailVerification?.sendVerificationEmail;r&&await $o(async()=>{try{let i=await $h(e.context.secret,t.email,void 0,e.context.options.emailVerification?.expiresIn),a=`${e.context.baseURL}/verify-email?token=${i}&callbackURL=${encodeURIComponent(n||`/`)}`;await e.context.runInBackgroundOrAwait(r({user:t,url:a,token:i},e.request))}catch(t){e.context.logger.error(`Failed to send OAuth verification email`,t)}})}async function sg(e,t,n){if(e.context.options.account?.accountLinking?.updateUserInfoOnLink===!0)try{let{email:r,emailVerified:i,name:a,image:o,...s}=n,c=io(e.context.options,s,`update`);return await e.context.internalAdapter.updateUser(t,{name:a,image:o,...c})}catch(t){e.context.logger.warn(`Could not update user info on account link`,t);return}}var cg=Ji(`better-auth:oauth-encryption:v1`);function lg(e,t){return ki(ma(Ka,Ji(e),cg,Ji(`better-auth:${t}:v1`),32))}function ug(e,t){return typeof e==`string`?lg(e,t):{keys:new Map(Array.from(e.keys,([e,n])=>[e,lg(n,t)])),currentVersion:e.currentVersion,...e.legacySecret&&{legacySecret:lg(e.legacySecret,t)}}}var dg=Mi({callbackURL:j(),codeVerifier:j(),errorURL:j().optional(),newUserURL:j().optional(),expiresAt:Ti(),oauthState:j().optional(),link:A({email:j(),userId:xs()}).optional(),requestSignUp:Pi().optional(),idTokenNonce:j().optional(),serverContext:Ei(j(),pi()).optional()}),fg=e=>`auth-state:${e}`;new Set(Object.keys(dg.shape));var pg=class extends N{code;details;errorURL;constructor(e,t){super(e,t),this.code=t.code,this.details=t.details,this.errorURL=t.errorURL}};async function mg(e,t,n){let r=Io(32);if(e.context.oauthConfig.storeStateStrategy===`cookie`){let i={...t,oauthState:r},a=await Yo({key:ug(e.context.secretConfig,`oauth-state-cookie`),data:JSON.stringify(i)}),o=e.context.createAuthCookie(n?.cookieName??`oauth_state`,{maxAge:600});return e.setCookie(o.name,a,o.attributes),{state:r,codeVerifier:t.codeVerifier}}let i=e.context.createAuthCookie(n?.cookieName??`state`,{maxAge:300});await e.setSignedCookie(i.name,r,e.context.secret,i.attributes);let a=new Date;if(a.setMinutes(a.getMinutes()+10),!await e.context.internalAdapter.createVerificationValue({value:JSON.stringify({...t,oauthState:r}),identifier:fg(r),expiresAt:a}))throw new pg(`Unable to create verification. Make sure the database adapter is properly working and there is a verification table in the database`,{code:`state_generation_error`});return{state:r,codeVerifier:t.codeVerifier}}async function hg(e,t,n){if(!t)throw new pg(`State not found in OAuth callback`,{code:`state_not_found`});let r=e.context.oauthConfig.storeStateStrategy,i;if(r===`cookie`){let r=e.context.createAuthCookie(n?.cookieName??`oauth_state`),a=e.getCookie(r.name);if(!a)throw new pg(`State mismatch: auth state cookie not found`,{code:`state_mismatch`,details:{state:t}});try{let t=await fs({key:ug(e.context.secretConfig,`oauth-state-cookie`),data:a});i=dg.parse(JSON.parse(t))}catch(e){throw new pg(`State invalid: Failed to decrypt or parse auth state`,{code:`state_invalid`,details:{state:t},cause:e})}if(!i.oauthState||i.oauthState!==t)throw new pg(`State mismatch: OAuth state parameter does not match stored state`,{code:`state_security_mismatch`,details:{state:t},errorURL:i.errorURL});ba(e,r)}else{let r=await e.context.internalAdapter.findVerificationValue(fg(t));if(!r)throw new pg(`State mismatch: verification not found`,{code:`state_mismatch`,details:{state:t}});if(i=dg.parse(JSON.parse(r.value)),i.oauthState!==void 0&&i.oauthState!==t)throw new pg(`State mismatch: OAuth state parameter does not match stored state`,{code:`state_security_mismatch`,details:{state:t},errorURL:i.errorURL});let a=e.context.createAuthCookie(n?.cookieName??`state`),o=await e.getSignedCookie(a.name,e.context.secret);if(!(n?.skipStateCookieCheck??e.context.oauthConfig.skipStateCookieCheck)&&(!o||o!==t))throw new pg(`State mismatch: State not persisted correctly`,{code:`state_security_mismatch`,details:{state:t},errorURL:i.errorURL});ba(e,a),await e.context.internalAdapter.deleteVerificationByIdentifier(fg(t))}if(i.expiresAt<Date.now())throw new pg(`Invalid state: request expired`,{code:`state_mismatch`,details:{expiresAt:i.expiresAt},errorURL:i.errorURL});return i}function gg(e){return e.requiresIdTokenNonce?Io(32):void 0}async function _g(e,t){let n=e.body?.callbackURL||e.context.options.baseURL;if(!n)throw M.from(`BAD_REQUEST`,P.CALLBACK_URL_REQUIRED);let r=t?.codeVerifier??Io(128),i=await ss(),a=i&&Object.keys(i).length?i:void 0,o={...t?.additionalData?t.additionalData:{},callbackURL:n,codeVerifier:r,errorURL:e.body?.errorCallbackURL,newUserURL:e.body?.newUserCallbackURL,link:t?.link,serverContext:a,expiresAt:Date.now()+6e5,requestSignUp:e.body?.requestSignUp,idTokenNonce:t?.idTokenNonce};await Lo(o);try{return mg(e,o)}catch(t){throw e.context.logger.error(`Failed to create verification`,t),new M(`INTERNAL_SERVER_ERROR`,{message:`Unable to create verification`,cause:t})}}async function vg(e){let t=e.query.state||e.body?.state,n=e.context.options.onAPIError?.errorURL||`${e.context.baseURL}/error`,r;try{r=await hg(e,t)}catch(t){e.context.logger.error(`Failed to parse state`,t);let r=`internal_server_error`,i=n;t instanceof pg&&(r=t.code===`state_security_mismatch`?`state_mismatch`:t.code,i=t.errorURL||n),Kh(e,i,r)}return r.errorURL||(r.errorURL=n),r&&await Lo(r),r}var yg=e=>{let t=`https://appleid.apple.com/auth/token`;return{id:`apple`,name:`Apple`,accountSubject:({profile:e})=>e.sub,async createAuthorizationURL({state:t,scopes:n,redirectURI:r,additionalParams:i,codeVerifier:a}){if(!ao(e.clientId)||!e.clientSecret)throw ra.error(`Client ID and client secret are required for Apple. Make sure to provide them in the options.`),new N(`CLIENT_ID_AND_SECRET_REQUIRED`);let o=e.disableDefaultScope?[]:[`email`,`name`];return e.scope&&o.push(...e.scope),n&&o.push(...n),await vm({id:`apple`,options:e,authorizationEndpoint:`https://appleid.apple.com/auth/authorize`,scopes:o,state:t,redirectURI:r,codeVerifier:a,responseMode:`form_post`,responseType:`code id_token`,additionalParams:i})},validateAuthorizationCode:async({code:n,codeVerifier:r,redirectURI:i})=>Im({code:n,codeVerifier:r,redirectURI:i,options:e,tokenEndpoint:t}),idToken:{jwks:e=>bg(e.kid),issuer:`https://appleid.apple.com`,algorithms:[`RS256`],audience:e.audience&&e.audience.length?e.audience:e.appBundleIdentifier?e.appBundleIdentifier:e.clientId,maxTokenAge:`1h`,nonceComparison:`exact-or-sha256`},refreshAccessToken:e.refreshAccessToken?e.refreshAccessToken:async n=>Nm({refreshToken:n,options:e,tokenEndpoint:t}),async getUserInfo(t){if(e.getUserInfo)return e.getUserInfo(t);if(!t.idToken)return null;let n=ls(t.idToken);if(!n)return null;let r;r=t.user?.name?`${t.user.name.firstName||``} ${t.user.name.lastName||``}`.trim():n.name||``;let i=typeof n.email_verified==`boolean`?n.email_verified:n.email_verified===`true`,a={...n,name:r},o=await e.mapProfileToUser?.(a);return{user:{name:a.name,emailVerified:i,email:n.email,...o},data:a}},options:e}},bg=async e=>{let{data:t}=await Za(`https://appleid.apple.com/auth/keys`);if(!t?.keys)throw new M(`BAD_REQUEST`,{message:`Keys not found`});let n=t.keys.find(t=>t.kid===e);if(!n)throw Error(`JWK with kid ${e} not found`);return await Uo(n,n.alg)},xg=e=>{let t=`https://auth.atlassian.com/oauth/token`;return{id:`atlassian`,name:`Atlassian`,accountSubject:({profile:e})=>e.account_id,async createAuthorizationURL({state:t,scopes:n,codeVerifier:r,redirectURI:i,additionalParams:a}){if(!e.clientId||!e.clientSecret)throw ra.error(`Client Id and Secret are required for Atlassian`),new N(`CLIENT_ID_AND_SECRET_REQUIRED`);if(!r)throw new N(`codeVerifier is required for Atlassian`);let o=e.disableDefaultScope?[]:[`read:jira-user`,`offline_access`];return e.scope&&o.push(...e.scope),n&&o.push(...n),vm({id:`atlassian`,options:e,authorizationEndpoint:`https://auth.atlassian.com/authorize`,scopes:o,state:t,codeVerifier:r,redirectURI:i,additionalParams:{...a??{},audience:`api.atlassian.com`},prompt:e.prompt})},validateAuthorizationCode:async({code:n,codeVerifier:r,redirectURI:i})=>Im({code:n,codeVerifier:r,redirectURI:i,options:e,tokenEndpoint:t}),refreshAccessToken:e.refreshAccessToken?e.refreshAccessToken:async n=>Nm({refreshToken:n,options:{clientId:e.clientId,clientSecret:e.clientSecret},tokenEndpoint:t}),async getUserInfo(t){if(e.getUserInfo)return e.getUserInfo(t);if(!t.accessToken)return null;try{let{data:n}=await Za(`https://api.atlassian.com/me`,{headers:{Authorization:`Bearer ${t.accessToken}`}});if(!n)return null;let r=await e.mapProfileToUser?.(n);return{user:{name:n.name,email:n.email,image:n.picture,emailVerified:!1,...r},data:n}}catch(e){return ra.error(`Failed to fetch user info from Atlassian:`,e),null}},options:e}},Sg=`https://dash.cloudflare.com/oauth2/auth`,Cg=`https://dash.cloudflare.com/oauth2/token`,wg=`https://api.cloudflare.com/client/v4/user`,Tg=e=>{let t=e.clientSecret?`client_secret_basic`:`none`;return{method:e.tokenEndpointAuthMethod??t}},Eg=e=>({id:`cloudflare`,name:`Cloudflare`,accountSubject:({profile:e})=>e.id,createAuthorizationURL({state:t,scopes:n,codeVerifier:r,redirectURI:i}){let a=e.disableDefaultScope?[]:[`user-details.read`];return e.scope?.length&&a.push(...e.scope),n?.length&&a.push(...n),vm({id:`cloudflare`,options:e,authorizationEndpoint:Sg,scopes:a.length?[...new Set(a)]:void 0,state:t,codeVerifier:r,redirectURI:i})},validateAuthorizationCode:async({code:t,codeVerifier:n,redirectURI:r})=>Im({code:t,codeVerifier:n,redirectURI:r,options:e,tokenEndpoint:Cg,tokenEndpointAuth:Tg(e)}),refreshAccessToken:e.refreshAccessToken?e.refreshAccessToken:async t=>Nm({refreshToken:t,options:{clientId:e.clientId,clientKey:e.clientKey,clientSecret:e.clientSecret},tokenEndpoint:Cg,tokenEndpointAuth:Tg(e)}),async getUserInfo(t){if(e.getUserInfo)return e.getUserInfo(t);let{data:n,error:r}=await Za(wg,{headers:{authorization:`Bearer ${t.accessToken}`}});if(r||!n?.success||!n.result)return ra.error(`Failed to fetch user info from Cloudflare:`,r??n?.errors),null;let i=n.result,a=[i.first_name,i.last_name].filter(Boolean).join(` `)||i.email,o=await e.mapProfileToUser?.(i);return{user:{name:a,email:i.email,emailVerified:!1,...o},data:i}},options:e}),Dg=e=>{if(!e.domain||!e.region||!e.userPoolId)throw ra.error(`Domain, region and userPoolId are required for Amazon Cognito. Make sure to provide them in the options.`),new N(`DOMAIN_AND_REGION_REQUIRED`);let t=e.domain.replace(/^https?:\/\//,``),n=`https://${t}/oauth2/authorize`,r=`https://${t}/oauth2/token`,i=`https://${t}/oauth2/userinfo`;return{id:`cognito`,name:`Cognito`,accountSubject:({profile:e})=>e.sub,async createAuthorizationURL({state:t,scopes:r,codeVerifier:i,redirectURI:a,additionalParams:o}){if(!ao(e.clientId))throw ra.error(`ClientId is required for Amazon Cognito. Make sure to provide them in the options.`),new N(`CLIENT_ID_AND_SECRET_REQUIRED`);if(e.requireClientSecret&&!e.clientSecret)throw ra.error(`Client Secret is required when requireClientSecret is true. Make sure to provide it in the options.`),new N(`CLIENT_SECRET_REQUIRED`);let s=e.disableDefaultScope?[]:[`openid`,`profile`,`email`];e.scope&&s.push(...e.scope),r&&s.push(...r);let c=await vm({id:`cognito`,options:{...e},authorizationEndpoint:n,scopes:s,state:t,codeVerifier:i,redirectURI:a,prompt:e.prompt,additionalParams:{...e.identityProvider?{identity_provider:e.identityProvider}:{},...o??{}}}),l=c.searchParams.get(`scope`);if(l){c.searchParams.delete(`scope`);let e=encodeURIComponent(l),t=c.toString(),n=t.includes(`?`)?`&`:`?`;return new URL(`${t}${n}scope=${e}`)}return c},validateAuthorizationCode:async({code:t,codeVerifier:n,redirectURI:i})=>Im({code:t,codeVerifier:n,redirectURI:i,options:e,tokenEndpoint:r}),refreshAccessToken:e.refreshAccessToken?e.refreshAccessToken:async t=>Nm({refreshToken:t,options:{clientId:e.clientId,clientKey:e.clientKey,clientSecret:e.clientSecret},tokenEndpoint:r}),idToken:{jwks:t=>Og(t.kid,e.region,e.userPoolId),issuer:`https://cognito-idp.${e.region}.amazonaws.com/${e.userPoolId}`,audience:e.clientId,algorithms:[`RS256`],maxTokenAge:`1h`},async getUserInfo(t){if(e.getUserInfo)return e.getUserInfo(t);if(t.idToken)try{let n=ls(t.idToken);if(!n)return null;let r=n.name||n.given_name||n.username||``,i={...n,name:r},a=await e.mapProfileToUser?.(i);return{user:{name:i.name,email:n.email,image:n.picture,emailVerified:n.email_verified,...a},data:i}}catch(e){ra.error(`Failed to decode ID token:`,e)}if(t.accessToken)try{let{data:n}=await Za(i,{headers:{Authorization:`Bearer ${t.accessToken}`}});if(n){let t=await e.mapProfileToUser?.(n);return{user:{name:n.name||n.given_name||n.username||``,email:n.email,image:n.picture,emailVerified:n.email_verified,...t},data:n}}}catch(e){ra.error(`Failed to fetch user info from Cognito:`,e)}return null},options:e}},Og=async(e,t,n)=>{let r=`https://cognito-idp.${t}.amazonaws.com/${n}/.well-known/jwks.json`;try{let{data:t}=await Za(r);if(!t?.keys)throw new M(`BAD_REQUEST`,{message:`Keys not found`});let n=t.keys.find(t=>t.kid===e);if(!n)throw Error(`JWK with kid ${e} not found`);return await Uo(n,n.alg)}catch(e){throw ra.error(`Failed to fetch Cognito public key:`,e),e}},kg=e=>{let t=`https://discord.com/api/oauth2/token`;return{id:`discord`,name:`Discord`,accountSubject:({profile:e})=>e.id,createAuthorizationURL({state:t,scopes:n,redirectURI:r,additionalParams:i}){let a=e.disableDefaultScope?[]:[`identify`,`email`];n&&a.push(...n),e.scope&&a.push(...e.scope);let o=a.includes(`bot`);return vm({id:`discord`,options:e,authorizationEndpoint:`https://discord.com/api/oauth2/authorize`,scopes:a,state:t,redirectURI:r,prompt:e.prompt||`none`,additionalParams:{...o&&e.permissions!==void 0?{permissions:String(e.permissions)}:{},...i??{}}})},validateAuthorizationCode:async({code:n,redirectURI:r})=>Im({code:n,redirectURI:r,options:e,tokenEndpoint:t}),refreshAccessToken:e.refreshAccessToken?e.refreshAccessToken:async n=>Nm({refreshToken:n,options:{clientId:e.clientId,clientKey:e.clientKey,clientSecret:e.clientSecret},tokenEndpoint:t}),async getUserInfo(t){if(e.getUserInfo)return e.getUserInfo(t);let{data:n,error:r}=await Za(`https://discord.com/api/users/@me`,{headers:{authorization:`Bearer ${t.accessToken}`}});if(r)return null;if(n.avatar===null)n.image_url=`https://cdn.discordapp.com/embed/avatars/${n.discriminator===`0`?Number(BigInt(n.id)>>BigInt(22))%6:parseInt(n.discriminator)%5}.png`;else{let e=n.avatar.startsWith(`a_`)?`gif`:`png`;n.image_url=`https://cdn.discordapp.com/avatars/${n.id}/${n.avatar}.${e}`}let i=await e.mapProfileToUser?.(n);return{user:{name:n.global_name||n.username||``,email:n.email,emailVerified:n.verified,image:n.image_url,...i},data:n}},options:e}},Ag=e=>{let t=`https://api.dropboxapi.com/oauth2/token`;return{id:`dropbox`,name:`Dropbox`,accountSubject:({profile:e})=>e.account_id,createAuthorizationURL:async({state:t,scopes:n,codeVerifier:r,redirectURI:i,additionalParams:a})=>{let o=e.disableDefaultScope?[]:[`account_info.read`];return e.scope&&o.push(...e.scope),n&&o.push(...n),await vm({id:`dropbox`,options:e,authorizationEndpoint:`https://www.dropbox.com/oauth2/authorize`,scopes:o,state:t,redirectURI:i,codeVerifier:r,additionalParams:{...e.accessType?{token_access_type:e.accessType}:{},...a??{}}})},validateAuthorizationCode:async({code:n,codeVerifier:r,redirectURI:i})=>await Im({code:n,codeVerifier:r,redirectURI:i,options:e,tokenEndpoint:t}),refreshAccessToken:e.refreshAccessToken?e.refreshAccessToken:async n=>Nm({refreshToken:n,options:{clientId:e.clientId,clientKey:e.clientKey,clientSecret:e.clientSecret},tokenEndpoint:t}),async getUserInfo(t){if(e.getUserInfo)return e.getUserInfo(t);let{data:n,error:r}=await Za(`https://api.dropboxapi.com/2/users/get_current_account`,{method:`POST`,headers:{Authorization:`Bearer ${t.accessToken}`}});if(r)return null;let i=await e.mapProfileToUser?.(n);return{user:{name:n.name?.display_name,email:n.email,emailVerified:n.email_verified||!1,image:n.profile_photo_url,...i},data:n}},options:e}};async function jg(e,t){let n=ao(t.clientId);if(!n||!t.clientSecret)return null;let r=Array.isArray(t.clientId)?t.clientId:[t.clientId],{data:i,error:a}=await Za(`https://graph.facebook.com/debug_token`,{query:{input_token:e,access_token:`${n}|${t.clientSecret}`}});if(a||!i?.data)return null;let{is_valid:o,app_id:s,user_id:c}=i.data;return o!==!0||!s||!r.includes(s)||!c?null:c}var Mg=e=>({id:`facebook`,name:`Facebook`,accountSubject:({profile:e})=>`sub`in e?e.sub:e.id,async createAuthorizationURL({state:t,scopes:n,redirectURI:r,loginHint:i,additionalParams:a}){if(!ao(e.clientId)||!e.clientSecret)throw ra.error(`Client ID and client secret are required for Facebook. Make sure to provide them in the options.`),new N(`CLIENT_ID_AND_SECRET_REQUIRED`);let o=e.disableDefaultScope?[]:[`email`,`public_profile`];return e.scope&&o.push(...e.scope),n&&o.push(...n),await vm({id:`facebook`,options:e,authorizationEndpoint:`https://www.facebook.com/v24.0/dialog/oauth`,scopes:o,state:t,redirectURI:r,loginHint:i,additionalParams:{...e.configId?{config_id:e.configId}:{},...a??{}}})},validateAuthorizationCode:async({code:t,redirectURI:n})=>Im({code:t,redirectURI:n,options:e,tokenEndpoint:`https://graph.facebook.com/v24.0/oauth/access_token`}),idToken:{jwks:lm(new URL(`https://limited.facebook.com/.well-known/oauth/openid/jwks/`)),issuer:`https://www.facebook.com`,audience:e.clientId,algorithms:[`RS256`],allowOpaqueToken:!0},refreshAccessToken:e.refreshAccessToken?e.refreshAccessToken:async t=>Nm({refreshToken:t,options:{clientId:e.clientId,clientKey:e.clientKey,clientSecret:e.clientSecret},tokenEndpoint:`https://graph.facebook.com/v24.0/oauth/access_token`}),async getUserInfo(t){if(e.getUserInfo){let n=!!t.idToken&&t.idToken.split(`.`).length!==3,r=t.accessToken||(n?t.idToken:void 0);return r&&!await jg(r,e)?null:e.getUserInfo(t)}if(t.idToken&&t.idToken.split(`.`).length===3){let n=ls(t.idToken),r=await e.mapProfileToUser?.(n);return{user:{name:n.name,email:n.email,image:n.picture,emailVerified:!1,...r},data:n}}let n=t.accessToken;if(!n)return null;let r=await jg(n,e);if(!r)return null;let{data:i,error:a}=await Za(`https://graph.facebook.com/me?fields=`+[`id`,`name`,`email`,`picture`,...e?.fields||[]].join(`,`),{auth:{type:`Bearer`,token:n}});if(a||i.id!==r)return null;let o=await e.mapProfileToUser?.(i);return{user:{name:i.name,email:i.email,image:i.picture.data.url,emailVerified:i.email_verified??!1,...o},data:i}},options:e}),Ng=e=>{let t=`https://api.figma.com/v1/oauth/token`;return{id:`figma`,name:`Figma`,accountSubject:({profile:e})=>e.id,async createAuthorizationURL({state:t,scopes:n,codeVerifier:r,redirectURI:i,additionalParams:a}){if(!e.clientId||!e.clientSecret)throw ra.error(`Client Id and Client Secret are required for Figma. Make sure to provide them in the options.`),new N(`CLIENT_ID_AND_SECRET_REQUIRED`);if(!r)throw new N(`codeVerifier is required for Figma`);let o=e.disableDefaultScope?[]:[`current_user:read`];return e.scope&&o.push(...e.scope),n&&o.push(...n),await vm({id:`figma`,options:e,authorizationEndpoint:`https://www.figma.com/oauth`,scopes:o,state:t,codeVerifier:r,redirectURI:i,additionalParams:a})},validateAuthorizationCode:async({code:n,codeVerifier:r,redirectURI:i})=>Im({code:n,codeVerifier:r,redirectURI:i,options:e,tokenEndpoint:t,authentication:`basic`}),refreshAccessToken:e.refreshAccessToken?e.refreshAccessToken:async n=>Nm({refreshToken:n,options:{clientId:e.clientId,clientKey:e.clientKey,clientSecret:e.clientSecret},tokenEndpoint:t,authentication:`basic`}),async getUserInfo(t){if(e.getUserInfo)return e.getUserInfo(t);try{let{data:n}=await Za(`https://api.figma.com/v1/me`,{headers:{Authorization:`Bearer ${t.accessToken}`}});if(!n)return ra.error(`Failed to fetch user from Figma`),null;let r=await e.mapProfileToUser?.(n);return{user:{name:n.handle,email:n.email,image:n.img_url,emailVerified:!1,...r},data:n}}catch(e){return ra.error(`Failed to fetch user info from Figma:`,e),null}},options:e}},Pg=e=>{let t=`https://github.com/login/oauth/access_token`;return{id:`github`,name:`GitHub`,accountSubject:({profile:e})=>e.id,createAuthorizationURL({state:t,scopes:n,loginHint:r,codeVerifier:i,redirectURI:a,additionalParams:o}){let s=e.disableDefaultScope?[]:[`read:user`,`user:email`];return e.scope&&s.push(...e.scope),n&&s.push(...n),vm({id:`github`,options:e,authorizationEndpoint:`https://github.com/login/oauth/authorize`,scopes:s,state:t,codeVerifier:i,redirectURI:a,loginHint:r,prompt:e.prompt,additionalParams:o})},validateAuthorizationCode:async({code:n,codeVerifier:r,redirectURI:i})=>{let{body:a,headers:o}=await Pm({code:n,codeVerifier:r,redirectURI:i,options:e}),{data:s,error:c}=await Za(t,{method:`POST`,body:a,headers:o});return c?(ra.error(`GitHub OAuth token exchange failed:`,c),null):`error`in s?(ra.error(`GitHub OAuth token exchange failed:`,s),null):ka(s)},refreshAccessToken:e.refreshAccessToken?e.refreshAccessToken:async n=>Nm({refreshToken:n,options:{clientId:e.clientId,clientKey:e.clientKey,clientSecret:e.clientSecret},tokenEndpoint:t}),async getUserInfo(t){if(e.getUserInfo)return e.getUserInfo(t);let{data:n,error:r}=await Za(`https://api.github.com/user`,{headers:{"User-Agent":`better-auth`,authorization:`Bearer ${t.accessToken}`}});if(r)return null;let{data:i}=await Za(`https://api.github.com/user/emails`,{headers:{Authorization:`Bearer ${t.accessToken}`,"User-Agent":`better-auth`}});!n.email&&i&&(n.email=(i.find(e=>e.primary)??i[0])?.email);let a=i?.find(e=>e.email===n.email)?.verified??!1,o=await e.mapProfileToUser?.(n);return{user:{name:n.name||n.login||``,email:n.email,image:n.avatar_url,emailVerified:a,...o},data:n}},options:e}},Fg=(e=``)=>e.split(`://`).map(e=>e.replace(/\/{2,}/g,`/`)).join(`://`),Ig=e=>{let t=e||`https://gitlab.com`;return{authorizationEndpoint:Fg(`${t}/oauth/authorize`),tokenEndpoint:Fg(`${t}/oauth/token`),userinfoEndpoint:Fg(`${t}/api/v4/user`)}},Lg=e=>{let{authorizationEndpoint:t,tokenEndpoint:n,userinfoEndpoint:r}=Ig(e.issuer),i=`gitlab`;return{id:i,name:`Gitlab`,accountSubject:({profile:e})=>e.id,createAuthorizationURL:async({state:n,scopes:r,codeVerifier:a,loginHint:o,redirectURI:s,additionalParams:c})=>{let l=e.disableDefaultScope?[]:[`read_user`];return e.scope&&l.push(...e.scope),r&&l.push(...r),await vm({id:i,options:e,authorizationEndpoint:t,scopes:l,state:n,redirectURI:s,codeVerifier:a,loginHint:o,additionalParams:c})},validateAuthorizationCode:async({code:t,redirectURI:r,codeVerifier:i})=>Im({code:t,redirectURI:r,options:e,codeVerifier:i,tokenEndpoint:n}),refreshAccessToken:e.refreshAccessToken?e.refreshAccessToken:async t=>Nm({refreshToken:t,options:{clientId:e.clientId,clientKey:e.clientKey,clientSecret:e.clientSecret},tokenEndpoint:n}),async getUserInfo(t){if(e.getUserInfo)return e.getUserInfo(t);let{data:n,error:i}=await Za(r,{headers:{authorization:`Bearer ${t.accessToken}`}});if(i||n.state!==`active`||n.locked)return null;let a=await e.mapProfileToUser?.(n);return{user:{name:n.name??n.username??``,email:n.email,image:n.avatar_url,emailVerified:n.email_verified??!1,...a},data:n}},options:e}},Rg=`1h`,zg=`RS256`,Bg=[zg],Vg=(e,t)=>e?typeof t!=`string`||!t?!1:e===`*`||t===e:!0,Hg=e=>({id:`google`,name:`Google`,accountSubject:({profile:e})=>e.sub,async createAuthorizationURL({state:t,scopes:n,codeVerifier:r,redirectURI:i,loginHint:a,display:o,additionalParams:s}){if(!ao(e.clientId)||!e.clientSecret)throw ra.error(`Client Id and Client Secret is required for Google. Make sure to provide them in the options.`),new N(`CLIENT_ID_AND_SECRET_REQUIRED`);if(!r)throw new N(`codeVerifier is required for Google`);let c=e.disableDefaultScope?[]:[`email`,`profile`,`openid`];return e.scope&&c.push(...e.scope),n&&c.push(...n),await vm({id:`google`,options:e,authorizationEndpoint:`https://accounts.google.com/o/oauth2/v2/auth`,scopes:c,state:t,codeVerifier:r,redirectURI:i,prompt:e.prompt,accessType:e.accessType,display:o||e.display,loginHint:a,hd:e.hd,additionalParams:{...e.includeGrantedScopes===!1?{}:{include_granted_scopes:`true`},...s??{}}})},validateAuthorizationCode:async({code:t,codeVerifier:n,redirectURI:r})=>Im({code:t,codeVerifier:n,redirectURI:r,options:e,tokenEndpoint:`https://oauth2.googleapis.com/token`}),refreshAccessToken:e.refreshAccessToken?e.refreshAccessToken:async t=>Nm({refreshToken:t,options:{clientId:e.clientId,clientKey:e.clientKey,clientSecret:e.clientSecret},tokenEndpoint:`https://oauth2.googleapis.com/token`}),idToken:{jwks:e=>Ug(e.kid),issuer:[`https://accounts.google.com`,`accounts.google.com`],audience:e.clientId,algorithms:Bg,maxTokenAge:Rg,verifyClaims:e.hd?t=>Vg(e.hd,t.hd):void 0},async getUserInfo(t){if(e.getUserInfo)return e.getUserInfo(t);if(!t.idToken)return null;let n=ls(t.idToken);if(!Vg(e.hd,n.hd))return ra.error(`Google sign-in rejected: id token hosted domain (hd) "${n.hd??`<missing>`}" does not satisfy the configured "hd" option "${e.hd}".`),null;let r=await e.mapProfileToUser?.(n);return{user:{name:n.name,email:n.email,image:n.picture,emailVerified:n.email_verified??!1,...r},data:n}},options:e}),Ug=async e=>{let[t]=await Wg(e);if(!t)throw Error(`JWK with kid ${e} not found`);return t},Wg=async e=>{let{data:t}=await Za(`https://www.googleapis.com/oauth2/v3/certs`);if(!t?.keys)throw new M(`BAD_REQUEST`,{message:`Keys not found`});let n=e?t.keys.filter(t=>t.kid===e):t.keys;if(!n.length)throw Error(`JWK with kid ${e} not found`);return Promise.all(n.map(e=>Uo(e,zg)))},Gg=e=>{let t=`https://huggingface.co/oauth/token`;return{id:`huggingface`,name:`Hugging Face`,accountSubject:({profile:e})=>e.sub,createAuthorizationURL({state:t,scopes:n,codeVerifier:r,redirectURI:i,additionalParams:a}){let o=e.disableDefaultScope?[]:[`openid`,`profile`,`email`];return e.scope&&o.push(...e.scope),n&&o.push(...n),vm({id:`huggingface`,options:e,authorizationEndpoint:`https://huggingface.co/oauth/authorize`,scopes:o,state:t,codeVerifier:r,redirectURI:i,additionalParams:a})},validateAuthorizationCode:async({code:n,codeVerifier:r,redirectURI:i})=>Im({code:n,codeVerifier:r,redirectURI:i,options:e,tokenEndpoint:t}),refreshAccessToken:e.refreshAccessToken?e.refreshAccessToken:async n=>Nm({refreshToken:n,options:{clientId:e.clientId,clientKey:e.clientKey,clientSecret:e.clientSecret},tokenEndpoint:t}),async getUserInfo(t){if(e.getUserInfo)return e.getUserInfo(t);let{data:n,error:r}=await Za(`https://huggingface.co/oauth/userinfo`,{method:`GET`,headers:{Authorization:`Bearer ${t.accessToken}`}});if(r)return null;let i=await e.mapProfileToUser?.(n);return{user:{name:n.name||n.preferred_username||``,email:n.email,image:n.picture,emailVerified:n.email_verified??!1,...i},data:n}},options:e}},Kg=e=>{let t=`https://kauth.kakao.com/oauth/token`;return{id:`kakao`,name:`Kakao`,accountSubject:({profile:e})=>e.id,createAuthorizationURL({state:t,scopes:n,redirectURI:r,additionalParams:i}){let a=e.disableDefaultScope?[]:[`account_email`,`profile_image`,`profile_nickname`];return e.scope&&a.push(...e.scope),n&&a.push(...n),vm({id:`kakao`,options:e,authorizationEndpoint:`https://kauth.kakao.com/oauth/authorize`,scopes:a,scopeJoiner:`,`,state:t,redirectURI:r,additionalParams:i})},validateAuthorizationCode:async({code:n,redirectURI:r})=>Im({code:n,redirectURI:r,options:e,tokenEndpoint:t}),refreshAccessToken:e.refreshAccessToken?e.refreshAccessToken:async n=>Nm({refreshToken:n,options:{clientId:e.clientId,clientKey:e.clientKey,clientSecret:e.clientSecret},tokenEndpoint:t}),async getUserInfo(t){if(e.getUserInfo)return e.getUserInfo(t);let{data:n,error:r}=await Za(`https://kapi.kakao.com/v2/user/me`,{headers:{Authorization:`Bearer ${t.accessToken}`}});if(r||!n)return null;let i=await e.mapProfileToUser?.(n),a=n.kakao_account||{},o=a.profile||{};return{user:{name:o.nickname||a.name||``,email:a.email,image:o.profile_image_url||o.thumbnail_image_url,emailVerified:!!a.is_email_valid&&!!a.is_email_verified,...i},data:n}},options:e}},qg=e=>({id:`kick`,name:`Kick`,accountSubject:({profile:e})=>e.user_id,createAuthorizationURL({state:t,scopes:n,redirectURI:r,codeVerifier:i,additionalParams:a}){let o=e.disableDefaultScope?[]:[`user:read`];return e.scope&&o.push(...e.scope),n&&o.push(...n),vm({id:`kick`,redirectURI:r,options:e,authorizationEndpoint:`https://id.kick.com/oauth/authorize`,scopes:o,codeVerifier:i,state:t,additionalParams:a})},async validateAuthorizationCode({code:t,redirectURI:n,codeVerifier:r}){return Im({code:t,redirectURI:n,options:e,tokenEndpoint:`https://id.kick.com/oauth/token`,codeVerifier:r})},refreshAccessToken:e.refreshAccessToken?e.refreshAccessToken:async t=>Nm({refreshToken:t,options:{clientId:e.clientId,clientSecret:e.clientSecret},tokenEndpoint:`https://id.kick.com/oauth/token`}),async getUserInfo(t){if(e.getUserInfo)return e.getUserInfo(t);let{data:n,error:r}=await Za(`https://api.kick.com/public/v1/users`,{method:`GET`,headers:{Authorization:`Bearer ${t.accessToken}`}});if(r)return null;let i=n.data[0],a=await e.mapProfileToUser?.(i);return{user:{name:i.name,email:i.email,image:i.profile_picture,emailVerified:!1,...a},data:i}},options:e}),Jg=e=>{let t=`https://api.line.me/oauth2/v2.1/token`;return{id:`line`,name:`LINE`,accountSubject:({profile:e})=>e.sub,async createAuthorizationURL({state:t,scopes:n,codeVerifier:r,redirectURI:i,loginHint:a,additionalParams:o}){let s=e.disableDefaultScope?[]:[`openid`,`profile`,`email`];return e.scope&&s.push(...e.scope),n&&s.push(...n),await vm({id:`line`,options:e,authorizationEndpoint:`https://access.line.me/oauth2/v2.1/authorize`,scopes:s,state:t,codeVerifier:r,redirectURI:i,loginHint:a,additionalParams:o})},validateAuthorizationCode:async({code:n,codeVerifier:r,redirectURI:i})=>Im({code:n,codeVerifier:r,redirectURI:i,options:e,tokenEndpoint:t}),refreshAccessToken:e.refreshAccessToken?e.refreshAccessToken:async n=>Nm({refreshToken:n,options:{clientId:e.clientId,clientSecret:e.clientSecret},tokenEndpoint:t}),idToken:{verify:async(t,n)=>{let r=new URLSearchParams;r.set(`id_token`,t),r.set(`client_id`,e.clientId),n&&r.set(`nonce`,n);let{data:i,error:a}=await Za(`https://api.line.me/oauth2/v2.1/verify`,{method:`POST`,headers:{"content-type":`application/x-www-form-urlencoded`},body:r});return!(a||!i||i.aud!==e.clientId||i.nonce&&i.nonce!==n)}},async getUserInfo(t){if(e.getUserInfo)return e.getUserInfo(t);let n=null;if(t.idToken)try{n=ls(t.idToken)}catch{}if(!n){let{data:e}=await Za(`https://api.line.me/oauth2/v2.1/userinfo`,{headers:{authorization:`Bearer ${t.accessToken}`}});n=e||null}if(!n)return null;let r=await e.mapProfileToUser?.(n);return{user:{name:n.name||``,email:n.email,image:n.picture,emailVerified:!1,...r},data:n}},options:e}},Yg=e=>{let t=`https://api.linear.app/oauth/token`;return{id:`linear`,name:`Linear`,accountSubject:({profile:e})=>e.id,createAuthorizationURL({state:t,scopes:n,loginHint:r,redirectURI:i,additionalParams:a}){let o=e.disableDefaultScope?[]:[`read`];return e.scope&&o.push(...e.scope),n&&o.push(...n),vm({id:`linear`,options:e,authorizationEndpoint:`https://linear.app/oauth/authorize`,scopes:o,state:t,redirectURI:i,loginHint:r,additionalParams:a})},validateAuthorizationCode:async({code:n,redirectURI:r})=>Im({code:n,redirectURI:r,options:e,tokenEndpoint:t}),refreshAccessToken:e.refreshAccessToken?e.refreshAccessToken:async n=>Nm({refreshToken:n,options:{clientId:e.clientId,clientKey:e.clientKey,clientSecret:e.clientSecret},tokenEndpoint:t}),async getUserInfo(t){if(e.getUserInfo)return e.getUserInfo(t);let{data:n,error:r}=await Za(`https://api.linear.app/graphql`,{method:`POST`,headers:{"Content-Type":`application/json`,Authorization:`Bearer ${t.accessToken}`},body:JSON.stringify({query:`
4
+ query {
5
+ viewer {
6
+ id
7
+ name
8
+ email
9
+ avatarUrl
10
+ active
11
+ createdAt
12
+ updatedAt
13
+ }
14
+ }
15
+ `})});if(r||!n?.data?.viewer)return null;let i=n.data.viewer,a=await e.mapProfileToUser?.(i);return{user:{name:n.data.viewer.name,email:n.data.viewer.email,image:n.data.viewer.avatarUrl,emailVerified:!1,...a},data:i}},options:e}},Xg=e=>{let t=`https://www.linkedin.com/oauth/v2/accessToken`;return{id:`linkedin`,name:`Linkedin`,accountSubject:({profile:e})=>e.sub,createAuthorizationURL:async({state:t,scopes:n,redirectURI:r,loginHint:i,additionalParams:a})=>{let o=e.disableDefaultScope?[]:[`profile`,`email`,`openid`];return e.scope&&o.push(...e.scope),n&&o.push(...n),await vm({id:`linkedin`,options:e,authorizationEndpoint:`https://www.linkedin.com/oauth/v2/authorization`,scopes:o,state:t,loginHint:i,redirectURI:r,additionalParams:a})},validateAuthorizationCode:async({code:n,redirectURI:r})=>await Im({code:n,redirectURI:r,options:e,tokenEndpoint:t}),refreshAccessToken:e.refreshAccessToken?e.refreshAccessToken:async n=>Nm({refreshToken:n,options:{clientId:e.clientId,clientKey:e.clientKey,clientSecret:e.clientSecret},tokenEndpoint:t}),async getUserInfo(t){if(e.getUserInfo)return e.getUserInfo(t);let{data:n,error:r}=await Za(`https://api.linkedin.com/v2/userinfo`,{method:`GET`,headers:{Authorization:`Bearer ${t.accessToken}`}});if(r)return null;let i=await e.mapProfileToUser?.(n);return{user:{name:n.name,email:n.email,emailVerified:n.email_verified??!1,image:n.picture,...i},data:n}},options:e}},Zg=`9188040d-6c67-4c5b-b112-36a304b66dad`,Qg=e=>{let t=e.tenantId||`common`,n=e.authority||`https://login.microsoftonline.com`;for(;n.endsWith(`/`);)n=n.slice(0,-1);let r=`${n}/${t}/oauth2/v2.0/authorize`,i=`${n}/${t}/oauth2/v2.0/token`;if(e.clientSecret&&e.clientAssertion)throw new N(`Microsoft Entra ID clientAssertion cannot be combined with clientSecret`);let a=e.clientAssertion?{method:`private_key_jwt`,getClientAssertion:e.clientAssertion}:void 0;return{id:`microsoft`,name:`Microsoft EntraID`,accountSubject:({profile:e})=>e.oid,createAuthorizationURL(t){if(!ao(e.clientId))throw ra.error(`Client Id is required for Microsoft Entra ID. Make sure to provide it in the options.`),new N(`CLIENT_ID_AND_SECRET_REQUIRED`);let n=e.disableDefaultScope?[]:[`openid`,`profile`,`email`,`User.Read`,`offline_access`];return e.scope&&n.push(...e.scope),t.scopes&&n.push(...t.scopes),vm({id:`microsoft`,options:e,authorizationEndpoint:r,state:t.state,codeVerifier:t.codeVerifier,scopes:n,redirectURI:t.redirectURI,prompt:e.prompt,loginHint:t.loginHint,additionalParams:t.additionalParams})},validateAuthorizationCode({code:t,codeVerifier:n,redirectURI:r}){return Im({code:t,codeVerifier:n,redirectURI:r,options:e,tokenEndpoint:i,tokenEndpointAuth:a})},idToken:{jwks:e=>$g(e.kid,t,n),algorithms:[`RS256`],audience:e.clientId,maxTokenAge:`1h`,issuer:t!==`common`&&t!==`organizations`&&t!==`consumers`?`${n}/${t}/v2.0`:void 0,verifyClaims:e=>{let r=e.tid;return!(typeof r!=`string`||e.iss!==`${n}/${r}/v2.0`||t===`organizations`&&r===Zg||t===`consumers`&&r!==Zg)}},async getUserInfo(t){if(e.getUserInfo)return e.getUserInfo(t);if(!t.idToken)return null;let n=ls(t.idToken);if(typeof n.oid!=`string`||n.oid.trim().length===0)return ra.error(`Microsoft Entra ID token did not include a valid oid claim; unable to resolve a stable account identifier.`),null;let r=e.profilePhotoSize||48;!e.disableProfilePhoto&&t.accessToken&&await Za(`https://graph.microsoft.com/v1.0/me/photos/${r}x${r}/$value`,{headers:{Authorization:`Bearer ${t.accessToken}`},async onResponse(e){if(e.response.ok)try{let t=await e.response.clone().arrayBuffer();n.picture=`data:image/jpeg;base64, ${Di.encode(t)}`}catch(e){ra.error(e&&typeof e==`object`&&`name`in e?e.name:``,e)}}});let i=await e.mapProfileToUser?.(n),a=n.email_verified===void 0?!!(n.email&&(n.verified_primary_email?.includes(n.email)||n.verified_secondary_email?.includes(n.email))):n.email_verified;return{user:{name:n.name,email:n.email,image:n.picture,emailVerified:a,...i},data:n}},refreshAccessToken:e.refreshAccessToken?e.refreshAccessToken:async t=>{let n=e.disableDefaultScope?[]:[`openid`,`profile`,`email`,`User.Read`,`offline_access`];return e.scope&&n.push(...e.scope),Nm({refreshToken:t,options:{clientId:e.clientId,clientSecret:e.clientSecret},extraParams:{scope:n.join(` `)},tokenEndpoint:i,tokenEndpointAuth:a})},options:e}},$g=async(e,t,n)=>{let{data:r}=await Za(`${n}/${t}/discovery/v2.0/keys`);if(!r?.keys)throw new M(`BAD_REQUEST`,{message:`Keys not found`});let i=r.keys.find(t=>t.kid===e);if(!i)throw Error(`JWK with kid ${e} not found`);return await Uo(i,i.alg??`RS256`)},e_=e=>{let t=`https://nid.naver.com/oauth2.0/token`;return{id:`naver`,name:`Naver`,accountSubject:({profile:e})=>e.response.id,createAuthorizationURL({state:t,scopes:n,redirectURI:r,additionalParams:i}){let a=e.disableDefaultScope?[]:[`profile`,`email`];return e.scope&&a.push(...e.scope),n&&a.push(...n),vm({id:`naver`,options:e,authorizationEndpoint:`https://nid.naver.com/oauth2.0/authorize`,scopes:a,state:t,redirectURI:r,additionalParams:i})},validateAuthorizationCode:async({code:n,redirectURI:r})=>Im({code:n,redirectURI:r,options:e,tokenEndpoint:t}),refreshAccessToken:e.refreshAccessToken?e.refreshAccessToken:async n=>Nm({refreshToken:n,options:{clientId:e.clientId,clientKey:e.clientKey,clientSecret:e.clientSecret},tokenEndpoint:t}),async getUserInfo(t){if(e.getUserInfo)return e.getUserInfo(t);let{data:n,error:r}=await Za(`https://openapi.naver.com/v1/nid/me`,{headers:{Authorization:`Bearer ${t.accessToken}`}});if(r||!n||n.resultcode!==`00`)return null;let i=await e.mapProfileToUser?.(n),a=n.response||{};return{user:{name:a.name||a.nickname||``,email:a.email,image:a.profile_image,emailVerified:!1,...i},data:n}},options:e}},t_=e=>{let t=`https://api.notion.com/v1/oauth/token`;return{id:`notion`,name:`Notion`,accountSubject:({profile:e})=>e.id,createAuthorizationURL({state:t,scopes:n,loginHint:r,redirectURI:i,additionalParams:a}){let o=(e.disableDefaultScope,[]);return e.scope&&o.push(...e.scope),n&&o.push(...n),vm({id:`notion`,options:e,authorizationEndpoint:`https://api.notion.com/v1/oauth/authorize`,scopes:o,state:t,redirectURI:i,loginHint:r,additionalParams:{...a??{},owner:`user`}})},validateAuthorizationCode:async({code:n,redirectURI:r})=>Im({code:n,redirectURI:r,options:e,tokenEndpoint:t,authentication:`basic`}),refreshAccessToken:e.refreshAccessToken?e.refreshAccessToken:async n=>Nm({refreshToken:n,options:{clientId:e.clientId,clientKey:e.clientKey,clientSecret:e.clientSecret},tokenEndpoint:t}),async getUserInfo(t){if(e.getUserInfo)return e.getUserInfo(t);let{data:n,error:r}=await Za(`https://api.notion.com/v1/users/me`,{headers:{Authorization:`Bearer ${t.accessToken}`,"Notion-Version":`2022-06-28`}});if(r||!n)return null;let i=n.bot?.owner?.user;if(!i)return null;let a=await e.mapProfileToUser?.(i);return{user:{name:i.name||``,email:i.person?.email||null,image:i.avatar_url,emailVerified:!1,...a},data:i}},options:e}},n_=e=>{let t=e.issuer||`https://idp.paybin.io`,n=`${t}/oauth2/authorize`,r=`${t}/oauth2/token`;return{id:`paybin`,name:`Paybin`,accountSubject:({profile:e})=>e.sub,async createAuthorizationURL({state:t,scopes:r,codeVerifier:i,redirectURI:a,loginHint:o,additionalParams:s}){if(!e.clientId||!e.clientSecret)throw ra.error(`Client Id and Client Secret is required for Paybin. Make sure to provide them in the options.`),new N(`CLIENT_ID_AND_SECRET_REQUIRED`);if(!i)throw new N(`codeVerifier is required for Paybin`);let c=e.disableDefaultScope?[]:[`openid`,`email`,`profile`];return e.scope&&c.push(...e.scope),r&&c.push(...r),await vm({id:`paybin`,options:e,authorizationEndpoint:n,scopes:c,state:t,codeVerifier:i,redirectURI:a,prompt:e.prompt,loginHint:o,additionalParams:s})},validateAuthorizationCode:async({code:t,codeVerifier:n,redirectURI:i})=>Im({code:t,codeVerifier:n,redirectURI:i,options:e,tokenEndpoint:r}),refreshAccessToken:e.refreshAccessToken?e.refreshAccessToken:async t=>Nm({refreshToken:t,options:{clientId:e.clientId,clientKey:e.clientKey,clientSecret:e.clientSecret},tokenEndpoint:r}),async getUserInfo(t){if(e.getUserInfo)return e.getUserInfo(t);if(!t.idToken)return null;let n=ls(t.idToken),r=await e.mapProfileToUser?.(n);return{user:{name:n.name||n.preferred_username||``,email:n.email,image:n.picture,emailVerified:n.email_verified||!1,...r},data:n}},options:e}},r_=e=>{let t=(e.environment||`sandbox`)===`sandbox`,n=t?`https://www.sandbox.paypal.com/signin/authorize`:`https://www.paypal.com/signin/authorize`,r=t?`https://api-m.sandbox.paypal.com/v1/oauth2/token`:`https://api-m.paypal.com/v1/oauth2/token`,i=t?`https://api-m.sandbox.paypal.com/v1/identity/oauth2/userinfo`:`https://api-m.paypal.com/v1/identity/oauth2/userinfo`,a={clientId:e.clientId,clientSecret:e.clientSecret},o={method:`client_secret_basic`};return{id:`paypal`,name:`PayPal`,accountSubject:({profile:e})=>e.user_id,async createAuthorizationURL({state:t,codeVerifier:r,redirectURI:i,additionalParams:a}){if(!e.clientId||!e.clientSecret)throw ra.error(`Client Id and Client Secret is required for PayPal. Make sure to provide them in the options.`),new N(`CLIENT_ID_AND_SECRET_REQUIRED`);return await vm({id:`paypal`,options:e,authorizationEndpoint:n,scopes:[],state:t,codeVerifier:r,redirectURI:i,prompt:e.prompt,additionalParams:a})},validateAuthorizationCode:async({code:t,codeVerifier:n,redirectURI:i})=>{try{return await Im({code:t,codeVerifier:n,redirectURI:e.redirectURI||i,options:a,tokenEndpoint:r,tokenEndpointAuth:o})}catch(e){throw ra.error(`PayPal token exchange failed:`,e),new N(`FAILED_TO_GET_ACCESS_TOKEN`)}},refreshAccessToken:e.refreshAccessToken?e.refreshAccessToken:async e=>{try{return await Nm({refreshToken:e,options:a,tokenEndpoint:r,tokenEndpointAuth:o})}catch(e){throw ra.error(`PayPal token refresh failed:`,e),new N(`FAILED_TO_REFRESH_ACCESS_TOKEN`)}},async getUserInfo(t){if(e.getUserInfo)return e.getUserInfo(t);if(!t.accessToken)return ra.error(`Access token is required to fetch PayPal user info`),null;try{let n=await Za(`${i}?schema=paypalv1.1`,{headers:{Authorization:`Bearer ${t.accessToken}`,Accept:`application/json`}});if(!n.data)return ra.error(`Failed to fetch user info from PayPal`),null;let r=n.data;if(t.idToken){let e;try{e=ls(t.idToken).sub}catch(e){return ra.error(`Failed to decode PayPal ID token:`,e),null}let n=r.sub??r.user_id;if(!e||n!==e)return ra.error(`PayPal user info subject does not match ID token subject`),null}let a=await e.mapProfileToUser?.(r);return{user:{name:r.name,email:r.email,image:r.picture,emailVerified:r.email_verified,...a},data:r}}catch(e){return ra.error(`Failed to fetch user info from PayPal:`,e),null}},options:e}},i_=e=>{let t=`https://api.polar.sh/v1/oauth2/token`;return{id:`polar`,name:`Polar`,accountSubject:({profile:e})=>e.sub,createAuthorizationURL({state:t,scopes:n,codeVerifier:r,redirectURI:i,additionalParams:a}){let o=e.disableDefaultScope?[]:[`openid`,`profile`,`email`];return e.scope&&o.push(...e.scope),n&&o.push(...n),vm({id:`polar`,options:e,authorizationEndpoint:`https://polar.sh/oauth2/authorize`,scopes:o,state:t,codeVerifier:r,redirectURI:i,prompt:e.prompt,additionalParams:a})},validateAuthorizationCode:async({code:n,codeVerifier:r,redirectURI:i})=>Im({code:n,codeVerifier:r,redirectURI:i,options:e,tokenEndpoint:t}),refreshAccessToken:e.refreshAccessToken?e.refreshAccessToken:async n=>Nm({refreshToken:n,options:{clientId:e.clientId,clientKey:e.clientKey,clientSecret:e.clientSecret},tokenEndpoint:t}),async getUserInfo(t){if(e.getUserInfo)return e.getUserInfo(t);let{data:n,error:r}=await Za(`https://api.polar.sh/v1/oauth2/userinfo`,{headers:{Authorization:`Bearer ${t.accessToken}`}});if(r)return null;let i=await e.mapProfileToUser?.(n);return{user:{name:n.name??``,email:n.email,emailVerified:n.email_verified??!1,...i},data:n}},options:e}},a_=`https://backboard.railway.com/oauth/auth`,o_=`https://backboard.railway.com/oauth/token`,s_=`https://backboard.railway.com/oauth/me`,c_=e=>({id:`railway`,name:`Railway`,accountSubject:({profile:e})=>e.sub,createAuthorizationURL({state:t,scopes:n,codeVerifier:r,redirectURI:i,additionalParams:a}){let o=e.disableDefaultScope?[]:[`openid`,`email`,`profile`];return e.scope&&o.push(...e.scope),n&&o.push(...n),vm({id:`railway`,options:e,authorizationEndpoint:a_,scopes:o,state:t,codeVerifier:r,redirectURI:i,additionalParams:a})},validateAuthorizationCode:async({code:t,codeVerifier:n,redirectURI:r})=>Im({code:t,codeVerifier:n,redirectURI:r,options:e,tokenEndpoint:o_,authentication:`basic`}),refreshAccessToken:e.refreshAccessToken?e.refreshAccessToken:async t=>Nm({refreshToken:t,options:{clientId:e.clientId,clientKey:e.clientKey,clientSecret:e.clientSecret},tokenEndpoint:o_,authentication:`basic`}),async getUserInfo(t){if(e.getUserInfo)return e.getUserInfo(t);let{data:n,error:r}=await Za(s_,{headers:{authorization:`Bearer ${t.accessToken}`}});if(r||!n)return null;let i=await e.mapProfileToUser?.(n);return{user:{name:n.name,email:n.email,image:n.picture,emailVerified:!1,...i},data:n}},options:e}),l_=`placeholder.invalid`;function u_({identifier:e,namespace:t}){let n=Li().safeParse(`${e}@${t}.${l_}`);if(!n.success)throw TypeError(`Invalid placeholder email`);return n.data}var d_={apple:yg,atlassian:xg,cloudflare:Eg,cognito:Dg,discord:kg,facebook:Mg,figma:Ng,github:Pg,microsoft:Qg,google:Hg,huggingface:Gg,slack:e=>{let t=`https://slack.com/api/openid.connect.token`;return{id:`slack`,name:`Slack`,accountSubject:({profile:e})=>e[`https://slack.com/user_id`],createAuthorizationURL({state:t,scopes:n,redirectURI:r,additionalParams:i}){let a=e.disableDefaultScope?[]:[`openid`,`profile`,`email`];return n&&a.push(...n),e.scope&&a.push(...e.scope),vm({id:`slack`,options:e,authorizationEndpoint:`https://slack.com/openid/connect/authorize`,scopes:a,state:t,redirectURI:r,additionalParams:i})},validateAuthorizationCode:async({code:n,redirectURI:r})=>Im({code:n,redirectURI:r,options:e,tokenEndpoint:t}),refreshAccessToken:e.refreshAccessToken?e.refreshAccessToken:async n=>Nm({refreshToken:n,options:{clientId:e.clientId,clientKey:e.clientKey,clientSecret:e.clientSecret},tokenEndpoint:t}),async getUserInfo(t){if(e.getUserInfo)return e.getUserInfo(t);let{data:n,error:r}=await Za(`https://slack.com/api/openid.connect.userInfo`,{headers:{authorization:`Bearer ${t.accessToken}`}});if(r)return null;let i=await e.mapProfileToUser?.(n);return{user:{name:n.name||``,email:n.email,emailVerified:n.email_verified,image:n.picture||n[`https://slack.com/user_image_512`],...i},data:n}},options:e}},spotify:e=>{let t=`https://accounts.spotify.com/api/token`;return{id:`spotify`,name:`Spotify`,accountSubject:({profile:e})=>e.id,createAuthorizationURL({state:t,scopes:n,codeVerifier:r,redirectURI:i,additionalParams:a}){let o=e.disableDefaultScope?[]:[`user-read-email`];return e.scope&&o.push(...e.scope),n&&o.push(...n),vm({id:`spotify`,options:e,authorizationEndpoint:`https://accounts.spotify.com/authorize`,scopes:o,state:t,codeVerifier:r,redirectURI:i,additionalParams:a})},validateAuthorizationCode:async({code:n,codeVerifier:r,redirectURI:i})=>Im({code:n,codeVerifier:r,redirectURI:i,options:e,tokenEndpoint:t}),refreshAccessToken:e.refreshAccessToken?e.refreshAccessToken:async n=>Nm({refreshToken:n,options:{clientId:e.clientId,clientKey:e.clientKey,clientSecret:e.clientSecret},tokenEndpoint:t}),async getUserInfo(t){if(e.getUserInfo)return e.getUserInfo(t);let{data:n,error:r}=await Za(`https://api.spotify.com/v1/me`,{method:`GET`,headers:{Authorization:`Bearer ${t.accessToken}`}});if(r)return null;let i=await e.mapProfileToUser?.(n);return{user:{name:n.display_name,email:n.email,image:n.images[0]?.url,emailVerified:!1,...i},data:n}},options:e}},twitch:e=>{let t=`https://id.twitch.tv/oauth2/token`;return{id:`twitch`,name:`Twitch`,accountSubject:({profile:e})=>e.sub,createAuthorizationURL({state:t,scopes:n,redirectURI:r,additionalParams:i}){let a=e.disableDefaultScope?[]:[`user:read:email`,`openid`];return e.scope&&a.push(...e.scope),n&&a.push(...n),vm({id:`twitch`,redirectURI:r,options:e,authorizationEndpoint:`https://id.twitch.tv/oauth2/authorize`,scopes:a,state:t,claims:e.claims||[`email`,`email_verified`,`preferred_username`,`picture`],additionalParams:i})},validateAuthorizationCode:async({code:n,redirectURI:r})=>Im({code:n,redirectURI:r,options:e,tokenEndpoint:t}),refreshAccessToken:e.refreshAccessToken?e.refreshAccessToken:async n=>Nm({refreshToken:n,options:{clientId:e.clientId,clientKey:e.clientKey,clientSecret:e.clientSecret},tokenEndpoint:t}),async getUserInfo(t){if(e.getUserInfo)return e.getUserInfo(t);let n=t.idToken;if(!n)return ra.error(`No idToken found in token`),null;let r=ls(n),i=await e.mapProfileToUser?.(r);return{user:{name:r.preferred_username,email:r.email,image:r.picture,emailVerified:r.email_verified,...i},data:r}},options:e}},twitter:e=>{let t=`https://api.x.com/2/oauth2/token`;return{id:`twitter`,name:`Twitter`,accountSubject:({profile:e})=>e.data.id,createAuthorizationURL(t){let n=e.disableDefaultScope?[]:[`users.read`,`tweet.read`,`offline.access`,`users.email`];return e.scope&&n.push(...e.scope),t.scopes&&n.push(...t.scopes),vm({id:`twitter`,options:e,authorizationEndpoint:`https://x.com/i/oauth2/authorize`,scopes:n,state:t.state,codeVerifier:t.codeVerifier,redirectURI:t.redirectURI,additionalParams:t.additionalParams})},validateAuthorizationCode:async({code:n,codeVerifier:r,redirectURI:i})=>Im({code:n,codeVerifier:r,authentication:`basic`,redirectURI:i,options:e,tokenEndpoint:t}),refreshAccessToken:e.refreshAccessToken?e.refreshAccessToken:async n=>Nm({refreshToken:n,options:{clientId:e.clientId,clientKey:e.clientKey,clientSecret:e.clientSecret},authentication:`basic`,tokenEndpoint:t}),async getUserInfo(t){if(e.getUserInfo)return e.getUserInfo(t);let{data:n,error:r}=await Za(`https://api.x.com/2/users/me?user.fields=profile_image_url`,{method:`GET`,headers:{Authorization:`Bearer ${t.accessToken}`}});if(r)return null;let{data:i,error:a}=await Za(`https://api.x.com/2/users/me?user.fields=confirmed_email`,{method:`GET`,headers:{Authorization:`Bearer ${t.accessToken}`}}),o=!1;!a&&i?.data?.confirmed_email&&(n.data.email=i.data.confirmed_email,o=!0);let s=await e.mapProfileToUser?.(n);return{user:{name:n.data.name,email:n.data.email||u_({identifier:n.data.id,namespace:`twitter`}),image:n.data.profile_image_url,emailVerified:o,...s},data:n}},options:e}},dropbox:Ag,kick:qg,linear:Yg,linkedin:Xg,gitlab:Lg,tiktok:e=>{let t=`https://open.tiktokapis.com/v2/oauth/token/`,n={method:`custom`,customizeRequest({body:t}){t.set(`client_key`,e.clientKey),t.set(`client_secret`,e.clientSecret)}};return{id:`tiktok`,name:`TikTok`,accountSubject:({profile:e})=>e.data.user.open_id,createAuthorizationURL({state:t,scopes:n,redirectURI:r,additionalParams:i}){let a=e.disableDefaultScope?[]:[`user.info.profile`];e.scope&&a.push(...e.scope),n&&a.push(...n);let o=new URL(`https://www.tiktok.com/v2/auth/authorize`);if(o.searchParams.set(`scope`,a.join(`,`)),o.searchParams.set(`response_type`,`code`),o.searchParams.set(`client_key`,e.clientKey),o.searchParams.set(`redirect_uri`,e.redirectURI||r),o.searchParams.set(`state`,t),i)for(let[e,t]of Object.entries(i))_m.has(e)||e!==`client_key`&&o.searchParams.set(e,t);return o},validateAuthorizationCode:async({code:r,codeVerifier:i,redirectURI:a})=>Im({code:r,codeVerifier:i,redirectURI:e.redirectURI||a,options:{},tokenEndpoint:t,tokenEndpointAuth:n}),refreshAccessToken:e.refreshAccessToken?e.refreshAccessToken:async e=>Nm({refreshToken:e,options:{},tokenEndpoint:t,tokenEndpointAuth:n}),async getUserInfo(t){if(e.getUserInfo)return e.getUserInfo(t);let{data:n,error:r}=await Za(`https://open.tiktokapis.com/v2/user/info/?fields=${[`open_id`,`avatar_large_url`,`display_name`,`username`].join(`,`)}`,{headers:{authorization:`Bearer ${t.accessToken}`}});return r?null:{user:{email:n.data.user.email||u_({identifier:n.data.user.open_id,namespace:`tiktok`}),name:n.data.user.display_name||n.data.user.username||``,image:n.data.user.avatar_large_url,emailVerified:!1},data:n}},options:e}},reddit:e=>{let t=`https://www.reddit.com/api/v1/access_token`,n={clientId:e.clientId,clientSecret:e.clientSecret},r={method:`client_secret_basic`};return{id:`reddit`,name:`Reddit`,accountSubject:({profile:e})=>e.id,createAuthorizationURL({state:t,scopes:n,redirectURI:r,additionalParams:i}){let a=e.disableDefaultScope?[]:[`identity`];return e.scope&&a.push(...e.scope),n&&a.push(...n),vm({id:`reddit`,options:e,authorizationEndpoint:`https://www.reddit.com/api/v1/authorize`,scopes:a,state:t,redirectURI:r,duration:e.duration,additionalParams:i})},validateAuthorizationCode:async({code:i,redirectURI:a})=>Im({code:i,redirectURI:e.redirectURI||a,options:n,tokenEndpoint:t,tokenEndpointAuth:r,headers:{accept:`text/plain`,"user-agent":`better-auth`}}),refreshAccessToken:e.refreshAccessToken?e.refreshAccessToken:async e=>Nm({refreshToken:e,options:n,tokenEndpoint:t,tokenEndpointAuth:r}),async getUserInfo(t){if(e.getUserInfo)return e.getUserInfo(t);let{data:n,error:r}=await Za(`https://oauth.reddit.com/api/v1/me`,{headers:{Authorization:`Bearer ${t.accessToken}`,"User-Agent":`better-auth`}});if(r)return null;let i=await e.mapProfileToUser?.(n),a=i?.email||u_({identifier:n.id,namespace:`reddit`});return{user:{name:n.name,image:n.icon_img?.split(`?`)[0],...i,email:a,emailVerified:i?.emailVerified??!1},data:n}},options:e}},roblox:e=>{let t=`https://apis.roblox.com/oauth/v1/token`;return{id:`roblox`,name:`Roblox`,accountSubject:({profile:e})=>e.sub,createAuthorizationURL({state:t,scopes:n,redirectURI:r,additionalParams:i}){let a=e.disableDefaultScope?[]:[`openid`,`profile`];return e.scope&&a.push(...e.scope),n&&a.push(...n),vm({id:`roblox`,options:e,authorizationEndpoint:`https://apis.roblox.com/oauth/v1/authorize`,scopes:a,state:t,redirectURI:r,prompt:e.prompt||`select_account consent`,additionalParams:i})},validateAuthorizationCode:async({code:n,redirectURI:r})=>Im({code:n,redirectURI:e.redirectURI||r,options:e,tokenEndpoint:t,authentication:`post`}),refreshAccessToken:e.refreshAccessToken?e.refreshAccessToken:async n=>Nm({refreshToken:n,options:{clientId:e.clientId,clientKey:e.clientKey,clientSecret:e.clientSecret},tokenEndpoint:t}),async getUserInfo(t){if(e.getUserInfo)return e.getUserInfo(t);let{data:n,error:r}=await Za(`https://apis.roblox.com/oauth/v1/userinfo`,{headers:{authorization:`Bearer ${t.accessToken}`}});if(r)return null;let i=await e.mapProfileToUser?.(n);return{user:{name:n.nickname||n.preferred_username||``,image:n.picture??void 0,email:u_({identifier:n.sub,namespace:`roblox`}),emailVerified:!1,...i},data:{...n}}},options:e}},salesforce:e=>{let t=(e.environment??`production`)===`sandbox`,n=e.loginUrl?`https://${e.loginUrl}/services/oauth2/authorize`:t?`https://test.salesforce.com/services/oauth2/authorize`:`https://login.salesforce.com/services/oauth2/authorize`,r=e.loginUrl?`https://${e.loginUrl}/services/oauth2/token`:t?`https://test.salesforce.com/services/oauth2/token`:`https://login.salesforce.com/services/oauth2/token`,i=e.loginUrl?`https://${e.loginUrl}/services/oauth2/userinfo`:t?`https://test.salesforce.com/services/oauth2/userinfo`:`https://login.salesforce.com/services/oauth2/userinfo`;return{id:`salesforce`,name:`Salesforce`,accountSubject:({profile:e})=>e.user_id,async createAuthorizationURL({state:t,scopes:r,codeVerifier:i,redirectURI:a,additionalParams:o}){if(!e.clientId||!e.clientSecret)throw ra.error(`Client Id and Client Secret are required for Salesforce. Make sure to provide them in the options.`),new N(`CLIENT_ID_AND_SECRET_REQUIRED`);if(!i)throw new N(`codeVerifier is required for Salesforce`);let s=e.disableDefaultScope?[]:[`openid`,`email`,`profile`];return e.scope&&s.push(...e.scope),r&&s.push(...r),vm({id:`salesforce`,options:e,authorizationEndpoint:n,scopes:s,state:t,codeVerifier:i,redirectURI:e.redirectURI||a,additionalParams:o})},validateAuthorizationCode:async({code:t,codeVerifier:n,redirectURI:i})=>Im({code:t,codeVerifier:n,redirectURI:e.redirectURI||i,options:e,tokenEndpoint:r}),refreshAccessToken:e.refreshAccessToken?e.refreshAccessToken:async t=>Nm({refreshToken:t,options:{clientId:e.clientId,clientSecret:e.clientSecret},tokenEndpoint:r}),async getUserInfo(t){if(e.getUserInfo)return e.getUserInfo(t);try{let{data:n}=await Za(i,{headers:{Authorization:`Bearer ${t.accessToken}`}});if(!n)return ra.error(`Failed to fetch user info from Salesforce`),null;let r=await e.mapProfileToUser?.(n);return{user:{name:n.name,email:n.email,image:n.photos?.picture||n.photos?.thumbnail,emailVerified:n.email_verified??!1,...r},data:n}}catch(e){return ra.error(`Failed to fetch user info from Salesforce:`,e),null}},options:e}},vk:e=>{let t=`https://id.vk.com/oauth2/auth`;return{id:`vk`,name:`VK`,accountSubject:({profile:e})=>e.user.user_id,async createAuthorizationURL({state:t,scopes:n,codeVerifier:r,redirectURI:i,additionalParams:a}){let o=e.disableDefaultScope?[]:[`email`,`phone`];return e.scope&&o.push(...e.scope),n&&o.push(...n),vm({id:`vk`,options:e,authorizationEndpoint:`https://id.vk.com/authorize`,scopes:o,state:t,redirectURI:i,codeVerifier:r,additionalParams:a})},validateAuthorizationCode:async({code:n,codeVerifier:r,redirectURI:i,deviceId:a})=>Im({code:n,codeVerifier:r,redirectURI:e.redirectURI||i,options:e,deviceId:a,tokenEndpoint:t}),refreshAccessToken:e.refreshAccessToken?e.refreshAccessToken:async n=>Nm({refreshToken:n,options:{clientId:e.clientId,clientKey:e.clientKey,clientSecret:e.clientSecret},tokenEndpoint:t}),async getUserInfo(t){if(e.getUserInfo)return e.getUserInfo(t);if(!t.accessToken)return null;let{data:n,error:r}=await Za(`https://id.vk.com/oauth2/user_info`,{method:`POST`,headers:{"Content-Type":`application/x-www-form-urlencoded`},body:new URLSearchParams({access_token:t.accessToken,client_id:e.clientId}).toString()});if(r)return null;let i=await e.mapProfileToUser?.(n);return!n.user.email&&!i?.email?null:{user:{first_name:n.user.first_name,last_name:n.user.last_name,email:n.user.email,image:n.user.avatar,emailVerified:!1,birthday:n.user.birthday,sex:n.user.sex,name:`${n.user.first_name} ${n.user.last_name}`,...i},data:n}},options:e}},zoom:e=>{let t={pkce:!0,...e};return{id:`zoom`,name:`Zoom`,accountSubject:({profile:e})=>e.id,createAuthorizationURL:async({state:e,redirectURI:n,codeVerifier:r,additionalParams:i})=>vm({id:`zoom`,options:t,authorizationEndpoint:`https://zoom.us/oauth/authorize`,state:e,redirectURI:n,codeVerifier:t.pkce?r:void 0,additionalParams:i}),validateAuthorizationCode:async({code:e,redirectURI:n,codeVerifier:r})=>Im({code:e,redirectURI:t.redirectURI||n,codeVerifier:r,options:t,tokenEndpoint:`https://zoom.us/oauth/token`,authentication:`post`}),refreshAccessToken:t.refreshAccessToken?t.refreshAccessToken:async e=>Nm({refreshToken:e,options:{clientId:t.clientId,clientKey:t.clientKey,clientSecret:t.clientSecret},tokenEndpoint:`https://zoom.us/oauth/token`}),async getUserInfo(e){if(t.getUserInfo)return t.getUserInfo(e);let{data:n,error:r}=await Za(`https://api.zoom.us/v2/users/me`,{headers:{authorization:`Bearer ${e.accessToken}`}});if(r)return null;let i=await t.mapProfileToUser?.(n);return{user:{name:n.display_name,image:n.pic_url,email:n.email,emailVerified:!!n.verified,...i},data:{...n}}}}},notion:t_,kakao:Kg,naver:e_,line:Jg,paybin:n_,paypal:r_,polar:i_,railway:c_,vercel:e=>({id:`vercel`,name:`Vercel`,accountSubject:({profile:e})=>e.sub,createAuthorizationURL({state:t,scopes:n,codeVerifier:r,redirectURI:i,additionalParams:a}){if(!r)throw new N(`codeVerifier is required for Vercel`);let o;return(e.scope!==void 0||n!==void 0)&&(o=[],e.scope&&o.push(...e.scope),n&&o.push(...n)),vm({id:`vercel`,options:e,authorizationEndpoint:`https://vercel.com/oauth/authorize`,scopes:o,state:t,codeVerifier:r,redirectURI:i,additionalParams:a})},validateAuthorizationCode:async({code:t,codeVerifier:n,redirectURI:r})=>Im({code:t,codeVerifier:n,redirectURI:r,options:e,tokenEndpoint:`https://api.vercel.com/login/oauth/token`}),async getUserInfo(t){if(e.getUserInfo)return e.getUserInfo(t);let{data:n,error:r}=await Za(`https://api.vercel.com/login/oauth/userinfo`,{headers:{Authorization:`Bearer ${t.accessToken}`}});if(r||!n)return null;let i=await e.mapProfileToUser?.(n);return{user:{name:n.name??n.preferred_username??``,email:n.email,image:n.picture,emailVerified:n.email_verified??!1,...i},data:n}},options:e}),wechat:e=>({id:`wechat`,name:`WeChat`,accountSubject:({profile:e})=>e.unionid||e.openid,createAuthorizationURL({state:t,scopes:n,redirectURI:r,additionalParams:i}){let a=e.disableDefaultScope?[]:[`snsapi_login`];e.scope&&a.push(...e.scope),n&&a.push(...n);let o=new URL(`https://open.weixin.qq.com/connect/qrconnect`);if(o.searchParams.set(`scope`,a.join(`,`)),o.searchParams.set(`response_type`,`code`),o.searchParams.set(`appid`,e.clientId),o.searchParams.set(`redirect_uri`,e.redirectURI||r),o.searchParams.set(`state`,t),o.searchParams.set(`lang`,e.lang||`cn`),i)for(let[e,t]of Object.entries(i))_m.has(e)||e!==`appid`&&o.searchParams.set(e,t);return o.hash=`wechat_redirect`,o},validateAuthorizationCode:async({code:t})=>{let{data:n,error:r}=await Za(`https://api.weixin.qq.com/sns/oauth2/access_token?`+new URLSearchParams({appid:e.clientId,secret:e.clientSecret,code:t,grant_type:`authorization_code`}).toString(),{method:`GET`});if(r||!n||n.errcode)throw Error(`Failed to validate authorization code: ${n?.errmsg||r?.message||`Unknown error`}`);return{tokenType:`Bearer`,accessToken:n.access_token,refreshToken:n.refresh_token,accessTokenExpiresAt:new Date(Date.now()+n.expires_in*1e3),scopes:n.scope.split(`,`),openid:n.openid,unionid:n.unionid}},refreshAccessToken:e.refreshAccessToken?e.refreshAccessToken:async t=>{let{data:n,error:r}=await Za(`https://api.weixin.qq.com/sns/oauth2/refresh_token?`+new URLSearchParams({appid:e.clientId,grant_type:`refresh_token`,refresh_token:t}).toString(),{method:`GET`});if(r||!n||n.errcode)throw Error(`Failed to refresh access token: ${n?.errmsg||r?.message||`Unknown error`}`);return{tokenType:`Bearer`,accessToken:n.access_token,refreshToken:n.refresh_token,accessTokenExpiresAt:new Date(Date.now()+n.expires_in*1e3),scopes:n.scope.split(`,`)}},async getUserInfo(t){if(e.getUserInfo)return e.getUserInfo(t);let n=t.openid;if(!n)return null;let{data:r,error:i}=await Za(`https://api.weixin.qq.com/sns/userinfo?`+new URLSearchParams({access_token:t.accessToken||``,openid:n,lang:`zh_CN`}).toString(),{method:`GET`});if(i||!r||r.errcode)return null;let a=await e.mapProfileToUser?.(r),o=r.unionid||r.openid||n;return{user:{name:r.nickname,email:r.email||u_({identifier:o,namespace:`wechat`}),image:r.headimgurl,emailVerified:!1,...a},data:r}},options:e})},f_=Object.keys(d_),p_=Qi(f_).or(j());function m_(e){return e?e.split(`,`).map(e=>e.trim()).filter(Boolean):[]}var h_=Ss(`/list-accounts`,{method:`GET`,use:[Pa],metadata:{openapi:{operationId:`listUserAccounts`,description:`List all accounts linked to the user`,responses:{200:{description:`Success`,content:{"application/json":{schema:{type:`array`,items:{type:`object`,properties:{id:{type:`string`},providerId:{type:`string`},createdAt:{type:`string`,format:`date-time`},updatedAt:{type:`string`,format:`date-time`},accountId:{type:`string`},userId:{type:`string`},scopes:{type:`array`,items:{type:`string`}}},required:[`id`,`providerId`,`createdAt`,`updatedAt`,`accountId`,`userId`,`scopes`]}}}}}}}}},async e=>{let t=e.context.session,n=await e.context.internalAdapter.findAccounts(t.user.id);return e.json(n.map(t=>{let{scope:n,...r}=Oa(e.context.options,t);return{...r,scopes:m_(n)}}))}),g_=Ss(`/link-social`,{method:`POST`,requireHeaders:!0,body:A({callbackURL:j().meta({description:`The URL to redirect to after the user has signed in`}).optional(),provider:p_,idToken:A({token:j(),nonce:j().optional(),accessToken:j().optional(),refreshToken:j().optional()}).optional(),requestSignUp:Pi().optional(),scopes:Gi(j()).meta({description:`Additional scopes to request from the provider`}).optional(),errorCallbackURL:j().meta({description:`The URL to redirect to if there is an error during the link process`}).optional(),disableRedirect:Pi().meta({description:`Disable automatic redirection to the provider. Useful for handling the redirection yourself`}).optional(),loginHint:j().meta({description:`The login hint to use for the authorization code request`}).optional(),additionalParams:ym,additionalData:Ei(j(),Ni()).optional()}),use:[Pa],metadata:{openapi:{description:`Link a social account to the user`,operationId:`linkSocialAccount`,responses:{200:{description:`Success`,content:{"application/json":{schema:{type:`object`,properties:{url:{type:`string`,description:`The authorization URL to redirect the user to`},redirect:{type:`boolean`,description:`Indicates if the user should be redirected to the authorization URL`},status:{type:`boolean`}},required:[`redirect`]}}}}}}}},async e=>{let t=e.context.session,n=await zh(e.context.socialProviders,{value:e.body.provider});if(!n)throw e.context.logger.error(`Provider not found. Make sure to add the provider in your auth config`,{provider:e.body.provider}),M.from(`NOT_FOUND`,P.PROVIDER_NOT_FOUND);if(e.body.idToken){if(!Um(n))throw e.context.logger.error(`Provider does not support id token verification`,{provider:e.body.provider}),M.from(`NOT_FOUND`,P.ID_TOKEN_NOT_SUPPORTED);let{token:r,nonce:i}=e.body.idToken;if(!await Wm(n,r,i,e))throw e.context.logger.warn(`Invalid id token`,{provider:e.body.provider}),M.from(`UNAUTHORIZED`,P.INVALID_TOKEN);let a=await n.getUserInfo({idToken:r,accessToken:e.body.idToken.accessToken,refreshToken:e.body.idToken.refreshToken});if(!a||!a?.user)throw e.context.logger.error(`Failed to get user info`,{provider:e.body.provider}),M.from(`UNAUTHORIZED`,P.FAILED_TO_GET_USER_INFO);if(!a.user.email)throw e.context.logger.error(qh(e.body.provider,{source:`id_token`}),{provider:e.body.provider}),M.from(`UNAUTHORIZED`,P.USER_EMAIL_NOT_FOUND);let o=await Uh(n,{idToken:r,accessToken:e.body.idToken.accessToken,refreshToken:e.body.idToken.refreshToken},a.data),s=await e.context.internalAdapter.findAccountByKey(o);if(s?.userId===t.user.id){let i=Object.fromEntries(Object.entries({providerId:n.id,accessToken:await Xh(e.body.idToken.accessToken,e.context),idToken:r,refreshToken:await Xh(e.body.idToken.refreshToken,e.context)}).filter(([e,t])=>t!==void 0));return await e.context.internalAdapter.updateAccount(s.id,i),await sg(e,t.user.id,a.user),e.json({url:``,status:!0,redirect:!1})}if(s)throw M.from(`CONFLICT`,P.SOCIAL_ACCOUNT_ALREADY_LINKED);if(!e.context.trustedProviders.includes(n.id)&&!a.user.emailVerified||e.context.options.account?.accountLinking?.enabled===!1)throw M.from(`UNAUTHORIZED`,{message:`Account not linked - linking not allowed`,code:`LINKING_NOT_ALLOWED`});if(a.user.email?.toLowerCase()!==t.user.email.toLowerCase()&&e.context.options.account?.accountLinking?.allowDifferentEmails!==!0)throw M.from(`UNAUTHORIZED`,{message:`Account not linked - different emails not allowed`,code:`LINKING_DIFFERENT_EMAILS_NOT_ALLOWED`});try{await e.context.internalAdapter.createAccount({userId:t.user.id,...o,accessToken:await Xh(e.body.idToken.accessToken,e.context),idToken:r,refreshToken:await Xh(e.body.idToken.refreshToken,e.context)})}catch{throw M.from(`EXPECTATION_FAILED`,{message:`Account not linked - unable to create account`,code:`LINKING_FAILED`})}return await sg(e,t.user.id,a.user),e.json({url:``,status:!0,redirect:!1})}let r=gg(n),i=await _g(e,{link:{userId:t.user.id,email:t.user.email},additionalData:e.body.additionalData,idTokenNonce:r}),a=await n.createAuthorizationURL({state:i.state,codeVerifier:i.codeVerifier,idTokenNonce:r,redirectURI:`${e.context.baseURL}${Zh(n)}`,scopes:e.body.scopes,loginHint:e.body.loginHint,additionalParams:e.body.additionalParams});return e.body.disableRedirect||e.setHeader(`Location`,a.toString()),e.json({url:a.toString(),redirect:!e.body.disableRedirect})}),__=Ss(`/unlink-account`,{method:`POST`,body:A({accountId:j().meta({description:`The Better Auth account ID to unlink`})}),use:[pa],metadata:{openapi:{description:`Unlink an account`,responses:{200:{description:`Success`,content:{"application/json":{schema:{type:`object`,properties:{status:{type:`boolean`}}}}}}}}}},async e=>{let{accountId:t}=e.body,n=await e.context.internalAdapter.findAccounts(e.context.session.user.id);if(n.length===1&&!e.context.options.account?.accountLinking?.allowUnlinkingAll)throw M.from(`BAD_REQUEST`,P.FAILED_TO_UNLINK_LAST_ACCOUNT);let r=n.find(e=>e.id===t);if(!r)throw M.from(`BAD_REQUEST`,P.ACCOUNT_NOT_FOUND);return await e.context.internalAdapter.deleteAccount(r.id),e.json({status:!0})});async function v_(e,t){let n=await Ja(e,{disableCookieCache:va(e)});if(!n&&(e.request||e.headers))throw e.error(`UNAUTHORIZED`);let r=n?.user?.id||t;if(!r)throw M.from(`BAD_REQUEST`,{message:`Either userId or session is required`,code:`USER_ID_OR_SESSION_REQUIRED`});return r}var y_=Ui([hi({accountId:j().meta({description:`The Better Auth account ID`}),userId:j().meta({description:`The user ID associated with the account`}).optional()}),hi({useAccountCookie:oa(!0).meta({description:`Select the current OAuth account from its signed cookie`}),userId:j().meta({description:`The user ID associated with the account`}).optional()})]);function b_(e,t,{resolvedUserId:n,selection:r}){return(!ps(e.context.options)||t.userId===n)&&(`accountId`in r?t.id===r.accountId:!0)}async function x_(e,{resolvedUserId:t,selection:n}){if(`accountId`in n){let r=(await e.context.internalAdapter.findAccounts(t)).find(e=>e.id===n.accountId);if(r)return{account:r,accountCookie:null}}else if(e.context.options.account?.storeAccountCookie){let r=await wa(e);if(r&&b_(e,r,{resolvedUserId:t,selection:n}))return{account:r,accountCookie:r}}throw M.from(`BAD_REQUEST`,P.ACCOUNT_NOT_FOUND)}async function S_(e,{resolvedUserId:t,selection:n,account:r}){let i=r??(await x_(e,{resolvedUserId:t,selection:n})).account;if(!b_(e,i,{resolvedUserId:t,selection:n}))throw M.from(`BAD_REQUEST`,P.ACCOUNT_NOT_FOUND);let a=await zh(e.context.socialProviders,{value:i.providerId});if(!a)throw M.from(`BAD_REQUEST`,{message:`Provider ${i.providerId} is not supported.`,code:`PROVIDER_NOT_SUPPORTED`});try{let t=null,n=i.accessTokenExpiresAt&&new Date(i.accessTokenExpiresAt).getTime()-Date.now()<5e3;if(i.refreshToken&&n&&a.refreshAccessToken){let n=await Yh(i.refreshToken,e.context);t=await a.refreshAccessToken(n,e);let r={accessToken:await Xh(t?.accessToken,e.context),accessTokenExpiresAt:t?.accessTokenExpiresAt,refreshToken:t?.refreshToken?await Xh(t.refreshToken,e.context):i.refreshToken,refreshTokenExpiresAt:t?.refreshTokenExpiresAt??i.refreshTokenExpiresAt,idToken:t?.idToken||i.idToken},o=null;i.id&&(o=await e.context.internalAdapter.updateAccount(i.id,r)),e.context.options.account?.storeAccountCookie&&await Xa(e,{...i,...o??r})}let r=(()=>{if(t?.accessTokenExpiresAt)return typeof t.accessTokenExpiresAt==`string`?new Date(t.accessTokenExpiresAt):t.accessTokenExpiresAt;if(i.accessTokenExpiresAt)return typeof i.accessTokenExpiresAt==`string`?new Date(i.accessTokenExpiresAt):i.accessTokenExpiresAt})();return{accessToken:t?.accessToken??await Yh(i.accessToken??``,e.context),accessTokenExpiresAt:r,scopes:m_(i.scope),idToken:t?.idToken??i.idToken??void 0}}catch{throw M.from(`BAD_REQUEST`,{message:`Failed to get a valid access token`,code:`FAILED_TO_GET_ACCESS_TOKEN`})}}var C_=Ss(`/get-access-token`,{method:`POST`,body:y_,metadata:{openapi:{description:`Get a valid access token, doing a refresh if needed`,responses:{200:{description:`A Valid access token`,content:{"application/json":{schema:{type:`object`,properties:{tokenType:{type:`string`},idToken:{type:`string`},accessToken:{type:`string`},accessTokenExpiresAt:{type:`string`,format:`date-time`}}}}}},400:{description:`Invalid refresh token or provider configuration`}}}}},async e=>{let{userId:t}=e.body,n=await S_(e,{resolvedUserId:await v_(e,t),selection:e.body});return e.json(n)}),w_=Ss(`/refresh-token`,{method:`POST`,body:y_,metadata:{openapi:{description:`Refresh the access token using a refresh token`,responses:{200:{description:`Access token refreshed successfully`,content:{"application/json":{schema:{type:`object`,properties:{tokenType:{type:`string`},idToken:{type:`string`},accessToken:{type:`string`},refreshToken:{type:`string`},accessTokenExpiresAt:{type:`string`,format:`date-time`},refreshTokenExpiresAt:{type:`string`,format:`date-time`}}}}}},400:{description:`Invalid refresh token or provider configuration`}}}}},async e=>{let{userId:t}=e.body,{account:n,accountCookie:r}=await x_(e,{resolvedUserId:await v_(e,t),selection:e.body}),i=await zh(e.context.socialProviders,{value:n.providerId});if(!i)throw M.from(`BAD_REQUEST`,{message:`Provider ${n.providerId} is not supported.`,code:`PROVIDER_NOT_SUPPORTED`});if(!i.refreshAccessToken)throw M.from(`BAD_REQUEST`,{message:`Provider ${n.providerId} does not support token refreshing.`,code:`TOKEN_REFRESH_NOT_SUPPORTED`});let a=n.refreshToken??void 0;if(!a)throw M.from(`BAD_REQUEST`,{message:`Refresh token not found`,code:`REFRESH_TOKEN_NOT_FOUND`});try{let t=await Yh(a,e.context),o=await i.refreshAccessToken(t,e),s=o.refreshToken?await Xh(o.refreshToken,e.context):a,c=o.refreshTokenExpiresAt??n.refreshTokenExpiresAt,l={accessToken:await Xh(o.accessToken,e.context),refreshToken:s,accessTokenExpiresAt:o.accessTokenExpiresAt,refreshTokenExpiresAt:c,idToken:o.idToken||n.idToken},u=null;n.id&&(u=await e.context.internalAdapter.updateAccount(n.id,l)),r?.id===n.id&&e.context.options.account?.storeAccountCookie&&await Xa(e,{...r,...u??l});let d=u?.scope??n.scope;return e.json({accessToken:o.accessToken,refreshToken:o.refreshToken??t,accessTokenExpiresAt:o.accessTokenExpiresAt,refreshTokenExpiresAt:c,scope:d,idToken:o.idToken||n.idToken,providerId:n.providerId,accountId:n.id})}catch{throw M.from(`BAD_REQUEST`,{message:`Failed to refresh access token`,code:`FAILED_TO_REFRESH_ACCESS_TOKEN`})}}),T_=Ss(`/account-info`,{method:`GET`,metadata:{openapi:{description:`Get the account info provided by the provider`,responses:{200:{description:`Success`,content:{"application/json":{schema:{type:`object`,properties:{user:{type:`object`,properties:{name:{type:`string`},email:{type:`string`,nullable:!0},image:{type:`string`},emailVerified:{type:`boolean`}},required:[`emailVerified`]},account:{type:`object`,properties:{id:{type:`string`},providerId:{type:`string`},accountId:{type:`string`}},required:[`id`,`providerId`,`accountId`],additionalProperties:!1},data:{type:`object`,properties:{},additionalProperties:!0}},required:[`user`,`data`,`account`],additionalProperties:!1}}}}}}},query:y_},async e=>{let{userId:t}=e.query,n=await v_(e,t),{account:r}=await x_(e,{resolvedUserId:n,selection:e.query}),i=await zh(e.context.socialProviders,{value:r.providerId});if(!i)throw M.from(`BAD_REQUEST`,{message:`Account is not associated with a configured social provider.`,code:`PROVIDER_NOT_CONFIGURED`});let a=await S_(e,{resolvedUserId:n,selection:e.query,account:r});if(!a.accessToken)throw M.from(`BAD_REQUEST`,{message:`Access token not found`,code:`ACCESS_TOKEN_NOT_FOUND`});let o=await i.getUserInfo({...a,accessToken:a.accessToken});if(!o)throw M.from(`UNAUTHORIZED`,P.FAILED_TO_GET_USER_INFO);return e.json({...o,account:{id:r.id,providerId:r.providerId,accountId:r.accountId}})});async function E_(e,t,n){if(n.iss&&t.issuer&&n.iss!==t.issuer)return e.context.logger.error(`OAuth issuer mismatch`,{expected:t.issuer,received:n.iss}),{error:Wh.ISSUER_MISMATCH};if(t.requiresIdTokenNonce&&!n.idTokenNonce)return e.context.logger.error(`OAuth id_token nonce binding required but no expected nonce was found in state`,{providerId:t.id}),{error:Wh.NONCE_BINDING_MISSING};let r;try{r=await t.validateAuthorizationCode({code:n.code,codeVerifier:n.codeVerifier,deviceId:n.deviceId,redirectURI:`${e.context.baseURL}${Zh(t)}`})}catch(t){return e.context.logger.error(`Failed to validate authorization code`,t),{error:Wh.INVALID_CODE}}if(!r)return{error:Wh.INVALID_CODE};let i=await t.getUserInfo({...r,expectedIdTokenNonce:n.idTokenNonce,user:Ki(n.user)??void 0});if(!i?.user)return e.context.logger.error(`Unable to get user info`),{error:Wh.UNABLE_TO_GET_USER_INFO};let a=await Hh(t,r,i.data).catch(n=>(e.context.logger.error(`Unable to derive provider account identity`,{providerId:t.id,error:n}),null));return a?{tokens:r,userInfo:i.user,providerProfile:Vh(i.data),accountKey:a}:{error:Wh.UNABLE_TO_GET_USER_INFO}}var D_={scope:`server`},O_=A({code:j().optional(),error:j().optional(),device_id:j().optional(),error_description:j().optional(),state:j().optional(),user:j().optional(),iss:j().optional()}),k_=Ss(`/callback/:id`,{method:[`GET`,`POST`],operationId:`handleOAuthCallback`,body:O_.optional(),query:O_.optional(),metadata:{...D_,allowedMediaTypes:[`application/x-www-form-urlencoded`,`application/json`]}},async e=>{let t,n=e.context.options.onAPIError?.errorURL||`${e.context.baseURL}/error`;if(e.method===`POST`){let t=e.body?O_.parse(e.body):{},n=e.query?O_.parse(e.query):{},r=O_.parse({...t,...n}),i=new URLSearchParams;for(let[e,t]of Object.entries(r))t!=null&&i.set(e,String(t));let a=`${e.context.baseURL}/callback/${e.params.id}?${i.toString()}`;throw e.redirect(a)}try{if(e.method===`GET`)t=O_.parse(e.query);else if(e.method===`POST`)t=O_.parse(e.body);else throw Error(`Unsupported method`)}catch(t){e.context.logger.error(`INVALID_CALLBACK_REQUEST`,t);let r=qo(n,new URLSearchParams({error:`invalid_callback_request`}));throw e.redirect(r)}let{code:r,error:i,state:a,error_description:o,device_id:s,user:c,iss:l}=t;if(a===void 0&&r){let t=await zh(e.context.socialProviders,{value:e.params.id});if(t?.allowIdpInitiated){let n=gg(t),{state:r,codeVerifier:i}=await _g(e,{idTokenNonce:n}),a=await t.createAuthorizationURL({state:r,codeVerifier:i,idTokenNonce:n,redirectURI:`${e.context.baseURL}${Zh(t)}`});throw e.redirect(a.toString())}}if(!a){e.context.logger.error(`State not found`,i);let t=qo(n,new URLSearchParams({error:`state_not_found`}));throw e.redirect(t)}let{codeVerifier:u,callbackURL:d,link:f,errorURL:p,newUserURL:m,requestSignUp:h,idTokenNonce:g}=await vg(e);function _(t,r){let i=p??n,a=new URLSearchParams({error:t});r&&a.set(`error_description`,r);let o=qo(i,a);throw e.redirect(o)}if(i&&_(i,o),!r)throw e.context.logger.warn(`Code not found`),_(Wh.NO_CODE);let v=await zh(e.context.socialProviders,{value:e.params.id});if(!v)throw e.context.logger.warn(`OAuth provider not found`,{providerId:e.params.id}),_(Wh.PROVIDER_NOT_FOUND);let y=await E_(e,v,{code:r,codeVerifier:u,iss:l,deviceId:s,user:c,idTokenNonce:g});if(y.error)throw _(y.error);let{tokens:b,userInfo:x,providerProfile:S,accountKey:C}=y,{accountId:w}=C;if(!d)throw e.context.logger.error(`No callback URL found`),_(Wh.NO_CALLBACK_URL);let T={...C,...b,scope:b.scopes?.join(`,`)};if(f){let t=await ig(e,{link:f,userInfo:x,account:T,profile:S,scopes:b.scopes});if(!t.linked)return _(t.error.code,t.error.message);throw e.redirect(d)}if(!x.email)return e.context.logger.error(qh(v.id)),_(Wh.EMAIL_NOT_FOUND);let E;try{E=await ag(e,{userInfo:{...x,id:w,email:x.email,name:x.name||``},account:T,callbackURL:d,disableSignUp:v.disableImplicitSignUp&&!h||v.options?.disableSignUp,overrideUserInfo:v.options?.overrideUserInfoOnSignIn,source:{method:`oauth`,oauth:{providerId:v.id,profile:S}}})}catch(e){throw za(e)&&e.body?.code&&_(e.body.code,e.body.message),e}if(E.error)return e.context.logger.error(E.error.split(` `).join(`_`)),_(E.error.split(` `).join(`_`));let{session:D,user:ee}=E.data;await Ua(e,{session:D,user:ee});let te;try{te=(E.isRegister&&m||d).toString()}catch{te=E.isRegister&&m||d}throw e.redirect(te)});function A_(e){return e.replace(/</g,`&lt;`).replace(/>/g,`&gt;`).replace(/"/g,`&quot;`).replace(/'/g,`&#39;`).replace(/&(?!amp;|lt;|gt;|quot;|#39;|#x[0-9a-fA-F]+;|#[0-9]+;)/g,`&amp;`)}var j_=(e,t=`Unknown`,n=null)=>{let r=e.onAPIError?.customizeDefaultErrorPage;return`<!DOCTYPE html>
16
+ <html lang="en">
17
+ <head>
18
+ <meta charset="UTF-8" />
19
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
20
+ <title>Error</title>
21
+ <style>
22
+ * {
23
+ box-sizing: border-box;
24
+ }
25
+ body {
26
+ font-family: ${r?.font?.defaultFamily||`-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif`};
27
+ background: ${r?.colors?.background||`var(--background)`};
28
+ color: var(--foreground);
29
+ margin: 0;
30
+ }
31
+ :root,
32
+ :host {
33
+ --spacing: 0.25rem;
34
+ --container-md: 28rem;
35
+ --text-sm: ${r?.size?.textSm||`0.875rem`};
36
+ --text-sm--line-height: calc(1.25 / 0.875);
37
+ --text-2xl: ${r?.size?.text2xl||`1.5rem`};
38
+ --text-2xl--line-height: calc(2 / 1.5);
39
+ --text-4xl: ${r?.size?.text4xl||`2.25rem`};
40
+ --text-4xl--line-height: calc(2.5 / 2.25);
41
+ --text-6xl: ${r?.size?.text6xl||`3rem`};
42
+ --text-6xl--line-height: 1;
43
+ --font-weight-medium: 500;
44
+ --font-weight-semibold: 600;
45
+ --font-weight-bold: 700;
46
+ --default-transition-duration: 150ms;
47
+ --default-transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
48
+ --radius: ${r?.size?.radiusSm||`0.625rem`};
49
+ --default-mono-font-family: ${r?.font?.monoFamily||`var(--font-geist-mono)`};
50
+ --primary: ${r?.colors?.primary||`black`};
51
+ --primary-foreground: ${r?.colors?.primaryForeground||`white`};
52
+ --background: ${r?.colors?.background||`white`};
53
+ --foreground: ${r?.colors?.foreground||`oklch(0.271 0 0)`};
54
+ --border: ${r?.colors?.border||`oklch(0.89 0 0)`};
55
+ --destructive: ${r?.colors?.destructive||`oklch(0.55 0.15 25.723)`};
56
+ --muted-foreground: ${r?.colors?.mutedForeground||`oklch(0.545 0 0)`};
57
+ --corner-border: ${r?.colors?.cornerBorder||`#404040`};
58
+ }
59
+
60
+ button, .btn {
61
+ cursor: pointer;
62
+ background: none;
63
+ border: none;
64
+ color: inherit;
65
+ font: inherit;
66
+ transition: all var(--default-transition-duration)
67
+ var(--default-transition-timing-function);
68
+ }
69
+ button:hover, .btn:hover {
70
+ opacity: 0.8;
71
+ }
72
+
73
+ @media (prefers-color-scheme: dark) {
74
+ :root,
75
+ :host {
76
+ --primary: ${r?.colors?.primary||`white`};
77
+ --primary-foreground: ${r?.colors?.primaryForeground||`black`};
78
+ --background: ${r?.colors?.background||`oklch(0.15 0 0)`};
79
+ --foreground: ${r?.colors?.foreground||`oklch(0.98 0 0)`};
80
+ --border: ${r?.colors?.border||`oklch(0.27 0 0)`};
81
+ --destructive: ${r?.colors?.destructive||`oklch(0.65 0.15 25.723)`};
82
+ --muted-foreground: ${r?.colors?.mutedForeground||`oklch(0.65 0 0)`};
83
+ --corner-border: ${r?.colors?.cornerBorder||`#a0a0a0`};
84
+ }
85
+ }
86
+ @media (max-width: 640px) {
87
+ :root, :host {
88
+ --text-6xl: 2.5rem;
89
+ --text-2xl: 1.25rem;
90
+ --text-sm: 0.8125rem;
91
+ }
92
+ }
93
+ @media (max-width: 480px) {
94
+ :root, :host {
95
+ --text-6xl: 2rem;
96
+ --text-2xl: 1.125rem;
97
+ }
98
+ }
99
+ </style>
100
+ </head>
101
+ <body style="width: 100vw; min-height: 100vh; overflow-x: hidden; overflow-y: auto;">
102
+ <div
103
+ style="
104
+ display: flex;
105
+ flex-direction: column;
106
+ align-items: center;
107
+ justify-content: center;
108
+ gap: 1.5rem;
109
+ position: relative;
110
+ width: 100%;
111
+ min-height: 100vh;
112
+ padding: 1rem;
113
+ "
114
+ >
115
+ ${r?.disableBackgroundGrid?``:`
116
+ <div
117
+ style="
118
+ position: absolute;
119
+ inset: 0;
120
+ background-image: linear-gradient(to right, ${r?.colors?.gridColor||`var(--border)`} 1px, transparent 1px),
121
+ linear-gradient(to bottom, ${r?.colors?.gridColor||`var(--border)`} 1px, transparent 1px);
122
+ background-size: 40px 40px;
123
+ opacity: 0.6;
124
+ pointer-events: none;
125
+ width: 100vw;
126
+ height: 100vh;
127
+ "
128
+ ></div>
129
+ <div
130
+ style="
131
+ position: absolute;
132
+ inset: 0;
133
+ display: flex;
134
+ align-items: center;
135
+ justify-content: center;
136
+ background: ${r?.colors?.background||`var(--background)`};
137
+ mask-image: radial-gradient(ellipse at center, transparent 20%, black);
138
+ -webkit-mask-image: radial-gradient(ellipse at center, transparent 20%, black);
139
+ pointer-events: none;
140
+ "
141
+ ></div>
142
+ `}
143
+
144
+ <div
145
+ style="
146
+ position: relative;
147
+ z-index: 10;
148
+ border: 2px solid var(--border);
149
+ background: ${r?.colors?.cardBackground||`var(--background)`};
150
+ padding: 1.5rem;
151
+ max-width: 42rem;
152
+ width: 100%;
153
+ "
154
+ >
155
+ ${r?.disableCornerDecorations?``:`
156
+ <!-- Corner decorations -->
157
+ <div
158
+ style="
159
+ position: absolute;
160
+ top: -2px;
161
+ left: -2px;
162
+ width: 2rem;
163
+ height: 2rem;
164
+ border-top: 4px solid var(--corner-border);
165
+ border-left: 4px solid var(--corner-border);
166
+ "
167
+ ></div>
168
+ <div
169
+ style="
170
+ position: absolute;
171
+ top: -2px;
172
+ right: -2px;
173
+ width: 2rem;
174
+ height: 2rem;
175
+ border-top: 4px solid var(--corner-border);
176
+ border-right: 4px solid var(--corner-border);
177
+ "
178
+ ></div>
179
+
180
+ <div
181
+ style="
182
+ position: absolute;
183
+ bottom: -2px;
184
+ left: -2px;
185
+ width: 2rem;
186
+ height: 2rem;
187
+ border-bottom: 4px solid var(--corner-border);
188
+ border-left: 4px solid var(--corner-border);
189
+ "
190
+ ></div>
191
+ <div
192
+ style="
193
+ position: absolute;
194
+ bottom: -2px;
195
+ right: -2px;
196
+ width: 2rem;
197
+ height: 2rem;
198
+ border-bottom: 4px solid var(--corner-border);
199
+ border-right: 4px solid var(--corner-border);
200
+ "
201
+ ></div>`}
202
+
203
+ <div style="text-align: center; margin-bottom: 1.5rem;">
204
+ <div style="margin-bottom: 1.5rem;">
205
+ <div
206
+ style="
207
+ display: inline-block;
208
+ border: 2px solid ${r?.disableTitleBorder?`transparent`:r?.colors?.titleBorder||`var(--destructive)`};
209
+ padding: 0.375rem 1rem;
210
+ "
211
+ >
212
+ <h1
213
+ style="
214
+ font-size: var(--text-6xl);
215
+ font-weight: var(--font-weight-semibold);
216
+ color: ${r?.colors?.titleColor||`var(--foreground)`};
217
+ letter-spacing: -0.02em;
218
+ margin: 0;
219
+ "
220
+ >
221
+ ERROR
222
+ </h1>
223
+ </div>
224
+ <div
225
+ style="
226
+ height: 2px;
227
+ background-color: var(--border);
228
+ width: calc(100% + 3rem);
229
+ margin-left: -1.5rem;
230
+ margin-top: 1.5rem;
231
+ "
232
+ ></div>
233
+ </div>
234
+
235
+ <h2
236
+ style="
237
+ font-size: var(--text-2xl);
238
+ font-weight: var(--font-weight-semibold);
239
+ color: var(--foreground);
240
+ margin: 0 0 1rem;
241
+ "
242
+ >
243
+ Something went wrong
244
+ </h2>
245
+
246
+ <div
247
+ style="
248
+ display: inline-flex;
249
+ align-items: center;
250
+ gap: 0.5rem;
251
+ border: 2px solid var(--border);
252
+ background-color: var(--muted);
253
+ padding: 0.375rem 0.75rem;
254
+ margin: 0 0 1rem;
255
+ flex-wrap: wrap;
256
+ justify-content: center;
257
+ "
258
+ >
259
+ <span
260
+ style="
261
+ font-size: 0.75rem;
262
+ color: var(--muted-foreground);
263
+ font-weight: var(--font-weight-semibold);
264
+ "
265
+ >
266
+ CODE:
267
+ </span>
268
+ <span
269
+ style="
270
+ font-size: var(--text-sm);
271
+ font-family: var(--default-mono-font-family, monospace);
272
+ color: var(--foreground);
273
+ word-break: break-all;
274
+ "
275
+ >
276
+ ${A_(t)}
277
+ </span>
278
+ </div>
279
+
280
+ <p
281
+ style="
282
+ color: var(--muted-foreground);
283
+ max-width: 28rem;
284
+ margin: 0 auto;
285
+ font-size: var(--text-sm);
286
+ line-height: 1.5;
287
+ text-wrap: pretty;
288
+ "
289
+ >
290
+ ${n||`We encountered an unexpected error. Please try again or return to the home page. If you're a developer, you can find <a href='https://better-auth.com/docs/reference/errors/${encodeURIComponent(t)}' target='_blank' rel="noopener noreferrer" style='color: var(--foreground); text-decoration: underline;'>more information about the error</a>.`}
291
+ </p>
292
+ </div>
293
+
294
+ <div
295
+ style="
296
+ display: flex;
297
+ gap: 0.75rem;
298
+ margin-top: 1.5rem;
299
+ justify-content: center;
300
+ flex-wrap: wrap;
301
+ "
302
+ >
303
+ <a
304
+ href="/"
305
+ style="
306
+ text-decoration: none;
307
+ "
308
+ >
309
+ <div
310
+ style="
311
+ border: 2px solid var(--border);
312
+ background: var(--primary);
313
+ color: var(--primary-foreground);
314
+ padding: 0.5rem 1rem;
315
+ border-radius: 0;
316
+ white-space: nowrap;
317
+ "
318
+ class="btn"
319
+ >
320
+ Go Home
321
+ </div>
322
+ </a>
323
+ <a
324
+ href="https://better-auth.com/docs/reference/errors/${encodeURIComponent(t)}?askai=${encodeURIComponent(`What does the error code ${t} mean?`)}"
325
+ target="_blank"
326
+ rel="noopener noreferrer"
327
+ style="
328
+ text-decoration: none;
329
+ "
330
+ >
331
+ <div
332
+ style="
333
+ border: 2px solid var(--border);
334
+ background: transparent;
335
+ color: var(--foreground);
336
+ padding: 0.5rem 1rem;
337
+ border-radius: 0;
338
+ white-space: nowrap;
339
+ "
340
+ class="btn"
341
+ >
342
+ Ask AI
343
+ </div>
344
+ </a>
345
+ </div>
346
+ </div>
347
+ </div>
348
+ </body>
349
+ </html>`},M_=Ss(`/error`,{method:`GET`,metadata:{...D_,openapi:{description:`Displays an error page`,responses:{200:{description:`Success`,content:{"text/html":{schema:{type:`string`,description:`The HTML content of the error page`}}}}}}}},async e=>{let t=new URL(e.request?.url||``),n=t.searchParams.get(`error`)||`UNKNOWN`,r=t.searchParams.get(`error_description`)||null,i=/^[\'A-Za-z0-9_-]+$/.test(n||``)?n:`UNKNOWN`,a=r?A_(r):null,o=new URLSearchParams;o.set(`error`,i),r&&o.set(`error_description`,r);let s=e.context.options,c=s.onAPIError?.errorURL;if(c){let e=qo(c,o);return new Response(null,{status:302,headers:{Location:e}})}return gi&&!s.onAPIError?.customizeDefaultErrorPage?new Response(null,{status:302,headers:{Location:`/?${o.toString()}`}}):new Response(j_(e.context.options,i,a),{headers:{"Content-Type":`text/html`}})}),N_=Ss(`/ok`,{method:`GET`,metadata:{...D_,openapi:{description:`Check if the API is working`,responses:{200:{description:`API is working`,content:{"application/json":{schema:{type:`object`,properties:{ok:{type:`boolean`,description:`Indicates if the API is working`}},required:[`ok`]}}}}}}}},async e=>e.json({ok:!0}));function P_(e,t){if(t.length<e.context.password.config.minPasswordLength)throw e.context.logger.warn(`Password is too short`),M.from(`BAD_REQUEST`,P.PASSWORD_TOO_SHORT)}function F_(e,t){if(t.length>e.context.password.config.maxPasswordLength)throw e.context.logger.warn(`Password is too long`),M.from(`BAD_REQUEST`,P.PASSWORD_TOO_LONG)}async function I_(e,t,n,r){await bo(e.context.adapter,async()=>{await r?.(),e.context.options.emailAndPassword?.revokeSessionsOnPasswordReset&&await e.context.internalAdapter.deleteUserSessions(t),await e.context.internalAdapter.findCredentialAccount(t)?await e.context.internalAdapter.updatePassword(t,n):await e.context.internalAdapter.createAccount({userId:t,providerId:`credential`,accountId:t,password:n})})}async function L_(e,t){F_(e,t.password);let n=await e.context.internalAdapter.findCredentialAccount(t.userId),r=n?.password;return!n||!r?!1:await e.context.password.verify({hash:r,password:t.password})}async function R_(e,t){let n=t.body.password;typeof n==`string`&&F_(t,n);let r=await t.context.internalAdapter.findCredentialAccount(e),i=r?.password;if(!r||!i||!n)throw n&&await t.context.password.hash(n),M.from(`BAD_REQUEST`,P.INVALID_PASSWORD);if(!await t.context.password.verify({hash:i,password:n}))throw M.from(`BAD_REQUEST`,P.INVALID_PASSWORD);return!0}function z_(e,t,n){let r=t?new URL(t,e.baseURL):new URL(`${e.baseURL}/error`);return n&&Object.entries(n).forEach(([e,t])=>r.searchParams.set(e,t)),r.href}function B_(e,t,n){let r=new URL(t,e.baseURL);return n&&Object.entries(n).forEach(([e,t])=>r.searchParams.set(e,t)),r.href}var V_=Ss(`/request-password-reset`,{method:`POST`,body:A({email:Li().meta({description:`The email address of the user to send a password reset email to`}),redirectTo:j().meta({description:"The URL to redirect the user to reset their password. If the token isn't valid or expired, it'll be redirected with a query parameter `?error=INVALID_TOKEN`. If the token is valid, it'll be redirected with a query parameter `?token=VALID_TOKEN"}).optional()}),metadata:{openapi:{operationId:`requestPasswordReset`,description:`Send a password reset email to the user`,responses:{200:{description:`Success`,content:{"application/json":{schema:{type:`object`,properties:{status:{type:`boolean`},message:{type:`string`}}}}}}}}},use:[rh(e=>e.body.redirectTo)]},async e=>{if(!e.context.options.emailAndPassword?.sendResetPassword)throw e.context.logger.error(`Reset password isn't enabled.Please pass an emailAndPassword.sendResetPassword function in your auth config!`),M.from(`BAD_REQUEST`,{message:`Reset password isn't enabled`,code:`RESET_PASSWORD_DISABLED`});let{email:t,redirectTo:n}=e.body,r=await e.context.internalAdapter.findUserByEmail(t,{includeAccounts:!0});if(!r)return Bi(24),await e.context.internalAdapter.findVerificationValue(`dummy-verification-token`),e.context.logger.warn(`Reset Password: User not found`),e.json({status:!0,message:`If this email exists in our system, check your email for the reset link`});let i=eo(e.context.options.emailAndPassword.resetPasswordTokenExpiresIn||3600,`sec`),a=Bi(24);await e.context.internalAdapter.createVerificationValue({value:r.user.id,identifier:`reset-password:${a}`,expiresAt:i});let o=n?encodeURIComponent(n):``,s=`${e.context.baseURL}/reset-password/${a}?callbackURL=${o}`;return await e.context.runInBackgroundOrAwait(e.context.options.emailAndPassword.sendResetPassword({user:r.user,url:s,token:a},e.request)),e.json({status:!0,message:`If this email exists in our system, check your email for the reset link`})}),H_=Ss(`/reset-password/:token`,{method:`GET`,operationId:`resetPasswordCallback`,query:A({callbackURL:j().meta({description:`The URL to redirect the user to reset their password`})}),use:[rh(e=>e.query.callbackURL)],metadata:{openapi:{operationId:`resetPasswordCallback`,description:`Redirects the user to the callback URL with the token`,parameters:[{name:`token`,in:`path`,required:!0,description:`The token to reset the password`,schema:{type:`string`}},{name:`callbackURL`,in:`query`,required:!0,description:`The URL to redirect the user to reset their password`,schema:{type:`string`}}],responses:{200:{description:`Success`,content:{"application/json":{schema:{type:`object`,properties:{token:{type:`string`}}}}}}}}}},async e=>{let{token:t}=e.params,{callbackURL:n}=e.query;if(!t||!n)throw e.redirect(z_(e.context,n,{error:`INVALID_TOKEN`}));let r=await e.context.internalAdapter.findVerificationValue(`reset-password:${t}`);throw!r||r.expiresAt<new Date?e.redirect(z_(e.context,n,{error:`INVALID_TOKEN`})):e.redirect(B_(e.context,n,{token:t}))}),U_=Ss(`/reset-password`,{method:`POST`,operationId:`resetPassword`,query:A({token:j().optional()}).optional(),body:A({newPassword:j().meta({description:`The new password to set`}),token:j().meta({description:`The token to reset the password`}).optional()}),metadata:{openapi:{operationId:`resetPassword`,description:`Reset the password for a user`,responses:{200:{description:`Success`,content:{"application/json":{schema:{type:`object`,properties:{status:{type:`boolean`}}}}}}}}}},async e=>{let t=e.body.token||e.query?.token;if(!t)throw M.from(`BAD_REQUEST`,P.INVALID_TOKEN);let{newPassword:n}=e.body;P_(e,n),F_(e,n);let r=`reset-password:${t}`,i=await e.context.internalAdapter.findVerificationValue(r);if(!i||i.expiresAt<new Date)throw M.from(`BAD_REQUEST`,P.INVALID_TOKEN);let a=i.value,o=await e.context.internalAdapter.findUserById(a);if(!o)throw M.from(`BAD_REQUEST`,P.USER_NOT_FOUND);return await I_(e,a,await e.context.password.hash(n),async()=>{if(!await e.context.internalAdapter.consumeVerificationValue(r))throw M.from(`BAD_REQUEST`,P.INVALID_TOKEN)}),e.context.options.emailAndPassword?.onPasswordReset&&await e.context.options.emailAndPassword.onPasswordReset({user:o},e.request),e.json({status:!0})}),W_=Ss(`/verify-password`,{method:`POST`,body:A({password:j().meta({description:`The password to verify`})}),metadata:{scope:`server`,openapi:{operationId:`verifyPassword`,description:`Verify the current user's password`,responses:{200:{description:`Success`,content:{"application/json":{schema:{type:`object`,properties:{status:{type:`boolean`}}}}}}}}},use:[Ro]},async e=>{let{password:t}=e.body,n=e.context.session;if(!await L_(e,{password:t,userId:n.user.id}))throw M.from(`BAD_REQUEST`,P.INVALID_PASSWORD);return e.json({status:!0})}),G_=A({callbackURL:j().meta({description:`Callback URL to redirect to after the user has signed in`}).optional(),newUserCallbackURL:j().optional(),errorCallbackURL:j().meta({description:`Callback URL to redirect to if an error happens`}).optional(),provider:p_,disableRedirect:Pi().meta({description:`Disable automatic redirection to the provider. Useful for handling the redirection yourself`}).optional(),idToken:ia(A({token:j().meta({description:`ID token from the provider`}),nonce:j().meta({description:`Nonce used to generate the token`}).optional(),accessToken:j().meta({description:`Access token from the provider`}).optional(),refreshToken:j().meta({description:`Refresh token from the provider`}).optional(),expiresAt:Ti().meta({description:`Expiry date of the token`}).optional(),user:A({name:A({firstName:j().optional(),lastName:j().optional()}).optional(),email:j().optional()}).meta({description:`The user object from the provider. Only available for some providers like Apple.`}).optional()})),scopes:Gi(j()).meta({description:`Array of scopes to request from the provider. This will override the default scopes passed.`}).optional(),requestSignUp:Pi().meta({description:`Explicitly request sign-up. Useful when disableImplicitSignUp is true for this provider`}).optional(),loginHint:j().meta({description:`The login hint to use for the authorization code request`}).optional(),additionalParams:ym,additionalData:Ei(j(),Ni()).optional().meta({description:`Additional data to be passed through the OAuth flow`})}),K_=()=>Ss(`/sign-in/social`,{method:`POST`,operationId:`socialSignIn`,body:G_,metadata:{$Infer:{body:{},returned:{}},openapi:{description:`Sign in with a social provider`,operationId:`socialSignIn`,responses:{200:{description:`Success - Returns session details (idToken branch) or an authorize URL (redirect branch)`,content:{"application/json":{schema:{type:`object`,description:`Returns session details when idToken is provided, or an authorize URL otherwise`,properties:{token:{type:`string`},user:{type:`object`,$ref:`#/components/schemas/User`},url:{type:`string`},redirect:{type:`boolean`}},required:[`redirect`]}}}}}}}},async e=>{let t=await zh(e.context.socialProviders,{value:e.body.provider});if(!t)throw e.context.logger.error(`Provider not found. Make sure to add the provider in your auth config`,{provider:e.body.provider}),M.from(`NOT_FOUND`,P.PROVIDER_NOT_FOUND);if(e.body.idToken){if(!Um(t))throw e.context.logger.error(`Provider does not support id token verification`,{provider:e.body.provider}),M.from(`NOT_FOUND`,P.ID_TOKEN_NOT_SUPPORTED);let{token:n,nonce:r}=e.body.idToken;if(!await Wm(t,n,r,e))throw e.context.logger.warn(`Invalid id token`,{provider:e.body.provider}),M.from(`UNAUTHORIZED`,P.INVALID_TOKEN);let i={idToken:n,accessToken:e.body.idToken.accessToken,refreshToken:e.body.idToken.refreshToken,user:e.body.idToken.user},a=await t.getUserInfo(i);if(!a||!a?.user)throw e.context.logger.error(`Failed to get user info`,{provider:e.body.provider}),M.from(`UNAUTHORIZED`,P.FAILED_TO_GET_USER_INFO);if(!a.user.email)throw e.context.logger.error(qh(e.body.provider,{source:`id_token`}),{provider:e.body.provider}),M.from(`UNAUTHORIZED`,P.USER_EMAIL_NOT_FOUND);let o=await Uh(t,i,a.data),s=Vh(a.data),c=await ag(e,{userInfo:{...a.user,email:a.user.email,id:o.accountId,name:a.user.name||``,image:a.user.image,emailVerified:a.user.emailVerified||!1},account:{...o,accessToken:e.body.idToken.accessToken,idToken:n},callbackURL:e.body.callbackURL,disableSignUp:t.disableImplicitSignUp&&!e.body.requestSignUp||t.options?.disableSignUp||t.disableSignUp,source:{method:`oauth`,oauth:{providerId:t.id,profile:s}}});if(c.error)throw c.error===Wh.EMAIL_NOT_VERIFIED?M.from(`FORBIDDEN`,P.EMAIL_NOT_VERIFIED):M.from(`UNAUTHORIZED`,{message:c.error,code:`OAUTH_LINK_ERROR`});return await Ua(e,c.data),e.json({redirect:!1,token:c.data.session.token,url:void 0,user:sa(e.context.options,c.data.user)})}let n=gg(t),{codeVerifier:r,state:i}=await _g(e,{additionalData:e.body.additionalData,idTokenNonce:n}),a=await t.createAuthorizationURL({state:i,codeVerifier:r,idTokenNonce:n,redirectURI:`${e.context.baseURL}${Zh(t)}`,scopes:e.body.scopes,loginHint:e.body.loginHint,additionalParams:e.body.additionalParams});return e.body.disableRedirect||e.setHeader(`Location`,a.toString()),e.json({url:a.toString(),redirect:!e.body.disableRedirect})}),q_=()=>Ss(`/sign-in/email`,{method:`POST`,operationId:`signInEmail`,use:[ah],cloneRequest:!0,body:A({email:j().meta({description:`Email of the user`}),password:j().meta({description:`Password of the user`}),callbackURL:j().meta({description:`Callback URL to use as a redirect for email verification`}).optional(),rememberMe:Pi().meta({description:"If this is false, the session will not be remembered. Default is `true`."}).default(!0).optional()}),metadata:{allowedMediaTypes:[`application/x-www-form-urlencoded`,`application/json`],$Infer:{body:{},returned:{}},openapi:{operationId:`signInEmail`,description:`Sign in with email and password`,responses:{200:{description:`Success - Returns either session details or redirect URL`,content:{"application/json":{schema:{type:`object`,description:`Session response when idToken is provided`,properties:{redirect:{type:`boolean`,enum:[!1]},token:{type:`string`,description:`Session token`},url:{type:`string`,nullable:!0},user:{type:`object`,$ref:`#/components/schemas/User`}},required:[`redirect`,`token`,`user`]}}}}}}}},async e=>{if(!e.context.options?.emailAndPassword?.enabled)throw e.context.logger.error("Email and password is not enabled. Make sure to enable it in the options on you `auth.ts` file. Check `https://better-auth.com/docs/authentication/email-password` for more!"),M.from(`BAD_REQUEST`,{code:`EMAIL_PASSWORD_DISABLED`,message:`Email and password is not enabled`});let{email:t,password:n}=e.body;if(!Li().safeParse(t).success)throw M.from(`BAD_REQUEST`,P.INVALID_EMAIL);F_(e,n);let r=await e.context.internalAdapter.findUserByEmail(t.toLowerCase(),{includeAccounts:!0}),i=r?.accounts.find(e=>e.providerId===`credential`&&e.accountId===r.user.id);if(!r||!i)throw await e.context.password.hash(n),e.context.logger.warn(`User not found`),M.from(`UNAUTHORIZED`,P.INVALID_EMAIL_OR_PASSWORD);let a=r.user,o=i.password;if(!o)throw await e.context.password.hash(n),e.context.logger.warn(`Password not found`),M.from(`UNAUTHORIZED`,P.INVALID_EMAIL_OR_PASSWORD);if(!await e.context.password.verify({hash:o,password:n}))throw e.context.logger.warn(`Invalid password`),M.from(`UNAUTHORIZED`,P.INVALID_EMAIL_OR_PASSWORD);if(e.context.options?.emailAndPassword?.requireEmailVerification&&!a.emailVerified){if(!e.context.options?.emailVerification?.sendVerificationEmail)throw M.from(`FORBIDDEN`,P.EMAIL_NOT_VERIFIED);if(e.context.options?.emailVerification?.sendOnSignIn){let t=await $h(e.context.secret,a.email,void 0,e.context.options.emailVerification?.expiresIn),n=e.body.callbackURL?encodeURIComponent(e.body.callbackURL):`%2F`,r=`${e.context.baseURL}/verify-email?token=${t}&callbackURL=${n}`;await e.context.runInBackgroundOrAwait(e.context.options.emailVerification.sendVerificationEmail({user:a,url:r,token:t},Qh(e.request)))}throw M.from(`FORBIDDEN`,P.EMAIL_NOT_VERIFIED)}let s=await e.context.internalAdapter.createSession(a.id,e.body.rememberMe===!1);if(!s)throw e.context.logger.error(`Failed to create session`),M.from(`UNAUTHORIZED`,P.FAILED_TO_CREATE_SESSION);return await Ua(e,{session:s,user:a},e.body.rememberMe===!1),e.body.callbackURL&&e.setHeader(`Location`,e.body.callbackURL),e.json({redirect:!!e.body.callbackURL,token:s.token,url:e.body.callbackURL,user:sa(e.context.options,a)})}),J_=A({callbackURL:j().meta({description:`The URL to redirect to after provider logout`}).optional(),disableRedirect:Pi().meta({description:`Return the provider logout URL without redirecting`}).optional(),state:j().meta({description:`State to pass to the provider logout endpoint`}).optional()}).optional(),Y_=e=>({success:!0,url:e?.url,redirect:e?.redirect}),X_=Ss(`/sign-out`,{method:`POST`,body:J_,operationId:`signOut`,requireHeaders:!0,metadata:{openapi:{operationId:`signOut`,description:`Sign out the current user`,responses:{200:{description:`Success`,content:{"application/json":{schema:{type:`object`,properties:{success:{type:`boolean`},url:{type:`string`,description:`Provider logout URL when RP-initiated logout is available`},redirect:{type:`boolean`,description:`Whether the client should redirect to the provider logout URL`}}}}}}}}}},async e=>{let t=await e.getSignedCookie(e.context.authCookies.sessionToken.name,e.context.secret),n=null;if(t)try{n=await e.context.internalAdapter.findSession(t)}catch(t){e.context.logger.error(`Failed to read session from database`,t)}if(t)try{await e.context.internalAdapter.deleteSession(t)}catch(t){e.context.logger.error(`Failed to delete session from database`,t)}Ba(e);let r=await(async()=>{try{if(!n)return null;let t=await e.context.internalAdapter.findAccounts(n.user.id),r=new Map(e.context.socialProviders.map(e=>[e.id,e])),i=t.filter(e=>!!r.get(e.providerId)?.createEndSessionURL).sort((e,t)=>t.updatedAt.getTime()-e.updatedAt.getTime());if(i.length===0)return null;let a=new Set,o=e.body?.callbackURL?new URL(e.body.callbackURL,e.context.baseURL).toString():void 0;for(let t of i){if(a.has(t.providerId))continue;a.add(t.providerId);let n=r.get(t.providerId);try{let r=await n?.createEndSessionURL?.({idToken:t.idToken,postLogoutRedirectURI:o,state:e.body?.state});if(r)return r.toString()}catch(n){e.context.logger.error(`Failed to create logout URL for provider "${t.providerId}"`,n)}}return null}catch(t){return e.context.logger.error(`Failed to create provider logout URL`,t),null}})();if(r){let t=!e.body?.disableRedirect;return t&&e.setHeader(`Location`,r),e.json(Y_({url:r,redirect:t}))}return e.json(Y_())}),Z_=A({name:j(),email:Li(),password:j().nonempty(),image:j().optional(),callbackURL:j().optional(),rememberMe:Pi().optional()}).and(Ei(j(),Ni())),Q_=()=>Ss(`/sign-up/email`,{method:`POST`,operationId:`signUpWithEmailAndPassword`,use:[ah],body:Z_,cloneRequest:!0,metadata:{allowedMediaTypes:[`application/x-www-form-urlencoded`,`application/json`],$Infer:{body:{},returned:{}},openapi:{operationId:`signUpWithEmailAndPassword`,description:`Sign up a user using email and password`,requestBody:{content:{"application/json":{schema:{type:`object`,properties:{name:{type:`string`,description:`The name of the user`},email:{type:`string`,description:`The email of the user`},password:{type:`string`,description:`The password of the user`},image:{type:`string`,description:`The profile image URL of the user`},callbackURL:{type:`string`,description:`The URL to use for email verification callback`},rememberMe:{type:`boolean`,description:"If this is false, the session will not be remembered. Default is `true`."}},required:[`name`,`email`,`password`]}}}},responses:{200:{description:`Successfully created user`,content:{"application/json":{schema:{type:`object`,properties:{token:{type:`string`,nullable:!0,description:`Authentication token for the session`},user:{type:`object`,properties:{id:{type:`string`,description:`The unique identifier of the user`},email:{type:`string`,format:`email`,description:`The email address of the user`},name:{type:`string`,description:`The name of the user`},image:{type:`string`,format:`uri`,nullable:!0,description:`The profile image URL of the user`},emailVerified:{type:`boolean`,description:`Whether the email has been verified`},createdAt:{type:`string`,format:`date-time`,description:`When the user was created`},updatedAt:{type:`string`,format:`date-time`,description:`When the user was last updated`}},required:[`id`,`email`,`name`,`emailVerified`,`createdAt`,`updatedAt`]}},required:[`user`]}}}},422:{description:`Unprocessable Entity. User already exists or failed to create user.`,content:{"application/json":{schema:{type:`object`,properties:{message:{type:`string`}}}}}}}}}},async e=>bo(e.context.adapter,async()=>{if(!e.context.options.emailAndPassword?.enabled||e.context.options.emailAndPassword?.disableSignUp)throw M.from(`BAD_REQUEST`,{message:`Email and password sign up is not enabled`,code:`EMAIL_PASSWORD_SIGN_UP_DISABLED`});let t=e.body,{name:n,email:r,password:i,image:a,callbackURL:o,rememberMe:s,...c}=t;if(!Li().safeParse(r).success)throw M.from(`BAD_REQUEST`,P.INVALID_EMAIL);if(!i||typeof i!=`string`)throw M.from(`BAD_REQUEST`,P.INVALID_PASSWORD);P_(e,i),F_(e,i);let l=e.context.options.emailAndPassword.requireEmailVerification||e.context.options.emailAndPassword.autoSignIn===!1,u=e.context.options.emailAndPassword.autoSignIn===!1||l,d=Ha(e.context.options,c,`create`),f=r.toLowerCase(),p=()=>{let t=new Date,r=e.context.generateId({model:`user`})||Bi(),i={name:n,email:f,emailVerified:!1,image:a??null,createdAt:t,updatedAt:t},o=e.context.options.emailAndPassword?.customSyntheticUser,s;if(o){let t=Object.keys(e.context.options.user?.additionalFields??{}),n={};for(let e of t)e in d&&(n[e]=d[e]);let a=o({coreFields:i,additionalFields:n,id:r});s=Sa(e.context.options,a)}else s=Sa(e.context.options,{...i,...d,id:r});return e.json({token:null,user:sa(e.context.options,s)})},m=await e.context.internalAdapter.findUserByEmail(f);if(m?.user){if(e.context.logger.info(`Sign-up attempt for existing email: ${r}`),l){await e.context.password.hash(i);let t=e.context.options.emailAndPassword?.onExistingUserSignUp;if(t){let n=Qh(e.request);await $o(async()=>{await e.context.runInBackgroundOrAwait(t({user:m.user},n))},{onError:t=>e.context.logger.error(`Failed to run onExistingUserSignUp after sign-up`,t)})}return p()}throw M.from(`UNPROCESSABLE_ENTITY`,P.USER_ALREADY_EXISTS_USE_ANOTHER_EMAIL)}let h=await e.context.password.hash(i),g;try{if(g=await e.context.internalAdapter.createUser({email:f,name:n,image:a,...d,emailVerified:!1},{method:`email-password`}),!g)throw M.from(`BAD_REQUEST`,P.FAILED_TO_CREATE_USER)}catch(t){if(za(t)){if(t.statusCode===403&&l)return p();throw t}throw wi()&&e.context.logger.error(`Failed to create user`,t),e.context.logger?.error(`Failed to create user`,t),M.from(`UNPROCESSABLE_ENTITY`,P.FAILED_TO_CREATE_USER)}if(!g)throw M.from(`UNPROCESSABLE_ENTITY`,P.FAILED_TO_CREATE_USER);await e.context.internalAdapter.linkAccount({userId:g.id,providerId:`credential`,accountId:g.id,password:h});let _=e.context.options.emailVerification?.sendOnSignUp??e.context.options.emailAndPassword.requireEmailVerification,v=e.context.options.emailVerification?.sendVerificationEmail;if(_&&v){let n=g,r=t.callbackURL?encodeURIComponent(t.callbackURL):`%2F`,i=Qh(e.request);await $o(async()=>{let t=await $h(e.context.secret,n.email,void 0,e.context.options.emailVerification?.expiresIn),a=`${e.context.baseURL}/verify-email?token=${t}&callbackURL=${r}`;await e.context.runInBackgroundOrAwait(v({user:n,url:a,token:t},i))},{onError:t=>e.context.logger.error(`Failed to send the sign-up verification email`,t)})}if(u)return e.json({token:null,user:sa(e.context.options,g)});let y=await e.context.internalAdapter.createSession(g.id,s===!1,void 0,void 0,{deferSecondaryStorageWrites:!0});if(!y)throw M.from(`BAD_REQUEST`,P.FAILED_TO_CREATE_SESSION);return await Ua(e,{session:y,user:g},s===!1),e.json({token:y.token,user:sa(e.context.options,g)})})),$_=Ei(j().meta({description:`Field name must be a string`}),Ni()),ev=()=>Ss(`/update-session`,{method:`POST`,operationId:`updateSession`,body:$_,use:[Pa],metadata:{$Infer:{body:{}},openapi:{operationId:`updateSession`,description:`Update the current session`,responses:{200:{description:`Success`,content:{"application/json":{schema:{type:`object`,properties:{session:{type:`object`,$ref:`#/components/schemas/Session`}}}}}}}}}},async e=>{let t=e.body;if(typeof t!=`object`||Array.isArray(t))throw M.from(`BAD_REQUEST`,P.BODY_MUST_BE_AN_OBJECT);let n=e.context.session,r=no(e.context.options,t,`update`);if(Object.keys(r).length===0)throw M.fromStatus(`BAD_REQUEST`,{message:`No fields to update`});let i=await e.context.internalAdapter.updateSession(n.session.token,{...r,updatedAt:new Date});if(!i&&va(e))throw Ba(e),M.from(`UNAUTHORIZED`,P.FAILED_TO_GET_SESSION);let a=i??{...n.session,...r,updatedAt:new Date};return await Ua(e,{session:a,user:n.user}),e.json({session:oo(e.context.options,a)})}),tv=Ei(j().meta({description:`Field name must be a string`}),Ni()),nv=()=>Ss(`/update-user`,{method:`POST`,operationId:`updateUser`,body:tv,use:[Pa],metadata:{$Infer:{body:{}},openapi:{operationId:`updateUser`,description:`Update the current user`,requestBody:{content:{"application/json":{schema:{type:`object`,properties:{name:{type:`string`,description:`The name of the user`},image:{type:`string`,description:`The image of the user`,nullable:!0}}}}}},responses:{200:{description:`Success`,content:{"application/json":{schema:{type:`object`,properties:{user:{type:`object`,$ref:`#/components/schemas/User`}}}}}}}}}},async e=>{let t=e.body;if(typeof t!=`object`||Array.isArray(t))throw M.from(`BAD_REQUEST`,P.BODY_MUST_BE_AN_OBJECT);if(t.email)throw M.from(`BAD_REQUEST`,P.EMAIL_CAN_NOT_BE_UPDATED);let{name:n,image:r,...i}=t,a=e.context.session,o=Ha(e.context.options,i,`update`);if(r===void 0&&n===void 0&&Object.keys(o).length===0)throw M.fromStatus(`BAD_REQUEST`,{message:`No fields to update`});let s=await e.context.internalAdapter.updateUser(a.user.id,{name:n,image:r,...o})??{...a.user,...n!==void 0&&{name:n},...r!==void 0&&{image:r},...o};return await Ua(e,{session:a.session,user:s}),e.json({status:!0})}),rv=Ss(`/change-password`,{method:`POST`,operationId:`changePassword`,body:A({newPassword:j().meta({description:`The new password to set`}),currentPassword:j().meta({description:`The current password is required`}),revokeOtherSessions:Pi().meta({description:`Must be a boolean value`}).optional()}),use:[Ro],metadata:{openapi:{operationId:`changePassword`,description:`Change the password of the user`,responses:{200:{description:`Password successfully changed`,content:{"application/json":{schema:{type:`object`,properties:{token:{type:`string`,nullable:!0,description:`New session token if other sessions were revoked`},user:{type:`object`,properties:{id:{type:`string`,description:`The unique identifier of the user`},email:{type:`string`,format:`email`,description:`The email address of the user`},name:{type:`string`,description:`The name of the user`},image:{type:`string`,format:`uri`,nullable:!0,description:`The profile image URL of the user`},emailVerified:{type:`boolean`,description:`Whether the email has been verified`},createdAt:{type:`string`,format:`date-time`,description:`When the user was created`},updatedAt:{type:`string`,format:`date-time`,description:`When the user was last updated`}},required:[`id`,`email`,`name`,`emailVerified`,`createdAt`,`updatedAt`]}},required:[`user`]}}}}}}}},async e=>{let{newPassword:t,currentPassword:n,revokeOtherSessions:r}=e.body,i=e.context.session;P_(e,t),F_(e,t),F_(e,n);let a=await e.context.internalAdapter.findCredentialAccount(i.user.id);if(!a||!a.password)throw M.from(`BAD_REQUEST`,P.CREDENTIAL_ACCOUNT_NOT_FOUND);let o=await e.context.password.hash(t);if(!await e.context.password.verify({hash:a.password,password:n}))throw M.from(`BAD_REQUEST`,P.INVALID_PASSWORD);let s=await bo(e.context.adapter,async()=>{if(r&&await e.context.internalAdapter.deleteUserSessions(i.user.id),await e.context.internalAdapter.updateAccount(a.id,{password:o}),!r)return null;let t=await e.context.internalAdapter.createSession(i.user.id,void 0,void 0,void 0,{deferSecondaryStorageWrites:!0});if(!t)throw M.from(`INTERNAL_SERVER_ERROR`,P.FAILED_TO_GET_SESSION);return t}),c=null;return s&&(await Ua(e,{session:s,user:i.user}),c=s.token),e.json({token:c,user:sa(e.context.options,i.user)})}),iv=Ss.serverOnly({method:`POST`,body:A({newPassword:j().meta({description:`The new password to set is required`})}),use:[Ro]},async e=>{let{newPassword:t}=e.body,n=e.context.session;P_(e,t),F_(e,t);let r=await e.context.internalAdapter.findCredentialAccount(n.user.id),i=await e.context.password.hash(t);if(!r)return await e.context.internalAdapter.linkAccount({userId:n.user.id,providerId:`credential`,accountId:n.user.id,password:i}),e.json({status:!0});if(!r.password)return await e.context.internalAdapter.updateAccount(r.id,{password:i}),e.json({status:!0});throw M.from(`BAD_REQUEST`,P.PASSWORD_ALREADY_SET)}),av=Ss(`/delete-user`,{method:`POST`,use:[Ro],body:A({callbackURL:j().meta({description:`The callback URL to redirect to after the user is deleted`}).optional(),password:j().meta({description:`The password of the user is required to delete the user`}).optional(),token:j().meta({description:`The token to delete the user is required`}).optional()}),metadata:{openapi:{operationId:`deleteUser`,description:`Delete the user`,requestBody:{content:{"application/json":{schema:{type:`object`,properties:{callbackURL:{type:`string`,description:`The callback URL to redirect to after the user is deleted`},password:{type:`string`,description:`The user's password. Required if session is not fresh`},token:{type:`string`,description:`The deletion verification token`}}}}}},responses:{200:{description:`User deletion processed successfully`,content:{"application/json":{schema:{type:`object`,properties:{success:{type:`boolean`,description:`Indicates if the operation was successful`},message:{type:`string`,enum:[`User deleted`,`Verification email sent`],description:`Status message of the deletion process`}},required:[`success`,`message`]}}}}}}}},async e=>{if(!e.context.options.user?.deleteUser?.enabled)throw e.context.logger.error(`Delete user is disabled. Enable it in the options`),M.fromStatus(`NOT_FOUND`);let t=e.context.session;if(e.body.password){F_(e,e.body.password);let n=await e.context.internalAdapter.findCredentialAccount(t.user.id);if(!n||!n.password)throw M.from(`BAD_REQUEST`,P.CREDENTIAL_ACCOUNT_NOT_FOUND);if(!await e.context.password.verify({hash:n.password,password:e.body.password}))throw M.from(`BAD_REQUEST`,P.INVALID_PASSWORD)}if(e.body.token)return await ov({...e,query:{token:e.body.token}}),e.json({success:!0,message:`User deleted`});if(e.context.options.user.deleteUser?.sendDeleteAccountVerification){let n=Io(32,`0-9`,`a-z`);await e.context.internalAdapter.createVerificationValue({value:t.user.id,identifier:`delete-account-${n}`,expiresAt:new Date(Date.now()+(e.context.options.user.deleteUser?.deleteTokenExpiresIn||86400)*1e3)});let r=`${e.context.baseURL}/delete-user/callback?token=${n}&callbackURL=${encodeURIComponent(e.body.callbackURL||`/`)}`;return await e.context.runInBackgroundOrAwait(e.context.options.user.deleteUser.sendDeleteAccountVerification({user:t.user,url:r,token:n},e.request)),e.json({success:!0,message:`Verification email sent`})}if(!e.body.password&&e.context.sessionConfig.freshAge!==0){let n=new Date(t.session.createdAt).getTime(),r=e.context.sessionConfig.freshAge*1e3;if(Date.now()-n>=r)throw M.from(`BAD_REQUEST`,P.SESSION_EXPIRED)}let n=e.context.options.user.deleteUser?.beforeDelete;n&&await n(t.user,e.request),await e.context.internalAdapter.deleteUser(t.user.id),await e.context.internalAdapter.deleteUserSessions(t.user.id),Ba(e);let r=e.context.options.user.deleteUser?.afterDelete;return r&&await r(t.user,e.request),e.json({success:!0,message:`User deleted`})}),ov=Ss(`/delete-user/callback`,{method:`GET`,query:A({token:j().meta({description:`The token to verify the deletion request`}),callbackURL:j().meta({description:`The URL to redirect to after deletion`}).optional()}),use:[rh(e=>e.query.callbackURL)],metadata:{openapi:{description:`Callback to complete user deletion with verification token`,responses:{200:{description:`User successfully deleted`,content:{"application/json":{schema:{type:`object`,properties:{success:{type:`boolean`,description:`Indicates if the deletion was successful`},message:{type:`string`,enum:[`User deleted`],description:`Confirmation message`}},required:[`success`,`message`]}}}}}}}},async e=>{if(!e.context.options.user?.deleteUser?.enabled)throw e.context.logger.error(`Delete user is disabled. Enable it in the options`),M.from(`NOT_FOUND`,{message:`Not found`,code:`NOT_FOUND`});let t=await Ja(e,{disableCookieCache:va(e)});if(!t)throw M.from(`NOT_FOUND`,P.FAILED_TO_GET_USER_INFO);let n=await e.context.internalAdapter.consumeVerificationValue(`delete-account-${e.query.token}`);if(!n||n.value!==t.user.id)throw M.from(`NOT_FOUND`,P.INVALID_TOKEN);let r=e.context.options.user.deleteUser?.beforeDelete;r&&await r(t.user,e.request),await e.context.internalAdapter.deleteUser(t.user.id),await e.context.internalAdapter.deleteUserSessions(t.user.id),await e.context.internalAdapter.deleteAccounts(t.user.id),Ba(e);let i=e.context.options.user.deleteUser?.afterDelete;if(i&&await i(t.user,e.request),e.query.callbackURL)throw e.redirect(e.query.callbackURL||`/`);return e.json({success:!0,message:`User deleted`})}),sv=Ss(`/change-email`,{method:`POST`,body:A({newEmail:Li().meta({description:`The new email address to set must be a valid email address`}),callbackURL:j().meta({description:`The URL to redirect to after email verification`}).optional()}),use:[Ro],metadata:{openapi:{operationId:`changeEmail`,responses:{200:{description:`Email change request processed successfully`,content:{"application/json":{schema:{type:`object`,properties:{user:{type:`object`,$ref:`#/components/schemas/User`},status:{type:`boolean`,description:`Indicates if the request was successful`},message:{type:`string`,enum:[`Email updated`,`Verification email sent`],description:`Status message of the email change process`,nullable:!0}},required:[`status`]}}}}}}}},async e=>{if(!e.context.options.user?.changeEmail?.enabled)throw e.context.logger.error(`Change email is disabled.`),M.from(`BAD_REQUEST`,P.CHANGE_EMAIL_DISABLED);let t=e.body.newEmail.toLowerCase();if(t===e.context.session.user.email)throw e.context.logger.warn(`Email is the same`),M.fromStatus(`BAD_REQUEST`,{message:`Email is the same`});let n=e.context.session.user.emailVerified!==!0&&e.context.options.user.changeEmail.updateEmailWithoutVerification,r=e.context.options.emailVerification?.sendVerificationEmail,i=r&&e.context.session.user.emailVerified&&e.context.options.user.changeEmail.sendChangeEmailConfirmation;if(!n&&!i&&!r)throw e.context.logger.error(`Verification email isn't enabled.`),M.fromStatus(`BAD_REQUEST`,{message:`Verification email isn't enabled`});if(await e.context.internalAdapter.findUserByEmail(t))return await $h(e.context.secret,e.context.session.user.email,t,e.context.options.emailVerification?.expiresIn),e.context.logger.info(`Change email attempt for existing email`),e.json({status:!0});if(n){if(await e.context.internalAdapter.updateUser(e.context.session.user.id,{email:t}),await Ua(e,{session:e.context.session.session,user:{...e.context.session.user,email:t}}),r){let n=await $h(e.context.secret,t,void 0,e.context.options.emailVerification?.expiresIn),i=`${e.context.baseURL}/verify-email?token=${n}&callbackURL=${encodeURIComponent(e.body.callbackURL||`/`)}`;await e.context.runInBackgroundOrAwait(r({user:{...e.context.session.user,email:t},url:i,token:n},e.request))}return e.json({status:!0})}if(i){let n=await $h(e.context.secret,e.context.session.user.email,t,e.context.options.emailVerification?.expiresIn,{requestType:`change-email-confirmation`}),r=`${e.context.baseURL}/verify-email?token=${n}&callbackURL=${encodeURIComponent(e.body.callbackURL||`/`)}`;return await e.context.runInBackgroundOrAwait(i({user:e.context.session.user,newEmail:t,url:r,token:n},e.request)),e.json({status:!0})}if(!r)throw e.context.logger.error(`Verification email isn't enabled.`),M.fromStatus(`BAD_REQUEST`,{message:`Verification email isn't enabled`});let a=await $h(e.context.secret,e.context.session.user.email,t,e.context.options.emailVerification?.expiresIn,{requestType:`change-email-verification`}),o=`${e.context.baseURL}/verify-email?token=${a}&callbackURL=${encodeURIComponent(e.body.callbackURL||`/`)}`;return await e.context.runInBackgroundOrAwait(r({user:{...e.context.session.user,email:t},url:o,token:a},e.request)),e.json({status:!0})});async function cv(e,t){if(e.baseURL)return e;let n=Ih(t),r=e.options.baseURL,i=_o(r)&&!!r.fallback;if(n===void 0&&!i)throw new M(`INTERNAL_SERVER_ERROR`,{message:"Dynamic baseURL could not be resolved for this direct auth.api call. Pass `headers: request.headers` (or `request`) to the call, or add `fallback` to your baseURL config."});try{return await Rh(e,n,Lh(e.options))}catch(e){throw e instanceof N?new M(`INTERNAL_SERVER_ERROR`,{message:e.message}):e}}function lv(e,t){let n={};for(let[r,i]of Object.entries(e))n[r]=async e=>{let n=Es(i,r),a=async()=>{let r=await t,a=r.checkSchema?.();a&&await a;let o=_o(r.options.baseURL)?await cv(r,e):r;return _s(i,{...e,context:o,operationId:n,asResponse:e?.asResponse??Ts(e?.request)})};return await Wo()?a():gs(new WeakMap,a)},n[r].path=i.path,n[r].options=i.options;return n}function uv(e,t){let n=new Map;e.plugins?.forEach(e=>{if(e.endpoints){for(let[t,r]of Object.entries(e.endpoints))if(r&&`path`in r&&typeof r.path==`string`){let i=r.path,a=[];r.options&&`method`in r.options&&(Array.isArray(r.options.method)?a=r.options.method:typeof r.options.method==`string`&&(a=[r.options.method])),a.length===0&&(a=[`*`]),n.has(i)||n.set(i,[]),n.get(i).push({pluginId:e.id,endpointKey:t,methods:a})}}});let r=[];for(let[e,t]of n.entries())if(t.length>1){let n=new Map,i=!1;for(let e of t)for(let r of e.methods)n.has(r)||n.set(r,[]),n.get(r).push(e.pluginId),n.get(r).length>1&&(i=!0),(r===`*`&&t.length>1||r!==`*`&&n.has(`*`))&&(i=!0);if(i){let i=[...new Set(t.map(e=>e.pluginId))],a=[];for(let[e,r]of n.entries())(r.length>1||e===`*`&&t.length>1||e!==`*`&&n.has(`*`))&&a.push(e);r.push({path:e,plugins:i,conflictingMethods:a})}}if(r.length>0){let e=r.map(e=>` - "${e.path}" [${e.conflictingMethods.join(`, `)}] used by plugins: ${e.plugins.join(`, `)}`).join(`
350
+ `);t.error(`Endpoint path conflicts detected! Multiple plugins are trying to use the same endpoint paths with conflicting HTTP methods:
351
+ ${e}
352
+
353
+ To resolve this, you can:
354
+ 1. Use only one of the conflicting plugins
355
+ 2. Configure the plugins to use different paths (if supported)
356
+ 3. Ensure plugins use different HTTP methods for the same path
357
+ `)}}function dv(e,t){let n=ji(t),r=t.plugins?.reduce((e,t)=>({...e,...t.endpoints}),{})??{},i=t.plugins?.map(t=>t.middlewares?.map(r=>{let i=(async i=>{let a=await e;return n(`middleware ${r.path} ${t.id}`,{"better_auth.hook.type":`middleware`,"http.route":r.path,"better_auth.context":`plugin:${t.id}`},()=>r.middleware({...i,context:{...a,...i.context}}))});return i.options=r.middleware.options,{path:r.path,middleware:i}})).filter(e=>e!==void 0).flat()||[];return{api:lv({signInSocial:K_(),callbackOAuth:k_,getSession:bs(),signOut:X_,signUpEmail:Q_(),signInEmail:q_(),resetPassword:U_,verifyPassword:W_,verifyEmail:ng,sendVerificationEmail:tg,changeEmail:sv,changePassword:rv,setPassword:iv,updateSession:ev(),updateUser:nv(),deleteUser:av,requestPasswordReset:V_,requestPasswordResetCallback:H_,listSessions:ga(),revokeSession:Bo,revokeSessions:la,revokeOtherSessions:Ra,linkSocialAccount:g_,listUserAccounts:h_,deleteUserCallback:ov,unlinkAccount:__,refreshToken:w_,getAccessToken:C_,accountInfo:T_,...r,ok:N_,error:M_},e),middlewares:i}}var fv=(e,t)=>{let n=ji(t),{api:r,middlewares:i}=dv(e,t),a=new URL(e.baseURL).pathname;return wo(r,{routerContext:e,openapi:{disabled:!0},basePath:a,routerMiddleware:[{path:`/**`,middleware:nh},...i],allowedMediaTypes:[`application/json`],skipTrailingSlashes:t.advanced?.skipTrailingSlashes??!1,async onRequest(t){let r=e.options.disabledPaths||[],i=Po(t.url,a);if(r.includes(i))return new Response(`Not Found`,{status:404});let o=e.checkSchema?.();o&&await o;let s=t,c=await yh(s,e);if(c)return c;for(let t of e.options.plugins||[])if(t.onRequest){let r=await n(`onRequest ${t.id}`,{[Wi]:`onRequest`,[Yi]:`plugin:${t.id}`},()=>t.onRequest(s,e));if(r&&`response`in r)return r.response;r&&`request`in r&&(s=r.request)}return s},async onResponse(t,r){for(let r of e.options.plugins||[])if(r.onResponse){let i=await n(`onResponse ${r.id}`,{[Wi]:`onResponse`,[Yi]:`plugin:${r.id}`,[ea]:t.status},()=>r.onResponse(t,e));if(i)return i.response}return t},async onError(n){if(za(n)&&n.status===`FOUND`)return;if(t.onAPIError?.throw)throw n;if(t.onAPIError?.onError){try{await t.onAPIError.onError(n,e)}catch(t){e.logger.error(`onAPIError.onError threw`,t)}return}let r=t.logger?.level,i=r===`error`||r===`warn`||r===`debug`?ra:void 0;if(t.logger?.disabled!==!0){if(n&&typeof n==`object`&&`message`in n&&typeof n.message==`string`&&(n.message.includes(`no column`)||n.message.includes(`column`)||n.message.includes(`relation`)||n.message.includes(`table`)||n.message.includes(`does not exist`))){e.logger?.error(n.message);return}za(n)?(n.status===`INTERNAL_SERVER_ERROR`&&e.logger.error(n.status,n),i?.error(n.message)):e.logger?.error(n&&typeof n==`object`&&`name`in n?n.name:``,n)}}})},pv=`1.8.0-beta.2`,mv=async e=>{let t=e.context.returned;return t?t instanceof Response?t.status===200?await t.clone().json():null:za(t)?null:t:null},hv=ca({INVALID_DEVICE_CODE:`Invalid device code`,EXPIRED_DEVICE_CODE:`Device code has expired`,EXPIRED_USER_CODE:`User code has expired`,AUTHORIZATION_PENDING:`Authorization pending`,ACCESS_DENIED:`Access denied`,INVALID_USER_CODE:`Invalid user code`,DEVICE_CODE_ALREADY_PROCESSED:`Device code already processed`,DEVICE_CODE_NOT_CLAIMED:"Device code has not been claimed by a verifying session; call `GET /device` with the `user_code` while signed in before approving or denying",POLLING_TOO_FREQUENTLY:`Polling too frequently`,USER_NOT_FOUND:`User not found`,FAILED_TO_CREATE_SESSION:`Failed to create session`,INVALID_DEVICE_CODE_STATUS:`Invalid device code status`,AUTHENTICATION_REQUIRED:`Authentication required`}),gv=`ABCDEFGHJKLMNPQRSTUVWXYZ23456789`,_v=3,vv=new Set([`11000`,`1062`,`2067`,`23505`,`2601`,`2627`,`ER_DUP_ENTRY`,`P2002`,`SQLITE_CONSTRAINT_UNIQUE`]);function yv(e){if(typeof e!=`object`||!e)return!1;let t=e;if([t.code,t.errcode,t.errno,t.number].some(e=>vv.has(String(e))))return!0;let n=t.message;return typeof n==`string`&&/unique(?: key)? constraint|duplicate (?:entry|key)|e11000/i.test(n)}var bv=RegExp(`^[${gv}]+$`,`i`);function xv(e,t){if(typeof e!=`string`)throw new M(`BAD_REQUEST`,{error:`invalid_request`,error_description:`Generated ${t} code must be a string`});if(Array.from(e).length>191)throw new M(`BAD_REQUEST`,{error:`invalid_request`,error_description:`Generated ${t} code must be at most 191 characters`});return e}function Sv(e){return e.replace(/[^a-zA-Z0-9]/g,``).toUpperCase()}async function Cv(e,t){let n=async t=>{let n=await e.context.adapter.findOne({model:`deviceCode`,where:[{field:`userCode`,value:t}]});return n?.userCode===t?n:null},r=await n(t);if(r)return r;let i=Sv(t);return i===t||!bv.test(i)?r:n(i)}var wv=()=>new M(`BAD_REQUEST`,{error:`expired_token`,error_description:hv.EXPIRED_USER_CODE.message}),Tv=()=>new M(`BAD_REQUEST`,{error:`invalid_request`,error_description:hv.DEVICE_CODE_ALREADY_PROCESSED.message});function Ev(e){if(e.expiresAt<new Date)throw wv();if(e.status!==`pending`)throw Tv()}async function Dv(e,t){let{deviceCode:n,userId:r,decision:i}=t;if(n.userId&&n.userId!==r)throw new M(`FORBIDDEN`,{error:`access_denied`,error_description:`You are not authorized to ${i===`approved`?`approve`:`deny`} this device authorization`});if(!await e.context.adapter.incrementOne({model:`deviceCode`,where:[{field:`id`,value:n.id},{field:`status`,value:`pending`},{field:`userId`,operator:`eq`,value:n.userId??null},{field:`expiresAt`,operator:`gt`,value:new Date}],increment:{},set:{...t.fields,userId:r,status:i}}))throw n.expiresAt<=new Date?wv():Tv()}async function Ov(e,t,n){let r=await Cv(e,n);if(!r)throw new M(`BAD_REQUEST`,{error:`invalid_request`,error_description:hv.INVALID_USER_CODE.message});return await t?.assertStandaloneUse({ctx:e,deviceCode:r,use:`approve`}),r}async function kv(e,t,n,r){let i=await Ja(e);if(!i)throw new M(`UNAUTHORIZED`,{error:`unauthorized`,error_description:hv.AUTHENTICATION_REQUIRED.message});let a=await Ov(e,t,n);if(Ev(a),!a.userId)throw new M(`BAD_REQUEST`,{error:`invalid_request`,error_description:hv.DEVICE_CODE_NOT_CLAIMED.message});await Dv(e,{deviceCode:a,userId:i.user.id,decision:r})}var Av=A({client_id:j().meta({description:`The client ID of the application`}),user_id:j().meta({description:`The user ID to which the device code should be pre-bound.`}).optional(),scope:j().meta({description:`Space-separated list of scopes`}).optional()}),jv=[`invalid_request`,`invalid_client`,`unauthorized_client`,`invalid_scope`],Mv=[`client_id`,`user_id`,`scope`];async function Nv(e,t){for(let e of Mv)t[e]===``&&(t[e]=void 0);let n=e?.headers.get(`content-type`)?.toLowerCase()??``;if(!e||!n.includes(`application/x-www-form-urlencoded`))return;let r=new URLSearchParams(await e.clone().text());for(let e of Mv){let n=r.getAll(e).filter(e=>e.length>0);if(n.length>1)throw new M(`BAD_REQUEST`,{error:`invalid_request`,error_description:`${e} must not be repeated`});t[e]=n.length===0?void 0:n[0]}}var Pv=(e,t)=>{let n=async()=>xv(e.generateDeviceCode?await e.generateDeviceCode():Hv(e.deviceCodeLength),`device`),r=async()=>xv(e.generateUserCode?await e.generateUserCode():Uv(e.userCodeLength),`user`),i=t?.requestSchemaFields??{},a=(t?Av.extend({client_id:j().optional()}):Av).extend(i),o=[...jv,...t?.requestErrorCodes??[]],s=[...o,`server_error`];return Ss(`/device/code`,{method:`POST`,cloneRequest:!0,body:a,error:A({error:Qi(s).meta({description:`Error code`}),error_description:j().meta({description:`Detailed error description`})}),onValidationError:({issues:e,message:n})=>{throw t?.onRequestValidationError?.(e),new M(`BAD_REQUEST`,{error:`invalid_request`,error_description:n})},metadata:{noStore:!0,allowedMediaTypes:[`application/json`,`application/x-www-form-urlencoded`],openapi:{description:`Request a device and user code
358
+
359
+ Follow [rfc8628#section-3.2](https://datatracker.ietf.org/doc/html/rfc8628#section-3.2)`,responses:{...t?.requestOpenAPIResponses,200:{description:`Success`,content:{"application/json":{schema:{type:`object`,properties:{device_code:{type:`string`,description:`The device verification code`},user_code:{type:`string`,description:`The user code to display`},verification_uri:{type:`string`,format:`uri`,description:`The URL for user verification. Defaults to /device if not configured.`},verification_uri_complete:{type:`string`,format:`uri`,description:`The complete URL with user code as query parameter.`},expires_in:{type:`number`,description:`Lifetime in seconds of the device code`},interval:{type:`number`,description:`Minimum polling interval in seconds`}}}}}},400:{description:`Error response`,content:{"application/json":{schema:{type:`object`,properties:{error:{type:`string`,enum:o},error_description:{type:`string`}}}}}},500:{description:`Server error`,content:{"application/json":{schema:{type:`object`,properties:{error:{type:`string`,enum:[`server_error`]},error_description:{type:`string`}}}}}}}}}},async i=>{let a=i.body;await Nv(i.request,a);let o=t?await t.authorizeRequest({ctx:i,request:a}):void 0,s=o?.clientId??a.client_id;if(!o){if(!a.client_id)throw new M(`BAD_REQUEST`,{error:`invalid_request`,error_description:`client_id is required`});if(!e.validateClient){if(t)throw new M(`BAD_REQUEST`,{error:`invalid_client`,error_description:`Invalid client ID`})}else if(!await e.validateClient(a.client_id))throw new M(`BAD_REQUEST`,{error:`invalid_client`,error_description:`Invalid client ID`})}if(!s)throw new M(`BAD_REQUEST`,{error:`invalid_request`,error_description:`client_id is required`});e.onDeviceAuthRequest&&await e.onDeviceAuthRequest(s,a.scope);let c=da(e.expiresIn),l=new Date(Date.now()+c);for(let t=0;t<_v;t++){let t=await n(),u=await r();try{await i.context.adapter.create({model:`deviceCode`,data:{...o?.deviceCodeFields,deviceCode:t,userCode:u,userId:a.user_id||null,expiresAt:l,status:`pending`,pollingInterval:da(e.interval),clientId:s,scope:a.scope}})}catch(e){if(!yv(e))throw e;continue}let{verificationUri:d,verificationUriComplete:f}=Vv(e.verificationUri,i.context.baseURL,u);return i.setHeader(`Cache-Control`,`no-store`),i.setHeader(`Pragma`,`no-cache`),i.json({device_code:t,user_code:u,verification_uri:d,verification_uri_complete:f,expires_in:Math.floor(c/1e3),interval:Math.floor(da(e.interval)/1e3)})}throw new M(`INTERNAL_SERVER_ERROR`,{error:`server_error`,error_description:`Failed to generate a unique device code`})})},Fv=A({grant_type:oa(`urn:ietf:params:oauth:grant-type:device_code`).meta({description:`The grant type for device flow`}),device_code:j().meta({description:`The device verification code`}),client_id:j().meta({description:`The client ID of the application`})}),Iv=A({error:Qi([`authorization_pending`,`slow_down`,`expired_token`,`access_denied`,`invalid_request`,`invalid_grant`]).meta({description:`Error code`}),error_description:j().meta({description:`Detailed error description`})});async function Lv(e){let t=await e.ctx.context.adapter.findOne({model:`deviceCode`,where:[{field:`deviceCode`,value:e.deviceCode}]});if(!t)throw new M(`BAD_REQUEST`,{error:`invalid_grant`,error_description:hv.INVALID_DEVICE_CODE.message});let n=await e.authorizeRedemption(t);if(t.expiresAt<new Date)throw await e.ctx.context.adapter.delete({model:`deviceCode`,where:[{field:`id`,value:t.id}]}),new M(`BAD_REQUEST`,{error:`expired_token`,error_description:hv.EXPIRED_DEVICE_CODE.message});if(t.lastPolledAt&&t.pollingInterval&&Date.now()-new Date(t.lastPolledAt).getTime()<t.pollingInterval)throw new M(`BAD_REQUEST`,{error:`slow_down`,error_description:hv.POLLING_TOO_FREQUENTLY.message});if(await e.ctx.context.adapter.update({model:`deviceCode`,where:[{field:`id`,value:t.id}],update:{lastPolledAt:new Date}}),t.status===`pending`)throw new M(`BAD_REQUEST`,{error:`authorization_pending`,error_description:hv.AUTHORIZATION_PENDING.message});if(t.status===`denied`)throw await e.ctx.context.adapter.delete({model:`deviceCode`,where:[{field:`id`,value:t.id}]}),new M(`BAD_REQUEST`,{error:`access_denied`,error_description:hv.ACCESS_DENIED.message});if(t.status!==`approved`||!t.userId)throw new M(`INTERNAL_SERVER_ERROR`,{error:`server_error`,error_description:hv.INVALID_DEVICE_CODE_STATUS.message});let r=await e.prepareRedemption(t,n.context),i=await e.ctx.context.internalAdapter.findUserById(t.userId);if(!i)throw new M(`INTERNAL_SERVER_ERROR`,{error:`server_error`,error_description:hv.USER_NOT_FOUND.message});let a=await e.ctx.context.adapter.consumeOne({model:`deviceCode`,where:[{field:`id`,value:t.id},n.ownershipWhere,{field:`status`,value:`approved`}]});if(!a?.userId)throw new M(`BAD_REQUEST`,{error:`invalid_grant`,error_description:hv.INVALID_DEVICE_CODE.message});return{claimedDeviceCode:a,authorizationContext:n.context,redemptionContext:r,user:i}}var Rv=(e,t)=>Ss(`/device/token`,{method:`POST`,body:Fv,error:Iv,metadata:{noStore:!0,openapi:{description:`Exchange device code for access token
360
+
361
+ Follow [rfc8628#section-3.4](https://datatracker.ietf.org/doc/html/rfc8628#section-3.4)`,responses:{200:{description:`Success`,content:{"application/json":{schema:{type:`object`,properties:{session:{$ref:`#/components/schemas/Session`},user:{$ref:`#/components/schemas/User`}}}}}},400:{description:`Error response`,content:{"application/json":{schema:{type:`object`,properties:{error:{type:`string`,enum:[`authorization_pending`,`slow_down`,`expired_token`,`access_denied`,`invalid_request`,`invalid_grant`]},error_description:{type:`string`}}}}}}}}}},async n=>{let{device_code:r,client_id:i}=n.body;if(e.validateClient&&!await e.validateClient(i))throw new M(`BAD_REQUEST`,{error:`invalid_grant`,error_description:`Invalid client ID`});let{claimedDeviceCode:a,user:o}=await Lv({ctx:n,deviceCode:r,authorizeRedemption:async e=>{if(e.clientId&&e.clientId!==i)throw new M(`BAD_REQUEST`,{error:`invalid_grant`,error_description:`Client ID mismatch`});return await t?.assertStandaloneUse({ctx:n,deviceCode:e,use:`redeem`}),{ownershipWhere:{field:`clientId`,value:i},context:void 0}},prepareRedemption:()=>void 0}),s=await n.context.internalAdapter.createSession(o.id);if(!s)throw new M(`INTERNAL_SERVER_ERROR`,{error:`server_error`,error_description:hv.FAILED_TO_CREATE_SESSION.message});return n.context.setNewSession({session:s,user:o}),n.context.options.secondaryStorage&&await n.context.secondaryStorage?.set(s.token,JSON.stringify({user:o,session:s}),Math.floor((new Date(s.expiresAt).getTime()-Date.now())/1e3)),n.setHeader(`Cache-Control`,`no-store`),n.setHeader(`Pragma`,`no-cache`),n.json({access_token:s.token,token_type:`Bearer`,expires_in:Math.floor((new Date(s.expiresAt).getTime()-Date.now())/1e3),scope:a.scope||``})}),zv=e=>Ss(`/device`,{method:`GET`,query:A({user_code:j().meta({description:`The user code to verify`})}),error:A({error:Qi([`invalid_request`]).meta({description:`Error code`}),error_description:j().meta({description:`Detailed error description`})}),metadata:{openapi:{description:`Verify user code and get device authorization status`,responses:{200:{description:`Device authorization status`,content:{"application/json":{schema:{type:`object`,properties:{user_code:{type:`string`,description:`The user code to verify`},status:{type:`string`,enum:[`pending`,`approved`,`denied`],description:`Current status of the device authorization`},client_id:{type:`string`,description:`The client requesting authorization, returned only to the authenticated user who owns this request`},scope:{type:`string`,description:`The requested scopes, returned only to the authenticated user who owns this request`}}}}}}}}}},async t=>{let{user_code:n}=t.query,r=await Ov(t,e,n);if(r.expiresAt<new Date)throw wv();let i=await Ja(t);i?.user?.id&&!r.userId&&r.status===`pending`&&await t.context.adapter.incrementOne({model:`deviceCode`,where:[{field:`id`,value:r.id},{field:`status`,value:`pending`},{field:`userId`,operator:`eq`,value:null}],increment:{},set:{userId:i.user.id}})&&(r.userId=i.user.id);let a=i?.user.id!==void 0&&r.userId===i.user.id;return t.json({user_code:n,status:r.status,...a?{client_id:r.clientId,scope:r.scope}:{}})}),Bv=(e,t)=>{let n=e===`/device/approve`?`approved`:`denied`,r=n===`approved`?`Approve`:`Deny`;return Ss(e,{method:`POST`,body:A({userCode:j().meta({description:`The user code to ${r.toLowerCase()}`})}),error:A({error:Qi([`invalid_request`,`expired_token`,`unauthorized`,`access_denied`]).meta({description:`Error code`}),error_description:j().meta({description:`Detailed error description`})}),requireHeaders:!0,metadata:{openapi:{description:`${r} device authorization`,responses:{200:{description:`Success`,content:{"application/json":{schema:{type:`object`,properties:{success:{type:`boolean`}}}}}}}}}},async e=>(await kv(e,t,e.body.userCode,n),e.json({success:!0})))},Vv=(e,t,n)=>{let r=e||`/device`,i;try{i=new URL(r)}catch{i=new URL(r,t)}let a=new URL(i);return a.searchParams.set(`user_code`,n),{verificationUri:i.toString(),verificationUriComplete:a.toString()}},Hv=e=>Io(e,`a-z`,`A-Z`,`0-9`),Uv=e=>{let t=new Uint8Array(e);return Array.from(crypto.getRandomValues(t)).map(e=>gv[e%32]).join(``)},Wv={deviceCode:{fields:{deviceCode:{type:`string`,required:!0},userCode:{type:`string`,required:!0},userId:{type:`string`,required:!1},expiresAt:{type:`date`,required:!0},status:{type:`string`,required:!0},lastPolledAt:{type:`date`,required:!1},pollingInterval:{type:`number`,required:!1},clientId:{type:`string`,required:!1},scope:{type:`string`,required:!1}},indexes:[{fields:[`deviceCode`],unique:!0},{fields:[`userCode`],unique:!0}]}};A({id:j(),deviceCode:j(),userCode:j(),userId:j().optional(),expiresAt:qi(),status:j(),lastPolledAt:qi().optional(),pollingInterval:Ti().optional(),clientId:j().optional(),scope:j().optional()});var Gv=Xi(e=>{if(typeof e!=`string`)return!1;try{return da(e),!0}catch{return!1}},{message:`Invalid time string format. Use formats like '30m', '5s', '1h', etc.`}),Kv=A({expiresIn:Gv.default(`30m`).describe(`Time in seconds until the device code expires. Use formats like '30m', '5s', '1h', etc.`),interval:Gv.default(`5s`).describe(`Time in seconds between polling attempts. Use formats like '30m', '5s', '1h', etc.`),deviceCodeLength:Ti().int().positive().max(191).default(40).describe(`Length of the device code to be generated. Must be at most 191 characters. Default is 40 characters.`),userCodeLength:Ti().int().positive().max(191).default(8).describe(`Length of the user code to be generated. Must be at most 191 characters. Default is 8 characters.`),generateDeviceCode:Xi(e=>typeof e==`function`,{message:`generateDeviceCode must be a function that returns a string or a promise that resolves to a string.`}).optional().describe(`Function to generate a device code. If not provided, a default random string generator will be used.`),generateUserCode:Xi(e=>typeof e==`function`,{message:`generateUserCode must be a function that returns a string or a promise that resolves to a string.`}).optional().describe(`Function to generate a user code. If not provided, a default random string generator will be used.`),validateClient:Xi(e=>typeof e==`function`,{message:`validateClient must be a function that returns a boolean or a promise that resolves to a boolean.`}).optional().describe(`Function to validate the client ID. If not provided, no validation will be performed.`),onDeviceAuthRequest:Xi(e=>typeof e==`function`,{message:`onDeviceAuthRequest must be a function that returns void or a promise that resolves to void.`}).optional().describe(`Function to handle device authorization requests. If not provided, no additional actions will be taken.`),verificationUri:j().optional().describe(`The URI where users verify their device code. Can be an absolute URL (https://example.com/device) or relative path (/custom-path). This will be returned as verification_uri in the device code response. If not provided, defaults to /device.`),schema:Xi(()=>!0).optional()}),qv=new Set([`client_id`,`user_id`,`scope`]);function Jv(e){let t=Object.keys(e?.deviceCodeSchemaFields??{}).filter(e=>e in Wv.deviceCode.fields);if(t.length>0)throw new N(`Device authorization grant fields must be additional and cannot redefine deviceCode fields: ${t.join(`, `)}`);let n=Object.keys(e?.requestSchemaFields??{}).filter(e=>qv.has(e));if(n.length>0)throw new N(`Device authorization grant request fields must be additional and cannot redefine request fields: ${n.join(`, `)}`)}var Yv=(e={})=>{let{grant:t,...n}=e,r=t,i=Kv.parse(n);return Jv(r),{id:`device-authorization`,version:pv,schema:rs({deviceCode:{...Wv.deviceCode,fields:{...Wv.deviceCode.fields,...r?.deviceCodeSchemaFields}}},e.schema),endpoints:{deviceCode:Pv(i,r),deviceToken:Rv(i,r),deviceVerify:zv(r),deviceApprove:Bv(`/device/approve`,r),deviceDeny:Bv(`/device/deny`,r)},rateLimit:[{pathMatcher(e){return e===`/device`},window:da(i.expiresIn)/1e3,max:5}],$ERROR_CODES:hv,options:{...i,grant:r}}},Xv=ca({OTP_EXPIRED:`OTP expired`,INVALID_OTP:`Invalid OTP`,TOO_MANY_ATTEMPTS:`Too many attempts`});function Zv(e,t){return`${e}-otp-${t}`}var Qv=async e=>{let t=await os(`SHA-256`).digest(new TextEncoder().encode(e));return _i.encode(new Uint8Array(t),{padding:!1})};function $v(e){let t=e.lastIndexOf(`:`);return t===-1?[e,``]:[e.slice(0,t),e.slice(t+1)]}async function ey(e,t,n){return t.storeOTP===`encrypted`?await Yo({key:e.context.secretConfig,data:n}):t.storeOTP===`hashed`?await Qv(n):typeof t.storeOTP==`object`&&`hash`in t.storeOTP?await t.storeOTP.hash(n):typeof t.storeOTP==`object`&&`encrypt`in t.storeOTP?await t.storeOTP.encrypt(n):n}async function ty(e,t,n,r){return t.storeOTP===`encrypted`?po(await fs({key:e.context.secretConfig,data:n}),r):t.storeOTP===`hashed`?po(await Qv(r),n):typeof t.storeOTP==`object`&&`hash`in t.storeOTP?po(await t.storeOTP.hash(r),n):typeof t.storeOTP==`object`&&`decrypt`in t.storeOTP?po(await t.storeOTP.decrypt(n),r):po(r,n)}async function ny(e,t,n){return t.storeOTP===`plain`||t.storeOTP===void 0?n:t.storeOTP===`encrypted`?await fs({key:e.context.secretConfig,data:n}):typeof t.storeOTP==`object`&&`decrypt`in t.storeOTP?await t.storeOTP.decrypt(n):null}async function ry(e,t,n){let r=await e.context.internalAdapter.findVerificationValue(n);if(!r||r.expiresAt<new Date)return null;let[i,a]=$v(r.value),o=t.allowedAttempts||3;if(a&&parseInt(a)>=o)return null;let s=await ny(e,t,i);return s?(await e.context.internalAdapter.updateVerificationByIdentifier(n,{expiresAt:eo(t.expiresIn,`sec`)}),s):null}var iy=5e3,ay=2e3,oy=250,sy=e=>`revoke-unproven-account-access:${e}`;async function cy(e,t){let n=Date.now()+ay;for(;Date.now()<n;){let n=await e.context.internalAdapter.findVerificationValue(t);if(!n)return;if(n.expiresAt<=new Date){await e.context.internalAdapter.deleteVerificationByIdentifier(t);return}await new Promise(e=>setTimeout(e,oy))}}async function ly(e,t){let n=sy(t);if(!await e.context.internalAdapter.reserveVerificationValue({identifier:n,value:t,expiresAt:new Date(Date.now()+iy)}).catch(e=>{if(e instanceof N&&e.message.includes(`requires database-backed verification storage`))return!0;throw e}))return await cy(e,n),e.context.internalAdapter.findUserById(t);try{let n=await e.context.internalAdapter.findUserById(t);if(!n||n.emailVerified)return n;let r=await e.context.internalAdapter.findAccounts(t);for(let t of r)await e.context.internalAdapter.deleteAccount(t.id);return await e.context.internalAdapter.deleteUserSessions(t),await e.context.internalAdapter.updateUser(t,{emailVerified:!0})}finally{await e.context.internalAdapter.deleteVerificationByIdentifier(n).catch(()=>{})}}var uy=[`email-verification`,`sign-in`,`forget-password`,`change-email`];async function dy(e,t,n,r){let i=Zv(r,n);if(t.resendStrategy===`reuse`){let n=await ry(e,t,i);if(n)return n}let a=t.generateOTP({email:n,type:r},e)||Py(t),o=await ey(e,t,a);return await e.context.internalAdapter.createVerificationValue({value:`${o}:0`,identifier:i,expiresAt:eo(t.expiresIn,`sec`)}).catch(async()=>{await e.context.internalAdapter.deleteVerificationByIdentifier(i),await e.context.internalAdapter.createVerificationValue({value:`${o}:0`,identifier:i,expiresAt:eo(t.expiresIn,`sec`)})}),a}var fy=A({email:j({}).meta({description:`Email address to send the OTP`}),type:Qi(uy).meta({description:`Type of the OTP`})}),py=e=>Ss(`/email-otp/send-verification-otp`,{method:`POST`,use:[ah],body:fy,metadata:{openapi:{operationId:`sendEmailVerificationOTP`,description:`Send a verification OTP to an email`,responses:{200:{description:`Success`,content:{"application/json":{schema:{type:`object`,properties:{success:{type:`boolean`}}}}}}}}}},async t=>{if(!e?.sendVerificationOTP)throw t.context.logger.error(`send email verification is not implemented`),M.fromStatus(`BAD_REQUEST`,{message:`send email verification is not implemented`});let n=t.body.email.toLowerCase();if(!Li().safeParse(n).success)throw M.from(`BAD_REQUEST`,P.INVALID_EMAIL);if(t.body.type===`change-email`)throw t.context.logger.error(`Use the /email-otp/request-email-change endpoint to send OTP for changing email`),M.fromStatus(`BAD_REQUEST`,{message:`Invalid OTP type`});let r=Zv(t.body.type,n),i=await dy(t,e,n,t.body.type),a=t.body.type===`sign-in`&&!e.disableSignUp;return!await t.context.internalAdapter.findUserByEmail(n)&&!a?(await t.context.internalAdapter.deleteVerificationByIdentifier(r),t.json({success:!0})):(await t.context.runInBackgroundOrAwait(e.sendVerificationOTP({email:n,otp:i,type:t.body.type},t)),t.json({success:!0}))}),my=A({email:j({}).meta({description:`Email address to send the OTP`}),type:Qi(uy).meta({required:!0,description:`Type of the OTP`})}),hy=e=>Ss.serverOnly({method:`POST`,body:my,metadata:{openapi:{operationId:`createEmailVerificationOTP`,description:`Create a verification OTP for an email`,responses:{200:{description:`Success`,content:{"application/json":{schema:{type:`string`}}}}}}}},async t=>{let n=t.body.email.toLowerCase(),r=e.generateOTP({email:n,type:t.body.type},t)||Py(e),i=await ey(t,e,r);return await t.context.internalAdapter.createVerificationValue({value:`${i}:0`,identifier:Zv(t.body.type,n),expiresAt:eo(e.expiresIn,`sec`)}),r}),gy=A({email:j({}).meta({description:`Email address the OTP was sent to`}),type:Qi(uy).meta({required:!0,description:`Type of the OTP`})}),_y=e=>Ss.serverOnly({method:`GET`,query:gy,metadata:{openapi:{operationId:`getEmailVerificationOTP`,description:`Get a verification OTP for an email`,responses:{200:{description:`OTP retrieved successfully or not found/expired`,content:{"application/json":{schema:{type:`object`,properties:{otp:{type:`string`,nullable:!0,description:`The stored OTP, or null if not found or expired`}},required:[`otp`]}}}}}}}},async t=>{let n=t.query.email.toLowerCase(),r=await t.context.internalAdapter.findVerificationValue(Zv(t.query.type,n));if(!r||r.expiresAt<new Date)return t.json({otp:null});if(e.storeOTP===`hashed`||typeof e.storeOTP==`object`&&`hash`in e.storeOTP)throw M.fromStatus(`BAD_REQUEST`,{message:`OTP is hashed, cannot return the plain text OTP`});let[i,a]=$v(r.value),o=i;return e.storeOTP===`encrypted`&&(o=await fs({key:t.context.secretConfig,data:i})),typeof e.storeOTP==`object`&&`decrypt`in e.storeOTP&&(o=await e.storeOTP.decrypt(i)),t.json({otp:o})}),vy=A({email:j().meta({description:`Email address the OTP was sent to`}),type:Qi(uy).meta({required:!0,description:`Type of the OTP`}),otp:j().meta({required:!0,description:`OTP to verify`})}),yy=e=>Ss(`/email-otp/check-verification-otp`,{method:`POST`,body:vy,metadata:{openapi:{operationId:`verifyEmailWithOTP`,description:`Verify an email with an OTP`,responses:{200:{description:`Success`,content:{"application/json":{schema:{type:`object`,properties:{success:{type:`boolean`}}}}}}}}}},async t=>{let n=t.body.email.toLowerCase();if(!Li().safeParse(n).success)throw M.from(`BAD_REQUEST`,P.INVALID_EMAIL);let r=Zv(t.body.type,n),i=await t.context.internalAdapter.findVerificationValue(r);if(!i)throw M.from(`BAD_REQUEST`,Xv.INVALID_OTP);if(i.expiresAt<new Date)throw await t.context.internalAdapter.deleteVerificationByIdentifier(r),M.from(`BAD_REQUEST`,Xv.OTP_EXPIRED);let[a,o]=$v(i.value),s=e?.allowedAttempts||3;if(o&&parseInt(o)>=s)throw await t.context.internalAdapter.deleteVerificationByIdentifier(r),M.from(`FORBIDDEN`,Xv.TOO_MANY_ATTEMPTS);if(!await ty(t,e,a,t.body.otp))throw await t.context.internalAdapter.updateVerificationByIdentifier(r,{value:`${a}:${parseInt(o||`0`)+1}`}),M.from(`BAD_REQUEST`,Xv.INVALID_OTP);if(!await t.context.internalAdapter.findUserByEmail(n))throw M.from(`BAD_REQUEST`,P.USER_NOT_FOUND);return t.json({success:!0})}),by=A({email:j({}).meta({description:`Email address to verify`}),otp:j().meta({required:!0,description:`OTP to verify`})}),xy=e=>Ss(`/email-otp/verify-email`,{method:`POST`,body:by,metadata:{openapi:{description:`Verify email with OTP`,responses:{200:{description:`Success`,content:{"application/json":{schema:{type:`object`,properties:{status:{type:`boolean`,description:`Indicates if the verification was successful`,enum:[!0]},token:{type:`string`,nullable:!0,description:`Session token if autoSignInAfterVerification is enabled, otherwise null`},user:{$ref:`#/components/schemas/User`}},required:[`status`,`token`,`user`]}}}}}}}},async t=>{let n=t.body.email.toLowerCase();if(!Li().safeParse(n).success)throw M.from(`BAD_REQUEST`,P.INVALID_EMAIL);await Iy(t,e,Zv(`email-verification`,n),t.body.otp);let r=await t.context.internalAdapter.findUserByEmail(n);if(!r)throw M.from(`BAD_REQUEST`,P.USER_NOT_FOUND);t.context.options.emailVerification?.beforeEmailVerification&&await t.context.options.emailVerification.beforeEmailVerification(r.user,t.request);let i=await t.context.internalAdapter.updateUser(r.user.id,{email:n,emailVerified:!0});if(await t.context.options.emailVerification?.afterEmailVerification?.(i,t.request),t.context.options.emailVerification?.autoSignInAfterVerification){let e=await t.context.internalAdapter.createSession(i.id);return await Ua(t,{session:e,user:i}),t.json({status:!0,token:e.token,user:sa(t.context.options,i)})}let a=await Ja(t);if(a&&i.emailVerified&&a.user.id===i.id){let e=await t.getSignedCookie(t.context.authCookies.dontRememberToken.name,t.context.secret);await Ma(t,{session:a.session,user:{...a.user,emailVerified:!0}},!!e)}return t.json({status:!0,token:null,user:sa(t.context.options,i)})}),Sy=A({email:j({}).meta({description:`Email address to sign in`}),otp:j().meta({required:!0,description:`OTP sent to the email`}),name:j().meta({description:`User display name. Only used if the user is registering for the first time. Eg: "my-name"`}).optional(),image:j().meta({description:`User profile image URL. Only used if the user is registering for the first time.`}).optional()}).and(Ei(j(),Ni())),Cy=e=>Ss(`/sign-in/email-otp`,{method:`POST`,body:Sy,metadata:{openapi:{operationId:`signInWithEmailOTP`,description:`Sign in with email and OTP`,responses:{200:{description:`Success`,content:{"application/json":{schema:{type:`object`,properties:{token:{type:`string`,description:`Session token for the authenticated session`},user:{$ref:`#/components/schemas/User`}},required:[`token`,`user`]}}}}}}}},async t=>{let{email:n,otp:r,name:i,image:a,...o}=t.body,s=n.toLowerCase();await Iy(t,e,Zv(`sign-in`,s),r);let c=await t.context.internalAdapter.findUserByEmail(s);if(!c){if(e.disableSignUp)throw M.from(`BAD_REQUEST`,Xv.INVALID_OTP);let n=Ha(t.context.options,o,`create`),r=await t.context.internalAdapter.createUser({...n,email:s,emailVerified:!0,name:i||``,image:a},{method:`email-otp`}),c=await t.context.internalAdapter.createSession(r.id);return await Ua(t,{session:c,user:r}),t.json({token:c.token,user:sa(t.context.options,r)})}let l=c.user;if(!l.emailVerified){let e=await ly(t,l.id);if(!e)throw M.from(`BAD_REQUEST`,Xv.INVALID_OTP);l=e}let u=await t.context.internalAdapter.createSession(l.id);return await Ua(t,{session:u,user:l}),t.json({token:u.token,user:sa(t.context.options,l)})}),wy=A({email:j().meta({description:`Email address to send the OTP`})}),Ty=e=>Ss(`/email-otp/request-password-reset`,{method:`POST`,body:wy,metadata:{openapi:{operationId:`requestPasswordResetWithEmailOTP`,description:`Request password reset with email and OTP`,responses:{200:{description:`Success`,content:{"application/json":{schema:{type:`object`,properties:{success:{type:`boolean`,description:`Indicates if the OTP was sent successfully`}}}}}}}}}},async t=>{let n=t.body.email.toLowerCase(),r=Zv(`forget-password`,n),i=await dy(t,e,n,`forget-password`);return await t.context.internalAdapter.findUserByEmail(n)?(await t.context.runInBackgroundOrAwait(e.sendVerificationOTP({email:n,otp:i,type:`forget-password`},t)),t.json({success:!0})):(await t.context.internalAdapter.deleteVerificationByIdentifier(r),t.json({success:!0}))}),Ey=A({email:j().meta({description:`Email address to send the OTP`})}),Dy=e=>{let t=Qm(()=>{},`The "/forget-password/email-otp" endpoint is deprecated. Please use "/email-otp/request-password-reset" instead. This endpoint will be removed in the next major version.`);return Ss(`/forget-password/email-otp`,{method:`POST`,body:Ey,metadata:{openapi:{operationId:`forgetPasswordWithEmailOTP`,description:`Deprecated: Use /email-otp/request-password-reset instead.`,responses:{200:{description:`Success`,content:{"application/json":{schema:{type:`object`,properties:{success:{type:`boolean`,description:`Indicates if the OTP was sent successfully`}}}}}}}}}},async n=>{t();let r=n.body.email.toLowerCase(),i=Zv(`forget-password`,r),a=await dy(n,e,r,`forget-password`);return await n.context.internalAdapter.findUserByEmail(r)?(await n.context.runInBackgroundOrAwait(e.sendVerificationOTP({email:r,otp:a,type:`forget-password`},n)),n.json({success:!0})):(await n.context.internalAdapter.deleteVerificationByIdentifier(i),n.json({success:!0}))})},Oy=A({email:j().meta({description:`Email address to reset the password`}),otp:j().meta({description:`OTP sent to the email`}),password:j().meta({description:`New password`})}),ky=e=>Ss(`/email-otp/reset-password`,{method:`POST`,body:Oy,metadata:{openapi:{operationId:`resetPasswordWithEmailOTP`,description:`Reset password with email and OTP`,responses:{200:{description:`Success`,content:{"application/json":{schema:{type:`object`,properties:{success:{type:`boolean`}}}}}}}}}},async t=>{let n=t.body.email.toLowerCase();P_(t,t.body.password),F_(t,t.body.password);let r=Zv(`forget-password`,n),i=!1;await Fy(t,e,r,t.body.otp)||(await Iy(t,e,r,t.body.otp),i=!0);let a=await t.context.internalAdapter.findUserByEmail(n);if(!a)throw M.from(`BAD_REQUEST`,P.USER_NOT_FOUND);let o=await t.context.password.hash(t.body.password);return await I_(t,a.user.id,o,i?void 0:()=>Iy(t,e,r,t.body.otp)),t.context.options.emailAndPassword?.onPasswordReset&&await t.context.options.emailAndPassword.onPasswordReset({user:a.user},t.request),a.user.emailVerified||await t.context.internalAdapter.updateUser(a.user.id,{emailVerified:!0}),t.json({success:!0})}),Ay=A({newEmail:j().meta({description:`New email address to send the OTP`}),otp:j().optional().meta({description:`OTP sent to the current email. This is required if changeEmail.verifyCurrentEmail option is set to true`})}),jy=e=>Ss(`/email-otp/request-email-change`,{method:`POST`,body:Ay,use:[Ro],metadata:{openapi:{operationId:`requestEmailChangeWithEmailOTP`,description:`Request email change with verification OTP sent to the new email`,responses:{200:{description:`Success`,content:{"application/json":{schema:{type:`object`,properties:{success:{type:`boolean`}}}}}}}}}},async t=>{if(!e.changeEmail?.enabled)throw t.context.logger.error(`Change email with OTP is disabled.`),M.fromStatus(`BAD_REQUEST`,{message:`Change email with OTP is disabled`});let n=t.context.session.user.email.toLowerCase(),r=t.body.newEmail.toLowerCase();if(!Li().safeParse(r).success)throw M.from(`BAD_REQUEST`,P.INVALID_EMAIL);if(r===n)throw t.context.logger.error(`Email is the same`),M.fromStatus(`BAD_REQUEST`,{message:`Email is the same`});if(e.changeEmail?.verifyCurrentEmail){if(!t.body.otp)throw M.fromStatus(`BAD_REQUEST`,{message:`OTP is required to verify current email`});await Iy(t,e,Zv(`email-verification`,n),t.body.otp)}else t.body.otp&&t.context.logger.warn(`OTP provided but not required for verifying current email. If you want to require OTP verification for current email, please set the changeEmail.verifyCurrentEmail option to true in the configuration`);let i=e.generateOTP({email:r,type:`change-email`},t)||Py(e),a=await ey(t,e,i);return await t.context.internalAdapter.createVerificationValue({value:`${a}:0`,identifier:Zv(`change-email`,`${n}-${r}`),expiresAt:eo(e.expiresIn,`sec`)}),await t.context.internalAdapter.findUserByEmail(r)?(await t.context.internalAdapter.deleteVerificationByIdentifier(Zv(`change-email`,`${n}-${r}`)),t.json({success:!0})):(await t.context.runInBackgroundOrAwait(e.sendVerificationOTP({email:r,otp:i,type:`change-email`},t)),t.json({success:!0}))}),My=A({newEmail:j().meta({description:`New email address to verify and change to`}),otp:j().meta({description:`OTP sent to the new email`})}),Ny=e=>Ss(`/email-otp/change-email`,{method:`POST`,body:My,use:[Ro],metadata:{openapi:{operationId:`changeEmailWithEmailOTP`,description:`Verify new email with OTP and change the email if verification is successful`,responses:{200:{description:`Success`,content:{"application/json":{schema:{type:`object`,properties:{success:{type:`boolean`}}}}}}}}}},async t=>{if(!e.changeEmail?.enabled)throw t.context.logger.error(`Change email with OTP is disabled.`),M.fromStatus(`BAD_REQUEST`,{message:`Change email with OTP is disabled`});let n=t.context.session,r=n.user.email.toLowerCase(),i=t.body.newEmail.toLowerCase();if(!Li().safeParse(i).success)throw M.from(`BAD_REQUEST`,P.INVALID_EMAIL);if(i===r)throw t.context.logger.error(`Email is the same`),M.fromStatus(`BAD_REQUEST`,{message:`Email is the same`});await Iy(t,e,Zv(`change-email`,`${r}-${i}`),t.body.otp);let a=await t.context.internalAdapter.findUserByEmail(r);if(!a)throw M.from(`BAD_REQUEST`,P.USER_NOT_FOUND);if(await t.context.internalAdapter.findUserByEmail(i))throw M.fromStatus(`BAD_REQUEST`,{message:`Email already in use`});t.context.options.emailVerification?.beforeEmailVerification&&await t.context.options.emailVerification.beforeEmailVerification(a.user,t.request);let o=await t.context.internalAdapter.updateUser(a.user.id,{email:i,emailVerified:!0});return t.context.options.emailVerification?.afterEmailVerification&&await t.context.options.emailVerification.afterEmailVerification(o,t.request),await Ua(t,{session:n.session,user:{...n.user,email:i,emailVerified:!0}}),t.json({success:!0})}),Py=e=>Io(e.otpLength??6,`0-9`);async function Fy(e,t,n,r){let i=await e.context.internalAdapter.findVerificationValue(n);if(!i||i.expiresAt<new Date)return!1;let[a,o]=$v(i.value);return parseInt(o||`0`)>=(t?.allowedAttempts||3)?!1:ty(e,t,a,r)}async function Iy(e,t,n,r){let i=await e.context.internalAdapter.consumeVerificationValue(n);if(!i)throw M.from(`BAD_REQUEST`,Xv.INVALID_OTP);let[a,o]=$v(i.value),s=t?.allowedAttempts||3,c=parseInt(o||`0`);if(c>=s)throw M.from(`FORBIDDEN`,Xv.TOO_MANY_ATTEMPTS);if(!await ty(e,t,a,r))throw await e.context.internalAdapter.createVerificationValue({value:`${a}:${c+1}`,identifier:n,expiresAt:i.expiresAt}),M.from(`BAD_REQUEST`,Xv.INVALID_OTP)}var Ly=e=>Io(e.otpLength??6,`0-9`),Ry=e=>{let t={expiresIn:300,generateOTP:()=>Ly(e),storeOTP:`plain`,...e},n=py(t);return{id:`email-otp`,version:pv,init(e){if(t.overrideDefaultEmailVerification)return{options:{emailVerification:{async sendVerificationEmail(t,r){await e.runInBackgroundOrAwait(n({context:e,request:r,body:{email:t.user.email,type:`email-verification`},ctx:e}))}}}}},endpoints:{sendVerificationOTP:n,createVerificationOTP:hy(t),getVerificationOTP:_y(t),checkVerificationOTP:yy(t),verifyEmailOTP:xy(t),signInEmailOTP:Cy(t),requestPasswordResetEmailOTP:Ty(t),forgetPasswordEmailOTP:Dy(t),resetPasswordEmailOTP:ky(t),requestEmailChangeEmailOTP:jy(t),changeEmailEmailOTP:Ny(t)},hooks:{after:[{matcher(e){return!!(e.path?.startsWith(`/sign-up`)&&t.sendVerificationOnSignUp&&!t.overrideDefaultEmailVerification)},handler:Ya(async n=>{let r=(await mv(n))?.user.email;if(r){let i=t.generateOTP({email:r,type:`email-verification`},n)||Ly(t),a=await ey(n,t,i);await n.context.internalAdapter.createVerificationValue({value:`${a}:0`,identifier:Zv(`email-verification`,r),expiresAt:eo(t.expiresIn,`sec`)}),await n.context.runInBackgroundOrAwait(e.sendVerificationOTP({email:r,otp:i,type:`email-verification`},n))}})}]},rateLimit:[{pathMatcher(e){return e===`/email-otp/send-verification-otp`},window:t.rateLimit?.window||60,max:t.rateLimit?.max||3},{pathMatcher(e){return e===`/email-otp/check-verification-otp`},window:t.rateLimit?.window||60,max:t.rateLimit?.max||3},{pathMatcher(e){return e===`/email-otp/verify-email`},window:t.rateLimit?.window||60,max:t.rateLimit?.max||3},{pathMatcher(e){return e===`/sign-in/email-otp`},window:t.rateLimit?.window||60,max:t.rateLimit?.max||3},{pathMatcher(e){return e===`/email-otp/request-password-reset`},window:t.rateLimit?.window||60,max:t.rateLimit?.max||3},{pathMatcher(e){return e===`/email-otp/reset-password`},window:t.rateLimit?.window||60,max:t.rateLimit?.max||3},{pathMatcher(e){return e===`/forget-password/email-otp`},window:t.rateLimit?.window||60,max:t.rateLimit?.max||3},{pathMatcher(e){return e===`/email-otp/request-email-change`},window:t.rateLimit?.window||60,max:t.rateLimit?.max||3},{pathMatcher(e){return e===`/email-otp/change-email`},window:t.rateLimit?.window||60,max:t.rateLimit?.max||3}],options:e,$ERROR_CODES:Xv}};async function zy(e,t){let n=ya();try{let r=e.split(`.`);if(r.length!==3)return null;let i=new TextDecoder().decode(Di.decode(r[0])),a=JSON.parse(i).kid;if(!a)return n.context.logger.debug(`JWT missing kid in header`),null;let o=await Mo(n.context.adapter,t).getAllKeys(n);if(!o||o.length===0)return n.context.logger.debug(`No JWKS keys available`),null;let s=o.find(e=>e.id===a);if(!s)return n.context.logger.debug(`No JWKS key found for kid: ${a}`),null;let c=JSON.parse(s.publicKey),l=s.alg??Go(t),u=await Uo(c,l),d=typeof n.context.options.baseURL==`string`?n.context.options.baseURL:void 0,f=t?.jwt?.issuer??d,p=t?.jwt?.audience??d;(!f||!p)&&n.context.logger.warn("[better-auth] The JWT plugin is verifying a JWT without checking its issuer or audience because no base URL was resolved for this call. Set `baseURL`, or `jwt.issuer` and `jwt.audience` in the JWT plugin options.");let{payload:m}=await ts(e,u,{issuer:f,audience:p,algorithms:[l]});return!m.sub||!m.aud?null:m}catch(e){return n.context.logger.debug(`JWT verification failed`,e),null}}function By(e){let t=e.context.options.baseURL;return typeof t==`string`?t||`better-auth:session-cache`:e.context.baseURL||`better-auth:session-cache`}async function Vy(e,t,n){let r=yo(t).kid;if(!r)return e.context.logger.debug(`Cookie-cache JWT missing kid in header`),null;let i=await Mo(e.context.adapter,n).getAllKeys(e);if(!i?.length)return e.context.logger.debug(`No JWKS keys available for cookie-cache JWT`),null;let a=i.find(e=>e.id===r);if(!a)return e.context.logger.debug(`No JWKS key found for cookie-cache JWT kid: ${r}`),null;let o=a.alg??Go(n);return{alg:o,publicKey:await Uo(JSON.parse(a.publicKey),o)}}async function Hy(e,t,n,r){let i=await ms(e,r);if(!i)throw new N("`jwt({ sessionCookieCache: true })` requires locally managed JWT plugin keys and does not support `jwt.sign`.");return await new Do({...t,sid:t.session.token}).setProtectedHeader({alg:i.alg,kid:i.kid,typ:xh}).setIssuedAt().setExpirationTime(Math.floor(Date.now()/1e3)+n).setIssuer(By(e)).setAudience(Sh).setSubject(t.user.id).sign(i.privateKey)}async function Uy(e,t,n){try{if(yo(t).typ!==`better-auth.session-cache+jwt`)return null;let r=await Vy(e,t,n);if(!r)return null;let{payload:i}=await ts(t,r.publicKey,{...Ch({issuer:By(e)}),algorithms:[r.alg]}),a=wh(i);return a?{payload:a,expiresAt:a.exp?a.exp*1e3:Date.now()}:null}catch(t){return e.context.logger.debug(`Cookie-cache JWT verification failed`,t),null}}function Wy(e){return{sign:(t,n,r)=>Hy(t,n,r,e),verify:(t,n)=>Uy(t,n,e)}}var Gy={jwks:{fields:{publicKey:{type:`string`,required:!0},privateKey:{type:`string`,required:!0},createdAt:{type:`date`,required:!0},expiresAt:{type:`date`,required:!1},alg:{type:`string`,required:!1},crv:{type:`string`,required:!1}}}},Ky=A({payload:Ei(j(),Ni()),overrideOptions:Ei(j(),Ni()).optional()}),qy=A({token:j(),issuer:j().optional()}),Jy=e=>{if(e?.jwt?.sign&&!e.jwks?.remoteUrl)throw new N(`options.jwks.remoteUrl must be set when using options.jwt.sign`);if(e?.jwks?.remoteUrl&&!e.jwks?.keyPairConfig?.alg)throw new N(`options.jwks.keyPairConfig.alg must be specified when options.jwks.remoteUrl is used for OpenID metadata`);let t=e?.jwks?.jwksPath??`/jwks`;if(typeof t!=`string`||t.length===0||!t.startsWith(`/`)||t.includes(`..`))throw new N(`options.jwks.jwksPath must be a non-empty string starting with '/' and not contain '..'`);return{id:`jwt`,version:pv,options:e,init(t){if(!e?.sessionCookieCache)return;if(t.options.session?.cookieCache?.strategy!==`jwt`)throw new N('`jwt({ sessionCookieCache: true })` requires `session.cookieCache.strategy = "jwt"`.');if(e.jwt?.sign)throw new N("`jwt({ sessionCookieCache: true })` requires locally managed JWT plugin keys and does not support `jwt.sign`.");let n=e.jwks?.gracePeriod,r=t.options.session.cookieCache.maxAge||300;return n!==void 0&&r>n&&t.logger.warn(`[better-auth] \`session.cookieCache.maxAge\` (${r}s) exceeds the JWT plugin JWKS grace period (${n}s). Rotated keys may stop verifying cookie-cache JWTs before the cookie expires.`),{context:{sessionConfig:{...t.sessionConfig,cookieCacheSigner:Wy(e)}}}},endpoints:{getJwks:Ss(t,{method:`GET`,metadata:{openapi:{operationId:`getJSONWebKeySet`,description:`Get the JSON Web Key Set`,responses:{200:{description:`JSON Web Key Set retrieved successfully`,content:{"application/json":{schema:{type:`object`,properties:{keys:{type:`array`,description:`Array of public JSON Web Keys`,items:{type:`object`,properties:{kid:{type:`string`,description:`Key ID uniquely identifying the key, corresponds to the 'id' from the stored Jwk`},kty:{type:`string`,description:`Key type (e.g., 'RSA', 'EC', 'OKP')`},alg:{type:`string`,description:`Algorithm intended for use with the key (e.g., 'EdDSA', 'RS256')`},use:{type:`string`,description:`Intended use of the public key (e.g., 'sig' for signature)`,enum:[`sig`],nullable:!0},n:{type:`string`,description:`Modulus for RSA keys (base64url-encoded)`,nullable:!0},e:{type:`string`,description:`Exponent for RSA keys (base64url-encoded)`,nullable:!0},crv:{type:`string`,description:`Curve name for elliptic curve keys (e.g., 'Ed25519', 'P-256')`,nullable:!0},x:{type:`string`,description:`X coordinate for elliptic curve keys (base64url-encoded)`,nullable:!0},y:{type:`string`,description:`Y coordinate for elliptic curve keys (base64url-encoded)`,nullable:!0}},required:[`kid`,`kty`,`alg`]}}},required:[`keys`]}}}}}}}},async t=>{if(e?.jwks?.remoteUrl)throw new M(`NOT_FOUND`);let n=Mo(t.context.adapter,e),r=await n.getAllKeys(t);if((!r||r?.length===0)&&(await Eo(t,e),r=await n.getAllKeys(t)),!r?.length)throw new N(`No key sets found. Make sure you have a key in your database.`);let i=Date.now(),a=(e?.jwks?.gracePeriod??2592e3)*1e3,o=r.filter(e=>!e.expiresAt||e.expiresAt.getTime()+a>i),s=e?.jwks?.keyPairConfig,c=s&&`crv`in s?s.crv:void 0;return t.json({keys:o.map(t=>({alg:t.alg??Go(e),crv:t.crv??c,...JSON.parse(t.publicKey),kid:t.id}))})}),getToken:Ss(`/token`,{method:`GET`,requireHeaders:!0,use:[Pa],metadata:{openapi:{operationId:`getJSONWebToken`,description:`Get a JWT token`,responses:{200:{description:`Success`,content:{"application/json":{schema:{type:`object`,properties:{token:{type:`string`}}}}}}}}}},async t=>{let n=await Ho(t,e);return t.json({token:n})}),signJWT:Ss.serverOnly({method:`POST`,metadata:{$Infer:{body:{}}},body:Ky},async t=>{let n=await xo(t,{options:{...e,...t.body.overrideOptions},payload:t.body.payload});return t.json({token:n})}),verifyJWT:Ss.serverOnly({method:`POST`,metadata:{$Infer:{body:{},response:{}}},body:qy},async t=>{let n=t.body.issuer?{...e,jwt:{...e?.jwt,issuer:t.body.issuer}}:e,r=await zy(t.body.token,n);return t.json({payload:r})})},hooks:{after:[{matcher(e){return e.path===`/get-session`},handler:Ya(async t=>{if(e?.disableSettingJwtHeader)return;let n=t.context.session||t.context.newSession;if(n&&n.session){let n=await Ho(t,e),r=t.context.responseHeaders?.get(`access-control-expose-headers`)||``,i=new Set(r.split(`,`).map(e=>e.trim()).filter(Boolean));i.add(`set-auth-jwt`),t.setHeader(`set-auth-jwt`,n),t.setHeader(`Access-Control-Expose-Headers`,Array.from(i).join(`, `))}})}]},schema:rs(Gy,e?.schema)}};function Yy(e){let{indexesByTable:t,tables:n}=Ii(e),r=new Map,i={};for(let e in n){let t=n[e],a=t.fields,o={};Object.entries(a).forEach(([e,t])=>{let i=t.references,a=i?n[i.model]:void 0,s=i&&a?{...t,references:{...i,model:a.modelName}}:t;o[t.fieldName||e]=s,i&&r.set(s,{modelKey:i.model,fieldKey:i.field})}),i[t.modelName]?(i[t.modelName].fields={...i[t.modelName].fields,...o},t.disableMigrations&&(i[t.modelName].disableMigrations=!0)):i[t.modelName]={fields:o,order:t.order||1/0,disableMigrations:t.disableMigrations}}for(let[e,n]of t)i[e]&&(i[e].indexes=n);return{schema:i,tables:n,referenceKeys:r}}var Xy=`urn:ietf:params:oauth:grant-type:device_code`,Zy=`/device/code`,Qy=Ui([fo,Gi(fo).min(1),oa(``)]),$y={client_secret:j().meta({description:`OAuth client secret`}).optional(),client_assertion:j().meta({description:`OAuth client assertion`}).optional(),client_assertion_type:j().meta({description:`OAuth client assertion type`}).optional(),resource:Qy.meta({description:`RFC 8707 resource indicator(s) to bind to this authorization request`}).optional()};async function eb(e){let{ctx:t,provider:n}=e,r=t.body,i=r?.device_code;i||As(`BAD_REQUEST`,`invalid_request`,`device_code is required`);let a=await n.authenticateClient({requireCredentials:!1}),{authorizationContext:{client:o,scopes:s},claimedDeviceCode:c,redemptionContext:{resources:l,confirmation:u},user:d}=await Lv({ctx:t,deviceCode:i,authorizeRedemption:async e=>{e.oauthClientId||As(`BAD_REQUEST`,`invalid_grant`,`invalid device code`),r?.client_id&&e.oauthClientId!==r.client_id&&As(`BAD_REQUEST`,`invalid_grant`,`Client ID mismatch`);let t=Da(e.scope);return e.oauthClientId!==a.client.clientId&&As(`BAD_REQUEST`,`invalid_grant`,`Client ID mismatch`),fa(a.client,t),{ownershipWhere:{field:`oauthClientId`,value:a.client.clientId},context:{...a,scopes:t}}},prepareRedemption:async(i,a)=>{let o=Wa(r?.resource),s=i.resources??void 0;if(o){let e=new Set(s);(!s||o.some(t=>!e.has(t)))&&As(`BAD_REQUEST`,`invalid_target`,`Requested resource was not authorized by the user`)}let c=o??s;return await vo(t,e.opts,{resource:c,clientId:a.client.clientId,requestedScopes:a.scopes}),{resources:c,confirmation:await n.resolveConfirmation({client:a.client,scopes:a.scopes,resources:c,confirmation:a.confirmation})}}});return n.issueTokens({client:o,scopes:s,user:d,resources:l,referenceId:c.referenceId??void 0,authTime:xa(c.authTime),acr:c.acr??void 0,amr:c.amr??void 0,originalResources:c.resources??void 0,confirmation:u})}function tb(e){async function t(e,t){let n=await Cv(e,t);return n?.oauthClientId||As(`BAD_REQUEST`,`invalid_request`,`Invalid user code`),{...n,oauthClientId:n.oauthClientId}}let n=(t,n)=>Vv(e,t.context.baseURL,n).verificationUriComplete,r=(e,t,r)=>qo(n(e,t),new URLSearchParams({status:r}));return{load:async({ctx:e,opts:n,value:i,signedQuery:a})=>{let o=await t(e,i);Ev(o);let s=await ua(e,n,o.oauthClientId);s||As(`BAD_REQUEST`,`invalid_client`,`client_id is required`);let c=Da(a?.scope??o.scope);return{query:{user_code:o.userCode,client_id:s.clientId,scope:c.join(` `),resource:o.resources??[]},client:s,requireConsent:!0,approve:async t=>(await Dv(e,{deviceCode:o,userId:t.userId,decision:`approved`,fields:{scope:t.query.scope,referenceId:t.referenceId??null,authTime:new Date(t.authTime),acr:t.acr??null,amr:t.amr??null}}),r(e,o.userCode,`approved`))}},deny:async({ctx:e,value:n,userId:i})=>{let a=await t(e,n);return await Dv(e,{deviceCode:a,userId:i,decision:`denied`}),r(e,a.userCode,`denied`)},errorPage:({ctx:e,value:t})=>n(e,t)}}function nb(e){return{requestSchemaFields:$y,requestErrorCodes:[`invalid_target`],requestOpenAPIResponses:{401:{description:`Invalid Basic client authentication`,headers:{"WWW-Authenticate":{description:`Basic client authentication challenge`,schema:{type:`string`,example:`Basic`}}},content:{"application/json":{schema:{type:`object`,properties:{error:{type:`string`,enum:[`invalid_client`]},error_description:{type:`string`}},required:[`error`]}}}}},onRequestValidationError:e=>{e.length>0&&e.every(e=>e.path?.[0]===`resource`)&&As(`BAD_REQUEST`,`invalid_target`,`Invalid resource indicator`)},deviceCodeSchemaFields:{resources:{type:`string[]`,required:!1},oauthClientId:{type:`string`,required:!1},referenceId:{type:`string`,required:!1},authTime:{type:`date`,required:!1},acr:{type:`string`,required:!1},amr:{type:`string[]`,required:!1}},grants:{[Xy]:eb},metadata:e=>({device_authorization_endpoint:`${e.ctx.context.baseURL}${Zy}`}),authorizeRequest:async({ctx:e,request:t})=>{let{detected:n}=await Va(e.request,e.body??{}),r=e.request?(await Na(e.request))?.getAll(`resource`).filter(Boolean):void 0;if(r?.length){let e=Qy.safeParse(r.length===1?r[0]:r);e.success||As(`BAD_REQUEST`,`invalid_target`,`Invalid resource indicator`),t.resource=e.data}let i=Fa(e.context);if(!i)return;let a=Da(t.scope);t.scope!==void 0&&(t.scope=a.join(` `));let o=t.resource===``?void 0:t.resource,s=Zo(e,i.options,Xy);!t.client_id&&!n&&As(`BAD_REQUEST`,`invalid_request`,`client_id is required`);let c=t.client_id?await ua(e,i.options,t.client_id):void 0;if(t.client_id&&!c&&!n)return;let l=await s.authenticateClient({scopes:a,requireCredentials:!1});return t.client_id&&l.clientId!==t.client_id&&As(`BAD_REQUEST`,`invalid_client`,`Client ID mismatch`),await vo(e,i.options,{resource:o,clientId:l.clientId,requestedScopes:a}),{clientId:l.clientId,deviceCodeFields:{oauthClientId:l.clientId,resources:Wa(o)??null}}},assertStandaloneUse:({deviceCode:e,use:t})=>{typeof e.oauthClientId==`string`&&(t===`redeem`&&As(`BAD_REQUEST`,`invalid_grant`,`This device code must be exchanged at the OAuth token endpoint (/oauth2/token).`),As(`BAD_REQUEST`,`invalid_request`,`Approve this device code through the OAuth provider: send the user to /oauth2/authorize?user_code=${encodeURIComponent(String(e.userCode))}.`))},interactionRequests:{user_code:tb(e)}}}function rb(e={}){let t=nb(e.verificationUri);return{...Yv({...e,grant:t}),init(e){if((e.options.plugins?.filter(e=>e.id===`device-authorization`).length??0)>1)throw new N(`oauthDeviceAuthorization() cannot be combined with another Device Authorization plugin.`);if(!e.getPlugin(`oauth-provider`))throw new N(`oauthDeviceAuthorization() requires oauthProvider() or mcp().`);Vo(e,t)}}}var L=Symbol.for(`drizzle:entityKind`);function R(e,t){if(!e||typeof e!=`object`)return!1;if(e instanceof t)return!0;if(!Object.prototype.hasOwnProperty.call(t,L))throw Error(`Class "${t.name??`<unknown>`}" doesn't look like a Drizzle entity. If this is incorrect and the class is provided by Drizzle, please report this as a bug.`);let n=Object.getPrototypeOf(e).constructor;if(n)for(;n;){if(L in n&&n[L]===t[L])return!0;n=Object.getPrototypeOf(n)}return!1}var ib=class{constructor(e,t){this.table=e,this.config=t,this.name=t.name,this.keyAsName=t.keyAsName,this.notNull=t.notNull,this.default=t.default,this.defaultFn=t.defaultFn,this.onUpdateFn=t.onUpdateFn,this.hasDefault=t.hasDefault,this.primary=t.primaryKey,this.isUnique=t.isUnique,this.uniqueName=t.uniqueName,this.uniqueType=t.uniqueType,this.dataType=t.dataType,this.columnType=t.columnType,this.generated=t.generated,this.generatedIdentity=t.generatedIdentity}static[L]=`Column`;name;keyAsName;primary;notNull;default;defaultFn;onUpdateFn;hasDefault;isUnique;uniqueName;uniqueType;dataType;columnType;enumValues=void 0;generated=void 0;generatedIdentity=void 0;config;mapFromDriverValue(e){return e}mapToDriverValue(e){return e}shouldDisableInsert(){return this.config.generated!==void 0&&this.config.generated.type!==`byDefault`}},ab=class{static[L]=`ColumnBuilder`;config;constructor(e,t,n){this.config={name:e,keyAsName:e===``,notNull:!1,default:void 0,hasDefault:!1,primaryKey:!1,isUnique:!1,uniqueName:void 0,uniqueType:void 0,dataType:t,columnType:n,generated:void 0}}$type(){return this}notNull(){return this.config.notNull=!0,this}default(e){return this.config.default=e,this.config.hasDefault=!0,this}$defaultFn(e){return this.config.defaultFn=e,this.config.hasDefault=!0,this}$default=this.$defaultFn;$onUpdateFn(e){return this.config.onUpdateFn=e,this.config.hasDefault=!0,this}$onUpdate=this.$onUpdateFn;primaryKey(){return this.config.primaryKey=!0,this.config.notNull=!0,this}setName(e){this.config.name===``&&(this.config.name=e)}},ob=Symbol.for(`drizzle:Name`),sb=class{static[L]=`PgForeignKeyBuilder`;reference;_onUpdate=`no action`;_onDelete=`no action`;constructor(e,t){this.reference=()=>{let{name:t,columns:n,foreignColumns:r}=e();return{name:t,columns:n,foreignTable:r[0].table,foreignColumns:r}},t&&(this._onUpdate=t.onUpdate,this._onDelete=t.onDelete)}onUpdate(e){return this._onUpdate=e===void 0?`no action`:e,this}onDelete(e){return this._onDelete=e===void 0?`no action`:e,this}build(e){return new cb(e,this)}},cb=class{constructor(e,t){this.table=e,this.reference=t.reference,this.onUpdate=t._onUpdate,this.onDelete=t._onDelete}static[L]=`PgForeignKey`;reference;onUpdate;onDelete;getName(){let{name:e,columns:t,foreignColumns:n}=this.reference(),r=t.map(e=>e.name),i=n.map(e=>e.name),a=[this.table[ob],...r,n[0].table[ob],...i];return e??`${a.join(`_`)}_fk`}};function lb(e,...t){return e(...t)}function ub(e){return new pb(e)}function db(e,t){return`${e[ob]}_${t.join(`_`)}_unique`}var fb=class{constructor(e,t){this.name=t,this.columns=e}static[L]=`PgUniqueConstraintBuilder`;columns;nullsNotDistinctConfig=!1;nullsNotDistinct(){return this.nullsNotDistinctConfig=!0,this}build(e){return new mb(e,this.columns,this.nullsNotDistinctConfig,this.name)}},pb=class{static[L]=`PgUniqueOnConstraintBuilder`;name;constructor(e){this.name=e}on(...e){return new fb(e,this.name)}},mb=class{constructor(e,t,n,r){this.table=e,this.columns=t,this.name=r??db(this.table,this.columns.map(e=>e.name)),this.nullsNotDistinct=n}static[L]=`PgUniqueConstraint`;columns;name;nullsNotDistinct=!1;getName(){return this.name}};function hb(e,t,n){for(let r=t;r<e.length;r++){let i=e[r];if(i===`\\`)r++;else{if(i===`"`)return[e.slice(t,r).replace(/\\/g,``),r+1];if(!n&&(i===`,`||i===`}`))return[e.slice(t,r).replace(/\\/g,``),r]}}return[e.slice(t).replace(/\\/g,``),e.length]}function gb(e,t=0){let n=[],r=t,i=!1;for(;r<e.length;){let a=e[r];if(a===`,`){(i||r===t)&&n.push(``),i=!0,r++;continue}if(i=!1,a===`\\`){r+=2;continue}if(a===`"`){let[t,i]=hb(e,r+1,!0);n.push(t),r=i;continue}if(a===`}`)return[n,r+1];if(a===`{`){let[t,i]=gb(e,r+1);n.push(t),r=i;continue}let[o,s]=hb(e,r,!1);n.push(o),r=s}return[n,r]}function _b(e){let[t]=gb(e,1);return t}function vb(e){return`{${e.map(e=>Array.isArray(e)?vb(e):typeof e==`string`?`"${e.replace(/\\/g,`\\\\`).replace(/"/g,`\\"`)}"`:`${e}`).join(`,`)}}`}var yb=class extends ab{foreignKeyConfigs=[];static[L]=`PgColumnBuilder`;array(e){return new Cb(this.config.name,this,e)}references(e,t={}){return this.foreignKeyConfigs.push({ref:e,actions:t}),this}unique(e,t){return this.config.isUnique=!0,this.config.uniqueName=e,this.config.uniqueType=t?.nulls,this}generatedAlwaysAs(e){return this.config.generated={as:e,type:`always`,mode:`stored`},this}buildForeignKeys(e,t){return this.foreignKeyConfigs.map(({ref:n,actions:r})=>lb((n,r)=>{let i=new sb(()=>{let t=n();return{columns:[e],foreignColumns:[t]}});return r.onUpdate&&i.onUpdate(r.onUpdate),r.onDelete&&i.onDelete(r.onDelete),i.build(t)},n,r))}buildExtraConfigColumn(e){return new xb(e,this.config)}},bb=class extends ib{constructor(e,t){t.uniqueName||=db(e,[t.name]),super(e,t),this.table=e}static[L]=`PgColumn`},xb=class extends bb{static[L]=`ExtraConfigColumn`;getSQLType(){return this.getSQLType()}indexConfig={order:this.config.order??`asc`,nulls:this.config.nulls??`last`,opClass:this.config.opClass};defaultConfig={order:`asc`,nulls:`last`,opClass:void 0};asc(){return this.indexConfig.order=`asc`,this}desc(){return this.indexConfig.order=`desc`,this}nullsFirst(){return this.indexConfig.nulls=`first`,this}nullsLast(){return this.indexConfig.nulls=`last`,this}op(e){return this.indexConfig.opClass=e,this}},Sb=class{static[L]=`IndexedColumn`;constructor(e,t,n,r){this.name=e,this.keyAsName=t,this.type=n,this.indexConfig=r}name;keyAsName;type;indexConfig},Cb=class extends yb{static[L]=`PgArrayBuilder`;constructor(e,t,n){super(e,`array`,`PgArray`),this.config.baseBuilder=t,this.config.size=n}build(e){let t=this.config.baseBuilder.build(e);return new wb(e,this.config,t)}},wb=class e extends bb{constructor(e,t,n,r){super(e,t),this.baseColumn=n,this.range=r,this.size=t.size}size;static[L]=`PgArray`;getSQLType(){return`${this.baseColumn.getSQLType()}[${typeof this.size==`number`?this.size:``}]`}mapFromDriverValue(e){return typeof e==`string`&&(e=_b(e)),e.map(e=>this.baseColumn.mapFromDriverValue(e))}mapToDriverValue(t,n=!1){let r=t.map(t=>t===null?null:R(this.baseColumn,e)?this.baseColumn.mapToDriverValue(t,!0):this.baseColumn.mapToDriverValue(t));return n?r:vb(r)}},Tb=class extends yb{static[L]=`PgEnumObjectColumnBuilder`;constructor(e,t){super(e,`string`,`PgEnumObjectColumn`),this.config.enum=t}build(e){return new Eb(e,this.config)}},Eb=class extends bb{static[L]=`PgEnumObjectColumn`;enum;enumValues=this.config.enum.enumValues;constructor(e,t){super(e,t),this.enum=t.enum}getSQLType(){return this.enum.enumName}},Db=Symbol.for(`drizzle:isPgEnum`);function Ob(e){return!!e&&typeof e==`function`&&Db in e&&e[Db]===!0}var kb=class extends yb{static[L]=`PgEnumColumnBuilder`;constructor(e,t){super(e,`string`,`PgEnumColumn`),this.config.enum=t}build(e){return new Ab(e,this.config)}},Ab=class extends bb{static[L]=`PgEnumColumn`;enum=this.config.enum;enumValues=this.config.enum.enumValues;constructor(e,t){super(e,t),this.enum=t.enum}getSQLType(){return this.enum.enumName}};function jb(e,t,n){let r=Object.assign(e=>new kb(e??``,r),{enumName:e,enumValues:t,schema:n,[Db]:!0});return r}function Mb(e,t,n){let r=Object.assign(e=>new Tb(e??``,r),{enumName:e,enumValues:Object.values(t),schema:n,[Db]:!0});return r}var Nb=class{static[L]=`Subquery`;constructor(e,t,n,r=!1,i=[]){this._={brand:`Subquery`,sql:e,selectedFields:t,alias:n,isWith:r,usedTables:i}}},Pb=class extends Nb{static[L]=`WithSubquery`},Fb={startActiveSpan(e,t){return t()}},Ib=Symbol.for(`drizzle:ViewBaseConfig`),Lb=Symbol.for(`drizzle:Schema`),Rb=Symbol.for(`drizzle:Columns`),zb=Symbol.for(`drizzle:ExtraConfigColumns`),Bb=Symbol.for(`drizzle:OriginalName`),Vb=Symbol.for(`drizzle:BaseName`),Hb=Symbol.for(`drizzle:IsAlias`),Ub=Symbol.for(`drizzle:ExtraConfigBuilder`),Wb=Symbol.for(`drizzle:IsDrizzleTable`),z=class{static[L]=`Table`;static Symbol={Name:ob,Schema:Lb,OriginalName:Bb,Columns:Rb,ExtraConfigColumns:zb,BaseName:Vb,IsAlias:Hb,ExtraConfigBuilder:Ub};[ob];[Bb];[Lb];[Rb];[zb];[Vb];[Hb]=!1;[Wb]=!0;[Ub]=void 0;constructor(e,t,n){this[ob]=this[Bb]=e,this[Lb]=t,this[Vb]=n}};function Gb(e){return e[ob]}function Kb(e){return`${e[Lb]??`public`}.${e[ob]}`}function qb(e){return e!=null&&typeof e.getSQL==`function`}function Jb(e){let t={sql:``,params:[]};for(let n of e)t.sql+=n.sql,t.params.push(...n.params),n.typings?.length&&(t.typings||=[],t.typings.push(...n.typings));return t}var Yb=class{static[L]=`StringChunk`;value;constructor(e){this.value=Array.isArray(e)?e:[e]}getSQL(){return new B([this])}},B=class e{constructor(e){this.queryChunks=e;for(let t of e)if(R(t,z)){let e=t[z.Symbol.Schema];this.usedTables.push(e===void 0?t[z.Symbol.Name]:e+`.`+t[z.Symbol.Name])}}static[L]=`SQL`;decoder=Qb;shouldInlineParams=!1;usedTables=[];append(e){return this.queryChunks.push(...e.queryChunks),this}toQuery(e){return Fb.startActiveSpan(`drizzle.buildSQL`,t=>{let n=this.buildQueryFromSourceParams(this.queryChunks,e);return t?.setAttributes({"drizzle.query.text":n.sql,"drizzle.query.params":JSON.stringify(n.params)}),n})}buildQueryFromSourceParams(t,n){let r=Object.assign({},n,{inlineParams:n.inlineParams||this.shouldInlineParams,paramStartIndex:n.paramStartIndex||{value:0}}),{casing:i,escapeName:a,escapeParam:o,prepareTyping:s,inlineParams:c,paramStartIndex:l}=r;return Jb(t.map(t=>{if(R(t,Yb))return{sql:t.value.join(``),params:[]};if(R(t,Xb))return{sql:a(t.value),params:[]};if(t===void 0)return{sql:``,params:[]};if(Array.isArray(t)){let e=[new Yb(`(`)];for(let[n,r]of t.entries())e.push(r),n<t.length-1&&e.push(new Yb(`, `));return e.push(new Yb(`)`)),this.buildQueryFromSourceParams(e,r)}if(R(t,e))return this.buildQueryFromSourceParams(t.queryChunks,{...r,inlineParams:c||t.shouldInlineParams});if(R(t,z)){let e=t[z.Symbol.Schema],n=t[z.Symbol.Name];return{sql:e===void 0||t[Hb]?a(n):a(e)+`.`+a(n),params:[]}}if(R(t,ib)){let e=i.getColumnCasing(t);if(n.invokeSource===`indexes`)return{sql:a(e),params:[]};let r=t.table[z.Symbol.Schema];return{sql:t.table[Hb]||r===void 0?a(t.table[z.Symbol.Name])+`.`+a(e):a(r)+`.`+a(t.table[z.Symbol.Name])+`.`+a(e),params:[]}}if(R(t,ix)){let e=t[Ib].schema,n=t[Ib].name;return{sql:e===void 0||t[Ib].isAlias?a(n):a(e)+`.`+a(n),params:[]}}if(R(t,ex)){if(R(t.value,tx))return{sql:o(l.value++,t),params:[t],typings:[`none`]};let n=t.value===null?null:t.encoder.mapToDriverValue(t.value);if(R(n,e))return this.buildQueryFromSourceParams([n],r);if(c)return{sql:this.mapInlineParam(n,r),params:[]};let i=[`none`];return s&&(i=[s(t.encoder)]),{sql:o(l.value++,n),params:[n],typings:i}}return R(t,tx)?{sql:o(l.value++,t),params:[t],typings:[`none`]}:R(t,e.Aliased)&&t.fieldAlias!==void 0?{sql:a(t.fieldAlias),params:[]}:R(t,Nb)?t._.isWith?{sql:a(t._.alias),params:[]}:this.buildQueryFromSourceParams([new Yb(`(`),t._.sql,new Yb(`) `),new Xb(t._.alias)],r):Ob(t)?t.schema?{sql:a(t.schema)+`.`+a(t.enumName),params:[]}:{sql:a(t.enumName),params:[]}:qb(t)?t.shouldOmitSQLParens?.()?this.buildQueryFromSourceParams([t.getSQL()],r):this.buildQueryFromSourceParams([new Yb(`(`),t.getSQL(),new Yb(`)`)],r):c?{sql:this.mapInlineParam(t,r),params:[]}:{sql:o(l.value++,t),params:[t],typings:[`none`]}}))}mapInlineParam(e,{escapeString:t}){if(e===null)return`null`;if(typeof e==`number`||typeof e==`boolean`)return e.toString();if(typeof e==`string`)return t(e);if(typeof e==`object`){let n=e.toString();return t(n===`[object Object]`?JSON.stringify(e):n)}throw Error(`Unexpected param value: `+e)}getSQL(){return this}as(t){return t===void 0?this:new e.Aliased(this,t)}mapWith(e){return this.decoder=typeof e==`function`?{mapFromDriverValue:e}:e,this}inlineParams(){return this.shouldInlineParams=!0,this}if(e){return e?this:void 0}},Xb=class{constructor(e){this.value=e}static[L]=`Name`;brand;getSQL(){return new B([this])}};function Zb(e){return typeof e==`object`&&!!e&&`mapToDriverValue`in e&&typeof e.mapToDriverValue==`function`}var Qb={mapFromDriverValue:e=>e},$b={mapToDriverValue:e=>e};({...Qb,...$b});var ex=class{constructor(e,t=$b){this.value=e,this.encoder=t}static[L]=`Param`;brand;getSQL(){return new B([this])}};function V(e,...t){let n=[];(t.length>0||e.length>0&&e[0]!==``)&&n.push(new Yb(e[0]));for(let[r,i]of t.entries())n.push(i,new Yb(e[r+1]));return new B(n)}(e=>{function t(){return new B([])}e.empty=t;function n(e){return new B(e)}e.fromList=n;function r(e){return new B([new Yb(e)])}e.raw=r;function i(e,t){let n=[];for(let[r,i]of e.entries())r>0&&t!==void 0&&n.push(t),n.push(i);return new B(n)}e.join=i;function a(e){return new Xb(e)}e.identifier=a;function o(e){return new tx(e)}e.placeholder=o;function s(e,t){return new ex(e,t)}e.param=s})(V||={}),(e=>{class t{constructor(e,t){this.sql=e,this.fieldAlias=t}static[L]=`SQL.Aliased`;isSelectionField=!1;getSQL(){return this.sql}clone(){return new t(this.sql,this.fieldAlias)}}e.Aliased=t})(B||={});var tx=class{constructor(e){this.name=e}static[L]=`Placeholder`;getSQL(){return new B([this])}};function nx(e,t){return e.map(e=>{if(R(e,tx)){if(!(e.name in t))throw Error(`No value for placeholder "${e.name}" was provided`);return t[e.name]}if(R(e,ex)&&R(e.value,tx)){if(!(e.value.name in t))throw Error(`No value for placeholder "${e.value.name}" was provided`);return e.encoder.mapToDriverValue(t[e.value.name])}return e})}var rx=Symbol.for(`drizzle:IsDrizzleView`),ix=class{static[L]=`View`;[Ib];[rx]=!0;constructor({name:e,schema:t,selectedFields:n,query:r}){this[Ib]={name:e,originalName:e,schema:t,selectedFields:n,query:r,isExisting:!r,isAlias:!1}}getSQL(){return new B([this])}};ib.prototype.getSQL=function(){return new B([this])},z.prototype.getSQL=function(){return new B([this])},Nb.prototype.getSQL=function(){return new B([this])};var ax=class{constructor(e){this.table=e}static[L]=`ColumnAliasProxyHandler`;get(e,t){return t===`table`?this.table:e[t]}},ox=class{constructor(e,t){this.alias=e,this.replaceOriginalName=t}static[L]=`TableAliasProxyHandler`;get(e,t){if(t===z.Symbol.IsAlias)return!0;if(t===z.Symbol.Name||this.replaceOriginalName&&t===z.Symbol.OriginalName)return this.alias;if(t===Ib)return{...e[Ib],name:this.alias,isAlias:!0};if(t===z.Symbol.Columns){let t=e[z.Symbol.Columns];if(!t)return t;let n={};return Object.keys(t).map(r=>{n[r]=new Proxy(t[r],new ax(new Proxy(e,this)))}),n}let n=e[t];return R(n,ib)?new Proxy(n,new ax(new Proxy(e,this))):n}};function sx(e,t){return new Proxy(e,new ox(t,!1))}function cx(e,t){return new Proxy(e,new ax(new Proxy(e.table,new ox(t,!1))))}function lx(e,t){return new B.Aliased(ux(e.sql,t),e.fieldAlias)}function ux(e,t){return V.join(e.queryChunks.map(e=>R(e,ib)?cx(e,t):R(e,B)?ux(e,t):R(e,B.Aliased)?lx(e,t):e))}var dx=class extends Error{static[L]=`DrizzleError`;constructor({message:e,cause:t}){super(e),this.name=`DrizzleError`,this.cause=t}},fx=class e extends Error{constructor(t,n,r){super(`Failed query: ${t}
362
+ params: ${n}`),this.query=t,this.params=n,this.cause=r,Error.captureStackTrace(this,e),r&&(this.cause=r)}},px=class extends dx{static[L]=`TransactionRollbackError`;constructor(){super({message:`Rollback`})}},mx=class{static[L]=`ConsoleLogWriter`;write(e){console.log(e)}},hx=class{static[L]=`DefaultLogger`;writer;constructor(e){this.writer=e?.writer??new mx}logQuery(e,t){let n=t.map(e=>{try{return JSON.stringify(e)}catch{return String(e)}}),r=n.length?` -- params: [${n.join(`, `)}]`:``;this.writer.write(`Query: ${e}${r}`)}},gx=class{static[L]=`NoopLogger`;logQuery(){}},_x=class{static[L]=`QueryPromise`;[Symbol.toStringTag]=`QueryPromise`;catch(e){return this.then(void 0,e)}finally(e){return this.then(t=>(e?.(),t),t=>{throw e?.(),t})}then(e,t){return this.execute().then(e,t)}};function vx(e,t,n){let r={},i=e.reduce((e,{path:i,field:a},o)=>{let s;s=R(a,ib)?a:R(a,B)?a.decoder:R(a,Nb)?a._.sql.decoder:a.sql.decoder;let c=e;for(let[e,l]of i.entries())if(e<i.length-1)l in c||(c[l]={}),c=c[l];else{let e=t[o],u=c[l]=e===null?null:s.mapFromDriverValue(e);if(n&&R(a,ib)&&i.length===2){let e=i[0];e in r?typeof r[e]==`string`&&r[e]!==Gb(a.table)&&(r[e]=!1):r[e]=u===null&&Gb(a.table)}}return e},{});if(n&&Object.keys(r).length>0)for(let[e,t]of Object.entries(r))typeof t==`string`&&!n[t]&&(i[e]=null);return i}function yx(e,t){return Object.entries(e).reduce((e,[n,r])=>{if(typeof n!=`string`)return e;let i=t?[...t,n]:[n];return R(r,ib)||R(r,B)||R(r,B.Aliased)||R(r,Nb)?e.push({path:i,field:r}):R(r,z)?e.push(...yx(r[z.Symbol.Columns],i)):e.push(...yx(r,i)),e},[])}function bx(e,t){let n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(let[e,t]of n.entries())if(t!==r[e])return!1;return!0}function xx(e,t){let n=Object.entries(t).filter(([,e])=>e!==void 0).map(([t,n])=>R(n,B)||R(n,ib)?[t,n]:[t,new ex(n,e[z.Symbol.Columns][t])]);if(n.length===0)throw Error(`No values to set`);return Object.fromEntries(n)}function Sx(e,t){for(let n of t)for(let t of Object.getOwnPropertyNames(n.prototype))t!==`constructor`&&Object.defineProperty(e.prototype,t,Object.getOwnPropertyDescriptor(n.prototype,t)||Object.create(null))}function Cx(e){return e[z.Symbol.Columns]}function wx(e){return R(e,Nb)?e._.alias:R(e,ix)?e[Ib].name:R(e,B)?void 0:e[z.Symbol.IsAlias]?e[z.Symbol.Name]:e[z.Symbol.BaseName]}function Tx(e,t){return{name:typeof e==`string`&&e.length>0?e:``,config:typeof e==`object`?e:t}}function Ex(e){if(typeof e!=`object`||!e||e.constructor.name!==`Object`)return!1;if(`logger`in e){let t=typeof e.logger;return t===`boolean`||t===`object`&&typeof e.logger.logQuery==`function`||t===`undefined`}if(`schema`in e){let t=typeof e.schema;return t===`object`||t===`undefined`}if(`casing`in e){let t=typeof e.casing;return t===`string`||t===`undefined`}if(`mode`in e)return e.mode==="default"&&e.mode===`planetscale`&&e.mode===void 0;if(`connection`in e){let t=typeof e.connection;return t===`string`||t===`object`||t===`undefined`}if(`client`in e){let t=typeof e.client;return t===`object`||t===`function`||t===`undefined`}return Object.keys(e).length===0}typeof TextDecoder>`u`||new TextDecoder;var Dx=class extends yb{static[L]=`PgIntColumnBaseBuilder`;generatedAlwaysAsIdentity(e){if(e){let{name:t,...n}=e;this.config.generatedIdentity={type:`always`,sequenceName:t,sequenceOptions:n}}else this.config.generatedIdentity={type:`always`};return this.config.hasDefault=!0,this.config.notNull=!0,this}generatedByDefaultAsIdentity(e){if(e){let{name:t,...n}=e;this.config.generatedIdentity={type:`byDefault`,sequenceName:t,sequenceOptions:n}}else this.config.generatedIdentity={type:`byDefault`};return this.config.hasDefault=!0,this.config.notNull=!0,this}},Ox=class extends Dx{static[L]=`PgBigInt53Builder`;constructor(e){super(e,`number`,`PgBigInt53`)}build(e){return new kx(e,this.config)}},kx=class extends bb{static[L]=`PgBigInt53`;getSQLType(){return`bigint`}mapFromDriverValue(e){return typeof e==`number`?e:Number(e)}},Ax=class extends Dx{static[L]=`PgBigInt64Builder`;constructor(e){super(e,`bigint`,`PgBigInt64`)}build(e){return new jx(e,this.config)}},jx=class extends bb{static[L]=`PgBigInt64`;getSQLType(){return`bigint`}mapFromDriverValue(e){return BigInt(e)}};function Mx(e,t){let{name:n,config:r}=Tx(e,t);return r.mode===`number`?new Ox(n):new Ax(n)}var Nx=class extends yb{static[L]=`PgBigSerial53Builder`;constructor(e){super(e,`number`,`PgBigSerial53`),this.config.hasDefault=!0,this.config.notNull=!0}build(e){return new Px(e,this.config)}},Px=class extends bb{static[L]=`PgBigSerial53`;getSQLType(){return`bigserial`}mapFromDriverValue(e){return typeof e==`number`?e:Number(e)}},Fx=class extends yb{static[L]=`PgBigSerial64Builder`;constructor(e){super(e,`bigint`,`PgBigSerial64`),this.config.hasDefault=!0}build(e){return new Ix(e,this.config)}},Ix=class extends bb{static[L]=`PgBigSerial64`;getSQLType(){return`bigserial`}mapFromDriverValue(e){return BigInt(e)}};function Lx(e,t){let{name:n,config:r}=Tx(e,t);return r.mode===`number`?new Nx(n):new Fx(n)}var Rx=class extends yb{static[L]=`PgBooleanBuilder`;constructor(e){super(e,`boolean`,`PgBoolean`)}build(e){return new zx(e,this.config)}},zx=class extends bb{static[L]=`PgBoolean`;getSQLType(){return`boolean`}};function Bx(e){return new Rx(e??``)}var Vx=class extends yb{static[L]=`PgCharBuilder`;constructor(e,t){super(e,`string`,`PgChar`),this.config.length=t.length,this.config.enumValues=t.enum}build(e){return new Hx(e,this.config)}},Hx=class extends bb{static[L]=`PgChar`;length=this.config.length;enumValues=this.config.enumValues;getSQLType(){return this.length===void 0?`char`:`char(${this.length})`}};function Ux(e,t={}){let{name:n,config:r}=Tx(e,t);return new Vx(n,r)}var Wx=class extends yb{static[L]=`PgCidrBuilder`;constructor(e){super(e,`string`,`PgCidr`)}build(e){return new Gx(e,this.config)}},Gx=class extends bb{static[L]=`PgCidr`;getSQLType(){return`cidr`}};function Kx(e){return new Wx(e??``)}var qx=class extends yb{static[L]=`PgCustomColumnBuilder`;constructor(e,t,n){super(e,`custom`,`PgCustomColumn`),this.config.fieldConfig=t,this.config.customTypeParams=n}build(e){return new Jx(e,this.config)}},Jx=class extends bb{static[L]=`PgCustomColumn`;sqlName;mapTo;mapFrom;constructor(e,t){super(e,t),this.sqlName=t.customTypeParams.dataType(t.fieldConfig),this.mapTo=t.customTypeParams.toDriver,this.mapFrom=t.customTypeParams.fromDriver}getSQLType(){return this.sqlName}mapFromDriverValue(e){return typeof this.mapFrom==`function`?this.mapFrom(e):e}mapToDriverValue(e){return typeof this.mapTo==`function`?this.mapTo(e):e}};function Yx(e){return(t,n)=>{let{name:r,config:i}=Tx(t,n);return new qx(r,i,e)}}var Xx=class extends yb{static[L]=`PgDateColumnBaseBuilder`;defaultNow(){return this.default(V`now()`)}},Zx=class extends Xx{static[L]=`PgDateBuilder`;constructor(e){super(e,`date`,`PgDate`)}build(e){return new Qx(e,this.config)}},Qx=class extends bb{static[L]=`PgDate`;getSQLType(){return`date`}mapFromDriverValue(e){return typeof e==`string`?new Date(e):e}mapToDriverValue(e){return e.toISOString()}},$x=class extends Xx{static[L]=`PgDateStringBuilder`;constructor(e){super(e,`string`,`PgDateString`)}build(e){return new eS(e,this.config)}},eS=class extends bb{static[L]=`PgDateString`;getSQLType(){return`date`}mapFromDriverValue(e){return typeof e==`string`?e:e.toISOString().slice(0,-14)}};function tS(e,t){let{name:n,config:r}=Tx(e,t);return r?.mode===`date`?new Zx(n):new $x(n)}var nS=class extends yb{static[L]=`PgDoublePrecisionBuilder`;constructor(e){super(e,`number`,`PgDoublePrecision`)}build(e){return new rS(e,this.config)}},rS=class extends bb{static[L]=`PgDoublePrecision`;getSQLType(){return`double precision`}mapFromDriverValue(e){return typeof e==`string`?Number.parseFloat(e):e}};function iS(e){return new nS(e??``)}var aS=class extends yb{static[L]=`PgInetBuilder`;constructor(e){super(e,`string`,`PgInet`)}build(e){return new oS(e,this.config)}},oS=class extends bb{static[L]=`PgInet`;getSQLType(){return`inet`}};function sS(e){return new aS(e??``)}var cS=class extends Dx{static[L]=`PgIntegerBuilder`;constructor(e){super(e,`number`,`PgInteger`)}build(e){return new lS(e,this.config)}},lS=class extends bb{static[L]=`PgInteger`;getSQLType(){return`integer`}mapFromDriverValue(e){return typeof e==`string`?Number.parseInt(e):e}};function uS(e){return new cS(e??``)}var dS=class extends yb{static[L]=`PgIntervalBuilder`;constructor(e,t){super(e,`string`,`PgInterval`),this.config.intervalConfig=t}build(e){return new fS(e,this.config)}},fS=class extends bb{static[L]=`PgInterval`;fields=this.config.intervalConfig.fields;precision=this.config.intervalConfig.precision;getSQLType(){return`interval${this.fields?` ${this.fields}`:``}${this.precision?`(${this.precision})`:``}`}};function pS(e,t={}){let{name:n,config:r}=Tx(e,t);return new dS(n,r)}var mS=class extends yb{static[L]=`PgJsonBuilder`;constructor(e){super(e,`json`,`PgJson`)}build(e){return new hS(e,this.config)}},hS=class extends bb{static[L]=`PgJson`;constructor(e,t){super(e,t)}getSQLType(){return`json`}mapToDriverValue(e){return JSON.stringify(e)}mapFromDriverValue(e){if(typeof e==`string`)try{return JSON.parse(e)}catch{return e}return e}};function gS(e){return new mS(e??``)}var _S=class extends yb{static[L]=`PgJsonbBuilder`;constructor(e){super(e,`json`,`PgJsonb`)}build(e){return new vS(e,this.config)}},vS=class extends bb{static[L]=`PgJsonb`;constructor(e,t){super(e,t)}getSQLType(){return`jsonb`}mapToDriverValue(e){return JSON.stringify(e)}mapFromDriverValue(e){if(typeof e==`string`)try{return JSON.parse(e)}catch{return e}return e}};function yS(e){return new _S(e??``)}var bS=class extends yb{static[L]=`PgLineBuilder`;constructor(e){super(e,`array`,`PgLine`)}build(e){return new xS(e,this.config)}},xS=class extends bb{static[L]=`PgLine`;getSQLType(){return`line`}mapFromDriverValue(e){let[t,n,r]=e.slice(1,-1).split(`,`);return[Number.parseFloat(t),Number.parseFloat(n),Number.parseFloat(r)]}mapToDriverValue(e){return`{${e[0]},${e[1]},${e[2]}}`}},SS=class extends yb{static[L]=`PgLineABCBuilder`;constructor(e){super(e,`json`,`PgLineABC`)}build(e){return new CS(e,this.config)}},CS=class extends bb{static[L]=`PgLineABC`;getSQLType(){return`line`}mapFromDriverValue(e){let[t,n,r]=e.slice(1,-1).split(`,`);return{a:Number.parseFloat(t),b:Number.parseFloat(n),c:Number.parseFloat(r)}}mapToDriverValue(e){return`{${e.a},${e.b},${e.c}}`}};function wS(e,t){let{name:n,config:r}=Tx(e,t);return!r?.mode||r.mode===`tuple`?new bS(n):new SS(n)}var TS=class extends yb{static[L]=`PgMacaddrBuilder`;constructor(e){super(e,`string`,`PgMacaddr`)}build(e){return new ES(e,this.config)}},ES=class extends bb{static[L]=`PgMacaddr`;getSQLType(){return`macaddr`}};function DS(e){return new TS(e??``)}var OS=class extends yb{static[L]=`PgMacaddr8Builder`;constructor(e){super(e,`string`,`PgMacaddr8`)}build(e){return new kS(e,this.config)}},kS=class extends bb{static[L]=`PgMacaddr8`;getSQLType(){return`macaddr8`}};function AS(e){return new OS(e??``)}var jS=class extends yb{static[L]=`PgNumericBuilder`;constructor(e,t,n){super(e,`string`,`PgNumeric`),this.config.precision=t,this.config.scale=n}build(e){return new MS(e,this.config)}},MS=class extends bb{static[L]=`PgNumeric`;precision;scale;constructor(e,t){super(e,t),this.precision=t.precision,this.scale=t.scale}mapFromDriverValue(e){return typeof e==`string`?e:String(e)}getSQLType(){return this.precision!==void 0&&this.scale!==void 0?`numeric(${this.precision}, ${this.scale})`:this.precision===void 0?`numeric`:`numeric(${this.precision})`}},NS=class extends yb{static[L]=`PgNumericNumberBuilder`;constructor(e,t,n){super(e,`number`,`PgNumericNumber`),this.config.precision=t,this.config.scale=n}build(e){return new PS(e,this.config)}},PS=class extends bb{static[L]=`PgNumericNumber`;precision;scale;constructor(e,t){super(e,t),this.precision=t.precision,this.scale=t.scale}mapFromDriverValue(e){return typeof e==`number`?e:Number(e)}mapToDriverValue=String;getSQLType(){return this.precision!==void 0&&this.scale!==void 0?`numeric(${this.precision}, ${this.scale})`:this.precision===void 0?`numeric`:`numeric(${this.precision})`}},FS=class extends yb{static[L]=`PgNumericBigIntBuilder`;constructor(e,t,n){super(e,`bigint`,`PgNumericBigInt`),this.config.precision=t,this.config.scale=n}build(e){return new IS(e,this.config)}},IS=class extends bb{static[L]=`PgNumericBigInt`;precision;scale;constructor(e,t){super(e,t),this.precision=t.precision,this.scale=t.scale}mapFromDriverValue=BigInt;mapToDriverValue=String;getSQLType(){return this.precision!==void 0&&this.scale!==void 0?`numeric(${this.precision}, ${this.scale})`:this.precision===void 0?`numeric`:`numeric(${this.precision})`}};function LS(e,t){let{name:n,config:r}=Tx(e,t),i=r?.mode;return i===`number`?new NS(n,r?.precision,r?.scale):i===`bigint`?new FS(n,r?.precision,r?.scale):new jS(n,r?.precision,r?.scale)}var RS=class extends yb{static[L]=`PgPointTupleBuilder`;constructor(e){super(e,`array`,`PgPointTuple`)}build(e){return new zS(e,this.config)}},zS=class extends bb{static[L]=`PgPointTuple`;getSQLType(){return`point`}mapFromDriverValue(e){if(typeof e==`string`){let[t,n]=e.slice(1,-1).split(`,`);return[Number.parseFloat(t),Number.parseFloat(n)]}return[e.x,e.y]}mapToDriverValue(e){return`(${e[0]},${e[1]})`}},BS=class extends yb{static[L]=`PgPointObjectBuilder`;constructor(e){super(e,`json`,`PgPointObject`)}build(e){return new VS(e,this.config)}},VS=class extends bb{static[L]=`PgPointObject`;getSQLType(){return`point`}mapFromDriverValue(e){if(typeof e==`string`){let[t,n]=e.slice(1,-1).split(`,`);return{x:Number.parseFloat(t),y:Number.parseFloat(n)}}return e}mapToDriverValue(e){return`(${e.x},${e.y})`}};function HS(e,t){let{name:n,config:r}=Tx(e,t);return!r?.mode||r.mode===`tuple`?new RS(n):new BS(n)}function US(e){let t=[];for(let n=0;n<e.length;n+=2)t.push(Number.parseInt(e.slice(n,n+2),16));return new Uint8Array(t)}function WS(e,t){let n=new DataView(new ArrayBuffer(8));for(let r=0;r<8;r++)n.setUint8(r,e[t+r]);return n.getFloat64(0,!0)}function GS(e){let t=US(e),n=0,r=t[n];n+=1;let i=new DataView(t.buffer),a=i.getUint32(n,r===1);if(n+=4,a&536870912&&(i.getUint32(n,r===1),n+=4),(a&65535)==1){let e=WS(t,n);n+=8;let r=WS(t,n);return n+=8,[e,r]}throw Error(`Unsupported geometry type`)}var KS=class extends yb{static[L]=`PgGeometryBuilder`;constructor(e){super(e,`array`,`PgGeometry`)}build(e){return new qS(e,this.config)}},qS=class extends bb{static[L]=`PgGeometry`;getSQLType(){return`geometry(point)`}mapFromDriverValue(e){return GS(e)}mapToDriverValue(e){return`point(${e[0]} ${e[1]})`}},JS=class extends yb{static[L]=`PgGeometryObjectBuilder`;constructor(e){super(e,`json`,`PgGeometryObject`)}build(e){return new YS(e,this.config)}},YS=class extends bb{static[L]=`PgGeometryObject`;getSQLType(){return`geometry(point)`}mapFromDriverValue(e){let t=GS(e);return{x:t[0],y:t[1]}}mapToDriverValue(e){return`point(${e.x} ${e.y})`}};function XS(e,t){let{name:n,config:r}=Tx(e,t);return!r?.mode||r.mode===`tuple`?new KS(n):new JS(n)}var ZS=class extends yb{static[L]=`PgRealBuilder`;constructor(e,t){super(e,`number`,`PgReal`),this.config.length=t}build(e){return new QS(e,this.config)}},QS=class extends bb{static[L]=`PgReal`;constructor(e,t){super(e,t)}getSQLType(){return`real`}mapFromDriverValue=e=>typeof e==`string`?Number.parseFloat(e):e};function $S(e){return new ZS(e??``)}var eC=class extends yb{static[L]=`PgSerialBuilder`;constructor(e){super(e,`number`,`PgSerial`),this.config.hasDefault=!0,this.config.notNull=!0}build(e){return new tC(e,this.config)}},tC=class extends bb{static[L]=`PgSerial`;getSQLType(){return`serial`}};function nC(e){return new eC(e??``)}var rC=class extends Dx{static[L]=`PgSmallIntBuilder`;constructor(e){super(e,`number`,`PgSmallInt`)}build(e){return new iC(e,this.config)}},iC=class extends bb{static[L]=`PgSmallInt`;getSQLType(){return`smallint`}mapFromDriverValue=e=>typeof e==`string`?Number(e):e};function aC(e){return new rC(e??``)}var oC=class extends yb{static[L]=`PgSmallSerialBuilder`;constructor(e){super(e,`number`,`PgSmallSerial`),this.config.hasDefault=!0,this.config.notNull=!0}build(e){return new sC(e,this.config)}},sC=class extends bb{static[L]=`PgSmallSerial`;getSQLType(){return`smallserial`}};function cC(e){return new oC(e??``)}var lC=class extends yb{static[L]=`PgTextBuilder`;constructor(e,t){super(e,`string`,`PgText`),this.config.enumValues=t.enum}build(e){return new uC(e,this.config)}},uC=class extends bb{static[L]=`PgText`;enumValues=this.config.enumValues;getSQLType(){return`text`}};function H(e,t={}){let{name:n,config:r}=Tx(e,t);return new lC(n,r)}var dC=class extends Xx{constructor(e,t,n){super(e,`string`,`PgTime`),this.withTimezone=t,this.precision=n,this.config.withTimezone=t,this.config.precision=n}static[L]=`PgTimeBuilder`;build(e){return new fC(e,this.config)}},fC=class extends bb{static[L]=`PgTime`;withTimezone;precision;constructor(e,t){super(e,t),this.withTimezone=t.withTimezone,this.precision=t.precision}getSQLType(){return`time${this.precision===void 0?``:`(${this.precision})`}${this.withTimezone?` with time zone`:``}`}};function pC(e,t={}){let{name:n,config:r}=Tx(e,t);return new dC(n,r.withTimezone??!1,r.precision)}var mC=class extends Xx{static[L]=`PgTimestampBuilder`;constructor(e,t,n){super(e,`date`,`PgTimestamp`),this.config.withTimezone=t,this.config.precision=n}build(e){return new hC(e,this.config)}},hC=class extends bb{static[L]=`PgTimestamp`;withTimezone;precision;constructor(e,t){super(e,t),this.withTimezone=t.withTimezone,this.precision=t.precision}getSQLType(){return`timestamp${this.precision===void 0?``:` (${this.precision})`}${this.withTimezone?` with time zone`:``}`}mapFromDriverValue(e){return typeof e==`string`?new Date(this.withTimezone?e:e+`+0000`):e}mapToDriverValue=e=>e.toISOString()},gC=class extends Xx{static[L]=`PgTimestampStringBuilder`;constructor(e,t,n){super(e,`string`,`PgTimestampString`),this.config.withTimezone=t,this.config.precision=n}build(e){return new _C(e,this.config)}},_C=class extends bb{static[L]=`PgTimestampString`;withTimezone;precision;constructor(e,t){super(e,t),this.withTimezone=t.withTimezone,this.precision=t.precision}getSQLType(){return`timestamp${this.precision===void 0?``:`(${this.precision})`}${this.withTimezone?` with time zone`:``}`}mapFromDriverValue(e){if(typeof e==`string`)return e;let t=e.toISOString().slice(0,-1).replace(`T`,` `);if(this.withTimezone){let n=e.getTimezoneOffset();return`${t}${n<=0?`+`:`-`}${Math.floor(Math.abs(n)/60).toString().padStart(2,`0`)}`}return t}};function U(e,t={}){let{name:n,config:r}=Tx(e,t);return r?.mode===`string`?new gC(n,r.withTimezone??!1,r.precision):new mC(n,r?.withTimezone??!1,r?.precision)}var vC=class extends yb{static[L]=`PgUUIDBuilder`;constructor(e){super(e,`string`,`PgUUID`)}defaultRandom(){return this.default(V`gen_random_uuid()`)}build(e){return new yC(e,this.config)}},yC=class extends bb{static[L]=`PgUUID`;getSQLType(){return`uuid`}};function bC(e){return new vC(e??``)}var xC=class extends yb{static[L]=`PgVarcharBuilder`;constructor(e,t){super(e,`string`,`PgVarchar`),this.config.length=t.length,this.config.enumValues=t.enum}build(e){return new SC(e,this.config)}},SC=class extends bb{static[L]=`PgVarchar`;length=this.config.length;enumValues=this.config.enumValues;getSQLType(){return this.length===void 0?`varchar`:`varchar(${this.length})`}};function CC(e,t={}){let{name:n,config:r}=Tx(e,t);return new xC(n,r)}var wC=class extends yb{static[L]=`PgBinaryVectorBuilder`;constructor(e,t){super(e,`string`,`PgBinaryVector`),this.config.dimensions=t.dimensions}build(e){return new TC(e,this.config)}},TC=class extends bb{static[L]=`PgBinaryVector`;dimensions=this.config.dimensions;getSQLType(){return`bit(${this.dimensions})`}};function EC(e,t){let{name:n,config:r}=Tx(e,t);return new wC(n,r)}var DC=class extends yb{static[L]=`PgHalfVectorBuilder`;constructor(e,t){super(e,`array`,`PgHalfVector`),this.config.dimensions=t.dimensions}build(e){return new OC(e,this.config)}},OC=class extends bb{static[L]=`PgHalfVector`;dimensions=this.config.dimensions;getSQLType(){return`halfvec(${this.dimensions})`}mapToDriverValue(e){return JSON.stringify(e)}mapFromDriverValue(e){return e.slice(1,-1).split(`,`).map(e=>Number.parseFloat(e))}};function kC(e,t){let{name:n,config:r}=Tx(e,t);return new DC(n,r)}var AC=class extends yb{static[L]=`PgSparseVectorBuilder`;constructor(e,t){super(e,`string`,`PgSparseVector`),this.config.dimensions=t.dimensions}build(e){return new jC(e,this.config)}},jC=class extends bb{static[L]=`PgSparseVector`;dimensions=this.config.dimensions;getSQLType(){return`sparsevec(${this.dimensions})`}};function MC(e,t){let{name:n,config:r}=Tx(e,t);return new AC(n,r)}var NC=class extends yb{static[L]=`PgVectorBuilder`;constructor(e,t){super(e,`array`,`PgVector`),this.config.dimensions=t.dimensions}build(e){return new PC(e,this.config)}},PC=class extends bb{static[L]=`PgVector`;dimensions=this.config.dimensions;getSQLType(){return`vector(${this.dimensions})`}mapToDriverValue(e){return JSON.stringify(e)}mapFromDriverValue(e){return e.slice(1,-1).split(`,`).map(e=>Number.parseFloat(e))}};function FC(e,t){let{name:n,config:r}=Tx(e,t);return new NC(n,r)}function IC(){return{bigint:Mx,bigserial:Lx,boolean:Bx,char:Ux,cidr:Kx,customType:Yx,date:tS,doublePrecision:iS,inet:sS,integer:uS,interval:pS,json:gS,jsonb:yS,line:wS,macaddr:DS,macaddr8:AS,numeric:LS,point:HS,geometry:XS,real:$S,serial:nC,smallint:aC,smallserial:cC,text:H,time:pC,timestamp:U,uuid:bC,varchar:CC,bit:EC,halfvec:kC,sparsevec:MC,vector:FC}}var LC=Symbol.for(`drizzle:PgInlineForeignKeys`),RC=Symbol.for(`drizzle:EnableRLS`),zC=class extends z{static[L]=`PgTable`;static Symbol=Object.assign({},z.Symbol,{InlineForeignKeys:LC,EnableRLS:RC});[LC]=[];[RC]=!1;[z.Symbol.ExtraConfigBuilder]=void 0;[z.Symbol.ExtraConfigColumns]={}};function BC(e,t,n,r,i=e){let a=new zC(e,r,i),o=typeof t==`function`?t(IC()):t,s=Object.fromEntries(Object.entries(o).map(([e,t])=>{let n=t;n.setName(e);let r=n.build(a);return a[LC].push(...n.buildForeignKeys(r,a)),[e,r]})),c=Object.fromEntries(Object.entries(o).map(([e,t])=>{let n=t;return n.setName(e),[e,n.buildExtraConfigColumn(a)]})),l=Object.assign(a,s);return l[z.Symbol.Columns]=s,l[z.Symbol.ExtraConfigColumns]=c,n&&(l[zC.Symbol.ExtraConfigBuilder]=n),Object.assign(l,{enableRLS:()=>(l[zC.Symbol.EnableRLS]=!0,l)})}var VC=(e,t,n)=>BC(e,t,n,void 0);function HC(...e){return e[0].columns?new UC(e[0].columns,e[0].name):new UC(e)}var UC=class{static[L]=`PgPrimaryKeyBuilder`;columns;name;constructor(e,t){this.columns=e,this.name=t}build(e){return new WC(e,this.columns,this.name)}},WC=class{constructor(e,t,n){this.table=e,this.columns=t,this.name=n}static[L]=`PgPrimaryKey`;columns;name;getName(){return this.name??`${this.table[zC.Symbol.Name]}_${this.columns.map(e=>e.name).join(`_`)}_pk`}};function GC(e,t){return Zb(t)&&!qb(e)&&!R(e,ex)&&!R(e,tx)&&!R(e,ib)&&!R(e,z)&&!R(e,ix)?new ex(e,t):e}var W=(e,t)=>V`${e} = ${GC(t,e)}`,KC=(e,t)=>V`${e} <> ${GC(t,e)}`;function qC(...e){let t=e.filter(e=>e!==void 0);if(t.length!==0)return t.length===1?new B(t):new B([new Yb(`(`),V.join(t,new Yb(` and `)),new Yb(`)`)])}function JC(...e){let t=e.filter(e=>e!==void 0);if(t.length!==0)return t.length===1?new B(t):new B([new Yb(`(`),V.join(t,new Yb(` or `)),new Yb(`)`)])}function YC(e){return V`not ${e}`}var XC=(e,t)=>V`${e} > ${GC(t,e)}`,ZC=(e,t)=>V`${e} >= ${GC(t,e)}`,QC=(e,t)=>V`${e} < ${GC(t,e)}`,$C=(e,t)=>V`${e} <= ${GC(t,e)}`;function ew(e,t){return Array.isArray(t)?t.length===0?V`false`:V`${e} in ${t.map(t=>GC(t,e))}`:V`${e} in ${GC(t,e)}`}function tw(e,t){return Array.isArray(t)?t.length===0?V`true`:V`${e} not in ${t.map(t=>GC(t,e))}`:V`${e} not in ${GC(t,e)}`}function nw(e){return V`${e} is null`}function rw(e){return V`${e} is not null`}function iw(e){return V`exists ${e}`}function aw(e){return V`not exists ${e}`}function ow(e,t,n){return V`${e} between ${GC(t,e)} and ${GC(n,e)}`}function sw(e,t,n){return V`${e} not between ${GC(t,e)} and ${GC(n,e)}`}function cw(e,t){return V`${e} like ${t}`}function lw(e,t){return V`${e} not like ${t}`}function uw(e,t){return V`${e} ilike ${t}`}function dw(e,t){return V`${e} not ilike ${t}`}function fw(e){return V`${e} asc`}function pw(e){return V`${e} desc`}var mw=class{constructor(e,t,n){this.sourceTable=e,this.referencedTable=t,this.relationName=n,this.referencedTableName=t[z.Symbol.Name]}static[L]=`Relation`;referencedTableName;fieldName},hw=class{constructor(e,t){this.table=e,this.config=t}static[L]=`Relations`},gw=class e extends mw{constructor(e,t,n,r){super(e,t,n?.relationName),this.config=n,this.isNullable=r}static[L]=`One`;withFieldName(t){let n=new e(this.sourceTable,this.referencedTable,this.config,this.isNullable);return n.fieldName=t,n}},_w=class e extends mw{constructor(e,t,n){super(e,t,n?.relationName),this.config=n}static[L]=`Many`;withFieldName(t){let n=new e(this.sourceTable,this.referencedTable,this.config);return n.fieldName=t,n}};function vw(){return{and:qC,between:ow,eq:W,exists:iw,gt:XC,gte:ZC,ilike:uw,inArray:ew,isNull:nw,isNotNull:rw,like:cw,lt:QC,lte:$C,ne:KC,not:YC,notBetween:sw,notExists:aw,notLike:lw,notIlike:dw,notInArray:tw,or:JC,sql:V}}function yw(){return{sql:V,asc:fw,desc:pw}}function bw(e,t){Object.keys(e).length===1&&`default`in e&&!R(e.default,z)&&(e=e.default);let n={},r={},i={};for(let[a,o]of Object.entries(e))if(R(o,z)){let e=Kb(o),t=r[e];n[e]=a,i[a]={tsName:a,dbName:o[z.Symbol.Name],schema:o[z.Symbol.Schema],columns:o[z.Symbol.Columns],relations:t?.relations??{},primaryKey:t?.primaryKey??[]};for(let e of Object.values(o[z.Symbol.Columns]))e.primary&&i[a].primaryKey.push(e);let s=o[z.Symbol.ExtraConfigBuilder]?.(o[z.Symbol.ExtraConfigColumns]);if(s)for(let e of Object.values(s))R(e,UC)&&i[a].primaryKey.push(...e.columns)}else if(R(o,hw)){let e=Kb(o.table),a=n[e],s=o.config(t(o.table)),c;for(let[t,n]of Object.entries(s))if(a){let e=i[a];e.relations[t]=n}else e in r||(r[e]={relations:{},primaryKey:c}),r[e].relations[t]=n}return{tables:i,tableNamesMap:n}}function xw(e,t){return new hw(e,e=>Object.fromEntries(Object.entries(t(e)).map(([e,t])=>[e,t.withFieldName(e)])))}function Sw(e){return function(t,n){return new gw(e,t,n,n?.fields.reduce((e,t)=>e&&t.notNull,!0)??!1)}}function Cw(e){return function(t,n){return new _w(e,t,n)}}function ww(e,t,n){if(R(n,gw)&&n.config)return{fields:n.config.fields,references:n.config.references};let r=t[Kb(n.referencedTable)];if(!r)throw Error(`Table "${n.referencedTable[z.Symbol.Name]}" not found in schema`);let i=e[r];if(!i)throw Error(`Table "${r}" not found in schema`);let a=n.sourceTable,o=t[Kb(a)];if(!o)throw Error(`Table "${a[z.Symbol.Name]}" not found in schema`);let s=[];for(let e of Object.values(i.relations))(n.relationName&&n!==e&&e.relationName===n.relationName||!n.relationName&&e.referencedTable===n.sourceTable)&&s.push(e);if(s.length>1)throw n.relationName?Error(`There are multiple relations with name "${n.relationName}" in table "${r}"`):Error(`There are multiple relations between "${r}" and "${n.sourceTable[z.Symbol.Name]}". Please specify relation name`);if(s[0]&&R(s[0],gw)&&s[0].config)return{fields:s[0].config.references,references:s[0].config.fields};throw Error(`There is not enough information to infer relation "${o}.${n.fieldName}"`)}function Tw(e){return{one:Sw(e),many:Cw(e)}}function Ew(e,t,n,r,i=e=>e){let a={};for(let[o,s]of r.entries())if(s.isJson){let r=t.relations[s.tsKey],c=n[o],l=typeof c==`string`?JSON.parse(c):c;a[s.tsKey]=R(r,gw)?l&&Ew(e,e[s.relationTableTsKey],l,s.selection,i):l.map(t=>Ew(e,e[s.relationTableTsKey],t,s.selection,i))}else{let e=i(n[o]),t=s.field,r;r=R(t,ib)?t:R(t,B)?t.decoder:t.sql.decoder,a[s.tsKey]=e===null?null:r.mapFromDriverValue(e)}return a}function Dw(e){return V`count(${e||V.raw(`*`)})`.mapWith(Number)}function Ow(e){let t=e?.dataType;return typeof t==`string`&&t.split(` `)[0]===`string`}function kw(e,t,n){if(!Ow(t))return e;let r=e=>{if(!(e instanceof Date))return e;let t=e.toISOString();return n===`mysql`?t.replace(`T`,` `).replace(`Z`,``):t};return Array.isArray(e)?e.map(r):r(e)}var Aw=/^\d{4}-\d{2}-\d{2}[ T]\d{2}:\d{2}(?::\d{2}(?:\.\d+)?)?$/;function jw(e){return typeof e==`string`&&Aw.test(e)?new Date(`${e.replace(` `,`T`)}Z`):new Date(e)}function Mw(e){let t=new Map;for(let[n,r]of Object.entries(e??{}))r.relations&&t.set(n,new Set(Object.keys(r.relations)));return t}function Nw({baseModel:e,joinModel:t,baseModelKey:n,joinModelKey:r,relationKeys:i,schema:a,getDefaultModelName:o}){let s=n??o(e),c=r??o(t),l=a[c]?.fields??{},u=Object.values(l).some(e=>e.references&&o(e.references.model)===s)?t:a[c]?.modelName??c;return i?.size?i.has(u)?u:i.has(t)?t:u:t}function Pw(e,t,n){return n===`pg`?uw(e,t):V`LOWER(${e}) LIKE LOWER(${t})`}function Fw(e,t){return t.length===0?V`false`:V`LOWER(${e}) IN (${V.join(t.map(e=>V`LOWER(${e})`),V`, `)})`}function Iw(e,t){return t.length===0?V`true`:V`LOWER(${e}) NOT IN (${V.join(t.map(e=>V`LOWER(${e})`),V`, `)})`}function Lw(e,t){return V`LOWER(${e}) = LOWER(${t})`}function Rw(e,t){return V`LOWER(${e}) <> LOWER(${t})`}function zw(e){let t=[];for(let[n,r]of Object.entries(e)){if(!R(r,z))continue;let e=Object.entries(Cx(r)).map(([e,t])=>({name:e,nullable:!t.notNull,hasDefault:t.hasDefault||t.generated!==void 0||t.generatedIdentity!==void 0}));t.push({name:n,columns:e})}return t}function Bw(e,t,n){return Ms(Bs(t,{usePlural:n}),zw(e))}function Vw(e,t,n){let r=0;if(e&&typeof e==`object`&&`rowCount`in e?r=e.rowCount:e&&typeof e==`object`&&typeof e.count==`number`?r=e.count:Array.isArray(e)?r=e.length>0&&Uw(e[0])?Hw(e[0]):e.length:Uw(e)&&(r=Hw(e)),typeof r!=`number`||!Number.isFinite(r))throw ra.error(`[Drizzle Adapter] The result of the ${t} operation is not a finite number. This is likely a bug in the adapter. Please report this issue to the Better Auth team.`,{result:e,...n}),new N(`Drizzle adapter ${t} returned an invalid affected row count`);return r}function Hw(e){if(!e||typeof e!=`object`)return;let t=e;if(`affectedRows`in t)return t.affectedRows;if(`rowsAffected`in t)return t.rowsAffected;if(`changes`in t)return t.changes;if(`meta`in t){let e=t.meta;if(e&&typeof e==`object`&&`changes`in e)return e.changes}}function Uw(e){return Hw(e)!==void 0}var Ww=(e,t)=>{let n=null,r=!1,i,a=()=>i??=Mw(e._?.schema),o=(e,n=!1)=>({getFieldName:i,getDefaultFieldName:o,getDefaultModelName:s,options:c,schema:l})=>{t.provider===`mysql`&&c.advanced?.database?.generateId===!1&&!r&&(r=!0,ra.warn(`[Drizzle Adapter] MySQL does not support INSERT...RETURNING. With generateId set to false, the adapter uses best-effort fallback strategies (unique columns, full-field match) to retrieve inserted rows. For reliable behavior, use Better Auth's default ID generation, a custom generateId function, or generateId: "serial" for auto-increment.`));function u(n){let r=t.schema||e._.fullSchema;if(!r)throw new N(`Drizzle adapter failed to initialize. Schema not found. Please provide a schema object in the adapter options object.`);let i=r[n];if(!i)throw new N(`[# Drizzle Adapter]: The model "${n}" was not found in the schema object. Please pass the schema directly to the adapter options.`);return i}let d=async(r,a,o,s,d)=>{if(t.provider!==`mysql`)return(await o.returning())[0];await o.execute();let p=u(r),m=o.config?.values;if(d?.length){let t=f(d.map(e=>s[e.field]===void 0?e:{...e,value:s[e.field]}),r,a);return(await e.select().from(p).where(...t))[0]}let h=async e=>{let t=m?.[0]?.id?.value;if(t)return(await e.select().from(p).where(W(p.id,t)).limit(1).execute())[0]??null;if(s.id)return(await e.select().from(p).where(W(p.id,s.id)).limit(1).execute())[0]??null;if(c.advanced?.database?.generateId===`serial`&&p.id){let t=(await e.select({id:V`LAST_INSERT_ID()`}).from(p).limit(1).execute())[0]?.id;if(t)return(await e.select().from(p).where(W(p.id,t)).limit(1).execute())[0]??null}let n=l[a]?.fields;if(n)for(let[t,r]of Object.entries(n)){if(!r.unique)continue;let n=i({model:a,field:t}),o=s[n];if(o==null||!p[n])continue;let c=await e.select().from(p).where(W(p[n],o)).limit(1).execute();if(c[0])return c[0]}let o=[];for(let[e,t]of Object.entries(s))t!==void 0&&p[e]&&o.push(t===null?nw(p[e]):W(p[e],t));if(o.length>0){let t=qC(...o);if(t){let n=await e.select().from(p).where(t).limit(2).execute();if(n.length===1)return n[0]}}return ra.warn(`[Drizzle Adapter] Unable to safely identify the inserted "${r}" row on MySQL. Enable Better Auth ID generation or use generateId: "serial" for reliable behavior.`),null};return n?h(e):e.transaction(h)};function f(e,n,r){let a=u(n),o=e=>{let t=i({model:r,field:e.field});if(!R(a[t],ib))throw new N(`The field "${e.field}" does not exist in the schema for the model "${n}". Please update your schema.`);return t};if(!e)return[];if(e.length===1){let n=e[0];if(!n)return[];let r=o(n),i=(n.mode??`sensitive`)===`insensitive`&&(typeof n.value==`string`||Array.isArray(n.value)&&n.value.every(e=>typeof e==`string`));if(n.operator===`in`){if(!Array.isArray(n.value))throw new N(`The value for the field "${n.field}" must be an array when using the "in" operator.`);return i?[Fw(a[r],n.value)]:[ew(a[r],n.value)]}if(n.operator===`not_in`){if(!Array.isArray(n.value))throw new N(`The value for the field "${n.field}" must be an array when using the "not_in" operator.`);return i?[Iw(a[r],n.value)]:[tw(a[r],n.value)]}return n.operator===`contains`?i&&typeof n.value==`string`?[Pw(a[r],`%${n.value}%`,t.provider)]:[cw(a[r],`%${n.value}%`)]:n.operator===`starts_with`?i&&typeof n.value==`string`?[Pw(a[r],`${n.value}%`,t.provider)]:[cw(a[r],`${n.value}%`)]:n.operator===`ends_with`?i&&typeof n.value==`string`?[Pw(a[r],`%${n.value}`,t.provider)]:[cw(a[r],`%${n.value}`)]:n.operator===`lt`?[QC(a[r],n.value)]:n.operator===`lte`?[$C(a[r],n.value)]:n.operator===`ne`?n.value===null?[rw(a[r])]:i&&typeof n.value==`string`?[Rw(a[r],n.value)]:[KC(a[r],n.value)]:n.operator===`gt`?[XC(a[r],n.value)]:n.operator===`gte`?[ZC(a[r],n.value)]:n.value===null?[nw(a[r])]:i&&typeof n.value==`string`?[Lw(a[r],n.value)]:[W(a[r],n.value)]}let s=e.filter(e=>e.connector===`AND`||!e.connector),c=e.filter(e=>e.connector===`OR`),l=qC(...s.map(e=>{let n=o(e),r=(e.mode??`sensitive`)===`insensitive`&&(typeof e.value==`string`||Array.isArray(e.value)&&e.value.every(e=>typeof e==`string`));if(e.operator===`in`){if(!Array.isArray(e.value))throw new N(`The value for the field "${e.field}" must be an array when using the "in" operator.`);return r?Fw(a[n],e.value):ew(a[n],e.value)}if(e.operator===`not_in`){if(!Array.isArray(e.value))throw new N(`The value for the field "${e.field}" must be an array when using the "not_in" operator.`);return r?Iw(a[n],e.value):tw(a[n],e.value)}return e.operator===`contains`?r&&typeof e.value==`string`?Pw(a[n],`%${e.value}%`,t.provider):cw(a[n],`%${e.value}%`):e.operator===`starts_with`?r&&typeof e.value==`string`?Pw(a[n],`${e.value}%`,t.provider):cw(a[n],`${e.value}%`):e.operator===`ends_with`?r&&typeof e.value==`string`?Pw(a[n],`%${e.value}`,t.provider):cw(a[n],`%${e.value}`):e.operator===`lt`?QC(a[n],e.value):e.operator===`lte`?$C(a[n],e.value):e.operator===`gt`?XC(a[n],e.value):e.operator===`gte`?ZC(a[n],e.value):e.operator===`ne`?e.value===null?rw(a[n]):r&&typeof e.value==`string`?Rw(a[n],e.value):KC(a[n],e.value):e.value===null?nw(a[n]):r&&typeof e.value==`string`?Lw(a[n],e.value):W(a[n],e.value)})),d=JC(...c.map(e=>{let n=o(e),r=(e.mode??`sensitive`)===`insensitive`&&(typeof e.value==`string`||Array.isArray(e.value)&&e.value.every(e=>typeof e==`string`));if(e.operator===`in`){if(!Array.isArray(e.value))throw new N(`The value for the field "${e.field}" must be an array when using the "in" operator.`);return r?Fw(a[n],e.value):ew(a[n],e.value)}if(e.operator===`not_in`){if(!Array.isArray(e.value))throw new N(`The value for the field "${e.field}" must be an array when using the "not_in" operator.`);return r?Iw(a[n],e.value):tw(a[n],e.value)}return e.operator===`contains`?r&&typeof e.value==`string`?Pw(a[n],`%${e.value}%`,t.provider):cw(a[n],`%${e.value}%`):e.operator===`starts_with`?r&&typeof e.value==`string`?Pw(a[n],`${e.value}%`,t.provider):cw(a[n],`${e.value}%`):e.operator===`ends_with`?r&&typeof e.value==`string`?Pw(a[n],`%${e.value}`,t.provider):cw(a[n],`%${e.value}`):e.operator===`lt`?QC(a[n],e.value):e.operator===`lte`?$C(a[n],e.value):e.operator===`gt`?XC(a[n],e.value):e.operator===`gte`?ZC(a[n],e.value):e.operator===`ne`?e.value===null?rw(a[n]):r&&typeof e.value==`string`?Rw(a[n],e.value):KC(a[n],e.value):e.value===null?nw(a[n]):r&&typeof e.value==`string`?Lw(a[n],e.value):W(a[n],e.value)}));return s.length&&c.length?[qC(l,d)]:s.length?[l]:c.length?[d]:[]}function p(e,t,n){if(!e)throw new N(`Drizzle adapter failed to initialize. Drizzle Schema not found. Please provide a schema object in the adapter options object.`);for(let r in n){let n;try{n=i({model:t,field:r})}catch{n=r}if(!e[n])throw new N(`The field "${r}" does not exist in the "${t}" Drizzle schema. Please update your drizzle schema or re-generate using "npx auth@latest generate".`)}}function m(n){if(!e.query)return null;if(e.query[n])return n;if(t.usePlural){let t=`${n}s`;if(e.query[t])return t}if(t.schema){let r=t.schema[n];if(r){let t=e._.fullSchema;if(t){for(let n of Object.keys(e.query))if(t[n]===r)return n}}}return null}function h(e,n,r,i,a,o){return o?Nw({baseModel:e,joinModel:n,baseModelKey:r,joinModelKey:i,relationKeys:a,schema:l,getDefaultModelName:s}):t.usePlural?n:`${n}s`}return{async create({model:t,modelKey:n=t,data:r}){let i=u(t);return p(i,n,r),await d(t,n,e.insert(i).values(r),r)},async findOne({model:t,modelKey:n=t,where:r,select:o,join:s}){let l=u(t),d=f(r,t,n);if(s){let r=m(t);if(!e.query||!r)ra.error(`[# Drizzle Adapter]: The model "${t}" was not found in the query object. Please update your Drizzle schema to include relations or re-generate using "npx auth@latest generate".`),ra.info(`Falling back to regular query`);else{let l,u=[],f=a().get(r);l={};let p=Object.entries(s);for(let[e,r]of p){let i=r.limit??c.advanced?.database?.defaultFindManyLimit??100,a=r.relation===`one-to-one`,o=h(t,e,n,r.modelKey??e,f,a);l[o]=a?!0:{limit:i},o!==e&&u.push({key:o,target:e})}let m=await e.query[r].findFirst({where:d[0],columns:o?.length&&o.length>0?o.reduce((e,t)=>(e[i({model:n,field:t})]=!0,e),{}):void 0,with:l});if(m)for(let{key:e,target:t}of u)m[t]=m[e],delete m[e];return m}}let p=await e.select(o?.length&&o.length>0?o.reduce((e,t)=>{let r=i({model:n,field:t});return{...e,[r]:l[r]}},{}):void 0).from(l).where(...d);return p.length?p[0]:null},async findMany({model:t,modelKey:n=t,where:r,sortBy:o,limit:s,select:l,offset:d,join:p}){let g=u(t),_=r?f(r,t,n):[],v=o?.direction===`desc`?pw:fw;if(p){let r=m(t);if(!e.query||!r)ra.error(`[# Drizzle Adapter]: The model "${t}" was not found in the query object. Please update your Drizzle schema to include relations or re-generate using "npx auth@latest generate".`),ra.info(`Falling back to regular query`);else{let u,f=[],m=a().get(r);u={};let y=Object.entries(p);for(let[e,r]of y){let i=r.relation===`one-to-one`,a=r.limit??c.advanced?.database?.defaultFindManyLimit??100,o=h(t,e,n,r.modelKey??e,m,i);u[o]=i?!0:{limit:a},o!==e&&f.push({key:o,target:e})}let b;o?.field&&(b=[v(g[i({model:n,field:o?.field})])]);let x=await e.query[r].findMany({where:_[0],with:u,columns:l?.length&&l.length>0?l.reduce((e,t)=>(e[i({model:n,field:t})]=!0,e),{}):void 0,limit:s??100,offset:d??0,orderBy:b});if(x)for(let e of x)for(let{key:t,target:n}of f)e[n]=e[t],delete e[t];return x}}let y=e.select(l?.length&&l.length>0?l.reduce((e,t)=>{let r=i({model:n,field:t});return{...e,[r]:g[r]}},{}):void 0).from(g),b=s,x=d;return b!==void 0&&(y=y.limit(b)),x!==void 0&&(y=y.offset(x)),o?.field&&(y=y.orderBy(v(g[i({model:n,field:o?.field})]))),await y.where(..._)},async count({model:t,modelKey:n=t,where:r}){let i=u(t),a=r?f(r,t,n):[];return(await e.select({count:Dw()}).from(i).where(...a))[0].count},async update({model:t,modelKey:n=t,where:r,update:i}){let a=u(t),o=f(r,t,n);return await d(t,n,e.update(a).set(i).where(...o),i,r)},async updateMany({model:t,modelKey:n=t,where:r,update:i}){let a=u(t),o=f(r,t,n);return Vw(await e.update(a).set(i).where(...o),`updateMany`,{model:t,where:r})},async delete({model:t,modelKey:n=t,where:r}){let i=u(t),a=f(r,t,n);return await e.delete(i).where(...a)},async deleteMany({model:t,modelKey:n=t,where:r}){let i=u(t),a=f(r,t,n);return Vw(await e.delete(i).where(...a),`deleteMany`,{model:t,where:r})},async consumeOne({model:r,modelKey:a=r,where:o}){let s=u(r),c=f(o,r,a),l=i({model:a,field:`id`}),d=s[l];if(t.provider===`mysql`){let t=async e=>{let t=(await e.select().from(s).where(...c).for(`update`).limit(1))[0];if(!t)return null;let n=t[l]??t.id;return n==null||!d?null:Vw(await e.delete(s).where(W(d,n)).execute(),`consumeOne`,{model:r,where:o})>0?t:null};return n?t(e):e.transaction(t)}if(!d)return null;let p=e.select({id:d}).from(s).where(...c).limit(1);return(await e.delete(s).where(ew(d,p)).returning())[0]??null},async incrementOne({model:r,modelKey:a=r,where:o,increment:s,set:c}){let l=u(r),d=f(o,r,a),p=i({model:a,field:`id`}),m=l[p],h={};for(let[e,t]of Object.entries(s)){let n=i({model:a,field:e}),o=l[n];if(!o)throw new N(`The field "${e}" does not exist in the schema for the model "${r}". Please update your schema.`);h[n]=V`${o} + ${V.param(t)}`}if(c)for(let[e,t]of Object.entries(c)){let n=i({model:a,field:e});if(!l[n])throw new N(`The field "${e}" does not exist in the schema for the model "${r}". Please update your schema.`);h[n]=t}if(t.provider===`mysql`){let t=async e=>{let t=(await e.select().from(l).where(...d).for(`update`).limit(1))[0];if(!t)return null;let n=t[p]??t.id;return n==null||!m?null:(await e.update(l).set(h).where(W(m,n)).execute(),(await e.select().from(l).where(W(m,n)).limit(1).execute())[0]??null)};return n?t(e):e.transaction(t)}if(!m)return null;let g=e.select({id:m}).from(l).where(...d).limit(1);return(await e.update(l).set(h).where(qC(...d,ew(m,g))).returning())[0]??null},options:t}},s=null;s={config:{adapterId:`drizzle`,adapterName:`Drizzle Adapter`,usePlural:t.usePlural??!1,debugLogs:t.debugLogs??!1,supportsUUIDs:t.provider===`pg`,supportsJSON:t.provider===`pg`,supportsArrays:t.provider===`pg`,customTransformInput:({data:n,fieldAttributes:r,model:i,field:a})=>r.type===`date`?kw(n,(t.schema||e._.fullSchema)?.[i]?.[a],t.provider):n,customTransformOutput:({data:e,fieldAttributes:t})=>t.type===`date`?e==null?e:jw(e):e,transaction:t.transaction??!1?t=>e.transaction(e=>t(Us({config:{...s.config,transaction:!1},adapter:o(e,!0)})(n))):!1},adapter:o(e)};let c=Us(s);return r=>{n=r;let i=c(r);return Ns(i,Fs(()=>Bw(t.schema??e._?.fullSchema??{},r,t.usePlural),`drizzle`),{runtimeEnabled:zs(r)}),i}},Gw=class{constructor(e,t){this.name=e,this.value=t}static[L]=`PgCheckBuilder`;brand;build(e){return new Kw(e,this)}},Kw=class{constructor(e,t){this.table=e,this.name=t.name,this.value=t.value}static[L]=`PgCheck`;name;value};function qw(e,t){return new Gw(e,t)}var Jw=class e{static[L]=`SelectionProxyHandler`;config;constructor(e){this.config={...e}}get(t,n){if(n===`_`)return{...t._,selectedFields:new Proxy(t._.selectedFields,this)};if(n===Ib)return{...t[Ib],selectedFields:new Proxy(t[Ib].selectedFields,this)};if(typeof n==`symbol`)return t[n];let r=(R(t,Nb)?t._.selectedFields:R(t,ix)?t[Ib].selectedFields:t)[n];if(R(r,B.Aliased)){if(this.config.sqlAliasedBehavior===`sql`&&!r.isSelectionField)return r.sql;let e=r.clone();return e.isSelectionField=!0,e}if(R(r,B)){if(this.config.sqlBehavior===`sql`)return r;throw Error(`You tried to reference "${n}" field from a subquery, which is a raw SQL field, but it doesn't have an alias declared. Please add an alias to the field using ".as('alias')" method.`)}return R(r,ib)?this.config.alias?new Proxy(r,new ax(new Proxy(r.table,new ox(this.config.alias,this.config.replaceOriginalName??!1)))):r:typeof r!=`object`||!r?r:new Proxy(r,new e(this.config))}},Yw=class{constructor(e,t){this.unique=e,this.name=t}static[L]=`PgIndexBuilderOn`;on(...e){return new Xw(e.map(e=>{if(R(e,B))return e;e=e;let t=new Sb(e.name,!!e.keyAsName,e.columnType,e.indexConfig);return e.indexConfig=JSON.parse(JSON.stringify(e.defaultConfig)),t}),this.unique,!1,this.name)}onOnly(...e){return new Xw(e.map(e=>{if(R(e,B))return e;e=e;let t=new Sb(e.name,!!e.keyAsName,e.columnType,e.indexConfig);return e.indexConfig=e.defaultConfig,t}),this.unique,!0,this.name)}using(e,...t){return new Xw(t.map(e=>{if(R(e,B))return e;e=e;let t=new Sb(e.name,!!e.keyAsName,e.columnType,e.indexConfig);return e.indexConfig=JSON.parse(JSON.stringify(e.defaultConfig)),t}),this.unique,!0,this.name,e)}},Xw=class{static[L]=`PgIndexBuilder`;config;constructor(e,t,n,r,i=`btree`){this.config={name:r,columns:e,unique:t,only:n,method:i}}concurrently(){return this.config.concurrently=!0,this}with(e){return this.config.with=e,this}where(e){return this.config.where=e,this}build(e){return new Zw(this.config,e)}},Zw=class{static[L]=`PgIndex`;config;constructor(e,t){this.config={...e,table:t}}};function Qw(e){return new Yw(!1,e)}function $w(e){return new Yw(!0,e)}var eT=Symbol.for(`drizzle:PgViewConfig`);function tT(e){return(e.replace(/['\u2019]/g,``).match(/[\da-z]+|[A-Z]+(?![a-z])|[A-Z][\da-z]+/g)??[]).map(e=>e.toLowerCase()).join(`_`)}function nT(e){return(e.replace(/['\u2019]/g,``).match(/[\da-z]+|[A-Z]+(?![a-z])|[A-Z][\da-z]+/g)??[]).reduce((e,t,n)=>e+(n===0?t.toLowerCase():`${t[0].toUpperCase()}${t.slice(1)}`),``)}function rT(e){return e}var iT=class{static[L]=`CasingCache`;cache={};cachedTables={};convert;constructor(e){this.convert=e===`snake_case`?tT:e===`camelCase`?nT:rT}getColumnCasing(e){if(!e.keyAsName)return e.name;let t=`${e.table[z.Symbol.Schema]??`public`}.${e.table[z.Symbol.OriginalName]}.${e.name}`;return this.cache[t]||this.cacheTable(e.table),this.cache[t]}cacheTable(e){let t=`${e[z.Symbol.Schema]??`public`}.${e[z.Symbol.OriginalName]}`;if(!this.cachedTables[t]){for(let n of Object.values(e[z.Symbol.Columns])){let e=`${t}.${n.name}`;this.cache[e]=this.convert(n.name)}this.cachedTables[t]=!0}}clearCache(){this.cache={},this.cachedTables={}}},aT=class extends ix{static[L]=`PgViewBase`},oT=class{static[L]=`PgDialect`;casing;constructor(e){this.casing=new iT(e?.casing)}async migrate(e,t,n){let r=typeof n==`string`?`__drizzle_migrations`:n.migrationsTable??`__drizzle_migrations`,i=typeof n==`string`?`drizzle`:n.migrationsSchema??`drizzle`,a=V`
363
+ CREATE TABLE IF NOT EXISTS ${V.identifier(i)}.${V.identifier(r)} (
364
+ id SERIAL PRIMARY KEY,
365
+ hash text NOT NULL,
366
+ created_at bigint
367
+ )
368
+ `;await t.execute(V`CREATE SCHEMA IF NOT EXISTS ${V.identifier(i)}`),await t.execute(a);let o=(await t.all(V`select id, hash, created_at from ${V.identifier(i)}.${V.identifier(r)} order by created_at desc limit 1`))[0];await t.transaction(async t=>{for await(let n of e)if(!o||Number(o.created_at)<n.folderMillis){for(let e of n.sql)await t.execute(V.raw(e));await t.execute(V`insert into ${V.identifier(i)}.${V.identifier(r)} ("hash", "created_at") values(${n.hash}, ${n.folderMillis})`)}})}escapeName(e){return`"${e.replace(/"/g,`""`)}"`}escapeParam(e){return`$${e+1}`}escapeString(e){return`'${e.replace(/'/g,`''`)}'`}buildWithCTE(e){if(!e?.length)return;let t=[V`with `];for(let[n,r]of e.entries())t.push(V`${V.identifier(r._.alias)} as (${r._.sql})`),n<e.length-1&&t.push(V`, `);return t.push(V` `),V.join(t)}buildDeleteQuery({table:e,where:t,returning:n,withList:r}){let i=this.buildWithCTE(r),a=n?V` returning ${this.buildSelection(n,{isSingleTable:!0})}`:void 0,o=t?V` where ${t}`:void 0;return V`${i}delete from ${e}${o}${a}`}buildUpdateSet(e,t){let n=e[z.Symbol.Columns],r=Object.keys(n).filter(e=>t[e]!==void 0||n[e]?.onUpdateFn!==void 0),i=r.length;return V.join(r.flatMap((e,r)=>{let a=n[e],o=a.onUpdateFn?.(),s=t[e]??(R(o,B)?o:V.param(o,a)),c=V`${V.identifier(this.casing.getColumnCasing(a))} = ${s}`;return r<i-1?[c,V.raw(`, `)]:[c]}))}buildUpdateQuery({table:e,set:t,where:n,returning:r,withList:i,from:a,joins:o}){let s=this.buildWithCTE(i),c=e[zC.Symbol.Name],l=e[zC.Symbol.Schema],u=e[zC.Symbol.OriginalName],d=c===u?void 0:c,f=V`${l?V`${V.identifier(l)}.`:void 0}${V.identifier(u)}${d&&V` ${V.identifier(d)}`}`,p=this.buildUpdateSet(e,t),m=a&&V.join([V.raw(` from `),this.buildFromTable(a)]),h=this.buildJoins(o),g=r?V` returning ${this.buildSelection(r,{isSingleTable:!a})}`:void 0,_=n?V` where ${n}`:void 0;return V`${s}update ${f} set ${p}${m}${h}${_}${g}`}buildSelection(e,{isSingleTable:t=!1}={}){let n=e.length,r=e.flatMap(({field:e},r)=>{let i=[];if(R(e,B.Aliased)&&e.isSelectionField)i.push(V.identifier(e.fieldAlias));else if(R(e,B.Aliased)||R(e,B)){let n=R(e,B.Aliased)?e.sql:e;t?i.push(new B(n.queryChunks.map(e=>R(e,bb)?V.identifier(this.casing.getColumnCasing(e)):e))):i.push(n),R(e,B.Aliased)&&i.push(V` as ${V.identifier(e.fieldAlias)}`)}else if(R(e,ib))t?i.push(V.identifier(this.casing.getColumnCasing(e))):i.push(e);else if(R(e,Nb)){let t=Object.entries(e._.selectedFields);if(t.length===1){let n=t[0][1],r=R(n,B)?n.decoder:R(n,ib)?{mapFromDriverValue:e=>n.mapFromDriverValue(e)}:n.sql.decoder;r&&(e._.sql.decoder=r)}i.push(e)}return r<n-1&&i.push(V`, `),i});return V.join(r)}buildJoins(e){if(!e||e.length===0)return;let t=[];for(let[n,r]of e.entries()){n===0&&t.push(V` `);let i=r.table,a=r.lateral?V` lateral`:void 0,o=r.on?V` on ${r.on}`:void 0;if(R(i,zC)){let e=i[zC.Symbol.Name],n=i[zC.Symbol.Schema],s=i[zC.Symbol.OriginalName],c=e===s?void 0:r.alias;t.push(V`${V.raw(r.joinType)} join${a} ${n?V`${V.identifier(n)}.`:void 0}${V.identifier(s)}${c&&V` ${V.identifier(c)}`}${o}`)}else if(R(i,ix)){let e=i[Ib].name,n=i[Ib].schema,s=i[Ib].originalName,c=e===s?void 0:r.alias;t.push(V`${V.raw(r.joinType)} join${a} ${n?V`${V.identifier(n)}.`:void 0}${V.identifier(s)}${c&&V` ${V.identifier(c)}`}${o}`)}else t.push(V`${V.raw(r.joinType)} join${a} ${i}${o}`);n<e.length-1&&t.push(V` `)}return V.join(t)}buildFromTable(e){if(R(e,z)&&e[z.Symbol.IsAlias]){let t=V`${V.identifier(e[z.Symbol.OriginalName])}`;return e[z.Symbol.Schema]&&(t=V`${V.identifier(e[z.Symbol.Schema])}.${t}`),V`${t} ${V.identifier(e[z.Symbol.Name])}`}return e}buildSelectQuery({withList:e,fields:t,fieldsFlat:n,where:r,having:i,table:a,joins:o,orderBy:s,groupBy:c,limit:l,offset:u,lockingClause:d,distinct:f,setOperators:p}){let m=n??yx(t);for(let e of m)if(R(e.field,ib)&&Gb(e.field.table)!==(R(a,Nb)?a._.alias:R(a,aT)?a[Ib].name:R(a,B)?void 0:Gb(a))&&!(e=>o?.some(({alias:t})=>t===(e[z.Symbol.IsAlias]?Gb(e):e[z.Symbol.BaseName])))(e.field.table)){let t=Gb(e.field.table);throw Error(`Your "${e.path.join(`->`)}" field references a column "${t}"."${e.field.name}", but the table "${t}" is not part of the query! Did you forget to join it?`)}let h=!o||o.length===0,g=this.buildWithCTE(e),_;f&&(_=f===!0?V` distinct`:V` distinct on (${V.join(f.on,V`, `)})`);let v=this.buildSelection(m,{isSingleTable:h}),y=this.buildFromTable(a),b=this.buildJoins(o),x=r?V` where ${r}`:void 0,S=i?V` having ${i}`:void 0,C;s&&s.length>0&&(C=V` order by ${V.join(s,V`, `)}`);let w;c&&c.length>0&&(w=V` group by ${V.join(c,V`, `)}`);let T=typeof l==`object`||typeof l==`number`&&l>=0?V` limit ${l}`:void 0,E=u?V` offset ${u}`:void 0,D=V.empty();if(d){let e=V` for ${V.raw(d.strength)}`;d.config.of&&e.append(V` of ${V.join(Array.isArray(d.config.of)?d.config.of:[d.config.of],V`, `)}`),d.config.noWait?e.append(V` nowait`):d.config.skipLocked&&e.append(V` skip locked`),D.append(e)}let ee=V`${g}select${_} ${v} from ${y}${b}${x}${w}${S}${C}${T}${E}${D}`;return p.length>0?this.buildSetOperations(ee,p):ee}buildSetOperations(e,t){let[n,...r]=t;if(!n)throw Error(`Cannot pass undefined values to any set operator`);return r.length===0?this.buildSetOperationQuery({leftSelect:e,setOperator:n}):this.buildSetOperations(this.buildSetOperationQuery({leftSelect:e,setOperator:n}),r)}buildSetOperationQuery({leftSelect:e,setOperator:{type:t,isAll:n,rightSelect:r,limit:i,orderBy:a,offset:o}}){let s=V`(${e.getSQL()}) `,c=V`(${r.getSQL()})`,l;if(a&&a.length>0){let e=[];for(let t of a)if(R(t,bb))e.push(V.identifier(t.name));else if(R(t,B)){for(let e=0;e<t.queryChunks.length;e++){let n=t.queryChunks[e];R(n,bb)&&(t.queryChunks[e]=V.identifier(n.name))}e.push(V`${t}`)}else e.push(V`${t}`);l=V` order by ${V.join(e,V`, `)} `}let u=typeof i==`object`||typeof i==`number`&&i>=0?V` limit ${i}`:void 0,d=V.raw(`${t} ${n?`all `:``}`),f=o?V` offset ${o}`:void 0;return V`${s}${d}${c}${l}${u}${f}`}buildInsertQuery({table:e,values:t,onConflict:n,returning:r,withList:i,select:a,overridingSystemValue_:o}){let s=[],c=e[z.Symbol.Columns],l=Object.entries(c).filter(([e,t])=>!t.shouldDisableInsert()),u=l.map(([,e])=>V.identifier(this.casing.getColumnCasing(e)));if(a){let e=t;R(e,B)?s.push(e):s.push(e.getSQL())}else{let e=t;s.push(V.raw(`values `));for(let[t,n]of e.entries()){let r=[];for(let[e,t]of l){let i=n[e];if(i===void 0||R(i,ex)&&i.value===void 0){if(t.defaultFn!==void 0){let e=t.defaultFn(),n=R(e,B)?e:V.param(e,t);r.push(n)}else if(!t.default&&t.onUpdateFn!==void 0){let e=t.onUpdateFn(),n=R(e,B)?e:V.param(e,t);r.push(n)}else r.push(V`default`)}else r.push(i)}s.push(r),t<e.length-1&&s.push(V`, `)}}let d=this.buildWithCTE(i),f=V.join(s),p=r?V` returning ${this.buildSelection(r,{isSingleTable:!0})}`:void 0,m=n?V` on conflict ${n}`:void 0,h=o===!0?V`overriding system value `:void 0;return V`${d}insert into ${e} ${u} ${h}${f}${m}${p}`}buildRefreshMaterializedViewQuery({view:e,concurrently:t,withNoData:n}){let r=t?V` concurrently`:void 0,i=n?V` with no data`:void 0;return V`refresh materialized view${r} ${e}${i}`}prepareTyping(e){return R(e,vS)||R(e,hS)?`json`:R(e,MS)?`decimal`:R(e,fC)?`time`:R(e,hC)||R(e,_C)?`timestamp`:R(e,Qx)||R(e,eS)?`date`:R(e,yC)?`uuid`:`none`}sqlToQuery(e,t){return e.toQuery({casing:this.casing,escapeName:this.escapeName,escapeParam:this.escapeParam,escapeString:this.escapeString,prepareTyping:this.prepareTyping,invokeSource:t})}buildRelationalQueryWithoutPK({fullSchema:e,schema:t,tableNamesMap:n,table:r,tableConfig:i,queryConfig:a,tableAlias:o,nestedQueryRelation:s,joinOn:c}){let l=[],u,d,f=[],p,m=[];if(a===!0)l=Object.entries(i.columns).map(([e,t])=>({dbKey:t.name,tsKey:e,field:cx(t,o),relationTableTsKey:void 0,isJson:!1,selection:[]}));else{let r=Object.fromEntries(Object.entries(i.columns).map(([e,t])=>[e,cx(t,o)]));if(a.where){let e=typeof a.where==`function`?a.where(r,vw()):a.where;p=e&&ux(e,o)}let s=[],c=[];if(a.columns){let e=!1;for(let[t,n]of Object.entries(a.columns))n!==void 0&&t in i.columns&&(!e&&n===!0&&(e=!0),c.push(t));c.length>0&&(c=e?c.filter(e=>a.columns?.[e]===!0):Object.keys(i.columns).filter(e=>!c.includes(e)))}else c=Object.keys(i.columns);for(let e of c){let t=i.columns[e];s.push({tsKey:e,value:t})}let h=[];a.with&&(h=Object.entries(a.with).filter(e=>!!e[1]).map(([e,t])=>({tsKey:e,queryConfig:t,relation:i.relations[e]})));let g;if(a.extras){g=typeof a.extras==`function`?a.extras(r,{sql:V}):a.extras;for(let[e,t]of Object.entries(g))s.push({tsKey:e,value:lx(t,o)})}for(let{tsKey:e,value:t}of s)l.push({dbKey:R(t,B.Aliased)?t.fieldAlias:i.columns[e].name,tsKey:e,field:R(t,ib)?cx(t,o):t,relationTableTsKey:void 0,isJson:!1,selection:[]});let _=typeof a.orderBy==`function`?a.orderBy(r,yw()):a.orderBy??[];Array.isArray(_)||(_=[_]),f=_.map(e=>R(e,ib)?cx(e,o):ux(e,o)),u=a.limit,d=a.offset;for(let{tsKey:r,queryConfig:i,relation:a}of h){let s=ww(t,n,a),c=n[Kb(a.referencedTable)],u=`${o}_${r}`,d=qC(...s.fields.map((e,t)=>W(cx(s.references[t],u),cx(e,o)))),f=this.buildRelationalQueryWithoutPK({fullSchema:e,schema:t,tableNamesMap:n,table:e[c],tableConfig:t[c],queryConfig:R(a,gw)?i===!0?{limit:1}:{...i,limit:1}:i,tableAlias:u,joinOn:d,nestedQueryRelation:a}),p=V`${V.identifier(u)}.${V.identifier(`data`)}`.as(r);m.push({on:V`true`,table:new Nb(f.sql,{},u),alias:u,joinType:`left`,lateral:!0}),l.push({dbKey:r,tsKey:r,field:p,relationTableTsKey:c,isJson:!0,selection:f.selection})}}if(l.length===0)throw new dx({message:`No fields selected for table "${i.tsName}" ("${o}")`});let h;if(p=qC(c,p),s){let e=V`json_build_array(${V.join(l.map(({field:e,tsKey:t,isJson:n})=>n?V`${V.identifier(`${o}_${t}`)}.${V.identifier(`data`)}`:R(e,B.Aliased)?e.sql:e),V`, `)})`;R(s,_w)&&(e=V`coalesce(json_agg(${e}${f.length>0?V` order by ${V.join(f,V`, `)}`:void 0}), '[]'::json)`);let t=[{dbKey:`data`,tsKey:`data`,field:e.as(`data`),isJson:!0,relationTableTsKey:i.tsName,selection:l}];u!==void 0||d!==void 0||f.length>0?(h=this.buildSelectQuery({table:sx(r,o),fields:{},fieldsFlat:[{path:[],field:V.raw(`*`)}],where:p,limit:u,offset:d,orderBy:f,setOperators:[]}),p=void 0,u=void 0,d=void 0,f=[]):h=sx(r,o),h=this.buildSelectQuery({table:R(h,zC)?h:new Nb(h,{},o),fields:{},fieldsFlat:t.map(({field:e})=>({path:[],field:R(e,ib)?cx(e,o):e})),joins:m,where:p,limit:u,offset:d,orderBy:f,setOperators:[]})}else h=this.buildSelectQuery({table:sx(r,o),fields:{},fieldsFlat:l.map(({field:e})=>({path:[],field:R(e,ib)?cx(e,o):e})),joins:m,where:p,limit:u,offset:d,orderBy:f,setOperators:[]});return{tableTsKey:i.tsName,sql:h,selection:l}}},sT=class{static[L]=`TypedQueryBuilder`;getSelectedFields(){return this._.selectedFields}},cT=class{static[L]=`PgSelectBuilder`;fields;session;dialect;withList=[];distinct;constructor(e){this.fields=e.fields,this.session=e.session,this.dialect=e.dialect,e.withList&&(this.withList=e.withList),this.distinct=e.distinct}authToken;setToken(e){return this.authToken=e,this}from(e){let t=!!this.fields,n=e,r;return r=this.fields?this.fields:R(n,Nb)?Object.fromEntries(Object.keys(n._.selectedFields).map(e=>[e,n[e]])):R(n,aT)?n[Ib].selectedFields:R(n,B)?{}:Cx(n),new uT({table:n,fields:r,isPartialSelect:t,session:this.session,dialect:this.dialect,withList:this.withList,distinct:this.distinct}).setToken(this.authToken)}},lT=class extends sT{static[L]=`PgSelectQueryBuilder`;_;config;joinsNotNullableMap;tableName;isPartialSelect;session;dialect;cacheConfig=void 0;usedTables=new Set;constructor({table:e,fields:t,isPartialSelect:n,session:r,dialect:i,withList:a,distinct:o}){super(),this.config={withList:a,table:e,fields:{...t},distinct:o,setOperators:[]},this.isPartialSelect=n,this.session=r,this.dialect=i,this._={selectedFields:t,config:this.config},this.tableName=wx(e),this.joinsNotNullableMap=typeof this.tableName==`string`?{[this.tableName]:!0}:{};for(let t of jT(e))this.usedTables.add(t)}getUsedTables(){return[...this.usedTables]}createJoin(e,t){return(n,r)=>{let i=this.tableName,a=wx(n);for(let e of jT(n))this.usedTables.add(e);if(typeof a==`string`&&this.config.joins?.some(e=>e.alias===a))throw Error(`Alias "${a}" is already used in this query`);if(!this.isPartialSelect&&(Object.keys(this.joinsNotNullableMap).length===1&&typeof i==`string`&&(this.config.fields={[i]:this.config.fields}),typeof a==`string`&&!R(n,B))){let e=R(n,Nb)?n._.selectedFields:R(n,ix)?n[Ib].selectedFields:n[z.Symbol.Columns];this.config.fields[a]=e}if(typeof r==`function`&&(r=r(new Proxy(this.config.fields,new Jw({sqlAliasedBehavior:`sql`,sqlBehavior:`sql`})))),this.config.joins||(this.config.joins=[]),this.config.joins.push({on:r,table:n,joinType:e,alias:a,lateral:t}),typeof a==`string`)switch(e){case`left`:this.joinsNotNullableMap[a]=!1;break;case`right`:this.joinsNotNullableMap=Object.fromEntries(Object.entries(this.joinsNotNullableMap).map(([e])=>[e,!1])),this.joinsNotNullableMap[a]=!0;break;case`cross`:case`inner`:this.joinsNotNullableMap[a]=!0;break;case`full`:this.joinsNotNullableMap=Object.fromEntries(Object.entries(this.joinsNotNullableMap).map(([e])=>[e,!1])),this.joinsNotNullableMap[a]=!1}return this}}leftJoin=this.createJoin(`left`,!1);leftJoinLateral=this.createJoin(`left`,!0);rightJoin=this.createJoin(`right`,!1);innerJoin=this.createJoin(`inner`,!1);innerJoinLateral=this.createJoin(`inner`,!0);fullJoin=this.createJoin(`full`,!1);crossJoin=this.createJoin(`cross`,!1);crossJoinLateral=this.createJoin(`cross`,!0);createSetOperator(e,t){return n=>{let r=typeof n==`function`?n(fT()):n;if(!bx(this.getSelectedFields(),r.getSelectedFields()))throw Error(`Set operator error (union / intersect / except): selected fields are not the same or are in a different order`);return this.config.setOperators.push({type:e,isAll:t,rightSelect:r}),this}}union=this.createSetOperator(`union`,!1);unionAll=this.createSetOperator(`union`,!0);intersect=this.createSetOperator(`intersect`,!1);intersectAll=this.createSetOperator(`intersect`,!0);except=this.createSetOperator(`except`,!1);exceptAll=this.createSetOperator(`except`,!0);addSetOperators(e){return this.config.setOperators.push(...e),this}where(e){return typeof e==`function`&&(e=e(new Proxy(this.config.fields,new Jw({sqlAliasedBehavior:`sql`,sqlBehavior:`sql`})))),this.config.where=e,this}having(e){return typeof e==`function`&&(e=e(new Proxy(this.config.fields,new Jw({sqlAliasedBehavior:`sql`,sqlBehavior:`sql`})))),this.config.having=e,this}groupBy(...e){if(typeof e[0]==`function`){let t=e[0](new Proxy(this.config.fields,new Jw({sqlAliasedBehavior:`alias`,sqlBehavior:`sql`})));this.config.groupBy=Array.isArray(t)?t:[t]}else this.config.groupBy=e;return this}orderBy(...e){if(typeof e[0]==`function`){let t=e[0](new Proxy(this.config.fields,new Jw({sqlAliasedBehavior:`alias`,sqlBehavior:`sql`}))),n=Array.isArray(t)?t:[t];this.config.setOperators.length>0?this.config.setOperators.at(-1).orderBy=n:this.config.orderBy=n}else{let t=e;this.config.setOperators.length>0?this.config.setOperators.at(-1).orderBy=t:this.config.orderBy=t}return this}limit(e){return this.config.setOperators.length>0?this.config.setOperators.at(-1).limit=e:this.config.limit=e,this}offset(e){return this.config.setOperators.length>0?this.config.setOperators.at(-1).offset=e:this.config.offset=e,this}for(e,t={}){return this.config.lockingClause={strength:e,config:t},this}getSQL(){return this.dialect.buildSelectQuery(this.config)}toSQL(){let{typings:e,...t}=this.dialect.sqlToQuery(this.getSQL());return t}as(e){let t=[];if(t.push(...jT(this.config.table)),this.config.joins)for(let e of this.config.joins)t.push(...jT(e.table));return new Proxy(new Nb(this.getSQL(),this.config.fields,e,!1,[...new Set(t)]),new Jw({alias:e,sqlAliasedBehavior:`alias`,sqlBehavior:`error`}))}getSelectedFields(){return new Proxy(this.config.fields,new Jw({alias:this.tableName,sqlAliasedBehavior:`alias`,sqlBehavior:`error`}))}$dynamic(){return this}$withCache(e){return this.cacheConfig=e===void 0?{config:{},enable:!0,autoInvalidate:!0}:e===!1?{enable:!1}:{enable:!0,autoInvalidate:!0,...e},this}},uT=class extends lT{static[L]=`PgSelect`;_prepare(e){let{session:t,config:n,dialect:r,joinsNotNullableMap:i,authToken:a,cacheConfig:o,usedTables:s}=this;if(!t)throw Error(`Cannot execute a query on a query builder. Please use a database instance instead.`);let{fields:c}=n;return Fb.startActiveSpan(`drizzle.prepareQuery`,()=>{let n=yx(c),l=t.prepareQuery(r.sqlToQuery(this.getSQL()),n,e,!0,void 0,{type:`select`,tables:[...s]},o);return l.joinsNotNullableMap=i,l.setToken(a)})}prepare(e){return this._prepare(e)}authToken;setToken(e){return this.authToken=e,this}execute=e=>Fb.startActiveSpan(`drizzle.operation`,()=>this._prepare().execute(e,this.authToken))};Sx(uT,[_x]);function dT(e,t){return(n,r,...i)=>{let a=[r,...i].map(n=>({type:e,isAll:t,rightSelect:n}));for(let e of a)if(!bx(n.getSelectedFields(),e.rightSelect.getSelectedFields()))throw Error(`Set operator error (union / intersect / except): selected fields are not the same or are in a different order`);return n.addSetOperators(a)}}var fT=()=>({union:pT,unionAll:mT,intersect:hT,intersectAll:gT,except:_T,exceptAll:vT}),pT=dT(`union`,!1),mT=dT(`union`,!0),hT=dT(`intersect`,!1),gT=dT(`intersect`,!0),_T=dT(`except`,!1),vT=dT(`except`,!0),yT=class{static[L]=`PgQueryBuilder`;dialect;dialectConfig;constructor(e){this.dialect=R(e,oT)?e:void 0,this.dialectConfig=R(e,oT)?void 0:e}$with=(e,t)=>{let n=this;return{as:r=>(typeof r==`function`&&(r=r(n)),new Proxy(new Pb(r.getSQL(),t??(`getSelectedFields`in r?r.getSelectedFields()??{}:{}),e,!0),new Jw({alias:e,sqlAliasedBehavior:`alias`,sqlBehavior:`error`})))}};with(...e){let t=this;function n(n){return new cT({fields:n??void 0,session:void 0,dialect:t.getDialect(),withList:e})}function r(e){return new cT({fields:e??void 0,session:void 0,dialect:t.getDialect(),distinct:!0})}function i(e,n){return new cT({fields:n??void 0,session:void 0,dialect:t.getDialect(),distinct:{on:e}})}return{select:n,selectDistinct:r,selectDistinctOn:i}}select(e){return new cT({fields:e??void 0,session:void 0,dialect:this.getDialect()})}selectDistinct(e){return new cT({fields:e??void 0,session:void 0,dialect:this.getDialect(),distinct:!0})}selectDistinctOn(e,t){return new cT({fields:t??void 0,session:void 0,dialect:this.getDialect(),distinct:{on:e}})}getDialect(){return this.dialect||=new oT(this.dialectConfig),this.dialect}},bT=class{constructor(e,t){this.name=e,this.schema=t}static[L]=`PgDefaultViewBuilderCore`;config={};with(e){return this.config.with=e,this}},xT=class extends bT{static[L]=`PgViewBuilder`;as(e){typeof e==`function`&&(e=e(new yT));let t=new Jw({alias:this.name,sqlBehavior:`error`,sqlAliasedBehavior:`alias`,replaceOriginalName:!0}),n=new Proxy(e.getSelectedFields(),t);return new Proxy(new ET({pgConfig:this.config,config:{name:this.name,schema:this.schema,selectedFields:n,query:e.getSQL().inlineParams()}}),t)}},ST=class extends bT{static[L]=`PgManualViewBuilder`;columns;constructor(e,t,n){super(e,n),this.columns=Cx(VC(e,t))}existing(){return new Proxy(new ET({pgConfig:void 0,config:{name:this.name,schema:this.schema,selectedFields:this.columns,query:void 0}}),new Jw({alias:this.name,sqlBehavior:`error`,sqlAliasedBehavior:`alias`,replaceOriginalName:!0}))}as(e){return new Proxy(new ET({pgConfig:this.config,config:{name:this.name,schema:this.schema,selectedFields:this.columns,query:e.inlineParams()}}),new Jw({alias:this.name,sqlBehavior:`error`,sqlAliasedBehavior:`alias`,replaceOriginalName:!0}))}},CT=class{constructor(e,t){this.name=e,this.schema=t}static[L]=`PgMaterializedViewBuilderCore`;config={};using(e){return this.config.using=e,this}with(e){return this.config.with=e,this}tablespace(e){return this.config.tablespace=e,this}withNoData(){return this.config.withNoData=!0,this}},wT=class extends CT{static[L]=`PgMaterializedViewBuilder`;as(e){typeof e==`function`&&(e=e(new yT));let t=new Jw({alias:this.name,sqlBehavior:`error`,sqlAliasedBehavior:`alias`,replaceOriginalName:!0}),n=new Proxy(e.getSelectedFields(),t);return new Proxy(new OT({pgConfig:{with:this.config.with,using:this.config.using,tablespace:this.config.tablespace,withNoData:this.config.withNoData},config:{name:this.name,schema:this.schema,selectedFields:n,query:e.getSQL().inlineParams()}}),t)}},TT=class extends CT{static[L]=`PgManualMaterializedViewBuilder`;columns;constructor(e,t,n){super(e,n),this.columns=Cx(VC(e,t))}existing(){return new Proxy(new OT({pgConfig:{tablespace:this.config.tablespace,using:this.config.using,with:this.config.with,withNoData:this.config.withNoData},config:{name:this.name,schema:this.schema,selectedFields:this.columns,query:void 0}}),new Jw({alias:this.name,sqlBehavior:`error`,sqlAliasedBehavior:`alias`,replaceOriginalName:!0}))}as(e){return new Proxy(new OT({pgConfig:{tablespace:this.config.tablespace,using:this.config.using,with:this.config.with,withNoData:this.config.withNoData},config:{name:this.name,schema:this.schema,selectedFields:this.columns,query:e.inlineParams()}}),new Jw({alias:this.name,sqlBehavior:`error`,sqlAliasedBehavior:`alias`,replaceOriginalName:!0}))}},ET=class extends aT{static[L]=`PgView`;[eT];constructor({pgConfig:e,config:t}){super(t),e&&(this[eT]={with:e.with})}},DT=Symbol.for(`drizzle:PgMaterializedViewConfig`),OT=class extends aT{static[L]=`PgMaterializedView`;[DT];constructor({pgConfig:e,config:t}){super(t),this[DT]={with:e?.with,using:e?.using,tablespace:e?.tablespace,withNoData:e?.withNoData}}};function kT(e,t,n){return t?new ST(e,t,n):new xT(e,n)}function AT(e,t,n){return t?new TT(e,t,n):new wT(e,n)}function jT(e){return R(e,zC)?[e[Lb]?`${e[Lb]}.${e[z.Symbol.BaseName]}`:e[z.Symbol.BaseName]]:R(e,Nb)?e._.usedTables??[]:R(e,B)?e.usedTables??[]:[]}var MT=class extends _x{constructor(e,t,n,r){super(),this.session=t,this.dialect=n,this.config={table:e,withList:r}}static[L]=`PgDelete`;config;cacheConfig;where(e){return this.config.where=e,this}returning(e=this.config.table[z.Symbol.Columns]){return this.config.returningFields=e,this.config.returning=yx(e),this}getSQL(){return this.dialect.buildDeleteQuery(this.config)}toSQL(){let{typings:e,...t}=this.dialect.sqlToQuery(this.getSQL());return t}_prepare(e){return Fb.startActiveSpan(`drizzle.prepareQuery`,()=>this.session.prepareQuery(this.dialect.sqlToQuery(this.getSQL()),this.config.returning,e,!0,void 0,{type:`delete`,tables:jT(this.config.table)},this.cacheConfig))}prepare(e){return this._prepare(e)}authToken;setToken(e){return this.authToken=e,this}execute=e=>Fb.startActiveSpan(`drizzle.operation`,()=>this._prepare().execute(e,this.authToken));getSelectedFields(){return this.config.returningFields?new Proxy(this.config.returningFields,new Jw({alias:Gb(this.config.table),sqlAliasedBehavior:`alias`,sqlBehavior:`error`})):void 0}$dynamic(){return this}},NT=class{constructor(e,t,n,r,i){this.table=e,this.session=t,this.dialect=n,this.withList=r,this.overridingSystemValue_=i}static[L]=`PgInsertBuilder`;authToken;setToken(e){return this.authToken=e,this}overridingSystemValue(){return this.overridingSystemValue_=!0,this}values(e){if(e=Array.isArray(e)?e:[e],e.length===0)throw Error(`values() must be called with at least one value`);let t=e.map(e=>{let t={},n=this.table[z.Symbol.Columns];for(let r of Object.keys(e)){let i=e[r];t[r]=R(i,B)?i:new ex(i,n[r])}return t});return new PT(this.table,t,this.session,this.dialect,this.withList,!1,this.overridingSystemValue_).setToken(this.authToken)}select(e){let t=typeof e==`function`?e(new yT):e;if(!R(t,B)&&!bx(this.table[Rb],t._.selectedFields))throw Error(`Insert select error: selected fields are not the same or are in a different order compared to the table definition`);return new PT(this.table,t,this.session,this.dialect,this.withList,!0)}},PT=class extends _x{constructor(e,t,n,r,i,a,o){super(),this.session=n,this.dialect=r,this.config={table:e,values:t,withList:i,select:a,overridingSystemValue_:o}}static[L]=`PgInsert`;config;cacheConfig;returning(e=this.config.table[z.Symbol.Columns]){return this.config.returningFields=e,this.config.returning=yx(e),this}onConflictDoNothing(e={}){if(e.target===void 0)this.config.onConflict=V`do nothing`;else{let t=``;t=Array.isArray(e.target)?e.target.map(e=>this.dialect.escapeName(this.dialect.casing.getColumnCasing(e))).join(`,`):this.dialect.escapeName(this.dialect.casing.getColumnCasing(e.target));let n=e.where?V` where ${e.where}`:void 0;this.config.onConflict=V`(${V.raw(t)})${n} do nothing`}return this}onConflictDoUpdate(e){if(e.where&&(e.targetWhere||e.setWhere))throw Error(`You cannot use both "where" and "targetWhere"/"setWhere" at the same time - "where" is deprecated, use "targetWhere" or "setWhere" instead.`);let t=e.where?V` where ${e.where}`:void 0,n=e.targetWhere?V` where ${e.targetWhere}`:void 0,r=e.setWhere?V` where ${e.setWhere}`:void 0,i=this.dialect.buildUpdateSet(this.config.table,xx(this.config.table,e.set)),a=``;return a=Array.isArray(e.target)?e.target.map(e=>this.dialect.escapeName(this.dialect.casing.getColumnCasing(e))).join(`,`):this.dialect.escapeName(this.dialect.casing.getColumnCasing(e.target)),this.config.onConflict=V`(${V.raw(a)})${n} do update set ${i}${t}${r}`,this}getSQL(){return this.dialect.buildInsertQuery(this.config)}toSQL(){let{typings:e,...t}=this.dialect.sqlToQuery(this.getSQL());return t}_prepare(e){return Fb.startActiveSpan(`drizzle.prepareQuery`,()=>this.session.prepareQuery(this.dialect.sqlToQuery(this.getSQL()),this.config.returning,e,!0,void 0,{type:`insert`,tables:jT(this.config.table)},this.cacheConfig))}prepare(e){return this._prepare(e)}authToken;setToken(e){return this.authToken=e,this}execute=e=>Fb.startActiveSpan(`drizzle.operation`,()=>this._prepare().execute(e,this.authToken));getSelectedFields(){return this.config.returningFields?new Proxy(this.config.returningFields,new Jw({alias:Gb(this.config.table),sqlAliasedBehavior:`alias`,sqlBehavior:`error`})):void 0}$dynamic(){return this}},FT=class extends _x{constructor(e,t,n){super(),this.session=t,this.dialect=n,this.config={view:e}}static[L]=`PgRefreshMaterializedView`;config;concurrently(){if(this.config.withNoData!==void 0)throw Error(`Cannot use concurrently and withNoData together`);return this.config.concurrently=!0,this}withNoData(){if(this.config.concurrently!==void 0)throw Error(`Cannot use concurrently and withNoData together`);return this.config.withNoData=!0,this}getSQL(){return this.dialect.buildRefreshMaterializedViewQuery(this.config)}toSQL(){let{typings:e,...t}=this.dialect.sqlToQuery(this.getSQL());return t}_prepare(e){return Fb.startActiveSpan(`drizzle.prepareQuery`,()=>this.session.prepareQuery(this.dialect.sqlToQuery(this.getSQL()),void 0,e,!0))}prepare(e){return this._prepare(e)}authToken;setToken(e){return this.authToken=e,this}execute=e=>Fb.startActiveSpan(`drizzle.operation`,()=>this._prepare().execute(e,this.authToken))},IT=class{constructor(e,t,n,r){this.table=e,this.session=t,this.dialect=n,this.withList=r}static[L]=`PgUpdateBuilder`;authToken;setToken(e){return this.authToken=e,this}set(e){return new LT(this.table,xx(this.table,e),this.session,this.dialect,this.withList).setToken(this.authToken)}},LT=class extends _x{constructor(e,t,n,r,i){super(),this.session=n,this.dialect=r,this.config={set:t,table:e,withList:i,joins:[]},this.tableName=wx(e),this.joinsNotNullableMap=typeof this.tableName==`string`?{[this.tableName]:!0}:{}}static[L]=`PgUpdate`;config;tableName;joinsNotNullableMap;cacheConfig;from(e){let t=e,n=wx(t);return typeof n==`string`&&(this.joinsNotNullableMap[n]=!0),this.config.from=t,this}getTableLikeFields(e){return R(e,zC)?e[z.Symbol.Columns]:R(e,Nb)?e._.selectedFields:e[Ib].selectedFields}createJoin(e){return(t,n)=>{let r=wx(t);if(typeof r==`string`&&this.config.joins.some(e=>e.alias===r))throw Error(`Alias "${r}" is already used in this query`);if(typeof n==`function`){let e=this.config.from&&!R(this.config.from,B)?this.getTableLikeFields(this.config.from):void 0;n=n(new Proxy(this.config.table[z.Symbol.Columns],new Jw({sqlAliasedBehavior:`sql`,sqlBehavior:`sql`})),e&&new Proxy(e,new Jw({sqlAliasedBehavior:`sql`,sqlBehavior:`sql`})))}if(this.config.joins.push({on:n,table:t,joinType:e,alias:r}),typeof r==`string`)switch(e){case`left`:this.joinsNotNullableMap[r]=!1;break;case`right`:this.joinsNotNullableMap=Object.fromEntries(Object.entries(this.joinsNotNullableMap).map(([e])=>[e,!1])),this.joinsNotNullableMap[r]=!0;break;case`inner`:this.joinsNotNullableMap[r]=!0;break;case`full`:this.joinsNotNullableMap=Object.fromEntries(Object.entries(this.joinsNotNullableMap).map(([e])=>[e,!1])),this.joinsNotNullableMap[r]=!1}return this}}leftJoin=this.createJoin(`left`);rightJoin=this.createJoin(`right`);innerJoin=this.createJoin(`inner`);fullJoin=this.createJoin(`full`);where(e){return this.config.where=e,this}returning(e){if(!e&&(e=Object.assign({},this.config.table[z.Symbol.Columns]),this.config.from)){let t=wx(this.config.from);if(typeof t==`string`&&this.config.from&&!R(this.config.from,B)){let n=this.getTableLikeFields(this.config.from);e[t]=n}for(let t of this.config.joins){let n=wx(t.table);if(typeof n==`string`&&!R(t.table,B)){let r=this.getTableLikeFields(t.table);e[n]=r}}}return this.config.returningFields=e,this.config.returning=yx(e),this}getSQL(){return this.dialect.buildUpdateQuery(this.config)}toSQL(){let{typings:e,...t}=this.dialect.sqlToQuery(this.getSQL());return t}_prepare(e){let t=this.session.prepareQuery(this.dialect.sqlToQuery(this.getSQL()),this.config.returning,e,!0,void 0,{type:`insert`,tables:jT(this.config.table)},this.cacheConfig);return t.joinsNotNullableMap=this.joinsNotNullableMap,t}prepare(e){return this._prepare(e)}authToken;setToken(e){return this.authToken=e,this}execute=e=>this._prepare().execute(e,this.authToken);getSelectedFields(){return this.config.returningFields?new Proxy(this.config.returningFields,new Jw({alias:Gb(this.config.table),sqlAliasedBehavior:`alias`,sqlBehavior:`error`})):void 0}$dynamic(){return this}},RT=class e extends B{constructor(t){super(e.buildEmbeddedCount(t.source,t.filters).queryChunks),this.params=t,this.mapWith(Number),this.session=t.session,this.sql=e.buildCount(t.source,t.filters)}sql;token;static[L]=`PgCountBuilder`;[Symbol.toStringTag]=`PgCountBuilder`;session;static buildEmbeddedCount(e,t){return V`(select count(*) from ${e}${V.raw(` where `).if(t)}${t})`}static buildCount(e,t){return V`select count(*) as count from ${e}${V.raw(` where `).if(t)}${t};`}setToken(e){return this.token=e,this}then(e,t){return Promise.resolve(this.session.count(this.sql,this.token)).then(e,t)}catch(e){return this.then(void 0,e)}finally(e){return this.then(t=>(e?.(),t),t=>{throw e?.(),t})}},zT=class{constructor(e,t,n,r,i,a,o){this.fullSchema=e,this.schema=t,this.tableNamesMap=n,this.table=r,this.tableConfig=i,this.dialect=a,this.session=o}static[L]=`PgRelationalQueryBuilder`;findMany(e){return new BT(this.fullSchema,this.schema,this.tableNamesMap,this.table,this.tableConfig,this.dialect,this.session,e||{},`many`)}findFirst(e){return new BT(this.fullSchema,this.schema,this.tableNamesMap,this.table,this.tableConfig,this.dialect,this.session,e?{...e,limit:1}:{limit:1},`first`)}},BT=class extends _x{constructor(e,t,n,r,i,a,o,s,c){super(),this.fullSchema=e,this.schema=t,this.tableNamesMap=n,this.table=r,this.tableConfig=i,this.dialect=a,this.session=o,this.config=s,this.mode=c}static[L]=`PgRelationalQuery`;_prepare(e){return Fb.startActiveSpan(`drizzle.prepareQuery`,()=>{let{query:t,builtQuery:n}=this._toSQL();return this.session.prepareQuery(n,void 0,e,!0,(e,n)=>{let r=e.map(e=>Ew(this.schema,this.tableConfig,e,t.selection,n));return this.mode===`first`?r[0]:r})})}prepare(e){return this._prepare(e)}_getQuery(){return this.dialect.buildRelationalQueryWithoutPK({fullSchema:this.fullSchema,schema:this.schema,tableNamesMap:this.tableNamesMap,table:this.table,tableConfig:this.tableConfig,queryConfig:this.config,tableAlias:this.tableConfig.tsName})}getSQL(){return this._getQuery().sql}_toSQL(){let e=this._getQuery();return{query:e,builtQuery:this.dialect.sqlToQuery(e.sql)}}toSQL(){return this._toSQL().builtQuery}authToken;setToken(e){return this.authToken=e,this}execute(){return Fb.startActiveSpan(`drizzle.operation`,()=>this._prepare().execute(void 0,this.authToken))}},VT=class extends _x{constructor(e,t,n,r){super(),this.execute=e,this.sql=t,this.query=n,this.mapBatchResult=r}static[L]=`PgRaw`;getSQL(){return this.sql}getQuery(){return this.query}mapResult(e,t){return t?this.mapBatchResult(e):e}_prepare(){return this}isResponseInArrayMode(){return!1}},HT=class{constructor(e,t,n){if(this.dialect=e,this.session=t,this._=n?{schema:n.schema,fullSchema:n.fullSchema,tableNamesMap:n.tableNamesMap,session:t}:{schema:void 0,fullSchema:{},tableNamesMap:{},session:t},this.query={},this._.schema)for(let[r,i]of Object.entries(this._.schema))this.query[r]=new zT(n.fullSchema,this._.schema,this._.tableNamesMap,n.fullSchema[r],i,e,t);this.$cache={invalidate:async e=>{}}}static[L]=`PgDatabase`;query;$with=(e,t)=>{let n=this;return{as:r=>(typeof r==`function`&&(r=r(new yT(n.dialect))),new Proxy(new Pb(r.getSQL(),t??(`getSelectedFields`in r?r.getSelectedFields()??{}:{}),e,!0),new Jw({alias:e,sqlAliasedBehavior:`alias`,sqlBehavior:`error`})))}};$count(e,t){return new RT({source:e,filters:t,session:this.session})}$cache;with(...e){let t=this;function n(n){return new cT({fields:n??void 0,session:t.session,dialect:t.dialect,withList:e})}function r(n){return new cT({fields:n??void 0,session:t.session,dialect:t.dialect,withList:e,distinct:!0})}function i(n,r){return new cT({fields:r??void 0,session:t.session,dialect:t.dialect,withList:e,distinct:{on:n}})}function a(n){return new IT(n,t.session,t.dialect,e)}function o(n){return new NT(n,t.session,t.dialect,e)}function s(n){return new MT(n,t.session,t.dialect,e)}return{select:n,selectDistinct:r,selectDistinctOn:i,update:a,insert:o,delete:s}}select(e){return new cT({fields:e??void 0,session:this.session,dialect:this.dialect})}selectDistinct(e){return new cT({fields:e??void 0,session:this.session,dialect:this.dialect,distinct:!0})}selectDistinctOn(e,t){return new cT({fields:t??void 0,session:this.session,dialect:this.dialect,distinct:{on:e}})}update(e){return new IT(e,this.session,this.dialect)}insert(e){return new NT(e,this.session,this.dialect)}delete(e){return new MT(e,this.session,this.dialect)}refreshMaterializedView(e){return new FT(e,this.session,this.dialect)}authToken;execute(e){let t=typeof e==`string`?V.raw(e):e.getSQL(),n=this.dialect.sqlToQuery(t),r=this.session.prepareQuery(n,void 0,void 0,!1);return new VT(()=>r.execute(void 0,this.authToken),t,n,e=>r.mapResult(e,!0))}transaction(e,t){return this.session.transaction(e,t)}},UT=class{constructor(e,t,n){this.seqName=e,this.seqOptions=t,this.schema=n}static[L]=`PgSequence`};function WT(e,t,n){return new UT(e,t,n)}var GT=class{constructor(e){this.schemaName=e}static[L]=`PgSchema`;table=(e,t,n)=>BC(e,t,n,this.schemaName);view=(e,t)=>kT(e,t,this.schemaName);materializedView=(e,t)=>AT(e,t,this.schemaName);enum(e,t){return Array.isArray(t)?jb(e,[...t],this.schemaName):Mb(e,t,this.schemaName)}sequence=(e,t)=>WT(e,t,this.schemaName);getSQL(){return new B([V.identifier(this.schemaName)])}shouldOmitSQLParens(){return!0}};function KT(e){if(e===`public`)throw Error(`You can't specify 'public' as schema name. Postgres is using public schema by default. If you want to use 'public' schema, just use pgTable() instead of creating a schema`);return new GT(e)}var qT=class{static[L]=`Cache`},JT=class extends qT{strategy(){return`all`}static[L]=`NoopCache`;async get(e){}async put(e,t,n,r){}async onMutate(e){}};async function YT(e,t){let n=`${e}-${JSON.stringify(t)}`,r=new TextEncoder().encode(n),i=await crypto.subtle.digest(`SHA-256`,r);return[...new Uint8Array(i)].map(e=>e.toString(16).padStart(2,`0`)).join(``)}var XT=class{constructor(e,t,n,r){this.query=e,this.cache=t,this.queryMetadata=n,this.cacheConfig=r,t&&t.strategy()===`all`&&r===void 0&&(this.cacheConfig={enable:!0,autoInvalidate:!0}),this.cacheConfig?.enable||(this.cacheConfig=void 0)}authToken;getQuery(){return this.query}mapResult(e,t){return e}setToken(e){return this.authToken=e,this}static[L]=`PgPreparedQuery`;joinsNotNullableMap;async queryWithCache(e,t,n){if(this.cache===void 0||R(this.cache,JT)||this.queryMetadata===void 0||this.cacheConfig&&!this.cacheConfig.enable)try{return await n()}catch(n){throw new fx(e,t,n)}if((this.queryMetadata.type===`insert`||this.queryMetadata.type===`update`||this.queryMetadata.type===`delete`)&&this.queryMetadata.tables.length>0)try{let[e]=await Promise.all([n(),this.cache.onMutate({tables:this.queryMetadata.tables})]);return e}catch(n){throw new fx(e,t,n)}if(!this.cacheConfig)try{return await n()}catch(n){throw new fx(e,t,n)}if(this.queryMetadata.type===`select`){let r=await this.cache.get(this.cacheConfig.tag??await YT(e,t),this.queryMetadata.tables,this.cacheConfig.tag!==void 0,this.cacheConfig.autoInvalidate);if(r===void 0){let r;try{r=await n()}catch(n){throw new fx(e,t,n)}return await this.cache.put(this.cacheConfig.tag??await YT(e,t),r,this.cacheConfig.autoInvalidate?this.queryMetadata.tables:[],this.cacheConfig.tag!==void 0,this.cacheConfig.config),r}return r}try{return await n()}catch(n){throw new fx(e,t,n)}}},ZT=class{constructor(e){this.dialect=e}static[L]=`PgSession`;execute(e,t){return Fb.startActiveSpan(`drizzle.operation`,()=>Fb.startActiveSpan(`drizzle.prepareQuery`,()=>this.prepareQuery(this.dialect.sqlToQuery(e),void 0,void 0,!1)).setToken(t).execute(void 0,t))}all(e){return this.prepareQuery(this.dialect.sqlToQuery(e),void 0,void 0,!1).all()}async count(e,t){let n=await this.execute(e,t);return Number(n[0].count)}},QT=class extends HT{constructor(e,t,n,r=0){super(e,t,n),this.schema=n,this.nestedIndex=r}static[L]=`PgTransaction`;rollback(){throw new px}getTransactionConfigSQL(e){let t=[];return e.isolationLevel&&t.push(`isolation level ${e.isolationLevel}`),e.accessMode&&t.push(e.accessMode),typeof e.deferrable==`boolean`&&t.push(e.deferrable?`deferrable`:`not deferrable`),V.raw(t.join(` `))}setTransaction(e){return this.session.execute(V`set transaction ${this.getTransactionConfigSQL(e)}`)}},$T=/^[a-z_][a-z0-9_]{0,62}$/,eE=(()=>{let e=globalThis.process?.env?.DATABASE_SCHEMA;if(e&&e!==`public`){if(!$T.test(e))throw Error(`Invalid DATABASE_SCHEMA: ${JSON.stringify(e)}. Set it to a lowercase Postgres schema name, such as pr_141, or leave it unset.`);return e}})(),tE=eE?KT(eE).table:VC,nE=tE(`account`,{accessToken:H(`access_token`),accessTokenExpiresAt:U(`access_token_expires_at`),accountId:H(`account_id`).notNull(),createdAt:U(`created_at`).defaultNow().notNull(),id:H(`id`).primaryKey(),idToken:H(`id_token`),password:H(`password`),providerId:H(`provider_id`).notNull(),refreshToken:H(`refresh_token`),refreshTokenExpiresAt:U(`refresh_token_expires_at`),scope:H(`scope`),updatedAt:U(`updated_at`).$onUpdate(()=>new Date).notNull(),userId:H(`user_id`).notNull().references(()=>bE.id,{onDelete:`cascade`})},e=>[Qw(`account_userId_idx`).on(e.userId)]),rE=xw(nE,({one:e})=>({user:e(bE,{fields:[nE.userId],references:[bE.id]})})),iE=tE(`device_code`,{acr:H(`acr`),amr:H(`amr`).array(),authTime:U(`auth_time`),clientId:H(`client_id`),deviceCode:H(`device_code`).notNull(),expiresAt:U(`expires_at`).notNull(),id:H(`id`).primaryKey(),lastPolledAt:U(`last_polled_at`),oauthClientId:H(`oauth_client_id`),pollingInterval:uS(`polling_interval`),referenceId:H(`reference_id`),resources:H(`resources`).array(),scope:H(`scope`),status:H(`status`).notNull(),userCode:H(`user_code`).notNull(),userId:H(`user_id`)},e=>[$w(`deviceCode_deviceCode_uidx`).on(e.deviceCode),Qw(`deviceCode_expiresAt_idx`).on(e.expiresAt),$w(`deviceCode_userCode_uidx`).on(e.userCode)]),aE=tE(`jwks`,{alg:H(`alg`),createdAt:U(`created_at`).notNull(),crv:H(`crv`),expiresAt:U(`expires_at`),id:H(`id`).primaryKey(),privateKey:H(`private_key`).notNull(),publicKey:H(`public_key`).notNull()}),oE=tE(`oauth_access_token`,{authorizationCodeId:H(`authorization_code_id`),clientId:H(`client_id`).notNull().references(()=>G.clientId,{onDelete:`cascade`}),confirmation:yS(`confirmation`),createdAt:U(`created_at`).notNull(),expiresAt:U(`expires_at`).notNull(),id:H(`id`).primaryKey(),referenceId:H(`reference_id`),refreshId:H(`refresh_id`).references(()=>mE.id,{onDelete:`cascade`}),requestedUserInfoClaims:H(`requested_user_info_claims`).array(),resources:H(`resources`).array(),revoked:U(`revoked`),scopes:H(`scopes`).array().notNull(),sessionId:H(`session_id`).references(()=>vE.id,{onDelete:`set null`}),token:H(`token`).notNull().unique(),userId:H(`user_id`).references(()=>bE.id,{onDelete:`cascade`})},e=>[Qw(`oauthAccessToken_authorizationCodeId_idx`).on(e.authorizationCodeId),Qw(`oauthAccessToken_clientId_idx`).on(e.clientId),Qw(`oauthAccessToken_expiresAt_idx`).on(e.expiresAt),Qw(`oauthAccessToken_refreshId_idx`).on(e.refreshId),Qw(`oauthAccessToken_sessionId_idx`).on(e.sessionId),Qw(`oauthAccessToken_userId_idx`).on(e.userId)]),sE=xw(oE,({one:e})=>({oauthClient:e(G,{fields:[oE.clientId],references:[G.clientId]}),oauthRefreshToken:e(mE,{fields:[oE.refreshId],references:[mE.id]}),session:e(vE,{fields:[oE.sessionId],references:[vE.id]}),user:e(bE,{fields:[oE.userId],references:[bE.id]})})),G=tE(`oauth_client`,{applicationType:H(`application_type`),backchannelLogoutSessionRequired:Bx(`backchannel_logout_session_required`),backchannelLogoutUri:H(`backchannel_logout_uri`),clientCredentialsScopes:H(`client_credentials_scopes`).array().default([]),clientDiscoveryId:H(`client_discovery_id`),clientId:H(`client_id`).notNull().unique(),clientSecret:H(`client_secret`),contacts:H(`contacts`).array(),createdAt:U(`created_at`),disabled:Bx(`disabled`).default(!1),dpopBoundAccessTokens:Bx(`dpop_bound_access_tokens`).default(!1),enableEndSession:Bx(`enable_end_session`),frontchannelLogoutSessionRequired:Bx(`frontchannel_logout_session_required`),frontchannelLogoutUri:H(`frontchannel_logout_uri`),grantTypes:H(`grant_types`).array(),icon:H(`icon`),id:H(`id`).primaryKey(),jwks:H(`jwks`),jwksUri:H(`jwks_uri`),metadata:yS(`metadata`),name:H(`name`),policy:H(`policy`),postLogoutRedirectUris:H(`post_logout_redirect_uris`).array(),redirectUris:H(`redirect_uris`).array().notNull(),referenceId:H(`reference_id`),requirePKCE:Bx(`require_pkce`),responseTypes:H(`response_types`).array(),scopes:H(`scopes`).array(),sectorIdentifier:H(`sector_identifier`),skipConsent:Bx(`skip_consent`),softwareId:H(`software_id`),softwareStatement:H(`software_statement`),softwareVersion:H(`software_version`),subjectType:H(`subject_type`),tokenEndpointAuthMethod:H(`token_endpoint_auth_method`),tos:H(`tos`),updatedAt:U(`updated_at`),uri:H(`uri`),userId:H(`user_id`).references(()=>bE.id,{onDelete:`cascade`})},e=>[Qw(`oauthClient_userId_idx`).on(e.userId)]),cE=tE(`oauth_client_assertion`,{expiresAt:U(`expires_at`).notNull(),id:H(`id`).primaryKey()},e=>[Qw(`oauthClientAssertion_expiresAt_idx`).on(e.expiresAt)]),lE=xw(G,({many:e,one:t})=>({oauthAccessTokens:e(oE),oauthClientResources:e(uE),oauthConsents:e(fE),oauthRefreshTokens:e(mE),user:t(bE,{fields:[G.userId],references:[bE.id]})})),uE=tE(`oauth_client_resource`,{clientId:H(`client_id`).notNull().references(()=>G.clientId,{onDelete:`cascade`}),createdAt:U(`created_at`),id:H(`id`).primaryKey(),metadata:yS(`metadata`),resourceId:H(`resource_id`).notNull().references(()=>gE.identifier,{onDelete:`cascade`})},e=>[Qw(`oauthClientResource_clientId_idx`).on(e.clientId),$w(`oauthClientResource_clientId_resourceId_uidx`).on(e.clientId,e.resourceId),Qw(`oauthClientResource_resourceId_idx`).on(e.resourceId)]),dE=xw(uE,({one:e})=>({oauthClient:e(G,{fields:[uE.clientId],references:[G.clientId]}),oauthResource:e(gE,{fields:[uE.resourceId],references:[gE.identifier]})})),fE=tE(`oauth_consent`,{clientId:H(`client_id`).notNull().references(()=>G.clientId,{onDelete:`cascade`}),createdAt:U(`created_at`).notNull(),id:H(`id`).primaryKey(),referenceId:H(`reference_id`),requestedUserInfoClaims:H(`requested_user_info_claims`).array(),resources:H(`resources`).array(),scopes:H(`scopes`).array().notNull(),updatedAt:U(`updated_at`).notNull(),userId:H(`user_id`).references(()=>bE.id,{onDelete:`cascade`})},e=>[Qw(`oauthConsent_clientId_idx`).on(e.clientId),Qw(`oauthConsent_userId_idx`).on(e.userId)]),pE=xw(fE,({one:e})=>({oauthClient:e(G,{fields:[fE.clientId],references:[G.clientId]}),user:e(bE,{fields:[fE.userId],references:[bE.id]})})),mE=tE(`oauth_refresh_token`,{acr:H(`acr`),amr:H(`amr`).array(),authorizationCodeId:H(`authorization_code_id`),authTime:U(`auth_time`),clientId:H(`client_id`).notNull().references(()=>G.clientId,{onDelete:`cascade`}),confirmation:yS(`confirmation`),createdAt:U(`created_at`).notNull(),expiresAt:U(`expires_at`).notNull(),id:H(`id`).primaryKey(),referenceId:H(`reference_id`),requestedUserInfoClaims:H(`requested_user_info_claims`).array(),resources:H(`resources`).array(),revoked:U(`revoked`),rotatedAt:U(`rotated_at`),rotationReplayExpiresAt:U(`rotation_replay_expires_at`),rotationReplayResponse:H(`rotation_replay_response`),scopes:H(`scopes`).array().notNull(),sessionId:H(`session_id`).references(()=>vE.id,{onDelete:`set null`}),token:H(`token`).notNull().unique(),userId:H(`user_id`).notNull().references(()=>bE.id,{onDelete:`cascade`})},e=>[Qw(`oauthRefreshToken_authorizationCodeId_idx`).on(e.authorizationCodeId),Qw(`oauthRefreshToken_clientId_idx`).on(e.clientId),Qw(`oauthRefreshToken_expiresAt_idx`).on(e.expiresAt),Qw(`oauthRefreshToken_sessionId_idx`).on(e.sessionId),Qw(`oauthRefreshToken_userId_idx`).on(e.userId)]),hE=xw(mE,({many:e,one:t})=>({oauthAccessTokens:e(oE),oauthClient:t(G,{fields:[mE.clientId],references:[G.clientId]}),session:t(vE,{fields:[mE.sessionId],references:[vE.id]}),user:t(bE,{fields:[mE.userId],references:[bE.id]})})),gE=tE(`oauth_resource`,{accessTokenTtl:uS(`access_token_ttl`),allowedScopes:H(`allowed_scopes`).array(),createdAt:U(`created_at`),customClaims:yS(`custom_claims`),disabled:Bx(`disabled`).default(!1),dpopBoundAccessTokensRequired:Bx(`dpop_bound_access_tokens_required`).default(!1),id:H(`id`).primaryKey(),identifier:H(`identifier`).notNull().unique(),metadata:yS(`metadata`),name:H(`name`).notNull(),policyVersion:uS(`policy_version`).default(1),refreshTokenTtl:uS(`refresh_token_ttl`),signingAlgorithm:H(`signing_algorithm`),signingKeyId:H(`signing_key_id`),updatedAt:U(`updated_at`)}),_E=xw(gE,({many:e})=>({oauthClientResources:e(uE)})),vE=tE(`session`,{createdAt:U(`created_at`).defaultNow().notNull(),expiresAt:U(`expires_at`).notNull(),id:H(`id`).primaryKey(),ipAddress:H(`ip_address`),token:H(`token`).notNull().unique(),updatedAt:U(`updated_at`).$onUpdate(()=>new Date).notNull(),userAgent:H(`user_agent`),userId:H(`user_id`).notNull().references(()=>bE.id,{onDelete:`cascade`})},e=>[Qw(`session_expiresAt_idx`).on(e.expiresAt),Qw(`session_userId_idx`).on(e.userId)]),yE=xw(vE,({many:e,one:t})=>({oauthAccessTokens:e(oE),oauthRefreshTokens:e(mE),user:t(bE,{fields:[vE.userId],references:[bE.id]})})),bE=tE(`user`,{createdAt:U(`created_at`).defaultNow().notNull(),email:H(`email`).notNull().unique(),emailVerified:Bx(`email_verified`).default(!1).notNull(),id:H(`id`).primaryKey(),image:H(`image`),name:H(`name`).notNull(),updatedAt:U(`updated_at`).defaultNow().$onUpdate(()=>new Date).notNull()}),xE=xw(bE,({many:e})=>({accounts:e(nE),oauthAccessTokens:e(oE),oauthClients:e(G),oauthConsents:e(fE),oauthRefreshTokens:e(mE),sessions:e(vE)})),K=tE(`verification`,{createdAt:U(`created_at`).defaultNow().notNull(),expiresAt:U(`expires_at`).notNull(),id:H(`id`).primaryKey(),identifier:H(`identifier`).notNull(),updatedAt:U(`updated_at`).defaultNow().$onUpdate(()=>new Date).notNull(),value:H(`value`).notNull()},e=>[Qw(`verification_expiresAt_idx`).on(e.expiresAt),Qw(`verification_identifier_idx`).on(e.identifier)]),SE=r({account:()=>nE,accountConfigs:()=>CE,accountRelations:()=>rE,appRealms:()=>wE,deviceCode:()=>iE,deviceRequests:()=>TE,firstAccounts:()=>EE,jwks:()=>aE,keys:()=>DE,oauthAccessToken:()=>oE,oauthAccessTokenRelations:()=>sE,oauthClient:()=>G,oauthClientAssertion:()=>cE,oauthClientRelations:()=>lE,oauthClientResource:()=>uE,oauthClientResourceRelations:()=>dE,oauthConsent:()=>fE,oauthConsentRelations:()=>pE,oauthRefreshToken:()=>mE,oauthRefreshTokenRelations:()=>hE,oauthResource:()=>gE,oauthResourceRelations:()=>_E,pendingKeys:()=>OE,realmPasskeys:()=>kE,realmPrivy:()=>AE,realmSecp256k1:()=>jE,realms:()=>ME,secp256k1Owners:()=>NE,session:()=>vE,sessionRelations:()=>yE,user:()=>bE,userRelations:()=>xE,verification:()=>K}),CE=tE(`account_configs`,{address:H(`address`).notNull(),chainId:uS(`chain_id`).notNull(),createdAt:U(`created_at`).defaultNow().notNull(),key:H(`key`).notNull(),owners:yS(`owners`).notNull(),salt:H(`salt`).notNull(),threshold:uS(`threshold`).notNull(),updatedAt:U(`updated_at`).defaultNow().notNull(),userId:H(`user_id`).notNull().references(()=>bE.id,{onDelete:`cascade`}),version:H(`version`).notNull()},e=>[HC({columns:[e.chainId,e.address]}),Qw(`account_configs_user_id_idx`).on(e.userId)]),wE=tE(`app_realms`,{clientId:H(`client_id`).notNull().references(()=>G.clientId,{onDelete:`cascade`}),position:uS(`position`).notNull(),realmId:H(`realm_id`).notNull().references(()=>ME.id)},e=>[qw(`app_realms_position_check`,V`${e.position} >= 0`),HC({columns:[e.clientId,e.position]}),ub(`app_realms_client_id_realm_id_unique`).on(e.clientId,e.realmId)]),TE=tE(`device_requests`,{account:H(`account`),challenge:H(`challenge`),createdAt:U(`created_at`).defaultNow().notNull(),device:H(`device`),expiresAt:U(`expires_at`).notNull(),id:H(`id`).primaryKey(),ip:H(`ip`),key:yS(`key`),keyAuthorization:yS(`key_authorization`),location:H(`location`)},e=>[Qw(`device_requests_expires_at_idx`).on(e.expiresAt)]),EE=tE(`first_accounts`,{createdAt:U(`created_at`).defaultNow().notNull(),realmId:H(`realm_id`).notNull().references(()=>ME.id,{onDelete:`cascade`}),userId:H(`user_id`).notNull().references(()=>bE.id,{onDelete:`cascade`})},e=>[HC({columns:[e.userId,e.realmId]})]),DE=tE(`keys`,{address:H(`address`).unique(),createdAt:U(`created_at`).defaultNow().notNull(),id:H(`id`).primaryKey(),publicKey:H(`public_key`).notNull(),rpId:H(`rp_id`).notNull(),source:H(`source`).notNull(),type:H(`type`).notNull(),userId:H(`user_id`).notNull().references(()=>bE.id,{onDelete:`cascade`})},e=>[qw(`keys_source_check`,V`${e.source} in ('registered', 'tempo-id', 'tempo-wallet', 'wallet')`),qw(`keys_type_check`,V`${e.type} = 'passkey'`),Qw(`keys_user_id_idx`).on(e.userId)]),OE=tE(`pending_keys`,{account:H(`account`).notNull(),clientId:H(`client_id`).notNull().references(()=>G.clientId,{onDelete:`cascade`}),codeChallenge:H(`code_challenge`).notNull(),createdAt:U(`created_at`).defaultNow().notNull(),expiresAt:U(`expires_at`).notNull(),keyAuthorization:yS(`key_authorization`).notNull(),userId:H(`user_id`).notNull().references(()=>bE.id,{onDelete:`cascade`})},e=>[Qw(`pending_keys_expires_at_idx`).on(e.expiresAt),HC({columns:[e.clientId,e.codeChallenge]})]),kE=tE(`realm_passkeys`,{createdAt:U(`created_at`).defaultNow().notNull(),realmId:H(`realm_id`).primaryKey().references(()=>ME.id,{onDelete:`cascade`}),rpId:H(`rp_id`).notNull().unique()}),AE=tE(`realm_privy`,{appId:H(`app_id`).notNull().unique(),appSecret:H(`app_secret`).notNull(),createdAt:U(`created_at`).defaultNow().notNull(),realmId:H(`realm_id`).primaryKey().references(()=>ME.id,{onDelete:`cascade`})}),jE=tE(`realm_secp256k1`,{createdAt:U(`created_at`).defaultNow().notNull(),realmId:H(`realm_id`).primaryKey().references(()=>ME.id,{onDelete:`cascade`})}),ME=tE(`realms`,{createdAt:U(`created_at`).defaultNow().notNull(),id:H(`id`).primaryKey(),name:H(`name`).notNull()},e=>[qw(`realms_id_check`,V`${e.id} ~ '^[a-z0-9]+(-[a-z0-9]+)*$'`)]),NE=tE(`secp256k1_owners`,{address:H(`address`).notNull().unique(),createdAt:U(`created_at`).defaultNow().notNull(),privateKey:H(`private_key`).notNull(),realmId:H(`realm_id`).notNull().references(()=>ME.id,{onDelete:`cascade`}),userId:H(`user_id`).notNull().references(()=>bE.id,{onDelete:`cascade`})},e=>[HC({columns:[e.userId,e.realmId]})]),PE=/\/(?:\.|%2e)(?:\.|%2e)?(?:\/|$|#|\?)/i,FE=new Set([`client_secret_post`,`client_secret_basic`,`client_secret_jwt`]);function IE(e){let t;try{t=new URL(e)}catch{return!1}return t.protocol===`https:`}function LE(e){if(PE.test(e))return`client_id URL MUST NOT contain dot segments`;if(e.includes(`#`))return`client_id URL MUST NOT contain a fragment`;let t;try{t=new URL(e)}catch{return`client_id is not a valid URL`}if(t.protocol!==`https:`)return`client_id URL must use HTTPS`;let n=/^https:\/\//i.exec(e);if(!n||e.includes(`\\`))return`client_id URL MUST use an explicit HTTPS authority form`;let r=e.slice(n[0].length),i=r.search(/[/?#]/);return i===0?`client_id URL MUST use an explicit HTTPS authority form`:i<0||r[i]!==`/`?`client_id URL MUST contain an explicit path component`:t.username||t.password?`client_id URL MUST NOT contain credentials`:Cs(t.hostname)?null:`client_id URL must not target a private or reserved address`}function RE(e){let t=[];try{let n=new URL(e);n.pathname===`/`&&t.push(`client_id URL path / is NOT RECOMMENDED (§3)`),n.search&&t.push(`client_id URL SHOULD NOT contain a query string (§3)`)}catch{}return t}function zE(e){try{let t=new URL(e);return t.protocol===`http:`||t.protocol===`https:`||ko(t)}catch{return!1}}function BE(e,t,n={}){if(!t||typeof t!=`object`)return{valid:!1,error:`metadata document is not a JSON object`};for(let e of Object.keys(t))if(La(e))return{valid:!1,error:`metadata document MUST NOT contain "${e}"`};let r=cs.strip().safeParse(t);if(!r.success){let e=r.error.issues[0];return{valid:!1,error:`${e?.path.join(`.`)||`metadata document`}: ${e?.message??`invalid client metadata`}`}}let i={...Object.fromEntries(Object.entries(t).filter(([e])=>n.extensionFields?.has(e))),...r.data},a=[];if(i.client_id!==e)return{valid:!1,error:`client_id "${String(i.client_id)}" does not match the metadata document URL`};if(n.metadataProfile===`mcp-2026-07-28`&&!i.client_name?.trim())return{valid:!1,error:`client_name must be a non-empty string`};for(let e of[`backchannel_logout_uri`,`backchannel_logout_session_required`])if(i[e]!==void 0)return{valid:!1,error:`metadata document MUST NOT contain "${e}"`};let o=new Set([`none`,`private_key_jwt`]);if(typeof i.token_endpoint_auth_method==`string`){if(FE.has(i.token_endpoint_auth_method))return{valid:!1,error:`symmetric auth method "${i.token_endpoint_auth_method}" is prohibited for Client ID Metadata Document clients`};if(!o.has(i.token_endpoint_auth_method))return{valid:!1,error:`token_endpoint_auth_method must be "none" or "private_key_jwt" for Client ID Metadata Document clients`};if(i.token_endpoint_auth_method===`private_key_jwt`&&!i.jwks&&!i.jwks_uri)return{valid:!1,error:`private_key_jwt requires either jwks or jwks_uri in the metadata document`}}if(i.jwks&&!Fo(i.jwks).valid)return{valid:!1,error:`jwks must contain only structurally valid public keys`};if(i.jwks_uri)try{let e=new URL(i.jwks_uri);if(e.username||e.password)return{valid:!1,error:`jwks_uri must not contain credentials`};if(i.jwks_uri.includes(`#`))return{valid:!1,error:`jwks_uri must not contain a fragment`}}catch{return{valid:!1,error:`jwks_uri must be a valid URL`}}if(n.metadataProfile===`mcp-2026-07-28`&&!i.redirect_uris||i.redirect_uris&&!i.redirect_uris.every(e=>zE(e)))return{valid:!1,error:`redirect_uris must be a non-empty array of absolute HTTP(S) or private-use URIs`};for(let e of[`client_uri`,`logo_uri`,`tos_uri`,`policy_uri`]){if(i[e]!==void 0&&typeof i[e]!=`string`)return{valid:!1,error:`${e} must be a string`};if(typeof i[e]==`string`)try{let t=new URL(i[e]);if(t.protocol!==`https:`&&t.protocol!==`http:`)return{valid:!1,error:`${e} must use HTTP(S)`};if(t.username||t.password)return{valid:!1,error:`${e} must not contain credentials`};if(!Cs(t.hostname))return{valid:!1,error:`${e} must not point to a private or reserved address`}}catch{return{valid:!1,error:`${e} is not a valid URL`}}}let s=n.originBoundFields??[`post_logout_redirect_uris`,`client_uri`],c;try{c=new URL(e).origin}catch{return{valid:!1,error:`client_id is not a valid URL`}}for(let e of s){let t=i[e];if(t===void 0)continue;let n;if(typeof t==`string`)n=[t];else if(Array.isArray(t)){if(!t.every(e=>typeof e==`string`))return{valid:!1,error:`${e} must be a string or an array of strings`};n=t}else return{valid:!1,error:`${e} must be a string or an array of strings`};for(let t of n){let n;try{n=new URL(t)}catch{return{valid:!1,error:`${e} contains an invalid URL: "${t}"`}}let r=e===`redirect_uris`||e===`post_logout_redirect_uris`,i=r&&ko(n);if(n.protocol!==`https:`&&n.protocol!==`http:`&&!i)return{valid:!1,error:`all values for ${e} must use HTTP(S) or a private-use scheme`};if(i&&(e===`redirect_uris`||co(n)))continue;let a=r&&(n.protocol===`http:`||n.protocol===`https:`)&&ho(n.hostname);if(n.origin!==c&&!a)return{valid:!1,error:`${e} value "${t}" must have the same origin as client_id (${c})`}}}return a.push(...RE(e)),{valid:!0,metadata:{...i,token_endpoint_auth_method:i.token_endpoint_auth_method??`none`},...a.length>0?{warnings:a}:{}}}var VE=5e3,HE=5120,UE=/^application\/(?:[-\w.]+\+)?json\s*(?:;|$)/i,WE=`Failed to fetch metadata document (network error or redirect blocked)`,GE=`cimd`;function KE(e){return new yi(`BAD_REQUEST`,{error:`invalid_client`,error_description:e})}function qE(){return KE(`Metadata document exceeds ${HE/1024}KB size limit`)}async function JE(e,t,n){let r=e.body?.getReader();if(!r){let n=await e.text();if(new TextEncoder().encode(n).byteLength>t)throw qE();return n}let i=[],a=0,o,s=new Promise((e,t)=>{o=t}),c=()=>{o?.(Error(`Metadata document body read aborted`)),r.cancel().catch(()=>{})};n.aborted?c():n.addEventListener(`abort`,c,{once:!0});try{for(;;){let{done:e,value:n}=await Promise.race([r.read(),s]);if(e)break;if(a+=n.byteLength,a>t)throw await r.cancel(),qE();i.push(n)}}finally{n.removeEventListener(`abort`,c),r.releaseLock()}let l=new Uint8Array(a),u=0;for(let e of i)l.set(e,u),u+=e.byteLength;return new TextDecoder().decode(l)}function YE(e){return{cacheControl:e.get(`cache-control`)??void 0,vary:e.get(`vary`)??void 0,expires:e.get(`expires`)??void 0,date:e.get(`date`)??void 0,age:e.get(`age`)??void 0,etag:e.get(`etag`)??void 0,lastModified:e.get(`last-modified`)??void 0}}async function XE(e,t,n,r,i){let a=LE(t);if(a)throw KE(a);if(n.isMetadataDocumentUrlAllowed&&!await n.isMetadataDocumentUrlAllowed(t,e))throw KE(`client_id URL is not permitted by the server's fetch policy`);let o=new Headers({Accept:`application/json`});r?.etag&&o.set(`If-None-Match`,r.etag),r?.lastModified&&o.set(`If-Modified-Since`,r.lastModified);let s,c=new AbortController,l=!1,u=setTimeout(()=>{l=!0,c.abort()},VE);try{try{s=await n.fetchClientMetadataResource(t,{headers:o,redirect:`error`,signal:c.signal})}catch{throw KE(l?`Metadata document fetch timed out after ${VE}ms`:WE)}if(s.redirected)throw KE(`Metadata document fetch must not follow redirects`);let a=YE(s.headers);if(s.status===304){if(!r?.etag&&!r?.lastModified)throw KE(`Metadata document returned 304 without a conditional validator`);return{status:`not-modified`,cacheHeaders:a}}if(s.status!==200)throw KE(`Metadata document fetch returned HTTP ${s.status}`);let u=s.headers.get(`content-type`)??``;if(!UE.test(u))throw KE(`Metadata document must be JSON (got Content-Type "${u||`(none)`}")`);let d;try{let e=s.headers.get(`content-length`);if(e){let t=Number.parseInt(e,10);if(Number.isFinite(t)&&t>HE)throw await s.body?.cancel(),qE()}d=await JE(s,HE,c.signal)}catch(e){throw l?KE(`Metadata document fetch timed out after ${VE}ms`):e instanceof yi?e:KE(WE)}let f;try{f=JSON.parse(d)}catch{throw KE(`Metadata document is not valid JSON`)}let p=BE(t,f,{originBoundFields:n.originBoundFields,metadataProfile:n.metadataProfile,extensionFields:i});if(!p.valid)throw KE(p.error);for(let t of p.warnings??[])e.context.logger.warn(`cimd metadata document warning: ${t}`);return{status:`modified`,metadata:p.metadata,cacheHeaders:a}}finally{clearTimeout(u)}}async function ZE(e,t,n,r,i,a){let o=a?{...a}:void 0,s=await as(e,i,{clientId:t,clientDiscoveryId:GE,metadata:{...n,client_id:n.client_id,redirect_uris:n.redirect_uris??[]},existingClient:a});if(s.created)try{await r.onClientCreated?.({client:s.client,clientMetadataDocument:n,context:e})}catch(t){e.context.logger.error(`cimd onClientCreated notification failed`,t)}else try{o&&await r.onClientRefreshed?.({client:s.client,previousClient:o,clientMetadataDocument:n,context:e})}catch(t){e.context.logger.error(`cimd onClientRefreshed notification failed`,t)}return s.client}var QE=6e4,$E={minimumFetchInterval:1,maximumConcurrentFetches:16,maximumConcurrentFetchesPerOrigin:4,maximumFetchesPerMinute:120,maximumFetchesPerOriginPerMinute:30};function eD(e){return new yi(`BAD_REQUEST`,{error:`invalid_client`,error_description:e})}function tD(e){return new yi(`TOO_MANY_REQUESTS`,{error:`temporarily_unavailable`,error_description:e})}function nD(e,t){if(typeof e==`number`){if(!Number.isFinite(e)||e<0)throw new N(`cimd metadataFetchPolicy.${t} must be a non-negative number of seconds or duration string`);return e*1e3}try{let t=Math.floor(Date.now()/1e3),n=(es(e,t)-t)*1e3;if(!Number.isFinite(n)||n<0)throw Error(`negative duration`);return n}catch{throw new N(`cimd metadataFetchPolicy.${t} must be a non-negative number of seconds or duration string`)}}function rD(e,t){if(!Number.isInteger(e)||e<1)throw new N(`cimd metadataFetchPolicy.${t} must be a positive integer`);return e}function iD(e){let t=e.metadataFetchPolicy;return{minimumFetchIntervalMs:nD(t?.minimumFetchInterval??$E.minimumFetchInterval,`minimumFetchInterval`),maximumConcurrentFetches:rD(t?.maximumConcurrentFetches??$E.maximumConcurrentFetches,`maximumConcurrentFetches`),maximumConcurrentFetchesPerOrigin:rD(t?.maximumConcurrentFetchesPerOrigin??$E.maximumConcurrentFetchesPerOrigin,`maximumConcurrentFetchesPerOrigin`),maximumFetchesPerMinute:rD(t?.maximumFetchesPerMinute??$E.maximumFetchesPerMinute,`maximumFetchesPerMinute`),maximumFetchesPerOriginPerMinute:rD(t?.maximumFetchesPerOriginPerMinute??$E.maximumFetchesPerOriginPerMinute,`maximumFetchesPerOriginPerMinute`)}}function aD(e,t){let n=t-QE,r=0;for(;r<e.length&&e[r]<=n;)r+=1;r>0&&e.splice(0,r)}function oD(e,t){if(typeof e==`number`)return Math.max(0,e*1e3);let n=Math.floor(t/1e3);return Math.max(0,(es(e,n)-n)*1e3)}function sD(e){let t=new Map,n=new Set;for(let r of e?.split(`,`)??[]){let[e,...i]=r.trim().split(`=`),a=e?.toLowerCase();if(!a)continue;t.has(a)&&n.add(a);let o=i.join(`=`).trim();t.set(a,!o||o.replace(/^"|"$/g,``))}return{directives:t,duplicates:n}}function cD(e){if(typeof e!=`string`||!/^\d+$/.test(e))return null;let t=Number(e);return Number.isSafeInteger(t)?t:null}function lD(e,t,n){let{directives:r,duplicates:i}=sD(e.cacheControl),a=e.vary?.split(`,`).some(e=>e.trim()===`*`);if(r.has(`no-store`)||r.has(`private`)||a)return{cacheable:!1,expiresAt:n};let o=oD(t,n);if(r.has(`no-cache`))return{cacheable:!0,expiresAt:n};let s=cD(e.age)??0,c=e.date?Date.parse(e.date):n,l=Number.isFinite(c)?Math.max(0,n-c):0,u=Math.max(l,s*1e3),d=null,f=r.has(`s-maxage`),p=cD(r.get(`s-maxage`)),m=r.has(`max-age`),h=cD(r.get(`max-age`)),g=f?p===null||i.has(`s-maxage`):m&&(h===null||i.has(`max-age`)),_=f?p:h;if(g)d=0;else if(_!==null)d=Math.max(0,_*1e3-u);else if(e.expires){let t=Date.parse(e.expires);Number.isFinite(t)&&(d=Math.max(0,t-(Number.isFinite(c)?c:n)-u))}return{cacheable:!0,expiresAt:n+Math.min(o,d??o)}}function uD(e,t){return{cacheControl:t.cacheControl??e.cacheControl,vary:t.vary??e.vary,expires:t.expires??e.expires,date:t.date??e.date,age:t.age??e.age,etag:t.etag??e.etag,lastModified:t.lastModified??e.lastModified}}function dD(e,t,n,r){let i=lD(t,n,r);return i.cacheable?{metadata:e,expiresAt:i.expiresAt,etag:t.etag,lastModified:t.lastModified,responseCacheHeaders:t}:null}function fD(e){let t=e.metadataRevalidationInterval??`60m`,n=e.maxCacheEntries??1e3;if(!Number.isInteger(n)||n<1)throw new N(`cimd maxCacheEntries must be a positive integer`);let r=iD(e),i=new Map,a=new Map,o=new Map,s=new Map,c=[],l=0,u=e=>{let t=i.get(e);if(t)return i.delete(e),i.set(e,t),t},d=(e,t)=>{for(i.delete(e);i.size>=n;){let e=i.keys().next().value;if(typeof e!=`string`)break;i.delete(e)}i.set(e,t)},f=(e,t)=>{if(!o.has(e))for(;o.size>=n;){let e=!1;for(let[n,i]of o)if(!a.has(n)&&!(r.minimumFetchIntervalMs>0&&t-i<r.minimumFetchIntervalMs)){o.delete(n),e=!0;break}if(!e)throw tD(`metadata fetch client state is at capacity`)}},p=(e,t)=>{let r=s.get(e);if(r)return aD(r.fetchStartTimesMs,t),s.delete(e),s.set(e,r),r;for(;s.size>=n;){let e=!1;for(let[n,r]of s)if(aD(r.fetchStartTimesMs,t),!(r.activeFetchCount>0||r.fetchStartTimesMs.length>0)){s.delete(n),e=!0;break}if(!e)throw tD(`metadata fetch origin state is at capacity`)}let i={activeFetchCount:0,fetchStartTimesMs:[]};return s.set(e,i),i},m=e=>{let t=Date.now(),n=o.get(e);if(r.minimumFetchIntervalMs>0&&n!==void 0&&t-n<r.minimumFetchIntervalMs)throw tD(`metadata document fetch is within the per-client minimum interval`);f(e,t);let i=new URL(e).origin,a=p(i,t);if(aD(c,t),l>=r.maximumConcurrentFetches)throw tD(`global metadata fetch concurrency limit exceeded`);if(a.activeFetchCount>=r.maximumConcurrentFetchesPerOrigin)throw tD(`metadata fetch concurrency limit exceeded for client origin`);if(c.length>=r.maximumFetchesPerMinute)throw tD(`global metadata fetch rate limit exceeded`);if(a.fetchStartTimesMs.length>=r.maximumFetchesPerOriginPerMinute)throw tD(`metadata fetch rate limit exceeded for client origin`);o.delete(e),o.set(e,t),c.push(t),a.fetchStartTimesMs.push(t),l+=1,a.activeFetchCount+=1;let s=!1;return()=>{s||(s=!0,--l,--a.activeFetchCount)}};return async(n,r,s)=>{if(!IE(r))return null;let c=n.context.getPlugin(`oauth-provider`);if(!c)throw new N(`cimd discovery invoked without the oauth-provider plugin installed`);let l=c.options,f=u(r),p=Date.now();if(f&&f.expiresAt>p)return s||ZE(n,r,f.metadata,e,l);let h=a.get(r);if(h!==void 0)return h;let g=m(r),_=(async()=>{let a=await XE(n,r,e,f?{etag:f.etag,lastModified:f.lastModified}:void 0,zo(l));if(a.status===`not-modified`&&!f)throw eD(`Metadata document returned 304 without a validated cached document`);let c=a.status===`modified`?a.metadata:f.metadata,u=await ZE(n,r,c,e,l,s??void 0),p=dD(c,a.status===`modified`?a.cacheHeaders:uD(f.responseCacheHeaders,a.cacheHeaders),t,Date.now());return p?d(r,p):i.delete(r),o.delete(r),u})();a.set(r,_);try{return await _}catch(e){throw o.delete(r),o.set(r,Date.now()),e}finally{a.get(r)===_&&a.delete(r),g()}}}function pD(e){return{id:GE,matches:IE,resolve:fD(e),fetchClientMetadataResource:e.fetchClientMetadataResource,discoveryMetadata:{client_id_metadata_document_supported:!0}}}var mD=2592e3,hD={gracePeriod:mD,jwksPath:`/oauth2/jwks`,keyPairConfig:{alg:`RS256`,modulusLength:2048}};function gD(e={}){return{getJwks:async t=>t.path===hD.jwksPath||!e.cache?await vD(t):[...await e.cache.get(()=>vD(t),[`signingKey.jwks`],{keep:e=>e.length>0,ttl:6e4})]}}async function _D(e,t){let n=(()=>{try{return yo(t.hint).kid}catch{return}})();return n?{keys:(await e.select().from(aE).where(W(aE.id,n)).limit(1)).map(e=>({...JSON.parse(e.publicKey),alg:e.alg??hD.keyPairConfig.alg,kid:e.id}))}:{keys:[]}}async function vD(e){return await(await mo(e.context.adapter)).findMany({limit:100,model:`jwks`,sortBy:{direction:`desc`,field:`createdAt`},where:[{connector:`OR`,field:`expiresAt`,value:null},{connector:`OR`,field:`expiresAt`,operator:`gt`,value:new Date(Date.now()-mD*1e3)}]})}var yD=class extends Error{name=`Apps.NotFoundError`;constructor(e){super(`Unknown app ${e.clientId}. Name a registered OAuth app.`)}},bD=`urn:ietf:params:oauth:grant-type:device_code`,xD=`tempo-id:sign`,SD=[`openid`,`profile`,`email`,`offline_access`];async function CD(e,t){let[n]=await e.select({clientSecret:G.clientSecret,disabled:G.disabled}).from(G).where(W(G.clientId,t.clientId)).limit(1);return!n?.clientSecret||n.disabled?!1:OD(await DD(t.clientSecret),n.clientSecret)}function wD(e=globalThis){return async(t,n)=>{let r=await e.fetch(new Request(t,{...n,redirect:`manual`}));if(r.status<300||r.status>=400||r.status===304)return r;throw await r.body?.cancel(),TypeError(`The metadata document redirects.`)}}async function TD(e,t){return(await e.select().from(G).where(qC(nw(G.clientDiscoveryId),W(G.skipConsent,!0),JC(nw(G.disabled),W(G.disabled,!1))))).filter(e=>e.redirectUris.some(e=>{let n=URL.parse(e);return(n?.protocol===`https:`||n?.protocol===`http:`)&&n.origin===t.origin})).map(KD)}async function ED(e,t){let n=await GD(e,t);if(t.enabled&&n.disabled)throw new yD({clientId:t.clientId});return KD(n)}async function DD(e){let t=await crypto.subtle.digest(`SHA-256`,new TextEncoder().encode(e));return sr(new Uint8Array(t),{pad:!1,url:!0})}function OD(e,t){let n=Ln(e),r=Ln(t);if(n.length!==r.length)return!1;let i=0;for(let e=0;e<n.length;e++)i|=n[e]^r[e];return i===0}var kD=new Set;function AD(e){let{accountStep:t,baseURL:n,cache:r,pendingKey:i}=e,a=e.metadataFetch??wD();return[Jy({adapter:gD({cache:r}),disableSettingJwtHeader:!0,jwks:hD,jwt:{issuer:n}}),Jo({allowDynamicClientRegistration:!1,cachedResources:new Set([n]),cachedTrustedClients:Object.assign(new Set,{has:()=>!0}),clientRegistrationDefaultScopes:[...SD],consentPage:`/authorize`,customIdTokenClaims:e=>e.scopes.includes(`email`)?{email:e.user.email,email_verified:e.user.emailVerified}:{},enforcePerClientResources:!1,extensions:[{clientDiscovery:[ID({fetch:a}),LD({fetch:a})]}],loginPage:`/login`,...t?{postLogin:{consentReferenceId:()=>void 0,page:`/choose-account`,shouldRedirect:async e=>{let n=(await ds())?.query,r=new URLSearchParams(n??``),i=r.get(`client_id`);return i?await t({clientId:i,headers:e.headers,query:r,sessionId:e.session.id,userId:e.user.id}):!1}}}:{},...i?{customTokenResponseFields:async e=>{let t=e.verificationValue?.query;if(e.grantType!==`authorization_code`||!t?.code_challenge||t.key_authorization===void 0||!e.user)return{};let n=await i({clientId:t.client_id,codeChallenge:t.code_challenge,userId:e.user.id});return n?{account:n.account,key_authorization:n.keyAuthorization}:{}}}:{},resources:kD.has(n)?[]:[{accessTokenTtl:300,identifier:n,name:`Tempo ID`}],scopes:[...SD],storeClientSecret:{hash:DD}}),{hooks:{after:[{handler:Ya(async e=>{await Xo(!1);let t=e.context.session;if(!t)return;let{expiresIn:n,updateAge:r}=e.context.sessionConfig;new Date(t.session.expiresAt).getTime()-(n-r)*1e3<=Date.now()&&(e.context.session=null,await Ja(e))}),matcher:e=>e.path===`/oauth2/authorize`}],before:[{handler:Ya(async()=>{await Xo(!0)}),matcher:e=>e.path===`/oauth2/authorize`}]},id:`tempo-id-authorize-session`},{endpoints:{resolveOAuthClient:Ss.serverOnly({body:A({client_id:j()}),method:`POST`},async e=>{let t=e.context.getPlugin(`oauth-provider`);if(!t)throw Error(`The OAuth provider plugin is missing.`);let n=await Zo(e,t.options).getClient(e.body.client_id);return e.json({resolved:!(!n||n.disabled)})})},id:`tempo-id-client-discovery`},{id:`tempo-id-resource-seed`,init:async e=>{kD.has(n)||await e.adapter.findOne({model:`oauthResource`,where:[{field:`identifier`,value:n}]})&&kD.add(n)}}]}function jD(e){let t=URL.parse(e);return t?.protocol===`https:`&&t.origin===e}function MD(e){return IE(e)}async function ND(e,t){let n=[...new Set(t.clientIds.filter(MD))];if(n.length===0)return[];let r=await e.select({clientDiscoveryId:G.clientDiscoveryId,clientId:G.clientId,updatedAt:G.updatedAt}).from(G).where(ew(G.clientId,n)),i=new Set(r.filter(e=>FD(e)).map(e=>e.clientId));return n.filter(e=>!i.has(e))}var PD=3e5;function FD(e){return!e?.clientDiscoveryId||!e.updatedAt?!1:Date.now()-e.updatedAt.getTime()<PD}function ID(e){let t=pD({fetchClientMetadataResource:e.fetch,originBoundFields:[`client_uri`,`logo_uri`,`policy_uri`,`post_logout_redirect_uris`,`redirect_uris`,`tos_uri`]}),n=new Map;return{...t,matches:e=>t.matches(e)&&!jD(e),resolve:async(e,r,i)=>{let a=await(()=>{if(FD(i))return i;let a=n.get(r)??t.resolve(e,r,i);return n.set(r,a),a})();if(!a)return a;let o=[...a.redirectUris??[],...a.postLogoutRedirectUris??[]].find(e=>{let t=URL.parse(e);return!t||t.protocol!==`https:`||ho(t.hostname)||t.hostname.endsWith(`.localhost`)});if(o)throw new M(`BAD_REQUEST`,{error:`invalid_client`,error_description:`Invalid redirect URI in the metadata document: ${o}. Use an https URI on the client ID's origin.`});let s=(a.grantTypes??[]).find(e=>e!==`authorization_code`&&e!==`refresh_token`);if(s)throw new M(`BAD_REQUEST`,{error:`invalid_client`,error_description:`Unsupported grant type in the metadata document: ${s}. Use authorization_code and refresh_token.`});let c=a.tokenEndpointAuthMethod??`none`;if(c!==`none`)throw new M(`BAD_REQUEST`,{error:`invalid_client`,error_description:`Unsupported token_endpoint_auth_method in the metadata document: ${c}. Use none.`});return a}}}function LD(e){let t=new Map;return{id:`origin`,matches:jD,resolve:async(n,r,i)=>{let{host:a,hostname:o}=new URL(r);if(!Cs(o))throw new M(`BAD_REQUEST`,{error:`invalid_client`,error_description:`Invalid client ID: ${r} is not a public host. Use the app's public https origin.`});return await(async()=>{if(FD(i))return i;let o=n.context.getPlugin(`oauth-provider`);if(!o)throw Error(`The OAuth provider plugin is missing.`);let s=t.get(r)??VD({fetch:e.fetch,origin:r}).then(e=>as(n,o.options,{clientDiscoveryId:`origin`,clientId:r,...i?{existingClient:i}:{},metadata:{client_id:r,client_name:e.name??a,grant_types:[`authorization_code`,`refresh_token`],...e.logo?{logo_uri:e.logo}:{},redirect_uris:e.redirectUris?.length?[...e.redirectUris]:[`${r}/`],response_types:[`code`],token_endpoint_auth_method:`none`}}));return t.set(r,s),(await s).client})()}}}var RD=65536,zD=32768,BD=new Set([`image/gif`,`image/jpeg`,`image/png`,`image/svg+xml`,`image/webp`]);async function VD(e){let{origin:t}=e,n=AbortSignal.timeout(5e3),r=async(t,r)=>{let i=await e.fetch(t,{headers:{accept:r},redirect:`error`,signal:n});if(i.status!==200||!i.body)throw await i.body?.cancel(),Error(`The read of ${t} responded with ${i.status}.`);let a=i.body.getReader(),o=new TextDecoder,s=RD,c=``;for(;s>0;){let{done:e,value:t}=await a.read();if(e)break;let n=t.subarray(0,s);s-=n.byteLength,c+=o.decode(n,{stream:!0})}return await a.cancel(),c},i=(e,n)=>{if(typeof e!=`string`)return;let r=URL.parse(e,n);return r?.origin===t?r.href:void 0},a=await r(`${t}/`,`text/html`).then(UD).catch(()=>void 0);if(!a)return{};let o=URL.parse(a.base??``,`${t}/`)?.href??`${t}/`,s=i(a.manifest,o),c=s?await r(s,`application/manifest+json, application/json`).then(e=>JSON.parse(e)).catch(()=>void 0):void 0,l=typeof c==`object`&&c?c:{},u=Array.isArray(l.icons)?l.icons.flatMap(e=>{if(typeof e!=`object`||!e)return[];let{purpose:t,sizes:n,src:r}=e;if(typeof t==`string`&&!/\b(any|maskable)\b/.test(t))return[];let a=s?i(r,s):void 0;return a?[{href:a,size:HD(n,0)}]:[]}):[],d=(u.length>0?u:a.icons.flatMap(e=>{let t=i(e.href,o);return t?[{href:t,size:e.size}]:[]})).reduce((e,t)=>e?e.size>=96&&t.size>=96?t.size<e.size?t:e:t.size>e.size?t:e:t,void 0),f=d?await(async()=>{let t=await e.fetch(d.href,{headers:{accept:[...BD].join(`, `)},redirect:`error`,signal:n}),r=t.headers.get(`content-type`)?.split(`;`)[0]?.trim().toLowerCase();if(t.status!==200||!r||!BD.has(r)){await t.body?.cancel();return}let i=t.body?.getReader();if(!i)return;let a=[],o=0;for(;;){let{done:e,value:t}=await i.read();if(e)break;if(o+=t.byteLength,o>zD){await i.cancel();return}a.push(t)}return`data:${r};base64,${sr(vn(...a))}`})().catch(()=>void 0):void 0,p=Array.isArray(l.redirect_uris)?l.redirect_uris.flatMap(e=>{if(typeof e!=`string`||e.includes(`#`))return[];let n=URL.parse(e);return n?.origin!==t||n.username||n.password?[]:[n.href]}).slice(0,10):void 0;return{logo:f,name:[l.name,l.short_name,a.title].map(e=>typeof e==`string`?e.replace(/[\p{Cc}\p{Cf}\s]+/gu,` `).trim().slice(0,64):``).find(Boolean),redirectUris:p}}function HD(e,t){return typeof e!=`string`||!e.trim()?t:Math.max(...e.toLowerCase().split(/\s+/).map(e=>{if(e===`any`)return 1/0;let[t,n]=e.split(`x`).map(Number);return Math.max(t||0,n||0)}))}function UD(e){let t=e.replace(/<!--[\s\S]*?(?:-->|$)|<(script|style)\b[\s\S]*?(?:<\/\1\s*>|$)/gi,``),n=e=>new Map([...e.matchAll(/([^\s"'=<>/]+)(?:\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s"'=<>`]*)))?/g)].map(e=>[e[1].toLowerCase(),WD(e[2]??e[3]??e[4]??``)])),r=[...t.matchAll(/<link\b([^>]*)(?:>|$)/gi)].map(e=>{let t=n(e[1]??``);return{attributes:t,rel:(t.get(`rel`)??``).toLowerCase().split(/\s+/)}}),i=/<title\b[^>]*(?:>([^<]*)|$)/i.exec(t)?.[1];return{base:[...t.matchAll(/<base\b([^>]*)(?:>|$)/gi)].map(e=>n(e[1]??``).get(`href`)).find(Boolean),icons:r.flatMap(e=>{let t=e.attributes.get(`href`);return t?e.rel.includes(`apple-touch-icon`)?[{href:t,size:HD(e.attributes.get(`sizes`),180)}]:e.rel.includes(`icon`)?[{href:t,size:HD(e.attributes.get(`sizes`),0)}]:[]:[]}),manifest:r.find(e=>e.rel.includes(`manifest`))?.attributes.get(`href`),title:i===void 0?void 0:WD(i)}}function WD(e){let t={amp:`&`,apos:`'`,gt:`>`,lt:`<`,nbsp:` `,quot:`"`};return e.replace(/&(#x[0-9a-f]+|#[0-9]+|[a-z]+);/gi,(e,n)=>{if(!n.startsWith(`#`))return t[n.toLowerCase()]??e;let r=n[1]?.toLowerCase()===`x`?Number.parseInt(n.slice(2),16):Number.parseInt(n.slice(1),10);return r>0&&r<=1114111?String.fromCodePoint(r):e})}async function GD(e,t){let[n]=await e.select().from(G).where(W(G.clientId,t.clientId));if(!n)throw new yD({clientId:t.clientId});return n}function KD(e){return{clientId:e.clientId,createdAt:e.createdAt,device:(e.grantTypes??[]).includes(bD),firstParty:!e.clientDiscoveryId&&e.skipConsent===!0,logo:e.icon?.startsWith(`data:image/`)?e.icon:null,name:e.name,postLogoutRedirectUris:e.postLogoutRedirectUris??[],redirectUris:e.redirectUris,secret:!!e.clientSecret,sign:(e.scopes??[]).includes(xD),type:e.applicationType===`native`?`native`:`web`}}var qD=`logo@id.tempo.xyz`,JD=`iVBORw0KGgoAAAANSUhEUgAAAJAAAACQCAYAAADnRuK4AAALGUlEQVR4nOyda2wU1xmGX8+ub13fkqIogv6ABBpMKRAIlwKKzdWAWxpVbYkqaAlKSX70V9VG+R+pSqtSVWojNW2kUkrUit5UULhDIYBrCJiCCLfSlEoBoWCKL7u1Db70/cwasFnvzuzZ25n5Hul4xrOz9nrO4+/cZs4Jo4Bpb2+fWFRUNIW7tfE0nqlmYGCgiscruT8G/qCVf1Mn/6YO7rcxXWW6wHSexy9UV1dfQYFShAIhGo0+2d/fP4+7g4kXbjYv6KeggNcixmtxkrt/Z2rmflNlZeVNFAB5FYgXpqKzs3MNd1/GPXEU9zQz/ZIi/Z5CdSFP5EUgRpsZjDbfoUBr+MdXQEkbXsN2braGQqF3Kioq/oEck1OBOjo6FnLzOlMjlGzwHtObVVVVR5EjciIQK8ONjDQizkIoueAoI9MPWPnehSyTVYFYv6nlH/IOd+dDyQdN/Md9mfWkC8gSDrKANLNZXP2I27NQefLJfMkD5sUPuc1KizbjESgWi83s7e3dRvOfhlIwUKB/hcPhr0cikRZkkIxFIH7AIpr+vb6+vmaVp/CQPJG8YR59V/IKGSIjP4h1nSfYLP8tP+RyKAUPBdrrOM461o0+gSHGAsUryvu4Ow6KTXzMf/gGSnQeBhgVYewQXM7II93rKo99fIZ518QA8DwMSFsg9u2s4wfYSYuroViJ5J0UZ6wXvYQ0SasIo7Wv8Bf/AopvYH6uZcfju/CIZ4HivcrbkaU+JCVv9DJ9hcMgO7y8yZNAjDx1NHU3d8ug+JFuDso+z76iD9y+wbVAlGcK6zzN8Ru5FP9yi3lcx9bZh25OdlUMMepUU573VJ5A8Gnm9XbmeY2bk10JxFr625RnPJRAwLx+innuqpGUUiD+oPX8gWugBArJc8n7lOcle5Etrse5+Y/eNRhM4jf6T2DL7NZo5ySNQHzzT1Se4BKv825Kes5oL8Sb7IegBB6KtIStsoOJXksYgShOCdPbUBQM+vAWU0JXEh5k9PkGN89AUe4xmU58M9ELCYsw1r4vcfNZKMoDLrEyPXnkwUciEOV5ASqP8ijPRKPRFSMPJirCXoeiJIA91I+4MUwglnP13MyFoiSmjn2Dwx5BHyYQa9rroShJYJP+1WHfD+3Ic0Os/3zCEyJQlFGQ3mlWph+nJ3L/0IMIxArSapVHSYX0TrOq88Wh7+8LRLNehKK4Y/3QzmARJj3PtEpmxyqFoqSmm0MbNYxGPYMRiMWXPL+u8ihuKaMzX5CdQYHYvq+HonhgyJmwfGEoqoeieGDIGUfqP9D5CRXvzKU7pQ77fmZC6z+Kd8rozrNhhqLJUJQ0EHfCDEPjuQMbaW5uhh+ZOnUqKioK/05icUcq0VZGoJMnT2LdunXwG8XFxTh16hRsQB71EoFcPUBWaOzfvx9+ZP78+SgvL4cNMAI9KXUgKwXavXs3/MjSpUthC+KOlRHoypUruHbtGvxIQ0MDLMJOgfxafE2fPh2PPfYYLEIFKiSWLFkCyxgUyKpOxNu3b+PMmTPwI8uWLYNllIZhGXv27IEfGTduHCZOnAjbsE4gvxZfK1asgI1YJVBXVxeamprgR2xqvj+MVQIdPnwYd+/ehd+oqanBrFmzYCNWCeTn1pet45HWCNTX1+dbgWwtvgRrBGpra8OGDRuQKbZs2SIzsCFd5s2bh9mzZyMTLFiwALYiSzQNIGDcvHlzcNDShK1bt2LuXH0K3LpmfCbYtctsKdHq6mrMmTMHSkAF2rt3L0yQAU9bK72ZJnACSV3q+PHjMMGyEfOsEjiBTIdCIpGI1ZXeTKMCeUSa3KFQCMo9AiVQNBrFsWPHYIIWX8MJlED79u2TR3KRLqWlpairq4PygEAJZHof9aJFi1BSUgLlAYERqLu7G0eOHIEJy5frquYjCYxAMo5mMpIvz2tZeMdg1gmMQKadhwsXLkRZma70OZJACHTnzh0cPHgQJmjrKzGBEEhuROvp6UG6OI6jAo1CIAQybX3JrRs2THaQD3wvkBRfBw4cgAna+hod3wskN+HHYjGY0NjYCCUxvhfItPU1c+bMwZvelcT4WiC5j9pUIFuf18oVvhboxIkTRvc9C1r/SY6vBTK9dUOmmpNHjpXR8a1AAwMDxgJp9EmNbwVqaWlBa2srTND6T2p8K5Bp5+GkSZMwYcIEKMnxrUCmrS8tvtzhS4HOnj2L69evwwQd+3KHLwUyjT5jx45FbW0tlNT4UqAdO3bAhFWrVkFxh+8EunTpkhZfOcR3Apn2/YwZMwYzZsyA4g4VaAQrV66E4h5fCSSz11++fBkmaPPdG74SaPv27TBBpm3ROX+84SuBdNqW3OMbgaT4OnfuHEzQ4ss7vhEoE9O2yLNfijd8I5Dp4KlMtavTtnjHFwLJpJmnT5+GCdp5mB6+EMg0+si0LfX19VC84wuBTFtfOm1L+jhM6T/zWwDIpJly87wJ2vpKmx5nYGCgGxYj0cdk1jGZtkUikJIWbQ47zqwWyLT5LjOu6nPv6SHBR4qwNliKTJp59OhRmKCtr/SR4COVaGsFkkkTTIovmbbF5pVyCoA2EegGLMW0+S4Dp/rcuxE3RKCLTF+GhUybNs3o3mUdeTfmoiz3tJ47v4aieOclacZfhKKkgbhTxC+lnZ2dUpHWKUgVL3RXVlbWSD+Q9ESfgaJ447i4I/1A0p5vhqJ4gCXXIdk6D3+jKG4JhUKDQWdIoPe5Sb9HTgka/ZFIZHDZx0GBqqur/8uN2UokSpA4wmrPbdlxHjq4GYrijs1DO/efYWExFmGn4g2apUPTyqjQk1hVVdUT9OR/8v39CMQDMaY/QVGSQEf+OCSP4Ix4cTMUJQkjHRkmEHsWD3FzGIqSmMNxR+7jjDzDcZw3oSgJSORGwgfB29vbP2Coeg6KEoeV5xZ298waedxJdDJN2wRFeQgGlDcSHk90kLY5bNIf1yikCPThFJvuc+jDI6MVCSOQnBgOh1/lbh+UoNNHFzYmkkdwRnsXxzpO8U0/hxJoxAG60DLq68nezNBV0dnZ+W/ujoESRD5ms32ydDKPdoKT7N18Y5Tpa9CR+iDSz7xfm0weIalAgnQcMRK9ASVQSJ4z71N2KruaEJA/rIhFmSx9rA+RB4NDlGcxo89AqhNTRiAh/oOkKPsnFL8jefxVN/IIrgQS2A9wi5FIFpEwW8VNKWRaJY8lr92+wbVAAruyr/AXfIm7d6H4jbuSt5LHXt7kSSCBv0Bupt4IxW9sjOetJzwLJDDEbebm20y9UGxHRhs2xPPUM0bTsnPUvjF+F2MpFBvp4cD5CxUVFWlPc2I8rz+b9/X9/f1/oUg6T4pFsL7TTnlWs7n+PgzIyMIQjEQTKdCfuft5KDbwYUlJyeqysrKPYEhadaCRSM2dJs+BPhpU8DDyvMW8ei4T8ggZX5qmo6PjW/yQP2NEqoRSMDBPZFxzLSvLf0UGyUgEehh+wN8UFxd/jh94G5RC4Q/Mk9pMyyNkdXEsVrAXsYL9K5r/NJR8cJHX/hXTinIysr66GiNRMYu1F/mHfB9ayc4VsnDaJorzLq97VkcNcro8XzQabWBEeo27i6Fkg7/xH/bHbNTsRI7Iy/qOsVjs2d7e3tfiN6vpIl1mSIT5XSgU+mkkEjFb8yoN8r5AKPuQ5rFDaw0j02oK9RSUlDDKfCQjAJRmG6U5iTxSUCvMdnV1jWdkWskL1MC0WLsC7sFr0clrcZBpbzgc3lleXn4VBUJBL1Ec7+GWmcSnMMl2PFMNL2hVXC6/3OzfGpekA/eWnrjKdEESj5/3eotFLvk/AAAA//9aGBgHAAAABklEQVQDAF0C38L/SxIzAAAAAElFTkSuQmCC`;function YD(e){let{code:t}=e,n=`It expires in 10 minutes.`,r=`If you did not request this code, ignore this email. No one can sign in without it.`;return{html:XD({code:t,expiry:n,ignore:r}),logo:{content:Uint8Array.from(atob(JD),e=>e.charCodeAt(0)),contentId:qD,contentType:`image/png`,filename:`tempo.png`},subject:`${t} is your Tempo ID sign-in code`,text:`Your Tempo ID sign-in code is ${t}.\n\n${n}\n\n${r}\n`}}function XD(e){let{code:t,expiry:n,ignore:r}=e,i=`Inter, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif`;return`<!doctype html>
369
+ <html lang="en">
370
+ <head>
371
+ <meta charset="utf-8">
372
+ <meta name="viewport" content="width=device-width, initial-scale=1">
373
+ <meta name="color-scheme" content="light">
374
+ <meta name="supported-color-schemes" content="light">
375
+ <title>Tempo ID sign-in code</title>
376
+ </head>
377
+ <body style="margin:0;padding:0;background-color:#f5f5f5;color:#171717;">
378
+ <div style="display:none;max-height:0;overflow:hidden;opacity:0;">Your Tempo ID sign-in code is ${t}. ${n}</div>
379
+ <table role="presentation" width="100%" cellpadding="0" cellspacing="0" border="0" style="background-color:#f5f5f5;">
380
+ <tr>
381
+ <td align="center" style="padding:40px 16px;">
382
+ <table role="presentation" width="100%" cellpadding="0" cellspacing="0" border="0" style="max-width:432px;background-color:#ffffff;color:#171717;border-radius:32px;box-shadow:0 1px 2px rgba(0,0,0,0.06),0 1px 1px rgba(0,0,0,0.04);">
383
+ <tr>
384
+ <td align="center" style="padding:40px 24px 0;"><img src="cid:${qD}" width="48" height="48" alt="Tempo" style="display:block;width:48px;height:48px;border:0;border-radius:16px;"></td>
385
+ </tr>
386
+ <tr>
387
+ <td align="center" style="padding:24px 24px 0;font-family:${i};font-size:24px;font-weight:600;line-height:32px;letter-spacing:-0.36px;color:#171717;">Your sign-in code</td>
388
+ </tr>
389
+ <tr>
390
+ <td align="center" style="padding:8px 24px 0;font-family:${i};font-size:16px;font-weight:400;line-height:24px;color:#4d4d4d;">${n}</td>
391
+ </tr>
392
+ <tr>
393
+ <td align="center" style="padding:32px 20px 0;white-space:nowrap;user-select:all;-webkit-user-select:all;">${[...t].map(e=>`<span style="display:inline-block;width:42px;height:49px;margin:0 3px;background-color:#f2f2f2;color:#171717;border-radius:16px;font-family:${i};font-size:24px;font-weight:400;line-height:49px;text-align:center;">${e}</span>`).join(``)}</td>
394
+ </tr>
395
+ <tr>
396
+ <td align="center" style="padding:32px 24px 40px;font-family:${i};font-size:14px;font-weight:400;line-height:20px;color:#4d4d4d;">${r}</td>
397
+ </tr>
398
+ </table>
399
+ </td>
400
+ </tr>
401
+ </table>
402
+ </body>
403
+ </html>
404
+ `}var ZD=`https://github.com/tempoxyz/id/blob/main/docs/errors.md`,QD={already_decided:{description:`The user code was already approved or denied.`,error:`invalid_request`,status:409},authorization_expired:{description:`The app's authorization request that sign-in or the approval page continues is forged or expired.`,error:`invalid_request`,status:400},body_too_large:{description:`The request body exceeds 64 KiB.`,error:`invalid_request`,status:413},challenge_not_permitted:{description:"A request carries a challenge, and its app lacks the `tempo-id:sign` scope.",error:`unauthorized_client`,status:403},config_conflict:{description:`The chain's configuration of the account differs from the one that Tempo ID stores.`,error:`invalid_request`,status:409},configurable_accounts_disabled:{description:`The deployment has no configurable accounts, or the request names another chain.`,error:`invalid_request`,status:400},cross_site_request:{description:`A form or body-less write came from another site.`,error:`access_denied`,status:403},duplicate_limit:{description:`Two limits name the same token.`,error:`invalid_authorization_details`,status:400},duplicate_scope:{description:`Two scopes name the same call on one target, or one allows any function on a target that another names a function on.`,error:`invalid_authorization_details`,status:400},empty_limits:{description:"`limits` is an empty list.",error:`invalid_authorization_details`,status:400},empty_scopes:{description:"`scopes` is an empty list.",error:`invalid_authorization_details`,status:400},expiry_exceeds_maximum:{description:`A headless key lasts longer than a year.`,error:`invalid_authorization_details`,status:403},expiry_passed:{description:`The key expiry has passed.`,error:`invalid_authorization_details`,status:400},foreign_account:{description:`The request names a Tempo Account that is not the user's in the app's realms.`,error:`access_denied`,status:403},invalid_chain:{description:`The key chain ID is 0.`,error:`invalid_authorization_details`,status:400},invalid_code:{description:`The emailed code is wrong or expired.`,error:`invalid_grant`,status:401},invalid_expiry:{description:`The key expiry is 0, which never expires.`,error:`invalid_authorization_details`,status:400},invalid_field:{description:`A field is missing or malformed.`,error:`invalid_request`,status:400},invalid_id_token_hint:{description:`The ID token hint is not an ID token that Tempo ID signed for the app.`,error:`invalid_request`,status:400},invalid_origin:{description:`A headless request came from an origin its redirect URI does not allow.`,error:`unauthorized_client`,status:403},invalid_period:{description:"A limit's `period` is not a whole number of seconds.",error:`invalid_authorization_details`,status:400},invalid_public_key:{description:`The key public key is not a valid point.`,error:`invalid_authorization_details`,status:400},invalid_recipients:{description:"A scope's `recipients` names the zero address or a duplicate, or is on a call other than `transfer`, `transferWithMemo`, or `approve` on a TIP-20 token.",error:`invalid_authorization_details`,status:400},limit_exceeds_maximum:{description:`A headless key limit exceeds the token’s ceiling.`,error:`invalid_authorization_details`,status:403},logout_not_permitted:{description:`The app that the ID token hint names may not end the session at the end-session endpoint.`,error:`unauthorized_client`,status:403},malformed_body:{description:`The request body is not valid JSON.`,error:`invalid_request`,status:400},missing_key:{description:`The key authorization names no key.`,error:`invalid_authorization_details`,status:400},missing_permissions:{description:"A third-party app's key request leaves out `expiry`, `limits`, or `scopes`.",error:`invalid_authorization_details`,status:400},missing_recipients:{description:"An `approve` scope names no spenders.",error:`invalid_authorization_details`,status:400},passkey_link_expired:{description:`The email step's link to a wallet.tempo passkey expired, or the browser holds no link for it.`,error:`invalid_request`,status:400},passkey_not_permitted:{description:`A passkey sign-in names an app, or reaches a realm, that holds no passkeys for Tempo ID.`,error:`unauthorized_client`,status:403},not_configurable:{description:`The account is not configurable on the chain, so no owner can join it, or no passkey owns it, so it cannot upgrade.`,error:`invalid_request`,status:400},owner_exists:{description:`The account already holds the owner that the request adds, or is already configurable.`,error:`invalid_request`,status:409},passkey_limit:{description:`The user holds the most passkeys that Tempo ID registers for one user.`,error:`access_denied`,status:403},post_logout_redirect_not_permitted:{description:`The post-logout redirect URI is not one of the post-logout redirect URIs the app registered.`,error:`invalid_request`,status:400},rate_limited:{description:`Tempo ID, or a service it depends on, is rate limiting the request.`,error:`temporarily_unavailable`,status:429},reauthentication_required:{description:`The request needs a session that signed in within the last 10 minutes.`,error:`login_required`,status:401},rejected:{description:`The issuer refused the authorization request.`,error:`invalid_request`,status:400},scope_without_limit:{description:`A scope calls a listed token that no limit names.`,error:`invalid_authorization_details`,status:400},session_changed:{description:`The signed-in session differs from the one that the approval page showed.`,error:`invalid_request`,status:409},session_required:{description:`The request needs a signed-in session.`,error:`login_required`,status:401},sign_up_not_permitted:{description:`The verified address has no account, and its domain is not one where the deployment creates accounts.`,error:`access_denied`,status:403},unexpected:{description:`An unexpected failure.`,error:`server_error`,status:500},unknown_code:{description:`The user code is wrong or expired.`,error:`invalid_request`,status:404},unknown_endpoint:{description:`No API endpoint matches this method and path.`,error:`invalid_request`,status:404},unsupported_call:{description:`A selector does not parse, a scope allows any function on a TIP-20 token, or a headless scope names an unrecognized call.`,error:`invalid_authorization_details`,status:400},unsupported_token:{description:`A limit names a token that is not supported on the chain.`,error:`invalid_authorization_details`,status:400},upgrade_required:{description:`A key authorization names a wallet.tempo passkey's account on a chain whose accounts are configurable, before its upgrade.`,error:`interaction_required`,status:403},upstream_unavailable:{description:`A service Tempo ID depends on failed or did not respond.`,error:`temporarily_unavailable`,status:503},webauthn_rejected:{description:`A passkey ceremony failed: its challenge is unknown, spent, or expired, or its response does not verify.`,error:`access_denied`,status:401},webauthn_required:{description:`A request without a page names a Tempo Account whose passkey signs only on a Tempo ID page.`,error:`interaction_required`,status:403}},$D=class extends nl{name=`ErrorResponse.ResponseError`;response;constructor(e){let t=QD[e.reason].status;super(t,{res:Response.json(e,{status:t})}),this.response=e}};function q(e){return class extends $D{static reason=e;constructor(t){super(sO({...t,reason:e}))}}}var eO=class extends q(`cross_site_request`){name=`ErrorResponse.CrossSiteRequestError`;constructor(){super({error_description:`Cross-site request refused. Send JSON from an allowed origin.`})}},tO=class extends q(`malformed_body`){name=`ErrorResponse.MalformedBodyError`;constructor(){super({error_description:"Malformed request body. Send a JSON object with `Content-Type: application/json`."})}},nO=class extends q(`rate_limited`){name=`ErrorResponse.RateLimitedError`;retryAfter;constructor(e={}){let{retryAfter:t}=e;super({error_description:`Rate limited by an upstream service. Try again ${t?`in ${uO({seconds:t})}`:`later`}.`,...t?{meta:{retryAfter:t}}:{}}),this.retryAfter=t}},rO=class extends q(`unexpected`){name=`ErrorResponse.UnexpectedError`;constructor(){super({error_description:`Unexpected error. Try again.`})}},iO=class extends q(`unknown_endpoint`){name=`ErrorResponse.UnknownEndpointError`;constructor(){super({error_description:`Unknown endpoint. Check the method and path against the API reference at /openapi.json.`})}},aO=class extends q(`upstream_unavailable`){name=`ErrorResponse.UpstreamUnavailableError`;constructor(){super({error_description:`An upstream service is unavailable. Retry later.`})}},oO;(function(e){let t=e.base=A({error:j().meta({description:"The OAuth error code (RFC 6749, OIDC Core, RFC 8628, RFC 9396), which `reason` determines."}),error_description:j().meta({description:`What went wrong and how to fix it, for people. Its wording may change.`}),error_uri:Hi().meta({description:"The errors page, at the refusal’s `reason`."}),field:j().optional().meta({description:`Extension: the request field at fault, as a dotted path.`}),meta:Ei(j(),Ui([Ti(),j()])).readonly().optional().meta({description:`Extension: the values the refusal compared. Base units are decimal strings.`}),reason:j().meta({description:`Extension: a stable name for the refusal, to branch on.`}),request_id:j().optional().meta({description:"Extension: the request ID, which `X-Request-Id` also carries. The Worker adds it to every error response."})}),n={already_decided:{error_description:`Code already approved or denied.`,field:`code`},authorization_expired:{error_description:`Expired authorization request: the request from the app is no longer valid. Return to the app, and start again.`,field:`oauth_query`},body_too_large:{error_description:`Invalid request body: exceeds the 65536-byte maximum. Send a body of 65536 bytes or fewer.`},challenge_not_permitted:{error_description:"Challenge not permitted: the app lacks the `tempo-id:sign` scope. Remove `challenge`, or grant the app the scope.",field:`challenge`},config_conflict:{error_description:`Configuration conflict: the chain's configuration of 0x8C3b5d0e2A4f6B1c9D7e3F5a0B2c4D6e8F1a3B5c differs from the stored one. Reload the account, and try again.`,field:`account`},configurable_accounts_disabled:{error_description:"Configurable accounts are not available on the chain `testnet`. Select the chain `t14`.",field:`chain`},cross_site_request:{error_description:`Cross-site request refused. Send JSON from an allowed origin.`},duplicate_limit:{error_description:`Duplicate limit for 0x20c0000000000000000000000000000000000001. Limit each token once.`,field:`key_authorization.limits.1.token`},duplicate_scope:{error_description:`Duplicate scope for 0xa9059cbb on OUSD. Name each call on a target once.`,field:`key_authorization.scopes.1.selector`},empty_limits:{error_description:"Empty `limits`. Name at least one token, or omit `limits`.",field:`key_authorization.limits`},empty_scopes:{error_description:"Empty `scopes`. Name at least one call, or omit `scopes`.",field:`key_authorization.scopes`},expiry_exceeds_maximum:{error_description:"Invalid `expiry`: Sat, 01 Jan 2028 00:00:00 GMT exceeds the one-year maximum. Use an earlier expiry, or authorize through a redirect or device grant.",field:`key_authorization.expiry`},expiry_passed:{error_description:"Invalid `expiry`: Wed, 01 Jan 2025 00:00:00 GMT has passed. Use a future Unix time.",field:`key_authorization.expiry`},foreign_account:{error_description:`Access denied to Tempo Account 0x8C3b5d0e2A4f6B1c9D7e3F5a0B2c4D6e8F1a3B5c. Name one of the user's accounts in the app's realms.`,field:`account`},invalid_chain:{error_description:"Invalid `chainId`: 0. Use a Tempo chain ID, such as 4217.",field:`key_authorization.chainId`},invalid_code:{error_description:`Invalid or expired code. Request a new one.`,field:`code`},invalid_expiry:{error_description:"Invalid `expiry`: 0 never expires. Use a future Unix time.",field:`key_authorization.expiry`},invalid_field:{error_description:"Invalid request. `email`: Invalid email address.",field:`email`},invalid_id_token_hint:{error_description:`Invalid id_token_hint: it is not an ID token that this issuer signed for the app. Send the ID token that the app received at sign-in.`,field:`id_token_hint`},invalid_origin:{error_description:"Invalid `Origin`: https://other.example.com. Requests for this redirect URI must come from https://app.example.com.",field:`Origin`},invalid_period:{error_description:"Invalid `period` on the OUSD limit: 1.5. Use a whole number of seconds, or 0 for a one-time limit.",field:`key_authorization.limits.0.period`},invalid_public_key:{error_description:"Invalid `publicKey`. Provide an uncompressed public key, or `address`.",field:`key_authorization.publicKey`},invalid_recipients:{error_description:`Invalid recipient 0x0000000000000000000000000000000000000000 for 0x095ea7b3 on OUSD. Name each recipient once, and never the zero address.`,field:`key_authorization.scopes.0.recipients.0`},limit_exceeds_maximum:{error_description:`Invalid OUSD limit: 5000 exceeds the 1000 maximum. Lower the limit, or authorize through a redirect or device grant.`,field:`key_authorization.limits.0.limit`},logout_not_permitted:{error_description:`Logout not permitted: the app client_01JZ8Q6W3N1R5B4V7C2X9K0M3T may not end the session. Register the app for logout, then retry.`},malformed_body:{error_description:"Malformed request body. Send a JSON object with `Content-Type: application/json`."},missing_key:{error_description:"Missing `address` or `publicKey`. Provide the access key.",field:`key_authorization.address`},missing_permissions:{error_description:"Missing `limits` and `scopes`. Name the expiry, limits, and scopes of the key, since a third-party app receives no defaults.",field:`key_authorization.limits`},missing_recipients:{error_description:"Missing `recipients` for `approve` on OUSD. Name the allowed spenders.",field:`key_authorization.scopes.0.recipients`},passkey_link_expired:{error_description:`Expired passkey sign-in: the link from the passkey step is no longer valid. Enter the code again to sign in with email only, or sign in with the passkey again.`,field:`link`},passkey_not_permitted:{error_description:`Passkey not permitted: the app client_01JZ8Q6W3N1R5B4V7C2X9K0M3T holds no passkeys. Sign in with an emailed code.`},not_configurable:{error_description:`Not configurable: 0x8C3b5d0e2A4f6B1c9D7e3F5a0B2c4D6e8F1a3B5c is not a configurable account yet. Upgrade it with its passkey, then add the owner.`,field:`account`},owner_exists:{error_description:`Owner exists: a cloud wallet already owns 0x8C3b5d0e2A4f6B1c9D7e3F5a0B2c4D6e8F1a3B5c. Use the account as it is.`,field:`wallet`},passkey_limit:{error_description:`Passkey limit reached: the user holds 10 registered passkeys, the most that Tempo ID registers. Sign in with one of them.`},post_logout_redirect_not_permitted:{error_description:`Invalid post_logout_redirect_uri: https://app.example/elsewhere is not registered for the app. Use one of its post-logout redirect URIs, or leave it out.`,field:`post_logout_redirect_uri`},rate_limited:{error_description:`Too many requests. Try again in 30 seconds.`},reauthentication_required:{error_description:`Sign in again: adding a passkey needs a sign-in within the last 10 minutes.`},rejected:{error_description:"Authorization request rejected. Check `client_id`, `redirect_uri`, and `scope` against the app's registration."},scope_without_limit:{error_description:`Scope on 0x20c0000000000000000000000000000000000002 has no limit. Add a limit for it, or remove the scope.`,field:`key_authorization.scopes.0.address`},session_changed:{error_description:`Changed session: the signed-in account differs from the one that this page showed. Reload the page, and check the account before the decision.`,field:`session_id`},session_required:{error_description:`Sign in first.`},sign_up_not_permitted:{error_description:`Sign-up not permitted: new accounts need an address at example.com. Sign in with an existing account, or with an address at example.com.`,field:`email`},unexpected:{error_description:`Unexpected error. Try again.`},unknown_code:{error_description:`Invalid or expired code. Check the code in the terminal.`,field:`code`},unknown_endpoint:{error_description:`Unknown endpoint. Check the method and path against the API reference at /openapi.json.`},unsupported_call:{error_description:"Unsupported call on OUSD: any function, which includes `approve` without spenders. Name each function in `selector`, such as `transfer`.",field:`key_authorization.scopes.0.selector`},unsupported_token:{error_description:`Unsupported token on chain 4217: 0x20c00000000000000000000000000000000000ff. Use a supported token, such as OUSD.`,field:`key_authorization.limits.0.token`},upgrade_required:{error_description:`Upgrade required: Tempo Account 0x8C3b5d0e2A4f6B1c9D7e3F5a0B2c4D6e8F1a3B5c is not a configurable account on this chain yet. Upgrade it on the account page, then authorize again.`,field:`key_authorization.account`},upstream_unavailable:{error_description:`An upstream service is unavailable. Retry later.`},webauthn_rejected:{error_description:`Passkey rejected. Request new options, then try again with the same passkey or another one.`},webauthn_required:{error_description:`Passkey required: Tempo Account 0x8C3b5d0e2A4f6B1c9D7e3F5a0B2c4D6e8F1a3B5c signs key authorizations only with its passkey, on a Tempo ID page. Authorize through a redirect, popup, or device grant, or name another account.`,field:`key_authorization.account`}},r=new Map(Object.entries(QD).map(([e,r])=>{let i=n[e],a=t.extend({error:oa(r.error).meta(t.shape.error.meta()),error_description:t.shape.error_description.meta({...t.shape.error_description.meta(),examples:[i.error_description]}),error_uri:t.shape.error_uri.meta({...t.shape.error_uri.meta(),examples:[`${ZD}#${e}`]}),reason:oa(e).meta(t.shape.reason.meta()),request_id:t.shape.request_id.meta({...t.shape.request_id.meta(),examples:[`8f1c2a3b4d5e6f70-SJC`]})});return[e,(i.field?a.extend({field:t.shape.field.meta({...t.shape.field.meta(),examples:[i.field]})}):a.omit({field:!0})).meta({description:`\`${r.error}\` (${r.status}): ${r.description}`,id:`ErrorResponse.${e}`})]}));function i(e){return r.get(e)}e.of=i})(oO||={});function sO(e){let{error_description:t,field:n,meta:r,reason:i}=e;return{error:QD[i].error,error_description:t,error_uri:`${ZD}#${i}`,...n?{field:n}:{},...r?{meta:r}:{},reason:i}}function cO(e){if(e instanceof nl)return;let t=`status`in e?e.status:void 0;if(t===429)return new nO({retryAfter:(()=>{if(e instanceof Response){let t=Number(e.headers.get(`retry-after`));return Number.isInteger(t)&&t>0?t:void 0}return`retryAfter`in e&&typeof e.retryAfter==`number`?e.retryAfter:void 0})()});let n=`status`in e&&t===void 0;if(typeof t==`number`&&(t===408||t>=500)||n||e instanceof Error&&e.name===`TimeoutError`)return new aO}(function(e){e.errors=[nO,aO]})(cO||={});function lO(e,t){if(e instanceof $D)return J(t,e);if(e instanceof nl&&e.status===400)return J(t,new tO);if(e instanceof nl&&e.status===403)return J(t,new eO);let n=cO(e);return n?($s(t,{error:e,message:`An upstream service refused a request.`}),J(t,n)):(Zs(t,{error:e,message:`The API failed a request.`}),J(t,new rO))}function J(e,t){let{response:n}=t;return t instanceof nO&&t.retryAfter&&e.header(`retry-after`,String(t.retryAfter)),e.json(n,QD[n.reason].status)}function uO(e){let{seconds:t}=e,[n,r]=t<60?[t,`second`]:t<3600?[Math.ceil(t/60),`minute`]:[Math.ceil(t/3600),`hour`];return new Intl.NumberFormat(`en`,{style:`unit`,unit:r,unitDisplay:`long`}).format(n)}var dO=new Map,fO=new Map,pO=0;function mO(e,t,n){let r=++pO,i=()=>dO.get(e)||[],a=()=>{let t=i().filter(e=>e.id!==r);t.length===0?(dO.delete(e),fO.delete(e)):dO.set(e,t)},o=()=>{let t=i();if(!t.some(e=>e.id===r))return;let n=fO.get(e);if(t.length===1&&n){let e=n();e instanceof Promise&&e.catch(()=>{})}a()},s=i();if(dO.set(e,[...s,{id:r,fns:t}]),s&&s.length>0)return o;let c={};for(let e in t)c[e]=((...t)=>{let n=i();if(n.length!==0)for(let r of n)r.fns[e]?.(...t)});let l=n(c);return typeof l==`function`&&fO.set(e,l),o}async function hO(e,{signal:t}={}){return new Promise((n,r)=>{if(t?.aborted){r(Dr(t));return}let i=()=>t?.removeEventListener(`abort`,o),a=setTimeout(()=>{i(),n()},Math.min(e,2**31-1)),o=()=>{clearTimeout(a),i(),r(Dr(t))};t?.addEventListener(`abort`,o,{once:!0})})}function gO(e,{emitOnBegin:t,initialWaitTime:n,interval:r}){let i=!0,a=()=>i=!1;return(async()=>{let o;t&&(o=await e({unpoll:a})),await hO(await n?.(o)??r);let s=async()=>{i&&(await e({unpoll:a}),await hO(r),s())};s()})(),a}var _O=new Map,vO=new Map;function yO(e){let t=(e,t)=>({clear:()=>t.delete(e),get:()=>t.get(e),set:n=>t.set(e,n)}),n=t(e,_O),r=t(e,vO);return{clear:()=>{n.clear(),r.clear()},promise:n,response:r}}async function bO(e,{cacheKey:t,cacheTime:n=1/0}){let r=yO(t),i=r.response.get();if(i&&n>0&&Date.now()-i.created.getTime()<n)return i.data;let a=r.promise.get();a||(a=e(),r.promise.set(a));try{let e=await a;return r.response.set({created:new Date,data:e}),e}finally{r.promise.clear()}}var xO=e=>`blockNumber.${e}`;async function SO(e,{cacheTime:t=e.cacheTime}={}){let n=await bO(()=>e.request({method:`eth_blockNumber`}),{cacheKey:xO(e.uid),cacheTime:t});return BigInt(n)}function CO(e,{delay:t=100,retryCount:n=2,shouldRetry:r=()=>!0,signal:i}={}){return new Promise((a,o)=>{let s=()=>o(Dr(i));i?.addEventListener(`abort`,s,{once:!0});let c=async({count:s=0}={})=>{if(i?.aborted){o(Dr(i));return}let l=async({error:e})=>{let n=typeof t==`function`?t({count:s,error:e}):t;if(n)try{await hO(n,{signal:i})}catch(e){o(e);return}return c({count:s+1})};try{a(await e())}catch(e){if(i?.aborted){o(Dr(i));return}if(lr(e)){o(e);return}if(s<n&&await r({count:s,error:e}))return l({error:e});o(e)}};c().catch(o).finally(()=>i?.removeEventListener(`abort`,s))})}var wO={"0x0":`reverted`,"0x1":`success`};function TO(e,t){let n={...e,blockNumber:e.blockNumber?BigInt(e.blockNumber):null,contractAddress:e.contractAddress?e.contractAddress:null,cumulativeGasUsed:e.cumulativeGasUsed?BigInt(e.cumulativeGasUsed):null,effectiveGasPrice:e.effectiveGasPrice?BigInt(e.effectiveGasPrice):null,gasUsed:e.gasUsed?BigInt(e.gasUsed):null,logs:e.logs?e.logs.map(e=>y(e)):null,to:e.to?e.to:null,transactionIndex:e.transactionIndex?vr(e.transactionIndex):null,status:e.status?wO[e.status]:null,type:e.type?Ot[e.type]||e.type:null};return e.blobGasPrice&&(n.blobGasPrice=BigInt(e.blobGasPrice)),e.blobGasUsed&&(n.blobGasUsed=BigInt(e.blobGasUsed)),n}var EO=ur(`transactionReceipt`,TO),DO=256,OO=DO,kO;function AO(e=11){if(!kO||OO+e>DO*2){kO=``,OO=0;for(let e=0;e<DO;e++)kO+=(256+Math.random()*256|0).toString(16).substring(1)}return kO.substring(OO,OO+++e)}function jO(e){let{batch:t,chain:n,ccipRead:r,dataSuffix:i,key:a=`base`,name:o=`Base Client`,tokens:s,type:c=`base`}=e,l=e.experimental_blockTag??(typeof n?.experimental_preconfirmationTime==`number`?`pending`:void 0),u=n?.blockTime??12e3,d=Math.min(Math.max(Math.floor(u/2),500),4e3),f=e.pollingInterval??d,p=e.cacheTime??Math.min(f,Math.floor(u/2)),m=e.account?zr(e.account):void 0,{config:h,request:g,value:_}=e.transport({account:m,chain:n,pollingInterval:f});return PO({account:m,batch:t,cacheTime:p,ccipRead:r,chain:n,dataSuffix:i,key:a,name:o,pollingInterval:f,request:g,tokens:s,transport:{...h,..._},type:c,uid:AO(),...l?{experimental_blockTag:l}:{}})}var MO=new WeakSet,NO=0;function PO(e){function t(r,i){return a=>{let o=a(r);for(let t in e)t!==`scope`&&delete o[t];let s={...r,...o};for(let e in o){let t=r[e],n=o[e];FO(t)&&FO(n)&&(s[e]={...t,...n})}let c=[...i,a],{scope:l}=s;return Object.assign(s,{extend:t(s,c),scope:typeof l==`function`&&MO.has(l)?n(c):l})}}function n(t){let n=new WeakMap,r=(r={})=>{let i=r.signal&&n.get(r.signal);if(i)return i;let a=`scope.${NO++}`,o=new AbortController,{signal:s}=r;s?.aborted?o.abort(s.reason):s?.addEventListener(`abort`,()=>o.abort(s.reason),{once:!0});let c=(t,n)=>e.request(t,{...n,signal:n?.signal??o.signal,uid:n?.uid??a}),l=t.reduce((e,t)=>e.extend(t),PO({...e,request:c,uid:a}));return s&&n.set(s,l),l};return MO.add(r),r}return Object.assign(e,{extend:t(e,[]),scope:n([])})}function FO(e){if(typeof e!=`object`||!e)return!1;let t=Object.getPrototypeOf(e);return t===Object.prototype||t===null}async function IO(e,{address:t,blockHash:n,blockNumber:r,blockTag:i=`latest`,requireCanonical:a}){let o=Pr({blockHash:n,blockNumber:r,blockTag:i,requireCanonical:a}),s=await e.request({method:`eth_getCode`,params:[t,o]},{dedupe:typeof r==`bigint`||n!==void 0});if(s!==`0x`)return s}async function LO({address:e,authorization:t,signature:n}){return Vr(dr(e),await Ze({authorization:t,signature:n}))}var RO=new oi(8192);function zO(e,{enabled:t=!0,id:n}){if(!t||!n)return e();if(RO.get(n))return RO.get(n);let r=e().finally(()=>RO.delete(n));return RO.set(n,r),r}function BO(e,t={}){return async(n,r={})=>{let{dedupe:i=!1,methods:a,retryDelay:o=150,retryCount:s=3,signal:c,uid:l}={...t,...r},{method:u}=n;if(a?.exclude?.includes(u)||a?.include&&!a.include.includes(u))throw new Fe(Error(`method not supported`),{method:u});if(c?.aborted)throw Dr(c);return zO(()=>CO(async()=>{try{return await e(n,c?{signal:c}:void 0)}catch(e){if(c?.aborted)throw Dr(c);if(lr(e))throw e;let t=e;switch(t.code){case ie.code:throw new ie(t);case Zt.code:throw new Zt(t);case Yt.code:throw new Yt(t,{method:n.method});case Je.code:throw new Je(t);case Kt.code:throw new Kt(t);case en.code:throw new en(t);case we.code:throw new we(t);case yt.code:throw new yt(t);case gt.code:throw new gt(t);case Fe.code:throw new Fe(t,{method:n.method});case E.code:throw new E(t);case Ne.code:throw new Ne(t);case Ae.code:throw new Ae(t);case ve.code:throw new ve(t);case ge.code:throw new ge(t);case te.code:throw new te(t);case ct.code:throw new ct(t);case C.code:throw new C(t);case le.code:throw new le(t);case O.code:throw new O(t);case Ue.code:throw new Ue(t);case xe.code:throw new xe(t);case ut.code:throw new ut(t);case At.code:throw new At(t);case Ct.code:throw new Ct(t);case 5e3:throw new Ae(t);case rn.code:throw new rn(t);default:throw e instanceof ei?e:new Ee(t)}}},{delay:({count:e,error:t})=>{let n=HO(t)?.headers?.get(`Retry-After`);if(n){let e=Number.parseInt(n,10);if(!Number.isNaN(e))return e*1e3;let t=Date.parse(n)-Date.now();if(t>0)return t}return~~(1<<e)*o},retryCount:s,signal:c,shouldRetry:({error:e})=>VO(e)}),{enabled:i,id:i?UO(`${l}.${Ur(n)}`):void 0})}}function VO(e){if(lr(e))return!1;let t=HO(e)?.status;if(`code`in e&&typeof e.code==`number`){if(e.code===-1||e.code===E.code||e.code===Kt.code||e.code===429||e.code===-32007)return!0;if(!t)return!1}return!t||t===403||t===408||t===413||t===429||t===500||t===502||t===503||t===504}function HO(e){if(e instanceof ei)return e.walk(e=>e instanceof Kr||e instanceof Wr)}function UO(e,t=0){let n=3735928559^t,r=1103547991^t;for(let t=0;t<e.length;t++){let i=e.charCodeAt(t);n=Math.imul(n^i,2654435761),r=Math.imul(r^i,1597334677)}return n=Math.imul(n^n>>>16,2246822507),n^=Math.imul(r^r>>>16,3266489909),r=Math.imul(r^r>>>16,2246822507),r^=Math.imul(n^n>>>16,3266489909),(4294967296*(2097151&r)+(n>>>0)).toString(36)}function WO(e){let t={formatters:void 0,fees:void 0,serializers:void 0,...e};function n(e){return t=>{let r=typeof t==`function`?t(e):t,i={...e,...r};return Object.assign(i,{extend:n(i)})}}return Object.assign(t,{extend:n(t)})}function GO(){return{}}function KO(e,{errorInstance:t=Error(`timed out`),timeout:n,signal:r}){return new Promise((i,a)=>{(async()=>{let o,s=new AbortController;try{n>0&&(o=setTimeout(()=>{r?s.abort():a(t)},n)),i(await e({signal:s?.signal||null}))}catch(e){if(s?.signal.aborted&&lr(e)){a(t);return}a(e)}finally{clearTimeout(o)}})()})}function qO(){return{current:0,take(){return this.current++},reset(){this.current=0}}}var JO=qO(),YO=10485760;function XO(e,t={}){let{url:n,headers:r}=ek(e);return{async request(e){let{body:i,fetchFn:a=t.fetchFn??fetch,maxResponseBodySize:o=t.maxResponseBodySize??YO,onRequest:s=t.onRequest,onResponse:c=t.onResponse,timeout:l=t.timeout??1e4}=e,u={...t.fetchOptions??{},...e.fetchOptions??{}},{headers:d,method:f,signal:p}=u;try{let{response:e,responseBody:t}=await KO(async({signal:e})=>{let{signal:t,cleanup:m}=ZO([p,l>0?e:null]);try{let e={...u,body:Ur(Array.isArray(i)?i.map(e=>({jsonrpc:`2.0`,id:e.id??JO.take(),...e})):{jsonrpc:`2.0`,id:i.id??JO.take(),...i}),headers:{...r,"Content-Type":`application/json`,...d},method:f||`POST`,signal:t},l=new Request(n,e),p=await s?.(l,e)??{...e,url:n},m=await a(p.url??n,p);return c&&await c(m),{response:m,responseBody:await QO(m,{maxResponseBodySize:o})}}finally{m()}},{errorInstance:new yr({body:i,url:n}),timeout:l,signal:!0}),m;if(e.headers.get(`Content-Type`)?.startsWith(`application/json`))m=JSON.parse(t);else{m=t;try{m=JSON.parse(m||`{}`)}catch(t){if(e.ok)throw t;m={error:m}}}let h=Array.isArray(i)&&Array.isArray(m)&&m.length===1?m[0]:m;if(!e.ok)throw $O(h)?new Wr({body:i,error:h.error,headers:e.headers,status:e.status,url:n}):new Kr({body:i,details:Ur(m.error)||e.statusText,headers:e.headers,status:e.status,url:n});if(!Array.isArray(i)||!i.length||Array.isArray(m)&&m.length>=i.length)return m;if(!$O(h))throw Error(`Expected ${i.length} responses to batch request.`);return i.map(()=>h)}catch(e){throw p?.aborted?Dr(p):lr(e)||e instanceof Kr||e instanceof cr||e instanceof Wr||e instanceof yr?e:new Kr({body:i,cause:e,url:n})}}}}function ZO(e){let t=e.filter(e=>!!e);if(t.length<2)return{signal:t[0]??null,cleanup:()=>{}};let n=new AbortController,r=()=>{i(),n.abort(t.find(e=>e.aborted)?.reason)},i=()=>{for(let e of t)e.removeEventListener(`abort`,r)};for(let e of t){if(e.aborted){i(),n.abort(e.reason);break}e.addEventListener(`abort`,r)}return{signal:n.signal,cleanup:i}}async function QO(e,{maxResponseBodySize:t}){if(t===!1)return e.text();let n=e.headers.get(`Content-Length`);if(n){let e=Number(n);if(e>t)throw new cr({maxSize:t,size:e})}if(!e.body){let n=await e.text(),r=new TextEncoder().encode(n).length;if(r>t)throw new cr({maxSize:t,size:r});return n}let r=e.body.getReader(),i=new TextDecoder,a=``,o=0;try{for(;;){let{done:e,value:n}=await r.read();if(e)break;if(o+=n.byteLength,o>t)throw await r.cancel(),new cr({maxSize:t,size:o});a+=i.decode(n,{stream:!0})}return a+=i.decode(),a}finally{r.releaseLock()}}function $O(e){return typeof e?.error?.code==`number`&&typeof e?.error?.message==`string`}function ek(e){try{let t=new URL(e),n=(()=>{if(t.username){let e=`${decodeURIComponent(t.username)}:${decodeURIComponent(t.password)}`;return t.username=``,t.password=``,{url:t.toString(),headers:{Authorization:`Basic ${btoa(e)}`}}}})();return{url:t.toString(),...n}}catch{return{url:e}}}var tk=be(`(uint256 chainId, address delegation, uint256 nonce, uint8 yParity, uint256 r, uint256 s), address to, bytes data`);function nk(e){if(typeof e==`string`){if(gn(e,-32)!==`0x8010801080108010801080108010801080108010801080108010801080108010`)throw new ak(e)}else zn(e.authorization)}function rk(e){nk(e);let t=cn(gn(e,-64,-32)),n=gn(e,-t-64,-64),r=gn(e,0,-t-64),[i,a,o]=S(tk,n);return{authorization:wf({address:i.delegation,chainId:Number(i.chainId),nonce:i.nonce,yParity:i.yParity,r:i.r,s:i.s}),signature:r,...o&&o!==`0x`?{data:o,to:a}:{}}}function ik(e){try{return nk(e),!0}catch{return!1}}var ak=class extends un{constructor(e){super(`Value \`${e}\` is an invalid ERC-8010 wrapped signature.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:`SignatureErc8010.InvalidWrappedSignatureError`})}};async function ok(e,{blockHash:t,blockNumber:n,blockTag:r,hash:i,index:a,sender:o,nonce:s}){let c=r||`latest`,l=n===void 0?void 0:br(n),u=null;if(i?u=await e.request({method:`eth_getTransactionByHash`,params:[i]},{dedupe:!0}):t?u=await e.request({method:`eth_getTransactionByBlockHashAndIndex`,params:[t,br(a)]},{dedupe:!0}):(l||c)&&typeof a==`number`?u=await e.request({method:`eth_getTransactionByBlockNumberAndIndex`,params:[l||c,br(a)]},{dedupe:!!l}):o&&typeof s==`number`&&(u=await e.request({method:`eth_getTransactionBySenderAndNonce`,params:[o,br(s)]},{dedupe:!0})),!u)throw new Mr({blockHash:t,blockNumber:n,blockTag:c,hash:i,index:a});return(e.chain?.formatters?.transaction?.format||Ge)(u,`getTransaction`)}async function sk(e,{hash:t}){let n=await e.request({method:`eth_getTransactionReceipt`,params:[t]},{dedupe:!0});if(!n)throw new jr({hash:t});return(e.chain?.formatters?.transactionReceipt?.format||TO)(n,`getTransactionReceipt`)}var ck=`0x6492649264926492649264926492649264926492649264926492649264926492`;function lk(e){if(gn(e,-32)!==`0x6492649264926492649264926492649264926492649264926492649264926492`)throw new fk(e)}function uk(e){let{data:t,signature:n,to:r}=e;return yn(ht(be(`address, bytes, bytes`),[r,t,n]),ck)}function dk(e){try{return lk(e),!0}catch{return!1}}var fk=class extends un{constructor(e){super(`Value \`${e}\` is an invalid ERC-6492 wrapped signature.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:`SignatureErc6492.InvalidWrappedSignatureError`})}};function pk({r:e,s:t,to:n=`hex`,v:r,yParity:i}){let a=(()=>{if(i===0||i===1)return i;if(r&&(r===27n||r===28n||r>=35n))return+(r%2n==0n);throw Error("Invalid `v` or `yParity` value")})(),o=`0x${new Pn.Signature(mr(e),mr(t)).toCompactHex()}${a===0?`1b`:`1c`}`;return n===`hex`?o:Cr(o)}async function mk(e,t){let{address:n,chain:r=e.chain,hash:i,erc6492VerifierAddress:a=t.universalSignatureVerifierAddress??r?.contracts?.erc6492Verifier?.address,multicallAddress:o=t.multicallAddress??r?.contracts?.multicall3?.address,mode:s=`auto`}=t;if(r?.verifyHash)return await r.verifyHash(e,t);let c=(()=>{let e=t.signature;return Ir(e)?e:typeof e==`object`&&`r`in e&&`s`in e?pk(e):Gr(e)})();try{if(s===`eoa`)try{if(Vr(dr(n),await Ut({hash:i,signature:c})))return!0}catch{}return ik(c)?await hk(e,{...t,multicallAddress:o,signature:c}):await gk(e,{...t,verifierAddress:a,signature:c})}catch(e){if(s!==`eoa`)try{if(Vr(dr(n),await Ut({hash:i,signature:c})))return!0}catch{}if(e instanceof vk)return!1;throw e}}async function hk(e,t){let{address:n,blockHash:r,blockNumber:i,blockTag:a,hash:o,multicallAddress:s,requireCanonical:c}=t,{authorization:l,data:u,signature:d,to:f}=rk(t.signature);if(await IO(e,{address:n,blockHash:r,blockNumber:i,blockTag:a,requireCanonical:c})===Rr([`0xef0100`,l.address]))return await _k(e,{...t,signature:d});let p={address:l.address,chainId:Number(l.chainId),nonce:Number(l.nonce),r:br(l.r,{size:32}),s:br(l.s,{size:32}),yParity:l.yParity};if(!await LO({address:n,authorization:p}))throw new vk;let m=await w(e,Ve,`readContract`)({...s?{address:s}:{code:ri},authorizationList:[p],abi:Jr,blockHash:r,blockNumber:i,blockTag:`pending`,functionName:`aggregate3`,requireCanonical:c,args:[[...u?[{allowFailure:!0,target:f??n,callData:u}]:[],{allowFailure:!0,target:n,callData:ii({abi:Br,functionName:`isValidSignature`,args:[o,d]})}]]});if((m[m.length-1]?.returnData)?.startsWith(`0x1626ba7e`))return!0;throw new vk}async function gk(e,t){let{address:n,factory:r,factoryData:i,hash:a,signature:o,verifierAddress:s,...c}=t,l=await(async()=>!r&&!i||dk(o)?o:uk({data:i,signature:o,to:r}))(),u=s?{to:s,data:ii({abi:Qr,functionName:`isValidSig`,args:[n,a,l]}),...c}:{data:Fr({abi:Qr,args:[n,a,l],bytecode:qr}),...c},{data:d}=await w(e,ni,`call`)(u).catch(e=>{throw e instanceof xr?new vk:e});if(gr(d??`0x0`))return!0;throw new vk}async function _k(e,t){let{address:n,blockHash:r,blockNumber:i,blockTag:a,hash:o,requireCanonical:s,signature:c}=t;if((await w(e,Ve,`readContract`)({address:n,abi:Br,args:[o,c],blockHash:r,blockNumber:i,blockTag:a,functionName:`isValidSignature`,requireCanonical:s}).catch(e=>{throw e instanceof wr?new vk:e})).startsWith(`0x1626ba7e`))return!0;throw new vk}var vk=class extends Error{};function yk(e,{emitOnBegin:t=!1,emitMissed:n=!1,onBlockNumber:r,onError:i,poll:a,pollingInterval:o=e.pollingInterval}){let s=a===void 0?e.transport.type!==`webSocket`&&e.transport.type!==`ipc`&&(e.transport.type!==`fallback`||e.transport.transports[0].config.type!==`webSocket`&&e.transport.transports[0].config.type!==`ipc`):a,c;return s?mO(Ur([`watchBlockNumber`,e.uid,t,n,o]),{onBlockNumber:r,onError:i},r=>gO(async()=>{try{let t=await w(e,SO,`getBlockNumber`)({cacheTime:0});if(c!==void 0){if(t===c)return;if(t-c>1&&n)for(let e=c+1n;e<t;e++)r.onBlockNumber(e,c),c=e}(c===void 0||t>c)&&(r.onBlockNumber(t,c),c=t)}catch(e){r.onError?.(e)}},{emitOnBegin:t,interval:o})):mO(Ur([`watchBlockNumber`,e.uid,t,n]),{onBlockNumber:r,onError:i},t=>{let n=!0,r=()=>n=!1;return(async()=>{try{let{unsubscribe:i}=await(()=>{if(e.transport.type===`fallback`){let t=e.transport.transports.find(e=>e.config.type===`webSocket`||e.config.type===`ipc`);return t?t.value:e.transport}return e.transport})().subscribe({params:[`newHeads`],onData(e){if(!n)return;let r=mr(e.result?.number);t.onBlockNumber(r,c),c=r},onError(e){t.onError?.(e)}});r=i,n||r()}catch(e){i?.(e)}})(),()=>r()})}async function bk(e,t){let{checkReplacement:n=e.chain?.supportsTransactionReplacementDetection??!0,confirmations:r=1,hash:i,onReplaced:a,retryCount:o=6,retryDelay:s=({count:e})=>~~(1<<e)*200,timeout:c=18e4}=t,l=e.chain?.transactionReplacement?.getKey?void 0:t.replacement,u=t=>e.chain?.transactionReplacement?.getKey?.(t)??String(t.nonce),d=t.pollingInterval?t.pollingInterval:e.chain?.experimental_preconfirmationTime?e.chain.experimental_preconfirmationTime:e.pollingInterval,f=Ur([`waitForTransactionReceipt`,e.uid,i,{checkReplacement:n,confirmations:r,pollingInterval:d,replacement:l,retryCount:o,timeout:c}]),p,m,h,g=!1,_,v,{promise:y,resolve:b,reject:x}=$r(),S=c?setTimeout(()=>{v?.(),_?.(),x(new Er({hash:i}))},c):void 0;return _=mO(f,{onReplaced:a,resolve:b,reject:x},async t=>{m=await w(e,sk,`getTransactionReceipt`)({hash:i}).catch(()=>void 0),m&&r<=1?(clearTimeout(S),t.resolve(m),_?.()):v=w(e,yk,`watchBlockNumber`)({emitMissed:!0,emitOnBegin:!0,poll:!0,pollingInterval:d,async onBlockNumber(a){let c=e=>{clearTimeout(S),v?.(),e(),_?.()},d=a;if(!g)try{if(m){if(r>1&&(!m.blockNumber||d-m.blockNumber+1n<r))return;c(()=>{h&&t.onReplaced?.(h),t.resolve(m)});return}if(n&&!p&&(g=!0,await CO(async()=>{p=await w(e,ok,`getTransaction`)({hash:i}),p.blockNumber&&(d=p.blockNumber)},{delay:s,retryCount:o,shouldRetry:({error:e})=>!(l&&e instanceof Mr)}),g=!1),m=await w(e,sk,`getTransactionReceipt`)({hash:i}),r>1&&(!m.blockNumber||d-m.blockNumber+1n<r))return;c(()=>t.resolve(m))}catch(a){if(a instanceof Mr||a instanceof jr){g=!1;let a=p??(n&&l?{...l,hash:i.toLowerCase()}:void 0);if(!a||a.blockNumber)return;try{if(!p){g=!0;let n=await w(e,ok,`getTransaction`)({nonce:a.nonce,sender:a.from}).catch(e=>{(e instanceof Yt||e instanceof Fe)&&(p=a)});if(g=!1,n?.hash.toLowerCase()===a.hash){p=n;return}if(n){let i=await w(e,sk,`getTransactionReceipt`)({hash:n.hash}).catch(e=>{if(!(e instanceof jr))throw e});if(!i||(m=i,h={reason:e.chain?.transactionReplacement?.getReason?.({replaced:a,replacement:n})??xk(a,n),replacedTransaction:a,transaction:n,transactionReceipt:m},r>1&&(!m.blockNumber||d-m.blockNumber+1n<r)))return;c(()=>{t.onReplaced?.(h),t.resolve(m)});return}}g=!0;let n=await CO(()=>w(e,Tt,`getBlock`)({blockNumber:d,includeTransactions:!0}),{delay:s,retryCount:o,shouldRetry:({error:e})=>e instanceof Lt});g=!1;let i=u(a),l=n.transactions.find(e=>Vr(e.from,a.from)&&e.hash!==a.hash&&u(e)===i);if(!l||(m=await w(e,sk,`getTransactionReceipt`)({hash:l.hash}),h={reason:e.chain?.transactionReplacement?.getReason?.({replaced:a,replacement:l})??xk(a,l),replacedTransaction:a,transaction:l,transactionReceipt:m},r>1&&(!m.blockNumber||d-m.blockNumber+1n<r)))return;c(()=>{t.onReplaced?.(h),t.resolve(m)})}catch(e){c(()=>t.reject(e))}}else c(()=>t.reject(a))}}})}),y.finally(()=>{clearTimeout(S),_?.()})}function xk(e,t){return(t.to&&e.to?Vr(t.to,e.to):t.to===e.to)&&t.value===e.value&&t.input===e.input?`repriced`:t.from===t.to&&t.value===0n?`cancelled`:`replaced`}async function Sk(e,{serializedTransaction:t,throwOnReceiptRevert:n,timeout:r}){let i=await e.request({method:`eth_sendRawTransactionSync`,params:r?[t,r]:[t]},{retryCount:0}),a=(e.chain?.formatters?.transactionReceipt?.format||TO)(i);if(a.status===`reverted`&&n)throw new Nr({receipt:a});return a}async function Ck(e,t){let{account:n=e.account,chain:r=e.chain,...i}=t;if(!n)throw new Re({docsPath:`/docs/actions/wallet/signTransaction`});let a=zr(n);ai({account:a,...t});let o=await w(e,Bt,`getChainId`)({});r!==null&&ze({currentChainId:o,chain:r});let s=(r?.formatters||e.chain?.formatters)?.transactionRequest?.format||Or;return a.signTransaction?a.signTransaction({...i,account:a,chainId:o},{serializer:e.chain?.serializers?.transaction}):await e.request({method:`eth_signTransaction`,params:[{...s({...i,account:a},`signTransaction`),chainId:br(o),from:a.address}]},{retryCount:0})}function wk({key:e,methods:t,name:n,request:r,retryCount:i=3,retryDelay:a=150,timeout:o,type:s},c){let l=AO();return{config:{key:e,methods:t,name:n,request:r,retryCount:i,retryDelay:a,timeout:o,type:s},request:BO(r,{methods:t,retryCount:i,retryDelay:a,uid:l}),value:c}}function Tk(e,t={}){let{key:n=`custom`,methods:r,name:i=`Custom Provider`,retryDelay:a}=t;return({retryCount:o})=>wk({key:n,methods:r,name:i,request:e.request.bind(e),retryCount:t.retryCount??o,retryDelay:a,type:`custom`})}var Ek=class extends ei{constructor(){super(`No URL was provided to the Transport. Please provide a valid RPC URL to the Transport.`,{docsPath:`/docs/clients/intro`,name:`UrlRequiredError`})}},Dk=0,Ok=new WeakMap;function kk(e){if(!e)return`default`;let t=Ok.get(e);if(t!==void 0)return t;let n=Dk++;return Ok.set(e,n),n}function Ak(e,t={}){let{batch:n,fetchFn:r,fetchOptions:i,key:a=`http`,maxResponseBodySize:o,methods:s,name:c=`HTTP JSON-RPC`,onFetchRequest:l,onFetchResponse:u,retryDelay:d,raw:f}=t;return({chain:p,retryCount:m,timeout:h})=>{let{batchSize:g=1e3,wait:_=0}=typeof n==`object`?n:{},v=t.retryCount??m,y=h??t.timeout??1e4,b=e||p?.rpcUrls.default.http[0];if(!b)throw new Ek;let x=XO(b,{fetchFn:r,fetchOptions:i,maxResponseBodySize:o,onRequest:l,onResponse:u,timeout:y});return wk({key:a,methods:s,name:c,async request({method:e,params:t},r){let i={method:e,params:t},a=r?.signal?{signal:r.signal}:void 0,{schedule:o}=Xr({id:`${b}.${kk(r?.signal)}`,wait:_,shouldSplitBatch(e){return e.length>g},fn:e=>x.request({body:e,fetchOptions:a}),sort:(e,t)=>e.id-t.id}),[{error:s,result:c}]=await(async e=>n?o(e):[await x.request({body:e,fetchOptions:a})])(i).catch(e=>{if(f&&e instanceof Wr)return[{error:e.cause,result:void 0}];throw e});if(f)return{error:s,result:c};if(s)throw new Wr({body:i,error:s,url:b});return c},retryCount:v,retryDelay:d,timeout:y,type:`http`},{fetchOptions:i,url:b})}}async function jk(e,t){let{owners:n,salt:r,threshold:i,...a}=t;return ot(Ve)(e,{...a,...jk.call({owners:n,salt:r,threshold:i})})}(function(e){function t(e){let{owners:t,salt:n,threshold:r}=St(e);return Qe({address:Qt,abi:ye,args:[n,r,t],functionName:`deriveAccount`})}Object.defineProperty(e,"call",{configurable:!0,enumerable:!0,value:t,writable:!0})})(jk||={});async function Mk(e,t){let n=await e.request({method:`account_getConfig`,params:[{address:t.address}]});return n?lt(n):null}async function Nk(e,t){let{account:n,...r}=t;return ot(Ve)(e,{...r,...Nk.call({account:n})})}(function(e){function t(e){return Qe({address:Qt,abi:ye,args:[e.account],functionName:`getConfigCommitment`})}Object.defineProperty(e,"call",{configurable:!0,enumerable:!0,value:t,writable:!0})})(Nk||={});async function Pk(e,t){return Pk.inner(ue,e,t)}(function(e){async function t(t,n,r){let{account:i,currentConfig:a,nextConfig:o,...s}=r,c=i??n.account,l=(()=>{if(typeof c==`object`&&c.source===`configurable`)return c})(),u=(()=>{if(a)return a;if(l?.config)return l.config})(),d=(()=>{if(l)return l.address;if(typeof c==`string`)return c;if(c)return c.address})(),f=await(async()=>{if(u)return St(u);if(!d)throw Error(`A configurable account address or current config is required.`);let e=await Mk(n,{address:d});if(!e)throw Error(`No current account config is cached for account ${d}. Provide the current config.`);return e})(),p=(()=>{if(l)return{...l,config:f};if(typeof c==`object`)return c;if(d)return D({address:d,...f})})();return await ot(t)(n,{...s,...p?{account:p}:{},...e.call({currentConfig:f,nextConfig:o})})}e.inner=t;function n(e){let t=St(e.currentConfig),n=Xt(t,e.nextConfig);return Qe({address:Qt,abi:ye,args:[t,n.threshold,n.owners],functionName:`updateConfig`})}Object.defineProperty(e,"call",{configurable:!0,enumerable:!0,value:n,writable:!0});function r(e){let[t]=De({abi:ye,logs:e,eventName:`ConfigurableAccountConfigUpdated`,strict:!0});if(!t)throw Error("`ConfigurableAccountConfigUpdated` event not found.");return t}e.extractEvent=r})(Pk||={});async function Fk(e,t){return Fk.inner(ue,e,t)}(function(e){async function t(t,n,r){let{owners:i,threshold:a,...o}=r;for(let e of[`authorizationList`,`calls`,`data`,`keyAuthorization`,`to`])if(o[e]!==void 0)throw Error(`\`${e}\` is not supported: the upgrade must be the only call, without authorizations.`);let s=o.account??n.account;if(typeof s==`object`){if(s.source===`configurable`)throw Error(`The account is already a configurable account.`);if(s.source===`accessKey`)throw Error(`The root key must sign the upgrade, not an access key.`)}return await ot(t)(n,{...o,...e.call({owners:i,threshold:a}),type:`tempo`})}e.inner=t;function n(e){let{owners:t,threshold:n}=St(e);return Qe({address:Qt,abi:ye,args:[n,t],functionName:`upgradeAccount`})}Object.defineProperty(e,"call",{configurable:!0,enumerable:!0,value:n,writable:!0});function r(e){let[t]=De({abi:ye,logs:e,eventName:`AccountUpgraded`,strict:!0});if(!t)throw Error("`AccountUpgraded` event not found.");return t}e.extractEvent=r})(Fk||={});async function Ik(e,t){let{account:n,hash:r,signature:i,...a}=t;return ot(Ve)(e,{...a,...Ik.call({account:n,hash:r,signature:i})})}(function(e){function t(e){let{account:t,hash:n,signature:r}=e;return Qe({address:je,abi:me,args:[t,n,r],functionName:`verifyConfigurableAccount`})}Object.defineProperty(e,"call",{configurable:!0,enumerable:!0,value:t,writable:!0})})(Ik||={});async function Lk(e,t){let{timeout:n=1e4}=t,r=zr(t.account),i=await e.request({method:`tempo_fundAddress`,params:[r.address]});return await Promise.all(i.map(t=>bk(e,{hash:t,checkReplacement:!1,timeout:n})))}async function Rk(e,t){let{blockNumber:n,blockTag:r=e.experimental_blockTag??`latest`,blocks:i,returnFullTransactions:a,traceTransfers:o,validation:s}=t;try{let t=[];for(let n of i){let r=n.blockOverrides?ti(n.blockOverrides):void 0,i=n.calls.map(t=>{let n=t,r=n.account?zr(n.account):e.account?zr(e.account):void 0,i=n.abi?ii(n):n.data,a={...n,account:r,data:n.dataSuffix?ui([i||`0x`,n.dataSuffix]):i,from:n.from??r?.address};return ai(a),Or(a)}),a=n.stateOverrides?Lr(n.stateOverrides):void 0;t.push({blockOverrides:r,calls:i,stateOverrides:a})}let c=(typeof n==`bigint`?br(n):void 0)||r,l=await e.request({method:`tempo_simulateV1`,params:[{blockStateCalls:t,returnFullTransactions:a,traceTransfers:o,validation:s},c]});return{blocks:l.blocks.map((e,t)=>({...Pt(e),calls:e.calls?.map((e,n)=>{let{abi:r,args:a,functionName:o,to:s}=i[t].calls[n],c=e.error?.data??e.returnData,l=BigInt(e.gasUsed),u=e.logs?.map(e=>y(e)),d=e.status===`0x1`?`success`:`failure`,f=r&&d===`success`&&c!==`0x`?Hr({abi:r,data:c,functionName:o}):null,p=(()=>{if(d===`success`)return;let e;if(c===`0x`?e=new hr:c&&(e=new _r({data:c})),e)return at(e,{abi:r??[],address:s??`0x`,args:a,functionName:o??`<unknown>`})})();return{data:c,gasUsed:l,logs:u,status:d,...d===`success`?{result:f}:{error:p}}})})),tokenMetadata:l.tokenMetadata??{}}}catch(e){let t=e,n=kr(t,{});throw n instanceof Sr?t:n}}async function zk(e,t){let{blockNumber:n,blockTag:r,calls:i,stateOverrides:a,traceTransfers:o,validation:s}=t,c=t.account?zr(t.account):void 0,l=await Rk(e,{blockNumber:n,blockTag:r,blocks:[{calls:i.map(e=>({...e,from:c?.address})),stateOverrides:a}],traceTransfers:o,validation:s}),{calls:u,...d}=l.blocks[0];return{block:d,results:u,tokenMetadata:l.tokenMetadata}}function Bk(e){if(!mt(e))return Ge(e);let t=e.blockTimestamp==null?void 0:BigInt(e.blockTimestamp),n=e.operation,{feePayerSignature:r,gasPrice:i,nonce:a,...o}=Op(e);return{...o,accessList:o.accessList,...t!==void 0&&{blockTimestamp:t},feePayerSignature:r?{r:k(r.r,{size:32}),s:k(r.s,{size:32}),v:BigInt(r.v??27),yParity:r.yParity}:void 0,nonce:Number(a),operation:Hk(n),typeHex:Ep[o.type],type:o.type}}function Vk(e){return{...TO(e),operation:Hk(e.operation),...e.status===`pending`?{status:`pending`,type:`tempo`}:{}}}function Hk(e){if(!e)return;let t=dp(e);if(t.type!==`transaction`)throw Error(`Expected an account transaction operation.`);return t}function Uk(e,t){let n=e,r=n.account?zr(n.account):void 0,i=n.owner?zr(n.owner):void 0;if(i?.type===`json-rpc`)throw Error(`A local owner account is required to approve a configurable account transaction.`);if(!mt(n))return Or(e,t);t&&(n.calls=n.calls??[{to:e.to||(!e.data||e.data===`0x`?`0x0000000000000000000000000000000000000000`:void 0),value:e.value,data:e.data}]),n.feePayer===!0&&!n.feePayerSignature&&delete n.feeToken;let{owner:a,signatures:o,...s}=n,c=Ap({...s,type:`tempo`});t===`estimateGas`&&(c.maxFeePerGas=void 0,c.maxPriorityFeePerGas=void 0),c.to=void 0,c.data=void 0,c.value=void 0;let l=i??r,[u,d]=(()=>{let e=l&&`keyType`in l?l.keyType:l?.source;return e?e===`webAuthn`?[`webAuthn`,`0x0578`]:[`p256`,`secp256k1`].includes(e)?[e,void 0]:[n.keyType,Wk(n.keyData)]:[n.keyType,Wk(n.keyData)]})(),f=l&&`accessKeyAddress`in l?l.accessKeyAddress:n.keyId;return r&&(c.from=r.address),{...c,...n.capabilities?{capabilities:n.capabilities}:{},...d?{keyData:d}:{},...f?{keyId:f}:{},...u?{keyType:u}:{},...n.accountSimulation?{accountSimulation:void 0}:{},...n.owner?{owner:void 0}:{},...n.feePayer===void 0?{}:{feePayer:typeof n.feePayer==`object`?zr(n.feePayer):n.feePayer},...`feePayerSignature`in n&&n.feePayerSignature!==void 0?{feePayerSignature:n.feePayerSignature}:{}}}function Wk(e){if(!e)return e;let t=(e.length-2)/2;return t<=4?e:k(t,{size:2})}var Gk=new Map;async function Kk(e){Gk.set(e,(Gk.get(e)??0)+1),await Promise.resolve();let t=(Gk.get(e)??0)>1;return queueMicrotask(()=>{let t=Gk.get(e)??0;t<=1?Gk.delete(e):Gk.set(e,t-1)}),t}var qk={getKey(e){let t=e;if(t.type!==`tempo`)return`0:${t.nonce}`;let n=t.nonceKey??0n;return n===li?`expiring:${Jk(t)}`:`${n}:${t.nonce}`},getReason({replaced:e,replacement:t}){return Yk(e,t)}};function Jk(e){let t=e,n=Mt({accessList:t.accessList,authorizationList:t.authorizationList,calls:t.calls,chainId:t.chainId,feePayerSignature:t.feePayerSignature?null:void 0,feeToken:t.feeToken,gas:t.gas,keyAuthorization:t.keyAuthorization??void 0,maxFeePerGas:t.maxFeePerGas,maxPriorityFeePerGas:t.maxPriorityFeePerGas,nonce:BigInt(t.nonce),nonceKey:t.nonceKey,validAfter:t.validAfter,validBefore:t.validBefore});return fr(yn(se(n),t.from))}function Yk(e,t){let n=Xk(t),r=Xk(e);return n.length===r.length&&n.every((e,t)=>Zk(e,r[t]))?`repriced`:n.every(e=>e.to&&Vr(e.to,t.from)&&!e.value&&Qk(e.data))?`cancelled`:`replaced`}function Xk(e){return e.type===`tempo`?e.calls:[{data:e.input,to:e.to,value:e.value}]}function Zk(e,t){return(e.to&&t.to?Vr(e.to,t.to):!e.to&&!t.to)&&(e.value??0n)===(t.value??0n)&&(Qk(e.data)?Qk(t.data):e.data===t.data)}function Qk(e){return!e||e===`0x`}var $k=25,eA=((e,t)=>_e(e,t)),tA={blockTime:1e3,extendSchema:GO(),formatters:{transaction:pt({exclude:[`aaAuthorizationList`],format:Bk}),transactionReceipt:EO({format:Vk}),transactionRequest:si({format:Uk})},prepareTransactionRequest:[async(e,{client:t,phase:n})=>{let r=e;if(r.hash){if(!r.account||typeof r.account==`string`||r.account.source!==`configurable`)throw Error(`A local configurable account is required to approve a stored configurable account transaction.`);if(!r.owner||typeof r.owner==`string`)throw Error(`A local owner account is required to approve a stored configurable account transaction.`);if(r.owner.source!==`root`)throw Error(`A Tempo owner account is required to approve a stored configurable account transaction.`);let e=await w(t,ok,`getTransaction`)({hash:r.hash}),n=`operation`in e?e.operation:void 0;if(!n)throw Error(`Expected an account operation transaction.`);if(!Vr(n.account,r.account.address))throw Error(`Account operation account does not match the requested account.`);let i=x(n.transaction);if(lp({account:n.account,config:n.config,transaction:n.transaction,type:`transaction`}).toLowerCase()!==r.hash.toLowerCase())throw Error(`Account operation hash does not match transaction.`);return{...i,gas:i.gas??0n,maxFeePerGas:i.maxFeePerGas??0n,maxPriorityFeePerGas:i.maxPriorityFeePerGas??0n,account:r.account,from:n.account,accountSimulation:nA({config:n.config,local:r.account}),owner:r.owner}}if(n===`afterFillParameters`)return r.gas!==void 0&&r.feePayer&&!r.feePayerSignature&&(r.keyAuthorization?.signature.type===`webAuthn`?r.gas=(r.gas??0n)+20000n:r.account?.source===`accessKey`&&(r.gas=(r.gas??0n)+10000n)),r;let i=(()=>{if(r.account?.source===`configurable`)return{account:r.account.address,config:r.account.config,local:r.account}})();if(r.owner&&!i)throw Error(`A configurable account is required when an owner is provided.`);if(r.owner&&typeof r.owner==`string`)throw Error(`A local owner account is required to approve a configurable account transaction.`);if(r.owner&&r.owner.source!==`root`)throw Error(`A Tempo owner account is required to approve a configurable account transaction.`);let a=!!i&&!!r.owner&&t.transport.accounts===!0;if(i){let{account:e,local:n}=i;if(!e)throw Error(`A configurable account address is required with a current config.`);let o=await(async()=>{if(i.config)return i.config;if(!a)return;let n=await w(t,Mk,`getConfig`)({address:e});if(!n)throw Error(`No current account config is cached for account ${e}. Provide the current config.`);return n})();if(!o)throw Error(`An account config is required to prepare a transaction.`);r.from=e,r.accountSimulation=nA({config:o,local:n})}let o=await(async()=>{if(r.nonceKey===`expiring`||r.nonceKey===li)return!0;if(r.nonceKey!==void 0||i)return!1;if(r.feePayer&&r.nonceKey===void 0)return!0;let e=r.account,t=typeof e==`string`?e:e?.address;return t&&r.nonceKey===void 0?await Kk(t.toLowerCase()):!1})();if(a&&r.nonceKey===void 0?(r.nonceKey=an(on(31))+1n,r.nonce=0):o?(r.nonceKey=li,r.nonce??=0,r.validAfter===void 0&&(r.validAfter=iA()),r.validBefore===void 0&&(r.validBefore=Math.floor(Date.now()/1e3)+$k)):r.nonceKey!==void 0&&BigInt(r.nonceKey)!==0n&&(r.nonce=typeof r.nonce==`number`?r.nonce:0),!r.keyAuthorization&&r.account?.source===`accessKey`){let e=r.account.keyAuthorizationManager;if(e){let n=r.chainId??r.chain?.id;if(n!==void 0){let i=r.account.address,a=r.account.accessKeyAddress,o={address:i,accessKey:a,chainId:n},s=await e.get(o);if(s){let n=BigInt(Math.floor(Date.now()/1e3));if(s.expiry!=null&&BigInt(s.expiry)<=n)await e.remove(o);else{let c=await w(t,Vt,`getMetadata`)({account:i,accessKey:a});Vr(c.address,a)&&!c.isRevoked&&c.expiry>n?await e.remove(o):r.keyAuthorization=s}}}}}return!r.feeToken&&r.chain?.feeToken&&(r.feeToken=r.chain.feeToken),r},{runAt:[`beforeFillTransaction`,`afterFillParameters`]}],serializers:{transaction:eA,async transactionEnvelope({serializedTransaction:e,transaction:t}){let n=t;if(!n.accountSimulation)return e;try{Xe(e)}catch{if(x(e).signature?.type===`configurable`)return e;throw Error(`A Tempo owner account is required to approve a configurable account transaction.`)}return await eA({...n,signatures:[...n.signatures??[],e]})}},transactionReplacement:qk,async verifyHash(e,t){let{address:n,hash:r,signature:i,mode:a}=t,o=(()=>{if(typeof i==`string`)return i;if(i instanceof Uint8Array)return xn(i)})(),s=(()=>{if(o)try{return Xe(o)}catch{return}})();if(s){if(s?.type===`keychain`&&a===`allowAccessKey`){let i=s.version===`v2`?fr(yn(`0x04`,r,n)):r,a=(()=>{try{return bt({payload:i,signature:s.inner})}catch{return}})();if(!a)return!1;let o=await Vt(e,{account:n,accessKey:a,blockHash:t.blockHash,blockNumber:t.blockNumber,blockTag:t.blockTag,requireCanonical:t.requireCanonical});return o.isRevoked||o.expiry<=BigInt(Math.floor(Date.now()/1e3))?!1:kt(s.inner,{address:a,payload:i})}if(s.type===`configurable`)return await Ve(e,{blockHash:t.blockHash,blockNumber:t.blockNumber,blockTag:t.blockTag,requireCanonical:t.requireCanonical,...Ik.call({account:n,hash:r,signature:o})}).catch(e=>{if(e instanceof ei&&e.walk(e=>e instanceof pr))return!1;throw e});if(s.type===`p256`||s.type===`webAuthn`){let i=await IO(e,{address:n,blockHash:t.blockHash,blockNumber:t.blockNumber,blockTag:t.blockTag,requireCanonical:t.requireCanonical});if(!i||i===`0xef01007702c00000000000000000000000000000000000`)return kt(s,{address:n,payload:r})}}return await w(e,mk,`verifyHash`)({...t,chain:null})}};function nA(e){let{config:t,local:n}=e;return{approvals:aA(t).map(e=>{let t=n?.owners.find(t=>Vr(t.address,e.owner));return{...rA(t),owner:e.owner}}),config:t}}function rA(e){let t=(()=>{if(e&&typeof e==`object`&&`keyType`in e&&typeof e.keyType==`string`)return e.keyType})();return!t||t===`webAuthn`?{keyData:`0x0578`,keyType:`webAuthn`}:t===`p256`||t===`secp256k1`?{keyType:t}:{keyData:`0x0578`,keyType:`webAuthn`}}function iA(){let e=BigInt(Math.floor(Date.now()/1e3))-60n;return e<=0n?0:Number(BigInt(on(8))%e)}function aA(e){let t=[...e.owners].sort((e,t)=>Number(t.weight)-Number(e.weight)||e.owner.toLowerCase().localeCompare(t.owner.toLowerCase())),n=[],r=0;for(let i of t.slice(0,8)){if(r>=Number(e.threshold))break;n.push(i),r+=Number(i.weight)}return n.sort((e,t)=>e.owner.toLowerCase().localeCompare(t.owner.toLowerCase()))}var oA=WO({...tA,id:4217,blockExplorers:{default:{name:`Tempo Explorer`,url:`https://explore.tempo.xyz`}},contracts:{earnFactory:{address:`0x3085A8003f340CD51C72D9e1a1298CDafB171B02`},erc4626EngineFactory:{address:`0xd43D00981222a8db444A528E69f19E3cE5A7D2Ff`}},name:`Tempo Mainnet`,nativeCurrency:{name:`USD`,symbol:`USD`,decimals:6},rpcUrls:{default:{http:[`https://rpc.tempo.xyz`],webSocket:[`wss://rpc.tempo.xyz`]}}}),sA=WO({...tA,id:31318,name:`Tempo Devnet`,hardfork:`t3`,blockExplorers:{default:{name:`Tempo Explorer`,url:`https://explore.devnet.tempo.xyz`}},nativeCurrency:{name:`USD`,symbol:`USD`,decimals:6},rpcUrls:{default:{http:[`https://rpc.devnet.tempoxyz.dev`],webSocket:[`wss://rpc.devnet.tempoxyz.dev`]}},testnet:!0}),cA=WO({...tA,id:1337,name:`Tempo`,hardfork:`t3`,nativeCurrency:{name:`USD`,symbol:`USD`,decimals:6},rpcUrls:{default:{http:[`http://localhost:8545`]}}}),lA=WO({...tA,id:42431,hardfork:`t5`,blockExplorers:{default:{name:`Tempo Explorer`,url:`https://explore.testnet.tempo.xyz`}},contracts:{earnFactory:{address:`0x1de6B233984583F4d936ae4265f3b60282b70cc6`},erc4626EngineFactory:{address:`0x0d57c10249eb3a92b7d81bBA6221F80F2865448A`}},name:`Tempo Testnet (Moderato)`,nativeCurrency:{name:`USD`,symbol:`USD`,decimals:6},rpcUrls:{default:{http:[`https://rpc.moderato.tempo.xyz`],webSocket:[`wss://rpc.moderato.tempo.xyz`]}},testnet:!0});function uA(e){let{addresses:t,currency:n,decimals:r,name:i,popular:a,symbol:o}=e;function s(e){let s=t[e];if(!s)throw Error(`Token has no address for chain id "${e}".`);return{address:s,currency:n,decimals:r,name:i,popular:a,symbol:o}}return Object.defineProperties(s,{addresses:{enumerable:!0,value:t},currency:{enumerable:!0,value:n},decimals:{enumerable:!0,value:r},name:{enumerable:!0,value:i},popular:{enumerable:!0,value:a},symbol:{enumerable:!0,value:o}})}var dA=uA({addresses:{42431:`0x20c0000000000000000000000000000000000001`},currency:`USD`,decimals:6,name:`AlphaUSD`,symbol:`alphaUSD`}),fA=uA({addresses:{42431:`0x20c0000000000000000000000000000000000002`},currency:`USD`,decimals:6,name:`BetaUSD`,symbol:`betaUSD`}),pA=uA({addresses:{4217:`0x20c000000000000000000000f047dd7018e50367`},currency:`BRL`,decimals:6,name:`BRLA Token`,symbol:`BRLA`}),mA=uA({addresses:{4217:`0x20c000000000000000000000c412ec89d0c08be5`},currency:`BTC`,decimals:6,name:`Coinbase Wrapped BTC`,symbol:`cbBTC`}),hA=uA({addresses:{4217:`0x20c00000000000000000000042109aef2f8b28e1`},currency:`CHF`,decimals:6,name:`AllUnity CHF`,symbol:`CHFAU`}),gA=uA({addresses:{1:`0x72DFB2E44f59C5AD2bAFE84314E5b99a7cd5075E`,5042:`0x171A4217b86A807A64eB94757Db6849fb4bDbAA0`,5042002:`0xf0C4a4CE82A5746AbAAd9425360Ab04fbBA432BF`,11155111:`0x3a3fe695F684Bf9b9e43CF43C2b895Ea5e392bB3`},currency:`BTC`,decimals:8,name:`Circle Wrapped Bitcoin`,symbol:`cirBTC`}),_A=uA({addresses:{4217:`0x20c0000000000000000000000520792dcccccccc`},currency:`USD`,decimals:6,name:`Cap USD`,symbol:`cUSD`}),vA=uA({addresses:{4217:`0x20c0000000000000000000006fd9a167923ba194`},currency:`USD`,decimals:6,name:`Deel USD`,symbol:`DLUSD`}),yA=uA({addresses:{4217:`0x20c0000000000000000000009a4a4b17e0dc6651`},currency:`EUR`,decimals:6,name:`AllUnity EUR`,symbol:`EURAU`}),bA=uA({addresses:{1:`0x1aBaEA1f7C830bD89Acc67eC4af516284b1bC33c`,25:`0xA6dE01a2d62C6B5f3525d768f34d276652C554c8`,338:`0x31f7538adb53cF16350e6B0c89d03D91b7D12c46`,480:`0x1C60ba0A0eD1019e8Eb035E6daF4155A5cE2380B`,4801:`0xe479EcA5740Ac65d6E1823bea2f1C08Bc14e954F`,5042:`0xbEf5f6d51CB62b58e6A8f77868681825C6fe21c1`,8453:`0x60a3E35Cc302bFA44Cb288Bc5a4F316Fdb1adb42`,9745:`0x3EE196E78d4d4248b849B8E1C7F44C5457FAFD2C`,43113:`0x5E44db7996c682E92a960b65AC713a54AD815c6B`,43114:`0xC891EB4cbdEFf6e073e859e987815Ed1505c2ACD`,84532:`0x808456652fdb597867f38412077A9182bf77359F`,5042002:`0x89B50855Aa3bE2F677cD6303Cec089B5F319D72a`,11155111:`0x08210F9170F89Ab7658F0B5E3fF39b0E03C594D4`},currency:`EUR`,decimals:6,name:`EURC`,symbol:`EURC`}),xA=uA({addresses:{4217:`0x20c0000000000000000000001621e21f71cf12fb`,42431:`0x20c000000000000000000000d72572838bbee59c`},currency:`EUR`,decimals:6,name:`Bridged EURC (Stargate)`,symbol:`EURC.e`}),SA=uA({addresses:{4217:`0x20c0000000000000000000003554d28269e0f3c2`},currency:`USD`,decimals:6,name:`Frax USD`,symbol:`frxUSD`}),CA=uA({addresses:{4217:`0x20c0000000000000000000000a6da882d075a4c3`},currency:`GBP`,decimals:6,name:`Agant GBP`,symbol:`GBPA`}),wA=uA({addresses:{4217:`0x20c0000000000000000000005c0bac7cef389a11`},currency:`USD`,decimals:6,name:`Generic USD`,symbol:`GUSD`}),TA=uA({addresses:{4217:`0x20c000000000000000000000ab02d39df30bd17e`},currency:`USD`,decimals:6,name:`InfiniFi USD`,symbol:`iUSD`}),EA=uA({addresses:{1:`0x9f6F3991D525015a6F8CaF062C83b62fD3AC4436`,4217:`0x20c0000000000000000000006a37DA5C996874BE`,8453:`0xB2000000000000000000002fEb517dFeC7415344`},currency:`USD`,decimals:6,name:`OpenUSD`,popular:!0,symbol:`OUSD`}),DA=uA({addresses:{4217:`0x20c0000000000000000000000000000000000000`,42431:`0x20c0000000000000000000000000000000000000`},currency:`USD`,decimals:6,name:`PathUSD`,symbol:`pathUSD`}),OA=uA({addresses:{4217:`0x20c000000000000000000000383a23bacb546ab9`},currency:`USD`,decimals:6,name:`Re Protocol reUSD`,symbol:`reUSD`}),kA=uA({addresses:{4217:`0x20c0000000000000000000007f7ba549dd0251b9`},currency:`USD`,decimals:6,name:`Reservoir Stablecoin`,symbol:`rUSD`}),AA=uA({addresses:{4217:`0x20c000000000000000000000ae247a1130450f09`},currency:`USD`,decimals:6,name:`Stable Coin`,symbol:`SBC`}),jA=uA({addresses:{4217:`0x20c000000000000000000000048c8f36df1c9a4a`},currency:`siUSD`,decimals:6,name:`InfiniFi Staked USD`,symbol:`siUSD`}),MA=uA({addresses:{4217:`0x20c0000000000000000000008ee4fcff88888888`},currency:`stcUSD`,decimals:6,name:`Staked Cap USD`,symbol:`stcUSD`}),NA=uA({addresses:{4217:`0x20c000000000000000000000bd95bfb69fbe6ce3`},currency:`sUSDe`,decimals:6,name:`Staked USDe`,symbol:`sUSDe`}),PA=uA({addresses:{4217:`0x20c0000000000000000000008191667423f70e67`},currency:`syrupUSDC`,decimals:6,name:`Syrup USDC`,symbol:`syrupUSDC`}),FA=uA({addresses:{42431:`0x20c0000000000000000000000000000000000003`},currency:`USD`,decimals:6,name:`ThetaUSD`,symbol:`thetaUSD`}),IA=uA({addresses:{4217:`0x20c000000000000000000000111111111e910f0f`},currency:`USD`,decimals:6,name:`USD1`,symbol:`USD1`}),LA=uA({addresses:{4217:`0x20c0000000000000000000003158081efd85bfc2`},currency:`USD`,decimals:6,name:`USDBridge`,symbol:`USDB`}),RA=uA({addresses:{1:`0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48`,10:`0x0b2C639c533813f4Aa9D7837CAf62653d097Ff85`,25:`0x3D7F2C478aAfdB65542BCB44bCeeC05849999d2D`,50:`0xfA2958CB79b0491CC627c1557F441eF849Ca8eb1`,51:`0xb5AB69F7bBada22B28e79C8FFAECe55eF1c771D4`,130:`0x078D782b760474a361dDA0AF3839290b0EF57AD6`,137:`0x3c499c542cEF5E3811e1192ce70d8cC03d5c3359`,143:`0x754704Bc059F8C67012fEd69BC8A327a5aafb603`,146:`0x29219dd400f2Bf60E5a23d13Be72B486D4038894`,196:`0xB6CEceAB302E2E4948951eE7843FC24E92933061`,300:`0xAe045DE5638162fa134807Cb558E15A3F5A7F853`,324:`0x1d17CBcF0D6D143135aE902365D2E5e2A16538D4`,338:`0xEb33dc5fac03833e132593659e1dE7256aB59794`,480:`0x79A02482A880bCE3F13e09Da970dC34db4CD24d1`,998:`0x2B3370eE501B4a559b57D449569354196457D8Ab`,999:`0xb88339CB7199b77E23DB6E890353E22632Ba630f`,1301:`0x31d0220469e10c4E71834a79b1f276d740d3768F`,1328:`0x4fCF1784B31630811181f670Aea7A7bEF803eaED`,1329:`0xe15fC38F6D8c56aF07bbCBe3BAf5708A2Bf42392`,1439:`0x0C382e685bbeeFE5d3d9C29e29E341fEE8E84C5d`,1672:`0xC879C018dB60520F4355C26eD1a6D572cdAC1815`,1776:`0xa00C59fF5a080D2b954d0c75e46E22a0c371235a`,1952:`0xDec90b78111Ba2fc6FC6d84d8B9ec159A2d4b9B3`,2818:`0xCfb1186F4e93D60E60a8bDd997427D1F33bc372B`,2910:`0x7433b41C6c5e1d58D4Da99483609520255ab661B`,3343:`0x98d2919b9A214E6Fa5384AC81E6864bA686Ad74c`,4801:`0x66145f38cBAC35Ca6F1Dfb4914dF98F1614aeA88`,5042:`0x3600000000000000000000000000000000000000`,8453:`0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913`,9745:`0x2d661C89D812261039AF9764eceaAee884f5F67F`,10143:`0x534b2f3A21130d7a60830c2Df862319e593943A3`,33431:`0x2d9F7CAD728051AA35Ecdc472a14cf8cDF5CFD6B`,42161:`0xaf88d065e77c8cC2239327C5EDb3A432268e5831`,42220:`0xcebA9300f2b948710d2653dD7B07f33A8B32118C`,43113:`0x5425890298aed601595a70AB815c96711a31Bc65`,43114:`0xB97EF9Ef8734C71904D8002F8b6Bc66Dd9c48a6E`,57054:`0xA4879Fed32Ecbef99399e5cbC247E533421C4eC6`,57073:`0x2D270e6886d130D724215A266106e6832161EAEd`,59141:`0xFEce4462D57bD51A6A552365A011b95f0E16d9B7`,59144:`0x176211869cA2b568f2A7D4EE941E073a821EE1ff`,64165:`0x0BA304580ee7c9a980CF72e55f5Ed2E9fd30Bc51`,80002:`0x41E94Eb019C0762f9Bfcf9Fb1E58725BfB0e7582`,81224:`0xd996633a415985DBd7D6D12f4A4343E31f5037cf`,84532:`0x036CbD53842c5426634e7929541eC2318f3dCF7e`,98866:`0x222365EF19F7947e5484218551B56bb3965Aa7aF`,98867:`0xcB5f30e335672893c7eb944B374c196392C19D18`,421614:`0x75faf114eafb1BDbe2F0316DF893fd58CE46AA4d`,688689:`0xcfC8330f4BCAB529c625D12781b1C19466A9Fc8B`,763373:`0xFabab97dCE620294D2B0b0e46C68964e326300Ac`,812242:`0x6d7f141b6819C2c9CC2f818e6ad549E7Ca090F8f`,5042002:`0x3600000000000000000000000000000000000000`,11142220:`0x01C5C0122039549AD1493B8220cABEdD739BC44E`,11155111:`0x1c7D4B196Cb0C7B01d743Fbc6116a902379C7238`,11155420:`0x5fd84259d66Cd46123540766Be93DFE6D43130D7`},currency:`USD`,decimals:6,name:`USD Coin`,popular:!0,symbol:`USDC`}),zA=uA({addresses:{4217:`0x20c000000000000000000000b9537d11c60e8b50`,42431:`0x20c0000000000000000000009e8d7eb59b783726`},currency:`USD`,decimals:6,name:`Bridged USDC (Stargate)`,symbol:`USDC.e`}),BA=uA({addresses:{4217:`0x20c0000000000000000000002f52d5cc21a3207b`},currency:`USD`,decimals:6,name:`USDe`,symbol:`USDe`}),VA=uA({addresses:{4217:`0x20c00000000000000000000014f22ca97301eb73`},currency:`USD`,decimals:6,name:`USDT0`,symbol:`USDT0`}),HA=uA({addresses:{1:`0x136471a34f6ef19fE571EFFC1CA711fdb8E49f2b`,56:`0x8D0fA28f221eB5735BC71d3a0Da67EE5bC821311`,97:`0x109656Aba6F175c634c63C9874f29CeAAAB8E606`,5042002:`0xe9185F0c5F296Ed1797AaE4238D26CCaBEadb86C`,11155111:`0x38D3A3f8717F4DB1CcB4Ad7D8C755919440848A3`},currency:`USD`,decimals:6,name:`US Yield Coin`,symbol:`USYC`}),UA=uA({addresses:{4217:`0x20c000000000000000000000aeed2ec36a54d0e5`},currency:`wsrUSD`,decimals:6,name:`Wrapped Savings rUSD`,symbol:`wsrUSD`}),WA={all:[dA,fA,pA,mA,hA,gA,_A,vA,yA,bA,xA,SA,CA,wA,TA,EA,DA,OA,kA,AA,jA,MA,NA,PA,FA,IA,LA,RA,zA,BA,VA,HA,UA],popular:[EA,RA],tempo:[dA,fA,pA,mA,hA,_A,vA,yA,xA,SA,CA,wA,TA,EA,DA,OA,kA,AA,jA,MA,NA,PA,FA,IA,LA,zA,BA,VA,UA]},GA=new WeakSet,KA=new WeakSet;function qA(e){return GA.has(e)}function JA(e){return KA.has(e)}var YA=new WeakMap,XA=`viem:relay:cache:`;function ZA(e){if(e)return{getItem:t=>e.getItem(t),setItem:(t,n)=>e.setItem(t,n),removeItem:t=>e.removeItem(t)}}async function QA(e,t){let{store:n,ttl:r}=t,i=`${XA}${t.key}`,a=!0,o=Error(`Relay cache operation timed out.`);return KO(async()=>{let t=await n.getItem(i);if(!a)throw o;if(t)try{let e=JSON.parse(t,(e,t)=>{if(typeof t!=`string`||!t.startsWith(XA))return t;if(t.startsWith(`${XA}string:`))return t.slice(`${XA}string:`.length);if(t.startsWith(`${XA}bigint:`))return BigInt(t.slice(`${XA}bigint:`.length));throw TypeError(`Invalid relay cache value.`)});if(e.expiresAt>Date.now())return e.value}catch{}let s=YA.get(n);s||(s=new Map,YA.set(n,s));let c=s.get(i);if(c)return c;let l=(async()=>{let t=await e();if(!a)throw o;return t!==void 0&&await n.setItem(i,JSON.stringify({value:t,expiresAt:Date.now()+r},(e,t)=>typeof t==`bigint`?`${XA}bigint:${t}`:typeof t==`string`&&t.startsWith(XA)?`${XA}string:${t}`:t)),t})().finally(()=>s.delete(i));return s.set(i,l),l},{timeout:3e4,errorInstance:o}).finally(()=>{a=!1})}async function $A(e,t,n,r){let i=new AbortController,a=()=>i.abort(n.signal?.reason);n.signal?.addEventListener(`abort`,a,{once:!0}),n.signal?.aborted&&a();let o=setTimeout(()=>i.abort(new ap({message:`Relay fill exceeded its deadline.`})),r.timeout??1e4),s=i.signal,c,l=new Promise((e,t)=>{c=t}),u=()=>c(s.reason);s.addEventListener(`abort`,u,{once:!0});try{return s.throwIfAborted(),await Promise.race([e(t,{...n,signal:s}),l])}finally{clearTimeout(o),n.signal?.removeEventListener(`abort`,a),s.removeEventListener(`abort`,u),i.abort()}}async function ej(e,t){let{account:n=ce,tokens:r=[],targets:i=[]}=t,a=[...new Set(i.map(e=>Np(e).masterId))],{data:o}=await ni(e,{batch:!1,data:ui([tj,Yr([{type:`address`},{type:`address`},{type:`address[]`},{type:`address`},{type:`bytes4[]`}],[n,Ke,r,Wt,a])])}),[s,c,l,u,d]=Zr([{type:`address`},{type:`uint256`},{type:`uint256[]`},{type:`bool`},{type:`address[]`}],o??`0x`);return{preferredToken:s,preferredBalance:c,balances:r.map((e,t)=>({address:e,balance:l[t]})),virtualAddresses:u&&i.length>0?Object.fromEntries(i.map(e=>{let t=d[a.indexOf(Np(e).masterId)];return[e,t===`0x0000000000000000000000000000000000000000`?null:t]})):void 0}}var tj=`0x608060405234801561001057600080fd5b506040516108be3803806108be83398101604081905261002f916106ed565b6040516001600160a01b038616602482015260009061008090869060440160408051601f198184030181529190526020810180516001600160e01b03908116631da931f560e31b179091526103fc16565b9150600090506001600160a01b0382111561009c57600061009e565b815b905060006001600160a01b038816156101305760405141602482015260009081906100fb908a9060440160408051601f198184030181529190526020810180516001600160e01b039081166336e2a53d60e11b179091526103fc16565b9150915081801561011357506001600160a01b038111155b1561012d578015610124578061012a565b608360961b5b92505b50505b600086516001600160401b0381111561014b5761014b610601565b604051908082528060200260200182016040528015610174578160200160208202803683370190505b506040516001600160a01b038b1660248201529091506000908190819060440160408051601f198184030181529190526020810180516001600160e01b03166370a0823160e01b179052905060005b8a51811015610270576101f78b82815181106101e1576101e16107e9565b6020026020010151838e8961042c60201b60201c565b858281518110610209576102096107e9565b602002602001018181525050866001600160a01b03168b8281518110610231576102316107e9565b60200260200101516001600160a01b031603610268576001925084818151811061025d5761025d6107e9565b602002602001015193505b6001016101c3565b508115801561028757506001600160a01b03861615155b1561029b5761029886828d8861042c565b92505b600088516001600160401b038111156102b6576102b6610601565b6040519080825280602002602001820160405280156102df578160200160208202803683370190505b509050600160005b8a518110156103c7576000806103648e8e8581518110610309576103096107e9565b602002602001015160405160240161033191906001600160e01b031991909116815260200190565b60408051601f198184030181529190526020810180516001600160e01b03908116636c2558b360e11b179091526103fc16565b9150915081158061037b57506001600160a01b0381115b1561038957600093506103bd565b8085848151811061039c5761039c6107e9565b60200260200101906001600160a01b031690816001600160a01b0316815250505b50506001016102e7565b50600088868884866040516020016103e3959493929190610844565b6040516020818303038152906040529050805160208201f35b60008060405160208185516020870188620186a0fa60203d1015169250821561042457805191505b509250929050565b60008061043986866103fc565b91505080158061045057506001600160a01b038316155b1561045f576000915050610565565b826001600160a01b0316866001600160a01b03161480610485575061048584878561056d565b15610491579050610565565b6040805160048152602481019091526020810180516001600160e01b03908116630217a4b760e41b179091526000916104cd918991906103fc16565b9150508015806104e357506001600160a01b0381115b156104f357600092505050610565565b806001600160a01b03808216908916148061051f5750846001600160a01b0316816001600160a01b0316145b156105305760009350505050610565565b61053b86898361056d565b801561054d575061054d86828761056d565b1561055d57829350505050610565565b600093505050505b949350505050565b6040516001600160a01b03808416602483015282166044820152600090819060640160408051601f198184030181529181526020820180516001600160e01b031663298d501f60e11b1781528151835193945092839189620186a0fa600060208301511160403d101582161693505050509392505050565b80516001600160a01b03811681146105fc57600080fd5b919050565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f191681016001600160401b038111828210171561063f5761063f610601565b604052919050565b60006001600160401b0382111561066057610660610601565b5060051b60200190565b600082601f83011261067b57600080fd5b815161068e61068982610647565b610617565b8082825260208201915060208360051b8601019250858311156106b057600080fd5b602085015b838110156106e35780516001600160e01b0319811681146106d557600080fd5b8352602092830192016106b5565b5095945050505050565b600080600080600060a0868803121561070557600080fd5b61070e866105e5565b945061071c602087016105e5565b60408701519094506001600160401b0381111561073857600080fd5b8601601f8101881361074957600080fd5b805161075761068982610647565b8082825260208201915060208360051b85010192508a83111561077957600080fd5b6020840193505b828410156107a257610791846105e5565b825260209384019390910190610780565b95506107b492505050606087016105e5565b60808701519092506001600160401b038111156107d057600080fd5b6107dc8882890161066a565b9150509295509295909350565b634e487b7160e01b600052603260045260246000fd5b600081518084526020840193506020830160005b8281101561083a5781516001600160a01b0316865260209586019590910190600101610813565b5093949350505050565b6001600160a01b0386168152602080820186905260a060408301819052855190830181905260009186019060c0840190835b81811015610894578351835260209384019390920191600101610876565b5050851515606085015283810360808501526108b081866107ff565b999850505050505050505056fe`;function nj(e){if(typeof e==`number`)return e;if(typeof e==`bigint`)return Number(e);if(typeof e==`string`){if(!/^(?:0x[0-9a-f]+|[0-9]+)$/i.test(e))return;let t=Number(e);if(Number.isFinite(t))return t}}function rj(e){let{to:t,data:n,value:r,...i}=e,a=ij(e.keyAuthorization),o=a?{keyAuthorization:a}:{};if(Array.isArray(e.calls))return{...e,...o,calls:e.calls.map(e=>{if(!e||typeof e!=`object`||Array.isArray(e))throw new op({message:`Expected a transaction call object.`});return aj(e.to),{...e,value:oj(e.value)}})};aj(t);let s={...t===void 0?{}:{to:t},...n===void 0?{}:{data:n},...r===void 0?{}:{value:oj(r)}};return{...i,...o,calls:[s]}}function ij(e){if(!e||typeof e!=`object`)return;let t=e.signature;if(t&&typeof t==`object`)return typeof t.signature==`object`&&t.signature!==null?We(e):e}function aj(e){if(e!=null&&(typeof e!=`string`||!nn(e,{strict:!1})))throw new op({message:`Invalid transaction call target.`})}function oj(e){if(typeof e!=`string`||!e.startsWith(`0x`))return e;if(!/^0x[\da-f]*$/i.test(e))throw new op({message:`Invalid transaction value.`});return BigInt(e===`0x`?`0x0`:e)}function sj(e){return typeof e==`string`?e.startsWith(`0x76`)||e.startsWith(`0x78`):!1}function cj(e){if(!e)throw Error("Expected `tx` in eth_fillTransaction response.");return Op({type:`0x76`,...e})}function lj(e){return{...kp(e),...`nonceKey`in e&&e.nonceKey!==void 0?{nonceKey:k(e.nonceKey)}:{}}}function uj(e){let t=e,n,r=new Set;for(;t&&typeof t==`object`&&!r.has(t);){r.add(t);let e=t;!(t instanceof Ee)&&typeof e.code==`number`&&typeof e.message==`string`&&(n=t instanceof rp?t:{code:e.code,message:e.message,data:e.data}),t=e.cause}return n?n.code===-32603&&/^Revm error: transaction expired(?:\.|: .+)?$/.test(n.message)?new ip({message:`Transaction expired.`,data:{code:`transaction_expired`}}):n instanceof rp?n:new rp(n):new sp({message:`Internal error`,data:{code:`internal_error`}})}function dj(e,t){let n={...t,...e},r=e.calls;if(Array.isArray(r)&&r.length>0)return n;let i=t.calls;if(Array.isArray(i))return n.calls=i,n;let{to:a,data:o,value:s}=t;return a===void 0&&o===void 0&&s===void 0||(n.calls=[{...a===void 0?{}:{to:a},...o===void 0?{}:{data:o},...s===void 0?{}:{value:s}}]),n}async function fj(e,t){let n=pj(t.calls);if(n.length!==0)return(await ej(e,{targets:n})).virtualAddresses}function pj(e){let t=new Set;for(let n of e)for(let e of[n.to,mj(n.data)])if(e&&ci(e)&&Mp(e)&&(t.add(e.toLowerCase()),t.size>100))throw new op({message:`Virtual-address targets exceed the limit of 100 addresses.`});return[...t]}function mj(e){if(!e)return;let t=e.slice(0,10).toLowerCase();if(hj.has(t))try{let{args:t,functionName:n}=ec({abi:tn,data:e});if((n===`transfer`||n===`transferWithMemo`)&&typeof t[0]==`string`)return t[0];if((n===`transferFrom`||n===`transferFromWithMemo`)&&typeof t[1]==`string`)return t[1]}catch{}}var hj=new Set([`0xa9059cbb`,`0x95777d59`,`0x23b872dd`,`0x929c2539`]);function gj(e){let t=e.calls;return t&&t.length>0?t.map(e=>({...e.to?{to:e.to}:{},...e.data?{data:e.data}:{},...e.value?{value:e.value}:{}})):[{...e.to?{to:e.to}:{},...e.data?{data:e.data}:{},...e.value?{value:e.value}:{}}]}async function _j(e){return WA.tempo.flatMap(t=>{let n=t.addresses[e];return n?[n]:[]})}async function vj(e,t){let{token:n,tokenMetadata:r,store:i}=t,a=r?.[n]??r?.[n.toLowerCase()];if(rt(n)&&a)return{decimals:6,symbol:a.symbol,name:a.name};let o=()=>Ft(e,{token:n}),s=i?await QA(o,{key:`tokenMetadata:${e.chain?.id??0}:${n.toLowerCase()}`,store:i,ttl:864e5}):await o();return{decimals:s.decimals??6,symbol:a?.symbol||s.symbol,name:a?.name||s.name}}async function yj(e,t){let{account:n,calls:r,feeToken:i,gas:a,store:o,maxFeePerGas:s,signal:c}=t;c?.throwIfAborted();try{let t=i&&!r.some(e=>e.to?.toLowerCase()===i.toLowerCase())?[Et.call(e,{account:n??`0x0000000000000000000000000000000000000000`,token:i})]:[],l=await zk(e,{account:n===`0x0000000000000000000000000000000000000000`?void 0:n,calls:[...r,...t],traceTransfers:!0}),u=l.results.slice(0,r.length),{tokenMetadata:d}=l;c?.throwIfAborted();let f=[];for(let e of u)e.logs&&f.push(...e.logs);return{balanceDiffs:n?await bj(e,{account:n,store:o,signal:c,logs:f,tokenMetadata:d}):{},fee:await xj(e,{feeToken:i,gas:a,store:o,signal:c,maxFeePerGas:s,tokenMetadata:d}),tokenMetadata:d}}catch{return c?.throwIfAborted(),{balanceDiffs:void 0,fee:await xj(e,{feeToken:i,gas:a,store:o,maxFeePerGas:s,signal:c}),tokenMetadata:void 0}}}async function bj(e,t){let{account:n,store:r,logs:i,tokenMetadata:a,signal:o}=t;o?.throwIfAborted();let s=n.toLowerCase(),c=De({abi:[mu(tn,`Transfer`)],eventName:`Transfer`,logs:i}),l=De({abi:[mu(tn,`Approval`)],eventName:`Approval`,logs:i}),u=new Map;for(let e of c){let t=e.address.toLowerCase(),n=e.args.from.toLowerCase(),r=e.args.to.toLowerCase(),i=u.get(t)??{incoming:0n,outgoing:0n,approved:0n,recipients:new Set,token:e.address};n===s&&(i.outgoing+=e.args.amount,i.recipients.add(e.args.to)),r===s&&(i.incoming+=e.args.amount),u.set(t,i)}let d=new Map;for(let e of l)e.args.owner.toLowerCase()===s&&d.set(`${e.address.toLowerCase()}:${e.args.spender.toLowerCase()}`,e);for(let e of d.values()){if(e.args.amount===0n)continue;let t=e.address.toLowerCase(),n=u.get(t)??{incoming:0n,outgoing:0n,approved:0n,recipients:new Set,token:e.address};n.approved+=e.args.amount,n.recipients.add(e.args.spender),u.set(t,n)}let f=[...u.values()].filter(e=>(e.outgoing>e.incoming?e.outgoing-e.incoming:e.incoming-e.outgoing)>0n||e.approved>0n);if(f.length===0)return{};if(f.length>100)return;let p=new Map,m=0;if(await Promise.all(Array.from({length:Math.min(10,f.length)},async()=>{for(;m<f.length;){let t=f[m++];try{let n=await vj(e,{token:t.token,tokenMetadata:a,store:r});p.set(t.token.toLowerCase(),n)}catch{o?.throwIfAborted()}}})),o?.throwIfAborted(),p.size!==f.length)return;let h=[];for(let e of f){let t=e.incoming>e.outgoing?e.incoming-e.outgoing:0n,n=(e.outgoing>e.incoming?e.outgoing-e.incoming:0n)+e.approved,r=p.get(e.token.toLowerCase()),i=r.decimals,a={address:e.token,decimals:i,name:r.name,symbol:r.symbol};t>0n&&h.push({...a,direction:`incoming`,formatted:Ie(t,i),recipients:[],value:k(t)}),n>0n&&h.push({...a,direction:`outgoing`,formatted:Ie(n,i),recipients:[...e.recipients],value:k(n)})}return{[n]:h}}async function xj(e,t){let{feeToken:n,gas:r,store:i,maxFeePerGas:a,tokenMetadata:o,signal:s}=t;if(s?.throwIfAborted(),n&&r&&a)try{let t=await vj(e,{token:n,tokenMetadata:o,store:i});s?.throwIfAborted();let c=r*a,l=10n**BigInt(Math.max(0,18-t.decimals)),u=(c+l-1n)/l;return{amount:k(u),decimals:t.decimals,formatted:Ie(u,t.decimals),symbol:t.symbol}}catch{s?.throwIfAborted();return}}function Sj(e){if(!(e instanceof Error))return!1;let t=new Set,n=[e];for(;n.length;){let e=n.pop();if(!e||typeof e!=`object`||t.has(e))continue;t.add(e);let r=e;if(r.code===3||r.name===`UpstreamRevertError`||r.name===`ExecutionRevertedError`||r.name===`ContractFunctionRevertedError`||[r.message,r.details].some(e=>typeof e==`string`&&/^execution reverted\b/i.test(e)))return!0;n.push(r.cause,r.error)}return!1}async function Cj(e,t,n,r){let i=Rt(e),a={from:t.from,to:t.to??null,gas:`0x0`,nonce:`0x0`,value:`0x0`,maxFeePerGas:`0x0`,maxPriorityFeePerGas:`0x0`};if(i.errorName===`InsufficientBalance`&&i.args?.length===3){let[e,o,s]=i.args,c=rj(t),l=c?gj(c):void 0,[{balanceDiffs:u,tokenMetadata:d},f]=l?await Promise.all([yj(n,{account:ce,calls:l,store:r}),fj(n,{calls:l}).catch(()=>void 0)]):[{balanceDiffs:void 0,tokenMetadata:void 0},void 0],p=t.from&&u?{[t.from]:u[`0x0000000000000000000000000000000000000000`]??[]}:u,m=await vj(n,{token:s,tokenMetadata:d,store:r}).catch(()=>void 0),h=o-e;return{tx:a,capabilities:{balanceDiffs:p,error:dt(i),insufficientFunds:m?{amount:k(h),decimals:m.decimals,formatted:Ie(h,m.decimals),token:s,symbol:m.symbol}:void 0,sponsored:!1,...f?{virtualAddresses:f}:{}}}}let o=rj(t),s=o?await fj(n,{calls:gj(o)}).catch(()=>void 0):void 0;return{tx:a,capabilities:{error:dt(i),sponsored:!1,...s?{virtualAddresses:s}:{}}}}function wj(e,t={},n){let r=t,i=t.plugins??[];if(i.length===0)return e;if(i.filter(e=>e.signTransaction).length>1)throw Error(`Only one relay transaction signer may be configured.`);let a=async(t,a={})=>{let o=new Map,s=new Map,c=e=>{if(!e)return;let t=o.get(e);return t||(t=ZA(e),o.set(e,t)),t},l=async(t,o,d)=>{let f={request:o,options:{...d},result:void 0},p=new Map,m=e=>{let t=p.get(e);if(t)return t;let i=new Map,a=(e=f.options.chainId)=>{if(e===void 0||!Number.isSafeInteger(e)||e<=0)throw new op({message:`A chain ID is required to resolve the downstream client.`});return e},o={get request(){return f.request},set request(e){f.request=e},get result(){return f.result},set result(e){f.result=e},get options(){return f.options},set options(e){f.options=e},get client(){return o.getClient()},getClient(t){let r=a(t),o=i.get(r);if(o)return o;let s=n?.(r);if(s?.chain&&s.chain.id!==r)throw new op({message:`Conflicting chain ids.`});return o=jO({chain:{...oA,...s?.chain,id:r},batch:{multicall:{deployless:!0}},transport:t=>{let n=Tk({request:async(t,n)=>(await l(e+1,t,{...f.options,...n,chainId:r})).state.result},{retryCount:0})(t);return{...n,request:n.config.request}}}),i.set(r,o),o},async resolveTokens(e){let t=a(e),n=s.get(t);return n||(n=Promise.resolve().then(()=>(r.resolveTokens??_j)(t)),s.set(t,n)),n},getStore:c};return p.set(e,o),o},h=async t=>{if(t===i.length){let t=f.request.params?.[0],n=f.request.method===`eth_fillTransaction`&&t?.feePayer===!0&&!t.feePayerSignature?t:void 0,r=n?Ej(n):void 0,i=(()=>{if(!n)return f.request;let{maxFeePerGas:e,maxPriorityFeePerGas:t,...i}=n;return{...f.request,params:[{...r?i:n,feeToken:void 0}]}})();a.signal?.throwIfAborted();let o=await e(i,{...f.options,...u?{signal:a.signal}:{}});f.result=r?Dj(o,r):o;return}let n=i[t],r=m(t);if(!n.handleRequest)return h(t+1);let o=!1,s=await n.handleRequest(r,async()=>{if(o)throw Error(`next() may only be called once per middleware invocation.`);o=!0,await h(t+1)});s!==void 0&&(f.result=s)};return await h(t),{state:f,contextAt:m}},u=t.method===`eth_fillTransaction`,d=[`eth_signRawTransaction`,`eth_sendRawTransaction`,`eth_sendRawTransactionSync`].includes(t.method),f=t.params?.[0],p;try{if(a.signal?.throwIfAborted(),u&&(!f||typeof f!=`object`||Array.isArray(f)))throw new op({message:`Expected a transaction object.`});u&&rj(f);let e=(()=>{if(d&&sj(t.params?.[0]))try{return x(t.params[0]).chainId}catch{throw new op({message:`Invalid serialized Tempo transaction.`})}if(!u||f.chainId===void 0)return;let e=nj(f.chainId);if(e===void 0||!Number.isSafeInteger(e)||e<=0)throw new op({message:`Invalid transaction chain ID.`});return e})();if(e!==void 0&&a.chainId!==void 0&&e!==a.chainId)throw new op({message:`Conflicting chain ids.`});if(p=await l(0,t,{...a,...(a.chainId??e)===void 0?{}:{chainId:a.chainId??e}}),!u)return p.state.result;let n=p.state.result;if(n.capabilities?.error)return n;let r=cj(dj(n.tx,rj(f))),o={...n,tx:lj(r)},s=Tj(structuredClone(o)),c=pj(gj(r)),m=o.capabilities?.virtualAddresses,[h,g,_]=await Promise.all([Promise.all(i.map((e,t)=>e.afterFill?.(s,p.contextAt(t)))),Promise.all(i.map((e,t)=>e.signTransaction?.(s,p.contextAt(t)))),c.length>0&&!c.every(e=>m&&e in m)?fj(p.contextAt(-1).client,{calls:gj(r)}).catch(()=>{a.signal?.throwIfAborted()}):void 0]);a.signal?.throwIfAborted();let v={...o.capabilities},y=new Set;for(let e of h)for(let[t,n]of Object.entries(e?.capabilities??{})){if(y.has(t))throw Error(`Conflicting relay capability: ${t}.`);y.add(t),v[t]=n}let b=g.find(e=>e!==void 0);b&&(delete o.tx.signature,o.tx.feePayerSignature=b);let S=v.sponsor??o.sponsor;return{...o,capabilities:{sponsored:!!S,...v,..._?{virtualAddresses:_}:{}}}}catch(t){if(a.signal?.throwIfAborted(),u&&Sj(t)&&f.capabilities?.errors===!0){let n=a.chainId??nj(f.chainId);return Cj(t,f,jO({chain:{...oA,id:n??oA.id},transport:Tk({request:(t,r)=>e(t,{...a,...r,chainId:n,signal:a.signal})},{retryCount:0})}))}throw!u&&!d?t:uj(t)}};if(t.timeout!==void 0&&(!Number.isSafeInteger(t.timeout)||t.timeout<=0))throw new op({message:`Expected a positive integer for timeout.`});if(t.timeout!==void 0&&t.timeout>2147483647)throw new op({message:`The fill timeout cannot exceed 2147483647 milliseconds.`});return(e,n={})=>e.method===`eth_fillTransaction`?$A(a,e,n,t):a(e,n)}function Tj(e){if(e&&typeof e==`object`){for(let t of Object.values(e))Tj(t);Object.freeze(e)}return e}function Ej(e){if(e.gas!=null)return;let t=Oj(e.maxFeePerGas),n=Oj(e.maxPriorityFeePerGas);if(t!==null&&n!==null&&(t!==void 0||n!==void 0)&&!(t!==void 0&&n!==void 0&&n>t))return{maxFeePerGas:t,maxPriorityFeePerGas:n}}function Dj(e,t){let{tx:n}=e??{};if(!n||typeof n!=`object`||n.feePayerSignature)return e;let r=Oj(n.maxFeePerGas),i=Oj(n.maxPriorityFeePerGas),a=t.maxFeePerGas??(r!=null&&t.maxPriorityFeePerGas!==void 0&&t.maxPriorityFeePerGas>r?t.maxPriorityFeePerGas:r);if(a==null)return t.maxPriorityFeePerGas===void 0?e:{...e,tx:{...n,maxPriorityFeePerGas:k(t.maxPriorityFeePerGas)}};let o=t.maxPriorityFeePerGas??(i!=null&&i<a?i:a);return{...e,tx:{...n,maxFeePerGas:k(a),maxPriorityFeePerGas:k(o)}}}function Oj(e){if(e!=null)return typeof e==`bigint`?e>=0n&&e<=kj?e:null:typeof e==`number`?Number.isSafeInteger(e)&&e>=0?BigInt(e):null:typeof e==`string`&&Aj.test(e)?an(e):null}var kj=2n**256n-1n,Aj=/^0x(?:0|[1-9a-fA-F][0-9a-fA-F]{0,63})$/,jj={CLOSE_GRACE_PERIOD:`0x956c8327`,VOUCHER_TYPEHASH:`0x94739e87`,close:`0x73b57f74`,computeChannelId:`0x185eeeac`,domainSeparator:`0xf698da25`,getChannel:`0xeef95313`,getChannelState:`0xd18da8b1`,getChannelStatesBatch:`0xd1f4cda2`,getVoucherDigest:`0xf3b349e8`,open:`0xedc53b00`,requestClose:`0x675402e5`,settle:`0x97fb5104`,storageCredits:`0x4d65338b`,topUp:`0xdc48471e`,withdraw:`0x41e2c664`};function Mj(e,t,n){if(typeof t!=`function`)return n=>{let r=e(n),i=wj((e,t)=>r.request(e,t),t,n.chain?()=>({chain:n.chain}):void 0);return{...r,request:((e,t)=>i(e,{chainId:n.chain?.id,...t})),value:{...r.value,...t.plugins?.some(qA)?{accounts:!0}:{},...t.plugins?.some(JA)?{keyAuthorization:!0}:{}}}};let{keyAuthorization:r,policy:i=`sign-only`}=n??{};return n=>{let a=e(n),o=t(n);return{...wk({key:Mj.type,name:`Relay Proxy`,async request({method:e,params:t},n){if(e===`eth_fillTransaction`)return o.request({method:e,params:t},n);if(e===`eth_getTransactionByHash`||e===`eth_getTransactionReceipt`){let r=await a.request({method:e,params:t},n);if(r!=null)return r;let i=await(async()=>{try{return await o.request({method:`account_getOperation`,params:t},n)}catch(e){if(e instanceof Yt||e instanceof Fe)return null;throw e}})();return!i||typeof i!=`object`||!(`type`in i)||i.type!==`transaction`?r:o.request({method:e,params:t},n)}if(e===`account_approveKeyAuthorization`||e===`account_approveRawTransaction`||e===`account_approveRawTransactionSync`||e===`account_getConfig`||e===`account_getOperation`||e===`relay_saveKeyAuthorization`)return o.request({method:e,params:t},n);if(e===`eth_sendRawTransactionSync`||e===`eth_sendRawTransaction`){let r=t[0],s=x(r);if(s.signature?.type===`configurable`)return o.request({method:e,params:t},n);if(s.feePayerSignature===null){if(i===`sign-and-broadcast`)return o.request({method:e,params:t},n);{let t=await o.request({method:`eth_signRawTransaction`,params:[r]},n);return a.request({method:e,params:[t]},n)}}}return await a.request({method:e,params:t},n)},type:Mj.type}),value:{accounts:!0,...r?{keyAuthorization:r}:{}}}}}var Nj=[oA,lA,sA,cA],Pj=j().regex(tc),Fj=`https://api.tempo.xyz`;function Ij(e){if(e.apiUrls?.trim()===`none`)return;let t=Object.values(Xs).some(t=>t===e.chainId);try{return Ks({value:e.apiUrls,variable:`TEMPO_API_URLS`}).find(t=>t.chainId===e.chainId)?.url??(t?Fj:void 0)}catch(e){if(!(e instanceof Qs))throw e;$s({error:e,message:`TEMPO_API_URLS does not parse.`});return}}function Lj(e){let t=Object.keys(Xs).find(t=>Xs[t]===e.chainId);if(t)return t;try{return Ks({value:e.rpcUrls}).find(t=>t.chainId===e.chainId)?.name}catch(e){if(!(e instanceof Qs))throw e;return}}var Rj=class extends q(`challenge_not_permitted`){name=`KeyAuthorization.ChallengeNotPermittedError`;constructor(e){let{clientId:t}=e;super({error_description:`Challenge not permitted: the app lacks the \`${xD}\` scope. Remove \`challenge\`, or grant the app the scope.`,field:`challenge`,meta:{client_id:t,scope:xD}})}},zj=class extends q(`duplicate_limit`){name=`KeyAuthorization.DuplicateLimitError`},Bj=class extends q(`duplicate_scope`){name=`KeyAuthorization.DuplicateScopeError`},Vj=class extends q(`empty_limits`){name=`KeyAuthorization.EmptyLimitsError`},Hj=class extends q(`empty_scopes`){name=`KeyAuthorization.EmptyScopesError`},Uj=class extends q(`expiry_exceeds_maximum`){name=`KeyAuthorization.ExpiryExceedsMaximumError`},Wj=class extends q(`expiry_passed`){name=`KeyAuthorization.ExpiryPassedError`},Gj=class extends q(`invalid_chain`){name=`KeyAuthorization.InvalidChainError`},Kj=class extends q(`invalid_expiry`){name=`KeyAuthorization.InvalidExpiryError`},qj=class extends q(`invalid_period`){name=`KeyAuthorization.InvalidPeriodError`},Jj=class extends q(`invalid_public_key`){name=`KeyAuthorization.InvalidPublicKeyError`},Yj=class extends q(`invalid_recipients`){name=`KeyAuthorization.InvalidRecipientsError`},Xj=class extends q(`limit_exceeds_maximum`){name=`KeyAuthorization.LimitExceedsMaximumError`},Zj=class extends q(`missing_key`){name=`KeyAuthorization.MissingKeyError`},Qj=class extends q(`missing_permissions`){name=`KeyAuthorization.MissingPermissionsError`},$j=class extends q(`missing_recipients`){name=`KeyAuthorization.MissingRecipientsError`},eM=class extends q(`scope_without_limit`){name=`KeyAuthorization.ScopeWithoutLimitError`},tM=class extends q(`unsupported_call`){name=`KeyAuthorization.UnsupportedCallError`},nM=class extends q(`unsupported_token`){name=`KeyAuthorization.UnsupportedTokenError`},rM=class extends q(`webauthn_required`){name=`KeyAuthorization.WebAuthnRequiredError`;constructor(e){super({error_description:e.description??`Passkey required: Tempo Account ${e.account} signs key authorizations only with its passkey, on a Tempo ID page. Authorize through a redirect, popup, or device grant, or name another account.`,field:`key_authorization.account`,meta:{account:e.account}})}},iM=Ci([`0x`,j().regex(/^[0-9a-fA-F]*$/)]).meta({pattern:`^0x[0-9a-fA-F]*$`}),aM=Ci([`0x`,j().regex(/^[0-9a-fA-F]{40}$/)]).meta({pattern:`^0x[0-9a-fA-F]{40}$`}),oM=Ci([`0x`,j().regex(/^[0-9a-fA-F]{0,64}$/)]).meta({pattern:`^0x[0-9a-fA-F]{0,64}$`}),sM=Ci([`0x`,j().regex(/^[0-9a-fA-F]{64}$/)]).meta({pattern:`^0x[0-9a-fA-F]{64}$`});function cM(e){return Fi(Ui([oM.meta({examples:e.examples}),ta()]),ta(),{decode:e=>typeof e==`bigint`?e:e===`0x`?0n:an(e),encode:e=>k(e)})}var lM=A({account:ia(aM).meta({description:`The Tempo Account the key acts for. Defaults to the account selected at sign-in, or else the oldest account.`,examples:[`0x9a073914db0d149375ac2b7fbb72c68c0780fb5f`]}),address:ia(aM).meta({description:"The access key's address. Required unless `publicKey` is present.",examples:[`0x81c0f22bd173c115d18eeea0f6a38e935ecf52fb`]}),chainId:ia(cM({examples:[`0x1079`]})).meta({description:`The chain ID the key acts on, as a hex quantity. Defaults to Tempo mainnet.`}),expiry:ia(Ti()).meta({description:`When the key expires, in Unix seconds. Defaults to one year after the request for a first-party app, and a third-party app must name it.`,examples:[1893456e3]}),keyType:ia(Qi([`p256`,`secp256k1`,`webAuthn`])).meta({description:"The signature scheme of the access key. Defaults to `secp256k1`.",examples:[`secp256k1`]}),limits:ia(Gi(A({limit:cM({examples:[`0x989680`]}).meta({description:"The most of the token the key may spend, in base units, as a hex quantity. Applies per period when `period` is set."}),period:ia(Ti()).meta({description:`Seconds after which the limit resets. Omitted or 0 for a one-time limit.`,examples:[86400]}),token:aM.meta({description:`The TIP-20 token the limit applies to.`,examples:[`0x20c0000000000000000000006a37DA5C996874BE`]})})).readonly()).meta({description:`The spending limit on each token. Defaults to the cap of each token that the scopes call, else of OUSD, for a first-party app, and a third-party app must name them.`}),publicKey:ia(iM).meta({description:"The access key's uncompressed public key, as hex. Tempo ID derives `address` from it when `address` is absent.",examples:[`0x0438ef39ed22456a6956f380ebc18c50bd18c0402658bc52903817cc8a1e8b2f7ed1da68afc7f343c1debc44c04ac60e62e96bbb261d2226e7a7b96e64fd0f0765`]}),scopes:ia(Gi(A({address:aM.meta({description:"The contract the key may call, such as a TIP-20 token or the TIP-1034 channel reserve at `0x4d50500000000000000000000000000000000000`.",examples:[`0x20c0000000000000000000006a37DA5C996874BE`]}),recipients:ia(Gi(aM).readonly()).meta({description:"The only addresses the call may name as recipient or spender. Required for `approve`, and refused on any call but `transfer`, `transferWithMemo`, and `approve` on a TIP-20 token.",examples:[[`0xff5deded16eb46018387144ff8bf41f26afb41af`]]}),selector:ia(Ui([iM,j().max(256)])).meta({description:"The function the key may call, as a 4-byte selector or a function signature. Absent, the key may call any function on the contract, which a TIP-20 token refuses, and the target takes no other scope. A headless flow accepts only `transfer`, `transferWithMemo`, and `approve` on a listed token, and `open` and `topUp` on the channel reserve, unless the app holds `tempo-id:sign`.",examples:[`0xa9059cbb`,`transfer(address,uint256)`]})})).readonly()).meta({description:"The calls the key may make. Defaults to `transfer` and `transferWithMemo` on each token that the key limits for a first-party app, and a third-party app must name them."})}),uM;(function(e){e.account=aM.meta({description:`The Tempo Account the key acts for.`,examples:[`0x9a073914db0d149375ac2b7fbb72c68c0780fb5f`]}),e.request=ia(lM.transform(AM)).meta({description:"A key authorization for the app's own key: the shape of the Accounts SDK's `wallet_connect` `authorizeAccessKey` capability. Omitted fields default to the headless ceiling.",id:`KeyAuthorizationRequest`}),e.description=A({account:aM.optional().meta({description:`The Tempo Account the request names. Absent when the request names none.`,examples:[`0x9a073914db0d149375ac2b7fbb72c68c0780fb5f`]}),calls:Gi(A({call:Qi([`open`,`topUp`]).meta({description:"The call on the channel reserve, which MPP sessions pay through: `open` starts a payment channel, and `topUp` adds to its deposit.",examples:[`open`,`topUp`]})})).readonly().meta({description:`The calls on the channel reserve, in the order of the scopes, which the screens list beside the limits. Transfers and approvals spend within the limits, so none is listed.`}),expiry:Ti().meta({description:`Unix seconds.`,examples:[1893456e3]}),limits:Gi(A({amount:j().meta({description:`In whole units.`,examples:[`1000`]}),currency:j().meta({description:"The tokens' currency, such as `USD`. A yield-bearing token names its own.",examples:[`USD`]}),period:Ti().optional().meta({description:`Seconds after which the amount resets. Omitted for a one-time limit.`,examples:[86400]}),tokens:Gi(A({amount:j().meta({description:`The token's own limit, in whole units.`,examples:[`1000`]}),symbol:j().meta({description:`The token's symbol, or its address when the token has no symbol.`,examples:[`OUSD`]})})).readonly().meta({description:`The tokens the amount spans.`})})).readonly().meta({description:`The spending limits, totaled for each currency and period.`}),unrecognized:Gi(A({address:aM.meta({description:`The contract that the call targets.`,examples:[`0x9a073914db0d149375ac2b7fbb72c68c0780fb5f`]}),selector:iM.optional().meta({description:`The 4-byte selector of the function. Absent when the scope allows any function on the contract.`,examples:[`0x12345678`]})})).readonly().meta({description:`The calls that Tempo ID does not recognize, which the screens warn about. Empty when it recognizes every call.`})}).meta({description:`What a key authorization grants, for approval screens.`,id:`KeyAuthorizationDescription`});let t=zi(`type`,[A({r:iM.meta({description:"The signature's 32-byte `r` value.",examples:[`0x12fe6a88b99377b94d6a628a86b9df544202c7b03827f44b16ee1a266ab98e17`]}),s:iM.meta({description:"The signature's 32-byte `s` value.",examples:[`0x4b6aa3723402498e07fb1f071673bd969d9f49a286af15ac60581d07ade24b77`]}),type:oa(`secp256k1`).meta({description:`A secp256k1 ECDSA signature.`}),v:iM.optional().meta({description:"The legacy recovery value, which `yParity` replaces. Absent in most envelopes.",examples:[`0x1c`]}),yParity:iM.meta({description:"The parity of the y-coordinate of the curve point, `0x0` or `0x1`.",examples:[`0x1`]})}).meta({description:`A secp256k1 signature.`}),A({preHash:Pi().meta({description:`Whether the signer hashed the digest with SHA-256 before signing it, as WebCrypto keys do.`,examples:[!0]}),pubKeyX:iM.meta({description:`The 32-byte x-coordinate of the signer's P256 public key.`,examples:[`0xdae3e3e5faba0a2aca73d4d2a4b84ad46460f3f23af8a60b17b8a13537cfd440`]}),pubKeyY:iM.meta({description:`The 32-byte y-coordinate of the signer's P256 public key.`,examples:[`0x816438c87ffd782cd0e37355eb83fbe1d4e5e905eaafa22fa27c32cc4abf7802`]}),r:iM.meta({description:"The signature's 32-byte `r` value.",examples:[`0x9da52cc71c005844434ce6996f7ea3b3262f84ec3a5d54f1d22d0bba9f2e5ea9`]}),s:iM.meta({description:"The signature's 32-byte `s` value.",examples:[`0x4b6aa3723402498e07fb1f071673bd969d9f49a286af15ac60581d07ade24b77`]}),type:oa(`p256`).meta({description:`A P256 (secp256r1) signature.`})}).meta({description:`A P256 signature, with its public key.`}),A({pubKeyX:iM.meta({description:`The 32-byte x-coordinate of the passkey's P256 public key.`,examples:[`0xdae3e3e5faba0a2aca73d4d2a4b84ad46460f3f23af8a60b17b8a13537cfd440`]}),pubKeyY:iM.meta({description:`The 32-byte y-coordinate of the passkey's P256 public key.`,examples:[`0x816438c87ffd782cd0e37355eb83fbe1d4e5e905eaafa22fa27c32cc4abf7802`]}),r:iM.meta({description:"The signature's 32-byte `r` value.",examples:[`0x9da52cc71c005844434ce6996f7ea3b3262f84ec3a5d54f1d22d0bba9f2e5ea9`]}),s:iM.meta({description:"The signature's 32-byte `s` value.",examples:[`0x4b6aa3723402498e07fb1f071673bd969d9f49a286af15ac60581d07ade24b77`]}),type:oa(`webAuthn`).meta({description:`A WebAuthn passkey signature.`}),webauthnData:iM.meta({description:"The assertion's authenticator data followed by its `clientDataJSON`, as hex.",examples:[`0xa7cb28053c8ee4e5394fc67a0018dc1c622dad5ce3591b8ca13094ae86d11ba605000000007b2274797065223a22776562617574686e2e676574222c226368616c6c656e6765223a2271334a306257467a6157356e6247567a6157647559585231636d566b6157646c633352765a6d746c65574631644767222c226f726967696e223a2268747470733a2f2f617574682e74656d706f2e78797a222c2263726f73734f726967696e223a66616c73657d`]})}).meta({description:`A WebAuthn signature, with its public key.`})]).meta({description:`A signature by one key, as secp256k1, P256, or WebAuthn.`});e.rpc=A({account:aM.nullable().optional().meta({description:`The Tempo Account the key is bound to (TIP-1049). Absent or null when the key has no account binding.`,examples:[`0x9a073914db0d149375ac2b7fbb72c68c0780fb5f`]}),allowedCalls:Gi(A({selectorRules:Gi(A({recipients:Gi(aM).readonly().optional().meta({description:`The only addresses the call may name as recipient or spender. Absent when any address may receive.`,examples:[[`0xff5deded16eb46018387144ff8bf41f26afb41af`]]}),selector:iM.meta({description:`The 4-byte selector of the function the key may call.`,examples:[`0xa9059cbb`]})})).readonly().optional().meta({description:`The functions the key may call on the target. Absent when the key may call any function on it.`}),target:aM.meta({description:`The contract the key may call.`,examples:[`0x20c0000000000000000000006a37DA5C996874BE`]})})).readonly().optional().meta({description:`The calls the key may make. Absent when the key may make any call.`}),chainId:iM.meta({description:`The chain ID the key acts on, as a hex quantity.`,examples:[`0xa5bf`]}),expiry:iM.nullable().optional().meta({description:`When the key expires, in Unix seconds, as a hex quantity. Absent or null when the key never expires.`,examples:[`0x6acdc1b4`]}),keyId:aM.meta({description:`The access key's address.`,examples:[`0x81c0f22bd173c115d18eeea0f6a38e935ecf52fb`]}),keyType:j().meta({description:"The signature scheme of the access key: `secp256k1`, `p256`, or `webAuthn`. The node names a configurable account key `multisig`.",examples:[`secp256k1`]}),limits:Gi(A({limit:iM.meta({description:"The most of the token the key may spend, in base units, as a hex quantity. Applies per period when `period` is set.",examples:[`0x989680`]}),period:iM.optional().meta({description:"Seconds after which the limit resets, as a hex quantity. Absent or `0x0` for a one-time limit.",examples:[`0x15180`]}),token:aM.meta({description:`The TIP-20 token the limit applies to.`,examples:[`0x20c0000000000000000000006a37DA5C996874BE`]})})).readonly().optional().meta({description:`The spending limit on each token, or absent when spending is unlimited. An empty list allows no spending.`}),signature:Ui([iM.meta({description:`A configurable account's RLP-encoded signature, which carries its owner approvals.`,examples:[`0xf8a094ff5deded16eb46018387144ff8bf41f26afb41afc0f87cf87a80a012fe6a88b99377b94d6a628a86b9df544202c7b03827f44b16ee1a266ab98e17a04b6aa3723402498e07fb1f071673bd969d9f49a286af15ac60581d07ade24b77`]}),t,A({keyId:aM.optional().meta({description:"The address of the access key that signed. Recovered from `signature` when absent.",examples:[`0x624f27c462b885a83c698cac444a106a8c519e25`]}),signature:t.meta({description:`The access key's own signature.`}),type:oa(`keychain`).meta({description:`A signature by an access key for an account.`}),userAddress:aM.meta({description:`The Tempo Account the access key signs for.`,examples:[`0x9a073914db0d149375ac2b7fbb72c68c0780fb5f`]}),version:Qi([`v1`,`v2`]).optional().meta({description:"The keychain signature version, `v1` by default. `v2` binds the signature to `userAddress`.",examples:[`v2`]})}).meta({description:`An access key signature that wraps a primitive signature.`})]).meta({description:`The owner's signature envelope, in the node's format.`}),witness:sM.optional().meta({description:`The witness the signature binds, when the request sent one.`,examples:[`0xf1e22f902be2546fe35d49388503ef7ea5c6c0e95a0f4b89d474e58793b64dec`]})}).meta({description:`A signed key authorization (TIP-1011), in the node's RPC format.`,id:`KeyAuthorization`})})(uM||={});var dM=31536e3,fM=EA(oA.id).address,pM=Nj,mM=oA.id,hM={BRL:`5000`,BTC:`0.01`,CHF:`800`,EUR:`850`,GBP:`750`,USD:`1000`},gM=uA({addresses:{[oA.id]:`0x20c000000000000000000000f37de3740adec032`,[lA.id]:`0x20c000000000000000000000f37de3740adec032`},currency:`USD`,decimals:6,name:`MACH`,symbol:`MACH`}),_M=new Map([...WA.tempo,gM].flatMap(e=>pM.flatMap(t=>{let n=e.addresses,r=n[t.id]??(t.id===sA.id||t.id===cA.id?n[lA.id]:void 0)??(e.symbol===`OUSD`?n[oA.id]:void 0);if(!r)return[];let i=hM[e.currency??``]??hM.USD;return[[`${t.id}:${r.toLowerCase()}`,{address:ae(r),cap:Jt(i,e.decimals),currency:e.currency,decimals:e.decimals,symbol:e.symbol??r}]]}))),vM={approve:hu(`approve(address,uint256)`),transfer:hu(`transfer(address,uint256)`),transferWithMemo:hu(`transferWithMemo(address,uint256,bytes32)`)},yM={address:qt,open:jj.open,topUp:jj.topUp};function bM(e,t){let n=t.selector===void 0?void 0:NM(t.selector);return t.address.toLowerCase()===yM.address?n===yM.open||n===yM.topUp:!!MM(e,t.address)&&(n===vM.approve||n===vM.transfer||n===vM.transferWithMemo)}function xM(e,t){return t.challenge===void 0?e:{...e,witness:fe(t.challenge)}}function SM(e){let t=Math.floor(Date.now()/1e3);if(!e.chainId)return new Gj({error_description:"Invalid `chainId`: 0. Use a Tempo chain ID, such as 4217.",field:`key_authorization.chainId`,meta:{chain_id:0}});let n=Number(e.chainId);if(!e.address&&!e.publicKey)return new Zj({error_description:"Missing `address` or `publicKey`. Provide the access key.",field:`key_authorization.address`});if(e.address===`0x0000000000000000000000000000000000000000`)return new Zj({error_description:"Invalid `address`: the zero address holds no key. Provide the address of the access key.",field:`key_authorization.address`});if(e.publicKey&&!IM(e.publicKey))return new Jj({error_description:"Invalid `publicKey`. Provide an uncompressed public key, or `address`.",field:`key_authorization.publicKey`});if(!Number.isSafeInteger(e.expiry))return new Kj({error_description:`Invalid \`expiry\`: ${e.expiry} is not a whole number of seconds. Use a future Unix time in seconds.`,field:`key_authorization.expiry`,meta:{expiry:e.expiry}});if(e.expiry===0)return new Kj({error_description:"Invalid `expiry`: 0 never expires. Use a future Unix time.",field:`key_authorization.expiry`,meta:{expiry:0}});if(e.expiry<=t)return new Wj({error_description:`Invalid \`expiry\`: ${FM(e.expiry)} has passed. Use a future Unix time.`,field:`key_authorization.expiry`,meta:{expiry:e.expiry,now:t}});if(!e.limits.length)return new Vj({error_description:"Empty `limits`. Name at least one token, or omit `limits`.",field:`key_authorization.limits`});if(!e.scopes.length)return new Hj({error_description:"Empty `scopes`. Name at least one call, or omit `scopes`.",field:`key_authorization.scopes`});let r=new Set;for(let[t,i]of e.limits.entries()){if(r.has(i.token.toLowerCase()))return new zj({error_description:`Duplicate limit for ${i.token}. Limit each token once.`,field:`key_authorization.limits.${t}.token`,meta:{token:i.token}});r.add(i.token.toLowerCase());let a=MM(e,i.token);if(!a)return new nM({error_description:`Unsupported token on chain ${n}: ${i.token}. Use a supported token, such as OUSD.`,field:`key_authorization.limits.${t}.token`,meta:{chain_id:n,token:i.token}});if(i.period!==void 0&&(!Number.isSafeInteger(i.period)||i.period<0))return new qj({error_description:`Invalid \`period\` on the ${a.symbol} limit: ${i.period}. Use a whole number of seconds, or 0 for a one-time limit.`,field:`key_authorization.limits.${t}.period`,meta:{period:i.period,symbol:a.symbol,token:a.address}})}let i=new Set,a=new Map;for(let[t,n]of e.scopes.entries()){let r=MM(e,n.address);if(r&&!e.limits.some(e=>ke(e.token,n.address)))return new eM({error_description:`Scope on ${r.symbol} has no limit. Add a limit for it, or remove the scope.`,field:`key_authorization.scopes.${t}.address`,meta:{token:n.address}});let o=r?.symbol??n.address,s={...r?{symbol:r.symbol}:{},token:n.address},c=n.selector===void 0?void 0:NM(n.selector);if(n.selector!==void 0&&!c)return new tM({error_description:`Unsupported call on ${o}: the selector does not parse. Use a 4-byte selector or a function signature.`,field:`key_authorization.scopes.${t}.selector`,meta:s});if(!c&&jM(n.address))return new tM({error_description:`Unsupported call on ${o}: any function, which includes \`approve\` without spenders. Name each function in \`selector\`, such as \`transfer\`.`,field:`key_authorization.scopes.${t}.selector`,meta:s});if(c===vM.approve&&!n.recipients?.length)return new $j({error_description:`Missing \`recipients\` for \`approve\` on ${o}. Name the allowed spenders.`,field:`key_authorization.scopes.${t}.recipients`,meta:s});if(n.recipients?.length&&(!jM(n.address)||c!==vM.approve&&c!==vM.transfer&&c!==vM.transferWithMemo))return new Yj({error_description:`Invalid \`recipients\` for ${c??`any function`} on ${o}. Remove \`recipients\`, since only \`transfer\`, \`transferWithMemo\`, and \`approve\` on a TIP-20 token take them.`,field:`key_authorization.scopes.${t}.recipients`,meta:s});let l=`${n.address.toLowerCase()}:${c??`any`}`;if(i.has(l))return new Bj({error_description:`Duplicate scope for ${c??`any function`} on ${o}. Name each call on a target once.`,field:`key_authorization.scopes.${t}.selector`,meta:{...c?{selector:c}:{},...s}});i.add(l);let u=c?`named`:`any`,d=a.get(n.address.toLowerCase());if(d&&d!==u)return new Bj({error_description:`Conflicting scopes on ${o}: one allows any function, and another names ${c??`a function`}. Keep the scope for any function, or name each function.`,field:`key_authorization.scopes.${t}.selector`,meta:{...c?{selector:c}:{},...s}});a.set(n.address.toLowerCase(),u);let f=new Set,p=(n.recipients??[]).findIndex(e=>{let t=e.toLowerCase();return t===`0x0000000000000000000000000000000000000000`||f.has(t)?!0:(f.add(t),!1)}),m=n.recipients?.[p];if(m)return new Yj({error_description:`Invalid recipient ${m} for ${c} on ${o}. Name each recipient once, and never the zero address.`,field:`key_authorization.scopes.${t}.recipients.${p}`,meta:{recipient:m,...s}})}}(function(e){e.errors=[zj,Bj,Vj,Hj,Wj,Gj,Kj,qj,Jj,Yj,Zj,$j,eM,tM,nM]})(SM||={});function CM(e){let{app:t,clientId:n,key:r}=e;if(r?.witness&&!t?.sign)return new Rj({clientId:n})}(function(e){e.errors=[Rj]})(CM||={});function wM(e){let t=typeof e==`object`&&e?{...e}:{},n=[`expiry`,`limits`,`scopes`].filter(e=>t[e]===void 0),[r]=n;if(!r)return;let i=n.map(e=>`\`${e}\``);return new Qj({error_description:`Missing ${i.length===1?i[0]:i.length===2?`${i[0]} and ${i[1]}`:`${i.slice(0,-1).join(`, `)}, and ${i.at(-1)}`}. Name the expiry, limits, and scopes of the key, since a third-party app receives no defaults.`,field:`key_authorization.${r}`,meta:{missing:n.join(` `)}})}(function(e){e.errors=[Qj]})(wM||={});function TM(e,t){let n=SM(e);if(n)return n;let r=e.scopes.findIndex(t=>!bM(e,t)),i=e.scopes[r];if(i&&!t.sign){let t=MM(e,i.address),n=i.selector===void 0?void 0:NM(i.selector);return new tM({error_description:`Unrecognized call on ${t?.symbol??i.address}: ${n??`any function`}. Authorize through a redirect or device grant, where the user approves it, or grant the app the \`${xD}\` scope.`,field:`key_authorization.scopes.${r}.selector`,meta:{...n?{selector:n}:{},...t?{symbol:t.symbol}:{},token:i.address}})}let a=Math.floor(Date.now()/1e3),o=Number(e.chainId);if(e.expiry>a+31536e3)return new Uj({error_description:`Invalid \`expiry\`: ${FM(e.expiry)} exceeds the one-year maximum. Use an earlier expiry, or authorize through a redirect or device grant.`,field:`key_authorization.expiry`,meta:{expiry:e.expiry,maximum:a+dM}});for(let[t,n]of e.limits.entries()){let r=MM(e,n.token),i=n.period?BigInt(Math.ceil((e.expiry-a)/n.period)):1n,s=n.limit*i;if(s>r.cap)return new Xj({error_description:`Invalid ${r.symbol} limit: ${T(s,r.decimals)}${i>1n?` over ${i} periods before the key expires`:``} exceeds the ${T(r.cap,r.decimals)} maximum. ${i>1n?`Lower the limit or shorten the expiry`:`Lower the limit`}, or authorize through a redirect or device grant.`,field:`key_authorization.limits.${t}.limit`,meta:{chain_id:o,limit:s.toString(),maximum:r.cap.toString(),periods:Number(i),symbol:r.symbol,token:r.address}})}}(function(e){e.errors=[...SM.errors,Uj,Xj]})(TM||={});function EM(e){let t=new Map;for(let n of e.limits){let r=MM(e,n.token),i=n.period??0,a=`${r.currency}\0${i}`,o=t.get(a);if(!o){t.set(a,{amount:n.limit,currency:r.currency,decimals:r.decimals,period:i,tokens:[{amount:T(n.limit,r.decimals),symbol:r.symbol}]});continue}o.tokens.push({amount:T(n.limit,r.decimals),symbol:r.symbol});let s=Math.max(o.decimals,r.decimals);o.amount=o.amount*10n**BigInt(s-o.decimals)+n.limit*10n**BigInt(s-r.decimals),o.decimals=s}return{account:e.account,calls:e.scopes.flatMap(e=>{if(e.address.toLowerCase()!==yM.address)return[];let t=e.selector===void 0?void 0:NM(e.selector);return t===yM.open?[{call:`open`}]:t===yM.topUp?[{call:`topUp`}]:[]}),expiry:e.expiry,limits:[...t.values()].map(e=>({amount:T(e.amount,e.decimals),currency:e.currency,...e.period?{period:e.period}:{},tokens:e.tokens})),unrecognized:e.scopes.filter(t=>!bM(e,t)).map(e=>{let t=e.selector===void 0?void 0:NM(e.selector);return{address:ae(e.address),...t?{selector:t}:{}}})}}function DM(e){let{account:t}=e,{key:n,...r}=PM(e.key),i=Nt({...r,address:n.address,type:n.type,...e.witness?{witness:e.witness}:{},...t?{account:t.address}:{}});return t?Gt({account:t.address,config:t.config,payload:i}):i}async function OM(e,t){let n=e.source===`configurable`&&`config`in e&&e.config?{config:e.config}:void 0;return We(await _t(e,{...PM(t.key),...n?{configurable:n}:{}}))}async function kM(e,t){let{account:n}=t,{metadata:r,signature:i}=$n(e),a=DM({account:n,key:t.key}),o=Vn(t.publicKey),s=ne({keyType:`webAuthn`,publicKey:o,sign(e){return e.hash===a?Promise.resolve($e({metadata:{authenticatorData:r.authenticatorData,clientDataJSON:r.clientDataJSON},publicKey:o,signature:i,type:`webAuthn`})):Promise.reject(Error(`The assertion signs another key authorization.`))}});if(!n)return await OM(s,{key:t.key});let c=n.config.owners.map(e=>({owner:ke(e.owner,s.address)?s:e.owner,weight:Number(e.weight)})),{salt:l,threshold:u,version:d}=n.config;return await OM(BigInt(d)===0n?D({owners:c,salt:l,threshold:Number(u)}):D({address:n.address,owners:c,salt:l,threshold:Number(u),version:d}),{key:t.key})}function AM(e){let t=e.chainId??BigInt(mM),n=[...new Map((e.scopes??[]).flatMap(e=>{let n=_M.get(`${t}:${e.address.toLowerCase()}`);return n?[[n.address,n]]:[]})).values()],r=e.limits??(n.length?n.map(e=>({limit:e.cap,token:e.address})):[{limit:_M.get(`${t}:${fM.toLowerCase()}`)?.cap??0n,token:fM}]),i=e.scopes??r.flatMap(e=>[vM.transfer,vM.transferWithMemo].map(t=>({address:e.token,selector:t})));return{...e,chainId:t,expiry:e.expiry??Math.floor(Date.now()/1e3)+31536e3,limits:r,scopes:i}}function jM(e){return e.toLowerCase().startsWith(`0x20c000000000000000000000`)}function MM(e,t){return _M.get(`${Number(e.chainId)}:${t.toLowerCase()}`)}function NM(e){if(/^0x[0-9a-fA-F]{8}$/.test(e))return e.toLowerCase();try{return hu(e)}catch{return}}function PM(e){return{chainId:e.chainId,expiry:e.expiry,key:{address:e.address??IM(e.publicKey),type:e.keyType??`secp256k1`},limits:e.limits,scopes:e.scopes,...e.witness?{witness:e.witness}:{}}}function FM(e){return new Date(e*1e3).toUTCString()}function IM(e){try{return he(Kn(e))}catch{return}}var LM=class extends q(`invalid_field`){name=`Validation.InvalidFieldError`;constructor(e){let{issues:t}=e;super({error_description:`Invalid request. ${t.map(e=>`${RM(e)?`\`${RM(e)}\``:`Body`}: ${e.message}.`).join(` `)}`,field:t[0]&&RM(t[0])?RM(t[0]):void 0})}};function RM(e){return(e.path??[]).map(e=>String(typeof e==`object`?e.key:e)).join(`.`)}var zM=class extends q(`invalid_origin`){name=`Authorize.InvalidOriginError`},BM=class extends q(`rejected`){name=`Authorize.RejectedError`;constructor(e={}){super({error_description:e.description??"Authorization request rejected. Check `client_id`, `redirect_uri`, and `scope` against the app's registration."})}},VM;(function(e){let t=e.tokens=A({access_token:j().meta({description:`The access token, a JWT that Tempo ID signs. APIs verify it against Tempo ID's JSON Web Key Set.`,examples:[`eyJhbGciOiJSUzI1NiJ9.eyJzdWIiOiJ1c2VyIn0.c2lnbmF0dXJl`]}),expires_in:Ti().meta({description:`Seconds until the access token expires.`,examples:[300]}),id_token:j().optional().meta({description:"The OIDC ID token, a JWT about the user. Absent when the request did not ask for the `openid` scope.",examples:[`eyJhbGciOiJSUzI1NiJ9.eyJhdWQiOiJhcHAifQ.c2lnbmF0dXJl`]}),refresh_token:j().optional().meta({description:"The refresh token, which the app redeems at `/oauth2/token` for new tokens. Absent without the `offline_access` scope.",examples:[`yAjhKk7QnRZ3vD9pLm2Xc8Ws5Tf1Ub4N`]}),token_type:j().meta({description:`The type of the access token (RFC 6749 §7.1).`,examples:[`Bearer`]})}).meta({description:`OAuth tokens for a public app.`,id:`Tokens`}),n=e.challenge=j().min(1).max(1024).optional().meta({description:"A message, such as a sign-in challenge from the app's backend, whose EIP-191 hash becomes the key authorization's `witness` (TIP-1053). Requires `key_authorization`, and the app's `tempo-id:sign` scope.",examples:[`Sign in to app.example.com
405
+ Nonce: 7f3a9c2e5b1d4f60`]});e.request=A({challenge:n,client_id:j().min(1).max(255).meta({description:`The app's client ID.`,examples:[`Qk3vT9xZbLmN2pRw8YcHjF6sDaE4uGtK`]}),code_challenge:j().regex(/^[\w-]{43}$/).optional().meta({description:`The S256 PKCE challenge of a verifier that the app's backend holds (RFC 7636). With one, the app receives a code, and without one, a public app receives tokens.`,examples:[`E9Melhoa2OwvFrEMTJguCHaoeK1t8URWbuGJSstw-cM`]}),key_authorization:uM.request,redirect_uri:Hi({protocol:/^(?!(?:blob|data|file|javascript|vbscript)$)[a-z][a-z\d+.-]*$/}).meta({description:`A registered redirect URI of a web app, whose origin the page calls from.`,examples:[`https://app.example.com/callback`]}),scope:j().regex(/^[\w:.-]+( [\w:.-]+)*$/).max(256).optional().meta({description:"Space-separated OAuth scopes. Defaults to `openid`.",examples:[`openid email offline_access`]}),skip_upgrade:Pi().optional().meta({description:"Whether a wallet.tempo passkey's account that waits for its upgrade on the key's chain, where accounts are configurable, signs the key as the passkey's own account, in place of `upgrade_required`. It applies when a passkey signs in the same request, through a sign-in with key signature or `passkey`. The response then holds `upgrade_available`. The key stops working on that chain once the account upgrades, unless `POST /v1/account/upgrade` registers it first. Defaults to `false`.",examples:[!0]}),state:j().min(1).max(256).optional().meta({description:`An opaque value that the response returns unchanged, to bind it to the request (RFC 6749 §4.1.1).`,examples:[`af0ifjsldkj`]})}).refine(e=>!e.challenge||e.key_authorization,{message:"A challenge requires `key_authorization`, whose witness binds it",path:[`challenge`]}).transform(e=>e.key_authorization?{...e,key_authorization:xM(e.key_authorization,{challenge:e.challenge})}:e).meta({description:`An app's headless authorization request.`,id:`AuthorizationRequest`}),e.redirect=A({challenge:n,key_authorization:uM.request}).refine(e=>!e.challenge||e.key_authorization,{message:"A challenge requires `key_authorization`, whose witness binds it",path:[`challenge`]}).transform(e=>e.key_authorization?xM(e.key_authorization,{challenge:e.challenge}):void 0),e.response=A({account:uM.account.optional(),code:j().optional().meta({description:"The authorization code, when the request sent a `code_challenge`. The app's backend redeems it at `/oauth2/token`.",examples:[`Vb7mQ2xLkP9sTzR4`]}),key_authorization:uM.rpc.optional(),state:j().optional().meta({description:"The request's `state`, unchanged. Absent when the request sent none.",examples:[`af0ifjsldkj`]}),tokens:t.optional().meta({description:"The tokens, when the request sent no `code_challenge`."}),upgrade_available:oa(!0).optional().meta({description:"Present when `skip_upgrade` signed the key as a wallet.tempo passkey's own account, whose upgrade waits on the key's chain. `POST /v1/account/upgrade` with the key registers it and upgrades the account."})}).meta({description:`An authorization: a code or tokens, with the signed key authorization when the request asks for one.`,id:`Authorization`})})(VM||={});function HM(e,t){let{app:n,origin:r}=t;if(!n||!n.redirectUris.includes(e.redirect_uri))return new BM;if(!n.firstParty)return new BM({description:"Headless authorization refused: the app is not a first-party app. Send the user to `/oauth2/authorize`, and receive the code at the redirect URI."});if(n.type===`native`)return new BM({description:"Headless authorization refused: a native app's request does not prove which app sends it. Open `/oauth2/authorize` in an authentication sheet, and receive the code at the redirect URI."});let i=new URL(e.redirect_uri);if(r!==i.origin)return new zM({error_description:`Invalid \`Origin\`: ${r??`none`}. Requests for this redirect URI must come from ${i.origin}.`,field:`Origin`,meta:{expected:i.origin,...r?{origin:r}:{}}});let a=e.key_authorization;if(a)return n.secret?new BM({description:`Key authorization refused: the app holds a client secret, which a headless request does not prove. Authorize the key through a redirect or the device grant.`}):TM(a,{sign:n.sign})??CM({app:n,clientId:e.client_id,key:a})}(function(e){e.errors=[...TM.errors,...CM.errors,zM,BM]})(HM||={});function UM(e){let{app:t,clientId:n,codeChallenge:r,key:i,query:a}=e;return r?(MD(n)?wM(JM(a.get(`key_authorization`)??``)):void 0)??SM(i)??CM({app:t,clientId:n,key:i}):new BM({description:"Key authorization refused: the request names no `code_challenge`, whose verifier receives the key. Send an S256 `code_challenge`."})}(function(e){e.errors=[...SM.errors,...wM.errors,...CM.errors,BM]})(UM||={});function WM(e){let t=qM.find(t=>e.getAll(t).length>1);if(t)return new LM({issues:[{message:`Repeated parameter. Send it once`,path:[t]}]});let n=e.get(`key_authorization`),r=VM.redirect.safeParse({challenge:e.get(`challenge`)??void 0,key_authorization:n===null?void 0:JM(n)});return r.success?r.data:new LM({issues:r.error.issues})}function GM(e){if(!e.has(`key_authorization`))return e;let t=new URLSearchParams(e),n=new Set((t.get(`prompt`)??``).split(` `).filter(Boolean));n.add(`consent`),t.set(`prompt`,[...n].join(` `));let[r,...i]=t.getAll(`key_authorization`),a=r&&!i.length?JM(r):void 0;return!MD(t.get(`client_id`)??``)&&typeof a==`object`&&a&&!Array.isArray(a)&&!(`expiry`in a)&&t.set(`key_authorization`,Wn(JSON.stringify({...a,expiry:Math.floor(Date.now()/1e3)+dM}),KM)),t}var KM={pad:!1,url:!0},qM=[`challenge`,`key_authorization`];function JM(e){try{return JSON.parse(Gn(e))}catch{return null}}var YM=class extends q(`already_decided`){name=`Device.AlreadyDecidedError`;constructor(){super({error_description:`Code already approved or denied.`,field:`code`})}},XM=class extends q(`unknown_code`){name=`Device.UnknownCodeError`;constructor(){super({error_description:`Invalid or expired code. Check the code in the terminal.`,field:`code`})}},ZM=`openid email offline_access`,QM=`BCDFGHJKLMNPQRSTVWXZ`;async function $M(e,t){return(await e.update(iE).set({userId:t.userId}).where(qC(W(iE.id,t.id),W(iE.status,`pending`),nw(iE.userId),XC(iE.expiresAt,new Date))).returning({id:iE.id})).length>0}async function eN(e,t){let n=await iN(e,t);if(n&&n.status===`pending`&&!n.userId)return n.clientId}async function tN(e,t){let{challenge:n,device:r,deviceCode:i,expiresAt:a,ip:o,location:s}=t,c=t.key?JSON.parse(JSON.stringify(t.key,(e,t)=>typeof t==`bigint`?k(t):t)):null,l=e.select({id:iE.id}).from(iE).where(W(iE.deviceCode,i));await e.insert(TE).values({challenge:n,device:r,expiresAt:a,id:V`(${l})`,ip:o,key:c,location:s})}async function nN(e,t){return(await e.update(iE).set({status:t.status}).where(qC(W(iE.id,t.id),W(iE.status,`pending`),W(iE.userId,t.userId),XC(iE.expiresAt,new Date))).returning({id:iE.id})).length>0}function rN(e){return`${e.slice(0,4)}-${e.slice(4)}`}async function iN(e,t){let[n]=await e.select({appName:G.name,challenge:TE.challenge,clientId:iE.clientId,createdAt:TE.createdAt,device:TE.device,expiresAt:iE.expiresAt,id:iE.id,ip:TE.ip,key:TE.key,location:TE.location,status:iE.status,userCode:iE.userCode,userId:iE.userId}).from(iE).leftJoin(TE,W(TE.id,iE.id)).leftJoin(G,W(G.clientId,iE.clientId)).where(qC(W(iE.userCode,t.userCode),XC(iE.expiresAt,new Date)));if(!n?.clientId)return;let r=n.key?VM.redirect.parse({challenge:n.challenge??void 0,key_authorization:n.key}):void 0;return{...n.appName?{appName:n.appName}:{},...n.challenge?{challenge:n.challenge}:{},clientId:n.clientId,createdAt:n.createdAt??new Date(n.expiresAt.getTime()-6e5),...n.device?{device:n.device}:{},id:n.id,...n.ip?{ip:n.ip}:{},...r?{key:r}:{},...n.location?{location:n.location}:{},status:fN(n.status),userCode:rN(n.userCode),...n.userId?{userId:n.userId}:{}}}async function aN(e,t){let{id:n,key:r,userId:i}=t;return(await e.update(TE).set({account:r.account,keyAuthorization:r.keyAuthorization}).where(qC(W(TE.id,n),nw(TE.keyAuthorization),iw(e.select({id:iE.id}).from(iE).where(qC(W(iE.id,n),W(iE.status,`pending`),W(iE.userId,i),XC(iE.expiresAt,new Date)))))).returning({id:TE.id})).length>0}async function oN(e,t){let{id:n,key:r}=t;await e.update(TE).set({account:null,keyAuthorization:null}).where(qC(W(TE.id,n),V`${TE.keyAuthorization} = ${JSON.stringify(r.keyAuthorization)}::jsonb`,iw(e.select({id:iE.id}).from(iE).where(qC(W(iE.id,n),W(iE.status,`pending`))))))}async function sN(e,t){let[n]=await e.select({clientId:iE.oauthClientId,id:iE.id}).from(iE).where(W(iE.deviceCode,t.deviceCode));return n}function cN(e){let t=e.toUpperCase().replace(/[^A-Z]/g,``);if(!(t.length!==8||[...t].some(e=>!QM.includes(e))))return t}var lN=`/device`;function uN(e,t){if(!e||!e.startsWith(`/`)||/^\/[/\\]/.test(e))return;let n=new URL(t.origin),r=URL.parse(e,n);if(!r||r.origin!==n.origin||r.pathname!==`/device`||r.hash)return;let i=[...r.searchParams.keys()];if(i.length===0)return lN;let[a]=i;if(i.length>1||a!==`code`&&a!==`user_code`)return;let o=cN(r.searchParams.get(a)??``);if(o)return`${lN}?${new URLSearchParams({code:rN(o)})}`}async function dN(e,t){let[n]=await e.delete(TE).where(W(TE.id,t.id)).returning({account:TE.account,keyAuthorization:TE.keyAuthorization});if(n?.account&&n.keyAuthorization)return{account:n.account,keyAuthorization:n.keyAuthorization}}function fN(e){return e===`approved`||e===`denied`?e:`pending`}var pN=`BCDFGHJKLMNPQRSTVWXZ`,mN=`0123456789ABCDEFGHJKMNPQRSTVWXYZ`;function hN(){return`user_${_N()}`}function gN(){let e=[];for(;e.length<8;)for(let t of crypto.getRandomValues(new Uint8Array(16)))t<240&&e.length<8&&e.push(pN[t%20]);return e.join(``)}function _N(){let e=Date.now();return Array.from({length:10},(t,n)=>{let r=5*(9-n);return mN[Math.floor(e/2**r)%32]}).join(``)+Array.from(crypto.getRandomValues(new Uint8Array(16)),e=>mN[e%32]).join(``)}function vN(e){return e.configurable?.owner.account.address??yN(e)}function yN(e){return SN(e)?.address??e.account.owners[0].address}function bN(e){return e}function xN(e){return e}function SN(e){return e.configurable?.owner===e?e.account:void 0}function CN(e,t){let{configurable:n}=e;return n&&t.chainId!==void 0&&Number(t.chainId)===n.chainId?n.owner:e}function wN(e){let t=e=>Math.floor(e.getTime()/1e3),n=e.map(()=>0),r=[];for(;;){let i=e.reduce((r,i,a)=>{let o=i[n[a]];if(!o)return r;if(r===void 0)return a;let s=e[r][n[r]];return t(o.createdAt)<t(s.createdAt)?a:r},void 0);if(i===void 0)return r;r.push(e[i][n[i]]),n[i]=n[i]+1}}async function TN(e,t){await e.execute(V`select pg_advisory_xact_lock(hashtextextended(${`tempo-account:${t.userId}`}, 0))`)}async function EN(e,t){let{expiresAt:n,identifier:r,others:i=[],value:a}=t,o=new Date,s=e.select({id:K.id}).from(K).where(qC(ew(K.identifier,[r,...i]),XC(K.expiresAt,o))),[c]=await e.insert(K).select(V`select ${o.toISOString()}::timestamp, ${n.toISOString()}::timestamp, ${r}, ${r}, ${o.toISOString()}::timestamp, ${a} where not exists (${s})`).onConflictDoUpdate({set:{createdAt:o,expiresAt:n,updatedAt:o,value:a},setWhere:$C(K.expiresAt,o),target:K.id}).returning({id:K.id});return c!==void 0}var DN=class extends q(`passkey_limit`){name=`Passkey.LimitError`;constructor(){super({error_description:`Passkey limit reached: the user holds 10 registered passkeys, the most that Tempo ID registers. Sign in with one of them.`,meta:{limit:10}})}},ON=class extends q(`passkey_link_expired`){name=`Passkey.LinkExpiredError`;constructor(){super({error_description:`Expired passkey sign-in: the link from the passkey step is no longer valid. Enter the code again to sign in with email only, or sign in with the passkey again.`,field:`link`})}},kN=class extends q(`passkey_not_permitted`){name=`Passkey.NotPermittedError`;constructor(e={}){let{clientId:t,origin:n}=e;super(t&&n?{error_description:`Passkey not permitted: no realm of the app ${t} holds passkeys for ${n}. Sign in with an emailed code.`,meta:{client_id:t,origin:n}}:t?{error_description:`Passkey not permitted: the app ${t} holds no passkeys. Sign in with an emailed code.`,meta:{client_id:t}}:{error_description:`Passkey not permitted: no realm holds passkeys for this sign-in. Sign in with an emailed code.`})}},AN=class extends q(`reauthentication_required`){name=`Passkey.ReauthenticationRequiredError`;constructor(){super({error_description:`Sign in again: adding a passkey needs a sign-in within the last 10 minutes.`})}},jN=class extends q(`webauthn_rejected`){name=`Passkey.WebAuthnRejectedError`;constructor(){super({error_description:`Passkey rejected. Request new options, then try again with the same passkey or another one.`})}},MN=`passkey-challenge:`,NN=`passkey-registration-proof:`,PN=`passkey-registration:`,FN=`passkey-signature:`,IN=dM,LN=`passkey-signature-spent:`,RN=`passkey-sign-in-spent:`,zN=!1,BN;(function(e){let t=j().regex(/^[A-Za-z0-9_-]+$/),n=Ci([`0x`,j().regex(/^[0-9a-fA-F]*$/)]),r=e.credentialId=t.min(1).max(1364);e.assertion=A({id:r.meta({description:`The credential ID of the passkey that signed, base64url.`,examples:[`KEbWNCc7NgaYnUyrNeFGX9_3Y-8`]}),metadata:A({authenticatorData:n.meta({description:`The authenticator data the passkey signed, as hex: the relying party ID hash, flags, and signature counter.`,examples:[`0x49960de5880e8c687434170f6476605b8fe4aeb9a28632c7995cf3ba831d97630500000000`]}),challengeIndex:Ti().int().nonnegative().optional().meta({description:'The character offset of `"challenge"` in `clientDataJSON`. Absent, verification searches for it.',examples:[23]}),clientDataJSON:j().max(4096).meta({description:`The client data the browser collected, as a JSON string, which holds the type, challenge, and origin.`,examples:[`{"type":"webauthn.get","challenge":"9jEFijuhEWrM4SOW-tChJbUEHEP44VcjcJ-Bqo1fTM8","origin":"https://id.tempo.xyz","crossOrigin":false}`]}),typeIndex:Ti().int().nonnegative().optional().meta({description:'The character offset of `"type"` in `clientDataJSON`. Absent, verification searches for it.',examples:[1]}),userVerificationRequired:Pi().optional().meta({description:`Whether the client required user verification. Verification ignores it and always requires user verification.`,examples:[!0]})}).meta({description:"The signed data that verification reads with `signature`, decoded from the browser response."}),raw:A({authenticatorAttachment:j().nullable().default(null).meta({description:"How the authenticator attaches to the client, such as `platform` or `cross-platform`. Defaults to `null` when the browser reports none.",examples:[`platform`]}),id:t.meta({description:`The credential ID, base64url, as the browser returns it.`,examples:[`KEbWNCc7NgaYnUyrNeFGX9_3Y-8`]}),rawId:t.meta({description:`The bytes of the credential ID, base64url.`,examples:[`KEbWNCc7NgaYnUyrNeFGX9_3Y-8`]}),response:A({clientDataJSON:t.meta({description:`The client data JSON, base64url.`,examples:[`eyJ0eXBlIjoid2ViYXV0aG4uZ2V0IiwiY2hhbGxlbmdlIjoiOWpFRmlqdWhFV3JNNFNPVy10Q2hKYlVFSEVQNDRWY2pjSi1CcW8xZlRNOCIsIm9yaWdpbiI6Imh0dHBzOi8vaWQudGVtcG8ueHl6IiwiY3Jvc3NPcmlnaW4iOmZhbHNlfQ`]})}).meta({description:"The authenticator's response. Verification keeps only `clientDataJSON` and drops other fields."}),type:j().meta({description:`The credential type.`,examples:[`public-key`]})}).meta({description:"The `PublicKeyCredential` that `navigator.credentials.get()` returns, serialized as JSON."}),signature:n.meta({description:"The P-256 signature over the authenticator data and the client data hash, as 64-byte hex: `r` then `s`.",examples:[`0x6c3f1e0a9b7d24f58e1c3a6b9d0f2e4a7c5b8d1e3f6a9c2b4d7e0f1a3c5b8d9e1f2a7c4b6d8e0f3a5c7b9d1e4f6a8c0b2d5e7f9a1c3b6d8e0f2a4c7b9d1e3f5a`]})}).meta({description:"The assertion, serialized as `webauthx/client` returns it.",id:`PasskeyAssertion`}),e.clientData=A({challenge:t,crossOrigin:Pi().optional()}),e.credential=A({attestationObject:t.max(16384).meta({description:`The authenticator's attestation object, base64url, which holds the new public key.`,examples:[`o2NmbXRkbm9uZWdhdHRTdG10oGhhdXRoRGF0YVjF`]}),clientDataJSON:t.max(4096).meta({description:`The client data the browser collected, base64url, which holds the type, challenge, and origin.`,examples:[`eyJ0eXBlIjoid2ViYXV0aG4uY3JlYXRlIiwiY2hhbGxlbmdlIjoiOWpFRmlqdWhFV3JNNFNPVy10Q2hKYlVFSEVQNDRWY2pjSi1CcW8xZlRNOCIsIm9yaWdpbiI6Imh0dHBzOi8vaWQudGVtcG8ueHl6IiwiY3Jvc3NPcmlnaW4iOmZhbHNlfQ`]}),id:r.meta({description:`The credential ID of the new passkey, base64url.`,examples:[`KEbWNCc7NgaYnUyrNeFGX9_3Y-8`]}),publicKey:Ci([`0x`,j().regex(/^04[0-9a-fA-F]{128}$/)]).meta({description:"The new passkey's uncompressed P256 public key, as hex. Verification reads the key from `attestationObject` and ignores this copy.",examples:[`0x04f6310589abb21116acc6e123967ed0a125b5041c43f8e157237093e07eaa354c6c3f1e0a9b7d24f58e1c3a6b9d0f2e4a7c5b8d1e3f6a9c2b4d7e0f1a3c5b8d`]}),raw:A({authenticatorAttachment:j().nullable().default(null).meta({description:"How the authenticator attaches to the client, such as `platform` or `cross-platform`. Defaults to `null` when the browser reports none.",examples:[`platform`]}),id:t.max(1364).meta({description:`The credential ID, base64url, as the browser returns it.`,examples:[`KEbWNCc7NgaYnUyrNeFGX9_3Y-8`]}),rawId:t.max(1364).meta({description:`The bytes of the credential ID, base64url.`,examples:[`KEbWNCc7NgaYnUyrNeFGX9_3Y-8`]}),response:A({clientDataJSON:t.max(4096).meta({description:`The client data JSON, base64url.`,examples:[`eyJ0eXBlIjoid2ViYXV0aG4uY3JlYXRlIiwiY2hhbGxlbmdlIjoiOWpFRmlqdWhFV3JNNFNPVy10Q2hKYlVFSEVQNDRWY2pjSi1CcW8xZlRNOCIsIm9yaWdpbiI6Imh0dHBzOi8vaWQudGVtcG8ueHl6IiwiY3Jvc3NPcmlnaW4iOmZhbHNlfQ`]})}).meta({description:"The authenticator's response. Verification keeps only `clientDataJSON`, and reads the top-level `attestationObject`."}),type:j().max(32).meta({description:`The credential type.`,examples:[`public-key`]})}).meta({description:"The `PublicKeyCredential` that `navigator.credentials.create()` returns, serialized as JSON."})}).meta({description:"The new passkey, serialized as `webauthx/client` returns it.",id:`PasskeyCredential`}),e.link=A({address:j(),createdAt:Ti().nullable(),expiresAt:Ti(),host:j(),id:j(),nonce:j(),publicKey:Ci([`0x`,j()]),rpId:j()}),e.proof=A({id:j(),publicKey:n,rpId:j()}),e.registration=A({rpId:j()}),e.signature=A({account:j(),clientId:j(),credential:A({id:j(),publicKey:n,rpId:j()})});let i=e.step=A({step:A({options:A({publicKey:A({allowCredentials:Gi(A({id:r.meta({description:`The credential ID of the account's passkey, base64url.`,examples:[`KEbWNCc7NgaYnUyrNeFGX9_3Y-8`]}),type:oa(`public-key`).meta({description:`The credential type.`})}).meta({description:`The passkey that must sign.`})).meta({description:`The account's passkey, the only one the browser offers.`}),challenge:Ci([`0x`,j()]).meta({description:`The key authorization's digest, as hex. It is single-use, and expires after 5 minutes.`,examples:[`0xf6310589abb21116acc6e123967ed0a125b5041c43f8e157237093e07eaa354c`]}),rpId:j().meta({description:`The relying party ID of the account's passkey.`,examples:[`tempo.xyz`]}),userVerification:oa(`required`).meta({description:`Every passkey signature requires user verification.`})}).meta({description:"The `PublicKeyCredentialRequestOptions`, serialized with the challenge as hex."})}).meta({description:"The options for `navigator.credentials.get()`."}),type:oa(`passkey`).meta({description:"Sign the options with the passkey, then repeat the approval with `passkey: { assertion }`."})}).meta({description:`The next step: the passkey's signature over the key authorization's digest.`})}).meta({description:`An approval that continues when the passkey signs the key authorization.`,id:`PasskeyStep`});e.headlessStep=A({expiry:Ti().int().meta({description:"The key's expiry in Unix seconds. The repeated request sends it as `key_authorization.expiry`, so the digest stays the same.",examples:[1791869364]}),step:i.shape.step.extend({type:oa(`passkey`).meta({description:"Sign the options with the passkey on the page, then repeat `POST /v1/authorize` with `passkey: { assertion }`."})}).meta({description:`The next step: the passkey's signature over the key authorization's digest.`})}).meta({description:`A headless authorization that continues when the passkey that owns the account signs the key authorization on the app's page.`,id:`HeadlessPasskeyStep`}),e.user=A({createdAt:qi(),email:j(),emailVerified:Pi(),id:j(),image:j().nullable(),name:j(),updatedAt:qi()}),e.value=A({authorize:pi().optional(),clientId:j().nullable(),link:j().optional(),origin:j().optional(),realmId:j().optional(),rpId:j(),witness:Ci([`0x`,j()]).optional()})})(BN||={});async function VN(e,t){let n=(t.keyChallenge?.digest??xn(crypto.getRandomValues(new Uint8Array(32)))).toLowerCase(),r=MN+n,i={expiresAt:new Date(Date.now()+3e5),id:crypto.randomUUID(),identifier:r,value:JSON.stringify(BN.value.parse({authorize:t.authorize,clientId:t.clientId,link:t.link,origin:t.origin,realmId:t.realmId,rpId:t.rpId,witness:t.keyChallenge?.witness}))};return t.keyChallenge?await EN(e,i)?n:void 0:(await e.insert(K).values(i),n)}function HN(e){let{app:t,clientId:n,origin:r}=e;if(!n)return new zM({error_description:`Invalid \`Origin\`: ${r??`none`}. A passkey sign-in from an app's page sends the app's \`client_id\`.`,field:`Origin`,...r?{meta:{origin:r}}:{}});if(!t||!t.firstParty)return new BM({description:`Passkey sign-in refused: ${n} is not a first-party app. Send the user to \`/oauth2/authorize\`, which offers passkey sign-in.`});if(t.type===`native`)return new BM({description:"Passkey sign-in refused: a native app's request does not prove which app sends it. Open `/oauth2/authorize` in an authentication sheet."});let i=t.redirectUris.flatMap(e=>{let t=URL.parse(e);return t?.protocol===`https:`||t?.protocol===`http:`?[t.origin]:[]});if(!r||!i.includes(r))return new zM({error_description:`Invalid \`Origin\`: ${r??`none`}. Passkey sign-in for ${n} must come from the origin of one of its redirect URIs.`,field:`Origin`,...r?{meta:{origin:r}}:{}})}(function(e){e.errors=[zM,BM]})(HN||={});function UN(e){try{let t=BN.clientData.parse(JSON.parse(e.clientDataJSON));return or(t.challenge)}catch{return}}async function WN(e,t){let[n]=await e.select().from(DE).where(qC(W(DE.id,t.id),W(DE.rpId,t.rpId)));return n}async function GN(e,t){let{credential:n,id:r,rpId:i,userId:a}=t;return await e.transaction(async e=>{await TN(e,{userId:a}),await e.insert(kE).values({realmId:`default`,rpId:i}).onConflictDoNothing();let[t]=await e.insert(DE).values({address:n.address.toLowerCase(),...n.createdAt===null?{}:{createdAt:new Date(n.createdAt)},id:r,publicKey:n.publicKey,rpId:i,source:`tempo-wallet`,type:`passkey`,userId:a}).onConflictDoNothing().returning({userId:DE.userId});return t?t.userId:(await WN(e,{id:r,rpId:i}))?.userId})}async function KN(e){let t=new TextEncoder,n=await crypto.subtle.importKey(`raw`,t.encode(e),`HKDF`,!1,[`deriveBits`]),r=await crypto.subtle.deriveBits({hash:`SHA-256`,info:t.encode(`tempo-id:passkey-link:v1`),name:`HKDF`,salt:new Uint8Array},n,256);return xn(new Uint8Array(r))}async function qN(e,t){return await e.select({id:DE.id,registered:V`(${ZN(t)})`,rpId:DE.rpId}).from(DE).where(W(DE.userId,t.userId)).orderBy(fw(DE.createdAt),fw(DE.id))}function JN(){return{endpoints:{signInPasskey:Ss.serverOnly({body:A({oauth_query:j().optional(),user:BN.user.optional(),userId:j()}),method:`POST`},async e=>{let{user:t,userId:n}=e.body,r=t?.id===n?t:await e.context.internalAdapter.findUserById(n);if(!r)throw Error(`The passkey user is missing.`);let i=await e.context.internalAdapter.createSession(r.id);return await Ua(e,{session:i,user:r}),e.json({user:{email:r.email,id:r.id}})})},id:`tempo-id-passkey`}}async function YN(e,t){let[n]=await e.select({count:V`count(*)::int`}).from(DE).where(ZN(t));return n?.count??0}async function XN(e,t){let{id:n,publicKey:r,rpId:i,userId:a}=t;return await e.transaction(async e=>{await TN(e,{userId:a});let t=e.$with(`counted`).as(e.select({count:V`count(*)::int`.as(`count`)}).from(DE).where(ZN({userId:a}))),o=e.$with(`stored`).as(e.insert(kE).select(V`select now(), 'default', ${i} from ${t} where ${t.count} < ${10}`).onConflictDoNothing().returning({rpId:kE.rpId})),s=e.select({rpId:kE.rpId}).from(kE).where(W(kE.realmId,`default`)).for(`update`),[c]=await e.with(t,o).select({count:t.count,rpId:V`coalesce((select ${o.rpId} from ${o}), (${s}))`}).from(t);if((c?.count??0)>=10)return`limit`;if((c?.rpId?{rpId:c.rpId}:(await s)[0])?.rpId!==i)return`stale`;let[l]=await e.insert(DE).values({address:he(Vn(r)).toLowerCase(),id:n,publicKey:r,rpId:i,source:`tempo-id`,type:`passkey`,userId:a}).onConflictDoNothing().returning({id:DE.id});return l?`stored`:`held`})}function ZN(e){return qC(ew(DE.source,[`registered`,`tempo-id`]),rw(DE.address),W(DE.userId,e.userId))}function QN(e,t){let n=[t.origin,t.page].flatMap(e=>e?[new URL(e).hostname]:[]);for(let t of e){let e=t.passkeys?.rpId;if(e!==void 0&&n.every(t=>t===e||t.endsWith(`.${e}`)))return{realmId:t.id,rpId:e}}}async function $N(e,t){let{credential:n,rpId:r,userId:i}=t,a=xn(crypto.getRandomValues(new Uint8Array(32)));return await e.insert(K).values({expiresAt:new Date(Date.now()+3e5),id:crypto.randomUUID(),identifier:tP({challenge:a,prefix:NN,userId:i}),value:JSON.stringify(BN.proof.parse({...n,rpId:r}))}),a}async function eP(e,t){let n=xn(crypto.getRandomValues(new Uint8Array(32)));return await e.insert(K).values({expiresAt:new Date(Date.now()+3e5),id:crypto.randomUUID(),identifier:tP({challenge:n,prefix:PN,userId:t.userId}),value:JSON.stringify(BN.registration.parse({rpId:t.rpId}))}),n}function tP(e){return e.prefix+JSON.stringify([e.userId,e.challenge.toLowerCase()])}async function nP(e,t){let{account:n,clientId:r,credential:i,digest:a,userId:o}=t;await e.insert(K).values({expiresAt:new Date(Date.now()+3e5),id:crypto.randomUUID(),identifier:fP({account:n,clientId:r,credentialId:i.id,digest:a,userId:o}),value:JSON.stringify(BN.signature.parse({account:n.toLowerCase(),clientId:r,credential:i}))})}async function rP(e,t){return await Yo({data:JSON.stringify(BN.link.parse(e)),key:await KN(t.secret)})}async function iP(e,t){let n=UN(t);if(!n)return;let[r]=await e.delete(K).where(qC(W(K.identifier,MN+n.toLowerCase()),XC(K.expiresAt,new Date))).returning({value:K.value});if(r)return aP(r.value,{challenge:n})}function aP(e,t){let n=BN.value.parse(JSON.parse(e));return{authorize:n.authorize,challenge:t.challenge,clientId:n.clientId,link:n.link,origin:n.origin,realmId:n.realmId,rpId:n.rpId,witness:n.witness}}async function oP(e,t){let n=UN(t);if(!n)return;let r=e.$with(`spent`).as(e.delete(K).where(qC(W(K.identifier,MN+n.toLowerCase()),XC(K.expiresAt,new Date))).returning({value:K.value})),[i]=await e.with(r).select({key:{id:DE.id,publicKey:DE.publicKey,userId:DE.userId},user:bE,value:r.value}).from(r).leftJoin(DE,qC(W(DE.id,t.id),W(DE.rpId,V`(${r.value})::jsonb ->> 'rpId'`))).leftJoin(bE,W(bE.id,DE.userId));if(i)return{challenge:aP(i.value,{challenge:n}),key:i.key&&i.user?{...i.key,user:i.user}:void 0}}async function sP(e,t){let n=(()=>{try{let e=BN.clientData.parse(JSON.parse(t.clientDataJSON));return or(e.challenge)}catch{return}})();if(!n)return;let[r]=await e.delete(K).where(qC(W(K.identifier,tP({challenge:n,prefix:NN,userId:t.userId})),XC(K.expiresAt,new Date))).returning({value:K.value});if(r)return{...BN.proof.parse(JSON.parse(r.value)),challenge:n}}async function cP(e,t){let n=(()=>{try{let e=BN.clientData.parse(JSON.parse(Gn(t.clientDataJSON)));return or(e.challenge)}catch{return}})();if(!n)return;let[r]=await e.delete(K).where(qC(W(K.identifier,tP({challenge:n,prefix:PN,userId:t.userId})),XC(K.expiresAt,new Date))).returning({value:K.value});if(r)return{challenge:n,rpId:BN.registration.parse(JSON.parse(r.value)).rpId}}async function lP(e,t){let n=pP(t),r=RN+n.slice(24);return await e.transaction(async e=>(await e.execute(V`select pg_advisory_xact_lock(hashtextextended(${n}, 0))`),await EN(e,{expiresAt:new Date(Math.min(Math.max(t.expiry*1e3,Date.now()+3e5),Date.now()+IN*1e3)),identifier:r,others:[n],value:`{}`})))}async function uP(e,t){let n=pP(t);return await e.transaction(async e=>(await e.execute(V`select pg_advisory_xact_lock(hashtextextended(${n}, 0))`),await EN(e,{expiresAt:new Date(Math.min(Math.max(t.expiry*1e3,Date.now()+3e5),Date.now()+IN*1e3)),identifier:n,value:`{}`})))}async function dP(e,t){let n=(()=>{try{let e=BN.clientData.parse(JSON.parse(t.clientDataJSON));return or(e.challenge)}catch{return}})();if(!n)return;let r=pP(t);return await e.transaction(async e=>{await e.execute(V`select pg_advisory_xact_lock(hashtextextended(${r}, 0))`);let[i]=await e.select({id:K.id}).from(K).where(qC(W(K.identifier,r),XC(K.expiresAt,new Date))),[a]=await e.delete(K).where(qC(W(K.identifier,fP({...t,digest:n})),XC(K.expiresAt,new Date))).returning({value:K.value});if(!a||i)return;let o={...BN.signature.parse(JSON.parse(a.value)),digest:n};if(t.verify(o))return await e.insert(K).values({expiresAt:new Date(Math.min(Math.max(t.expiry*1e3,Date.now()+3e5),Date.now()+IN*1e3)),id:crypto.randomUUID(),identifier:r,value:`{}`}),o})}function fP(e){return FN+JSON.stringify([e.userId,e.clientId,e.account.toLowerCase(),e.credentialId,e.digest.toLowerCase()])}function pP(e){return LN+Hn(yn(e.authenticatorData,e.signature))}async function mP(e,t){let n=await fs({data:e,key:await KN(t.secret)}).then(e=>BN.link.safeParse(JSON.parse(e))).catch(()=>void 0);if(n?.success&&n.data.host===t.host&&!(n.data.expiresAt<=Date.now()/1e3))return n.data}function hP(){zN||=(ar.utils.precompute(4),!0)}function gP(e,t){hP();try{return!BN.clientData.parse(JSON.parse(e.metadata.clientDataJSON)).crossOrigin&&Zp({...e,metadata:{...e.metadata,userVerificationRequired:!0}},{challenge:t.challenge,origin:t.origin,publicKey:t.publicKey,rpId:t.rpId})}catch{return!1}}function _P(e,t){try{if(BN.clientData.parse(JSON.parse(Gn(e.clientDataJSON))).crossOrigin)return;let n=tm(e,{attestation:`none`,challenge:t.challenge,origin:t.origin,rpId:t.rpId,userVerification:`required`});return{id:n.credential.id,publicKey:n.credential.publicKey}}catch{return}}var vP=class extends q(`authorization_expired`){name=`Auth.AuthorizationExpiredError`;constructor(){super({error_description:`Expired authorization request: the request from the app is no longer valid. Return to the app, and start again.`,field:`oauth_query`})}},yP=class extends q(`invalid_code`){name=`Auth.InvalidCodeError`;constructor(){super({error_description:`Invalid or expired code. Request a new one.`,field:`code`})}},bP=class extends q(`session_changed`){name=`Auth.SessionChangedError`;constructor(){super({error_description:`Changed session: the signed-in account differs from the one that this page showed. Reload the page, and check the account before the decision.`,field:`session_id`})}},xP=class extends q(`session_required`){name=`Auth.SessionRequiredError`;constructor(){super({error_description:`Sign in first.`})}},SP=class extends q(`sign_up_not_permitted`){name=`Auth.SignUpNotPermittedError`;constructor(e){let t=e.domains.join(` or `);super({error_description:`Sign-up not permitted: new accounts need an address at ${t}. Sign in with an existing account, or with an address at ${t}.`,field:`email`,meta:{domains:e.domains.join(`,`)}})}},CP=`tempo-id-session`;function wP(e){let{accountStep:t,baseURL:n,cache:r,db:i,metadataFetch:a,pendingKey:o,secret:s,sendCode:c,sessionCreated:l,signUpDomains:u,userCreated:d,waitUntil:f}=e;return{advanced:{backgroundTasks:{handler:f},cookies:{session_token:{name:CP}},database:{generateId:e=>e.model===`user`?hN():crypto.randomUUID(),joins:!0},ipAddress:{ipAddressHeaders:[`cf-connecting-ip`]}},basePath:`/`,baseURL:n,database:Ww(i,{provider:`pg`,schema:SE}),databaseHooks:{session:{create:{after:e=>(l?.({id:e.id,userId:e.userId}),Promise.resolve())}},user:{create:{after:e=>(d?.({id:e.id}),Promise.resolve()),before:e=>{if(e.emailVerified!==!0)return Promise.resolve(!1);let t=e.email.slice(e.email.lastIndexOf(`@`)+1);return u&&!u.includes(t.toLowerCase())?Promise.reject(new M(`FORBIDDEN`,{code:SP.reason,message:`Sign-up not permitted.`})):Promise.resolve(!0)}}}},onAPIError:{errorURL:`${n}/error`},plugins:[Ry({allowedAttempts:3,expiresIn:600,otpLength:6,sendVerificationOTP:e=>c({code:e.otp,email:e.email}),storeOTP:`hashed`}),JN(),...AD({accountStep:t,baseURL:n,cache:r,metadataFetch:a,pendingKey:o}),rb({expiresIn:`600s`,generateUserCode:gN,interval:`5s`,verificationUri:lN}),{id:`tempo-id-indexes`,schema:{deviceCode:{fields:{},indexes:[{fields:[`expiresAt`]}]},oauthAccessToken:{fields:{},indexes:[{fields:[`expiresAt`]}]},oauthClientAssertion:{fields:{},indexes:[{fields:[`expiresAt`]}]},oauthRefreshToken:{fields:{},indexes:[{fields:[`expiresAt`]}]},session:{fields:{},indexes:[{fields:[`expiresAt`]}]},verification:{fields:{},indexes:[{fields:[`expiresAt`]}]}}}],rateLimit:{enabled:!1},secret:s,verification:{disableCleanup:!0}}}var TP=e=>e,EP=!1;async function Y(e,t,n,r){let i=e.var.timing,a=performance.now(),o={closed:1/0,...r?{description:r}:{},duration:0,name:n,opened:i.events++,start:a-i.start};i.spans.push(o);try{return await t}finally{o.closed=i.events++,o.duration=performance.now()-a}}var DP=TP(async(e,t)=>{let n=!EP;EP=!0;let r={events:0,spans:[],start:performance.now()};e.set(`timing`,r),await t();let i=performance.now()-r.start,a=OP(r.spans);e.res.headers.append(`server-timing`,[`total;dur=${kP(i)}`,...n?[`cold`]:[],...a.map(AP)].join(`, `)),!Ys()&&Gs({fields:{duration:kP(i),errorCode:e.var.refusal?.error,method:e.req.method,reason:e.var.refusal?.reason,requestId:e.var.requestId,route:qs(e),spans:a.map(e=>`${e.name};dur=${kP(e.duration)};start=${kP(e.start)}`).join(`, `),status:e.res.status},message:`The Worker timed a request.`})});function OP(e){return e.map((e,t)=>({settles:e.opened-t,span:e})).toSorted((e,t)=>e.settles===t.settles?e.span.closed===t.span.closed?e.span.opened-t.span.opened:e.span.closed>t.span.closed?-1:1:e.settles-t.settles).map(e=>e.span)}function kP(e){return Math.round(e*10)/10}function AP(e){let t=`${e.name};dur=${kP(e.duration)}`;return e.description?`${t};desc="${e.description.replace(/["\\]/g,`\\$&`)}"`:t}var jP=class extends Error{name=`Balance.RequestError`;constructor(e){super(`The Tempo API responded with ${e.status}.`)}},MP=3e3,NP;(function(e){e.balance=A({amount:j().meta({description:`The value in USD, as a decimal string.`,examples:[`12.5`]}),currency:oa(`USD`).meta({description:"The currency of `amount`."})}).meta({description:`The value of an account's verified token holdings, in USD.`,id:`Balance`}),e.valuation=A({amount:j().regex(/^\d+(\.\d+)?$/),currency:oa(`USD`)})})(NP||={});async function PP(e){let t=new URL(e.apiUrl);t.pathname=`${t.pathname.replace(/\/$/,``)}/v1/addresses/${e.address}/valuation`,t.searchParams.set(`chainId`,String(e.chainId)),t.searchParams.set(`currency`,`USD`);let n=[t.username,t.password].filter(Boolean).map(decodeURIComponent).join(`:`);t.username=``,t.password=``;let r=await fetch(t,{headers:n?{"tempo-api-key":n}:{},signal:AbortSignal.timeout(MP)});if(!r.ok)throw await r.body?.cancel(),new jP({status:r.status});return{amount:NP.valuation.parse(await r.json()).amount,currency:`USD`}}function FP(e,t){let{accounts:n,apiUrl:r,chainId:i}=t;return r?Promise.all(n.map(t=>Y(e,PP({address:t.address,apiUrl:r,chainId:i}),`tempoApi.valuation.get`).catch(t=>($s(e,{error:t,fields:{chainId:i},message:`A balance failed to load.`}),null)))):Promise.resolve(n.map(()=>null))}var IP=`Payload Too Large`,LP=e=>{let t=e.onError||(()=>{throw new nl(413,{res:new Response(IP,{status:413})})}),n=e.maxSize;return async function(e,r){if(!e.req.raw.body)return r();let i=e.req.raw.headers.has(`transfer-encoding`);if(e.req.raw.headers.has(`content-length`)&&!i)return parseInt(e.req.raw.headers.get(`content-length`)||`0`,10)>n?t(e):r();let a=0,o=[],s=e.req.raw.body.getReader();for(;;){let{done:r,value:i}=await s.read();if(r)break;if(a+=i.length,a>n)return t(e);o.push(i)}let c={body:new ReadableStream({start(e){for(let t of o)e.enqueue(t);e.close()}}),duplex:`half`};return e.req.raw=new Request(e.req.raw,c),r()}},RP=class extends q(`body_too_large`){name=`BodyLimit.BodyTooLargeError`;constructor(){super({error_description:`Invalid request body: exceeds the ${BP}-byte maximum. Send a body of ${BP} bytes or fewer.`,meta:{maximum:BP}})}},zP=[RP],BP=65536,VP=LP({maxSize:BP,onError:e=>J(e,new RP)});function HP(e){let{max:t=1e3,ttl:n}=e,r=new Map,i=0;return{async get(e,a,o={}){let{keep:s=()=>!0}=o,c=Math.min(o.ttl??n,n),l=JSON.stringify(a);if(c<=0||l.length>256)return await e();let u=r.get(l);if(u&&u.expires>Date.now())return u.value;let d=++i,f=await e();if(!s(f))return f;let p=r.get(l);if(p&&p.load>d)return f;let m=Date.now();if(r.delete(l),r.size>=t)for(let[e,t]of r)t.expires<=m&&r.delete(e);if(r.size>=t){let e=r.keys().next().value;e!==void 0&&r.delete(e)}return r.set(l,{expires:m+c,load:d,value:f}),f}}}async function UP(e,t,n,r={}){let i=e.var.cache;return i?await i.get(t,n,r):await t()}var WP=1e3;async function GP(e){let[t,n]=await Promise.all([(async()=>{if(!e.apiUrl)return`none`;let t=new URL(e.apiUrl);t.pathname=`${t.pathname.replace(/\/$/,``)}/health`,t.username=``,t.password=``;try{let e=await fetch(t,{signal:AbortSignal.timeout(WP)});return await e.body?.cancel(),e.ok?`up`:`down`}catch{return`down`}})(),(async()=>{let t=jO({transport:Ak(e.rpcUrl,{retryCount:0,timeout:WP})});return await Bt(t).catch(()=>void 0)===e.chainId?`up`:`down`})()]);return{api:t,node:n}}var KP=class extends q(`config_conflict`){name=`ConfigurableAccount.ConflictError`;constructor(e){super({error_description:`Configuration conflict: the chain's configuration of ${e.account} differs from the stored one. Reload the account, and try again.`,field:`account`,meta:{account:e.account}})}},qP=class extends q(`configurable_accounts_disabled`){name=`ConfigurableAccount.DisabledError`;constructor(e={}){let{chain:t,configured:n=[]}=e;super(t&&n.length>0?{error_description:`Configurable accounts are not available on the chain \`${t}\`. Select ${n.map(e=>`\`${e}\``).join(` or `)}.`,field:`chain`,meta:{chain:t,configured:n.join(`,`)}}:{error_description:`Configurable accounts are not available on this deployment. Use the account as it is.`,field:`chain`})}},JP=class extends q(`not_configurable`){name=`ConfigurableAccount.NotConfigurableError`;constructor(e){let{account:t}=e;super({error_description:e.reason===`cloud`?`Not configurable: a cloud wallet owns ${t}, and only an account that a passkey owns upgrades in place. Use an account that is configurable from its creation.`:`Not configurable: ${t} is not a configurable account yet. Upgrade it with its passkey, then add the owner.`,field:`account`,meta:{account:t,reason:e.reason}})}},YP=class extends q(`owner_exists`){name=`ConfigurableAccount.OwnerExistsError`;constructor(e){super({error_description:{configurable:`Owner exists: ${e.account} is already a configurable account. Add an owner to it instead.`,passkey:`Owner exists: a passkey already owns ${e.account}. Use the account as it is.`}[e.owner],field:e.owner===`passkey`?`account`:`wallet`,meta:{account:e.account,owner:e.owner}})}},XP=class extends q(`upgrade_required`){name=`ConfigurableAccount.UpgradeRequiredError`;constructor(e){super({error_description:`Upgrade required: Tempo Account ${e.account} is not a configurable account on this chain yet. Upgrade it on the account page, then authorize again.`,field:`key_authorization.account`,meta:{account:e.account}})}},ZP=`tempo-id:account-config`,QP=`0x20c0000000000000000000000000000000000000`,$P=`0x${`0`.repeat(63)}1`,eF={transfer:`0xa9059cbb`,transferWithMemo:`0x95777d59`},tF=`account-config:`,nF;(function(e){let t=Ci([`0x`,j().regex(/^[0-9a-fA-F]{40}$/)]),n=Ci([`0x`,j().regex(/^[0-9a-fA-F]*$/)]),r=e.owners=Gi(A({address:t,type:j(),weight:Ti().int().positive()})),i=A({address:t,chainId:Ti().int(),key:t,owners:r,salt:n,threshold:Ti().int(),version:j().regex(/^[0-9]+$/)});e.pending=A({current:i.optional(),registration:A({digest:n,transaction:n}).optional(),target:i,transaction:n})})(nF||={});function rF(e,t){let{chainId:n}=t,r=t=>e.find(e=>ke(yN(e),t)),i=[...t.configs,...e.flatMap(e=>e.linked||t.configs.some(t=>ke(t.key,yN(e)))?[]:[sF({chainId:n,key:yN(e),type:e.type})])],a=new Set(i.flatMap(e=>e.owners.filter(t=>!ke(t.address,e.key)).map(e=>e.address.toLowerCase())));return e.filter(e=>!a.has(yN(e).toLowerCase())).map(e=>{let t=i.find(t=>ke(t.key,yN(e)));if(!t)return e;let n=t.owners.flatMap(e=>{let t=r(e.address);return t?[t]:[]}),a=n.find(e=>e.credential),o=n.find(e=>e.signer),s=bN({account:xF(t),createdAt:e.createdAt,credential:a?.credential,linked:e.linked,realm:e.realm,signer:o?.signer?async(e,n)=>xF(t,{signers:[await o.signer(e,n)]}):void 0,type:e.type}),c={chainId:t.chainId,owner:s,owners:t.owners};return s.configurable=c,{...e,configurable:c}})}function iF(e){return Js(e).flatMap(e=>{let t=Nj.find(t=>t.id===e.chainId);return t?[{...e,definition:t}]:[]})}function aF(e){let{chainId:t,env:n}=e;if(t!==void 0)return iF({rpcUrl:n.TEMPO_RPC_URL,rpcUrls:n.RPC_URLS,value:n.CONFIGURABLE_ACCOUNTS}).find(e=>e.chainId===t)}function oF(e){let{apiUrl:t,chain:n}=e,r=(()=>{if(!t)return;let e=new URL(t),r=[e.username,e.password].filter(Boolean).map(decodeURIComponent).join(`:`);if(r)return e.username=``,e.password=``,e.pathname=`${e.pathname.replace(/\/$/,``)}/rpc/sponsor/${n.chainId}`,{key:r,url:e.href}})(),i=Ak(n.rpcUrl,{retryCount:0});return jO({chain:n.definition,transport:r?Mj(i,Ak(r.url,{fetchOptions:{headers:{"tempo-api-key":r.key}},retryCount:0})):i})}function sF(e){let{chainId:t,key:n,type:r}=e,i=cF({address:n,chainId:t,key:n,owners:[{address:n,type:r,weight:1}],salt:`0x${`0`.repeat(64)}`,threshold:1,version:0n});return cF({...i,address:xF(i).address})}function cF(e){return e}async function lF(e,t){return(await e.select().from(CE).where(qC(W(CE.chainId,t.chainId),W(CE.userId,t.userId)))).map(e=>cF({address:ae(e.address),chainId:e.chainId,key:ae(e.key),owners:nF.owners.parse(e.owners).map(e=>({...e,address:ae(e.address)})),salt:e.salt,threshold:e.threshold,version:BigInt(e.version)}))}function uF(e){let{add:t=[],address:n,chainId:r,current:i}=e,a=[...i?.owners??[{address:n,type:e.type,weight:1}],...t],o=a.map(e=>({owner:e.address,weight:e.weight})),s=i?Xt(kF(i),{owners:o,threshold:1}):st(n,{owners:o,threshold:1});return cF({address:n,chainId:r,key:i?.key??n,owners:s.owners.map(e=>({address:ae(e.owner),type:a.find(t=>ke(t.address,e.owner)).type,weight:Number(e.weight)})),salt:s.salt,threshold:Number(s.threshold),version:BigInt(s.version)})}function dF(e){let{configurable:t}=e;if(!t)return;let{config:n}=t.owner.account;return cF({address:t.owner.account.address,chainId:t.chainId,key:yN(e),owners:t.owners,salt:n.salt,threshold:Number(n.threshold),version:BigInt(n.version)})}async function fF(e){let{client:t,current:n,publicKey:r,target:i}=e;await CF({client:t,current:n,target:i});let a={},o=ne({keyType:`webAuthn`,publicKey:Vn(r),sign(e){return a.digest=e.hash,Promise.reject(Error(`The digest is captured.`))}}),s=n?xF(n,{signers:[o]}):o,c=await EF({account:s,client:t,current:n,target:i}),l=await _e(c);if(await Ck(t,{...c,account:s}).catch(()=>void 0),!a.digest)throw Error(`The transaction asked the passkey to sign no digest.`);return{digest:a.digest,transaction:l}}async function pF(e,t){let{config:n,userId:r}=t,i={address:n.address.toLowerCase(),chainId:n.chainId,key:n.key.toLowerCase(),owners:n.owners.map(e=>({address:e.address.toLowerCase(),type:e.type,weight:e.weight})),salt:n.salt,threshold:n.threshold,userId:r,version:n.version.toString()};await e.insert(CE).values(i).onConflictDoUpdate({set:{owners:i.owners,salt:i.salt,threshold:i.threshold,updatedAt:V`now()`,version:i.version},setWhere:V`${CE.version}::numeric < excluded.version::numeric and ${CE.userId} = excluded.user_id`,target:[CE.chainId,CE.address]})}async function mF(e){let{account:t,client:n,current:r,target:i}=e;return await CF({client:n,current:r,target:i}),await OF({client:n,serialized:await Ck(n,{...await EF({account:t,client:n,current:r,target:i}),account:t})}),i}async function hF(e){let{assertion:t,client:n,current:r,digest:i,publicKey:a,target:o}=e;await CF({client:n,current:r,target:o});let{metadata:s,signature:c}=$n(t),l=$e({metadata:{authenticatorData:s.authenticatorData,clientDataJSON:s.clientDataJSON},publicKey:Vn(a),signature:c,type:`webAuthn`}),u=ne({keyType:`webAuthn`,publicKey:Vn(a),sign(e){return e.hash===i?Promise.resolve(l):Promise.reject(Error(`The assertion signs another transaction.`))}}),d=r?xF(r,{signers:[u]}):u;return await OF({client:n,serialized:await Ck(n,{...x(e.transaction),account:d})}),o}async function gF(e){let{account:t,client:n,key:r}=e,i=DF(r,{account:t});if(!i)return;let a={},o=SF({account:t,key:r,sign(e){return a.digest=e,Promise.reject(Error(`The digest is captured.`))}}),s=await nt(n,{account:o,calls:[i],feePayer:n.transport.key===`relay`||void 0,keyAuthorization:r,nonceKey:an(on(24)),type:`tempo`,validBefore:Math.floor(Date.now()/1e3)+300}),c=await _e(s);if(await Ck(n,{...s,account:o}).catch(()=>void 0),!a.digest)throw Error(`The transaction asked the access key to sign no digest.`);return{digest:a.digest,transaction:c}}async function _F(e){let{account:t,client:n,key:r}=e,i=await Vt(n,{account:t,accessKey:r});return i.isRevoked?`revoked`:ke(i.address,r)?`active`:`missing`}async function vF(e){let{account:t,client:n,digest:r,signature:i}=e,a=x(e.transaction),o=SF({account:t,key:a.keyAuthorization,sign(e){return e===r?Promise.resolve(i):Promise.reject(Error(`The signature signs another transaction.`))}});await OF({client:n,serialized:await Ck(n,{...a,account:o})})}async function yF(e,t){let{current:n,digest:r,registration:i,target:a,transaction:o,userId:s}=t,c=e=>({...e,version:e.version.toString()});await e.insert(K).values({expiresAt:new Date(Date.now()+3e5),id:crypto.randomUUID(),identifier:TF({digest:r,userId:s}),value:JSON.stringify(nF.pending.parse({...n?{current:c(n)}:{},...i?{registration:i}:{},target:c(a),transaction:o}))})}async function bF(e,t){let[n]=await e.delete(K).where(qC(W(K.identifier,TF(t)),XC(K.expiresAt,new Date))).returning({value:K.value});if(!n)return;let r=nF.pending.parse(JSON.parse(n.value)),i=e=>cF({...e,address:ae(e.address),key:ae(e.key),owners:e.owners.map(e=>({...e,address:ae(e.address)})),version:BigInt(e.version)});return{current:r.current?i(r.current):void 0,registration:r.registration,target:i(r.target),transaction:r.transaction}}function xF(e,t={}){let{signers:n=[]}=t,r=e.owners.map(e=>({owner:n.find(t=>ke(t.address,e.address))??e.address,weight:e.weight}));return e.version===0n?D({owners:r,salt:e.salt,threshold:e.threshold}):D({address:e.address,owners:r,salt:e.salt,threshold:e.threshold,version:e.version})}function SF(e){let{account:t,key:n}=e;return{...ne({access:t,keyType:n.type,publicKey:re({privateKey:$P}),sign:t=>e.sign(t.hash)}),accessKeyAddress:ae(n.address)}}async function CF(e){let{client:t,current:n,target:r}=e,i=await Nk(t,{account:r.address}),a=n?He(kF(n)):void 0,o=/^0x0*$/.test(i);if(!(a?bn(i,a)||n.version===0n&&o:o))throw new KP({account:r.address})}async function wF(e){let{client:t,target:n}=e,r=await Nk(t,{account:n.address});return bn(r,He(kF(n)))}function TF(e){return tF+JSON.stringify([e.userId,e.digest.toLowerCase()])}async function EF(e){let{account:t,client:n,current:r,target:i}=e,a=i.owners.map(e=>({owner:e.address,weight:e.weight})),o=r?[Pk.call({currentConfig:kF(r),nextConfig:{owners:a,threshold:i.threshold}})]:[Fk.call({owners:a,threshold:i.threshold})];return await nt(n,{account:t,calls:o,feePayer:n.transport.key===`relay`||void 0,nonceKey:an(on(24)),type:`tempo`,validBefore:Math.floor(Date.now()/1e3)+300})}function DF(e,t){let{account:n}=t;if(!e.scopes)return AF({to:n,token:QP});for(let t of e.scopes){if(!jM(t.address))continue;let e=t.recipients?.[0]??n,r=t.selector?.toLowerCase();if(r===eF.transfer)return AF({to:e,token:t.address});if(r===eF.transferWithMemo)return Ye.call({amount:0n,memo:dn(`0x`,32),to:e,token:t.address})}}async function OF(e){let t=await Sk(e.client,{serializedTransaction:e.serialized});if(t.status!==`success`)throw Error(`The transaction ${t.transactionHash} reverted.`)}function kF(e){return St({owners:e.owners.map(e=>({owner:e.address,weight:e.weight})),salt:e.salt,threshold:e.threshold,version:e.version})}function AF(e){return Ye.call({amount:0n,...e})}var jF=Nj.filter(e=>e.id!==Xs.mainnet);async function MF(e){return(await Lk(jO({chain:e.chain,transport:Ak(e.rpcUrl,{retryCount:0})}),{account:e.address})).map(e=>e.transactionHash)}var NF=e=>e.__COMPOSED_HANDLER?NF(e[Tl]):e,PF=(e,t,n)=>{let r=e.req.raw.headers.get(`Cookie`);if(typeof t==`string`){if(!r)return;let e=t;return n===`secure`?e=`__Secure-`+t:n===`host`&&(e=`__Host-`+t),_(r,e)[e]}return r?_(r):{}},FF=async(e,t,n,r)=>{let i=e.req.raw.headers.get(`Cookie`);if(typeof n==`string`){if(!i)return;let e=n;return r===`secure`?e=`__Secure-`+n:r===`host`&&(e=`__Host-`+n),(await f(i,t,e))[e]}return i?await f(i,t):{}},IF=(e,t,n)=>{let r;return r=n?.prefix===`secure`?h(`__Secure-`+e,t,{path:`/`,...n,secure:!0}):n?.prefix===`host`?h(`__Host-`+e,t,{...n,path:`/`,secure:!0,domain:void 0}):h(e,t,{path:`/`,...n}),r},LF=(e,t,n,r)=>{let i=IF(t,n,r);e.header(`Set-Cookie`,i,{append:!0})},RF=(e,t,n)=>{let r=PF(e,t,n?.prefix);return LF(e,t,``,{...n,maxAge:0}),r},zF=/^application\/([a-z-\.]+\+)?json(;\s*[a-zA-Z0-9\-]+\=([^;]+))*$/i,BF=/^multipart\/form-data(;\s?boundary=[a-zA-Z0-9'"()+_,\-./:=?]+)?$/i,VF=/^application\/x-www-form-urlencoded(;\s*[a-zA-Z0-9\-]+\=([^;]+))*$/i,HF=(e,t)=>async(n,r)=>{let i={},a=n.req.header(`Content-Type`);switch(e){case`json`:if(!a||!zF.test(a))break;try{i=await n.req.json()}catch{throw new nl(400,{message:`Malformed JSON in request body`})}break;case`form`:{if(!a||!(BF.test(a)||VF.test(a)))break;let e;if(n.req.bodyCache.formData)e=await n.req.bodyCache.formData;else try{e=await il(await n.req.arrayBuffer(),a),n.req.bodyCache.formData=e}catch(e){let t=`Malformed FormData request.`;throw t+=e instanceof Error?` ${e.message}`:` ${String(e)}`,new nl(400,{message:t})}let t=Object.create(null);e.forEach((e,n)=>{n.endsWith(`[]`)?(t[n]??=[]).push(e):Array.isArray(t[n])?t[n].push(e):Object.hasOwn(t,n)?t[n]=[t[n],e]:t[n]=e}),i=t;break}case`query`:i=Object.fromEntries(Object.entries(n.req.queries()).map(([e,t])=>t.length===1?[e,t[0]]:[e,t]));break;case`param`:i=n.req.param();break;case`header`:i=n.req.header();break;case`cookie`:i=PF(n)}let o=await t(i,n);return o instanceof Response?o:(n.req.addValidatedData(e,o),await r())},UF={header:[`cookie`]};function WF(e,t,n){if(!(n in UF))return e;let r=UF[n]||[];return t===`arktype`?GF(e,r):t===`valibot`?KF(e,r):e}function GF(e,t){return e.map(e=>{if(e&&typeof e==`object`&&`data`in e&&typeof e.data==`object`&&e.data!==null&&!Array.isArray(e.data)){let n={...e.data};for(let e of t)delete n[e];let r=Object.create(Object.getPrototypeOf(e));return Object.assign(r,e,{data:n}),r}return e})}function KF(e,t){return e.map(e=>{if(e&&typeof e==`object`&&`path`in e&&Array.isArray(e.path)){for(let n of e.path)if(typeof n==`object`&&`input`in n&&typeof n.input==`object`&&n.input!==null&&!Array.isArray(n.input))for(let e of t)delete n.input[e]}return e})}var qF=(e,t,n)=>HF(e,async(r,i)=>{let a=await t[`~standard`].validate(r);if(n){let t=await n(a.issues?{data:r,error:a.issues,success:!1,target:e}:{data:r,success:!0,target:e},i);if(t){if(t instanceof Response)return t;if(typeof t==`object`&&`response`in t)return t.response}}if(a.issues){let n=WF(a.issues,t[`~standard`].vendor,e);return i.json({data:r,error:n,success:!1},400)}return a.value}),JF=Symbol(`openapi`),YF=`__HonoOpenAPIValidator__`,XF=[`GET`,`PUT`,`POST`,`DELETE`,`OPTIONS`,`HEAD`,`PATCH`,`TRACE`],ZF=e=>{let t=e;if(t.startsWith(`:`)){let e=t.match(/^:([^{?]+)(?:{(.+)})?(\?)?$/);e?t=`{${e[1]}}`:(t=t.slice(1,t.length),t.endsWith(`?`)&&(t=t.slice(0,-1)),t=`{${t}}`)}return t},QF=e=>e.split(`/`).map(ZF).join(`/`),$F=e=>e.split(/[\W_]+/).filter(Boolean).map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(``),eI=e=>{let t=e.method.toLowerCase();if(e.path===`/`)return`${t}Index`;for(let n of e.path.split(`/`)){let e=ZF(n);e.charCodeAt(0)===123?t+=`By${$F(e.slice(1,-1))}`:t+=$F(e)}return t},tI=e=>`$ref`in e?e.$ref:`${e.in} ${e.name}`;function nI(...e){let t=e.flatMap(e=>e??[]).reduce((e,t)=>(e.set(tI(t),t),e),new Map);return Array.from(t.values())}var rI=new Map;function iI(e,t){let n=[];for(let[r,i]of t){if(!i)continue;let t=r.endsWith(`/*`)?r.slice(0,-2):r;(e===t||e.startsWith(`${t}/`))&&n.push(i)}return n}function aI(e,t){return!e||!t||`$ref`in e||`$ref`in t?t:{...e,...t,content:{...e.content,...t.content}}}function oI(e,...t){return t.reduce((t,n)=>{if(!n||!t)return t;for(let[r,i]of Object.entries(n))if(i!=null){if(r in t&&(typeof i==`object`||typeof i==`function`&&r===`operationId`)){if(Array.isArray(i)){let e=[...t[r]??[],...i];t[r]=r===`tags`?Array.from(new Set(e)):r===`parameters`?nI(e):e}else typeof i==`function`?t[r]=i(e):r===`parameters`?t[r]=nI(t[r],i):r===`requestBody`?t.requestBody=aI(t.requestBody,i):t[r]={...t[r],...i}}else t[r]=i}return t},{operationId:eI(e)})}function sI({route:e,specs:t,paths:n},r=rI){let i=QF(e.path),a=e.method.toLowerCase();if(a===`all`){if(!t)return;if(r.has(i)){let n=r.get(i)??{};r.set(i,oI(e,n,t))}else r.set(i,t)}else{let o=iI(i,r);i in n||(n[i]={}),n[i]&&(n[i][a]=oI(e,...o,n[i]?.[a],t))}}function cI(e,t){let{exclude:n,excludeStaticFile:r}=t.options,i={},a=Array.isArray(n)?n:[n];for(let[n,o]of Object.entries(e)){if(o==null||a.some(e=>typeof e==`string`?n===e:e.test(n))||n.includes(`*`)&&!n.includes(`{`))continue;if(r){let e=n.includes(`{`),t=(n.split(`/`).pop()||``).includes(`.`);if(!e&&t)continue}for(let e of Object.keys(o)){let r=o[e];if(r==null)continue;let i=r[YF]===!0;if(delete r[YF],n.includes(`{`)){r.parameters=r.parameters?[...r.parameters]:[];let e=n.split(`/`).filter(e=>e.startsWith(`{`)&&!r.parameters.find(t=>t.in===`path`&&t.name===e.slice(1,e.length-1)));for(let n of e){let e=n.slice(1,n.length-1);r.parameters.findIndex(n=>{if(`$ref`in n){let r=n.$ref.split(`/`).pop();if(r){let n=t.components.parameters?.[r];if(n&&!(`$ref`in n))return n.in===`path`&&n.name===e}return!1}return n.in===`path`&&n.name===e})===-1&&r.parameters.push({schema:{type:`string`},in:`path`,name:e,required:!0})}}if(r.responses||={200:{}},i&&t.options.defaultValidationErrorResponse!==!1&&!r.responses[400]){let e=t.options.defaultValidationErrorResponse;typeof e==`object`?r.responses[400]=structuredClone(e):t.validationErrorResponse&&(r.responses[400]=structuredClone(t.validationErrorResponse))}}let e={};for(let t of Object.keys(o))o[t]!=null&&(e[t]=o[t]);Object.keys(e).length>0&&(i[n]=e)}return i}var lI={documentation:{},excludeStaticFile:!0,exclude:[],excludeMethods:[`OPTIONS`],excludeTags:[],defaultValidationErrorResponse:!0},uI={description:`Validation Error`,content:{"application/json":{schema:{type:`object`,properties:{success:{type:`boolean`,enum:[!1]},error:{type:`array`,items:{}},data:{}},required:[`success`,`error`,`data`]}}}};async function dI(e,t=lI,n){let r={components:{},options:{...lI,...t},validationErrorResponse:uI},i=r.options.documentation??{},a={...i,components:i.components&&{...i.components}},o=await fI(e,r);for(let e in o)for(let t in o[e])pI({valueOrFunc:o[e][t]?.hide,method:t,path:e,c:n})&&(o[e][t]=void 0);let s=a.components?.responses?await vI(a.components.responses):void 0;s&&a.components&&(a.components.responses=s.responses);let c=bI(a.components,s?.components,r.components);return{openapi:`3.1.0`,...a,tags:a.tags?.filter(e=>!r.options.excludeTags?.includes(e?.name)),info:{title:`Hono Documentation`,description:`Development documentation`,version:`0.0.0`,...a.info},paths:{...cI(o,r),...a.paths},components:c}}async function fI(e,t){let n={},r=new Map;for(let i of e.routes){let e=NF(i.handler)[JF];if(!e){t.options.includeEmptyPaths&&sI({route:i,paths:n},r);continue}let a=i.method;if(a!==`ALL`&&(t.options.excludeMethods?.includes(a)||!XF.includes(a)))continue;let{schema:o,components:s={}}=await mI(e,t.options.defaultOptions?.[a]&&{...t.options.defaultOptions[a]},t.components.parameters);t.components=bI(t.components,s),sI({route:i,specs:o,paths:n},r)}return n}function pI(e){let{valueOrFunc:t,c:n,method:r,path:i}=e;if(t!=null){if(typeof t==`boolean`)return t;if(typeof t==`function`)return t({c:n,method:r,path:i})}return!1}async function mI(e,t,n){if(`spec`in e){let n={...t,...e.spec,responses:{...t?.responses,...e.spec.responses}},r={};if(n.responses){let e=await vI(n.responses);n.responses=e.responses,r=e.components}if(n.requestBody&&`content`in n.requestBody){let e=await _I(n.requestBody.content);n.requestBody={...n.requestBody,content:e.content},r=bI(r,e.components)}return{schema:n,components:r}}let r=await e.toOpenAPISchema();yI(r);let i={...t,[YF]:!0};if(e.target===`form`||e.target===`json`){let t=e.options?.media??(e.target===`json`?`application/json`:`multipart/form-data`);!i.requestBody||!(`content`in i.requestBody)||!i.requestBody.content?i.requestBody={required:!0,content:{[t]:{schema:r.schema}}}:i.requestBody.content[t]={schema:r.schema}}else{let t=[];if(`$ref`in r.schema){let i=r.schema.$ref.split(`/`).pop();if(i&&r.components?.schemas?.[i]){let a=r.components.schemas[i],o=hI(e.target,a,r.components.schemas),s=o.length===1?o[0]:void 0,c=n?.[i];s&&(!c||`in`in c&&c.in===s.in&&c.name===s.name)?(r.components.parameters??={},r.components.parameters[i]=s,t.push({$ref:`#/components/parameters/${i}`}),delete r.components.schemas[i]):t=o}}else t=hI(e.target,r.schema,r.components?.schemas);i.parameters=t}return{schema:i,components:r.components}}function hI(e,t,n){let r=[];for(let[i,a]of gI(t,n)){let t={in:e===`param`?`path`:e,name:i,schema:a.schema};a.required&&(t.required=!0),t.schema&&`description`in t.schema&&t.schema.description&&(t.description=t.schema.description,t.schema={...t.schema,description:void 0}),r.push(t)}return r}function gI(e,t){let n=new Map,r=new Set,i=e=>{for(let[t,r]of Object.entries(e.properties??{})){let i=n.get(t);n.set(t,{schema:i?{allOf:[i.schema,r]}:r,required:!!e.required?.includes(t)||i?.required})}for(let n of e.allOf??[])if(`$ref`in n){if(!n.$ref.startsWith(`#/components/schemas/`))continue;let e=n.$ref.slice(21).replaceAll(`~1`,`/`).replaceAll(`~0`,`~`),a=t?.[e];a&&!r.has(e)&&(r.add(e),i(a),r.delete(e))}else i(n)};return i(e),n}async function _I(e){let t={},n={};for(let[r,i]of Object.entries(e))if(i){if(i.schema&&`toOpenAPISchema`in i.schema){let e=await i.schema.toOpenAPISchema();yI(e),n[r]={...i,schema:e.schema},e.components&&(t=bI(t,e.components))}else n[r]=i}return{content:n,components:t}}async function vI(e){let t={},n={};for(let[r,i]of Object.entries(e)){if(!i||!(`content`in i)||!i.content){n[r]=i;continue}let e=await _I(i.content);n[r]={...i,content:e.content},t=bI(t,e.components)}return{responses:n,components:t}}function yI(e){let t=e.schema.$defs;t&&typeof t==`object`&&(e.components??={},e.components.schemas={...t,...e.components.schemas},delete e.schema.$defs)}function bI(...e){return e.reduce((e,t,n)=>(t==null||n===0||((e.schemas&&Object.keys(e.schemas).length>0||t.schemas&&Object.keys(t.schemas).length>0)&&(e.schemas={...e.schemas,...t.schemas}),(e.parameters&&Object.keys(e.parameters).length>0||t.parameters&&Object.keys(t.parameters).length>0)&&(e.parameters={...e.parameters,...t.parameters})),e),e[0]??{})}var xI=e=>e.base,SI=e=>{e.zodSchema._zod.def.type===`date`&&(e.jsonSchema.type=`string`,e.jsonSchema.format=`date-time`)};function CI(e,t){let n=e[`~standard`].vendor;return{vendor:n,validate:e[`~standard`].validate,toJSONSchema:n=>nc(e,{...t,...n}),toOpenAPISchema:r=>rc(e,{...t,...r,...n===`arktype`?wI(t,r):void 0,...n===`zod`?TI(e,t,r):void 0})}}function wI(e,t){let n=e?.options,r=t?.options;if(!(e?.fallback||n?.fallback||t?.fallback||r?.fallback))return{options:{fallback:xI,...n,...r}}}function TI(e,t,n){if(!(`_zod`in e))return;let r=t?.options,i=n?.options;if(!(t?.override||r?.override||n?.override||i?.override))return{options:{unrepresentable:`any`,override:SI,...r,...i}}}function EI(e,t,n,r){let i=qF(e,t,n);return Object.defineProperty(i,"name",{value:`validator`,configurable:!0}),Object.assign(i,{[JF]:{target:e,...CI(t,r),options:r}})}function DI(e){let t=async(e,t)=>{await t()};return Object.defineProperty(t,"name",{value:`describeRoute`,configurable:!0}),Object.assign(t,{[JF]:{spec:e}})}var OI={options:{override:e=>{let{jsonSchema:t}=e;delete t.readOnly;let n=t.anyOf?.filter(e=>Object.keys(e).length>0);n&&n.length!==t.anyOf.length&&(n.length===1?(delete t.anyOf,Object.assign(t,n[0])):t.anyOf=n)},unrepresentable:`any`}},kI={integrity:`sha384-U11tb2XnKvmwt8RlTvnwUnYgrN+ur4Xyh9htLhjajWNR/Oyl5AX5DEz00qRmlrmK`,src:`https://cdn.jsdelivr.net/npm/@scalar/api-reference@1.72.1/dist/browser/standalone.js`},AI={description:"Tempo ID signs users in to Tempo apps, authorizes apps for them, and signs key authorizations on their Tempo Accounts. Every refusal is an OAuth error response (RFC 6749 §5.2) whose `reason` determines its `error` and status.",title:`Tempo ID`,version:`0.0.0`};function jI(e){let t=LI.get(e);if(t)return t;let n=RI(e);return LI.set(e,n),n.catch(()=>LI.delete(e)),n}var MI=`<!doctype html>
406
+ <html lang="en">
407
+ <head>
408
+ <meta charset="utf-8" />
409
+ <meta name="viewport" content="width=device-width, initial-scale=1" />
410
+ <title>Tempo ID API</title>
411
+ </head>
412
+ <body>
413
+ <script id="api-reference" type="application/json" data-url="/openapi.json"><\/script>
414
+ <script src="${kI.src}" integrity="${kI.integrity}" crossorigin="anonymous"><\/script>
415
+ </body>
416
+ </html>
417
+ `,NI=[`default-src 'self'`,`script-src ${kI.src}`,`style-src 'self' 'unsafe-inline' https://fonts.scalar.com`,`font-src https://fonts.scalar.com`,`img-src 'self' data:`,`connect-src 'self'`,`object-src 'none'`,`base-uri 'none'`,`form-action 'none'`,`frame-ancestors 'none'`].join(`; `);function PI(e){let t=new Map;for(let n of new Set([...e,rO].map(e=>e.reason)).values()){let e=QD[n].status;t.set(e,[...t.get(e)??[],n])}return Object.fromEntries([...t].map(([e,t])=>[e,{content:{"application/json":{schema:{anyOf:t.map(e=>({$ref:`#/components/schemas/ErrorResponse.${e}`}))}}},description:t.map(e=>`\`${e}\``).join(`, `)}]))}function FI(e,t){let n=EI(e,t,void 0,{...OI,...e===`form`?{media:`application/x-www-form-urlencoded`}:{}});return Object.assign((e,t)=>t(),{[JF]:n[JF]})}function II(e){let{errors:t=[],success:n}=e;return{[n.status??200]:{content:{"application/json":{schema:CI(n.schema,OI)}},description:n.description},...PI(t)}}function X(e,t){return EI(e,t,(e,t)=>{if(!e.success)return J(t,new LM({issues:e.error}))},OI)}(function(e){e.errors=[tO,LM]})(X||={});var LI=new WeakMap;async function RI(e){let t=await Promise.all(Object.keys(QD).map(async e=>(await CI(oO.of(e),OI).toOpenAPISchema()).components?.schemas));return dI(e,{defaultValidationErrorResponse:!1,excludeStaticFile:!1,documentation:{components:{schemas:Object.assign({},...t),securitySchemes:{accessToken:{bearerFormat:`JWT`,description:"An access token from `/oauth2/token`, as `Authorization: Bearer <token>`.",scheme:`bearer`,type:`http`},clientBasic:{description:"An OAuth app's client ID and secret, as HTTP Basic `Authorization` (RFC 6749 §2.3.1).",scheme:`basic`,type:`http`},sessionCookie:{description:`The Tempo ID session, which sign-in sets as an HTTP-only cookie on Tempo ID's origin.`,in:`cookie`,name:CP,type:`apiKey`}}},info:AI,openapi:`3.1.0`}})}var zI={ACCOUNT_LIMIT:{limit:60,namespace:`1007`,period:60},APP_DISCOVERY_LIMIT:{limit:30,namespace:`1009`,period:60},AUTHORIZE_LIMIT:{limit:60,namespace:`1001`,period:60},DEVICE_LIMIT:{limit:10,namespace:`1002`,period:60},SIGN_IN_CODE_LIMIT:{limit:5,namespace:`1003`,period:60},SIGN_IN_IP_LIMIT:{limit:100,namespace:`1004`,period:60},TOKEN_APP_LIMIT:{limit:600,namespace:`1008`,period:60},TOKEN_LIMIT:{limit:300,namespace:`1006`,period:60}},BI=[`TOKEN_APP_LIMIT`],VI=class extends q(`rate_limited`){name=`RateLimit.LimitedError`;constructor(e){super({error_description:`Too many requests. Try again in ${uO({seconds:e.retryAfter})}.`,meta:{retryAfter:e.retryAfter}})}},HI=`2a06:98c0:3600::103`,UI=YI({name:`sign-in-codes`,quota:10,window:3600}),WI=[`RateLimit`,`RateLimit-Policy`,`Retry-After`];async function Z(e,t){let n=e.env,r=t.limits.flatMap(t=>t.key===void 0?[]:!n[t.binding]&&BI.includes(t.binding)?($s(e,{fields:{binding:t.binding},message:`A rate limit has no binding, so the request is not counted.`}),[]):[{...t,key:t.key,policy:ZI({binding:t.binding})}]);for(let t of r)qI(e,{policy:t.policy});for(let t of r)if(!await GI(e,{binding:t.binding,key:t.key}))return QI(e,{policy:t.policy,retryAfter:t.policy.window})}(function(e){e.errors=[VI]})(Z||={});function GI(e,t){let n=e.var.counted??new Map;e.var.counted||e.set(`counted`,n);let r=JSON.stringify([t.binding,t.key]),i=n.get(r)??Y(e,e.env[t.binding].limit({key:t.key}),`ratelimit.limit`).then(e=>e.success);return n.set(r,i),i}async function KI(e,t){let n=`sign-in-codes:${JI(t)}`,r=Date.now(),i=crypto.randomUUID();await e.insert(K).values({expiresAt:new Date(r+UI.window*1e3),id:i,identifier:n,value:``});let[a]=await e.select({count:V`count(*)::int`}).from(K).where(qC(W(K.identifier,n),XC(K.expiresAt,new Date(r))));return(a?.count??0)<=UI.quota||(await e.delete(K).where(W(K.id,i)),!1)}function qI(e,t){let{policy:n}=t;e.header(`ratelimit-policy`,`"${n.name}";q=${n.quota};w=${n.window}`,{append:!0})}function JI(e){return Hn(mn(e.email),{as:`Hex`})}function YI(e){return e}function XI(e){let t=e.req.header(`cf-connecting-ip`);if(t===HI)return`worker:${e.req.header(`cf-worker`)??``}`;if(!t?.includes(`:`)||t.includes(`.`))return t;let[n,r]=t.toLowerCase().split(`::`),i=n?n.split(`:`):[],a=r?r.split(`:`):[];return`${(r===void 0?i:[...i,...Array(Math.max(0,8-i.length-a.length)).fill(`0`),...a]).slice(0,4).map(e=>e.replace(/^0+(?=.)/,``)).join(`:`)}::/64`}function ZI(e){let{binding:t}=e,n=zI[t];return YI({name:t.replace(/_LIMIT$/,``).toLowerCase().replaceAll(`_`,`-`),quota:n.limit,window:n.period})}function QI(e,t){let{policy:n,retryAfter:r}=t;return e.header(`ratelimit`,`"${n.name}";r=0;t=${r}`),e.header(`retry-after`,String(r)),J(e,new VI({retryAfter:r}))}function $I(e,t){return e.endsWith(t)?e.length===t.length||e[e.length-t.length-1]===`.`:!1}function eL(e,t){let n=e.length-t.length-2,r=e.lastIndexOf(`.`,n);return r===-1?e:e.slice(r+1)}function tL(e,t,n){if(n.validHosts!==null){let e=n.validHosts;for(let n of e)if($I(t,n))return n}let r=0;if(t.startsWith(`.`))for(;r<t.length&&t[r]===`.`;)r+=1;return e.length===t.length-r?null:eL(t,e)}function nL(e,t){return e.slice(0,-t.length-1)}var rL=/[\t\n\r]/g,iL=!1;function aL(e){return e>=97&&e<=122||e>=48&&e<=57||e>127||e>=65&&e<=90||e===45||e===95}function oL(e,t,n){let r=n-t,i=e.charCodeAt(t)|32;if(r===2)return+(i===119&&(e.charCodeAt(t+1)|32)==115);if(r===3){let n=e.charCodeAt(t+1)|32,r=e.charCodeAt(t+2)|32;return+(i===119&&n===115&&r===115||i===102&&n===116&&r===112)}if(r===4){let n=e.charCodeAt(t+1)|32,r=e.charCodeAt(t+2)|32,a=e.charCodeAt(t+3)|32;return i===104&&n===116&&r===116&&a===112?1:i===102&&n===105&&r===108&&a===101?2:0}return r===5?+(i===104&&(e.charCodeAt(t+1)|32)==116&&(e.charCodeAt(t+2)|32)==116&&(e.charCodeAt(t+3)|32)==112&&(e.charCodeAt(t+4)|32)==115):0}function sL(e,t,n=!1){let r=0,i=e.length,a=!1,o=!1;if(iL=!1,!t){if(e.startsWith(`data:`))return null;for(;r<e.length&&e.charCodeAt(r)<=32;)r+=1;for(;i>r+1&&e.charCodeAt(i-1)<=32;)--i;if(e.charCodeAt(r)===47&&e.charCodeAt(r+1)===47)r+=2;else{let a=e.indexOf(`:/`,r);if(a!==-1){let i=oL(e,r,a);if(i===1)for(o=!0,r=a+2;e.charCodeAt(r)===47||e.charCodeAt(r)===92;)r+=1;else if(i===2){o=!0,r=a+1;let t=0;for(;(e.charCodeAt(r)===47||e.charCodeAt(r)===92)&&t<2;)r+=1,t+=1;if(t<2)return null}else{for(let i=r;i<a;i+=1){let r=e.charCodeAt(i)|32;if(!(r>=97&&r<=122||r>=48&&r<=57||r===46||r===45||r===43)){let r=e.charCodeAt(i);return r===9||r===10||r===13?sL(e.replace(rL,``),t,n):null}}if(e.charCodeAt(a+2)===47)r=a+3;else return null}}else if(e.charCodeAt(r)!==91){let a=-1;for(let o=r;o<i;o+=1){let r=e.charCodeAt(o);if(r===9||r===10||r===13)return sL(e.replace(rL,``),t,n);if(r===58){a=o;break}if(r===47||r===92||r===63||r===35)break}if(a!==-1){let t=!1;for(let n=a+1;n<i;n+=1){let r=e.charCodeAt(n);if(r===47||r===92||r===63||r===35)break;if(r===64){t=!0;break}}if(!t){let t=!0,n=a+1;for(;n<i;n+=1){let r=e.charCodeAt(n);if(r===47||r===92||r===63||r===35)break;if(r<48||r>57){t=!1;break}}if(n===a+1&&(t=!1),!t){let t=oL(e,r,a);if(t===0){let t=!1;for(let n=a+1;n<i;n+=1){let r=e.charCodeAt(n);if(r===47||r===92||r===63||r===35)break;if(r===58){t=!0;break}}if(!t)return null}else if(o=!0,r=a+1,t===2){let t=0;for(;(e.charCodeAt(r)===47||e.charCodeAt(r)===92)&&t<2;)r+=1,t+=1;if(t<2)return null}else for(;e.charCodeAt(r)===47||e.charCodeAt(r)===92;)r+=1}}}}}let s=-1,c=-1,l=-1,u=-1,d=!1,f=n,p=r-1,m=-1;if(n&&r<i){let t=e.charCodeAt(r);(!(aL(t)||t===46||t===95)||t===45)&&(f=!1)}for(let t=r;t<i;t+=1){let r=e.charCodeAt(t);if(r<64){if(r===47||r===35||r===63){i=t;break}r===58?(u===-1&&(u=t),l=t):r===9||r===10||r===13?d=!0:n&&(r===46?((t-p>64||m===46||m===45)&&(f=!1),p=t):(r<48||r>57)&&(r!==45||m===46)&&(f=!1))}else if(o&&r===92){i=t;break}else r===64?(s=t,u=-1):r===93?c=t:r>=65&&r<=90?a=!0:n&&!aL(r)&&(f=!1);n&&(m=r)}if(d)return sL(e.replace(rL,``),t,n);if(s!==-1&&s>=r&&s<i&&(r=s+1),e.charCodeAt(r)===91)return c===-1?null:e.slice(r+1,c).toLowerCase();if(l!==-1&&l>r&&l<i&&u===l&&(i=l),r>=i)return null;n&&f&&s===-1&&l===-1&&c===-1&&e.charCodeAt(i-1)!==46&&i-r<=255&&i-p-1<=63&&m!==45&&(iL=!0)}for(;i>r+1&&e.charCodeAt(i-1)===46;)--i;let s=r!==0||i!==e.length?e.slice(r,i):e;return a?s.toLowerCase():s}function cL(e){if(e.length<7||e.length>15)return!1;let t=0;for(let n=0;n<e.length;n+=1){let r=e.charCodeAt(n);if(r===46)t+=1;else if(r<48||r>57)return!1}return t===3&&e.charCodeAt(0)!==46&&e.charCodeAt(e.length-1)!==46}function lL(e){if(e.length<3)return!1;let t=+!!e.startsWith(`[`),n=e.length;if(e[n-1]===`]`&&--n,n-t>39)return!1;let r=!1;for(;t<n;t+=1){let n=e.charCodeAt(t);if(n===58)r=!0;else if(!(n>=48&&n<=57||n>=97&&n<=102||n>=65&&n<=70))return!1}return r}function uL(e){return lL(e)||cL(e)}var dL=[`test`,`localhost`,`invalid`,`example`,`example.com`,`example.net`,`example.org`,`local`,`onion`,`alt`,`home.arpa`,`ipv4only.arpa`,`resolver.arpa`,`service.arpa`,`6tisch.arpa`,`eap.arpa`];function fL(e){for(let t of dL)if(e.endsWith(t)&&(e.length===t.length||e.charCodeAt(e.length-t.length-1)===46))return!0;return!1}function pL(e){return e>=97&&e<=122||e>=48&&e<=57||e>127}function mL(e){if(e.length>255||e.length===0||!pL(e.charCodeAt(0))&&e.charCodeAt(0)!==46&&e.charCodeAt(0)!==95)return!1;let t=-1,n=-1,r=e.length;for(let i=0;i<r;i+=1){let r=e.charCodeAt(i);if(r===46){if(i-t>64||n===46||n===45)return!1;t=i}else if(!(pL(r)||r===45||r===95)||r===45&&n===46)return!1;n=r}return r-t-1<=63&&n!==45}function hL({allowIcannDomains:e=!0,allowPrivateDomains:t=!1,detectIp:n=!0,detectSpecialUse:r=!1,extractHostname:i=!0,mixedInputs:a=!0,validHosts:o=null,validateHostname:s=!0}){return{allowIcannDomains:e,allowPrivateDomains:t,detectIp:n,detectSpecialUse:r,extractHostname:i,mixedInputs:a,validHosts:o,validateHostname:s}}var gL=hL({});function _L(e){return e===void 0?gL:hL(e)}function vL(e,t){return t.length===e.length?``:e.slice(0,-t.length-1)}function yL(){return{domain:null,domainWithoutSuffix:null,hostname:null,isIcann:null,isIp:null,isPrivate:null,isSpecialUse:null,publicSuffix:null,subdomain:null}}function bL(e,t,n,r,i){let a=_L(r);if(typeof e!=`string`)return i;let o=!1;return a.extractHostname?a.mixedInputs?(o=mL(e),i.hostname=sL(e,o,a.validateHostname)):i.hostname=sL(e,!1,a.validateHostname):i.hostname=e,a.detectIp&&i.hostname!==null&&(i.isIp=uL(i.hostname),i.isIp)?i:a.validateHostname&&a.extractHostname&&i.hostname!==null&&!(o&&i.hostname===e)&&!iL&&!mL(i.hostname)?(i.hostname=null,i):(t===0||i.hostname===null||(t===5&&a.detectSpecialUse&&(i.isSpecialUse=fL(i.hostname)),n(i.hostname,a,i),t===2||i.publicSuffix===null)||(i.domain=tL(i.publicSuffix,i.hostname,a),t===3||i.domain===null)||(i.subdomain=vL(i.hostname,i.domain),t===4)||(i.domainWithoutSuffix=nL(i.domain,i.publicSuffix)),i)}function xL(e,t,n){if(!t.allowPrivateDomains&&e.length>3){let t=e.length-1,r=e.charCodeAt(t),i=e.charCodeAt(t-1),a=e.charCodeAt(t-2),o=e.charCodeAt(t-3);if(r===109&&i===111&&a===99&&o===46)return n.isIcann=!0,n.isPrivate=!1,n.publicSuffix=`com`,!0;if(r===103&&i===114&&a===111&&o===46)return n.isIcann=!0,n.isPrivate=!1,n.publicSuffix=`org`,!0;if(r===117&&i===100&&a===101&&o===46)return n.isIcann=!0,n.isPrivate=!1,n.publicSuffix=`edu`,!0;if(r===118&&i===111&&a===103&&o===46)return n.isIcann=!0,n.isPrivate=!1,n.publicSuffix=`gov`,!0;if(r===116&&i===101&&a===110&&o===46)return n.isIcann=!0,n.isPrivate=!1,n.publicSuffix=`net`,!0;if(r===101&&i===100&&a===46)return n.isIcann=!0,n.isPrivate=!1,n.publicSuffix=`de`,!0}return!1}var SL=new Uint8Array([1,2,1,1,1,1,1,1,1,1,1,1,0,2,2,2,0,2,2,0,2,0,0,1,0,0,2,1,1,1,1,1,1,0,0,0,1,0,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,1,1,1,1,1,0,0,2,1,1,1,1,1,1,1,1,1,1,1,0,1,1,1,1,1,1,1,1,1,0,1,0,1,1,0,1,1,0,0,0,0,0,0,1,1,1,0,2,0,0,0,0,0,0,0,2,0,2,2,0,0,2,2,0,0,0,0,0,0,1,1,1,0,0,0,0,0,0,0,0,0,0,0,1,0,1,1,0,2,1,1,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,2,2,0,0,0,0,0,2,0,0,0,2,0,0,0,0,0,0,2,0,2,0,0,0,0,0,0,0,0,0,2,0,0,0,0,2,1,1,1,1,1,1,1,1,1,0,1,1,0,0,0,0,1,0,2,2,0,0,0,2,0,1,1,0,2,0,2,2,0,1,1,1,1,1,1,1,1,0,1,1,1,0,1,1,1,1,0,0,0,0,1,0,1,1,1,0,1,1,1,1,1,1,1,1,1,1,2,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,2,2,0,2,2,0,0,0,0,0,1,1,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,1,1,1,1,1,1,1,1,1,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,1,1,1,1,1,1,1,1,1,1,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,1,0,2,2,0,2,2,2,2,0,0,0,0,2,0,0,0,0,0,0,0,2,2,0,0,0,2,2,1,1,1,1,1,2,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,0,0,0,2,2,0,0,2,1,1,1,1,1,1,1,1,1,1,1,1,2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,2,2,1,2,1,1,1,2,1,1,1,1,1,0,1,1,1,1,2,1,1,1,1,2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,0,1,1,1,1,1,2,1,1,1,1,2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,1,1,1,1,1,1,1,0,0,0,0,0]),CL=new Uint16Array([0,0,0,10,11,18,106,111,117,124,130,136,145,146,147,148,149,150,151,153,154,155,157,159,227,240,242,243,244,259,266,267,270,271,272,275,277,296,297,299,308,313,330,331,334,336,337,339,373,374,376,379,380,384,386,390,393,425,428,441,442,450,451,453,463,477,478,479,480,489,490,527,532,548,568,574,616,617,644,671,672,820,826,829,830,831,836,841,850,872,873,874,875,876,877,878,896,898,899,902,904,905,907,909,924,939,944,945,947,948,949,950,951,953,956,961,962,963,965,966,969,972,973,974,987,989,1001,1012,1020,1022,1063,1066,1070,1071,1073,1076,1087,1089,1099,1101,1107,1109,1110,1112,1115,1116,1117,1170,1172,1174,1194,1195,1196,1197,1199,1210,1241,1252,1264,1273,1280,1285,1298,1309,1322,1323,1334,1368,1369,1370,1385,1400,1472,1473,1475,1476,1510,1511,1512,1513,1516,1520,1523,1525,1554,1555,1563,1564,1565,1566,1568,1570,1571,1573,1574,1575,1586,1587,1588,1589,1590,1591,1592,1593,1594,1595,1596,1597,1598,1599,1601,1602,1603,2057,2060,2061,2063,2070,2077,2087,2091,2102,2103,2104,2116,2117,2119,2121,2122,2129,2130,2132,2133,2135,2136,2137,2138,2139,2213,2215,2236,2237,2238,2240,2266,2267,2318,2319,2321,2328,2334,2344,2354,2407,2408,2409,2419,2433,2434,2437,2444,2445,2453,2454,2455,2456,2457,2468,2469,2470,2472,2473,2474,2483,2495,2501,2533,2537,2539,2540,2542,2543,2554,2555,2557,2565,2572,2578,2583,2584,2590,2593,2599,2606,2607,2614,2622,2623,2624,2662,2668,2683,2684,2689,2707,2738,2756,2758,2761,2769,2771,2778,2830,2854,2855,2856,2857,2858,2859,2860,2867,2868,2869,2870,2871,2872,2874,2875,2879,2959,2972,2973,3410,3414,3428,3480,3508,3530,3588,3610,3625,3688,3739,3777,3813,3838,3980,4026,4077,4096,4130,4145,4165,4195,4226,4249,4280,4310,4342,4369,4444,4466,4504,4514,4548,4567,4593,4635,4685,4711,4780,4781,4783,4806,4829,4865,4896,4913,4970,4983,5007,5036,5038,5072,5088,5116,5421,5430,5439,5446,5463,5467,5473,5512,5514,5521,5528,5537,5544,5545,5546,5558,5561,5576,5577,5586,5587,5596,5605,5611,5613,5614,5615,5652,5653,5655,5663,5670,5683,5687,5689,5690,5696,5703,5717,5727,5732,5740,5748,5754,5755,5759,5761,5762,5774,5846,5847,5848,5849,5851,5852,5855,5857,5860,5864,5865,5866,5872,5873,5874,5876,5878,5880,5881,5882,5885,5887,5890,5891,5893,6091,6098,6099,6100,6110,6115,6132,6146,6155,6156,6157,6161,6162,6164,6166,6172,6173,6176,6177,6179,6180,6181,7081,7084,7088,7106,7115,7118,7125,7126,7128,7129,7130,7132,7184,7185,7188,7189,7306,7307,7318,7329,7336,7339,7348,7349,7350,7365,7420,7612,7614,7615,7617,7622,7635,7650,7657,7666,7669,7672,7679,7687,7691,7692,7693,7707,7711,7720,7721,7722,7726,7761,7762,7780,7787,7795,7796,7801,7809,7853,7854,7860,7863,7875,7880,7881,7884,7886,7921,7922,7928,7935,7936,7945,7954,7969,7973,7974,8026,8027,8032,8034,8037,8039,8040,8041,8050,8064,8072,8086,8098,8099,8101,8103,8125,8136,8142,8143,8155,8167,8254,8266,8274,8277,8283,8308,8311,8312,8313,8314,8316,8319,8322,8333,8335,8337,8365,8440,8447,8451,8452,8461,8483,8484,8489,8490,8569,8571,8573,8582,8586,8592,8598,8604,8614,8619,8620,8638,8649,8654,8659,8669,8675,8679,8685,8691,10300,10301,10302,10309,10311]),wL=new Uint8Array([3,3,3,3,3,3,3,3,5,8,8,2,2,3,3,3,3,3,8,5,5,5,5,5,3,3,5,5,9,12,19,8,19,8,11,9,9,8,7,7,6,8,9,16,10,7,7,11,8,6,6,9,7,11,7,14,4,4,4,4,4,4,10,7,6,6,6,6,10,10,6,10,10,22,11,9,10,10,10,9,10,8,7,7,7,8,21,13,11,11,9,10,9,13,10,8,8,9,12,9,7,10,7,7,13,7,3,3,3,3,3,2,3,3,3,3,3,3,3,3,3,3,8,6,3,3,3,3,3,3,2,5,3,3,3,7,2,2,2,2,2,2,3,3,3,1,1,7,8,5,2,2,7,2,2,1,4,1,11,9,9,5,5,8,5,5,5,5,5,5,5,3,3,3,3,3,5,11,9,9,13,7,14,7,6,6,6,7,6,6,6,6,6,10,7,11,9,4,4,4,4,4,6,6,6,6,13,6,8,7,10,9,9,7,9,8,9,8,7,10,6,9,8,10,10,7,8,1,9,10,12,12,12,10,9,9,10,10,9,9,1,1,5,3,3,3,3,3,3,3,3,3,3,3,3,6,6,6,4,3,3,3,7,4,4,4,3,3,6,7,3,4,1,2,2,2,6,1,2,2,2,2,2,12,5,3,8,9,13,4,4,13,9,9,11,7,3,12,9,2,2,2,3,3,3,3,3,8,2,2,3,3,3,2,2,2,2,2,3,3,3,3,3,3,3,3,3,3,3,4,3,7,10,15,7,15,15,20,15,9,10,10,12,14,14,14,12,12,12,12,12,14,14,10,10,10,10,14,9,9,9,10,14,14,14,13,13,9,9,9,9,9,9,7,8,6,8,8,6,8,13,8,8,6,13,8,11,13,8,6,13,8,6,9,10,10,12,14,14,14,12,12,12,12,14,14,10,10,10,10,9,9,9,10,14,14,11,13,13,9,9,9,9,9,9,2,6,9,2,2,3,3,3,3,3,3,3,3,3,4,4,4,2,3,3,3,3,3,3,7,7,2,3,2,2,5,3,3,3,3,3,3,4,2,2,2,2,2,2,3,3,3,3,3,3,3,4,5,7,4,2,2,12,8,10,8,10,7,18,4,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,5,2,2,3,3,3,5,5,3,8,8,6,8,6,6,4,6,7,7,7,10,11,2,5,5,3,3,3,3,3,3,5,5,6,11,10,7,7,7,4,4,4,2,3,3,3,3,3,2,2,7,5,5,3,3,3,3,3,3,3,3,7,7,7,11,7,6,9,6,6,8,10,8,6,8,13,4,4,4,4,4,10,8,11,8,8,8,10,10,7,10,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,1,1,2,2,2,2,2,2,5,5,5,5,5,5,5,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,7,10,13,7,8,7,11,8,8,6,9,8,8,6,6,6,8,8,6,6,6,6,6,9,7,6,4,4,4,4,4,4,4,6,6,6,9,7,8,10,8,8,2,3,3,3,3,3,2,8,9,9,2,2,2,3,3,3,2,3,3,3,9,2,2,3,3,3,3,3,3,5,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,12,5,5,3,5,4,2,3,2,4,3,9,2,2,2,2,2,5,5,3,8,8,13,6,10,9,4,7,9,11,2,3,7,3,3,4,1,3,4,2,9,3,3,12,5,3,7,10,10,7,4,4,6,14,7,9,7,13,2,2,2,2,2,2,3,3,3,3,3,8,15,4,4,2,3,3,3,7,4,9,9,2,3,3,3,5,3,2,2,7,2,7,6,6,7,2,4,2,2,2,2,2,2,8,8,8,9,5,2,3,3,3,3,3,3,10,7,4,4,4,4,3,4,2,3,3,3,3,3,10,7,4,4,4,4,2,3,3,3,3,10,7,4,4,4,4,3,9,6,6,6,9,13,9,2,2,2,8,7,9,5,3,3,3,5,5,13,12,9,10,7,8,7,6,8,6,11,12,7,9,10,4,4,7,8,11,6,7,9,8,7,10,8,9,15,7,8,5,4,7,2,3,3,3,2,14,10,2,14,10,2,14,3,9,13,13,10,14,16,17,11,2,14,2,14,3,9,13,10,14,16,17,11,14,10,14,2,7,3,10,7,14,10,2,14,10,9,9,17,6,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,3,3,3,3,3,3,10,10,10,12,9,4,10,10,11,8,8,8,7,9,5,3,3,3,3,3,3,3,3,5,8,4,4,4,4,4,4,6,16,3,3,14,3,14,2,14,9,13,10,10,14,16,17,11,6,9,10,10,12,14,14,14,12,12,12,12,14,14,10,10,10,10,14,9,9,9,10,14,14,14,9,9,9,9,9,9,2,14,9,13,10,10,14,16,17,11,6,2,14,9,17,13,10,10,14,16,17,11,6,2,14,9,13,10,14,16,17,11,2,14,9,13,10,16,11,2,14,10,19,7,2,14,9,13,10,19,10,7,14,16,17,11,6,2,14,9,13,10,19,7,14,16,17,11,2,14,9,13,17,13,10,10,14,16,17,11,6,3,2,14,9,13,10,10,14,16,17,11,6,9,10,12,14,14,14,12,12,12,12,12,14,14,14,10,10,10,14,9,9,9,9,14,14,14,13,13,14,9,9,9,9,9,9,4,11,2,14,9,13,17,13,10,19,10,7,14,16,17,11,6,2,14,9,13,17,13,10,19,10,7,14,16,17,11,6,2,9,10,10,7,17,3,3,12,12,16,15,15,12,14,14,14,20,20,13,12,12,12,12,12,12,20,25,14,14,12,12,10,10,10,10,9,9,9,25,4,9,17,10,7,14,16,21,13,13,14,20,14,13,17,24,9,12,13,25,13,21,20,17,9,9,9,9,9,9,12,17,4,4,9,9,9,10,10,12,14,14,14,12,12,12,12,12,14,14,10,10,10,10,14,9,9,9,10,14,14,14,13,13,9,9,9,9,9,9,1,5,8,7,11,11,1,3,3,3,5,3,3,4,8,9,10,14,14,12,12,12,12,14,14,10,10,10,10,14,9,9,9,10,14,14,14,13,13,9,9,9,9,9,7,4,4,4,4,4,4,4,4,4,7,4,9,12,6,14,4,12,7,2,2,1,2,7,6,4,4,4,6,8,8,7,4,5,6,3,3,3,3,4,16,8,5,4,3,3,3,5,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,11,12,7,7,13,9,10,17,12,8,9,7,8,5,12,10,13,14,5,5,5,13,5,5,5,3,3,3,5,16,5,5,5,5,7,12,14,8,12,8,10,12,9,11,7,9,7,10,7,13,9,7,12,8,17,7,7,16,10,13,13,8,10,10,14,17,7,16,16,15,8,10,10,12,17,17,7,17,14,7,10,17,8,7,7,7,8,15,15,7,14,10,10,10,11,11,7,7,13,8,10,7,16,7,8,7,14,17,12,10,11,21,8,9,7,13,9,8,13,6,12,7,6,13,10,10,10,8,18,9,17,13,10,12,6,13,6,11,8,13,10,13,18,13,11,13,8,16,7,10,8,16,12,10,8,8,14,11,8,15,8,8,7,7,12,7,8,9,14,15,8,9,10,9,15,7,8,8,12,13,9,10,15,13,7,10,10,20,7,6,9,6,6,14,11,14,11,12,9,10,16,16,12,7,11,28,8,11,10,7,21,8,7,9,4,4,4,17,7,8,6,9,6,6,13,6,6,6,6,18,20,14,8,11,12,9,10,13,15,15,19,8,9,12,7,10,16,12,9,9,9,14,12,11,9,12,11,18,9,9,9,10,7,7,16,8,9,7,13,12,10,14,18,7,8,11,7,7,8,8,13,7,7,7,11,15,13,11,7,8,15,11,7,8,18,14,13,18,15,10,12,12,9,7,11,11,8,7,10,8,14,12,10,18,7,10,9,7,8,13,10,14,10,8,8,23,7,7,11,12,12,17,7,7,11,11,17,16,16,7,8,11,14,14,8,10,7,7,16,16,13,9,11,9,15,15,11,11,7,7,14,7,9,7,7,16,10,13,10,11,14,7,11,10,11,7,11,10,11,15,11,15,10,12,10,14,13,11,11,12,13,10,7,13,10,16,12,21,9,10,10,7,11,14,17,7,7,8,11,12,8,15,14,14,8,17,12,10,10,7,9,11,7,10,7,11,18,7,11,7,12,11,8,8,14,12,7,8,15,3,7,7,5,2,9,2,2,2,2,2,2,2,3,3,3,3,3,3,3,2,5,3,3,3,3,3,3,4,4,3,3,3,3,3,3,5,11,6,4,7,10,7,7,11,1,10,2,2,3,3,3,3,3,3,3,3,5,7,3,5,6,3,3,5,2,2,5,3,4,13,11,3,3,6,3,5,14,2,2,3,8,2,2,12,5,18,5,3,3,3,16,5,5,5,10,7,13,12,13,9,12,14,19,9,9,21,9,9,10,6,9,6,15,10,6,12,8,6,10,15,4,4,6,6,9,9,12,16,14,23,7,7,7,14,9,7,7,11,14,10,7,10,10,10,12,6,11,10,13,11,15,11,7,12,10,3,7,1,1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,3,4,3,7,2,5,5,3,3,5,5,5,5,7,6,6,6,4,4,4,4,4,4,6,6,6,6,6,7,10,2,2,2,5,5,5,5,3,3,3,3,3,5,5,10,9,11,8,7,12,8,9,7,6,13,11,6,13,7,9,9,4,4,4,4,4,6,10,7,8,13,8,8,9,14,7,8,10,7,7,7,9,6,9,7,2,12,5,3,3,13,4,2,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,2,3,3,3,3,3,3,3,3,4,5,5,5,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,8,4,4,4,4,4,4,4,4,4,4,4,4,9,3,3,3,3,3,3,3,3,3,3,4,2,2,2,5,3,3,3,3,3,3,3,3,4,4,1,7,6,4,12,3,3,3,3,3,8,7,3,3,3,3,3,3,4,4,11,14,2,8,3,5,5,8,10,8,6,4,7,17,7,4,5,2,6,3,2,2,12,5,5,3,15,13,8,11,2,2,3,3,3,3,3,3,3,3,4,4,5,3,3,3,3,4,18,2,12,5,3,3,3,3,3,5,16,8,8,9,6,6,4,4,4,4,31,6,6,10,11,21,10,9,7,10,7,7,2,4,4,4,4,6,5,3,3,4,3,3,3,3,3,3,3,3,3,6,6,6,2,2,2,5,3,3,3,7,7,4,3,3,3,3,3,3,3,3,3,3,3,3,3,2,3,3,3,3,8,2,3,3,3,3,3,5,9,11,3,3,3,3,4,4,3,3,3,3,3,5,10,9,3,3,3,3,3,3,3,3,3,3,3,3,3,4,4,2,3,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,3,3,3,3,3,3,3,3,11,10,10,10,10,10,11,10,11,10,11,10,9,9,11,3,3,3,3,3,3,5,3,7,8,8,7,6,6,11,4,4,4,7,8,9,9,2,3,7,4,4,2,5,5,3,3,3,3,3,3,3,3,3,4,4,4,4,4,4,2,2,5,5,5,5,5,3,3,5,5,5,7,7,6,6,6,4,4,4,4,4,4,4,4,4,4,6,6,8,8,1,2,2,2,2,2,2,3,3,3,3,3,3,3,4,4,6,9,12,3,7,10,7,2,2,3,3,3,3,3,4,3,3,2,2,2,2,3,3,3,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,5,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,5,5,8,8,6,6,8,6,7,4,4,4,4,4,4,6,7,5,5,20,19,8,10,9,7,10,6,8,11,6,6,6,6,13,12,8,6,7,14,11,9,2,5,3,6,2,3,2,2,2,2,2,2,2,5,4,3,7,6,4,7,4,3,6,4,7,2,7,7,7,5,5,5,5,3,3,3,3,3,3,3,3,3,5,9,10,10,11,7,8,20,7,8,9,8,12,6,6,6,8,9,8,12,6,6,8,13,10,12,6,6,7,7,9,6,4,4,4,4,4,4,10,6,6,6,7,14,11,10,7,8,10,8,11,14,11,11,9,7,9,8,11,9,17,10,9,2,2,2,9,3,3,3,3,15,14,9,5,5,2,8,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,15,12,22,19,17,18,18,19,21,7,16,16,5,5,5,5,5,5,5,5,5,5,5,7,5,5,5,5,5,5,5,5,5,5,5,9,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,5,7,16,11,11,7,7,7,7,17,7,8,12,15,9,19,7,19,8,21,11,12,19,14,22,7,7,7,7,7,7,7,7,7,7,7,16,16,19,24,12,7,14,7,12,7,8,10,10,13,7,12,12,7,7,10,18,15,12,16,7,14,12,17,10,16,17,12,17,25,7,7,7,13,6,9,6,9,18,6,6,11,20,10,6,6,6,6,6,6,17,6,6,6,15,6,6,6,6,6,8,14,11,12,11,15,13,19,17,21,7,18,8,13,13,8,12,8,6,6,13,6,15,15,16,6,6,16,6,6,6,14,6,18,6,6,6,17,18,9,13,15,8,19,8,15,15,18,14,16,4,4,4,4,4,4,4,4,4,4,4,4,6,11,10,11,6,21,23,12,17,12,11,14,13,22,15,15,11,12,14,12,7,12,8,12,14,12,18,10,8,16,19,17,12,14,15,8,19,17,12,13,13,15,18,13,23,24,23,21,17,24,8,21,8,14,14,16,20,14,8,8,15,20,8,19,21,9,8,13,12,13,15,11,8,11,9,9,8,11,8,21,14,21,15,15,13,7,19,7,7,7,7,7,7,16,12,17,18,7,7,11,11,7,9,9,2,2,3,3,2,2,2,3,3,3,3,3,3,3,3,3,3,4,5,5,5,5,5,5,5,5,3,3,10,10,7,9,7,7,7,6,8,6,6,6,6,6,6,6,7,6,8,6,6,9,7,7,7,4,4,4,4,4,4,4,4,8,9,8,7,8,7,8,10,7,5,5,5,5,5,5,3,9,7,7,8,6,6,6,6,6,6,6,6,9,6,6,9,11,13,7,8,9,9,5,5,5,7,8,6,6,6,6,6,6,6,7,8,9,7,10,9,10,7,8,5,5,5,5,5,5,7,7,9,8,7,7,6,6,6,6,6,6,10,6,6,6,6,6,6,6,6,6,6,6,9,10,4,4,4,4,8,7,7,10,10,9,8,8,15,9,8,8,8,8,8,9,10,9,10,7,8,13,5,5,5,5,5,3,3,7,7,8,6,6,6,4,4,11,9,7,8,9,10,7,5,5,5,5,5,3,3,7,6,6,13,7,9,8,7,5,5,5,5,5,5,5,5,3,3,3,3,7,8,7,8,13,6,6,6,6,6,6,6,6,6,6,6,6,6,6,8,8,6,6,6,6,7,6,7,6,6,9,7,4,4,4,4,4,4,4,7,8,7,8,9,8,8,8,7,10,7,8,5,5,5,5,5,5,5,5,3,7,7,7,7,9,7,10,9,6,6,6,6,6,8,8,6,6,6,7,6,6,6,9,9,4,4,13,7,10,9,9,12,7,8,8,10,8,8,8,8,8,8,5,5,5,5,3,7,7,11,7,9,8,8,6,6,10,6,8,8,8,6,7,6,6,12,4,4,4,4,4,4,4,4,4,9,8,8,16,8,9,8,7,5,5,5,5,5,3,3,7,7,7,10,15,8,9,8,9,9,6,6,6,6,6,6,7,4,8,7,8,8,7,8,11,8,5,5,5,5,5,3,7,7,6,11,16,7,6,4,4,4,4,9,9,8,8,8,13,12,8,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,11,7,8,8,9,13,7,7,7,9,8,8,9,12,7,12,7,12,8,7,10,12,9,9,6,6,8,8,6,6,6,6,6,6,6,9,8,9,11,8,6,6,6,6,6,12,7,6,6,6,9,7,7,6,6,6,6,6,11,9,6,6,6,6,6,7,9,4,4,4,4,4,4,4,4,9,9,9,9,7,7,7,7,7,11,7,7,8,8,8,8,8,8,9,8,9,9,7,7,11,11,7,12,8,8,8,8,8,7,8,8,8,8,8,13,12,8,8,8,8,7,7,7,9,5,5,5,5,5,5,5,3,3,7,7,11,7,8,8,8,6,6,6,6,6,6,6,6,6,6,6,10,11,6,7,9,4,4,4,4,4,4,9,9,8,9,8,8,8,7,7,5,5,5,5,5,5,5,5,5,5,3,3,11,7,7,7,9,6,6,11,8,10,6,6,6,12,8,8,7,6,6,8,7,4,4,4,4,4,4,4,4,9,10,9,9,8,10,9,11,8,5,5,5,7,6,6,8,7,4,4,4,4,8,7,7,8,7,8,8,5,5,5,5,7,7,8,8,8,6,6,6,6,6,10,8,9,13,6,7,6,6,8,7,8,4,4,4,4,11,8,8,8,10,5,5,8,7,8,13,8,7,6,8,6,9,7,8,7,5,5,5,5,5,5,3,3,7,8,9,6,4,8,10,10,8,12,9,13,2,7,5,5,5,5,5,7,7,10,6,6,6,6,6,6,6,8,4,4,9,8,8,8,14,8,8,8,9,8,5,5,5,5,5,3,3,9,6,6,6,6,10,12,6,6,6,6,6,6,6,4,4,4,4,11,8,7,8,8,8,5,5,3,3,3,3,7,7,6,8,6,8,11,7,6,6,6,7,4,8,11,9,10,5,5,5,3,3,3,7,7,8,9,8,15,9,6,6,6,6,6,6,11,11,4,4,4,4,4,7,9,9,10,8,7,5,5,5,5,5,5,3,3,8,6,6,6,6,6,6,6,6,6,9,7,4,4,4,4,4,9,9,8,8,10,13,5,5,5,3,17,7,7,7,7,7,8,6,8,13,6,6,6,6,6,6,6,6,4,4,4,9,10,8,8,8,5,5,5,5,3,7,7,7,8,8,6,6,6,8,8,8,9,10,8,4,8,10,9,8,8,8,9,13,10,5,5,5,5,5,5,5,5,5,5,3,3,7,8,9,9,7,7,7,10,9,9,8,9,8,8,8,6,6,6,6,6,6,6,6,6,6,6,6,6,8,12,6,6,6,6,6,6,6,6,6,12,4,4,4,4,4,4,4,4,4,4,4,11,8,8,9,9,10,8,9,7,7,5,5,5,5,5,5,3,7,8,7,6,6,8,6,6,10,4,7,8,9,12,8,7,7,5,5,5,5,5,5,3,3,7,14,7,9,8,8,6,6,8,12,12,6,6,7,7,10,4,4,4,4,4,9,9,14,9,13,8,7,5,5,5,6,6,6,7,4,8,7,5,5,5,5,5,5,5,5,3,3,7,7,7,8,6,6,6,6,6,6,12,6,6,6,6,4,4,9,9,8,8,11,7,7,7,5,5,5,3,9,8,6,6,7,4,4,4,4,4,4,8,8,11,5,5,5,7,7,7,9,6,6,6,6,6,6,9,8,4,4,4,4,7,12,9,8,8,8,7,10,10,5,5,5,5,5,5,5,3,11,14,8,7,8,8,6,6,6,6,6,8,7,6,6,6,7,6,8,9,4,4,4,7,8,9,7,9,7,7,9,8,5,5,5,5,5,5,5,5,5,11,3,9,7,7,12,14,8,6,6,12,11,8,6,6,6,6,6,6,6,6,6,15,7,4,4,4,16,9,9,9,8,9,9,9,9,9,8,8,8,13,11,8,5,5,5,5,3,7,6,6,8,8,8,6,6,7,10,7,4,4,4,4,9,7,8,7,7,7,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,3,7,7,7,9,6,6,6,6,6,8,8,7,7,9,6,6,6,7,6,6,6,6,6,15,4,4,4,4,4,8,8,7,8,12,9,8,8,8,8,8,9,8,8,10,8,8,8,8,16,9,10,2,5,5,5,5,5,5,5,9,7,6,8,9,4,4,4,4,4,7,8,8,8,9,8,11,10,5,5,5,5,3,7,8,6,6,6,6,6,8,6,6,6,6,4,12,10,12,7,7,7,7,7,7,7,5,5,5,5,3,3,7,7,10,8,9,7,6,10,7,6,6,4,4,8,9,7,9,9,9,9,8,8,8,8,10,5,5,5,5,5,5,8,7,6,6,6,10,6,7,10,7,4,4,4,4,4,4,4,12,9,10,7,7,10,8,10,5,12,9,6,6,6,6,6,7,6,4,4,4,10,9,9,8,7,7,5,5,5,5,5,5,3,3,13,7,7,9,7,7,7,8,9,9,7,8,6,6,6,6,6,6,6,6,6,6,6,6,6,7,13,9,15,15,4,4,4,4,4,10,10,9,8,9,8,8,9,7,8,7,8,5,5,7,6,6,6,4,4,4,7,8,11,8,5,5,5,5,5,5,5,7,6,6,6,6,6,6,9,11,10,7,4,4,4,9,8,8,5,5,5,5,5,9,9,6,6,6,6,6,6,6,9,9,4,4,4,4,8,8,8,9,9,8,8,8,13,2,4,2,7,5,5,5,5,5,5,9,9,6,6,6,6,10,8,8,8,6,6,6,4,4,9,8,10,8,9,8,8,8,9,8,8,5,3,3,3,11,6,6,6,7,6,6,6,4,4,9,8,5,5,5,5,5,3,11,8,6,6,6,6,6,9,7,4,4,14,10,9,8,12,8,8,8,11,15,8,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,11,11,11,10,10,7,7,3,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,5,5,5,5,5,5,5,5,5,5,3,3,3,7,11,7,7,11,11,7,8,9,10,7,7,9,9,9,9,7,7,10,8,13,8,8,8,8,11,10,6,6,8,10,11,14,14,6,6,6,6,6,6,9,11,7,7,6,8,12,11,11,6,6,10,6,6,6,6,6,10,7,7,6,6,11,6,6,6,11,8,9,7,6,10,11,9,10,11,7,11,8,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,8,6,6,8,9,10,9,6,6,6,10,6,6,6,6,11,10,11,10,9,8,7,7,7,7,11,14,8,10,9,9,8,8,7,11,8,8,8,11,11,10,10,9,10,8,11,10,8,11,9,12,8,10,8,11,8,9,9,11,11,10,11,13,8,7,8,8,9,7,8,8,8,8,7,8,2,2,2,2,2,2,2,4,4,2,2,2,3,3,3,3,3,3,3,3,3,3,3,3,4,2,3,3,3,3,3,3,3,3,8,6,4,4,4,11,7,11,3,3,3,3,3,3,3,3,3,3,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,5,5,5,5,3,3,3,3,8,7,7,8,8,4,8,7,7,7,9,7,8,9,8,2,3,3,3,3,3,3,3,3,3,3,3,3,3,3,6,3,3,3,3,3,3,3,3,4,2,2,3,3,3,3,3,3,4,5,5,3,3,8,8,6,9,4,4,10,7,3,3,3,2,5,3,3,3,3,3,3,3,3,3,3,3,3,4,3,2,2,2,3,3,3,3,3,4,10,2,3,3,3,3,3,3,3,4,2,3,3,3,3,3,3,3,3,2,2,3,3,3,5,2,4,2,6,2,2,9,5,5,3,3,3,3,3,3,3,5,5,5,9,8,7,9,6,6,11,4,4,4,4,4,4,4,4,6,6,7,7,11,8,8,6,5,11,2,3,3,3,3,3,3,3,3,3,3,3,3,3,4,2,2,3,3,3,3,3,3,6,4,4,4,4,3,3,3,3,5,7,2,3,3,3,3,3,8,2,2,2,3,3,3,3,3,3,3,3,3,3,3,3,3,6,4,4,4,4,2,2,3,3,3,3,3,3,3,4,3,3,3,3,3,3,3,3,3,3,3,3,4,2,2,3,3,3,3,3,3,2,3,3,3,3,3,6,3,3,8,10,3,4,4,1,1,1,1,1,1,1,8,9,10,7,7,1,14,18,13,18,13,10,10,16,13,18,16,13,16,18,13,22,16,16,16,14,21,16,9,14,16,9,9,14,10,10,14,12,14,19,12,11,18,13,17,15,15,15,15,16,14,13,19,18,15,19,18,12,18,12,11,20,14,15,10,17,17,16,19,20,21,15,13,16,15,15,15,1,1,3,8,7,7,8,8,8,1,6,1,1,6,3,3,4,7,3,3,5,5,4,4,4,4,4,2,7,7,8,12,3,4,5,1,3,4,4,10,4,3,3,3,8,7,7,2,2,2,2,2,2,2,2,2,12,9,20,7,5,5,5,9,13,5,5,5,5,5,3,3,3,16,5,5,5,13,7,8,8,11,8,7,9,7,11,12,9,9,8,8,11,10,14,7,12,10,11,13,7,9,11,17,17,14,13,7,8,7,10,10,7,16,13,7,8,17,12,9,8,6,7,10,6,6,12,6,8,10,8,8,8,6,8,6,14,6,6,6,13,6,10,6,6,7,14,8,6,6,10,11,10,9,9,7,7,6,6,6,9,9,7,9,10,9,13,12,4,4,4,4,4,4,4,4,4,4,6,6,6,8,8,6,8,9,10,9,7,10,10,8,7,8,7,10,12,9,8,15,8,7,8,8,7,7,15,13,7,10,9,14,18,16,7,24,7,8,10,11,16,8,14,7,9,9,9,13,19,14,15,14,11,7,13,9,10,7,13,9,10,11,12,8,9,2,3,5,8,7,4,4,15,10,5,3,3,3,3,3,5,4,4,4,2,2,2,2,2,1,3,3,3,3,3,3,3,3,3,3,3,3,3,4,4,4,2,2,2,3,3,3,3,3,3,3,3,3,3,4,2,12,5,3,8,10,15,6,7,2,3,2,5,5,12,2,5,5,5,5,2,2,5,5,12,9,5,2,2,9,5,5,12,12,5,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,9,12,5,8,8,9,5,5,5,8,19,7,16,15,14,9,9,9,9,7,11,11,11,7,14,10,10,5,5,5,5,5,5,5,5,5,15,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,9,9,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,14,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,15,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,5,5,5,5,5,5,5,12,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,9,9,12,9,9,12,12,12,15,7,11,7,14,11,18,13,8,18,15,18,12,14,12,8,8,8,8,9,9,9,12,7,10,10,8,8,12,12,12,7,12,12,9,7,7,7,7,7,8,15,12,9,10,10,7,10,10,13,11,10,9,22,11,9,8,8,8,8,8,13,18,13,9,15,19,9,7,7,10,7,7,7,11,8,13,17,7,7,10,10,10,7,20,16,7,7,7,7,7,7,11,21,12,12,13,11,14,16,8,8,13,11,7,7,13,7,7,14,15,15,6,6,6,6,6,6,6,6,6,6,13,10,18,6,6,6,6,6,6,6,6,6,11,8,8,12,12,11,11,8,12,9,9,9,13,13,9,9,9,9,9,9,6,10,12,6,6,6,6,17,11,7,7,7,7,14,14,12,6,7,7,6,6,15,10,13,10,6,8,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,7,13,9,9,15,13,6,12,12,6,19,11,10,7,7,16,8,19,17,9,9,9,9,9,6,6,6,10,8,16,8,6,6,9,6,6,6,6,6,6,6,6,8,8,8,6,7,6,6,6,6,6,6,6,6,6,6,6,14,6,6,6,6,20,6,9,6,14,9,9,9,6,9,8,8,12,9,8,8,8,8,7,8,12,7,8,8,8,6,8,6,6,6,6,6,6,6,9,8,8,6,6,13,9,12,13,12,14,13,12,11,11,6,8,8,8,6,13,12,11,11,12,6,11,12,11,13,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,15,6,6,6,6,6,6,6,13,6,6,6,6,6,6,6,6,6,6,6,6,6,8,8,8,8,6,18,6,12,13,13,13,9,10,15,9,12,6,6,6,6,6,6,6,6,9,15,10,9,10,13,9,19,8,18,17,10,10,8,8,6,6,6,6,6,6,10,14,8,16,16,9,8,15,8,8,10,12,14,7,7,8,8,7,7,7,7,8,13,13,11,9,9,9,12,10,17,8,11,9,7,7,14,8,14,14,7,7,7,7,7,7,14,7,7,7,7,7,10,10,8,14,7,7,7,7,8,8,8,8,8,17,9,7,15,7,8,12,7,9,14,7,7,7,9,13,8,14,7,16,18,13,15,14,12,13,10,15,9,7,7,7,10,13,15,15,9,9,9,9,19,11,7,11,11,13,8,8,8,8,7,12,19,17,9,9,13,7,7,7,9,7,7,7,12,13,15,10,8,8,14,15,12,13,13,8,12,14,7,11,7,14,15,13,12,8,8,8,8,11,13,15,15,8,13,12,8,8,8,13,10,16,14,11,8,8,12,12,9,15,15,12,12,13,8,8,9,12,13,9,8,8,8,8,8,8,8,8,8,8,8,11,12,11,7,14,7,13,13,13,12,18,16,7,12,11,10,10,15,9,9,9,21,7,7,7,11,16,8,8,11,11,7,7,7,7,7,19,7,7,7,7,7,7,7,7,7,12,8,9,12,14,11,9,9,9,22,12,3,3,4,8,8,15,4,2,2,5,5,3,3,3,3,3,3,6,6,4,4,4,12,7,10,2,3,3,3,3,3,3,3,6,7,3,7,5,14,4,4,7,8,10,4,1,3,3,6,2,4,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,3,3,3,4,2,2,5,3,4,2,2,2,2,2,2,11,5,5,5,11,5,5,3,5,5,5,5,11,14,13,9,11,9,12,8,11,11,8,11,16,9,9,7,10,9,12,8,15,6,7,6,6,13,10,8,11,8,6,6,6,12,16,6,11,7,8,9,18,6,6,9,4,4,6,13,6,6,6,6,8,8,9,16,7,7,14,7,8,8,8,7,7,7,7,7,7,15,13,7,10,7,7,10,12,16,15,7,9,9,14,11,11,10,9,10,8,12,7,8,7,7,10,12,7,12,8,7,2,3,3,3,3,3,3,3,3,3,3,5,3,3,5,5,5,10,4,8,7,10,3,3,3,3,3,3,3,3,3,3,1,3,3,3,3,3,3,3,7,4,5,2,3,3,3,3,3,3,3,3,3,3,3,3,3,3,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,5,5,5,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,5,6,6,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,9,8,2,2,2,8,12,7,7,5,5,5,5,5,5,5,5,5,5,5,5,8,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,5,5,5,7,11,9,8,8,8,7,8,9,7,7,9,7,7,7,10,7,7,10,9,10,6,6,6,6,6,6,15,7,8,9,9,8,6,6,10,9,6,8,13,9,7,6,6,6,6,6,6,12,6,6,7,6,7,6,6,6,10,10,7,6,6,6,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,6,14,6,6,7,7,9,6,6,6,6,9,9,8,9,10,9,8,9,12,7,7,7,8,7,10,12,11,9,10,7,7,7,9,10,10,8,12,9,7,7,9,8,8,8,10,7,7,8,9,9,7,7,7,8,2,4,6,3,4,2,3,3,3,3,2,3,3,3,3,3,3,3,3,4,4,4,4,5,5,3,3,3,3,3,3,3,3,5,8,6,4,7,3,3,3,3,3,3,3,12,3,3,3,3,3,3,4,4,2,3,5,3,4,7,3,3,3,3,3,3,4,3,3,3,3,3,3,3,4,3,3,6,4,3,4,2,2,2,5,3,3,3,3,3,5,4,4,4,4,7,6,8,9,2,2,2,2,3,3,3,5,7,2,3,3,8,7,7,2,2,8,5,3,3,3,3,3,3,3,3,3,3,3,3,3,5,5,8,8,7,7,6,10,6,9,7,11,4,6,8,8,7,8,4,5,5,5,5,3,3,11,8,9,6,6,8,7,4,4,7,8,7,2,2,3,3,3,3,4,3,3,3,3,3,3,3,3,7,2,2,5,3,3,2,3,3,3,3,3,3,4,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,2,2,2,2,12,5,5,3,3,3,5,10,12,6,15,4,6,6,7,14,9,3,3,3,3,3,8,2,2,3,5,5,3,3,3,3,3,3,8,8,8,7,5,8,4,6,11,2,2,6,7,3,3,2,9,8,5,5,3,3,3,5,5,7,7,6,6,10,6,8,6,8,9,7,4,4,4,4,7,6,6,7,7,10,9,8,11,8,3,3,3,3,3,4,4,2,3,3,3,3,3,7,6,2,5,6,7,6,4,8,9,11,2,2,3,3,3,3,3,3,3,2,2,5,3,3,3,3,3,9,9,6,4,8,7,7,5,9,8,6,2,8,7,8,5,5,5,5,5,3,3,3,16,8,7,7,7,8,7,7,7,7,9,6,9,6,10,7,7,7,6,10,8,9,11,11,8,4,4,10,8,8,6,9,6,11,8,8,8,15,7,8,9,5,3,3,3,3,3,5,11,2,2,3,8,9,10,3,2,2,2,2,2,2,3,6,4,2,2,3,3,3,3,3,3,3,3,3,3,4,4,2,3,3,3,3,3,3,3,11,5,3,3,3,3,3,3,3,3,6,7,4,4,2,3,3,3,3,3,3,3,3,12,7,4,12,4,6,5,4,2,2,2,2,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,4,4,2,3,3,3,3,3,3,3,3,4,4,11,10,6,4,6,10,8,3,3,3,3,3,3,3,3,5,4,4,4,2,2,2,2,2,2,2,2,5,3,4,4,1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,10,5,5,5,5,5,5,3,3,3,3,3,3,3,3,7,8,8,7,13,12,10,10,8,8,7,7,9,12,11,6,6,8,8,9,7,7,7,10,15,10,4,4,4,4,4,11,8,8,9,7,9,14,14,12,2,2,2,2,2,2,2,3,3,3,3,3,12,5,5,5,11,10,7,9,3,8,7,3,15,13,11,4,4,2,2,2,19,7,5,5,3,3,3,3,3,3,3,5,22,18,6,14,17,4,4,19,16,18,2,3,3,7,2,3,2,3,3,6,4,2,3,3,2,5,3,3,3,3,3,3,3,9,9,2,3,2,2,2,3,3,3,5,7,14,7,7,12,9,13,6,11,6,10,9,7,7,8,12,12,8,8,8,10,7,7,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,3,3,3,3,3,5,8,10,7,8,11,8,12,9,4,14,7,7,9,13,2,3,3,3,3,3,3,2,3,3,3,1,2,2,3,3,3,3,3,3,5,2,2,5,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,8,4,4,4,3,2,3,3,3,3,5,2,2,2,2,5,5,5,5,3,3,3,3,3,3,3,3,3,7,7,7,7,7,8,8,8,8,8,12,9,8,8,9,8,6,17,6,6,6,8,8,6,6,6,6,6,6,6,6,6,6,6,7,4,4,8,8,9,9,9,7,7,7,7,7,7,7,9,9,9,7,8,8,8,10,7,13,10,8,9,3,3,5,13,3,3,3,3,3,7,7,6,6,10,13,11,11,8,8,9,8,9,9,10,10,10,11,10,10,13,13,16,15,11,12,9,9,10,9,11,10,9,9,14,7,8,3,10,7,7,3,2,2,2,5,3,3,3,3,3,3,3,3,3,3,3,3,6,7,2,2,3,3,3,3,3,3,3,3,4,11,6,7,4,6,2,2,3,3,3,1,3,3,3,3,3,3,6,4,4,2,2,2,3,3,3,3,4,4,6,6,6,6,5,4,4,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,9,11,6,10,9,12,7,7,11,14,9,7,12,3,3,7,12,11,12,7,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,9,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,3,3,3,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,11,5,5,5,5,5,5,5,5,11,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,5,5,5,5,5,5,5,3,3,3,5,5,5,5,5,5,5,5,5,5,5,3,3,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,6,5,5,5,5,5,5,5,5,5,5,5,5,5,3,10,3,3,3,11,3,5,9,11,8,12,14,9,7,8,7,7,11,11,7,7,10,9,8,10,9,7,7,7,7,7,7,8,8,7,11,8,8,8,7,7,10,8,7,13,12,7,17,10,8,8,11,7,11,11,14,7,11,7,8,6,9,20,8,7,9,16,7,10,6,11,10,8,9,7,16,11,11,9,8,9,8,8,8,11,8,15,8,8,9,7,8,8,11,10,7,5,7,10,10,15,7,7,7,8,7,8,8,10,11,10,10,10,11,11,7,8,6,8,8,8,10,6,8,6,6,7,8,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,16,6,15,6,7,11,11,7,9,10,11,13,10,6,16,8,10,12,11,6,6,6,6,6,6,6,10,6,10,7,7,7,7,11,7,11,6,6,6,6,6,6,17,7,7,6,6,12,22,6,6,6,6,6,8,6,6,6,6,7,6,6,5,6,6,8,11,6,9,14,11,9,11,7,7,8,6,6,6,8,10,9,6,6,6,6,9,7,6,6,6,6,6,15,6,4,4,4,6,4,17,8,11,6,6,9,6,6,6,6,6,6,6,6,6,6,6,6,6,6,7,6,6,6,6,10,6,10,6,6,6,6,12,8,6,6,6,6,6,6,6,6,6,9,6,6,6,6,18,6,6,6,8,9,10,7,8,9,10,11,7,13,6,8,8,6,6,14,7,7,7,7,10,7,14,9,6,6,9,15,9,7,14,6,11,14,13,7,12,8,7,7,7,7,7,12,7,10,9,16,6,8,6,5,17,6,8,10,4,6,4,10,15,17,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,8,4,4,11,7,4,4,7,7,7,6,6,6,6,6,6,6,6,6,6,6,6,19,17,6,10,11,6,6,6,6,18,6,6,11,4,4,4,5,6,6,6,9,5,6,4,6,6,4,6,6,6,6,10,6,6,4,6,6,10,6,10,6,6,6,6,11,6,6,10,6,6,8,6,6,6,8,6,11,4,11,9,10,9,11,4,8,4,11,12,7,9,8,6,7,7,8,12,12,11,13,10,11,7,7,7,9,7,11,10,7,7,7,16,11,10,11,17,9,9,8,8,7,7,7,9,7,7,7,14,7,13,9,11,10,14,10,10,12,11,10,7,10,5,14,8,8,8,9,7,8,7,7,9,8,7,8,7,7,7,7,7,7,7,11,8,10,8,7,8,14,11,8,9,9,9,8,24,10,10,12,7,7,15,11,8,8,12,11,8,9,9,7,8,9,10,11,10,11,7,12,7,7,11,9,8,14,13,12,8,11,10,8,8,7,7,14,9,10,8,9,11,7,14,8,8,13,8,8,12,7,10,14,14,11,9,10,9,9,7,7,11,11,13,9,13,5,5,5,7,9,5,11,12,14,8,7,7,11,10,9,7,8,8,7,10,11,11,5,5,7,5,5,5,7,7,15,7,7,8,7,15,12,12,10,7,8,7,11,7,7,7,23,11,8,8,11,10,7,8,11,7,19,7,7,6,9,9,9,11,3,4,7,8,6,6,4,10,8,2,2]),TL=new Uint16Array([0,0,0,1,0,0,0,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,1,1,1,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,1,12,1,1,1,1,1,17,1,1,1,12,1,12,1,12,13,1,1,1,1,12,1,12,1,1,1,1,1,14,21,1,1,1,1,1,1,1,19,12,1,1,1,1,1,1,1,20,1,1,1,16,18,1,1,15,1,1,1,1,12,1,1,1,1,1,1,1,1,22,1,1,1,1,12,1,1,1,1,1,1,1,1,12,12,12,12,12,12,12,12,12,12,12,12,1,24,25,26,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,0,1,1,12,12,12,12,1,32,0,0,0,1,1,1,1,35,34,1,1,1,1,1,33,1,1,1,1,37,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,38,0,0,0,0,39,40,0,0,0,0,12,1,1,12,1,1,1,1,43,44,44,44,43,44,43,43,45,44,43,44,43,43,43,43,43,43,45,43,43,43,43,43,43,44,46,46,44,43,43,43,43,43,12,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,49,51,49,49,49,51,49,50,49,52,49,50,50,49,49,49,50,52,50,52,49,50,50,12,54,54,53,55,50,52,49,49,47,48,56,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,59,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,0,1,1,66,67,12,1,1,65,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,78,0,0,0,0,0,0,0,0,0,0,0,0,0,76,79,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,77,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,1,1,1,1,1,0,0,0,0,0,0,0,0,0,1,1,0,0,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,1,1,12,1,1,1,1,89,1,91,1,1,1,1,1,1,1,1,94,1,1,1,1,1,1,1,1,1,1,1,1,0,1,97,97,1,1,12,1,100,1,1,1,1,1,1,1,98,1,99,1,101,1,1,1,1,1,102,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,110,111,1,1,1,1,1,1,113,113,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,121,122,1,1,1,1,1,1,1,1,1,1,1,1,1,122,1,1,1,1,1,1,1,1,1,1,122,1,1,1,1,1,1,1,1,1,126,123,125,120,1,124,1,1,114,1,1,1,1,117,1,127,1,1,1,1,1,1,119,1,108,1,109,1,12,128,106,1,112,1,1,1,1,1,107,115,1,12,12,12,118,116,1,1,1,1,1,1,0,0,0,0,1,12,12,1,1,1,1,1,12,134,1,1,1,1,1,1,1,1,1,1,1,12,136,1,1,1,1,1,1,1,1,137,138,12,12,135,133,44,44,140,49,49,139,142,141,1,1,0,0,0,0,0,0,0,0,0,0,0,0,145,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,143,0,0,0,0,1,0,144,132,1,0,1,1,12,12,1,1,1,1,1,0,0,0,0,0,0,0,1,148,147,20,1,1,12,12,1,20,12,12,1,1,1,1,1,134,1,1,152,1,1,1,1,153,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,1,1,136,1,1,152,1,1,1,1,153,1,1,134,1,1,1,152,1,1,1,1,153,1,1,134,1,1,1,1,1,1,1,1,134,1,1,1,1,1,1,1,1,1,1,1,160,1,1,1,152,1,1,1,1,1,153,1,1,160,1,1,1,1,1,1,1,1,1,1,134,1,1,1,1,152,1,1,1,1,153,1,1,1,134,1,1,152,1,1,1,1,164,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,1,167,1,1,160,1,1,1,1,1,152,1,1,1,1,1,153,1,1,160,1,1,1,1,1,152,1,1,1,1,1,153,1,154,158,158,12,1,12,166,1,1,1,1,1,158,158,158,154,1,1,1,157,158,161,165,1,1,1,1,157,157,1,1,156,154,154,157,170,156,170,1,1,168,1,156,155,157,1,1,1,1,157,1,159,1,1,1,12,1,162,1,162,1,1,1,162,161,163,169,156,154,1,1,1,1,1,1,172,172,172,172,172,172,172,172,172,172,172,172,172,172,172,172,172,172,172,173,172,173,172,172,172,172,174,174,172,173,172,173,172,172,12,1,12,12,12,12,1,12,12,12,12,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,12,1,1,1,1,1,1,12,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,196,1,1,1,1,12,202,203,204,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,12,1,1,1,1,1,1,1,1,151,1,1,1,1,1,1,1,1,1,1,1,199,1,1,1,186,1,1,1,1,210,1,1,207,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,12,1,1,1,1,1,12,1,1,1,1,1,1,1,1,177,193,1,1,1,189,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,184,1,1,1,1,1,1,1,194,1,1,1,1,198,1,1,1,1,171,1,1,192,1,1,1,195,1,1,1,12,1,1,1,1,1,1,1,1,1,1,1,1,182,1,12,1,1,12,1,1,1,1,185,1,1,1,191,1,12,1,1,1,1,1,1,1,1,1,1,1,1,1,1,12,1,1,211,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,197,1,1,1,1,1,12,1,1,1,1,1,1,1,1,176,12,1,1,1,179,12,1,1,1,1,1,1,1,201,1,1,1,1,1,1,1,1,1,1,178,1,1,1,1,1,1,1,206,1,1,1,183,1,1,1,190,1,12,1,187,12,1,1,1,1,1,1,1,1,1,1,194,1,1,1,1,181,1,1,1,1,1,1,1,1,1,1,1,1,1,1,175,1,1,1,1,1,1,1,1,1,1,188,1,1,1,1,1,1,1,1,1,1,1,208,1,1,1,1,1,1,1,1,1,1,12,1,209,1,1,12,1,1,1,1,180,1,1,1,188,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,12,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,12,1,1,1,200,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,12,12,1,1,1,1,1,1,1,1,1,205,1,1,12,1,1,1,12,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,0,1,0,1,1,1,1,1,1,1,1,1,1,221,0,0,0,0,0,222,0,0,0,0,0,0,1,12,1,1,1,226,1,1,1,0,227,224,225,1,1,1,1,1,1,232,1,234,1,1,1,1,1,1,1,1,1,1,1,230,1,1,1,1,1,236,1,1,12,1,12,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,235,1,1,1,12,1,1,1,1,231,1,1,1,229,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,233,1,1,1,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,1,12,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,242,13,1,1,1,12,12,239,240,1,1,1,1,241,1,1,12,1,1,1,1,1,1,1,243,1,1,12,16,1,1,1,1,1,1,244,1,1,1,12,12,1,1,1,1,1,1,244,12,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,1,253,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,257,257,1,0,0,0,0,0,1,12,0,0,0,0,0,0,0,0,172,262,263,1,12,1,1,1,1,12,265,1,1,264,1,1,267,1,1,1,1,1,1,0,1,1,1,271,1,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,12,1,0,1,0,0,0,0,1,0,1,0,1,1,1,1,1,0,1,0,1,1,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,1,1,12,0,282,0,0,283,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,1,1,12,0,0,0,0,0,0,0,0,0,0,0,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,59,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,1,0,1,1,1,0,307,0,0,0,0,0,0,0,0,0,309,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,1,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,1,1,1,12,1,1,1,1,1,1,1,1,1,12,1,1,1,1,1,325,325,326,325,0,188,1,1,13,321,1,319,0,0,0,0,0,0,0,322,1,1,327,1,207,1,1,1,1,320,1,317,1,323,1,315,1,324,1,316,1,1,1,1,1,1,1,12,1,1,1,1,12,318,318,1,1,1,186,1,1,12,1,1,1,1,1,1,1,1,1,1,12,1,1,1,1,12,1,1,1,1,314,1,0,0,0,1,0,0,0,0,0,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,0,0,0,330,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,267,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,370,370,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,362,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,1,1,1,0,1,338,349,1,1,337,372,1,343,1,1,335,367,1,1,353,334,339,1,1,1,346,377,355,1,1,1,1,1,1,356,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,1,0,365,369,0,0,79,1,1,0,363,340,376,341,344,351,1,366,0,1,0,79,360,358,1,0,0,1,1,1,0,0,0,0,379,1,1,350,1,79,1,0,1,1,1,382,1,0,0,79,357,0,1,336,1,1,1,0,1,1,359,1,0,1,1,1,0,1,384,347,1,1,0,1,0,0,375,0,1,1,1,79,368,1,1,364,361,1,1,1,1,1,1,1,1,1,1,1,342,1,1,1,1,1,1,1,1,1,1,1,374,0,79,1,1,1,1,0,1,1,1,1,1,1,0,0,1,1,378,1,1,1,0,0,381,0,0,0,1,354,1,0,79,380,1,0,0,0,0,383,1,1,0,0,1,0,1,0,352,0,348,0,1,1,1,0,1,1,0,371,345,373,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,1,0,0,0,1,0,0,1,0,0,0,0,0,0,0,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,1,0,0,1,0,0,0,0,0,12,1,1,1,12,399,399,1,1,12,12,1,399,1,1,12,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,0,1,1,1,1,1,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,411,1,1,0,1,1,1,1,207,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,1,1,1,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,429,429,1,1,0,0,315,1,1,1,1,1,1,1,1,1,1,1,1,12,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,442,1,441,1,1,1,1,1,1,1,1,1,446,1,12,12,1,1,1,1,1,12,1,1,1,1,454,1,1,1,456,1,1,1,1,1,1,1,1,1,1,453,1,448,1,1,1,1,435,1,1,1,1,1,1,1,1,449,12,1,1,1,1,455,1,1,1,450,444,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,315,1,432,1,1,12,452,1,1,315,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,437,1,1,1,1,1,1,1,1,1,1,1,455,1,1,1,1,315,1,451,1,1,1,445,439,1,1,1,1,1,440,1,457,443,1,1,1,1,1,438,1,1,1,1,1,1,1,1,1,433,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,447,1,1,1,1,1,1,1,1,1,1,1,1,436,1,1,1,1,1,434,1,221,458,1,1,1,1,1,12,1,1,1,1,12,1,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,0,1,0,0,1,0,1,0,1,1,0,0,0,464,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,12,1,67,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,468,0,468,468,468,468,468,468,468,0,468,468,468,468,468,1,468,468,468,0,468,468,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,473,472,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,477,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,470,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,471,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,479,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,468,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,476,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,469,0,0,480,475,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,474,0,0,0,0,0,0,0,0,0,0,0,0,0,468,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,469,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,468,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,478,0,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,1,12,1,1,1,1,1,1,1,1,1,1,1,1,490,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,201,201,1,494,1,1,1,493,1,1,1,1,489,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,491,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,495,1,1,492,1,1,1,1,1,1,1,1,370,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,496,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,1,0,0,1,0,0,0,0,1,0,1,0,0,0,0,0,0,0,1,0,0,0,507,0,0,0,0,0,0,0,0,0,1,1,1,1,0,0,0,1,1,0,0,0,0,0,0,0,0,0,0,1,1,0,0,1,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,1,0,1,0,0,0,0,1,0,0,0,0,0,0,1,0,0,0,0,1,0,1,0,0,0,1,0,0,0,1,0,0,1,0,0,1,1,1,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,1,0,0,0,0,0,0,1,0,1,0,0,12,1,509,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,1,1,0,0,1,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,12,12,1,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,1,1,0,1,0,0,0,0,0,0,0,1,0,0,1,0,1,1,1,1,0,0,0,1,0,0,0,1,59,1,1,12,12,12,12,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,528,1,1,1,1,1,1,1,529,1,1,1,1,1,1,1,527,1,1,12,1,1,531,240,1,1,12,12,1,1,12,1,12,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,535,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,1,0,0,1,1,0,0,0,1,0,0,0,1,0,0,0,0,0,1,1,1,1,1,1,0,0,0,0,0,1,1,1,541,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,132,1,12,546,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,107,1,1,12,1,1,1,12,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,551,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,12,0,0,0,0,0,0,0,0,0,1,1,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,1,1,0,0,0,1,1,1,1,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,0,0,0,0,0,0,144,1,1,1,229,1,1,12,30,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,0,0,1,576,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,1,1,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,221,1,326,1,1,1,1,1,1,1,1,1,0,0,581,1,1,1,1,0,583,0,79,0,582,0,1,1,1,0,1,1,1,1,1,1,12,0,0,0,1,0,1,0,0,0,0,0,0,590,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,0,1,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,585,585,0,589,587,585,585,585,585,585,591,585,585,595,585,585,585,585,585,585,585,585,585,585,592,589,585,585,589,585,585,585,585,585,585,585,585,585,585,585,585,585,587,585,585,585,585,585,593,585,585,585,585,585,585,0,0,0,1,594,1,1,1,1,588,1,1,1,1,1,586,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,1,12,599,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,0,0,0,0,0,1,12,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,12,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,12,1,1,12,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,96,64,279,305,410,537,0,4,68,237,255,281,306,332,386,412,0,501,521,538,601,9,0,60,88,396,408,428,579,0,499,520,534,616,0,30,6,0,463,502,606,564,70,0,7,284,256,387,465,415,540,79,602,0,580,308,417,467,9,105,287,508,6,30,0,310,79,389,79,485,10,6,131,249,274,0,617,511,0,567,0,63,6,6,252,95,2,431,397,409,600,0,6,0,6,285,103,6,565,503,542,0,466,388,272,286,8,71,104,603,545,390,311,299,418,146,74,289,549,512,605,568,333,328,481,6,75,149,11,0,250,524,550,569,516,554,574,615,36,6,261,294,331,303,219,30,530,557,219,41,217,266,295,304,405,422,483,273,0,73,566,0,402,416,298,79,248,79,0,584,548,506,291,420,79,391,385,0,0,0,9,559,575,218,0,423,406,533,518,577,619,85,219,42,296,394,424,573,0,513,292,275,79,216,80,28,388,30,6,392,329,302,608,596,526,553,515,0,259,81,30,404,421,0,30,425,0,220,597,519,9,407,426,219,249,86,223,598,578,561,484,427,395,251,228,87,58,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,624,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,413,0,0,0,0,0,0,0,0,82,0,129,0,0,84,552,0,0,0,0,0,0,0,27,0,555,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,413,0,0,0,0,505,0,258,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,293,0,0,0,0,0,0,0,621,0,0,0,0,0,620,0,0,0,0,0,0,0,0,0,0,0,0,0,0,393,0,0,0,486,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,69,0,0,0,0,0,0,497,0,0,0,0,0,0,403,0,0,0,0,0,0,0,0,0,0,0,0,0,212,0,0,0,0,0,0,0,0,0,0,0,517,0,0,0,0,0,0,0,0,0,0,0,0,498,0,0,0,0,0,0,0,0,0,0,0,0,0,0,270,280,0,0,0,0,0,532,276,0,0,0,0,0,0,0,0,0,0,0,0,0,514,0,0,0,0,0,0,0,0,0,0,0,459,0,0,0,313,0,0,0,0,0,0,254,0,0,0,0,0,0,23,0,0,0,0,572,0,0,0,0,604,523,0,0,0,0,245,0,0,0,0,0,0,461,0,0,482,0,0,0,0,0,61,0,0,0,268,57,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,247,0,0,0,0,0,278,614,0,72,0,0,0,0,0,0,0,0,0,623,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,150,0,277,0,0,0,0,0,0,571,0,0,0,0,0,0,525,0,0,0,0,0,0,0,0,0,570,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,62,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,214,0,0,0,0,0,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,84,0,504,0,0,0,0,0,558,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,84,83,0,0,0,0,0,0,0,0,0,0,0,0,488,0,487,0,0,0,0,0,0,0,0,0,0,260,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,460,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,288,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,539,0,0,0,0,0,0,0,0,297,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,69,238,0,0,0,0,0,0,0,0,0,0,84,0,610,0,0,556,0,0,0,0,0,0,0,0,0,246,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,613,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,522,0,0,0,84,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,500,0,618,0,0,430,0,0,0,0,0,0,0,0,0,0,0,0,401,0,0,0,547,0,93,0,0,0,0,0,0,0,0,0,0,31,0,0,0,0,0,0,29,92,0,0,0,0,0,0,0,0,0,0,0,0,290,0,0,0,215,0,0,0,0,0,0,562,0,0,0,0,130,0,0,0,0,0,563,0,0,0,0,0,0,0,413,419,0,0,0,0,0,0,0,0,0,0,0,0,0,0,398,0,312,0,0,0,0,0,5,0,0,0,0,0,0,0,300,0,0,0,0,0,0,0,0,0,0,0,0,0,536,0,0,0,414,0,0,400,0,0,0,0,0,0,607,0,0,0,543,0,0,90,0,544,0,0,0,0,0,0,0,0,0,0,510,462,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,269,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,413,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,612,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,611,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,622,0,0,0,0,0,560,0,0,0,0,0,0,0,0,0,0,301,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,609,0,0,213,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,627,627,627,627,627,627,627,626,628]),EL=`orgmilcomschnetedugovdrrformsfeedbackofficialaccoorgmilschnetgovmagazinemediaunioncargopilotgroupcaarespressworksaerodromeworkinggroupair-traffic-controlaircraftaccident-preventioneducatormarketplaceambulanceinsurancecateringairportrepbodyenginesoftwaremodellingair-surveillanceconsultingchartertrainermaintenanceservicesdesignflightskydivingfreightassociationstudentgroundhandlingdgcafuelclubtaxicrewshowballooningexpresstraderbrokerauthoragentsairtrafficjournalistsafetyconsultantmicrolightaccident-investigationparachutingequipmentproductionfederationrecreationscientistnavigationengineertradingglidingleasingresearchpassenger-associationentertainmentparaglidinghangglidingaerobaticrotorcraftemergencycertificationgovernmentaeroclubexchangelogisticschampionshiphomebuiltcouncilconferencecontrolairlinecivilaviationjournalorgcomnetedugovcoorgcomnomnetobjofforgcomnetuwukiloappsframerorgmilcomnetedugovcoradioorgcomnetcommuneedogpbcoitgvorgedugov*spreviewfrontendrelayononstagingupid*mtls*privatelinktypedreamdeveloperbravemochawindsurfaivenmirenupsunwnextbegetngrokclerkwale2bwebcsbrunputerflutterflowspawnbaseshiptodaymagicpatternsnetlifyondigitaloceanrailwayhostedclaudehasurabotdashvercelgithubluyanigadgetreplitcloudflaretelebitedgecomputeevervaultexponyatnoopencrpplxzeaburwasmerframerzeropsrocketpreviewconvexmedusajsspritesonherculeseasypanelstreamlitglideossnowflakemesserliloginlinehackclubcodepennorthflankbase44corespeedleapcellngrok-freeclerkstagelovableon-fleek*us-west-3ap-south-2us-central-2us-central-1eu-central-1ap-south-1us-west-2us-east-2eu-north-1ap-north-1us-west-1us-east-1*rcloudintsegorgmilcomgobbetnetintedugovturmusicasenasamutualcoopip6uriurnin-addre164homeirisgovdixdaemoncloudnssthwien*inexexkunden4accogvormymyspreadshop4lima2ixortsinfofuturecmsfuturehosting12hpprivfuturemailinglima-cityfunkfeuer123webseitednshomemelmyspreadshopcloudletswasantqldvicactnswtascatholicwasaqldvictasidwasantozqldorgcomvicasnactnetedugovnswtasconfcomairflowlambda-urltransfer-webappairflowtransfer-webapptransfer-webapptransfer-webapp-fipstransfer-webappeu-west-3ap-south-2eu-south-2eu-central-2ap-southeast-3ap-southeast-4ap-northeast-3eu-central-1mx-central-1me-central-1ca-central-1il-central-1ap-northeast-1ap-southeast-1me-south-1af-south-1eu-south-1ap-south-1ap-southeast-7us-west-2eu-west-2us-east-2eu-north-1ap-southeast-2ap-northeast-2ap-southeast-5us-gov-west-1us-gov-east-1ca-west-1us-west-1eu-west-1us-east-1ap-east-1sa-east-1privatenotebookstudiolabelingnotebookstudionotebooknotebook-fipslabelingnotebookstudionotebook-fipsnotebookstudio-fipsnotebook-fipsnotebookstudionotebook-fipsnotebookstudioeu-west-3ap-south-2eu-south-2eu-central-2ap-southeast-3ap-southeast-4ap-northeast-3eu-central-1me-central-1ca-central-1il-central-1ap-northeast-1ap-southeast-1me-south-1af-south-1eu-south-1ap-south-1us-west-2eu-west-2us-east-2eu-north-1ap-southeast-2ap-northeast-2experimentsus-gov-west-1us-gov-east-1ca-west-1us-west-1eu-west-1us-east-1ap-east-1sa-east-1onrepostsagemakercopporgmilcompronetintedugovbiznameinfoshoprsorgmilcomnetedugovbrendlyresolvenzauscotvstoreorgcomnetedugovbizinfoidacaicoittvorgmilcomschnetedugovinfocloudezproxysiteacmymyspreadshopkuleuvenwebhostingtransurl123websitecloudnsinterhostsolutionsddns5476103298edgfacbmlonihkjutwvqpsryxzbarsycoororgcomedumyftpno-iporxcloud-ipfor-somemmafanfor-morewebhopselfipjozidyndnscloudnsdscloudfor-thefor-betteractivetrailcoeconorestooteorgcomeconeteduassurmoneyafricaarchitectesrestaurantloisirstourismavocatsinfoagrounivcoorgcomnetedugoviatvdeportesaludtksatorgmilcomwebgobnetinteducienciaboliviarevistacooperativaempresanombreindustriamusicapatriamedicinademocraciapoliticapuebloindigenaplurinacionalarteblogwikiinfoagrotransportenoticiasprofesionalacademiaeconomiaecologiamovimientotecnologianaturalsimplesitecepesebamapadfmgalampbacscpirngorotomtrjspaprrprrsesmscepesebamapadfmgalampbacscpirngorotomtrjspaprrprrsesms*biaamfmtcmptvfeirasampajampanatalbelemananiradiog12medindfndbmdtrdthepoaggfjdfdefinfenflegsegongengcngorgzlgslglogppgmillelqslcimcomnomadmjabimbbibbsbabcrectecsjcetcpscpvhudieticriapipsiecnbiorioecogeoteoodoproatoartfstmatvetdetbetnetcntnotfotgrueduajuespappreptmpemparqsrvadvdevgovntrturagrjorfarjusmusdesvixxyzcozfozslzbhzmaringasantamariacampinagrandegoianiasorocabafloripasaobernardocuritibaboavistarecifeaparecidasaogoncasalvadorcuiabamorenamacapalondrinacontagemsocialfortalmaceioleilaoosascoriobranconiteroi9guacutcheblogflogvlogwikitaxicoopmanauspalmascaxiasjoinvillebaruericampinassantoandreribeiraoriopretoweorgcomnetedugovv0windsurfshiptodaycloudsitecoaccoorgnetgovofmilcomgovmediatechzacoorgcomnetedugsjgovmydnspenfnlabnbmbgcbcqconcontnuyksknsmyspreadshopno-ipawdevboxbarsyonidatemfuinabusavinstanceseceuguukussryzespawncsxcloud-ipmyphotosfantasyleaguetwmailcleverappsscrappingccwucloudnsftpaccessgame-serverccgovobjectsrmalpgcust*svcalp1aeappenginermalpgmyspreadshop4lima2ixsquare7cloudscale123websitefirenet12hpflowgotdnslinkyard-cloudcloudnslima-citydnskingobjectstorageedaccogoorusorgcomnetinteduaéroportxn--aroport-byaassogouvcomilgobgovcloudnses-1eu-west-1us-east-1euvipit1eurarubait1s3lbwebsites3websiteru-spbru-mskelasticcsrunstnukukcaukusnl-ams-1fr-par-1fr-par-2functionsnodess3ddlwhmrdbfnck8sifrs3-websitecockpitscblmgdbdtwhkafkpubprivs3ddlwhmrdbk8sifrs3-websitecockpitscblmgdbdtwhkafks3ddlrdbk8sifrs3-websitecockpitscblmgdbdtwhkafkk8sscalebookpl-wawfr-parnl-amsbaremetalsmartlabelinginstancesdechk2kuleuvenlaravelvoorloperurownoxazapscwhstgrvaporonline-serverobservablehqelementorantagonistreclaimjoteluluencowaydiademjelasticmatlabmagentositetrendhostingaxarnetperspectajenv-arubajelejoteravendbemergenttrafficplexconvexkeliwebserveboltbegetcdnstaticson-rancherprimetelonstackitunison-servicesdnshomelinkyardbarsyjelecloudnscocomnetgovmycn-northwest-1cn-north-1s3s3-accesspoints3-websites3s3-accesspointrdsdualstacks3-deprecatedemrappui-prods3-websiteemrstudio-prods3-object-lambdaemrnotebooks-prodexecute-apis3s3-accesspoints3s3-accesspointrdsdualstackemrappui-prods3-websiteemrstudio-prods3-object-lambdaemrnotebooks-prodexecute-apicn-northwest-1cn-north-1cn-northwest-1ebcomputeelbcn-north-1airflowcn-northwest-1cn-north-1oncn-northwest-1cn-north-1amazonawssagemakeramazonwebservicesdirectasgdsdhehahljlnmhbacscahqhshhihnlnynsnmofjbjzjxjtjhkcqtwgsjssxnxjxgxxzgz網絡网络公司orgmilcomnetedugovxn--55qx5dcanva-appsxn--io0a7iquickconnectcanvasitekhsjxn--od0algcanva-codemyqnapcloudsrvrlessclustersrealtimestorageleadpagescarrdcrdorgmilcomnomnetedugovhidnssupabaserdpareplmypiumsoxmitotaplpagesfirewalledreplitowodevwebview-assetsvfswebview-assetss3s3-accesspointdualstackemrappui-prods3-websiteaws-cloud9emrstudio-prods3-object-lambdaemrnotebooks-prodexecute-apicloud9eu-west-3ap-south-2eu-south-2eu-central-2ap-southeast-3ap-southeast-4ap-northeast-3eu-central-1me-central-1ca-central-1il-central-1ap-northeast-1ap-southeast-1me-south-1af-south-1eu-south-1ap-south-1ap-southeast-7us-west-2eu-west-2us-east-2eu-north-1ap-southeast-2ap-northeast-2ap-southeast-5ca-west-1us-west-1eu-west-1us-east-1ap-east-1sa-east-1s3s3-accesspointdualstackemrappui-prods3-websiteaws-cloud9emrstudio-prods3-object-lambdaemrnotebooks-prodexecute-apicloud9s3s3-accesspointdualstackanalytics-gatewayemrappui-prods3-websiteaws-cloud9emrstudio-prods3-object-lambdaemrnotebooks-prodexecute-apicloud9s3s3-accesspointdualstackemrappui-prods3-websiteemrstudio-prods3-object-lambdaemrnotebooks-prodexecute-apis3s3-accesspointdualstacks3-deprecateds3-websites3-object-lambdaexecute-apis3s3-accesspoints3-websites3-accesspoint-fipss3-fipss3s3-accesspointdualstackemrappui-prods3-websites3-accesspoint-fipsaws-cloud9s3-fipsemrstudio-prods3-object-lambdaemrnotebooks-prodexecute-apicloud9s3s3-accesspointdualstackemrappui-prods3-websites3-accesspoint-fipss3-fipsemrstudio-prods3-object-lambdaemrnotebooks-prodexecute-apis3s3-accesspointdualstacks3-deprecatedanalytics-gatewayemrappui-prods3-websiteaws-cloud9emrstudio-prods3-object-lambdaemrnotebooks-prodexecute-apicloud9vfss3s3-accesspointdualstackemrappui-prods3-websiteaws-cloud9emrstudio-prods3-object-lambdaemrnotebooks-prodexecute-apicloud9eu-west-3ap-south-2eu-central-2ap-southeast-3ap-southeast-4ap-northeast-3eu-central-1mx-central-1me-central-1ca-central-1il-central-1ap-northeast-1us-northeast-1ap-southeast-1me-south-1af-south-1ap-south-1ap-southeast-7us-west-2eu-west-2ap-east-2us-east-2ap-southeast-2ap-northeast-2ap-southeast-5us-gov-west-1us-gov-east-1ap-southeast-6ca-west-1us-west-1eu-west-1us-east-1ap-east-1sa-east-1mrapaccesspoints3s3-accesspointdualstacks3-deprecatedanalytics-gatewayemrappui-prods3-websites3-accesspoint-fipsaws-cloud9s3-fipsemrstudio-prods3-object-lambdaemrnotebooks-prodexecute-apicloud9s3s3-accesspointdualstacks3-deprecatedanalytics-gatewayemrappui-prods3-websites3-accesspoint-fipsaws-cloud9s3-fipsemrstudio-prods3-object-lambdaemrnotebooks-prodexecute-apicloud9s3eu-west-3ap-south-2eu-south-2computes3-ap-northeast-2elbrdss3-ap-east-1s3-sa-east-1s3-us-gov-west-1s3-eu-central-1s3-ca-central-1eu-central-2ap-southeast-3ap-southeast-4ap-northeast-3s3-website-us-west-2s3-website-eu-west-1s3-external-1eu-central-1me-central-1ca-central-1il-central-1s3-us-west-1s3-eu-west-1s3-website-sa-east-1s3-website-ap-southeast-2ap-northeast-1ap-southeast-1s3-us-west-2s3-eu-west-2me-south-1af-south-1eu-south-1ap-south-1us-west-2eu-west-2us-east-2s3-website-ap-southeast-1s3-1s3-globals3-ap-northeast-3eu-north-1airflowap-southeast-2s3-us-gov-east-1s3-fips-us-gov-east-1s3-me-south-1s3-ap-south-1ap-northeast-2s3-website-us-west-1ap-southeast-5s3-eu-north-1s3-ap-southeast-1s3-website-us-gov-west-1compute-1s3-eu-west-3us-gov-west-1s3-website-ap-northeast-1us-gov-east-1s3-fips-us-gov-west-1s3-website-us-east-1s3-ap-southeast-2ca-west-1us-west-1eu-west-1us-east-1ap-east-1sa-east-1s3-us-east-2s3-ap-northeast-1authauthauth-fipsauth-fipseu-west-3ap-south-2eu-south-2eu-central-2ap-southeast-3ap-southeast-4ap-northeast-3eu-central-1mx-central-1me-central-1ca-central-1il-central-1ap-northeast-1ap-southeast-1me-south-1af-south-1eu-south-1ap-south-1ap-southeast-7us-west-2eu-west-2us-east-2eu-north-1ap-southeast-2ap-northeast-2ap-southeast-5us-gov-west-1us-gov-east-1ca-west-1us-west-1eu-west-1us-east-1ap-east-1sa-east-1rframeservicesbuilderstg-builderdev-builder*ociocpocsazuregcpawsdemoinstanceeu-west-3eu-south-2ap-southeast-3ap-northeast-3eu-central-1me-central-1ca-central-1il-central-1ap-northeast-1ap-southeast-1me-south-1af-south-1eu-south-1ap-south-1ap-southeast-7us-west-2eu-west-2us-east-2eu-north-1ap-southeast-2ap-northeast-2ap-southeast-5us-gov-west-1us-gov-east-1us-west-1eu-west-1us-east-1ap-east-1sa-east-1previeweu-4us-4us-1eu-1us-2eu-2us-3eu-3appscomputepaasrag-cloudrag-cloud-chjcloudjcloud-ver-jpcdemonodebalancermembersipeuxvsoncillaocelotonzayalilynxsphinxfentigercustomercaracalo365cloudstaticxendevapp001testcode-builder-stgplatformmediasiteprojedrydpagesjsx0desazacncoitrueu4uhkukgrbrushatenadiarymyspreadshopfrom-flfrom-wvwebspace-hosttheworkpchatenablogcursorusercontentservesarcasmapplinzisakuratanwixsiteappchizigiizeis-into-carsdnsiskinkyadobeaemcloudis-a-therapistpgfogmyvncdojinis-an-actress1kappfldrvkozowqa2jpnmexprgmrfirewall-gatewaydynnscafjsfbsbxooguyfrom-gawoltlab-demois-a-anarchistwiardwebteaches-yogadattowebtb-hostinglive-websiteservegamegotpantheonfrom-nhsubsc-payfrom-ohvipsinaappfrom-cadyndns-officehomelinuxfrom-mahercules-appservebbsstreakusercontentfrom-okfrom-wyfastly-terrariumis-a-llamaqualyhqportalserveexchangeon-vaporvivenushopciscofreakgrayjayleaguesmetaaiusercontentfrom-iais-a-libertariansaves-the-whalestaveusercontentyolasiteoperaunitepoint2thisis-a-catererclaudeusercontentlinodeusercontentfrom-vagithubusercontentsells-for-lesshosteurcanva-appsplaystation-cloudddnsfreefrom-pafrom-prfrom-waddnskingoutsystemscloudhotelwithflightmydattois-a-nascarfanmydbserverminiserverdamnserverservehumouris-a-playerfrom-nvfrom-nmemergentagentgentappsamplifyappfrom-kyis-an-accountantnfshostserveircfrom-akpythonanywherestackhero-networkpostman-echolikescandydyndns-mailobservableusercontentserveftpfreeboxosfrom-utcdn77-storageamazonawsneat-urldyndns-serverlinodeis-a-teacherfrom-vtgleezemythic-beastsus1-pleniteu1-plenitla1-plenitpaywhirlservecounterstrikejdevcloudhealth-carereformis-into-animegoogleapisis-a-painterafricaisa-hockeynutatmetais-an-actora2hostedis-a-democratdatadetectest-le-patrondigitaloceanspacesis-a-designeris-a-hunterlinodeobjectstemp-dnsissmarterthanyoufrom-arsimplesiteevennodetownnews-stagingis-a-liberalgooglecodejelasticservemp3qualyhqpartnerdyndns-free1cooldnsest-a-la-masiondrayddnsdynuddnsfrom-orfrom-miis-a-bloggerfrom-himydobisscanvacodeis-an-engineerest-a-la-maisonupsunappdevinappswafflecellmyasustorwpenginepoweredfrom-ctservep2psame-appmyshopblocksthingdustdatalikes-piediscordsezis-with-thebandlpusercontentis-leetshopitsite3utilitiesis-a-personaltrainersinaappladeskis-a-cheflogoipselfipbase44-sandboxnospamproxyalibabacloudcsmesswithdnsauthgearappsiamallamawithgooglelutrausercontentmochausercontentframercanvasmytabitdyndns-homew-credentialless-staticblitzcpserverdiscordsaysis-a-nurseappspotatlassian-isolated-3premotewdfrom-mtwixstudiocode0emm180rmyactivedirectoryawsappsmytuleapdnsabrpolyspaceqbuserrenderbuiltwithdarkboutirgotdnsabrdnsdopaascanva-hosted-embedawsglobalacceleratorhomesecuritypcmyiphostditchyouripclever-clouddyndns-ipon-aptibleis-a-musicianhosted-by-filessecuritytacticsappspaceusercontenthomeunixstrapiappsame-previewcf-ipfsmycloudnaselasticbeanstalkis-certifieddontexistkasserverik-serverdrive-platformatlassian-3pfirebaseappherokuappawsapprunnerbarsycenteris-a-cubicle-slaveservehttpmyshopifyis-a-guruquicksytessiiitesorsitesmagicpatternsappis-a-cpameteorappfrom-wiis-a-rockstarbumbleshrimpdattolocaldatabricksappsreadthedocs-hostedfrom-rifamilydsdyndns-picsplesknsbplaceddnsaliasdynaliasdyndns-remotedoomdnsip-ddnsblogdnsis-a-doctorroutingthecloudamazoncognitobarsyonlinedsmynasddnsgurucloudflare-ipfsdeus-canvasfrom-idsmushcdnpagespeedmobilizerdyndns-at-homeunusualpersonhosted-by-previderis-a-republicandyn-o-saurstreamlitappworkisboringonthewificprapidqualifioappis-uberleetis-slickgetmyipwpdevcloudtypeformdyndns-at-workgentlentapismynascloudw-corp-staticblitzfrom-ingeekgalaxyservebeerfrom-mdonrenderspace-to-rentaivencloudappspacehostedwafaicloudcodespotblogspotatlassian-3p-us-gov-modfrom-ndfrom-msis-a-techieis-a-studentcustomer-ociis-a-photographerdurumisfrom-ksmassivegriddyndns-wikiis-an-entertaineris-a-hard-workermysecuritycamerafrom-mnrackmazedyndns-blogis-a-bulls-fanwritesthisblogfreemyipsimple-urlfrom-sdreservdauthgear-stagingest-mon-blogueuris-into-gamesrice-labsxtooldevicesakurawebis-an-anarchistoraclecloudappsdyndns-worksells-for-urhcloudfrom-dcfastvps-serverwpmucdnis-a-geekscrysecfrom-txis-into-cartoonsmodelscapetrycloudflarelocaltonetstreak-linkbalena-devicesfrom-njforgeblocksfreebox-oswebadorsitefrom-ncdoesntexisthobby-sitestreaklinkshomesecuritymacownprovidertuleap-partnersdattorelaywphostedmailservequakeis-a-socialistservehalflifepivohostingdynuhostingquipelementsw-staticblitzdyndns-webfrom-deproject-studyaliases121is-not-certifiedhercules-devis-a-financialadvisorservepicsis-a-greenloseyouripfrom-ilwithyoutubemwcloudnonprodwiredbladehostingdnsdojofrom-tnpixolinomyqnapcloudis-an-artisthostedpiis-a-landscaperauiusercontentoaiusercontenton-forgeis-a-conservativedreamhostersnet-freaksapps-1and1is-goneencoreapifastly-edgefrom-nesalesforcefrom-scdeployagentoraclegovcloudappsfrom-alis-a-lawyercechirevultrobjectsstufftoreadisa-geekddnsgeeklovableprojecttry-snowplowfrom-moblogsyteis-a-bookkeepernogmyforumravendbmyboxdeelementoredsaacficogoorinforgcomgobnatneteduidstoreorgcomnetintedudevnomepublorgcomneteduathgovtestscalculatorspaynowinfoquizzesresearchedcloudnsfunnelsassessmentsjscaleforcetmacltdorgmilcompronetgovbizpresseklogesrsccloudcustomfltusrcloude4corealmgovmunicontentproxy9metacentrumdyndyndyndnsdynpagespages-researchitionoccustomercomymyspreadshopipv64diskussionsbereich4limacomrub2ixfirewall-gatewayddnssspdnsbarsykeymachinesquare7myhome-serverspeedpartnercommunity-proschuldockxenonconnectgünstigliefernbwcloud-os-instancedyndnssecmy-routerxn--gnstigliefern-wobin-butterl-o-g-i-nisteingeekin-dslin-berlinin-brbfuettertdasnetzleitungsenin-vpnlcube-serverdyn-ip24logoipdyn-berlinruhr-uni-bochum12hpgoipsrvdnsfruskygit-repossvn-reposinternet-dnsgünstigbestellenhome-webserverxn--gnstigbestellen-zvbbplacedheimdnscosidnswebspaceconfiglima-citydyndns1istmeinvirtualuserschulplattformmy-gatewayddnsseclebtimnetztest-iservmein-iservvirtual-userhome64iservschuletaifun-dnstraeumtgeradeschulserverdynamisches-dns123webseitednshomehs-heilbronndnsupdaterbssgraphicdwadpdwdaepeweaawapaafpfwfabwbpbacwcpcciwebuserapiobjectsidsiskospockkimodorikerbonesteamsparisjanewaypicardglobaltarpitreedpikekiraworfsulukirkarchertuckerhackercanarywesleystagingprereleaset3r2lpbravepanelngrokiservstglclcrmerpflypagesbarsyvivenushoplocalcertlocalplayerbearbloggatewaydeno-stagingis-not-ais-a-goodbotdashvercelmocha-sandboxplatter-appreplitgithubpreviewworkersinbrowserevervaultis-ahrsndenoxmitmodxmyaddrstorageapipayloadgrebedocruncontainersstgstagelclstageloginlineis-a-fullstackcodepenleapcellngrok-freeis-coolstoragewebharemediatechlibp2pdiscourseimaginecomyspreadshopstoreregbiz123hjemmesidefirmcoorgcomnetedugovsldorgmilcomwebgobartnetedugovtmorgpolcomsocartnetedugovassoagrondiscoodontk12medcuegyecpaabgengorgmilgalsaltulcomadmesmgobpubdocmonfindgnriouioproartlatvetnetfotedulojgovntrturibrbarxxxofficialbasechefprofmktgpsictechinfoarqtcontdentrrpppsiqgit-pagesritmedfieorgcomlibprieduaipgovriikmeactvsportorgmilcomscieunnetedugovnameinfopintouchtawktotawkmyspreadshoporgcomnomgobedu123miwebcomputeorgcomnetedugovbiznameinfocognito-idpeusc-de-east-1onjelasticnxaspdnsbarsydirectwpdeuxfleurstransurldogadoprvwcloudnsamazonwebservicesdnshomeuserpartycokoobinmkmfidymyspreadshopalandkapsiikixn--hkkinen-5wacloudplatformhäkkinen123kotisivuidacorgmilcompronetedugovbiznameinforadioorgcomneteduuserexperts-comptablestmmyspreadshopgretaprdcomnomynhccifbxoshuissier-justicenotairesaeroportfreeboxoson-webavocatassoportgouvkdnschirurgiens-dentistes-en-franceavouesfbx-os123sitewebveterinairechirurgiens-dentistespharmacienchambagrimedecinfreebox-osdediboxgoupilemszicpyicpvicppleysheezypagesedugovcnpyorgcomcybllcpvtnetedugovtnxonlineschooldaemond6atcopanelorgnetplybotdashstackitkaasorgmilcomnetedugovbizmodltdorgcomedugovcoorgcomneteduappwriteacorgcomnetedugovcloudtranslateusercontentorgcomnetedumobiassoorgcomnetedugovbarsysimplesitediscourseindorgmilcomgobneteduorgcomwebnetedugovguaminfonxhra教育敎育網絡网絡组織組織网络網络组织組织公司政府個人个人箇人ltdorgcomincneteduidvgovxn--uc0ay4axn--55qx5dxn--mk0axixn--io0a7ixn--uc0atvxn--zf0avxxn--lcvr32dxn--od0algxn--wcvs22dxn--gmqw5axn--od0aq3bxn--mxtq1mxn--ciqpnxn--tn0agxn--gmq050iorgmilcomgobneteduiservwp2tempurlmircloudfreesitewpmudevmyfastgadgetcloudaccessjelehalfboltfastvpsemergenteasypanelopencraftizcombrendlynamefromrtpersoadultmedorgpolrelcomproartnetedufirminfoassoshopcoopgouvtmcomediahotelforumvideosportorgsexagrargameslakaseroticaerotikatozsdereklamcasino2000filmsuliinfoboltshopprivnewsszexcityutazasjogaszkonyveloingatlaneacaicogoormyᬩᬮᬶmilwebschnetkopbizzonedesaponpesxn--9tfkymyspreadshopgovmytabittabitorderravpageaccok12idforgnetgovmuniltdplcaccotttvorgcomnetmeca6g5gpgamubacaicniocoukuptverdruscsdelhiindorgmilcomwebnicfingenpronetintedugovresbizbiharbarsyinternetbusinessschooltravelsupabasealumnigujaratfirminfoaeropostbankcoopindevscloudnsno-ipbarsybarrell-of-knowledgebarrel-of-knowledgensupdategroks-thisdnsupdatefor-ourknowsitalldvrcammittwalddynamic-dnsv-infowebhopselfipdyndnshere-for-moreilovecollegemayfirstforumzcloudnsmittwaldservertypo3servergroks-theeusekd1cdndyndnsidrawsainaueuapjpusstagemocksysdevicesclientcustreservdcustdevdisrecprodtestingcobeebyteutwenteboxfusebravepstmndedynngrokorgmilcomnomnetedugovqcxqzzbarsythingdustmo-siemensrb-hostingfh-muenstergitbookbluebitecloudbeesusercontentnodeartkiloappsforgerockdarklangresinstagingapigeebubbleb-datascryptedhypernodedappnodepantheonsitegitlabgithubkeeneticvirtualservercleverappshostyhostingon-rioedugitticketstelebitwixstudioon-k3sicp0icp12038jeleqotolairbubbleappsmyaddrstolosmyrdbxwebflowdrive-platformbeagleboardhasura-applolipopdefinimavaporcloudmusicianwebflowtestazurecontainerresindevicereadthedocsloginlineeditorxmoonscalesandcatsbasicserverwebthingsbrowsersafetymarkbeebyteappbitbucketidaccovistablogorgschnetgovxn--mgba3a4f16axn--mgba3a4fraarvanedgeايرانایرانjclaspeziapdudcefegelemeperetevebacanatavaparasabgagfgogrgpgalclblimfmrmcbmbvbfclcmcvcrcpcchlimifibicivipirisimncnbnanenrnpntnnolomobocoaogorosopotoptvtatctbtmtltotpusulunutpspapaqsvpvvvtvavvrtrsrprgrfrcrbrarorkrvstsssbscsmsispzczbzbozen-suedtirolmyspreadshopxn--bulsan-sdtirol-nsbxn--valledaoste-ebbtrentinoaltoadigetrentin-sued-tirolxn--forlcesena-c8axn--forl-cesena-fcbxn--bozen-sdtirol-2obtriestetrentinsuedtiroltrentino-s-tirollecceudineaostesienaparmaluccapaviagenoapaduaaostamonzaabruzzoternirietiturinmilanbozenlaziofermoleccocuneonuoropratola-speziavdataaligfvgpugmolcalcamlomumbsicpmnvenvaoedugovabrsarmaremrbastoslazibxosfirenzetrentinosüdtirolval-d-aostavalle-aostamessinacremonaravennatoscanatrentin-suedtirolbolognacalabriaurbinopesarofriuli-v-giuliaogliastraxn--valle-aoste-ebblaquilaandriatranibarlettasyncloudxn--valle-d-aoste-ehbaostavalleyvalled-aostatrentino-alto-adigevallee-d-aostexn--balsan-sdtirol-nsbpistoiasicilialucaniacataniaiserniaperugiabresciaveneziagorizialiguriaimperiabulsan-suedtirolbalsan-suedtirolbarlettatraniandriaxn--trentino-sdtirol-szbforlì-cesenatuscanyvallée-d-aostemantovavallée-aostecasertapiemontevalleaostaval-daostafriulivgiuliatrevisoforli-cesenavalléedaosteferrarapescaravald-aostatrentino-altoadigefriuli-vegiuliavallee-aostecarboniaiglesiastarantomediocampidanovalleedaostetrentinosud-tirolcampobassotrentinsüd-tiroltrentinosüd-tirolmonzabrianzatrentino-südtirolxn--trentino-sd-tirol-c3bpotenzacosenzavicenzaemiliaromagnavenicefrosinonemarchepordenonetrentinosued-tirolvaresemolisevalléeaostefriuli-veneziagiuliabasilicatalatinaanconasavonaveronamodenabiellabolzano-altoadigepugliafoggiaumbriatrentino-stirolgenovapadovamateranovararagusapiacenzatrentinostirolvalleeaostetempio-olbiasudsardegnatrentinsudtirolmassa-carrarafriuliveneziagiuliatrentinosuedtirolandria-barletta-tranitrapanixn--cesenaforl-i8amaceratacaltanissettaascoli-picenobrindisicarraramassacagliaririmininapolivibo-valentiachietibulsan-sudtirolbalsan-sudtiroltrentino-a-adigebulsanbalsaniglesiascarboniamilanotorinoteramodell-ogliastraarezzotrentinoalto-adigerovigotrentovenetoiglesias-carboniatrentino-sud-tirolaltoadigereggio-emiliareggio-calabriasardegnatranibarlettaandriapiedmontxn--sdtirol-n2amedio-campidanotrentino-süd-tirolfriuli-vgiuliafriuli-ve-giuliaromeennaromapisa32-b16-b64-blodiastibarineencomonaplesforlicesenailiadboxosalessandriasicilytrani-barletta-andriaxn--trentin-sdtirol-7vbpesarourbinotrentinsued-tirolcesena-forliforlìcesenaemilia-romagnamonzaebrianzaxn--trentinsdtirol-nsbtrentinos-tiroltrentinsüdtirolvalledaostaolbia-tempiocampidanomediovibovalentiasassarivalle-daostalombardysud-sardegnafriulivegiuliareggioemiliamonzaedellabrianzaalto-adigevercellitrentin-sudtiroltraniandriabarlettatrentino-sudtirolascolipicenobozen-südtirolfriulive-giuliaflorencexn--cesena-forl-mcbcarbonia-iglesiasaosta-valleycarrara-massadellogliastratrentinoa-adigexn--valleaoste-e7apesaro-urbinoxn--trentinosdtirol-7vbxn--trentin-sd-tirol-rzbxn--trentinsd-tirol-6vbtrani-andria-barlettatrentin-süd-tirolxn--trentinosd-tirol-rzbgrossetomonza-e-della-brianzasüdtirolreggiocalabriatrentinoaadigetrentin-südtirolverbano-cusio-ossolafriuliv-giuliaverbaniacampaniatrentino-aadigefriulivenezia-giuliasardiniaandriabarlettatranibarletta-trani-andriacatanzarooristanourbino-pesarocesena-forlìvalle-d-aostacampidano-medio123homepagesiracusatempioolbiasuedtirollombardiaavellinocesenaforlìtrentinofriuli-venezia-giuliabozen-sudtirolandria-trani-barlettabulsan-südtirolbalsan-südtirolmonza-brianzabolzanotrentino-sued-tirolbellunosalernolivornocrotonesondriodnshometrentinsud-tirolmassacarraratrentin-sud-tiroltrentino-suedtirolviterbobergamocesenaforliolbiatempiopalermobeneventoagrigentoofcoorgnetfmaitvphdengorgmilcomschnetedugovperagrikanieasukehandachitatokaiaisaikonanoharuamaobuhigashiuraowariasahiinuyamatobishimaiwakurashitarainazawatoyonegamagorimihamatoyotataharakariyayatomioguchikomakimiyoshinishiotokonamekiyosuchiryutoyohashiokazakiisshikikasugaikotakiratoeianjotogofusosetohazutsushimashinshirotakahamanisshinshikatsuhekinantoyokawaichinomiyatoyoakeodateogataakitaikawakyowahonjoogayurihonjonoshirokamiokakatagamimitanegojomeyokotekosakadaisenkazunonikahohonjyomoriyoshimisatohappoukamikoanihachirogatahigashinarusesembokufujisatokitaakitaitayanagiowanitakkomutsutsurutahirosakigonoheoirasetowadamisawanohejiaomorishingohiranairokunohehashikamitsugarushichinohehachinohenakadomarisannohekuroishisakaeisumiasahiotakiinzaiabikomatsudoyachiyomutsuzawakujukuriomigawakashiwatoganemihamanaritasakuranagaramobarahanamigawachoshishiroichoseikozakishisuikatorimidorichonankyonanfuttsuonjukufunabashinagareyamanodasosatakochuotohnoshourayasukimitsuyokaichibayotsukaidosodegauratateyamakamagayayokoshibahikariyachimatakatsuuratomisatokisarazukamogawaichikawanarashinoichinomiyashimofusaminamibososhirakoichiharaoamishirasatoikatahonaiainansaijoseiyoiyoozuuwajimaniihamanamikatamasakiuchikokihokutobetoonshikokuchuomatsuyamaimabarikamijimakumakogenyawatahamamatsunosabaeikedaobamasakaifukuiohionotsurugamihamawakasaminamiechizeneiheijikatsuyamatakahamaechizensoedaukihaomutaokawanishiogoribuzenonojosueumiokiotochikugosasagurisaigawamizumakishinyoshitomikurumekurateyamadakasuganakamamiyamanogatatakatahakataiizukakawaratagawakasuyaashiyainatsukimunakataminamitsuikishonaikurogifukuchikeisenhigashimiyakoshinguyukuhashiokagakiyamekogaongausuikahotohochuotoyotsumiyawakadazaifuhisayamatachiaraiyanagawanakagawahirokawachikujochikushinochikuhochikuzennamieotamaokumashowateneiiwakikoorinangoononishigoshimogoomotegomishimafukushimaasakawakagamiishishirakawaiitatefutabahiratayugawahanawakitakatakawamatakunimiyabukibandaihigashihironoyamatomiharuyamatsuriaizubangedatesomaaizuwakamatsuyanaizuaizumisatonishiaizuizumizakikitashiobarataishinkaneyamakoriyamainawashirotanagurafurudonosamegawasukagawaishikawatamakawaikedaogakitaruiginanenahashimahichisonakatsugawaibigawashirakawamizunamiminokamomitakekawauesekigaharatomikasakahogikitagatayamagatatajimianpachimotosuyaotsukakamigaharahidakanisekitokigujominogodoyorogifukasamatsutakayamawanouchihigashishirakawakasaharashimonitatsumagoichiyodakannakanrashowameiwakiryuotaoratomiokafujiokaitakuranaganoharahigashiagatsumatakasakishibukawaminakamikatashinatsukiyonokawabanumataannakaoizumimidorishintoisesakiuenoyoshiokakusatsutakayamanakanojonanmokutamamuratatebayashimaebashiotakekaitadaiwahongofuchukuietajimashobaramiharahatsukaichihigashihiroshimamiyoshikumanokurenakasakaseraseranishiasaminamifukuyamashinichionomichiosakikamijimajinsekikogentakeharaotobenanaeikedatohmaozoraobiraabirakyowaeniwataikibibaisharirebunerimohiroooketootarupippunishiokoppechitosefurubirahakodateshiranukakitahiroshimakushiroobihironanporoiwamizawaniikappukunneppufukushimanakasatsunaitoyourakuromatsunaiakabirakamisunagawashibechaurakawakamifuranonakatombetsuasahikawashimokawakayabeokoppebiratoriabashirisaromaatsumanumatahidakabifukamukawamikasahorokanaitoyotomisarufutsuhigashikawaishikarikitamiyoichiesashiiwanaitomariminamifuranoakkeshifuranotoyakoyakumootoineppushikaoishiraoinemuronayorohaboroashorobihororishirifujiutashinaihokutotakasuebetsuurausuassabukikonaishimamakinaiedatetoyabieinikiesanuryuoumuteshikagarikubetsuashibetsukimobetsuaibetsutobetsusobetsuembetsushimizuchippubetsurishirihokuryuhoronobeshintokutsubetsushibetsuhonbetsumombetsutsukigatakuriyamakoshimizushiriuchikutchanmurorannoboribetsukamishihorowassamushinshinotsukembuchiwakkanaikamoenaikiyosatotakinoueshikabesunagawafukagawanakagawatakikawakamikawahigashikagurahamatonbetsumatsumaemoseushirankoshishakotanimakanemashikeotofuketomakomaisandatambaitamiawajikasaiasagoshisoonoakoyashirotoyookaminamiawajiinagawafukusakitakasagokamigorikasugaharimayokawaashiyahimejiakashitaishiaogakisannantakinosumototakarazukanishinomiyashingugoshikinishiwakiyokatakaaioimikisayoyabukawanishiamagasakisasayamashinonsenkakogawaichikawakamikawatatsunotsukubaiwamaogawaasahisakaitokaioaraiitakobandodaigosuifuinaamikasumigaurakashimaomitamayachiyoshimodatetomobetoridehitachinakainashikisakuragawakasamayawaramoriyahitachiomiyanamegatayamagatahitachikamisuushikutakahagiibarakitonekoganakasowayukimihojosomitoryugasakishimotsumafujishirotsuchiurachikuseihitachiotashirosatotamatsukuriuchiharashikahakuinanaotsubatawajimakahokukawakitatsurugikaganominotosuzuuchinadakomatsuanamizunakanotohakusannonoichikanazawaiwateshiwafudaikawaimoriokaofunatohanamakikuzumakikitakamininohekunoheyamadayahabasumitaichinosekitanohatahiraizumirikuzentakatajobojiotsuchihironomiyakoiwaizumikarumaiichinohenodakujitonooshushizukuishifujisawamizusawakamaishikanegasakimannoutazukotohiraayagawazentsujihigashikagawauchinomikanonjisanukimarugamemitoyotakamatsutadotsunaoshimatonoshoakuneamamiizumihiokiyusuikinkoisasookouyamanakatanekagoshimakanoyaisenkawanabeminamitanemakurazakitarumizunishinoomotematsumotosatsumasendaioimatsudaayaseebinamiurazushinakaiodawaraiseharasagamiharahakoneaikawakaiseiatsugitsukuihadanoyamatoyamakitazamaoisochigasakininomiyayokosukakamakuraminamiashigarafujisawasamukawakiyokawahiratsukayugawaraokawaumajikochitsunootoyoakiinonishitosayasudahidakamiharasakawaniyodogawahigashitsunokagamigeiseisusakiotsukinaharisukumomurototosakamiochitoyotosashimizumotoyamanankokunakamurakitagawayusuharaogunichoyoukiasoutoozugyokutoamakusamifunetakamoriyamagaminamataminamiogunikikuchisumotoyamatonagasumashikiaraokumamotokamiamakusanishiharayatsushiroayabeseikasakyoideineujinakagyokameokakyotangokyotanabekyotambaminamiyamashiroyamashinatanabeyawatawazukaminaminantanmiyazuhigashiyamafukuchiyamakitamukokamojoyokizumaizuruujitawaraoyamazakinagaokakyokumiyamakawagoeinabeshimameiwaasahitaikiudonoisetsukisosakikuwanamihamamiyamasuzukatamakimisuginabarikumanokomonominamiisewataraitobakiwatakikihotadomatsusakayokkaichikameyamaureshinoishinomakishichikashukuohirataiwaosakizaohigashimatsushimashikamaiwanumashibataogawaraonagawakawasakiseminemarumoriminamisanrikukakudamuratawakuyatomiyanatoriwataritagajomisatotomekamirifushiroishimatsushimayamamotoshiogamafurukawahyugaebinotsunosaitoayakushimanobeokakitauramiyazakitakazakigokaseshiibamimatashintomikunitomikitakatakobayashikawaminamitakaharukijotakanabemiyakonojonishimeranichinankitagawakadogawamorotsukakisofukushimaminamimakisakaeobuseikedaogawamiasaokayaasahiotakiotarichinoinaomichikumakomaganechikuhokukaruizawayasuokaooshikaikusakaminamiaikitogakushimatsukawakawakamitateshinatakamorikitaaikishiojirimiyadahakubaiizunaiijimaiiyamamiyotasuzakayasakatoguraookuwanagawaminowahirayayamagataminamiminowafujimiomachisakakitakaginaganonakanosakuhokomoronagisoshinanomachiwadauedaiidaharasuwatomiachiaokianankisosakunozawaonsenagematsutakayamashimosuwamatsumotoyamanouchinakagawamochizukiazuminotatsunoobamaomuraseihiunzenosetofutsuikichijiwanagasakiisahayahasamisaikaikawatanasasebohiradokuchinotsugototogitsutsushimashimabarashinkamigotomatsuurayamazoekashibaikomakawaitenrioyodosangokoryoudaojiikarugayamatokoriyamatenkawakatsuragikurotakikawakamimiyakemitsuetakatorikamikitayamayamatotakadahegurishinjokanmakisakuraitawaramotogoseoudanarasoniandokawanishishimoichihigashiyoshinokashiharashimokitayamanosegawayoshinomintsivorytopazsakuragehirnsumomoaseinetopalmail-boxmokurenyoitamuikaojiyagosensanjoaganomyokoseiroagaomishibataniigatanagaokamurakamiuonumayuzawakariwatagamitainaitsunanminamiuonumatochioyahikojoetsuseiroukamosadoizumozakitokamachiitoigawasekikawakashiwazakitsubamemitsukekokonoesaikiusukibeppuusahimeshimakunisakihasamataketatsukumihitaoitahijikusuyufukujukamitsuebungoonobungotakadaibaraniimibizentsuyamaokayamakasaokahayashimayakagemaniwaakaiwamisakishinjotamanotakahashikibichuowakesojanagishookumenannishiawakurakurashikiasakuchisetouchikagaminosatoshotomigusukunakagusukuyaeseizenaurumaiheyaaguniogiminanjokinminamidaitokitanakagusukuyonaguniokinawaishigakikunigamiurasoekadenataramahiraraginozataketomishimojizamamitonakiitomanhigashimotobuyonabarugushikamionnanahanagohaebarukumejimakitadaitonakijinnishiharayomitanginowantokashikiishikawaikedasuitaminohizuminishisakaikananabenodaitoosakasayamayaokishiwadatadaokakaizukatondabayashichihayaakasakakumatorikadomasayamahigashiosakashijonawatehirakatataishimisakitajirihannansennankatanotoyonominatosettsuhigashiyodogawaibarakinosekitachuohigashisumiyoshifujiiderakashiwaraizumiotsutoyonakamatsubaramoriguchiizumisanoshimamototakatsukineyagawahabikinotakaishikawachinaganoyoshinogarikamiminearitaouchiimarihizenogikashimaariakekiyamafukudomikitagatakitahataomachigenkaikanzakinishiaritakyuragisagataratosutakushiroishikaratsuhamatamakouhokukawagoeyoshidasatteogoseirumaasakaurawaogawaniizaomiyayoriiotakishikihonjooganohannohanyuinasaitamaokegawaarakawayoshikawayokozehasudasayamahidakafukayachichibuiwatsukiryokamiyoshimikamiizumifujimiwarabiranzanmiyoshiminanoyashiosakadosugitomisatohigashichichibutodasokakukiyonokazoshiraokakasukabekounosukawajimatsurugashimamiyashirokitamotohatoyamamoroyamahatogayakumagayakawaguchinagatorokamisatomatsubushinamegawatokigawakamikawafujiminohigashimatsuyamakoshigayatokorozawas3isk01isk02ryuohkoseikonanaishorittotakashimamaibarahikonetorahimenishiazaikokagamokotoyasuotsukusatsunagahamamoriyamatoyosatotakatsukinotogawaomihachimanhigashiomiakagiunnanizumogotsuamayatsukakakinokimatsuehamadamasudahikawahikimiokuizumoyasugiyakumomisatotamayuohdahigashiizumookinoshimanishinoshimatsuwanoshimaneshimadafujiedayoshidashimodagotembaiwataatamikosaiyaizuitoizumishimahaibaramakinoharaomaezakikawanehonkannamisusonohigashiizufukuroinumazukawazufujiaraishizuokahamamatsushimizuizunokunimatsuzakimorimachiminamiizunishiizukikugawakakegawafujikawafujinomiyaujiietsugaoyamayaitaohiranikkoashikagakuroisokanumasakurashioyakarasuyamamotegiichikaikaminokawatochigihagamokanogisanobatonasumibunasushiobaranishikatautsunomiyaiwafunemashikoshimotsukeohtawaratakanezawaitanokomatsushimatokushimaichibaminamiaizumiwajikikainanmiyoshinarutomimamugiananmatsushigesanagochishishikuinakagawamachidachiyodakomaefussainagitaitochofufuchuomeotahigashiyamatotoshimaokutamaaogashimakodairaedogawaarakawahachiojishinagawatachikawashibuyasuginamihinodekiyosesumidaoshimanerimamitakahamuraadachinakanomizuhobunkyomegurominatokoganeihigashikurumekokubunjihigashimurayamamusashimurayamatamakitahinochuokotokatsushikakouzushimaogasawaraakishimakunitachishinjukusetagayamusashinohachijoitabashiakirunohinoharachizunanbukotouramisasawakasayonagokogehinoyazutottorinichinansakaiminatokawaharaoyabetairainamiasahinantoimizufuchutakaokakurobeyamadajohanatoyamatonaminyuzenfunahashinakaniikawanamerikawaunazukitogahimiuozufukumitsutateyamakamiichiiwadearidayuasainamitaijikatsuragiaridagawatanabemihamahidakakainankiminomisatoshingushirahamakamitondayurakozakoyagobokitayamawakayamakudoyamahashimotokushimotokozagawahirogawakinokawanachikatsuurarsuseroeoishidasagaeoguniasahinagaitendonanyoobanazawanishikawasakataohkuratozawamikawamamurogawayamagatafunagatatakahatashonaishinjokahokuiideyuzakawanishitsuruokakaminoyamayamanobeshiratakamurayamanakayamakaneyamahigashineyonezawasakegawamitouubeyuuabushimonosekitabuseoshimatoyotaiwakunihikarishunannagatohagihofukudamatsutokuyamashowadoshitsurunanbukoshukaiminami-alpsnirasakikosugeotsukioshinohokutominobuyamanashifuefukichuokofuichikawamisatoyamanakakonakamichitabayamanishikatsuranarusawafujikawahayakawafujiyoshidafujikawaguchikouenohara長野京都岐阜大阪三重群馬千葉滋賀佐賀奈良adednelgaccogogror秋田愛知高知埼玉沖縄栃木熊本岩手青森山梨新潟島根鳥取長崎香川宮城石川大分宮崎茨城山口兵庫山形徳島広島福島福岡岡山富山静岡愛媛福井東京xn--4it168dhatenadiaryxn--vgu402ckawaiishophatenablogcocottenamaste北海道penneehimeiwateversestabachibashigagonnagunmapermahaccaakitaosakauh-ohblushkochiaichifukuikuroncapooitigohyogotokyokyotopunyuthickcheap0t00g00j0mie2-ddaapyawjg0amfemsubxiiboomoobutchueekpgwrgrherskrboyrdyupperunderflierchipsmydnsheavyangryhippygirlyrulez神奈川鹿児島和歌山bambinaxn--nit225kokayamasaitamaxn--k7yn95exn--1lqs03nsapporoparasitelolipopmcxn--efvn9sniigatafukuokatokushimafukushimahiroshimakagoshimafakefurokinawaxn--8pvr4ucoolblogxn--0trq7p7nnkawasakinagasakimiyazakichilloutxn--8ltr62kxn--klty5xpeeweezombiecutegirlxn--rny31hxn--uuwu58axn--ntso0iqx3axn--djrs72d6uytoyamanikitanyantakagawamimozanagoyaboyfriendxn--2m4a15egreaterchowderegoismyamagatafashionstorexn--elqq16hxn--pssu33lsendaimiyagixn--rht27zpecoriaomorisaloonwatsonvivianxn--djty4knobushipigboatnaganopinokoxn--f6qx53asadistvelvetsecretxn--5js045dchicappayamanashiibarakidigickgirlfriendxn--1lqs71dmongolianxn--c3s14mxn--qqqt11mtochigixn--5rtq34kparallelo0o0mondkobesagabonadecaoitanarafoolkilldecimainhiholomosblokilociaoundopupugifutankcrapflopnooroopsmodsholyjeezstripperpepperbittershizuokaxn--rht3dkitakyushureadymadeicurusversusmatrixxn--rht61ehungryfloppygloomycrankyhandcraftedlittlestarxn--klt787dxn--kltx9awhitesnowsunnydaytottorilovepoptheshopbuyshopxn--5rtp49cxn--d5qv7z876cwebaccelxn--kbrq7oxn--4pvxsxn--1ctwolovesickkumamotocatfoodxn--tor131oyokohamawakayamatonkotsuxn--ehqz56nxn--uist22hxn--6btw5axn--kltp7dyamaguchifrenchkisspussycatxn--4it797kxn--uisz3gbabybluexn--zbx025dnetgamersxn--7t0a264ckanagawaxn--6orx2rishikawaxn--ntsq17ghalfmoonschoolbusjellybeanxn--mkru45iusercontentlolitapunkxn--32vp30hsakurastoragehokkaidoshimanecandypopbabymilksupersaleweblikeraindropbackdropwebsozaikikirarahateblodaynightmeneacsccogoormobiinfoaeusxxorgmilcomnetedugovorgcomnetedugovbizinfotmprdorgmilcomnomedugovassnotairespresseassocoopgouvveterinairemedecinpharmaciensorgnetedugovtraorgcomedurepgovmeneperekgacscaiiocogoitoresmshsseoulbusanulsandaeguc01milvkimmvchungnamjeonnamjeonbukeliv-dnsgyeonggijejueliv-cdnincheondaejeongangwongyeongbukgwangjuchungbukgyeongnameliv-apicoeduindorgcomembnetedugovorgmilcomnetedugovjcloudorgcomnetintedugovperbnrinfocooyorgcomnetedugovethipfscanvamypepethw3sstorachakeeneticjoinmcinbrowserdwebcyonnftstoragemyfritzaemewphlxachotelltdorgcomwebsocschngonetintedugrpgovassnomgacsccoorgnetedugovbizinfo123websiteidorgmilcomasnnetedugovconfidmedorgcomplcschnetedugovaccoorgnetgovpresstmassoirseproxaccosoundcasthoptocraftvp4c66orgnetedugovitsmcdirmyboxbarsyedgestacksynologylogintoopencloudnohostwebhopdiskstationi234tcp4hoocgroknoipprivmydsddnsdnsforlohmustransipdscloudfilegear-sgbrasiliafilegearframerbarsybarsyonlinecoprdorgmilcomnomedugovinforgcomnetedugovnameacprorgcomartnetedugovpresseinfoassoinstgouvorgnycedugovbarsydscloudjuorgcomnetedugovminisiteaccoororgcomnetgovorgmilcompronetintedugovbizmuseumnameinfoaerocoopaccoorgcomnetintedugovbizcooporgcomgobneteduorgmilcomnetedugovbiznameaccoorgmilneteduadvgovcoorgcomnetaltgovforgotherhiskeeneticispmanagernomassoprod5476132eastasiacentraluswesteuropewestus2eastus2pnortheurope-01newzealandnorth-01southindia-01southcentralus2-01norwaywest-01eastus2-01westus2-01australiaeast-01italynorth-01israelnorthwest-01swedencentral-01westeurope-01centraluseuap-01taiwannorthwest-01uaecentral-01northcentralusstage-01israelcentral-01mexicocentral-01canadacentral-01austriaeast-01germanywestcentral-01francecentral-01ukwest-01denmarkeast-01polandcentral-01eastus-01westus-01swedensouth-01eastus3-01westus3-01brazilsouth-01centralus-01francesouth-01australiacentral-01westindia-01uaenorth-01jioindiacentral-01canadaeast-01belgiumcentral-01spaincentral-01koreacentral-01chilecentral-01qatarcentral-01westcentralus-01eastus2euap-01norwayeast-01southafricanorth-01brazilsoutheast-01germanynorth-01switzerlandnorth-01switzerlandwest-01japanwest-01southafricawest-01japaneast-01eastasia-01indiasouthcentral-01taiwannorth-01centralindia-01uksouth-01southcentralus-01northcentralus-01eastasiastage-01indonesiacentral-01australiacentral2-01australiasoutheast-01malaysiawest-01koreasouth-01southeastasia-01southeastus5-01northeastus5-01jioindiawest-01rucdnwest1-usfra1-desandboxjls-sto1jls-sto3jls-sto2aglobalabglobalsslmapprodfreetlsmapvpslon-1lon-2ny-1fr-1sg-1ny-2paassnwebpaashostingjelasticnordeste-idcsocuserpagescwebfileblobservicebuscoreatlricnjsjelasticwebsitestoragesezagbinruhuukjptsmyspreadshopmynetnameakamaiorigin-stagingfrom-coipv64dynv6cdn77serveblogadobeaemcloudhicamsprytdnsupno-ipownipde5ovhicpfirewall-gatewaysytesmypsxbarsyusgovcloudapimyamazemyradwebakamaihdsaveincloudfastlylbfrom-lasubsc-paysquare7in-the-bandblackbaudcdnhomelinuxoninfernoctfcloudservebbsdns-dynamiccloudfrontakamai-stagingipifonyham-radio-opsenseeringclickrisingcommunity-profrom-nylocalcertgrafana-devedgesuite-stagingcloudflareanycasteating-organicatlassian-devmydattofeste-iplocaltotorprojectknx-serveredgekeycloudflareglobalcloudyclustercasacamserveftpakamaized-stagingakamaiorigindns-cloudmyeffectboomlabotdashbuyshousestwmailhetemlazure-mobilein-dslthruhereredirectmedynuddnsbouncemesupabaseluyanicloudappakamaicloudfunctionsdebiannhlfanpgafanstatic-accessin-vpnmysynologymafeloappudohomeftptrafficmanagersiteleafseidatmemsetcloudflarecloudaccesskeyword-onazure-apiis-a-chefdoes-itgets-itwebhopselfiphomeipkicks-assedgesuitewindowsserver-ontunnelmolemydissentscrapper-sitecloudflarecnuni5srcfggffiobbzabchrsndenodynuopikddnsvpndnsakadnselastxkinghostvps-hostfastlyhomeunixazureedgeshopselectdontexistmyfritzcloudjiffyalwaysdatasells-itsquaresbroke-itazurefddattolocalat-band-campmeinforumfamilydsazurestaticappsdefinimabplaceddnsaliasdynaliasnow-dnsblogdnsroutingthecloudendofinternetdsmynasakamaiedgemymediapcadobeio-staticakamaiedge-stagingakamaihd-stagingddns-ipprivatizehealthinsurancelive-onkrellianschokokeksmassivegridmysecuritycamerarackmazeserveminecraftfrom-azis-a-geekakamaizedmoonscaleoffice-on-theusgovtrafficmanageradobeioruntimeedgekey-stagingreserve-onlinechannelsdvrdnsdojousgovcloudappcdn77-sslapps-1and1podzoneazurewebsitesdynathomescaleforceyandexcloudvusercontentisa-geekcdn-edgescoaemalcesappwriteazimuthtlonarvobuiltwithrocketnoticeablestorecomwebrecnetperotherfirminfoartslgdloncogoiltdorgmilcolcomplcschgenngonetedugovbiznamefirmmobiacincoorgmilcomnomwebgobnetintedubizinfocomyspreadshopdemongovtransurl123websitehosting-clusterkhplaycistrongsnesosvalervålerxn--vler-qoaossandeheroysandeherøybøboheroyherøyxn--hery-iraxn--b-5gavalerbøboxn--b-5gasandesandexn--hery-iraxn--vler-qoavålerhåreålaahavaofsfvfhlolnlalrlhmfmtmahcostntbuåstrmreigersundmyspreadshopgálsáeidsvolltingvollgildeskalflorøvadsøvardøvanylvenxn--bhccavuotna-k7astrandaxn--kvnangen-k0axn--sknland-fxaxn--mosjen-eyarakkestadhyllestadnannestadvevelstadvaapstenordre-landsondre-landsøndre-landtjieltexn--vrggt-xqadsør-aurdalsor-aurdalheradstordmoldefordeførdeseljefedjeryggehemnexn--krehamn-dxasognegranesøgnebrynetjomevallebykletokkegiskedovretjømehobølvoldasaudatolgasømnaviknadønnasomnadonnatranafrananesnaraumasmolatrænafrænalesjasmølaørstaorstahitrafloraaukraloppafrøyarissasnasahalsagalsaromsaraisaráisafroyasnåsagronghobolfjelltydalårdalardalaskimharamkraanghkekråanghkesorumbarumhurumbærumsørummodumsálátbálátfrognbjugnvåganvagangulenskienløtenlotenstrynvefsnxn--merker-kuaskaunsveiobømlobomloskjåkvardoflorovadsosalatbalatsálatklæbuklabuselbubarduulvikskjakklepprisørxn--nttery-byaeflåeidflahofmilgolholsellomskifetvikdepvgsfhsaskerrisorhamarasnesåsnesrørosrorosxn--slat-5namasoynaroyvaroyluroydyroyaskoyradoyandoyrodoymeloyradøyandøyrødøymeløyaskøylurøydyrøymåsøyværøynærøyhoylandethøylandetdivtasvuodnalørenskoglorenskognesoddtangenxn--tjme-hraxn--smla-hraxn--stjrdal-s1aunjargalillehammerunjárgaxn--hamary-fyadavvenjargaxn--bearalvhki-y4a123hjemmesidegjerdrumxn--brnnysund-m8acxn--tnsberg-q1axn--mlatvuopmi-s4axn--snsa-roaxn--skierv-utaxn--brum-voatysfjordkvafjordeidfjordkvæfjordsongdalenmjondalenmjøndalenxn--gls-elackragerogáŋgaviikagangaviikasørreisasorreisasør-varangersor-varangerxn--risr-iraskiervaxn--frna-woaxn--trna-woakvinesdalleksvikleirvikrøyrvikroyrviksvelvikvenneslaevje-og-hornnessandnessjøenmarnardalvindafjordsandefjordenebakksnillfjordullensvangxn--trany-yuabrønnøysundnamsskoganaustevollxn--stjrdalshalsen-sqbnord-aurdalnord-frontrøgstadtrogstadgrimstadflakstadgjerstadxn--sandy-yuaxn--leagaviika-52bnore-og-uvdalvegarsheixn--rlingen-mxaxn--ggaviika-8ya47hvegårsheikarlsoykvitsoymasfjordenhamaroyinderoyosteroydavvenjárgasauheradguovdageaidnuxn--vre-eiker-k8abronnoysiellakkrødsheradkrodsheradkvinnheradbrønnøyxn--mtta-vrjjat-k7afxn--lrenskog-54akvitsøyvárggátkarlsøyosterøyinderøyhamarøybronnoysundxn--aurskog-hland-jnbbahccavuotnabáhccavuotnagiehtavuoatnastor-elvdalmidtre-gauldalxn--gildeskl-g0akarasjokevenassixn--bievt-0qaxn--yer-znalebesbynessebyxn--hbmer-xqamalselvmålselvxn--unjrga-rtamøre-og-romsdalmore-og-romsdalhareidmelandørlandorlandstrandålgårdsolundalgardafjordåfjorddielddanuorrikautokeinoxn--stre-toten-zcbskodjeaejriestangeliernebamblestokkefauskesnåasesnaasekongsvingerlangevagberlevagxn--flor-jrahattfjelldalostre-totenøstre-totenvestfoldxn--mely-iraálaheadjualaheadjunordreisaxn--troms-zuaxn--lgrd-poacporsangerflatangerstavangerleikangerbremangersamnangergieldakarasjohkaxn--rdy-0nabfrostautsirasnoasatromsaxn--sr-aurdal-l8aflekkefjordjølsterjolsteraremarkhedmarknååmesjevuemienaamesjevuemiexn--vard-jrarollagmeråkermerakerorskogørskogxn--bdddj-mrabdákŋoluoktaxn--osyro-wuaaknoluoktatrysilskjervøymandaljondalbindalrindalmeldalsuldalorkdalsigdalalvdallærdalhurdalsirdalverdallerdallardaloppdalåseralaseralhadselkragerødivttasvuotnaoverhallasteinkjerxn--hnefoss-q1askedsmokorsettromsøxn--dyry-iravestre-totenmuseumxn--sandnessjen-ogbrahkkeravjufylkesbiblbájddarbajddarxn--laheadju-7yarennesøyxn--koluokta-7ya57hxn--hgebostad-g3aleirfjordstorfjordbalsfjordbåtsfjordbatsfjordmuosátbievátloabátkárášjohkanøtterøyxn--mjndalen-64anordkappláhppilahppialstahaugsiljanverranrøykenroykenhaldenlyngenbergenhortenhønefosshonefosstroandinbeiarnvarggatosoyroosøyrotromsoidrettmuosatbievatruovatloabatvoagattynsetnessetxn--indery-fyaskánitskanitraholtråholtxn--ystre-slidre-ujbandebusarpsborgbearduxn--karlsy-fyahordalandjorpelandjørpelanddeatnuringsakersør-odalsor-odalxn--slt-elabringerikeaudnedalnittedalnissedalhemsedalslattumsurnadalxn--blt-elabelverumstjørdalnaustdalhjartdalgjøvikfyresdalhasviknarviklarvikgjovikmalvikgamviklenvikporsgrunnstjordalengerdaldrobakdrøbakxn--msy-ula0hvestvagoyxn--vgan-qoaxn--ryken-vuaxn--lten-graxn--stfold-9xaxn--hpmir-xqaxn--lury-iramálatvuopmimalatvuopmitysværkirkenesbirkenesmoskenesbáidárxn--fjord-lraxn--rdal-poabahcavuotnabáhcavuotnaxn--frde-gralindåsbearalvahkixn--hobl-iraráhkkerávjuxn--loabt-0qavågåáltábodøsundlundraderådeetnetimeholeauregrueoddavagavegaranatanaarnasolasulaaltalekafusavangbergkvamåmliamlibokntinnroangranosenoslobodorøstroststatåmotamotivguprivøyeroyerliermossvossxn--nvuotna-hwalusterlunnermarkerhábmerhabmerhvalerfjalerxn--rholt-mratysvarbaidarfitjargaularhápmirhapmirmelhusfosnesøksnesoksnestysneshemnesevenesflesbergeidsbergtonsbergtønsberglindasxn--sndre-land-0cbnamsosxn--srum-graøystre-slidreoystre-slidrevestre-slidretrondheimbalestrandxn--langevg-jxaaustrheimxn--skjk-soavagsoyaveroysandoykarmoyfinnoytranoyvestbytranbysykkylvenxn--hyanger-q1aspjelkavikandasuoloxn--fl-ziaxn--drbak-wuastathellexn--sr-varanger-ggbtelemarkxn--bhcavuotna-s4axn--porsgu-sta26fčáhcesuolocahcesuoloakrehamnåkrehamnsandøykarmøyfinnøytranøyvågsøyaverøynamdalseidxn--lesund-huabadaddjaxn--vegrshei-c0axn--btsfjord-9zagildeskålporsanguxn--trgstad-r1anávuotnanavuotnahammerfestxn--sgne-graxn--brnny-wuacibestadharstadnarviikaevenáššivestnesgjemnessandnesagdenesrennesoyxn--avery-yuaxn--tysvr-vrabearalváhkikongsbergspydebergrandabergxn--andy-iradavvesiidaxn--krdsherad-m8aporsáŋgufredrikstadbjerkreimringeburennebuaurskog-holandnotteroyxn--vgsy-qoa0jxn--rmskog-byaskierváivelandbyglandfrolandaurlandforsandxn--bjddar-ptamidsundålesundalesundfetsundfarsundovre-eikerøvre-eikerakershusxn--moreke-juasørfoldøstfoldostfoldsorfoldhøyangerhoyangerlevangerorkangertanangerxn--vestvgy-ixa6olillesandulsteinxn--rennesy-v1agranvinskjervoyxn--klbu-woalavagisxn--h-2faxn--ryrvik-byakafjordkåfjordseljordfolkebiblxn--gjvik-wuajevnakerxn--kfjord-iuabudejjuxn--kranghke-b0axn--davvenjrga-y4axn--rland-uuaxn--ldingen-q1axn--mlselv-iuaxn--rady-iraxn--linds-prabrumunddalxn--ygarden-p1amo-i-ranaeidskogrømskogromskoghjelmelandxn--finny-yuaxn--sr-odal-q1axn--skjervy-v1aballangenkvanangenkvænangengratangenxn--hmmrfeasta-s4acvossevangensuohkanxn--rde-ulaxn--mli-tlaxn--ksnes-uuanordlandskanlandskånlandsortlandfuoiskuxn--rros-graxn--hcesuolo-7ya35bxn--eveni-0qa01gagaivuotnagáivuotnaxn--seral-lradrammenmodalenmosjoenjan-mayentorskensteigengloppenxn--snes-poamatta-varjjatxn--sr-fron-q1aomasvuotnajessheimbådåddjåxn--krager-gyaxn--kvfjord-nxaxn--asky-iraxn--snase-nraxn--bidr-5nacholtålenxn--vads-jraxn--jlster-byamosjøenxn--rst-0nastavernxn--ostery-fyaxn--oppegrd-ixaxn--sknit-yqaxn--risa-5naoppegårdskiptvetrendalenholtalenxn--mot-tlaxn--lhppi-xqaxn--holtlen-hxaxn--srreisa-q1akopervikxn--muost-0qaxn--bmlo-grahokksundkvalsundegersundxn--karmy-yuaullensakerxn--hylandet-54axn--kvitsy-fyaxn--bod-2nalangevågberlevågkristiansandxn--rsta-frahornindalstjørdalshalsenstjordalshalsensandnessjoenhámmárfeastaxn--lrdal-srasør-fronsor-fronnord-odalkristiansundmátta-várjjatvestvågøynesoddennotoddenbuskerudøygardenoygardensalangenlavangenralingenrælingenlodingenlødingenleaŋgaviikalaakesvuemieleangaviikauenorgexn--srfold-byaaskvollxn--rskog-uuaxn--nry-yla5gxn--vry-yla5ghammarfeastaxn--rhkkervju-01afxn--givuotna-8yakommunekrokstadelvanedre-eikerhagebostadhægebostadxn--berlevg-jxakviteseidxn--s-1faxn--l-1faxn--nmesjevuemie-tcbafuosskomoårekemoarekexn--lt-liacxn--jrpeland-54asvalbardoppegardholmestrandtvedestrandsogndalsokndalarendalsunndalfolldalxn--krjohka-hwab49jlyngdaletnedalnorddalsaltdalgausdalskedsmovaksdalgjesdalstordalxn--frya-hraaarbortedrangedalxn--smna-graaurskog-hølandxn--vg-yiabtjeldsundhaugesundlindesnesxn--mre-og-romsdal-qqbxn--dnna-gradyntmpheremerseineshacknetenterprisecloudmineaccomaorimāoriorgmilcriiwigennetschoolhealthkiwigovtgeekxn--mori-qsacloudnsparliamentcomedorgcompronetedugovmuseumwebsitekinservicebarsywebsitebuildereerobookheimdnsleapcelleero-stagetechcrscsslorigingohomecdbedeeeiemesecabgngilnlalplchfisiincnnoroptatitmtltruauhulumkdkukskjplvtrgrfrkrhrusesismycynzcznetinteduassoososcloudstgbetaaezaeuhkusjshatenadiarycdn77hoptozaptois-a-knightmyftpno-ipjpnddnssdpdnsspdnsbarsysweetpepperis-a-bruinsfanis-very-sweetservegameis-a-soxfanhomelinuxcdn77-secureservebbsmisconfusedwebredirectblogsitefreedesktopcouchpotatofriestoolforgeaccesscamis-lostreadmyblogsmall-webfedorapeopleserveftpis-a-celticsfanmywirepotagertwmailin-dslsellsyourhomeread-booksfreeddnscable-modemis-savednflfanufcfanmlbfanstuff-4-saleendoftheinternetin-vpnmy-firewallhomeftpis-localis-a-chefboldlygoingnowherewebhopselfipkicks-assroxatunkcamdvrfedoraprojectgotdnsdvrdnsdyndnspubtlspimientahomeunixdontexistfedorainfracloudwmflabsfspagesbmoattachmentsteckidsfamilydsdnsaliasdynaliasnow-dnscloudnsdoomdnsduckdnsblogdnshomednsroutingthecloudendofinternetdsmynasip-dynamicpoivronhttpbinmyfirewallis-very-evilmysecuritycamerais-a-linux-userwmcloudis-a-geektuxfamilyis-a-candidatedoesntexistis-very-badhobby-sitegame-hostaltervistais-foundis-a-patsfandnsdojohepforgepodzonedynservcollegefanis-very-goodfrom-meis-very-niceisa-geeknerdpolacmedsldingorgcomnomgobabonetedupleskaemhlxmyboxrockyprvcydeuxfleurspdnscodebergheyflowstatichostorgmilcomnomgobneteduorgcomeduiorgmilcomngonetedugovcloudns1337ngrokacorggogfamcomwebgobnetedugokgopgkpgovgosbizpasaugumicsopozpapuwmwsrprusiskwpspkppspkmpspokeoiawsawifoumsdnskokwpmuppuppsppiwwiwoowuzswkzoschrzpisdnwzmiuwwitdpssewsseumigugimoirmpinbwinbwiihupporzgwgriwupowwskrwioswuozstarostwokonsulattmpccopruszkowmyspreadshopostrodakartuzyopolegminamediaustkazgorajgoraolawailawalomzawloclradombytomjaworznotargilubinkoninzagantorunkutnokepnonakloczestsopotsanokturekplockslasksklepzarowlukowmedaidgdaorgmilrelcomnomatmgsmartneteduelkgovwawsossexbiztgorysejnytychypomorzeboleslawiechomesklepsdscloudunicloudzakopanelegnicarawa-mazbydgoszczswidnikkrasnikwloclawekbielawamragowograjeworealestatebeskidykaszubymalopolskaprzeworskswiebodzinlecznadfirmaszkolawarmiagdyniamiastakazimierz-dolnymalborkswidnicadlugolekaostrolekapodlasieelblagtravelsimplesitezachpomormielecszczecinnieruchomosciwalbrzychlezajsklublinbedzinpoznanwielunmielnooleckostarachowicedkontopowiatwroclawrybniksuwalkileborkslupskgdanskostrowwlkptarnobrzegtourismwegrowkrakowglogowyou2pilanysamailwrocinfoagroautobeepshoppriviqhslapypiszlodzcfolksecommerce-shopmazurypulawyskoczowrzeszowpomorskiezgierzkaliszolkuszlowiczostrowiecsosnowiecmazowszewodzislawbialowiezazgorzeleckatowicepabianicejelenia-gorawolominkarpaczsieradznowarudaczeladzkonskowolaskierniewiceswinoujscieturystykabieszczadycieszynketrzynolsztynbialystokbabia-goraprochowicewarszawastalowa-wolapolkowicegorlicegliwiceponiatowalimanowalubartowaugustowkobierzyceopocznognieznoszczytnokolobrzegshoparenapodhalebielskoklodzkostargardatwithplayitownnamecoorgnetedugovacorgcomproestnetedugovbiznameislaprofinforechtngrokmedaaaacacpaenglawjurbarbarsykeeneticavocatacctcloudnsorgcomsecplonetedugov123paginaweborgcomnetintedugovnomepublidkinbarsygovx443cloudnsorgmilcomnetedugovcooporgmilcomschnetedugovnamecomcannetlibassoaemclantmcontstoreorgcomnomrecwwwbarsyfirminfoshopartsstackitmyddnswebspacelima-cityacincooxorgedugovbarsybrendlyhbvpsvpsspectrumlandinghostingacppmordoviamcprecbgorgmilcomspbnetintedumsknovgovbirrasmcdirmytismircloudvladimirnalchikadygeyamarinepyatigorskmyjinobashkiriaeurodirvladikavkazna4ugroznykustanaikalmykiacldmaildagestaniranbuildcloudcanvaliaravalwixdevelopmentappwritemigrationneedleverceldatabasestackitcodereplravendbonporterlovableaccoorgmilnetgovcoopmedorgcompubschnetedugovservicemecomygovorggovtvmedorgcomnetedugovinfoedgfacbmlonihkutwpsryxzbdtmacfhppmyspreadshopbrandpartiorgcomfhvpress123minsidaitcouldbeworlanbibkommunalforbundfhskiopsyskomvuxkomforbnaturbruksgymnloginlineorgcomnetedugovenscaledeuusentsurgebotdaorgmilcomnetgovnowteleporthashbangplatformlovablebarsyshopwarebasehoplixbarsyonlinemsf5gitappgitpagewawamscofigma-govcaffeinefigmacanvasoltstscwputerbarsysupportchatgptsquareomniweopensocialcpanelplaycodenotionnovecorewpsquaredpreviewjelecyonbyensrhtfastvpspieboxconvexjouwwebheyflowplatformshloginlinemadethissourcecraftclouderaorgorgcomartedugouvunivmeorgcomnetedugovsurveysstatichfheiyuxs4allprojectmyfastubervibehostapp-ionosdeployagentmecoorgcomschnetedugovbizcncostoreorgmilcomneteduembaixadaconsuladokiraranohoprincipesaotomeheliohobarsystorebaseshopwaresellfyaiabkhaziavologdamordoviapenzalenugsochinavoiexnetspbmsknovnorth-kazakhstanashgabadkareliaarmeniageorgiavladimirnalchikivanovobukharaadygeyakhakassiakalugakrasnodarjambylaktyubinsktroitskbryanskobninskkurganazerbaijanpokrovskbashkiriatselinogradvladikavkazmurmansktulatuvamangyshlaktashkentchimkentgroznykaragandatermezarkhangelskkustanaikalmykiabalashoveast-kazakhstankaracoldagestantogliattibarsyredorgcomgobedumirenknightpointaccoorgjelasticdiscoursecleverappsschacmiincogoornetonlineshopcogoorgmilcomwebnicnetintedugovbiznametestcoorgmilcomnomnetedugovorangecloudpersoindorgcomfinnatnetgovensmincomtourismintlinfox0611oyaorgmilcomnetedugovquickconnectvpnplusnettprequalifymeaddrmyaddrntdllwadlnctvavdrk12orgmilpolbeltelcomwebgennetedutskkepgovbbsbiznameinfocoorgmilcompronetedugovbiznameinfobetter-thanworse-thansakurafromdyndnson-the-webmymailerorgmilurlcomneteduidvgovmydnsgameclubebizmeneacsccogotvorhotelmilmobiinfovodteiflgplkmsmsbcckhincndnvncoztltmkckppzpdprvcvkvlvcrkrkscxuzchernovtsyrivneyaltaodesavolynrovnolutskltdinforgcomnetedugovbizvinnicazhitomirternopilpoltavakropyvnytskyizaporizhzhiasevastopolsebastopoluzhgoroduzhhorodkharkovkharkivvinnytsiakhmelnytskyizaporizhzhecrimeaodessazhytomyrnikolaevcherkassydonetskluganskluhanskkirovogradivano-frankivskchernivtsikrymkievkyivlvivsumyzakarpattiamykolaivcherkasychernigovkhersonchernihivdnipropetrovskdnepropetrovskkhmelnitskiyneacsccogoorusorgmilcomedugovmyspreadshopadimono-ipbarsybarsyonlinelayershiftnh-servretrosnubapicampaignservicelugaffinitylotteryweeklylotteryraffleentrygluglugsmeaccoindependent-inquestnimsitecopropymntltdorgplcschnetgovnhsbarsyindependent-commissionindependent-reviewpolicepublic-inquiryindependent-panelconnhospindependent-inquiryroyal-commissionoraclegovcloudappscck12libaws-govccphxcclibpvtparochchtrcck12libcceatonk12coglibtecgendstmusann-arborwashtenawcck12glghcck12sealibforksolympiabainbridge-islkeyporthoquiamyarrow-pointcentraliaport-townsendsequimport-ludlowrentonsilverdalebremertonredmondsheltonbellevueport-orchardport-angeleskingstonchehalisaberdeengig-harborseattlepoulsboidmdndsddemenegacalamaiavawapailalflnmdcncscohnhmihiviwiriinmntnmocoutvtctmtgunjokakwvnvprarorasmskstxwynykyazisadninsnngosrvis-bymircloudservernamepointtoenscaledland-4-salefreeddnsstuff-4-saleazure-apinoipdatabricksappscloudnsgolffanheliohostazurewebsitesgvorgmilcomgubneteducoorgcomnetd0egvorgmilcomnetedugovmydnsiacostoree12orgmilcomnomwebgobbibrectecnetintedugovraremprendefirminfoartseducok12orgcomnethidnsidacaiiosonlahanamhanoicamauhueorgcompronetintedugovbizbacninhtayninhhoabinhnamdinhtravinhhaiphongvinhlonghaiduongquangnamquangtrithuathienhuequangninhbacgianghaugiangquangbinhsoctrangbentrethanhphohochiminhdanangkontumhatinhkhanhhoathanhhoahealthgialailaocaiyenbaibackanngheanlonganphuyenphuthocanthodaklakdongnainameinfovinhphucdongthapkiengiangtiengiangquangngailaichaulangsonlamdongdaknonghagiangangiangcaobangbinhduongninhthuanbinhthuanbaclieuthaibinhninhbinhbinhdinhtuyenquanghungyenbaria-vungtauthainguyendienbienbinhphuocschbizputerimagine-proxyorgcomnetedugovcloud66advisormypetsdyndnsxn--8dbq2axn--4dbgdty6cxn--5dbhl8dxn--hebda8bxn--80auxn--d1atxn--c1avgxn--o1acxn--o1achxn--90azhxn--55qx5dxn--uc0atvxn--od0algxn--wcvs22dxn--gmqw5axn--mxtq1mxn--12c1fe0brxn--h3cuzk1dixn--12co0c3b4evaxn--12cfi8ixb8lxn--o3cyx2axn--m3ch0j3axn--j1adpxn--90amcxn--90a1afxn--h1ahnxn--j1ael8bxn--h1alizxn--c1avgxn--j1aefxn--80aaa0cvacxn--41acaffeineexeopentunnelbotdashtelebitorgtmaccoagricorgmilnomwebnicngonetaltedugovlawnisschoolgrondaraccoorgmilcomschnetedugovbizinfoprg1-zeropstritonstackitlimazeropsaccoorgmilgovяспборгкоммскбизмирсамаракрымсочиакодпроргобрупрצהלממשלישובאקדמיהองค์กรธุรกิจรัฐบาลศึกษาทหารเน็ต教育網絡組織公司政府個人닷넷한국澳门新闻澳門联通家電嘉里招聘通販닷컴삼성コムგეбгрфеюadcdbdgdidmdsdtdaebedeeegeiejekemenepereseveyegabacalamanauavapaqasazacfbfafgfnfpfwftfbgcgagggegkgngmgsgpgvgtgugilmlnlalclglplsltlhmimjmkmmmomambmcmdmfmgmzmpmsmtmgbbblbsbecccacnclcmcvctcscmhkhghchbhthphshlinikifigiaibicivisikninhnmncnbngnsnpnvntnjoionomobocoaofodorosotoptstttytatbtetgtithtmtltrusuvuaucueuguhulumunufjdjbjtjsjlkmkhkfkdkcktkukskpkgpmpnpkpjpgqaqmqiqsvtvcvbvmvlvrwpwtwzwbwcwawgwkwmwtrsrprgrfrercrbrarnrmrlrkrirhrwsusrssspsgsesbsaslsmsissxmxaxcxuypysylymykygybycyuztzsznzmzkzdzczbzazελευ世界台灣购物公益点看臺灣网络書籍在线网站手机机构大拿游戏信息台湾谷歌慈善商标香港中国餐厅网址中國商城食品微博政务移动集团公司八卦商店健康网店政府时尚佛山中信娱乐广东企业homedepotengineeringاماراتrepublicankuokgroupversicherungchannelcitadelxn--pgbs0dhxn--b4w605ferdstatebankwebsitexn--mgb9awbf亚马逊淡马锡alibabaxn--ngbc5azdxn--mgbbh1axn--45br5cyltoshibabuildworldcloudtradeguideplacespacedancemoviephoneprimesmilebiblestyleappleazurestoreskypegripexn--l1accdrivelottehorsehouseleasechasereisestadahondaomegaaetnaamicaninjanokiamediadeltavodkaedekaosakapizzaslingemailgmailtirolshelltmallfinallegaltotalhotelamfamforumrehabmusicciticricohcoachwatchboschearthfaithirishmiamiarchidubaiguccipraxiみんなストアセールcanonsalononionnikonepsonkoelngreensevencrownikanoradioaudioweiboglobopromogalloyahoociscorodeovideomangobingotokyovolvolottokyotophotosmartsportquesttrusthyattjetztadultcymrubaidutushuxn--kprw13dubankclickblackmerckgroupsharpcheapnowtvxn--h2brj9cקוםհայоргсрбмонкомбелмкдқазрусукрمصرقطرعربكومdadcfdmedwedredphdthdbidpidkrdmsdltdiceonewmeglemoerwecfageacbanbambaaaammakianraspacpaaxawtfbcgaegongingaigvigorgdogdhlmilrilonlaolloluoljllcalgalnflafltelsrlfrllplkimibmcamcombommomifmabbjcbscbwebcabnabtabmlbpubabcbbcnecincpncllcstcwtcpwcnyckfhbzhovhmoiskiobisbitcifyituipinvinwinxincbnbcnmanfangdnmenrenkpnmtnyunrunfununobiojioriohbogmofooboooooacoecoceongoproartistottnttbbtcateatlatvetpetbetnethktmitfitintjothotgotdotbotprueduicujnjyouinknhktdkappsapgapmapdnptopgopllpjmpzipvipripesqtrvdtvitvdevmovgovhivnrwlawsewnewbmwwownowhowdvrftrmtrsfrbarcartvscrseusawsupsubssbsadsddsldssasbmsmlsxxxboxfoxgmxtjxsextaxbuyflydiysoyjoyskypaydaygayxyzanzbizwebersenerpokerlameractortatarsolarລາວคอมไทยtourslocusnexuslexusgiftsbeatsboatspartspressglassswissकॉमनेटtiresgivescodeshomesgamestunesshoescardswalesloansvegastoolsdealsautosparisファッションworkssucksrocksxeroxforexfedexpartylillymoneystudyrugbytoraytoday中文网xn--unup4y天主教飞利浦新加坡enterprises我爱你嘉里大酒店christmasxn--fct429kholdingsxn--8y0a063axn--mgbx4cd0ablifestyleabogadoallstatenetbankكاثوليكxn--s9brj9cxn--gk3at1ebestbuycharityxn--55qx5dmicrosoftpropertybasketballhomegoodscorsicajewelrygallerygrocerysurgerycountrybrusselsverisignferreroxn--czr694bhdfcbankcommbanksoftbankپاكستانپاکستانnextdirectالسعوديهالعليانxn--h2brj9c8cxn--80adxhksshikshaxn--mgbai9azgqp6jcuisinellabarclayscatholicxn--kpry57dcompanyxn--xhq521bblackfridayxn--mgba3a3ejtsandvikxn--d1acj3bacademydownloadمليسياxn--j1amhxn--w4r85el8fhu5dnraipirangaathletaxn--fhbeixn--mgbqly7cvafrzuerichxn--c2br7gஇலங்கைcontractorsxn--io0a7igraphicsinsurancetemasekxn--xkc2al3hye2amotorcyclesphotographydirectoryplumbingxn--vhquvclothingtrainingcleaningwilliamhilllightingxn--mgba3a4f16ashoppingcateringeducationokinawapicturesventuresproductionsxn--9et52uwalmartഭാരതംsupportrealestatecapitalonexn--nqv7fs00emaauspostfloristdentistxn--qxamgodaddybradescobargainsmitsubishikerryhotelsxn--9dbq2axn--3pxu8kimmobilienxn--fjq720axn--mgbtx2bholidaymckinseymadridbusinessbuildershelsinkixn--4gbrimмоскваالسعودیةcoffeedegreelacaixapartnersalsaceofficeabbvievoyageorangegeorgeonlinechromemobilekindlegoogleoraclecircleschulesecureinsurexn--mgba7c0bbn0aestatexn--mgbc0a9azcgcruisehangoutxn--vuq861bxn--42c2d9arexrothfirestoneuniversityxn--nnx388alifeinsuranceextraspaceонлайнvermögensberatersoftwarexn--fiqs8sxn--mgbab2bdxn--w4rs40ltiendaभारतम्africatoyotaotsukasakuracameracreditcardnagoyaconsultingnetworkjunipertheatermonsterprogressivepioneerxn--55qw42gracingdatingvotingvikinglivinggivingxn--bck1b9a5dre4cbrotherweatherjoburgفلسطينlplfinancialxn--clchc0ea0b2g2a9gcdfutbolschoolsocialglobaldentalwoodsidechanelairtelmatteltravelrealtorwebcamstreamభారత్unicomalstomxn--nodexn--6frz82gmuseumfurniturexn--rvc1e0am3exn--mix891faccenturexn--11b4c3dismailineustardiscountquebeccomsecclinicservicesxn--y9a3aqxn--c1avgswatchchurchsearchالاردنmarketingcontacthealthmonashshoujisanofitaipeiamericanexpresssuzukiアマゾンクラウドポイントbhartiグーグルxn--mgberp4a5d4armemorialxn--1qqw23alondonmormoninstitutevisionbostonnortoncouponmaisonamazonvirginberlindesigndurbanolayannissananquanxihuanhitachikaufengardenreisenbayerntechnologydatsunxn--90a3aclatinocasinostudiophysioxn--ngbe9e0apharmacytattootaobaoaramcoexpertreportabbottdirectselectimamatfairwindspictettargetmarketintuittravelersinsurancecreditdupontryukyusuppliesxn--tckwebnpparibasschmidtmerckmsdyodobashirestaurantbridgestonecricketxn--fpcrj9c3dbostikbroadwayattorneylefrakemerckxn--fiq228c5hscareersfarmerswinnersflowersxn--wgbh1cguitarsxn--54b7fta0ccxn--p1acfmakeupgalluplandroverxn--kcrx77d1x4agoldpointbauhausxn--mgbayh7gpahiphopplaystationxn--mgba3a4fraxn--eckvdtc9dhyundaixn--gckr3f0fistanbulticketsmarketsflightschintaireviewsxn--3e0b707ewindowsxn--fiqz9sfinancialxn--fzys8d69uvgmابوظبيdiscoverreviewবাংলাxn--5su34j936bgsgmoscowobserverapartmentsдетиارامكوсайтeurovisionxn--i1b6b1a6a2exn--xkc2dl3a5ee0hتونسموقعبارتڀارتشبكةعمانبيتكعراقreadkredbondlandbandfundfoodprodgoldfordtubecafesafelifeggeeieeefreefagepagegugezonewinememenamegamesaleablebikenikelikecarecbreherefiresaveloveliveblueartedatesitevotecaseluxebofamodaltdaasdatiaayogasinavanashiaasiajavabbvatevavivadatazaraarpacasavisasncfprofmaifsurfgolfdvagsongbingpingwangkpmggoogblogpohlfailcooldellcalldeallidlsarlfilmteamroomfarmimdbarabclubhdfcicbchsbcgmbhrichtechfishdishcashminiernikddiaudiwikimobitaxicitikiwidesiqponskinloanakdnwienopenporncerntownimmolimoolloinfonicofidolegosaxozeroaerovivoautovotomotofastbestresthostpostnextlgbtchatseatgiftmeetdietreitmintrentgentspotscotguruitausohumenucyoubanklinkpinkdclktalksilkbookseekworkrsvpaarpjeepshopcoophelpcamppccwshowbeerstarruhrflirweirhaircarsparsjprshausplusnewstipstoysjobskidsfanspicsdocsxboxamexsexynavycitysonyarmyallybabyplaydeliverybuzzgbizlamborghiniphilipsලංකාಭಾರತfitnessexpresslanxesspfizercenterwalterlawyersoccercareerkosherbrokerlockerdealerdoctorauthorxn--mgbqly7c0a67fbcvermögensberatungjaguarxn--pssy2uxn--hxt814eflickrrepairrogersairbusxn--mgbai9a5eva00beventsyachtsxn--t60b56aভাৰতভারতभारतभारोतviajeshermeshughesxn--j1aefसंगठनvillasଭାରତclaimshotelsભારતzapposphotosjuegoscondostatamotorsgratistennisਭਾਰਤtkmaxxtjmaxxschaeffleryandexxn--80aswgrealtysafetybeautyluxuryxn--3ds443gsupplyfamilyxn--o3cw4hhockeysydneyxn--90aenissayalipayenergycomputeragencyxn--rovu88b電訊盈科xn--gecrj9cstatefarmaccountantaquarelleolayangroup香格里拉xn--p1ai组织机构xn--1ck2e1bxn--mgbt3dhdschwarzموريتانياabudhabinowruzkomatsufujitsuhospitalxn--80asehdbxn--mgbtf8flxn--j6w193gxn--yfro4i67oprudentialxn--flw351ecruisescoursesrecipesxn--e1a4cferrarixn--ses554gxn--wgbl6awatchesstaplessinglesxn--mgbcpq6gpa1axn--otu796dpropertiescreditunionxn--mgbah1a3hjkrdstockholmhisamitsuالسعوديةstcgroupdomainsoriginscouponsbloombergclubmedfroganslimitedxn--80aqecdr1aexposedinternationalequipmentbarclaycardxn--q7ce6axn--mgbi4ecexpprotectionassociatesconstructionxn--cck2b3bxn--45q11candroidfoundationישראלxn--mgbca7dzdocliniqueboutiqueengineerxn--qxa6asystemsfirmdalefashionauctionxn--nqv7finfinitirentalsreliancetradingweddingfishinghostinggentingbookingcookingxn--3hcrj9cgraingerxn--czrs0tdemocratsamsungyokohamaxn--h2breg3evexn--nyqy26alundbeckmelbournevacationssolutionsfrontierxn--vermgensberatung-pwbmanagementxn--cg4bkixn--mgb2ddeslincolnhamburgsandvikcoromantblockbusterairforcebarefootxn--4dbrk0ceinvestmentsfeedbackcommunityxn--ngbrxالبحرينdiamondsamsterdamhealthcareredumbrellaxn--mxtq1mxn--2scrj9cagakhanxn--mgbpl2fhкатоликcaravanசிங்கப்பூர்richardlimortgageamericanfamilyxn--fzc2c9e2cscholarshipssaarlandxn--imr513nvlaanderensamsclubgoodyearkitchenஇந்தியாweatherchannelallfinanzxn--kput3iالسعودیۃxn--90aisxn--efvy88hالجزائرxn--mgbaam7a8hexchangejpmorganxn--tiq49xqyjfidelitysecurityxn--mk1bu44cwanggouxn--fiq64bxn--6qq986b3xlxn--mgbbh1a71exn--80ao21amarshallsxn--5tzm5gtravelerspanasoniclatrobeyoutubeaccountantsxn--rhqv96gxn--cckwcxetdanalyticsxn--ygbi2ammxبازاربھارتسوريةorganicfreseniusسورياxn--9krt00axn--qcka1pmcxn--jlq480n2rgdeloittesciencefinancexn--jvr189mxn--30rr7yhomesensehotmailbaseballfootballleclercboehringerxn--q9jyb4cxn--mix082fاليمنهمراهpolitieسودانايرانایرانnetflixyamaxunxn--lgbbat1ad8jcollegestoragecapetowncolognekerrypropertiesxn--mgbgu82axn--ogbpf8flxn--czru2dwhoswhociprianilasallexn--g2xx48cforsalebanamexaudiblexn--vermgensberater-ctbxn--zfr164bericssonvanguardxn--45brj9cindustriestheatremarriottxn--3bst00mcomparexn--mgberp4a5d4a87gcapitaldigitalالمغربbarcelonashangrilaxn--d1alfcalvinkleinwwwcitysapporokawasakinagoyasendaikobekitakyushuyokohamackjp`,DL=SL.length,OL=wL.length,kL=new Uint32Array(OL),AL=new Uint32Array(OL),jL=new Int32Array(DL).fill(-1);for(let e=0,t=0;e<DL;e+=1)for(let n=CL[e];n<CL[e+1];n+=1){kL[n]=t;let r=t+wL[n],i=5381;for(let e=r-1;e>=t;--e)i=i*33^EL.charCodeAt(e);AL[n]=i>>>0,wL[n]===1&&`orgmilcomschnetedugovdrrformsfeedbackofficialaccoorgmilschnetgovmagazinemediaunioncargopilotgroupcaarespressworksaerodromeworkinggroupair-traffic-controlaircraftaccident-preventioneducatormarketplaceambulanceinsurancecateringairportrepbodyenginesoftwaremodellingair-surveillanceconsultingchartertrainermaintenanceservicesdesignflightskydivingfreightassociationstudentgroundhandlingdgcafuelclubtaxicrewshowballooningexpresstraderbrokerauthoragentsairtrafficjournalistsafetyconsultantmicrolightaccident-investigationparachutingequipmentproductionfederationrecreationscientistnavigationengineertradingglidingleasingresearchpassenger-associationentertainmentparaglidinghangglidingaerobaticrotorcraftemergencycertificationgovernmentaeroclubexchangelogisticschampionshiphomebuiltcouncilconferencecontrolairlinecivilaviationjournalorgcomnetedugovcoorgcomnomnetobjofforgcomnetuwukiloappsframerorgmilcomnetedugovcoradioorgcomnetcommuneedogpbcoitgvorgedugov*spreviewfrontendrelayononstagingupid*mtls*privatelinktypedreamdeveloperbravemochawindsurfaivenmirenupsunwnextbegetngrokclerkwale2bwebcsbrunputerflutterflowspawnbaseshiptodaymagicpatternsnetlifyondigitaloceanrailwayhostedclaudehasurabotdashvercelgithubluyanigadgetreplitcloudflaretelebitedgecomputeevervaultexponyatnoopencrpplxzeaburwasmerframerzeropsrocketpreviewconvexmedusajsspritesonherculeseasypanelstreamlitglideossnowflakemesserliloginlinehackclubcodepennorthflankbase44corespeedleapcellngrok-freeclerkstagelovableon-fleek*us-west-3ap-south-2us-central-2us-central-1eu-central-1ap-south-1us-west-2us-east-2eu-north-1ap-north-1us-west-1us-east-1*rcloudintsegorgmilcomgobbetnetintedugovturmusicasenasamutualcoopip6uriurnin-addre164homeirisgovdixdaemoncloudnssthwien*inexexkunden4accogvormymyspreadshop4lima2ixortsinfofuturecmsfuturehosting12hpprivfuturemailinglima-cityfunkfeuer123webseitednshomemelmyspreadshopcloudletswasantqldvicactnswtascatholicwasaqldvictasidwasantozqldorgcomvicasnactnetedugovnswtasconfcomairflowlambda-urltransfer-webappairflowtransfer-webapptransfer-webapptransfer-webapp-fipstransfer-webappeu-west-3ap-south-2eu-south-2eu-central-2ap-southeast-3ap-southeast-4ap-northeast-3eu-central-1mx-central-1me-central-1ca-central-1il-central-1ap-northeast-1ap-southeast-1me-south-1af-south-1eu-south-1ap-south-1ap-southeast-7us-west-2eu-west-2us-east-2eu-north-1ap-southeast-2ap-northeast-2ap-southeast-5us-gov-west-1us-gov-east-1ca-west-1us-west-1eu-west-1us-east-1ap-east-1sa-east-1privatenotebookstudiolabelingnotebookstudionotebooknotebook-fipslabelingnotebookstudionotebook-fipsnotebookstudio-fipsnotebook-fipsnotebookstudionotebook-fipsnotebookstudioeu-west-3ap-south-2eu-south-2eu-central-2ap-southeast-3ap-southeast-4ap-northeast-3eu-central-1me-central-1ca-central-1il-central-1ap-northeast-1ap-southeast-1me-south-1af-south-1eu-south-1ap-south-1us-west-2eu-west-2us-east-2eu-north-1ap-southeast-2ap-northeast-2experimentsus-gov-west-1us-gov-east-1ca-west-1us-west-1eu-west-1us-east-1ap-east-1sa-east-1onrepostsagemakercopporgmilcompronetintedugovbiznameinfoshoprsorgmilcomnetedugovbrendlyresolvenzauscotvstoreorgcomnetedugovbizinfoidacaicoittvorgmilcomschnetedugovinfocloudezproxysiteacmymyspreadshopkuleuvenwebhostingtransurl123websitecloudnsinterhostsolutionsddns5476103298edgfacbmlonihkjutwvqpsryxzbarsycoororgcomedumyftpno-iporxcloud-ipfor-somemmafanfor-morewebhopselfipjozidyndnscloudnsdscloudfor-thefor-betteractivetrailcoeconorestooteorgcomeconeteduassurmoneyafricaarchitectesrestaurantloisirstourismavocatsinfoagrounivcoorgcomnetedugoviatvdeportesaludtksatorgmilcomwebgobnetinteducienciaboliviarevistacooperativaempresanombreindustriamusicapatriamedicinademocraciapoliticapuebloindigenaplurinacionalarteblogwikiinfoagrotransportenoticiasprofesionalacademiaeconomiaecologiamovimientotecnologianaturalsimplesitecepesebamapadfmgalampbacscpirngorotomtrjspaprrprrsesmscepesebamapadfmgalampbacscpirngorotomtrjspaprrprrsesms*biaamfmtcmptvfeirasampajampanatalbelemananiradiog12medindfndbmdtrdthepoaggfjdfdefinfenflegsegongengcngorgzlgslglogppgmillelqslcimcomnomadmjabimbbibbsbabcrectecsjcetcpscpvhudieticriapipsiecnbiorioecogeoteoodoproatoartfstmatvetdetbetnetcntnotfotgrueduajuespappreptmpemparqsrvadvdevgovntrturagrjorfarjusmusdesvixxyzcozfozslzbhzmaringasantamariacampinagrandegoianiasorocabafloripasaobernardocuritibaboavistarecifeaparecidasaogoncasalvadorcuiabamorenamacapalondrinacontagemsocialfortalmaceioleilaoosascoriobranconiteroi9guacutcheblogflogvlogwikitaxicoopmanauspalmascaxiasjoinvillebaruericampinassantoandreribeiraoriopretoweorgcomnetedugovv0windsurfshiptodaycloudsitecoaccoorgnetgovofmilcomgovmediatechzacoorgcomnetedugsjgovmydnspenfnlabnbmbgcbcqconcontnuyksknsmyspreadshopno-ipawdevboxbarsyonidatemfuinabusavinstanceseceuguukussryzespawncsxcloud-ipmyphotosfantasyleaguetwmailcleverappsscrappingccwucloudnsftpaccessgame-serverccgovobjectsrmalpgcust*svcalp1aeappenginermalpgmyspreadshop4lima2ixsquare7cloudscale123websitefirenet12hpflowgotdnslinkyard-cloudcloudnslima-citydnskingobjectstorageedaccogoorusorgcomnetinteduaéroportxn--aroport-byaassogouvcomilgobgovcloudnses-1eu-west-1us-east-1euvipit1eurarubait1s3lbwebsites3websiteru-spbru-mskelasticcsrunstnukukcaukusnl-ams-1fr-par-1fr-par-2functionsnodess3ddlwhmrdbfnck8sifrs3-websitecockpitscblmgdbdtwhkafkpubprivs3ddlwhmrdbk8sifrs3-websitecockpitscblmgdbdtwhkafks3ddlrdbk8sifrs3-websitecockpitscblmgdbdtwhkafkk8sscalebookpl-wawfr-parnl-amsbaremetalsmartlabelinginstancesdechk2kuleuvenlaravelvoorloperurownoxazapscwhstgrvaporonline-serverobservablehqelementorantagonistreclaimjoteluluencowaydiademjelasticmatlabmagentositetrendhostingaxarnetperspectajenv-arubajelejoteravendbemergenttrafficplexconvexkeliwebserveboltbegetcdnstaticson-rancherprimetelonstackitunison-servicesdnshomelinkyardbarsyjelecloudnscocomnetgovmycn-northwest-1cn-north-1s3s3-accesspoints3-websites3s3-accesspointrdsdualstacks3-deprecatedemrappui-prods3-websiteemrstudio-prods3-object-lambdaemrnotebooks-prodexecute-apis3s3-accesspoints3s3-accesspointrdsdualstackemrappui-prods3-websiteemrstudio-prods3-object-lambdaemrnotebooks-prodexecute-apicn-northwest-1cn-north-1cn-northwest-1ebcomputeelbcn-north-1airflowcn-northwest-1cn-north-1oncn-northwest-1cn-north-1amazonawssagemakeramazonwebservicesdirectasgdsdhehahljlnmhbacscahqhshhihnlnynsnmofjbjzjxjtjhkcqtwgsjssxnxjxgxxzgz網絡网络公司orgmilcomnetedugovxn--55qx5dcanva-appsxn--io0a7iquickconnectcanvasitekhsjxn--od0algcanva-codemyqnapcloudsrvrlessclustersrealtimestorageleadpagescarrdcrdorgmilcomnomnetedugovhidnssupabaserdpareplmypiumsoxmitotaplpagesfirewalledreplitowodevwebview-assetsvfswebview-assetss3s3-accesspointdualstackemrappui-prods3-websiteaws-cloud9emrstudio-prods3-object-lambdaemrnotebooks-prodexecute-apicloud9eu-west-3ap-south-2eu-south-2eu-central-2ap-southeast-3ap-southeast-4ap-northeast-3eu-central-1me-central-1ca-central-1il-central-1ap-northeast-1ap-southeast-1me-south-1af-south-1eu-south-1ap-south-1ap-southeast-7us-west-2eu-west-2us-east-2eu-north-1ap-southeast-2ap-northeast-2ap-southeast-5ca-west-1us-west-1eu-west-1us-east-1ap-east-1sa-east-1s3s3-accesspointdualstackemrappui-prods3-websiteaws-cloud9emrstudio-prods3-object-lambdaemrnotebooks-prodexecute-apicloud9s3s3-accesspointdualstackanalytics-gatewayemrappui-prods3-websiteaws-cloud9emrstudio-prods3-object-lambdaemrnotebooks-prodexecute-apicloud9s3s3-accesspointdualstackemrappui-prods3-websiteemrstudio-prods3-object-lambdaemrnotebooks-prodexecute-apis3s3-accesspointdualstacks3-deprecateds3-websites3-object-lambdaexecute-apis3s3-accesspoints3-websites3-accesspoint-fipss3-fipss3s3-accesspointdualstackemrappui-prods3-websites3-accesspoint-fipsaws-cloud9s3-fipsemrstudio-prods3-object-lambdaemrnotebooks-prodexecute-apicloud9s3s3-accesspointdualstackemrappui-prods3-websites3-accesspoint-fipss3-fipsemrstudio-prods3-object-lambdaemrnotebooks-prodexecute-apis3s3-accesspointdualstacks3-deprecatedanalytics-gatewayemrappui-prods3-websiteaws-cloud9emrstudio-prods3-object-lambdaemrnotebooks-prodexecute-apicloud9vfss3s3-accesspointdualstackemrappui-prods3-websiteaws-cloud9emrstudio-prods3-object-lambdaemrnotebooks-prodexecute-apicloud9eu-west-3ap-south-2eu-central-2ap-southeast-3ap-southeast-4ap-northeast-3eu-central-1mx-central-1me-central-1ca-central-1il-central-1ap-northeast-1us-northeast-1ap-southeast-1me-south-1af-south-1ap-south-1ap-southeast-7us-west-2eu-west-2ap-east-2us-east-2ap-southeast-2ap-northeast-2ap-southeast-5us-gov-west-1us-gov-east-1ap-southeast-6ca-west-1us-west-1eu-west-1us-east-1ap-east-1sa-east-1mrapaccesspoints3s3-accesspointdualstacks3-deprecatedanalytics-gatewayemrappui-prods3-websites3-accesspoint-fipsaws-cloud9s3-fipsemrstudio-prods3-object-lambdaemrnotebooks-prodexecute-apicloud9s3s3-accesspointdualstacks3-deprecatedanalytics-gatewayemrappui-prods3-websites3-accesspoint-fipsaws-cloud9s3-fipsemrstudio-prods3-object-lambdaemrnotebooks-prodexecute-apicloud9s3eu-west-3ap-south-2eu-south-2computes3-ap-northeast-2elbrdss3-ap-east-1s3-sa-east-1s3-us-gov-west-1s3-eu-central-1s3-ca-central-1eu-central-2ap-southeast-3ap-southeast-4ap-northeast-3s3-website-us-west-2s3-website-eu-west-1s3-external-1eu-central-1me-central-1ca-central-1il-central-1s3-us-west-1s3-eu-west-1s3-website-sa-east-1s3-website-ap-southeast-2ap-northeast-1ap-southeast-1s3-us-west-2s3-eu-west-2me-south-1af-south-1eu-south-1ap-south-1us-west-2eu-west-2us-east-2s3-website-ap-southeast-1s3-1s3-globals3-ap-northeast-3eu-north-1airflowap-southeast-2s3-us-gov-east-1s3-fips-us-gov-east-1s3-me-south-1s3-ap-south-1ap-northeast-2s3-website-us-west-1ap-southeast-5s3-eu-north-1s3-ap-southeast-1s3-website-us-gov-west-1compute-1s3-eu-west-3us-gov-west-1s3-website-ap-northeast-1us-gov-east-1s3-fips-us-gov-west-1s3-website-us-east-1s3-ap-southeast-2ca-west-1us-west-1eu-west-1us-east-1ap-east-1sa-east-1s3-us-east-2s3-ap-northeast-1authauthauth-fipsauth-fipseu-west-3ap-south-2eu-south-2eu-central-2ap-southeast-3ap-southeast-4ap-northeast-3eu-central-1mx-central-1me-central-1ca-central-1il-central-1ap-northeast-1ap-southeast-1me-south-1af-south-1eu-south-1ap-south-1ap-southeast-7us-west-2eu-west-2us-east-2eu-north-1ap-southeast-2ap-northeast-2ap-southeast-5us-gov-west-1us-gov-east-1ca-west-1us-west-1eu-west-1us-east-1ap-east-1sa-east-1rframeservicesbuilderstg-builderdev-builder*ociocpocsazuregcpawsdemoinstanceeu-west-3eu-south-2ap-southeast-3ap-northeast-3eu-central-1me-central-1ca-central-1il-central-1ap-northeast-1ap-southeast-1me-south-1af-south-1eu-south-1ap-south-1ap-southeast-7us-west-2eu-west-2us-east-2eu-north-1ap-southeast-2ap-northeast-2ap-southeast-5us-gov-west-1us-gov-east-1us-west-1eu-west-1us-east-1ap-east-1sa-east-1previeweu-4us-4us-1eu-1us-2eu-2us-3eu-3appscomputepaasrag-cloudrag-cloud-chjcloudjcloud-ver-jpcdemonodebalancermembersipeuxvsoncillaocelotonzayalilynxsphinxfentigercustomercaracalo365cloudstaticxendevapp001testcode-builder-stgplatformmediasiteprojedrydpagesjsx0desazacncoitrueu4uhkukgrbrushatenadiarymyspreadshopfrom-flfrom-wvwebspace-hosttheworkpchatenablogcursorusercontentservesarcasmapplinzisakuratanwixsiteappchizigiizeis-into-carsdnsiskinkyadobeaemcloudis-a-therapistpgfogmyvncdojinis-an-actress1kappfldrvkozowqa2jpnmexprgmrfirewall-gatewaydynnscafjsfbsbxooguyfrom-gawoltlab-demois-a-anarchistwiardwebteaches-yogadattowebtb-hostinglive-websiteservegamegotpantheonfrom-nhsubsc-payfrom-ohvipsinaappfrom-cadyndns-officehomelinuxfrom-mahercules-appservebbsstreakusercontentfrom-okfrom-wyfastly-terrariumis-a-llamaqualyhqportalserveexchangeon-vaporvivenushopciscofreakgrayjayleaguesmetaaiusercontentfrom-iais-a-libertariansaves-the-whalestaveusercontentyolasiteoperaunitepoint2thisis-a-catererclaudeusercontentlinodeusercontentfrom-vagithubusercontentsells-for-lesshosteurcanva-appsplaystation-cloudddnsfreefrom-pafrom-prfrom-waddnskingoutsystemscloudhotelwithflightmydattois-a-nascarfanmydbserverminiserverdamnserverservehumouris-a-playerfrom-nvfrom-nmemergentagentgentappsamplifyappfrom-kyis-an-accountantnfshostserveircfrom-akpythonanywherestackhero-networkpostman-echolikescandydyndns-mailobservableusercontentserveftpfreeboxosfrom-utcdn77-storageamazonawsneat-urldyndns-serverlinodeis-a-teacherfrom-vtgleezemythic-beastsus1-pleniteu1-plenitla1-plenitpaywhirlservecounterstrikejdevcloudhealth-carereformis-into-animegoogleapisis-a-painterafricaisa-hockeynutatmetais-an-actora2hostedis-a-democratdatadetectest-le-patrondigitaloceanspacesis-a-designeris-a-hunterlinodeobjectstemp-dnsissmarterthanyoufrom-arsimplesiteevennodetownnews-stagingis-a-liberalgooglecodejelasticservemp3qualyhqpartnerdyndns-free1cooldnsest-a-la-masiondrayddnsdynuddnsfrom-orfrom-miis-a-bloggerfrom-himydobisscanvacodeis-an-engineerest-a-la-maisonupsunappdevinappswafflecellmyasustorwpenginepoweredfrom-ctservep2psame-appmyshopblocksthingdustdatalikes-piediscordsezis-with-thebandlpusercontentis-leetshopitsite3utilitiesis-a-personaltrainersinaappladeskis-a-cheflogoipselfipbase44-sandboxnospamproxyalibabacloudcsmesswithdnsauthgearappsiamallamawithgooglelutrausercontentmochausercontentframercanvasmytabitdyndns-homew-credentialless-staticblitzcpserverdiscordsaysis-a-nurseappspotatlassian-isolated-3premotewdfrom-mtwixstudiocode0emm180rmyactivedirectoryawsappsmytuleapdnsabrpolyspaceqbuserrenderbuiltwithdarkboutirgotdnsabrdnsdopaascanva-hosted-embedawsglobalacceleratorhomesecuritypcmyiphostditchyouripclever-clouddyndns-ipon-aptibleis-a-musicianhosted-by-filessecuritytacticsappspaceusercontenthomeunixstrapiappsame-previewcf-ipfsmycloudnaselasticbeanstalkis-certifieddontexistkasserverik-serverdrive-platformatlassian-3pfirebaseappherokuappawsapprunnerbarsycenteris-a-cubicle-slaveservehttpmyshopifyis-a-guruquicksytessiiitesorsitesmagicpatternsappis-a-cpameteorappfrom-wiis-a-rockstarbumbleshrimpdattolocaldatabricksappsreadthedocs-hostedfrom-rifamilydsdyndns-picsplesknsbplaceddnsaliasdynaliasdyndns-remotedoomdnsip-ddnsblogdnsis-a-doctorroutingthecloudamazoncognitobarsyonlinedsmynasddnsgurucloudflare-ipfsdeus-canvasfrom-idsmushcdnpagespeedmobilizerdyndns-at-homeunusualpersonhosted-by-previderis-a-republicandyn-o-saurstreamlitappworkisboringonthewificprapidqualifioappis-uberleetis-slickgetmyipwpdevcloudtypeformdyndns-at-workgentlentapismynascloudw-corp-staticblitzfrom-ingeekgalaxyservebeerfrom-mdonrenderspace-to-rentaivencloudappspacehostedwafaicloudcodespotblogspotatlassian-3p-us-gov-modfrom-ndfrom-msis-a-techieis-a-studentcustomer-ociis-a-photographerdurumisfrom-ksmassivegriddyndns-wikiis-an-entertaineris-a-hard-workermysecuritycamerafrom-mnrackmazedyndns-blogis-a-bulls-fanwritesthisblogfreemyipsimple-urlfrom-sdreservdauthgear-stagingest-mon-blogueuris-into-gamesrice-labsxtooldevicesakurawebis-an-anarchistoraclecloudappsdyndns-worksells-for-urhcloudfrom-dcfastvps-serverwpmucdnis-a-geekscrysecfrom-txis-into-cartoonsmodelscapetrycloudflarelocaltonetstreak-linkbalena-devicesfrom-njforgeblocksfreebox-oswebadorsitefrom-ncdoesntexisthobby-sitestreaklinkshomesecuritymacownprovidertuleap-partnersdattorelaywphostedmailservequakeis-a-socialistservehalflifepivohostingdynuhostingquipelementsw-staticblitzdyndns-webfrom-deproject-studyaliases121is-not-certifiedhercules-devis-a-financialadvisorservepicsis-a-greenloseyouripfrom-ilwithyoutubemwcloudnonprodwiredbladehostingdnsdojofrom-tnpixolinomyqnapcloudis-an-artisthostedpiis-a-landscaperauiusercontentoaiusercontenton-forgeis-a-conservativedreamhostersnet-freaksapps-1and1is-goneencoreapifastly-edgefrom-nesalesforcefrom-scdeployagentoraclegovcloudappsfrom-alis-a-lawyercechirevultrobjectsstufftoreadisa-geekddnsgeeklovableprojecttry-snowplowfrom-moblogsyteis-a-bookkeepernogmyforumravendbmyboxdeelementoredsaacficogoorinforgcomgobnatneteduidstoreorgcomnetintedudevnomepublorgcomneteduathgovtestscalculatorspaynowinfoquizzesresearchedcloudnsfunnelsassessmentsjscaleforcetmacltdorgmilcompronetgovbizpresseklogesrsccloudcustomfltusrcloude4corealmgovmunicontentproxy9metacentrumdyndyndyndnsdynpagespages-researchitionoccustomercomymyspreadshopipv64diskussionsbereich4limacomrub2ixfirewall-gatewayddnssspdnsbarsykeymachinesquare7myhome-serverspeedpartnercommunity-proschuldockxenonconnectgünstigliefernbwcloud-os-instancedyndnssecmy-routerxn--gnstigliefern-wobin-butterl-o-g-i-nisteingeekin-dslin-berlinin-brbfuettertdasnetzleitungsenin-vpnlcube-serverdyn-ip24logoipdyn-berlinruhr-uni-bochum12hpgoipsrvdnsfruskygit-repossvn-reposinternet-dnsgünstigbestellenhome-webserverxn--gnstigbestellen-zvbbplacedheimdnscosidnswebspaceconfiglima-citydyndns1istmeinvirtualuserschulplattformmy-gatewayddnsseclebtimnetztest-iservmein-iservvirtual-userhome64iservschuletaifun-dnstraeumtgeradeschulserverdynamisches-dns123webseitednshomehs-heilbronndnsupdaterbssgraphicdwadpdwdaepeweaawapaafpfwfabwbpbacwcpcciwebuserapiobjectsidsiskospockkimodorikerbonesteamsparisjanewaypicardglobaltarpitreedpikekiraworfsulukirkarchertuckerhackercanarywesleystagingprereleaset3r2lpbravepanelngrokiservstglclcrmerpflypagesbarsyvivenushoplocalcertlocalplayerbearbloggatewaydeno-stagingis-not-ais-a-goodbotdashvercelmocha-sandboxplatter-appreplitgithubpreviewworkersinbrowserevervaultis-ahrsndenoxmitmodxmyaddrstorageapipayloadgrebedocruncontainersstgstagelclstageloginlineis-a-fullstackcodepenleapcellngrok-freeis-coolstoragewebharemediatechlibp2pdiscourseimaginecomyspreadshopstoreregbiz123hjemmesidefirmcoorgcomnetedugovsldorgmilcomwebgobartnetedugovtmorgpolcomsocartnetedugovassoagrondiscoodontk12medcuegyecpaabgengorgmilgalsaltulcomadmesmgobpubdocmonfindgnriouioproartlatvetnetfotedulojgovntrturibrbarxxxofficialbasechefprofmktgpsictechinfoarqtcontdentrrpppsiqgit-pagesritmedfieorgcomlibprieduaipgovriikmeactvsportorgmilcomscieunnetedugovnameinfopintouchtawktotawkmyspreadshoporgcomnomgobedu123miwebcomputeorgcomnetedugovbiznameinfocognito-idpeusc-de-east-1onjelasticnxaspdnsbarsydirectwpdeuxfleurstransurldogadoprvwcloudnsamazonwebservicesdnshomeuserpartycokoobinmkmfidymyspreadshopalandkapsiikixn--hkkinen-5wacloudplatformhäkkinen123kotisivuidacorgmilcompronetedugovbiznameinforadioorgcomneteduuserexperts-comptablestmmyspreadshopgretaprdcomnomynhccifbxoshuissier-justicenotairesaeroportfreeboxoson-webavocatassoportgouvkdnschirurgiens-dentistes-en-franceavouesfbx-os123sitewebveterinairechirurgiens-dentistespharmacienchambagrimedecinfreebox-osdediboxgoupilemszicpyicpvicppleysheezypagesedugovcnpyorgcomcybllcpvtnetedugovtnxonlineschooldaemond6atcopanelorgnetplybotdashstackitkaasorgmilcomnetedugovbizmodltdorgcomedugovcoorgcomneteduappwriteacorgcomnetedugovcloudtranslateusercontentorgcomnetedumobiassoorgcomnetedugovbarsysimplesitediscourseindorgmilcomgobneteduorgcomwebnetedugovguaminfonxhra教育敎育網絡网絡组織組織网络網络组织組织公司政府個人个人箇人ltdorgcomincneteduidvgovxn--uc0ay4axn--55qx5dxn--mk0axixn--io0a7ixn--uc0atvxn--zf0avxxn--lcvr32dxn--od0algxn--wcvs22dxn--gmqw5axn--od0aq3bxn--mxtq1mxn--ciqpnxn--tn0agxn--gmq050iorgmilcomgobneteduiservwp2tempurlmircloudfreesitewpmudevmyfastgadgetcloudaccessjelehalfboltfastvpsemergenteasypanelopencraftizcombrendlynamefromrtpersoadultmedorgpolrelcomproartnetedufirminfoassoshopcoopgouvtmcomediahotelforumvideosportorgsexagrargameslakaseroticaerotikatozsdereklamcasino2000filmsuliinfoboltshopprivnewsszexcityutazasjogaszkonyveloingatlaneacaicogoormyᬩᬮᬶmilwebschnetkopbizzonedesaponpesxn--9tfkymyspreadshopgovmytabittabitorderravpageaccok12idforgnetgovmuniltdplcaccotttvorgcomnetmeca6g5gpgamubacaicniocoukuptverdruscsdelhiindorgmilcomwebnicfingenpronetintedugovresbizbiharbarsyinternetbusinessschooltravelsupabasealumnigujaratfirminfoaeropostbankcoopindevscloudnsno-ipbarsybarrell-of-knowledgebarrel-of-knowledgensupdategroks-thisdnsupdatefor-ourknowsitalldvrcammittwalddynamic-dnsv-infowebhopselfipdyndnshere-for-moreilovecollegemayfirstforumzcloudnsmittwaldservertypo3servergroks-theeusekd1cdndyndnsidrawsainaueuapjpusstagemocksysdevicesclientcustreservdcustdevdisrecprodtestingcobeebyteutwenteboxfusebravepstmndedynngrokorgmilcomnomnetedugovqcxqzzbarsythingdustmo-siemensrb-hostingfh-muenstergitbookbluebitecloudbeesusercontentnodeartkiloappsforgerockdarklangresinstagingapigeebubbleb-datascryptedhypernodedappnodepantheonsitegitlabgithubkeeneticvirtualservercleverappshostyhostingon-rioedugitticketstelebitwixstudioon-k3sicp0icp12038jeleqotolairbubbleappsmyaddrstolosmyrdbxwebflowdrive-platformbeagleboardhasura-applolipopdefinimavaporcloudmusicianwebflowtestazurecontainerresindevicereadthedocsloginlineeditorxmoonscalesandcatsbasicserverwebthingsbrowsersafetymarkbeebyteappbitbucketidaccovistablogorgschnetgovxn--mgba3a4f16axn--mgba3a4fraarvanedgeايرانایرانjclaspeziapdudcefegelemeperetevebacanatavaparasabgagfgogrgpgalclblimfmrmcbmbvbfclcmcvcrcpcchlimifibicivipirisimncnbnanenrnpntnnolomobocoaogorosopotoptvtatctbtmtltotpusulunutpspapaqsvpvvvtvavvrtrsrprgrfrcrbrarorkrvstsssbscsmsispzczbzbozen-suedtirolmyspreadshopxn--bulsan-sdtirol-nsbxn--valledaoste-ebbtrentinoaltoadigetrentin-sued-tirolxn--forlcesena-c8axn--forl-cesena-fcbxn--bozen-sdtirol-2obtriestetrentinsuedtiroltrentino-s-tirollecceudineaostesienaparmaluccapaviagenoapaduaaostamonzaabruzzoternirietiturinmilanbozenlaziofermoleccocuneonuoropratola-speziavdataaligfvgpugmolcalcamlomumbsicpmnvenvaoedugovabrsarmaremrbastoslazibxosfirenzetrentinosüdtirolval-d-aostavalle-aostamessinacremonaravennatoscanatrentin-suedtirolbolognacalabriaurbinopesarofriuli-v-giuliaogliastraxn--valle-aoste-ebblaquilaandriatranibarlettasyncloudxn--valle-d-aoste-ehbaostavalleyvalled-aostatrentino-alto-adigevallee-d-aostexn--balsan-sdtirol-nsbpistoiasicilialucaniacataniaiserniaperugiabresciaveneziagorizialiguriaimperiabulsan-suedtirolbalsan-suedtirolbarlettatraniandriaxn--trentino-sdtirol-szbforlì-cesenatuscanyvallée-d-aostemantovavallée-aostecasertapiemontevalleaostaval-daostafriulivgiuliatrevisoforli-cesenavalléedaosteferrarapescaravald-aostatrentino-altoadigefriuli-vegiuliavallee-aostecarboniaiglesiastarantomediocampidanovalleedaostetrentinosud-tirolcampobassotrentinsüd-tiroltrentinosüd-tirolmonzabrianzatrentino-südtirolxn--trentino-sd-tirol-c3bpotenzacosenzavicenzaemiliaromagnavenicefrosinonemarchepordenonetrentinosued-tirolvaresemolisevalléeaostefriuli-veneziagiuliabasilicatalatinaanconasavonaveronamodenabiellabolzano-altoadigepugliafoggiaumbriatrentino-stirolgenovapadovamateranovararagusapiacenzatrentinostirolvalleeaostetempio-olbiasudsardegnatrentinsudtirolmassa-carrarafriuliveneziagiuliatrentinosuedtirolandria-barletta-tranitrapanixn--cesenaforl-i8amaceratacaltanissettaascoli-picenobrindisicarraramassacagliaririmininapolivibo-valentiachietibulsan-sudtirolbalsan-sudtiroltrentino-a-adigebulsanbalsaniglesiascarboniamilanotorinoteramodell-ogliastraarezzotrentinoalto-adigerovigotrentovenetoiglesias-carboniatrentino-sud-tirolaltoadigereggio-emiliareggio-calabriasardegnatranibarlettaandriapiedmontxn--sdtirol-n2amedio-campidanotrentino-süd-tirolfriuli-vgiuliafriuli-ve-giuliaromeennaromapisa32-b16-b64-blodiastibarineencomonaplesforlicesenailiadboxosalessandriasicilytrani-barletta-andriaxn--trentin-sdtirol-7vbpesarourbinotrentinsued-tirolcesena-forliforlìcesenaemilia-romagnamonzaebrianzaxn--trentinsdtirol-nsbtrentinos-tiroltrentinsüdtirolvalledaostaolbia-tempiocampidanomediovibovalentiasassarivalle-daostalombardysud-sardegnafriulivegiuliareggioemiliamonzaedellabrianzaalto-adigevercellitrentin-sudtiroltraniandriabarlettatrentino-sudtirolascolipicenobozen-südtirolfriulive-giuliaflorencexn--cesena-forl-mcbcarbonia-iglesiasaosta-valleycarrara-massadellogliastratrentinoa-adigexn--valleaoste-e7apesaro-urbinoxn--trentinosdtirol-7vbxn--trentin-sd-tirol-rzbxn--trentinsd-tirol-6vbtrani-andria-barlettatrentin-süd-tirolxn--trentinosd-tirol-rzbgrossetomonza-e-della-brianzasüdtirolreggiocalabriatrentinoaadigetrentin-südtirolverbano-cusio-ossolafriuliv-giuliaverbaniacampaniatrentino-aadigefriulivenezia-giuliasardiniaandriabarlettatranibarletta-trani-andriacatanzarooristanourbino-pesarocesena-forlìvalle-d-aostacampidano-medio123homepagesiracusatempioolbiasuedtirollombardiaavellinocesenaforlìtrentinofriuli-venezia-giuliabozen-sudtirolandria-trani-barlettabulsan-südtirolbalsan-südtirolmonza-brianzabolzanotrentino-sued-tirolbellunosalernolivornocrotonesondriodnshometrentinsud-tirolmassacarraratrentin-sud-tiroltrentino-suedtirolviterbobergamocesenaforliolbiatempiopalermobeneventoagrigentoofcoorgnetfmaitvphdengorgmilcomschnetedugovperagrikanieasukehandachitatokaiaisaikonanoharuamaobuhigashiuraowariasahiinuyamatobishimaiwakurashitarainazawatoyonegamagorimihamatoyotataharakariyayatomioguchikomakimiyoshinishiotokonamekiyosuchiryutoyohashiokazakiisshikikasugaikotakiratoeianjotogofusosetohazutsushimashinshirotakahamanisshinshikatsuhekinantoyokawaichinomiyatoyoakeodateogataakitaikawakyowahonjoogayurihonjonoshirokamiokakatagamimitanegojomeyokotekosakadaisenkazunonikahohonjyomoriyoshimisatohappoukamikoanihachirogatahigashinarusesembokufujisatokitaakitaitayanagiowanitakkomutsutsurutahirosakigonoheoirasetowadamisawanohejiaomorishingohiranairokunohehashikamitsugarushichinohehachinohenakadomarisannohekuroishisakaeisumiasahiotakiinzaiabikomatsudoyachiyomutsuzawakujukuriomigawakashiwatoganemihamanaritasakuranagaramobarahanamigawachoshishiroichoseikozakishisuikatorimidorichonankyonanfuttsuonjukufunabashinagareyamanodasosatakochuotohnoshourayasukimitsuyokaichibayotsukaidosodegauratateyamakamagayayokoshibahikariyachimatakatsuuratomisatokisarazukamogawaichikawanarashinoichinomiyashimofusaminamibososhirakoichiharaoamishirasatoikatahonaiainansaijoseiyoiyoozuuwajimaniihamanamikatamasakiuchikokihokutobetoonshikokuchuomatsuyamaimabarikamijimakumakogenyawatahamamatsunosabaeikedaobamasakaifukuiohionotsurugamihamawakasaminamiechizeneiheijikatsuyamatakahamaechizensoedaukihaomutaokawanishiogoribuzenonojosueumiokiotochikugosasagurisaigawamizumakishinyoshitomikurumekurateyamadakasuganakamamiyamanogatatakatahakataiizukakawaratagawakasuyaashiyainatsukimunakataminamitsuikishonaikurogifukuchikeisenhigashimiyakoshinguyukuhashiokagakiyamekogaongausuikahotohochuotoyotsumiyawakadazaifuhisayamatachiaraiyanagawanakagawahirokawachikujochikushinochikuhochikuzennamieotamaokumashowateneiiwakikoorinangoononishigoshimogoomotegomishimafukushimaasakawakagamiishishirakawaiitatefutabahiratayugawahanawakitakatakawamatakunimiyabukibandaihigashihironoyamatomiharuyamatsuriaizubangedatesomaaizuwakamatsuyanaizuaizumisatonishiaizuizumizakikitashiobarataishinkaneyamakoriyamainawashirotanagurafurudonosamegawasukagawaishikawatamakawaikedaogakitaruiginanenahashimahichisonakatsugawaibigawashirakawamizunamiminokamomitakekawauesekigaharatomikasakahogikitagatayamagatatajimianpachimotosuyaotsukakamigaharahidakanisekitokigujominogodoyorogifukasamatsutakayamawanouchihigashishirakawakasaharashimonitatsumagoichiyodakannakanrashowameiwakiryuotaoratomiokafujiokaitakuranaganoharahigashiagatsumatakasakishibukawaminakamikatashinatsukiyonokawabanumataannakaoizumimidorishintoisesakiuenoyoshiokakusatsutakayamanakanojonanmokutamamuratatebayashimaebashiotakekaitadaiwahongofuchukuietajimashobaramiharahatsukaichihigashihiroshimamiyoshikumanokurenakasakaseraseranishiasaminamifukuyamashinichionomichiosakikamijimajinsekikogentakeharaotobenanaeikedatohmaozoraobiraabirakyowaeniwataikibibaisharirebunerimohiroooketootarupippunishiokoppechitosefurubirahakodateshiranukakitahiroshimakushiroobihironanporoiwamizawaniikappukunneppufukushimanakasatsunaitoyourakuromatsunaiakabirakamisunagawashibechaurakawakamifuranonakatombetsuasahikawashimokawakayabeokoppebiratoriabashirisaromaatsumanumatahidakabifukamukawamikasahorokanaitoyotomisarufutsuhigashikawaishikarikitamiyoichiesashiiwanaitomariminamifuranoakkeshifuranotoyakoyakumootoineppushikaoishiraoinemuronayorohaboroashorobihororishirifujiutashinaihokutotakasuebetsuurausuassabukikonaishimamakinaiedatetoyabieinikiesanuryuoumuteshikagarikubetsuashibetsukimobetsuaibetsutobetsusobetsuembetsushimizuchippubetsurishirihokuryuhoronobeshintokutsubetsushibetsuhonbetsumombetsutsukigatakuriyamakoshimizushiriuchikutchanmurorannoboribetsukamishihorowassamushinshinotsukembuchiwakkanaikamoenaikiyosatotakinoueshikabesunagawafukagawanakagawatakikawakamikawahigashikagurahamatonbetsumatsumaemoseushirankoshishakotanimakanemashikeotofuketomakomaisandatambaitamiawajikasaiasagoshisoonoakoyashirotoyookaminamiawajiinagawafukusakitakasagokamigorikasugaharimayokawaashiyahimejiakashitaishiaogakisannantakinosumototakarazukanishinomiyashingugoshikinishiwakiyokatakaaioimikisayoyabukawanishiamagasakisasayamashinonsenkakogawaichikawakamikawatatsunotsukubaiwamaogawaasahisakaitokaioaraiitakobandodaigosuifuinaamikasumigaurakashimaomitamayachiyoshimodatetomobetoridehitachinakainashikisakuragawakasamayawaramoriyahitachiomiyanamegatayamagatahitachikamisuushikutakahagiibarakitonekoganakasowayukimihojosomitoryugasakishimotsumafujishirotsuchiurachikuseihitachiotashirosatotamatsukuriuchiharashikahakuinanaotsubatawajimakahokukawakitatsurugikaganominotosuzuuchinadakomatsuanamizunakanotohakusannonoichikanazawaiwateshiwafudaikawaimoriokaofunatohanamakikuzumakikitakamininohekunoheyamadayahabasumitaichinosekitanohatahiraizumirikuzentakatajobojiotsuchihironomiyakoiwaizumikarumaiichinohenodakujitonooshushizukuishifujisawamizusawakamaishikanegasakimannoutazukotohiraayagawazentsujihigashikagawauchinomikanonjisanukimarugamemitoyotakamatsutadotsunaoshimatonoshoakuneamamiizumihiokiyusuikinkoisasookouyamanakatanekagoshimakanoyaisenkawanabeminamitanemakurazakitarumizunishinoomotematsumotosatsumasendaioimatsudaayaseebinamiurazushinakaiodawaraiseharasagamiharahakoneaikawakaiseiatsugitsukuihadanoyamatoyamakitazamaoisochigasakininomiyayokosukakamakuraminamiashigarafujisawasamukawakiyokawahiratsukayugawaraokawaumajikochitsunootoyoakiinonishitosayasudahidakamiharasakawaniyodogawahigashitsunokagamigeiseisusakiotsukinaharisukumomurototosakamiochitoyotosashimizumotoyamanankokunakamurakitagawayusuharaogunichoyoukiasoutoozugyokutoamakusamifunetakamoriyamagaminamataminamiogunikikuchisumotoyamatonagasumashikiaraokumamotokamiamakusanishiharayatsushiroayabeseikasakyoideineujinakagyokameokakyotangokyotanabekyotambaminamiyamashiroyamashinatanabeyawatawazukaminaminantanmiyazuhigashiyamafukuchiyamakitamukokamojoyokizumaizuruujitawaraoyamazakinagaokakyokumiyamakawagoeinabeshimameiwaasahitaikiudonoisetsukisosakikuwanamihamamiyamasuzukatamakimisuginabarikumanokomonominamiisewataraitobakiwatakikihotadomatsusakayokkaichikameyamaureshinoishinomakishichikashukuohirataiwaosakizaohigashimatsushimashikamaiwanumashibataogawaraonagawakawasakiseminemarumoriminamisanrikukakudamuratawakuyatomiyanatoriwataritagajomisatotomekamirifushiroishimatsushimayamamotoshiogamafurukawahyugaebinotsunosaitoayakushimanobeokakitauramiyazakitakazakigokaseshiibamimatashintomikunitomikitakatakobayashikawaminamitakaharukijotakanabemiyakonojonishimeranichinankitagawakadogawamorotsukakisofukushimaminamimakisakaeobuseikedaogawamiasaokayaasahiotakiotarichinoinaomichikumakomaganechikuhokukaruizawayasuokaooshikaikusakaminamiaikitogakushimatsukawakawakamitateshinatakamorikitaaikishiojirimiyadahakubaiizunaiijimaiiyamamiyotasuzakayasakatoguraookuwanagawaminowahirayayamagataminamiminowafujimiomachisakakitakaginaganonakanosakuhokomoronagisoshinanomachiwadauedaiidaharasuwatomiachiaokianankisosakunozawaonsenagematsutakayamashimosuwamatsumotoyamanouchinakagawamochizukiazuminotatsunoobamaomuraseihiunzenosetofutsuikichijiwanagasakiisahayahasamisaikaikawatanasasebohiradokuchinotsugototogitsutsushimashimabarashinkamigotomatsuurayamazoekashibaikomakawaitenrioyodosangokoryoudaojiikarugayamatokoriyamatenkawakatsuragikurotakikawakamimiyakemitsuetakatorikamikitayamayamatotakadahegurishinjokanmakisakuraitawaramotogoseoudanarasoniandokawanishishimoichihigashiyoshinokashiharashimokitayamanosegawayoshinomintsivorytopazsakuragehirnsumomoaseinetopalmail-boxmokurenyoitamuikaojiyagosensanjoaganomyokoseiroagaomishibataniigatanagaokamurakamiuonumayuzawakariwatagamitainaitsunanminamiuonumatochioyahikojoetsuseiroukamosadoizumozakitokamachiitoigawasekikawakashiwazakitsubamemitsukekokonoesaikiusukibeppuusahimeshimakunisakihasamataketatsukumihitaoitahijikusuyufukujukamitsuebungoonobungotakadaibaraniimibizentsuyamaokayamakasaokahayashimayakagemaniwaakaiwamisakishinjotamanotakahashikibichuowakesojanagishookumenannishiawakurakurashikiasakuchisetouchikagaminosatoshotomigusukunakagusukuyaeseizenaurumaiheyaaguniogiminanjokinminamidaitokitanakagusukuyonaguniokinawaishigakikunigamiurasoekadenataramahiraraginozataketomishimojizamamitonakiitomanhigashimotobuyonabarugushikamionnanahanagohaebarukumejimakitadaitonakijinnishiharayomitanginowantokashikiishikawaikedasuitaminohizuminishisakaikananabenodaitoosakasayamayaokishiwadatadaokakaizukatondabayashichihayaakasakakumatorikadomasayamahigashiosakashijonawatehirakatataishimisakitajirihannansennankatanotoyonominatosettsuhigashiyodogawaibarakinosekitachuohigashisumiyoshifujiiderakashiwaraizumiotsutoyonakamatsubaramoriguchiizumisanoshimamototakatsukineyagawahabikinotakaishikawachinaganoyoshinogarikamiminearitaouchiimarihizenogikashimaariakekiyamafukudomikitagatakitahataomachigenkaikanzakinishiaritakyuragisagataratosutakushiroishikaratsuhamatamakouhokukawagoeyoshidasatteogoseirumaasakaurawaogawaniizaomiyayoriiotakishikihonjooganohannohanyuinasaitamaokegawaarakawayoshikawayokozehasudasayamahidakafukayachichibuiwatsukiryokamiyoshimikamiizumifujimiwarabiranzanmiyoshiminanoyashiosakadosugitomisatohigashichichibutodasokakukiyonokazoshiraokakasukabekounosukawajimatsurugashimamiyashirokitamotohatoyamamoroyamahatogayakumagayakawaguchinagatorokamisatomatsubushinamegawatokigawakamikawafujiminohigashimatsuyamakoshigayatokorozawas3isk01isk02ryuohkoseikonanaishorittotakashimamaibarahikonetorahimenishiazaikokagamokotoyasuotsukusatsunagahamamoriyamatoyosatotakatsukinotogawaomihachimanhigashiomiakagiunnanizumogotsuamayatsukakakinokimatsuehamadamasudahikawahikimiokuizumoyasugiyakumomisatotamayuohdahigashiizumookinoshimanishinoshimatsuwanoshimaneshimadafujiedayoshidashimodagotembaiwataatamikosaiyaizuitoizumishimahaibaramakinoharaomaezakikawanehonkannamisusonohigashiizufukuroinumazukawazufujiaraishizuokahamamatsushimizuizunokunimatsuzakimorimachiminamiizunishiizukikugawakakegawafujikawafujinomiyaujiietsugaoyamayaitaohiranikkoashikagakuroisokanumasakurashioyakarasuyamamotegiichikaikaminokawatochigihagamokanogisanobatonasumibunasushiobaranishikatautsunomiyaiwafunemashikoshimotsukeohtawaratakanezawaitanokomatsushimatokushimaichibaminamiaizumiwajikikainanmiyoshinarutomimamugiananmatsushigesanagochishishikuinakagawamachidachiyodakomaefussainagitaitochofufuchuomeotahigashiyamatotoshimaokutamaaogashimakodairaedogawaarakawahachiojishinagawatachikawashibuyasuginamihinodekiyosesumidaoshimanerimamitakahamuraadachinakanomizuhobunkyomegurominatokoganeihigashikurumekokubunjihigashimurayamamusashimurayamatamakitahinochuokotokatsushikakouzushimaogasawaraakishimakunitachishinjukusetagayamusashinohachijoitabashiakirunohinoharachizunanbukotouramisasawakasayonagokogehinoyazutottorinichinansakaiminatokawaharaoyabetairainamiasahinantoimizufuchutakaokakurobeyamadajohanatoyamatonaminyuzenfunahashinakaniikawanamerikawaunazukitogahimiuozufukumitsutateyamakamiichiiwadearidayuasainamitaijikatsuragiaridagawatanabemihamahidakakainankiminomisatoshingushirahamakamitondayurakozakoyagobokitayamawakayamakudoyamahashimotokushimotokozagawahirogawakinokawanachikatsuurarsuseroeoishidasagaeoguniasahinagaitendonanyoobanazawanishikawasakataohkuratozawamikawamamurogawayamagatafunagatatakahatashonaishinjokahokuiideyuzakawanishitsuruokakaminoyamayamanobeshiratakamurayamanakayamakaneyamahigashineyonezawasakegawamitouubeyuuabushimonosekitabuseoshimatoyotaiwakunihikarishunannagatohagihofukudamatsutokuyamashowadoshitsurunanbukoshukaiminami-alpsnirasakikosugeotsukioshinohokutominobuyamanashifuefukichuokofuichikawamisatoyamanakakonakamichitabayamanishikatsuranarusawafujikawahayakawafujiyoshidafujikawaguchikouenohara長野京都岐阜大阪三重群馬千葉滋賀佐賀奈良adednelgaccogogror秋田愛知高知埼玉沖縄栃木熊本岩手青森山梨新潟島根鳥取長崎香川宮城石川大分宮崎茨城山口兵庫山形徳島広島福島福岡岡山富山静岡愛媛福井東京xn--4it168dhatenadiaryxn--vgu402ckawaiishophatenablogcocottenamaste北海道penneehimeiwateversestabachibashigagonnagunmapermahaccaakitaosakauh-ohblushkochiaichifukuikuroncapooitigohyogotokyokyotopunyuthickcheap0t00g00j0mie2-ddaapyawjg0amfemsubxiiboomoobutchueekpgwrgrherskrboyrdyupperunderflierchipsmydnsheavyangryhippygirlyrulez神奈川鹿児島和歌山bambinaxn--nit225kokayamasaitamaxn--k7yn95exn--1lqs03nsapporoparasitelolipopmcxn--efvn9sniigatafukuokatokushimafukushimahiroshimakagoshimafakefurokinawaxn--8pvr4ucoolblogxn--0trq7p7nnkawasakinagasakimiyazakichilloutxn--8ltr62kxn--klty5xpeeweezombiecutegirlxn--rny31hxn--uuwu58axn--ntso0iqx3axn--djrs72d6uytoyamanikitanyantakagawamimozanagoyaboyfriendxn--2m4a15egreaterchowderegoismyamagatafashionstorexn--elqq16hxn--pssu33lsendaimiyagixn--rht27zpecoriaomorisaloonwatsonvivianxn--djty4knobushipigboatnaganopinokoxn--f6qx53asadistvelvetsecretxn--5js045dchicappayamanashiibarakidigickgirlfriendxn--1lqs71dmongolianxn--c3s14mxn--qqqt11mtochigixn--5rtq34kparallelo0o0mondkobesagabonadecaoitanarafoolkilldecimainhiholomosblokilociaoundopupugifutankcrapflopnooroopsmodsholyjeezstripperpepperbittershizuokaxn--rht3dkitakyushureadymadeicurusversusmatrixxn--rht61ehungryfloppygloomycrankyhandcraftedlittlestarxn--klt787dxn--kltx9awhitesnowsunnydaytottorilovepoptheshopbuyshopxn--5rtp49cxn--d5qv7z876cwebaccelxn--kbrq7oxn--4pvxsxn--1ctwolovesickkumamotocatfoodxn--tor131oyokohamawakayamatonkotsuxn--ehqz56nxn--uist22hxn--6btw5axn--kltp7dyamaguchifrenchkisspussycatxn--4it797kxn--uisz3gbabybluexn--zbx025dnetgamersxn--7t0a264ckanagawaxn--6orx2rishikawaxn--ntsq17ghalfmoonschoolbusjellybeanxn--mkru45iusercontentlolitapunkxn--32vp30hsakurastoragehokkaidoshimanecandypopbabymilksupersaleweblikeraindropbackdropwebsozaikikirarahateblodaynightmeneacsccogoormobiinfoaeusxxorgmilcomnetedugovorgcomnetedugovbizinfotmprdorgmilcomnomedugovassnotairespresseassocoopgouvveterinairemedecinpharmaciensorgnetedugovtraorgcomedurepgovmeneperekgacscaiiocogoitoresmshsseoulbusanulsandaeguc01milvkimmvchungnamjeonnamjeonbukeliv-dnsgyeonggijejueliv-cdnincheondaejeongangwongyeongbukgwangjuchungbukgyeongnameliv-apicoeduindorgcomembnetedugovorgmilcomnetedugovjcloudorgcomnetintedugovperbnrinfocooyorgcomnetedugovethipfscanvamypepethw3sstorachakeeneticjoinmcinbrowserdwebcyonnftstoragemyfritzaemewphlxachotelltdorgcomwebsocschngonetintedugrpgovassnomgacsccoorgnetedugovbizinfo123websiteidorgmilcomasnnetedugovconfidmedorgcomplcschnetedugovaccoorgnetgovpresstmassoirseproxaccosoundcasthoptocraftvp4c66orgnetedugovitsmcdirmyboxbarsyedgestacksynologylogintoopencloudnohostwebhopdiskstationi234tcp4hoocgroknoipprivmydsddnsdnsforlohmustransipdscloudfilegear-sgbrasiliafilegearframerbarsybarsyonlinecoprdorgmilcomnomedugovinforgcomnetedugovnameacprorgcomartnetedugovpresseinfoassoinstgouvorgnycedugovbarsydscloudjuorgcomnetedugovminisiteaccoororgcomnetgovorgmilcompronetintedugovbizmuseumnameinfoaerocoopaccoorgcomnetintedugovbizcooporgcomgobneteduorgmilcomnetedugovbiznameaccoorgmilneteduadvgovcoorgcomnetaltgovforgotherhiskeeneticispmanagernomassoprod5476132eastasiacentraluswesteuropewestus2eastus2pnortheurope-01newzealandnorth-01southindia-01southcentralus2-01norwaywest-01eastus2-01westus2-01australiaeast-01italynorth-01israelnorthwest-01swedencentral-01westeurope-01centraluseuap-01taiwannorthwest-01uaecentral-01northcentralusstage-01israelcentral-01mexicocentral-01canadacentral-01austriaeast-01germanywestcentral-01francecentral-01ukwest-01denmarkeast-01polandcentral-01eastus-01westus-01swedensouth-01eastus3-01westus3-01brazilsouth-01centralus-01francesouth-01australiacentral-01westindia-01uaenorth-01jioindiacentral-01canadaeast-01belgiumcentral-01spaincentral-01koreacentral-01chilecentral-01qatarcentral-01westcentralus-01eastus2euap-01norwayeast-01southafricanorth-01brazilsoutheast-01germanynorth-01switzerlandnorth-01switzerlandwest-01japanwest-01southafricawest-01japaneast-01eastasia-01indiasouthcentral-01taiwannorth-01centralindia-01uksouth-01southcentralus-01northcentralus-01eastasiastage-01indonesiacentral-01australiacentral2-01australiasoutheast-01malaysiawest-01koreasouth-01southeastasia-01southeastus5-01northeastus5-01jioindiawest-01rucdnwest1-usfra1-desandboxjls-sto1jls-sto3jls-sto2aglobalabglobalsslmapprodfreetlsmapvpslon-1lon-2ny-1fr-1sg-1ny-2paassnwebpaashostingjelasticnordeste-idcsocuserpagescwebfileblobservicebuscoreatlricnjsjelasticwebsitestoragesezagbinruhuukjptsmyspreadshopmynetnameakamaiorigin-stagingfrom-coipv64dynv6cdn77serveblogadobeaemcloudhicamsprytdnsupno-ipownipde5ovhicpfirewall-gatewaysytesmypsxbarsyusgovcloudapimyamazemyradwebakamaihdsaveincloudfastlylbfrom-lasubsc-paysquare7in-the-bandblackbaudcdnhomelinuxoninfernoctfcloudservebbsdns-dynamiccloudfrontakamai-stagingipifonyham-radio-opsenseeringclickrisingcommunity-profrom-nylocalcertgrafana-devedgesuite-stagingcloudflareanycasteating-organicatlassian-devmydattofeste-iplocaltotorprojectknx-serveredgekeycloudflareglobalcloudyclustercasacamserveftpakamaized-stagingakamaiorigindns-cloudmyeffectboomlabotdashbuyshousestwmailhetemlazure-mobilein-dslthruhereredirectmedynuddnsbouncemesupabaseluyanicloudappakamaicloudfunctionsdebiannhlfanpgafanstatic-accessin-vpnmysynologymafeloappudohomeftptrafficmanagersiteleafseidatmemsetcloudflarecloudaccesskeyword-onazure-apiis-a-chefdoes-itgets-itwebhopselfiphomeipkicks-assedgesuitewindowsserver-ontunnelmolemydissentscrapper-sitecloudflarecnuni5srcfggffiobbzabchrsndenodynuopikddnsvpndnsakadnselastxkinghostvps-hostfastlyhomeunixazureedgeshopselectdontexistmyfritzcloudjiffyalwaysdatasells-itsquaresbroke-itazurefddattolocalat-band-campmeinforumfamilydsazurestaticappsdefinimabplaceddnsaliasdynaliasnow-dnsblogdnsroutingthecloudendofinternetdsmynasakamaiedgemymediapcadobeio-staticakamaiedge-stagingakamaihd-stagingddns-ipprivatizehealthinsurancelive-onkrellianschokokeksmassivegridmysecuritycamerarackmazeserveminecraftfrom-azis-a-geekakamaizedmoonscaleoffice-on-theusgovtrafficmanageradobeioruntimeedgekey-stagingreserve-onlinechannelsdvrdnsdojousgovcloudappcdn77-sslapps-1and1podzoneazurewebsitesdynathomescaleforceyandexcloudvusercontentisa-geekcdn-edgescoaemalcesappwriteazimuthtlonarvobuiltwithrocketnoticeablestorecomwebrecnetperotherfirminfoartslgdloncogoiltdorgmilcolcomplcschgenngonetedugovbiznamefirmmobiacincoorgmilcomnomwebgobnetintedubizinfocomyspreadshopdemongovtransurl123websitehosting-clusterkhplaycistrongsnesosvalervålerxn--vler-qoaossandeheroysandeherøybøboheroyherøyxn--hery-iraxn--b-5gavalerbøboxn--b-5gasandesandexn--hery-iraxn--vler-qoavålerhåreålaahavaofsfvfhlolnlalrlhmfmtmahcostntbuåstrmreigersundmyspreadshopgálsáeidsvolltingvollgildeskalflorøvadsøvardøvanylvenxn--bhccavuotna-k7astrandaxn--kvnangen-k0axn--sknland-fxaxn--mosjen-eyarakkestadhyllestadnannestadvevelstadvaapstenordre-landsondre-landsøndre-landtjieltexn--vrggt-xqadsør-aurdalsor-aurdalheradstordmoldefordeførdeseljefedjeryggehemnexn--krehamn-dxasognegranesøgnebrynetjomevallebykletokkegiskedovretjømehobølvoldasaudatolgasømnaviknadønnasomnadonnatranafrananesnaraumasmolatrænafrænalesjasmølaørstaorstahitrafloraaukraloppafrøyarissasnasahalsagalsaromsaraisaráisafroyasnåsagronghobolfjelltydalårdalardalaskimharamkraanghkekråanghkesorumbarumhurumbærumsørummodumsálátbálátfrognbjugnvåganvagangulenskienløtenlotenstrynvefsnxn--merker-kuaskaunsveiobømlobomloskjåkvardoflorovadsosalatbalatsálatklæbuklabuselbubarduulvikskjakklepprisørxn--nttery-byaeflåeidflahofmilgolholsellomskifetvikdepvgsfhsaskerrisorhamarasnesåsnesrørosrorosxn--slat-5namasoynaroyvaroyluroydyroyaskoyradoyandoyrodoymeloyradøyandøyrødøymeløyaskøylurøydyrøymåsøyværøynærøyhoylandethøylandetdivtasvuodnalørenskoglorenskognesoddtangenxn--tjme-hraxn--smla-hraxn--stjrdal-s1aunjargalillehammerunjárgaxn--hamary-fyadavvenjargaxn--bearalvhki-y4a123hjemmesidegjerdrumxn--brnnysund-m8acxn--tnsberg-q1axn--mlatvuopmi-s4axn--snsa-roaxn--skierv-utaxn--brum-voatysfjordkvafjordeidfjordkvæfjordsongdalenmjondalenmjøndalenxn--gls-elackragerogáŋgaviikagangaviikasørreisasorreisasør-varangersor-varangerxn--risr-iraskiervaxn--frna-woaxn--trna-woakvinesdalleksvikleirvikrøyrvikroyrviksvelvikvenneslaevje-og-hornnessandnessjøenmarnardalvindafjordsandefjordenebakksnillfjordullensvangxn--trany-yuabrønnøysundnamsskoganaustevollxn--stjrdalshalsen-sqbnord-aurdalnord-frontrøgstadtrogstadgrimstadflakstadgjerstadxn--sandy-yuaxn--leagaviika-52bnore-og-uvdalvegarsheixn--rlingen-mxaxn--ggaviika-8ya47hvegårsheikarlsoykvitsoymasfjordenhamaroyinderoyosteroydavvenjárgasauheradguovdageaidnuxn--vre-eiker-k8abronnoysiellakkrødsheradkrodsheradkvinnheradbrønnøyxn--mtta-vrjjat-k7afxn--lrenskog-54akvitsøyvárggátkarlsøyosterøyinderøyhamarøybronnoysundxn--aurskog-hland-jnbbahccavuotnabáhccavuotnagiehtavuoatnastor-elvdalmidtre-gauldalxn--gildeskl-g0akarasjokevenassixn--bievt-0qaxn--yer-znalebesbynessebyxn--hbmer-xqamalselvmålselvxn--unjrga-rtamøre-og-romsdalmore-og-romsdalhareidmelandørlandorlandstrandålgårdsolundalgardafjordåfjorddielddanuorrikautokeinoxn--stre-toten-zcbskodjeaejriestangeliernebamblestokkefauskesnåasesnaasekongsvingerlangevagberlevagxn--flor-jrahattfjelldalostre-totenøstre-totenvestfoldxn--mely-iraálaheadjualaheadjunordreisaxn--troms-zuaxn--lgrd-poacporsangerflatangerstavangerleikangerbremangersamnangergieldakarasjohkaxn--rdy-0nabfrostautsirasnoasatromsaxn--sr-aurdal-l8aflekkefjordjølsterjolsteraremarkhedmarknååmesjevuemienaamesjevuemiexn--vard-jrarollagmeråkermerakerorskogørskogxn--bdddj-mrabdákŋoluoktaxn--osyro-wuaaknoluoktatrysilskjervøymandaljondalbindalrindalmeldalsuldalorkdalsigdalalvdallærdalhurdalsirdalverdallerdallardaloppdalåseralaseralhadselkragerødivttasvuotnaoverhallasteinkjerxn--hnefoss-q1askedsmokorsettromsøxn--dyry-iravestre-totenmuseumxn--sandnessjen-ogbrahkkeravjufylkesbiblbájddarbajddarxn--laheadju-7yarennesøyxn--koluokta-7ya57hxn--hgebostad-g3aleirfjordstorfjordbalsfjordbåtsfjordbatsfjordmuosátbievátloabátkárášjohkanøtterøyxn--mjndalen-64anordkappláhppilahppialstahaugsiljanverranrøykenroykenhaldenlyngenbergenhortenhønefosshonefosstroandinbeiarnvarggatosoyroosøyrotromsoidrettmuosatbievatruovatloabatvoagattynsetnessetxn--indery-fyaskánitskanitraholtråholtxn--ystre-slidre-ujbandebusarpsborgbearduxn--karlsy-fyahordalandjorpelandjørpelanddeatnuringsakersør-odalsor-odalxn--slt-elabringerikeaudnedalnittedalnissedalhemsedalslattumsurnadalxn--blt-elabelverumstjørdalnaustdalhjartdalgjøvikfyresdalhasviknarviklarvikgjovikmalvikgamviklenvikporsgrunnstjordalengerdaldrobakdrøbakxn--msy-ula0hvestvagoyxn--vgan-qoaxn--ryken-vuaxn--lten-graxn--stfold-9xaxn--hpmir-xqaxn--lury-iramálatvuopmimalatvuopmitysværkirkenesbirkenesmoskenesbáidárxn--fjord-lraxn--rdal-poabahcavuotnabáhcavuotnaxn--frde-gralindåsbearalvahkixn--hobl-iraráhkkerávjuxn--loabt-0qavågåáltábodøsundlundraderådeetnetimeholeauregrueoddavagavegaranatanaarnasolasulaaltalekafusavangbergkvamåmliamlibokntinnroangranosenoslobodorøstroststatåmotamotivguprivøyeroyerliermossvossxn--nvuotna-hwalusterlunnermarkerhábmerhabmerhvalerfjalerxn--rholt-mratysvarbaidarfitjargaularhápmirhapmirmelhusfosnesøksnesoksnestysneshemnesevenesflesbergeidsbergtonsbergtønsberglindasxn--sndre-land-0cbnamsosxn--srum-graøystre-slidreoystre-slidrevestre-slidretrondheimbalestrandxn--langevg-jxaaustrheimxn--skjk-soavagsoyaveroysandoykarmoyfinnoytranoyvestbytranbysykkylvenxn--hyanger-q1aspjelkavikandasuoloxn--fl-ziaxn--drbak-wuastathellexn--sr-varanger-ggbtelemarkxn--bhcavuotna-s4axn--porsgu-sta26fčáhcesuolocahcesuoloakrehamnåkrehamnsandøykarmøyfinnøytranøyvågsøyaverøynamdalseidxn--lesund-huabadaddjaxn--vegrshei-c0axn--btsfjord-9zagildeskålporsanguxn--trgstad-r1anávuotnanavuotnahammerfestxn--sgne-graxn--brnny-wuacibestadharstadnarviikaevenáššivestnesgjemnessandnesagdenesrennesoyxn--avery-yuaxn--tysvr-vrabearalváhkikongsbergspydebergrandabergxn--andy-iradavvesiidaxn--krdsherad-m8aporsáŋgufredrikstadbjerkreimringeburennebuaurskog-holandnotteroyxn--vgsy-qoa0jxn--rmskog-byaskierváivelandbyglandfrolandaurlandforsandxn--bjddar-ptamidsundålesundalesundfetsundfarsundovre-eikerøvre-eikerakershusxn--moreke-juasørfoldøstfoldostfoldsorfoldhøyangerhoyangerlevangerorkangertanangerxn--vestvgy-ixa6olillesandulsteinxn--rennesy-v1agranvinskjervoyxn--klbu-woalavagisxn--h-2faxn--ryrvik-byakafjordkåfjordseljordfolkebiblxn--gjvik-wuajevnakerxn--kfjord-iuabudejjuxn--kranghke-b0axn--davvenjrga-y4axn--rland-uuaxn--ldingen-q1axn--mlselv-iuaxn--rady-iraxn--linds-prabrumunddalxn--ygarden-p1amo-i-ranaeidskogrømskogromskoghjelmelandxn--finny-yuaxn--sr-odal-q1axn--skjervy-v1aballangenkvanangenkvænangengratangenxn--hmmrfeasta-s4acvossevangensuohkanxn--rde-ulaxn--mli-tlaxn--ksnes-uuanordlandskanlandskånlandsortlandfuoiskuxn--rros-graxn--hcesuolo-7ya35bxn--eveni-0qa01gagaivuotnagáivuotnaxn--seral-lradrammenmodalenmosjoenjan-mayentorskensteigengloppenxn--snes-poamatta-varjjatxn--sr-fron-q1aomasvuotnajessheimbådåddjåxn--krager-gyaxn--kvfjord-nxaxn--asky-iraxn--snase-nraxn--bidr-5nacholtålenxn--vads-jraxn--jlster-byamosjøenxn--rst-0nastavernxn--ostery-fyaxn--oppegrd-ixaxn--sknit-yqaxn--risa-5naoppegårdskiptvetrendalenholtalenxn--mot-tlaxn--lhppi-xqaxn--holtlen-hxaxn--srreisa-q1akopervikxn--muost-0qaxn--bmlo-grahokksundkvalsundegersundxn--karmy-yuaullensakerxn--hylandet-54axn--kvitsy-fyaxn--bod-2nalangevågberlevågkristiansandxn--rsta-frahornindalstjørdalshalsenstjordalshalsensandnessjoenhámmárfeastaxn--lrdal-srasør-fronsor-fronnord-odalkristiansundmátta-várjjatvestvågøynesoddennotoddenbuskerudøygardenoygardensalangenlavangenralingenrælingenlodingenlødingenleaŋgaviikalaakesvuemieleangaviikauenorgexn--srfold-byaaskvollxn--rskog-uuaxn--nry-yla5gxn--vry-yla5ghammarfeastaxn--rhkkervju-01afxn--givuotna-8yakommunekrokstadelvanedre-eikerhagebostadhægebostadxn--berlevg-jxakviteseidxn--s-1faxn--l-1faxn--nmesjevuemie-tcbafuosskomoårekemoarekexn--lt-liacxn--jrpeland-54asvalbardoppegardholmestrandtvedestrandsogndalsokndalarendalsunndalfolldalxn--krjohka-hwab49jlyngdaletnedalnorddalsaltdalgausdalskedsmovaksdalgjesdalstordalxn--frya-hraaarbortedrangedalxn--smna-graaurskog-hølandxn--vg-yiabtjeldsundhaugesundlindesnesxn--mre-og-romsdal-qqbxn--dnna-gradyntmpheremerseineshacknetenterprisecloudmineaccomaorimāoriorgmilcriiwigennetschoolhealthkiwigovtgeekxn--mori-qsacloudnsparliamentcomedorgcompronetedugovmuseumwebsitekinservicebarsywebsitebuildereerobookheimdnsleapcelleero-stagetechcrscsslorigingohomecdbedeeeiemesecabgngilnlalplchfisiincnnoroptatitmtltruauhulumkdkukskjplvtrgrfrkrhrusesismycynzcznetinteduassoososcloudstgbetaaezaeuhkusjshatenadiarycdn77hoptozaptois-a-knightmyftpno-ipjpnddnssdpdnsspdnsbarsysweetpepperis-a-bruinsfanis-very-sweetservegameis-a-soxfanhomelinuxcdn77-secureservebbsmisconfusedwebredirectblogsitefreedesktopcouchpotatofriestoolforgeaccesscamis-lostreadmyblogsmall-webfedorapeopleserveftpis-a-celticsfanmywirepotagertwmailin-dslsellsyourhomeread-booksfreeddnscable-modemis-savednflfanufcfanmlbfanstuff-4-saleendoftheinternetin-vpnmy-firewallhomeftpis-localis-a-chefboldlygoingnowherewebhopselfipkicks-assroxatunkcamdvrfedoraprojectgotdnsdvrdnsdyndnspubtlspimientahomeunixdontexistfedorainfracloudwmflabsfspagesbmoattachmentsteckidsfamilydsdnsaliasdynaliasnow-dnscloudnsdoomdnsduckdnsblogdnshomednsroutingthecloudendofinternetdsmynasip-dynamicpoivronhttpbinmyfirewallis-very-evilmysecuritycamerais-a-linux-userwmcloudis-a-geektuxfamilyis-a-candidatedoesntexistis-very-badhobby-sitegame-hostaltervistais-foundis-a-patsfandnsdojohepforgepodzonedynservcollegefanis-very-goodfrom-meis-very-niceisa-geeknerdpolacmedsldingorgcomnomgobabonetedupleskaemhlxmyboxrockyprvcydeuxfleurspdnscodebergheyflowstatichostorgmilcomnomgobneteduorgcomeduiorgmilcomngonetedugovcloudns1337ngrokacorggogfamcomwebgobnetedugokgopgkpgovgosbizpasaugumicsopozpapuwmwsrprusiskwpspkppspkmpspokeoiawsawifoumsdnskokwpmuppuppsppiwwiwoowuzswkzoschrzpisdnwzmiuwwitdpssewsseumigugimoirmpinbwinbwiihupporzgwgriwupowwskrwioswuozstarostwokonsulattmpccopruszkowmyspreadshopostrodakartuzyopolegminamediaustkazgorajgoraolawailawalomzawloclradombytomjaworznotargilubinkoninzagantorunkutnokepnonakloczestsopotsanokturekplockslasksklepzarowlukowmedaidgdaorgmilrelcomnomatmgsmartneteduelkgovwawsossexbiztgorysejnytychypomorzeboleslawiechomesklepsdscloudunicloudzakopanelegnicarawa-mazbydgoszczswidnikkrasnikwloclawekbielawamragowograjeworealestatebeskidykaszubymalopolskaprzeworskswiebodzinlecznadfirmaszkolawarmiagdyniamiastakazimierz-dolnymalborkswidnicadlugolekaostrolekapodlasieelblagtravelsimplesitezachpomormielecszczecinnieruchomosciwalbrzychlezajsklublinbedzinpoznanwielunmielnooleckostarachowicedkontopowiatwroclawrybniksuwalkileborkslupskgdanskostrowwlkptarnobrzegtourismwegrowkrakowglogowyou2pilanysamailwrocinfoagroautobeepshoppriviqhslapypiszlodzcfolksecommerce-shopmazurypulawyskoczowrzeszowpomorskiezgierzkaliszolkuszlowiczostrowiecsosnowiecmazowszewodzislawbialowiezazgorzeleckatowicepabianicejelenia-gorawolominkarpaczsieradznowarudaczeladzkonskowolaskierniewiceswinoujscieturystykabieszczadycieszynketrzynolsztynbialystokbabia-goraprochowicewarszawastalowa-wolapolkowicegorlicegliwiceponiatowalimanowalubartowaugustowkobierzyceopocznognieznoszczytnokolobrzegshoparenapodhalebielskoklodzkostargardatwithplayitownnamecoorgnetedugovacorgcomproestnetedugovbiznameislaprofinforechtngrokmedaaaacacpaenglawjurbarbarsykeeneticavocatacctcloudnsorgcomsecplonetedugov123paginaweborgcomnetintedugovnomepublidkinbarsygovx443cloudnsorgmilcomnetedugovcooporgmilcomschnetedugovnamecomcannetlibassoaemclantmcontstoreorgcomnomrecwwwbarsyfirminfoshopartsstackitmyddnswebspacelima-cityacincooxorgedugovbarsybrendlyhbvpsvpsspectrumlandinghostingacppmordoviamcprecbgorgmilcomspbnetintedumsknovgovbirrasmcdirmytismircloudvladimirnalchikadygeyamarinepyatigorskmyjinobashkiriaeurodirvladikavkazna4ugroznykustanaikalmykiacldmaildagestaniranbuildcloudcanvaliaravalwixdevelopmentappwritemigrationneedleverceldatabasestackitcodereplravendbonporterlovableaccoorgmilnetgovcoopmedorgcompubschnetedugovservicemecomygovorggovtvmedorgcomnetedugovinfoedgfacbmlonihkutwpsryxzbdtmacfhppmyspreadshopbrandpartiorgcomfhvpress123minsidaitcouldbeworlanbibkommunalforbundfhskiopsyskomvuxkomforbnaturbruksgymnloginlineorgcomnetedugovenscaledeuusentsurgebotdaorgmilcomnetgovnowteleporthashbangplatformlovablebarsyshopwarebasehoplixbarsyonlinemsf5gitappgitpagewawamscofigma-govcaffeinefigmacanvasoltstscwputerbarsysupportchatgptsquareomniweopensocialcpanelplaycodenotionnovecorewpsquaredpreviewjelecyonbyensrhtfastvpspieboxconvexjouwwebheyflowplatformshloginlinemadethissourcecraftclouderaorgorgcomartedugouvunivmeorgcomnetedugovsurveysstatichfheiyuxs4allprojectmyfastubervibehostapp-ionosdeployagentmecoorgcomschnetedugovbizcncostoreorgmilcomneteduembaixadaconsuladokiraranohoprincipesaotomeheliohobarsystorebaseshopwaresellfyaiabkhaziavologdamordoviapenzalenugsochinavoiexnetspbmsknovnorth-kazakhstanashgabadkareliaarmeniageorgiavladimirnalchikivanovobukharaadygeyakhakassiakalugakrasnodarjambylaktyubinsktroitskbryanskobninskkurganazerbaijanpokrovskbashkiriatselinogradvladikavkazmurmansktulatuvamangyshlaktashkentchimkentgroznykaragandatermezarkhangelskkustanaikalmykiabalashoveast-kazakhstankaracoldagestantogliattibarsyredorgcomgobedumirenknightpointaccoorgjelasticdiscoursecleverappsschacmiincogoornetonlineshopcogoorgmilcomwebnicnetintedugovbiznametestcoorgmilcomnomnetedugovorangecloudpersoindorgcomfinnatnetgovensmincomtourismintlinfox0611oyaorgmilcomnetedugovquickconnectvpnplusnettprequalifymeaddrmyaddrntdllwadlnctvavdrk12orgmilpolbeltelcomwebgennetedutskkepgovbbsbiznameinfocoorgmilcompronetedugovbiznameinfobetter-thanworse-thansakurafromdyndnson-the-webmymailerorgmilurlcomneteduidvgovmydnsgameclubebizmeneacsccogotvorhotelmilmobiinfovodteiflgplkmsmsbcckhincndnvncoztltmkckppzpdprvcvkvlvcrkrkscxuzchernovtsyrivneyaltaodesavolynrovnolutskltdinforgcomnetedugovbizvinnicazhitomirternopilpoltavakropyvnytskyizaporizhzhiasevastopolsebastopoluzhgoroduzhhorodkharkovkharkivvinnytsiakhmelnytskyizaporizhzhecrimeaodessazhytomyrnikolaevcherkassydonetskluganskluhanskkirovogradivano-frankivskchernivtsikrymkievkyivlvivsumyzakarpattiamykolaivcherkasychernigovkhersonchernihivdnipropetrovskdnepropetrovskkhmelnitskiyneacsccogoorusorgmilcomedugovmyspreadshopadimono-ipbarsybarsyonlinelayershiftnh-servretrosnubapicampaignservicelugaffinitylotteryweeklylotteryraffleentrygluglugsmeaccoindependent-inquestnimsitecopropymntltdorgplcschnetgovnhsbarsyindependent-commissionindependent-reviewpolicepublic-inquiryindependent-panelconnhospindependent-inquiryroyal-commissionoraclegovcloudappscck12libaws-govccphxcclibpvtparochchtrcck12libcceatonk12coglibtecgendstmusann-arborwashtenawcck12glghcck12sealibforksolympiabainbridge-islkeyporthoquiamyarrow-pointcentraliaport-townsendsequimport-ludlowrentonsilverdalebremertonredmondsheltonbellevueport-orchardport-angeleskingstonchehalisaberdeengig-harborseattlepoulsboidmdndsddemenegacalamaiavawapailalflnmdcncscohnhmihiviwiriinmntnmocoutvtctmtgunjokakwvnvprarorasmskstxwynykyazisadninsnngosrvis-bymircloudservernamepointtoenscaledland-4-salefreeddnsstuff-4-saleazure-apinoipdatabricksappscloudnsgolffanheliohostazurewebsitesgvorgmilcomgubneteducoorgcomnetd0egvorgmilcomnetedugovmydnsiacostoree12orgmilcomnomwebgobbibrectecnetintedugovraremprendefirminfoartseducok12orgcomnethidnsidacaiiosonlahanamhanoicamauhueorgcompronetintedugovbizbacninhtayninhhoabinhnamdinhtravinhhaiphongvinhlonghaiduongquangnamquangtrithuathienhuequangninhbacgianghaugiangquangbinhsoctrangbentrethanhphohochiminhdanangkontumhatinhkhanhhoathanhhoahealthgialailaocaiyenbaibackanngheanlonganphuyenphuthocanthodaklakdongnainameinfovinhphucdongthapkiengiangtiengiangquangngailaichaulangsonlamdongdaknonghagiangangiangcaobangbinhduongninhthuanbinhthuanbaclieuthaibinhninhbinhbinhdinhtuyenquanghungyenbaria-vungtauthainguyendienbienbinhphuocschbizputerimagine-proxyorgcomnetedugovcloud66advisormypetsdyndnsxn--8dbq2axn--4dbgdty6cxn--5dbhl8dxn--hebda8bxn--80auxn--d1atxn--c1avgxn--o1acxn--o1achxn--90azhxn--55qx5dxn--uc0atvxn--od0algxn--wcvs22dxn--gmqw5axn--mxtq1mxn--12c1fe0brxn--h3cuzk1dixn--12co0c3b4evaxn--12cfi8ixb8lxn--o3cyx2axn--m3ch0j3axn--j1adpxn--90amcxn--90a1afxn--h1ahnxn--j1ael8bxn--h1alizxn--c1avgxn--j1aefxn--80aaa0cvacxn--41acaffeineexeopentunnelbotdashtelebitorgtmaccoagricorgmilnomwebnicngonetaltedugovlawnisschoolgrondaraccoorgmilcomschnetedugovbizinfoprg1-zeropstritonstackitlimazeropsaccoorgmilgovяспборгкоммскбизмирсамаракрымсочиакодпроргобрупрצהלממשלישובאקדמיהองค์กรธุรกิจรัฐบาลศึกษาทหารเน็ต教育網絡組織公司政府個人닷넷한국澳门新闻澳門联通家電嘉里招聘通販닷컴삼성コムგეбгрфеюadcdbdgdidmdsdtdaebedeeegeiejekemenepereseveyegabacalamanauavapaqasazacfbfafgfnfpfwftfbgcgagggegkgngmgsgpgvgtgugilmlnlalclglplsltlhmimjmkmmmomambmcmdmfmgmzmpmsmtmgbbblbsbecccacnclcmcvctcscmhkhghchbhthphshlinikifigiaibicivisikninhnmncnbngnsnpnvntnjoionomobocoaofodorosotoptstttytatbtetgtithtmtltrusuvuaucueuguhulumunufjdjbjtjsjlkmkhkfkdkcktkukskpkgpmpnpkpjpgqaqmqiqsvtvcvbvmvlvrwpwtwzwbwcwawgwkwmwtrsrprgrfrercrbrarnrmrlrkrirhrwsusrssspsgsesbsaslsmsissxmxaxcxuypysylymykygybycyuztzsznzmzkzdzczbzazελευ世界台灣购物公益点看臺灣网络書籍在线网站手机机构大拿游戏信息台湾谷歌慈善商标香港中国餐厅网址中國商城食品微博政务移动集团公司八卦商店健康网店政府时尚佛山中信娱乐广东企业homedepotengineeringاماراتrepublicankuokgroupversicherungchannelcitadelxn--pgbs0dhxn--b4w605ferdstatebankwebsitexn--mgb9awbf亚马逊淡马锡alibabaxn--ngbc5azdxn--mgbbh1axn--45br5cyltoshibabuildworldcloudtradeguideplacespacedancemoviephoneprimesmilebiblestyleappleazurestoreskypegripexn--l1accdrivelottehorsehouseleasechasereisestadahondaomegaaetnaamicaninjanokiamediadeltavodkaedekaosakapizzaslingemailgmailtirolshelltmallfinallegaltotalhotelamfamforumrehabmusicciticricohcoachwatchboschearthfaithirishmiamiarchidubaiguccipraxiみんなストアセールcanonsalononionnikonepsonkoelngreensevencrownikanoradioaudioweiboglobopromogalloyahoociscorodeovideomangobingotokyovolvolottokyotophotosmartsportquesttrusthyattjetztadultcymrubaidutushuxn--kprw13dubankclickblackmerckgroupsharpcheapnowtvxn--h2brj9cקוםհայоргсрбмонкомбелмкдқазрусукрمصرقطرعربكومdadcfdmedwedredphdthdbidpidkrdmsdltdiceonewmeglemoerwecfageacbanbambaaaammakianraspacpaaxawtfbcgaegongingaigvigorgdogdhlmilrilonlaolloluoljllcalgalnflafltelsrlfrllplkimibmcamcombommomifmabbjcbscbwebcabnabtabmlbpubabcbbcnecincpncllcstcwtcpwcnyckfhbzhovhmoiskiobisbitcifyituipinvinwinxincbnbcnmanfangdnmenrenkpnmtnyunrunfununobiojioriohbogmofooboooooacoecoceongoproartistottnttbbtcateatlatvetpetbetnethktmitfitintjothotgotdotbotprueduicujnjyouinknhktdkappsapgapmapdnptopgopllpjmpzipvipripesqtrvdtvitvdevmovgovhivnrwlawsewnewbmwwownowhowdvrftrmtrsfrbarcartvscrseusawsupsubssbsadsddsldssasbmsmlsxxxboxfoxgmxtjxsextaxbuyflydiysoyjoyskypaydaygayxyzanzbizwebersenerpokerlameractortatarsolarລາວคอมไทยtourslocusnexuslexusgiftsbeatsboatspartspressglassswissकॉमनेटtiresgivescodeshomesgamestunesshoescardswalesloansvegastoolsdealsautosparisファッションworkssucksrocksxeroxforexfedexpartylillymoneystudyrugbytoraytoday中文网xn--unup4y天主教飞利浦新加坡enterprises我爱你嘉里大酒店christmasxn--fct429kholdingsxn--8y0a063axn--mgbx4cd0ablifestyleabogadoallstatenetbankكاثوليكxn--s9brj9cxn--gk3at1ebestbuycharityxn--55qx5dmicrosoftpropertybasketballhomegoodscorsicajewelrygallerygrocerysurgerycountrybrusselsverisignferreroxn--czr694bhdfcbankcommbanksoftbankپاكستانپاکستانnextdirectالسعوديهالعليانxn--h2brj9c8cxn--80adxhksshikshaxn--mgbai9azgqp6jcuisinellabarclayscatholicxn--kpry57dcompanyxn--xhq521bblackfridayxn--mgba3a3ejtsandvikxn--d1acj3bacademydownloadمليسياxn--j1amhxn--w4r85el8fhu5dnraipirangaathletaxn--fhbeixn--mgbqly7cvafrzuerichxn--c2br7gஇலங்கைcontractorsxn--io0a7igraphicsinsurancetemasekxn--xkc2al3hye2amotorcyclesphotographydirectoryplumbingxn--vhquvclothingtrainingcleaningwilliamhilllightingxn--mgba3a4f16ashoppingcateringeducationokinawapicturesventuresproductionsxn--9et52uwalmartഭാരതംsupportrealestatecapitalonexn--nqv7fs00emaauspostfloristdentistxn--qxamgodaddybradescobargainsmitsubishikerryhotelsxn--9dbq2axn--3pxu8kimmobilienxn--fjq720axn--mgbtx2bholidaymckinseymadridbusinessbuildershelsinkixn--4gbrimмоскваالسعودیةcoffeedegreelacaixapartnersalsaceofficeabbvievoyageorangegeorgeonlinechromemobilekindlegoogleoraclecircleschulesecureinsurexn--mgba7c0bbn0aestatexn--mgbc0a9azcgcruisehangoutxn--vuq861bxn--42c2d9arexrothfirestoneuniversityxn--nnx388alifeinsuranceextraspaceонлайнvermögensberatersoftwarexn--fiqs8sxn--mgbab2bdxn--w4rs40ltiendaभारतम्africatoyotaotsukasakuracameracreditcardnagoyaconsultingnetworkjunipertheatermonsterprogressivepioneerxn--55qw42gracingdatingvotingvikinglivinggivingxn--bck1b9a5dre4cbrotherweatherjoburgفلسطينlplfinancialxn--clchc0ea0b2g2a9gcdfutbolschoolsocialglobaldentalwoodsidechanelairtelmatteltravelrealtorwebcamstreamభారత్unicomalstomxn--nodexn--6frz82gmuseumfurniturexn--rvc1e0am3exn--mix891faccenturexn--11b4c3dismailineustardiscountquebeccomsecclinicservicesxn--y9a3aqxn--c1avgswatchchurchsearchالاردنmarketingcontacthealthmonashshoujisanofitaipeiamericanexpresssuzukiアマゾンクラウドポイントbhartiグーグルxn--mgberp4a5d4armemorialxn--1qqw23alondonmormoninstitutevisionbostonnortoncouponmaisonamazonvirginberlindesigndurbanolayannissananquanxihuanhitachikaufengardenreisenbayerntechnologydatsunxn--90a3aclatinocasinostudiophysioxn--ngbe9e0apharmacytattootaobaoaramcoexpertreportabbottdirectselectimamatfairwindspictettargetmarketintuittravelersinsurancecreditdupontryukyusuppliesxn--tckwebnpparibasschmidtmerckmsdyodobashirestaurantbridgestonecricketxn--fpcrj9c3dbostikbroadwayattorneylefrakemerckxn--fiq228c5hscareersfarmerswinnersflowersxn--wgbh1cguitarsxn--54b7fta0ccxn--p1acfmakeupgalluplandroverxn--kcrx77d1x4agoldpointbauhausxn--mgbayh7gpahiphopplaystationxn--mgba3a4fraxn--eckvdtc9dhyundaixn--gckr3f0fistanbulticketsmarketsflightschintaireviewsxn--3e0b707ewindowsxn--fiqz9sfinancialxn--fzys8d69uvgmابوظبيdiscoverreviewবাংলাxn--5su34j936bgsgmoscowobserverapartmentsдетиارامكوсайтeurovisionxn--i1b6b1a6a2exn--xkc2dl3a5ee0hتونسموقعبارتڀارتشبكةعمانبيتكعراقreadkredbondlandbandfundfoodprodgoldfordtubecafesafelifeggeeieeefreefagepagegugezonewinememenamegamesaleablebikenikelikecarecbreherefiresaveloveliveblueartedatesitevotecaseluxebofamodaltdaasdatiaayogasinavanashiaasiajavabbvatevavivadatazaraarpacasavisasncfprofmaifsurfgolfdvagsongbingpingwangkpmggoogblogpohlfailcooldellcalldeallidlsarlfilmteamroomfarmimdbarabclubhdfcicbchsbcgmbhrichtechfishdishcashminiernikddiaudiwikimobitaxicitikiwidesiqponskinloanakdnwienopenporncerntownimmolimoolloinfonicofidolegosaxozeroaerovivoautovotomotofastbestresthostpostnextlgbtchatseatgiftmeetdietreitmintrentgentspotscotguruitausohumenucyoubanklinkpinkdclktalksilkbookseekworkrsvpaarpjeepshopcoophelpcamppccwshowbeerstarruhrflirweirhaircarsparsjprshausplusnewstipstoysjobskidsfanspicsdocsxboxamexsexynavycitysonyarmyallybabyplaydeliverybuzzgbizlamborghiniphilipsලංකාಭಾರತfitnessexpresslanxesspfizercenterwalterlawyersoccercareerkosherbrokerlockerdealerdoctorauthorxn--mgbqly7c0a67fbcvermögensberatungjaguarxn--pssy2uxn--hxt814eflickrrepairrogersairbusxn--mgbai9a5eva00beventsyachtsxn--t60b56aভাৰতভারতभारतभारोतviajeshermeshughesxn--j1aefसंगठनvillasଭାରତclaimshotelsભારતzapposphotosjuegoscondostatamotorsgratistennisਭਾਰਤtkmaxxtjmaxxschaeffleryandexxn--80aswgrealtysafetybeautyluxuryxn--3ds443gsupplyfamilyxn--o3cw4hhockeysydneyxn--90aenissayalipayenergycomputeragencyxn--rovu88b電訊盈科xn--gecrj9cstatefarmaccountantaquarelleolayangroup香格里拉xn--p1ai组织机构xn--1ck2e1bxn--mgbt3dhdschwarzموريتانياabudhabinowruzkomatsufujitsuhospitalxn--80asehdbxn--mgbtf8flxn--j6w193gxn--yfro4i67oprudentialxn--flw351ecruisescoursesrecipesxn--e1a4cferrarixn--ses554gxn--wgbl6awatchesstaplessinglesxn--mgbcpq6gpa1axn--otu796dpropertiescreditunionxn--mgbah1a3hjkrdstockholmhisamitsuالسعوديةstcgroupdomainsoriginscouponsbloombergclubmedfroganslimitedxn--80aqecdr1aexposedinternationalequipmentbarclaycardxn--q7ce6axn--mgbi4ecexpprotectionassociatesconstructionxn--cck2b3bxn--45q11candroidfoundationישראלxn--mgbca7dzdocliniqueboutiqueengineerxn--qxa6asystemsfirmdalefashionauctionxn--nqv7finfinitirentalsreliancetradingweddingfishinghostinggentingbookingcookingxn--3hcrj9cgraingerxn--czrs0tdemocratsamsungyokohamaxn--h2breg3evexn--nyqy26alundbeckmelbournevacationssolutionsfrontierxn--vermgensberatung-pwbmanagementxn--cg4bkixn--mgb2ddeslincolnhamburgsandvikcoromantblockbusterairforcebarefootxn--4dbrk0ceinvestmentsfeedbackcommunityxn--ngbrxالبحرينdiamondsamsterdamhealthcareredumbrellaxn--mxtq1mxn--2scrj9cagakhanxn--mgbpl2fhкатоликcaravanசிங்கப்பூர்richardlimortgageamericanfamilyxn--fzc2c9e2cscholarshipssaarlandxn--imr513nvlaanderensamsclubgoodyearkitchenஇந்தியாweatherchannelallfinanzxn--kput3iالسعودیۃxn--90aisxn--efvy88hالجزائرxn--mgbaam7a8hexchangejpmorganxn--tiq49xqyjfidelitysecurityxn--mk1bu44cwanggouxn--fiq64bxn--6qq986b3xlxn--mgbbh1a71exn--80ao21amarshallsxn--5tzm5gtravelerspanasoniclatrobeyoutubeaccountantsxn--rhqv96gxn--cckwcxetdanalyticsxn--ygbi2ammxبازاربھارتسوريةorganicfreseniusسورياxn--9krt00axn--qcka1pmcxn--jlq480n2rgdeloittesciencefinancexn--jvr189mxn--30rr7yhomesensehotmailbaseballfootballleclercboehringerxn--q9jyb4cxn--mix082fاليمنهمراهpolitieسودانايرانایرانnetflixyamaxunxn--lgbbat1ad8jcollegestoragecapetowncolognekerrypropertiesxn--mgbgu82axn--ogbpf8flxn--czru2dwhoswhociprianilasallexn--g2xx48cforsalebanamexaudiblexn--vermgensberater-ctbxn--zfr164bericssonvanguardxn--45brj9cindustriestheatremarriottxn--3bst00mcomparexn--mgberp4a5d4a87gcapitaldigitalالمغربbarcelonashangrilaxn--d1alfcalvinkleinwwwcitysapporokawasakinagoyasendaikobekitakyushuyokohamackjp`.charCodeAt(t)===42&&(jL[e]=n),t=r}var ML=-1,NL=0,PL=0;function FL(e,t,n,r){if(wL[e]!==r)return!1;let i=kL[e];for(let e=0;e<r;e+=1)if(`orgmilcomschnetedugovdrrformsfeedbackofficialaccoorgmilschnetgovmagazinemediaunioncargopilotgroupcaarespressworksaerodromeworkinggroupair-traffic-controlaircraftaccident-preventioneducatormarketplaceambulanceinsurancecateringairportrepbodyenginesoftwaremodellingair-surveillanceconsultingchartertrainermaintenanceservicesdesignflightskydivingfreightassociationstudentgroundhandlingdgcafuelclubtaxicrewshowballooningexpresstraderbrokerauthoragentsairtrafficjournalistsafetyconsultantmicrolightaccident-investigationparachutingequipmentproductionfederationrecreationscientistnavigationengineertradingglidingleasingresearchpassenger-associationentertainmentparaglidinghangglidingaerobaticrotorcraftemergencycertificationgovernmentaeroclubexchangelogisticschampionshiphomebuiltcouncilconferencecontrolairlinecivilaviationjournalorgcomnetedugovcoorgcomnomnetobjofforgcomnetuwukiloappsframerorgmilcomnetedugovcoradioorgcomnetcommuneedogpbcoitgvorgedugov*spreviewfrontendrelayononstagingupid*mtls*privatelinktypedreamdeveloperbravemochawindsurfaivenmirenupsunwnextbegetngrokclerkwale2bwebcsbrunputerflutterflowspawnbaseshiptodaymagicpatternsnetlifyondigitaloceanrailwayhostedclaudehasurabotdashvercelgithubluyanigadgetreplitcloudflaretelebitedgecomputeevervaultexponyatnoopencrpplxzeaburwasmerframerzeropsrocketpreviewconvexmedusajsspritesonherculeseasypanelstreamlitglideossnowflakemesserliloginlinehackclubcodepennorthflankbase44corespeedleapcellngrok-freeclerkstagelovableon-fleek*us-west-3ap-south-2us-central-2us-central-1eu-central-1ap-south-1us-west-2us-east-2eu-north-1ap-north-1us-west-1us-east-1*rcloudintsegorgmilcomgobbetnetintedugovturmusicasenasamutualcoopip6uriurnin-addre164homeirisgovdixdaemoncloudnssthwien*inexexkunden4accogvormymyspreadshop4lima2ixortsinfofuturecmsfuturehosting12hpprivfuturemailinglima-cityfunkfeuer123webseitednshomemelmyspreadshopcloudletswasantqldvicactnswtascatholicwasaqldvictasidwasantozqldorgcomvicasnactnetedugovnswtasconfcomairflowlambda-urltransfer-webappairflowtransfer-webapptransfer-webapptransfer-webapp-fipstransfer-webappeu-west-3ap-south-2eu-south-2eu-central-2ap-southeast-3ap-southeast-4ap-northeast-3eu-central-1mx-central-1me-central-1ca-central-1il-central-1ap-northeast-1ap-southeast-1me-south-1af-south-1eu-south-1ap-south-1ap-southeast-7us-west-2eu-west-2us-east-2eu-north-1ap-southeast-2ap-northeast-2ap-southeast-5us-gov-west-1us-gov-east-1ca-west-1us-west-1eu-west-1us-east-1ap-east-1sa-east-1privatenotebookstudiolabelingnotebookstudionotebooknotebook-fipslabelingnotebookstudionotebook-fipsnotebookstudio-fipsnotebook-fipsnotebookstudionotebook-fipsnotebookstudioeu-west-3ap-south-2eu-south-2eu-central-2ap-southeast-3ap-southeast-4ap-northeast-3eu-central-1me-central-1ca-central-1il-central-1ap-northeast-1ap-southeast-1me-south-1af-south-1eu-south-1ap-south-1us-west-2eu-west-2us-east-2eu-north-1ap-southeast-2ap-northeast-2experimentsus-gov-west-1us-gov-east-1ca-west-1us-west-1eu-west-1us-east-1ap-east-1sa-east-1onrepostsagemakercopporgmilcompronetintedugovbiznameinfoshoprsorgmilcomnetedugovbrendlyresolvenzauscotvstoreorgcomnetedugovbizinfoidacaicoittvorgmilcomschnetedugovinfocloudezproxysiteacmymyspreadshopkuleuvenwebhostingtransurl123websitecloudnsinterhostsolutionsddns5476103298edgfacbmlonihkjutwvqpsryxzbarsycoororgcomedumyftpno-iporxcloud-ipfor-somemmafanfor-morewebhopselfipjozidyndnscloudnsdscloudfor-thefor-betteractivetrailcoeconorestooteorgcomeconeteduassurmoneyafricaarchitectesrestaurantloisirstourismavocatsinfoagrounivcoorgcomnetedugoviatvdeportesaludtksatorgmilcomwebgobnetinteducienciaboliviarevistacooperativaempresanombreindustriamusicapatriamedicinademocraciapoliticapuebloindigenaplurinacionalarteblogwikiinfoagrotransportenoticiasprofesionalacademiaeconomiaecologiamovimientotecnologianaturalsimplesitecepesebamapadfmgalampbacscpirngorotomtrjspaprrprrsesmscepesebamapadfmgalampbacscpirngorotomtrjspaprrprrsesms*biaamfmtcmptvfeirasampajampanatalbelemananiradiog12medindfndbmdtrdthepoaggfjdfdefinfenflegsegongengcngorgzlgslglogppgmillelqslcimcomnomadmjabimbbibbsbabcrectecsjcetcpscpvhudieticriapipsiecnbiorioecogeoteoodoproatoartfstmatvetdetbetnetcntnotfotgrueduajuespappreptmpemparqsrvadvdevgovntrturagrjorfarjusmusdesvixxyzcozfozslzbhzmaringasantamariacampinagrandegoianiasorocabafloripasaobernardocuritibaboavistarecifeaparecidasaogoncasalvadorcuiabamorenamacapalondrinacontagemsocialfortalmaceioleilaoosascoriobranconiteroi9guacutcheblogflogvlogwikitaxicoopmanauspalmascaxiasjoinvillebaruericampinassantoandreribeiraoriopretoweorgcomnetedugovv0windsurfshiptodaycloudsitecoaccoorgnetgovofmilcomgovmediatechzacoorgcomnetedugsjgovmydnspenfnlabnbmbgcbcqconcontnuyksknsmyspreadshopno-ipawdevboxbarsyonidatemfuinabusavinstanceseceuguukussryzespawncsxcloud-ipmyphotosfantasyleaguetwmailcleverappsscrappingccwucloudnsftpaccessgame-serverccgovobjectsrmalpgcust*svcalp1aeappenginermalpgmyspreadshop4lima2ixsquare7cloudscale123websitefirenet12hpflowgotdnslinkyard-cloudcloudnslima-citydnskingobjectstorageedaccogoorusorgcomnetinteduaéroportxn--aroport-byaassogouvcomilgobgovcloudnses-1eu-west-1us-east-1euvipit1eurarubait1s3lbwebsites3websiteru-spbru-mskelasticcsrunstnukukcaukusnl-ams-1fr-par-1fr-par-2functionsnodess3ddlwhmrdbfnck8sifrs3-websitecockpitscblmgdbdtwhkafkpubprivs3ddlwhmrdbk8sifrs3-websitecockpitscblmgdbdtwhkafks3ddlrdbk8sifrs3-websitecockpitscblmgdbdtwhkafkk8sscalebookpl-wawfr-parnl-amsbaremetalsmartlabelinginstancesdechk2kuleuvenlaravelvoorloperurownoxazapscwhstgrvaporonline-serverobservablehqelementorantagonistreclaimjoteluluencowaydiademjelasticmatlabmagentositetrendhostingaxarnetperspectajenv-arubajelejoteravendbemergenttrafficplexconvexkeliwebserveboltbegetcdnstaticson-rancherprimetelonstackitunison-servicesdnshomelinkyardbarsyjelecloudnscocomnetgovmycn-northwest-1cn-north-1s3s3-accesspoints3-websites3s3-accesspointrdsdualstacks3-deprecatedemrappui-prods3-websiteemrstudio-prods3-object-lambdaemrnotebooks-prodexecute-apis3s3-accesspoints3s3-accesspointrdsdualstackemrappui-prods3-websiteemrstudio-prods3-object-lambdaemrnotebooks-prodexecute-apicn-northwest-1cn-north-1cn-northwest-1ebcomputeelbcn-north-1airflowcn-northwest-1cn-north-1oncn-northwest-1cn-north-1amazonawssagemakeramazonwebservicesdirectasgdsdhehahljlnmhbacscahqhshhihnlnynsnmofjbjzjxjtjhkcqtwgsjssxnxjxgxxzgz網絡网络公司orgmilcomnetedugovxn--55qx5dcanva-appsxn--io0a7iquickconnectcanvasitekhsjxn--od0algcanva-codemyqnapcloudsrvrlessclustersrealtimestorageleadpagescarrdcrdorgmilcomnomnetedugovhidnssupabaserdpareplmypiumsoxmitotaplpagesfirewalledreplitowodevwebview-assetsvfswebview-assetss3s3-accesspointdualstackemrappui-prods3-websiteaws-cloud9emrstudio-prods3-object-lambdaemrnotebooks-prodexecute-apicloud9eu-west-3ap-south-2eu-south-2eu-central-2ap-southeast-3ap-southeast-4ap-northeast-3eu-central-1me-central-1ca-central-1il-central-1ap-northeast-1ap-southeast-1me-south-1af-south-1eu-south-1ap-south-1ap-southeast-7us-west-2eu-west-2us-east-2eu-north-1ap-southeast-2ap-northeast-2ap-southeast-5ca-west-1us-west-1eu-west-1us-east-1ap-east-1sa-east-1s3s3-accesspointdualstackemrappui-prods3-websiteaws-cloud9emrstudio-prods3-object-lambdaemrnotebooks-prodexecute-apicloud9s3s3-accesspointdualstackanalytics-gatewayemrappui-prods3-websiteaws-cloud9emrstudio-prods3-object-lambdaemrnotebooks-prodexecute-apicloud9s3s3-accesspointdualstackemrappui-prods3-websiteemrstudio-prods3-object-lambdaemrnotebooks-prodexecute-apis3s3-accesspointdualstacks3-deprecateds3-websites3-object-lambdaexecute-apis3s3-accesspoints3-websites3-accesspoint-fipss3-fipss3s3-accesspointdualstackemrappui-prods3-websites3-accesspoint-fipsaws-cloud9s3-fipsemrstudio-prods3-object-lambdaemrnotebooks-prodexecute-apicloud9s3s3-accesspointdualstackemrappui-prods3-websites3-accesspoint-fipss3-fipsemrstudio-prods3-object-lambdaemrnotebooks-prodexecute-apis3s3-accesspointdualstacks3-deprecatedanalytics-gatewayemrappui-prods3-websiteaws-cloud9emrstudio-prods3-object-lambdaemrnotebooks-prodexecute-apicloud9vfss3s3-accesspointdualstackemrappui-prods3-websiteaws-cloud9emrstudio-prods3-object-lambdaemrnotebooks-prodexecute-apicloud9eu-west-3ap-south-2eu-central-2ap-southeast-3ap-southeast-4ap-northeast-3eu-central-1mx-central-1me-central-1ca-central-1il-central-1ap-northeast-1us-northeast-1ap-southeast-1me-south-1af-south-1ap-south-1ap-southeast-7us-west-2eu-west-2ap-east-2us-east-2ap-southeast-2ap-northeast-2ap-southeast-5us-gov-west-1us-gov-east-1ap-southeast-6ca-west-1us-west-1eu-west-1us-east-1ap-east-1sa-east-1mrapaccesspoints3s3-accesspointdualstacks3-deprecatedanalytics-gatewayemrappui-prods3-websites3-accesspoint-fipsaws-cloud9s3-fipsemrstudio-prods3-object-lambdaemrnotebooks-prodexecute-apicloud9s3s3-accesspointdualstacks3-deprecatedanalytics-gatewayemrappui-prods3-websites3-accesspoint-fipsaws-cloud9s3-fipsemrstudio-prods3-object-lambdaemrnotebooks-prodexecute-apicloud9s3eu-west-3ap-south-2eu-south-2computes3-ap-northeast-2elbrdss3-ap-east-1s3-sa-east-1s3-us-gov-west-1s3-eu-central-1s3-ca-central-1eu-central-2ap-southeast-3ap-southeast-4ap-northeast-3s3-website-us-west-2s3-website-eu-west-1s3-external-1eu-central-1me-central-1ca-central-1il-central-1s3-us-west-1s3-eu-west-1s3-website-sa-east-1s3-website-ap-southeast-2ap-northeast-1ap-southeast-1s3-us-west-2s3-eu-west-2me-south-1af-south-1eu-south-1ap-south-1us-west-2eu-west-2us-east-2s3-website-ap-southeast-1s3-1s3-globals3-ap-northeast-3eu-north-1airflowap-southeast-2s3-us-gov-east-1s3-fips-us-gov-east-1s3-me-south-1s3-ap-south-1ap-northeast-2s3-website-us-west-1ap-southeast-5s3-eu-north-1s3-ap-southeast-1s3-website-us-gov-west-1compute-1s3-eu-west-3us-gov-west-1s3-website-ap-northeast-1us-gov-east-1s3-fips-us-gov-west-1s3-website-us-east-1s3-ap-southeast-2ca-west-1us-west-1eu-west-1us-east-1ap-east-1sa-east-1s3-us-east-2s3-ap-northeast-1authauthauth-fipsauth-fipseu-west-3ap-south-2eu-south-2eu-central-2ap-southeast-3ap-southeast-4ap-northeast-3eu-central-1mx-central-1me-central-1ca-central-1il-central-1ap-northeast-1ap-southeast-1me-south-1af-south-1eu-south-1ap-south-1ap-southeast-7us-west-2eu-west-2us-east-2eu-north-1ap-southeast-2ap-northeast-2ap-southeast-5us-gov-west-1us-gov-east-1ca-west-1us-west-1eu-west-1us-east-1ap-east-1sa-east-1rframeservicesbuilderstg-builderdev-builder*ociocpocsazuregcpawsdemoinstanceeu-west-3eu-south-2ap-southeast-3ap-northeast-3eu-central-1me-central-1ca-central-1il-central-1ap-northeast-1ap-southeast-1me-south-1af-south-1eu-south-1ap-south-1ap-southeast-7us-west-2eu-west-2us-east-2eu-north-1ap-southeast-2ap-northeast-2ap-southeast-5us-gov-west-1us-gov-east-1us-west-1eu-west-1us-east-1ap-east-1sa-east-1previeweu-4us-4us-1eu-1us-2eu-2us-3eu-3appscomputepaasrag-cloudrag-cloud-chjcloudjcloud-ver-jpcdemonodebalancermembersipeuxvsoncillaocelotonzayalilynxsphinxfentigercustomercaracalo365cloudstaticxendevapp001testcode-builder-stgplatformmediasiteprojedrydpagesjsx0desazacncoitrueu4uhkukgrbrushatenadiarymyspreadshopfrom-flfrom-wvwebspace-hosttheworkpchatenablogcursorusercontentservesarcasmapplinzisakuratanwixsiteappchizigiizeis-into-carsdnsiskinkyadobeaemcloudis-a-therapistpgfogmyvncdojinis-an-actress1kappfldrvkozowqa2jpnmexprgmrfirewall-gatewaydynnscafjsfbsbxooguyfrom-gawoltlab-demois-a-anarchistwiardwebteaches-yogadattowebtb-hostinglive-websiteservegamegotpantheonfrom-nhsubsc-payfrom-ohvipsinaappfrom-cadyndns-officehomelinuxfrom-mahercules-appservebbsstreakusercontentfrom-okfrom-wyfastly-terrariumis-a-llamaqualyhqportalserveexchangeon-vaporvivenushopciscofreakgrayjayleaguesmetaaiusercontentfrom-iais-a-libertariansaves-the-whalestaveusercontentyolasiteoperaunitepoint2thisis-a-catererclaudeusercontentlinodeusercontentfrom-vagithubusercontentsells-for-lesshosteurcanva-appsplaystation-cloudddnsfreefrom-pafrom-prfrom-waddnskingoutsystemscloudhotelwithflightmydattois-a-nascarfanmydbserverminiserverdamnserverservehumouris-a-playerfrom-nvfrom-nmemergentagentgentappsamplifyappfrom-kyis-an-accountantnfshostserveircfrom-akpythonanywherestackhero-networkpostman-echolikescandydyndns-mailobservableusercontentserveftpfreeboxosfrom-utcdn77-storageamazonawsneat-urldyndns-serverlinodeis-a-teacherfrom-vtgleezemythic-beastsus1-pleniteu1-plenitla1-plenitpaywhirlservecounterstrikejdevcloudhealth-carereformis-into-animegoogleapisis-a-painterafricaisa-hockeynutatmetais-an-actora2hostedis-a-democratdatadetectest-le-patrondigitaloceanspacesis-a-designeris-a-hunterlinodeobjectstemp-dnsissmarterthanyoufrom-arsimplesiteevennodetownnews-stagingis-a-liberalgooglecodejelasticservemp3qualyhqpartnerdyndns-free1cooldnsest-a-la-masiondrayddnsdynuddnsfrom-orfrom-miis-a-bloggerfrom-himydobisscanvacodeis-an-engineerest-a-la-maisonupsunappdevinappswafflecellmyasustorwpenginepoweredfrom-ctservep2psame-appmyshopblocksthingdustdatalikes-piediscordsezis-with-thebandlpusercontentis-leetshopitsite3utilitiesis-a-personaltrainersinaappladeskis-a-cheflogoipselfipbase44-sandboxnospamproxyalibabacloudcsmesswithdnsauthgearappsiamallamawithgooglelutrausercontentmochausercontentframercanvasmytabitdyndns-homew-credentialless-staticblitzcpserverdiscordsaysis-a-nurseappspotatlassian-isolated-3premotewdfrom-mtwixstudiocode0emm180rmyactivedirectoryawsappsmytuleapdnsabrpolyspaceqbuserrenderbuiltwithdarkboutirgotdnsabrdnsdopaascanva-hosted-embedawsglobalacceleratorhomesecuritypcmyiphostditchyouripclever-clouddyndns-ipon-aptibleis-a-musicianhosted-by-filessecuritytacticsappspaceusercontenthomeunixstrapiappsame-previewcf-ipfsmycloudnaselasticbeanstalkis-certifieddontexistkasserverik-serverdrive-platformatlassian-3pfirebaseappherokuappawsapprunnerbarsycenteris-a-cubicle-slaveservehttpmyshopifyis-a-guruquicksytessiiitesorsitesmagicpatternsappis-a-cpameteorappfrom-wiis-a-rockstarbumbleshrimpdattolocaldatabricksappsreadthedocs-hostedfrom-rifamilydsdyndns-picsplesknsbplaceddnsaliasdynaliasdyndns-remotedoomdnsip-ddnsblogdnsis-a-doctorroutingthecloudamazoncognitobarsyonlinedsmynasddnsgurucloudflare-ipfsdeus-canvasfrom-idsmushcdnpagespeedmobilizerdyndns-at-homeunusualpersonhosted-by-previderis-a-republicandyn-o-saurstreamlitappworkisboringonthewificprapidqualifioappis-uberleetis-slickgetmyipwpdevcloudtypeformdyndns-at-workgentlentapismynascloudw-corp-staticblitzfrom-ingeekgalaxyservebeerfrom-mdonrenderspace-to-rentaivencloudappspacehostedwafaicloudcodespotblogspotatlassian-3p-us-gov-modfrom-ndfrom-msis-a-techieis-a-studentcustomer-ociis-a-photographerdurumisfrom-ksmassivegriddyndns-wikiis-an-entertaineris-a-hard-workermysecuritycamerafrom-mnrackmazedyndns-blogis-a-bulls-fanwritesthisblogfreemyipsimple-urlfrom-sdreservdauthgear-stagingest-mon-blogueuris-into-gamesrice-labsxtooldevicesakurawebis-an-anarchistoraclecloudappsdyndns-worksells-for-urhcloudfrom-dcfastvps-serverwpmucdnis-a-geekscrysecfrom-txis-into-cartoonsmodelscapetrycloudflarelocaltonetstreak-linkbalena-devicesfrom-njforgeblocksfreebox-oswebadorsitefrom-ncdoesntexisthobby-sitestreaklinkshomesecuritymacownprovidertuleap-partnersdattorelaywphostedmailservequakeis-a-socialistservehalflifepivohostingdynuhostingquipelementsw-staticblitzdyndns-webfrom-deproject-studyaliases121is-not-certifiedhercules-devis-a-financialadvisorservepicsis-a-greenloseyouripfrom-ilwithyoutubemwcloudnonprodwiredbladehostingdnsdojofrom-tnpixolinomyqnapcloudis-an-artisthostedpiis-a-landscaperauiusercontentoaiusercontenton-forgeis-a-conservativedreamhostersnet-freaksapps-1and1is-goneencoreapifastly-edgefrom-nesalesforcefrom-scdeployagentoraclegovcloudappsfrom-alis-a-lawyercechirevultrobjectsstufftoreadisa-geekddnsgeeklovableprojecttry-snowplowfrom-moblogsyteis-a-bookkeepernogmyforumravendbmyboxdeelementoredsaacficogoorinforgcomgobnatneteduidstoreorgcomnetintedudevnomepublorgcomneteduathgovtestscalculatorspaynowinfoquizzesresearchedcloudnsfunnelsassessmentsjscaleforcetmacltdorgmilcompronetgovbizpresseklogesrsccloudcustomfltusrcloude4corealmgovmunicontentproxy9metacentrumdyndyndyndnsdynpagespages-researchitionoccustomercomymyspreadshopipv64diskussionsbereich4limacomrub2ixfirewall-gatewayddnssspdnsbarsykeymachinesquare7myhome-serverspeedpartnercommunity-proschuldockxenonconnectgünstigliefernbwcloud-os-instancedyndnssecmy-routerxn--gnstigliefern-wobin-butterl-o-g-i-nisteingeekin-dslin-berlinin-brbfuettertdasnetzleitungsenin-vpnlcube-serverdyn-ip24logoipdyn-berlinruhr-uni-bochum12hpgoipsrvdnsfruskygit-repossvn-reposinternet-dnsgünstigbestellenhome-webserverxn--gnstigbestellen-zvbbplacedheimdnscosidnswebspaceconfiglima-citydyndns1istmeinvirtualuserschulplattformmy-gatewayddnsseclebtimnetztest-iservmein-iservvirtual-userhome64iservschuletaifun-dnstraeumtgeradeschulserverdynamisches-dns123webseitednshomehs-heilbronndnsupdaterbssgraphicdwadpdwdaepeweaawapaafpfwfabwbpbacwcpcciwebuserapiobjectsidsiskospockkimodorikerbonesteamsparisjanewaypicardglobaltarpitreedpikekiraworfsulukirkarchertuckerhackercanarywesleystagingprereleaset3r2lpbravepanelngrokiservstglclcrmerpflypagesbarsyvivenushoplocalcertlocalplayerbearbloggatewaydeno-stagingis-not-ais-a-goodbotdashvercelmocha-sandboxplatter-appreplitgithubpreviewworkersinbrowserevervaultis-ahrsndenoxmitmodxmyaddrstorageapipayloadgrebedocruncontainersstgstagelclstageloginlineis-a-fullstackcodepenleapcellngrok-freeis-coolstoragewebharemediatechlibp2pdiscourseimaginecomyspreadshopstoreregbiz123hjemmesidefirmcoorgcomnetedugovsldorgmilcomwebgobartnetedugovtmorgpolcomsocartnetedugovassoagrondiscoodontk12medcuegyecpaabgengorgmilgalsaltulcomadmesmgobpubdocmonfindgnriouioproartlatvetnetfotedulojgovntrturibrbarxxxofficialbasechefprofmktgpsictechinfoarqtcontdentrrpppsiqgit-pagesritmedfieorgcomlibprieduaipgovriikmeactvsportorgmilcomscieunnetedugovnameinfopintouchtawktotawkmyspreadshoporgcomnomgobedu123miwebcomputeorgcomnetedugovbiznameinfocognito-idpeusc-de-east-1onjelasticnxaspdnsbarsydirectwpdeuxfleurstransurldogadoprvwcloudnsamazonwebservicesdnshomeuserpartycokoobinmkmfidymyspreadshopalandkapsiikixn--hkkinen-5wacloudplatformhäkkinen123kotisivuidacorgmilcompronetedugovbiznameinforadioorgcomneteduuserexperts-comptablestmmyspreadshopgretaprdcomnomynhccifbxoshuissier-justicenotairesaeroportfreeboxoson-webavocatassoportgouvkdnschirurgiens-dentistes-en-franceavouesfbx-os123sitewebveterinairechirurgiens-dentistespharmacienchambagrimedecinfreebox-osdediboxgoupilemszicpyicpvicppleysheezypagesedugovcnpyorgcomcybllcpvtnetedugovtnxonlineschooldaemond6atcopanelorgnetplybotdashstackitkaasorgmilcomnetedugovbizmodltdorgcomedugovcoorgcomneteduappwriteacorgcomnetedugovcloudtranslateusercontentorgcomnetedumobiassoorgcomnetedugovbarsysimplesitediscourseindorgmilcomgobneteduorgcomwebnetedugovguaminfonxhra教育敎育網絡网絡组織組織网络網络组织組织公司政府個人个人箇人ltdorgcomincneteduidvgovxn--uc0ay4axn--55qx5dxn--mk0axixn--io0a7ixn--uc0atvxn--zf0avxxn--lcvr32dxn--od0algxn--wcvs22dxn--gmqw5axn--od0aq3bxn--mxtq1mxn--ciqpnxn--tn0agxn--gmq050iorgmilcomgobneteduiservwp2tempurlmircloudfreesitewpmudevmyfastgadgetcloudaccessjelehalfboltfastvpsemergenteasypanelopencraftizcombrendlynamefromrtpersoadultmedorgpolrelcomproartnetedufirminfoassoshopcoopgouvtmcomediahotelforumvideosportorgsexagrargameslakaseroticaerotikatozsdereklamcasino2000filmsuliinfoboltshopprivnewsszexcityutazasjogaszkonyveloingatlaneacaicogoormyᬩᬮᬶmilwebschnetkopbizzonedesaponpesxn--9tfkymyspreadshopgovmytabittabitorderravpageaccok12idforgnetgovmuniltdplcaccotttvorgcomnetmeca6g5gpgamubacaicniocoukuptverdruscsdelhiindorgmilcomwebnicfingenpronetintedugovresbizbiharbarsyinternetbusinessschooltravelsupabasealumnigujaratfirminfoaeropostbankcoopindevscloudnsno-ipbarsybarrell-of-knowledgebarrel-of-knowledgensupdategroks-thisdnsupdatefor-ourknowsitalldvrcammittwalddynamic-dnsv-infowebhopselfipdyndnshere-for-moreilovecollegemayfirstforumzcloudnsmittwaldservertypo3servergroks-theeusekd1cdndyndnsidrawsainaueuapjpusstagemocksysdevicesclientcustreservdcustdevdisrecprodtestingcobeebyteutwenteboxfusebravepstmndedynngrokorgmilcomnomnetedugovqcxqzzbarsythingdustmo-siemensrb-hostingfh-muenstergitbookbluebitecloudbeesusercontentnodeartkiloappsforgerockdarklangresinstagingapigeebubbleb-datascryptedhypernodedappnodepantheonsitegitlabgithubkeeneticvirtualservercleverappshostyhostingon-rioedugitticketstelebitwixstudioon-k3sicp0icp12038jeleqotolairbubbleappsmyaddrstolosmyrdbxwebflowdrive-platformbeagleboardhasura-applolipopdefinimavaporcloudmusicianwebflowtestazurecontainerresindevicereadthedocsloginlineeditorxmoonscalesandcatsbasicserverwebthingsbrowsersafetymarkbeebyteappbitbucketidaccovistablogorgschnetgovxn--mgba3a4f16axn--mgba3a4fraarvanedgeايرانایرانjclaspeziapdudcefegelemeperetevebacanatavaparasabgagfgogrgpgalclblimfmrmcbmbvbfclcmcvcrcpcchlimifibicivipirisimncnbnanenrnpntnnolomobocoaogorosopotoptvtatctbtmtltotpusulunutpspapaqsvpvvvtvavvrtrsrprgrfrcrbrarorkrvstsssbscsmsispzczbzbozen-suedtirolmyspreadshopxn--bulsan-sdtirol-nsbxn--valledaoste-ebbtrentinoaltoadigetrentin-sued-tirolxn--forlcesena-c8axn--forl-cesena-fcbxn--bozen-sdtirol-2obtriestetrentinsuedtiroltrentino-s-tirollecceudineaostesienaparmaluccapaviagenoapaduaaostamonzaabruzzoternirietiturinmilanbozenlaziofermoleccocuneonuoropratola-speziavdataaligfvgpugmolcalcamlomumbsicpmnvenvaoedugovabrsarmaremrbastoslazibxosfirenzetrentinosüdtirolval-d-aostavalle-aostamessinacremonaravennatoscanatrentin-suedtirolbolognacalabriaurbinopesarofriuli-v-giuliaogliastraxn--valle-aoste-ebblaquilaandriatranibarlettasyncloudxn--valle-d-aoste-ehbaostavalleyvalled-aostatrentino-alto-adigevallee-d-aostexn--balsan-sdtirol-nsbpistoiasicilialucaniacataniaiserniaperugiabresciaveneziagorizialiguriaimperiabulsan-suedtirolbalsan-suedtirolbarlettatraniandriaxn--trentino-sdtirol-szbforlì-cesenatuscanyvallée-d-aostemantovavallée-aostecasertapiemontevalleaostaval-daostafriulivgiuliatrevisoforli-cesenavalléedaosteferrarapescaravald-aostatrentino-altoadigefriuli-vegiuliavallee-aostecarboniaiglesiastarantomediocampidanovalleedaostetrentinosud-tirolcampobassotrentinsüd-tiroltrentinosüd-tirolmonzabrianzatrentino-südtirolxn--trentino-sd-tirol-c3bpotenzacosenzavicenzaemiliaromagnavenicefrosinonemarchepordenonetrentinosued-tirolvaresemolisevalléeaostefriuli-veneziagiuliabasilicatalatinaanconasavonaveronamodenabiellabolzano-altoadigepugliafoggiaumbriatrentino-stirolgenovapadovamateranovararagusapiacenzatrentinostirolvalleeaostetempio-olbiasudsardegnatrentinsudtirolmassa-carrarafriuliveneziagiuliatrentinosuedtirolandria-barletta-tranitrapanixn--cesenaforl-i8amaceratacaltanissettaascoli-picenobrindisicarraramassacagliaririmininapolivibo-valentiachietibulsan-sudtirolbalsan-sudtiroltrentino-a-adigebulsanbalsaniglesiascarboniamilanotorinoteramodell-ogliastraarezzotrentinoalto-adigerovigotrentovenetoiglesias-carboniatrentino-sud-tirolaltoadigereggio-emiliareggio-calabriasardegnatranibarlettaandriapiedmontxn--sdtirol-n2amedio-campidanotrentino-süd-tirolfriuli-vgiuliafriuli-ve-giuliaromeennaromapisa32-b16-b64-blodiastibarineencomonaplesforlicesenailiadboxosalessandriasicilytrani-barletta-andriaxn--trentin-sdtirol-7vbpesarourbinotrentinsued-tirolcesena-forliforlìcesenaemilia-romagnamonzaebrianzaxn--trentinsdtirol-nsbtrentinos-tiroltrentinsüdtirolvalledaostaolbia-tempiocampidanomediovibovalentiasassarivalle-daostalombardysud-sardegnafriulivegiuliareggioemiliamonzaedellabrianzaalto-adigevercellitrentin-sudtiroltraniandriabarlettatrentino-sudtirolascolipicenobozen-südtirolfriulive-giuliaflorencexn--cesena-forl-mcbcarbonia-iglesiasaosta-valleycarrara-massadellogliastratrentinoa-adigexn--valleaoste-e7apesaro-urbinoxn--trentinosdtirol-7vbxn--trentin-sd-tirol-rzbxn--trentinsd-tirol-6vbtrani-andria-barlettatrentin-süd-tirolxn--trentinosd-tirol-rzbgrossetomonza-e-della-brianzasüdtirolreggiocalabriatrentinoaadigetrentin-südtirolverbano-cusio-ossolafriuliv-giuliaverbaniacampaniatrentino-aadigefriulivenezia-giuliasardiniaandriabarlettatranibarletta-trani-andriacatanzarooristanourbino-pesarocesena-forlìvalle-d-aostacampidano-medio123homepagesiracusatempioolbiasuedtirollombardiaavellinocesenaforlìtrentinofriuli-venezia-giuliabozen-sudtirolandria-trani-barlettabulsan-südtirolbalsan-südtirolmonza-brianzabolzanotrentino-sued-tirolbellunosalernolivornocrotonesondriodnshometrentinsud-tirolmassacarraratrentin-sud-tiroltrentino-suedtirolviterbobergamocesenaforliolbiatempiopalermobeneventoagrigentoofcoorgnetfmaitvphdengorgmilcomschnetedugovperagrikanieasukehandachitatokaiaisaikonanoharuamaobuhigashiuraowariasahiinuyamatobishimaiwakurashitarainazawatoyonegamagorimihamatoyotataharakariyayatomioguchikomakimiyoshinishiotokonamekiyosuchiryutoyohashiokazakiisshikikasugaikotakiratoeianjotogofusosetohazutsushimashinshirotakahamanisshinshikatsuhekinantoyokawaichinomiyatoyoakeodateogataakitaikawakyowahonjoogayurihonjonoshirokamiokakatagamimitanegojomeyokotekosakadaisenkazunonikahohonjyomoriyoshimisatohappoukamikoanihachirogatahigashinarusesembokufujisatokitaakitaitayanagiowanitakkomutsutsurutahirosakigonoheoirasetowadamisawanohejiaomorishingohiranairokunohehashikamitsugarushichinohehachinohenakadomarisannohekuroishisakaeisumiasahiotakiinzaiabikomatsudoyachiyomutsuzawakujukuriomigawakashiwatoganemihamanaritasakuranagaramobarahanamigawachoshishiroichoseikozakishisuikatorimidorichonankyonanfuttsuonjukufunabashinagareyamanodasosatakochuotohnoshourayasukimitsuyokaichibayotsukaidosodegauratateyamakamagayayokoshibahikariyachimatakatsuuratomisatokisarazukamogawaichikawanarashinoichinomiyashimofusaminamibososhirakoichiharaoamishirasatoikatahonaiainansaijoseiyoiyoozuuwajimaniihamanamikatamasakiuchikokihokutobetoonshikokuchuomatsuyamaimabarikamijimakumakogenyawatahamamatsunosabaeikedaobamasakaifukuiohionotsurugamihamawakasaminamiechizeneiheijikatsuyamatakahamaechizensoedaukihaomutaokawanishiogoribuzenonojosueumiokiotochikugosasagurisaigawamizumakishinyoshitomikurumekurateyamadakasuganakamamiyamanogatatakatahakataiizukakawaratagawakasuyaashiyainatsukimunakataminamitsuikishonaikurogifukuchikeisenhigashimiyakoshinguyukuhashiokagakiyamekogaongausuikahotohochuotoyotsumiyawakadazaifuhisayamatachiaraiyanagawanakagawahirokawachikujochikushinochikuhochikuzennamieotamaokumashowateneiiwakikoorinangoononishigoshimogoomotegomishimafukushimaasakawakagamiishishirakawaiitatefutabahiratayugawahanawakitakatakawamatakunimiyabukibandaihigashihironoyamatomiharuyamatsuriaizubangedatesomaaizuwakamatsuyanaizuaizumisatonishiaizuizumizakikitashiobarataishinkaneyamakoriyamainawashirotanagurafurudonosamegawasukagawaishikawatamakawaikedaogakitaruiginanenahashimahichisonakatsugawaibigawashirakawamizunamiminokamomitakekawauesekigaharatomikasakahogikitagatayamagatatajimianpachimotosuyaotsukakamigaharahidakanisekitokigujominogodoyorogifukasamatsutakayamawanouchihigashishirakawakasaharashimonitatsumagoichiyodakannakanrashowameiwakiryuotaoratomiokafujiokaitakuranaganoharahigashiagatsumatakasakishibukawaminakamikatashinatsukiyonokawabanumataannakaoizumimidorishintoisesakiuenoyoshiokakusatsutakayamanakanojonanmokutamamuratatebayashimaebashiotakekaitadaiwahongofuchukuietajimashobaramiharahatsukaichihigashihiroshimamiyoshikumanokurenakasakaseraseranishiasaminamifukuyamashinichionomichiosakikamijimajinsekikogentakeharaotobenanaeikedatohmaozoraobiraabirakyowaeniwataikibibaisharirebunerimohiroooketootarupippunishiokoppechitosefurubirahakodateshiranukakitahiroshimakushiroobihironanporoiwamizawaniikappukunneppufukushimanakasatsunaitoyourakuromatsunaiakabirakamisunagawashibechaurakawakamifuranonakatombetsuasahikawashimokawakayabeokoppebiratoriabashirisaromaatsumanumatahidakabifukamukawamikasahorokanaitoyotomisarufutsuhigashikawaishikarikitamiyoichiesashiiwanaitomariminamifuranoakkeshifuranotoyakoyakumootoineppushikaoishiraoinemuronayorohaboroashorobihororishirifujiutashinaihokutotakasuebetsuurausuassabukikonaishimamakinaiedatetoyabieinikiesanuryuoumuteshikagarikubetsuashibetsukimobetsuaibetsutobetsusobetsuembetsushimizuchippubetsurishirihokuryuhoronobeshintokutsubetsushibetsuhonbetsumombetsutsukigatakuriyamakoshimizushiriuchikutchanmurorannoboribetsukamishihorowassamushinshinotsukembuchiwakkanaikamoenaikiyosatotakinoueshikabesunagawafukagawanakagawatakikawakamikawahigashikagurahamatonbetsumatsumaemoseushirankoshishakotanimakanemashikeotofuketomakomaisandatambaitamiawajikasaiasagoshisoonoakoyashirotoyookaminamiawajiinagawafukusakitakasagokamigorikasugaharimayokawaashiyahimejiakashitaishiaogakisannantakinosumototakarazukanishinomiyashingugoshikinishiwakiyokatakaaioimikisayoyabukawanishiamagasakisasayamashinonsenkakogawaichikawakamikawatatsunotsukubaiwamaogawaasahisakaitokaioaraiitakobandodaigosuifuinaamikasumigaurakashimaomitamayachiyoshimodatetomobetoridehitachinakainashikisakuragawakasamayawaramoriyahitachiomiyanamegatayamagatahitachikamisuushikutakahagiibarakitonekoganakasowayukimihojosomitoryugasakishimotsumafujishirotsuchiurachikuseihitachiotashirosatotamatsukuriuchiharashikahakuinanaotsubatawajimakahokukawakitatsurugikaganominotosuzuuchinadakomatsuanamizunakanotohakusannonoichikanazawaiwateshiwafudaikawaimoriokaofunatohanamakikuzumakikitakamininohekunoheyamadayahabasumitaichinosekitanohatahiraizumirikuzentakatajobojiotsuchihironomiyakoiwaizumikarumaiichinohenodakujitonooshushizukuishifujisawamizusawakamaishikanegasakimannoutazukotohiraayagawazentsujihigashikagawauchinomikanonjisanukimarugamemitoyotakamatsutadotsunaoshimatonoshoakuneamamiizumihiokiyusuikinkoisasookouyamanakatanekagoshimakanoyaisenkawanabeminamitanemakurazakitarumizunishinoomotematsumotosatsumasendaioimatsudaayaseebinamiurazushinakaiodawaraiseharasagamiharahakoneaikawakaiseiatsugitsukuihadanoyamatoyamakitazamaoisochigasakininomiyayokosukakamakuraminamiashigarafujisawasamukawakiyokawahiratsukayugawaraokawaumajikochitsunootoyoakiinonishitosayasudahidakamiharasakawaniyodogawahigashitsunokagamigeiseisusakiotsukinaharisukumomurototosakamiochitoyotosashimizumotoyamanankokunakamurakitagawayusuharaogunichoyoukiasoutoozugyokutoamakusamifunetakamoriyamagaminamataminamiogunikikuchisumotoyamatonagasumashikiaraokumamotokamiamakusanishiharayatsushiroayabeseikasakyoideineujinakagyokameokakyotangokyotanabekyotambaminamiyamashiroyamashinatanabeyawatawazukaminaminantanmiyazuhigashiyamafukuchiyamakitamukokamojoyokizumaizuruujitawaraoyamazakinagaokakyokumiyamakawagoeinabeshimameiwaasahitaikiudonoisetsukisosakikuwanamihamamiyamasuzukatamakimisuginabarikumanokomonominamiisewataraitobakiwatakikihotadomatsusakayokkaichikameyamaureshinoishinomakishichikashukuohirataiwaosakizaohigashimatsushimashikamaiwanumashibataogawaraonagawakawasakiseminemarumoriminamisanrikukakudamuratawakuyatomiyanatoriwataritagajomisatotomekamirifushiroishimatsushimayamamotoshiogamafurukawahyugaebinotsunosaitoayakushimanobeokakitauramiyazakitakazakigokaseshiibamimatashintomikunitomikitakatakobayashikawaminamitakaharukijotakanabemiyakonojonishimeranichinankitagawakadogawamorotsukakisofukushimaminamimakisakaeobuseikedaogawamiasaokayaasahiotakiotarichinoinaomichikumakomaganechikuhokukaruizawayasuokaooshikaikusakaminamiaikitogakushimatsukawakawakamitateshinatakamorikitaaikishiojirimiyadahakubaiizunaiijimaiiyamamiyotasuzakayasakatoguraookuwanagawaminowahirayayamagataminamiminowafujimiomachisakakitakaginaganonakanosakuhokomoronagisoshinanomachiwadauedaiidaharasuwatomiachiaokianankisosakunozawaonsenagematsutakayamashimosuwamatsumotoyamanouchinakagawamochizukiazuminotatsunoobamaomuraseihiunzenosetofutsuikichijiwanagasakiisahayahasamisaikaikawatanasasebohiradokuchinotsugototogitsutsushimashimabarashinkamigotomatsuurayamazoekashibaikomakawaitenrioyodosangokoryoudaojiikarugayamatokoriyamatenkawakatsuragikurotakikawakamimiyakemitsuetakatorikamikitayamayamatotakadahegurishinjokanmakisakuraitawaramotogoseoudanarasoniandokawanishishimoichihigashiyoshinokashiharashimokitayamanosegawayoshinomintsivorytopazsakuragehirnsumomoaseinetopalmail-boxmokurenyoitamuikaojiyagosensanjoaganomyokoseiroagaomishibataniigatanagaokamurakamiuonumayuzawakariwatagamitainaitsunanminamiuonumatochioyahikojoetsuseiroukamosadoizumozakitokamachiitoigawasekikawakashiwazakitsubamemitsukekokonoesaikiusukibeppuusahimeshimakunisakihasamataketatsukumihitaoitahijikusuyufukujukamitsuebungoonobungotakadaibaraniimibizentsuyamaokayamakasaokahayashimayakagemaniwaakaiwamisakishinjotamanotakahashikibichuowakesojanagishookumenannishiawakurakurashikiasakuchisetouchikagaminosatoshotomigusukunakagusukuyaeseizenaurumaiheyaaguniogiminanjokinminamidaitokitanakagusukuyonaguniokinawaishigakikunigamiurasoekadenataramahiraraginozataketomishimojizamamitonakiitomanhigashimotobuyonabarugushikamionnanahanagohaebarukumejimakitadaitonakijinnishiharayomitanginowantokashikiishikawaikedasuitaminohizuminishisakaikananabenodaitoosakasayamayaokishiwadatadaokakaizukatondabayashichihayaakasakakumatorikadomasayamahigashiosakashijonawatehirakatataishimisakitajirihannansennankatanotoyonominatosettsuhigashiyodogawaibarakinosekitachuohigashisumiyoshifujiiderakashiwaraizumiotsutoyonakamatsubaramoriguchiizumisanoshimamototakatsukineyagawahabikinotakaishikawachinaganoyoshinogarikamiminearitaouchiimarihizenogikashimaariakekiyamafukudomikitagatakitahataomachigenkaikanzakinishiaritakyuragisagataratosutakushiroishikaratsuhamatamakouhokukawagoeyoshidasatteogoseirumaasakaurawaogawaniizaomiyayoriiotakishikihonjooganohannohanyuinasaitamaokegawaarakawayoshikawayokozehasudasayamahidakafukayachichibuiwatsukiryokamiyoshimikamiizumifujimiwarabiranzanmiyoshiminanoyashiosakadosugitomisatohigashichichibutodasokakukiyonokazoshiraokakasukabekounosukawajimatsurugashimamiyashirokitamotohatoyamamoroyamahatogayakumagayakawaguchinagatorokamisatomatsubushinamegawatokigawakamikawafujiminohigashimatsuyamakoshigayatokorozawas3isk01isk02ryuohkoseikonanaishorittotakashimamaibarahikonetorahimenishiazaikokagamokotoyasuotsukusatsunagahamamoriyamatoyosatotakatsukinotogawaomihachimanhigashiomiakagiunnanizumogotsuamayatsukakakinokimatsuehamadamasudahikawahikimiokuizumoyasugiyakumomisatotamayuohdahigashiizumookinoshimanishinoshimatsuwanoshimaneshimadafujiedayoshidashimodagotembaiwataatamikosaiyaizuitoizumishimahaibaramakinoharaomaezakikawanehonkannamisusonohigashiizufukuroinumazukawazufujiaraishizuokahamamatsushimizuizunokunimatsuzakimorimachiminamiizunishiizukikugawakakegawafujikawafujinomiyaujiietsugaoyamayaitaohiranikkoashikagakuroisokanumasakurashioyakarasuyamamotegiichikaikaminokawatochigihagamokanogisanobatonasumibunasushiobaranishikatautsunomiyaiwafunemashikoshimotsukeohtawaratakanezawaitanokomatsushimatokushimaichibaminamiaizumiwajikikainanmiyoshinarutomimamugiananmatsushigesanagochishishikuinakagawamachidachiyodakomaefussainagitaitochofufuchuomeotahigashiyamatotoshimaokutamaaogashimakodairaedogawaarakawahachiojishinagawatachikawashibuyasuginamihinodekiyosesumidaoshimanerimamitakahamuraadachinakanomizuhobunkyomegurominatokoganeihigashikurumekokubunjihigashimurayamamusashimurayamatamakitahinochuokotokatsushikakouzushimaogasawaraakishimakunitachishinjukusetagayamusashinohachijoitabashiakirunohinoharachizunanbukotouramisasawakasayonagokogehinoyazutottorinichinansakaiminatokawaharaoyabetairainamiasahinantoimizufuchutakaokakurobeyamadajohanatoyamatonaminyuzenfunahashinakaniikawanamerikawaunazukitogahimiuozufukumitsutateyamakamiichiiwadearidayuasainamitaijikatsuragiaridagawatanabemihamahidakakainankiminomisatoshingushirahamakamitondayurakozakoyagobokitayamawakayamakudoyamahashimotokushimotokozagawahirogawakinokawanachikatsuurarsuseroeoishidasagaeoguniasahinagaitendonanyoobanazawanishikawasakataohkuratozawamikawamamurogawayamagatafunagatatakahatashonaishinjokahokuiideyuzakawanishitsuruokakaminoyamayamanobeshiratakamurayamanakayamakaneyamahigashineyonezawasakegawamitouubeyuuabushimonosekitabuseoshimatoyotaiwakunihikarishunannagatohagihofukudamatsutokuyamashowadoshitsurunanbukoshukaiminami-alpsnirasakikosugeotsukioshinohokutominobuyamanashifuefukichuokofuichikawamisatoyamanakakonakamichitabayamanishikatsuranarusawafujikawahayakawafujiyoshidafujikawaguchikouenohara長野京都岐阜大阪三重群馬千葉滋賀佐賀奈良adednelgaccogogror秋田愛知高知埼玉沖縄栃木熊本岩手青森山梨新潟島根鳥取長崎香川宮城石川大分宮崎茨城山口兵庫山形徳島広島福島福岡岡山富山静岡愛媛福井東京xn--4it168dhatenadiaryxn--vgu402ckawaiishophatenablogcocottenamaste北海道penneehimeiwateversestabachibashigagonnagunmapermahaccaakitaosakauh-ohblushkochiaichifukuikuroncapooitigohyogotokyokyotopunyuthickcheap0t00g00j0mie2-ddaapyawjg0amfemsubxiiboomoobutchueekpgwrgrherskrboyrdyupperunderflierchipsmydnsheavyangryhippygirlyrulez神奈川鹿児島和歌山bambinaxn--nit225kokayamasaitamaxn--k7yn95exn--1lqs03nsapporoparasitelolipopmcxn--efvn9sniigatafukuokatokushimafukushimahiroshimakagoshimafakefurokinawaxn--8pvr4ucoolblogxn--0trq7p7nnkawasakinagasakimiyazakichilloutxn--8ltr62kxn--klty5xpeeweezombiecutegirlxn--rny31hxn--uuwu58axn--ntso0iqx3axn--djrs72d6uytoyamanikitanyantakagawamimozanagoyaboyfriendxn--2m4a15egreaterchowderegoismyamagatafashionstorexn--elqq16hxn--pssu33lsendaimiyagixn--rht27zpecoriaomorisaloonwatsonvivianxn--djty4knobushipigboatnaganopinokoxn--f6qx53asadistvelvetsecretxn--5js045dchicappayamanashiibarakidigickgirlfriendxn--1lqs71dmongolianxn--c3s14mxn--qqqt11mtochigixn--5rtq34kparallelo0o0mondkobesagabonadecaoitanarafoolkilldecimainhiholomosblokilociaoundopupugifutankcrapflopnooroopsmodsholyjeezstripperpepperbittershizuokaxn--rht3dkitakyushureadymadeicurusversusmatrixxn--rht61ehungryfloppygloomycrankyhandcraftedlittlestarxn--klt787dxn--kltx9awhitesnowsunnydaytottorilovepoptheshopbuyshopxn--5rtp49cxn--d5qv7z876cwebaccelxn--kbrq7oxn--4pvxsxn--1ctwolovesickkumamotocatfoodxn--tor131oyokohamawakayamatonkotsuxn--ehqz56nxn--uist22hxn--6btw5axn--kltp7dyamaguchifrenchkisspussycatxn--4it797kxn--uisz3gbabybluexn--zbx025dnetgamersxn--7t0a264ckanagawaxn--6orx2rishikawaxn--ntsq17ghalfmoonschoolbusjellybeanxn--mkru45iusercontentlolitapunkxn--32vp30hsakurastoragehokkaidoshimanecandypopbabymilksupersaleweblikeraindropbackdropwebsozaikikirarahateblodaynightmeneacsccogoormobiinfoaeusxxorgmilcomnetedugovorgcomnetedugovbizinfotmprdorgmilcomnomedugovassnotairespresseassocoopgouvveterinairemedecinpharmaciensorgnetedugovtraorgcomedurepgovmeneperekgacscaiiocogoitoresmshsseoulbusanulsandaeguc01milvkimmvchungnamjeonnamjeonbukeliv-dnsgyeonggijejueliv-cdnincheondaejeongangwongyeongbukgwangjuchungbukgyeongnameliv-apicoeduindorgcomembnetedugovorgmilcomnetedugovjcloudorgcomnetintedugovperbnrinfocooyorgcomnetedugovethipfscanvamypepethw3sstorachakeeneticjoinmcinbrowserdwebcyonnftstoragemyfritzaemewphlxachotelltdorgcomwebsocschngonetintedugrpgovassnomgacsccoorgnetedugovbizinfo123websiteidorgmilcomasnnetedugovconfidmedorgcomplcschnetedugovaccoorgnetgovpresstmassoirseproxaccosoundcasthoptocraftvp4c66orgnetedugovitsmcdirmyboxbarsyedgestacksynologylogintoopencloudnohostwebhopdiskstationi234tcp4hoocgroknoipprivmydsddnsdnsforlohmustransipdscloudfilegear-sgbrasiliafilegearframerbarsybarsyonlinecoprdorgmilcomnomedugovinforgcomnetedugovnameacprorgcomartnetedugovpresseinfoassoinstgouvorgnycedugovbarsydscloudjuorgcomnetedugovminisiteaccoororgcomnetgovorgmilcompronetintedugovbizmuseumnameinfoaerocoopaccoorgcomnetintedugovbizcooporgcomgobneteduorgmilcomnetedugovbiznameaccoorgmilneteduadvgovcoorgcomnetaltgovforgotherhiskeeneticispmanagernomassoprod5476132eastasiacentraluswesteuropewestus2eastus2pnortheurope-01newzealandnorth-01southindia-01southcentralus2-01norwaywest-01eastus2-01westus2-01australiaeast-01italynorth-01israelnorthwest-01swedencentral-01westeurope-01centraluseuap-01taiwannorthwest-01uaecentral-01northcentralusstage-01israelcentral-01mexicocentral-01canadacentral-01austriaeast-01germanywestcentral-01francecentral-01ukwest-01denmarkeast-01polandcentral-01eastus-01westus-01swedensouth-01eastus3-01westus3-01brazilsouth-01centralus-01francesouth-01australiacentral-01westindia-01uaenorth-01jioindiacentral-01canadaeast-01belgiumcentral-01spaincentral-01koreacentral-01chilecentral-01qatarcentral-01westcentralus-01eastus2euap-01norwayeast-01southafricanorth-01brazilsoutheast-01germanynorth-01switzerlandnorth-01switzerlandwest-01japanwest-01southafricawest-01japaneast-01eastasia-01indiasouthcentral-01taiwannorth-01centralindia-01uksouth-01southcentralus-01northcentralus-01eastasiastage-01indonesiacentral-01australiacentral2-01australiasoutheast-01malaysiawest-01koreasouth-01southeastasia-01southeastus5-01northeastus5-01jioindiawest-01rucdnwest1-usfra1-desandboxjls-sto1jls-sto3jls-sto2aglobalabglobalsslmapprodfreetlsmapvpslon-1lon-2ny-1fr-1sg-1ny-2paassnwebpaashostingjelasticnordeste-idcsocuserpagescwebfileblobservicebuscoreatlricnjsjelasticwebsitestoragesezagbinruhuukjptsmyspreadshopmynetnameakamaiorigin-stagingfrom-coipv64dynv6cdn77serveblogadobeaemcloudhicamsprytdnsupno-ipownipde5ovhicpfirewall-gatewaysytesmypsxbarsyusgovcloudapimyamazemyradwebakamaihdsaveincloudfastlylbfrom-lasubsc-paysquare7in-the-bandblackbaudcdnhomelinuxoninfernoctfcloudservebbsdns-dynamiccloudfrontakamai-stagingipifonyham-radio-opsenseeringclickrisingcommunity-profrom-nylocalcertgrafana-devedgesuite-stagingcloudflareanycasteating-organicatlassian-devmydattofeste-iplocaltotorprojectknx-serveredgekeycloudflareglobalcloudyclustercasacamserveftpakamaized-stagingakamaiorigindns-cloudmyeffectboomlabotdashbuyshousestwmailhetemlazure-mobilein-dslthruhereredirectmedynuddnsbouncemesupabaseluyanicloudappakamaicloudfunctionsdebiannhlfanpgafanstatic-accessin-vpnmysynologymafeloappudohomeftptrafficmanagersiteleafseidatmemsetcloudflarecloudaccesskeyword-onazure-apiis-a-chefdoes-itgets-itwebhopselfiphomeipkicks-assedgesuitewindowsserver-ontunnelmolemydissentscrapper-sitecloudflarecnuni5srcfggffiobbzabchrsndenodynuopikddnsvpndnsakadnselastxkinghostvps-hostfastlyhomeunixazureedgeshopselectdontexistmyfritzcloudjiffyalwaysdatasells-itsquaresbroke-itazurefddattolocalat-band-campmeinforumfamilydsazurestaticappsdefinimabplaceddnsaliasdynaliasnow-dnsblogdnsroutingthecloudendofinternetdsmynasakamaiedgemymediapcadobeio-staticakamaiedge-stagingakamaihd-stagingddns-ipprivatizehealthinsurancelive-onkrellianschokokeksmassivegridmysecuritycamerarackmazeserveminecraftfrom-azis-a-geekakamaizedmoonscaleoffice-on-theusgovtrafficmanageradobeioruntimeedgekey-stagingreserve-onlinechannelsdvrdnsdojousgovcloudappcdn77-sslapps-1and1podzoneazurewebsitesdynathomescaleforceyandexcloudvusercontentisa-geekcdn-edgescoaemalcesappwriteazimuthtlonarvobuiltwithrocketnoticeablestorecomwebrecnetperotherfirminfoartslgdloncogoiltdorgmilcolcomplcschgenngonetedugovbiznamefirmmobiacincoorgmilcomnomwebgobnetintedubizinfocomyspreadshopdemongovtransurl123websitehosting-clusterkhplaycistrongsnesosvalervålerxn--vler-qoaossandeheroysandeherøybøboheroyherøyxn--hery-iraxn--b-5gavalerbøboxn--b-5gasandesandexn--hery-iraxn--vler-qoavålerhåreålaahavaofsfvfhlolnlalrlhmfmtmahcostntbuåstrmreigersundmyspreadshopgálsáeidsvolltingvollgildeskalflorøvadsøvardøvanylvenxn--bhccavuotna-k7astrandaxn--kvnangen-k0axn--sknland-fxaxn--mosjen-eyarakkestadhyllestadnannestadvevelstadvaapstenordre-landsondre-landsøndre-landtjieltexn--vrggt-xqadsør-aurdalsor-aurdalheradstordmoldefordeførdeseljefedjeryggehemnexn--krehamn-dxasognegranesøgnebrynetjomevallebykletokkegiskedovretjømehobølvoldasaudatolgasømnaviknadønnasomnadonnatranafrananesnaraumasmolatrænafrænalesjasmølaørstaorstahitrafloraaukraloppafrøyarissasnasahalsagalsaromsaraisaráisafroyasnåsagronghobolfjelltydalårdalardalaskimharamkraanghkekråanghkesorumbarumhurumbærumsørummodumsálátbálátfrognbjugnvåganvagangulenskienløtenlotenstrynvefsnxn--merker-kuaskaunsveiobømlobomloskjåkvardoflorovadsosalatbalatsálatklæbuklabuselbubarduulvikskjakklepprisørxn--nttery-byaeflåeidflahofmilgolholsellomskifetvikdepvgsfhsaskerrisorhamarasnesåsnesrørosrorosxn--slat-5namasoynaroyvaroyluroydyroyaskoyradoyandoyrodoymeloyradøyandøyrødøymeløyaskøylurøydyrøymåsøyværøynærøyhoylandethøylandetdivtasvuodnalørenskoglorenskognesoddtangenxn--tjme-hraxn--smla-hraxn--stjrdal-s1aunjargalillehammerunjárgaxn--hamary-fyadavvenjargaxn--bearalvhki-y4a123hjemmesidegjerdrumxn--brnnysund-m8acxn--tnsberg-q1axn--mlatvuopmi-s4axn--snsa-roaxn--skierv-utaxn--brum-voatysfjordkvafjordeidfjordkvæfjordsongdalenmjondalenmjøndalenxn--gls-elackragerogáŋgaviikagangaviikasørreisasorreisasør-varangersor-varangerxn--risr-iraskiervaxn--frna-woaxn--trna-woakvinesdalleksvikleirvikrøyrvikroyrviksvelvikvenneslaevje-og-hornnessandnessjøenmarnardalvindafjordsandefjordenebakksnillfjordullensvangxn--trany-yuabrønnøysundnamsskoganaustevollxn--stjrdalshalsen-sqbnord-aurdalnord-frontrøgstadtrogstadgrimstadflakstadgjerstadxn--sandy-yuaxn--leagaviika-52bnore-og-uvdalvegarsheixn--rlingen-mxaxn--ggaviika-8ya47hvegårsheikarlsoykvitsoymasfjordenhamaroyinderoyosteroydavvenjárgasauheradguovdageaidnuxn--vre-eiker-k8abronnoysiellakkrødsheradkrodsheradkvinnheradbrønnøyxn--mtta-vrjjat-k7afxn--lrenskog-54akvitsøyvárggátkarlsøyosterøyinderøyhamarøybronnoysundxn--aurskog-hland-jnbbahccavuotnabáhccavuotnagiehtavuoatnastor-elvdalmidtre-gauldalxn--gildeskl-g0akarasjokevenassixn--bievt-0qaxn--yer-znalebesbynessebyxn--hbmer-xqamalselvmålselvxn--unjrga-rtamøre-og-romsdalmore-og-romsdalhareidmelandørlandorlandstrandålgårdsolundalgardafjordåfjorddielddanuorrikautokeinoxn--stre-toten-zcbskodjeaejriestangeliernebamblestokkefauskesnåasesnaasekongsvingerlangevagberlevagxn--flor-jrahattfjelldalostre-totenøstre-totenvestfoldxn--mely-iraálaheadjualaheadjunordreisaxn--troms-zuaxn--lgrd-poacporsangerflatangerstavangerleikangerbremangersamnangergieldakarasjohkaxn--rdy-0nabfrostautsirasnoasatromsaxn--sr-aurdal-l8aflekkefjordjølsterjolsteraremarkhedmarknååmesjevuemienaamesjevuemiexn--vard-jrarollagmeråkermerakerorskogørskogxn--bdddj-mrabdákŋoluoktaxn--osyro-wuaaknoluoktatrysilskjervøymandaljondalbindalrindalmeldalsuldalorkdalsigdalalvdallærdalhurdalsirdalverdallerdallardaloppdalåseralaseralhadselkragerødivttasvuotnaoverhallasteinkjerxn--hnefoss-q1askedsmokorsettromsøxn--dyry-iravestre-totenmuseumxn--sandnessjen-ogbrahkkeravjufylkesbiblbájddarbajddarxn--laheadju-7yarennesøyxn--koluokta-7ya57hxn--hgebostad-g3aleirfjordstorfjordbalsfjordbåtsfjordbatsfjordmuosátbievátloabátkárášjohkanøtterøyxn--mjndalen-64anordkappláhppilahppialstahaugsiljanverranrøykenroykenhaldenlyngenbergenhortenhønefosshonefosstroandinbeiarnvarggatosoyroosøyrotromsoidrettmuosatbievatruovatloabatvoagattynsetnessetxn--indery-fyaskánitskanitraholtråholtxn--ystre-slidre-ujbandebusarpsborgbearduxn--karlsy-fyahordalandjorpelandjørpelanddeatnuringsakersør-odalsor-odalxn--slt-elabringerikeaudnedalnittedalnissedalhemsedalslattumsurnadalxn--blt-elabelverumstjørdalnaustdalhjartdalgjøvikfyresdalhasviknarviklarvikgjovikmalvikgamviklenvikporsgrunnstjordalengerdaldrobakdrøbakxn--msy-ula0hvestvagoyxn--vgan-qoaxn--ryken-vuaxn--lten-graxn--stfold-9xaxn--hpmir-xqaxn--lury-iramálatvuopmimalatvuopmitysværkirkenesbirkenesmoskenesbáidárxn--fjord-lraxn--rdal-poabahcavuotnabáhcavuotnaxn--frde-gralindåsbearalvahkixn--hobl-iraráhkkerávjuxn--loabt-0qavågåáltábodøsundlundraderådeetnetimeholeauregrueoddavagavegaranatanaarnasolasulaaltalekafusavangbergkvamåmliamlibokntinnroangranosenoslobodorøstroststatåmotamotivguprivøyeroyerliermossvossxn--nvuotna-hwalusterlunnermarkerhábmerhabmerhvalerfjalerxn--rholt-mratysvarbaidarfitjargaularhápmirhapmirmelhusfosnesøksnesoksnestysneshemnesevenesflesbergeidsbergtonsbergtønsberglindasxn--sndre-land-0cbnamsosxn--srum-graøystre-slidreoystre-slidrevestre-slidretrondheimbalestrandxn--langevg-jxaaustrheimxn--skjk-soavagsoyaveroysandoykarmoyfinnoytranoyvestbytranbysykkylvenxn--hyanger-q1aspjelkavikandasuoloxn--fl-ziaxn--drbak-wuastathellexn--sr-varanger-ggbtelemarkxn--bhcavuotna-s4axn--porsgu-sta26fčáhcesuolocahcesuoloakrehamnåkrehamnsandøykarmøyfinnøytranøyvågsøyaverøynamdalseidxn--lesund-huabadaddjaxn--vegrshei-c0axn--btsfjord-9zagildeskålporsanguxn--trgstad-r1anávuotnanavuotnahammerfestxn--sgne-graxn--brnny-wuacibestadharstadnarviikaevenáššivestnesgjemnessandnesagdenesrennesoyxn--avery-yuaxn--tysvr-vrabearalváhkikongsbergspydebergrandabergxn--andy-iradavvesiidaxn--krdsherad-m8aporsáŋgufredrikstadbjerkreimringeburennebuaurskog-holandnotteroyxn--vgsy-qoa0jxn--rmskog-byaskierváivelandbyglandfrolandaurlandforsandxn--bjddar-ptamidsundålesundalesundfetsundfarsundovre-eikerøvre-eikerakershusxn--moreke-juasørfoldøstfoldostfoldsorfoldhøyangerhoyangerlevangerorkangertanangerxn--vestvgy-ixa6olillesandulsteinxn--rennesy-v1agranvinskjervoyxn--klbu-woalavagisxn--h-2faxn--ryrvik-byakafjordkåfjordseljordfolkebiblxn--gjvik-wuajevnakerxn--kfjord-iuabudejjuxn--kranghke-b0axn--davvenjrga-y4axn--rland-uuaxn--ldingen-q1axn--mlselv-iuaxn--rady-iraxn--linds-prabrumunddalxn--ygarden-p1amo-i-ranaeidskogrømskogromskoghjelmelandxn--finny-yuaxn--sr-odal-q1axn--skjervy-v1aballangenkvanangenkvænangengratangenxn--hmmrfeasta-s4acvossevangensuohkanxn--rde-ulaxn--mli-tlaxn--ksnes-uuanordlandskanlandskånlandsortlandfuoiskuxn--rros-graxn--hcesuolo-7ya35bxn--eveni-0qa01gagaivuotnagáivuotnaxn--seral-lradrammenmodalenmosjoenjan-mayentorskensteigengloppenxn--snes-poamatta-varjjatxn--sr-fron-q1aomasvuotnajessheimbådåddjåxn--krager-gyaxn--kvfjord-nxaxn--asky-iraxn--snase-nraxn--bidr-5nacholtålenxn--vads-jraxn--jlster-byamosjøenxn--rst-0nastavernxn--ostery-fyaxn--oppegrd-ixaxn--sknit-yqaxn--risa-5naoppegårdskiptvetrendalenholtalenxn--mot-tlaxn--lhppi-xqaxn--holtlen-hxaxn--srreisa-q1akopervikxn--muost-0qaxn--bmlo-grahokksundkvalsundegersundxn--karmy-yuaullensakerxn--hylandet-54axn--kvitsy-fyaxn--bod-2nalangevågberlevågkristiansandxn--rsta-frahornindalstjørdalshalsenstjordalshalsensandnessjoenhámmárfeastaxn--lrdal-srasør-fronsor-fronnord-odalkristiansundmátta-várjjatvestvågøynesoddennotoddenbuskerudøygardenoygardensalangenlavangenralingenrælingenlodingenlødingenleaŋgaviikalaakesvuemieleangaviikauenorgexn--srfold-byaaskvollxn--rskog-uuaxn--nry-yla5gxn--vry-yla5ghammarfeastaxn--rhkkervju-01afxn--givuotna-8yakommunekrokstadelvanedre-eikerhagebostadhægebostadxn--berlevg-jxakviteseidxn--s-1faxn--l-1faxn--nmesjevuemie-tcbafuosskomoårekemoarekexn--lt-liacxn--jrpeland-54asvalbardoppegardholmestrandtvedestrandsogndalsokndalarendalsunndalfolldalxn--krjohka-hwab49jlyngdaletnedalnorddalsaltdalgausdalskedsmovaksdalgjesdalstordalxn--frya-hraaarbortedrangedalxn--smna-graaurskog-hølandxn--vg-yiabtjeldsundhaugesundlindesnesxn--mre-og-romsdal-qqbxn--dnna-gradyntmpheremerseineshacknetenterprisecloudmineaccomaorimāoriorgmilcriiwigennetschoolhealthkiwigovtgeekxn--mori-qsacloudnsparliamentcomedorgcompronetedugovmuseumwebsitekinservicebarsywebsitebuildereerobookheimdnsleapcelleero-stagetechcrscsslorigingohomecdbedeeeiemesecabgngilnlalplchfisiincnnoroptatitmtltruauhulumkdkukskjplvtrgrfrkrhrusesismycynzcznetinteduassoososcloudstgbetaaezaeuhkusjshatenadiarycdn77hoptozaptois-a-knightmyftpno-ipjpnddnssdpdnsspdnsbarsysweetpepperis-a-bruinsfanis-very-sweetservegameis-a-soxfanhomelinuxcdn77-secureservebbsmisconfusedwebredirectblogsitefreedesktopcouchpotatofriestoolforgeaccesscamis-lostreadmyblogsmall-webfedorapeopleserveftpis-a-celticsfanmywirepotagertwmailin-dslsellsyourhomeread-booksfreeddnscable-modemis-savednflfanufcfanmlbfanstuff-4-saleendoftheinternetin-vpnmy-firewallhomeftpis-localis-a-chefboldlygoingnowherewebhopselfipkicks-assroxatunkcamdvrfedoraprojectgotdnsdvrdnsdyndnspubtlspimientahomeunixdontexistfedorainfracloudwmflabsfspagesbmoattachmentsteckidsfamilydsdnsaliasdynaliasnow-dnscloudnsdoomdnsduckdnsblogdnshomednsroutingthecloudendofinternetdsmynasip-dynamicpoivronhttpbinmyfirewallis-very-evilmysecuritycamerais-a-linux-userwmcloudis-a-geektuxfamilyis-a-candidatedoesntexistis-very-badhobby-sitegame-hostaltervistais-foundis-a-patsfandnsdojohepforgepodzonedynservcollegefanis-very-goodfrom-meis-very-niceisa-geeknerdpolacmedsldingorgcomnomgobabonetedupleskaemhlxmyboxrockyprvcydeuxfleurspdnscodebergheyflowstatichostorgmilcomnomgobneteduorgcomeduiorgmilcomngonetedugovcloudns1337ngrokacorggogfamcomwebgobnetedugokgopgkpgovgosbizpasaugumicsopozpapuwmwsrprusiskwpspkppspkmpspokeoiawsawifoumsdnskokwpmuppuppsppiwwiwoowuzswkzoschrzpisdnwzmiuwwitdpssewsseumigugimoirmpinbwinbwiihupporzgwgriwupowwskrwioswuozstarostwokonsulattmpccopruszkowmyspreadshopostrodakartuzyopolegminamediaustkazgorajgoraolawailawalomzawloclradombytomjaworznotargilubinkoninzagantorunkutnokepnonakloczestsopotsanokturekplockslasksklepzarowlukowmedaidgdaorgmilrelcomnomatmgsmartneteduelkgovwawsossexbiztgorysejnytychypomorzeboleslawiechomesklepsdscloudunicloudzakopanelegnicarawa-mazbydgoszczswidnikkrasnikwloclawekbielawamragowograjeworealestatebeskidykaszubymalopolskaprzeworskswiebodzinlecznadfirmaszkolawarmiagdyniamiastakazimierz-dolnymalborkswidnicadlugolekaostrolekapodlasieelblagtravelsimplesitezachpomormielecszczecinnieruchomosciwalbrzychlezajsklublinbedzinpoznanwielunmielnooleckostarachowicedkontopowiatwroclawrybniksuwalkileborkslupskgdanskostrowwlkptarnobrzegtourismwegrowkrakowglogowyou2pilanysamailwrocinfoagroautobeepshoppriviqhslapypiszlodzcfolksecommerce-shopmazurypulawyskoczowrzeszowpomorskiezgierzkaliszolkuszlowiczostrowiecsosnowiecmazowszewodzislawbialowiezazgorzeleckatowicepabianicejelenia-gorawolominkarpaczsieradznowarudaczeladzkonskowolaskierniewiceswinoujscieturystykabieszczadycieszynketrzynolsztynbialystokbabia-goraprochowicewarszawastalowa-wolapolkowicegorlicegliwiceponiatowalimanowalubartowaugustowkobierzyceopocznognieznoszczytnokolobrzegshoparenapodhalebielskoklodzkostargardatwithplayitownnamecoorgnetedugovacorgcomproestnetedugovbiznameislaprofinforechtngrokmedaaaacacpaenglawjurbarbarsykeeneticavocatacctcloudnsorgcomsecplonetedugov123paginaweborgcomnetintedugovnomepublidkinbarsygovx443cloudnsorgmilcomnetedugovcooporgmilcomschnetedugovnamecomcannetlibassoaemclantmcontstoreorgcomnomrecwwwbarsyfirminfoshopartsstackitmyddnswebspacelima-cityacincooxorgedugovbarsybrendlyhbvpsvpsspectrumlandinghostingacppmordoviamcprecbgorgmilcomspbnetintedumsknovgovbirrasmcdirmytismircloudvladimirnalchikadygeyamarinepyatigorskmyjinobashkiriaeurodirvladikavkazna4ugroznykustanaikalmykiacldmaildagestaniranbuildcloudcanvaliaravalwixdevelopmentappwritemigrationneedleverceldatabasestackitcodereplravendbonporterlovableaccoorgmilnetgovcoopmedorgcompubschnetedugovservicemecomygovorggovtvmedorgcomnetedugovinfoedgfacbmlonihkutwpsryxzbdtmacfhppmyspreadshopbrandpartiorgcomfhvpress123minsidaitcouldbeworlanbibkommunalforbundfhskiopsyskomvuxkomforbnaturbruksgymnloginlineorgcomnetedugovenscaledeuusentsurgebotdaorgmilcomnetgovnowteleporthashbangplatformlovablebarsyshopwarebasehoplixbarsyonlinemsf5gitappgitpagewawamscofigma-govcaffeinefigmacanvasoltstscwputerbarsysupportchatgptsquareomniweopensocialcpanelplaycodenotionnovecorewpsquaredpreviewjelecyonbyensrhtfastvpspieboxconvexjouwwebheyflowplatformshloginlinemadethissourcecraftclouderaorgorgcomartedugouvunivmeorgcomnetedugovsurveysstatichfheiyuxs4allprojectmyfastubervibehostapp-ionosdeployagentmecoorgcomschnetedugovbizcncostoreorgmilcomneteduembaixadaconsuladokiraranohoprincipesaotomeheliohobarsystorebaseshopwaresellfyaiabkhaziavologdamordoviapenzalenugsochinavoiexnetspbmsknovnorth-kazakhstanashgabadkareliaarmeniageorgiavladimirnalchikivanovobukharaadygeyakhakassiakalugakrasnodarjambylaktyubinsktroitskbryanskobninskkurganazerbaijanpokrovskbashkiriatselinogradvladikavkazmurmansktulatuvamangyshlaktashkentchimkentgroznykaragandatermezarkhangelskkustanaikalmykiabalashoveast-kazakhstankaracoldagestantogliattibarsyredorgcomgobedumirenknightpointaccoorgjelasticdiscoursecleverappsschacmiincogoornetonlineshopcogoorgmilcomwebnicnetintedugovbiznametestcoorgmilcomnomnetedugovorangecloudpersoindorgcomfinnatnetgovensmincomtourismintlinfox0611oyaorgmilcomnetedugovquickconnectvpnplusnettprequalifymeaddrmyaddrntdllwadlnctvavdrk12orgmilpolbeltelcomwebgennetedutskkepgovbbsbiznameinfocoorgmilcompronetedugovbiznameinfobetter-thanworse-thansakurafromdyndnson-the-webmymailerorgmilurlcomneteduidvgovmydnsgameclubebizmeneacsccogotvorhotelmilmobiinfovodteiflgplkmsmsbcckhincndnvncoztltmkckppzpdprvcvkvlvcrkrkscxuzchernovtsyrivneyaltaodesavolynrovnolutskltdinforgcomnetedugovbizvinnicazhitomirternopilpoltavakropyvnytskyizaporizhzhiasevastopolsebastopoluzhgoroduzhhorodkharkovkharkivvinnytsiakhmelnytskyizaporizhzhecrimeaodessazhytomyrnikolaevcherkassydonetskluganskluhanskkirovogradivano-frankivskchernivtsikrymkievkyivlvivsumyzakarpattiamykolaivcherkasychernigovkhersonchernihivdnipropetrovskdnepropetrovskkhmelnitskiyneacsccogoorusorgmilcomedugovmyspreadshopadimono-ipbarsybarsyonlinelayershiftnh-servretrosnubapicampaignservicelugaffinitylotteryweeklylotteryraffleentrygluglugsmeaccoindependent-inquestnimsitecopropymntltdorgplcschnetgovnhsbarsyindependent-commissionindependent-reviewpolicepublic-inquiryindependent-panelconnhospindependent-inquiryroyal-commissionoraclegovcloudappscck12libaws-govccphxcclibpvtparochchtrcck12libcceatonk12coglibtecgendstmusann-arborwashtenawcck12glghcck12sealibforksolympiabainbridge-islkeyporthoquiamyarrow-pointcentraliaport-townsendsequimport-ludlowrentonsilverdalebremertonredmondsheltonbellevueport-orchardport-angeleskingstonchehalisaberdeengig-harborseattlepoulsboidmdndsddemenegacalamaiavawapailalflnmdcncscohnhmihiviwiriinmntnmocoutvtctmtgunjokakwvnvprarorasmskstxwynykyazisadninsnngosrvis-bymircloudservernamepointtoenscaledland-4-salefreeddnsstuff-4-saleazure-apinoipdatabricksappscloudnsgolffanheliohostazurewebsitesgvorgmilcomgubneteducoorgcomnetd0egvorgmilcomnetedugovmydnsiacostoree12orgmilcomnomwebgobbibrectecnetintedugovraremprendefirminfoartseducok12orgcomnethidnsidacaiiosonlahanamhanoicamauhueorgcompronetintedugovbizbacninhtayninhhoabinhnamdinhtravinhhaiphongvinhlonghaiduongquangnamquangtrithuathienhuequangninhbacgianghaugiangquangbinhsoctrangbentrethanhphohochiminhdanangkontumhatinhkhanhhoathanhhoahealthgialailaocaiyenbaibackanngheanlonganphuyenphuthocanthodaklakdongnainameinfovinhphucdongthapkiengiangtiengiangquangngailaichaulangsonlamdongdaknonghagiangangiangcaobangbinhduongninhthuanbinhthuanbaclieuthaibinhninhbinhbinhdinhtuyenquanghungyenbaria-vungtauthainguyendienbienbinhphuocschbizputerimagine-proxyorgcomnetedugovcloud66advisormypetsdyndnsxn--8dbq2axn--4dbgdty6cxn--5dbhl8dxn--hebda8bxn--80auxn--d1atxn--c1avgxn--o1acxn--o1achxn--90azhxn--55qx5dxn--uc0atvxn--od0algxn--wcvs22dxn--gmqw5axn--mxtq1mxn--12c1fe0brxn--h3cuzk1dixn--12co0c3b4evaxn--12cfi8ixb8lxn--o3cyx2axn--m3ch0j3axn--j1adpxn--90amcxn--90a1afxn--h1ahnxn--j1ael8bxn--h1alizxn--c1avgxn--j1aefxn--80aaa0cvacxn--41acaffeineexeopentunnelbotdashtelebitorgtmaccoagricorgmilnomwebnicngonetaltedugovlawnisschoolgrondaraccoorgmilcomschnetedugovbizinfoprg1-zeropstritonstackitlimazeropsaccoorgmilgovяспборгкоммскбизмирсамаракрымсочиакодпроргобрупрצהלממשלישובאקדמיהองค์กรธุรกิจรัฐบาลศึกษาทหารเน็ต教育網絡組織公司政府個人닷넷한국澳门新闻澳門联通家電嘉里招聘通販닷컴삼성コムგეбгрфеюadcdbdgdidmdsdtdaebedeeegeiejekemenepereseveyegabacalamanauavapaqasazacfbfafgfnfpfwftfbgcgagggegkgngmgsgpgvgtgugilmlnlalclglplsltlhmimjmkmmmomambmcmdmfmgmzmpmsmtmgbbblbsbecccacnclcmcvctcscmhkhghchbhthphshlinikifigiaibicivisikninhnmncnbngnsnpnvntnjoionomobocoaofodorosotoptstttytatbtetgtithtmtltrusuvuaucueuguhulumunufjdjbjtjsjlkmkhkfkdkcktkukskpkgpmpnpkpjpgqaqmqiqsvtvcvbvmvlvrwpwtwzwbwcwawgwkwmwtrsrprgrfrercrbrarnrmrlrkrirhrwsusrssspsgsesbsaslsmsissxmxaxcxuypysylymykygybycyuztzsznzmzkzdzczbzazελευ世界台灣购物公益点看臺灣网络書籍在线网站手机机构大拿游戏信息台湾谷歌慈善商标香港中国餐厅网址中國商城食品微博政务移动集团公司八卦商店健康网店政府时尚佛山中信娱乐广东企业homedepotengineeringاماراتrepublicankuokgroupversicherungchannelcitadelxn--pgbs0dhxn--b4w605ferdstatebankwebsitexn--mgb9awbf亚马逊淡马锡alibabaxn--ngbc5azdxn--mgbbh1axn--45br5cyltoshibabuildworldcloudtradeguideplacespacedancemoviephoneprimesmilebiblestyleappleazurestoreskypegripexn--l1accdrivelottehorsehouseleasechasereisestadahondaomegaaetnaamicaninjanokiamediadeltavodkaedekaosakapizzaslingemailgmailtirolshelltmallfinallegaltotalhotelamfamforumrehabmusicciticricohcoachwatchboschearthfaithirishmiamiarchidubaiguccipraxiみんなストアセールcanonsalononionnikonepsonkoelngreensevencrownikanoradioaudioweiboglobopromogalloyahoociscorodeovideomangobingotokyovolvolottokyotophotosmartsportquesttrusthyattjetztadultcymrubaidutushuxn--kprw13dubankclickblackmerckgroupsharpcheapnowtvxn--h2brj9cקוםհայоргсрбмонкомбелмкдқазрусукрمصرقطرعربكومdadcfdmedwedredphdthdbidpidkrdmsdltdiceonewmeglemoerwecfageacbanbambaaaammakianraspacpaaxawtfbcgaegongingaigvigorgdogdhlmilrilonlaolloluoljllcalgalnflafltelsrlfrllplkimibmcamcombommomifmabbjcbscbwebcabnabtabmlbpubabcbbcnecincpncllcstcwtcpwcnyckfhbzhovhmoiskiobisbitcifyituipinvinwinxincbnbcnmanfangdnmenrenkpnmtnyunrunfununobiojioriohbogmofooboooooacoecoceongoproartistottnttbbtcateatlatvetpetbetnethktmitfitintjothotgotdotbotprueduicujnjyouinknhktdkappsapgapmapdnptopgopllpjmpzipvipripesqtrvdtvitvdevmovgovhivnrwlawsewnewbmwwownowhowdvrftrmtrsfrbarcartvscrseusawsupsubssbsadsddsldssasbmsmlsxxxboxfoxgmxtjxsextaxbuyflydiysoyjoyskypaydaygayxyzanzbizwebersenerpokerlameractortatarsolarລາວคอมไทยtourslocusnexuslexusgiftsbeatsboatspartspressglassswissकॉमनेटtiresgivescodeshomesgamestunesshoescardswalesloansvegastoolsdealsautosparisファッションworkssucksrocksxeroxforexfedexpartylillymoneystudyrugbytoraytoday中文网xn--unup4y天主教飞利浦新加坡enterprises我爱你嘉里大酒店christmasxn--fct429kholdingsxn--8y0a063axn--mgbx4cd0ablifestyleabogadoallstatenetbankكاثوليكxn--s9brj9cxn--gk3at1ebestbuycharityxn--55qx5dmicrosoftpropertybasketballhomegoodscorsicajewelrygallerygrocerysurgerycountrybrusselsverisignferreroxn--czr694bhdfcbankcommbanksoftbankپاكستانپاکستانnextdirectالسعوديهالعليانxn--h2brj9c8cxn--80adxhksshikshaxn--mgbai9azgqp6jcuisinellabarclayscatholicxn--kpry57dcompanyxn--xhq521bblackfridayxn--mgba3a3ejtsandvikxn--d1acj3bacademydownloadمليسياxn--j1amhxn--w4r85el8fhu5dnraipirangaathletaxn--fhbeixn--mgbqly7cvafrzuerichxn--c2br7gஇலங்கைcontractorsxn--io0a7igraphicsinsurancetemasekxn--xkc2al3hye2amotorcyclesphotographydirectoryplumbingxn--vhquvclothingtrainingcleaningwilliamhilllightingxn--mgba3a4f16ashoppingcateringeducationokinawapicturesventuresproductionsxn--9et52uwalmartഭാരതംsupportrealestatecapitalonexn--nqv7fs00emaauspostfloristdentistxn--qxamgodaddybradescobargainsmitsubishikerryhotelsxn--9dbq2axn--3pxu8kimmobilienxn--fjq720axn--mgbtx2bholidaymckinseymadridbusinessbuildershelsinkixn--4gbrimмоскваالسعودیةcoffeedegreelacaixapartnersalsaceofficeabbvievoyageorangegeorgeonlinechromemobilekindlegoogleoraclecircleschulesecureinsurexn--mgba7c0bbn0aestatexn--mgbc0a9azcgcruisehangoutxn--vuq861bxn--42c2d9arexrothfirestoneuniversityxn--nnx388alifeinsuranceextraspaceонлайнvermögensberatersoftwarexn--fiqs8sxn--mgbab2bdxn--w4rs40ltiendaभारतम्africatoyotaotsukasakuracameracreditcardnagoyaconsultingnetworkjunipertheatermonsterprogressivepioneerxn--55qw42gracingdatingvotingvikinglivinggivingxn--bck1b9a5dre4cbrotherweatherjoburgفلسطينlplfinancialxn--clchc0ea0b2g2a9gcdfutbolschoolsocialglobaldentalwoodsidechanelairtelmatteltravelrealtorwebcamstreamభారత్unicomalstomxn--nodexn--6frz82gmuseumfurniturexn--rvc1e0am3exn--mix891faccenturexn--11b4c3dismailineustardiscountquebeccomsecclinicservicesxn--y9a3aqxn--c1avgswatchchurchsearchالاردنmarketingcontacthealthmonashshoujisanofitaipeiamericanexpresssuzukiアマゾンクラウドポイントbhartiグーグルxn--mgberp4a5d4armemorialxn--1qqw23alondonmormoninstitutevisionbostonnortoncouponmaisonamazonvirginberlindesigndurbanolayannissananquanxihuanhitachikaufengardenreisenbayerntechnologydatsunxn--90a3aclatinocasinostudiophysioxn--ngbe9e0apharmacytattootaobaoaramcoexpertreportabbottdirectselectimamatfairwindspictettargetmarketintuittravelersinsurancecreditdupontryukyusuppliesxn--tckwebnpparibasschmidtmerckmsdyodobashirestaurantbridgestonecricketxn--fpcrj9c3dbostikbroadwayattorneylefrakemerckxn--fiq228c5hscareersfarmerswinnersflowersxn--wgbh1cguitarsxn--54b7fta0ccxn--p1acfmakeupgalluplandroverxn--kcrx77d1x4agoldpointbauhausxn--mgbayh7gpahiphopplaystationxn--mgba3a4fraxn--eckvdtc9dhyundaixn--gckr3f0fistanbulticketsmarketsflightschintaireviewsxn--3e0b707ewindowsxn--fiqz9sfinancialxn--fzys8d69uvgmابوظبيdiscoverreviewবাংলাxn--5su34j936bgsgmoscowobserverapartmentsдетиارامكوсайтeurovisionxn--i1b6b1a6a2exn--xkc2dl3a5ee0hتونسموقعبارتڀارتشبكةعمانبيتكعراقreadkredbondlandbandfundfoodprodgoldfordtubecafesafelifeggeeieeefreefagepagegugezonewinememenamegamesaleablebikenikelikecarecbreherefiresaveloveliveblueartedatesitevotecaseluxebofamodaltdaasdatiaayogasinavanashiaasiajavabbvatevavivadatazaraarpacasavisasncfprofmaifsurfgolfdvagsongbingpingwangkpmggoogblogpohlfailcooldellcalldeallidlsarlfilmteamroomfarmimdbarabclubhdfcicbchsbcgmbhrichtechfishdishcashminiernikddiaudiwikimobitaxicitikiwidesiqponskinloanakdnwienopenporncerntownimmolimoolloinfonicofidolegosaxozeroaerovivoautovotomotofastbestresthostpostnextlgbtchatseatgiftmeetdietreitmintrentgentspotscotguruitausohumenucyoubanklinkpinkdclktalksilkbookseekworkrsvpaarpjeepshopcoophelpcamppccwshowbeerstarruhrflirweirhaircarsparsjprshausplusnewstipstoysjobskidsfanspicsdocsxboxamexsexynavycitysonyarmyallybabyplaydeliverybuzzgbizlamborghiniphilipsලංකාಭಾರತfitnessexpresslanxesspfizercenterwalterlawyersoccercareerkosherbrokerlockerdealerdoctorauthorxn--mgbqly7c0a67fbcvermögensberatungjaguarxn--pssy2uxn--hxt814eflickrrepairrogersairbusxn--mgbai9a5eva00beventsyachtsxn--t60b56aভাৰতভারতभारतभारोतviajeshermeshughesxn--j1aefसंगठनvillasଭାରତclaimshotelsભારતzapposphotosjuegoscondostatamotorsgratistennisਭਾਰਤtkmaxxtjmaxxschaeffleryandexxn--80aswgrealtysafetybeautyluxuryxn--3ds443gsupplyfamilyxn--o3cw4hhockeysydneyxn--90aenissayalipayenergycomputeragencyxn--rovu88b電訊盈科xn--gecrj9cstatefarmaccountantaquarelleolayangroup香格里拉xn--p1ai组织机构xn--1ck2e1bxn--mgbt3dhdschwarzموريتانياabudhabinowruzkomatsufujitsuhospitalxn--80asehdbxn--mgbtf8flxn--j6w193gxn--yfro4i67oprudentialxn--flw351ecruisescoursesrecipesxn--e1a4cferrarixn--ses554gxn--wgbl6awatchesstaplessinglesxn--mgbcpq6gpa1axn--otu796dpropertiescreditunionxn--mgbah1a3hjkrdstockholmhisamitsuالسعوديةstcgroupdomainsoriginscouponsbloombergclubmedfroganslimitedxn--80aqecdr1aexposedinternationalequipmentbarclaycardxn--q7ce6axn--mgbi4ecexpprotectionassociatesconstructionxn--cck2b3bxn--45q11candroidfoundationישראלxn--mgbca7dzdocliniqueboutiqueengineerxn--qxa6asystemsfirmdalefashionauctionxn--nqv7finfinitirentalsreliancetradingweddingfishinghostinggentingbookingcookingxn--3hcrj9cgraingerxn--czrs0tdemocratsamsungyokohamaxn--h2breg3evexn--nyqy26alundbeckmelbournevacationssolutionsfrontierxn--vermgensberatung-pwbmanagementxn--cg4bkixn--mgb2ddeslincolnhamburgsandvikcoromantblockbusterairforcebarefootxn--4dbrk0ceinvestmentsfeedbackcommunityxn--ngbrxالبحرينdiamondsamsterdamhealthcareredumbrellaxn--mxtq1mxn--2scrj9cagakhanxn--mgbpl2fhкатоликcaravanசிங்கப்பூர்richardlimortgageamericanfamilyxn--fzc2c9e2cscholarshipssaarlandxn--imr513nvlaanderensamsclubgoodyearkitchenஇந்தியாweatherchannelallfinanzxn--kput3iالسعودیۃxn--90aisxn--efvy88hالجزائرxn--mgbaam7a8hexchangejpmorganxn--tiq49xqyjfidelitysecurityxn--mk1bu44cwanggouxn--fiq64bxn--6qq986b3xlxn--mgbbh1a71exn--80ao21amarshallsxn--5tzm5gtravelerspanasoniclatrobeyoutubeaccountantsxn--rhqv96gxn--cckwcxetdanalyticsxn--ygbi2ammxبازاربھارتسوريةorganicfreseniusسورياxn--9krt00axn--qcka1pmcxn--jlq480n2rgdeloittesciencefinancexn--jvr189mxn--30rr7yhomesensehotmailbaseballfootballleclercboehringerxn--q9jyb4cxn--mix082fاليمنهمراهpolitieسودانايرانایرانnetflixyamaxunxn--lgbbat1ad8jcollegestoragecapetowncolognekerrypropertiesxn--mgbgu82axn--ogbpf8flxn--czru2dwhoswhociprianilasallexn--g2xx48cforsalebanamexaudiblexn--vermgensberater-ctbxn--zfr164bericssonvanguardxn--45brj9cindustriestheatremarriottxn--3bst00mcomparexn--mgberp4a5d4a87gcapitaldigitalالمغربbarcelonashangrilaxn--d1alfcalvinkleinwwwcitysapporokawasakinagoyasendaikobekitakyushuyokohamackjp`.charCodeAt(i+e)!==t.charCodeAt(n+e))return!1;return!0}function IL(e,t,n,r,i){let a=CL[e],o=CL[e+1];for(;a<o;){let e=a+o>>>1,s=AL[e];if(s<t)a=e+1;else if(s>t)o=e;else{for(let o=e;o>=a&&AL[o]===t;--o)if(FL(o,n,r,i))return o;for(let a=e+1;a<o&&AL[a]===t;a+=1)if(FL(a,n,r,i))return a;return-1}}return-1}function LL(e,t,n){let r=t,i=e.length,a=5381;ML=-1;for(let t=e.length-1;t>=0;--t){let o=e.charCodeAt(t);if(o===46){let o=t+1,s=IL(r,a>>>0,e,o,i-o);if(s===-1&&(s=jL[r]),s===-1)return ML!==-1;r=TL[s],(SL[r]&n)!==0&&(ML=r,NL=o,PL=i),i=t,a=5381}else a=a*33^o}let o=IL(r,a>>>0,e,0,i);return o===-1&&(o=jL[r]),o!==-1&&(r=TL[o],(SL[r]&n)!==0&&(ML=r,NL=0,PL=i)),ML!==-1}function RL(e,t,n){if(xL(e,t,n))return;let r=(t.allowPrivateDomains?2:0)|!!t.allowIcannDomains;if(LL(e,629,r)){n.isIcann=!!(SL[ML]&1),n.isPrivate=!!(SL[ML]&2),n.publicSuffix=e.slice(PL+1);return}if(LL(e,625,r)){n.isIcann=!!(SL[ML]&1),n.isPrivate=!!(SL[ML]&2),n.publicSuffix=e.slice(NL);return}n.isIcann=!1,n.isPrivate=!1;let i=e.lastIndexOf(`.`);n.publicSuffix=i===-1?e:e.slice(i+1)}function zL(e,t){return bL(e,5,RL,t,yL())}var BL=class extends Error{name=`Realm.NotFoundError`;constructor(e){super(`Unknown realm ${e.id}. Add it first.`)}},VL=`default`,HL;(function(e){let t=e.id=j().regex(/^[a-z0-9]+(-[a-z0-9]+)*$/,{message:`Use lowercase kebab case, such as tempo-cash.`});e.realm=A({id:t,name:j().trim().min(1,{message:`Set a name.`})}),e.passkeys=A({realmId:t,rpId:j().regex(/^(?=.{1,253}$)([a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?)(\.[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?)*$/,{message:`Use a lowercase domain, such as tempo.xyz.`})}),e.privy=A({appId:j().trim().min(1,{message:`Set a Privy app ID.`}),appSecret:j().min(1,{message:`Set a Privy app secret.`}),realmId:t}),e.realms=Gi(t).refine(e=>new Set(e).size===e.length,{message:`Name each realm once.`})})(HL||={});async function UL(e,t){let n=await e.select({appId:AE.appId,id:ME.id,name:ME.name,position:wE.position,rpId:kE.rpId,secp256k1:jE.realmId}).from(ME).leftJoin(wE,qC(W(wE.realmId,ME.id),W(wE.clientId,t.clientId))).leftJoin(kE,W(kE.realmId,ME.id)).leftJoin(AE,W(AE.realmId,ME.id)).leftJoin(jE,W(jE.realmId,ME.id)).where(JC(W(wE.clientId,t.clientId),W(ME.id,VL))).orderBy(fw(wE.position)),r=n.filter(e=>e.position!==null);return(r.length>0?r:n).map(YL)}async function WL(e,t){let{clientId:n,db:r,origin:i,own:a}=t,o=async()=>[await UP(e,()=>KL(r,{id:VL}),[`realm.get`,VL])];if(!n)return await o();let s=await UP(e,async()=>{let[e]=await r.select({redirectUris:G.redirectUris}).from(G).where(qC(W(G.clientId,n),nw(G.clientDiscoveryId)));return{origins:(e?.redirectUris??[]).flatMap(e=>{let t=URL.parse(e);return t&&(t.protocol===`https:`||t.protocol===`http:`)?[t.origin]:[]}),realms:await UL(r,{clientId:n})}},[`realm.forRequest`,n]);return i&&i!==a&&!s.origins.includes(i)?await o():s.realms}function GL(e){return e}async function KL(e,t){let[n]=await e.select({appId:AE.appId,id:ME.id,name:ME.name,rpId:kE.rpId,secp256k1:jE.realmId}).from(ME).leftJoin(kE,W(kE.realmId,ME.id)).leftJoin(AE,W(AE.realmId,ME.id)).leftJoin(jE,W(jE.realmId,ME.id)).where(W(ME.id,t.id));if(!n)throw new BL({id:t.id});return YL(n)}async function qL(e,t){let{db:n}=t,r=t.realms.flatMap(e=>e.privy?[e.id]:[]);if(r.length===0)return new Map;let i=await UP(e,()=>n.select().from(AE).where(ew(AE.realmId,r)),[`realm.privyApps`,...r]);return new Map(await Promise.all(i.map(async e=>[e.realmId,{appId:e.appId,appSecret:await fs({data:e.appSecret,key:t.secret})}])))}async function JL(e,t){let{db:n,realms:r}=t;if(!r.some(e=>e.id==="default"&&!e.passkeys))return r;let i=new URL(t.origin).hostname,a=zL(i,{allowPrivateDomains:!0});if(a.isIp)return r;let o=a.domain??i,s=i.split(`.`),c=s.map((e,t)=>s.slice(t).join(`.`)).filter(e=>e===o||e.endsWith(`.${o}`));if(r.some(e=>e.passkeys&&c.includes(e.passkeys.rpId)))return r;let l=await UP(e,async()=>{let e=await n.select({realmId:kE.realmId,rpId:kE.rpId}).from(kE).where(JC(W(kE.realmId,VL),ew(kE.rpId,c))),t=e.find(e=>e.realmId===VL);return{own:t?.rpId??null,taken:!t&&e.length>0}},[`realm.rpHolder`,...c]);return l.taken?r:r.map(e=>e.id==="default"&&!e.passkeys?GL({...e,passkeys:{rpId:l.own??o}}):e)}function YL(e){return GL({id:e.id,name:e.name,passkeys:e.rpId===null?void 0:{rpId:e.rpId},privy:e.appId===null?void 0:{appId:e.appId},secp256k1:e.secp256k1!==null})}var XL=xN({errors:[],load(e,t){let{userId:n}=t,r=t.realms.filter(e=>e.passkeys);return Promise.resolve({async list(e,t){return r.length===0?[]:(await t.db.select().from(DE).where(qC(W(DE.userId,n),rw(DE.address),ew(DE.rpId,r.map(e=>e.passkeys.rpId)))).orderBy(fw(DE.createdAt),fw(DE.id))).flatMap(e=>r.filter(t=>t.passkeys.rpId===e.rpId).map(t=>bN({account:D({owners:[Se({id:e.id,publicKey:e.publicKey},{rpId:e.rpId})]}),createdAt:e.createdAt,credential:{id:e.id,publicKey:e.publicKey,rpId:e.rpId},linked:[`tempo-wallet`,`wallet`].includes(e.source),realm:t,signer:void 0,type:`webAuthn`})))}})},type:`webAuthn`});function ZL(e,t,n,r,i){if(r===`m`)throw TypeError(`Private method is not writable`);if(r===`a`&&!i)throw TypeError(`Private accessor was defined without a setter`);if(typeof t==`function`?e!==t||!i:!t.has(e))throw TypeError(`Cannot write private member to an object whose class did not declare it`);return r===`a`?i.call(e,n):i?i.value=n:t.set(e,n),n}function QL(e,t,n,r){if(n===`a`&&!r)throw TypeError(`Private accessor was defined without a getter`);if(typeof t==`function`?e!==t||!r:!t.has(e))throw TypeError(`Cannot read private member from an object whose class did not declare it`);return n===`m`?r:n===`a`?r.call(e):r?r.value:t.get(e)}var $L=function(){let{crypto:e}=globalThis;if(e?.randomUUID)return $L=e.randomUUID.bind(e),e.randomUUID();let t=new Uint8Array(1),n=e?()=>e.getRandomValues(t)[0]:()=>Math.random()*255&255;return`10000000-1000-4000-8000-100000000000`.replace(/[018]/g,e=>(+e^n()&15>>e/4).toString(16))};function eR(e){return typeof e==`object`&&!!e&&(`name`in e&&e.name===`AbortError`||`message`in e&&String(e.message).includes(`FetchRequestCanceledException`))}var tR=e=>{if(e instanceof Error)return e;if(typeof e==`object`&&e){try{if(Object.prototype.toString.call(e)===`[object Error]`){let t=Error(e.message,e.cause?{cause:e.cause}:{});return e.stack&&(t.stack=e.stack),e.cause&&!t.cause&&(t.cause=e.cause),e.name&&(t.name=e.name),t}}catch{}try{return Error(JSON.stringify(e))}catch{}}return Error(e)},nR=class extends Error{},rR=class e extends nR{constructor(t,n,r,i){super(`${e.makeMessage(t,n,r)}`),this.status=t,this.headers=i,this.error=n}static makeMessage(e,t,n){let r=t?.message?typeof t.message==`string`?t.message:JSON.stringify(t.message):t?JSON.stringify(t):n;return e&&r?`${e} ${r}`:e?`${e} status code (no body)`:r||`(no status code or body)`}static generate(t,n,r,i){if(!t||!i)return new aR({message:r,cause:tR(n)});let a=n;return t===400?new sR(t,a,r,i):t===401?new cR(t,a,r,i):t===403?new lR(t,a,r,i):t===404?new uR(t,a,r,i):t===409?new dR(t,a,r,i):t===422?new fR(t,a,r,i):t===429?new pR(t,a,r,i):t>=500?new mR(t,a,r,i):new e(t,a,r,i)}},iR=class extends rR{constructor({message:e}={}){super(void 0,void 0,e||`Request was aborted.`,void 0)}},aR=class extends rR{constructor({message:e,cause:t}){super(void 0,void 0,e||`Connection error.`,void 0),t&&(this.cause=t)}},oR=class extends aR{constructor({message:e}={}){super({message:e??`Request timed out.`})}},sR=class extends rR{},cR=class extends rR{},lR=class extends rR{},uR=class extends rR{},dR=class extends rR{},fR=class extends rR{},pR=class extends rR{},mR=class extends rR{},hR=/^[a-z][a-z0-9+.-]*:/i,gR=e=>hR.test(e),_R=e=>(_R=Array.isArray,_R(e)),vR=_R;function yR(e){return typeof e==`object`?e??{}:{}}function bR(e){if(!e)return!0;for(let t in e)return!1;return!0}function xR(e,t){return Object.prototype.hasOwnProperty.call(e,t)}var SR=(e,t)=>{if(typeof t!=`number`||!Number.isInteger(t))throw new nR(`${e} must be an integer`);if(t<0)throw new nR(`${e} must be a positive integer`);return t},CR=e=>{try{return JSON.parse(e)}catch{return}},wR=e=>new Promise(t=>setTimeout(t,e)),TR=`0.35.0`,ER=()=>typeof window<`u`&&window.document!==void 0&&typeof navigator<`u`;function DR(){return typeof Deno<`u`&&Deno.build!=null?`deno`:typeof EdgeRuntime<`u`?`edge`:Object.prototype.toString.call(globalThis.process===void 0?0:globalThis.process)===`[object process]`?`node`:`unknown`}var OR=()=>{let e=DR();if(e===`deno`)return{"X-Stainless-Lang":`js`,"X-Stainless-Package-Version":TR,"X-Stainless-OS":jR(Deno.build.os),"X-Stainless-Arch":AR(Deno.build.arch),"X-Stainless-Runtime":`deno`,"X-Stainless-Runtime-Version":typeof Deno.version==`string`?Deno.version:Deno.version?.deno??`unknown`};if(typeof EdgeRuntime<`u`)return{"X-Stainless-Lang":`js`,"X-Stainless-Package-Version":TR,"X-Stainless-OS":`Unknown`,"X-Stainless-Arch":`other:${EdgeRuntime}`,"X-Stainless-Runtime":`edge`,"X-Stainless-Runtime-Version":globalThis.process.version};if(e===`node`)return{"X-Stainless-Lang":`js`,"X-Stainless-Package-Version":TR,"X-Stainless-OS":jR(globalThis.process.platform??`unknown`),"X-Stainless-Arch":AR(globalThis.process.arch??`unknown`),"X-Stainless-Runtime":`node`,"X-Stainless-Runtime-Version":globalThis.process.version??`unknown`};let t=kR();return t?{"X-Stainless-Lang":`js`,"X-Stainless-Package-Version":TR,"X-Stainless-OS":`Unknown`,"X-Stainless-Arch":`unknown`,"X-Stainless-Runtime":`browser:${t.browser}`,"X-Stainless-Runtime-Version":t.version}:{"X-Stainless-Lang":`js`,"X-Stainless-Package-Version":TR,"X-Stainless-OS":`Unknown`,"X-Stainless-Arch":`unknown`,"X-Stainless-Runtime":`unknown`,"X-Stainless-Runtime-Version":`unknown`}};function kR(){if(typeof navigator>`u`||!navigator)return null;for(let{key:e,pattern:t}of[{key:`edge`,pattern:/Edge(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:`ie`,pattern:/MSIE(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:`ie`,pattern:/Trident(?:.*rv\:(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:`chrome`,pattern:/Chrome(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:`firefox`,pattern:/Firefox(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:`safari`,pattern:/(?:Version\W+(\d+)\.(\d+)(?:\.(\d+))?)?(?:\W+Mobile\S*)?\W+Safari/}]){let n=t.exec(navigator.userAgent);if(n)return{browser:e,version:`${n[1]||0}.${n[2]||0}.${n[3]||0}`}}return null}var AR=e=>e===`x32`?`x32`:e===`x86_64`||e===`x64`?`x64`:e===`arm`?`arm`:e===`aarch64`||e===`arm64`?`arm64`:e?`other:${e}`:`unknown`,jR=e=>(e=e.toLowerCase(),e.includes(`ios`)?`iOS`:e===`android`?`Android`:e===`darwin`?`MacOS`:e===`win32`?`Windows`:e===`freebsd`?`FreeBSD`:e===`openbsd`?`OpenBSD`:e===`linux`?`Linux`:e?`Other:${e}`:`Unknown`),MR,NR=()=>MR??=OR();function PR(){if(typeof fetch<`u`)return fetch;throw Error("`fetch` is not defined as a global; Either pass `fetch` to the client, `new PrivyAPI({ fetch })` or polyfill the global, `globalThis.fetch = fetch`")}function FR(...e){let t=globalThis.ReadableStream;if(t===void 0)throw Error("`ReadableStream` is not defined as a global; You will need to polyfill it, `globalThis.ReadableStream = ReadableStream`");return new t(...e)}function IR(e){let t=Symbol.asyncIterator in e?e[Symbol.asyncIterator]():e[Symbol.iterator]();return FR({start(){},async pull(e){let{done:n,value:r}=await t.next();n?e.close():e.enqueue(r)},async cancel(){await t.return?.()}})}async function LR(e){if(typeof e!=`object`||!e)return;if(e[Symbol.asyncIterator]){await e[Symbol.asyncIterator]().return?.();return}let t=e.getReader(),n=t.cancel();t.releaseLock(),await n}var RR=({headers:e,body:t})=>({bodyHeaders:{"content-type":`application/json`},body:JSON.stringify(t)}),zR=`RFC3986`,BR=e=>String(e),VR={RFC1738:e=>String(e).replace(/%20/g,`+`),RFC3986:BR},HR=(e,t)=>(HR=Object.hasOwn??Function.prototype.call.bind(Object.prototype.hasOwnProperty),HR(e,t)),UR=(()=>{let e=[];for(let t=0;t<256;++t)e.push(`%`+((t<16?`0`:``)+t.toString(16)).toUpperCase());return e})(),WR=1024,GR=(e,t,n,r,i)=>{if(e.length===0)return e;let a=e;if(typeof e==`symbol`?a=Symbol.prototype.toString.call(e):typeof e!=`string`&&(a=String(e)),n===`iso-8859-1`)return escape(a).replace(/%u[0-9a-f]{4}/gi,function(e){return`%26%23`+parseInt(e.slice(2),16)+`%3B`});let o=``;for(let e=0;e<a.length;e+=WR){let t=a.length>=WR?a.slice(e,e+WR):a,n=[];for(let e=0;e<t.length;++e){let r=t.charCodeAt(e);r===45||r===46||r===95||r===126||r>=48&&r<=57||r>=65&&r<=90||r>=97&&r<=122||i===`RFC1738`&&(r===40||r===41)?n[n.length]=t.charAt(e):r<128?n[n.length]=UR[r]:r<2048?n[n.length]=UR[192|r>>6]+UR[128|r&63]:r<55296||r>=57344?n[n.length]=UR[224|r>>12]+UR[128|r>>6&63]+UR[128|r&63]:(e+=1,r=65536+((r&1023)<<10|t.charCodeAt(e)&1023),n[n.length]=UR[240|r>>18]+UR[128|r>>12&63]+UR[128|r>>6&63]+UR[128|r&63])}o+=n.join(``)}return o};function KR(e){return!e||typeof e!=`object`?!1:!!(e.constructor&&e.constructor.isBuffer&&e.constructor.isBuffer(e))}function qR(e,t){if(_R(e)){let n=[];for(let r=0;r<e.length;r+=1)n.push(t(e[r]));return n}return t(e)}var JR={brackets(e){return String(e)+`[]`},comma:`comma`,indices(e,t){return String(e)+`[`+t+`]`},repeat(e){return String(e)}},YR=function(e,t){Array.prototype.push.apply(e,_R(t)?t:[t])},XR,ZR={addQueryPrefix:!1,allowDots:!1,allowEmptyArrays:!1,arrayFormat:`indices`,charset:`utf-8`,charsetSentinel:!1,delimiter:`&`,encode:!0,encodeDotInKeys:!1,encoder:GR,encodeValuesOnly:!1,format:zR,formatter:BR,indices:!1,serializeDate(e){return(XR??=Function.prototype.call.bind(Date.prototype.toISOString))(e)},skipNulls:!1,strictNullHandling:!1};function QR(e){return typeof e==`string`||typeof e==`number`||typeof e==`boolean`||typeof e==`symbol`||typeof e==`bigint`}var $R={};function ez(e,t,n,r,i,a,o,s,c,l,u,d,f,p,m,h,g,_){let v=e,y=_,b=0,x=!1;for(;(y=y.get($R))!==void 0&&!x;){let t=y.get(e);if(b+=1,t!==void 0){if(t===b)throw RangeError(`Cyclic object value`);x=!0}y.get($R)===void 0&&(b=0)}if(typeof l==`function`?v=l(t,v):v instanceof Date?v=f?.(v):n===`comma`&&_R(v)&&(v=qR(v,function(e){return e instanceof Date?f?.(e):e})),v===null){if(a)return c&&!h?c(t,ZR.encoder,g,`key`,p):t;v=``}if(QR(v)||KR(v)){if(c){let e=h?t:c(t,ZR.encoder,g,`key`,p);return[m?.(e)+`=`+m?.(c(v,ZR.encoder,g,`value`,p))]}return[m?.(t)+`=`+m?.(String(v))]}let S=[];if(v===void 0)return S;let C;if(n===`comma`&&_R(v))h&&c&&(v=qR(v,c)),C=[{value:v.length>0?v.join(`,`)||null:void 0}];else if(_R(l))C=l;else{let e=Object.keys(v);C=u?e.sort(u):e}let w=s?String(t).replace(/\./g,`%2E`):String(t),T=r&&_R(v)&&v.length===1?w+`[]`:w;if(i&&_R(v)&&v.length===0)return T+`[]`;for(let t=0;t<C.length;++t){let y=C[t],x=typeof y==`object`&&y.value!==void 0?y.value:v[y];if(o&&x===null)continue;let w=d&&s?y.replace(/\./g,`%2E`):y,E=_R(v)?typeof n==`function`?n(T,w):T:T+(d?`.`+w:`[`+w+`]`);_.set(e,b);let D=new WeakMap;D.set($R,_),YR(S,ez(x,E,n,r,i,a,o,s,n===`comma`&&h&&_R(v)?null:c,l,u,d,f,p,m,h,g,D))}return S}function tz(e=ZR){if(e.allowEmptyArrays!==void 0&&typeof e.allowEmptyArrays!=`boolean`)throw TypeError("`allowEmptyArrays` option can only be `true` or `false`, when provided");if(e.encodeDotInKeys!==void 0&&typeof e.encodeDotInKeys!=`boolean`)throw TypeError("`encodeDotInKeys` option can only be `true` or `false`, when provided");if(e.encoder!==null&&e.encoder!==void 0&&typeof e.encoder!=`function`)throw TypeError(`Encoder has to be a function.`);let t=e.charset||ZR.charset;if(e.charset!==void 0&&e.charset!==`utf-8`&&e.charset!==`iso-8859-1`)throw TypeError(`The charset option must be either utf-8, iso-8859-1, or undefined`);let n=zR;if(e.format!==void 0){if(!HR(VR,e.format))throw TypeError(`Unknown format option provided.`);n=e.format}let r=VR[n],i=ZR.filter;(typeof e.filter==`function`||_R(e.filter))&&(i=e.filter);let a;if(a=e.arrayFormat&&e.arrayFormat in JR?e.arrayFormat:`indices`in e?e.indices?`indices`:`repeat`:ZR.arrayFormat,`commaRoundTrip`in e&&typeof e.commaRoundTrip!=`boolean`)throw TypeError("`commaRoundTrip` must be a boolean, or absent");let o=e.allowDots===void 0?e.encodeDotInKeys?!0:ZR.allowDots:!!e.allowDots;return{addQueryPrefix:typeof e.addQueryPrefix==`boolean`?e.addQueryPrefix:ZR.addQueryPrefix,allowDots:o,allowEmptyArrays:typeof e.allowEmptyArrays==`boolean`?!!e.allowEmptyArrays:ZR.allowEmptyArrays,arrayFormat:a,charset:t,charsetSentinel:typeof e.charsetSentinel==`boolean`?e.charsetSentinel:ZR.charsetSentinel,commaRoundTrip:!!e.commaRoundTrip,delimiter:e.delimiter===void 0?ZR.delimiter:e.delimiter,encode:typeof e.encode==`boolean`?e.encode:ZR.encode,encodeDotInKeys:typeof e.encodeDotInKeys==`boolean`?e.encodeDotInKeys:ZR.encodeDotInKeys,encoder:typeof e.encoder==`function`?e.encoder:ZR.encoder,encodeValuesOnly:typeof e.encodeValuesOnly==`boolean`?e.encodeValuesOnly:ZR.encodeValuesOnly,filter:i,format:n,formatter:r,serializeDate:typeof e.serializeDate==`function`?e.serializeDate:ZR.serializeDate,skipNulls:typeof e.skipNulls==`boolean`?e.skipNulls:ZR.skipNulls,sort:typeof e.sort==`function`?e.sort:null,strictNullHandling:typeof e.strictNullHandling==`boolean`?e.strictNullHandling:ZR.strictNullHandling}}function nz(e,t={}){let n=e,r=tz(t),i,a;typeof r.filter==`function`?(a=r.filter,n=a(``,n)):_R(r.filter)&&(a=r.filter,i=a);let o=[];if(typeof n!=`object`||!n)return``;let s=JR[r.arrayFormat],c=s===`comma`&&r.commaRoundTrip;i||=Object.keys(n),r.sort&&i.sort(r.sort);let l=new WeakMap;for(let e=0;e<i.length;++e){let t=i[e];r.skipNulls&&n[t]===null||YR(o,ez(n[t],t,s,c,r.allowEmptyArrays,r.strictNullHandling,r.skipNulls,r.encodeDotInKeys,r.encode?r.encoder:null,r.filter,r.sort,r.allowDots,r.serializeDate,r.format,r.formatter,r.encodeValuesOnly,r.charset,l))}let u=o.join(r.delimiter),d=r.addQueryPrefix===!0?`?`:``;return r.charsetSentinel&&(r.charset===`iso-8859-1`?d+=`utf8=%26%2310003%3B&`:d+=`utf8=%E2%9C%93&`),u.length>0?d+u:``}function rz(e){return nz(e,{arrayFormat:`comma`})}var iz={off:0,error:200,warn:300,info:400,debug:500},az=(e,t,n)=>{if(e){if(xR(iz,e))return e;uz(n).warn(`${t} was set to ${JSON.stringify(e)}, expected one of ${JSON.stringify(Object.keys(iz))}`)}};function oz(){}function sz(e,t,n){return!t||iz[e]>iz[n]?oz:t[e].bind(t)}var cz={error:oz,warn:oz,info:oz,debug:oz},lz=new WeakMap;function uz(e){let t=e.logger,n=e.logLevel??`off`;if(!t)return cz;let r=lz.get(t);if(r&&r[0]===n)return r[1];let i={error:sz(`error`,t,n),warn:sz(`warn`,t,n),info:sz(`info`,t,n),debug:sz(`debug`,t,n)};return lz.set(t,[n,i]),i}var dz=e=>(e.options&&(e.options={...e.options},delete e.options.headers),e.headers&&=Object.fromEntries((e.headers instanceof Headers?[...e.headers]:Object.entries(e.headers)).map(([e,t])=>[e,e.toLowerCase()===`authorization`||e.toLowerCase()===`api-key`||e.toLowerCase()===`x-api-key`||e.toLowerCase()===`cookie`||e.toLowerCase()===`set-cookie`?`***`:t])),`retryOfRequestLogID`in e&&(e.retryOfRequestLogID&&(e.retryOf=e.retryOfRequestLogID),delete e.retryOfRequestLogID),e);async function fz(e,t){let{response:n,requestLogID:r,retryOfRequestLogID:i,startTime:a}=t,o=await(async()=>{if(n.status===204)return null;if(t.options.__binaryResponse)return n;let e=n.headers.get(`content-type`)?.split(`;`)[0]?.trim();return e?.includes(`application/json`)||e?.endsWith(`+json`)?n.headers.get(`content-length`)===`0`?void 0:await n.json():await n.text()})();return uz(e).debug(`[${r}] response parsed`,dz({retryOfRequestLogID:i,url:n.url,status:n.status,body:o,durationMs:Date.now()-a})),o}var pz,mz=class e extends Promise{constructor(e,t,n=fz){super(e=>{e(null)}),this.responsePromise=t,this.parseResponse=n,pz.set(this,void 0),ZL(this,pz,e,`f`)}_thenUnwrap(t){return new e(QL(this,pz,`f`),this.responsePromise,async(e,n)=>t(await this.parseResponse(e,n),n))}asResponse(){return this.responsePromise.then(e=>e.response)}async withResponse(){let[e,t]=await Promise.all([this.parse(),this.asResponse()]);return{data:e,response:t}}parse(){return this.parsedPromise||=this.responsePromise.then(e=>this.parseResponse(QL(this,pz,`f`),e)),this.parsedPromise}then(e,t){return this.parse().then(e,t)}catch(e){return this.parse().catch(e)}finally(e){return this.parse().finally(e)}};pz=new WeakMap;var hz,gz=class{constructor(e,t,n,r){hz.set(this,void 0),ZL(this,hz,e,`f`),this.options=r,this.response=t,this.body=n}hasNextPage(){return this.getPaginatedItems().length?this.nextPageRequestOptions()!=null:!1}async getNextPage(){let e=this.nextPageRequestOptions();if(!e)throw new nR("No next page expected; please check `.hasNextPage()` before calling `.getNextPage()`.");return await QL(this,hz,`f`).requestAPIList(this.constructor,e)}async*iterPages(){let e=this;for(yield e;e.hasNextPage();)e=await e.getNextPage(),yield e}async*[(hz=new WeakMap,Symbol.asyncIterator)](){for await(let e of this.iterPages())for(let t of e.getPaginatedItems())yield t}},_z=class extends mz{constructor(e,t,n){super(e,t,async(e,t)=>new n(e,t.response,await fz(e,t),t.options))}async*[Symbol.asyncIterator](){let e=await this;for await(let t of e)yield t}},vz=class extends gz{constructor(e,t,n,r){super(e,t,n,r),this.data=n.data||[],this.next_cursor=n.next_cursor||``}getPaginatedItems(){return this.data??[]}nextPageRequestOptions(){let e=this.next_cursor;return e?{...this.options,query:{...yR(this.options.query),cursor:e}}:null}},yz=()=>{if(typeof File>`u`){let{process:e}=globalThis,t=typeof e?.versions?.node==`string`&&parseInt(e.versions.node.split(`.`))<20;throw Error("`File` is not defined as a global, which is required for file uploads."+(t?" Update to Node 20 LTS or newer, or set `globalThis.File` to `import('node:buffer').File`.":``))}};function bz(e,t,n){return yz(),new File(e,t??`unknown_file`,n)}function xz(e){return(typeof e==`object`&&!!e&&(`name`in e&&e.name&&String(e.name)||`url`in e&&e.url&&String(e.url)||`filename`in e&&e.filename&&String(e.filename)||`path`in e&&e.path&&String(e.path))||``).split(/[\\/]/).pop()||void 0}var Sz=e=>typeof e==`object`&&!!e&&typeof e[Symbol.asyncIterator]==`function`,Cz=e=>typeof e==`object`&&!!e&&typeof e.size==`number`&&typeof e.type==`string`&&typeof e.text==`function`&&typeof e.slice==`function`&&typeof e.arrayBuffer==`function`,wz=e=>typeof e==`object`&&!!e&&typeof e.name==`string`&&typeof e.lastModified==`number`&&Cz(e),Tz=e=>typeof e==`object`&&!!e&&typeof e.url==`string`&&typeof e.blob==`function`;async function Ez(e,t,n){if(yz(),e=await e,wz(e))return e instanceof File?e:bz([await e.arrayBuffer()],e.name);if(Tz(e)){let r=await e.blob();return t||=new URL(e.url).pathname.split(/[\\/]/).pop(),bz(await Dz(r),t,n)}let r=await Dz(e);if(t||=xz(e),!n?.type){let e=r.find(e=>typeof e==`object`&&`type`in e&&e.type);typeof e==`string`&&(n={...n,type:e})}return bz(r,t,n)}async function Dz(e){let t=[];if(typeof e==`string`||ArrayBuffer.isView(e)||e instanceof ArrayBuffer)t.push(e);else if(Cz(e))t.push(e instanceof Blob?e:await e.arrayBuffer());else if(Sz(e))for await(let n of e)t.push(...await Dz(n));else{let t=e?.constructor?.name;throw Error(`Unexpected data type: ${typeof e}${t?`; constructor: ${t}`:``}${Oz(e)}`)}return t}function Oz(e){return typeof e!=`object`||!e?``:`; props: [${Object.getOwnPropertyNames(e).map(e=>`"${e}"`).join(`, `)}]`}var kz=class{constructor(e){this._client=e}},Az=class extends kz{},jz=class extends kz{},Mz=class extends kz{},Nz=class extends kz{};function Pz(e){return e.replace(/[^A-Za-z0-9\-._~!$&'()*+,;=:@]+/g,encodeURIComponent)}var Fz=Object.freeze(Object.create(null)),Q=((e=Pz)=>function(t,...n){if(t.length===1)return t[0];let r=!1,i=[],a=t.reduce((t,a,o)=>{/[?#]/.test(a)&&(r=!0);let s=n[o],c=(r?encodeURIComponent:e)(``+s);return o!==n.length&&(s==null||typeof s==`object`&&s.toString===Object.getPrototypeOf(Object.getPrototypeOf(s.hasOwnProperty??Fz)??Fz)?.toString)&&(c=s+``,i.push({start:t.length+a.length,length:c.length,error:`Value of type ${Object.prototype.toString.call(s).slice(8,-1)} is not a valid path parameter`})),t+a+(o===n.length?``:c)},``),o=a.split(/[?#]/,1)[0],s=/(?<=^|\/)(?:\.|%2e){1,2}(?=\/|$)/gi,c;for(;(c=s.exec(o))!==null;)i.push({start:c.index,length:c[0].length,error:`Value "${c[0]}" can\'t be safely passed as a path parameter`});if(i.sort((e,t)=>e.start-t.start),i.length>0){let e=0,t=i.reduce((t,n)=>{let r=` `.repeat(n.start-e),i=`^`.repeat(n.length);return e=n.start+n.length,t+r+i},``);throw new nR(`Path parameters result in path with invalid segments:\n${i.map(e=>e.error).join(`
418
+ `)}\n${a}\n${t}`)}return a})(Pz),Iz=class extends kz{create(e,t,n){return this._client.post(Q`/v1/apps/${e}/allowlist`,{body:t,...n})}list(e,t){return this._client.get(Q`/v1/apps/${e}/allowlist`,t)}delete(e,t,n){return this._client.delete(Q`/v1/apps/${e}/allowlist`,{body:t,...n})}},Lz=class extends kz{constructor(){super(...arguments),this.allowlist=new Iz(this._client)}get(e,t){if(e===``)throw Error(`appID must not be an empty string`);return this._client.get(Q`/v1/apps/${e}`,t)}getGasSpend(e,t){return this._client.get(`/v1/apps/gas_spend`,{query:e,...t})}getTestCredentials(e,t){return this._client.get(Q`/v1/apps/${e}/test_credentials`,t)}};Lz.Allowlist=Iz;var Rz=class extends kz{},zz=class extends kz{},Bz=class extends kz{},Vz=class extends kz{},Hz=class extends kz{},Uz=class extends kz{},Wz=Symbol(`brand.privateNullableHeaders`);function*Gz(e){if(!e)return;if(Wz in e){let{values:t,nulls:n}=e;yield*t.entries();for(let e of n)yield[e,null];return}let t=!1,n;e instanceof Headers?n=e.entries():vR(e)?n=e:(t=!0,n=Object.entries(e??{}));for(let e of n){let n=e[0];if(typeof n!=`string`)throw TypeError(`expected header name to be a string`);let r=vR(e[1])?e[1]:[e[1]],i=!1;for(let e of r)e!==void 0&&(t&&!i&&(i=!0,yield[n,null]),yield[n,e])}}var Kz=e=>{let t=new Headers,n=new Set;for(let r of e){let e=new Set;for(let[i,a]of Gz(r)){let r=i.toLowerCase();e.has(r)||(t.delete(i),e.add(r)),a===null?(t.delete(i),n.add(r)):(t.append(i,a),n.delete(r))}}return{[Wz]:!0,values:t,nulls:n}},qz=class extends kz{list(e={},t){return this._client.getAPIList(`/v1/intents`,vz,{query:e,...t})}createPolicyRule(e,t,n){let{"privy-request-expiry":r,...i}=t;return this._client.post(Q`/v1/intents/policies/${e}/rules`,{body:i,...n,headers:Kz([{...r==null?void 0:{"privy-request-expiry":r}},n?.headers])})}deletePolicyRule(e,t,n){let{policy_id:r,"privy-request-expiry":i}=t;return this._client.delete(Q`/v1/intents/policies/${r}/rules/${e}`,{...n,headers:Kz([{...i==null?void 0:{"privy-request-expiry":i}},n?.headers])})}get(e,t){if(e===``)throw Error(`intentID must not be an empty string`);return this._client.get(Q`/v1/intents/${e}`,t)}reject(e,t){return this._client.post(Q`/v1/intents/${e}/reject`,t)}rpc(e,t,n){let{"privy-request-expiry":r,...i}=t;return this._client.post(Q`/v1/intents/wallets/${e}/rpc`,{body:i,...n,headers:Kz([{...r==null?void 0:{"privy-request-expiry":r}},n?.headers])})}transfer(e,t,n){let{"privy-request-expiry":r,...i}=t;return this._client.post(Q`/v1/intents/wallets/${e}/transfer`,{body:i,...n,headers:Kz([{...r==null?void 0:{"privy-request-expiry":r}},n?.headers])})}updateKeyQuorum(e,t,n){let{"privy-request-expiry":r,...i}=t;return this._client.patch(Q`/v1/intents/key_quorums/${e}`,{body:i,...n,headers:Kz([{...r==null?void 0:{"privy-request-expiry":r}},n?.headers])})}updatePolicy(e,t,n){let{"privy-request-expiry":r,...i}=t;return this._client.patch(Q`/v1/intents/policies/${e}`,{body:i,...n,headers:Kz([{...r==null?void 0:{"privy-request-expiry":r}},n?.headers])})}updatePolicyRule(e,t,n){let{policy_id:r,"privy-request-expiry":i,...a}=t;return this._client.patch(Q`/v1/intents/policies/${r}/rules/${e}`,{body:a,...n,headers:Kz([{...i==null?void 0:{"privy-request-expiry":i}},n?.headers])})}updateWallet(e,t,n){let{"privy-request-expiry":r,...i}=t;return this._client.patch(Q`/v1/intents/wallets/${e}`,{body:i,...n,headers:Kz([{...r==null?void 0:{"privy-request-expiry":r}},n?.headers])})}},Jz=class extends kz{create(e,t){return this._client.post(`/v1/key_quorums`,{body:e,...t})}_delete(e,t={},n){let{"privy-authorization-signature":r,"privy-request-expiry":i}=t??{};return this._client.delete(Q`/v1/key_quorums/${e}`,{...n,headers:Kz([{...r==null?void 0:{"privy-authorization-signature":r},...i==null?void 0:{"privy-request-expiry":i}},n?.headers])})}_update(e,t,n){let{"privy-authorization-signature":r,"privy-request-expiry":i,...a}=t;return this._client.patch(Q`/v1/key_quorums/${e}`,{body:a,...n,headers:Kz([{...r==null?void 0:{"privy-authorization-signature":r},...i==null?void 0:{"privy-request-expiry":i}},n?.headers])})}get(e,t){if(e===``)throw Error(`keyQuorumID must not be an empty string`);return this._client.get(Q`/v1/key_quorums/${e}`,t)}},Yz=class extends kz{},Xz=class extends kz{},Zz=class extends kz{},Qz=class extends kz{create(e,t,n){return this._client.post(Q`/v1/organizations/${e}/external_fiat_accounts`,{body:t,...n})}list(e,t,n){return this._client.get(Q`/v1/organizations/${e}/external_fiat_accounts`,{query:t,...n})}delete(e,t,n){let{organization_id:r}=t;return this._client.delete(Q`/v1/organizations/${r}/external_fiat_accounts/${e}`,n)}get(e,t,n){let{organization_id:r}=t;return this._client.get(Q`/v1/organizations/${r}/external_fiat_accounts/${e}`,n)}},$z=class extends kz{list(e,t){return this._client.get(Q`/v1/organizations/${e}/kyb`,t)}initiateLinks(e,t,n){return this._client.post(Q`/v1/organizations/${e}/kyb/links`,{body:t,...n})}initiateTos(e,t,n){return this._client.post(Q`/v1/organizations/${e}/kyb/tos`,{body:t,...n})}submit(e,t,n){return this._client.post(Q`/v1/organizations/${e}/kyb/submit`,{body:t,...n})}},eB=class extends kz{constructor(){super(...arguments),this.externalFiatAccounts=new Qz(this._client),this.kyb=new $z(this._client)}create(e,t){return this._client.post(`/v1/organizations`,{body:e,...t})}update(e,t,n){return this._client.patch(Q`/v1/organizations/${e}`,{body:t,...n})}list(e={},t){return this._client.getAPIList(`/v1/organizations`,vz,{query:e,...t})}delete(e,t){return this._client.delete(Q`/v1/organizations/${e}`,{...t,headers:Kz([{Accept:`*/*`},t?.headers])})}get(e,t){return this._client.get(Q`/v1/organizations/${e}`,t)}};eB.ExternalFiatAccounts=Qz,eB.KYB=$z;var tB=class extends kz{create(e,t){let{"privy-idempotency-key":n,...r}=e;return this._client.post(`/v1/policies`,{body:r,...t,headers:Kz([{...n==null?void 0:{"privy-idempotency-key":n}},t?.headers])})}_createRule(e,t,n){let{"privy-authorization-signature":r,"privy-request-expiry":i,...a}=t;return this._client.post(Q`/v1/policies/${e}/rules`,{body:a,...n,headers:Kz([{...r==null?void 0:{"privy-authorization-signature":r},...i==null?void 0:{"privy-request-expiry":i}},n?.headers])})}_delete(e,t={},n){let{"privy-authorization-signature":r,"privy-request-expiry":i}=t??{};return this._client.delete(Q`/v1/policies/${e}`,{...n,headers:Kz([{...r==null?void 0:{"privy-authorization-signature":r},...i==null?void 0:{"privy-request-expiry":i}},n?.headers])})}_deleteRule(e,t,n){let{policy_id:r,"privy-authorization-signature":i,"privy-request-expiry":a}=t;return this._client.delete(Q`/v1/policies/${r}/rules/${e}`,{...n,headers:Kz([{...i==null?void 0:{"privy-authorization-signature":i},...a==null?void 0:{"privy-request-expiry":a}},n?.headers])})}_update(e,t,n){let{"privy-authorization-signature":r,"privy-request-expiry":i,...a}=t;return this._client.patch(Q`/v1/policies/${e}`,{body:a,...n,headers:Kz([{...r==null?void 0:{"privy-authorization-signature":r},...i==null?void 0:{"privy-request-expiry":i}},n?.headers])})}_updateRule(e,t,n){let{policy_id:r,"privy-authorization-signature":i,"privy-request-expiry":a,...o}=t;return this._client.patch(Q`/v1/policies/${r}/rules/${e}`,{body:o,...n,headers:Kz([{...i==null?void 0:{"privy-authorization-signature":i},...a==null?void 0:{"privy-request-expiry":a}},n?.headers])})}get(e,t){if(e===``)throw Error(`policyID must not be an empty string`);return this._client.get(Q`/v1/policies/${e}`,t)}getRule(e,t,n){if(e===``)throw Error(`ruleID must not be an empty string`);let{policy_id:r}=t;if(r===``)throw Error(`policy_id must not be an empty string`);return this._client.get(Q`/v1/policies/${r}/rules/${e}`,n)}},nB=class extends kz{},rB=class extends kz{},iB=class extends kz{get(e,t){if(e===``)throw Error(`transactionID must not be an empty string`);return this._client.get(Q`/v1/transactions/${e}`,t)}},aB=class extends kz{create(e,t,n){return this._client.post(Q`/v1/users/${e}/external_fiat_accounts`,{body:t,...n})}list(e,t,n){return this._client.get(Q`/v1/users/${e}/external_fiat_accounts`,{query:t,...n})}delete(e,t,n){let{user_id:r}=t;return this._client.delete(Q`/v1/users/${r}/external_fiat_accounts/${e}`,n)}get(e,t,n){let{user_id:r}=t;return this._client.get(Q`/v1/users/${r}/external_fiat_accounts/${e}`,n)}},oB=class extends kz{list(e,t){return this._client.get(Q`/v1/users/${e}/kyc`,t)}initiateLinks(e,t,n){return this._client.post(Q`/v1/users/${e}/kyc/links`,{body:t,...n})}initiateTos(e,t,n){return this._client.post(Q`/v1/users/${e}/kyc/tos`,{body:t,...n})}submit(e,t,n){return this._client.post(Q`/v1/users/${e}/kyc/submit`,{body:t,...n})}},sB=class extends kz{constructor(){super(...arguments),this.externalFiatAccounts=new aB(this._client),this.kyc=new oB(this._client)}create(e,t){return this._client.post(`/v1/users`,{body:e,...t})}list(e={},t){return this._client.getAPIList(`/v1/users`,vz,{query:e,...t})}delete(e,t){return this._client.delete(Q`/v1/users/${e}`,{...t,headers:Kz([{Accept:`*/*`},t?.headers])})}_get(e,t){if(e===``)throw Error(`userID must not be an empty string`);return this._client.get(Q`/v1/users/${e}`,t)}getByCustomAuthID(e,t){return this._client.post(`/v1/users/custom_auth/id`,{body:e,...t})}getByDiscordUsername(e,t){return this._client.post(`/v1/users/discord/username`,{body:e,...t})}getByEmailAddress(e,t){return this._client.post(`/v1/users/email/address`,{body:e,...t})}getByFarcasterID(e,t){return this._client.post(`/v1/users/farcaster/fid`,{body:e,...t})}getByGitHubUsername(e,t){return this._client.post(`/v1/users/github/username`,{body:e,...t})}getByPhoneNumber(e,t){return this._client.post(`/v1/users/phone/number`,{body:e,...t})}getBySmartWalletAddress(e,t){return this._client.post(`/v1/users/smart_wallet/address`,{body:e,...t})}getByTelegramUserID(e,t){return this._client.post(`/v1/users/telegram/telegram_user_id`,{body:e,...t})}getByTelegramUsername(e,t){return this._client.post(`/v1/users/telegram/username`,{body:e,...t})}getByTwitterSubject(e,t){return this._client.post(`/v1/users/twitter/subject`,{body:e,...t})}getByTwitterUsername(e,t){return this._client.post(`/v1/users/twitter/username`,{body:e,...t})}getByWalletAddress(e,t){return this._client.post(`/v1/users/wallet/address`,{body:e,...t})}pregenerateWallets(e,t,n){return this._client.post(Q`/v1/users/${e}/wallets`,{body:t,...n})}search(e,t){return this._client.post(`/v1/users/search`,{body:e,...t})}setCustomMetadata(e,t,n){return this._client.post(Q`/v1/users/${e}/custom_metadata`,{body:t,...n})}unlinkLinkedAccount(e,t,n){return this._client.post(Q`/v1/users/${e}/accounts/unlink`,{body:t,...n})}};sB.ExternalFiatAccounts=aB,sB.KYC=oB;var cB=class extends kz{create(e,t){return this._client.post(`/v1/wallet_automations`,{body:e,...t})}update(e,t,n){return this._client.patch(Q`/v1/wallet_automations/${e}`,{body:t,...n})}list(e={},t){return this._client.getAPIList(`/v1/wallet_automations`,vz,{query:e,...t})}delete(e,t){return this._client.delete(Q`/v1/wallet_automations/${e}`,t)}get(e,t){return this._client.get(Q`/v1/wallet_automations/${e}`,t)}listExecutions(e={},t){return this._client.getAPIList(`/v1/wallet_automations/executions`,vz,{query:e,...t})}reindex(e,t){return this._client.post(`/v1/wallet_automations/reindex`,{body:e,...t})}},lB=class extends kz{get(e,t,n){let{wallet_id:r,"privy-authorization-signature":i,...a}=t;return this._client.get(Q`/v1/wallets/${r}/actions/${e}`,{query:a,...n,headers:Kz([{...i==null?void 0:{"privy-authorization-signature":i}},n?.headers])})}},uB=class extends kz{get(e,t={},n){if(e===``)throw Error(`walletID must not be an empty string`);return this._client.get(Q`/v1/wallets/${e}/balance`,{query:t,...n})}},dB=class extends kz{execute(e,t,n){let{"privy-authorization-signature":r,"privy-idempotency-key":i,"privy-request-expiry":a,...o}=t;return this._client.post(Q`/v1/wallets/${e}/swap`,{body:o,...n,headers:Kz([{...r==null?void 0:{"privy-authorization-signature":r},...i==null?void 0:{"privy-idempotency-key":i},...a==null?void 0:{"privy-request-expiry":a}},n?.headers])})}quote(e,t,n){let{"privy-authorization-signature":r,"privy-request-expiry":i,...a}=t;return this._client.post(Q`/v1/wallets/${e}/swap/quote`,{body:a,...n,headers:Kz([{...r==null?void 0:{"privy-authorization-signature":r},...i==null?void 0:{"privy-request-expiry":i}},n?.headers])})}},fB=class extends kz{get(e,t,n){if(e===``)throw Error(`walletID must not be an empty string`);return this._client.get(Q`/v1/wallets/${e}/transactions`,{query:t,...n})}},pB=class extends kz{create(e,t,n){return this._client.post(Q`/v1/wallets/${e}/deposit_accounts/fiat`,{body:t,...n})}list(e,t,n){return this._client.get(Q`/v1/wallets/${e}/deposit_accounts/fiat`,{query:t,...n})}get(e,t,n){let{wallet_id:r}=t;return this._client.get(Q`/v1/wallets/${r}/deposit_accounts/fiat/${e}`,n)}},mB=class extends kz{get(e,t,n){let{wallet_id:r}=t;return this._client.get(Q`/v1/wallets/${r}/deposit_accounts/crypto/orders/${e}`,n)}},hB=class extends kz{constructor(){super(...arguments),this.orders=new mB(this._client)}list(e,t={},n){return this._client.getAPIList(Q`/v1/wallets/${e}/deposit_accounts/crypto`,vz,{query:t,...n})}_create(e,t,n){let{"privy-authorization-signature":r,"privy-idempotency-key":i,"privy-request-expiry":a,...o}=t;return this._client.post(Q`/v1/wallets/${e}/deposit_accounts/crypto`,{body:o,...n,headers:Kz([{...r==null?void 0:{"privy-authorization-signature":r},...i==null?void 0:{"privy-idempotency-key":i},...a==null?void 0:{"privy-request-expiry":a}},n?.headers])})}getConfig(e){return this._client.get(`/v1/deposit_accounts/crypto/config`,e)}getNextOrder(e,t,n){return this._client.get(Q`/v1/wallets/${e}/deposit_accounts/crypto/next_order`,{query:t,...n})}quote(e,t){return this._client.post(`/v1/deposit_accounts/crypto/quote`,{body:e,...t})}};hB.Orders=mB;var gB=class extends kz{constructor(){super(...arguments),this.crypto=new hB(this._client),this.fiat=new pB(this._client)}};gB.Crypto=hB,gB.Fiat=pB;var _B=class extends kz{_claim(e,t,n){let{"privy-authorization-signature":r,"privy-idempotency-key":i,"privy-request-expiry":a,...o}=t;return this._client.post(Q`/v1/wallets/${e}/earn/ethereum/incentive/claim`,{body:o,...n,headers:Kz([{...r==null?void 0:{"privy-authorization-signature":r},...i==null?void 0:{"privy-idempotency-key":i},...a==null?void 0:{"privy-request-expiry":a}},n?.headers])})}},vB=class extends kz{constructor(){super(...arguments),this._incentive=new _B(this._client)}_deposit(e,t,n){let{"privy-authorization-signature":r,"privy-idempotency-key":i,"privy-request-expiry":a,...o}=t;return this._client.post(Q`/v1/wallets/${e}/earn/ethereum/deposit`,{body:o,...n,headers:Kz([{...r==null?void 0:{"privy-authorization-signature":r},...i==null?void 0:{"privy-idempotency-key":i},...a==null?void 0:{"privy-request-expiry":a}},n?.headers])})}_withdraw(e,t,n){let{"privy-authorization-signature":r,"privy-idempotency-key":i,"privy-request-expiry":a,...o}=t;return this._client.post(Q`/v1/wallets/${e}/earn/ethereum/withdraw`,{body:o,...n,headers:Kz([{...r==null?void 0:{"privy-authorization-signature":r},...i==null?void 0:{"privy-idempotency-key":i},...a==null?void 0:{"privy-request-expiry":a}},n?.headers])})}vaultDetails(e,t){return this._client.get(Q`/v1/earn/ethereum/vaults/${e}`,t)}vaultPosition(e,t,n){return this._client.get(Q`/v1/wallets/${e}/earn/ethereum/vaults`,{query:t,...n})}};vB.Incentive=_B;var yB=class extends kz{constructor(){super(...arguments),this._ethereum=new vB(this._client)}};yB.Ethereum=vB;var bB=class extends kz{_create(e,t,n){let{"privy-authorization-signature":r,"privy-idempotency-key":i,"privy-request-expiry":a,...o}=t;return this._client.post(Q`/v1/wallets/${e}/payout/fiat`,{body:o,...n,headers:Kz([{...r==null?void 0:{"privy-authorization-signature":r},...i==null?void 0:{"privy-idempotency-key":i},...a==null?void 0:{"privy-request-expiry":a}},n?.headers])})}},xB=class extends kz{constructor(){super(...arguments),this._fiat=new bB(this._client)}};xB.Fiat=bB;var SB=class extends kz{constructor(){super(...arguments),this.actions=new lB(this._client),this.balance=new uB(this._client),this.depositAccounts=new gB(this._client),this._earn=new yB(this._client),this._payout=new xB(this._client),this.swap=new dB(this._client),this.transactions=new fB(this._client)}create(e,t){let{"privy-idempotency-key":n,...r}=e;return this._client.post(`/v1/wallets`,{body:r,...t,headers:Kz([{...n==null?void 0:{"privy-idempotency-key":n}},t?.headers])})}list(e={},t){return this._client.getAPIList(`/v1/wallets`,vz,{query:e,...t})}_attachAutomations(e,t,n){let{"privy-authorization-signature":r,"privy-request-expiry":i,...a}=t;return this._client.post(Q`/v1/wallets/${e}/automations/attach`,{body:a,...n,headers:Kz([{...r==null?void 0:{"privy-authorization-signature":r},...i==null?void 0:{"privy-request-expiry":i}},n?.headers])})}_detachAutomations(e,t,n){let{"privy-authorization-signature":r,"privy-request-expiry":i,...a}=t;return this._client.post(Q`/v1/wallets/${e}/automations/detach`,{body:a,...n,headers:Kz([{...r==null?void 0:{"privy-authorization-signature":r},...i==null?void 0:{"privy-request-expiry":i}},n?.headers])})}_export(e,t,n){let{"privy-authorization-signature":r,"privy-request-expiry":i,...a}=t;return this._client.post(Q`/v1/wallets/${e}/export`,{body:a,...n,headers:Kz([{...r==null?void 0:{"privy-authorization-signature":r},...i==null?void 0:{"privy-request-expiry":i}},n?.headers])})}_initImport(e,t){return this._client.post(`/v1/wallets/import/init`,{body:e,...t})}_rawSign(e,t,n){let{"privy-authorization-signature":r,"privy-idempotency-key":i,"privy-request-expiry":a,...o}=t;return this._client.post(Q`/v1/wallets/${e}/raw_sign`,{body:o,...n,headers:Kz([{...r==null?void 0:{"privy-authorization-signature":r},...i==null?void 0:{"privy-idempotency-key":i},...a==null?void 0:{"privy-request-expiry":a}},n?.headers])})}_rpc(e,t,n){let{"privy-authorization-signature":r,"privy-idempotency-key":i,"privy-request-expiry":a,...o}=t;return this._client.post(Q`/v1/wallets/${e}/rpc`,{body:o,...n,headers:Kz([{...r==null?void 0:{"privy-authorization-signature":r},...i==null?void 0:{"privy-idempotency-key":i},...a==null?void 0:{"privy-request-expiry":a}},n?.headers])})}_submitImport(e,t){return this._client.post(`/v1/wallets/import/submit`,{body:e,...t})}_transfer(e,t,n){let{"privy-authorization-signature":r,"privy-idempotency-key":i,"privy-request-expiry":a,...o}=t;return this._client.post(Q`/v1/wallets/${e}/transfer`,{body:o,...n,headers:Kz([{...r==null?void 0:{"privy-authorization-signature":r},...i==null?void 0:{"privy-idempotency-key":i},...a==null?void 0:{"privy-request-expiry":a}},n?.headers])})}_update(e,t,n){let{"privy-authorization-signature":r,"privy-request-expiry":i,...a}=t;return this._client.patch(Q`/v1/wallets/${e}`,{body:a,...n,headers:Kz([{...r==null?void 0:{"privy-authorization-signature":r},...i==null?void 0:{"privy-request-expiry":i}},n?.headers])})}archive(e,t){return this._client.post(Q`/v1/wallets/${e}/archive`,t)}assignEntity(e,t,n){return this._client.post(Q`/v1/wallets/${e}/entity`,{body:t,...n})}authenticateWithJwt(e,t){return this._client.post(`/v1/wallets/authenticate`,{body:e,...t})}createBatch(e,t){return this._client.post(`/v1/wallets/batch`,{body:e,...t})}createWalletsWithRecovery(e,t){return this._client.post(`/v1/wallets_with_recovery`,{body:e,...t})}get(e,t={},n){if(e===``)throw Error(`walletID must not be an empty string`);return this._client.get(Q`/v1/wallets/${e}`,{query:t,...n})}getWalletByAddress(e,t){return this._client.post(`/v1/wallets/address`,{body:e,...t})}};SB.Actions=lB,SB.Balance=uB,SB.DepositAccounts=gB,SB.Earn=yB,SB.Payout=xB,SB.Swap=dB,SB.Transactions=fB;var CB=class extends kz{unsafeUnwrap(e){return JSON.parse(e)}},wB=class extends kz{},TB;function EB(e){let t;return(TB??=(t=new globalThis.TextEncoder,t.encode.bind(t)))(e)}var DB=e=>{if(!e)return``;if(globalThis.Buffer!==void 0)return globalThis.Buffer.from(e).toString(`base64`);if(typeof e==`string`&&(e=EB(e)),typeof btoa<`u`)return btoa(String.fromCharCode.apply(null,e));throw new nR("Cannot generate base64 string; Expected `Buffer` or `btoa` to be defined")},OB=e=>{if(globalThis.process!==void 0)return globalThis.process.env?.[e]?.trim()||void 0;if(globalThis.Deno!==void 0)return globalThis.Deno.env?.get?.(e)?.trim()||void 0},kB,AB,jB,MB,NB={production:`https://api.privy.io`,staging:`https://api.staging.privy.io`},PB=class{constructor({baseURL:e=OB(`PRIVY_API_BASE_URL`),appID:t=OB(`PRIVY_APP_ID`),appSecret:n=OB(`PRIVY_APP_SECRET`),...r}={}){if(kB.add(this),jB.set(this,void 0),this.apps=new Lz(this),this.cards=new Rz(this),this.intents=new qz(this),this.keyQuorums=new Jz(this),this.organizations=new eB(this),this.policies=new tB(this),this.transactions=new iB(this),this.users=new sB(this),this.walletAutomations=new cB(this),this.wallets=new SB(this),this.webhooks=new CB(this),this.accounts=new Az(this),this.aggregations=new Mz(this),this.embeddedWallets=new Vz(this),this.analytics=new Nz(this),this.clientAuth=new zz(this),this.shared=new nB(this),this.fiat=new Hz(this),this.onramps=new Zz(this),this.funding=new Uz(this),this.crossApp=new Bz(this),this.oAuth=new Xz(this),this.yield=new wB(this),this.krakenEmbed=new Yz(this),this.actions=new jz(this),this.swaps=new rB(this),t===void 0)throw new nR(`The PRIVY_APP_ID environment variable is missing or empty; either provide it, or instantiate the PrivyAPI client with an appID option, like new PrivyAPI({ appID: 'My App ID' }).`);if(n===void 0)throw new nR(`The PRIVY_APP_SECRET environment variable is missing or empty; either provide it, or instantiate the PrivyAPI client with an appSecret option, like new PrivyAPI({ appSecret: 'My App Secret' }).`);let i={appID:t,appSecret:n,...r,baseURL:e,environment:r.environment??`production`};if(ER())throw new nR(`It looks like you're running in a browser-like environment, which is disabled to protect your secret API credentials from attackers. If you have a strong business need for client-side use of this API, please open a GitHub issue with your use-case and security mitigations.`);if(e&&r.environment)throw new nR("Ambiguous URL; The `baseURL` option (or PRIVY_API_BASE_URL env var) and the `environment` option are given. If you want to use the environment you must pass baseURL: null");this.baseURL=i.baseURL||NB[i.environment||`production`],this.timeout=i.timeout??AB.DEFAULT_TIMEOUT,this.logger=i.logger??console;let a=`warn`;this.logLevel=a,this.logLevel=az(i.logLevel,`ClientOptions.logLevel`,this)??az(OB(`PRIVY_API_LOG`),`process.env['PRIVY_API_LOG']`,this)??a,this.fetchOptions=i.fetchOptions,this.maxRetries=i.maxRetries??2,this.fetch=i.fetch??PR(),ZL(this,jB,RR,`f`);let o=OB(`PRIVY_API_CUSTOM_HEADERS`);if(o){let e={};for(let t of o.split(`
419
+ `)){let n=t.indexOf(`:`);n>=0&&(e[t.substring(0,n).trim()]=t.substring(n+1).trim())}i.defaultHeaders={...e,...i.defaultHeaders}}this._options=i,this.appID=t,this.appSecret=n}withOptions(e){return new this.constructor({...this._options,environment:e.environment?e.environment:void 0,baseURL:e.environment?void 0:this.baseURL,maxRetries:this.maxRetries,timeout:this.timeout,logger:this.logger,logLevel:this.logLevel,fetch:this.fetch,fetchOptions:this.fetchOptions,appID:this.appID,appSecret:this.appSecret,...e})}defaultQuery(){return this._options.defaultQuery}validateHeaders({values:e,nulls:t}){}async authHeaders(e){return!this.appID||!this.appSecret?void 0:Kz([{Authorization:`Basic ${DB(`${this.appID}:${this.appSecret}`)}`}])}stringifyQuery(e){return rz(e)}getUserAgent(){return`${this.constructor.name}/JS ${TR}`}defaultIdempotencyKey(){return`stainless-node-retry-${$L()}`}makeStatusError(e,t,n,r){return rR.generate(e,t,n,r)}buildURL(e,t,n){let r=!QL(this,kB,`m`,MB).call(this)&&n||this.baseURL,i=gR(e)?new URL(e):new URL(r+(r.endsWith(`/`)&&e.startsWith(`/`)?e.slice(1):e)),a=this.defaultQuery(),o=Object.fromEntries(i.searchParams);return(!bR(a)||!bR(o))&&(t={...o,...a,...t}),typeof t==`object`&&t&&!Array.isArray(t)&&(i.search=this.stringifyQuery(t)),i.toString()}async prepareOptions(e){}async prepareRequest(e,{url:t,options:n}){}get(e,t){return this.methodRequest(`get`,e,t)}post(e,t){return this.methodRequest(`post`,e,t)}patch(e,t){return this.methodRequest(`patch`,e,t)}put(e,t){return this.methodRequest(`put`,e,t)}delete(e,t){return this.methodRequest(`delete`,e,t)}methodRequest(e,t,n){return this.request(Promise.resolve(n).then(n=>({method:e,path:t,...n})))}request(e,t=null){return new mz(this,this.makeRequest(e,t,void 0))}async makeRequest(e,t,n){let r=await e,i=r.maxRetries??this.maxRetries;t??=i,await this.prepareOptions(r);let{req:a,url:o,timeout:s}=await this.buildRequest(r,{retryCount:i-t});await this.prepareRequest(a,{url:o,options:r});let c=`log_`+(Math.random()*(1<<24)|0).toString(16).padStart(6,`0`),l=n===void 0?``:`, retryOf: ${n}`,u=Date.now();if(uz(this).debug(`[${c}] sending request`,dz({retryOfRequestLogID:n,method:r.method,url:o,options:r,headers:a.headers})),r.signal?.aborted)throw new iR;let d=new AbortController,f=await this.fetchWithTimeout(o,a,s,d).catch(tR),p=Date.now();if(f instanceof globalThis.Error){let e=`retrying, ${t} attempts remaining`;if(r.signal?.aborted)throw new iR;let i=eR(f)||/timed? ?out/i.test(String(f)+(`cause`in f?String(f.cause):``));if(t)return uz(this).info(`[${c}] connection ${i?`timed out`:`failed`} - ${e}`),uz(this).debug(`[${c}] connection ${i?`timed out`:`failed`} (${e})`,dz({retryOfRequestLogID:n,url:o,durationMs:p-u,message:f.message})),this.retryRequest(r,t,n??c);throw uz(this).info(`[${c}] connection ${i?`timed out`:`failed`} - error; no more retries left`),uz(this).debug(`[${c}] connection ${i?`timed out`:`failed`} (error; no more retries left)`,dz({retryOfRequestLogID:n,url:o,durationMs:p-u,message:f.message})),i?new oR:new aR({cause:f})}let m=`[${c}${l}] ${a.method} ${o} ${f.ok?`succeeded`:`failed`} with status ${f.status} in ${p-u}ms`;if(!f.ok){let e=await this.shouldRetry(f);if(t&&e){let e=`retrying, ${t} attempts remaining`;return await LR(f.body),uz(this).info(`${m} - ${e}`),uz(this).debug(`[${c}] response error (${e})`,dz({retryOfRequestLogID:n,url:f.url,status:f.status,headers:f.headers,durationMs:p-u})),this.retryRequest(r,t,n??c,f.headers)}let i=e?`error; no more retries left`:`error; not retryable`;uz(this).info(`${m} - ${i}`);let a=await f.text().catch(e=>tR(e).message),o=CR(a),s=o?void 0:a;throw uz(this).debug(`[${c}] response error (${i})`,dz({retryOfRequestLogID:n,url:f.url,status:f.status,headers:f.headers,message:s,durationMs:Date.now()-u})),this.makeStatusError(f.status,o,s,f.headers)}return uz(this).info(m),uz(this).debug(`[${c}] response start`,dz({retryOfRequestLogID:n,url:f.url,status:f.status,headers:f.headers,durationMs:p-u})),{response:f,options:r,controller:d,requestLogID:c,retryOfRequestLogID:n,startTime:u}}getAPIList(e,t,n){return this.requestAPIList(t,n&&`then`in n?n.then(t=>({method:`get`,path:e,...t})):{method:`get`,path:e,...n})}requestAPIList(e,t){let n=this.makeRequest(t,null,void 0);return new _z(this,n,e)}async fetchWithTimeout(e,t,n,r){let{signal:i,method:a,...o}=t||{},s=this._makeAbort(r);i&&i.addEventListener(`abort`,s,{once:!0});let c=setTimeout(s,n),l=globalThis.ReadableStream&&o.body instanceof globalThis.ReadableStream||typeof o.body==`object`&&o.body!==null&&Symbol.asyncIterator in o.body,u={signal:r.signal,...l?{duplex:`half`}:{},method:`GET`,...o};a&&(u.method=a.toUpperCase());try{return await this.fetch.call(void 0,e,u)}finally{clearTimeout(c)}}async shouldRetry(e){let t=e.headers.get(`x-should-retry`);return t===`true`?!0:t===`false`?!1:e.status===408||e.status===409||e.status===429||e.status>=500}async retryRequest(e,t,n,r){let i,a=r?.get(`retry-after-ms`);if(a){let e=parseFloat(a);Number.isNaN(e)||(i=e)}let o=r?.get(`retry-after`);if(o&&!i){let e=parseFloat(o);i=Number.isNaN(e)?Date.parse(o)-Date.now():e*1e3}let s=r?.get(`x-ratelimit-reset`);if(s&&!i){let e=parseFloat(s);Number.isNaN(e)||(i=e*1e3-Date.now())}if(i===void 0){let n=e.maxRetries??this.maxRetries;i=this.calculateDefaultRetryTimeoutMillis(t,n)}return await wR(i),this.makeRequest(e,t-1,n)}calculateDefaultRetryTimeoutMillis(e,t){let n=t-e;return Math.min(.5*2**n,8)*(1-Math.random()*.25)*1e3}async buildRequest(e,{retryCount:t=0}={}){let n={...e},{method:r,path:i,query:a,defaultBaseURL:o}=n,s=this.buildURL(i,a,o);`timeout`in n&&SR(`timeout`,n.timeout),n.timeout=n.timeout??this.timeout;let{bodyHeaders:c,body:l}=this.buildBody({options:n});return{req:{method:r,headers:await this.buildHeaders({options:e,method:r,bodyHeaders:c,retryCount:t}),...n.signal&&{signal:n.signal},...globalThis.ReadableStream&&l instanceof globalThis.ReadableStream&&{duplex:`half`},...l&&{body:l},...this.fetchOptions??{},...n.fetchOptions??{}},url:s,timeout:n.timeout}}async buildHeaders({options:e,method:t,bodyHeaders:n,retryCount:r}){let i={};this.idempotencyHeader&&t!==`get`&&(e.idempotencyKey||=this.defaultIdempotencyKey(),i[this.idempotencyHeader]=e.idempotencyKey);let a=Kz([i,{Accept:`application/json`,"User-Agent":this.getUserAgent(),"X-Stainless-Retry-Count":String(r),...e.timeout?{"X-Stainless-Timeout":String(Math.trunc(e.timeout/1e3))}:{},...NR(),"privy-app-id":this.appID},await this.authHeaders(e),this._options.defaultHeaders,n,e.headers]);return this.validateHeaders(a),a.values}_makeAbort(e){return()=>e.abort()}buildBody({options:e}){let{body:t,headers:n}=e;if(!t)return t==null&&`body`in e?QL(this,jB,`f`).call(this,{body:t,headers:Kz([n])}):{bodyHeaders:void 0,body:void 0};let r=Kz([n]);return ArrayBuffer.isView(t)||t instanceof ArrayBuffer||t instanceof DataView||typeof t==`string`&&r.values.has(`content-type`)||globalThis.Blob&&t instanceof globalThis.Blob||t instanceof FormData||t instanceof URLSearchParams||globalThis.ReadableStream&&t instanceof globalThis.ReadableStream?{bodyHeaders:void 0,body:t}:typeof t==`object`&&(Symbol.asyncIterator in t||Symbol.iterator in t&&`next`in t&&typeof t.next==`function`)?{bodyHeaders:void 0,body:IR(t)}:typeof t==`object`&&r.values.get(`content-type`)===`application/x-www-form-urlencoded`?{bodyHeaders:{"content-type":`application/x-www-form-urlencoded`},body:this.stringifyQuery(t)}:QL(this,jB,`f`).call(this,{body:t,headers:r})}};AB=PB,jB=new WeakMap,kB=new WeakSet,MB=function(){return this.baseURL!==NB[this._options.environment||`production`]},PB.PrivyAPI=AB,PB.DEFAULT_TIMEOUT=6e4,PB.PrivyAPIError=nR,PB.APIError=rR,PB.APIConnectionError=aR,PB.APIConnectionTimeoutError=oR,PB.APIUserAbortError=iR,PB.NotFoundError=uR,PB.ConflictError=dR,PB.RateLimitError=pR,PB.BadRequestError=sR,PB.AuthenticationError=cR,PB.InternalServerError=mR,PB.PermissionDeniedError=lR,PB.UnprocessableEntityError=fR,PB.toFile=Ez,PB.Apps=Lz,PB.Cards=Rz,PB.Intents=qz,PB.KeyQuorums=Jz,PB.Organizations=eB,PB.Policies=tB,PB.Transactions=iB,PB.Users=sB,PB.WalletAutomations=cB,PB.Wallets=SB,PB.Webhooks=CB,PB.Accounts=Az,PB.Aggregations=Mz,PB.EmbeddedWallets=Vz,PB.Analytics=Nz,PB.ClientAuth=zz,PB.Shared=nB,PB.Fiat=Hz,PB.Onramps=Zz,PB.Funding=Uz,PB.CrossApp=Bz,PB.OAuth=Xz,PB.Yield=wB,PB.KrakenEmbed=Yz,PB.Actions=jz,PB.Swaps=rB;var FB=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.ApplicationInSerializer=void 0,e.ApplicationInSerializer={_fromJsonObject(e){return{metadata:e.metadata,name:e.name,rateLimit:e.rateLimit,throttleRate:e.throttleRate,uid:e.uid}},_toJsonObject(e){return{metadata:e.metadata,name:e.name,rateLimit:e.rateLimit,throttleRate:e.throttleRate,uid:e.uid}}}})),IB=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.ApplicationOutSerializer=void 0,e.ApplicationOutSerializer={_fromJsonObject(e){return{createdAt:new Date(e.createdAt),id:e.id,metadata:e.metadata,name:e.name,rateLimit:e.rateLimit,throttleRate:e.throttleRate,uid:e.uid,updatedAt:new Date(e.updatedAt)}},_toJsonObject(e){return{createdAt:e.createdAt,id:e.id,metadata:e.metadata,name:e.name,rateLimit:e.rateLimit,throttleRate:e.throttleRate,uid:e.uid,updatedAt:e.updatedAt}}}})),LB=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.ApplicationPatchSerializer=void 0,e.ApplicationPatchSerializer={_fromJsonObject(e){return{metadata:e.metadata,name:e.name,rateLimit:e.rateLimit,throttleRate:e.throttleRate,uid:e.uid}},_toJsonObject(e){return{metadata:e.metadata,name:e.name,rateLimit:e.rateLimit,throttleRate:e.throttleRate,uid:e.uid}}}})),RB=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.ListResponseApplicationOutSerializer=void 0;var t=IB();e.ListResponseApplicationOutSerializer={_fromJsonObject(e){return{data:e.data.map(e=>t.ApplicationOutSerializer._fromJsonObject(e)),done:e.done,iterator:e.iterator,prevIterator:e.prevIterator}},_toJsonObject(e){return{data:e.data.map(e=>t.ApplicationOutSerializer._toJsonObject(e)),done:e.done,iterator:e.iterator,prevIterator:e.prevIterator}}}})),zB=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.ApiException=void 0,e.ApiException=class extends Error{constructor(e,t,n){super(`HTTP-Code: ${e}\nHeaders: ${JSON.stringify(n)}`),this.code=e,this.body=t,this.headers={},n.forEach((e,t)=>{this.headers[t]=e})}}})),BB=i(((e,t,n)=>{var r=n&&n.__awaiter||function(e,t,n,r){function i(e){return e instanceof n?e:new n(function(t){t(e)})}return new(n||=Promise)(function(n,a){function o(e){try{c(r.next(e))}catch(e){a(e)}}function s(e){try{c(r.throw(e))}catch(e){a(e)}}function c(e){e.done?n(e.value):i(e.value).then(o,s)}c((r=r.apply(e,t||[])).next())})};Object.defineProperty(e,"__esModule",{value:!0}),e.SvixRequest=e.HttpMethod=e.LIB_VERSION=void 0;var i=zB();e.LIB_VERSION=`1.99.1`;function a(){var t=[`svix-libs/${e.LIB_VERSION}/javascript`];return process===void 0?(navigator==null?void 0:navigator.userAgent)!==void 0&&t.push(navigator.userAgent):(process.version!==void 0&&t.push(`node/${process.version}`),process.platform!==void 0&&process.arch!==void 0&&t.push(`${process.platform}/${process.arch}`)),t.join(` `)}(function(e){e.GET=`GET`,e.HEAD=`HEAD`,e.POST=`POST`,e.PUT=`PUT`,e.DELETE=`DELETE`,e.CONNECT=`CONNECT`,e.OPTIONS=`OPTIONS`,e.TRACE=`TRACE`,e.PATCH=`PATCH`})(e.HttpMethod||={}),e.SvixRequest=class{constructor(e,t){this.method=e,this.path=t,this.queryParams={},this.headerParams={}}setPathParam(e,t){let n=this.path.replace(`{${e}}`,encodeURIComponent(t));if(this.path===n)throw Error(`path parameter ${e} not found`);this.path=n}setQueryParams(e){for(let[t,n]of Object.entries(e))this.setQueryParam(t,n)}setQueryParam(e,t){if(t!=null){if(typeof t==`string`)this.queryParams[e]=t;else if(typeof t==`boolean`||typeof t==`number`)this.queryParams[e]=t.toString();else if(t instanceof Date)this.queryParams[e]=t.toISOString();else if(Array.isArray(t))t.length>0&&(this.queryParams[e]=t.join(`,`));else throw Error(`query parameter ${e} has unsupported type`)}}setHeaderParam(e,t){t!==void 0&&(this.headerParams[e]=t)}setBody(e){this.body=JSON.stringify(e)}send(e,t){return r(this,void 0,void 0,function*(){let n=yield this.sendInner(e);if(n.status===204)return null;let r=yield n.text();return t(JSON.parse(r))})}sendNoResponseBody(e){return r(this,void 0,void 0,function*(){yield this.sendInner(e)})}sendInner(e){return r(this,void 0,void 0,function*(){let t=new URL(e.baseUrl+this.path);for(let[e,n]of Object.entries(this.queryParams))t.searchParams.set(e,n);this.headerParams[`idempotency-key`]===void 0&&this.method.toUpperCase()===`POST`&&(this.headerParams[`idempotency-key`]=`auto_${crypto.randomUUID()}`);let n=Math.floor(Math.random()*(2**53-1));this.body!=null&&(this.headerParams[`content-type`]=`application/json`);let r=`credentials`in Request.prototype;return o(yield s(t,{method:this.method.toString(),body:this.body,headers:Object.assign({accept:`application/json, */*;q=0.8`,authorization:`Bearer ${e.token}`,"user-agent":a(),"svix-req-id":n.toString()},this.headerParams),credentials:r?`same-origin`:void 0,signal:e.timeout===void 0?void 0:AbortSignal.timeout(e.timeout)},e.retryScheduleInMs,e.retryScheduleInMs?.[0],e.retryScheduleInMs?.length??e.numRetries,e.fetch))})}};function o(e){return r(this,void 0,void 0,function*(){if(e.status<300)return e;let t=yield e.text();throw e.status===422||e.status>=400&&e.status<=499?new i.ApiException(e.status,JSON.parse(t),e.headers):new i.ApiException(e.status,t,e.headers)})}function s(e,t,n,i=50,a=2,o=fetch,c=1){return r(this,void 0,void 0,function*(){let r=e=>new Promise(t=>setTimeout(t,e));try{let n=yield o(e,t);if(a<=0||n.status<500)return n}catch(e){if(a<=0)throw e}return yield r(i),t.headers[`svix-retry-count`]=c.toString(),i=n?.[c]??i*2,yield s(e,t,n,i,--a,o,++c)})}})),VB=i(((e,t,n)=>{var r=n&&n.__awaiter||function(e,t,n,r){function i(e){return e instanceof n?e:new n(function(t){t(e)})}return new(n||=Promise)(function(n,a){function o(e){try{c(r.next(e))}catch(e){a(e)}}function s(e){try{c(r.throw(e))}catch(e){a(e)}}function c(e){e.done?n(e.value):i(e.value).then(o,s)}c((r=r.apply(e,t||[])).next())})};Object.defineProperty(e,"__esModule",{value:!0}),e.Application=void 0;var i=FB(),a=IB(),o=LB(),s=RB(),c=BB();e.Application=class{constructor(e){this.requestCtx=e}list(e){return r(this,void 0,void 0,function*(){let t=new c.SvixRequest(c.HttpMethod.GET,`/api/v1/app`);return t.setQueryParams({exclude_apps_with_no_endpoints:e?.excludeAppsWithNoEndpoints,exclude_apps_with_disabled_endpoints:e?.excludeAppsWithDisabledEndpoints,exclude_apps_with_svix_play_endpoints:e?.excludeAppsWithSvixPlayEndpoints,limit:e?.limit,iterator:e?.iterator,order:e?.order}),yield t.send(this.requestCtx,s.ListResponseApplicationOutSerializer._fromJsonObject)})}create(e,t){return r(this,void 0,void 0,function*(){let n=new c.SvixRequest(c.HttpMethod.POST,`/api/v1/app`);return n.setHeaderParam(`idempotency-key`,t?.idempotencyKey),n.setBody(i.ApplicationInSerializer._toJsonObject(e)),yield n.send(this.requestCtx,a.ApplicationOutSerializer._fromJsonObject)})}getOrCreate(e,t){let n=new c.SvixRequest(c.HttpMethod.POST,`/api/v1/app`);return n.setQueryParam(`get_if_exists`,!0),n.setHeaderParam(`idempotency-key`,t?.idempotencyKey),n.setBody(i.ApplicationInSerializer._toJsonObject(e)),n.send(this.requestCtx,a.ApplicationOutSerializer._fromJsonObject)}get(e){return r(this,void 0,void 0,function*(){let t=new c.SvixRequest(c.HttpMethod.GET,`/api/v1/app/{app_id}`);return t.setPathParam(`app_id`,e),yield t.send(this.requestCtx,a.ApplicationOutSerializer._fromJsonObject)})}update(e,t){return r(this,void 0,void 0,function*(){let n=new c.SvixRequest(c.HttpMethod.PUT,`/api/v1/app/{app_id}`);return n.setPathParam(`app_id`,e),n.setBody(i.ApplicationInSerializer._toJsonObject(t)),yield n.send(this.requestCtx,a.ApplicationOutSerializer._fromJsonObject)})}delete(e){return r(this,void 0,void 0,function*(){let t=new c.SvixRequest(c.HttpMethod.DELETE,`/api/v1/app/{app_id}`);return t.setPathParam(`app_id`,e),yield t.sendNoResponseBody(this.requestCtx)})}patch(e,t){return r(this,void 0,void 0,function*(){let n=new c.SvixRequest(c.HttpMethod.PATCH,`/api/v1/app/{app_id}`);return n.setPathParam(`app_id`,e),n.setBody(o.ApplicationPatchSerializer._toJsonObject(t)),yield n.send(this.requestCtx,a.ApplicationOutSerializer._fromJsonObject)})}}})),HB=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.ApiTokenOutSerializer=void 0,e.ApiTokenOutSerializer={_fromJsonObject(e){return{createdAt:new Date(e.createdAt),expiresAt:e.expiresAt?new Date(e.expiresAt):null,id:e.id,name:e.name,scopes:e.scopes,token:e.token}},_toJsonObject(e){return{createdAt:e.createdAt,expiresAt:e.expiresAt,id:e.id,name:e.name,scopes:e.scopes,token:e.token}}}})),UB=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.AppPortalCapabilitySerializer=e.AppPortalCapability=void 0,(function(e){e.ViewBase=`ViewBase`,e.ViewEndpointSecret=`ViewEndpointSecret`,e.ManageEndpointSecret=`ManageEndpointSecret`,e.ManageTransformations=`ManageTransformations`,e.CreateAttempts=`CreateAttempts`,e.ManageEndpoint=`ManageEndpoint`})(e.AppPortalCapability||={}),e.AppPortalCapabilitySerializer={_fromJsonObject(e){return e},_toJsonObject(e){return e}}})),WB=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.AppPortalAccessInSerializer=void 0;var t=UB(),n=FB();e.AppPortalAccessInSerializer={_fromJsonObject(e){return{application:e.application==null?void 0:n.ApplicationInSerializer._fromJsonObject(e.application),capabilities:e.capabilities?.map(e=>t.AppPortalCapabilitySerializer._fromJsonObject(e)),expiry:e.expiry,featureFlags:e.featureFlags,readOnly:e.readOnly,sessionId:e.sessionId}},_toJsonObject(e){return{application:e.application==null?void 0:n.ApplicationInSerializer._toJsonObject(e.application),capabilities:e.capabilities?.map(e=>t.AppPortalCapabilitySerializer._toJsonObject(e)),expiry:e.expiry,featureFlags:e.featureFlags,readOnly:e.readOnly,sessionId:e.sessionId}}}})),GB=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.AppPortalAccessOutSerializer=void 0,e.AppPortalAccessOutSerializer={_fromJsonObject(e){return{token:e.token,url:e.url}},_toJsonObject(e){return{token:e.token,url:e.url}}}})),KB=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.ApplicationTokenExpireInSerializer=void 0,e.ApplicationTokenExpireInSerializer={_fromJsonObject(e){return{expiry:e.expiry,sessionIds:e.sessionIds}},_toJsonObject(e){return{expiry:e.expiry,sessionIds:e.sessionIds}}}})),qB=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.RotatePollerTokenInSerializer=void 0,e.RotatePollerTokenInSerializer={_fromJsonObject(e){return{expiry:e.expiry,oldTokenExpiry:e.oldTokenExpiry}},_toJsonObject(e){return{expiry:e.expiry,oldTokenExpiry:e.oldTokenExpiry}}}})),JB=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.StreamPortalAccessInSerializer=void 0,e.StreamPortalAccessInSerializer={_fromJsonObject(e){return{expiry:e.expiry,featureFlags:e.featureFlags,sessionId:e.sessionId}},_toJsonObject(e){return{expiry:e.expiry,featureFlags:e.featureFlags,sessionId:e.sessionId}}}})),YB=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.StreamTokenExpireInSerializer=void 0,e.StreamTokenExpireInSerializer={_fromJsonObject(e){return{expiry:e.expiry,sessionIds:e.sessionIds}},_toJsonObject(e){return{expiry:e.expiry,sessionIds:e.sessionIds}}}})),XB=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.DashboardAccessOutSerializer=void 0,e.DashboardAccessOutSerializer={_fromJsonObject(e){return{token:e.token,url:e.url}},_toJsonObject(e){return{token:e.token,url:e.url}}}})),ZB=i(((e,t,n)=>{var r=n&&n.__awaiter||function(e,t,n,r){function i(e){return e instanceof n?e:new n(function(t){t(e)})}return new(n||=Promise)(function(n,a){function o(e){try{c(r.next(e))}catch(e){a(e)}}function s(e){try{c(r.throw(e))}catch(e){a(e)}}function c(e){e.done?n(e.value):i(e.value).then(o,s)}c((r=r.apply(e,t||[])).next())})};Object.defineProperty(e,"__esModule",{value:!0}),e.Authentication=void 0;var i=HB(),a=WB(),o=GB(),s=KB(),c=qB(),l=JB(),u=YB(),d=XB(),f=BB();e.Authentication=class{constructor(e){this.requestCtx=e}appPortalAccess(e,t={},n){return r(this,void 0,void 0,function*(){let r=new f.SvixRequest(f.HttpMethod.POST,`/api/v1/auth/app-portal-access/{app_id}`);return r.setPathParam(`app_id`,e),r.setHeaderParam(`idempotency-key`,n?.idempotencyKey),r.setBody(a.AppPortalAccessInSerializer._toJsonObject(t)),yield r.send(this.requestCtx,o.AppPortalAccessOutSerializer._fromJsonObject)})}logout(e){return r(this,void 0,void 0,function*(){let t=new f.SvixRequest(f.HttpMethod.POST,`/api/v1/auth/logout`);return t.setHeaderParam(`idempotency-key`,e?.idempotencyKey),yield t.sendNoResponseBody(this.requestCtx)})}expireAll(e,t={},n){return r(this,void 0,void 0,function*(){let r=new f.SvixRequest(f.HttpMethod.POST,`/api/v1/auth/app/{app_id}/expire-all`);return r.setPathParam(`app_id`,e),r.setHeaderParam(`idempotency-key`,n?.idempotencyKey),r.setBody(s.ApplicationTokenExpireInSerializer._toJsonObject(t)),yield r.sendNoResponseBody(this.requestCtx)})}dashboardAccess(e,t){let n=new f.SvixRequest(f.HttpMethod.POST,`/api/v1/auth/dashboard-access/{app_id}`);return n.setPathParam(`app_id`,e),n.setHeaderParam(`idempotency-key`,t?.idempotencyKey),n.send(this.requestCtx,d.DashboardAccessOutSerializer._fromJsonObject)}streamPortalAccess(e,t={},n){return r(this,void 0,void 0,function*(){let r=new f.SvixRequest(f.HttpMethod.POST,`/api/v1/auth/stream-portal-access/{stream_id}`);return r.setPathParam(`stream_id`,e),r.setHeaderParam(`idempotency-key`,n?.idempotencyKey),r.setBody(l.StreamPortalAccessInSerializer._toJsonObject(t)),yield r.send(this.requestCtx,o.AppPortalAccessOutSerializer._fromJsonObject)})}streamLogout(e){return r(this,void 0,void 0,function*(){let t=new f.SvixRequest(f.HttpMethod.POST,`/api/v1/auth/stream-logout`);return t.setHeaderParam(`idempotency-key`,e?.idempotencyKey),yield t.sendNoResponseBody(this.requestCtx)})}streamExpireAll(e,t={},n){return r(this,void 0,void 0,function*(){let r=new f.SvixRequest(f.HttpMethod.POST,`/api/v1/auth/stream/{stream_id}/expire-all`);return r.setPathParam(`stream_id`,e),r.setHeaderParam(`idempotency-key`,n?.idempotencyKey),r.setBody(u.StreamTokenExpireInSerializer._toJsonObject(t)),yield r.sendNoResponseBody(this.requestCtx)})}rotateStreamPollerToken(e,t,n={},a){return r(this,void 0,void 0,function*(){let r=new f.SvixRequest(f.HttpMethod.POST,`/api/v1/auth/stream/{stream_id}/sink/{sink_id}/poller/token/rotate`);return r.setPathParam(`stream_id`,e),r.setPathParam(`sink_id`,t),r.setHeaderParam(`idempotency-key`,a?.idempotencyKey),r.setBody(c.RotatePollerTokenInSerializer._toJsonObject(n)),yield r.send(this.requestCtx,i.ApiTokenOutSerializer._fromJsonObject)})}getStreamPollerToken(e,t){return r(this,void 0,void 0,function*(){let n=new f.SvixRequest(f.HttpMethod.GET,`/api/v1/auth/stream/{stream_id}/sink/{sink_id}/poller/token`);return n.setPathParam(`stream_id`,e),n.setPathParam(`sink_id`,t),yield n.send(this.requestCtx,i.ApiTokenOutSerializer._fromJsonObject)})}}})),QB=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.BackgroundTaskStatusSerializer=e.BackgroundTaskStatus=void 0,(function(e){e.Running=`running`,e.Finished=`finished`,e.Failed=`failed`})(e.BackgroundTaskStatus||={}),e.BackgroundTaskStatusSerializer={_fromJsonObject(e){return e},_toJsonObject(e){return e}}})),$B=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.BackgroundTaskTypeSerializer=e.BackgroundTaskType=void 0,(function(e){e.EndpointReplay=`endpoint.replay`,e.EndpointRecover=`endpoint.recover`,e.ApplicationStats=`application.stats`,e.MessageBroadcast=`message.broadcast`,e.SdkGenerate=`sdk.generate`,e.EventTypeAggregate=`event-type.aggregate`,e.ApplicationPurgeContent=`application.purge_content`,e.EndpointBulkReplay=`endpoint.bulk-replay`})(e.BackgroundTaskType||={}),e.BackgroundTaskTypeSerializer={_fromJsonObject(e){return e},_toJsonObject(e){return e}}})),eV=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.BackgroundTaskOutSerializer=void 0;var t=QB(),n=$B();e.BackgroundTaskOutSerializer={_fromJsonObject(e){return{data:e.data,id:e.id,status:t.BackgroundTaskStatusSerializer._fromJsonObject(e.status),task:n.BackgroundTaskTypeSerializer._fromJsonObject(e.task),updatedAt:new Date(e.updatedAt)}},_toJsonObject(e){return{data:e.data,id:e.id,status:t.BackgroundTaskStatusSerializer._toJsonObject(e.status),task:n.BackgroundTaskTypeSerializer._toJsonObject(e.task),updatedAt:e.updatedAt}}}})),tV=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.ListResponseBackgroundTaskOutSerializer=void 0;var t=eV();e.ListResponseBackgroundTaskOutSerializer={_fromJsonObject(e){return{data:e.data.map(e=>t.BackgroundTaskOutSerializer._fromJsonObject(e)),done:e.done,iterator:e.iterator,prevIterator:e.prevIterator}},_toJsonObject(e){return{data:e.data.map(e=>t.BackgroundTaskOutSerializer._toJsonObject(e)),done:e.done,iterator:e.iterator,prevIterator:e.prevIterator}}}})),nV=i(((e,t,n)=>{var r=n&&n.__awaiter||function(e,t,n,r){function i(e){return e instanceof n?e:new n(function(t){t(e)})}return new(n||=Promise)(function(n,a){function o(e){try{c(r.next(e))}catch(e){a(e)}}function s(e){try{c(r.throw(e))}catch(e){a(e)}}function c(e){e.done?n(e.value):i(e.value).then(o,s)}c((r=r.apply(e,t||[])).next())})};Object.defineProperty(e,"__esModule",{value:!0}),e.BackgroundTask=void 0;var i=eV(),a=tV(),o=BB();e.BackgroundTask=class{constructor(e){this.requestCtx=e}list(e){return r(this,void 0,void 0,function*(){let t=new o.SvixRequest(o.HttpMethod.GET,`/api/v1/background-task`);return t.setQueryParams({status:e?.status,task:e?.task,limit:e?.limit,iterator:e?.iterator,order:e?.order}),yield t.send(this.requestCtx,a.ListResponseBackgroundTaskOutSerializer._fromJsonObject)})}listByEndpoint(e){return this.list(e)}get(e){return r(this,void 0,void 0,function*(){let t=new o.SvixRequest(o.HttpMethod.GET,`/api/v1/background-task/{task_id}`);return t.setPathParam(`task_id`,e),yield t.send(this.requestCtx,i.BackgroundTaskOutSerializer._fromJsonObject)})}}})),rV=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.ConnectorKindSerializer=e.ConnectorKind=void 0,(function(e){e.Custom=`Custom`,e.AgenticCommerceProtocol=`AgenticCommerceProtocol`,e.CloseCrm=`CloseCRM`,e.CustomerIo=`CustomerIO`,e.Discord=`Discord`,e.Hubspot=`Hubspot`,e.Inngest=`Inngest`,e.Loops=`Loops`,e.Otel=`Otel`,e.Resend=`Resend`,e.Salesforce=`Salesforce`,e.Segment=`Segment`,e.Sendgrid=`Sendgrid`,e.Slack=`Slack`,e.Teams=`Teams`,e.TriggerDev=`TriggerDev`,e.Windmill=`Windmill`,e.Zapier=`Zapier`})(e.ConnectorKind||={}),e.ConnectorKindSerializer={_fromJsonObject(e){return e},_toJsonObject(e){return e}}})),iV=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.ConnectorProductSerializer=e.ConnectorProduct=void 0,(function(e){e.Dispatch=`Dispatch`,e.Stream=`Stream`})(e.ConnectorProduct||={}),e.ConnectorProductSerializer={_fromJsonObject(e){return e},_toJsonObject(e){return e}}})),aV=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.ConnectorInSerializer=void 0;var t=rV(),n=iV();e.ConnectorInSerializer={_fromJsonObject(e){return{allowedEventTypes:e.allowedEventTypes,description:e.description,featureFlags:e.featureFlags,instructions:e.instructions,kind:e.kind==null?void 0:t.ConnectorKindSerializer._fromJsonObject(e.kind),logo:e.logo,name:e.name,productType:e.productType==null?void 0:n.ConnectorProductSerializer._fromJsonObject(e.productType),transformation:e.transformation,uid:e.uid}},_toJsonObject(e){return{allowedEventTypes:e.allowedEventTypes,description:e.description,featureFlags:e.featureFlags,instructions:e.instructions,kind:e.kind==null?void 0:t.ConnectorKindSerializer._toJsonObject(e.kind),logo:e.logo,name:e.name,productType:e.productType==null?void 0:n.ConnectorProductSerializer._toJsonObject(e.productType),transformation:e.transformation,uid:e.uid}}}})),oV=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.ConnectorOutSerializer=void 0;var t=rV(),n=iV();e.ConnectorOutSerializer={_fromJsonObject(e){return{allowedEventTypes:e.allowedEventTypes,createdAt:new Date(e.createdAt),description:e.description,featureFlags:e.featureFlags,id:e.id,instructions:e.instructions,kind:t.ConnectorKindSerializer._fromJsonObject(e.kind),logo:e.logo,name:e.name,orgId:e.orgId,productType:n.ConnectorProductSerializer._fromJsonObject(e.productType),transformation:e.transformation,transformationUpdatedAt:new Date(e.transformationUpdatedAt),uid:e.uid,updatedAt:new Date(e.updatedAt)}},_toJsonObject(e){return{allowedEventTypes:e.allowedEventTypes,createdAt:e.createdAt,description:e.description,featureFlags:e.featureFlags,id:e.id,instructions:e.instructions,kind:t.ConnectorKindSerializer._toJsonObject(e.kind),logo:e.logo,name:e.name,orgId:e.orgId,productType:n.ConnectorProductSerializer._toJsonObject(e.productType),transformation:e.transformation,transformationUpdatedAt:e.transformationUpdatedAt,uid:e.uid,updatedAt:e.updatedAt}}}})),sV=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.ConnectorPatchSerializer=void 0;var t=rV();e.ConnectorPatchSerializer={_fromJsonObject(e){return{allowedEventTypes:e.allowedEventTypes,description:e.description,featureFlags:e.featureFlags,instructions:e.instructions,kind:e.kind==null?void 0:t.ConnectorKindSerializer._fromJsonObject(e.kind),logo:e.logo,name:e.name,transformation:e.transformation}},_toJsonObject(e){return{allowedEventTypes:e.allowedEventTypes,description:e.description,featureFlags:e.featureFlags,instructions:e.instructions,kind:e.kind==null?void 0:t.ConnectorKindSerializer._toJsonObject(e.kind),logo:e.logo,name:e.name,transformation:e.transformation}}}})),cV=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.ConnectorUpdateSerializer=void 0;var t=rV();e.ConnectorUpdateSerializer={_fromJsonObject(e){return{allowedEventTypes:e.allowedEventTypes,description:e.description,featureFlags:e.featureFlags,instructions:e.instructions,kind:e.kind==null?void 0:t.ConnectorKindSerializer._fromJsonObject(e.kind),logo:e.logo,name:e.name,transformation:e.transformation}},_toJsonObject(e){return{allowedEventTypes:e.allowedEventTypes,description:e.description,featureFlags:e.featureFlags,instructions:e.instructions,kind:e.kind==null?void 0:t.ConnectorKindSerializer._toJsonObject(e.kind),logo:e.logo,name:e.name,transformation:e.transformation}}}})),lV=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.ListResponseConnectorOutSerializer=void 0;var t=oV();e.ListResponseConnectorOutSerializer={_fromJsonObject(e){return{data:e.data.map(e=>t.ConnectorOutSerializer._fromJsonObject(e)),done:e.done,iterator:e.iterator,prevIterator:e.prevIterator}},_toJsonObject(e){return{data:e.data.map(e=>t.ConnectorOutSerializer._toJsonObject(e)),done:e.done,iterator:e.iterator,prevIterator:e.prevIterator}}}})),uV=i(((e,t,n)=>{var r=n&&n.__awaiter||function(e,t,n,r){function i(e){return e instanceof n?e:new n(function(t){t(e)})}return new(n||=Promise)(function(n,a){function o(e){try{c(r.next(e))}catch(e){a(e)}}function s(e){try{c(r.throw(e))}catch(e){a(e)}}function c(e){e.done?n(e.value):i(e.value).then(o,s)}c((r=r.apply(e,t||[])).next())})};Object.defineProperty(e,"__esModule",{value:!0}),e.Connector=void 0;var i=aV(),a=oV(),o=sV(),s=cV(),c=lV(),l=BB();e.Connector=class{constructor(e){this.requestCtx=e}list(e){return r(this,void 0,void 0,function*(){let t=new l.SvixRequest(l.HttpMethod.GET,`/api/v1/connector`);return t.setQueryParams({limit:e?.limit,iterator:e?.iterator,order:e?.order,product_type:e?.productType}),yield t.send(this.requestCtx,c.ListResponseConnectorOutSerializer._fromJsonObject)})}create(e,t){return r(this,void 0,void 0,function*(){let n=new l.SvixRequest(l.HttpMethod.POST,`/api/v1/connector`);return n.setHeaderParam(`idempotency-key`,t?.idempotencyKey),n.setBody(i.ConnectorInSerializer._toJsonObject(e)),yield n.send(this.requestCtx,a.ConnectorOutSerializer._fromJsonObject)})}get(e){return r(this,void 0,void 0,function*(){let t=new l.SvixRequest(l.HttpMethod.GET,`/api/v1/connector/{connector_id}`);return t.setPathParam(`connector_id`,e),yield t.send(this.requestCtx,a.ConnectorOutSerializer._fromJsonObject)})}update(e,t){return r(this,void 0,void 0,function*(){let n=new l.SvixRequest(l.HttpMethod.PUT,`/api/v1/connector/{connector_id}`);return n.setPathParam(`connector_id`,e),n.setBody(s.ConnectorUpdateSerializer._toJsonObject(t)),yield n.send(this.requestCtx,a.ConnectorOutSerializer._fromJsonObject)})}delete(e){return r(this,void 0,void 0,function*(){let t=new l.SvixRequest(l.HttpMethod.DELETE,`/api/v1/connector/{connector_id}`);return t.setPathParam(`connector_id`,e),yield t.sendNoResponseBody(this.requestCtx)})}patch(e,t){return r(this,void 0,void 0,function*(){let n=new l.SvixRequest(l.HttpMethod.PATCH,`/api/v1/connector/{connector_id}`);return n.setPathParam(`connector_id`,e),n.setBody(o.ConnectorPatchSerializer._toJsonObject(t)),yield n.send(this.requestCtx,a.ConnectorOutSerializer._fromJsonObject)})}}})),dV=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.MessageStatusSerializer=e.MessageStatus=void 0,(function(e){e[e.Success=0]=`Success`,e[e.Pending=1]=`Pending`,e[e.Fail=2]=`Fail`,e[e.Sending=3]=`Sending`,e[e.Canceled=4]=`Canceled`})(e.MessageStatus||={}),e.MessageStatusSerializer={_fromJsonObject(e){return e},_toJsonObject(e){return e}}})),fV=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.StatusCodeClassSerializer=e.StatusCodeClass=void 0,(function(e){e[e.CodeNone=0]=`CodeNone`,e[e.Code1xx=100]=`Code1xx`,e[e.Code2xx=200]=`Code2xx`,e[e.Code3xx=300]=`Code3xx`,e[e.Code4xx=400]=`Code4xx`,e[e.Code5xx=500]=`Code5xx`})(e.StatusCodeClass||={}),e.StatusCodeClassSerializer={_fromJsonObject(e){return e},_toJsonObject(e){return e}}})),pV=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.BulkReplayInSerializer=void 0;var t=dV(),n=fV();e.BulkReplayInSerializer={_fromJsonObject(e){return{channel:e.channel,eventTypes:e.eventTypes,since:new Date(e.since),status:e.status==null?void 0:t.MessageStatusSerializer._fromJsonObject(e.status),statusCodeClass:e.statusCodeClass==null?void 0:n.StatusCodeClassSerializer._fromJsonObject(e.statusCodeClass),tag:e.tag,until:e.until?new Date(e.until):null}},_toJsonObject(e){return{channel:e.channel,eventTypes:e.eventTypes,since:e.since,status:e.status==null?void 0:t.MessageStatusSerializer._toJsonObject(e.status),statusCodeClass:e.statusCodeClass==null?void 0:n.StatusCodeClassSerializer._toJsonObject(e.statusCodeClass),tag:e.tag,until:e.until}}}})),mV=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.EndpointHeadersInSerializer=void 0,e.EndpointHeadersInSerializer={_fromJsonObject(e){return{headers:e.headers}},_toJsonObject(e){return{headers:e.headers}}}})),hV=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.EndpointHeadersOutSerializer=void 0,e.EndpointHeadersOutSerializer={_fromJsonObject(e){return{headers:e.headers,sensitive:e.sensitive}},_toJsonObject(e){return{headers:e.headers,sensitive:e.sensitive}}}})),gV=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.EndpointHeadersPatchInSerializer=void 0,e.EndpointHeadersPatchInSerializer={_fromJsonObject(e){return{deleteHeaders:e.deleteHeaders,headers:e.headers}},_toJsonObject(e){return{deleteHeaders:e.deleteHeaders,headers:e.headers}}}})),_V=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.EndpointInSerializer=void 0,e.EndpointInSerializer={_fromJsonObject(e){return{channels:e.channels,description:e.description,disabled:e.disabled,filterTypes:e.filterTypes,headers:e.headers,metadata:e.metadata,rateLimit:e.rateLimit,secret:e.secret,throttleRate:e.throttleRate,uid:e.uid,url:e.url,version:e.version}},_toJsonObject(e){return{channels:e.channels,description:e.description,disabled:e.disabled,filterTypes:e.filterTypes,headers:e.headers,metadata:e.metadata,rateLimit:e.rateLimit,secret:e.secret,throttleRate:e.throttleRate,uid:e.uid,url:e.url,version:e.version}}}})),vV=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.EndpointOutSerializer=void 0,e.EndpointOutSerializer={_fromJsonObject(e){return{channels:e.channels,createdAt:new Date(e.createdAt),description:e.description,disabled:e.disabled,filterTypes:e.filterTypes,id:e.id,metadata:e.metadata,rateLimit:e.rateLimit,throttleRate:e.throttleRate,uid:e.uid,updatedAt:new Date(e.updatedAt),url:e.url,version:e.version}},_toJsonObject(e){return{channels:e.channels,createdAt:e.createdAt,description:e.description,disabled:e.disabled,filterTypes:e.filterTypes,id:e.id,metadata:e.metadata,rateLimit:e.rateLimit,throttleRate:e.throttleRate,uid:e.uid,updatedAt:e.updatedAt,url:e.url,version:e.version}}}})),yV=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.EndpointPatchSerializer=void 0,e.EndpointPatchSerializer={_fromJsonObject(e){return{channels:e.channels,description:e.description,disabled:e.disabled,filterTypes:e.filterTypes,metadata:e.metadata,rateLimit:e.rateLimit,secret:e.secret,throttleRate:e.throttleRate,uid:e.uid,url:e.url,version:e.version}},_toJsonObject(e){return{channels:e.channels,description:e.description,disabled:e.disabled,filterTypes:e.filterTypes,metadata:e.metadata,rateLimit:e.rateLimit,secret:e.secret,throttleRate:e.throttleRate,uid:e.uid,url:e.url,version:e.version}}}})),bV=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.EndpointSecretOutSerializer=void 0,e.EndpointSecretOutSerializer={_fromJsonObject(e){return{key:e.key}},_toJsonObject(e){return{key:e.key}}}})),xV=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.EndpointSecretRotateInSerializer=void 0,e.EndpointSecretRotateInSerializer={_fromJsonObject(e){return{gracePeriodSeconds:e.gracePeriodSeconds,key:e.key}},_toJsonObject(e){return{gracePeriodSeconds:e.gracePeriodSeconds,key:e.key}}}})),SV=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.EndpointStatsSerializer=void 0,e.EndpointStatsSerializer={_fromJsonObject(e){return{canceled:e.canceled,fail:e.fail,pending:e.pending,sending:e.sending,success:e.success}},_toJsonObject(e){return{canceled:e.canceled,fail:e.fail,pending:e.pending,sending:e.sending,success:e.success}}}})),CV=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.EndpointTransformationInSerializer=void 0,e.EndpointTransformationInSerializer={_fromJsonObject(e){return{code:e.code,enabled:e.enabled}},_toJsonObject(e){return{code:e.code,enabled:e.enabled}}}})),wV=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.EndpointTransformationOutSerializer=void 0,e.EndpointTransformationOutSerializer={_fromJsonObject(e){return{code:e.code,enabled:e.enabled,updatedAt:e.updatedAt?new Date(e.updatedAt):null,variables:e.variables}},_toJsonObject(e){return{code:e.code,enabled:e.enabled,updatedAt:e.updatedAt,variables:e.variables}}}})),TV=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.EndpointTransformationPatchSerializer=void 0,e.EndpointTransformationPatchSerializer={_fromJsonObject(e){return{code:e.code,enabled:e.enabled,variables:e.variables}},_toJsonObject(e){return{code:e.code,enabled:e.enabled,variables:e.variables}}}})),EV=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.EndpointUpdateSerializer=void 0,e.EndpointUpdateSerializer={_fromJsonObject(e){return{channels:e.channels,description:e.description,disabled:e.disabled,filterTypes:e.filterTypes,metadata:e.metadata,rateLimit:e.rateLimit,throttleRate:e.throttleRate,uid:e.uid,url:e.url,version:e.version}},_toJsonObject(e){return{channels:e.channels,description:e.description,disabled:e.disabled,filterTypes:e.filterTypes,metadata:e.metadata,rateLimit:e.rateLimit,throttleRate:e.throttleRate,uid:e.uid,url:e.url,version:e.version}}}})),DV=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.EventExampleInSerializer=void 0,e.EventExampleInSerializer={_fromJsonObject(e){return{eventType:e.eventType,exampleIndex:e.exampleIndex}},_toJsonObject(e){return{eventType:e.eventType,exampleIndex:e.exampleIndex}}}})),OV=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.ListResponseEndpointOutSerializer=void 0;var t=vV();e.ListResponseEndpointOutSerializer={_fromJsonObject(e){return{data:e.data.map(e=>t.EndpointOutSerializer._fromJsonObject(e)),done:e.done,iterator:e.iterator,prevIterator:e.prevIterator}},_toJsonObject(e){return{data:e.data.map(e=>t.EndpointOutSerializer._toJsonObject(e)),done:e.done,iterator:e.iterator,prevIterator:e.prevIterator}}}})),kV=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.MessageOutSerializer=void 0,e.MessageOutSerializer={_fromJsonObject(e){return{channels:e.channels,deliverAt:e.deliverAt?new Date(e.deliverAt):null,eventId:e.eventId,eventType:e.eventType,id:e.id,payload:e.payload,tags:e.tags,timestamp:new Date(e.timestamp)}},_toJsonObject(e){return{channels:e.channels,deliverAt:e.deliverAt,eventId:e.eventId,eventType:e.eventType,id:e.id,payload:e.payload,tags:e.tags,timestamp:e.timestamp}}}})),AV=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.RecoverInSerializer=void 0,e.RecoverInSerializer={_fromJsonObject(e){return{since:new Date(e.since),until:e.until?new Date(e.until):null}},_toJsonObject(e){return{since:e.since,until:e.until}}}})),jV=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.RecoverOutSerializer=void 0;var t=QB(),n=$B();e.RecoverOutSerializer={_fromJsonObject(e){return{id:e.id,status:t.BackgroundTaskStatusSerializer._fromJsonObject(e.status),task:n.BackgroundTaskTypeSerializer._fromJsonObject(e.task),updatedAt:new Date(e.updatedAt)}},_toJsonObject(e){return{id:e.id,status:t.BackgroundTaskStatusSerializer._toJsonObject(e.status),task:n.BackgroundTaskTypeSerializer._toJsonObject(e.task),updatedAt:e.updatedAt}}}})),MV=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.ReplayInSerializer=void 0,e.ReplayInSerializer={_fromJsonObject(e){return{since:new Date(e.since),until:e.until?new Date(e.until):null}},_toJsonObject(e){return{since:e.since,until:e.until}}}})),NV=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.ReplayOutSerializer=void 0;var t=QB(),n=$B();e.ReplayOutSerializer={_fromJsonObject(e){return{id:e.id,status:t.BackgroundTaskStatusSerializer._fromJsonObject(e.status),task:n.BackgroundTaskTypeSerializer._fromJsonObject(e.task),updatedAt:new Date(e.updatedAt)}},_toJsonObject(e){return{id:e.id,status:t.BackgroundTaskStatusSerializer._toJsonObject(e.status),task:n.BackgroundTaskTypeSerializer._toJsonObject(e.task),updatedAt:e.updatedAt}}}})),PV=i(((e,t,n)=>{var r=n&&n.__awaiter||function(e,t,n,r){function i(e){return e instanceof n?e:new n(function(t){t(e)})}return new(n||=Promise)(function(n,a){function o(e){try{c(r.next(e))}catch(e){a(e)}}function s(e){try{c(r.throw(e))}catch(e){a(e)}}function c(e){e.done?n(e.value):i(e.value).then(o,s)}c((r=r.apply(e,t||[])).next())})};Object.defineProperty(e,"__esModule",{value:!0}),e.Endpoint=void 0;var i=pV(),a=mV(),o=hV(),s=gV(),c=_V(),l=vV(),u=yV(),d=bV(),f=xV(),p=SV(),m=CV(),h=wV(),g=TV(),_=EV(),v=DV(),y=OV(),b=kV(),x=AV(),S=jV(),C=MV(),w=NV(),T=BB();e.Endpoint=class{constructor(e){this.requestCtx=e}list(e,t){return r(this,void 0,void 0,function*(){let n=new T.SvixRequest(T.HttpMethod.GET,`/api/v1/app/{app_id}/endpoint`);return n.setPathParam(`app_id`,e),n.setQueryParams({limit:t?.limit,iterator:t?.iterator,order:t?.order}),yield n.send(this.requestCtx,y.ListResponseEndpointOutSerializer._fromJsonObject)})}create(e,t,n){return r(this,void 0,void 0,function*(){let r=new T.SvixRequest(T.HttpMethod.POST,`/api/v1/app/{app_id}/endpoint`);return r.setPathParam(`app_id`,e),r.setHeaderParam(`idempotency-key`,n?.idempotencyKey),r.setBody(c.EndpointInSerializer._toJsonObject(t)),yield r.send(this.requestCtx,l.EndpointOutSerializer._fromJsonObject)})}get(e,t){return r(this,void 0,void 0,function*(){let n=new T.SvixRequest(T.HttpMethod.GET,`/api/v1/app/{app_id}/endpoint/{endpoint_id}`);return n.setPathParam(`app_id`,e),n.setPathParam(`endpoint_id`,t),yield n.send(this.requestCtx,l.EndpointOutSerializer._fromJsonObject)})}update(e,t,n){return r(this,void 0,void 0,function*(){let r=new T.SvixRequest(T.HttpMethod.PUT,`/api/v1/app/{app_id}/endpoint/{endpoint_id}`);return r.setPathParam(`app_id`,e),r.setPathParam(`endpoint_id`,t),r.setBody(_.EndpointUpdateSerializer._toJsonObject(n)),yield r.send(this.requestCtx,l.EndpointOutSerializer._fromJsonObject)})}delete(e,t){return r(this,void 0,void 0,function*(){let n=new T.SvixRequest(T.HttpMethod.DELETE,`/api/v1/app/{app_id}/endpoint/{endpoint_id}`);return n.setPathParam(`app_id`,e),n.setPathParam(`endpoint_id`,t),yield n.sendNoResponseBody(this.requestCtx)})}patch(e,t,n){return r(this,void 0,void 0,function*(){let r=new T.SvixRequest(T.HttpMethod.PATCH,`/api/v1/app/{app_id}/endpoint/{endpoint_id}`);return r.setPathParam(`app_id`,e),r.setPathParam(`endpoint_id`,t),r.setBody(u.EndpointPatchSerializer._toJsonObject(n)),yield r.send(this.requestCtx,l.EndpointOutSerializer._fromJsonObject)})}getSecret(e,t){return r(this,void 0,void 0,function*(){let n=new T.SvixRequest(T.HttpMethod.GET,`/api/v1/app/{app_id}/endpoint/{endpoint_id}/secret`);return n.setPathParam(`app_id`,e),n.setPathParam(`endpoint_id`,t),yield n.send(this.requestCtx,d.EndpointSecretOutSerializer._fromJsonObject)})}rotateSecret(e,t,n={},i){return r(this,void 0,void 0,function*(){let r=new T.SvixRequest(T.HttpMethod.POST,`/api/v1/app/{app_id}/endpoint/{endpoint_id}/secret/rotate`);return r.setPathParam(`app_id`,e),r.setPathParam(`endpoint_id`,t),r.setHeaderParam(`idempotency-key`,i?.idempotencyKey),r.setBody(f.EndpointSecretRotateInSerializer._toJsonObject(n)),yield r.sendNoResponseBody(this.requestCtx)})}getHeaders(e,t){return r(this,void 0,void 0,function*(){let n=new T.SvixRequest(T.HttpMethod.GET,`/api/v1/app/{app_id}/endpoint/{endpoint_id}/headers`);return n.setPathParam(`app_id`,e),n.setPathParam(`endpoint_id`,t),yield n.send(this.requestCtx,o.EndpointHeadersOutSerializer._fromJsonObject)})}updateHeaders(e,t,n){return r(this,void 0,void 0,function*(){let r=new T.SvixRequest(T.HttpMethod.PUT,`/api/v1/app/{app_id}/endpoint/{endpoint_id}/headers`);return r.setPathParam(`app_id`,e),r.setPathParam(`endpoint_id`,t),r.setBody(a.EndpointHeadersInSerializer._toJsonObject(n)),yield r.sendNoResponseBody(this.requestCtx)})}headersUpdate(e,t,n){return this.updateHeaders(e,t,n)}patchHeaders(e,t,n){return r(this,void 0,void 0,function*(){let r=new T.SvixRequest(T.HttpMethod.PATCH,`/api/v1/app/{app_id}/endpoint/{endpoint_id}/headers`);return r.setPathParam(`app_id`,e),r.setPathParam(`endpoint_id`,t),r.setBody(s.EndpointHeadersPatchInSerializer._toJsonObject(n)),yield r.sendNoResponseBody(this.requestCtx)})}headersPatch(e,t,n){return this.patchHeaders(e,t,n)}transformationGet(e,t){return r(this,void 0,void 0,function*(){let n=new T.SvixRequest(T.HttpMethod.GET,`/api/v1/app/{app_id}/endpoint/{endpoint_id}/transformation`);return n.setPathParam(`app_id`,e),n.setPathParam(`endpoint_id`,t),yield n.send(this.requestCtx,h.EndpointTransformationOutSerializer._fromJsonObject)})}patchTransformation(e,t,n){return r(this,void 0,void 0,function*(){let r=new T.SvixRequest(T.HttpMethod.PATCH,`/api/v1/app/{app_id}/endpoint/{endpoint_id}/transformation`);return r.setPathParam(`app_id`,e),r.setPathParam(`endpoint_id`,t),r.setBody(g.EndpointTransformationPatchSerializer._toJsonObject(n)),yield r.sendNoResponseBody(this.requestCtx)})}replayMissing(e,t,n,i){return r(this,void 0,void 0,function*(){let r=new T.SvixRequest(T.HttpMethod.POST,`/api/v1/app/{app_id}/endpoint/{endpoint_id}/replay-missing`);return r.setPathParam(`app_id`,e),r.setPathParam(`endpoint_id`,t),r.setHeaderParam(`idempotency-key`,i?.idempotencyKey),r.setBody(C.ReplayInSerializer._toJsonObject(n)),yield r.send(this.requestCtx,w.ReplayOutSerializer._fromJsonObject)})}bulkReplay(e,t,n,a){return r(this,void 0,void 0,function*(){let r=new T.SvixRequest(T.HttpMethod.POST,`/api/v1/app/{app_id}/endpoint/{endpoint_id}/bulk-replay`);return r.setPathParam(`app_id`,e),r.setPathParam(`endpoint_id`,t),r.setHeaderParam(`idempotency-key`,a?.idempotencyKey),r.setBody(i.BulkReplayInSerializer._toJsonObject(n)),yield r.send(this.requestCtx,w.ReplayOutSerializer._fromJsonObject)})}getStats(e,t,n){return r(this,void 0,void 0,function*(){let r=new T.SvixRequest(T.HttpMethod.GET,`/api/v1/app/{app_id}/endpoint/{endpoint_id}/stats`);return r.setPathParam(`app_id`,e),r.setPathParam(`endpoint_id`,t),r.setQueryParams({since:n?.since,until:n?.until}),yield r.send(this.requestCtx,p.EndpointStatsSerializer._fromJsonObject)})}recover(e,t,n,i){return r(this,void 0,void 0,function*(){let r=new T.SvixRequest(T.HttpMethod.POST,`/api/v1/app/{app_id}/endpoint/{endpoint_id}/recover`);return r.setPathParam(`app_id`,e),r.setPathParam(`endpoint_id`,t),r.setHeaderParam(`idempotency-key`,i?.idempotencyKey),r.setBody(x.RecoverInSerializer._toJsonObject(n)),yield r.send(this.requestCtx,S.RecoverOutSerializer._fromJsonObject)})}sendExample(e,t,n,i){return r(this,void 0,void 0,function*(){let r=new T.SvixRequest(T.HttpMethod.POST,`/api/v1/app/{app_id}/endpoint/{endpoint_id}/send-example`);return r.setPathParam(`app_id`,e),r.setPathParam(`endpoint_id`,t),r.setHeaderParam(`idempotency-key`,i?.idempotencyKey),r.setBody(v.EventExampleInSerializer._toJsonObject(n)),yield r.send(this.requestCtx,b.MessageOutSerializer._fromJsonObject)})}transformationPartialUpdate(e,t,n={}){return r(this,void 0,void 0,function*(){let r=new T.SvixRequest(T.HttpMethod.PATCH,`/api/v1/app/{app_id}/endpoint/{endpoint_id}/transformation`);return r.setPathParam(`app_id`,e),r.setPathParam(`endpoint_id`,t),r.setBody(m.EndpointTransformationInSerializer._toJsonObject(n)),yield r.sendNoResponseBody(this.requestCtx)})}}})),FV=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.EventTypeInSerializer=void 0,e.EventTypeInSerializer={_fromJsonObject(e){return{archived:e.archived,deprecated:e.deprecated,description:e.description,featureFlag:e.featureFlag,featureFlags:e.featureFlags,groupName:e.groupName,name:e.name,schemas:e.schemas}},_toJsonObject(e){return{archived:e.archived,deprecated:e.deprecated,description:e.description,featureFlag:e.featureFlag,featureFlags:e.featureFlags,groupName:e.groupName,name:e.name,schemas:e.schemas}}}})),IV=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.EnvironmentInSerializer=void 0;var t=aV(),n=FV();e.EnvironmentInSerializer={_fromJsonObject(e){return{connectors:e.connectors?.map(e=>t.ConnectorInSerializer._fromJsonObject(e)),eventTypes:e.eventTypes?.map(e=>n.EventTypeInSerializer._fromJsonObject(e)),settings:e.settings}},_toJsonObject(e){return{connectors:e.connectors?.map(e=>t.ConnectorInSerializer._toJsonObject(e)),eventTypes:e.eventTypes?.map(e=>n.EventTypeInSerializer._toJsonObject(e)),settings:e.settings}}}})),LV=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.EventTypeOutSerializer=void 0,e.EventTypeOutSerializer={_fromJsonObject(e){return{archived:e.archived,createdAt:new Date(e.createdAt),deprecated:e.deprecated,description:e.description,featureFlag:e.featureFlag,featureFlags:e.featureFlags,groupName:e.groupName,name:e.name,schemas:e.schemas,updatedAt:new Date(e.updatedAt)}},_toJsonObject(e){return{archived:e.archived,createdAt:e.createdAt,deprecated:e.deprecated,description:e.description,featureFlag:e.featureFlag,featureFlags:e.featureFlags,groupName:e.groupName,name:e.name,schemas:e.schemas,updatedAt:e.updatedAt}}}})),RV=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.EnvironmentOutSerializer=void 0;var t=oV(),n=LV();e.EnvironmentOutSerializer={_fromJsonObject(e){return{connectors:e.connectors.map(e=>t.ConnectorOutSerializer._fromJsonObject(e)),createdAt:new Date(e.createdAt),eventTypes:e.eventTypes.map(e=>n.EventTypeOutSerializer._fromJsonObject(e)),settings:e.settings,version:e.version}},_toJsonObject(e){return{connectors:e.connectors.map(e=>t.ConnectorOutSerializer._toJsonObject(e)),createdAt:e.createdAt,eventTypes:e.eventTypes.map(e=>n.EventTypeOutSerializer._toJsonObject(e)),settings:e.settings,version:e.version}}}})),zV=i(((e,t,n)=>{var r=n&&n.__awaiter||function(e,t,n,r){function i(e){return e instanceof n?e:new n(function(t){t(e)})}return new(n||=Promise)(function(n,a){function o(e){try{c(r.next(e))}catch(e){a(e)}}function s(e){try{c(r.throw(e))}catch(e){a(e)}}function c(e){e.done?n(e.value):i(e.value).then(o,s)}c((r=r.apply(e,t||[])).next())})};Object.defineProperty(e,"__esModule",{value:!0}),e.Environment=void 0;var i=IV(),a=RV(),o=BB();e.Environment=class{constructor(e){this.requestCtx=e}export(e){return r(this,void 0,void 0,function*(){let t=new o.SvixRequest(o.HttpMethod.POST,`/api/v1/environment/export`);return t.setHeaderParam(`idempotency-key`,e?.idempotencyKey),yield t.send(this.requestCtx,a.EnvironmentOutSerializer._fromJsonObject)})}import(e={},t){return r(this,void 0,void 0,function*(){let n=new o.SvixRequest(o.HttpMethod.POST,`/api/v1/environment/import`);return n.setHeaderParam(`idempotency-key`,t?.idempotencyKey),n.setBody(i.EnvironmentInSerializer._toJsonObject(e)),yield n.sendNoResponseBody(this.requestCtx)})}}})),BV=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.EventTypeImportOpenApiInSerializer=void 0,e.EventTypeImportOpenApiInSerializer={_fromJsonObject(e){return{dryRun:e.dryRun,replaceAll:e.replaceAll,spec:e.spec,specRaw:e.specRaw}},_toJsonObject(e){return{dryRun:e.dryRun,replaceAll:e.replaceAll,spec:e.spec,specRaw:e.specRaw}}}})),VV=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.EventTypeFromOpenApiSerializer=void 0,e.EventTypeFromOpenApiSerializer={_fromJsonObject(e){return{deprecated:e.deprecated,description:e.description,featureFlag:e.featureFlag,featureFlags:e.featureFlags,groupName:e.groupName,name:e.name,schemas:e.schemas}},_toJsonObject(e){return{deprecated:e.deprecated,description:e.description,featureFlag:e.featureFlag,featureFlags:e.featureFlags,groupName:e.groupName,name:e.name,schemas:e.schemas}}}})),HV=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.EventTypeImportOpenApiOutDataSerializer=void 0;var t=VV();e.EventTypeImportOpenApiOutDataSerializer={_fromJsonObject(e){return{modified:e.modified,toModify:e.to_modify?.map(e=>t.EventTypeFromOpenApiSerializer._fromJsonObject(e))}},_toJsonObject(e){return{modified:e.modified,to_modify:e.toModify?.map(e=>t.EventTypeFromOpenApiSerializer._toJsonObject(e))}}}})),UV=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.EventTypeImportOpenApiOutSerializer=void 0;var t=HV();e.EventTypeImportOpenApiOutSerializer={_fromJsonObject(e){return{data:t.EventTypeImportOpenApiOutDataSerializer._fromJsonObject(e.data)}},_toJsonObject(e){return{data:t.EventTypeImportOpenApiOutDataSerializer._toJsonObject(e.data)}}}})),WV=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.EventTypePatchSerializer=void 0,e.EventTypePatchSerializer={_fromJsonObject(e){return{archived:e.archived,deprecated:e.deprecated,description:e.description,featureFlag:e.featureFlag,featureFlags:e.featureFlags,groupName:e.groupName,schemas:e.schemas}},_toJsonObject(e){return{archived:e.archived,deprecated:e.deprecated,description:e.description,featureFlag:e.featureFlag,featureFlags:e.featureFlags,groupName:e.groupName,schemas:e.schemas}}}})),GV=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.EventTypeUpdateSerializer=void 0,e.EventTypeUpdateSerializer={_fromJsonObject(e){return{archived:e.archived,deprecated:e.deprecated,description:e.description,featureFlag:e.featureFlag,featureFlags:e.featureFlags,groupName:e.groupName,schemas:e.schemas}},_toJsonObject(e){return{archived:e.archived,deprecated:e.deprecated,description:e.description,featureFlag:e.featureFlag,featureFlags:e.featureFlags,groupName:e.groupName,schemas:e.schemas}}}})),KV=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.ListResponseEventTypeOutSerializer=void 0;var t=LV();e.ListResponseEventTypeOutSerializer={_fromJsonObject(e){return{data:e.data.map(e=>t.EventTypeOutSerializer._fromJsonObject(e)),done:e.done,iterator:e.iterator,prevIterator:e.prevIterator}},_toJsonObject(e){return{data:e.data.map(e=>t.EventTypeOutSerializer._toJsonObject(e)),done:e.done,iterator:e.iterator,prevIterator:e.prevIterator}}}})),qV=i(((e,t,n)=>{var r=n&&n.__awaiter||function(e,t,n,r){function i(e){return e instanceof n?e:new n(function(t){t(e)})}return new(n||=Promise)(function(n,a){function o(e){try{c(r.next(e))}catch(e){a(e)}}function s(e){try{c(r.throw(e))}catch(e){a(e)}}function c(e){e.done?n(e.value):i(e.value).then(o,s)}c((r=r.apply(e,t||[])).next())})};Object.defineProperty(e,"__esModule",{value:!0}),e.EventType=void 0;var i=BV(),a=UV(),o=FV(),s=LV(),c=WV(),l=GV(),u=KV(),d=BB();e.EventType=class{constructor(e){this.requestCtx=e}list(e){return r(this,void 0,void 0,function*(){let t=new d.SvixRequest(d.HttpMethod.GET,`/api/v1/event-type`);return t.setQueryParams({limit:e?.limit,iterator:e?.iterator,order:e?.order,include_archived:e?.includeArchived,with_content:e?.withContent}),yield t.send(this.requestCtx,u.ListResponseEventTypeOutSerializer._fromJsonObject)})}create(e,t){return r(this,void 0,void 0,function*(){let n=new d.SvixRequest(d.HttpMethod.POST,`/api/v1/event-type`);return n.setHeaderParam(`idempotency-key`,t?.idempotencyKey),n.setBody(o.EventTypeInSerializer._toJsonObject(e)),yield n.send(this.requestCtx,s.EventTypeOutSerializer._fromJsonObject)})}importOpenapi(e={},t){return r(this,void 0,void 0,function*(){let n=new d.SvixRequest(d.HttpMethod.POST,`/api/v1/event-type/import/openapi`);return n.setHeaderParam(`idempotency-key`,t?.idempotencyKey),n.setBody(i.EventTypeImportOpenApiInSerializer._toJsonObject(e)),yield n.send(this.requestCtx,a.EventTypeImportOpenApiOutSerializer._fromJsonObject)})}get(e){return r(this,void 0,void 0,function*(){let t=new d.SvixRequest(d.HttpMethod.GET,`/api/v1/event-type/{event_type_name}`);return t.setPathParam(`event_type_name`,e),yield t.send(this.requestCtx,s.EventTypeOutSerializer._fromJsonObject)})}update(e,t){return r(this,void 0,void 0,function*(){let n=new d.SvixRequest(d.HttpMethod.PUT,`/api/v1/event-type/{event_type_name}`);return n.setPathParam(`event_type_name`,e),n.setBody(l.EventTypeUpdateSerializer._toJsonObject(t)),yield n.send(this.requestCtx,s.EventTypeOutSerializer._fromJsonObject)})}delete(e,t){return r(this,void 0,void 0,function*(){let n=new d.SvixRequest(d.HttpMethod.DELETE,`/api/v1/event-type/{event_type_name}`);return n.setPathParam(`event_type_name`,e),n.setQueryParams({expunge:t?.expunge}),yield n.sendNoResponseBody(this.requestCtx)})}patch(e,t){return r(this,void 0,void 0,function*(){let n=new d.SvixRequest(d.HttpMethod.PATCH,`/api/v1/event-type/{event_type_name}`);return n.setPathParam(`event_type_name`,e),n.setBody(c.EventTypePatchSerializer._toJsonObject(t)),yield n.send(this.requestCtx,s.EventTypeOutSerializer._fromJsonObject)})}}})),JV=i(((e,t,n)=>{var r=n&&n.__awaiter||function(e,t,n,r){function i(e){return e instanceof n?e:new n(function(t){t(e)})}return new(n||=Promise)(function(n,a){function o(e){try{c(r.next(e))}catch(e){a(e)}}function s(e){try{c(r.throw(e))}catch(e){a(e)}}function c(e){e.done?n(e.value):i(e.value).then(o,s)}c((r=r.apply(e,t||[])).next())})};Object.defineProperty(e,"__esModule",{value:!0}),e.Health=void 0;var i=BB();e.Health=class{constructor(e){this.requestCtx=e}get(){return r(this,void 0,void 0,function*(){return yield new i.SvixRequest(i.HttpMethod.GET,`/api/v1/health`).sendNoResponseBody(this.requestCtx)})}}})),YV=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.IngestSourceConsumerPortalAccessInSerializer=void 0,e.IngestSourceConsumerPortalAccessInSerializer={_fromJsonObject(e){return{expiry:e.expiry,readOnly:e.readOnly}},_toJsonObject(e){return{expiry:e.expiry,readOnly:e.readOnly}}}})),XV=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.IngestEndpointHeadersInSerializer=void 0,e.IngestEndpointHeadersInSerializer={_fromJsonObject(e){return{headers:e.headers}},_toJsonObject(e){return{headers:e.headers}}}})),ZV=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.IngestEndpointHeadersOutSerializer=void 0,e.IngestEndpointHeadersOutSerializer={_fromJsonObject(e){return{headers:e.headers,sensitive:e.sensitive}},_toJsonObject(e){return{headers:e.headers,sensitive:e.sensitive}}}})),QV=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.IngestEndpointInSerializer=void 0,e.IngestEndpointInSerializer={_fromJsonObject(e){return{description:e.description,disabled:e.disabled,metadata:e.metadata,rateLimit:e.rateLimit,secret:e.secret,throttleRate:e.throttleRate,uid:e.uid,url:e.url}},_toJsonObject(e){return{description:e.description,disabled:e.disabled,metadata:e.metadata,rateLimit:e.rateLimit,secret:e.secret,throttleRate:e.throttleRate,uid:e.uid,url:e.url}}}})),$V=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.IngestEndpointOutSerializer=void 0,e.IngestEndpointOutSerializer={_fromJsonObject(e){return{createdAt:new Date(e.createdAt),description:e.description,disabled:e.disabled,id:e.id,metadata:e.metadata,rateLimit:e.rateLimit,throttleRate:e.throttleRate,uid:e.uid,updatedAt:new Date(e.updatedAt),url:e.url}},_toJsonObject(e){return{createdAt:e.createdAt,description:e.description,disabled:e.disabled,id:e.id,metadata:e.metadata,rateLimit:e.rateLimit,throttleRate:e.throttleRate,uid:e.uid,updatedAt:e.updatedAt,url:e.url}}}})),eH=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.IngestEndpointSecretInSerializer=void 0,e.IngestEndpointSecretInSerializer={_fromJsonObject(e){return{key:e.key}},_toJsonObject(e){return{key:e.key}}}})),tH=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.IngestEndpointSecretOutSerializer=void 0,e.IngestEndpointSecretOutSerializer={_fromJsonObject(e){return{key:e.key}},_toJsonObject(e){return{key:e.key}}}})),nH=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.IngestEndpointTransformationOutSerializer=void 0,e.IngestEndpointTransformationOutSerializer={_fromJsonObject(e){return{code:e.code,enabled:e.enabled}},_toJsonObject(e){return{code:e.code,enabled:e.enabled}}}})),rH=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.IngestEndpointTransformationPatchSerializer=void 0,e.IngestEndpointTransformationPatchSerializer={_fromJsonObject(e){return{code:e.code,enabled:e.enabled}},_toJsonObject(e){return{code:e.code,enabled:e.enabled}}}})),iH=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.IngestEndpointUpdateSerializer=void 0,e.IngestEndpointUpdateSerializer={_fromJsonObject(e){return{description:e.description,disabled:e.disabled,metadata:e.metadata,rateLimit:e.rateLimit,throttleRate:e.throttleRate,uid:e.uid,url:e.url}},_toJsonObject(e){return{description:e.description,disabled:e.disabled,metadata:e.metadata,rateLimit:e.rateLimit,throttleRate:e.throttleRate,uid:e.uid,url:e.url}}}})),aH=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.ListResponseIngestEndpointOutSerializer=void 0;var t=$V();e.ListResponseIngestEndpointOutSerializer={_fromJsonObject(e){return{data:e.data.map(e=>t.IngestEndpointOutSerializer._fromJsonObject(e)),done:e.done,iterator:e.iterator,prevIterator:e.prevIterator}},_toJsonObject(e){return{data:e.data.map(e=>t.IngestEndpointOutSerializer._toJsonObject(e)),done:e.done,iterator:e.iterator,prevIterator:e.prevIterator}}}})),oH=i(((e,t,n)=>{var r=n&&n.__awaiter||function(e,t,n,r){function i(e){return e instanceof n?e:new n(function(t){t(e)})}return new(n||=Promise)(function(n,a){function o(e){try{c(r.next(e))}catch(e){a(e)}}function s(e){try{c(r.throw(e))}catch(e){a(e)}}function c(e){e.done?n(e.value):i(e.value).then(o,s)}c((r=r.apply(e,t||[])).next())})};Object.defineProperty(e,"__esModule",{value:!0}),e.IngestEndpoint=void 0;var i=XV(),a=ZV(),o=QV(),s=$V(),c=eH(),l=tH(),u=nH(),d=rH(),f=iH(),p=aH(),m=BB();e.IngestEndpoint=class{constructor(e){this.requestCtx=e}list(e,t){return r(this,void 0,void 0,function*(){let n=new m.SvixRequest(m.HttpMethod.GET,`/ingest/api/v1/source/{source_id}/endpoint`);return n.setPathParam(`source_id`,e),n.setQueryParams({limit:t?.limit,iterator:t?.iterator,order:t?.order}),yield n.send(this.requestCtx,p.ListResponseIngestEndpointOutSerializer._fromJsonObject)})}create(e,t,n){return r(this,void 0,void 0,function*(){let r=new m.SvixRequest(m.HttpMethod.POST,`/ingest/api/v1/source/{source_id}/endpoint`);return r.setPathParam(`source_id`,e),r.setHeaderParam(`idempotency-key`,n?.idempotencyKey),r.setBody(o.IngestEndpointInSerializer._toJsonObject(t)),yield r.send(this.requestCtx,s.IngestEndpointOutSerializer._fromJsonObject)})}get(e,t){return r(this,void 0,void 0,function*(){let n=new m.SvixRequest(m.HttpMethod.GET,`/ingest/api/v1/source/{source_id}/endpoint/{endpoint_id}`);return n.setPathParam(`source_id`,e),n.setPathParam(`endpoint_id`,t),yield n.send(this.requestCtx,s.IngestEndpointOutSerializer._fromJsonObject)})}update(e,t,n){return r(this,void 0,void 0,function*(){let r=new m.SvixRequest(m.HttpMethod.PUT,`/ingest/api/v1/source/{source_id}/endpoint/{endpoint_id}`);return r.setPathParam(`source_id`,e),r.setPathParam(`endpoint_id`,t),r.setBody(f.IngestEndpointUpdateSerializer._toJsonObject(n)),yield r.send(this.requestCtx,s.IngestEndpointOutSerializer._fromJsonObject)})}delete(e,t){return r(this,void 0,void 0,function*(){let n=new m.SvixRequest(m.HttpMethod.DELETE,`/ingest/api/v1/source/{source_id}/endpoint/{endpoint_id}`);return n.setPathParam(`source_id`,e),n.setPathParam(`endpoint_id`,t),yield n.sendNoResponseBody(this.requestCtx)})}getSecret(e,t){return r(this,void 0,void 0,function*(){let n=new m.SvixRequest(m.HttpMethod.GET,`/ingest/api/v1/source/{source_id}/endpoint/{endpoint_id}/secret`);return n.setPathParam(`source_id`,e),n.setPathParam(`endpoint_id`,t),yield n.send(this.requestCtx,l.IngestEndpointSecretOutSerializer._fromJsonObject)})}rotateSecret(e,t,n={},i){return r(this,void 0,void 0,function*(){let r=new m.SvixRequest(m.HttpMethod.POST,`/ingest/api/v1/source/{source_id}/endpoint/{endpoint_id}/secret/rotate`);return r.setPathParam(`source_id`,e),r.setPathParam(`endpoint_id`,t),r.setHeaderParam(`idempotency-key`,i?.idempotencyKey),r.setBody(c.IngestEndpointSecretInSerializer._toJsonObject(n)),yield r.sendNoResponseBody(this.requestCtx)})}getHeaders(e,t){return r(this,void 0,void 0,function*(){let n=new m.SvixRequest(m.HttpMethod.GET,`/ingest/api/v1/source/{source_id}/endpoint/{endpoint_id}/headers`);return n.setPathParam(`source_id`,e),n.setPathParam(`endpoint_id`,t),yield n.send(this.requestCtx,a.IngestEndpointHeadersOutSerializer._fromJsonObject)})}updateHeaders(e,t,n){return r(this,void 0,void 0,function*(){let r=new m.SvixRequest(m.HttpMethod.PUT,`/ingest/api/v1/source/{source_id}/endpoint/{endpoint_id}/headers`);return r.setPathParam(`source_id`,e),r.setPathParam(`endpoint_id`,t),r.setBody(i.IngestEndpointHeadersInSerializer._toJsonObject(n)),yield r.sendNoResponseBody(this.requestCtx)})}getTransformation(e,t){return r(this,void 0,void 0,function*(){let n=new m.SvixRequest(m.HttpMethod.GET,`/ingest/api/v1/source/{source_id}/endpoint/{endpoint_id}/transformation`);return n.setPathParam(`source_id`,e),n.setPathParam(`endpoint_id`,t),yield n.send(this.requestCtx,u.IngestEndpointTransformationOutSerializer._fromJsonObject)})}setTransformation(e,t,n){return r(this,void 0,void 0,function*(){let r=new m.SvixRequest(m.HttpMethod.PATCH,`/ingest/api/v1/source/{source_id}/endpoint/{endpoint_id}/transformation`);return r.setPathParam(`source_id`,e),r.setPathParam(`endpoint_id`,t),r.setBody(d.IngestEndpointTransformationPatchSerializer._toJsonObject(n)),yield r.sendNoResponseBody(this.requestCtx)})}}})),sH=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.AdobeSignConfigSerializer=void 0,e.AdobeSignConfigSerializer={_fromJsonObject(e){return{clientId:e.clientId}},_toJsonObject(e){return{clientId:e.clientId}}}})),cH=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.AirwallexConfigSerializer=void 0,e.AirwallexConfigSerializer={_fromJsonObject(e){return{secret:e.secret}},_toJsonObject(e){return{secret:e.secret}}}})),lH=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.CheckbookConfigSerializer=void 0,e.CheckbookConfigSerializer={_fromJsonObject(e){return{secret:e.secret}},_toJsonObject(e){return{secret:e.secret}}}})),uH=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.CronConfigSerializer=void 0,e.CronConfigSerializer={_fromJsonObject(e){return{contentType:e.contentType,payload:e.payload,schedule:e.schedule}},_toJsonObject(e){return{contentType:e.contentType,payload:e.payload,schedule:e.schedule}}}})),dH=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.DocusignConfigSerializer=void 0,e.DocusignConfigSerializer={_fromJsonObject(e){return{secret:e.secret}},_toJsonObject(e){return{secret:e.secret}}}})),fH=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.EasypostConfigSerializer=void 0,e.EasypostConfigSerializer={_fromJsonObject(e){return{secret:e.secret}},_toJsonObject(e){return{secret:e.secret}}}})),pH=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.GithubConfigSerializer=void 0,e.GithubConfigSerializer={_fromJsonObject(e){return{secret:e.secret}},_toJsonObject(e){return{secret:e.secret}}}})),mH=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.HubspotConfigSerializer=void 0,e.HubspotConfigSerializer={_fromJsonObject(e){return{secret:e.secret}},_toJsonObject(e){return{secret:e.secret}}}})),hH=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.MetaConfigSerializer=void 0,e.MetaConfigSerializer={_fromJsonObject(e){return{secret:e.secret,verifyToken:e.verifyToken}},_toJsonObject(e){return{secret:e.secret,verifyToken:e.verifyToken}}}})),gH=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.NangoConfigSerializer=void 0,e.NangoConfigSerializer={_fromJsonObject(e){return{secret:e.secret}},_toJsonObject(e){return{secret:e.secret}}}})),_H=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.OpenClawConfigSerializer=void 0,e.OpenClawConfigSerializer={_fromJsonObject(e){return{secret:e.secret}},_toJsonObject(e){return{secret:e.secret}}}})),vH=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.OrumIoConfigSerializer=void 0,e.OrumIoConfigSerializer={_fromJsonObject(e){return{publicKey:e.publicKey}},_toJsonObject(e){return{publicKey:e.publicKey}}}})),yH=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.PandaDocConfigSerializer=void 0,e.PandaDocConfigSerializer={_fromJsonObject(e){return{secret:e.secret}},_toJsonObject(e){return{secret:e.secret}}}})),bH=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.PortIoConfigSerializer=void 0,e.PortIoConfigSerializer={_fromJsonObject(e){return{secret:e.secret}},_toJsonObject(e){return{secret:e.secret}}}})),xH=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.RutterConfigSerializer=void 0,e.RutterConfigSerializer={_fromJsonObject(e){return{secret:e.secret}},_toJsonObject(e){return{secret:e.secret}}}})),SH=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.SegmentConfigSerializer=void 0,e.SegmentConfigSerializer={_fromJsonObject(e){return{secret:e.secret}},_toJsonObject(e){return{secret:e.secret}}}})),CH=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.ShopifyConfigSerializer=void 0,e.ShopifyConfigSerializer={_fromJsonObject(e){return{secret:e.secret}},_toJsonObject(e){return{secret:e.secret}}}})),wH=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.SlackConfigSerializer=void 0,e.SlackConfigSerializer={_fromJsonObject(e){return{secret:e.secret}},_toJsonObject(e){return{secret:e.secret}}}})),TH=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.StripeConfigSerializer=void 0,e.StripeConfigSerializer={_fromJsonObject(e){return{secret:e.secret}},_toJsonObject(e){return{secret:e.secret}}}})),EH=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.SvixConfigSerializer=void 0,e.SvixConfigSerializer={_fromJsonObject(e){return{secret:e.secret}},_toJsonObject(e){return{secret:e.secret}}}})),DH=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.TailscaleConfigSerializer=void 0,e.TailscaleConfigSerializer={_fromJsonObject(e){return{secret:e.secret,timestampGraceSeconds:e.timestampGraceSeconds}},_toJsonObject(e){return{secret:e.secret,timestampGraceSeconds:e.timestampGraceSeconds}}}})),OH=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.TelnyxConfigSerializer=void 0,e.TelnyxConfigSerializer={_fromJsonObject(e){return{publicKey:e.publicKey}},_toJsonObject(e){return{publicKey:e.publicKey}}}})),kH=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.VapiConfigSerializer=void 0,e.VapiConfigSerializer={_fromJsonObject(e){return{secret:e.secret}},_toJsonObject(e){return{secret:e.secret}}}})),AH=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.VeriffConfigSerializer=void 0,e.VeriffConfigSerializer={_fromJsonObject(e){return{secret:e.secret}},_toJsonObject(e){return{secret:e.secret}}}})),jH=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.VgsConfigSerializer=void 0,e.VgsConfigSerializer={_fromJsonObject(e){return{secret:e.secret}},_toJsonObject(e){return{secret:e.secret}}}})),MH=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.ZoomConfigSerializer=void 0,e.ZoomConfigSerializer={_fromJsonObject(e){return{secret:e.secret}},_toJsonObject(e){return{secret:e.secret}}}})),NH=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.IngestSourceInSerializer=void 0;var t=sH(),n=cH(),r=lH(),i=uH(),a=dH(),o=fH(),s=pH(),c=mH(),l=hH(),u=gH(),d=_H(),f=vH(),p=yH(),m=bH(),h=xH(),g=SH(),_=CH(),v=wH(),y=TH(),b=EH(),x=DH(),S=OH(),C=kH(),w=AH(),T=jH(),E=MH();e.IngestSourceInSerializer={_fromJsonObject(e){let D=e.type;function ee(D){switch(D){case`generic-webhook`:return{};case`cron`:return i.CronConfigSerializer._fromJsonObject(e.config);case`adobe-sign`:return t.AdobeSignConfigSerializer._fromJsonObject(e.config);case`beehiiv`:return b.SvixConfigSerializer._fromJsonObject(e.config);case`brex`:return b.SvixConfigSerializer._fromJsonObject(e.config);case`checkbook`:return r.CheckbookConfigSerializer._fromJsonObject(e.config);case`clerk`:return b.SvixConfigSerializer._fromJsonObject(e.config);case`docusign`:return a.DocusignConfigSerializer._fromJsonObject(e.config);case`easypost`:return o.EasypostConfigSerializer._fromJsonObject(e.config);case`github`:return s.GithubConfigSerializer._fromJsonObject(e.config);case`guesty`:return b.SvixConfigSerializer._fromJsonObject(e.config);case`hubspot`:return c.HubspotConfigSerializer._fromJsonObject(e.config);case`incident-io`:return b.SvixConfigSerializer._fromJsonObject(e.config);case`lithic`:return b.SvixConfigSerializer._fromJsonObject(e.config);case`meta`:return l.MetaConfigSerializer._fromJsonObject(e.config);case`nango`:return u.NangoConfigSerializer._fromJsonObject(e.config);case`nash`:return b.SvixConfigSerializer._fromJsonObject(e.config);case`openclaw`:return d.OpenClawConfigSerializer._fromJsonObject(e.config);case`orum-io`:return f.OrumIoConfigSerializer._fromJsonObject(e.config);case`panda-doc`:return p.PandaDocConfigSerializer._fromJsonObject(e.config);case`port-io`:return m.PortIoConfigSerializer._fromJsonObject(e.config);case`pleo`:return b.SvixConfigSerializer._fromJsonObject(e.config);case`psi-fi`:return b.SvixConfigSerializer._fromJsonObject(e.config);case`replicate`:return b.SvixConfigSerializer._fromJsonObject(e.config);case`resend`:return b.SvixConfigSerializer._fromJsonObject(e.config);case`rutter`:return h.RutterConfigSerializer._fromJsonObject(e.config);case`safebase`:return b.SvixConfigSerializer._fromJsonObject(e.config);case`sardine`:return b.SvixConfigSerializer._fromJsonObject(e.config);case`segment`:return g.SegmentConfigSerializer._fromJsonObject(e.config);case`shopify`:return _.ShopifyConfigSerializer._fromJsonObject(e.config);case`slack`:return v.SlackConfigSerializer._fromJsonObject(e.config);case`stripe`:return y.StripeConfigSerializer._fromJsonObject(e.config);case`stych`:return b.SvixConfigSerializer._fromJsonObject(e.config);case`svix`:return b.SvixConfigSerializer._fromJsonObject(e.config);case`zoom`:return E.ZoomConfigSerializer._fromJsonObject(e.config);case`tailscale`:return x.TailscaleConfigSerializer._fromJsonObject(e.config);case`telnyx`:return S.TelnyxConfigSerializer._fromJsonObject(e.config);case`vapi`:return C.VapiConfigSerializer._fromJsonObject(e.config);case`open-ai`:return b.SvixConfigSerializer._fromJsonObject(e.config);case`render`:return b.SvixConfigSerializer._fromJsonObject(e.config);case`veriff`:return w.VeriffConfigSerializer._fromJsonObject(e.config);case`airwallex`:return n.AirwallexConfigSerializer._fromJsonObject(e.config);case`vgs`:return T.VgsConfigSerializer._fromJsonObject(e.config);default:throw Error(`Unexpected type: ${D}`)}}return{type:D,config:ee(D),metadata:e.metadata,name:e.name,uid:e.uid}},_toJsonObject(e){let D;switch(e.type){case`generic-webhook`:D={};break;case`cron`:D=i.CronConfigSerializer._toJsonObject(e.config);break;case`adobe-sign`:D=t.AdobeSignConfigSerializer._toJsonObject(e.config);break;case`beehiiv`:D=b.SvixConfigSerializer._toJsonObject(e.config);break;case`brex`:D=b.SvixConfigSerializer._toJsonObject(e.config);break;case`checkbook`:D=r.CheckbookConfigSerializer._toJsonObject(e.config);break;case`clerk`:D=b.SvixConfigSerializer._toJsonObject(e.config);break;case`docusign`:D=a.DocusignConfigSerializer._toJsonObject(e.config);break;case`easypost`:D=o.EasypostConfigSerializer._toJsonObject(e.config);break;case`github`:D=s.GithubConfigSerializer._toJsonObject(e.config);break;case`guesty`:D=b.SvixConfigSerializer._toJsonObject(e.config);break;case`hubspot`:D=c.HubspotConfigSerializer._toJsonObject(e.config);break;case`incident-io`:D=b.SvixConfigSerializer._toJsonObject(e.config);break;case`lithic`:D=b.SvixConfigSerializer._toJsonObject(e.config);break;case`meta`:D=l.MetaConfigSerializer._toJsonObject(e.config);break;case`nango`:D=u.NangoConfigSerializer._toJsonObject(e.config);break;case`nash`:D=b.SvixConfigSerializer._toJsonObject(e.config);break;case`openclaw`:D=d.OpenClawConfigSerializer._toJsonObject(e.config);break;case`orum-io`:D=f.OrumIoConfigSerializer._toJsonObject(e.config);break;case`panda-doc`:D=p.PandaDocConfigSerializer._toJsonObject(e.config);break;case`port-io`:D=m.PortIoConfigSerializer._toJsonObject(e.config);break;case`pleo`:D=b.SvixConfigSerializer._toJsonObject(e.config);break;case`psi-fi`:D=b.SvixConfigSerializer._toJsonObject(e.config);break;case`replicate`:D=b.SvixConfigSerializer._toJsonObject(e.config);break;case`resend`:D=b.SvixConfigSerializer._toJsonObject(e.config);break;case`rutter`:D=h.RutterConfigSerializer._toJsonObject(e.config);break;case`safebase`:D=b.SvixConfigSerializer._toJsonObject(e.config);break;case`sardine`:D=b.SvixConfigSerializer._toJsonObject(e.config);break;case`segment`:D=g.SegmentConfigSerializer._toJsonObject(e.config);break;case`shopify`:D=_.ShopifyConfigSerializer._toJsonObject(e.config);break;case`slack`:D=v.SlackConfigSerializer._toJsonObject(e.config);break;case`stripe`:D=y.StripeConfigSerializer._toJsonObject(e.config);break;case`stych`:D=b.SvixConfigSerializer._toJsonObject(e.config);break;case`svix`:D=b.SvixConfigSerializer._toJsonObject(e.config);break;case`zoom`:D=E.ZoomConfigSerializer._toJsonObject(e.config);break;case`tailscale`:D=x.TailscaleConfigSerializer._toJsonObject(e.config);break;case`telnyx`:D=S.TelnyxConfigSerializer._toJsonObject(e.config);break;case`vapi`:D=C.VapiConfigSerializer._toJsonObject(e.config);break;case`open-ai`:D=b.SvixConfigSerializer._toJsonObject(e.config);break;case`render`:D=b.SvixConfigSerializer._toJsonObject(e.config);break;case`veriff`:D=w.VeriffConfigSerializer._toJsonObject(e.config);break;case`airwallex`:D=n.AirwallexConfigSerializer._toJsonObject(e.config);break;case`vgs`:D=T.VgsConfigSerializer._toJsonObject(e.config)}return{type:e.type,config:D,metadata:e.metadata,name:e.name,uid:e.uid}}}})),PH=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.AdobeSignConfigOutSerializer=void 0,e.AdobeSignConfigOutSerializer={_fromJsonObject(e){return{}},_toJsonObject(e){return{}}}})),FH=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.AirwallexConfigOutSerializer=void 0,e.AirwallexConfigOutSerializer={_fromJsonObject(e){return{}},_toJsonObject(e){return{}}}})),IH=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.CheckbookConfigOutSerializer=void 0,e.CheckbookConfigOutSerializer={_fromJsonObject(e){return{}},_toJsonObject(e){return{}}}})),LH=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.DocusignConfigOutSerializer=void 0,e.DocusignConfigOutSerializer={_fromJsonObject(e){return{}},_toJsonObject(e){return{}}}})),RH=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.EasypostConfigOutSerializer=void 0,e.EasypostConfigOutSerializer={_fromJsonObject(e){return{}},_toJsonObject(e){return{}}}})),zH=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.GithubConfigOutSerializer=void 0,e.GithubConfigOutSerializer={_fromJsonObject(e){return{}},_toJsonObject(e){return{}}}})),BH=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.HubspotConfigOutSerializer=void 0,e.HubspotConfigOutSerializer={_fromJsonObject(e){return{}},_toJsonObject(e){return{}}}})),VH=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.MetaConfigOutSerializer=void 0,e.MetaConfigOutSerializer={_fromJsonObject(e){return{}},_toJsonObject(e){return{}}}})),HH=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.NangoConfigOutSerializer=void 0,e.NangoConfigOutSerializer={_fromJsonObject(e){return{}},_toJsonObject(e){return{}}}})),UH=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.OpenClawConfigOutSerializer=void 0,e.OpenClawConfigOutSerializer={_fromJsonObject(e){return{}},_toJsonObject(e){return{}}}})),WH=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.OrumIoConfigOutSerializer=void 0,e.OrumIoConfigOutSerializer={_fromJsonObject(e){return{publicKey:e.publicKey}},_toJsonObject(e){return{publicKey:e.publicKey}}}})),GH=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.PandaDocConfigOutSerializer=void 0,e.PandaDocConfigOutSerializer={_fromJsonObject(e){return{}},_toJsonObject(e){return{}}}})),KH=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.PortIoConfigOutSerializer=void 0,e.PortIoConfigOutSerializer={_fromJsonObject(e){return{}},_toJsonObject(e){return{}}}})),qH=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.RutterConfigOutSerializer=void 0,e.RutterConfigOutSerializer={_fromJsonObject(e){return{}},_toJsonObject(e){return{}}}})),JH=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.SegmentConfigOutSerializer=void 0,e.SegmentConfigOutSerializer={_fromJsonObject(e){return{}},_toJsonObject(e){return{}}}})),YH=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.ShopifyConfigOutSerializer=void 0,e.ShopifyConfigOutSerializer={_fromJsonObject(e){return{}},_toJsonObject(e){return{}}}})),XH=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.SlackConfigOutSerializer=void 0,e.SlackConfigOutSerializer={_fromJsonObject(e){return{}},_toJsonObject(e){return{}}}})),ZH=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.StripeConfigOutSerializer=void 0,e.StripeConfigOutSerializer={_fromJsonObject(e){return{}},_toJsonObject(e){return{}}}})),QH=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.SvixConfigOutSerializer=void 0,e.SvixConfigOutSerializer={_fromJsonObject(e){return{}},_toJsonObject(e){return{}}}})),$H=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.TailscaleConfigOutSerializer=void 0,e.TailscaleConfigOutSerializer={_fromJsonObject(e){return{}},_toJsonObject(e){return{}}}})),eU=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.TelnyxConfigOutSerializer=void 0,e.TelnyxConfigOutSerializer={_fromJsonObject(e){return{publicKey:e.publicKey}},_toJsonObject(e){return{publicKey:e.publicKey}}}})),tU=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.VapiConfigOutSerializer=void 0,e.VapiConfigOutSerializer={_fromJsonObject(e){return{}},_toJsonObject(e){return{}}}})),nU=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.VeriffConfigOutSerializer=void 0,e.VeriffConfigOutSerializer={_fromJsonObject(e){return{}},_toJsonObject(e){return{}}}})),rU=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.VgsConfigOutSerializer=void 0,e.VgsConfigOutSerializer={_fromJsonObject(e){return{}},_toJsonObject(e){return{}}}})),iU=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.ZoomConfigOutSerializer=void 0,e.ZoomConfigOutSerializer={_fromJsonObject(e){return{}},_toJsonObject(e){return{}}}})),aU=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.IngestSourceOutSerializer=void 0;var t=PH(),n=FH(),r=IH(),i=uH(),a=LH(),o=RH(),s=zH(),c=BH(),l=VH(),u=HH(),d=UH(),f=WH(),p=GH(),m=KH(),h=qH(),g=JH(),_=YH(),v=XH(),y=ZH(),b=QH(),x=$H(),S=eU(),C=tU(),w=nU(),T=rU(),E=iU();e.IngestSourceOutSerializer={_fromJsonObject(e){let D=e.type;function ee(D){switch(D){case`generic-webhook`:return{};case`cron`:return i.CronConfigSerializer._fromJsonObject(e.config);case`adobe-sign`:return t.AdobeSignConfigOutSerializer._fromJsonObject(e.config);case`beehiiv`:return b.SvixConfigOutSerializer._fromJsonObject(e.config);case`brex`:return b.SvixConfigOutSerializer._fromJsonObject(e.config);case`checkbook`:return r.CheckbookConfigOutSerializer._fromJsonObject(e.config);case`clerk`:return b.SvixConfigOutSerializer._fromJsonObject(e.config);case`docusign`:return a.DocusignConfigOutSerializer._fromJsonObject(e.config);case`easypost`:return o.EasypostConfigOutSerializer._fromJsonObject(e.config);case`github`:return s.GithubConfigOutSerializer._fromJsonObject(e.config);case`guesty`:return b.SvixConfigOutSerializer._fromJsonObject(e.config);case`hubspot`:return c.HubspotConfigOutSerializer._fromJsonObject(e.config);case`incident-io`:return b.SvixConfigOutSerializer._fromJsonObject(e.config);case`lithic`:return b.SvixConfigOutSerializer._fromJsonObject(e.config);case`meta`:return l.MetaConfigOutSerializer._fromJsonObject(e.config);case`nango`:return u.NangoConfigOutSerializer._fromJsonObject(e.config);case`nash`:return b.SvixConfigOutSerializer._fromJsonObject(e.config);case`openclaw`:return d.OpenClawConfigOutSerializer._fromJsonObject(e.config);case`orum-io`:return f.OrumIoConfigOutSerializer._fromJsonObject(e.config);case`panda-doc`:return p.PandaDocConfigOutSerializer._fromJsonObject(e.config);case`port-io`:return m.PortIoConfigOutSerializer._fromJsonObject(e.config);case`psi-fi`:return b.SvixConfigOutSerializer._fromJsonObject(e.config);case`pleo`:return b.SvixConfigOutSerializer._fromJsonObject(e.config);case`replicate`:return b.SvixConfigOutSerializer._fromJsonObject(e.config);case`resend`:return b.SvixConfigOutSerializer._fromJsonObject(e.config);case`rutter`:return h.RutterConfigOutSerializer._fromJsonObject(e.config);case`safebase`:return b.SvixConfigOutSerializer._fromJsonObject(e.config);case`sardine`:return b.SvixConfigOutSerializer._fromJsonObject(e.config);case`segment`:return g.SegmentConfigOutSerializer._fromJsonObject(e.config);case`shopify`:return _.ShopifyConfigOutSerializer._fromJsonObject(e.config);case`slack`:return v.SlackConfigOutSerializer._fromJsonObject(e.config);case`stripe`:return y.StripeConfigOutSerializer._fromJsonObject(e.config);case`stych`:return b.SvixConfigOutSerializer._fromJsonObject(e.config);case`svix`:return b.SvixConfigOutSerializer._fromJsonObject(e.config);case`zoom`:return E.ZoomConfigOutSerializer._fromJsonObject(e.config);case`tailscale`:return x.TailscaleConfigOutSerializer._fromJsonObject(e.config);case`telnyx`:return S.TelnyxConfigOutSerializer._fromJsonObject(e.config);case`vapi`:return C.VapiConfigOutSerializer._fromJsonObject(e.config);case`open-ai`:return b.SvixConfigOutSerializer._fromJsonObject(e.config);case`render`:return b.SvixConfigOutSerializer._fromJsonObject(e.config);case`veriff`:return w.VeriffConfigOutSerializer._fromJsonObject(e.config);case`airwallex`:return n.AirwallexConfigOutSerializer._fromJsonObject(e.config);case`vgs`:return T.VgsConfigOutSerializer._fromJsonObject(e.config);default:throw Error(`Unexpected type: ${D}`)}}return{type:D,config:ee(D),createdAt:new Date(e.createdAt),id:e.id,ingestUrl:e.ingestUrl,metadata:e.metadata,name:e.name,uid:e.uid,updatedAt:new Date(e.updatedAt)}},_toJsonObject(e){let D;switch(e.type){case`generic-webhook`:D={};break;case`cron`:D=i.CronConfigSerializer._toJsonObject(e.config);break;case`adobe-sign`:D=t.AdobeSignConfigOutSerializer._toJsonObject(e.config);break;case`beehiiv`:D=b.SvixConfigOutSerializer._toJsonObject(e.config);break;case`brex`:D=b.SvixConfigOutSerializer._toJsonObject(e.config);break;case`checkbook`:D=r.CheckbookConfigOutSerializer._toJsonObject(e.config);break;case`clerk`:D=b.SvixConfigOutSerializer._toJsonObject(e.config);break;case`docusign`:D=a.DocusignConfigOutSerializer._toJsonObject(e.config);break;case`easypost`:D=o.EasypostConfigOutSerializer._toJsonObject(e.config);break;case`github`:D=s.GithubConfigOutSerializer._toJsonObject(e.config);break;case`guesty`:D=b.SvixConfigOutSerializer._toJsonObject(e.config);break;case`hubspot`:D=c.HubspotConfigOutSerializer._toJsonObject(e.config);break;case`incident-io`:D=b.SvixConfigOutSerializer._toJsonObject(e.config);break;case`lithic`:D=b.SvixConfigOutSerializer._toJsonObject(e.config);break;case`meta`:D=l.MetaConfigOutSerializer._toJsonObject(e.config);break;case`nango`:D=u.NangoConfigOutSerializer._toJsonObject(e.config);break;case`nash`:D=b.SvixConfigOutSerializer._toJsonObject(e.config);break;case`openclaw`:D=d.OpenClawConfigOutSerializer._toJsonObject(e.config);break;case`orum-io`:D=f.OrumIoConfigOutSerializer._toJsonObject(e.config);break;case`panda-doc`:D=p.PandaDocConfigOutSerializer._toJsonObject(e.config);break;case`port-io`:D=m.PortIoConfigOutSerializer._toJsonObject(e.config);break;case`psi-fi`:D=b.SvixConfigOutSerializer._toJsonObject(e.config);break;case`pleo`:D=b.SvixConfigOutSerializer._toJsonObject(e.config);break;case`replicate`:D=b.SvixConfigOutSerializer._toJsonObject(e.config);break;case`resend`:D=b.SvixConfigOutSerializer._toJsonObject(e.config);break;case`rutter`:D=h.RutterConfigOutSerializer._toJsonObject(e.config);break;case`safebase`:D=b.SvixConfigOutSerializer._toJsonObject(e.config);break;case`sardine`:D=b.SvixConfigOutSerializer._toJsonObject(e.config);break;case`segment`:D=g.SegmentConfigOutSerializer._toJsonObject(e.config);break;case`shopify`:D=_.ShopifyConfigOutSerializer._toJsonObject(e.config);break;case`slack`:D=v.SlackConfigOutSerializer._toJsonObject(e.config);break;case`stripe`:D=y.StripeConfigOutSerializer._toJsonObject(e.config);break;case`stych`:D=b.SvixConfigOutSerializer._toJsonObject(e.config);break;case`svix`:D=b.SvixConfigOutSerializer._toJsonObject(e.config);break;case`zoom`:D=E.ZoomConfigOutSerializer._toJsonObject(e.config);break;case`tailscale`:D=x.TailscaleConfigOutSerializer._toJsonObject(e.config);break;case`telnyx`:D=S.TelnyxConfigOutSerializer._toJsonObject(e.config);break;case`vapi`:D=C.VapiConfigOutSerializer._toJsonObject(e.config);break;case`open-ai`:D=b.SvixConfigOutSerializer._toJsonObject(e.config);break;case`render`:D=b.SvixConfigOutSerializer._toJsonObject(e.config);break;case`veriff`:D=w.VeriffConfigOutSerializer._toJsonObject(e.config);break;case`airwallex`:D=n.AirwallexConfigOutSerializer._toJsonObject(e.config);break;case`vgs`:D=T.VgsConfigOutSerializer._toJsonObject(e.config)}return{type:e.type,config:D,createdAt:e.createdAt,id:e.id,ingestUrl:e.ingestUrl,metadata:e.metadata,name:e.name,uid:e.uid,updatedAt:e.updatedAt}}}})),oU=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.ListResponseIngestSourceOutSerializer=void 0;var t=aU();e.ListResponseIngestSourceOutSerializer={_fromJsonObject(e){return{data:e.data.map(e=>t.IngestSourceOutSerializer._fromJsonObject(e)),done:e.done,iterator:e.iterator,prevIterator:e.prevIterator}},_toJsonObject(e){return{data:e.data.map(e=>t.IngestSourceOutSerializer._toJsonObject(e)),done:e.done,iterator:e.iterator,prevIterator:e.prevIterator}}}})),sU=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.RotateTokenOutSerializer=void 0,e.RotateTokenOutSerializer={_fromJsonObject(e){return{ingestUrl:e.ingestUrl}},_toJsonObject(e){return{ingestUrl:e.ingestUrl}}}})),cU=i(((e,t,n)=>{var r=n&&n.__awaiter||function(e,t,n,r){function i(e){return e instanceof n?e:new n(function(t){t(e)})}return new(n||=Promise)(function(n,a){function o(e){try{c(r.next(e))}catch(e){a(e)}}function s(e){try{c(r.throw(e))}catch(e){a(e)}}function c(e){e.done?n(e.value):i(e.value).then(o,s)}c((r=r.apply(e,t||[])).next())})};Object.defineProperty(e,"__esModule",{value:!0}),e.IngestSource=void 0;var i=NH(),a=aU(),o=oU(),s=sU(),c=BB();e.IngestSource=class{constructor(e){this.requestCtx=e}list(e){return r(this,void 0,void 0,function*(){let t=new c.SvixRequest(c.HttpMethod.GET,`/ingest/api/v1/source`);return t.setQueryParams({limit:e?.limit,iterator:e?.iterator,order:e?.order}),yield t.send(this.requestCtx,o.ListResponseIngestSourceOutSerializer._fromJsonObject)})}create(e,t){return r(this,void 0,void 0,function*(){let n=new c.SvixRequest(c.HttpMethod.POST,`/ingest/api/v1/source`);return n.setHeaderParam(`idempotency-key`,t?.idempotencyKey),n.setBody(i.IngestSourceInSerializer._toJsonObject(e)),yield n.send(this.requestCtx,a.IngestSourceOutSerializer._fromJsonObject)})}get(e){return r(this,void 0,void 0,function*(){let t=new c.SvixRequest(c.HttpMethod.GET,`/ingest/api/v1/source/{source_id}`);return t.setPathParam(`source_id`,e),yield t.send(this.requestCtx,a.IngestSourceOutSerializer._fromJsonObject)})}update(e,t){return r(this,void 0,void 0,function*(){let n=new c.SvixRequest(c.HttpMethod.PUT,`/ingest/api/v1/source/{source_id}`);return n.setPathParam(`source_id`,e),n.setBody(i.IngestSourceInSerializer._toJsonObject(t)),yield n.send(this.requestCtx,a.IngestSourceOutSerializer._fromJsonObject)})}delete(e){return r(this,void 0,void 0,function*(){let t=new c.SvixRequest(c.HttpMethod.DELETE,`/ingest/api/v1/source/{source_id}`);return t.setPathParam(`source_id`,e),yield t.sendNoResponseBody(this.requestCtx)})}rotateToken(e,t){return r(this,void 0,void 0,function*(){let n=new c.SvixRequest(c.HttpMethod.POST,`/ingest/api/v1/source/{source_id}/token/rotate`);return n.setPathParam(`source_id`,e),n.setHeaderParam(`idempotency-key`,t?.idempotencyKey),yield n.send(this.requestCtx,s.RotateTokenOutSerializer._fromJsonObject)})}}})),lU=i(((e,t,n)=>{var r=n&&n.__awaiter||function(e,t,n,r){function i(e){return e instanceof n?e:new n(function(t){t(e)})}return new(n||=Promise)(function(n,a){function o(e){try{c(r.next(e))}catch(e){a(e)}}function s(e){try{c(r.throw(e))}catch(e){a(e)}}function c(e){e.done?n(e.value):i(e.value).then(o,s)}c((r=r.apply(e,t||[])).next())})};Object.defineProperty(e,"__esModule",{value:!0}),e.Ingest=void 0;var i=XB(),a=YV(),o=oH(),s=cU(),c=BB();e.Ingest=class{constructor(e){this.requestCtx=e}get endpoint(){return new o.IngestEndpoint(this.requestCtx)}get source(){return new s.IngestSource(this.requestCtx)}dashboard(e,t={},n){return r(this,void 0,void 0,function*(){let r=new c.SvixRequest(c.HttpMethod.POST,`/ingest/api/v1/source/{source_id}/dashboard`);return r.setPathParam(`source_id`,e),r.setHeaderParam(`idempotency-key`,n?.idempotencyKey),r.setBody(a.IngestSourceConsumerPortalAccessInSerializer._toJsonObject(t)),yield r.send(this.requestCtx,i.DashboardAccessOutSerializer._fromJsonObject)})}}})),uU=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.IntegrationInSerializer=void 0,e.IntegrationInSerializer={_fromJsonObject(e){return{featureFlags:e.featureFlags,name:e.name}},_toJsonObject(e){return{featureFlags:e.featureFlags,name:e.name}}}})),dU=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.IntegrationKeyOutSerializer=void 0,e.IntegrationKeyOutSerializer={_fromJsonObject(e){return{key:e.key}},_toJsonObject(e){return{key:e.key}}}})),fU=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.IntegrationOutSerializer=void 0,e.IntegrationOutSerializer={_fromJsonObject(e){return{createdAt:new Date(e.createdAt),featureFlags:e.featureFlags,id:e.id,name:e.name,updatedAt:new Date(e.updatedAt)}},_toJsonObject(e){return{createdAt:e.createdAt,featureFlags:e.featureFlags,id:e.id,name:e.name,updatedAt:e.updatedAt}}}})),pU=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.IntegrationUpdateSerializer=void 0,e.IntegrationUpdateSerializer={_fromJsonObject(e){return{featureFlags:e.featureFlags,name:e.name}},_toJsonObject(e){return{featureFlags:e.featureFlags,name:e.name}}}})),mU=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.ListResponseIntegrationOutSerializer=void 0;var t=fU();e.ListResponseIntegrationOutSerializer={_fromJsonObject(e){return{data:e.data.map(e=>t.IntegrationOutSerializer._fromJsonObject(e)),done:e.done,iterator:e.iterator,prevIterator:e.prevIterator}},_toJsonObject(e){return{data:e.data.map(e=>t.IntegrationOutSerializer._toJsonObject(e)),done:e.done,iterator:e.iterator,prevIterator:e.prevIterator}}}})),hU=i(((e,t,n)=>{var r=n&&n.__awaiter||function(e,t,n,r){function i(e){return e instanceof n?e:new n(function(t){t(e)})}return new(n||=Promise)(function(n,a){function o(e){try{c(r.next(e))}catch(e){a(e)}}function s(e){try{c(r.throw(e))}catch(e){a(e)}}function c(e){e.done?n(e.value):i(e.value).then(o,s)}c((r=r.apply(e,t||[])).next())})};Object.defineProperty(e,"__esModule",{value:!0}),e.Integration=void 0;var i=uU(),a=dU(),o=fU(),s=pU(),c=mU(),l=BB();e.Integration=class{constructor(e){this.requestCtx=e}list(e,t){return r(this,void 0,void 0,function*(){let n=new l.SvixRequest(l.HttpMethod.GET,`/api/v1/app/{app_id}/integration`);return n.setPathParam(`app_id`,e),n.setQueryParams({limit:t?.limit,iterator:t?.iterator,order:t?.order}),yield n.send(this.requestCtx,c.ListResponseIntegrationOutSerializer._fromJsonObject)})}create(e,t,n){return r(this,void 0,void 0,function*(){let r=new l.SvixRequest(l.HttpMethod.POST,`/api/v1/app/{app_id}/integration`);return r.setPathParam(`app_id`,e),r.setHeaderParam(`idempotency-key`,n?.idempotencyKey),r.setBody(i.IntegrationInSerializer._toJsonObject(t)),yield r.send(this.requestCtx,o.IntegrationOutSerializer._fromJsonObject)})}get(e,t){return r(this,void 0,void 0,function*(){let n=new l.SvixRequest(l.HttpMethod.GET,`/api/v1/app/{app_id}/integration/{integ_id}`);return n.setPathParam(`app_id`,e),n.setPathParam(`integ_id`,t),yield n.send(this.requestCtx,o.IntegrationOutSerializer._fromJsonObject)})}update(e,t,n){return r(this,void 0,void 0,function*(){let r=new l.SvixRequest(l.HttpMethod.PUT,`/api/v1/app/{app_id}/integration/{integ_id}`);return r.setPathParam(`app_id`,e),r.setPathParam(`integ_id`,t),r.setBody(s.IntegrationUpdateSerializer._toJsonObject(n)),yield r.send(this.requestCtx,o.IntegrationOutSerializer._fromJsonObject)})}delete(e,t){return r(this,void 0,void 0,function*(){let n=new l.SvixRequest(l.HttpMethod.DELETE,`/api/v1/app/{app_id}/integration/{integ_id}`);return n.setPathParam(`app_id`,e),n.setPathParam(`integ_id`,t),yield n.sendNoResponseBody(this.requestCtx)})}rotateKey(e,t,n){return r(this,void 0,void 0,function*(){let r=new l.SvixRequest(l.HttpMethod.POST,`/api/v1/app/{app_id}/integration/{integ_id}/key/rotate`);return r.setPathParam(`app_id`,e),r.setPathParam(`integ_id`,t),r.setHeaderParam(`idempotency-key`,n?.idempotencyKey),yield r.send(this.requestCtx,a.IntegrationKeyOutSerializer._fromJsonObject)})}getKey(e,t){return r(this,void 0,void 0,function*(){let n=new l.SvixRequest(l.HttpMethod.GET,`/api/v1/app/{app_id}/integration/{integ_id}/key`);return n.setPathParam(`app_id`,e),n.setPathParam(`integ_id`,t),yield n.send(this.requestCtx,a.IntegrationKeyOutSerializer._fromJsonObject)})}}})),gU=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.ExpungeAllContentsOutSerializer=void 0;var t=QB(),n=$B();e.ExpungeAllContentsOutSerializer={_fromJsonObject(e){return{id:e.id,status:t.BackgroundTaskStatusSerializer._fromJsonObject(e.status),task:n.BackgroundTaskTypeSerializer._fromJsonObject(e.task),updatedAt:new Date(e.updatedAt)}},_toJsonObject(e){return{id:e.id,status:t.BackgroundTaskStatusSerializer._toJsonObject(e.status),task:n.BackgroundTaskTypeSerializer._toJsonObject(e.task),updatedAt:e.updatedAt}}}})),_U=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.ListResponseMessageOutSerializer=void 0;var t=kV();e.ListResponseMessageOutSerializer={_fromJsonObject(e){return{data:e.data.map(e=>t.MessageOutSerializer._fromJsonObject(e)),done:e.done,iterator:e.iterator,prevIterator:e.prevIterator}},_toJsonObject(e){return{data:e.data.map(e=>t.MessageOutSerializer._toJsonObject(e)),done:e.done,iterator:e.iterator,prevIterator:e.prevIterator}}}})),vU=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.MessagePrecheckInSerializer=void 0,e.MessagePrecheckInSerializer={_fromJsonObject(e){return{channels:e.channels,eventType:e.eventType}},_toJsonObject(e){return{channels:e.channels,eventType:e.eventType}}}})),yU=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.MessagePrecheckOutSerializer=void 0,e.MessagePrecheckOutSerializer={_fromJsonObject(e){return{active:e.active}},_toJsonObject(e){return{active:e.active}}}})),bU=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.PollingEndpointConsumerSeekInSerializer=void 0,e.PollingEndpointConsumerSeekInSerializer={_fromJsonObject(e){return{after:new Date(e.after)}},_toJsonObject(e){return{after:e.after}}}})),xU=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.PollingEndpointConsumerSeekOutSerializer=void 0,e.PollingEndpointConsumerSeekOutSerializer={_fromJsonObject(e){return{iterator:e.iterator}},_toJsonObject(e){return{iterator:e.iterator}}}})),SU=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.PollingEndpointMessageOutSerializer=void 0,e.PollingEndpointMessageOutSerializer={_fromJsonObject(e){return{channels:e.channels,deliverAt:e.deliverAt?new Date(e.deliverAt):null,eventId:e.eventId,eventType:e.eventType,headers:e.headers,id:e.id,payload:e.payload,tags:e.tags,timestamp:new Date(e.timestamp)}},_toJsonObject(e){return{channels:e.channels,deliverAt:e.deliverAt,eventId:e.eventId,eventType:e.eventType,headers:e.headers,id:e.id,payload:e.payload,tags:e.tags,timestamp:e.timestamp}}}})),CU=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.PollingEndpointOutSerializer=void 0;var t=SU();e.PollingEndpointOutSerializer={_fromJsonObject(e){return{data:e.data.map(e=>t.PollingEndpointMessageOutSerializer._fromJsonObject(e)),done:e.done,iterator:e.iterator}},_toJsonObject(e){return{data:e.data.map(e=>t.PollingEndpointMessageOutSerializer._toJsonObject(e)),done:e.done,iterator:e.iterator}}}})),wU=i(((e,t,n)=>{var r=n&&n.__awaiter||function(e,t,n,r){function i(e){return e instanceof n?e:new n(function(t){t(e)})}return new(n||=Promise)(function(n,a){function o(e){try{c(r.next(e))}catch(e){a(e)}}function s(e){try{c(r.throw(e))}catch(e){a(e)}}function c(e){e.done?n(e.value):i(e.value).then(o,s)}c((r=r.apply(e,t||[])).next())})};Object.defineProperty(e,"__esModule",{value:!0}),e.MessagePoller=void 0;var i=bU(),a=xU(),o=CU(),s=BB();e.MessagePoller=class{constructor(e){this.requestCtx=e}poll(e,t,n){return r(this,void 0,void 0,function*(){let r=new s.SvixRequest(s.HttpMethod.GET,`/api/v1/app/{app_id}/poller/{sink_id}`);return r.setPathParam(`app_id`,e),r.setPathParam(`sink_id`,t),r.setQueryParams({limit:n?.limit,iterator:n?.iterator,event_type:n?.eventType,channel:n?.channel,after:n?.after}),yield r.send(this.requestCtx,o.PollingEndpointOutSerializer._fromJsonObject)})}consumerSeek(e,t,n,o,c){return r(this,void 0,void 0,function*(){let r=new s.SvixRequest(s.HttpMethod.POST,`/api/v1/app/{app_id}/poller/{sink_id}/consumer/{consumer_id}/seek`);return r.setPathParam(`app_id`,e),r.setPathParam(`sink_id`,t),r.setPathParam(`consumer_id`,n),r.setHeaderParam(`idempotency-key`,c?.idempotencyKey),r.setBody(i.PollingEndpointConsumerSeekInSerializer._toJsonObject(o)),yield r.send(this.requestCtx,a.PollingEndpointConsumerSeekOutSerializer._fromJsonObject)})}consumerPoll(e,t,n,i){return r(this,void 0,void 0,function*(){let r=new s.SvixRequest(s.HttpMethod.GET,`/api/v1/app/{app_id}/poller/{sink_id}/consumer/{consumer_id}`);return r.setPathParam(`app_id`,e),r.setPathParam(`sink_id`,t),r.setPathParam(`consumer_id`,n),r.setQueryParams({limit:i?.limit,iterator:i?.iterator}),yield r.send(this.requestCtx,o.PollingEndpointOutSerializer._fromJsonObject)})}}})),TU=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.MessageInSerializer=void 0;var t=FB();e.MessageInSerializer={_fromJsonObject(e){return{application:e.application==null?void 0:t.ApplicationInSerializer._fromJsonObject(e.application),channels:e.channels,deliverAt:e.deliverAt?new Date(e.deliverAt):null,eventId:e.eventId,eventType:e.eventType,payload:e.payload,payloadRetentionHours:e.payloadRetentionHours,payloadRetentionPeriod:e.payloadRetentionPeriod,tags:e.tags,transformationsParams:e.transformationsParams}},_toJsonObject(e){return{application:e.application==null?void 0:t.ApplicationInSerializer._toJsonObject(e.application),channels:e.channels,deliverAt:e.deliverAt,eventId:e.eventId,eventType:e.eventType,payload:e.payload,payloadRetentionHours:e.payloadRetentionHours,payloadRetentionPeriod:e.payloadRetentionPeriod,tags:e.tags,transformationsParams:e.transformationsParams}}}})),EU=i(((e,t,n)=>{var r=n&&n.__awaiter||function(e,t,n,r){function i(e){return e instanceof n?e:new n(function(t){t(e)})}return new(n||=Promise)(function(n,a){function o(e){try{c(r.next(e))}catch(e){a(e)}}function s(e){try{c(r.throw(e))}catch(e){a(e)}}function c(e){e.done?n(e.value):i(e.value).then(o,s)}c((r=r.apply(e,t||[])).next())})};Object.defineProperty(e,"__esModule",{value:!0}),e.messageInRaw=e.Message=void 0;var i=gU(),a=_U(),o=kV(),s=vU(),c=yU(),l=wU(),u=BB(),d=TU();e.Message=class{constructor(e){this.requestCtx=e}get poller(){return new l.MessagePoller(this.requestCtx)}list(e,t){return r(this,void 0,void 0,function*(){let n=new u.SvixRequest(u.HttpMethod.GET,`/api/v1/app/{app_id}/msg`);return n.setPathParam(`app_id`,e),n.setQueryParams({limit:t?.limit,iterator:t?.iterator,channel:t?.channel,before:t?.before,after:t?.after,with_content:t?.withContent,tag:t?.tag,event_types:t?.eventTypes}),yield n.send(this.requestCtx,a.ListResponseMessageOutSerializer._fromJsonObject)})}create(e,t,n){return r(this,void 0,void 0,function*(){let r=new u.SvixRequest(u.HttpMethod.POST,`/api/v1/app/{app_id}/msg`);r.setPathParam(`app_id`,e),r.setQueryParams({with_content:!1}),r.setHeaderParam(`idempotency-key`,n?.idempotencyKey),r.setBody(d.MessageInSerializer._toJsonObject(t));let i=yield r.send(this.requestCtx,o.MessageOutSerializer._fromJsonObject);return(n?.withContent??!0)&&(i.payload=t.payload),i})}precheck(e,t,n){return r(this,void 0,void 0,function*(){let r=new u.SvixRequest(u.HttpMethod.POST,`/api/v1/app/{app_id}/msg/precheck/active`);return r.setPathParam(`app_id`,e),r.setHeaderParam(`idempotency-key`,n?.idempotencyKey),r.setBody(s.MessagePrecheckInSerializer._toJsonObject(t)),yield r.send(this.requestCtx,c.MessagePrecheckOutSerializer._fromJsonObject)})}get(e,t,n){return r(this,void 0,void 0,function*(){let r=new u.SvixRequest(u.HttpMethod.GET,`/api/v1/app/{app_id}/msg/{msg_id}`);return r.setPathParam(`app_id`,e),r.setPathParam(`msg_id`,t),r.setQueryParams({with_content:n?.withContent}),yield r.send(this.requestCtx,o.MessageOutSerializer._fromJsonObject)})}expungeContent(e,t){return r(this,void 0,void 0,function*(){let n=new u.SvixRequest(u.HttpMethod.DELETE,`/api/v1/app/{app_id}/msg/{msg_id}/content`);return n.setPathParam(`app_id`,e),n.setPathParam(`msg_id`,t),yield n.sendNoResponseBody(this.requestCtx)})}expungeAllContents(e,t){return r(this,void 0,void 0,function*(){let n=new u.SvixRequest(u.HttpMethod.POST,`/api/v1/app/{app_id}/msg/expunge-all-contents`);return n.setPathParam(`app_id`,e),n.setHeaderParam(`idempotency-key`,t?.idempotencyKey),yield n.send(this.requestCtx,i.ExpungeAllContentsOutSerializer._fromJsonObject)})}};function f(e,t,n){return{eventType:e,payload:{},transformationsParams:{rawPayload:t,headers:n?{"content-type":n}:void 0}}}e.messageInRaw=f})),DU=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.EmptyResponseSerializer=void 0,e.EmptyResponseSerializer={_fromJsonObject(e){return{}},_toJsonObject(e){return{}}}})),OU=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.MessageStatusTextSerializer=e.MessageStatusText=void 0,(function(e){e.Success=`success`,e.Pending=`pending`,e.Fail=`fail`,e.Sending=`sending`,e.Canceled=`canceled`})(e.MessageStatusText||={}),e.MessageStatusTextSerializer={_fromJsonObject(e){return e},_toJsonObject(e){return e}}})),kU=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.EndpointMessageOutSerializer=void 0;var t=dV(),n=OU();e.EndpointMessageOutSerializer={_fromJsonObject(e){return{channels:e.channels,deliverAt:e.deliverAt?new Date(e.deliverAt):null,eventId:e.eventId,eventType:e.eventType,id:e.id,nextAttempt:e.nextAttempt?new Date(e.nextAttempt):null,payload:e.payload,status:t.MessageStatusSerializer._fromJsonObject(e.status),statusText:n.MessageStatusTextSerializer._fromJsonObject(e.statusText),tags:e.tags,timestamp:new Date(e.timestamp)}},_toJsonObject(e){return{channels:e.channels,deliverAt:e.deliverAt,eventId:e.eventId,eventType:e.eventType,id:e.id,nextAttempt:e.nextAttempt,payload:e.payload,status:t.MessageStatusSerializer._toJsonObject(e.status),statusText:n.MessageStatusTextSerializer._toJsonObject(e.statusText),tags:e.tags,timestamp:e.timestamp}}}})),AU=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.ListResponseEndpointMessageOutSerializer=void 0;var t=kU();e.ListResponseEndpointMessageOutSerializer={_fromJsonObject(e){return{data:e.data.map(e=>t.EndpointMessageOutSerializer._fromJsonObject(e)),done:e.done,iterator:e.iterator,prevIterator:e.prevIterator}},_toJsonObject(e){return{data:e.data.map(e=>t.EndpointMessageOutSerializer._toJsonObject(e)),done:e.done,iterator:e.iterator,prevIterator:e.prevIterator}}}})),jU=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.MessageAttemptTriggerTypeSerializer=e.MessageAttemptTriggerType=void 0,(function(e){e[e.Scheduled=0]=`Scheduled`,e[e.Manual=1]=`Manual`})(e.MessageAttemptTriggerType||={}),e.MessageAttemptTriggerTypeSerializer={_fromJsonObject(e){return e},_toJsonObject(e){return e}}})),MU=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.MessageAttemptOutSerializer=void 0;var t=jU(),n=kV(),r=dV(),i=OU();e.MessageAttemptOutSerializer={_fromJsonObject(e){return{endpointId:e.endpointId,id:e.id,msg:e.msg==null?void 0:n.MessageOutSerializer._fromJsonObject(e.msg),msgId:e.msgId,response:e.response,responseDurationMs:e.responseDurationMs,responseStatusCode:e.responseStatusCode,status:r.MessageStatusSerializer._fromJsonObject(e.status),statusText:i.MessageStatusTextSerializer._fromJsonObject(e.statusText),timestamp:new Date(e.timestamp),triggerType:t.MessageAttemptTriggerTypeSerializer._fromJsonObject(e.triggerType),url:e.url}},_toJsonObject(e){return{endpointId:e.endpointId,id:e.id,msg:e.msg==null?void 0:n.MessageOutSerializer._toJsonObject(e.msg),msgId:e.msgId,response:e.response,responseDurationMs:e.responseDurationMs,responseStatusCode:e.responseStatusCode,status:r.MessageStatusSerializer._toJsonObject(e.status),statusText:i.MessageStatusTextSerializer._toJsonObject(e.statusText),timestamp:e.timestamp,triggerType:t.MessageAttemptTriggerTypeSerializer._toJsonObject(e.triggerType),url:e.url}}}})),NU=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.ListResponseMessageAttemptOutSerializer=void 0;var t=MU();e.ListResponseMessageAttemptOutSerializer={_fromJsonObject(e){return{data:e.data.map(e=>t.MessageAttemptOutSerializer._fromJsonObject(e)),done:e.done,iterator:e.iterator,prevIterator:e.prevIterator}},_toJsonObject(e){return{data:e.data.map(e=>t.MessageAttemptOutSerializer._toJsonObject(e)),done:e.done,iterator:e.iterator,prevIterator:e.prevIterator}}}})),PU=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.MessageEndpointOutSerializer=void 0;var t=dV(),n=OU();e.MessageEndpointOutSerializer={_fromJsonObject(e){return{channels:e.channels,createdAt:new Date(e.createdAt),description:e.description,disabled:e.disabled,filterTypes:e.filterTypes,id:e.id,nextAttempt:e.nextAttempt?new Date(e.nextAttempt):null,rateLimit:e.rateLimit,status:t.MessageStatusSerializer._fromJsonObject(e.status),statusText:n.MessageStatusTextSerializer._fromJsonObject(e.statusText),throttleRate:e.throttleRate,uid:e.uid,updatedAt:new Date(e.updatedAt),url:e.url,version:e.version}},_toJsonObject(e){return{channels:e.channels,createdAt:e.createdAt,description:e.description,disabled:e.disabled,filterTypes:e.filterTypes,id:e.id,nextAttempt:e.nextAttempt,rateLimit:e.rateLimit,status:t.MessageStatusSerializer._toJsonObject(e.status),statusText:n.MessageStatusTextSerializer._toJsonObject(e.statusText),throttleRate:e.throttleRate,uid:e.uid,updatedAt:e.updatedAt,url:e.url,version:e.version}}}})),FU=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.ListResponseMessageEndpointOutSerializer=void 0;var t=PU();e.ListResponseMessageEndpointOutSerializer={_fromJsonObject(e){return{data:e.data.map(e=>t.MessageEndpointOutSerializer._fromJsonObject(e)),done:e.done,iterator:e.iterator,prevIterator:e.prevIterator}},_toJsonObject(e){return{data:e.data.map(e=>t.MessageEndpointOutSerializer._toJsonObject(e)),done:e.done,iterator:e.iterator,prevIterator:e.prevIterator}}}})),IU=i(((e,t,n)=>{var r=n&&n.__awaiter||function(e,t,n,r){function i(e){return e instanceof n?e:new n(function(t){t(e)})}return new(n||=Promise)(function(n,a){function o(e){try{c(r.next(e))}catch(e){a(e)}}function s(e){try{c(r.throw(e))}catch(e){a(e)}}function c(e){e.done?n(e.value):i(e.value).then(o,s)}c((r=r.apply(e,t||[])).next())})};Object.defineProperty(e,"__esModule",{value:!0}),e.MessageAttempt=void 0;var i=DU(),a=AU(),o=NU(),s=FU(),c=MU(),l=BB();e.MessageAttempt=class{constructor(e){this.requestCtx=e}listByEndpoint(e,t,n){return r(this,void 0,void 0,function*(){let r=new l.SvixRequest(l.HttpMethod.GET,`/api/v1/app/{app_id}/attempt/endpoint/{endpoint_id}`);return r.setPathParam(`app_id`,e),r.setPathParam(`endpoint_id`,t),r.setQueryParams({limit:n?.limit,iterator:n?.iterator,status:n?.status,status_code_class:n?.statusCodeClass,channel:n?.channel,tag:n?.tag,before:n?.before,after:n?.after,with_content:n?.withContent,with_msg:n?.withMsg,expanded_statuses:n?.expandedStatuses??!0,event_types:n?.eventTypes}),yield r.send(this.requestCtx,o.ListResponseMessageAttemptOutSerializer._fromJsonObject)})}listByMsg(e,t,n){return r(this,void 0,void 0,function*(){let r=new l.SvixRequest(l.HttpMethod.GET,`/api/v1/app/{app_id}/attempt/msg/{msg_id}`);return r.setPathParam(`app_id`,e),r.setPathParam(`msg_id`,t),r.setQueryParams({limit:n?.limit,iterator:n?.iterator,status:n?.status,status_code_class:n?.statusCodeClass,channel:n?.channel,tag:n?.tag,endpoint_id:n?.endpointId,before:n?.before,after:n?.after,with_content:n?.withContent,expanded_statuses:n?.expandedStatuses??!0,event_types:n?.eventTypes}),yield r.send(this.requestCtx,o.ListResponseMessageAttemptOutSerializer._fromJsonObject)})}listAttemptedMessages(e,t,n){return r(this,void 0,void 0,function*(){let r=new l.SvixRequest(l.HttpMethod.GET,`/api/v1/app/{app_id}/endpoint/{endpoint_id}/msg`);return r.setPathParam(`app_id`,e),r.setPathParam(`endpoint_id`,t),r.setQueryParams({limit:n?.limit,iterator:n?.iterator,channel:n?.channel,tag:n?.tag,status:n?.status,before:n?.before,after:n?.after,with_content:n?.withContent,expanded_statuses:n?.expandedStatuses??!0,event_types:n?.eventTypes}),yield r.send(this.requestCtx,a.ListResponseEndpointMessageOutSerializer._fromJsonObject)})}listAttemptedDestinations(e,t,n){return r(this,void 0,void 0,function*(){let r=new l.SvixRequest(l.HttpMethod.GET,`/api/v1/app/{app_id}/msg/{msg_id}/endpoint`);return r.setPathParam(`app_id`,e),r.setPathParam(`msg_id`,t),r.setQueryParams({limit:n?.limit,iterator:n?.iterator}),yield r.send(this.requestCtx,s.ListResponseMessageEndpointOutSerializer._fromJsonObject)})}get(e,t,n,i){return r(this,void 0,void 0,function*(){let r=new l.SvixRequest(l.HttpMethod.GET,`/api/v1/app/{app_id}/msg/{msg_id}/attempt/{attempt_id}`);return r.setPathParam(`app_id`,e),r.setPathParam(`msg_id`,t),r.setPathParam(`attempt_id`,n),r.setQueryParams({expanded_statuses:i?.expandedStatuses??!0}),yield r.send(this.requestCtx,c.MessageAttemptOutSerializer._fromJsonObject)})}expungeContent(e,t,n){return r(this,void 0,void 0,function*(){let r=new l.SvixRequest(l.HttpMethod.DELETE,`/api/v1/app/{app_id}/msg/{msg_id}/attempt/{attempt_id}/content`);return r.setPathParam(`app_id`,e),r.setPathParam(`msg_id`,t),r.setPathParam(`attempt_id`,n),yield r.sendNoResponseBody(this.requestCtx)})}resend(e,t,n,a){return r(this,void 0,void 0,function*(){let r=new l.SvixRequest(l.HttpMethod.POST,`/api/v1/app/{app_id}/msg/{msg_id}/endpoint/{endpoint_id}/resend`);return r.setPathParam(`app_id`,e),r.setPathParam(`msg_id`,t),r.setPathParam(`endpoint_id`,n),r.setHeaderParam(`idempotency-key`,a?.idempotencyKey),yield r.send(this.requestCtx,i.EmptyResponseSerializer._fromJsonObject)})}}})),LU=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.OperationalWebhookEndpointOutSerializer=void 0,e.OperationalWebhookEndpointOutSerializer={_fromJsonObject(e){return{createdAt:new Date(e.createdAt),description:e.description,disabled:e.disabled,filterTypes:e.filterTypes,id:e.id,metadata:e.metadata,rateLimit:e.rateLimit,throttleRate:e.throttleRate,uid:e.uid,updatedAt:new Date(e.updatedAt),url:e.url}},_toJsonObject(e){return{createdAt:e.createdAt,description:e.description,disabled:e.disabled,filterTypes:e.filterTypes,id:e.id,metadata:e.metadata,rateLimit:e.rateLimit,throttleRate:e.throttleRate,uid:e.uid,updatedAt:e.updatedAt,url:e.url}}}})),RU=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.ListResponseOperationalWebhookEndpointOutSerializer=void 0;var t=LU();e.ListResponseOperationalWebhookEndpointOutSerializer={_fromJsonObject(e){return{data:e.data.map(e=>t.OperationalWebhookEndpointOutSerializer._fromJsonObject(e)),done:e.done,iterator:e.iterator,prevIterator:e.prevIterator}},_toJsonObject(e){return{data:e.data.map(e=>t.OperationalWebhookEndpointOutSerializer._toJsonObject(e)),done:e.done,iterator:e.iterator,prevIterator:e.prevIterator}}}})),zU=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.OperationalWebhookEndpointHeadersInSerializer=void 0,e.OperationalWebhookEndpointHeadersInSerializer={_fromJsonObject(e){return{headers:e.headers}},_toJsonObject(e){return{headers:e.headers}}}})),BU=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.OperationalWebhookEndpointHeadersOutSerializer=void 0,e.OperationalWebhookEndpointHeadersOutSerializer={_fromJsonObject(e){return{headers:e.headers,sensitive:e.sensitive}},_toJsonObject(e){return{headers:e.headers,sensitive:e.sensitive}}}})),VU=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.OperationalWebhookEndpointInSerializer=void 0,e.OperationalWebhookEndpointInSerializer={_fromJsonObject(e){return{description:e.description,disabled:e.disabled,filterTypes:e.filterTypes,metadata:e.metadata,rateLimit:e.rateLimit,secret:e.secret,throttleRate:e.throttleRate,uid:e.uid,url:e.url}},_toJsonObject(e){return{description:e.description,disabled:e.disabled,filterTypes:e.filterTypes,metadata:e.metadata,rateLimit:e.rateLimit,secret:e.secret,throttleRate:e.throttleRate,uid:e.uid,url:e.url}}}})),HU=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.OperationalWebhookEndpointSecretInSerializer=void 0,e.OperationalWebhookEndpointSecretInSerializer={_fromJsonObject(e){return{key:e.key}},_toJsonObject(e){return{key:e.key}}}})),UU=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.OperationalWebhookEndpointSecretOutSerializer=void 0,e.OperationalWebhookEndpointSecretOutSerializer={_fromJsonObject(e){return{key:e.key}},_toJsonObject(e){return{key:e.key}}}})),WU=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.OperationalWebhookEndpointUpdateSerializer=void 0,e.OperationalWebhookEndpointUpdateSerializer={_fromJsonObject(e){return{description:e.description,disabled:e.disabled,filterTypes:e.filterTypes,metadata:e.metadata,rateLimit:e.rateLimit,throttleRate:e.throttleRate,uid:e.uid,url:e.url}},_toJsonObject(e){return{description:e.description,disabled:e.disabled,filterTypes:e.filterTypes,metadata:e.metadata,rateLimit:e.rateLimit,throttleRate:e.throttleRate,uid:e.uid,url:e.url}}}})),GU=i(((e,t,n)=>{var r=n&&n.__awaiter||function(e,t,n,r){function i(e){return e instanceof n?e:new n(function(t){t(e)})}return new(n||=Promise)(function(n,a){function o(e){try{c(r.next(e))}catch(e){a(e)}}function s(e){try{c(r.throw(e))}catch(e){a(e)}}function c(e){e.done?n(e.value):i(e.value).then(o,s)}c((r=r.apply(e,t||[])).next())})};Object.defineProperty(e,"__esModule",{value:!0}),e.OperationalWebhookEndpoint=void 0;var i=RU(),a=zU(),o=BU(),s=VU(),c=LU(),l=HU(),u=UU(),d=WU(),f=BB();e.OperationalWebhookEndpoint=class{constructor(e){this.requestCtx=e}list(e){return r(this,void 0,void 0,function*(){let t=new f.SvixRequest(f.HttpMethod.GET,`/api/v1/operational-webhook/endpoint`);return t.setQueryParams({limit:e?.limit,iterator:e?.iterator,order:e?.order}),yield t.send(this.requestCtx,i.ListResponseOperationalWebhookEndpointOutSerializer._fromJsonObject)})}create(e,t){return r(this,void 0,void 0,function*(){let n=new f.SvixRequest(f.HttpMethod.POST,`/api/v1/operational-webhook/endpoint`);return n.setHeaderParam(`idempotency-key`,t?.idempotencyKey),n.setBody(s.OperationalWebhookEndpointInSerializer._toJsonObject(e)),yield n.send(this.requestCtx,c.OperationalWebhookEndpointOutSerializer._fromJsonObject)})}get(e){return r(this,void 0,void 0,function*(){let t=new f.SvixRequest(f.HttpMethod.GET,`/api/v1/operational-webhook/endpoint/{endpoint_id}`);return t.setPathParam(`endpoint_id`,e),yield t.send(this.requestCtx,c.OperationalWebhookEndpointOutSerializer._fromJsonObject)})}update(e,t){return r(this,void 0,void 0,function*(){let n=new f.SvixRequest(f.HttpMethod.PUT,`/api/v1/operational-webhook/endpoint/{endpoint_id}`);return n.setPathParam(`endpoint_id`,e),n.setBody(d.OperationalWebhookEndpointUpdateSerializer._toJsonObject(t)),yield n.send(this.requestCtx,c.OperationalWebhookEndpointOutSerializer._fromJsonObject)})}delete(e){return r(this,void 0,void 0,function*(){let t=new f.SvixRequest(f.HttpMethod.DELETE,`/api/v1/operational-webhook/endpoint/{endpoint_id}`);return t.setPathParam(`endpoint_id`,e),yield t.sendNoResponseBody(this.requestCtx)})}getSecret(e){return r(this,void 0,void 0,function*(){let t=new f.SvixRequest(f.HttpMethod.GET,`/api/v1/operational-webhook/endpoint/{endpoint_id}/secret`);return t.setPathParam(`endpoint_id`,e),yield t.send(this.requestCtx,u.OperationalWebhookEndpointSecretOutSerializer._fromJsonObject)})}rotateSecret(e,t={},n){return r(this,void 0,void 0,function*(){let r=new f.SvixRequest(f.HttpMethod.POST,`/api/v1/operational-webhook/endpoint/{endpoint_id}/secret/rotate`);return r.setPathParam(`endpoint_id`,e),r.setHeaderParam(`idempotency-key`,n?.idempotencyKey),r.setBody(l.OperationalWebhookEndpointSecretInSerializer._toJsonObject(t)),yield r.sendNoResponseBody(this.requestCtx)})}getHeaders(e){return r(this,void 0,void 0,function*(){let t=new f.SvixRequest(f.HttpMethod.GET,`/api/v1/operational-webhook/endpoint/{endpoint_id}/headers`);return t.setPathParam(`endpoint_id`,e),yield t.send(this.requestCtx,o.OperationalWebhookEndpointHeadersOutSerializer._fromJsonObject)})}updateHeaders(e,t){return r(this,void 0,void 0,function*(){let n=new f.SvixRequest(f.HttpMethod.PUT,`/api/v1/operational-webhook/endpoint/{endpoint_id}/headers`);return n.setPathParam(`endpoint_id`,e),n.setBody(a.OperationalWebhookEndpointHeadersInSerializer._toJsonObject(t)),yield n.sendNoResponseBody(this.requestCtx)})}}})),KU=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.OperationalWebhook=void 0;var t=GU();e.OperationalWebhook=class{constructor(e){this.requestCtx=e}get endpoint(){return new t.OperationalWebhookEndpoint(this.requestCtx)}}})),qU=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.AggregateEventTypesOutSerializer=void 0;var t=QB(),n=$B();e.AggregateEventTypesOutSerializer={_fromJsonObject(e){return{id:e.id,status:t.BackgroundTaskStatusSerializer._fromJsonObject(e.status),task:n.BackgroundTaskTypeSerializer._fromJsonObject(e.task),updatedAt:new Date(e.updatedAt)}},_toJsonObject(e){return{id:e.id,status:t.BackgroundTaskStatusSerializer._toJsonObject(e.status),task:n.BackgroundTaskTypeSerializer._toJsonObject(e.task),updatedAt:e.updatedAt}}}})),JU=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.AppUsageStatsInSerializer=void 0,e.AppUsageStatsInSerializer={_fromJsonObject(e){return{appIds:e.appIds,since:new Date(e.since),until:new Date(e.until)}},_toJsonObject(e){return{appIds:e.appIds,since:e.since,until:e.until}}}})),YU=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.AppUsageStatsOutSerializer=void 0;var t=QB(),n=$B();e.AppUsageStatsOutSerializer={_fromJsonObject(e){return{id:e.id,status:t.BackgroundTaskStatusSerializer._fromJsonObject(e.status),task:n.BackgroundTaskTypeSerializer._fromJsonObject(e.task),unresolvedAppIds:e.unresolvedAppIds,updatedAt:new Date(e.updatedAt)}},_toJsonObject(e){return{id:e.id,status:t.BackgroundTaskStatusSerializer._toJsonObject(e.status),task:n.BackgroundTaskTypeSerializer._toJsonObject(e.task),unresolvedAppIds:e.unresolvedAppIds,updatedAt:e.updatedAt}}}})),XU=i(((e,t,n)=>{var r=n&&n.__awaiter||function(e,t,n,r){function i(e){return e instanceof n?e:new n(function(t){t(e)})}return new(n||=Promise)(function(n,a){function o(e){try{c(r.next(e))}catch(e){a(e)}}function s(e){try{c(r.throw(e))}catch(e){a(e)}}function c(e){e.done?n(e.value):i(e.value).then(o,s)}c((r=r.apply(e,t||[])).next())})};Object.defineProperty(e,"__esModule",{value:!0}),e.Statistics=void 0;var i=qU(),a=JU(),o=YU(),s=BB();e.Statistics=class{constructor(e){this.requestCtx=e}aggregateEventTypes(){return r(this,void 0,void 0,function*(){return yield new s.SvixRequest(s.HttpMethod.PUT,`/api/v1/stats/usage/event-types`).send(this.requestCtx,i.AggregateEventTypesOutSerializer._fromJsonObject)})}aggregateAppStats(e,t){return r(this,void 0,void 0,function*(){let n=new s.SvixRequest(s.HttpMethod.POST,`/api/v1/stats/usage/app`);return n.setHeaderParam(`idempotency-key`,t?.idempotencyKey),n.setBody(a.AppUsageStatsInSerializer._toJsonObject(e)),yield n.send(this.requestCtx,o.AppUsageStatsOutSerializer._fromJsonObject)})}}})),ZU=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.HttpSinkHeadersPatchInSerializer=void 0,e.HttpSinkHeadersPatchInSerializer={_fromJsonObject(e){return{headers:e.headers}},_toJsonObject(e){return{headers:e.headers}}}})),QU=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.SinkTransformationOutSerializer=void 0,e.SinkTransformationOutSerializer={_fromJsonObject(e){return{code:e.code,enabled:e.enabled}},_toJsonObject(e){return{code:e.code,enabled:e.enabled}}}})),$U=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.StreamEventTypeOutSerializer=void 0,e.StreamEventTypeOutSerializer={_fromJsonObject(e){return{archived:e.archived,createdAt:new Date(e.createdAt),deprecated:e.deprecated,description:e.description,featureFlags:e.featureFlags,name:e.name,updatedAt:new Date(e.updatedAt)}},_toJsonObject(e){return{archived:e.archived,createdAt:e.createdAt,deprecated:e.deprecated,description:e.description,featureFlags:e.featureFlags,name:e.name,updatedAt:e.updatedAt}}}})),eW=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.ListResponseStreamEventTypeOutSerializer=void 0;var t=$U();e.ListResponseStreamEventTypeOutSerializer={_fromJsonObject(e){return{data:e.data.map(e=>t.StreamEventTypeOutSerializer._fromJsonObject(e)),done:e.done,iterator:e.iterator,prevIterator:e.prevIterator}},_toJsonObject(e){return{data:e.data.map(e=>t.StreamEventTypeOutSerializer._toJsonObject(e)),done:e.done,iterator:e.iterator,prevIterator:e.prevIterator}}}})),tW=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.StreamEventTypeInSerializer=void 0,e.StreamEventTypeInSerializer={_fromJsonObject(e){return{archived:e.archived,deprecated:e.deprecated,description:e.description,featureFlags:e.featureFlags,name:e.name}},_toJsonObject(e){return{archived:e.archived,deprecated:e.deprecated,description:e.description,featureFlags:e.featureFlags,name:e.name}}}})),nW=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.StreamEventTypePatchSerializer=void 0,e.StreamEventTypePatchSerializer={_fromJsonObject(e){return{archived:e.archived,deprecated:e.deprecated,description:e.description,featureFlags:e.featureFlags}},_toJsonObject(e){return{archived:e.archived,deprecated:e.deprecated,description:e.description,featureFlags:e.featureFlags}}}})),rW=i(((e,t,n)=>{var r=n&&n.__awaiter||function(e,t,n,r){function i(e){return e instanceof n?e:new n(function(t){t(e)})}return new(n||=Promise)(function(n,a){function o(e){try{c(r.next(e))}catch(e){a(e)}}function s(e){try{c(r.throw(e))}catch(e){a(e)}}function c(e){e.done?n(e.value):i(e.value).then(o,s)}c((r=r.apply(e,t||[])).next())})};Object.defineProperty(e,"__esModule",{value:!0}),e.StreamingEventType=void 0;var i=eW(),a=tW(),o=$U(),s=nW(),c=BB();e.StreamingEventType=class{constructor(e){this.requestCtx=e}list(e){return r(this,void 0,void 0,function*(){let t=new c.SvixRequest(c.HttpMethod.GET,`/api/v1/stream/event-type`);return t.setQueryParams({limit:e?.limit,iterator:e?.iterator,order:e?.order,include_archived:e?.includeArchived}),yield t.send(this.requestCtx,i.ListResponseStreamEventTypeOutSerializer._fromJsonObject)})}create(e,t){return r(this,void 0,void 0,function*(){let n=new c.SvixRequest(c.HttpMethod.POST,`/api/v1/stream/event-type`);return n.setHeaderParam(`idempotency-key`,t?.idempotencyKey),n.setBody(a.StreamEventTypeInSerializer._toJsonObject(e)),yield n.send(this.requestCtx,o.StreamEventTypeOutSerializer._fromJsonObject)})}get(e){return r(this,void 0,void 0,function*(){let t=new c.SvixRequest(c.HttpMethod.GET,`/api/v1/stream/event-type/{name}`);return t.setPathParam(`name`,e),yield t.send(this.requestCtx,o.StreamEventTypeOutSerializer._fromJsonObject)})}update(e,t){return r(this,void 0,void 0,function*(){let n=new c.SvixRequest(c.HttpMethod.PUT,`/api/v1/stream/event-type/{name}`);return n.setPathParam(`name`,e),n.setBody(a.StreamEventTypeInSerializer._toJsonObject(t)),yield n.send(this.requestCtx,o.StreamEventTypeOutSerializer._fromJsonObject)})}delete(e,t){return r(this,void 0,void 0,function*(){let n=new c.SvixRequest(c.HttpMethod.DELETE,`/api/v1/stream/event-type/{name}`);return n.setPathParam(`name`,e),n.setQueryParams({expunge:t?.expunge}),yield n.sendNoResponseBody(this.requestCtx)})}patch(e,t){return r(this,void 0,void 0,function*(){let n=new c.SvixRequest(c.HttpMethod.PATCH,`/api/v1/stream/event-type/{name}`);return n.setPathParam(`name`,e),n.setBody(s.StreamEventTypePatchSerializer._toJsonObject(t)),yield n.send(this.requestCtx,o.StreamEventTypeOutSerializer._fromJsonObject)})}}})),iW=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.EventInSerializer=void 0,e.EventInSerializer={_fromJsonObject(e){return{eventType:e.eventType,payload:e.payload}},_toJsonObject(e){return{eventType:e.eventType,payload:e.payload}}}})),aW=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.StreamInSerializer=void 0,e.StreamInSerializer={_fromJsonObject(e){return{metadata:e.metadata,name:e.name,uid:e.uid}},_toJsonObject(e){return{metadata:e.metadata,name:e.name,uid:e.uid}}}})),oW=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.CreateStreamEventsInSerializer=void 0;var t=iW(),n=aW();e.CreateStreamEventsInSerializer={_fromJsonObject(e){return{events:e.events.map(e=>t.EventInSerializer._fromJsonObject(e)),stream:e.stream==null?void 0:n.StreamInSerializer._fromJsonObject(e.stream)}},_toJsonObject(e){return{events:e.events.map(e=>t.EventInSerializer._toJsonObject(e)),stream:e.stream==null?void 0:n.StreamInSerializer._toJsonObject(e.stream)}}}})),sW=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.CreateStreamEventsOutSerializer=void 0,e.CreateStreamEventsOutSerializer={_fromJsonObject(e){return{}},_toJsonObject(e){return{}}}})),cW=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.EventOutSerializer=void 0,e.EventOutSerializer={_fromJsonObject(e){return{eventType:e.eventType,payload:e.payload,timestamp:new Date(e.timestamp)}},_toJsonObject(e){return{eventType:e.eventType,payload:e.payload,timestamp:e.timestamp}}}})),lW=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.EventStreamOutSerializer=void 0;var t=cW();e.EventStreamOutSerializer={_fromJsonObject(e){return{data:e.data.map(e=>t.EventOutSerializer._fromJsonObject(e)),done:e.done,iterator:e.iterator}},_toJsonObject(e){return{data:e.data.map(e=>t.EventOutSerializer._toJsonObject(e)),done:e.done,iterator:e.iterator}}}})),uW=i(((e,t,n)=>{var r=n&&n.__awaiter||function(e,t,n,r){function i(e){return e instanceof n?e:new n(function(t){t(e)})}return new(n||=Promise)(function(n,a){function o(e){try{c(r.next(e))}catch(e){a(e)}}function s(e){try{c(r.throw(e))}catch(e){a(e)}}function c(e){e.done?n(e.value):i(e.value).then(o,s)}c((r=r.apply(e,t||[])).next())})};Object.defineProperty(e,"__esModule",{value:!0}),e.StreamingEvents=void 0;var i=oW(),a=sW(),o=lW(),s=BB();e.StreamingEvents=class{constructor(e){this.requestCtx=e}get(e,t,n){return r(this,void 0,void 0,function*(){let r=new s.SvixRequest(s.HttpMethod.GET,`/api/v1/stream/{stream_id}/sink/{sink_id}/events`);return r.setPathParam(`stream_id`,e),r.setPathParam(`sink_id`,t),r.setQueryParams({limit:n?.limit,iterator:n?.iterator,after:n?.after}),yield r.send(this.requestCtx,o.EventStreamOutSerializer._fromJsonObject)})}create(e,t,n){return r(this,void 0,void 0,function*(){let r=new s.SvixRequest(s.HttpMethod.POST,`/api/v1/stream/{stream_id}/events`);return r.setPathParam(`stream_id`,e),r.setHeaderParam(`idempotency-key`,n?.idempotencyKey),r.setBody(i.CreateStreamEventsInSerializer._toJsonObject(t)),yield r.send(this.requestCtx,a.CreateStreamEventsOutSerializer._fromJsonObject)})}}})),dW=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.AzureBlobStorageConfigSerializer=void 0,e.AzureBlobStorageConfigSerializer={_fromJsonObject(e){return{accessKey:e.accessKey,account:e.account,container:e.container}},_toJsonObject(e){return{accessKey:e.accessKey,account:e.account,container:e.container}}}})),fW=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.BigQueryConfigSerializer=void 0,e.BigQueryConfigSerializer={_fromJsonObject(e){return{credentials:e.credentials,datasetId:e.datasetId,projectId:e.projectId,tableId:e.tableId}},_toJsonObject(e){return{credentials:e.credentials,datasetId:e.datasetId,projectId:e.projectId,tableId:e.tableId}}}})),pW=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.ClickhouseConfigSerializer=void 0,e.ClickhouseConfigSerializer={_fromJsonObject(e){return{database:e.database,password:e.password,tableName:e.tableName,url:e.url,username:e.username}},_toJsonObject(e){return{database:e.database,password:e.password,tableName:e.tableName,url:e.url,username:e.username}}}})),mW=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.EventBridgeConfigSerializer=void 0,e.EventBridgeConfigSerializer={_fromJsonObject(e){return{accessKeyId:e.accessKeyId,detailType:e.detailType,eventBusName:e.eventBusName,region:e.region,secretAccessKey:e.secretAccessKey}},_toJsonObject(e){return{accessKeyId:e.accessKeyId,detailType:e.detailType,eventBusName:e.eventBusName,region:e.region,secretAccessKey:e.secretAccessKey}}}})),hW=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.GoogleCloudPubSubConfigSerializer=void 0,e.GoogleCloudPubSubConfigSerializer={_fromJsonObject(e){return{credentials:e.credentials,projectId:e.projectId,topicId:e.topicId}},_toJsonObject(e){return{credentials:e.credentials,projectId:e.projectId,topicId:e.topicId}}}})),gW=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.GoogleCloudStorageConfigSerializer=void 0,e.GoogleCloudStorageConfigSerializer={_fromJsonObject(e){return{bucket:e.bucket,credentials:e.credentials}},_toJsonObject(e){return{bucket:e.bucket,credentials:e.credentials}}}})),_W=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.RabbitMqConfigSerializer=void 0,e.RabbitMqConfigSerializer={_fromJsonObject(e){return{routingKey:e.routingKey,uri:e.uri}},_toJsonObject(e){return{routingKey:e.routingKey,uri:e.uri}}}})),vW=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.RedshiftConfigSerializer=void 0,e.RedshiftConfigSerializer={_fromJsonObject(e){return{accessKeyId:e.accessKeyId,clusterIdentifier:e.clusterIdentifier,dbName:e.dbName,dbUser:e.dbUser,region:e.region,schemaName:e.schemaName,secretAccessKey:e.secretAccessKey,tableName:e.tableName,workgroupName:e.workgroupName}},_toJsonObject(e){return{accessKeyId:e.accessKeyId,clusterIdentifier:e.clusterIdentifier,dbName:e.dbName,dbUser:e.dbUser,region:e.region,schemaName:e.schemaName,secretAccessKey:e.secretAccessKey,tableName:e.tableName,workgroupName:e.workgroupName}}}})),yW=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.S3ConfigSerializer=void 0,e.S3ConfigSerializer={_fromJsonObject(e){return{accessKeyId:e.accessKeyId,bucket:e.bucket,endpointUrl:e.endpointUrl,region:e.region,secretAccessKey:e.secretAccessKey}},_toJsonObject(e){return{accessKeyId:e.accessKeyId,bucket:e.bucket,endpointUrl:e.endpointUrl,region:e.region,secretAccessKey:e.secretAccessKey}}}})),bW=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.SinkHttpConfigSerializer=void 0,e.SinkHttpConfigSerializer={_fromJsonObject(e){return{headers:e.headers,key:e.key,url:e.url}},_toJsonObject(e){return{headers:e.headers,key:e.key,url:e.url}}}})),xW=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.SinkOtelV1ConfigSerializer=void 0,e.SinkOtelV1ConfigSerializer={_fromJsonObject(e){return{headers:e.headers,url:e.url}},_toJsonObject(e){return{headers:e.headers,url:e.url}}}})),SW=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.SinkStatusSerializer=e.SinkStatus=void 0,(function(e){e.Enabled=`enabled`,e.Paused=`paused`,e.Disabled=`disabled`,e.Retrying=`retrying`})(e.SinkStatus||={}),e.SinkStatusSerializer={_fromJsonObject(e){return e},_toJsonObject(e){return e}}})),CW=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.SnowflakeConfigSerializer=void 0,e.SnowflakeConfigSerializer={_fromJsonObject(e){return{accountIdentifier:e.accountIdentifier,dbName:e.dbName,privateKey:e.privateKey,schemaName:e.schemaName,tableName:e.tableName,userId:e.userId}},_toJsonObject(e){return{accountIdentifier:e.accountIdentifier,dbName:e.dbName,privateKey:e.privateKey,schemaName:e.schemaName,tableName:e.tableName,userId:e.userId}}}})),wW=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.SnsConfigSerializer=void 0,e.SnsConfigSerializer={_fromJsonObject(e){return{accessKeyId:e.accessKeyId,endpointUrl:e.endpointUrl,region:e.region,secretAccessKey:e.secretAccessKey,topicArn:e.topicArn}},_toJsonObject(e){return{accessKeyId:e.accessKeyId,endpointUrl:e.endpointUrl,region:e.region,secretAccessKey:e.secretAccessKey,topicArn:e.topicArn}}}})),TW=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.SqsConfigSerializer=void 0,e.SqsConfigSerializer={_fromJsonObject(e){return{accessKeyId:e.accessKeyId,endpointUrl:e.endpointUrl,queueUrl:e.queueUrl,region:e.region,secretAccessKey:e.secretAccessKey}},_toJsonObject(e){return{accessKeyId:e.accessKeyId,endpointUrl:e.endpointUrl,queueUrl:e.queueUrl,region:e.region,secretAccessKey:e.secretAccessKey}}}})),EW=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.StreamSinkOutSerializer=void 0;var t=dW(),n=fW(),r=pW(),i=mW(),a=hW(),o=gW(),s=_W(),c=vW(),l=yW(),u=bW(),d=xW(),f=SW(),p=CW(),m=wW(),h=TW();e.StreamSinkOutSerializer={_fromJsonObject(e){let g=e.type;function _(f){switch(f){case`poller`:return{};case`azureBlobStorage`:return t.AzureBlobStorageConfigSerializer._fromJsonObject(e.config);case`otelTracing`:return d.SinkOtelV1ConfigSerializer._fromJsonObject(e.config);case`http`:return u.SinkHttpConfigSerializer._fromJsonObject(e.config);case`amazonS3`:return l.S3ConfigSerializer._fromJsonObject(e.config);case`googleCloudStorage`:return o.GoogleCloudStorageConfigSerializer._fromJsonObject(e.config);case`googleCloudPubSub`:return a.GoogleCloudPubSubConfigSerializer._fromJsonObject(e.config);case`sqs`:return h.SqsConfigSerializer._fromJsonObject(e.config);case`sns`:return m.SnsConfigSerializer._fromJsonObject(e.config);case`bigQuery`:return n.BigQueryConfigSerializer._fromJsonObject(e.config);case`clickhouse`:return r.ClickhouseConfigSerializer._fromJsonObject(e.config);case`eventBridge`:return i.EventBridgeConfigSerializer._fromJsonObject(e.config);case`snowflake`:return p.SnowflakeConfigSerializer._fromJsonObject(e.config);case`rabbitMq`:return s.RabbitMqConfigSerializer._fromJsonObject(e.config);case`redshift`:return c.RedshiftConfigSerializer._fromJsonObject(e.config);default:throw Error(`Unexpected type: ${f}`)}}return{type:g,config:_(g),batchSize:e.batchSize,createdAt:new Date(e.createdAt),currentIterator:e.currentIterator,eventTypes:e.eventTypes,failureReason:e.failureReason,id:e.id,maxWaitSecs:e.maxWaitSecs,metadata:e.metadata,nextRetryAt:e.nextRetryAt?new Date(e.nextRetryAt):null,status:f.SinkStatusSerializer._fromJsonObject(e.status),uid:e.uid,updatedAt:new Date(e.updatedAt)}},_toJsonObject(e){let g;switch(e.type){case`poller`:g={};break;case`azureBlobStorage`:g=t.AzureBlobStorageConfigSerializer._toJsonObject(e.config);break;case`otelTracing`:g=d.SinkOtelV1ConfigSerializer._toJsonObject(e.config);break;case`http`:g=u.SinkHttpConfigSerializer._toJsonObject(e.config);break;case`amazonS3`:g=l.S3ConfigSerializer._toJsonObject(e.config);break;case`googleCloudStorage`:g=o.GoogleCloudStorageConfigSerializer._toJsonObject(e.config);break;case`googleCloudPubSub`:g=a.GoogleCloudPubSubConfigSerializer._toJsonObject(e.config);break;case`sqs`:g=h.SqsConfigSerializer._toJsonObject(e.config);break;case`sns`:g=m.SnsConfigSerializer._toJsonObject(e.config);break;case`bigQuery`:g=n.BigQueryConfigSerializer._toJsonObject(e.config);break;case`clickhouse`:g=r.ClickhouseConfigSerializer._toJsonObject(e.config);break;case`eventBridge`:g=i.EventBridgeConfigSerializer._toJsonObject(e.config);break;case`snowflake`:g=p.SnowflakeConfigSerializer._toJsonObject(e.config);break;case`rabbitMq`:g=s.RabbitMqConfigSerializer._toJsonObject(e.config);break;case`redshift`:g=c.RedshiftConfigSerializer._toJsonObject(e.config)}return{type:e.type,config:g,batchSize:e.batchSize,createdAt:e.createdAt,currentIterator:e.currentIterator,eventTypes:e.eventTypes,failureReason:e.failureReason,id:e.id,maxWaitSecs:e.maxWaitSecs,metadata:e.metadata,nextRetryAt:e.nextRetryAt,status:f.SinkStatusSerializer._toJsonObject(e.status),uid:e.uid,updatedAt:e.updatedAt}}}})),DW=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.ListResponseStreamSinkOutSerializer=void 0;var t=EW();e.ListResponseStreamSinkOutSerializer={_fromJsonObject(e){return{data:e.data.map(e=>t.StreamSinkOutSerializer._fromJsonObject(e)),done:e.done,iterator:e.iterator,prevIterator:e.prevIterator}},_toJsonObject(e){return{data:e.data.map(e=>t.StreamSinkOutSerializer._toJsonObject(e)),done:e.done,iterator:e.iterator,prevIterator:e.prevIterator}}}})),OW=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.SinkSecretOutSerializer=void 0,e.SinkSecretOutSerializer={_fromJsonObject(e){return{key:e.key}},_toJsonObject(e){return{key:e.key}}}})),kW=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.SinkTransformInSerializer=void 0,e.SinkTransformInSerializer={_fromJsonObject(e){return{code:e.code}},_toJsonObject(e){return{code:e.code}}}})),AW=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.SinkStatusInSerializer=e.SinkStatusIn=void 0,(function(e){e.Enabled=`enabled`,e.Disabled=`disabled`})(e.SinkStatusIn||={}),e.SinkStatusInSerializer={_fromJsonObject(e){return e},_toJsonObject(e){return e}}})),jW=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.StreamSinkInSerializer=void 0;var t=dW(),n=fW(),r=pW(),i=mW(),a=hW(),o=gW(),s=_W(),c=vW(),l=yW(),u=bW(),d=xW(),f=AW(),p=CW(),m=wW(),h=TW();e.StreamSinkInSerializer={_fromJsonObject(e){let g=e.type;function _(f){switch(f){case`poller`:return{};case`azureBlobStorage`:return t.AzureBlobStorageConfigSerializer._fromJsonObject(e.config);case`otelTracing`:return d.SinkOtelV1ConfigSerializer._fromJsonObject(e.config);case`http`:return u.SinkHttpConfigSerializer._fromJsonObject(e.config);case`amazonS3`:return l.S3ConfigSerializer._fromJsonObject(e.config);case`googleCloudStorage`:return o.GoogleCloudStorageConfigSerializer._fromJsonObject(e.config);case`googleCloudPubSub`:return a.GoogleCloudPubSubConfigSerializer._fromJsonObject(e.config);case`sqs`:return h.SqsConfigSerializer._fromJsonObject(e.config);case`sns`:return m.SnsConfigSerializer._fromJsonObject(e.config);case`bigQuery`:return n.BigQueryConfigSerializer._fromJsonObject(e.config);case`clickhouse`:return r.ClickhouseConfigSerializer._fromJsonObject(e.config);case`eventBridge`:return i.EventBridgeConfigSerializer._fromJsonObject(e.config);case`snowflake`:return p.SnowflakeConfigSerializer._fromJsonObject(e.config);case`rabbitMq`:return s.RabbitMqConfigSerializer._fromJsonObject(e.config);case`redshift`:return c.RedshiftConfigSerializer._fromJsonObject(e.config);default:throw Error(`Unexpected type: ${f}`)}}return{type:g,config:_(g),batchSize:e.batchSize,eventTypes:e.eventTypes,maxWaitSecs:e.maxWaitSecs,metadata:e.metadata,status:e.status==null?void 0:f.SinkStatusInSerializer._fromJsonObject(e.status),uid:e.uid}},_toJsonObject(e){let g;switch(e.type){case`poller`:g={};break;case`azureBlobStorage`:g=t.AzureBlobStorageConfigSerializer._toJsonObject(e.config);break;case`otelTracing`:g=d.SinkOtelV1ConfigSerializer._toJsonObject(e.config);break;case`http`:g=u.SinkHttpConfigSerializer._toJsonObject(e.config);break;case`amazonS3`:g=l.S3ConfigSerializer._toJsonObject(e.config);break;case`googleCloudStorage`:g=o.GoogleCloudStorageConfigSerializer._toJsonObject(e.config);break;case`googleCloudPubSub`:g=a.GoogleCloudPubSubConfigSerializer._toJsonObject(e.config);break;case`sqs`:g=h.SqsConfigSerializer._toJsonObject(e.config);break;case`sns`:g=m.SnsConfigSerializer._toJsonObject(e.config);break;case`bigQuery`:g=n.BigQueryConfigSerializer._toJsonObject(e.config);break;case`clickhouse`:g=r.ClickhouseConfigSerializer._toJsonObject(e.config);break;case`eventBridge`:g=i.EventBridgeConfigSerializer._toJsonObject(e.config);break;case`snowflake`:g=p.SnowflakeConfigSerializer._toJsonObject(e.config);break;case`rabbitMq`:g=s.RabbitMqConfigSerializer._toJsonObject(e.config);break;case`redshift`:g=c.RedshiftConfigSerializer._toJsonObject(e.config)}return{type:e.type,config:g,batchSize:e.batchSize,eventTypes:e.eventTypes,maxWaitSecs:e.maxWaitSecs,metadata:e.metadata,status:e.status==null?void 0:f.SinkStatusInSerializer._toJsonObject(e.status),uid:e.uid}}}})),MW=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.AmazonS3PatchConfigSerializer=void 0,e.AmazonS3PatchConfigSerializer={_fromJsonObject(e){return{accessKeyId:e.accessKeyId,bucket:e.bucket,endpointUrl:e.endpointUrl,region:e.region,secretAccessKey:e.secretAccessKey}},_toJsonObject(e){return{accessKeyId:e.accessKeyId,bucket:e.bucket,endpointUrl:e.endpointUrl,region:e.region,secretAccessKey:e.secretAccessKey}}}})),NW=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.AzureBlobStoragePatchConfigSerializer=void 0,e.AzureBlobStoragePatchConfigSerializer={_fromJsonObject(e){return{accessKey:e.accessKey,account:e.account,container:e.container}},_toJsonObject(e){return{accessKey:e.accessKey,account:e.account,container:e.container}}}})),PW=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.BigQueryPatchConfigSerializer=void 0,e.BigQueryPatchConfigSerializer={_fromJsonObject(e){return{credentials:e.credentials,datasetId:e.datasetId,projectId:e.projectId,tableId:e.tableId}},_toJsonObject(e){return{credentials:e.credentials,datasetId:e.datasetId,projectId:e.projectId,tableId:e.tableId}}}})),FW=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.ClickhousePatchConfigSerializer=void 0,e.ClickhousePatchConfigSerializer={_fromJsonObject(e){return{database:e.database,password:e.password,tableName:e.tableName,url:e.url,username:e.username}},_toJsonObject(e){return{database:e.database,password:e.password,tableName:e.tableName,url:e.url,username:e.username}}}})),IW=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.EventBridgePatchConfigSerializer=void 0,e.EventBridgePatchConfigSerializer={_fromJsonObject(e){return{accessKeyId:e.accessKeyId,detailType:e.detailType,eventBusName:e.eventBusName,region:e.region,secretAccessKey:e.secretAccessKey}},_toJsonObject(e){return{accessKeyId:e.accessKeyId,detailType:e.detailType,eventBusName:e.eventBusName,region:e.region,secretAccessKey:e.secretAccessKey}}}})),LW=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.GoogleCloudPubSubPatchConfigSerializer=void 0,e.GoogleCloudPubSubPatchConfigSerializer={_fromJsonObject(e){return{credentials:e.credentials,projectId:e.projectId,topicId:e.topicId}},_toJsonObject(e){return{credentials:e.credentials,projectId:e.projectId,topicId:e.topicId}}}})),RW=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.GoogleCloudStoragePatchConfigSerializer=void 0,e.GoogleCloudStoragePatchConfigSerializer={_fromJsonObject(e){return{bucket:e.bucket,credentials:e.credentials}},_toJsonObject(e){return{bucket:e.bucket,credentials:e.credentials}}}})),zW=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.HttpPatchConfigSerializer=void 0,e.HttpPatchConfigSerializer={_fromJsonObject(e){return{url:e.url}},_toJsonObject(e){return{url:e.url}}}})),BW=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.OtelTracingPatchConfigSerializer=void 0,e.OtelTracingPatchConfigSerializer={_fromJsonObject(e){return{url:e.url}},_toJsonObject(e){return{url:e.url}}}})),VW=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.RabbitMqPatchConfigSerializer=void 0,e.RabbitMqPatchConfigSerializer={_fromJsonObject(e){return{routingKey:e.routingKey,uri:e.uri}},_toJsonObject(e){return{routingKey:e.routingKey,uri:e.uri}}}})),HW=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.RedshiftPatchConfigSerializer=void 0,e.RedshiftPatchConfigSerializer={_fromJsonObject(e){return{accessKeyId:e.accessKeyId,dbName:e.dbName,region:e.region,schemaName:e.schemaName,secretAccessKey:e.secretAccessKey,tableName:e.tableName}},_toJsonObject(e){return{accessKeyId:e.accessKeyId,dbName:e.dbName,region:e.region,schemaName:e.schemaName,secretAccessKey:e.secretAccessKey,tableName:e.tableName}}}})),UW=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.SnowflakePatchConfigSerializer=void 0,e.SnowflakePatchConfigSerializer={_fromJsonObject(e){return{accountIdentifier:e.accountIdentifier,dbName:e.dbName,privateKey:e.privateKey,schemaName:e.schemaName,tableName:e.tableName,userId:e.userId}},_toJsonObject(e){return{accountIdentifier:e.accountIdentifier,dbName:e.dbName,privateKey:e.privateKey,schemaName:e.schemaName,tableName:e.tableName,userId:e.userId}}}})),WW=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.SnsPatchConfigSerializer=void 0,e.SnsPatchConfigSerializer={_fromJsonObject(e){return{accessKeyId:e.accessKeyId,endpointUrl:e.endpointUrl,region:e.region,secretAccessKey:e.secretAccessKey,topicArn:e.topicArn}},_toJsonObject(e){return{accessKeyId:e.accessKeyId,endpointUrl:e.endpointUrl,region:e.region,secretAccessKey:e.secretAccessKey,topicArn:e.topicArn}}}})),GW=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.SqsPatchConfigSerializer=void 0,e.SqsPatchConfigSerializer={_fromJsonObject(e){return{accessKeyId:e.accessKeyId,endpointUrl:e.endpointUrl,queueUrl:e.queueUrl,region:e.region,secretAccessKey:e.secretAccessKey}},_toJsonObject(e){return{accessKeyId:e.accessKeyId,endpointUrl:e.endpointUrl,queueUrl:e.queueUrl,region:e.region,secretAccessKey:e.secretAccessKey}}}})),KW=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.StreamSinkPatchSerializer=void 0;var t=MW(),n=NW(),r=PW(),i=FW(),a=IW(),o=LW(),s=RW(),c=zW(),l=BW(),u=VW(),d=HW(),f=AW(),p=UW(),m=WW(),h=GW();e.StreamSinkPatchSerializer={_fromJsonObject(e){let g=e.type;function _(f){switch(f){case`poller`:return{};case`azureBlobStorage`:return n.AzureBlobStoragePatchConfigSerializer._fromJsonObject(e.config);case`otelTracing`:return l.OtelTracingPatchConfigSerializer._fromJsonObject(e.config);case`http`:return c.HttpPatchConfigSerializer._fromJsonObject(e.config);case`amazonS3`:return t.AmazonS3PatchConfigSerializer._fromJsonObject(e.config);case`googleCloudStorage`:return s.GoogleCloudStoragePatchConfigSerializer._fromJsonObject(e.config);case`googleCloudPubSub`:return o.GoogleCloudPubSubPatchConfigSerializer._fromJsonObject(e.config);case`sqs`:return h.SqsPatchConfigSerializer._fromJsonObject(e.config);case`sns`:return m.SnsPatchConfigSerializer._fromJsonObject(e.config);case`bigQuery`:return r.BigQueryPatchConfigSerializer._fromJsonObject(e.config);case`clickhouse`:return i.ClickhousePatchConfigSerializer._fromJsonObject(e.config);case`eventBridge`:return a.EventBridgePatchConfigSerializer._fromJsonObject(e.config);case`snowflake`:return p.SnowflakePatchConfigSerializer._fromJsonObject(e.config);case`rabbitMq`:return u.RabbitMqPatchConfigSerializer._fromJsonObject(e.config);case`redshift`:return d.RedshiftPatchConfigSerializer._fromJsonObject(e.config);default:throw Error(`Unexpected type: ${f}`)}}return{type:g,config:_(g),batchSize:e.batchSize,eventTypes:e.eventTypes,maxWaitSecs:e.maxWaitSecs,metadata:e.metadata,status:e.status==null?void 0:f.SinkStatusInSerializer._fromJsonObject(e.status),uid:e.uid}},_toJsonObject(e){let g;switch(e.type){case`poller`:g={};break;case`azureBlobStorage`:g=n.AzureBlobStoragePatchConfigSerializer._toJsonObject(e.config);break;case`otelTracing`:g=l.OtelTracingPatchConfigSerializer._toJsonObject(e.config);break;case`http`:g=c.HttpPatchConfigSerializer._toJsonObject(e.config);break;case`amazonS3`:g=t.AmazonS3PatchConfigSerializer._toJsonObject(e.config);break;case`googleCloudStorage`:g=s.GoogleCloudStoragePatchConfigSerializer._toJsonObject(e.config);break;case`googleCloudPubSub`:g=o.GoogleCloudPubSubPatchConfigSerializer._toJsonObject(e.config);break;case`sqs`:g=h.SqsPatchConfigSerializer._toJsonObject(e.config);break;case`sns`:g=m.SnsPatchConfigSerializer._toJsonObject(e.config);break;case`bigQuery`:g=r.BigQueryPatchConfigSerializer._toJsonObject(e.config);break;case`clickhouse`:g=i.ClickhousePatchConfigSerializer._toJsonObject(e.config);break;case`eventBridge`:g=a.EventBridgePatchConfigSerializer._toJsonObject(e.config);break;case`snowflake`:g=p.SnowflakePatchConfigSerializer._toJsonObject(e.config);break;case`rabbitMq`:g=u.RabbitMqPatchConfigSerializer._toJsonObject(e.config);break;case`redshift`:g=d.RedshiftPatchConfigSerializer._toJsonObject(e.config)}return{type:e.type,config:g,batchSize:e.batchSize,eventTypes:e.eventTypes,maxWaitSecs:e.maxWaitSecs,metadata:e.metadata,status:e.status==null?void 0:f.SinkStatusInSerializer._toJsonObject(e.status),uid:e.uid}}}})),qW=i(((e,t,n)=>{var r=n&&n.__awaiter||function(e,t,n,r){function i(e){return e instanceof n?e:new n(function(t){t(e)})}return new(n||=Promise)(function(n,a){function o(e){try{c(r.next(e))}catch(e){a(e)}}function s(e){try{c(r.throw(e))}catch(e){a(e)}}function c(e){e.done?n(e.value):i(e.value).then(o,s)}c((r=r.apply(e,t||[])).next())})};Object.defineProperty(e,"__esModule",{value:!0}),e.StreamingSink=void 0;var i=DU(),a=xV(),o=DW(),s=OW(),c=kW(),l=jW(),u=EW(),d=KW(),f=BB();e.StreamingSink=class{constructor(e){this.requestCtx=e}list(e,t){return r(this,void 0,void 0,function*(){let n=new f.SvixRequest(f.HttpMethod.GET,`/api/v1/stream/{stream_id}/sink`);return n.setPathParam(`stream_id`,e),n.setQueryParams({limit:t?.limit,iterator:t?.iterator,order:t?.order}),yield n.send(this.requestCtx,o.ListResponseStreamSinkOutSerializer._fromJsonObject)})}create(e,t,n){return r(this,void 0,void 0,function*(){let r=new f.SvixRequest(f.HttpMethod.POST,`/api/v1/stream/{stream_id}/sink`);return r.setPathParam(`stream_id`,e),r.setHeaderParam(`idempotency-key`,n?.idempotencyKey),r.setBody(l.StreamSinkInSerializer._toJsonObject(t)),yield r.send(this.requestCtx,u.StreamSinkOutSerializer._fromJsonObject)})}get(e,t){return r(this,void 0,void 0,function*(){let n=new f.SvixRequest(f.HttpMethod.GET,`/api/v1/stream/{stream_id}/sink/{sink_id}`);return n.setPathParam(`stream_id`,e),n.setPathParam(`sink_id`,t),yield n.send(this.requestCtx,u.StreamSinkOutSerializer._fromJsonObject)})}update(e,t,n){return r(this,void 0,void 0,function*(){let r=new f.SvixRequest(f.HttpMethod.PUT,`/api/v1/stream/{stream_id}/sink/{sink_id}`);return r.setPathParam(`stream_id`,e),r.setPathParam(`sink_id`,t),r.setBody(l.StreamSinkInSerializer._toJsonObject(n)),yield r.send(this.requestCtx,u.StreamSinkOutSerializer._fromJsonObject)})}delete(e,t){return r(this,void 0,void 0,function*(){let n=new f.SvixRequest(f.HttpMethod.DELETE,`/api/v1/stream/{stream_id}/sink/{sink_id}`);return n.setPathParam(`stream_id`,e),n.setPathParam(`sink_id`,t),yield n.sendNoResponseBody(this.requestCtx)})}patch(e,t,n){return r(this,void 0,void 0,function*(){let r=new f.SvixRequest(f.HttpMethod.PATCH,`/api/v1/stream/{stream_id}/sink/{sink_id}`);return r.setPathParam(`stream_id`,e),r.setPathParam(`sink_id`,t),r.setBody(d.StreamSinkPatchSerializer._toJsonObject(n)),yield r.send(this.requestCtx,u.StreamSinkOutSerializer._fromJsonObject)})}transformationPartialUpdate(e,t,n={}){return r(this,void 0,void 0,function*(){let r=new f.SvixRequest(f.HttpMethod.PATCH,`/api/v1/stream/{stream_id}/sink/{sink_id}/transformation`);return r.setPathParam(`stream_id`,e),r.setPathParam(`sink_id`,t),r.setBody(c.SinkTransformInSerializer._toJsonObject(n)),yield r.send(this.requestCtx,i.EmptyResponseSerializer._fromJsonObject)})}getSecret(e,t){return r(this,void 0,void 0,function*(){let n=new f.SvixRequest(f.HttpMethod.GET,`/api/v1/stream/{stream_id}/sink/{sink_id}/secret`);return n.setPathParam(`stream_id`,e),n.setPathParam(`sink_id`,t),yield n.send(this.requestCtx,s.SinkSecretOutSerializer._fromJsonObject)})}rotateSecret(e,t,n={},o){return r(this,void 0,void 0,function*(){let r=new f.SvixRequest(f.HttpMethod.POST,`/api/v1/stream/{stream_id}/sink/{sink_id}/secret/rotate`);return r.setPathParam(`stream_id`,e),r.setPathParam(`sink_id`,t),r.setHeaderParam(`idempotency-key`,o?.idempotencyKey),r.setBody(a.EndpointSecretRotateInSerializer._toJsonObject(n)),yield r.send(this.requestCtx,i.EmptyResponseSerializer._fromJsonObject)})}}})),JW=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.StreamOutSerializer=void 0,e.StreamOutSerializer={_fromJsonObject(e){return{createdAt:new Date(e.createdAt),id:e.id,metadata:e.metadata,name:e.name,uid:e.uid,updatedAt:new Date(e.updatedAt)}},_toJsonObject(e){return{createdAt:e.createdAt,id:e.id,metadata:e.metadata,name:e.name,uid:e.uid,updatedAt:e.updatedAt}}}})),YW=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.ListResponseStreamOutSerializer=void 0;var t=JW();e.ListResponseStreamOutSerializer={_fromJsonObject(e){return{data:e.data.map(e=>t.StreamOutSerializer._fromJsonObject(e)),done:e.done,iterator:e.iterator,prevIterator:e.prevIterator}},_toJsonObject(e){return{data:e.data.map(e=>t.StreamOutSerializer._toJsonObject(e)),done:e.done,iterator:e.iterator,prevIterator:e.prevIterator}}}})),XW=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.StreamPatchSerializer=void 0,e.StreamPatchSerializer={_fromJsonObject(e){return{description:e.description,metadata:e.metadata,uid:e.uid}},_toJsonObject(e){return{description:e.description,metadata:e.metadata,uid:e.uid}}}})),ZW=i(((e,t,n)=>{var r=n&&n.__awaiter||function(e,t,n,r){function i(e){return e instanceof n?e:new n(function(t){t(e)})}return new(n||=Promise)(function(n,a){function o(e){try{c(r.next(e))}catch(e){a(e)}}function s(e){try{c(r.throw(e))}catch(e){a(e)}}function c(e){e.done?n(e.value):i(e.value).then(o,s)}c((r=r.apply(e,t||[])).next())})};Object.defineProperty(e,"__esModule",{value:!0}),e.StreamingStream=void 0;var i=YW(),a=aW(),o=JW(),s=XW(),c=BB();e.StreamingStream=class{constructor(e){this.requestCtx=e}list(e){return r(this,void 0,void 0,function*(){let t=new c.SvixRequest(c.HttpMethod.GET,`/api/v1/stream`);return t.setQueryParams({limit:e?.limit,iterator:e?.iterator,order:e?.order}),yield t.send(this.requestCtx,i.ListResponseStreamOutSerializer._fromJsonObject)})}create(e,t){return r(this,void 0,void 0,function*(){let n=new c.SvixRequest(c.HttpMethod.POST,`/api/v1/stream`);return n.setHeaderParam(`idempotency-key`,t?.idempotencyKey),n.setBody(a.StreamInSerializer._toJsonObject(e)),yield n.send(this.requestCtx,o.StreamOutSerializer._fromJsonObject)})}get(e){return r(this,void 0,void 0,function*(){let t=new c.SvixRequest(c.HttpMethod.GET,`/api/v1/stream/{stream_id}`);return t.setPathParam(`stream_id`,e),yield t.send(this.requestCtx,o.StreamOutSerializer._fromJsonObject)})}update(e,t){return r(this,void 0,void 0,function*(){let n=new c.SvixRequest(c.HttpMethod.PUT,`/api/v1/stream/{stream_id}`);return n.setPathParam(`stream_id`,e),n.setBody(a.StreamInSerializer._toJsonObject(t)),yield n.send(this.requestCtx,o.StreamOutSerializer._fromJsonObject)})}delete(e){return r(this,void 0,void 0,function*(){let t=new c.SvixRequest(c.HttpMethod.DELETE,`/api/v1/stream/{stream_id}`);return t.setPathParam(`stream_id`,e),yield t.sendNoResponseBody(this.requestCtx)})}patch(e,t){return r(this,void 0,void 0,function*(){let n=new c.SvixRequest(c.HttpMethod.PATCH,`/api/v1/stream/{stream_id}`);return n.setPathParam(`stream_id`,e),n.setBody(s.StreamPatchSerializer._toJsonObject(t)),yield n.send(this.requestCtx,o.StreamOutSerializer._fromJsonObject)})}}})),QW=i(((e,t,n)=>{var r=n&&n.__awaiter||function(e,t,n,r){function i(e){return e instanceof n?e:new n(function(t){t(e)})}return new(n||=Promise)(function(n,a){function o(e){try{c(r.next(e))}catch(e){a(e)}}function s(e){try{c(r.throw(e))}catch(e){a(e)}}function c(e){e.done?n(e.value):i(e.value).then(o,s)}c((r=r.apply(e,t||[])).next())})};Object.defineProperty(e,"__esModule",{value:!0}),e.Streaming=void 0;var i=hV(),a=ZU(),o=QU(),s=rW(),c=uW(),l=qW(),u=ZW(),d=BB();e.Streaming=class{constructor(e){this.requestCtx=e}get event_type(){return new s.StreamingEventType(this.requestCtx)}get events(){return new c.StreamingEvents(this.requestCtx)}get sink(){return new l.StreamingSink(this.requestCtx)}get stream(){return new u.StreamingStream(this.requestCtx)}sinkTransformationGet(e,t){return r(this,void 0,void 0,function*(){let n=new d.SvixRequest(d.HttpMethod.GET,`/api/v1/stream/{stream_id}/sink/{sink_id}/transformation`);return n.setPathParam(`stream_id`,e),n.setPathParam(`sink_id`,t),yield n.send(this.requestCtx,o.SinkTransformationOutSerializer._fromJsonObject)})}sinkHeadersGet(e,t){return r(this,void 0,void 0,function*(){let n=new d.SvixRequest(d.HttpMethod.GET,`/api/v1/stream/{stream_id}/sink/{sink_id}/headers`);return n.setPathParam(`stream_id`,e),n.setPathParam(`sink_id`,t),yield n.send(this.requestCtx,i.EndpointHeadersOutSerializer._fromJsonObject)})}sinkHeadersPatch(e,t,n){return r(this,void 0,void 0,function*(){let r=new d.SvixRequest(d.HttpMethod.PATCH,`/api/v1/stream/{stream_id}/sink/{sink_id}/headers`);return r.setPathParam(`stream_id`,e),r.setPathParam(`sink_id`,t),r.setBody(a.HttpSinkHeadersPatchInSerializer._toJsonObject(n)),yield r.send(this.requestCtx,i.EndpointHeadersOutSerializer._fromJsonObject)})}}})),$W=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.HTTPValidationError=e.ValidationError=e.HttpErrorOut=void 0;var t=class e{static getAttributeTypeMap(){return e.attributeTypeMap}};e.HttpErrorOut=t,t.discriminator=void 0,t.mapping=void 0,t.attributeTypeMap=[{name:`code`,baseName:`code`,type:`string`,format:``},{name:`detail`,baseName:`detail`,type:`string`,format:``}];var n=class e{static getAttributeTypeMap(){return e.attributeTypeMap}};e.ValidationError=n,n.discriminator=void 0,n.mapping=void 0,n.attributeTypeMap=[{name:`loc`,baseName:`loc`,type:`Array<string>`,format:``},{name:`msg`,baseName:`msg`,type:`string`,format:``},{name:`type`,baseName:`type`,type:`string`,format:``}];var r=class e{static getAttributeTypeMap(){return e.attributeTypeMap}};e.HTTPValidationError=r,r.discriminator=void 0,r.mapping=void 0,r.attributeTypeMap=[{name:`detail`,baseName:`detail`,type:`Array<ValidationError>`,format:``}]})),eG=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.timingSafeEqual=void 0;function t(e,t=``){if(!e)throw Error(t)}function n(e,n){if(e.byteLength!==n.byteLength)return!1;e instanceof DataView||(e=new DataView(ArrayBuffer.isView(e)?e.buffer:e)),n instanceof DataView||(n=new DataView(ArrayBuffer.isView(n)?n.buffer:n)),t(e instanceof DataView),t(n instanceof DataView);let r=e.byteLength,i=0,a=-1;for(;++a<r;)i|=e.getUint8(a)^n.getUint8(a);return i===0}e.timingSafeEqual=n})),tG=i(((e,t,n)=>{var r=n&&n.__extends||(function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])},e(t,n)};return function(t,n){e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}})();Object.defineProperty(e,"__esModule",{value:!0});var i=256,a=function(){function e(e){e===void 0&&(e=`=`),this._paddingCharacter=e}return e.prototype.encodedLength=function(e){return this._paddingCharacter?(e+2)/3*4|0:(e*8+5)/6|0},e.prototype.encode=function(e){for(var t=``,n=0;n<e.length-2;n+=3){var r=e[n]<<16|e[n+1]<<8|e[n+2];t+=this._encodeByte(r>>>18&63),t+=this._encodeByte(r>>>12&63),t+=this._encodeByte(r>>>6&63),t+=this._encodeByte(r>>>0&63)}var i=e.length-n;if(i>0){var r=e[n]<<16|(i===2?e[n+1]<<8:0);t+=this._encodeByte(r>>>18&63),t+=this._encodeByte(r>>>12&63),t+=i===2?this._encodeByte(r>>>6&63):this._paddingCharacter||``,t+=this._paddingCharacter||``}return t},e.prototype.maxDecodedLength=function(e){return this._paddingCharacter?e/4*3|0:(e*6+7)/8|0},e.prototype.decodedLength=function(e){return this.maxDecodedLength(e.length-this._getPaddingLength(e))},e.prototype.decode=function(e){if(e.length===0)return new Uint8Array;for(var t=this._getPaddingLength(e),n=e.length-t,r=new Uint8Array(this.maxDecodedLength(n)),a=0,o=0,s=0,c=0,l=0,u=0,d=0;o<n-4;o+=4)c=this._decodeChar(e.charCodeAt(o+0)),l=this._decodeChar(e.charCodeAt(o+1)),u=this._decodeChar(e.charCodeAt(o+2)),d=this._decodeChar(e.charCodeAt(o+3)),r[a++]=c<<2|l>>>4,r[a++]=l<<4|u>>>2,r[a++]=u<<6|d,s|=c&i,s|=l&i,s|=u&i,s|=d&i;if(o<n-1&&(c=this._decodeChar(e.charCodeAt(o)),l=this._decodeChar(e.charCodeAt(o+1)),r[a++]=c<<2|l>>>4,s|=c&i,s|=l&i),o<n-2&&(u=this._decodeChar(e.charCodeAt(o+2)),r[a++]=l<<4|u>>>2,s|=u&i),o<n-3&&(d=this._decodeChar(e.charCodeAt(o+3)),r[a++]=u<<6|d,s|=d&i),s!==0)throw Error(`Base64Coder: incorrect characters for decoding`);return r},e.prototype._encodeByte=function(e){var t=e;return t+=65,t+=25-e>>>8&6,t+=51-e>>>8&-75,t+=61-e>>>8&-15,t+=62-e>>>8&3,String.fromCharCode(t)},e.prototype._decodeChar=function(e){var t=i;return t+=(42-e&e-44)>>>8&-i+e-43+62,t+=(46-e&e-48)>>>8&-i+e-47+63,t+=(47-e&e-58)>>>8&-i+e-48+52,t+=(64-e&e-91)>>>8&-i+e-65+0,t+=(96-e&e-123)>>>8&-i+e-97+26,t},e.prototype._getPaddingLength=function(e){var t=0;if(this._paddingCharacter){for(var n=e.length-1;n>=0&&e[n]===this._paddingCharacter;n--)t++;if(e.length<4||t>2)throw Error(`Base64Coder: incorrect padding`)}return t},e}();e.Coder=a;var o=new a;function s(e){return o.encode(e)}e.encode=s;function c(e){return o.decode(e)}e.decode=c;var l=function(e){r(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.prototype._encodeByte=function(e){var t=e;return t+=65,t+=25-e>>>8&6,t+=51-e>>>8&-75,t+=61-e>>>8&-13,t+=62-e>>>8&49,String.fromCharCode(t)},t.prototype._decodeChar=function(e){var t=i;return t+=(44-e&e-46)>>>8&-i+e-45+62,t+=(94-e&e-96)>>>8&-i+e-95+63,t+=(47-e&e-58)>>>8&-i+e-48+52,t+=(64-e&e-91)>>>8&-i+e-65+0,t+=(96-e&e-123)>>>8&-i+e-97+26,t},t}(a);e.URLSafeCoder=l;var u=new l;function d(e){return u.encode(e)}e.encodeURLSafe=d;function f(e){return u.decode(e)}e.decodeURLSafe=f,e.encodedLength=function(e){return o.encodedLength(e)},e.maxDecodedLength=function(e){return o.maxDecodedLength(e)},e.decodedLength=function(e){return o.decodedLength(e)}})),nG=i(((e,t,n)=>{(function(e,n){var r={};n(r);var i=r.default;for(var a in r)i[a]=r[a];typeof t==`object`&&typeof t.exports==`object`?t.exports=i:typeof define==`function`&&define.amd?define(function(){return i}):e.sha256=i})(n,function(e){e.__esModule=!0,e.digestLength=32,e.blockSize=64;var t=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]);function n(e,n,r,i,a){for(var o,s,c,l,u,d,f,p,m,h,g,_,v;a>=64;){for(o=n[0],s=n[1],c=n[2],l=n[3],u=n[4],d=n[5],f=n[6],p=n[7],h=0;h<16;h++)g=i+h*4,e[h]=(r[g]&255)<<24|(r[g+1]&255)<<16|(r[g+2]&255)<<8|r[g+3]&255;for(h=16;h<64;h++)m=e[h-2],_=(m>>>17|m<<15)^(m>>>19|m<<13)^m>>>10,m=e[h-15],v=(m>>>7|m<<25)^(m>>>18|m<<14)^m>>>3,e[h]=(_+e[h-7]|0)+(v+e[h-16]|0);for(h=0;h<64;h++)_=(((u>>>6|u<<26)^(u>>>11|u<<21)^(u>>>25|u<<7))+(u&d^~u&f)|0)+(p+(t[h]+e[h]|0)|0)|0,v=((o>>>2|o<<30)^(o>>>13|o<<19)^(o>>>22|o<<10))+(o&s^o&c^s&c)|0,p=f,f=d,d=u,u=l+_|0,l=c,c=s,s=o,o=_+v|0;n[0]+=o,n[1]+=s,n[2]+=c,n[3]+=l,n[4]+=u,n[5]+=d,n[6]+=f,n[7]+=p,i+=64,a-=64}return i}var r=function(){function t(){this.digestLength=e.digestLength,this.blockSize=e.blockSize,this.state=new Int32Array(8),this.temp=new Int32Array(64),this.buffer=new Uint8Array(128),this.bufferLength=0,this.bytesHashed=0,this.finished=!1,this.reset()}return t.prototype.reset=function(){return this.state[0]=1779033703,this.state[1]=3144134277,this.state[2]=1013904242,this.state[3]=2773480762,this.state[4]=1359893119,this.state[5]=2600822924,this.state[6]=528734635,this.state[7]=1541459225,this.bufferLength=0,this.bytesHashed=0,this.finished=!1,this},t.prototype.clean=function(){for(var e=0;e<this.buffer.length;e++)this.buffer[e]=0;for(var e=0;e<this.temp.length;e++)this.temp[e]=0;this.reset()},t.prototype.update=function(e,t){if(t===void 0&&(t=e.length),this.finished)throw Error(`SHA256: can't update because hash was finished.`);var r=0;if(this.bytesHashed+=t,this.bufferLength>0){for(;this.bufferLength<64&&t>0;)this.buffer[this.bufferLength++]=e[r++],t--;this.bufferLength===64&&(n(this.temp,this.state,this.buffer,0,64),this.bufferLength=0)}for(t>=64&&(r=n(this.temp,this.state,e,r,t),t%=64);t>0;)this.buffer[this.bufferLength++]=e[r++],t--;return this},t.prototype.finish=function(e){if(!this.finished){var t=this.bytesHashed,r=this.bufferLength,i=t/536870912|0,a=t<<3,o=t%64<56?64:128;this.buffer[r]=128;for(var s=r+1;s<o-8;s++)this.buffer[s]=0;this.buffer[o-8]=i>>>24&255,this.buffer[o-7]=i>>>16&255,this.buffer[o-6]=i>>>8&255,this.buffer[o-5]=i>>>0&255,this.buffer[o-4]=a>>>24&255,this.buffer[o-3]=a>>>16&255,this.buffer[o-2]=a>>>8&255,this.buffer[o-1]=a>>>0&255,n(this.temp,this.state,this.buffer,0,o),this.finished=!0}for(var s=0;s<8;s++)e[s*4+0]=this.state[s]>>>24&255,e[s*4+1]=this.state[s]>>>16&255,e[s*4+2]=this.state[s]>>>8&255,e[s*4+3]=this.state[s]>>>0&255;return this},t.prototype.digest=function(){var e=new Uint8Array(this.digestLength);return this.finish(e),e},t.prototype._saveState=function(e){for(var t=0;t<this.state.length;t++)e[t]=this.state[t]},t.prototype._restoreState=function(e,t){for(var n=0;n<this.state.length;n++)this.state[n]=e[n];this.bytesHashed=t,this.finished=!1,this.bufferLength=0},t}();e.Hash=r;var i=function(){function e(e){this.inner=new r,this.outer=new r,this.blockSize=this.inner.blockSize,this.digestLength=this.inner.digestLength;var t=new Uint8Array(this.blockSize);if(e.length>this.blockSize)new r().update(e).finish(t).clean();else for(var n=0;n<e.length;n++)t[n]=e[n];for(var n=0;n<t.length;n++)t[n]^=54;this.inner.update(t);for(var n=0;n<t.length;n++)t[n]^=106;this.outer.update(t),this.istate=new Uint32Array(8),this.ostate=new Uint32Array(8),this.inner._saveState(this.istate),this.outer._saveState(this.ostate);for(var n=0;n<t.length;n++)t[n]=0}return e.prototype.reset=function(){return this.inner._restoreState(this.istate,this.inner.blockSize),this.outer._restoreState(this.ostate,this.outer.blockSize),this},e.prototype.clean=function(){for(var e=0;e<this.istate.length;e++)this.ostate[e]=this.istate[e]=0;this.inner.clean(),this.outer.clean()},e.prototype.update=function(e){return this.inner.update(e),this},e.prototype.finish=function(e){return this.outer.finished?this.outer.finish(e):(this.inner.finish(e),this.outer.update(e,this.digestLength).finish(e)),this},e.prototype.digest=function(){var e=new Uint8Array(this.digestLength);return this.finish(e),e},e}();e.HMAC=i;function a(e){var t=new r().update(e),n=t.digest();return t.clean(),n}e.hash=a,e.default=a;function o(e,t){var n=new i(e).update(t),r=n.digest();return n.clean(),r}e.hmac=o;function s(e,t,n,r){var i=r[0];if(i===0)throw Error(`hkdf: cannot expand more`);t.reset(),i>1&&t.update(e),n&&t.update(n),t.update(r),t.finish(e),r[0]++}var c=new Uint8Array(e.digestLength);function l(e,t,n,r){t===void 0&&(t=c),r===void 0&&(r=32);for(var a=new Uint8Array([1]),l=new i(o(t,e)),u=new Uint8Array(l.digestLength),d=u.length,f=new Uint8Array(r),p=0;p<r;p++)d===u.length&&(s(u,l,n,a),d=0),f[p]=u[d++];return l.clean(),u.fill(0),a.fill(0),f}e.hkdf=l;function u(e,t,n,r){for(var a=new i(e),o=a.digestLength,s=new Uint8Array(4),c=new Uint8Array(o),l=new Uint8Array(o),u=new Uint8Array(r),d=0;d*o<r;d++){var f=d+1;s[0]=f>>>24&255,s[1]=f>>>16&255,s[2]=f>>>8&255,s[3]=f>>>0&255,a.reset(),a.update(t),a.update(s),a.finish(l);for(var p=0;p<o;p++)c[p]=l[p];for(var p=2;p<=n;p++){a.reset(),a.update(l).finish(l);for(var m=0;m<o;m++)c[m]^=l[m]}for(var p=0;p<o&&d*o+p<r;p++)u[d*o+p]=c[p]}for(var d=0;d<o;d++)c[d]=l[d]=0;for(var d=0;d<4;d++)s[d]=0;return a.clean(),u}e.pbkdf2=u})})),rG=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.Webhook=e.WebhookVerificationError=void 0;var t=eG(),n=tG(),r=nG(),i=300,a=class e extends Error{constructor(t){super(t),Object.setPrototypeOf(this,e.prototype),this.name=`ExtendableError`,this.stack=Error(t).stack}},o=class e extends a{constructor(t){super(t),Object.setPrototypeOf(this,e.prototype),this.name=`WebhookVerificationError`}};e.WebhookVerificationError=o;var s=class e{constructor(t,r){if(!t)throw Error(`Secret can't be empty.`);if(r?.format===`raw`)this.key=t instanceof Uint8Array?t:Uint8Array.from(t,e=>e.charCodeAt(0));else{if(typeof t!=`string`)throw Error(`Expected secret to be of type string`);t.startsWith(e.prefix)&&(t=t.substring(e.prefix.length)),this.key=n.decode(t)}}verify(e,n){let r={};for(let e of Object.keys(n))r[e.toLowerCase()]=n[e];let i=r[`webhook-id`],a=r[`webhook-signature`],s=r[`webhook-timestamp`];if(!a||!i||!s)throw new o(`Missing required headers`);let c=this.verifyTimestamp(s),l=this.sign(i,c,e).split(`,`)[1],u=a.split(` `),d=new globalThis.TextEncoder;for(let n of u){let[r,i]=n.split(`,`);if(r===`v1`&&(0,t.timingSafeEqual)(d.encode(i),d.encode(l)))return JSON.parse(e.toString())}throw new o(`No matching signature found`)}sign(e,t,i){if(typeof i!=`string`){if(i.constructor.name===`Buffer`)i=i.toString();else throw Error(`Expected payload to be of type string or Buffer.`)}let a=new TextEncoder,o=Math.floor(t.getTime()/1e3),s=a.encode(`${e}.${o}.${i}`);return`v1,${n.encode(r.hmac(this.key,s))}`}verifyTimestamp(e){let t=Math.floor(Date.now()/1e3),n=parseInt(e,10);if(isNaN(n))throw new o(`Invalid Signature Headers`);if(t-n>i)throw new o(`Message timestamp too old`);if(n>t+i)throw new o(`Message timestamp too new`);return new Date(n*1e3)}};e.Webhook=s,s.prefix=`whsec_`})),iG=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.Webhook=e.WebhookVerificationError=void 0;var t=rG(),n=rG();Object.defineProperty(e,"WebhookVerificationError",{enumerable:!0,get:function(){return n.WebhookVerificationError}}),e.Webhook=class{constructor(e,n){this.inner=new t.Webhook(e,n)}verify(e,t){let n={};for(let e of Object.keys(t))n[e.toLowerCase()]=t[e];return n[`webhook-id`]=n[`svix-id`]??n[`webhook-id`]??``,n[`webhook-signature`]=n[`svix-signature`]??n[`webhook-signature`]??``,n[`webhook-timestamp`]=n[`svix-timestamp`]??n[`webhook-timestamp`]??``,this.inner.verify(e,n)}sign(e,t,n){return this.inner.sign(e,t,n)}}})),aG=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.EndpointDisabledTriggerSerializer=e.EndpointDisabledTrigger=void 0,(function(e){e.Manual=`manual`,e.Automatic=`automatic`})(e.EndpointDisabledTrigger||={}),e.EndpointDisabledTriggerSerializer={_fromJsonObject(e){return e},_toJsonObject(e){return e}}})),oG=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.OrderingSerializer=e.Ordering=void 0,(function(e){e.Ascending=`ascending`,e.Descending=`descending`})(e.Ordering||={}),e.OrderingSerializer={_fromJsonObject(e){return e},_toJsonObject(e){return e}}})),sG=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.StatusCodeClass=e.SinkStatusIn=e.SinkStatus=e.Ordering=e.MessageStatusText=e.MessageStatus=e.MessageAttemptTriggerType=e.EndpointDisabledTrigger=e.ConnectorProduct=e.ConnectorKind=e.BackgroundTaskType=e.BackgroundTaskStatus=e.AppPortalCapability=void 0;var t=UB();Object.defineProperty(e,"AppPortalCapability",{enumerable:!0,get:function(){return t.AppPortalCapability}});var n=QB();Object.defineProperty(e,"BackgroundTaskStatus",{enumerable:!0,get:function(){return n.BackgroundTaskStatus}});var r=$B();Object.defineProperty(e,"BackgroundTaskType",{enumerable:!0,get:function(){return r.BackgroundTaskType}});var i=rV();Object.defineProperty(e,"ConnectorKind",{enumerable:!0,get:function(){return i.ConnectorKind}});var a=iV();Object.defineProperty(e,"ConnectorProduct",{enumerable:!0,get:function(){return a.ConnectorProduct}});var o=aG();Object.defineProperty(e,"EndpointDisabledTrigger",{enumerable:!0,get:function(){return o.EndpointDisabledTrigger}});var s=jU();Object.defineProperty(e,"MessageAttemptTriggerType",{enumerable:!0,get:function(){return s.MessageAttemptTriggerType}});var c=dV();Object.defineProperty(e,"MessageStatus",{enumerable:!0,get:function(){return c.MessageStatus}});var l=OU();Object.defineProperty(e,"MessageStatusText",{enumerable:!0,get:function(){return l.MessageStatusText}});var u=oG();Object.defineProperty(e,"Ordering",{enumerable:!0,get:function(){return u.Ordering}});var d=SW();Object.defineProperty(e,"SinkStatus",{enumerable:!0,get:function(){return d.SinkStatus}});var f=AW();Object.defineProperty(e,"SinkStatusIn",{enumerable:!0,get:function(){return f.SinkStatusIn}});var p=fV();Object.defineProperty(e,"StatusCodeClass",{enumerable:!0,get:function(){return p.StatusCodeClass}})})),cG=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.SvixInternal=void 0;var t=bG();e.SvixInternal=class extends t.Svix{getRequestCtx(){return this.requestCtx}}})),lG=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.SinkInCommonSerializer=void 0,e.SinkInCommonSerializer={_fromJsonObject(e){return{channels:e.channels,description:e.description,disabled:e.disabled,filterTypes:e.filterTypes,metadata:e.metadata,rateLimit:e.rateLimit,secret:e.secret,throttleRate:e.throttleRate,uid:e.uid}},_toJsonObject(e){return{channels:e.channels,description:e.description,disabled:e.disabled,filterTypes:e.filterTypes,metadata:e.metadata,rateLimit:e.rateLimit,secret:e.secret,throttleRate:e.throttleRate,uid:e.uid}}}})),uG=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.AutoConfigSinkTypeSerializer=void 0;var t=_V(),n=lG();e.AutoConfigSinkTypeSerializer={_fromJsonObject(e){let r=e.type;function i(r){switch(r){case`poller`:return n.SinkInCommonSerializer._fromJsonObject(e.config);case`http`:return t.EndpointInSerializer._fromJsonObject(e.config);default:throw Error(`Unexpected type: ${r}`)}}return{type:r,config:i(r)}},_toJsonObject(e){let r;switch(e.type){case`poller`:r=n.SinkInCommonSerializer._toJsonObject(e.config);break;case`http`:r=t.EndpointInSerializer._toJsonObject(e.config)}return{type:e.type,config:r}}}})),dG=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.SubscribeInSerializer=void 0;var t=uG(),n=_V();e.SubscribeInSerializer={_fromJsonObject(e){return{endpoint:e.endpoint==null?void 0:n.EndpointInSerializer._fromJsonObject(e.endpoint),sink:e.sink==null?void 0:t.AutoConfigSinkTypeSerializer._fromJsonObject(e.sink)}},_toJsonObject(e){return{endpoint:e.endpoint==null?void 0:n.EndpointInSerializer._toJsonObject(e.endpoint),sink:e.sink==null?void 0:t.AutoConfigSinkTypeSerializer._toJsonObject(e.sink)}}}})),fG=i(((e,t,n)=>{var r=n&&n.__awaiter||function(e,t,n,r){function i(e){return e instanceof n?e:new n(function(t){t(e)})}return new(n||=Promise)(function(n,a){function o(e){try{c(r.next(e))}catch(e){a(e)}}function s(e){try{c(r.throw(e))}catch(e){a(e)}}function c(e){e.done?n(e.value):i(e.value).then(o,s)}c((r=r.apply(e,t||[])).next())})};Object.defineProperty(e,"__esModule",{value:!0}),e.EndpointAutoConfig=void 0;var i=vV(),a=dG(),o=BB();e.EndpointAutoConfig=class{constructor(e){this.requestCtx=e}update(e,t,n={}){return r(this,void 0,void 0,function*(){let r=new o.SvixRequest(o.HttpMethod.PUT,`/api/v1/app/{app_id}/endpoint/{endpoint_id}/auto-config`);return r.setPathParam(`app_id`,e),r.setPathParam(`endpoint_id`,t),r.setBody(a.SubscribeInSerializer._toJsonObject(n)),yield r.send(this.requestCtx,i.EndpointOutSerializer._fromJsonObject)})}}})),pG=i(((e,t,n)=>{var r=n&&n.__awaiter||function(e,t,n,r){function i(e){return e instanceof n?e:new n(function(t){t(e)})}return new(n||=Promise)(function(n,a){function o(e){try{c(r.next(e))}catch(e){a(e)}}function s(e){try{c(r.throw(e))}catch(e){a(e)}}function c(e){e.done?n(e.value):i(e.value).then(o,s)}c((r=r.apply(e,t||[])).next())})};Object.defineProperty(e,"__esModule",{value:!0}),e.Endpoint=void 0;var i=CV(),a=fG(),o=BB();e.Endpoint=class{constructor(e){this.requestCtx=e}get auto_config(){return new a.EndpointAutoConfig(this.requestCtx)}transformationPartialUpdate(e,t,n={}){return r(this,void 0,void 0,function*(){let r=new o.SvixRequest(o.HttpMethod.PATCH,`/api/v1/app/{app_id}/endpoint/{endpoint_id}/transformation`);return r.setPathParam(`app_id`,e),r.setPathParam(`endpoint_id`,t),r.setBody(i.EndpointTransformationInSerializer._toJsonObject(n)),yield r.sendNoResponseBody(this.requestCtx)})}}})),mG=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.AutoConfig=e.decodeAutoconfigTokenV1=e.isAutoConfigTokenContentV1=e.AutoConfigError=void 0;var t=cG(),n=pG(),r=iG(),i=`auto_v1_`,a=class extends Error{constructor(e=`invalid token`){super(e),this.name=`AutoConfigError`}};e.AutoConfigError=a;function o(e){if(typeof e!=`object`||!e)return!1;let{aid:t,eid:n,surl:r,esec:i,tok:a}=e;return typeof t==`string`&&typeof n==`string`&&typeof r==`string`&&typeof i==`string`&&typeof a==`string`}e.isAutoConfigTokenContentV1=o;function s(e){if(!e.startsWith(i))throw new a;let t=e.slice(8),n;try{n=Buffer.from(t,`base64`).toString(`utf8`)}catch{throw new a}let r;try{r=JSON.parse(n)}catch{throw new a}if(!o(r))throw new a;return r}e.decodeAutoconfigTokenV1=s,e.AutoConfig=class{constructor(e,n){let i=s(e),o;try{o=new r.Webhook(i.esec)}catch{throw new a}this.appId=i.aid,this.endpointId=i.eid,this.endpointIn=n,this.webhook=o;let c=new t.SvixInternal(i.tok,{serverUrl:i.surl});this.requestCtx=c.getRequestCtx()}subscribe(){return new n.Endpoint(this.requestCtx).auto_config.update(this.appId,this.endpointId,{endpoint:this.endpointIn})}verify(e,t){return this.webhook.verify(e,t)}}})),hG=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.PollerV2CommitInSerializer=void 0,e.PollerV2CommitInSerializer={_fromJsonObject(e){return{offset:e.offset}},_toJsonObject(e){return{offset:e.offset}}}})),gG=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.PollerV2MessageOutSerializer=void 0,e.PollerV2MessageOutSerializer={_fromJsonObject(e){return{channels:e.channels,deliverAt:e.deliverAt?new Date(e.deliverAt):null,eventId:e.eventId,eventType:e.eventType,headers:e.headers,id:e.id,offset:e.offset,payload:e.payload,tags:e.tags,timestamp:new Date(e.timestamp)}},_toJsonObject(e){return{channels:e.channels,deliverAt:e.deliverAt,eventId:e.eventId,eventType:e.eventType,headers:e.headers,id:e.id,offset:e.offset,payload:e.payload,tags:e.tags,timestamp:e.timestamp}}}})),_G=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.PollerV2PollOutSerializer=void 0;var t=gG();e.PollerV2PollOutSerializer={_fromJsonObject(e){return{data:e.data.map(e=>t.PollerV2MessageOutSerializer._fromJsonObject(e)),done:e.done}},_toJsonObject(e){return{data:e.data.map(e=>t.PollerV2MessageOutSerializer._toJsonObject(e)),done:e.done}}}})),vG=i(((e,t,n)=>{var r=n&&n.__awaiter||function(e,t,n,r){function i(e){return e instanceof n?e:new n(function(t){t(e)})}return new(n||=Promise)(function(n,a){function o(e){try{c(r.next(e))}catch(e){a(e)}}function s(e){try{c(r.throw(e))}catch(e){a(e)}}function c(e){e.done?n(e.value):i(e.value).then(o,s)}c((r=r.apply(e,t||[])).next())})};Object.defineProperty(e,"__esModule",{value:!0}),e.MessagePollerv2=void 0;var i=hG(),a=_G(),o=BB();e.MessagePollerv2=class{constructor(e){this.requestCtx=e}consumerPoll(e,t,n,i){return r(this,void 0,void 0,function*(){let r=new o.SvixRequest(o.HttpMethod.GET,`/api/v1/app/{app_id}/polling-endpoint/{sink_id}/consumer/{consumer_id}`);return r.setPathParam(`app_id`,e),r.setPathParam(`sink_id`,t),r.setPathParam(`consumer_id`,n),r.setQueryParams({limit:i?.limit,lease_duration_ms:i?.leaseDurationMs,starting_position:i?.startingPosition}),yield r.send(this.requestCtx,a.PollerV2PollOutSerializer._fromJsonObject)})}consumerCommit(e,t,n,a,s){return r(this,void 0,void 0,function*(){let r=new o.SvixRequest(o.HttpMethod.POST,`/api/v1/app/{app_id}/polling-endpoint/{sink_id}/consumer/{consumer_id}/commit`);return r.setPathParam(`app_id`,e),r.setPathParam(`sink_id`,t),r.setPathParam(`consumer_id`,n),r.setHeaderParam(`idempotency-key`,s?.idempotencyKey),r.setBody(i.PollerV2CommitInSerializer._toJsonObject(a)),yield r.sendNoResponseBody(this.requestCtx)})}}})),yG=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.AutoConfigConsumer=void 0;var t=cG(),n=pG(),r=vG(),i=mG();e.AutoConfigConsumer=class{constructor(e,n){let r=(0,i.decodeAutoconfigTokenV1)(e);this.appId=r.aid,this.sinkId=r.eid,this.sinkIn=n;let a=new t.SvixInternal(r.tok,{serverUrl:r.surl});this.requestCtx=a.getRequestCtx()}subscribe(){return new n.Endpoint(this.requestCtx).auto_config.update(this.appId,this.sinkId,{sink:{type:`poller`,config:this.sinkIn}})}receive(e,t){return new r.MessagePollerv2(this.requestCtx).consumerPoll(this.appId,this.sinkId,e,t)}commit(e,t,n){return new r.MessagePollerv2(this.requestCtx).consumerCommit(this.appId,this.sinkId,e,{offset:t},n)}}})),bG=i(((e,t,n)=>{var r=n&&n.__createBinding||(Object.create?(function(e,t,n,r){r===void 0&&(r=n);var i=Object.getOwnPropertyDescriptor(t,n);(!i||(`get`in i?!t.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,i)}):(function(e,t,n,r){r===void 0&&(r=n),e[r]=t[n]})),i=n&&n.__exportStar||function(e,t){for(var n in e)n!=="default"&&!Object.prototype.hasOwnProperty.call(t,n)&&r(t,e,n)};Object.defineProperty(e,"__esModule",{value:!0}),e.AutoConfigConsumer=e.AutoConfigError=e.AutoConfig=e.Svix=e.messageInRaw=e.ValidationError=e.HttpErrorOut=e.HTTPValidationError=e.ApiException=void 0;var a=VB(),o=ZB(),s=nV(),c=uV(),l=PV(),u=zV(),d=qV(),f=JV(),p=lU(),m=hU(),h=EU(),g=IU(),_=KU(),v=XU(),y=QW(),b=GU(),x=zB();Object.defineProperty(e,"ApiException",{enumerable:!0,get:function(){return x.ApiException}});var S=$W();Object.defineProperty(e,"HTTPValidationError",{enumerable:!0,get:function(){return S.HTTPValidationError}}),Object.defineProperty(e,"HttpErrorOut",{enumerable:!0,get:function(){return S.HttpErrorOut}}),Object.defineProperty(e,"ValidationError",{enumerable:!0,get:function(){return S.ValidationError}}),i(iG(),e),i(sG(),e);var C=EU();Object.defineProperty(e,"messageInRaw",{enumerable:!0,get:function(){return C.messageInRaw}});var w=[{region:`us`,url:`https://api.us.svix.com`},{region:`eu`,url:`https://api.eu.svix.com`},{region:`in`,url:`https://api.in.svix.com`},{region:`ca`,url:`https://api.ca.svix.com`},{region:`au`,url:`https://api.au.svix.com`}];e.Svix=class{constructor(e,t={}){let n=w.find(t=>t.region===e.split(`.`)[1])?.url,r=t.serverUrl??n??`https://api.svix.com`;this.requestCtx=t.retryScheduleInMs?{baseUrl:r,token:e,timeout:t.requestTimeout,retryScheduleInMs:t.retryScheduleInMs,fetch:t.fetch}:t.numRetries?{baseUrl:r,token:e,timeout:t.requestTimeout,numRetries:t.numRetries,fetch:t.fetch}:{baseUrl:r,token:e,timeout:t.requestTimeout,fetch:t.fetch}}get application(){return new a.Application(this.requestCtx)}get authentication(){return new o.Authentication(this.requestCtx)}get backgroundTask(){return new s.BackgroundTask(this.requestCtx)}get connector(){return new c.Connector(this.requestCtx)}get endpoint(){return new l.Endpoint(this.requestCtx)}get environment(){return new u.Environment(this.requestCtx)}get eventType(){return new d.EventType(this.requestCtx)}get health(){return new f.Health(this.requestCtx)}get ingest(){return new p.Ingest(this.requestCtx)}get integration(){return new m.Integration(this.requestCtx)}get message(){return new h.Message(this.requestCtx)}get messageAttempt(){return new g.MessageAttempt(this.requestCtx)}get operationalWebhook(){return new _.OperationalWebhook(this.requestCtx)}get statistics(){return new v.Statistics(this.requestCtx)}get streaming(){return new y.Streaming(this.requestCtx)}get operationalWebhookEndpoint(){return new b.OperationalWebhookEndpoint(this.requestCtx)}};var T=mG();Object.defineProperty(e,"AutoConfig",{enumerable:!0,get:function(){return T.AutoConfig}}),Object.defineProperty(e,"AutoConfigError",{enumerable:!0,get:function(){return T.AutoConfigError}});var E=yG();Object.defineProperty(e,"AutoConfigConsumer",{enumerable:!0,get:function(){return E.AutoConfigConsumer}})})),xG=bG(),SG=class{constructor(e,t){this.webhooksResource=e,this.webhookSigningSecret=t}verify({payload:e,headers:t,svix:n,signing_secret:r}){let i=r??this.webhookSigningSecret;if(!i)throw new CG(`Webhook signing secret is required. Pass it to PrivyClient constructor or to verify().`);let a=typeof e==`string`?e:JSON.stringify(e),o;if(t)o={"svix-id":t[`svix-id`],"svix-timestamp":t[`svix-timestamp`],"svix-signature":t[`svix-signature`]};else if(n)o={"svix-id":n.id,"svix-timestamp":n.timestamp,"svix-signature":n.signature};else throw new CG(`Webhook headers are required (svix-id, svix-timestamp, svix-signature).`);try{new xG.Webhook(i).verify(a,o)}catch(e){throw e instanceof Error?new CG(`Webhook verification failed: ${e.message}`):new CG(`Webhook verification failed`)}return this.webhooksResource.unsafeUnwrap(a)}},CG=class extends nR{},wG={p:BigInt(`0xffffffff00000001000000000000000000000000ffffffffffffffffffffffff`),n:BigInt(`0xffffffff00000000ffffffffffffffffbce6faada7179e84f3b9cac2fc632551`),h:BigInt(1),a:BigInt(`0xffffffff00000001000000000000000000000000fffffffffffffffffffffffc`),b:BigInt(`0x5ac635d8aa3a93e7b3ebbd55769886bc651d06b0cc53b0f63bce3c3e27d2604b`),Gx:BigInt(`0x6b17d1f2e12c4247f8bce6e563a440f277037d812deb33a0f4a13945d898c296`),Gy:BigInt(`0x4fe342e2fe1a7f9b8ee7eb4a7c0f9e162bce33576b315ececbb6406837bf51f5`)},TG={p:BigInt(`0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffeffffffff0000000000000000ffffffff`),n:BigInt(`0xffffffffffffffffffffffffffffffffffffffffffffffffc7634d81f4372ddf581a0db248b0a77aecec196accc52973`),h:BigInt(1),a:BigInt(`0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffeffffffff0000000000000000fffffffc`),b:BigInt(`0xb3312fa7e23ee7e4988e056be3f82d19181d9c6efe8141120314088f5013875ac656398d8a2ed19d2a85c8edd3ec2aef`),Gx:BigInt(`0xaa87ca22be8b05378eb1c71ef320ad746e1d3b628ba79b9859f741e082542a385502f25dbf55296c3a545e3872760ab7`),Gy:BigInt(`0x3617de4a96262c6f5d9e98bf9292dc29f8f41dbd289a147ce9da3113b5f0b8c00a60b1ce1d7e819d7a431d7c90ea0e5f`)},EG={p:BigInt(`0x1ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff`),n:BigInt(`0x01fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffa51868783bf2f966b7fcc0148f709a5d03bb5c9b8899c47aebb6fb71e91386409`),h:BigInt(1),a:BigInt(`0x1fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc`),b:BigInt(`0x0051953eb9618e1c9a1f929a21a0b68540eea2da725b99b315f3b8b489918ef109e156193951ec7e937b1652c0bd3bb1bf073573df883d2c34f1ef451fd46b503f00`),Gx:BigInt(`0x00c6858e06b70404e9cd9e3ecb662395b4429c648139053fb521f828af606b4d3dbaa14b5e77efe75928fe1dc127a2ffa8de3348b3c1856a429bf97e7e31c2e5bd66`),Gy:BigInt(`0x011839296a789a3bc0045c8a5fb42c7d1bd998f54449579b446817afbd17273e662c97ee72995ef42640c550b9013fad0761353c7086a272c24088be94769fd16650`)},DG=Pd(wG.p),OG=Pd(TG.p),kG=Pd(EG.p),AG=Cf({...wG,Fp:DG,lowS:!1},An);Cf({...TG,Fp:OG,lowS:!1},Mn),Cf({...EG,Fp:kG,lowS:!1,allowedPrivateKeyLengths:[130,131,132]},Nn);var jG=i(((e,t)=>{t.exports=function e(t){if(typeof t==`number`&&isNaN(t))throw Error(`NaN is not allowed`);if(typeof t==`number`&&!isFinite(t))throw Error(`Infinity is not allowed`);return typeof t!=`object`||!t?JSON.stringify(t):t.toJSON instanceof Function?e(t.toJSON()):Array.isArray(t)?`[${t.reduce((t,n,r)=>`${t}${r===0?``:`,`}${e(n===void 0||typeof n==`symbol`?null:n)}`,``)}]`:`{${Object.keys(t).sort().reduce((n,r)=>t[r]===void 0||typeof t[r]==`symbol`?n:`${n}${n.length===0?``:`,`}${e(r)}:${e(t[r])}`,``)}}`}})),MG=class extends Error{constructor(e){let t;t=e instanceof Error?e.message:typeof e==`string`?e:``,super(t),this.name=this.constructor.name}},NG=class extends MG{},PG=class extends MG{},FG=class extends MG{},IG=class extends MG{},LG=class extends MG{},RG=class extends MG{},zG=class extends MG{},BG=class extends MG{},VG=class extends MG{},HG=class extends MG{},UG=class extends MG{},WG=GG(globalThis,{});function GG(e,t){return new Proxy(e,{get(n,r,i){return r in t?t[r]:e[r]},set(n,r,i){return r in t&&delete t[r],e[r]=i,!0},deleteProperty(n,r){let i=!1;return r in t&&(delete t[r],i=!0),r in e&&(delete e[r],i=!0),i},ownKeys(n){let r=Reflect.ownKeys(e),i=Reflect.ownKeys(t),a=new Set(i);return[...r.filter(e=>!a.has(e)),...i]},defineProperty(n,r,i){return r in t&&delete t[r],Reflect.defineProperty(e,r,i),!0},getOwnPropertyDescriptor(n,r){return r in t?Reflect.getOwnPropertyDescriptor(t,r):Reflect.getOwnPropertyDescriptor(e,r)},has(n,r){return r in t||r in e}})}async function KG(){if(WG!==void 0&&globalThis.crypto!==void 0)return globalThis.crypto.subtle;try{let{webcrypto:e}=await import(`crypto`);return e.subtle}catch(e){throw new UG(e)}}var qG=class{constructor(){Object.defineProperty(this,"_api",{enumerable:!0,configurable:!0,writable:!0,value:void 0})}async _setup(){this._api===void 0&&(this._api=await KG())}},JG={Base:0,Psk:1,Auth:2,AuthPsk:3},YG={NotAssigned:0,DhkemP256HkdfSha256:16,DhkemP384HkdfSha384:17,DhkemP521HkdfSha512:18,DhkemSecp256k1HkdfSha256:19,DhkemX25519HkdfSha256:32,DhkemX448HkdfSha512:33,HybridkemX25519Kyber768:48,MlKem512:64,MlKem768:65,MlKem1024:66,XWing:25722},XG={HkdfSha256:1,HkdfSha384:2,HkdfSha512:3,Sha3256:4,Sha3384:5,Sha3512:6,Shake128:16,Shake256:17,TurboShake128:18,TurboShake256:19},ZG={Aes128Gcm:1,Aes256Gcm:2,Chacha20Poly1305:3,ExportOnly:65535},QG=new Uint8Array,$G=0n,eK=(()=>{let e=Array(256),t=0,n=0n;for(;t<256;)e[t]=n,t++,n+=1n;return e})(),tK=new Uint8Array([75,69,77,0,0]),nK=new Uint8Array([72,80,75,69,45,118,49]);function rK(e){return new Uint8Array(iK(e))}function iK(e){return e instanceof ArrayBuffer?e:ArrayBuffer.isView(e)?new Uint8Array(e.buffer,e.byteOffset,e.byteLength).slice().buffer:new Uint8Array(e).slice().buffer}var aK=class extends qG{constructor(){super(),Object.defineProperty(this,"id",{enumerable:!0,configurable:!0,writable:!0,value:XG.HkdfSha256}),Object.defineProperty(this,"hashSize",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"_suiteId",{enumerable:!0,configurable:!0,writable:!0,value:QG}),Object.defineProperty(this,"algHash",{enumerable:!0,configurable:!0,writable:!0,value:{name:`HMAC`,hash:`SHA-256`,length:256}})}init(e){this._suiteId=e}buildLabeledIkm(e,t){this._checkInit();let n=new Uint8Array(7+this._suiteId.byteLength+e.byteLength+t.byteLength);return n.set(nK,0),n.set(this._suiteId,7),n.set(e,7+this._suiteId.byteLength),n.set(t,7+this._suiteId.byteLength+e.byteLength),n}buildLabeledInfo(e,t,n){this._checkInit();let r=new Uint8Array(9+this._suiteId.byteLength+e.byteLength+t.byteLength);return r.set(new Uint8Array([0,n]),0),r.set(nK,2),r.set(this._suiteId,9),r.set(e,9+this._suiteId.byteLength),r.set(t,9+this._suiteId.byteLength+e.byteLength),r}async extract(e,t){await this._setup();let n=e.byteLength===0?new ArrayBuffer(this.hashSize):iK(e);if(n.byteLength!==this.hashSize)throw new NG(`The salt length must be the same as the hashSize`);let r=iK(t),i=await this._api.importKey(`raw`,n,this.algHash,!1,[`sign`]);return await this._api.sign(`HMAC`,i,r)}async expand(e,t,n){await this._setup();let r=iK(e),i=await this._api.importKey(`raw`,r,this.algHash,!1,[`sign`]),a=new ArrayBuffer(n),o=new Uint8Array(a),s=QG,c=rK(t),l=new Uint8Array(1);if(n>255*this.hashSize)throw Error(`Entropy limit reached`);let u=new Uint8Array(this.hashSize+c.length+1);for(let e=1,t=0;t<o.length;e++)l[0]=e,u.set(s,0),u.set(c,s.length),u.set(l,s.length+c.length),s=new Uint8Array(await this._api.sign(`HMAC`,i,u.slice(0,s.length+c.length+1))),o.length-t>=s.length?(o.set(s,t),t+=s.length):(o.set(s.slice(0,o.length-t),t),t+=o.length-t);return a}async extractAndExpand(e,t,n,r){await this._setup();let i=iK(t),a=await this._api.importKey(`raw`,i,`HKDF`,!1,[`deriveBits`]);return await this._api.deriveBits({name:`HKDF`,hash:this.algHash.hash,salt:iK(e),info:iK(n)},a,r*8)}async labeledExtract(e,t,n){return await this.extract(e,this.buildLabeledIkm(t,n))}async labeledExpand(e,t,n,r){return await this.expand(e,this.buildLabeledInfo(t,n,r),r)}_checkInit(){if(this._suiteId===QG)throw Error(`Not initialized. Call init()`)}},oK=class extends aK{constructor(){super(...arguments),Object.defineProperty(this,"id",{enumerable:!0,configurable:!0,writable:!0,value:XG.HkdfSha256}),Object.defineProperty(this,"hashSize",{enumerable:!0,configurable:!0,writable:!0,value:32}),Object.defineProperty(this,"algHash",{enumerable:!0,configurable:!0,writable:!0,value:{name:`HMAC`,hash:`SHA-256`,length:256}})}},sK=e=>typeof e==`object`&&!!e&&typeof e.privateKey==`object`&&typeof e.publicKey==`object`;function cK(e,t){if(t<=0)throw Error(`i2Osp: too small size`);if(e>=256**t)throw Error(`i2Osp: too large integer`);let n=new Uint8Array(t);for(let r=0;r<t&&e;r++)n[t-(r+1)]=e%256,e=Math.floor(e/256);return n}function lK(e,t){let n=new Uint8Array(e.length+t.length);return n.set(e,0),n.set(t,e.length),n}function uK(e){let t=e.replace(/-/g,`+`).replace(/_/g,`/`),n=atob(t),r=new Uint8Array(n.length);for(let e=0;e<n.length;e++)r[e]=n.charCodeAt(e);return r}function dK(e,t){if(e.byteLength!==t.byteLength)throw Error(`xor: different length inputs`);let n=new Uint8Array(e.byteLength);for(let r=0;r<e.byteLength;r++)n[r]=e[r]^t[r];return n}var fK=new Uint8Array([101,97,101,95,112,114,107]),pK=new Uint8Array([115,104,97,114,101,100,95,115,101,99,114,101,116]);function mK(e,t,n){let r=new Uint8Array(e.length+t.length+n.length);return r.set(e,0),r.set(t,e.length),r.set(n,e.length+t.length),r}var hK=class{constructor(e,t,n){Object.defineProperty(this,"id",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"secretSize",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"encSize",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"publicKeySize",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"privateKeySize",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"_prim",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_kdf",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.id=e,this._prim=t,this._kdf=n;let r=new Uint8Array(tK);r.set(cK(this.id,2),3),this._kdf.init(r)}async serializePublicKey(e){return await this._prim.serializePublicKey(e)}async deserializePublicKey(e){return await this._prim.deserializePublicKey(iK(e))}async serializePrivateKey(e){return await this._prim.serializePrivateKey(e)}async deserializePrivateKey(e){return await this._prim.deserializePrivateKey(iK(e))}async importKey(e,t,n=!0){return await this._prim.importKey(e,t,n)}async generateKeyPair(){return await this._prim.generateKeyPair()}async deriveKeyPair(e){let t=iK(e);if(t.byteLength>8192)throw new NG(`Too long ikm`);return await this._prim.deriveKeyPair(t)}async encap(e){let t;t=e.ekm===void 0?await this.generateKeyPair():sK(e.ekm)?e.ekm:await this.deriveKeyPair(e.ekm);let n=await this._prim.serializePublicKey(t.publicKey),r=await this._prim.serializePublicKey(e.recipientPublicKey);try{let i;if(e.senderKey===void 0)i=new Uint8Array(await this._prim.dh(t.privateKey,e.recipientPublicKey));else{let n=sK(e.senderKey)?e.senderKey.privateKey:e.senderKey;i=lK(new Uint8Array(await this._prim.dh(t.privateKey,e.recipientPublicKey)),new Uint8Array(await this._prim.dh(n,e.recipientPublicKey)))}let a;if(e.senderKey===void 0)a=lK(new Uint8Array(n),new Uint8Array(r));else{let t=sK(e.senderKey)?e.senderKey.publicKey:await this._prim.derivePublicKey(e.senderKey),i=await this._prim.serializePublicKey(t);a=mK(new Uint8Array(n),new Uint8Array(r),new Uint8Array(i))}return{enc:n,sharedSecret:await this._generateSharedSecret(i,a)}}catch(e){throw new IG(e)}}async decap(e){let t=iK(e.enc),n=await this._prim.deserializePublicKey(t),r=sK(e.recipientKey)?e.recipientKey.privateKey:e.recipientKey,i=sK(e.recipientKey)?e.recipientKey.publicKey:await this._prim.derivePublicKey(e.recipientKey),a=await this._prim.serializePublicKey(i);try{let i;i=e.senderPublicKey===void 0?new Uint8Array(await this._prim.dh(r,n)):lK(new Uint8Array(await this._prim.dh(r,n)),new Uint8Array(await this._prim.dh(r,e.senderPublicKey)));let o;if(e.senderPublicKey===void 0)o=lK(new Uint8Array(t),new Uint8Array(a));else{let n=await this._prim.serializePublicKey(e.senderPublicKey);o=new Uint8Array(t.byteLength+a.byteLength+n.byteLength),o.set(new Uint8Array(t),0),o.set(new Uint8Array(a),t.byteLength),o.set(new Uint8Array(n),t.byteLength+a.byteLength)}return await this._generateSharedSecret(i,o)}catch(e){throw new LG(e)}}async _generateSharedSecret(e,t){let n=this._kdf.buildLabeledIkm(fK,e),r=this._kdf.buildLabeledInfo(pK,t,this.secretSize);return await this._kdf.extractAndExpand(QG,n,r,this.secretSize)}},gK=[`deriveBits`],_K=new Uint8Array([100,107,112,95,112,114,107]),vK=class{constructor(e){Object.defineProperty(this,"_num",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this._num=new Uint8Array(e)}val(){return this._num}reset(){this._num.fill(0)}set(e){if(e.length!==this._num.length)throw Error(`Bignum.set: invalid argument`);this._num.set(e)}isZero(){for(let e=0;e<this._num.length;e++)if(this._num[e]!==0)return!1;return!0}lessThan(e){if(e.length!==this._num.length)throw Error(`Bignum.lessThan: invalid argument`);for(let t=0;t<this._num.length;t++){if(this._num[t]<e[t])return!0;if(this._num[t]>e[t])return!1}return!1}},yK=new Uint8Array([99,97,110,100,105,100,97,116,101]),bK=new Uint8Array([255,255,255,255,0,0,0,0,255,255,255,255,255,255,255,255,188,230,250,173,167,23,158,132,243,185,202,194,252,99,37,81]),xK=new Uint8Array([255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,199,99,77,129,244,55,45,223,88,26,13,178,72,176,167,122,236,236,25,106,204,197,41,115]),SK=new Uint8Array([1,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,250,81,134,135,131,191,47,150,107,127,204,1,72,247,9,165,208,59,181,201,184,137,156,71,174,187,111,183,30,145,56,100,9]),CK=new Uint8Array([48,65,2,1,0,48,19,6,7,42,134,72,206,61,2,1,6,8,42,134,72,206,61,3,1,7,4,39,48,37,2,1,1,4,32]),wK=new Uint8Array([48,78,2,1,0,48,16,6,7,42,134,72,206,61,2,1,6,5,43,129,4,0,34,4,55,48,53,2,1,1,4,48]),TK=new Uint8Array([48,96,2,1,0,48,16,6,7,42,134,72,206,61,2,1,6,5,43,129,4,0,35,4,73,48,71,2,1,1,4,66]),EK={p:115792089210356248762697446949407573530086143415290314195533631308867097853951n,b:41058363725152142129326129780047268409114441015993725554835256314039467401291n,gx:48439561293906451759052585252797914202762949526041747995844080717082404635286n,gy:36134250956749795798585127919587881956611106672985015071877198253568414405109n,coordinateSize:32},DK={p:39402006196394479212279040100143613805079739270465446667948293404245721771496870329047266088258938001861606973112319n,b:27580193559959705877849011840389048093056905856361568521428707301988689241309860865136260764883745107765439761230575n,gx:26247035095799689268623156744566981891852923491109213387815615900925518854738050089022388053975719786650872476732087n,gy:8325710961489029985546751289520108179287853048861315594709205902480503199884419224438643760392947333078086511627871n,coordinateSize:48},OK={p:(1n<<521n)-1n,b:1093849038073734274511112390766805569936207598951683748994586394495953116150735016013708737573759623248592132296706313309438452531591012912142327488478985984n,gx:2661740802050217063228768716723360960729859168756973147706671368418802944996427808491545080627771902352094241225065558662157113545570916814161637315895999846n,gy:3757180025770020463545507224491183603594455134769762486694567779615544477440556316691234405012945539562144444537289428522585666729196580810124344277578376784n,coordinateSize:66};function kK(e,t){let n=e%t;return n>=0n?n:n+t}function AK(e,t,n){let r=1n,i=kK(e,n),a=t;for(;a>0n;)(a&1n)==1n&&(r=kK(r*i,n)),i=kK(i*i,n),a>>=1n;return r}function jK(e,t){let n=AK(e,t+1n>>2n,t);if(kK(n*n,t)!==kK(e,t))throw Error(`Invalid ECDH point`);return n}function MK(e){let t=0n;for(let n of e)t=t<<8n|eK[n];return t}function NK(e,t){let n=new Uint8Array(t),r=e;for(let e=t-1;e>=0;e--)n[e]=Number(r&255n),r>>=8n;if(r!==0n)throw Error(`Invalid coordinate length`);return n}function PK(e,t,n){let r=new Uint8Array(1+n*2);return r[0]=4,r.set(NK(e,n),1),r.set(NK(t,n),1+n),r}var FK=class extends qG{constructor(e,t){switch(super(),Object.defineProperty(this,"_hkdf",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_alg",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_nPk",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_nSk",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_nDh",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_order",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_bitmask",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_pkcs8AlgId",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_curveParams",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this._hkdf=t,e){case YG.DhkemP256HkdfSha256:this._alg={name:`ECDH`,namedCurve:`P-256`},this._nPk=65,this._nSk=32,this._nDh=32,this._order=bK,this._bitmask=255,this._pkcs8AlgId=CK,this._curveParams=EK;break;case YG.DhkemP384HkdfSha384:this._alg={name:`ECDH`,namedCurve:`P-384`},this._nPk=97,this._nSk=48,this._nDh=48,this._order=xK,this._bitmask=255,this._pkcs8AlgId=wK,this._curveParams=DK;break;default:this._alg={name:`ECDH`,namedCurve:`P-521`},this._nPk=133,this._nSk=66,this._nDh=66,this._order=SK,this._bitmask=1,this._pkcs8AlgId=TK,this._curveParams=OK}}async serializePublicKey(e){await this._setup();try{return await this._api.exportKey(`raw`,e)}catch(e){throw new PG(e)}}async deserializePublicKey(e){await this._setup();try{return await this._importRawKey(iK(e),!0)}catch(e){throw new FG(e)}}async serializePrivateKey(e){await this._setup();try{let t=await this._api.exportKey(`jwk`,e);if(!(`d`in t))throw Error(`Not private key`);return uK(t.d).buffer}catch(e){throw new PG(e)}}async deserializePrivateKey(e){await this._setup();try{return await this._importRawKey(iK(e),!1)}catch(e){throw new FG(e)}}async importKey(e,t,n){await this._setup();try{if(e===`raw`)return await this._importRawKey(t,n);if(t instanceof ArrayBuffer)throw Error(`Invalid jwk key format`);return await this._importJWK(t,n)}catch(e){throw new FG(e)}}async generateKeyPair(){await this._setup();try{return await this._api.generateKey(this._alg,!0,gK)}catch(e){throw new UG(e)}}async deriveKeyPair(e){await this._setup();try{let t=iK(e),n=await this._hkdf.labeledExtract(QG,_K,new Uint8Array(t)),r=new vK(this._nSk);for(let e=0;r.isZero()||!r.lessThan(this._order);e++){if(e>255)throw Error(`Faild to derive a key pair`);let t=new Uint8Array(await this._hkdf.labeledExpand(n,yK,cK(e,1),this._nSk));t[0]&=this._bitmask,r.set(t)}let i=await this._deserializePkcs8Key(r.val());return r.reset(),{privateKey:i,publicKey:await this.derivePublicKey(i)}}catch(e){throw new HG(e)}}async derivePublicKey(e){await this._setup();try{let t=await this._api.exportKey(`jwk`,e);return delete t.d,delete t.key_ops,await this._api.importKey(`jwk`,t,this._alg,!0,[])}catch{try{return await this._derivePublicKeyWithoutJwkExport(e)}catch(e){throw new FG(e)}}}async dh(e,t){try{return await this._setup(),await this._api.deriveBits({name:`ECDH`,public:t},e,this._nDh*8)}catch(e){throw new PG(e)}}async _importRawKey(e,t){if(t&&e.byteLength!==this._nPk)throw Error(`Invalid public key for the ciphersuite`);if(!t&&e.byteLength!==this._nSk)throw Error(`Invalid private key for the ciphersuite`);return t?await this._api.importKey(`raw`,e,this._alg,!0,[]):await this._deserializePkcs8Key(new Uint8Array(e))}async _importJWK(e,t){if(e.crv===void 0||e.crv!==this._alg.namedCurve)throw Error(`Invalid crv: ${e.crv}`);if(t){if(e.d!==void 0)throw Error("Invalid key: `d` should not be set");return await this._api.importKey(`jwk`,e,this._alg,!0,[])}if(e.d===void 0)throw Error("Invalid key: `d` not found");return await this._api.importKey(`jwk`,e,this._alg,!0,gK)}async _deserializePkcs8Key(e){let t=new Uint8Array(this._pkcs8AlgId.length+e.length);return t.set(this._pkcs8AlgId,0),t.set(e,this._pkcs8AlgId.length),await this._api.importKey(`pkcs8`,t,this._alg,!0,gK)}async _derivePublicKeyWithoutJwkExport(e){let t=PK(this._curveParams.gx,this._curveParams.gy,this._curveParams.coordinateSize),n=await this._api.importKey(`raw`,t.buffer,this._alg,!0,[]),r=new Uint8Array(await this._api.deriveBits({name:`ECDH`,public:n},e,this._nDh*8)),i=this._curveParams.p,a=MK(r),o=jK(kK(AK(a,3n,i)-3n*a+this._curveParams.b,i),i);(o&1n)==1n&&(o=i-o);let s=PK(a,o,this._curveParams.coordinateSize);return await this._api.importKey(`raw`,s.buffer,this._alg,!0,[])}};function IK(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name===`Uint8Array`}function LK(e,t=``){if(!Number.isSafeInteger(e)||e<0){let n=t&&`"${t}" `;throw Error(`${n}expected integer >0, got ${e}`)}}function RK(e,t,n=``){let r=IK(e),i=e?.length,a=t!==void 0;if(!r||a&&i!==t){let o=n&&`"${n}" `,s=a?` of length ${t}`:``,c=r?`length=${i}`:`type=${typeof e}`;throw Error(o+`expected Uint8Array`+s+`, got `+c)}return e}function zK(e,t=!0){if(e.destroyed)throw Error(`Hash instance has been destroyed`);if(t&&e.finished)throw Error(`Hash#digest() has already been called`)}function BK(e,t){RK(e,void 0,`digestInto() output`);let n=t.outputLen;if(e.length<n)throw Error(`"digestInto() output" expected to be of length >=`+n)}function VK(e){return new Uint32Array(e.buffer,e.byteOffset,Math.floor(e.byteLength/4))}function HK(...e){for(let t=0;t<e.length;t++)e[t].fill(0)}var UK=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;function WK(e){return new DataView(e.buffer,e.byteOffset,e.byteLength)}function GK(e){LK(e,`numberToBigint`);let t=e,n=$G,r=1n;for(;t>0;)t%2==1&&(n+=r),t=Math.floor(t/2),r<<=1n;return n}function KK(e){return Uint8Array.from(e)}function qK(e){if(typeof e!=`boolean`)throw Error(`boolean expected, not ${e}`)}var JK=(e,t)=>{function n(n,...r){if(RK(n,void 0,`key`),!UK)throw Error(`Non little-endian hardware is not yet supported`);if(e.nonceLength!==void 0){let t=r[0];RK(t,e.varSizeNonce?void 0:e.nonceLength,`nonce`)}let i=e.tagLength;i&&r[1]!==void 0&&RK(r[1],void 0,`AAD`);let a=t(n,...r),o=(e,t)=>{if(t!==void 0){if(e!==2)throw Error(`cipher output not supported`);RK(t,void 0,`output`)}},s=!1;return{encrypt(e,t){if(s)throw Error(`cannot encrypt() twice with same key + nonce`);return s=!0,RK(e),o(a.encrypt.length,t),a.encrypt(e,t)},decrypt(e,t){if(RK(e),i&&e.length<i)throw Error(`"ciphertext" expected length bigger than tagLength=`+i);return o(a.decrypt.length,t),a.decrypt(e,t)}}}return Object.assign(n,e),n};function YK(e,t){if(typeof t!=`object`||!t)throw Error(`options must be defined`);return Object.assign(e,t)}function XK(e,t){if(e.length!==t.length)return!1;let n=0;for(let r=0;r<e.length;r++)n|=e[r]^t[r];return n===0}function ZK(e,t,n=!0){if(t===void 0)return new Uint8Array(e);if(t.length!==e)throw Error(`"output" expected Uint8Array of length `+e+`, got: `+t.length);if(n&&!$K(t))throw Error(`invalid output, must be aligned`);return t}function QK(e,t,n){qK(n);let r=new Uint8Array(16),i=WK(r);return i.setBigUint64(0,GK(t),n),i.setBigUint64(8,GK(e),n),r}function $K(e){return e.byteOffset%4==0}var eq=e=>Uint8Array.from(e.split(``).map(e=>e.charCodeAt(0))),tq=eq(`expand 16-byte k`),nq=eq(`expand 32-byte k`),rq=VK(tq),iq=VK(nq);function aq(e,t){return e<<t|e>>>32-t}function oq(e){return e.byteOffset%4==0}var sq=64,cq=16,lq=2**32-1,uq=Uint32Array.of();function dq(e,t,n,r,i,a,o,s){let c=i.length,l=new Uint8Array(sq),u=VK(l),d=oq(i)&&oq(a),f=d?VK(i):uq,p=d?VK(a):uq;for(let m=0;m<c;o++){if(e(t,n,r,u,o,s),o>=lq)throw Error(`arx: counter overflow`);let h=Math.min(sq,c-m);if(d&&h===sq){let e=m/4;if(m%4!=0)throw Error(`arx: invalid block position`);for(let t=0,n;t<cq;t++)n=e+t,p[n]=f[n]^u[t];m+=sq}else{for(let e=0,t;e<h;e++)t=m+e,a[t]=i[t]^l[e];m+=h}}}function fq(e,t){let{allowShortKeys:n,extendNonceFn:r,counterLength:i,counterRight:a,rounds:o}=YK({allowShortKeys:!1,counterLength:8,counterRight:!1,rounds:20},t);if(typeof e!=`function`)throw Error(`core must be a function`);return LK(i),LK(o),qK(a),qK(n),(t,s,c,l,u=0)=>{RK(t,void 0,`key`),RK(s,void 0,`nonce`),RK(c,void 0,`data`);let d=c.length;if(l===void 0&&(l=new Uint8Array(d)),RK(l,void 0,`output`),LK(u),u<0||u>=lq)throw Error(`arx: counter overflow`);if(l.length<d)throw Error(`arx: output (${l.length}) is shorter than data (${d})`);let f=[],p=t.length,m,h;if(p===32)f.push(m=KK(t)),h=iq;else if(p===16&&n)m=new Uint8Array(32),m.set(t),m.set(t,16),h=rq,f.push(m);else throw RK(t,32,`arx key`),Error(`invalid key size`);oq(s)||f.push(s=KK(s));let g=VK(m);if(r){if(s.length!==24)throw Error(`arx: extended nonce must be 24 bytes`);r(h,g,VK(s.subarray(0,16)),g),s=s.subarray(16)}let _=16-i;if(_!==s.length)throw Error(`arx: nonce must be ${_} or 16 bytes`);if(_!==12){let e=new Uint8Array(12);e.set(s,a?0:12-s.length),s=e,f.push(s)}let v=VK(s);return dq(e,h,g,v,c,l,u,o),HK(...f),l}}function pq(e,t){return e[t++]&255|(e[t++]&255)<<8}var mq=class{constructor(e){Object.defineProperty(this,"blockLen",{enumerable:!0,configurable:!0,writable:!0,value:16}),Object.defineProperty(this,"outputLen",{enumerable:!0,configurable:!0,writable:!0,value:16}),Object.defineProperty(this,"buffer",{enumerable:!0,configurable:!0,writable:!0,value:new Uint8Array(16)}),Object.defineProperty(this,"r",{enumerable:!0,configurable:!0,writable:!0,value:new Uint16Array(10)}),Object.defineProperty(this,"h",{enumerable:!0,configurable:!0,writable:!0,value:new Uint16Array(10)}),Object.defineProperty(this,"pad",{enumerable:!0,configurable:!0,writable:!0,value:new Uint16Array(8)}),Object.defineProperty(this,"pos",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"finished",{enumerable:!0,configurable:!0,writable:!0,value:!1}),e=KK(RK(e,32,`key`));let t=pq(e,0),n=pq(e,2),r=pq(e,4),i=pq(e,6),a=pq(e,8),o=pq(e,10),s=pq(e,12),c=pq(e,14);this.r[0]=t&8191,this.r[1]=(t>>>13|n<<3)&8191,this.r[2]=(n>>>10|r<<6)&7939,this.r[3]=(r>>>7|i<<9)&8191,this.r[4]=(i>>>4|a<<12)&255,this.r[5]=a>>>1&8190,this.r[6]=(a>>>14|o<<2)&8191,this.r[7]=(o>>>11|s<<5)&8065,this.r[8]=(s>>>8|c<<8)&8191,this.r[9]=c>>>5&127;for(let t=0;t<8;t++)this.pad[t]=pq(e,16+2*t)}process(e,t,n=!1){let r=n?0:2048,{h:i,r:a}=this,o=a[0],s=a[1],c=a[2],l=a[3],u=a[4],d=a[5],f=a[6],p=a[7],m=a[8],h=a[9],g=pq(e,t+0),_=pq(e,t+2),v=pq(e,t+4),y=pq(e,t+6),b=pq(e,t+8),x=pq(e,t+10),S=pq(e,t+12),C=pq(e,t+14),w=i[0]+(g&8191),T=i[1]+((g>>>13|_<<3)&8191),E=i[2]+((_>>>10|v<<6)&8191),D=i[3]+((v>>>7|y<<9)&8191),ee=i[4]+((y>>>4|b<<12)&8191),te=i[5]+(b>>>1&8191),ne=i[6]+((b>>>14|x<<2)&8191),re=i[7]+((x>>>11|S<<5)&8191),ie=i[8]+((S>>>8|C<<8)&8191),ae=i[9]+(C>>>5|r),O=0,oe=O+w*o+5*h*T+5*m*E+5*p*D+5*f*ee;O=oe>>>13,oe&=8191,oe+=5*d*te+5*u*ne+5*l*re+5*c*ie+5*s*ae,O+=oe>>>13,oe&=8191;let se=O+w*s+T*o+5*h*E+5*m*D+5*p*ee;O=se>>>13,se&=8191,se+=5*f*te+5*d*ne+5*u*re+5*l*ie+5*c*ae,O+=se>>>13,se&=8191;let ce=O+w*c+T*s+E*o+5*h*D+5*m*ee;O=ce>>>13,ce&=8191,ce+=5*p*te+5*f*ne+5*d*re+5*u*ie+5*l*ae,O+=ce>>>13,ce&=8191;let le=O+w*l+T*c+E*s+D*o+5*h*ee;O=le>>>13,le&=8191,le+=5*m*te+5*p*ne+5*f*re+5*d*ie+5*u*ae,O+=le>>>13,le&=8191;let ue=O+w*u+T*l+E*c+D*s+ee*o;O=ue>>>13,ue&=8191,ue+=5*h*te+5*m*ne+5*p*re+5*f*ie+5*d*ae,O+=ue>>>13,ue&=8191;let de=O+w*d+T*u+E*l+D*c+ee*s;O=de>>>13,de&=8191,de+=te*o+5*h*ne+5*m*re+5*p*ie+5*f*ae,O+=de>>>13,de&=8191;let fe=O+w*f+T*d+E*u+D*l+ee*c;O=fe>>>13,fe&=8191,fe+=te*s+ne*o+5*h*re+5*m*ie+5*p*ae,O+=fe>>>13,fe&=8191;let pe=O+w*p+T*f+E*d+D*u+ee*l;O=pe>>>13,pe&=8191,pe+=te*c+ne*s+re*o+5*h*ie+5*m*ae,O+=pe>>>13,pe&=8191;let me=O+w*m+T*p+E*f+D*d+ee*u;O=me>>>13,me&=8191,me+=te*l+ne*c+re*s+ie*o+5*h*ae,O+=me>>>13,me&=8191;let he=O+w*h+T*m+E*p+D*f+ee*d;O=he>>>13,he&=8191,he+=te*u+ne*l+re*c+ie*s+ae*o,O+=he>>>13,he&=8191,O=(O<<2)+O|0,O=O+oe|0,oe=O&8191,O>>>=13,se+=O,i[0]=oe,i[1]=se,i[2]=ce,i[3]=le,i[4]=ue,i[5]=de,i[6]=fe,i[7]=pe,i[8]=me,i[9]=he}finalize(){let{h:e,pad:t}=this,n=new Uint16Array(10),r=e[1]>>>13;e[1]&=8191;for(let t=2;t<10;t++)e[t]+=r,r=e[t]>>>13,e[t]&=8191;e[0]+=r*5,r=e[0]>>>13,e[0]&=8191,e[1]+=r,r=e[1]>>>13,e[1]&=8191,e[2]+=r,n[0]=e[0]+5,r=n[0]>>>13,n[0]&=8191;for(let t=1;t<10;t++)n[t]=e[t]+r,r=n[t]>>>13,n[t]&=8191;n[9]-=8192;let i=(r^1)-1;for(let e=0;e<10;e++)n[e]&=i;i=~i;for(let t=0;t<10;t++)e[t]=e[t]&i|n[t];e[0]=(e[0]|e[1]<<13)&65535,e[1]=(e[1]>>>3|e[2]<<10)&65535,e[2]=(e[2]>>>6|e[3]<<7)&65535,e[3]=(e[3]>>>9|e[4]<<4)&65535,e[4]=(e[4]>>>12|e[5]<<1|e[6]<<14)&65535,e[5]=(e[6]>>>2|e[7]<<11)&65535,e[6]=(e[7]>>>5|e[8]<<8)&65535,e[7]=(e[8]>>>8|e[9]<<5)&65535;let a=e[0]+t[0];e[0]=a&65535;for(let n=1;n<8;n++)a=(e[n]+t[n]|0)+(a>>>16)|0,e[n]=a&65535;HK(n)}update(e){zK(this),RK(e),e=KK(e);let{buffer:t,blockLen:n}=this,r=e.length;for(let i=0;i<r;){let a=Math.min(n-this.pos,r-i);if(a===n)for(;n<=r-i;i+=n)this.process(e,i);else t.set(e.subarray(i,i+a),this.pos),this.pos+=a,i+=a,this.pos===n&&(this.process(t,0,!1),this.pos=0)}return this}destroy(){HK(this.h,this.r,this.buffer,this.pad)}digestInto(e){zK(this),BK(e,this),this.finished=!0;let{buffer:t,h:n}=this,{pos:r}=this;if(r){for(t[r++]=1;r<16;r++)t[r]=0;this.process(t,0,!0)}this.finalize();let i=0;for(let t=0;t<8;t++)e[i++]=n[t]>>>0,e[i++]=n[t]>>>8;return e}digest(){let{buffer:e,outputLen:t}=this;this.digestInto(e);let n=e.slice(0,t);return this.destroy(),n}};function hq(e){let t=(t,n)=>e(n).update(t).digest(),n=e(new Uint8Array(32));return t.outputLen=n.outputLen,t.blockLen=n.blockLen,t.create=t=>e(t),t}var gq=hq(e=>new mq(e));function _q(e,t,n,r,i,a=20){let o=e[0],s=e[1],c=e[2],l=e[3],u=t[0],d=t[1],f=t[2],p=t[3],m=t[4],h=t[5],g=t[6],_=t[7],v=i,y=n[0],b=n[1],x=n[2],S=o,C=s,w=c,T=l,E=u,D=d,ee=f,te=p,ne=m,re=h,ie=g,ae=_,O=v,oe=y,se=b,ce=x;for(let e=0;e<a;e+=2)S=S+E|0,O=aq(O^S,16),ne=ne+O|0,E=aq(E^ne,12),S=S+E|0,O=aq(O^S,8),ne=ne+O|0,E=aq(E^ne,7),C=C+D|0,oe=aq(oe^C,16),re=re+oe|0,D=aq(D^re,12),C=C+D|0,oe=aq(oe^C,8),re=re+oe|0,D=aq(D^re,7),w=w+ee|0,se=aq(se^w,16),ie=ie+se|0,ee=aq(ee^ie,12),w=w+ee|0,se=aq(se^w,8),ie=ie+se|0,ee=aq(ee^ie,7),T=T+te|0,ce=aq(ce^T,16),ae=ae+ce|0,te=aq(te^ae,12),T=T+te|0,ce=aq(ce^T,8),ae=ae+ce|0,te=aq(te^ae,7),S=S+D|0,ce=aq(ce^S,16),ie=ie+ce|0,D=aq(D^ie,12),S=S+D|0,ce=aq(ce^S,8),ie=ie+ce|0,D=aq(D^ie,7),C=C+ee|0,O=aq(O^C,16),ae=ae+O|0,ee=aq(ee^ae,12),C=C+ee|0,O=aq(O^C,8),ae=ae+O|0,ee=aq(ee^ae,7),w=w+te|0,oe=aq(oe^w,16),ne=ne+oe|0,te=aq(te^ne,12),w=w+te|0,oe=aq(oe^w,8),ne=ne+oe|0,te=aq(te^ne,7),T=T+E|0,se=aq(se^T,16),re=re+se|0,E=aq(E^re,12),T=T+E|0,se=aq(se^T,8),re=re+se|0,E=aq(E^re,7);let le=0;r[le++]=o+S|0,r[le++]=s+C|0,r[le++]=c+w|0,r[le++]=l+T|0,r[le++]=u+E|0,r[le++]=d+D|0,r[le++]=f+ee|0,r[le++]=p+te|0,r[le++]=m+ne|0,r[le++]=h+re|0,r[le++]=g+ie|0,r[le++]=_+ae|0,r[le++]=v+O|0,r[le++]=y+oe|0,r[le++]=b+se|0,r[le++]=x+ce|0}var vq=fq(_q,{counterRight:!1,counterLength:4,allowShortKeys:!1}),yq=new Uint8Array(16),bq=(e,t)=>{e.update(t);let n=t.length%16;n&&e.update(yq.subarray(n))},xq=new Uint8Array(32);function Sq(e,t,n,r,i){i!==void 0&&RK(i,void 0,`AAD`);let a=e(t,n,xq),o=QK(r.length,i?i.length:0,!0),s=gq.create(a);i&&bq(s,i),bq(s,r),s.update(o);let c=s.digest();return HK(a,o),c}var Cq=JK({blockSize:64,nonceLength:12,tagLength:16},(e=>(t,n,r)=>({encrypt(i,a){let o=i.length;a=ZK(o+16,a,!1),a.set(i);let s=a.subarray(0,-16);e(t,n,s,s,1);let c=Sq(e,t,n,s,r);return a.set(c,o),HK(c),a},decrypt(i,a){a=ZK(i.length-16,a,!1);let o=i.subarray(0,-16),s=i.subarray(-16),c=Sq(e,t,n,o,r);if(!XK(s,c))throw Error(`invalid tag`);return a.set(i.subarray(0,-16)),e(t,n,a,a,1),HK(c),a}}))(vq)),wq=class{constructor(e){Object.defineProperty(this,"_key",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this._key=new Uint8Array(iK(e))}async seal(e,t,n){return await this._seal(iK(e),iK(t),iK(n))}async open(e,t,n){return await this._open(iK(e),iK(t),iK(n))}_seal(e,t,n){return new Promise(r=>{r(Cq(this._key,new Uint8Array(e),new Uint8Array(n)).encrypt(new Uint8Array(t)).buffer)})}_open(e,t,n){return new Promise(r=>{r(Cq(this._key,new Uint8Array(e),new Uint8Array(n)).decrypt(new Uint8Array(t)).buffer)})}},Tq=class{constructor(){Object.defineProperty(this,"id",{enumerable:!0,configurable:!0,writable:!0,value:ZG.Chacha20Poly1305}),Object.defineProperty(this,"keySize",{enumerable:!0,configurable:!0,writable:!0,value:32}),Object.defineProperty(this,"nonceSize",{enumerable:!0,configurable:!0,writable:!0,value:12}),Object.defineProperty(this,"tagSize",{enumerable:!0,configurable:!0,writable:!0,value:16})}createEncryptionContext(e){return new wq(e)}};function Eq(){return new Promise((e,t)=>{t(new UG(`Not supported`))})}var Dq=new Uint8Array([115,101,99]),Oq=class{constructor(e,t,n){Object.defineProperty(this,"_api",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"exporterSecret",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_kdf",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this._api=e,this._kdf=t,this.exporterSecret=n}async seal(e,t){return await Eq()}async open(e,t){return await Eq()}async export(e,t){let n=iK(e);if(n.byteLength>8192)throw new NG(`Too long exporter context`);try{return await this._kdf.labeledExpand(this.exporterSecret,Dq,new Uint8Array(n),t)}catch(e){throw new RG(e)}}},kq=class extends Oq{},Aq=class extends Oq{constructor(e,t,n,r){super(e,t,n),Object.defineProperty(this,"enc",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.enc=r}},jq=class extends Oq{constructor(e,t,n){if(super(e,t,n.exporterSecret),Object.defineProperty(this,"_aead",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_nK",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_nN",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_nT",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_ctx",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),n.key===void 0||n.baseNonce===void 0||n.seq===void 0)throw Error(`Required parameters are missing`);this._aead=n.aead,this._nK=this._aead.keySize,this._nN=this._aead.nonceSize,this._nT=this._aead.tagSize;let r=this._aead.createEncryptionContext(n.key);this._ctx={key:r,baseNonce:n.baseNonce,seq:n.seq}}computeNonce(e){let t=cK(e.seq,e.baseNonce.byteLength);return dK(e.baseNonce,t).buffer}incrementSeq(e){if(e.seq>2**53-1)throw new VG(`Message limit reached`);e.seq+=1}},Mq=function(e,t,n,r){if(n===`a`&&!r)throw TypeError(`Private accessor was defined without a getter`);if(typeof t==`function`?e!==t||!r:!t.has(e))throw TypeError(`Cannot read private member from an object whose class did not declare it`);return n===`m`?r:n===`a`?r.call(e):r?r.value:t.get(e)},Nq=function(e,t,n,r,i){if(r===`m`)throw TypeError(`Private method is not writable`);if(r===`a`&&!i)throw TypeError(`Private accessor was defined without a setter`);if(typeof t==`function`?e!==t||!i:!t.has(e))throw TypeError(`Cannot write private member to an object whose class did not declare it`);return r===`a`?i.call(e,n):i?i.value=n:t.set(e,n),n},Pq,Fq=class{constructor(){Pq.set(this,Promise.resolve())}async lock(){let e,t=new Promise(t=>{e=t}),n=Mq(this,Pq,`f`);return Nq(this,Pq,t,`f`),await n,e}};Pq=new WeakMap;var Iq=function(e,t,n,r){if(n===`a`&&!r)throw TypeError(`Private accessor was defined without a getter`);if(typeof t==`function`?e!==t||!r:!t.has(e))throw TypeError(`Cannot read private member from an object whose class did not declare it`);return n===`m`?r:n===`a`?r.call(e):r?r.value:t.get(e)},Lq=function(e,t,n,r,i){if(r===`m`)throw TypeError(`Private method is not writable`);if(r===`a`&&!i)throw TypeError(`Private accessor was defined without a setter`);if(typeof t==`function`?e!==t||!i:!t.has(e))throw TypeError(`Cannot write private member to an object whose class did not declare it`);return r===`a`?i.call(e,n):i?i.value=n:t.set(e,n),n},Rq,zq=class extends jq{constructor(){super(...arguments),Rq.set(this,void 0)}async open(e,t=QG.buffer){Lq(this,Rq,Iq(this,Rq,`f`)??new Fq,`f`);let n=await Iq(this,Rq,`f`).lock(),r;try{r=await this._ctx.key.open(this.computeNonce(this._ctx),iK(e),iK(t))}catch(e){throw new BG(e)}finally{n()}return this.incrementSeq(this._ctx),r}};Rq=new WeakMap;var Bq=function(e,t,n,r){if(n===`a`&&!r)throw TypeError(`Private accessor was defined without a getter`);if(typeof t==`function`?e!==t||!r:!t.has(e))throw TypeError(`Cannot read private member from an object whose class did not declare it`);return n===`m`?r:n===`a`?r.call(e):r?r.value:t.get(e)},Vq=function(e,t,n,r,i){if(r===`m`)throw TypeError(`Private method is not writable`);if(r===`a`&&!i)throw TypeError(`Private accessor was defined without a setter`);if(typeof t==`function`?e!==t||!i:!t.has(e))throw TypeError(`Cannot write private member to an object whose class did not declare it`);return r===`a`?i.call(e,n):i?i.value=n:t.set(e,n),n},Hq,Uq=class extends jq{constructor(e,t,n,r){super(e,t,n),Object.defineProperty(this,"enc",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Hq.set(this,void 0),this.enc=r}async seal(e,t=QG.buffer){Vq(this,Hq,Bq(this,Hq,`f`)??new Fq,`f`);let n=await Bq(this,Hq,`f`).lock(),r;try{r=await this._ctx.key.seal(this.computeNonce(this._ctx),iK(e),iK(t))}catch(e){throw new zG(e)}finally{n()}return this.incrementSeq(this._ctx),r}};Hq=new WeakMap;var Wq=new Uint8Array([98,97,115,101,95,110,111,110,99,101]),Gq=new Uint8Array([101,120,112]),Kq=new Uint8Array([105,110,102,111,95,104,97,115,104]),qq=new Uint8Array([107,101,121]),Jq=new Uint8Array([112,115,107,95,105,100,95,104,97,115,104]),Yq=new Uint8Array([115,101,99,114,101,116]),Xq=new Uint8Array([72,80,75,69,0,0,0,0,0,0]),Zq=class extends qG{constructor(e){if(super(),Object.defineProperty(this,"_kem",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_kdf",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_aead",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_suiteId",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),typeof e.kem==`number`)throw new NG(`KemId cannot be used`);if(this._kem=e.kem,typeof e.kdf==`number`)throw new NG(`KdfId cannot be used`);if(this._kdf=e.kdf,typeof e.aead==`number`)throw new NG(`AeadId cannot be used`);this._aead=e.aead,this._suiteId=new Uint8Array(Xq),this._suiteId.set(cK(this._kem.id,2),4),this._suiteId.set(cK(this._kdf.id,2),6),this._suiteId.set(cK(this._aead.id,2),8),this._kdf.init(this._suiteId)}get kem(){return this._kem}get kdf(){return this._kdf}get aead(){return this._aead}async createSenderContext(e){this._validateInputLength(e),await this._setup();let t=await this._kem.encap(e),n;return n=e.psk===void 0?e.senderKey===void 0?JG.Base:JG.Auth:e.senderKey===void 0?JG.Psk:JG.AuthPsk,await this._keyScheduleS(n,t.sharedSecret,t.enc,e)}async createRecipientContext(e){this._validateInputLength(e),await this._setup();let t=await this._kem.decap(e),n;return n=e.psk===void 0?e.senderPublicKey===void 0?JG.Base:JG.Auth:e.senderPublicKey===void 0?JG.Psk:JG.AuthPsk,await this._keyScheduleR(n,t,e)}async seal(e,t,n=QG.buffer){let r=await this.createSenderContext(e);return{ct:await r.seal(t,n),enc:r.enc}}async open(e,t,n=QG.buffer){return await(await this.createRecipientContext(e)).open(t,n)}async _keySchedule(e,t,n){let r=n.psk===void 0?QG:rK(n.psk.id),i=await this._kdf.labeledExtract(QG,Jq,r),a=n.info===void 0?QG:rK(n.info),o=await this._kdf.labeledExtract(QG,Kq,a),s=new Uint8Array(1+i.byteLength+o.byteLength);s.set(new Uint8Array([e]),0),s.set(new Uint8Array(i),1),s.set(new Uint8Array(o),1+i.byteLength);let c=n.psk===void 0?QG:rK(n.psk.key),l=this._kdf.buildLabeledIkm(Yq,c),u=this._kdf.buildLabeledInfo(Gq,s,this._kdf.hashSize),d=await this._kdf.extractAndExpand(t,l,u,this._kdf.hashSize);if(this._aead.id===ZG.ExportOnly)return{aead:this._aead,exporterSecret:d};let f=this._kdf.buildLabeledInfo(qq,s,this._aead.keySize),p=await this._kdf.extractAndExpand(t,l,f,this._aead.keySize),m=this._kdf.buildLabeledInfo(Wq,s,this._aead.nonceSize),h=await this._kdf.extractAndExpand(t,l,m,this._aead.nonceSize);return{aead:this._aead,exporterSecret:d,key:p,baseNonce:new Uint8Array(h),seq:0}}async _keyScheduleS(e,t,n,r){let i=await this._keySchedule(e,t,r);return i.key===void 0?new Aq(this._api,this._kdf,i.exporterSecret,n):new Uq(this._api,this._kdf,i,n)}async _keyScheduleR(e,t,n){let r=await this._keySchedule(e,t,n);return r.key===void 0?new kq(this._api,this._kdf,r.exporterSecret):new zq(this._api,this._kdf,r)}_validateInputLength(e){if(e.info!==void 0&&e.info.byteLength>268435456)throw new NG(`Too long info`);if(e.psk!==void 0){if(e.psk.key.byteLength<32)throw new NG(`PSK must have at least 32 bytes`);if(e.psk.key.byteLength>8192)throw new NG(`Too long psk.key`);if(e.psk.id.byteLength>8192)throw new NG(`Too long psk.id`)}}},Qq=class extends hK{constructor(){let e=new oK,t=new FK(YG.DhkemP256HkdfSha256,e);super(YG.DhkemP256HkdfSha256,t,e),Object.defineProperty(this,"id",{enumerable:!0,configurable:!0,writable:!0,value:YG.DhkemP256HkdfSha256}),Object.defineProperty(this,"secretSize",{enumerable:!0,configurable:!0,writable:!0,value:32}),Object.defineProperty(this,"encSize",{enumerable:!0,configurable:!0,writable:!0,value:65}),Object.defineProperty(this,"publicKeySize",{enumerable:!0,configurable:!0,writable:!0,value:65}),Object.defineProperty(this,"privateKeySize",{enumerable:!0,configurable:!0,writable:!0,value:32})}},$q=class extends Zq{},eJ=class extends Qq{},tJ=class extends oK{},nJ=e(jG(),1);function rJ(){let e=globalThis.crypto?.subtle;if(!e)throw Error("`crypto.subtle` is not defined as a global; Either run in a runtime that provides WebCrypto, or polyfill `globalThis.crypto`");return e}function iJ(e){let t=e.replace(cJ,``).replace(sJ,``),n=Buffer.from(t,`base64`),r=n.indexOf(Buffer.from([4,32]));if(r===-1)throw Error(`Invalid wallet authorization private key`);let i=n.subarray(r+2,r+34);return AG.Point.Fn.fromBytes(i)}async function aJ(){let e=new $q({kem:new eJ,kdf:new tJ,aead:new Tq}),t=await e.kem.generateKeyPair(),n=await rJ().exportKey(`spki`,t.publicKey);return{publicKeySpki:new Uint8Array(n),decryptPayload:async(n,r)=>{let i=await(await e.createRecipientContext({recipientKey:t.privateKey,enc:n})).open(r);return new Uint8Array(i)}}}async function oJ(){let e=new $q({kem:new eJ,kdf:new tJ,aead:new Tq});return{encryptPayload:async(t,n)=>{let r=await e.kem.deserializePublicKey(t),i=await e.createSenderContext({recipientPublicKey:r}),a=await i.seal(n);return{ciphertext:new Uint8Array(a),encapsulatedKey:new Uint8Array(i.enc)}}}}var sJ=`wallet-api:`,cJ=`wallet-auth:`;function lJ(e){let t=e.body;typeof t==`object`&&t&&Object.keys(t).length===0&&(e.body=``);let n=(0,nJ.default)(e);if(!n)throw new nR(`Failed to serialize request for authorization signature`);return new TextEncoder().encode(n)}async function uJ(e,{authorizationContext:t,input:n}){let r=lJ(n),i=t.user_jwts??[],a=[];i.length>0&&(a=await Promise.all(i.map(t=>e._jwtExchange().exchangeJwtForAuthorizationKey(t))));let o=[...t.authorization_private_keys??[],...a].map(e=>fJ({authorizationPrivateKey:e,input:r})),s=await Promise.all((t.sign_fns??[]).map(e=>e(r)));return[...t.signatures??[],...o,...s]}async function dJ(e,t,{authorizationContext:n={},idempotencyKey:r,requestExpiry:i,method:a,url:o,body:s}){let c=String(i);return{headers:{"privy-authorization-signature":(await uJ(e,{authorizationContext:n,input:{version:1,method:a,url:o,body:s,headers:{"privy-app-id":t,...r&&{"privy-idempotency-key":r},...i&&{"privy-request-expiry":c}}}})).join(`,`),...r&&{"privy-idempotency-key":r},...i&&{"privy-request-expiry":c}}}}function fJ({authorizationPrivateKey:e,input:t}){let n=t instanceof Uint8Array?t:lJ(t),r=iJ(e),i=AG.sign(An(n),r).toBytes(`der`);return Buffer.from(i).toString(`base64`)}function pJ(e){let{entropy:t,entropyType:n,chainType:r}=e;if(typeof t!=`string`)return t;switch(n){case`hd`:return new TextEncoder().encode(t);case`private-key`:if(r===`ethereum`||r===`tron`||r===`sui`||r===`aptos`||r===`xrpl`)try{let e=t.startsWith(`0x`)?t.slice(2):t;return new Uint8Array(Buffer.from(e,`hex`))}catch{throw new nR(`Invalid private key: ${r} entropy must be hex encoded`)}if(r===`solana`)try{return zu.decode(t)}catch{throw new nR(`Invalid private key: Solana entropy must be base58 encoded`)}if(r===`stellar`)return Lu.decode(t).slice(1,33);throw new nR(`Invalid chain type for imports: ${r}`);default:throw new nR(`Invalid entropy type: ${n}`)}}var mJ=class extends hB{constructor(e,t){super(e),this.privyClient=t}async create(e,{authorization_context:t={},idempotency_key:n,request_expiry:r,...i}){let{headers:a}=await dJ(this.privyClient,this._client.appID,{authorizationContext:t,idempotencyKey:n,requestExpiry:r??this.privyClient.getRequestExpiry(),method:`POST`,url:`${this._client.baseURL}/v1/wallets/${e}/deposit_accounts/crypto`,body:i});return await this._create(e,{...i,...a})}},hJ=class extends gB{constructor(e,t){super(e),this.crypto=new mJ(e,t)}},gJ=class extends _B{constructor(e,t){super(e),this.privyClient=t}async claim(e,{authorization_context:t={},idempotency_key:n,...r}){let{headers:i}=await dJ(this.privyClient,this._client.appID,{authorizationContext:t,idempotencyKey:n,requestExpiry:this.privyClient.getRequestExpiry(),method:`POST`,url:`${this._client.baseURL}/v1/wallets/${e}/earn/ethereum/incentive/claim`,body:r});return await this._claim(e,{...r,...i})}},_J=class extends vB{constructor(e,t){super(e),this.privyClient=t,this.incentiveService=new gJ(e,t)}incentive(){return this.incentiveService}async deposit(e,{authorization_context:t={},idempotency_key:n,...r}){let{headers:i}=await dJ(this.privyClient,this._client.appID,{authorizationContext:t,idempotencyKey:n,requestExpiry:this.privyClient.getRequestExpiry(),method:`POST`,url:`${this._client.baseURL}/v1/wallets/${e}/earn/ethereum/deposit`,body:r});return await this._deposit(e,{...r,...i})}async withdraw(e,{authorization_context:t={},idempotency_key:n,...r}){let{headers:i}=await dJ(this.privyClient,this._client.appID,{authorizationContext:t,idempotencyKey:n,requestExpiry:this.privyClient.getRequestExpiry(),method:`POST`,url:`${this._client.baseURL}/v1/wallets/${e}/earn/ethereum/withdraw`,body:r});return await this._withdraw(e,{...r,...i})}},vJ=class extends yB{constructor(e,t){super(e),this.ethereumService=new _J(e,t)}ethereum(){return this.ethereumService}},yJ=class{constructor(e){this.privyWalletsService=e}async signMessage(e,{message:t,...n}){let r;return r=t instanceof Uint8Array?{message:Buffer.from(t).toString(`hex`),encoding:`hex`}:t.startsWith(`0x`)?{message:t.slice(2),encoding:`hex`}:{message:t,encoding:`utf-8`},(await this.privyWalletsService.rpc(e,{...n,params:r,method:`personal_sign`,chain_type:`ethereum`})).data}async signSecp256k1(e,t){return(await this.privyWalletsService.rpc(e,{...t,method:`secp256k1_sign`,chain_type:`ethereum`})).data}async sign7702Authorization(e,t){return(await this.privyWalletsService.rpc(e,{...t,method:`eth_sign7702Authorization`,chain_type:`ethereum`})).data}async signTransaction(e,t){return(await this.privyWalletsService.rpc(e,{...t,method:`eth_signTransaction`,chain_type:`ethereum`})).data}async signTypedData(e,t){return(await this.privyWalletsService.rpc(e,{...t,method:`eth_signTypedData_v4`,chain_type:`ethereum`})).data}async signUserOperation(e,t){return(await this.privyWalletsService.rpc(e,{...t,method:`eth_signUserOperation`,chain_type:`ethereum`})).data}async sendTransaction(e,t){return(await this.privyWalletsService.rpc(e,{...t,method:`eth_sendTransaction`,chain_type:`ethereum`})).data}async sendCalls(e,t){return(await this.privyWalletsService.rpc(e,{...t,method:`wallet_sendCalls`,chain_type:`ethereum`})).data}},bJ=class{constructor(e){this.privyWalletsService=e}async signMessage(e,{message:t,...n}){let r;return r=t instanceof Uint8Array?{message:Buffer.from(t).toString(`base64`),encoding:`base64`}:{message:t,encoding:`base64`},(await this.privyWalletsService.rpc(e,{...n,method:`signMessage`,chain_type:`solana`,params:r})).data}async signTransaction(e,{transaction:t,...n}){let r;return r=t instanceof Uint8Array?{transaction:Buffer.from(t).toString(`base64`),encoding:`base64`}:{transaction:t,encoding:`base64`},(await this.privyWalletsService.rpc(e,{...n,method:`signTransaction`,chain_type:`solana`,params:r})).data}async signAndSendTransaction(e,{transaction:t,...n}){let r;return r=t instanceof Uint8Array?{transaction:Buffer.from(t).toString(`base64`),encoding:`base64`}:{transaction:t,encoding:`base64`},(await this.privyWalletsService.rpc(e,{...n,method:`signAndSendTransaction`,chain_type:`solana`,params:r})).data}},xJ=class{constructor(e){this.privyWalletsService=e}async signTransaction(e,t){return(await this.privyWalletsService.rpc(e,{...t,method:`tron_signTransaction`})).data}async sendTransaction(e,t){return(await this.privyWalletsService.rpc(e,{...t,method:`tron_sendTransaction`})).data}},SJ=class extends bB{constructor(e,t){super(e),this.privyClient=t}async create(e,{authorization_context:t={},idempotency_key:n,request_expiry:r,...i}){let{headers:a}=await dJ(this.privyClient,this._client.appID,{authorizationContext:t,idempotencyKey:n,requestExpiry:r??this.privyClient.getRequestExpiry(),method:`POST`,url:`${this._client.baseURL}/v1/wallets/${e}/payout/fiat`,body:i});return await this._create(e,{...i,...a})}},CJ=class extends xB{constructor(e,t){super(e),this.fiatService=new SJ(e,t)}fiat(){return this.fiatService}},wJ=class{constructor(e,t){this.swapResource=new dB(e),this.privyClient=t,this.appID=e.appID,this.baseURL=e.baseURL}async execute(e,{authorization_context:t={},idempotency_key:n,...r}){let{headers:i}=await dJ(this.privyClient,this.appID,{authorizationContext:t,idempotencyKey:n,method:`POST`,url:`${this.baseURL}/v1/wallets/${e}/swap`,body:r});return await this.swapResource.execute(e,{...r,...i})}async quote(e,{authorization_context:t={},...n}){let{headers:r}=await dJ(this.privyClient,this.appID,{authorizationContext:t,method:`POST`,url:`${this.baseURL}/v1/wallets/${e}/swap/quote`,body:n});return await this.swapResource.quote(e,{...n,...r})}},TJ=class extends SB{constructor(e,t){super(e),this.privyClient=t,this.depositAccounts=new hJ(e,t),this.payoutService=new CJ(e,t),this.ethereumService=new yJ(this),this.solanaService=new bJ(this),this.tronService=new xJ(this),this.earnService=new vJ(e,t),this.swapsService=new wJ(e,t)}earn(){return this.earnService}payout(){return this.payoutService}ethereum(){return this.ethereumService}solana(){return this.solanaService}tron(){return this.tronService}swaps(){return this.swapsService}create({idempotency_key:e,...t}){return super.create({...t,...e&&{"privy-idempotency-key":e}})}async rpc(e,{authorization_context:t={},idempotency_key:n,request_expiry:r,...i}){let{headers:a}=await dJ(this.privyClient,this._client.appID,{authorizationContext:t,idempotencyKey:n,requestExpiry:r??this.privyClient.getRequestExpiry(),method:`POST`,url:`${this._client.baseURL}/v1/wallets/${e}/rpc`,body:i});return await this._rpc(e,{...i,...a})}async rawSign(e,{authorization_context:t={},idempotency_key:n,request_expiry:r,...i}){let{headers:a}=await dJ(this.privyClient,this._client.appID,{authorizationContext:t,idempotencyKey:n,requestExpiry:r??this.privyClient.getRequestExpiry(),method:`POST`,url:`${this._client.baseURL}/v1/wallets/${e}/raw_sign`,body:i});return(await this._rawSign(e,{...i,...a})).data}async update(e,{authorization_context:t={},request_expiry:n,...r}){let{headers:i}=await dJ(this.privyClient,this._client.appID,{authorizationContext:t,requestExpiry:n??this.privyClient.getRequestExpiry(),method:`PATCH`,url:`${this._client.baseURL}/v1/wallets/${e}`,body:r});return await this._update(e,{...r,...i})}async transfer(e,{authorization_context:t={},...n}){let{headers:r}=await dJ(this.privyClient,this._client.appID,{authorizationContext:t,requestExpiry:this.privyClient.getRequestExpiry(),method:`POST`,url:`${this._client.baseURL}/v1/wallets/${e}/transfer`,body:n});return await this._transfer(e,{...n,...r})}async export(e,{authorization_context:t={},request_expiry:n,...r}){let{publicKeySpki:i,decryptPayload:a}=await aJ(),o={...r,encryption_type:`HPKE`,recipient_public_key:Buffer.from(i).toString(`base64`)},{headers:s}=await dJ(this.privyClient,this._client.appID,{authorizationContext:t,requestExpiry:n??this.privyClient.getRequestExpiry(),method:`POST`,url:`${this._client.baseURL}/v1/wallets/${e}/export`,body:o}),c=await this._export(e,{...o,...s}),l=await a(Buffer.from(c.encapsulated_key,`base64`),Buffer.from(c.ciphertext,`base64`));return{private_key:new TextDecoder().decode(l)}}async exportPrivateKey(e,t){return this.export(e,{...t,export_seed_phrase:!1})}async exportSeedPhrase(e,t){let{private_key:n}=await this.export(e,{...t,export_seed_phrase:!0});return{seed_phrase:n}}async import({wallet:{private_key:e,...t},...n}){let r=await oJ(),i=pJ({entropy:e,entropyType:t.entropy_type,chainType:t.chain_type}),a=await this._initImport({...t,encryption_type:`HPKE`});if(a.encryption_type!==`HPKE`)throw new nR(`Invalid encryption type: ${a.encryption_type}`);let o=Buffer.from(a.encryption_public_key,`base64`),{encapsulatedKey:s,ciphertext:c}=await r.encryptPayload(o,i);return await this._submitImport({...n,wallet:{...t,encryption_type:`HPKE`,encapsulated_key:Buffer.from(s).toString(`base64`),ciphertext:Buffer.from(c).toString(`base64`)}})}},EJ=class extends tB{constructor(e,t){super(e),this.privyClient=t}create({idempotency_key:e,...t}){return super.create({...t,...e&&{"privy-idempotency-key":e}})}async update(e,{authorization_context:t={},request_expiry:n,...r}){let{headers:i}=await dJ(this.privyClient,this._client.appID,{authorizationContext:t,requestExpiry:n??this.privyClient.getRequestExpiry(),method:`PATCH`,url:`${this._client.baseURL}/v1/policies/${e}`,body:r});return await this._update(e,{...r,...i})}async delete(e,{authorization_context:t={},request_expiry:n,...r}){let{headers:i}=await dJ(this.privyClient,this._client.appID,{authorizationContext:t,requestExpiry:n??this.privyClient.getRequestExpiry(),method:`DELETE`,url:`${this._client.baseURL}/v1/policies/${e}`,body:r});return await this._delete(e,{...r,...i})}async createRule(e,{authorization_context:t={},request_expiry:n,...r}){let{headers:i}=await dJ(this.privyClient,this._client.appID,{authorizationContext:t,requestExpiry:n??this.privyClient.getRequestExpiry(),method:`POST`,url:`${this._client.baseURL}/v1/policies/${e}/rules`,body:r});return await this._createRule(e,{...r,...i})}async updateRule(e,{authorization_context:t={},request_expiry:n,policy_id:r,...i}){let{headers:a}=await dJ(this.privyClient,this._client.appID,{authorizationContext:t,requestExpiry:n??this.privyClient.getRequestExpiry(),method:`PATCH`,url:`${this._client.baseURL}/v1/policies/${r}/rules/${e}`,body:i});return await this._updateRule(e,{...i,policy_id:r,...a})}async deleteRule(e,{authorization_context:t={},request_expiry:n,policy_id:r,...i}){let{headers:a}=await dJ(this.privyClient,this._client.appID,{authorizationContext:t,requestExpiry:n??this.privyClient.getRequestExpiry(),method:`DELETE`,url:`${this._client.baseURL}/v1/policies/${r}/rules/${e}`,body:i});return await this._deleteRule(e,{...i,policy_id:r,...a})}},DJ=class extends iB{},OJ=class extends Jz{constructor(e,t){super(e),this.privyClient=t}async update(e,{authorization_context:t={},request_expiry:n,...r}){let{headers:i}=await dJ(this.privyClient,this._client.appID,{authorizationContext:t,requestExpiry:n??this.privyClient.getRequestExpiry(),method:`PATCH`,url:`${this._client.baseURL}/v1/key_quorums/${e}`,body:r});return await this._update(e,{...r,...i})}async delete(e,{authorization_context:t={},request_expiry:n,...r}){let{headers:i}=await dJ(this.privyClient,this._client.appID,{authorizationContext:t,requestExpiry:n??this.privyClient.getRequestExpiry(),method:`DELETE`,url:`${this._client.baseURL}/v1/key_quorums/${e}`,body:r});return await this._delete(e,{...r,...i})}};function kJ(e){let t=MJ(e);return{id:e.sub,created_at:parseInt(e.cr),is_guest:e.guest===`t`,linked_accounts:AJ(e),...t?{custom_metadata:t}:{},has_accepted_terms:!1,mfa_methods:[]}}function AJ(e){let t=e.linked_accounts;if(typeof t!=`string`)throw new NJ(`Unable to parse identity token`);let n=JSON.parse(t);if(!Array.isArray(n))throw new NJ(`Unable to parse identity token`);return n.map(jJ).filter(e=>e!==null)}function jJ(e){if(e.type===`email`)return{type:`email`,address:e.address,first_verified_at:null,verified_at:e.lv,latest_verified_at:e.lv};if(e.type===`phone`)return{type:`phone`,phoneNumber:e.phone_number,first_verified_at:null,verified_at:e.lv,latest_verified_at:e.lv};if(e.type===`wallet`)return e.wallet_client_type===`privy`?{type:`wallet`,wallet_client_type:`privy`,wallet_client:`privy`,connector_type:`embedded`,id:e.id,address:e.address,chain_type:e.chain_type,first_verified_at:null,verified_at:e.lv,latest_verified_at:e.lv,chain_id:``,delegated:!1,imported:!1,public_key:``,wallet_index:0,recovery_method:e.id?`privy-v2`:`privy`}:{type:`wallet`,wallet_client:`unknown`,address:e.address,chain_type:e.chain_type,first_verified_at:null,verified_at:e.lv,latest_verified_at:e.lv};if(e.type===`smart_wallet`)return{type:`smart_wallet`,address:e.address,smart_wallet_type:e.smart_wallet_type,first_verified_at:null,verified_at:e.lv,latest_verified_at:e.lv};if(e.type===`farcaster`)return{type:`farcaster`,fid:e.fid,username:e.username,first_verified_at:null,verified_at:e.lv,latest_verified_at:e.lv,owner_address:e.oa};if(e.type===`google_oauth`)return{type:`google_oauth`,subject:e.subject,email:e.email,name:e.name,first_verified_at:null,verified_at:e.lv,latest_verified_at:e.lv};if(e.type===`twitter_oauth`){let t=e.pfp?e.pfp:null;return t?.startsWith(`default`)?t=`https://abs.twimg.com/sticky/default_profile_images/${t}`:t?.startsWith(`https://`)||(t=`https://pbs.twimg.com/profile_images/${t}`),{type:`twitter_oauth`,subject:e.subject,username:e.username,name:e.name?e.name:null,profile_picture_url:t,first_verified_at:null,verified_at:e.lv,latest_verified_at:e.lv}}return e.type===`discord_oauth`?{type:`discord_oauth`,subject:e.subject,username:e.username,email:null,first_verified_at:null,verified_at:e.lv,latest_verified_at:e.lv}:e.type===`github_oauth`?{type:`github_oauth`,subject:e.subject,username:e.username,email:null,name:null,first_verified_at:null,verified_at:e.lv,latest_verified_at:e.lv}:e.type===`spotify_oauth`?{type:`spotify_oauth`,subject:e.subject,email:null,name:null,first_verified_at:null,verified_at:e.lv,latest_verified_at:e.lv}:e.type===`instagram_oauth`?{type:`instagram_oauth`,subject:e.subject,username:e.username,first_verified_at:null,verified_at:e.lv,latest_verified_at:e.lv}:e.type===`tiktok_oauth`?{type:`tiktok_oauth`,subject:e.subject,username:e.username,name:null,first_verified_at:null,verified_at:e.lv,latest_verified_at:e.lv}:e.type===`linkedin_oauth`?{type:`linkedin_oauth`,subject:e.subject,email:e.email,first_verified_at:null,verified_at:e.lv,latest_verified_at:e.lv}:e.type===`apple_oauth`?{type:`apple_oauth`,subject:e.subject,email:e.email,first_verified_at:null,verified_at:e.lv,latest_verified_at:e.lv}:e.type===`cross_app`?{type:`cross_app`,subject:e.subject,provider_app_id:e.provider_app_id,embedded_wallets:e.embedded_wallets,smart_wallets:e.smart_wallets,first_verified_at:null,verified_at:e.lv,latest_verified_at:e.lv}:e.type===`custom_auth`?{type:`custom_auth`,custom_user_id:e.custom_user_id,first_verified_at:null,verified_at:e.lv,latest_verified_at:e.lv}:e.type===`telegram`?{type:`telegram`,telegram_user_id:e.telegram_user_id,username:e.username,first_verified_at:null,verified_at:e.lv,latest_verified_at:e.lv}:e.type===`passkey`?{type:`passkey`,credential_id:e.credential_id,first_verified_at:null,verified_at:e.lv,latest_verified_at:e.lv,enrolled_in_mfa:!1}:null}function MJ(e){let t=e.custom_metadata;if(t===void 0)return;if(typeof t!=`string`)throw new NJ(`Unable to parse identity token`);let n=JSON.parse(t);if(!n||typeof n!=`object`)throw new NJ(`Unable to parse identity token`);return n}var NJ=class extends nR{},PJ=`ES256`,FJ=`privy.io`;async function IJ(e,t,n){let r;return r=await ts(e,n,{typ:`JWT`,algorithms:[PJ],issuer:FJ,audience:t}).catch(HJ),r}async function LJ({access_token:e,app_id:t,verification_key:n}){let r=await IJ(e,t,typeof n==`string`?await hs(n,PJ):n);return{app_id:BJ(r.payload.aud),issuer:BJ(r.payload.iss),issued_at:VJ(r.payload.iat),expiration:VJ(r.payload.exp),session_id:BJ(r.payload.sid),user_id:BJ(r.payload.sub)}}async function RJ({identity_token:e,app_id:t,verification_key:n}){let r=await IJ(e,t,typeof n==`string`?await hs(n,PJ):n);if(!r.payload)throw new zJ(`Unable to parse identity token`);return kJ(r.payload)}var zJ=class extends nR{};function BJ(e){if(!e||typeof e!=`string`)throw new zJ(`Token's payload is invalid`);return e}function VJ(e){if(!e||typeof e!=`number`)throw new zJ(`Token's payload is invalid`);return e}function HJ(e){throw e instanceof go?new zJ(`Authentication token expired`):e instanceof Ds||e instanceof ws?new zJ(`Authentication token is invalid`):new zJ(`Failed to verify authentication token`)}function UJ({appId:e,apiUrl:t,headers:n,verificationKeyOverride:r}){if(r!==void 0){let e;return async()=>{if(e===void 0)try{e=await hs(r,PJ)}catch{throw new zJ(`Failed to import the provided verification key override`)}return e}}return lm(new URL(`${t}/v1/apps/${e}/jwks.json`),{cacheMaxAge:36e5,cooldownDuration:6e5,headers:n})}var WJ=class extends sB{constructor(e,t){super(e),this.appJwks=t}async get({id_token:e}){return RJ({identity_token:e,app_id:this._client.appID,verification_key:this.appJwks})}},GJ=class extends Lz{constructor(e){super(e)}async getAllowlist(){return this.allowlist.list(this._client.appID)}async inviteToAllowlist(e){return this.allowlist.create(this._client.appID,e)}async removeFromAllowlist(e){return this.allowlist.delete(this._client.appID,e)}async getSettings(){return this.get(this._client.appID)}async getTestAccessToken(e){let{data:t}=await this.getTestCredentials(this._client.appID);if(!t||t.length===0)throw Error(`No test accounts found for this app. Create test accounts in the Privy dashboard.`);let n;if(e&&`email`in e){if(n=t.find(t=>t.email===e.email),!n)throw Error(`No test account found with email "${e.email}". Available: ${t.map(e=>e.email).join(`, `)}`)}else if(e&&`phone_number`in e){if(n=t.find(t=>t.phone_number===e.phone_number),!n)throw Error(`No test account found with phone number "${e.phone_number}". Available: ${t.map(e=>e.phone_number).join(`, `)}`)}else n=t[0];let r=await this._client.post(`/v1/passwordless/authenticate`,{body:{email:n.email,code:n.otp_code}});if(!r.token)throw Error(`Unable to authenticate with the test account.`);return{access_token:r.token}}},KJ=class extends qz{constructor(e,t){super(e),this.privyClient=t}rpc(e,{request_expiry:t,...n}){let r=t??this.privyClient.getIntentRequestExpiry();return super.rpc(e,{...n,...r!=null&&{"privy-request-expiry":String(r)}})}createPolicyRule(e,{request_expiry:t,...n}){let r=t??this.privyClient.getIntentRequestExpiry();return super.createPolicyRule(e,{...n,...r!=null&&{"privy-request-expiry":String(r)}})}deletePolicyRule(e,{request_expiry:t,...n}){let r=t??this.privyClient.getIntentRequestExpiry();return super.deletePolicyRule(e,{...n,...r!=null&&{"privy-request-expiry":String(r)}})}updatePolicy(e,{request_expiry:t,...n}){let r=t??this.privyClient.getIntentRequestExpiry();return super.updatePolicy(e,{...n,...r!=null&&{"privy-request-expiry":String(r)}})}updatePolicyRule(e,{request_expiry:t,...n}){let r=t??this.privyClient.getIntentRequestExpiry();return super.updatePolicyRule(e,{...n,...r!=null&&{"privy-request-expiry":String(r)}})}updateWallet(e,{request_expiry:t,...n}){let r=t??this.privyClient.getIntentRequestExpiry();return super.updateWallet(e,{...n,...r!=null&&{"privy-request-expiry":String(r)}})}updateKeyQuorum(e,{request_expiry:t,...n}){let r=t??this.privyClient.getIntentRequestExpiry();return super.updateKeyQuorum(e,{...n,...r!=null&&{"privy-request-expiry":String(r)}})}},qJ=class extends eB{constructor(e){super(e)}},JJ=class{constructor(e,t){this.appJwks=t,this.privyAppID=e.appID}async verifyAccessToken(e){return LJ({access_token:e,app_id:this.privyAppID,verification_key:this.appJwks})}async verifyAuthToken(e){return this.verifyAccessToken(e)}async verifyIdentityToken(e){return RJ({identity_token:e,app_id:this.privyAppID,verification_key:this.appJwks})}},YJ=class{constructor(){this.formatRequestForAuthorizationSignature=lJ}},XJ=class{constructor(e){this.generateAuthorizationSignature=fJ,this.privyClient=e}generateAuthorizationSignatures(...e){return uJ(this.privyClient,...e)}},ZJ=class{constructor(e,t,n){this._requestSigner=new XJ(t),this._requestFormatter=new YJ,this._auth=new JJ(e,n)}requestSigner(){return this._requestSigner}requestFormatter(){return this._requestFormatter}auth(){return this._auth}},QJ={hasSubscribers:!1},$J=QJ,eY=QJ,tY=typeof performance==`object`&&performance&&typeof performance.now==`function`?performance:Date,nY=()=>$J.hasSubscribers||eY.hasSubscribers,rY=new Set,iY=typeof process==`object`&&process?process:{},aY=(e,t,n,r)=>{typeof iY.emitWarning==`function`?iY.emitWarning(e,t,n,r):console.error(`[${n}] ${t}: ${e}`)},oY=e=>!rY.has(e),sY=e=>!!e&&e===Math.floor(e)&&e>0&&isFinite(e),cY=e=>sY(e)?e<=256?Uint8Array:e<=2**16?Uint16Array:e<=2**32?Uint32Array:e<=2**53-1?lY:null:null,lY=class extends Array{constructor(e){super(e),this.fill(0)}},uY=class e{heap;length;static#e=!1;static create(t){let n=cY(t);if(!n)return[];e.#e=!0;let r=new e(t,n);return e.#e=!1,r}constructor(t,n){if(!e.#e)throw TypeError(`instantiate Stack using Stack.create(n)`);this.heap=new n(t),this.length=0}push(e){this.heap[this.length++]=e}pop(){return this.heap[--this.length]}},dY=class e{#e;#t;#n;#r;#i;#a;#o;#s;get perf(){return this.#s}ttl;ttlResolution;ttlAutopurge;updateAgeOnGet;updateAgeOnHas;allowStale;noDisposeOnSet;noUpdateTTL;maxEntrySize;sizeCalculation;noDeleteOnFetchRejection;noDeleteOnStaleGet;allowStaleOnFetchAbort;allowStaleOnFetchRejection;ignoreFetchAbort;backgroundFetchSize;#c;#l;#u;#d;#f;#p;#m;#h;#g;#_;#v;#y;#b;#x;#S;#C;#w;#T;#E;static unsafeExposeInternals(e){return{starts:e.#b,ttls:e.#x,autopurgeTimers:e.#S,sizes:e.#y,keyMap:e.#u,keyList:e.#d,valList:e.#f,next:e.#p,prev:e.#m,get head(){return e.#h},get tail(){return e.#g},free:e.#_,isBackgroundFetch:t=>e.#W(t),backgroundFetch:(t,n,r,i)=>e.#U(t,n,r,i),moveToTail:t=>e.#X(t),indexes:t=>e.#I(t),rindexes:t=>e.#L(t),isStale:t=>e.#j(t)}}get max(){return this.#e}get maxSize(){return this.#t}get calculatedSize(){return this.#l}get size(){return this.#c}get fetchMethod(){return this.#a}get memoMethod(){return this.#o}get dispose(){return this.#n}get onInsert(){return this.#r}get disposeAfter(){return this.#i}constructor(t){let{max:n=0,ttl:r,ttlResolution:i=1,ttlAutopurge:a,updateAgeOnGet:o,updateAgeOnHas:s,allowStale:c,dispose:l,onInsert:u,disposeAfter:d,noDisposeOnSet:f,noUpdateTTL:p,maxSize:m=0,maxEntrySize:h=0,sizeCalculation:g,fetchMethod:_,memoMethod:v,noDeleteOnFetchRejection:y,noDeleteOnStaleGet:b,allowStaleOnFetchRejection:x,allowStaleOnFetchAbort:S,ignoreFetchAbort:C,backgroundFetchSize:w=1,perf:T}=t;if(this.backgroundFetchSize=w,T!==void 0&&typeof T?.now!=`function`)throw TypeError(`perf option must have a now() method if specified`);if(this.#s=T??tY,n!==0&&!sY(n))throw TypeError(`max option must be a nonnegative integer`);let E=n?cY(n):Array;if(!E)throw Error(`invalid max value: `+n);if(this.#e=n,this.#t=m,this.maxEntrySize=h||this.#t,this.sizeCalculation=g,this.sizeCalculation){if(!this.#t&&!this.maxEntrySize)throw TypeError(`cannot set sizeCalculation without setting maxSize or maxEntrySize`);if(typeof this.sizeCalculation!=`function`)throw TypeError(`sizeCalculation set to non-function`)}if(v!==void 0&&typeof v!=`function`)throw TypeError(`memoMethod must be a function if defined`);if(this.#o=v,_!==void 0&&typeof _!=`function`)throw TypeError(`fetchMethod must be a function if specified`);if(this.#a=_,this.#w=!!_,this.#u=new Map,this.#d=Array.from({length:n}).fill(void 0),this.#f=Array.from({length:n}).fill(void 0),this.#p=new E(n),this.#m=new E(n),this.#h=0,this.#g=0,this.#_=uY.create(n),this.#c=0,this.#l=0,typeof l==`function`&&(this.#n=l),typeof u==`function`&&(this.#r=u),typeof d==`function`?(this.#i=d,this.#v=[]):(this.#i=void 0,this.#v=void 0),this.#C=!!this.#n,this.#E=!!this.#r,this.#T=!!this.#i,this.noDisposeOnSet=!!f,this.noUpdateTTL=!!p,this.noDeleteOnFetchRejection=!!y,this.allowStaleOnFetchRejection=!!x,this.allowStaleOnFetchAbort=!!S,this.ignoreFetchAbort=!!C,this.maxEntrySize!==0){if(this.#t!==0&&!sY(this.#t))throw TypeError(`maxSize must be a positive integer if specified`);if(!sY(this.maxEntrySize))throw TypeError(`maxEntrySize must be a positive integer if specified`);this.#M()}if(this.allowStale=!!c,this.noDeleteOnStaleGet=!!b,this.updateAgeOnGet=!!o,this.updateAgeOnHas=!!s,this.ttlResolution=sY(i)||i===0?i:1,this.ttlAutopurge=!!a,this.ttl=r||0,this.ttl){if(!sY(this.ttl))throw TypeError(`ttl must be a positive integer if specified`);this.#D()}if(this.#e===0&&this.ttl===0&&this.#t===0)throw TypeError(`At least one of max, maxSize, or ttl is required`);if(!this.ttlAutopurge&&!this.#e&&!this.#t){let t=`LRU_CACHE_UNBOUNDED`;oY(t)&&(rY.add(t),aY(`TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.`,`UnboundedCacheWarning`,t,e))}}getRemainingTTL(e){return this.#u.has(e)?1/0:0}#D(){let e=new lY(this.#e),t=new lY(this.#e);this.#x=e,this.#b=t;let n=this.ttlAutopurge?Array.from({length:this.#e}):void 0;this.#S=n,this.#A=(n,i,a=this.#s.now())=>{t[n]=i===0?0:a,e[n]=i,r(n,i)},this.#O=n=>{t[n]=e[n]===0?0:this.#s.now(),r(n,e[n])};let r=this.ttlAutopurge?(e,t)=>{if(n?.[e]&&(clearTimeout(n[e]),n[e]=void 0),t&&t!==0&&n){let i=setTimeout(()=>{this.#j(e)?(this.#Z(this.#d[e],`expire`),n[e]=void 0):r(e,o(e))},t+1);i.unref&&i.unref(),n[e]=i}}:()=>{};this.#k=(n,r)=>{if(e[r]){let o=e[r],s=t[r];if(!o||!s)return;n.ttl=o,n.start=s,n.now=i||a(),n.remainingTTL=o-(n.now-s)}};let i=0,a=()=>{let e=this.#s.now();if(this.ttlResolution>0){i=e;let t=setTimeout(()=>i=0,this.ttlResolution);t.unref&&t.unref()}return e};this.getRemainingTTL=e=>{let t=this.#u.get(e);return t===void 0?0:o(t)};let o=n=>{let r=e[n],o=t[n];return!r||!o?1/0:r-((i||a())-o)};this.#j=n=>{let r=t[n],o=e[n];return!!o&&!!r&&(i||a())-r>o}}#O=()=>{};#k=()=>{};#A=()=>{};#j=()=>!1;#M(){let e=new lY(this.#e);this.#l=0,this.#y=e,this.#N=t=>{this.#l-=e[t],e[t]=0},this.#F=(e,t,n,r)=>{if(!sY(n)){if(this.#W(t))return this.backgroundFetchSize;if(r){if(typeof r!=`function`)throw TypeError(`sizeCalculation must be a function`);if(n=r(t,e),!sY(n))throw TypeError(`sizeCalculation return invalid (expect positive integer)`)}else throw TypeError(`invalid size value (must be positive integer). When maxSize or maxEntrySize is used, sizeCalculation or size must be set.`)}return n},this.#P=(t,n,r)=>{if(e[t]=n,this.#t){let n=this.#t-e[t];for(;this.#l>n;)this.#B(!0)}this.#l+=e[t],r&&(r.entrySize=n,r.totalCalculatedSize=this.#l)}}#N=e=>{};#P=(e,t,n)=>{};#F=(e,t,n,r)=>{if(n||r)throw TypeError(`cannot set size without setting maxSize or maxEntrySize on cache`);return 0};*#I({allowStale:e=this.allowStale}={}){if(this.#c)for(let t=this.#g;this.#R(t)&&((e||!this.#j(t))&&(yield t),t!==this.#h);)t=this.#m[t]}*#L({allowStale:e=this.allowStale}={}){if(this.#c)for(let t=this.#h;this.#R(t)&&((e||!this.#j(t))&&(yield t),t!==this.#g);)t=this.#p[t]}#R(e){return e!==void 0&&this.#u.get(this.#d[e])===e}*entries(){for(let e of this.#I())this.#f[e]!==void 0&&this.#d[e]!==void 0&&!this.#W(this.#f[e])&&(yield[this.#d[e],this.#f[e]])}*rentries(){for(let e of this.#L())this.#f[e]!==void 0&&this.#d[e]!==void 0&&!this.#W(this.#f[e])&&(yield[this.#d[e],this.#f[e]])}*keys(){for(let e of this.#I()){let t=this.#d[e];t!==void 0&&!this.#W(this.#f[e])&&(yield t)}}*rkeys(){for(let e of this.#L()){let t=this.#d[e];t!==void 0&&!this.#W(this.#f[e])&&(yield t)}}*values(){for(let e of this.#I())this.#f[e]!==void 0&&!this.#W(this.#f[e])&&(yield this.#f[e])}*rvalues(){for(let e of this.#L())this.#f[e]!==void 0&&!this.#W(this.#f[e])&&(yield this.#f[e])}[Symbol.iterator](){return this.entries()}[Symbol.toStringTag]=`LRUCache`;find(e,t={}){for(let n of this.#I()){let r=this.#f[n],i=this.#W(r)?r.__staleWhileFetching:r;if(i!==void 0&&e(i,this.#d[n],this))return this.#J(this.#d[n],t)}}forEach(e,t=this){for(let n of this.#I()){let r=this.#f[n],i=this.#W(r)?r.__staleWhileFetching:r;i!==void 0&&e.call(t,i,this.#d[n],this)}}rforEach(e,t=this){for(let n of this.#L()){let r=this.#f[n],i=this.#W(r)?r.__staleWhileFetching:r;i!==void 0&&e.call(t,i,this.#d[n],this)}}purgeStale(){let e=!1;for(let t of this.#L({allowStale:!0}))this.#j(t)&&(this.#Z(this.#d[t],`expire`),e=!0);return e}info(e){let t=this.#u.get(e);if(t===void 0)return;let n=this.#f[t],r=this.#W(n)?n.__staleWhileFetching:n;if(r===void 0)return;let i={value:r};if(this.#x&&this.#b){let e=this.#x[t],n=this.#b[t];e&&n&&(i.ttl=e-(this.#s.now()-n),i.start=Date.now())}return this.#y&&(i.size=this.#y[t]),i}dump(){let e=[];for(let t of this.#I({allowStale:!0})){let n=this.#d[t],r=this.#f[t],i=this.#W(r)?r.__staleWhileFetching:r;if(i===void 0||n===void 0)continue;let a={value:i};if(this.#x&&this.#b){a.ttl=this.#x[t];let e=this.#s.now()-this.#b[t];a.start=Math.floor(Date.now()-e)}this.#y&&(a.size=this.#y[t]),e.unshift([n,a])}return e}load(e){this.clear();for(let[t,n]of e){if(n.start){let e=Date.now()-n.start;n.start=this.#s.now()-e}this.#z(t,n.value,n)}}set(e,t,n={}){let{status:r=$J.hasSubscribers?{}:void 0}=n;n.status=r,r&&(r.op=`set`,r.key=e,t!==void 0&&(r.value=t),r.cache=this);let i=this.#z(e,t,n);return r&&$J.hasSubscribers&&$J.publish(r),i}#z(e,t,n,r){let{ttl:i=this.ttl,start:a,noDisposeOnSet:o=this.noDisposeOnSet,sizeCalculation:s=this.sizeCalculation,status:c}=n,l=this.#W(t);if(t===void 0)return c&&(c.set=`deleted`),this.delete(e),this;let{noUpdateTTL:u=this.noUpdateTTL}=n;c&&!l&&(c.value=t);let d=this.#F(e,t,n.size||0,s,c);if(this.maxEntrySize&&d>this.maxEntrySize)return this.#Z(e,`set`),c&&(c.set=`miss`,c.maxEntrySizeExceeded=!0),this;let f=this.#c===0?void 0:this.#u.get(e);if(f===void 0)f=this.#c===0?this.#g:this.#_.length===0?this.#c===this.#e?this.#B(!1):this.#c:this.#_.pop(),this.#d[f]=e,this.#f[f]=t,this.#u.set(e,f),this.#p[this.#g]=f,this.#m[f]=this.#g,this.#g=f,this.#c++,this.#P(f,d,c),c&&(c.set=`add`),u=!1,this.#E&&!l&&this.#r?.(t,e,`add`);else{this.#X(f);let n=this.#f[f];if(t!==n){if(!o){if(this.#W(n)){n!==r&&n.__abortController.abort(Error(`replaced`));let{__staleWhileFetching:i}=n;i!==void 0&&i!==t&&(this.#C&&this.#n?.(i,e,`set`),this.#T&&this.#v?.push([i,e,`set`]))}else this.#C&&this.#n?.(n,e,`set`),this.#T&&this.#v?.push([n,e,`set`])}if(this.#N(f),this.#P(f,d,c),this.#f[f]=t,!l){let r=n&&this.#W(n)?n.__staleWhileFetching:n,i=r===void 0?`add`:t===r?`update`:`replace`;c&&(c.set=i,r!==void 0&&(c.oldValue=r)),this.#E&&this.onInsert?.(t,e,i)}}else l||(c&&(c.set=`update`),this.#E&&this.onInsert?.(t,e,`update`))}if(i!==0&&!this.#x&&this.#D(),this.#x&&(u||this.#A(f,i,a),c&&this.#k(c,f)),!o&&this.#T&&this.#v){let e=this.#v,t;for(;t=e?.shift();)this.#i?.(...t)}return this}pop(){try{for(;this.#c;){let e=this.#f[this.#h];if(this.#B(!0),this.#W(e)){if(e.__staleWhileFetching)return e.__staleWhileFetching}else if(e!==void 0)return e}}finally{if(this.#T&&this.#v){let e=this.#v,t;for(;t=e?.shift();)this.#i?.(...t)}}}#B(e){let t=this.#h,n=this.#d[t],r=this.#f[t],i=this.#W(r);i&&r.__abortController.abort(Error(`evicted`));let a=i?r.__staleWhileFetching:r;return(this.#C||this.#T)&&a!==void 0&&(this.#C&&this.#n?.(a,n,`evict`),this.#T&&this.#v?.push([a,n,`evict`])),this.#N(t),this.#S?.[t]&&(clearTimeout(this.#S[t]),this.#S[t]=void 0),e&&(this.#d[t]=void 0,this.#f[t]=void 0,this.#_.push(t)),this.#c===1?(this.#h=this.#g=0,this.#_.length=0):this.#h=this.#p[t],this.#u.delete(n),this.#c--,t}has(e,t={}){let{status:n=$J.hasSubscribers?{}:void 0}=t;t.status=n,n&&(n.op=`has`,n.key=e,n.cache=this);let r=this.#V(e,t);return $J.hasSubscribers&&$J.publish(n),r}#V(e,t={}){let{updateAgeOnHas:n=this.updateAgeOnHas,status:r}=t,i=this.#u.get(e);if(i!==void 0){let e=this.#f[i];if(this.#W(e)&&e.__staleWhileFetching===void 0)return!1;if(this.#j(i))r&&(r.has=`stale`,this.#k(r,i));else return n&&this.#O(i),r&&(r.has=`hit`,this.#k(r,i)),!0}else r&&(r.has=`miss`);return!1}peek(e,t={}){let{status:n=nY()?{}:void 0}=t;n&&(n.op=`peek`,n.key=e,n.cache=this),t.status=n;let r=this.#H(e,t);return $J.hasSubscribers&&$J.publish(n),r}#H(e,t){let{status:n,allowStale:r=this.allowStale}=t,i=this.#u.get(e);if(i===void 0||!r&&this.#j(i)){n&&(n.peek=i===void 0?`miss`:`stale`);return}let a=this.#f[i],o=this.#W(a)?a.__staleWhileFetching:a;return n&&(o===void 0?n.peek=`miss`:(n.peek=`hit`,n.value=o)),o}#U(e,t,n,r){let i=t===void 0?void 0:this.#f[t];if(this.#W(i))return i;let a=new AbortController,{signal:o}=n;o?.addEventListener(`abort`,()=>a.abort(o.reason),{signal:a.signal});let s={signal:a.signal,options:n,context:r},c=(r,i=!1)=>{let{aborted:o}=a.signal,c=n.ignoreFetchAbort&&r!==void 0,l=n.ignoreFetchAbort||!!(n.allowStaleOnFetchAbort&&r!==void 0);if(n.status&&(o&&!i?(n.status.fetchAborted=!0,n.status.fetchError=a.signal.reason,c&&(n.status.fetchAbortIgnored=!0)):n.status.fetchResolved=!0),o&&!c&&!i)return u(a.signal.reason,l);let d=f,p=this.#f[t];return(p===f||p===void 0&&c&&i)&&(r===void 0?d.__staleWhileFetching===void 0?this.#Z(e,`fetch`):this.#f[t]=d.__staleWhileFetching:(n.status&&(n.status.fetchUpdated=!0),this.#z(e,r,s.options,d))),r},l=e=>(n.status&&(n.status.fetchRejected=!0,n.status.fetchError=e),u(e,!1)),u=(r,i)=>{let{aborted:o}=a.signal,s=o&&n.allowStaleOnFetchAbort,c=s||n.allowStaleOnFetchRejection,l=c||n.noDeleteOnFetchRejection,u=f;if(this.#f[t]===f&&(!l||!i&&u.__staleWhileFetching===void 0?this.#Z(e,`fetch`):s||(this.#f[t]=u.__staleWhileFetching)),c)return n.status&&u.__staleWhileFetching!==void 0&&(n.status.returnedStale=!0),u.__staleWhileFetching;if(u.__returned===u)throw r},d=(t,r)=>{let o=this.#a?.(e,i,s);a.signal.addEventListener(`abort`,()=>{(!n.ignoreFetchAbort||n.allowStaleOnFetchAbort)&&(t(void 0),n.allowStaleOnFetchAbort&&(t=e=>c(e,!0)))}),o&&o instanceof Promise?o.then(e=>t(e===void 0?void 0:e),r):o!==void 0&&t(o)};n.status&&(n.status.fetchDispatched=!0);let f=new Promise(d).then(c,l),p=Object.assign(f,{__abortController:a,__staleWhileFetching:i,__returned:void 0});return t===void 0?(this.#z(e,p,{...s.options,status:void 0}),t=this.#u.get(e)):this.#f[t]=p,p}#W(e){if(!this.#w)return!1;let t=e;return!!t&&t instanceof Promise&&t.hasOwnProperty(`__staleWhileFetching`)&&t.__abortController instanceof AbortController}fetch(e,t={}){let n=eY.hasSubscribers,{status:r=nY()?{}:void 0}=t;t.status=r,r&&t.context&&(r.context=t.context);let i=this.#G(e,t);return r&&n&&(r.trace=!0,eY.tracePromise(()=>i,r).catch(()=>{})),i}async#G(e,t={}){let{allowStale:n=this.allowStale,updateAgeOnGet:r=this.updateAgeOnGet,noDeleteOnStaleGet:i=this.noDeleteOnStaleGet,ttl:a=this.ttl,noDisposeOnSet:o=this.noDisposeOnSet,size:s=0,sizeCalculation:c=this.sizeCalculation,noUpdateTTL:l=this.noUpdateTTL,noDeleteOnFetchRejection:u=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:d=this.allowStaleOnFetchRejection,ignoreFetchAbort:f=this.ignoreFetchAbort,allowStaleOnFetchAbort:p=this.allowStaleOnFetchAbort,context:m,forceRefresh:h=!1,status:g,signal:_}=t;if(g&&(g.op=`fetch`,g.key=e,h&&(g.forceRefresh=!0),g.cache=this),!this.#w)return g&&(g.fetch=`get`),this.#J(e,{allowStale:n,updateAgeOnGet:r,noDeleteOnStaleGet:i,status:g});let v={allowStale:n,updateAgeOnGet:r,noDeleteOnStaleGet:i,ttl:a,noDisposeOnSet:o,size:s,sizeCalculation:c,noUpdateTTL:l,noDeleteOnFetchRejection:u,allowStaleOnFetchRejection:d,allowStaleOnFetchAbort:p,ignoreFetchAbort:f,status:g,signal:_},y=this.#u.get(e);if(y===void 0){g&&(g.fetch=`miss`);let t=this.#U(e,y,v,m);return t.__returned=t}{let t=this.#f[y];if(this.#W(t)){let e=n&&t.__staleWhileFetching!==void 0;return g&&(g.fetch=`inflight`,e&&(g.returnedStale=!0)),e?t.__staleWhileFetching:t.__returned=t}let i=this.#j(y);if(!h&&!i)return g&&(g.fetch=`hit`),this.#X(y),r&&this.#O(y),g&&this.#k(g,y),t;let a=this.#U(e,y,v,m),o=a.__staleWhileFetching!==void 0&&n;return g&&(g.fetch=i?`stale`:`refresh`,o&&i&&(g.returnedStale=!0)),o?a.__staleWhileFetching:a.__returned=a}}forceFetch(e,t={}){let n=eY.hasSubscribers,{status:r=nY()?{}:void 0}=t;t.status=r,r&&t.context&&(r.context=t.context);let i=this.#K(e,t);return r&&n&&(r.trace=!0,eY.tracePromise(()=>i,r).catch(()=>{})),i}async#K(e,t={}){let n=await this.#G(e,t);if(n===void 0)throw Error(`fetch() returned undefined`);return n}memo(e,t={}){let{status:n=$J.hasSubscribers?{}:void 0}=t;t.status=n,n&&(n.op=`memo`,n.key=e,t.context&&(n.context=t.context),n.cache=this);let r=this.#q(e,t);return n&&(n.value=r),$J.hasSubscribers&&$J.publish(n),r}#q(e,t={}){let n=this.#o;if(!n)throw Error(`no memoMethod provided to constructor`);let{context:r,status:i,forceRefresh:a,...o}=t;i&&a&&(i.forceRefresh=!0);let s=this.#J(e,o),c=a||s===void 0;if(i&&(i.memo=c?`miss`:`hit`,c||(i.value=s)),!c)return s;let l=n(e,s,{options:o,context:r});return i&&(i.value=l),this.#z(e,l,o),l}get(e,t={}){let{status:n=$J.hasSubscribers?{}:void 0}=t;t.status=n,n&&(n.op=`get`,n.key=e,n.cache=this);let r=this.#J(e,t);return n&&(r!==void 0&&(n.value=r),$J.hasSubscribers&&$J.publish(n)),r}#J(e,t={}){let{allowStale:n=this.allowStale,updateAgeOnGet:r=this.updateAgeOnGet,noDeleteOnStaleGet:i=this.noDeleteOnStaleGet,status:a}=t,o=this.#u.get(e);if(o===void 0){a&&(a.get=`miss`);return}let s=this.#f[o],c=this.#W(s);return a&&this.#k(a,o),this.#j(o)?c?(a&&(a.get=`stale-fetching`),n&&s.__staleWhileFetching!==void 0?(a&&(a.returnedStale=!0),s.__staleWhileFetching):void 0):(i||this.#Z(e,`expire`),a&&(a.get=`stale`),n?(a&&(a.returnedStale=!0),s):void 0):(a&&(a.get=c?`fetching`:`hit`),this.#X(o),r&&this.#O(o),c?s.__staleWhileFetching:s)}#Y(e,t){this.#m[t]=e,this.#p[e]=t}#X(e){e!==this.#g&&(e===this.#h?this.#h=this.#p[e]:this.#Y(this.#m[e],this.#p[e]),this.#Y(this.#g,e),this.#g=e)}delete(e){return this.#Z(e,`delete`)}#Z(e,t){$J.hasSubscribers&&$J.publish({op:`delete`,delete:t,key:e,cache:this});let n=!1;if(this.#c!==0){let r=this.#u.get(e);if(r!==void 0){if(this.#S?.[r]&&(clearTimeout(this.#S[r]),this.#S[r]=void 0),n=!0,this.#c===1)this.#Q(t);else{this.#N(r);let n=this.#f[r];if(this.#W(n)?n.__abortController.abort(Error(`deleted`)):(this.#C||this.#T)&&(this.#C&&this.#n?.(n,e,t),this.#T&&this.#v?.push([n,e,t])),this.#u.delete(e),this.#d[r]=void 0,this.#f[r]=void 0,r===this.#g)this.#g=this.#m[r];else if(r===this.#h)this.#h=this.#p[r];else{let e=this.#m[r];this.#p[e]=this.#p[r];let t=this.#p[r];this.#m[t]=this.#m[r]}this.#c--,this.#_.push(r)}}}if(this.#T&&this.#v?.length){let e=this.#v,t;for(;t=e?.shift();)this.#i?.(...t)}return n}clear(){return this.#Q(`delete`)}#Q(e){for(let t of this.#L({allowStale:!0})){let n=this.#f[t];if(this.#W(n))n.__abortController.abort(Error(`deleted`));else{let r=this.#d[t];this.#C&&this.#n?.(n,r,e),this.#T&&this.#v?.push([n,r,e])}}if(this.#u.clear(),this.#f.fill(void 0),this.#d.fill(void 0),this.#x&&this.#b){this.#x.fill(0),this.#b.fill(0);for(let e of this.#S??[])e!==void 0&&clearTimeout(e);this.#S?.fill(void 0)}if(this.#y&&this.#y.fill(0),this.#h=0,this.#g=0,this.#_.length=0,this.#l=0,this.#c=0,this.#T&&this.#v){let e=this.#v,t;for(;t=e?.shift();)this.#i?.(...t)}}},fY=class{constructor(e,t){this._hpkeRecipient=null,this.walletsService=e,this.jwtCache=new dY({max:t})}async getHpkeRecipient(){return this._hpkeRecipient||=await aJ(),this._hpkeRecipient}async exchangeJwtForAuthorizationKey(e){let t=this.jwtCache.get(e);if(t)return t;let{publicKeySpki:n,decryptPayload:r}=await this.getHpkeRecipient(),i=await this.walletsService.authenticateWithJwt({user_jwt:e,encryption_type:`HPKE`,recipient_public_key:Buffer.from(n).toString(`base64`)});if(`encrypted_authorization_key`in i&&i.encrypted_authorization_key.encryption_type===`HPKE`){let t=i.encrypted_authorization_key,n=await r(Buffer.from(t.encapsulated_key,`base64`),Buffer.from(t.ciphertext,`base64`)),a=new TextDecoder().decode(n);return this.jwtCache.set(e,a,{ttl:i.expires_at-Date.now()}),a}throw new nR(`JWT exchange failed: unsupported encryption type`)}},pY=1e3,mY=9e5,hY=2592e5,gY=class{_jwtExchange(){return this.jwtExchangeService}constructor({appId:e,appSecret:t,apiUrl:n,authorizationKeyCacheMaxCapacity:r=pY,defaultRequestExpiryMs:i,disableRequestExpiry:a,requestExpiry:o,defaultHeaders:s,jwtVerificationKey:c,webhookSigningSecret:l,...u}){this.privyApiClient=new PB({...u,appID:e,appSecret:t,baseURL:n,defaultHeaders:{...s,"privy-client":`node:${TR}`}});let d=UJ({appId:this.privyApiClient.appID,apiUrl:this.privyApiClient.baseURL,headers:{"privy-client":`node:${TR}`},verificationKeyOverride:c});this._disableRequestExpiry=o?.disabled??a??!1,this._defaultRequestExpiryMs=o?.defaultMs??i??mY,this._defaultIntentRequestExpiryMs=o?.defaultIntentMs??hY,this.jwtExchangeService=new fY(this.privyApiClient.wallets,r),this.walletsService=new TJ(this.privyApiClient,this),this.policiesService=new EJ(this.privyApiClient,this),this.transactionsService=new DJ(this.privyApiClient),this.keyQuorumsService=new OJ(this.privyApiClient,this),this.intentsService=new KJ(this.privyApiClient,this),this.usersService=new WJ(this.privyApiClient,d),this.organizationsService=new qJ(this.privyApiClient),this.appsService=new GJ(this.privyApiClient),this.utilsService=new ZJ(this.privyApiClient,this,d),this.webhooksService=new SG(this.privyApiClient.webhooks,l)}webhooks(){return this.webhooksService}wallets(){return this.walletsService}policies(){return this.policiesService}transactions(){return this.transactionsService}keyQuorums(){return this.keyQuorumsService}intents(){return this.intentsService}users(){return this.usersService}organizations(){return this.organizationsService}apps(){return this.appsService}utils(){return this.utilsService}getRequestExpiry(e){if(!this._disableRequestExpiry)return Date.now()+(e??this._defaultRequestExpiryMs)}getIntentRequestExpiry(e){if(!this._disableRequestExpiry)return Date.now()+(e??this._defaultIntentRequestExpiryMs)}};function _Y(){return Tr(Pn.utils.randomPrivateKey())}function vY(e){if(typeof e==`string`){if(!ci(e,{strict:!1}))throw new Ar({address:e});return{address:e,type:`json-rpc`}}if(!ci(e.address,{strict:!1}))throw new Ar({address:e.address});return{address:e.address,nonceManager:e.nonceManager,sign:e.sign,signAuthorization:e.signAuthorization,signMessage:e.signMessage,signTransaction:e.signTransaction,signTypedData:e.signTypedData,source:`custom`,type:`local`}}var yY=!1;async function bY({hash:e,privateKey:t,to:n=`object`}){let{r,s:i,recovery:a}=Pn.sign(e.slice(2),t.slice(2),{lowS:!0,extraEntropy:Ir(yY,{strict:!1})?Cr(yY):yY}),o={r:br(r,{size:32}),s:br(i,{size:32}),v:a?28n:27n,yParity:a};return n===`bytes`||n===`hex`?pk({...o,to:n}):o}async function xY(e){let{chainId:t,nonce:n,privateKey:r,to:i=`object`}=e,a=e.contractAddress??e.address,o=await bY({hash:xt({address:a,chainId:t,nonce:n}),privateKey:r,to:i});return i===`object`?{address:a,chainId:t,nonce:n,...o}:o}async function SY({message:e,privateKey:t}){return await bY({hash:fe(e),privateKey:t,to:`hex`})}async function CY(e){let{privateKey:t,transaction:n,serializer:r=jt}=e,i=n.type===`eip4844`?{...n,sidecars:!1}:n;return await r(n,await bY({hash:fr(await r(i)),privateKey:t}))}async function wY(e){let{privateKey:t,...n}=e;return await bY({hash:oe(n),privateKey:t,to:`hex`})}function TY(e,t={}){let{nonceManager:n}=t,r=Tr(Pn.getPublicKey(e.slice(2),!1));return{...vY({address:et(r),nonceManager:n,async sign({hash:t}){return bY({hash:t,privateKey:e,to:`hex`})},async signAuthorization(t){return xY({...t,privateKey:e})},async signMessage({message:t}){return SY({message:t,privateKey:e})},async signTransaction(t,{serializer:n}={}){return CY({privateKey:e,transaction:t,serializer:n})},async signTypedData(t){return wY({...t,privateKey:e})}}),publicKey:r,source:`privateKey`}}var EY=e=>`0x${e.toString(16)}`,DY=e=>typeof e==`bigint`?EY(e):e;function OY(e,t){let n=e.account,r=t??n;return r?.source===`accessKey`||mt({...e,...r?{account:r}:{}})}function kY(e){let t={type:118,calls:(e.calls?.length?e.calls:[{to:e.to,data:e.data,value:e.value}]).map(e=>{if(!e.to)throw new nR("Tempo transaction calls require a `to` address.");return{to:e.to,...e.data===void 0?{}:{data:e.data},...e.value===void 0?{}:{value:DY(e.value)}}})};return e.chainId!==void 0&&(t.chain_id=e.chainId),e.nonce!==void 0&&(t.nonce=e.nonce),e.nonceKey!==void 0&&e.nonceKey!==`random`&&(t.nonce_key=DY(e.nonceKey)),e.validAfter!==void 0&&(t.valid_after=DY(e.validAfter)),e.validBefore!==void 0&&(t.valid_before=DY(e.validBefore)),e.feeToken!==void 0&&(t.fee_token=AY(e.feeToken)),e.from!==void 0&&(t.from=e.from),e.gas!==void 0&&(t.gas_limit=DY(e.gas)),e.maxFeePerGas!==void 0&&(t.max_fee_per_gas=DY(e.maxFeePerGas)),e.maxPriorityFeePerGas!==void 0&&(t.max_priority_fee_per_gas=DY(e.maxPriorityFeePerGas)),e.accessList&&(t.access_list=e.accessList.map(e=>({address:e.address,storage_keys:[...e.storageKeys]}))),e.feePayerSignature&&(t.fee_payer_signature=jY(e.feePayerSignature)),t}var AY=e=>typeof e==`string`?e:`0x20c0${e.toString(16).padStart(36,`0`)}`,jY=e=>{let t=e.yParity===void 0?e.v===void 0?void 0:Number(e.v)-27:e.yParity;if(t!==0&&t!==1)throw new nR(`Tempo signatures require a valid yParity value.`);return{r:e.r,s:e.s,y_parity:t}};function MY(e,{walletId:t,address:n,authorizationContext:r,signatureOptions:i}){return vY({address:n,sign:async({hash:n})=>(await e.wallets().ethereum().signSecp256k1(t,{params:{hash:n},...r?{authorization_context:r}:{}})).signature,signMessage:async({message:n})=>(await e.wallets().ethereum().signMessage(t,{message:PY(n),...r?{authorization_context:r}:{}})).signature,signTypedData:async n=>{let{message:a,domain:o,types:s,primaryType:c}=IY(n,Tr);if(!o)throw new nR(`typedData.domain must be defined`);if(!a||!s)throw new nR(`typedData.message must be defined`);let l=o.chainId,u=i?.type===`erc1271`&&l?`eip155:${l}`:void 0,{signature:d}=await e.wallets().ethereum().signTypedData(t,{params:{typed_data:{domain:o,message:a,primary_type:c,types:s}},...i?{signature_options:i}:{},...u?{caip2:u}:{},...r?{authorization_context:r}:{}});return d},signTransaction:async n=>{let{signed_transaction:i}=await e.wallets().ethereum().signTransaction(t,{params:{transaction:FY(n)},...r?{authorization_context:r}:{}});return i},signAuthorization:async n=>{let{authorization:i}=await e.wallets().ethereum().sign7702Authorization(t,{params:{contract:n.contractAddress??n.address,chain_id:n.chainId,nonce:n.nonce},...r?{authorization_context:r}:{}});return{address:i.contract,nonce:Number(i.nonce),chainId:Number(i.chain_id),yParity:i.y_parity,r:i.r,s:i.s}}})}function NY(e){if(e===`legacy`)return 0;if(e===`eip2930`)return 1;if(e==`eip1559`||e===void 0)return 2;if(e===`tempo`)return 118;throw new nR(`EIP4844 and EIP7702 transaction types are not yet supported.`)}var PY=e=>typeof e==`string`?e:typeof e.raw==`string`?Uint8Array.from(Buffer.from(e.raw.slice(2),`hex`)):e.raw,FY=e=>{if(OY(e))return kY(e);let t=e;return{type:NY(t.type),...t.to?{to:t.to}:{},...t.nonce?{nonce:t.nonce}:{},...t.chainId?{chain_id:t.chainId}:{},...t.data?{data:t.data}:{},...t.value?{value:EY(t.value)}:{},...t.gas?{gas_limit:EY(t.gas)}:{},...t.gasPrice?{gas_price:EY(t.gasPrice)}:{},...t.maxFeePerGas?{max_fee_per_gas:EY(t.maxFeePerGas)}:{},...t.maxPriorityFeePerGas?{max_priority_fee_per_gas:EY(t.maxPriorityFeePerGas)}:{}}},IY=(e,t)=>typeof e==`bigint`?t(e):Array.isArray(e)?e.map(e=>IY(e,t)):e&&typeof e==`object`?Object.fromEntries(Object.entries(e).map(([e,n])=>[e,IY(n,t)])):e,LY=class extends Error{name=`Privy.SigningKeyMissingError`;constructor(){super(`Missing PRIVY_JWT_PRIVATE_KEY. Set the RS256 private key whose public half each Privy app trusts.`)}},RY=60;function zY(e,t){e.var.privyUsers.set(ZY({app:void 0,userId:t.userId}),Promise.resolve(void 0))}async function BY(e,t){let{app:n,userId:r}=t,i=await Y(e,JY(e,{app:n,userId:r}),`Privy.findUser`)??await Y(e,qY(e,{app:n,userId:r}),`Privy.createUser`),a=i.wallets[0];if(a)return a;let o=await Y(e,GY(e,{app:n,privyUserId:i.id}),`Privy.addWallet`);return QY(e,{app:n,user:{id:i.id,wallets:[o]},userId:r}),o}(function(e){e.errors=cO.errors})(BY||={});async function VY(e,t){return(await Y(e,JY(e,t),`Privy.findUser`))?.wallets??[]}(function(e){e.errors=cO.errors})(VY||={});var HY=TP(async(e,t)=>{e.set(`privyUsers`,new Map),await t()});async function UY(e,t){let{app:n,privateKey:r,userId:i}=t;if(!r)throw new LY;let a=await crypto.subtle.importKey(`pkcs8`,new Uint8Array(Ln(r.replace(/-----[^-]+-----|\s/g,``))),{hash:`SHA-256`,name:`RSASSA-PKCS1-v1_5`},!0,[`sign`]),o=await crypto.subtle.exportKey(`jwk`,a),s=Math.floor(Date.now()/1e3);return(await e.api.signJWT({body:{overrideOptions:{adapter:{getJwks:()=>[{alg:`RS256`,createdAt:new Date(0),id:`privy`,privateKey:JSON.stringify(o),publicKey:JSON.stringify({e:o.e,kty:o.kty,n:o.n})}]},jwks:{disablePrivateKeyEncryption:!0,keyPairConfig:{alg:`RS256`}}},payload:{aud:n.appId,exp:s+RY,iat:s,sub:i}}})).token}function WY(e){let{app:t,token:n,wallet:r}=e;return D({owners:[MY(KY(t),{address:r.address,...n?{authorizationContext:{user_jwts:[n]}}:{},walletId:r.id})]})}async function GY(e,t){for(let n=1;;n++){let r=await Y(e,KY(t.app).wallets().create({chain_type:`ethereum`,idempotency_key:`tempo-id:first-wallet:${t.privyUserId}`,owner:{user_id:t.privyUserId}}),`privy.wallets.create`).catch(e=>{if(!(n<GY.attempts&&XY(e)))throw e});if(r)return{address:r.address,createdAt:new Date(r.created_at),id:r.id};await Y(e,new Promise(e=>setTimeout(e,GY.interval)),`Privy.addWallet.wait`)}}(function(e){e.attempts=10,e.interval=250})(GY||={});function KY(e){return new gY({appId:e.appId,appSecret:e.appSecret,maxRetries:1,timeout:8e3})}async function qY(e,t){let n=$Y(await Y(e,KY(t.app).users().create({linked_accounts:[{custom_user_id:t.userId,type:`custom_auth`}]}),`privy.users.create`).catch(async n=>{let r=await Y(e,YY(e,t),`Privy.getUser`);if(!r)throw n;return r}));return QY(e,{app:t.app,user:n,userId:t.userId}),n}async function JY(e,t){let n=e.var.privyUsers,r=ZY(t),i=n.get(r)??n.get(ZY({app:void 0,userId:t.userId}))??(async()=>{let n=await Y(e,YY(e,t),`Privy.getUser`);return n?$Y(n):void 0})();return n.set(r,i),await i.catch(e=>{throw n.get(r)===i&&n.delete(r),e})}async function YY(e,t){return await Y(e,KY(t.app).users().getByCustomAuthID({custom_user_id:t.userId}),`privy.users.get`).catch(e=>{if(!(e instanceof Error&&`status`in e&&e.status===404))throw e})}function XY(e){return e instanceof Error&&`status`in e&&e.status===400&&e.message.includes(`idempotency key is still in progress`)}function ZY(e){return JSON.stringify([e.app?.appId??null,e.userId])}function QY(e,t){e.var.privyUsers.set(ZY(t),Promise.resolve(t.user))}function $Y(e){return{id:e.id,wallets:eX(e)}}function eX(e){return e.linked_accounts.flatMap(e=>e.type===`wallet`&&`chain_type`in e&&e.chain_type===`ethereum`&&`connector_type`in e&&e.connector_type===`embedded`&&`id`in e&&e.id?[{...e,id:e.id}]:[]).sort((e,t)=>(e.wallet_index??0)-(t.wallet_index??0)).reduce((t,n)=>{let r=typeof n.first_verified_at==`number`?new Date(n.first_verified_at*1e3):t.at(-1)?.createdAt??new Date(e.created_at*1e3);return[...t,{address:n.address,createdAt:r,id:n.id}]},[])}var tX=xN({errors:cO.errors,async load(e,t){let{db:n,env:r,realms:i,userId:a}=t,o=await Y(e,qL(e,{db:n,realms:i,secret:r.SECRET}),`Realm.privyApps`),s=(e,t,n)=>bN({account:WY({app:e,wallet:n}),createdAt:n.createdAt,linked:!1,realm:t,async signer(t,i){return WY({app:e,token:await Y(t,UY(i.auth,{app:e,privateKey:r.PRIVY_JWT_PRIVATE_KEY,userId:a}),`Privy.token`),wallet:n}).owners[0]},type:`privy`});return{create(e){let t=o.get(e.id);if(t)return async n=>{let r=await Y(n,BY(n,{app:t,userId:a}),`Privy.firstWallet`);return s(t,e,r)}},async list(e){return wN(await Promise.all(i.map(async t=>{let n=o.get(t.id);return n?(await Y(e,VY(e,{app:n,userId:a}),`Privy.listWallets`)).map(e=>s(n,t,e)):[]})))}}},type:`privy`}),nX=class extends Error{name=`Secp256k1.SignerRequiredError`;constructor(){super(`The account of a secp256k1 owner signs nothing. Sign with the owner's signer.`)}},rX=xN({errors:[],load(e,t){let{env:n,userId:r}=t,i=t.realms.filter(e=>e.secp256k1),a=(e,t)=>bN({account:D({owners:[iX(e.address)]}),createdAt:e.createdAt,linked:!1,realm:t,async signer(){return TY(await fs({data:e.privateKey,key:n.SECRET}))},type:`secp256k1`});return Promise.resolve({create(e){if(i.some(t=>t.id===e.id))return async i=>{let o=_Y(),[s]=await Y(i,t.db.insert(NE).values({address:TY(o).address,privateKey:await Yo({data:o,key:n.SECRET}),realmId:e.id,userId:r}).onConflictDoUpdate({set:{userId:r},target:[NE.userId,NE.realmId]}).returning(),`db.secp256k1Owner.insert`);return a(s,e)}},async list(e,t){return i.length===0?[]:(await Y(e,t.db.select().from(NE).where(qC(W(NE.userId,r),ew(NE.realmId,i.map(e=>e.id)))).orderBy(fw(NE.createdAt),fw(NE.realmId)),`db.secp256k1Owner.list`)).map(e=>a(e,i.find(t=>t.id===e.realmId)))}})},type:`secp256k1`});function iX(e){let t=()=>Promise.reject(new nX);return vY({address:e,signMessage:t,signTransaction:t,signTypedData:t})}var aX=class extends q(`foreign_account`){name=`TempoAccount.ForeignAccountError`;constructor(e){super({error_description:`Access denied to Tempo Account ${e.account}. Name one of the user's accounts in the app's realms.`,field:e.field??`account`,meta:{account:e.account}})}},oX=[XL,tX,rX],sX;(function(e){let t=Ci([`0x`,j().regex(/^[0-9a-fA-F]{40}$/)]).meta({description:`A 20-byte address.`,examples:[`0x8C3b5d0e2A4f6B1c9D7e3F5a0B2c4D6e8F1a3B5c`]}),n=e.realm=A({id:j().meta({description:"The realm ID, such as `default` or `tempo-cash`.",examples:[`tempo-cash`]}),name:j().meta({description:"The realm display name, such as `Tempo Cash`.",examples:[`Tempo Cash`]})}).meta({description:`A realm, which holds Tempo Accounts. An app reaches only the accounts of its realms.`,id:`Realm`});e.tempoAccount=A({address:t.meta({description:`The address on the request's chain: the owner key's address, or the initial configuration's address on a chain with configurable accounts. A linked wallet.tempo passkey keeps its own address, also after its upgrade.`,examples:[`0x8C3b5d0e2A4f6B1c9D7e3F5a0B2c4D6e8F1a3B5c`]}),config:A({chainId:Ti().int().optional().meta({description:`The ID of the chain where the configuration applies, which the request named. Absent on a chain whose accounts are not configurable, and for a wallet.tempo passkey that no upgrade made configurable.`,examples:[31318]}),owners:Gi(A({owner:t.meta({description:`The address of the owner key.`,examples:[`0x8C3b5d0e2A4f6B1c9D7e3F5a0B2c4D6e8F1a3B5c`]}),type:Qi(oX.map(e=>e.type)).meta({description:"Who holds the owner key: a Privy wallet (`privy`), a key that Tempo ID holds in development (`secp256k1`), or a passkey (`webAuthn`), which signs only in the browser.",examples:[`webAuthn`]}),weight:Ti().meta({description:"The owner's signing weight, which counts toward `threshold`.",examples:[1]})}).meta({description:`One key that signs for the account.`})).readonly().meta({description:`The keys that sign for the account.`}),salt:Ci([`0x`,j()]).meta({description:`The 32-byte salt that the account address derives from, as hex.`,examples:[`0x${`0`.repeat(64)}`]}),threshold:Ti().meta({description:`The total owner weight that a signature needs to act for the account.`,examples:[1]}),version:Ci([`0x`,j()]).meta({description:`The configuration version, as a hex quantity.`,examples:[`0x0`]})}).meta({description:`The account configuration (TIP-1107): its owners, salt, threshold, and version.`}),realm:n}).meta({description:`A configurable Tempo Account (TIP-1107) and its configuration.`,id:`TempoAccount`})})(sX||={});async function cX(e,t){let{db:n,realms:r,userId:i}=t,a=await Y(e,mX(e,t),`TempoAccount.load`),o=await Y(e,hX(e,{chainId:t.chainId,db:n,env:t.env,key:pX(t),loaded:a,userId:i}),`TempoAccount.owners`);if(o.length>0)return o;let s=e=>{for(let t of a){let n=t.create?.(e);if(n)return n}},c=r[0];if(!c||!s(c))return[];let l=r.filter(e=>s(e)),u=await n.transaction(async n=>{await Y(e,TN(n,{userId:i}),`db.account.lock`);let o=await Y(e,hX(e,{chainId:t.chainId,db:n,env:t.env,loaded:a.filter(e=>!e.create),userId:i}),`TempoAccount.linked`),s=n.$with(`claims`).as(n.select({realmId:EE.realmId}).from(EE).where(qC(W(EE.userId,i),ew(EE.realmId,l.map(e=>e.id))))),u=n.$with(`claim`).as(n.insert(EE).select(n.select({createdAt:V`now()`.as(`created_at`),realmId:V`${c.id}`.as(`realm_id`),userId:bE.id}).from(bE).where(qC(W(bE.id,i),aw(n.select().from(s))))).onConflictDoNothing().returning({realmId:EE.realmId})),d=await Y(e,o.length>0?n.with(s).select().from(s):n.with(s,u).select().from(s),`db.account.claims`),f=r.find(e=>d.some(t=>t.realmId===e.id));return f?{realm:f}:o.length>0?{linked:o}:{realm:c}});if(`linked`in u)return e.var.ownerLists?.delete(pX(t)),u.linked;let d=await Y(e,s(u.realm)(e),`TempoAccount.createOwner`);e.var.ownerLists?.delete(pX(t));let f=aF(t);return f?rF([d],{chainId:f.chainId,configs:[]}):[d]}(function(e){e.errors=[...XL.errors,...tX.errors,...rX.errors]})(cX||={});async function lX(e,t){let n=await Y(e,mX(e,t),`TempoAccount.load`);return await Y(e,hX(e,{chainId:t.chainId,db:t.db,env:t.env,key:pX(t),loaded:n,userId:t.userId}),`TempoAccount.owners`)}(function(e){e.errors=cX.errors})(lX||={});async function uX(e,t){return(await Y(e,lX(e,t),`TempoAccount.held`)).map(_X)}(function(e){e.errors=cX.errors})(uX||={});function dX(e){e.var.ownerLists?.clear()}var fX=TP(async(e,t)=>{e.set(`ownerLists`,e.env.ownerLists??new Map),await t()});function pX(e){return JSON.stringify([e.userId,...e.realms.map(e=>[e.id,e.name,e.passkeys?.rpId??null,e.privy?.appId??null,e.secp256k1])])}async function mX(e,t){return await Promise.all(oX.map(n=>n.load(e,t)))}async function hX(e,t){let{db:n,key:r,userId:i}=t,a=aF(t),[o,s]=await Promise.all([(()=>{let i=()=>Promise.all(t.loaded.map(t=>t.list(e,{db:n}))),a=e.var.ownerLists;if(!r||!a)return i();let o=a.get(r);if(o)return o;let s=i().catch(e=>{throw a.get(r)===s&&a.delete(r),e});return a.set(r,s),s})(),a?Y(e,lF(n,{chainId:a.chainId,userId:i}),`db.accountConfig.list`):[]]),c=wN(o);return a?rF(c,{chainId:a.chainId,configs:s}):c}function gX(e){return e.config.owners.find(e=>e.type!==`webAuthn`)??e.config.owners[0]}function _X(e){let{configurable:t}=e;if(t){let n=$t(t.owner.account.config);return sX.tempoAccount.parse({address:t.owner.account.address,config:{...n,chainId:t.chainId,owners:n.owners.map(n=>({...n,type:t.owners.find(e=>e.address.toLowerCase()===n.owner.toLowerCase())?.type??e.type}))},realm:{id:e.realm.id,name:e.realm.name}})}let n=$t(e.account.config);return sX.tempoAccount.parse({address:vN(e),config:{...n,owners:n.owners.map(t=>({...t,type:e.type}))},realm:{id:e.realm.id,name:e.realm.name}})}var vX;(function(e){let t=e.credential=A({address:j().regex(/^0x[0-9a-fA-F]{40}$/),createdAt:Ti().int().min(0).max(864e13).nullable(),email:Li().nullable(),publicKey:Ci([`0x04`,j().regex(/^[0-9a-fA-F]{128}$/)])});e.listed=Gi(t.extend({credentialId:j().regex(/^[A-Za-z0-9_-]{1,1366}$/)}))})(vX||={});async function yX(e,t){let n=vX.credential.safeParse(await e.credential({credentialId:t.id}));if(n.success&&xX(n.data))return n.data}async function bX(e,t){let n=vX.listed.safeParse(await e.credentials({email:t.email}));return n.success?n.data.filter(xX):[]}function xX(e){let t=(()=>{try{return he(Vn(e.publicKey))}catch{return}})();return t!==void 0&&ke(t,e.address)}var SX=r({"module.exports":()=>hc}),CX=n(()=>{}),wX=i((e=>{e.parse=function(e,n){return new t(e,n).parse()};var t=class e{constructor(e,t){this.source=e,this.transform=t||n,this.position=0,this.entries=[],this.recorded=[],this.dimension=0}isEof(){return this.position>=this.source.length}nextCharacter(){var e=this.source[this.position++];return e===`\\`?{value:this.source[this.position++],escaped:!0}:{value:e,escaped:!1}}record(e){this.recorded.push(e)}newEntry(e){var t;(this.recorded.length>0||e)&&(t=this.recorded.join(``),t===`NULL`&&!e&&(t=null),t!==null&&(t=this.transform(t)),this.entries.push(t),this.recorded=[])}consumeDimensions(){if(this.source[0]===`[`)for(;!this.isEof()&&this.nextCharacter().value!==`=`;);}parse(t){var n,r,i;for(this.consumeDimensions();!this.isEof();)if(n=this.nextCharacter(),n.value===`{`&&!i)this.dimension++,this.dimension>1&&(r=new e(this.source.substr(this.position-1),this.transform),this.entries.push(r.parse(!0)),this.position+=r.position-2);else if(n.value===`}`&&!i){if(this.dimension--,!this.dimension&&(this.newEntry(),t))return this.entries}else n.value===`"`&&!n.escaped?(i&&this.newEntry(!0),i=!i):n.value===`,`&&!i?this.newEntry():this.record(n.value);if(this.dimension!==0)throw Error(`array dimension not balanced`);return this.entries}};function n(e){return e}})),TX=i(((e,t)=>{var n=wX();t.exports={create:function(e,t){return{parse:function(){return n.parse(e,t)}}}}})),EX=i(((e,t)=>{var n=/(\d{1,})-(\d{2})-(\d{2}) (\d{2}):(\d{2}):(\d{2})(\.\d{1,})?.*?( BC)?$/,r=/^(\d{1,})-(\d{2})-(\d{2})( BC)?$/,i=/([Z+-])(\d{2})?:?(\d{2})?:?(\d{2})?/,a=/^-?infinity$/;t.exports=function(e){if(a.test(e))return Number(e.replace(`i`,`I`));var t=n.exec(e);if(!t)return o(e)||null;var r=!!t[8],i=parseInt(t[1],10);r&&(i=c(i));var u=parseInt(t[2],10)-1,d=t[3],f=parseInt(t[4],10),p=parseInt(t[5],10),m=parseInt(t[6],10),h=t[7];h=h?1e3*parseFloat(h):0;var g,_=s(e);return _==null?(g=new Date(i,u,d,f,p,m,h),l(i)&&g.setFullYear(i)):(g=new Date(Date.UTC(i,u,d,f,p,m,h)),l(i)&&g.setUTCFullYear(i),_!==0&&g.setTime(g.getTime()-_)),g};function o(e){var t=r.exec(e);if(t){var n=parseInt(t[1],10);t[4]&&(n=c(n));var i=parseInt(t[2],10)-1,a=t[3],o=new Date(n,i,a);return l(n)&&o.setFullYear(n),o}}function s(e){if(e.endsWith(`+00`))return 0;var t=i.exec(e.split(` `)[1]);if(t){var n=t[1];if(n===`Z`)return 0;var r=n===`-`?-1:1;return(parseInt(t[2],10)*3600+parseInt(t[3]||0,10)*60+parseInt(t[4]||0,10))*r*1e3}}function c(e){return-(e-1)}function l(e){return e>=0&&e<100}})),DX=i(((e,t)=>{t.exports=r;var n=Object.prototype.hasOwnProperty;function r(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var i in r)n.call(r,i)&&(e[i]=r[i])}return e}})),OX=i(((e,t)=>{var n=DX();t.exports=r;function r(e){if(!(this instanceof r))return new r(e);n(this,g(e))}var i=[`seconds`,`minutes`,`hours`,`days`,`months`,`years`];r.prototype.toPostgres=function(){var e=i.filter(this.hasOwnProperty,this);return this.milliseconds&&e.indexOf(`seconds`)<0&&e.push(`seconds`),e.length===0?`0`:e.map(function(e){var t=this[e]||0;return e===`seconds`&&this.milliseconds&&(t=(t+this.milliseconds/1e3).toFixed(6).replace(/\.?0+$/,``)),t+` `+e},this).join(` `)};var a={years:`Y`,months:`M`,days:`D`,hours:`H`,minutes:`M`,seconds:`S`},o=[`years`,`months`,`days`],s=[`hours`,`minutes`,`seconds`];r.prototype.toISOString=r.prototype.toISO=function(){var e=o.map(n,this).join(``),t=s.map(n,this).join(``);return`P`+e+`T`+t;function n(e){var t=this[e]||0;return e===`seconds`&&this.milliseconds&&(t=(t+this.milliseconds/1e3).toFixed(6).replace(/0+$/,``)),t+a[e]}};var c=`([+-]?\\d+)`,l=c+`\\s+years?`,u=c+`\\s+mons?`,d=c+`\\s+days?`,f=new RegExp([l,u,d,`([+-])?([\\d]*):(\\d\\d):(\\d\\d)\\.?(\\d{1,6})?`].map(function(e){return`(`+e+`)?`}).join(`\\s*`)),p={years:2,months:4,days:6,hours:9,minutes:10,seconds:11,milliseconds:12},m=[`hours`,`minutes`,`seconds`,`milliseconds`];function h(e){var t=e+`000000`.slice(e.length);return parseInt(t,10)/1e3}function g(e){if(!e)return{};var t=f.exec(e),n=t[8]===`-`;return Object.keys(p).reduce(function(e,r){var i=t[p[r]];return!i||(i=r===`milliseconds`?h(i):parseInt(i,10),!i)||(n&&~m.indexOf(r)&&(i*=-1),e[r]=i),e},{})}})),kX=i(((e,t)=>{var n=Buffer.from||Buffer;t.exports=function(e){if(/^\\x/.test(e))return n(e.substr(2),`hex`);for(var t=``,r=0;r<e.length;)if(e[r]!==`\\`)t+=e[r],++r;else if(/[0-7]{3}/.test(e.substr(r+1,3)))t+=String.fromCharCode(parseInt(e.substr(r+1,3),8)),r+=4;else{for(var i=1;r+i<e.length&&e[r+i]===`\\`;)i++;for(var a=0;a<Math.floor(i/2);++a)t+=`\\`;r+=Math.floor(i/2)*2}return n(t,`binary`)}})),AX=i(((e,t)=>{var n=wX(),r=TX(),i=EX(),a=OX(),o=kX();function s(e){return function(t){return t===null?t:e(t)}}function c(e){return e===null?e:e===`TRUE`||e===`t`||e===`true`||e===`y`||e===`yes`||e===`on`||e===`1`}function l(e){return e?n.parse(e,c):null}function u(e){return parseInt(e,10)}function d(e){return e?n.parse(e,s(u)):null}function f(e){return e?n.parse(e,s(function(e){return b(e).trim()})):null}var p=function(e){return e?r.create(e,function(e){return e!==null&&(e=S(e)),e}).parse():null},m=function(e){return e?r.create(e,function(e){return e!==null&&(e=parseFloat(e)),e}).parse():null},h=function(e){return e?r.create(e).parse():null},g=function(e){return e?r.create(e,function(e){return e!==null&&(e=i(e)),e}).parse():null},_=function(e){return e?r.create(e,function(e){return e!==null&&(e=a(e)),e}).parse():null},v=function(e){return e?n.parse(e,s(o)):null},y=function(e){return parseInt(e,10)},b=function(e){var t=String(e);return/^\d+$/.test(t)?t:e},x=function(e){return e?n.parse(e,s(JSON.parse)):null},S=function(e){return e[0]===`(`?(e=e.substring(1,e.length-1).split(`,`),{x:parseFloat(e[0]),y:parseFloat(e[1])}):null},C=function(e){if(e[0]!==`<`&&e[1]!==`(`)return null;for(var t=`(`,n=``,r=!1,i=2;i<e.length-1;i++)r||(t+=e[i]),e[i]===`)`?r=!0:r&&e[i]!==`,`&&(n+=e[i]);var a=S(t);return a.radius=parseFloat(n),a};t.exports={init:function(e){e(20,b),e(21,y),e(23,y),e(26,y),e(700,parseFloat),e(701,parseFloat),e(16,c),e(1082,i),e(1114,i),e(1184,i),e(600,S),e(651,h),e(718,C),e(1e3,l),e(1001,v),e(1005,d),e(1007,d),e(1028,d),e(1016,f),e(1017,p),e(1021,m),e(1022,m),e(1231,m),e(1014,h),e(1015,h),e(1008,h),e(1009,h),e(1040,h),e(1041,h),e(1115,g),e(1182,g),e(1185,g),e(1186,a),e(1187,_),e(17,o),e(114,JSON.parse.bind(JSON)),e(3802,JSON.parse.bind(JSON)),e(199,x),e(3807,x),e(3907,h),e(2951,h),e(791,h),e(1183,h),e(1270,h)}}})),jX=i(((e,t)=>{var n=1e6;function r(e){var t=e.readInt32BE(0),r=e.readUInt32BE(4),i=``;t<0&&(t=~t+(r===0),r=~r+1>>>0,i=`-`);var a=``,o=t%n,s,c,l,u,d;if(t=t/n>>>0,s=4294967296*o+r,r=s/n>>>0,c=``+(s-n*r),r===0&&t===0)return i+c+a;for(l=``,u=6-c.length,d=0;d<u;d++)l+=`0`;if(a=l+c+a,o=t%n,t=t/n>>>0,s=4294967296*o+r,r=s/n>>>0,c=``+(s-n*r),r===0&&t===0)return i+c+a;for(l=``,u=6-c.length,d=0;d<u;d++)l+=`0`;if(a=l+c+a,o=t%n,t=t/n>>>0,s=4294967296*o+r,r=s/n>>>0,c=``+(s-n*r),r===0&&t===0)return i+c+a;for(l=``,u=6-c.length,d=0;d<u;d++)l+=`0`;return a=l+c+a,o=t%n,s=4294967296*o+r,c=``+s%n,i+c+a}t.exports=r})),MX=i(((e,t)=>{var n=jX(),r=function(e,t,n,r,i){n||=0,r||=!1,i||=function(e,t,n){return e*2**n+t};var a=n>>3,o=function(e){return r?~e&255:e},s=255,c=8-n%8;t<c&&(s=255<<8-t&255,c=t),n&&(s>>=n%8);var l=0;n%8+t>=8&&(l=i(0,o(e[a])&s,c));for(var u=t+n>>3,d=a+1;d<u;d++)l=i(l,o(e[d]),8);var f=(t+n)%8;return f>0&&(l=i(l,o(e[u])>>8-f,f)),l},i=function(e,t,n){var i=2**(n-1)-1,a=r(e,1),o=r(e,n,1);if(o===0)return 0;var s=1,c=r(e,t,n+1,!1,function(e,t,n){e===0&&(e=1);for(var r=1;r<=n;r++)s/=2,(t&1<<n-r)>0&&(e+=s);return e});return o==2**(n+1)-1?c===0?a===0?1/0:-1/0:NaN:(a===0?1:-1)*2**(o-i)*c},a=function(e){return r(e,1)==1?-1*(r(e,15,1,!0)+1):r(e,15,1)},o=function(e){return r(e,1)==1?-1*(r(e,31,1,!0)+1):r(e,31,1)},s=function(e){return i(e,23,8)},c=function(e){return i(e,52,11)},l=function(e){var t=r(e,16,32);if(t==49152)return NaN;for(var n=1e4**r(e,16,16),i=0,a=r(e,16),o=0;o<a;o++)i+=r(e,16,64+16*o)*n,n/=1e4;var s=10**r(e,16,48);return(t===0?1:-1)*Math.round(i*s)/s},u=function(e,t){var n=r(t,1),i=r(t,63,1),a=new Date((n===0?1:-1)*i/1e3+9466848e5);return e||a.setTime(a.getTime()+a.getTimezoneOffset()*6e4),a.usec=i%1e3,a.getMicroSeconds=function(){return this.usec},a.setMicroSeconds=function(e){this.usec=e},a.getUTCMicroSeconds=function(){return this.usec},a},d=function(e){var t=r(e,32);r(e,32,32);for(var n=r(e,32,64),i=96,a=[],o=0;o<t;o++)a[o]=r(e,32,i),i+=32,i+=32;var s=function(t){var n=r(e,32,i);if(i+=32,n==4294967295)return null;var a;if(t==23||t==20)return a=r(e,n*8,i),i+=n*8,a;if(t==25)return a=e.toString(this.encoding,i>>3,(i+=n<<3)>>3),a;console.log(`ERROR: ElementType not implemented: `+t)},c=function(e,t){var n=[],r;if(e.length>1){var i=e.shift();for(r=0;r<i;r++)n[r]=c(e,t);e.unshift(i)}else for(r=0;r<e[0];r++)n[r]=s(t);return n};return c(a,n)},f=function(e){return e.toString(`utf8`)},p=function(e){return e===null?null:r(e,8)>0};t.exports={init:function(e){e(20,n),e(21,a),e(23,o),e(26,o),e(1700,l),e(700,s),e(701,c),e(16,p),e(1114,u.bind(null,!1)),e(1184,u.bind(null,!0)),e(1e3,d),e(1007,d),e(1016,d),e(1008,d),e(1009,d),e(25,f)}}})),NX=i(((e,t)=>{t.exports={BOOL:16,BYTEA:17,CHAR:18,INT8:20,INT2:21,INT4:23,REGPROC:24,TEXT:25,OID:26,TID:27,XID:28,CID:29,JSON:114,XML:142,PG_NODE_TREE:194,SMGR:210,PATH:602,POLYGON:604,CIDR:650,FLOAT4:700,FLOAT8:701,ABSTIME:702,RELTIME:703,TINTERVAL:704,CIRCLE:718,MACADDR8:774,MONEY:790,MACADDR:829,INET:869,ACLITEM:1033,BPCHAR:1042,VARCHAR:1043,DATE:1082,TIME:1083,TIMESTAMP:1114,TIMESTAMPTZ:1184,INTERVAL:1186,TIMETZ:1266,BIT:1560,VARBIT:1562,NUMERIC:1700,REFCURSOR:1790,REGPROCEDURE:2202,REGOPER:2203,REGOPERATOR:2204,REGCLASS:2205,REGTYPE:2206,UUID:2950,TXID_SNAPSHOT:2970,PG_LSN:3220,PG_NDISTINCT:3361,PG_DEPENDENCIES:3402,TSVECTOR:3614,TSQUERY:3615,GTSVECTOR:3642,REGCONFIG:3734,REGDICTIONARY:3769,JSONB:3802,REGNAMESPACE:4089,REGROLE:4096}})),PX=i((e=>{var t=AX(),n=MX(),r=TX(),i=NX();e.getTypeParser=s,e.setTypeParser=c,e.arrayParser=r,e.builtins=i;var a={text:{},binary:{}};function o(e){return String(e)}function s(e,t){return t||=`text`,a[t]&&a[t][e]||o}function c(e,t,n){typeof t==`function`&&(n=t,t=`text`),a[t][e]=n}t.init(function(e,t){a.text[e]=t}),n.init(function(e,t){a.binary[e]=t})})),FX=i(((e,t)=>{var n;try{n=process.platform===`win32`?process.env.USERNAME:process.env.USER}catch{}t.exports={host:`localhost`,user:n,database:void 0,password:null,connectionString:void 0,port:5432,rows:0,binary:!1,max:10,idleTimeoutMillis:3e4,client_encoding:``,ssl:!1,sslnegotiation:void 0,application_name:void 0,fallback_application_name:void 0,options:void 0,parseInputDatesAsUTC:!1,statement_timeout:!1,lock_timeout:!1,idle_in_transaction_session_timeout:!1,query_timeout:!1,connect_timeout:0,keepalives:1,keepalives_idle:0};var r=PX(),i=r.getTypeParser(20,`text`),a=r.getTypeParser(1016,`text`);t.exports.__defineSetter__(`parseInt8`,function(e){r.setTypeParser(20,`text`,e?r.getTypeParser(23,`text`):i),r.setTypeParser(1016,`text`,e?r.getTypeParser(1007,`text`):a)})})),IX=r({"module.exports":()=>gc}),LX=n(()=>{}),RX=r({"module.exports":()=>_c}),zX=n(()=>{}),BX=i(((e,n)=>{var r=FX(),i=(LX(),t(IX)),{isDate:a}=(zX(),t(RX)),o=i.deprecate(()=>{},`Sending an invalid date to Postgres is deprecated and will throw an error in the next major version of pg. Ensure any Date object passed as a query parameter is valid.`,`PG_INVALID_DATE`);function s(e){return`"`+e.replace(/\\/g,`\\\\`).replace(/"/g,`\\"`)+`"`}function c(e){let t=`{`;for(let n=0;n<e.length;n++){n>0&&(t+=`,`);let r=e[n];r==null?t+=`NULL`:Array.isArray(r)?t+=c(r):ArrayBuffer.isView(r)?(r instanceof Buffer||(r=Buffer.from(r.buffer,r.byteOffset,r.byteLength)),t+=`\\\\x`+r.toString(`hex`)):t+=s(l(r))}return t+=`}`,t}var l=function(e,t){return e==null?null:typeof e==`object`?e instanceof Buffer?e:ArrayBuffer.isView(e)?Buffer.from(e.buffer,e.byteOffset,e.byteLength):a(e)?(isNaN(e.getTime())&&o(),r.parseInputDatesAsUTC?f(e):d(e)):Array.isArray(e)?c(e):u(e,t):e.toString()};function u(e,t){if(e&&typeof e.toPostgres==`function`){if(t||=[],t.indexOf(e)!==-1)throw Error(`circular reference detected while preparing "`+e+`" for query`);return t.push(e),l(e.toPostgres(l),t)}return JSON.stringify(e)}function d(e){let t=-e.getTimezoneOffset(),n=e.getFullYear(),r=n<1;r&&(n=Math.abs(n)+1);let i=String(n).padStart(4,`0`)+`-`+String(e.getMonth()+1).padStart(2,`0`)+`-`+String(e.getDate()).padStart(2,`0`)+`T`+String(e.getHours()).padStart(2,`0`)+`:`+String(e.getMinutes()).padStart(2,`0`)+`:`+String(e.getSeconds()).padStart(2,`0`)+`.`+String(e.getMilliseconds()).padStart(3,`0`);return t<0?(i+=`-`,t*=-1):i+=`+`,i+=String(Math.floor(t/60)).padStart(2,`0`)+`:`+String(t%60).padStart(2,`0`),r&&(i+=` BC`),i}function f(e){let t=e.getUTCFullYear(),n=t<1;n&&(t=Math.abs(t)+1);let r=String(t).padStart(4,`0`)+`-`+String(e.getUTCMonth()+1).padStart(2,`0`)+`-`+String(e.getUTCDate()).padStart(2,`0`)+`T`+String(e.getUTCHours()).padStart(2,`0`)+`:`+String(e.getUTCMinutes()).padStart(2,`0`)+`:`+String(e.getUTCSeconds()).padStart(2,`0`)+`.`+String(e.getUTCMilliseconds()).padStart(3,`0`);return r+=`+00:00`,n&&(r+=` BC`),r}function p(e,t,n){return e=typeof e==`string`?{text:e}:m(e),t&&(typeof t==`function`?e.callback=t:e.values=t),n&&(e.callback=n),e}function m(e){return e==null?e:Object.defineProperties(Object.create(Object.getPrototypeOf(e)),Object.getOwnPropertyDescriptors(e))}n.exports={prepareValue:function(e){return l(e)},normalizeQueryConfig:p,escapeIdentifier:function(e){return`"`+e.replace(/"/g,`""`)+`"`},escapeLiteral:function(e){let t=!1,n=`'`;if(e==null||typeof e!=`string`)return`''`;for(let r=0;r<e.length;r++){let i=e[r];i===`'`?n+=i+i:i===`\\`?(n+=i+i,t=!0):n+=i}return n+=`'`,t===!0&&(n=` E`+n),n}}})),VX=r({"module.exports":()=>fc}),HX=n(()=>{}),UX=i(((e,n)=>{var r=(HX(),t(VX));n.exports={postgresMd5PasswordHash:l,randomBytes:s,deriveKey:p,sha256:u,hashByName:d,hmacSha256:f,md5:c};var i=r.webcrypto||globalThis.crypto,a=i.subtle,o=new TextEncoder;function s(e){return i.getRandomValues(Buffer.alloc(e))}async function c(e){try{return r.createHash(`md5`).update(e,`utf-8`).digest(`hex`)}catch{let t=typeof e==`string`?o.encode(e):e,n=await a.digest(`MD5`,t);return Array.from(new Uint8Array(n)).map(e=>e.toString(16).padStart(2,`0`)).join(``)}}async function l(e,t,n){let r=await c(t+e);return`md5`+await c(Buffer.concat([Buffer.from(r),n]))}async function u(e){return await a.digest(`SHA-256`,e)}async function d(e,t){return await a.digest(e,t)}async function f(e,t){let n=await a.importKey(`raw`,e,{name:`HMAC`,hash:`SHA-256`},!1,[`sign`]);return await a.sign(`HMAC`,n,o.encode(t))}async function p(e,t,n){let r=await a.importKey(`raw`,o.encode(e),`PBKDF2`,!1,[`deriveBits`]),i={name:`PBKDF2`,hash:`SHA-256`,salt:t,iterations:n};return await a.deriveBits(i,r,256,[`deriveBits`])}})),WX=i(((e,t)=>{function n(e,t){return Error(`SASL channel binding: `+e+` when parsing public certificate `+t.toString(`base64`))}function r(e,t){let r=e[t++];if(r<128)return{length:r,index:t};let i=r&127;if(i>4)throw n(`bad length`,e);r=0;for(let n=0;n<i;n++)r=r<<8|e[t++];return{length:r,index:t}}function i(e,t){if(e[t++]!==6)throw n(`non-OID data`,e);let{length:i,index:a}=r(e,t);t=a;let o=t+i,s=e[t++],c=(s/40|0)+`.`+s%40;for(;t<o;){let n=0;for(;t<o;){let r=e[t++];if(n=n<<7|r&127,r<128)break}c+=`.`+n}return{oid:c,index:t}}function a(e,t){if(e[t++]!==48)throw n(`non-sequence data`,e);return r(e,t)}function o(e,t){t===void 0&&(t=0),t=a(e,t).index;let{length:o,index:s}=a(e,t);t=s+o,t=a(e,t).index;let{oid:c,index:l}=i(e,t);switch(c){case`1.2.840.113549.1.1.4`:return`MD5`;case`1.2.840.113549.1.1.5`:return`SHA-1`;case`1.2.840.113549.1.1.11`:return`SHA-256`;case`1.2.840.113549.1.1.12`:return`SHA-384`;case`1.2.840.113549.1.1.13`:return`SHA-512`;case`1.2.840.113549.1.1.14`:return`SHA-224`;case`1.2.840.113549.1.1.15`:return`SHA512-224`;case`1.2.840.113549.1.1.16`:return`SHA512-256`;case`1.2.840.10045.4.1`:return`SHA-1`;case`1.2.840.10045.4.3.1`:return`SHA-224`;case`1.2.840.10045.4.3.2`:return`SHA-256`;case`1.2.840.10045.4.3.3`:return`SHA-384`;case`1.2.840.10045.4.3.4`:return`SHA-512`;case`1.2.840.113549.1.1.10`:{if(t=l,t=a(e,t).index,e[t++]!==160)throw n(`non-tag data`,e);t=r(e,t).index,t=a(e,t).index;let{oid:o}=i(e,t);switch(o){case`1.2.840.113549.2.5`:return`MD5`;case`1.3.14.3.2.26`:return`SHA-1`;case`2.16.840.1.101.3.4.2.1`:return`SHA-256`;case`2.16.840.1.101.3.4.2.2`:return`SHA-384`;case`2.16.840.1.101.3.4.2.3`:return`SHA-512`}throw n(`unknown hash OID `+o,e)}case`1.3.101.110`:case`1.3.101.112`:return`SHA-512`;case`1.3.101.111`:case`1.3.101.113`:throw n(`Ed448 certificate channel binding is not currently supported by Postgres`)}throw n(`unknown OID `+c,e)}t.exports={signatureAlgorithmHashFromCertificate:o}})),GX=i(((e,t)=>{var n=UX(),{signatureAlgorithmHashFromCertificate:r}=WX();function i(e){return e.replace(/[\u00A0\u1680\u2000-\u200B\u202F\u205F\u3000]/g,` `).replace(/[\u00AD\u034F\u1806\u180B\u180C\u180D\u200C\u200D\u2060\uFE00-\uFE0F\uFEFF]/g,``).normalize(`NFKC`)}var a=1e5;function o(e,t,r=a){let i=[`SCRAM-SHA-256`];t&&i.unshift(`SCRAM-SHA-256-PLUS`);let o=i.find(t=>e.includes(t));if(!o)throw Error(`SASL: Only mechanism(s) `+i.join(` and `)+` are supported`);if(o===`SCRAM-SHA-256-PLUS`&&typeof t.getPeerCertificate!=`function`)throw Error(`SASL: Mechanism SCRAM-SHA-256-PLUS requires a certificate`);let s=n.randomBytes(18).toString(`base64`);return{mechanism:o,clientNonce:s,response:(o===`SCRAM-SHA-256-PLUS`?`p=tls-server-end-point`:t?`y`:`n`)+`,,n=*,r=`+s,message:`SASLInitialResponse`,scramMaxIterations:r}}async function s(e,t,o,s){if(e.message!==`SASLInitialResponse`)throw Error(`SASL: Last message was not SASLInitialResponse`);if(typeof t!=`string`)throw Error(`SASL: SCRAM-SERVER-FIRST-MESSAGE: client password must be a string`);if(t===``)throw Error(`SASL: SCRAM-SERVER-FIRST-MESSAGE: client password must be a non-empty string`);if(typeof o!=`string`)throw Error(`SASL: SCRAM-SERVER-FIRST-MESSAGE: serverData must be a string`);let c=f(o);if(!c.nonce.startsWith(e.clientNonce))throw Error(`SASL: SCRAM-SERVER-FIRST-MESSAGE: server nonce does not start with client nonce`);if(c.nonce.length===e.clientNonce.length)throw Error(`SASL: SCRAM-SERVER-FIRST-MESSAGE: server nonce is too short`);let l=typeof e.scramMaxIterations==`number`?e.scramMaxIterations:a;if(l!==0&&c.iteration>l)throw Error(`SASL: SCRAM-SERVER-FIRST-MESSAGE: iteration count `+c.iteration+` exceeds scramMaxIterations of `+l);let u=`n=*,r=`+e.clientNonce,d=`r=`+c.nonce+`,s=`+c.salt+`,i=`+c.iteration,p=s?`eSws`:`biws`;if(e.mechanism===`SCRAM-SHA-256-PLUS`){let e=s.getPeerCertificate().raw,t=r(e);(t===`MD5`||t===`SHA-1`)&&(t=`SHA-256`);let i=await n.hashByName(t,e);p=Buffer.concat([Buffer.from(`p=tls-server-end-point,,`),Buffer.from(i)]).toString(`base64`)}let h=`c=`+p+`,r=`+c.nonce,g=u+`,`+d+`,`+h,_=Buffer.from(c.salt,`base64`),v=await n.deriveKey(i(t),_,c.iteration),y=await n.hmacSha256(v,`Client Key`),b=await n.sha256(y),x=await n.hmacSha256(b,g),S=m(Buffer.from(y),Buffer.from(x)).toString(`base64`),C=await n.hmacSha256(v,`Server Key`),w=await n.hmacSha256(C,g);e.message=`SASLResponse`,e.serverSignature=Buffer.from(w).toString(`base64`),e.response=h+`,p=`+S}function c(e,t){if(e.message!==`SASLResponse`)throw Error(`SASL: Last message was not SASLResponse`);if(typeof t!=`string`)throw Error(`SASL: SCRAM-SERVER-FINAL-MESSAGE: serverData must be a string`);let{serverSignature:n}=p(t);if(n!==e.serverSignature)throw Error(`SASL: SCRAM-SERVER-FINAL-MESSAGE: server signature does not match`)}function l(e){if(typeof e!=`string`)throw TypeError(`SASL: text must be a string`);return e.split(``).map((t,n)=>e.charCodeAt(n)).every(e=>e>=33&&e<=43||e>=45&&e<=126)}function u(e){return/^(?:[a-zA-Z0-9+/]{4})*(?:[a-zA-Z0-9+/]{2}==|[a-zA-Z0-9+/]{3}=)?$/.test(e)}function d(e){if(typeof e!=`string`)throw TypeError(`SASL: attribute pairs text must be a string`);return new Map(e.split(`,`).map(e=>{if(!/^.=/.test(e))throw Error(`SASL: Invalid attribute pair entry`);return[e[0],e.substring(2)]}))}function f(e){let t=d(e),n=t.get(`r`);if(!n)throw Error(`SASL: SCRAM-SERVER-FIRST-MESSAGE: nonce missing`);if(!l(n))throw Error(`SASL: SCRAM-SERVER-FIRST-MESSAGE: nonce must only contain printable characters`);let r=t.get(`s`);if(!r)throw Error(`SASL: SCRAM-SERVER-FIRST-MESSAGE: salt missing`);if(!u(r))throw Error(`SASL: SCRAM-SERVER-FIRST-MESSAGE: salt must be base64`);let i=t.get(`i`);if(!i)throw Error(`SASL: SCRAM-SERVER-FIRST-MESSAGE: iteration missing`);if(!/^[1-9][0-9]*$/.test(i))throw Error(`SASL: SCRAM-SERVER-FIRST-MESSAGE: invalid iteration count`);return{nonce:n,salt:r,iteration:parseInt(i,10)}}function p(e){let t=d(e),n=t.get(`e`),r=t.get(`v`);if(n)throw Error(`SASL: SCRAM-SERVER-FINAL-MESSAGE: server returned error: "${n}"`);if(!r)throw Error(`SASL: SCRAM-SERVER-FINAL-MESSAGE: server signature is missing`);if(!u(r))throw Error(`SASL: SCRAM-SERVER-FINAL-MESSAGE: server signature must be base64`);return{serverSignature:r}}function m(e,t){if(!Buffer.isBuffer(e))throw TypeError(`first argument must be a Buffer`);if(!Buffer.isBuffer(t))throw TypeError(`second argument must be a Buffer`);if(e.length!==t.length)throw Error(`Buffer lengths must match`);if(e.length===0)throw Error(`Buffers cannot be empty`);return Buffer.from(e.map((n,r)=>e[r]^t[r]))}t.exports={startSession:o,continueSession:s,finalizeSession:c,DEFAULT_MAX_SCRAM_ITERATIONS:a}})),KX=i(((e,t)=>{var n=PX();function r(e){this._types=e||n,this.text={},this.binary={}}r.prototype.getOverrides=function(e){switch(e){case`text`:return this.text;case`binary`:return this.binary;default:return{}}},r.prototype.setTypeParser=function(e,t,n){typeof t==`function`&&(n=t,t=`text`),this.getOverrides(t)[e]=n},r.prototype.getTypeParser=function(e,t){return t||=`text`,this.getOverrides(t)[e]||this._types.getTypeParser(e,t)},t.exports=r})),qX=r({"module.exports":()=>vc}),JX=n(()=>{}),YX=r({"module.exports":()=>yc}),XX=n(()=>{}),ZX=i(((e,n)=>{function r(e,n={}){if(e.charAt(0)===`/`){let t=e.split(` `);return{host:t[0],database:t[1]}}let r=Object.create(null),i,a=!1;/ |%[^a-f0-9]|%[a-f0-9][^a-f0-9]/i.test(e)&&(e=encodeURI(e).replace(/%25(\d\d)/g,`%$1`));try{try{i=new URL(e,`postgres://base`)}catch{i=new URL(e.replace(`@/`,`@___DUMMY___/`),`postgres://base`),a=!0}}catch(e){throw e.input&&=`*****REDACTED*****`,e}for(let e of i.searchParams.entries())r[e[0]]=e[1];if(r.user=r.user||decodeURIComponent(i.username),r.password=r.password||decodeURIComponent(i.password),i.protocol==`socket:`)return r.host=decodeURI(i.pathname),r.database=i.searchParams.get(`db`),r.client_encoding=i.searchParams.get(`encoding`),r;let o=(a?``:i.hostname).replace(/^\[(.+)\]$/,`$1`);r.host?o&&/^%2f/i.test(o)&&(i.pathname=o+i.pathname):r.host=decodeURIComponent(o),r.port||=i.port;let c=i.pathname.slice(1)||null;r.database=c?decodeURI(c):null,(r.ssl===`true`||r.ssl===`1`)&&(r.ssl=!0),r.ssl===`0`&&(r.ssl=!1),(r.sslcert||r.sslkey||r.sslrootcert||r.sslmode)&&(r.ssl={}),r.sslnegotiation===`direct`&&r.ssl===void 0&&(r.ssl=!0);let l=r.sslcert||r.sslkey||r.sslrootcert?(XX(),t(YX)):null;if(r.sslcert&&(r.ssl.cert=l.readFileSync(r.sslcert).toString()),r.sslkey&&(r.ssl.key=l.readFileSync(r.sslkey).toString()),r.sslrootcert&&(r.ssl.ca=l.readFileSync(r.sslrootcert).toString()),n.useLibpqCompat&&r.uselibpqcompat)throw Error(`Both useLibpqCompat and uselibpqcompat are set. Please use only one of them.`);if(r.uselibpqcompat===`true`||n.useLibpqCompat)switch(r.sslmode){case`disable`:r.ssl=!1;break;case`prefer`:r.ssl.rejectUnauthorized=!1;break;case`require`:r.sslrootcert?r.ssl.checkServerIdentity=function(){}:r.ssl.rejectUnauthorized=!1;break;case`verify-ca`:if(!r.ssl.ca)throw Error(`SECURITY WARNING: Using sslmode=verify-ca requires specifying a CA with sslrootcert. If a public CA is used, verify-ca allows connections to a server that somebody else may have registered with the CA, making you vulnerable to Man-in-the-Middle attacks. Either specify a custom CA certificate with sslrootcert parameter or use sslmode=verify-full for proper security.`);r.ssl.checkServerIdentity=function(){}}else switch(r.sslmode){case`disable`:r.ssl=!1;break;case`prefer`:case`require`:case`verify-ca`:case`verify-full`:r.sslmode!==`verify-full`&&s(r.sslmode);break;case`no-verify`:r.ssl.rejectUnauthorized=!1}return r}function i(e){return Object.entries(e).reduce((e,[t,n])=>(n!=null&&(e[t]=n),e),Object.create(null))}function a(e){return Object.entries(e).reduce((e,[t,n])=>{if(t===`ssl`){let r=n;typeof r==`boolean`&&(e[t]=r),typeof r==`object`&&(e[t]=i(r))}else if(n!=null){if(t===`port`){if(n!==``){let r=parseInt(n,10);if(isNaN(r))throw Error(`Invalid ${t}: ${n}`);e[t]=r}}else e[t]=n}return e},Object.create(null))}function o(e){return a(r(e))}function s(e){!s.warned&&typeof process<`u`&&process.emitWarning&&(s.warned=!0,process.emitWarning(`SECURITY WARNING: The SSL modes 'prefer', 'require', and 'verify-ca' are treated as aliases for 'verify-full'.
420
+ In the next major version (pg-connection-string v3.0.0 and pg v9.0.0), these modes will adopt standard libpq semantics, which have weaker security guarantees.
421
+
422
+ To prepare for this change:
423
+ - If you want the current behavior, explicitly use 'sslmode=verify-full'
424
+ - If you want libpq compatibility now, use 'uselibpqcompat=true&sslmode=${e}'
425
+
426
+ See https://www.postgresql.org/docs/current/libpq-ssl.html for libpq SSL mode definitions.`))}n.exports=r,r.parse=r,r.toClientConfig=a,r.parseIntoClientConfig=o})),QX=i(((e,n)=>{var r=(JX(),t(qX)),i=FX(),a=ZX().parse,o=function(e,t,n){return t[e]?t[e]:(n===void 0?n=process.env[`PG`+e.toUpperCase()]:n===!1||(n=process.env[n]),n||i[e])},s=function(){switch(process.env.PGSSLMODE){case`disable`:return!1;case`prefer`:case`require`:case`verify-ca`:case`verify-full`:return!0;case`no-verify`:return{rejectUnauthorized:!1}}return i.ssl},c=function(e){return`'`+(``+e).replace(/\\/g,`\\\\`).replace(/'/g,`\\'`)+`'`},l=function(e,t,n){let r=t[n];r!=null&&e.push(n+`=`+c(r))};n.exports=class{constructor(e){if(e=typeof e==`string`?a(e):e||{},e.connectionString&&(e=Object.assign({},e,a(e.connectionString))),this.user=o(`user`,e),this.database=o(`database`,e),this.database===void 0&&(this.database=this.user),this.port=parseInt(o(`port`,e),10),this.host=o(`host`,e),Object.defineProperty(this,"password",{configurable:!0,enumerable:!1,writable:!0,value:o(`password`,e)}),this.binary=o(`binary`,e),this.options=o(`options`,e),this.ssl=e.ssl===void 0?s():e.ssl,typeof this.ssl==`string`&&this.ssl===`true`&&(this.ssl=!0),this.ssl===`no-verify`&&(this.ssl={rejectUnauthorized:!1}),this.ssl&&this.ssl.key&&Object.defineProperty(this.ssl,"key",{enumerable:!1}),this.sslnegotiation=o(`sslnegotiation`,e,`PGSSLNEGOTIATION`),this.sslnegotiation!==void 0&&this.sslnegotiation!==`postgres`&&this.sslnegotiation!==`direct`)throw Error(`Invalid sslnegotiation value: "${this.sslnegotiation}". Valid values are "postgres" and "direct".`);if(this.sslnegotiation===`direct`&&!this.ssl)throw Error(`sslnegotiation=direct requires SSL to be enabled`);this.client_encoding=o(`client_encoding`,e),this.replication=o(`replication`,e),this.isDomainSocket=!(this.host||``).indexOf(`/`),this.application_name=o(`application_name`,e,`PGAPPNAME`),this.fallback_application_name=o(`fallback_application_name`,e,!1),this.statement_timeout=o(`statement_timeout`,e,!1),this.lock_timeout=o(`lock_timeout`,e,!1),this.idle_in_transaction_session_timeout=o(`idle_in_transaction_session_timeout`,e,!1),this.query_timeout=o(`query_timeout`,e,!1),this.connect_timeout=e.connectionTimeoutMillis===void 0?process.env.PGCONNECT_TIMEOUT||0:Math.floor(e.connectionTimeoutMillis/1e3),e.keepAlive===!1?this.keepalives=0:e.keepAlive===!0&&(this.keepalives=1),typeof e.keepAliveInitialDelayMillis==`number`&&(this.keepalives_idle=Math.floor(e.keepAliveInitialDelayMillis/1e3))}getLibpqConnectionString(e){let t=[];l(t,this,`user`),l(t,this,`password`),l(t,this,`port`),l(t,this,`application_name`),l(t,this,`fallback_application_name`),l(t,this,`connect_timeout`),l(t,this,`options`);let n=typeof this.ssl==`object`?this.ssl:this.ssl?{sslmode:this.ssl}:{};if(l(t,n,`sslmode`),l(t,n,`sslca`),l(t,n,`sslkey`),l(t,n,`sslcert`),l(t,n,`sslrootcert`),l(t,this,`sslnegotiation`),this.database&&t.push(`dbname=`+c(this.database)),this.replication&&t.push(`replication=`+c(this.replication)),this.host&&t.push(`host=`+c(this.host)),this.isDomainSocket)return e(null,t.join(` `));this.client_encoding&&t.push(`client_encoding=`+c(this.client_encoding)),r.lookup(this.host,function(n,r){return n?e(n,null):(t.push(`hostaddr=`+c(r)),e(null,t.join(` `)))})}}})),$X=i(((e,t)=>{var n=PX(),r=/^([A-Za-z]+)(?: (\d+))?(?: (\d+))?/;t.exports=class{constructor(e,t){this.command=null,this.rowCount=null,this.oid=null,this.rows=[],this.fields=[],this._parsers=void 0,this._types=t,this.RowCtor=null,this.rowAsArray=e===`array`,this.rowAsArray&&(this.parseRow=this._parseRowAsArray),this._prebuiltEmptyResultObject=null}addCommandComplete(e){let t;t=e.text?r.exec(e.text):r.exec(e.command),t&&(this.command=t[1],t[3]?(this.oid=parseInt(t[2],10),this.rowCount=parseInt(t[3],10)):t[2]&&(this.rowCount=parseInt(t[2],10)))}_parseRowAsArray(e){let t=Array(e.length);for(let n=0,r=e.length;n<r;n++){let r=e[n];r===null?t[n]=null:t[n]=this._parsers[n](r)}return t}parseRow(e){let t={...this._prebuiltEmptyResultObject};for(let n=0,r=e.length;n<r;n++){let r=e[n],i=this.fields[n].name;if(r!==null){let e=this.fields[n].format===`binary`?Buffer.from(r):r;t[i]=this._parsers[n](e)}else t[i]=null}return t}addRow(e){this.rows.push(e)}addFields(e){this.fields=e,this.fields.length&&(this._parsers=Array(e.length));let t=Object.create(null);for(let r=0;r<e.length;r++){let i=e[r];t[i.name]=null,this._types?this._parsers[r]=this._types.getTypeParser(i.dataTypeID,i.format||`text`):this._parsers[r]=n.getTypeParser(i.dataTypeID,i.format||`text`)}this._prebuiltEmptyResultObject={...t}}}})),eZ=i(((e,n)=>{var{EventEmitter:r}=(CX(),t(SX)),i=$X(),a=BX();n.exports=class extends r{constructor(e,t,n){super(),e=a.normalizeQueryConfig(e,t,n),this.text=e.text,this.values=e.values,this.rows=e.rows,this.types=e.types,this.name=e.name,this.queryMode=e.queryMode,this.binary=e.binary,this.portal=e.portal||``,this.callback=e.callback,this._rowMode=e.rowMode,process.domain&&e.callback&&(this.callback=process.domain.bind(e.callback)),this._result=new i(this._rowMode,this.types),this._results=this._result,this._canceledDueToError=!1}requiresPreparation(){return this.queryMode===`extended`||this.name||this.rows?!0:!this.text||!this.values?!1:this.values.length>0}_checkForMultirow(){this._result.command&&(Array.isArray(this._results)||(this._results=[this._result]),this._result=new i(this._rowMode,this._result._types),this._results.push(this._result))}handleRowDescription(e){this._checkForMultirow(),this._result.addFields(e.fields),this._accumulateRows=this.callback||!this.listeners(`row`).length}handleDataRow(e){let t;if(!this._canceledDueToError){try{t=this._result.parseRow(e.fields)}catch(e){this._canceledDueToError=e;return}this.emit(`row`,t,this._result),this._accumulateRows&&this._result.addRow(t)}}handleCommandComplete(e,t){this._checkForMultirow(),this._result.addCommandComplete(e),this.rows&&t.sync()}handleEmptyQuery(e){this.rows&&e.sync()}handleError(e,t){if(this._canceledDueToError&&=(e=this._canceledDueToError,!1),this.callback)return this.callback(e);this.emit(`error`,e)}handleReadyForQuery(e){if(this._canceledDueToError)return this.handleError(this._canceledDueToError,e);if(this.callback)try{this.callback(null,this._results)}catch(e){process.nextTick(()=>{throw e})}this.emit(`end`,this._results)}submit(e){if(typeof this.text!=`string`&&typeof this.name!=`string`)return Error(`A query must have either text or a name. Supplying neither is unsupported.`);let t=e.parsedStatements[this.name]||e.submittedNamedStatements[this.name];if(this.text&&t&&this.text!==t)return Error(`Prepared statements must be unique - '${this.name}' was used for a different statement`);if(this.values&&!Array.isArray(this.values))return Error(`Query values must be an array`);if(this.requiresPreparation()){e.stream.cork&&e.stream.cork();try{this.prepare(e)}finally{e.stream.uncork&&e.stream.uncork()}}else e.query(this.text);return null}hasBeenParsed(e){return this.name&&(e.parsedStatements[this.name]!==void 0||e.submittedNamedStatements[this.name]!==void 0)}handlePortalSuspended(e){this._getRows(e,this.rows)}_getRows(e,t){e.execute({portal:this.portal,rows:t}),t?e.flush():e.sync()}prepare(e){this.hasBeenParsed(e)||(e.parse({text:this.text,name:this.name,types:this.types}),this.name&&(e.submittedNamedStatements[this.name]=this.text));try{e.bind({portal:this.portal,statement:this.name,values:this.values,binary:this.binary,valueMapper:a.prepareValue})}catch(t){e.close({type:`S`,name:this.name}),e.sync(),this.handleError(t,e);return}e.describe({type:`P`,name:this.portal||``}),this._getRows(e,this.rows)}handleCopyInResponse(e){e.sendCopyFail(`No source stream defined`)}handleCopyData(e,t){}}})),tZ=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.NoticeMessage=e.DataRowMessage=e.CommandCompleteMessage=e.ReadyForQueryMessage=e.NotificationResponseMessage=e.BackendKeyDataMessage=e.AuthenticationMD5Password=e.ParameterStatusMessage=e.ParameterDescriptionMessage=e.RowDescriptionMessage=e.Field=e.CopyResponse=e.CopyDataMessage=e.DatabaseError=e.copyDone=e.emptyQuery=e.replicationStart=e.portalSuspended=e.noData=e.closeComplete=e.bindComplete=e.parseComplete=void 0,e.parseComplete={name:`parseComplete`,length:5},e.bindComplete={name:`bindComplete`,length:5},e.closeComplete={name:`closeComplete`,length:5},e.noData={name:`noData`,length:5},e.portalSuspended={name:`portalSuspended`,length:5},e.replicationStart={name:`replicationStart`,length:4},e.emptyQuery={name:`emptyQuery`,length:4},e.copyDone={name:`copyDone`,length:4},e.DatabaseError=class extends Error{constructor(e,t,n){super(e),this.length=t,this.name=n}},e.CopyDataMessage=class{constructor(e,t){this.length=e,this.chunk=t,this.name=`copyData`}},e.CopyResponse=class{constructor(e,t,n,r){this.length=e,this.name=t,this.binary=n,this.columnTypes=Array(r)}},e.Field=class{constructor(e,t,n,r,i,a,o){this.name=e,this.tableID=t,this.columnID=n,this.dataTypeID=r,this.dataTypeSize=i,this.dataTypeModifier=a,this.format=o}},e.RowDescriptionMessage=class{constructor(e,t){this.length=e,this.fieldCount=t,this.name=`rowDescription`,this.fields=Array(this.fieldCount)}},e.ParameterDescriptionMessage=class{constructor(e,t){this.length=e,this.parameterCount=t,this.name=`parameterDescription`,this.dataTypeIDs=Array(this.parameterCount)}},e.ParameterStatusMessage=class{constructor(e,t,n){this.length=e,this.parameterName=t,this.parameterValue=n,this.name=`parameterStatus`}},e.AuthenticationMD5Password=class{constructor(e,t){this.length=e,this.salt=t,this.name=`authenticationMD5Password`}},e.BackendKeyDataMessage=class{constructor(e,t,n){this.length=e,this.processID=t,this.secretKey=n,this.name=`backendKeyData`}},e.NotificationResponseMessage=class{constructor(e,t,n,r){this.length=e,this.processId=t,this.channel=n,this.payload=r,this.name=`notification`}},e.ReadyForQueryMessage=class{constructor(e,t){this.length=e,this.status=t,this.name=`readyForQuery`}},e.CommandCompleteMessage=class{constructor(e,t){this.length=e,this.text=t,this.name=`commandComplete`}},e.DataRowMessage=class{constructor(e,t){this.length=e,this.fields=t,this.name=`dataRow`,this.fieldCount=t.length}},e.NoticeMessage=class{constructor(e,t){this.length=e,this.message=t,this.name=`notice`}}})),nZ=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.Writer=void 0,e.Writer=class{constructor(e=256){this.size=e,this.offset=5,this.headerPosition=0,this.buffer=Buffer.allocUnsafe(e)}ensure(e){if(this.buffer.length-this.offset<e){let t=this.buffer,n=t.length+(t.length>>1)+e;this.buffer=Buffer.allocUnsafe(n),t.copy(this.buffer,0,0,this.offset)}}addInt32(e){return this.ensure(4),this.buffer[this.offset++]=e>>>24&255,this.buffer[this.offset++]=e>>>16&255,this.buffer[this.offset++]=e>>>8&255,this.buffer[this.offset++]=e>>>0&255,this}addInt16(e){return this.ensure(2),this.buffer[this.offset++]=e>>>8&255,this.buffer[this.offset++]=e>>>0&255,this}addCString(e){if(!e)this.ensure(1);else{let t=Buffer.byteLength(e);this.ensure(t+1),this.buffer.write(e,this.offset,`utf-8`),this.offset+=t}return this.buffer[this.offset++]=0,this}addString(e=``){let t=Buffer.byteLength(e);return this.ensure(t),this.buffer.write(e,this.offset),this.offset+=t,this}addInt32PrefixedString(e){let t=Buffer.byteLength(e);this.ensure(4+t);let n=this.buffer,r=this.offset;return n[r++]=t>>>24&255,n[r++]=t>>>16&255,n[r++]=t>>>8&255,n[r++]=t>>>0&255,n.write(e,r,`utf-8`),this.offset=r+t,this}add(e){return this.ensure(e.length),e.copy(this.buffer,this.offset),this.offset+=e.length,this}reserveUnsafe(e){let t=this.offset;return this.ensure(e),this.offset+=e,t}join(e){if(e){this.buffer[this.headerPosition]=e;let t=this.offset-(this.headerPosition+1);this.buffer.writeInt32BE(t,this.headerPosition+1)}return this.buffer.slice(e?0:5,this.offset)}flush(e){let t=this.join(e);return this.offset=5,this.headerPosition=0,this.buffer=Buffer.allocUnsafe(this.size),t}clear(){this.offset=5,this.headerPosition=0}}})),rZ=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.serialize=void 0;var t=nZ(),n=new t.Writer,r=e=>{n.addInt16(3).addInt16(0);for(let t of Object.keys(e))n.addCString(t).addCString(e[t]);n.addCString(`client_encoding`).addCString(`UTF8`);let r=n.addCString(``).flush(),i=r.length+4;return new t.Writer().addInt32(i).add(r).flush()},i=()=>{let e=Buffer.allocUnsafe(8);return e.writeInt32BE(8,0),e.writeInt32BE(80877103,4),e},a=e=>n.addCString(e).flush(112),o=function(e,t){return n.addCString(e).addInt32PrefixedString(t),n.flush(112)},s=function(e){return n.addString(e).flush(112)},c=e=>n.addCString(e).flush(81),l=[],u=e=>{let t=e.name||``;t.length>63&&(console.error(`Warning! Postgres only supports 63 characters for query names.`),console.error(`You supplied %s (%s)`,t,t.length),console.error(`This can cause conflicts and silent errors executing queries`));let r=e.types||l,i=r.length,a=n.addCString(t).addCString(e.text).addInt16(i);for(let e=0;e<i;e++)a.addInt32(r[e]);return n.flush(80)},d=function(e,t,r){let i=e.length;for(let a=0;a<i;a++){let i=t?t(e[a],a):e[a],o=0;i==null?n.addInt32(-1):i instanceof Buffer?(o=1,n.addInt32(i.length),n.add(i)):n.addInt32PrefixedString(i);let s=n.buffer;s[r++]=0,s[r++]=o}},f=(e={})=>{let t=e.portal||``,r=e.statement||``,i=e.binary||!1,a=e.values||l,o=a.length;n.addCString(t).addCString(r),n.addInt16(o);let s=n.reserveUnsafe(o*2);n.addInt16(o);try{d(a,e.valueMapper,s)}catch(e){throw n.clear(),e}return n.addInt16(1),n.addInt16(+!!i),n.flush(66)},p=Buffer.from([69,0,0,0,9,0,0,0,0,0]),m=e=>{if(!e||!e.portal&&!e.rows)return p;let t=e.portal||``,n=e.rows||0,r=Buffer.byteLength(t),i=4+r+1+4,a=Buffer.allocUnsafe(1+i);return a[0]=69,a.writeInt32BE(i,1),a.write(t,5,`utf-8`),a[r+5]=0,a.writeUInt32BE(n,a.length-4),a},h=(e,t)=>{let n=Buffer.allocUnsafe(16);return n.writeInt32BE(16,0),n.writeInt16BE(1234,4),n.writeInt16BE(5678,6),n.writeInt32BE(e,8),n.writeInt32BE(t,12),n},g=(e,t)=>{let n=4+Buffer.byteLength(t)+1,r=Buffer.allocUnsafe(1+n);return r[0]=e,r.writeInt32BE(n,1),r.write(t,5,`utf-8`),r[n]=0,r},_=n.addCString(`P`).flush(68),v=n.addCString(`S`).flush(68),y=e=>e.name?g(68,`${e.type}${e.name||``}`):e.type===`P`?_:v,b=e=>g(67,`${e.type}${e.name||``}`),x=e=>n.add(e).flush(100),S=e=>g(102,e),C=e=>Buffer.from([e,0,0,0,4]),w=C(72),T=C(83),E=C(88),D=C(99);e.serialize={startup:r,password:a,requestSsl:i,sendSASLInitialResponseMessage:o,sendSCRAMClientFinalMessage:s,query:c,parse:u,bind:f,execute:m,describe:y,close:b,flush:()=>w,sync:()=>T,end:()=>E,copyData:x,copyDone:()=>D,copyFail:S,cancel:h}})),iZ=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.BufferReader=void 0,e.BufferReader=class{constructor(e=0){this.offset=e,this.buffer=Buffer.allocUnsafe(0),this.encoding=`utf-8`}setBuffer(e,t){this.offset=e,this.buffer=t}int16(){let e=this.buffer.readInt16BE(this.offset);return this.offset+=2,e}byte(){let e=this.buffer[this.offset];return this.offset++,e}int32(){let e=this.buffer.readInt32BE(this.offset);return this.offset+=4,e}uint32(){let e=this.buffer.readUInt32BE(this.offset);return this.offset+=4,e}string(e){let t=this.buffer.toString(this.encoding,this.offset,this.offset+e);return this.offset+=e,t}cstring(){let e=this.offset,t=e;for(;this.buffer[t++];);return this.offset=t,this.buffer.toString(this.encoding,e,t-1)}bytes(e){let t=this.buffer.slice(this.offset,this.offset+e);return this.offset+=e,t}}})),aZ=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.Parser=void 0;var t=tZ(),n=iZ(),r=1,i=5,a=-1,o=Buffer.allocUnsafe(0);e.Parser=class{constructor(e){if(this.buffer=o,this.bufferLength=0,this.bufferOffset=0,this.reader=new n.BufferReader,e?.mode===`binary`)throw Error(`Binary mode not supported yet`);this.mode=e?.mode||`text`}parse(e,t){this.mergeBuffer(e);let n=this.bufferOffset+this.bufferLength,a=this.bufferOffset;for(;a+i<=n;){let e=this.buffer[a],o=this.buffer.readUInt32BE(a+r),s=r+o;if(s+a<=n)t(this.handlePacket(a+i,e,o,this.buffer)),a+=s;else break}a===n?(this.buffer=o,this.bufferLength=0,this.bufferOffset=0):(this.bufferLength=n-a,this.bufferOffset=a)}mergeBuffer(e){if(this.bufferLength>0){let t=this.bufferLength+e.byteLength;if(t+this.bufferOffset>this.buffer.byteLength){let e;if(t<=this.buffer.byteLength&&this.bufferOffset>=this.bufferLength)e=this.buffer;else{let n=this.buffer.byteLength*2;for(;t>=n;)n*=2;e=Buffer.allocUnsafe(n)}this.buffer.copy(e,0,this.bufferOffset,this.bufferOffset+this.bufferLength),this.buffer=e,this.bufferOffset=0}e.copy(this.buffer,this.bufferOffset+this.bufferLength),this.bufferLength=t}else this.buffer=e,this.bufferOffset=0,this.bufferLength=e.byteLength}handlePacket(e,n,r,i){let{reader:a}=this;a.setBuffer(e,i);let f;switch(n){case 50:f=t.bindComplete;break;case 49:f=t.parseComplete;break;case 51:f=t.closeComplete;break;case 110:f=t.noData;break;case 115:f=t.portalSuspended;break;case 99:f=t.copyDone;break;case 87:f=t.replicationStart;break;case 73:f=t.emptyQuery;break;case 68:f=_(a);break;case 67:f=c(a);break;case 90:f=s(a);break;case 65:f=p(a);break;case 82:f=b(a,r);break;case 83:f=v(a);break;case 75:f=y(a);break;case 69:f=x(a,`error`);break;case 78:f=x(a,`notice`);break;case 84:f=m(a);break;case 116:f=g(a);break;case 71:f=u(a);break;case 72:f=d(a);break;case 100:f=l(a,r);break;default:return new t.DatabaseError(`received invalid response: `+n.toString(16),r,`error`)}return a.setBuffer(0,o),f.length=r,f}};var s=e=>{let n=e.string(1);return new t.ReadyForQueryMessage(a,n)},c=e=>{let n=e.cstring();return new t.CommandCompleteMessage(a,n)},l=(e,n)=>{let r=e.bytes(n-4);return new t.CopyDataMessage(a,r)},u=e=>f(e,`copyInResponse`),d=e=>f(e,`copyOutResponse`),f=(e,n)=>{let r=e.byte()!==0,i=e.int16(),o=new t.CopyResponse(a,n,r,i);for(let t=0;t<i;t++)o.columnTypes[t]=e.int16();return o},p=e=>{let n=e.int32(),r=e.cstring(),i=e.cstring();return new t.NotificationResponseMessage(a,n,r,i)},m=e=>{let n=e.int16(),r=new t.RowDescriptionMessage(a,n);for(let t=0;t<n;t++)r.fields[t]=h(e);return r},h=e=>{let n=e.cstring(),r=e.uint32(),i=e.int16(),a=e.uint32(),o=e.int16(),s=e.int32(),c=e.int16()===0?`text`:`binary`;return new t.Field(n,r,i,a,o,s,c)},g=e=>{let n=e.int16(),r=new t.ParameterDescriptionMessage(a,n);for(let t=0;t<n;t++)r.dataTypeIDs[t]=e.uint32();return r},_=e=>{let n=e.int16(),r=Array(n);for(let t=0;t<n;t++){let n=e.int32();r[t]=n===-1?null:e.string(n)}return new t.DataRowMessage(a,r)},v=e=>{let n=e.cstring(),r=e.cstring();return new t.ParameterStatusMessage(a,n,r)},y=e=>{let n=e.int32(),r=e.int32();return new t.BackendKeyDataMessage(a,n,r)},b=(e,n)=>{let r=e.int32(),i={name:`authenticationOk`,length:n};switch(r){case 0:break;case 3:i.length===8&&(i.name=`authenticationCleartextPassword`);break;case 5:if(i.length===12){i.name=`authenticationMD5Password`;let n=e.bytes(4);return new t.AuthenticationMD5Password(a,n)}break;case 10:{i.name=`authenticationSASL`,i.mechanisms=[];let t;do t=e.cstring(),t&&i.mechanisms.push(t);while(t)}break;case 11:i.name=`authenticationSASLContinue`,i.data=e.string(n-8);break;case 12:i.name=`authenticationSASLFinal`,i.data=e.string(n-8);break;default:throw Error(`Unknown authenticationOk message type `+r)}return i},x=(e,n)=>{let r={},i=e.string(1);for(;i!==`\0`;)r[i]=e.cstring(),i=e.string(1);let o=r.M,s=n===`notice`?new t.NoticeMessage(a,o):new t.DatabaseError(o,a,n);return s.severity=r.S,s.code=r.C,s.detail=r.D,s.hint=r.H,s.position=r.P,s.internalPosition=r.p,s.internalQuery=r.q,s.where=r.W,s.schema=r.s,s.table=r.t,s.column=r.c,s.dataType=r.d,s.constraint=r.n,s.file=r.F,s.line=r.L,s.routine=r.R,s}})),oZ=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.DatabaseError=e.serialize=void 0,e.parse=i;var t=tZ();Object.defineProperty(e,"DatabaseError",{enumerable:!0,get:function(){return t.DatabaseError}});var n=rZ();Object.defineProperty(e,"serialize",{enumerable:!0,get:function(){return n.serialize}});var r=aZ();function i(e,t){let n=new r.Parser;return e.on(`data`,e=>n.parse(e,t)),new Promise(t=>e.on(`end`,()=>t()))}})),sZ=r({"module.exports":()=>bc}),cZ=n(()=>{}),lZ=r({"module.exports":()=>xc}),uZ=n(()=>{}),dZ=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.CloudflareSocket=void 0;var n=(CX(),t(SX));e.CloudflareSocket=class extends n.EventEmitter{constructor(e){super(),this.ssl=e,this.writable=!1,this.destroyed=!1,this._upgrading=!1,this._upgraded=!1,this._cfSocket=null,this._cfWriter=null,this._cfReader=null}setNoDelay(){return this}setKeepAlive(){return this}ref(){return this}unref(){return this}async connect(e,t,n){try{n&&this.once(`connect`,n);let r=this.ssl?{secureTransport:`starttls`}:{},i=(await import(`cloudflare:sockets`)).connect;return this._cfSocket=i(`${t}:${e}`,r),this._cfWriter=this._cfSocket.writable.getWriter(),this._addClosedHandler(),this._cfReader=this._cfSocket.readable.getReader(),this.ssl?this._listenOnce().catch(e=>this.emit(`error`,e)):this._listen().catch(e=>this.emit(`error`,e)),await this._cfWriter.ready,this.writable=!0,this.emit(`connect`),this}catch(e){this.emit(`error`,e)}}async _listen(){for(;;){let{done:e,value:t}=await this._cfReader.read();if(e)break;this.emit(`data`,Buffer.from(t))}}async _listenOnce(){let{done:e,value:t}=await this._cfReader.read();this.emit(`data`,Buffer.from(t))}write(e,t=`utf8`,n=()=>{}){let r=typeof t==`function`?`utf8`:t;return typeof t==`function`&&(n=t),e.length===0?n():(typeof e==`string`&&(e=Buffer.from(e,r)),this._cfWriter.write(e).then(()=>{n()},e=>{n(e)}),!0)}end(e=Buffer.alloc(0),t=`utf8`,n=()=>{}){return this.write(e,t,e=>{let t=this._cfSocket;(t?.close())?.then(()=>{this._cfSocket===t&&(this._cfSocket=null,this.emit(`close`))}).catch(e=>this.emit(`error`,e)),n&&n(e)}),this}destroy(e){return this.destroyed=!0,this.end()}startTls(e){this._upgraded?this.emit(`error`,"Cannot call `startTls()` more than once on a socket"):(this._cfWriter.releaseLock(),this._cfReader.releaseLock(),this._upgrading=!0,this._cfSocket=this._cfSocket.startTls(e),this._cfWriter=this._cfSocket.writable.getWriter(),this._cfReader=this._cfSocket.readable.getReader(),this._addClosedHandler(),this._listen().catch(e=>this.emit(`error`,e)))}_addClosedHandler(){let e=this._cfSocket;e.closed.then(()=>{this._upgrading?(this._upgrading=!1,this._upgraded=!0):this._cfSocket===e&&(this._cfSocket=null,this.emit(`close`))}).catch(e=>this.emit(`error`,e))}}})),fZ=i(((e,n)=>{var{getStream:r,getSecureStream:i}=c();n.exports={getStream:r,getSecureStream:i};function a(){function e(e){return new(cZ(),t(sZ)).Socket}function n(e){return(uZ(),t(lZ)).connect(e)}return{getStream:e,getSecureStream:n}}function o(){function e(e){let{CloudflareSocket:t}=dZ();return new t(e)}function t(e){return e.socket.startTls(e),e.socket}return{getStream:e,getSecureStream:t}}function s(){if(typeof navigator==`object`&&navigator!==null&&typeof navigator.userAgent==`string`)return navigator.userAgent===`Cloudflare-Workers`;if(typeof Response==`function`){let e=new Response(null,{cf:{thing:!0}});if(typeof e.cf==`object`&&e.cf!==null&&e.cf.thing)return!0}return!1}function c(){return s()?o():a()}})),pZ=i(((e,n)=>{var r=(CX(),t(SX)).EventEmitter,{parse:i,serialize:a}=oZ(),o=fZ(),{getStream:s}=o,c=a.flush(),l=a.sync(),u=a.end();n.exports=class extends r{constructor(e){super(),e||={},this.stream=e.stream||s(e.ssl),typeof this.stream==`function`&&(this.stream=this.stream(e)),this._keepAlive=e.keepAlive,this._keepAliveInitialDelayMillis=e.keepAliveInitialDelayMillis,this.parsedStatements={},this.submittedNamedStatements={},this.ssl=e.ssl||!1,this.sslNegotiation=e.sslNegotiation||`postgres`,this._ending=!1,this._emitMessage=!1;let t=this;this.on(`newListener`,function(e){e===`message`&&(t._emitMessage=!0)})}connect(e,t){let n=this;this._connecting=!0,this.stream.setNoDelay(!0),this.stream.connect(e,t),this.stream.once(`connect`,function(){n._keepAlive&&n.stream.setKeepAlive(!0,n._keepAliveInitialDelayMillis),n.emit(`connect`)});let r=function(e){(!n._ending||e.code!==`ECONNRESET`&&e.code!==`EPIPE`)&&n.emit(`error`,e)};if(this.stream.on(`error`,r),this.stream.on(`close`,function(){n.emit(`end`)}),!this.ssl)return this.attachListeners(this.stream);if(this.sslNegotiation===`direct`)return this.stream.once(`connect`,function(){n.upgradeToSSL(t,r)});this.stream.once(`data`,function(e){switch(e.toString(`utf8`)){case`S`:break;case`N`:return n.stream.end(),n.emit(`error`,Error(`The server does not support SSL connections`));default:return n.stream.end(),n.emit(`error`,Error(`There was an error establishing an SSL connection`))}n.upgradeToSSL(t,r)})}upgradeToSSL(e,n){let r=this,i={socket:r.stream,host:e};r.ssl!==!0&&(Object.assign(i,r.ssl),`key`in r.ssl&&(i.key=r.ssl.key)),r.sslNegotiation===`direct`&&(i.ALPNProtocols=[`postgresql`]);let a=(cZ(),t(sZ));a.isIP&&a.isIP(e)===0&&(i.servername=e);try{r.stream=o.getSecureStream(i)}catch(e){return r.emit(`error`,e)}r.attachListeners(r.stream),r.stream.on(`error`,n),r.emit(`sslconnect`)}attachListeners(e){i(e,e=>{let t=e.name===`error`?`errorMessage`:e.name;this._emitMessage&&this.emit(`message`,e),this.emit(t,e)})}requestSsl(){this.stream.write(a.requestSsl())}startup(e){this.stream.write(a.startup(e))}cancel(e,t){this._send(a.cancel(e,t))}password(e){this._send(a.password(e))}sendSASLInitialResponseMessage(e,t){this._send(a.sendSASLInitialResponseMessage(e,t))}sendSCRAMClientFinalMessage(e){this._send(a.sendSCRAMClientFinalMessage(e))}_send(e){return this.stream.writable?this.stream.write(e):!1}query(e){this._send(a.query(e))}parse(e){this._send(a.parse(e))}bind(e){this._send(a.bind(e))}execute(e){this._send(a.execute(e))}flush(){this.stream.writable&&this.stream.write(c)}sync(){this._send(l)}ref(){this.stream.ref()}unref(){this.stream.unref()}end(){if(this._ending=!0,!this._connecting||!this.stream.writable)this.stream.end();else return this.stream.write(u,()=>{this.stream.end()})}close(e){this._send(a.close(e))}describe(e){this._send(a.describe(e))}sendCopyFromChunk(e){this._send(a.copyData(e))}endCopyFrom(){this._send(a.copyDone())}sendCopyFail(e){this._send(a.copyFail(e))}}})),mZ=r({"module.exports":()=>Sc}),hZ=n(()=>{}),gZ=r({"module.exports":()=>Cc}),_Z=n(()=>{}),vZ=r({"module.exports":()=>wc}),yZ=n(()=>{}),bZ=i(((e,n)=>{var{Transform:r}=(_Z(),t(gZ)),{StringDecoder:i}=(yZ(),t(vZ)),a=Symbol(`last`),o=Symbol(`decoder`);function s(e,t,n){let r;if(this.overflow){if(r=this[o].write(e).split(this.matcher),r.length===1)return n();r.shift(),this.overflow=!1}else this[a]+=this[o].write(e),r=this[a].split(this.matcher);this[a]=r.pop();for(let e=0;e<r.length;e++)try{l(this,this.mapper(r[e]))}catch(e){return n(e)}this.overflow=this[a].length>this.maxLength,this.overflow&&!this.skipOverflow?n(Error(`maximum buffer reached`)):n()}function c(e){if(this[a]+=this[o].end(),this[a])try{l(this,this.mapper(this[a]))}catch(t){return e(t)}e()}function l(e,t){t!==void 0&&e.push(t)}function u(e){return e}function d(e,t,n){switch(e||=/\r?\n/,t||=u,n||={},arguments.length){case 1:typeof e==`function`?(t=e,e=/\r?\n/):typeof e==`object`&&!(e instanceof RegExp)&&!e[Symbol.split]&&(n=e,e=/\r?\n/);break;case 2:typeof e==`function`?(n=t,t=e,e=/\r?\n/):typeof t==`object`&&(n=t,t=u)}n=Object.assign({},n),n.autoDestroy=!0,n.transform=s,n.flush=c,n.readableObjectMode=!0;let l=new r(n);return l[a]=``,l[o]=new i(`utf8`),l.matcher=e,l.mapper=t,l.maxLength=n.maxLength,l.skipOverflow=n.skipOverflow||!1,l.overflow=!1,l._destroy=function(e,t){this._writableState.errorEmitted=!1,t(e)},l}n.exports=d})),xZ=i(((e,n)=>{var r=(hZ(),t(mZ)),i=(_Z(),t(gZ)).Stream,a=bZ(),o=(LX(),t(IX)),s=5432,c=process.platform===`win32`,l=process.stderr,u=56,d=7,f=61440,p=32768;function m(e){return(e&f)==p}var h=[`host`,`port`,`database`,`user`,`password`],g=h.length,_=h[g-1];function v(){if(l instanceof i&&!0===l.writable){var e=Array.prototype.slice.call(arguments).concat(`
427
+ `);l.write(o.format.apply(o,e))}}Object.defineProperty(n.exports,"isWin",{get:function(){return c},set:function(e){c=e}}),n.exports.warnTo=function(e){var t=l;return l=e,t},n.exports.getFileName=function(e){var t=e||process.env;return t.PGPASSFILE||(c?r.join(t.APPDATA||`./`,`postgresql`,`pgpass.conf`):r.join(t.HOME||`./`,`.pgpass`))},n.exports.usePgPass=function(e,t){return Object.prototype.hasOwnProperty.call(process.env,`PGPASSWORD`)?!1:c?!0:(t||=`<unkn>`,m(e.mode)?e.mode&(u|d)?(v(`WARNING: password file "%s" has group or world access; permissions should be u=rw (0600) or less`,t),!1):!0:(v(`WARNING: password file "%s" is not a plain file`,t),!1))};var y=n.exports.match=function(e,t){return h.slice(0,-1).reduce(function(n,r,i){return i==1&&Number(e[r]||s)===Number(t[r])?n&&!0:n&&(t[r]===`*`||t[r]===e[r])},!0)};n.exports.getPassword=function(e,t,n){var r,i=t.pipe(a());function o(t){var n=b(t);n&&x(n)&&y(e,n)&&(r=n[_],i.end())}var s=function(){t.destroy(),n(r)},c=function(e){t.destroy(),v(`WARNING: error on reading file: %s`,e),n(void 0)};t.on(`error`,c),i.on(`data`,o).on(`end`,s).on(`error`,c)};var b=n.exports.parseLine=function(e){if(e.length<11||e.match(/^\s+#/))return null;for(var t=``,n=``,r=0,i=0,a={},o=!1,s=function(t,n,r){var i=e.substring(n,r);Object.hasOwnProperty.call(process.env,`PGPASS_NO_DEESCAPE`)||(i=i.replace(/\\([:\\])/g,`$1`)),a[h[t]]=i},c=0;c<e.length-1;c+=1){if(t=e.charAt(c+1),n=e.charAt(c),o=r==g-1,o){s(r,i);break}c>=0&&t==`:`&&n!==`\\`&&(s(r,i,c+1),i=c+2,r+=1)}return a=Object.keys(a).length===g?a:null,a},x=n.exports.isValidEntry=function(e){for(var t={0:function(e){return e.length>0},1:function(e){return e===`*`||(e=Number(e),isFinite(e)&&e>0&&e<9007199254740992&&Math.floor(e)===e)},2:function(e){return e.length>0},3:function(e){return e.length>0},4:function(e){return e.length>0}},n=0;n<h.length;n+=1){var r=t[n];if(!r(e[h[n]]||``))return!1}return!0}})),SZ=i(((e,n)=>{hZ();var r=(XX(),t(YX)),i=xZ();n.exports=function(e,t){var n=i.getFileName();r.stat(n,function(a,o){if(a||!i.usePgPass(o,n))return t(void 0);var s=r.createReadStream(n);i.getPassword(e,s,t)})},n.exports.warnTo=i.warnTo})),CZ=i(((e,n)=>{var r=(CX(),t(SX)).EventEmitter,i=BX(),a=(LX(),t(IX)),o=GX(),s=KX(),c=QX(),l=eZ(),u=FX(),d=pZ(),f=UX(),p=a.deprecate(()=>{},`Client.activeQuery is deprecated and will be removed in pg@9.0`),m=a.deprecate(()=>{},`Client.queryQueue is deprecated and will be removed in pg@9.0.`),h=a.deprecate(()=>{},`pgpass support is deprecated and will be removed in pg@9.0. You can provide an async function as the password property to the Client/Pool constructor that returns a password instead. Within this function you can call the pgpass module in your own code.`),g=a.deprecate(()=>{},`Passing a custom Promise implementation to the Client/Pool constructor is deprecated and will be removed in pg@9.0.`),_=a.deprecate(()=>{},`Calling client.query() when the client is already executing a query is deprecated and will be removed in pg@9.0. Use async/await or an external async flow control mechanism instead.`);function v(e,t){if(typeof e==`number`)return Number.isFinite(e)?e:t;if(typeof e==`string`&&e.trim()!==``){let n=Number(e);return Number.isFinite(n)?n:t}return t}var y=class extends r{constructor(e){super(),this.connectionParameters=new c(e),this.user=this.connectionParameters.user,this.database=this.connectionParameters.database,this.port=this.connectionParameters.port,this.host=this.connectionParameters.host,Object.defineProperty(this,"password",{configurable:!0,enumerable:!1,writable:!0,value:this.connectionParameters.password}),this.replication=this.connectionParameters.replication;let t=e||{};t.Promise&&g(),this._Promise=t.Promise||global.Promise,this._types=new s(t.types),this._ending=!1,this._ended=!1,this._connecting=!1,this._connected=!1,this._connectionError=!1,this._queryable=!0,this._activeQuery=null,this._txStatus=null,this.enableChannelBinding=!!t.enableChannelBinding,this.scramMaxIterations=v(t.scramMaxIterations,o.DEFAULT_MAX_SCRAM_ITERATIONS),this.connection=t.connection||new d({stream:t.stream,ssl:this.connectionParameters.ssl,sslNegotiation:this.connectionParameters.sslnegotiation,keepAlive:t.keepAlive||!1,keepAliveInitialDelayMillis:t.keepAliveInitialDelayMillis||0,encoding:this.connectionParameters.client_encoding||`utf8`}),this._queryQueue=[],this._sentQueryQueue=[],this.pipeline=!!t.pipeline,this.binary=t.binary||u.binary,this.processID=null,this.secretKey=null,this.ssl=this.connectionParameters.ssl||!1,this.sslNegotiation=this.connectionParameters.sslnegotiation||`postgres`,this.ssl&&this.ssl.key&&Object.defineProperty(this.ssl,"key",{enumerable:!1}),this._connectionTimeoutMillis=t.connectionTimeoutMillis||0}get activeQuery(){return p(),this._activeQuery}set activeQuery(e){p(),this._activeQuery=e}_getActiveQuery(){return this._activeQuery}_errorAllQueries(e){let t=t=>{process.nextTick(()=>{t.handleError(e,this.connection)})},n=this._getActiveQuery();n&&(t(n),this._activeQuery=null),this._sentQueryQueue.forEach(t),this._sentQueryQueue.length=0,this._queryQueue.forEach(t),this._queryQueue.length=0}_connect(e){let t=this,n=this.connection;if(this._connectionCallback=e,this._connecting||this._connected){let t=Error(`Client has already been connected. You cannot reuse a client.`);process.nextTick(()=>{e(t)})}else this._connecting=!0,this._connectionTimeoutMillis>0&&(this.connectionTimeoutHandle=setTimeout(()=>{n._ending=!0,n.stream.destroy(Error(`timeout expired`))},this._connectionTimeoutMillis),this.connectionTimeoutHandle.unref&&this.connectionTimeoutHandle.unref()),this.host&&this.host.indexOf(`/`)===0?n.connect(this.host+`/.s.PGSQL.`+this.port):n.connect(this.port,this.host),n.on(`connect`,function(){t.ssl?t.sslNegotiation!==`direct`&&n.requestSsl():n.startup(t.getStartupConf())}),n.on(`sslconnect`,function(){n.startup(t.getStartupConf())}),this._attachListeners(n),n.once(`end`,()=>{let e=this._ending?Error(`Connection terminated`):Error(`Connection terminated unexpectedly`);clearTimeout(this.connectionTimeoutHandle),this._errorAllQueries(e),this._ended=!0,this._ending||(this._connecting&&!this._connectionError?this._connectionCallback?this._connectionCallback(e):this._handleErrorEvent(e):this._connectionError||this._handleErrorEvent(e)),process.nextTick(()=>{this.emit(`end`)})})}connect(e){if(e)this._connect(e);else return new this._Promise((e,t)=>{this._connect(n=>{n?t(n):e(this)})})}_attachListeners(e){e.on(`authenticationCleartextPassword`,this._handleAuthCleartextPassword.bind(this)),e.on(`authenticationMD5Password`,this._handleAuthMD5Password.bind(this)),e.on(`authenticationSASL`,this._handleAuthSASL.bind(this)),e.on(`authenticationSASLContinue`,this._handleAuthSASLContinue.bind(this)),e.on(`authenticationSASLFinal`,this._handleAuthSASLFinal.bind(this)),e.on(`backendKeyData`,this._handleBackendKeyData.bind(this)),e.on(`error`,this._handleErrorEvent.bind(this)),e.on(`errorMessage`,this._handleErrorMessage.bind(this)),e.on(`readyForQuery`,this._handleReadyForQuery.bind(this)),e.on(`notice`,this._handleNotice.bind(this)),e.on(`rowDescription`,this._handleRowDescription.bind(this)),e.on(`dataRow`,this._handleDataRow.bind(this)),e.on(`portalSuspended`,this._handlePortalSuspended.bind(this)),e.on(`emptyQuery`,this._handleEmptyQuery.bind(this)),e.on(`commandComplete`,this._handleCommandComplete.bind(this)),e.on(`parseComplete`,this._handleParseComplete.bind(this)),e.on(`copyInResponse`,this._handleCopyInResponse.bind(this)),e.on(`copyData`,this._handleCopyData.bind(this)),e.on(`notification`,this._handleNotification.bind(this))}_getPassword(e){let t=this.connection;if(typeof this.password==`function`)this._Promise.resolve().then(()=>this.password(this.connectionParameters)).then(n=>{if(n!==void 0){if(typeof n!=`string`){t.emit(`error`,TypeError(`Password must be a string`));return}this.connectionParameters.password=this.password=n}else this.connectionParameters.password=this.password=null;e()}).catch(e=>{t.emit(`error`,e)});else if(this.password!==null)e();else try{SZ()(this.connectionParameters,t=>{t!==void 0&&(h(),this.connectionParameters.password=this.password=t),e()})}catch(e){this.emit(`error`,e)}}_handleAuthCleartextPassword(e){this._getPassword(()=>{this.connection.password(this.password)})}_handleAuthMD5Password(e){this._getPassword(async()=>{try{let t=await f.postgresMd5PasswordHash(this.user,this.password,e.salt);this.connection.password(t)}catch(e){this.emit(`error`,e)}})}_handleAuthSASL(e){this._getPassword(()=>{try{this.saslSession=o.startSession(e.mechanisms,this.enableChannelBinding&&this.connection.stream,this.scramMaxIterations),this.connection.sendSASLInitialResponseMessage(this.saslSession.mechanism,this.saslSession.response)}catch(e){this.connection.emit(`error`,e)}})}async _handleAuthSASLContinue(e){try{await o.continueSession(this.saslSession,this.password,e.data,this.enableChannelBinding&&this.connection.stream),this.connection.sendSCRAMClientFinalMessage(this.saslSession.response)}catch(e){this.connection.emit(`error`,e)}}_handleAuthSASLFinal(e){try{o.finalizeSession(this.saslSession,e.data),this.saslSession=null}catch(e){this.connection.emit(`error`,e)}}_handleBackendKeyData(e){this.processID=e.processID,this.secretKey=e.secretKey}_handleReadyForQuery(e){this._connecting&&(this._connecting=!1,this._connected=!0,clearTimeout(this.connectionTimeoutHandle),this._connectionCallback&&=(this._connectionCallback(null,this),null),this.emit(`connect`));let t=this._getActiveQuery();this._activeQuery=null,this._txStatus=e?.status??null,this.readyForQuery=!0,t&&t.handleReadyForQuery(this.connection),this._pulseQueryQueue()}_handleErrorWhileConnecting(e){if(!this._connectionError){if(this._connectionError=!0,clearTimeout(this.connectionTimeoutHandle),this._connectionCallback)return this._connectionCallback(e);this.emit(`error`,e)}}_handleErrorEvent(e){if(this._connecting)return this._handleErrorWhileConnecting(e);this._queryable=!1,this._errorAllQueries(e),this.emit(`error`,e)}_handleErrorMessage(e){if(this._connecting)return this._handleErrorWhileConnecting(e);let t=this._getActiveQuery();t?(this._activeQuery=null,t.name&&delete this.connection.submittedNamedStatements[t.name],t.handleError(e,this.connection)):this._handleErrorEvent(e)}_handleRowDescription(e){let t=this._getActiveQuery();if(t==null){let e=Error(`Received unexpected rowDescription message from backend.`);this._handleErrorEvent(e)}else t.handleRowDescription(e)}_handleDataRow(e){let t=this._getActiveQuery();if(t==null){let e=Error(`Received unexpected dataRow message from backend.`);this._handleErrorEvent(e)}else t.handleDataRow(e)}_handlePortalSuspended(e){let t=this._getActiveQuery();if(t==null){let e=Error(`Received unexpected portalSuspended message from backend.`);this._handleErrorEvent(e)}else t.handlePortalSuspended(this.connection)}_handleEmptyQuery(e){let t=this._getActiveQuery();if(t==null){let e=Error(`Received unexpected emptyQuery message from backend.`);this._handleErrorEvent(e)}else t.handleEmptyQuery(this.connection)}_handleCommandComplete(e){let t=this._getActiveQuery();if(t==null){let e=Error(`Received unexpected commandComplete message from backend.`);this._handleErrorEvent(e)}else t.handleCommandComplete(e,this.connection)}_handleParseComplete(){let e=this._getActiveQuery();if(e==null){let e=Error(`Received unexpected parseComplete message from backend.`);this._handleErrorEvent(e)}else e.name&&(this.connection.parsedStatements[e.name]=e.text,delete this.connection.submittedNamedStatements[e.name])}_handleCopyInResponse(e){let t=this._getActiveQuery();if(t==null){let e=Error(`Received unexpected copyInResponse message from backend.`);this._handleErrorEvent(e)}else t.handleCopyInResponse(this.connection)}_handleCopyData(e){let t=this._getActiveQuery();if(t==null){let e=Error(`Received unexpected copyData message from backend.`);this._handleErrorEvent(e)}else t.handleCopyData(e,this.connection)}_handleNotification(e){this.emit(`notification`,e)}_handleNotice(e){this.emit(`notice`,e)}getStartupConf(){let e=this.connectionParameters,t={user:e.user,database:e.database},n=e.application_name||e.fallback_application_name;return n&&(t.application_name=n),e.replication&&(t.replication=``+e.replication),e.statement_timeout&&(t.statement_timeout=String(parseInt(e.statement_timeout,10))),e.lock_timeout&&(t.lock_timeout=String(parseInt(e.lock_timeout,10))),e.idle_in_transaction_session_timeout&&(t.idle_in_transaction_session_timeout=String(parseInt(e.idle_in_transaction_session_timeout,10))),e.options&&(t.options=e.options),t}cancel(e,t){if(e.activeQuery===t){let t=this.connection;this.host&&this.host.indexOf(`/`)===0?t.connect(this.host+`/.s.PGSQL.`+this.port):t.connect(this.port,this.host),t.on(`connect`,function(){t.cancel(e.processID,e.secretKey)})}else e._queryQueue.indexOf(t)===-1?e._sentQueryQueue.indexOf(t)!==-1&&(t.callback=()=>{}):e._queryQueue.splice(e._queryQueue.indexOf(t),1)}setTypeParser(e,t,n){return this._types.setTypeParser(e,t,n)}getTypeParser(e,t){return this._types.getTypeParser(e,t)}escapeIdentifier(e){return i.escapeIdentifier(e)}escapeLiteral(e){return i.escapeLiteral(e)}_pulseQueryQueue(){if(this.pipeline)this._pulsePipelinedQueryQueue();else if(this.readyForQuery===!0){this._activeQuery=this._queryQueue.shift();let e=this._getActiveQuery();if(e){this.readyForQuery=!1,this.hasExecuted=!0;let t=e.submit(this.connection);t&&process.nextTick(()=>{e.handleError(t,this.connection),this.readyForQuery=!0,this._pulseQueryQueue()})}else this.hasExecuted&&(this._activeQuery=null,this.emit(`drain`))}}_pulsePipelinedQueryQueue(){if(this._connected&&this._queryable){for(;this._queryQueue.length>0;){let e=this._queryQueue.shift();this.hasExecuted=!0;let t=e.submit(this.connection);t?process.nextTick(()=>{e.handleError(t,this.connection)}):this._sentQueryQueue.push(e)}this.readyForQuery&&!this._activeQuery&&this._sentQueryQueue.length>0&&(this._activeQuery=this._sentQueryQueue.shift(),this.readyForQuery=!1),!this._activeQuery&&this._sentQueryQueue.length===0&&this._queryQueue.length===0&&this.hasExecuted&&this.emit(`drain`)}}query(e,t,n){let r,i;if(e==null)throw TypeError(`Client was passed a null or undefined query`);if(typeof e.submit==`function`)i=r=e,r.callback||(typeof t==`function`?r.callback=t:n&&(r.callback=n));else if(r=new l(e,t,n),!r.callback)i=new this._Promise((e,t)=>{r.callback=(n,r)=>n?t(n):e(r)}).catch(e=>{throw Error.captureStackTrace(e),e});else if(typeof r.callback!=`function`)throw TypeError(`callback is not a function`);let a=e.query_timeout||this.connectionParameters.query_timeout;if(a){let e=r.callback||(()=>{}),t=setTimeout(()=>{let t=Error(`Query read timeout`);process.nextTick(()=>{r.handleError(t,this.connection)}),e(t),r.callback=()=>{};let n=this._queryQueue.indexOf(r);if(n>-1)this._queryQueue.splice(n,1);else if(this.pipeline){this.connection.stream.destroy();return}this._pulseQueryQueue()},a);r.callback=(n,r)=>{clearTimeout(t),e(n,r)}}if(this.binary&&!r.binary&&(r.binary=!0),r._result&&!r._result._types&&(r._result._types=this._types),this.pipeline){let t=typeof e.submit==`function`&&!(r instanceof l)?`Custom query classes such as pg-cursor and pg-query-stream are`:r.rows?"The `rows` option is":null;if(t)return process.nextTick(()=>{r.handleError(Error(`${t} not supported in pipeline mode`),this.connection)}),i}return this._queryable?this._ending?(process.nextTick(()=>{r.handleError(Error(`Client was closed and is not queryable`),this.connection)}),i):(this._queryQueue.length>0&&!this.pipeline&&_(),this._queryQueue.push(r),this._pulseQueryQueue(),i):(process.nextTick(()=>{r.handleError(Error(`Client has encountered a connection error and is not queryable`),this.connection)}),i)}ref(){this.connection.ref()}unref(){this.connection.unref()}getTransactionStatus(){return this._txStatus}end(e){if(this._ending=!0,!this.connection._connecting||this._ended){if(e){e();return}return this._Promise.resolve()}if(this._queryable?this.pipeline&&(this._getActiveQuery()||this._sentQueryQueue.length>0||this._queryQueue.length>0)?this.once(`drain`,()=>this.connection.end()):this._getActiveQuery()?this.connection.stream.destroy():this.connection.end():this.connection.stream.destroy(),e)this.connection.once(`end`,e);else return new this._Promise(e=>{this.connection.once(`end`,e)})}get queryQueue(){return m(),this._queryQueue}};y.Query=l,n.exports=y})),wZ=i(((e,n)=>{var r=(CX(),t(SX)).EventEmitter,i=function(){},a=(e,t)=>{let n=e.findIndex(t);return n===-1?void 0:e.splice(n,1)[0]},o=class{constructor(e,t,n){this.client=e,this.idleListener=t,this.timeoutId=n}},s=class{constructor(e){this.callback=e}};function c(){throw Error(`Release called on client which has already been released to the pool.`)}function l(e,t){if(t)return{callback:t,result:void 0};let n,r;return{callback:function(e,t){e?n(e):r(t)},result:new e(function(e,t){r=e,n=t}).catch(e=>{throw Error.captureStackTrace(e),e})}}function u(e,t){return function n(r){r.client=t,t.removeListener(`error`,n),t.on(`error`,()=>{e.log(`additional client error after disconnection due to error`,r)}),e._remove(t),e.emit(`error`,r,t)}}n.exports=class extends r{constructor(e,t){super(),this.options=Object.assign({},e),e!=null&&`password`in e&&Object.defineProperty(this.options,"password",{configurable:!0,enumerable:!1,writable:!0,value:e.password}),e!=null&&e.ssl&&e.ssl.key&&Object.defineProperty(this.options.ssl,"key",{enumerable:!1}),this.options.max=this.options.max||this.options.poolSize||10,this.options.min=this.options.min||0,this.options.maxUses=this.options.maxUses||1/0,this.options.allowExitOnIdle=this.options.allowExitOnIdle||!1,this.options.maxLifetimeSeconds=this.options.maxLifetimeSeconds||0,this.log=this.options.log||function(){},this.Client=this.options.Client||t||jZ().Client,this.Promise=this.options.Promise||global.Promise,this.options.idleTimeoutMillis===void 0&&(this.options.idleTimeoutMillis=1e4),this._clients=[],this._idle=[],this._expired=new WeakSet,this._pendingQueue=[],this._endCallback=void 0,this.ending=!1,this.ended=!1}_promiseTry(e){let t=this.Promise;return typeof t.try==`function`?t.try(e):new t(t=>t(e()))}_isFull(){return this._clients.length>=this.options.max}_isAboveMin(){return this._clients.length>this.options.min}_pulseQueue(){if(this.log(`pulse queue`),this.ended){this.log(`pulse queue ended`);return}if(this.ending){this.log(`pulse queue on ending`),this._idle.length&&this._idle.slice().map(e=>{this._remove(e.client)}),this._clients.length||(this.ended=!0,this._endCallback());return}if(!this._pendingQueue.length){this.log(`no queued requests`);return}if(!this._idle.length&&this._isFull())return;let e=this._pendingQueue.shift();if(this._idle.length){let t=this._idle.pop();clearTimeout(t.timeoutId);let n=t.client;n.ref&&n.ref();let r=t.idleListener;return this._acquireClient(n,e,r,!1)}if(!this._isFull())return this.newClient(e);throw Error(`unexpected condition`)}_remove(e,t){let n=a(this._idle,t=>t.client===e);n!==void 0&&clearTimeout(n.timeoutId),this._clients=this._clients.filter(t=>t!==e);let r=this;e.end(()=>{r.emit(`remove`,e),typeof t==`function`&&t()})}connect(e){if(this.ending){let t=Error(`Cannot use a pool after calling end on the pool`);return e?e(t):this.Promise.reject(t)}let t=l(this.Promise,e),n=t.result;if(this._isFull()||this._idle.length){if(this._idle.length&&process.nextTick(()=>this._pulseQueue()),!this.options.connectionTimeoutMillis)return this._pendingQueue.push(new s(t.callback)),n;let e=(e,n,r)=>{clearTimeout(i),t.callback(e,n,r)},r=new s(e),i=setTimeout(()=>{a(this._pendingQueue,t=>t.callback===e),r.timedOut=!0,t.callback(Error(`timeout exceeded when trying to connect`))},this.options.connectionTimeoutMillis);return i.unref&&i.unref(),this._pendingQueue.push(r),n}return this.newClient(new s(t.callback)),n}newClient(e){let t=new this.Client(this.options);this._clients.push(t);let n=u(this,t);this.log(`checking client timeout`);let r,a=!1;this.options.connectionTimeoutMillis&&(r=setTimeout(()=>{t.connection?(this.log(`ending client due to timeout`),a=!0,t.connection.stream.destroy()):t.isConnected()||(this.log(`ending client due to timeout`),a=!0,t.end())},this.options.connectionTimeoutMillis)),this.log(`connecting new client`),t.connect(o=>{if(r&&clearTimeout(r),t.on(`error`,n),o)this.log(`client failed to connect`,o),this._clients=this._clients.filter(e=>e!==t),a&&(o=Error(`Connection terminated due to connection timeout`,{cause:o})),this._pulseQueue(),e.timedOut||e.callback(o,void 0,i);else{if(this.log(`new client connected`),this.options.onConnect){this._promiseTry(()=>this.options.onConnect(t)).then(()=>{this._afterConnect(t,e,n)},n=>{this._clients=this._clients.filter(e=>e!==t),t.end(()=>{this._pulseQueue(),e.timedOut||e.callback(n,void 0,i)})});return}return this._afterConnect(t,e,n)}})}_afterConnect(e,t,n){if(this.options.maxLifetimeSeconds!==0){let t=setTimeout(()=>{this.log(`ending client due to expired lifetime`),this._expired.add(e),this._idle.findIndex(t=>t.client===e)!==-1&&this._acquireClient(e,new s((e,t,n)=>n()),n,!1)},this.options.maxLifetimeSeconds*1e3);t.unref(),e.once(`end`,()=>clearTimeout(t))}return this._acquireClient(e,t,n,!0)}_acquireClient(e,t,n,r){r&&this.emit(`connect`,e),this.emit(`acquire`,e),e.release=this._releaseOnce(e,n),e.removeListener(`error`,n),t.timedOut?r&&this.options.verify?this.options.verify(e,e.release):e.release():r&&this.options.verify?this.options.verify(e,n=>{if(n)return e.release(n),t.callback(n,void 0,i);t.callback(void 0,e,e.release)}):t.callback(void 0,e,e.release)}_releaseOnce(e,t){let n=!1;return r=>{n&&c(),n=!0,this._release(e,t,r)}}_release(e,t,n){if(e.on(`error`,t),e._poolUseCount=(e._poolUseCount||0)+1,this.emit(`release`,n,e),n||this.ending||!e._queryable||e._ending||e._poolUseCount>=this.options.maxUses)return e._poolUseCount>=this.options.maxUses&&this.log(`remove expended client`),this._remove(e,this._pulseQueue.bind(this));if(this._expired.has(e))return this.log(`remove expired client`),this._expired.delete(e),this._remove(e,this._pulseQueue.bind(this));let r;this.options.idleTimeoutMillis&&this._isAboveMin()&&(r=setTimeout(()=>{this._isAboveMin()&&(this.log(`remove idle client`),this._remove(e,this._pulseQueue.bind(this)))},this.options.idleTimeoutMillis),this.options.allowExitOnIdle&&r.unref()),this.options.allowExitOnIdle&&e.unref(),this._idle.push(new o(e,t,r)),this._pulseQueue()}query(e,t,n){if(typeof e==`function`){let t=l(this.Promise,e);return setImmediate(function(){return t.callback(Error(`Passing a function as the first parameter to pool.query is not supported`))}),t.result}typeof t==`function`&&(n=t,t=void 0);let r=l(this.Promise,n);return n=r.callback,this.connect((r,i)=>{if(r)return n(r);let a=!1,o=e=>{a||(a=!0,i.release(e),n(e))};i.once(`error`,o),this.log(`dispatching query`);try{i.query(e,t,(e,t)=>{if(this.log(`query dispatched`),i.removeListener(`error`,o),!a)return a=!0,i.release(e),e?n(e):n(void 0,t)})}catch(e){return i.release(e),n(e)}}),r.result}end(e){if(this.log(`ending`),this.ending){let t=Error(`Called end on pool more than once`);return e?e(t):this.Promise.reject(t)}this.ending=!0;let t=l(this.Promise,e);return this._endCallback=t.callback,this._pulseQueue(),t.result}get waitingCount(){return this._pendingQueue.length}get idleCount(){return this._idle.length}get expiredCount(){return this._clients.reduce((e,t)=>e+ +!!this._expired.has(t),0)}get totalCount(){return this._clients.length}}})),TZ=r({default:()=>EZ}),EZ,DZ=n(()=>{throw EZ={},Error(`Could not resolve "pg-native" imported by "pg". Is it installed?`)}),OZ=i(((e,n)=>{var r=(CX(),t(SX)).EventEmitter,i=(LX(),t(IX)),a=BX(),o=n.exports=function(e,t,n){r.call(this),e=a.normalizeQueryConfig(e,t,n),this.text=e.text,this.values=e.values,this.name=e.name,this.queryMode=e.queryMode,this.callback=e.callback,this.state=`new`,this._arrayMode=e.rowMode===`array`,this._emitRowEvents=!1,this.on(`newListener`,function(e){e===`row`&&(this._emitRowEvents=!0)}.bind(this))};i.inherits(o,r);var s={sqlState:`code`,statementPosition:`position`,messagePrimary:`message`,messageDetail:`detail`,messageHint:`hint`,context:`where`,schemaName:`schema`,tableName:`table`,columnName:`column`,dataTypeName:`dataType`,constraintName:`constraint`,sourceFile:`file`,sourceLine:`line`,sourceFunction:`routine`};o.prototype.handleError=function(e){let t=this.native&&this.native.pq.resultErrorFields();if(t)for(let n in t){let r=s[n]||n;e[r]=t[n]}this.callback?this.callback(e):this.emit(`error`,e),this.state=`error`},o.prototype.then=function(e,t){return this._getPromise().then(e,t)},o.prototype.catch=function(e){return this._getPromise().catch(e)},o.prototype._getPromise=function(){return this._promise||=new Promise(function(e,t){this._once(`end`,e),this._once(`error`,t)}.bind(this)),this._promise},o.prototype.submit=function(e){this.state=`running`;let t=this;this.native=e.native,e.native.arrayMode=this._arrayMode;let n=function(n,r,i){if(e.native.arrayMode=!1,setImmediate(function(){t.emit(`_done`)}),n)return t.handleError(n);t._emitRowEvents&&(i.length>1?r.forEach((e,n)=>{e.forEach(e=>{t.emit(`row`,e,i[n])})}):r.forEach(function(e){t.emit(`row`,e,i)})),t.state=`end`,t.emit(`end`,i),t.callback&&t.callback(null,i)};if(process.domain&&(n=process.domain.bind(n)),this.name){this.name.length>63&&(console.error(`Warning! Postgres only supports 63 characters for query names.`),console.error(`You supplied %s (%s)`,this.name,this.name.length),console.error(`This can cause conflicts and silent errors executing queries`));let r=(this.values||[]).map(a.prepareValue);if(e.namedQueries[this.name]!==void 0){if(this.text&&e.namedQueries[this.name]!==this.text){let e=Error(`Prepared statements must be unique - '${this.name}' was used for a different statement`);return n(e)}return e.native.execute(this.name,r,n)}return e.native.prepare(this.name,this.text,r.length,function(i){return i?n(i):(e.namedQueries[t.name]=t.text,t.native.execute(t.name,r,n))})}if(this.values){if(!Array.isArray(this.values))return n(Error(`Query values must be an array`));let t=this.values.map(a.prepareValue);e.native.query(this.text,t,n)}else this.queryMode===`extended`?e.native.query(this.text,[],n):e.native.query(this.text,n)}})),kZ=i(((e,n)=>{var r=(LX(),t(IX)),i;try{i=(DZ(),t(TZ))}catch(e){throw e}var a=KX(),o=(CX(),t(SX)).EventEmitter,s=(LX(),t(IX)),c=QX(),l=OZ(),u=r.deprecate(()=>{},`Calling client.query() when the client is already executing a query is deprecated and will be removed in pg@9.0. Use async/await or an external async flow control mechanism instead.`),d=n.exports=function(e){o.call(this),e||={},this._Promise=e.Promise||global.Promise,this._types=new a(e.types),this.native=new i({types:this._types}),this._queryQueue=[],this._ending=!1,this._connecting=!1,this._connected=!1,this._queryable=!0,this.pipeline=!!e.pipeline,this._pipelineInFlight=!1;let t=this.connectionParameters=new c(e);e.nativeConnectionString&&(t.nativeConnectionString=e.nativeConnectionString),this.user=t.user,Object.defineProperty(this,"password",{configurable:!0,enumerable:!1,writable:!0,value:t.password}),this.database=t.database,this.host=t.host,this.port=t.port,this.namedQueries={}};d.Query=l,s.inherits(d,o),d.prototype._errorAllQueries=function(e){let t=t=>{process.nextTick(()=>{t.native=this.native,t.handleError(e)})};this._hasActiveQuery()&&(t(this._activeQuery),this._activeQuery=null),this._queryQueue.forEach(t),this._queryQueue.length=0},d.prototype._connect=function(e){let t=this;this._connecting?process.nextTick(()=>e(Error(`Client has already been connected. You cannot reuse a client.`))):(this._connecting=!0,this.connectionParameters.getLibpqConnectionString(function(n,r){if(t.connectionParameters.nativeConnectionString&&(r=t.connectionParameters.nativeConnectionString),n)return e(n);t.native.connect(r,function(n){if(n)return t.native.end(),e(n);t._connected=!0,t.native.on(`error`,function(e){t._queryable=!1,t._errorAllQueries(e),t.emit(`error`,e)}),t.native.on(`notification`,function(e){t.emit(`notification`,{channel:e.relname,payload:e.extra})}),t.emit(`connect`),t._pulseQueryQueue(!0),e(null,this)})}))},d.prototype.connect=function(e){if(e)this._connect(e);else return new this._Promise((e,t)=>{this._connect(n=>{n?t(n):e(this)})})},d.prototype.query=function(e,t,n){let r,i,a,o,s;if(e==null)throw TypeError(`Client was passed a null or undefined query`);if(typeof e.submit==`function`)a=e.query_timeout||this.connectionParameters.query_timeout,i=r=e,typeof t==`function`&&(e.callback=t);else if(a=e.query_timeout||this.connectionParameters.query_timeout,r=new l(e,t,n),!r.callback){let e,t;i=new this._Promise((n,r)=>{e=n,t=r}).catch(e=>{throw Error.captureStackTrace(e),e}),r.callback=(n,r)=>n?t(n):e(r)}return a&&(s=r.callback||(()=>{}),o=setTimeout(()=>{let e=Error(`Query read timeout`);process.nextTick(()=>{r.handleError(e,this.connection)}),s(e),r.callback=()=>{};let t=this._queryQueue.indexOf(r);t>-1&&this._queryQueue.splice(t,1),this._pulseQueryQueue()},a),r.callback=(e,t)=>{clearTimeout(o),s(e,t)}),this._queryable?this._ending?(r.native=this.native,process.nextTick(()=>{r.handleError(Error(`Client was closed and is not queryable`))}),i):(this._queryQueue.length>0&&!this.pipeline&&u(),this._queryQueue.push(r),this._pulseQueryQueue(),i):(r.native=this.native,process.nextTick(()=>{r.handleError(Error(`Client has encountered a connection error and is not queryable`))}),i)},d.prototype.end=function(e){let t=this;this._ending=!0,this._connecting&&!this._connected&&this.once(`connect`,()=>{this.end(()=>{})});let n;e||(n=new this._Promise(function(t,n){e=e=>e?n(e):t()}));let r=function(){t.native.end(function(){t._connected=!1,t._errorAllQueries(Error(`Connection terminated`)),process.nextTick(()=>{t.emit(`end`),e&&e()})})};return this.pipeline&&(this._pipelineInFlight||this._queryQueue.length>0)?this.once(`drain`,r):r(),n},d.prototype._hasActiveQuery=function(){return this._activeQuery&&this._activeQuery.state!==`error`&&this._activeQuery.state!==`end`},d.prototype._pulseQueryQueue=function(e){if(!this._connected)return;if(this.pipeline&&!e)return this._pulsePipelinedQueryQueue();if(this._hasActiveQuery())return;let t=this._queryQueue.shift();if(!t){e||this.emit(`drain`);return}this._activeQuery=t,t.submit(this);let n=this;t.once(`_done`,function(){n._pulseQueryQueue()})},d.prototype._pulsePipelinedQueryQueue=function(){if(!this._connected||this._pipelineInFlight)return;if(this._queryQueue.length===0){this.hasExecuted&&this.emit(`drain`);return}this._pipelineInFlight=!0;let e=this,t=[],n=[],r=BX();for(;this._queryQueue.length>0;){let e=this._queryQueue.shift();this.hasExecuted=!0,n.push(e);let i=e.values?e.values.map(r.prepareValue):null,a={text:e.text,name:e.name,arrayMode:e._arrayMode};i&&(a.values=i),e.name&&this.namedQueries[e.name]&&(a._alreadyPrepared=!0),t.push(a)}this.native.pipeline(t,function(t,r){if(e._pipelineInFlight=!1,t){e._connected=!1,e._queryable=!1;for(let r=0;r<n.length;r++){let i=n[r];i.native=e.native,i.handleError(t)}e._errorAllQueries(t),e.emit(`error`,t),e.emit(`end`)}else{for(let t=0;t<n.length;t++){let i=n[t],a=r[t];i.native=e.native,a.err?i.handleError(a.err):(i.name&&(e.namedQueries[i.name]=i.text),i.state=`end`,i.emit(`end`,a.result),i.callback&&i.callback(null,a.result)),setImmediate(function(){i.emit(`_done`)})}e._pulsePipelinedQueryQueue()}})},d.prototype.cancel=function(e){this._activeQuery===e?this.native.cancel(function(){}):this._queryQueue.indexOf(e)!==-1&&this._queryQueue.splice(this._queryQueue.indexOf(e),1)},d.prototype.ref=function(){},d.prototype.unref=function(){},d.prototype.setTypeParser=function(e,t,n){return this._types.setTypeParser(e,t,n)},d.prototype.getTypeParser=function(e,t){return this._types.getTypeParser(e,t)},d.prototype.isConnected=function(){return this._connected},d.prototype.getTransactionStatus=function(){return this.native.getTransactionStatus()}})),AZ=i(((e,t)=>{t.exports=kZ()})),jZ=i(((e,t)=>{var n=CZ(),r=FX(),i=pZ(),a=$X(),o=BX(),s=wZ(),c=KX(),{DatabaseError:l}=oZ(),{escapeIdentifier:u,escapeLiteral:d}=BX(),f=e=>class extends s{constructor(t){super(t,e)}},p=function(e){this.defaults=r,this.Client=e,this.Query=this.Client.Query,this.Pool=f(this.Client),this._pools=[],this.Connection=i,this.types=PX(),this.DatabaseError=l,this.TypeOverrides=c,this.escapeIdentifier=u,this.escapeLiteral=d,this.Result=a,this.utils=o},m=n,h=!1;try{h=!!process.env.NODE_PG_FORCE_NATIVE}catch{}h&&(m=AZ()),t.exports=new p(m),Object.defineProperty(t.exports,"native",{configurable:!0,enumerable:!1,get(){let e=null;try{e=new p(AZ())}catch(e){if(e.code!==`MODULE_NOT_FOUND`)throw e}return Object.defineProperty(t.exports,"native",{value:e}),e}})})),MZ=e(jZ(),1);MZ.default.Client,MZ.default.Pool,MZ.default.Connection,MZ.default.types,MZ.default.Query,MZ.default.DatabaseError,MZ.default.escapeIdentifier,MZ.default.escapeLiteral,MZ.default.Result,MZ.default.TypeOverrides,MZ.default.defaults;var NZ=MZ.default,{Pool:PZ,types:FZ}=NZ,IZ=class extends XT{constructor(e,t,n,r,i,a,o,s,c,l,u){super({sql:t,params:n},i,a,o),this.client=e,this.queryString=t,this.params=n,this.logger=r,this.fields=s,this._isResponseInArrayMode=l,this.customResultMapper=u,this.rawQueryConfig={name:c,text:t,types:{getTypeParser:(e,t)=>e===FZ.builtins.TIMESTAMPTZ||e===FZ.builtins.TIMESTAMP||e===FZ.builtins.DATE||e===FZ.builtins.INTERVAL||e===1231||e===1115||e===1185||e===1187||e===1182?e=>e:FZ.getTypeParser(e,t)}},this.queryConfig={name:c,text:t,rowMode:`array`,types:{getTypeParser:(e,t)=>e===FZ.builtins.TIMESTAMPTZ||e===FZ.builtins.TIMESTAMP||e===FZ.builtins.DATE||e===FZ.builtins.INTERVAL||e===1231||e===1115||e===1185||e===1187||e===1182?e=>e:FZ.getTypeParser(e,t)}}}static[L]=`NodePgPreparedQuery`;rawQueryConfig;queryConfig;async execute(e={}){return Fb.startActiveSpan(`drizzle.execute`,async()=>{let t=nx(this.params,e);this.logger.logQuery(this.rawQueryConfig.text,t);let{fields:n,rawQueryConfig:r,client:i,queryConfig:a,joinsNotNullableMap:o,customResultMapper:s}=this;if(!n&&!s)return Fb.startActiveSpan(`drizzle.driver.execute`,async e=>(e?.setAttributes({"drizzle.query.name":r.name,"drizzle.query.text":r.text,"drizzle.query.params":JSON.stringify(t)}),this.queryWithCache(r.text,t,async()=>await i.query(r,t))));let c=await Fb.startActiveSpan(`drizzle.driver.execute`,e=>(e?.setAttributes({"drizzle.query.name":a.name,"drizzle.query.text":a.text,"drizzle.query.params":JSON.stringify(t)}),this.queryWithCache(a.text,t,async()=>await i.query(a,t))));return Fb.startActiveSpan(`drizzle.mapResponse`,()=>s?s(c.rows):c.rows.map(e=>vx(n,e,o)))})}all(e={}){return Fb.startActiveSpan(`drizzle.execute`,()=>{let t=nx(this.params,e);return this.logger.logQuery(this.rawQueryConfig.text,t),Fb.startActiveSpan(`drizzle.driver.execute`,e=>(e?.setAttributes({"drizzle.query.name":this.rawQueryConfig.name,"drizzle.query.text":this.rawQueryConfig.text,"drizzle.query.params":JSON.stringify(t)}),this.queryWithCache(this.rawQueryConfig.text,t,async()=>this.client.query(this.rawQueryConfig,t)).then(e=>e.rows)))})}isResponseInArrayMode(){return this._isResponseInArrayMode}},LZ=class e extends ZT{constructor(e,t,n,r={}){super(t),this.client=e,this.schema=n,this.options=r,this.logger=r.logger??new gx,this.cache=r.cache??new JT}static[L]=`NodePgSession`;logger;cache;prepareQuery(e,t,n,r,i,a,o){return new IZ(this.client,e.sql,e.params,this.logger,this.cache,a,o,t,n,r,i)}async transaction(t,n){let r=this.client instanceof PZ||Object.getPrototypeOf(this.client).constructor.name.includes(`Pool`),i=r?new e(await this.client.connect(),this.dialect,this.schema,this.options):this,a=new RZ(this.dialect,i,this.schema);await a.execute(V`begin${n?V` ${a.getTransactionConfigSQL(n)}`:void 0}`);try{let e=await t(a);return await a.execute(V`commit`),e}catch(e){throw await a.execute(V`rollback`),e}finally{r&&i.client.release()}}async count(e){let t=await this.execute(e);return Number(t.rows[0].count)}},RZ=class e extends QT{static[L]=`NodePgTransaction`;async transaction(t){let n=`sp${this.nestedIndex+1}`,r=new e(this.dialect,this.session,this.schema,this.nestedIndex+1);await r.execute(V.raw(`savepoint ${n}`));try{let e=await t(r);return await r.execute(V.raw(`release savepoint ${n}`)),e}catch(e){throw await r.execute(V.raw(`rollback to savepoint ${n}`)),e}}},zZ=class{constructor(e,t,n={}){this.client=e,this.dialect=t,this.options=n}static[L]=`NodePgDriver`;createSession(e){return new LZ(this.client,this.dialect,e,{logger:this.options.logger,cache:this.options.cache})}},BZ=class extends HT{static[L]=`NodePgDatabase`};function VZ(e,t={}){let n=new oT({casing:t.casing}),r;t.logger===!0?r=new hx:t.logger!==!1&&(r=t.logger);let i;if(t.schema){let e=bw(t.schema,Tw);i={fullSchema:t.schema,schema:e.tables,tableNamesMap:e.tableNamesMap}}let a=new BZ(n,new zZ(e,n,{logger:r,cache:t.cache}).createSession(i),i);return a.$client=e,a.$cache=t.cache,a.$cache&&(a.$cache.invalidate=t.cache?.onMutate),a}function HZ(...e){if(typeof e[0]==`string`)return VZ(new NZ.Pool({connectionString:e[0]}),e[1]);if(Ex(e[0])){let{connection:t,client:n,...r}=e[0];return VZ(n||(typeof t==`string`?new NZ.Pool({connectionString:t}):new NZ.Pool(t)),r)}return VZ(e[0],e[1])}(e=>{function t(e){return VZ({},e)}e.mock=t})(HZ||={});var UZ={};function WZ(){let e=tl(`DATABASE_URL`);if(e)return e;let t=tl(`HYPERDRIVE`);if(t?.connectionString)return t.connectionString;throw Error(`db: PostgreSQL is not configured. Add DATABASE_URL to .env for local dev, or configure Hyperdrive for production.`)}function GZ(){return HZ({connection:{connectionString:WZ(),max:1,idleTimeoutMillis:1e3}}).$client}function KZ(){return Xc(UZ,GZ,GZ)}function qZ(e,t={}){let n=new Map,r;return new Proxy({},{get(n,r){if(Object.hasOwn(t,r))return t[r];let i=e(),a=Reflect.get(i,r);return typeof a==`function`?a.bind(i):a},has(r,i){return Object.hasOwn(t,i)?!0:(n.has(i)||n.set(i,Reflect.has(e(),i)),n.get(i))},getPrototypeOf:()=>r??=Object.getPrototypeOf(e())})}var JZ,YZ=new Proxy({},{get(e,t){Xc(UZ,GZ,()=>void 0),JZ??=HZ({client:qZ(KZ),schema:SE});let n=Reflect.get(JZ,t);return typeof n==`function`?n.bind(JZ):n}}),$=YZ;async function XZ(e,t){let{account:n,assertion:r,client:i,credential:a,userId:o}=t,s=await Y(e,dP($,{account:n,authenticatorData:r.metadata.authenticatorData,clientId:ZP,clientDataJSON:r.metadata.clientDataJSON,credentialId:r.id,expiry:Math.floor(Date.now()/1e3)+300,signature:r.signature,userId:o,verify:e=>e.account===n.toLowerCase()&&e.clientId===`tempo-id:account-config`&&e.credential.id===a.id&&e.credential.publicKey===a.publicKey&&r.id===a.id&&gP(r,{challenge:e.digest,origin:t.origin??new URL(I.URL).origin,publicKey:a.publicKey,rpId:a.rpId})}),`Passkey.takeSignature`),c=s?await Y(e,bF($,{digest:s.digest,userId:o}),`ConfigurableAccount.takePending`):void 0;if(!s||!c)return new jN;let{registration:l}=c;if(l&&!t.keySignature)return lQ();let u=t.link?await Y(e,t.link(),`Configure.link`):void 0;if(u)return u;l&&await cQ(e,()=>vF({account:n,client:i,digest:l.digest,signature:t.keySignature,transaction:l.transaction}));let d=await cQ(e,()=>hF({assertion:r,client:i,current:c.current,digest:s.digest,publicKey:a.publicKey,target:c.target,transaction:c.transaction}));return await Y(e,pF($,{config:d,userId:o}),`db.accountConfig.save`),d}(function(e){e.errors=[...cO.errors,KP,jN,aX,LM]})(XZ||={});async function ZZ(e,t){let{account:n,clientId:r,userId:i}=t,a=eQ({chain:t.chain});if(a instanceof $D)return a;let o=await Y(e,QZ(e,{clientId:r}),`Configure.reach`),s=await Y(e,lX(e,{chainId:a.chainId,db:$,env:I,realms:o,userId:i}),`TempoAccount.held`),c=s.find(e=>vN(e).toLowerCase()===n.toLowerCase());return c?{chain:a,client:oF({apiUrl:Ij({apiUrls:I.TEMPO_API_URLS,chainId:a.chainId}),chain:a}),current:dF(c),owner:c,owners:s,realms:o}:new aX({account:n})}(function(e){e.errors=[...lX.errors,qP,aX]})(ZZ||={});async function QZ(e,t){let n=await Y(e,WL(e,{clientId:t.clientId,db:$,origin:e.req.header(`origin`),own:new URL(I.URL).origin}),`Realm.forRequest`);return await Y(e,JL(e,{db:$,origin:I.URL,realms:n}),`Realm.withDefaults`)}async function $Z(e,t){let{account:n,client:r,credential:i,current:a,registration:o,target:s,userId:c}=t,l=await cQ(e,()=>fF({client:r,current:a,publicKey:i.publicKey,target:s}));return await Y(e,nP($,{account:n,clientId:ZP,credential:i,digest:l.digest,userId:c}),`Passkey.requestSignature`),await Y(e,yF($,{current:a,digest:l.digest,registration:o,target:s,transaction:l.transaction,userId:c}),`ConfigurableAccount.storePending`),Xp({challenge:l.digest,credentialId:[i.id],rpId:i.rpId,userVerification:`required`}).options}function eQ(e){let t=iF({rpcUrl:I.TEMPO_RPC_URL,rpcUrls:I.RPC_URLS,value:I.CONFIGURABLE_ACCOUNTS});return(e.chain===void 0?t[0]:t.find(t=>t.name===e.chain))||new qP({chain:e.chain,configured:t.map(e=>e.name)})}async function tQ(e,t){let{email:n,realms:r,userId:i}=t,a=e.env.WALLET;if(!a||!nQ(e,{realms:r}))return!1;let[o]=await Y(e,$.select({id:DE.id}).from(DE).where(W(DE.userId,i)).limit(1),`db.keys.stored`);if(o)return!1;let s=await Y(e,bX(a,{email:n}),`Wallet.credentials`).catch(t=>{$s(e,{error:t,message:`The wallet service failed a passkey lookup by email, so no cloud wallet was created.`})});return!s||(await uQ(e,{listed:s})).length>0}function nQ(e,t){return!t.realms.some(e=>e.id==="default")||!e.env.WALLET?!1:iF({rpcUrl:I.TEMPO_RPC_URL,rpcUrls:I.RPC_URLS,value:I.CONFIGURABLE_ACCOUNTS}).length>0}async function rQ(e,t){return e.env.WALLET?await uQ(e,{listed:await Y(e,bX(e.env.WALLET,{email:t.email}),`Wallet.credentials`).catch(t=>($s(e,{error:t,message:`The wallet service failed a passkey lookup by email.`}),[]))}):[]}async function iQ(e,t){let{email:n,userId:r}=t,i=iF({rpcUrl:I.TEMPO_RPC_URL,rpcUrls:I.RPC_URLS,value:I.CONFIGURABLE_ACCOUNTS}).find(e=>e.name===t.chain);if(!i)return[];let[a,o,s,c]=await Promise.all([Y(e,$.select({address:DE.address,source:DE.source}).from(DE).where(qC(W(DE.userId,r),rw(DE.address))),`db.keys.list`),Y(e,$.select({address:CE.address,chainId:CE.chainId}).from(CE).where(W(CE.userId,r)),`db.accountConfigs.list`),Y(e,$.select({address:NE.address}).from(NE).where(W(NE.userId,r)).limit(1),`db.secp256k1Owners.list`),Y(e,$.select({realmId:EE.realmId}).from(EE).where(W(EE.userId,r)).limit(1),`db.firstAccounts.list`)]),l=a.flatMap(e=>e.address&&[`tempo-wallet`,`wallet`].includes(e.source)?[e.address]:[]).filter(e=>!o.some(t=>t.chainId===i.chainId&&t.address===e)).map(e=>({account:ae(e),chain:i.name}));return a.length>0||s.length>0||c.length>0?l:(await Y(e,rQ(e,{email:n}),`Configure.unlinked`)).map(e=>({chain:i.name,credentialId:e.credentialId}))}async function aQ(e,t){let{clientId:n,credentialId:r,email:i,userId:a}=t;if(t.account){let r=await Y(e,ZZ(e,{account:t.account,chain:t.chain,clientId:n,userId:a}),`Configure.find`);if(r instanceof $D)return r;let{owner:i}=r,o=vN(i);return r.current?new YP({account:o,owner:`configurable`}):i.credential?{account:o,chain:r.chain,client:r.client,credential:i.credential,link:void 0,owners:r.owners,realm:i.realm}:new JP({account:o,reason:`cloud`})}let o=eQ({chain:t.chain});if(o instanceof $D)return o;let s=await Y(e,QZ(e,{clientId:n}),`Configure.reach`),c=s.find(e=>e.id===VL),l=c?QN([c],{origin:I.URL}):void 0;if(!c||!l)return new kN({clientId:n});let u=r,d=new aX({account:u,field:`credentialId`}),f=e.env.WALLET?await Y(e,yX(e.env.WALLET,{id:u}),`Wallet.credential`).catch(t=>{throw $s(e,{error:t,message:`The wallet service failed a passkey lookup.`}),t instanceof Error&&cO(t)||new aO}):void 0;if(!f||f.email?.toLowerCase()!==i.toLowerCase())return d;let p=await Y(e,lX(e,{chainId:o.chainId,db:$,env:I,realms:s,userId:a}),`TempoAccount.held`),m=ae(f.address);return p.some(e=>e.configurable&&ke(yN(e),m))?new YP({account:m,owner:`configurable`}):{account:m,chain:o,client:oF({apiUrl:Ij({apiUrls:I.TEMPO_API_URLS,chainId:o.chainId}),chain:o}),credential:{id:u,publicKey:f.publicKey,rpId:l.rpId},link:async()=>{let t=await Y(e,GN($,{credential:f,id:u,rpId:l.rpId,userId:a}),`Passkey.link`);return dX(e),t===a?void 0:d},owners:p,realm:c}}(function(e){e.errors=[...cO.errors,...ZZ.errors,JP,YP,kN]})(aQ||={});async function oQ(e,t){let{client:n,current:r,signing:i,target:a,userId:o}=t,s=await Y(e,i.signer(e,{auth:e.var.auth}),`Owner.signer`),c=await cQ(e,()=>mF({account:s,client:n,current:r,target:a}));return await Y(e,pF($,{config:c,userId:o}),`db.accountConfig.save`),c}(function(e){e.errors=[...cO.errors,KP]})(oQ||={});function sQ(e,t){return t.current?e.configurable.owner:e}async function cQ(e,t){try{return await Y(e,t(),`ConfigurableAccount.send`)}catch(t){if(t instanceof $D)throw t;if(t instanceof Error){let e=cO(t);if(e)throw e}throw $s(e,{error:t,message:`The chain did not install the account configuration.`}),new aO}}(function(e){e.errors=[...cO.errors,KP]})(cQ||={});function lQ(){return new LM({issues:[{message:"The step registers the key before the upgrade, so the request needs the access key's signature over `step.key.digest`. Request a new step, and send both signatures",path:[`key`,`signature`]}]})}async function uQ(e,t){let{listed:n}=t;if(n.length===0)return[];let r=await Y(e,$.select({id:DE.id}).from(DE).where(ew(DE.id,n.map(e=>e.credentialId))),`db.keys.linked`);return n.filter(e=>!r.some(t=>t.id===e.credentialId))}var dQ=`__Host-tempo-id-account`,fQ=3456e4,pQ;(function(e){e.value=A({apps:Ei(j(),j()),session:j()})})(pQ||={});async function mQ(e,t){return(await Y(e,xQ(e,t),`AccountStep.held`)).map(_X)}(function(e){e.errors=lX.errors})(mQ||={});async function hQ(e,t){let n=await Y(e,OQ(e,t),`AccountStep.realms`);return await Y(e,tQ(e,{email:t.email,realms:n,userId:t.userId}),`Configure.awaitsUpgrade`)}function gQ(){return h(dQ,``,{httpOnly:!0,maxAge:0,path:`/`,sameSite:`Lax`,secure:!0})}async function _Q(e,t){let n=await Y(e,OQ(e,t),`AccountStep.realms`),r={chainId:t.chainId,db:$,env:I,realms:n,userId:t.userId},i=await(async()=>{if(t.email!==void 0)return t.email;if(!nQ(e,{realms:n}))return;let[r]=await Y(e,$.select({email:bE.email}).from(bE).where(W(bE.id,t.userId)),`db.user.get`);return r?.email})();return i!==void 0&&await Y(e,tQ(e,{email:i,realms:n,userId:t.userId}),`Configure.awaitsUpgrade`)?await Y(e,lX(e,r),`TempoAccount.held`):await Y(e,cX(e,r),`TempoAccount.create`)}(function(e){e.errors=cX.errors})(_Q||={});async function vQ(e,t){let n=(await Y(e,OQ(e,t),`AccountStep.realms`))[0];return n!==void 0&&(n.privy!==void 0||n.secp256k1)}async function yQ(e,t){if(!await GI(e,{binding:`ACCOUNT_LIMIT`,key:t.userId}))return!1;let n=await Y(e,mQ(e,t),`AccountStep.accounts`).catch(n=>($s(e,{error:n,fields:{clientId:t.clientId},message:`The account step skipped an authorization whose accounts failed to load.`}),[]));return n.length<=1?!1:!bQ(n,TQ(t))}function bQ(e,t){if(t)return e.find(e=>e.address.toLowerCase()===t.toLowerCase())}async function xQ(e,t){let n=await Y(e,OQ(e,t),`AccountStep.realms`);return await Y(e,lX(e,{chainId:t.chainId,db:$,env:I,realms:n,userId:t.userId}),`TempoAccount.held`)}(function(e){e.errors=lX.errors})(xQ||={});function SQ(e,t){let n=bQ(e,TQ(t));return n?[n,...e.filter(e=>e!==n)]:e}async function CQ(e,t){let{clientId:n,userId:r}=t;try{if(!await GI(e,{binding:`ACCOUNT_LIMIT`,key:r}))return;let t=await Y(e,qL(e,{db:$,realms:await Y(e,OQ(e,{clientId:n}),`AccountStep.realms`),secret:I.SECRET}),`Realm.privyApps`);await Promise.all([...t.values()].map(t=>Y(e,VY(e,{app:t,userId:r}),`Privy.listWallets`)))}catch(t){$s(e,{error:t,message:`A sign-in failed to read the user's Privy users ahead.`})}}function wQ(e){let t=(e.cookie??``).split(`;`).map(e=>e.trim()).filter(e=>e&&!e.startsWith(`__Host-tempo-id-account=`)),n=EQ(e.clientId),{[n]:r,...i}=DQ(e),a=JSON.stringify({apps:{...Object.fromEntries(Object.entries(i).slice(-15)),[n]:e.account},session:e.sessionId});return{header:[...t,`${dQ}=${encodeURIComponent(a)}`].join(`; `),setCookie:h(dQ,a,{httpOnly:!0,maxAge:fQ,path:`/`,sameSite:`Lax`,secure:!0})}}function TQ(e){let t=DQ(e),n=EQ(e.clientId);return Object.hasOwn(t,n)?t[n]:void 0}function EQ(e){if(!MD(e))return e;let t=Hn(mn(e));return`cimd:${sr(t.slice(0,16),{pad:!1,url:!0})}`}function DQ(e){let t=_(e.cookie??``,dQ)[dQ];if(!t)return{};try{let n=pQ.value.safeParse(JSON.parse(t));return!n.success||n.data.session!==e.sessionId?{}:n.data.apps}catch{return{}}}async function OQ(e,t){let n=await Y(e,UP(e,()=>UL($,{clientId:t.clientId}),[`realm.forApp`,t.clientId]),`Realm.forApp`);return await Y(e,JL(e,{db:$,origin:I.URL,realms:n}),`Realm.withDefaults`)}var kQ=e=>{let t={origin:`*`,allowMethods:[`GET`,`HEAD`,`PUT`,`POST`,`DELETE`,`PATCH`,`QUERY`],allowHeaders:[],exposeHeaders:[],...e},n=t.exposeHeaders?.length?t.exposeHeaders.join(`,`):void 0,r=t.allowHeaders?.length?t.allowHeaders.join(`,`):void 0,i=(e=>typeof e==`string`?e===`*`?()=>e:t=>e===t?t:null:typeof e==`function`?e:t=>e.includes(t)?t:null)(t.origin),a=(e=>{if(typeof e==`function`)return async(t,n)=>(await e(t,n)).join(`,`);if(Array.isArray(e)){let t=e.join(`,`);return()=>t}return()=>``})(t.allowMethods);return async function(e,o){function s(t,n){e.res.headers.set(t,n)}let c=await i(e.req.header(`origin`)||``,e);if(c&&s(`Access-Control-Allow-Origin`,c),t.credentials&&s(`Access-Control-Allow-Credentials`,`true`),n&&s(`Access-Control-Expose-Headers`,n),e.req.method===`OPTIONS`){t.origin!==`*`&&e.res.headers.append(`Vary`,`Origin`),t.maxAge!=null&&s(`Access-Control-Max-Age`,t.maxAge.toString());let n=await a(e.req.header(`origin`)||``,e);n&&s(`Access-Control-Allow-Methods`,n);let i=r;if(!i){let t=e.req.header(`Access-Control-Request-Headers`);t&&(i=t.split(`,`).map(e=>e.trim()).join(`,`))}return i&&(s(`Access-Control-Allow-Headers`,i),e.res.headers.append(`Vary`,`Access-Control-Request-Headers`)),e.res.headers.delete(`Content-Length`),e.res.headers.delete(`Content-Type`),new Response(null,{headers:e.res.headers,status:204,statusText:`No Content`})}await o(),t.origin!==`*`&&e.header(`Vary`,`Origin`,{append:!0})}},AQ=({limitLength:e=255,headerName:t=`X-Request-Id`,generator:n=()=>crypto.randomUUID()}={})=>async function(r,i){let a=t?r.req.header(t):void 0;(!a||a.length>e||/[^\w\-=]/.test(a))&&(a=n(r)),r.set(`requestId`,a),t&&r.header(t,a),await i()},jQ=`X-Request-Id`;function MQ(){let e=AQ({generator:IQ,headerName:``});return TP(async(t,n)=>{await e(t,n);let r=t.var.requestId,i=t.res,a=FQ(i)?await Y(t,RQ(i),`response.json`):void 0;a&&t.set(`refusal`,NQ(t,{body:a,id:r})),t.header(jQ,r)})}function NQ(e,t){let n=e.res;return e.res=new Response(JSON.stringify({...t.body,request_id:t.id}),{headers:n.headers,status:n.status,statusText:n.statusText}),e.header(`content-length`,void 0),{error:PQ(t.body.error),reason:PQ(t.body.reason)}}function PQ(e){return typeof e==`string`&&/^[a-z_]{1,64}$/.test(e)?e:void 0}function FQ(e){return e.status>=400&&!!e.headers.get(`content-type`)?.startsWith(`application/json`)}function IQ(e){let t=e.req.header(`cf-ray`);return t&&/^[\da-f]{16}(?:-[A-Z]{3})?$/.test(t)?t:crypto.randomUUID()}function LQ(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}async function RQ(e){let t=await e.clone().json().catch(()=>void 0);return LQ(t)&&typeof t.error==`string`?t:void 0}var zQ;(function(e){e.refusal=Qi([`foreign_account`,`no_account`,`passkey`,`unavailable`,`upgrade`]).meta({description:"Why approval cannot sign the key: the key names another user's account (`foreign_account`), the user holds no account and none can be created (`no_account`), a passkey that this page cannot use owns the account (`passkey`), the accounts could not be read (`unavailable`), or the account must upgrade first (`upgrade`). Absent when approval can sign it.",examples:[`passkey`]})})(zQ||={});async function BQ(e,t){let{account:n,clientId:r,key:i,owner:a,userId:o}=t,s=a.credential,c=DM({account:SN(a),key:i});return await Y(e,nP($,{account:n,clientId:r,credential:s,digest:c,userId:o}),`Passkey.requestSignature`),Xp({challenge:c,credentialId:s.id,rpId:s.rpId,userVerification:`required`}).options}async function VQ(e,t){let{clientId:n,sessionId:r,userId:i}=t,a=t.chainId===void 0?void 0:Number(t.chainId),o=await(async()=>{if(await GI(e,{binding:`ACCOUNT_LIMIT`,key:i}))try{let o=await Y(e,xQ(e,{chainId:a,clientId:n,userId:i}),`AccountStep.held`);return{owners:o,signing:await Y(e,HQ(e,{account:t.account,chainId:a,clientId:n,cookie:e.req.header(`cookie`),owners:o,passkey:!0,sessionId:r,userId:i}),`KeySigner.resolve`)}}catch(t){$s(e,{error:t,fields:{clientId:n},message:`An approval page's account owners failed to load.`});return}})(),s=o?.signing,c=s instanceof BM&&await Y(e,hQ(e,{clientId:n,email:t.email,userId:i}),`AccountStep.awaitsUpgrade`),l=s instanceof BM&&!c&&await Y(e,vQ(e,{clientId:n}),`AccountStep.creates`),u=s?s instanceof rM||s instanceof XP?s.response.meta?.account:s instanceof $D?t.account:s.account:t.account,d=(()=>{if(!s)return`unavailable`;if(s instanceof aX)return`foreign_account`;if(s instanceof rM)return`passkey`;if(s instanceof XP||c)return`upgrade`;if(s instanceof BM&&!l)return`no_account`})();return{account:u,accounts:o?o.owners.map(_X):[],refusal:d}}async function HQ(e,t){let{clientId:n,cookie:r,sessionId:i,userId:a}=t,o=t.chainId===void 0?void 0:Number(t.chainId),s=t.owners??(t.create&&!t.account?await Y(e,_Q(e,{chainId:o,clientId:n,email:t.email,userId:a}),`AccountStep.create`):await Y(e,xQ(e,{chainId:o,clientId:n,userId:a}),`AccountStep.held`)),c=s.map(_X),l=t.account,u=s.find(e=>t.signInCredential!==void 0&&e.credential?.id===t.signInCredential),d=l?void 0:(u&&_X(u).address)??bQ(c,TQ({clientId:n,cookie:r,sessionId:i}))?.address;if(t.single&&!l&&!d&&c.length>1)return new BM({description:"Several Tempo Accounts: the user holds more than one account in the app's realms and chose none. Choose the account on the account step, or name it in `key_authorization.account`."});let f=l?bQ(c,l)?.address:d??c[0]?.address;if(l&&!f)return new aX({account:l,field:`key_authorization.account`});let p=f?s.find(e=>_X(e).address.toLowerCase()===f.toLowerCase()):void 0;if(!f||!p)return new BM({description:t.create?"No Tempo Account: the user holds no account in the app's realms, and the app's first realm has no Privy app to create one. Authorize without `key_authorization`.":"No Tempo Account: the user holds no account in the app's realms, so no owner signs the key. Create the account with `POST /v1/account`, or authorize without `key_authorization`."});if(p.linked&&!p.configurable&&!t.skipUpgrade&&aF({chainId:o,env:I}))return new XP({account:f});let m=CN(p,{chainId:o});return!m.signer&&!(t.passkey&&GQ(m,{page:t.page}))&&(t.signInCredential===void 0||m!==p||m.credential?.id!==t.signInCredential)?new rM({account:f}):{account:f,owner:m}}(function(e){e.errors=[..._Q.errors,...xQ.errors,BM,XP,rM,aX]})(HQ||={});async function UQ(e,t){let{account:n,assertion:r,key:i,owner:a}=t;if(!a.signer){if(!r||!a.credential)return new rM({account:n});let o=a.credential;if(t.challenge===`sign-in`){let n=DM({account:SN(a),key:i});return!(r.id===o.id&&gP(r,{challenge:n,origin:t.origin??new URL(I.URL).origin,publicKey:o.publicKey,rpId:o.rpId}))||!await Y(e,uP($,{authenticatorData:r.metadata.authenticatorData,expiry:i.expiry,signature:r.signature}),`Passkey.spendSignature`)?new jN:await Y(e,kM(r,{account:SN(a),key:i,publicKey:o.publicKey}),`KeyAuthorization.signWithAssertion`)}return await Y(e,dP($,{account:n,authenticatorData:r.metadata.authenticatorData,clientId:t.clientId,clientDataJSON:r.metadata.clientDataJSON,credentialId:r.id,expiry:i.expiry,signature:r.signature,userId:t.userId,verify:e=>e.account===n.toLowerCase()&&e.clientId===t.clientId&&e.credential.id===o.id&&e.credential.publicKey===o.publicKey&&r.id===o.id&&e.digest===DM({account:SN(a),key:i})&&gP(r,{challenge:e.digest,origin:t.origin??new URL(I.URL).origin,publicKey:o.publicKey,rpId:o.rpId})}),`Passkey.takeSignature`)?await Y(e,kM(r,{account:SN(a),key:i,publicKey:o.publicKey}),`KeyAuthorization.signWithAssertion`):new jN}return await Y(e,OM(await Y(e,a.signer(e,{auth:e.var.auth}),`Owner.signer`),{key:i}),`KeyAuthorization.sign`)}(function(e){e.errors=[rM,jN]})(UQ||={});async function WQ(e,t){let{clientId:n,credentialId:r,email:i,userId:a}=t,o=(await Y(e,QZ(e,{clientId:n}),`Configure.reach`)).find(e=>e.id===VL),s=o?QN([o],{origin:I.URL}):void 0;if(!o||!s)return;let c=await Y(e,rQ(e,{email:i}),`Configure.unlinked`),l=r===void 0?c[0]:c.find(e=>e.credentialId===r);if(!l)return;let{rpId:u}=s,d=ae(l.address),f={id:l.credentialId,publicKey:l.publicKey,rpId:u};return{account:d,link:async()=>{let t=await Y(e,GN($,{credential:l,id:f.id,rpId:u,userId:a}),`Passkey.link`);return dX(e),t===a?void 0:new aX({account:d,field:`passkey`})},owner:bN({account:D({owners:[Se(f,{rpId:u})]}),createdAt:l.createdAt===null?new Date:new Date(l.createdAt),credential:f,linked:!0,realm:o,signer:void 0,type:`webAuthn`})}}(function(e){e.errors=[aX]})(WQ||={});function GQ(e,t){return e.credential?QN([e.realm],{origin:I.URL,page:t.page})?.rpId===e.credential.rpId:!1}var KQ=600,qQ=`sign-in-grant-held:`,JQ=3600,YQ=`sign-in-grant-spent:`,XQ;(function(e){e.held=A({assertion:pi().optional(),witness:Ci([`0x`,j()]).optional()})})(XQ||={});async function ZQ(e,t){await e.insert(K).values({expiresAt:new Date(Date.now()+KQ*1e3),id:crypto.randomUUID(),identifier:n$(t),value:JSON.stringify(XQ.held.parse({assertion:t.keySignature?.assertion,witness:t.keySignature?.witness}))})}function QQ(e){let t=[`client_id`,`redirect_uri`,`state`,`code_challenge`,`key_authorization`,`challenge`,`scope`].map(t=>e.get(t)??``);return xn(Hn(mn(JSON.stringify(t))))}async function $Q(e,t){let n=YQ+QQ(t.query),r=Number(t.query.get(`exp`));return await EN(e,{expiresAt:new Date(Number.isSafeInteger(r)&&r>0?r*1e3:Date.now()+JQ*1e3),identifier:n,value:`{}`})}async function e$(e,t){let[n]=await e.select({id:K.id}).from(K).where(qC(W(K.identifier,YQ+QQ(t.query)),XC(K.expiresAt,new Date))).limit(1);return n!==void 0}async function t$(e,t){let[n]=await e.delete(K).where(qC(W(K.identifier,n$(t)),XC(K.expiresAt,new Date))).returning({value:K.value});if(n)return XQ.held.parse(JSON.parse(n.value))}function n$(e){return`${qQ}${QQ(e.query)}:${e.sessionId}`}async function r$(e,t){let{clientId:n,codeChallenge:r,expiry:i,key:a,userId:o}=t,s={account:a.account,expiresAt:new Date(Math.min(Date.now()+6e5,i*1e3)),keyAuthorization:a.keyAuthorization,userId:o};await e.insert(OE).values({...s,clientId:n,codeChallenge:r}).onConflictDoUpdate({set:{...s,createdAt:new Date},setWhere:W(OE.userId,o),target:[OE.clientId,OE.codeChallenge]})}async function i$(e,t){let{clientId:n,codeChallenge:r,userId:i}=t,[a]=await e.delete(OE).where(qC(W(OE.clientId,n),W(OE.codeChallenge,r),XC(OE.expiresAt,new Date),W(OE.userId,i))).returning({account:OE.account,keyAuthorization:OE.keyAuthorization});if(a)return{account:a.account,keyAuthorization:a.keyAuthorization}}var a$=A({url:j().min(1)});async function o$(e,t){let{headers:n,oauthQuery:r,session:i}=t,a=await Y(e,e.var.auth.$context,`auth.context`);if(!await Y(e,$a(r,a.secret),`auth.verifyOAuthQueryParams`))return new vP;let o=new URLSearchParams(r);c$(o);let s=s$(o)?await Y(e,l$(e,{account:t.account,assertion:t.assertion,email:t.email,keySignature:t.keySignature,query:o,session:i,single:t.single,skipUpgrade:t.skipUpgrade}),`Consent.approveKey`):void 0;if(s instanceof $D)return s;if(s&&`options`in s)return{options:s.options};let c=await Y(e,e.var.auth.api.oauth2Consent({asResponse:!1,body:{accept:!0,oauth_query:r},headers:n,request:new Request(e.req.url,{headers:n,method:`POST`})}),`auth.oauth2Consent`).catch(e=>{if(za(e)&&e.body?.error===`invalid_signature`)return new vP;throw e});if(c instanceof $D)return c;let l=a$.parse(c).url,u=URL.parse(l)?.searchParams.get(`code`);return s&&u&&await Y(e,r$($,{clientId:s.clientId,codeChallenge:s.codeChallenge,expiry:s.expiry,key:{account:s.account,keyAuthorization:s.signed},userId:i.user.id}),`PendingKey.put`),{redirect:l}}(function(e){e.errors=[...UM.errors,...HQ.errors,...UQ.errors,...WQ.errors,vP,BM,rM,jN,LM]})(o$||={});function s$(e){return e.has(`key_authorization`)||e.has(`challenge`)}function c$(e){let t=URL.parse(e.get(`redirect_uri`)??``);if(!t||t.protocol!==`http:`&&t.protocol!==`https:`&&!ko(t))throw Error(`The app's redirect URI uses a refused scheme.`)}async function l$(e,t){let{keySignature:n,query:r,session:i}=t,a=WM(r);if(!a||a instanceof $D)return a;let o=r.get(`client_id`),s=r.get(`code_challenge`),c=await Y(e,ED($,{clientId:o}).catch(e=>{if(!(e instanceof yD))throw e}),`Apps.get`),l=UM({app:c,clientId:o,codeChallenge:s,key:a,query:r});if(l)return l;let u=await Y(e,HQ(e,{account:a.account??t.account,chainId:a.chainId,clientId:o,cookie:e.req.header(`cookie`),create:!0,email:t.email,passkey:!0,sessionId:i.session.id,single:t.single,skipUpgrade:t.skipUpgrade,userId:i.user.id}),`KeySigner.resolve`),d=t.skipUpgrade&&u instanceof BM?t.email:void 0,f=d===void 0?void 0:await Y(e,WQ(e,{clientId:o,credentialId:t.assertion?.id,email:d,userId:i.user.id}),`KeySigner.unlinked`),p=f||(d!==void 0&&t.assertion?new jN:u);if(p instanceof rM){let e=p.response.meta?.account;return new rM({account:e,description:`Passkey required: the passkey of Tempo Account ${e} signs only at its own relying party, which the approval page is not part of. Name another account, or deny the request.`})}if(p instanceof $D)return p;let m=n&&!SN(p.owner)&&p.owner.credential?.id===n.assertion.id?n:void 0,h=m?{...a,witness:m.witness}:a,g=m?.assertion??t.assertion;if(t.assertion&&p.owner.signer)return new jN;if(!g&&!p.owner.signer)return{options:await Y(e,BQ(e,{account:p.account,clientId:o,key:h,owner:p.owner,userId:i.user.id}),`KeySigner.challenge`)};let _=await Y(e,UQ(e,{account:p.account,assertion:p.owner.signer?void 0:g,challenge:m?`sign-in`:`stored`,clientId:o,key:h,owner:p.owner,userId:i.user.id}),`KeySigner.sign`);return _ instanceof $D?_:(f?await Y(e,f.link(),`KeySigner.link`):void 0)||{account:p.account,clientId:o,codeChallenge:s,expiry:h.expiry,signed:_}}async function u$(e,t){return await Y(e,p$(e,t),`SignInConsent.accountStep`).catch(n=>($s(e,{error:n,message:`An account step kept its redirect, since its grant failed.`}),{redirect:t.redirect}))}async function d$(e,t){return await Y(e,g$(e,t),`SignInConsent.signIn`).catch(n=>($s(e,{error:n,message:`A sign-in kept its redirect, since its grant failed.`}),t.redirect))}async function f$(e,t){let n=new URLSearchParams(t.oauthQuery);if(!n.has(`key_authorization`)||n.has(`challenge`)||MD(n.get(`client_id`)??``))return;let r=await Y(e,e.var.auth.$context,`auth.context`);if(!await Y(e,$a(t.oauthQuery,r.secret),`auth.verifyOAuthQueryParams`)||await Y(e,e$($,{query:n}),`SignInGrant.spent`))return;let i=WM(n);if(!i||i instanceof $D)return;let a=xn(crypto.getRandomValues(new Uint8Array(32)));return{digest:DM({key:{...i,witness:a}}),witness:a}}async function p$(e,t){let{account:n,assertion:r,headers:i,redirect:a,session:o}=t,s=URL.parse(a,I.URL);if(!s||s.origin!==new URL(I.URL).origin||s.pathname!==`/authorize`||s.searchParams.has(`challenge`))return{redirect:a};let c=await Y(e,t$($,{query:s.searchParams,sessionId:o.session.id}),`SignInGrant.take`);if(!c)return{redirect:a};let l=await m$(e,{account:n,assertion:r,headers:i,keySignature:(()=>{let e=BN.assertion.safeParse(c.assertion);if(e.success&&c.witness)return{assertion:e.data,witness:c.witness}})(),redirect:a,session:o,url:s});return`options`in l&&await Y(e,ZQ($,{keySignature:c.witness?{assertion:c.assertion,witness:c.witness}:void 0,query:s.searchParams,sessionId:o.session.id}),`SignInGrant.hold`),l}async function m$(e,t){let{headers:n,redirect:r,session:i,url:a}=t;if(await Y(e,Z(e,{limits:[{binding:`AUTHORIZE_LIMIT`,key:i.user.id}]}),`RateLimit.check`))return{redirect:r};let o=await Y(e,o$(e,{account:t.account,assertion:t.assertion,headers:n,keySignature:t.keySignature,oauthQuery:a.search.slice(1),session:i,single:!0}),`Consent.approve`).catch(t=>{$s(e,{error:t,message:`A sign-in could not grant the key that the sign-in page showed.`})});return!o||o instanceof $D?{redirect:r}:`options`in o?{options:o.options}:{redirect:o.redirect}}function h$(e,t){let n=new Map((e.req.header(`cookie`)??``).split(`;`).map(e=>e.trim()).filter(Boolean).map(e=>{let t=e.indexOf(`=`);return[e.slice(0,t),e.slice(t+1)]}));for(let e of t.setCookie){let[t=``]=e.split(`;`),r=t.indexOf(`=`);r>0&&n.set(t.slice(0,r).trim(),t.slice(r+1))}let r=new Headers(e.req.raw.headers);return r.set(`cookie`,[...n].map(([e,t])=>`${e}=${t}`).join(`; `)),r}async function g$(e,t){let{keySignature:n,redirect:r,setCookie:i}=t,a=URL.parse(r,I.URL);if(!a||a.origin!==new URL(I.URL).origin||a.pathname!==`/authorize`&&a.pathname!==`/choose-account`)return r;let o=a.searchParams;if(!o.has(`key_authorization`)||o.has(`challenge`)||MD(o.get(`client_id`)??``))return r;let s=h$(e,{setCookie:i}),c=e.var.newSession;if(!c||!await Y(e,$Q($,{query:o}),`SignInGrant.spend`))return r;if(a.pathname===`/choose-account`)return await Y(e,ZQ($,{keySignature:n,query:o,sessionId:c.session.id}),`SignInGrant.hold`),r;let l=await m$(e,{headers:s,keySignature:n,redirect:r,session:c,url:a});return`options`in l?r:l.redirect}var _$=`Tempo-Id-Signed-In`,v$={pad:!1,url:!0},y$=A({url:j().min(1)});async function b$(e,t){let{clientId:n}=t;return e.var.firstParty?.find(e=>e.clientId===n)||await Y(e,ED($,{clientId:n,enabled:!0}).catch(e=>{if(!(e instanceof yD))throw e}),`Apps.get`)}function x$(e,t){return HM(e,t)??E$(e,{secret:!!t.app?.secret})}(function(e){e.errors=[...HM.errors,BM]})(x$||={});async function S$(e,t){let{headers:n,keySignature:r,passkey:i,request:a,session:o}=t,s=t.create??!!r,c=a.client_id,l=n.get(`cookie`)??void 0,u=E$(a,{secret:t.secret});if(u)return u;let d=a.key_authorization,f=await Y(e,Z(e,{limits:[{binding:`AUTHORIZE_LIMIT`,key:o.user.id},...s&&d&&!d.account?[{binding:`ACCOUNT_LIMIT`,key:o.user.id}]:[]]}),`RateLimit.check`);if(f)return f;let p=d?await Y(e,HQ(e,{account:d.account,chainId:d.chainId,clientId:c,cookie:l,create:s,email:o.user.email,page:i?new URL(a.redirect_uri).origin:void 0,passkey:!!i,sessionId:o.session.id,signInCredential:r?.assertion.id,skipUpgrade:a.skip_upgrade&&!!(r||i),userId:o.user.id}),`KeySigner.resolve`):void 0;if(p instanceof $D)return p;let m=r&&p&&!SN(p.owner)&&p.owner.credential?.id===r.assertion.id?r:void 0,h=d&&m?{...d,witness:m.witness}:d;if(h&&p&&!p.owner.signer&&!m&&!i?.assertion)return{expiry:h.expiry,options:await Y(e,BQ(e,{account:p.account,clientId:c,key:h,owner:p.owner,userId:o.user.id}),`KeySigner.challenge`)};let g=await(async()=>{if(p)return p.account;let t=await Y(e,mQ(e,{chainId:d?.chainId===void 0?void 0:Number(d.chainId),clientId:c,userId:o.user.id}),`AccountStep.accounts`).catch(t=>($s(e,{error:t,fields:{clientId:c},message:`The headless authorization skipped an account selection whose accounts failed to load.`}),[]));return bQ(t,TQ({clientId:c,cookie:l,sessionId:o.session.id}))?.address??t[0]?.address})(),_=g?wQ({account:g.toLowerCase(),clientId:c,cookie:l,sessionId:o.session.id}):void 0,v=new Headers(n);_&&v.set(`cookie`,_.header),e.set(`accountChosen`,!0);let y=a.code_challenge?void 0:sr(_n(32),v$),b={client_id:c,code_challenge:a.code_challenge??sr(Hn(mn(y)),v$),code_challenge_method:`S256`,redirect_uri:a.redirect_uri,resource:I.URL,response_type:`code`,scope:a.scope??`openid`,...a.state?{state:a.state}:{}},x=new URL(`/oauth2/authorize`,I.URL);x.search=new URLSearchParams(b).toString(),v.set(`accept`,`application/json`);let S=await Y(e,e.var.auth.api.oauth2Authorize({asResponse:!1,body:{},headers:v,query:b,request:new Request(x,{headers:v})}),`auth.oauth2Authorize`),C=y$.safeParse(S),w=C.success?URL.parse(C.data.url,I.URL):null,T=new URL(a.redirect_uri).searchParams,E=w?.searchParams.get(`code`);if(!w||!E||w.searchParams.getAll(`error`).length>T.getAll(`error`).length||!`${w.origin}${w.pathname}`.startsWith(new URL(a.redirect_uri).origin))return new BM({description:`Authorization refused: the app's request needs the user's approval, which no page shows here. Authorize through a redirect, or register the app to skip consent.`});let[D,ee]=await Promise.allSettled([h&&p?Y(e,UQ(e,{account:p.account,assertion:m?.assertion??i?.assertion,challenge:m?`sign-in`:`stored`,clientId:c,key:h,origin:m?.origin??(i?new URL(a.redirect_uri).origin:void 0),owner:p.owner,userId:o.user.id}),`KeySigner.sign`):void 0,y?Y(e,e.var.auth.api.oauth2Token({body:{client_id:c,code:E,code_verifier:y,grant_type:`authorization_code`,redirect_uri:a.redirect_uri,resource:I.URL},headers:new Headers({"content-type":`application/x-www-form-urlencoded`})}),`auth.oauth2Token`):void 0]);if(D.status===`rejected`)throw D.reason;let te=D.value;if(te instanceof $D)return te;let ne=te&&p?.owner.linked&&!p.owner.configurable&&aF({chainId:Number(d.chainId),env:I}),re={...g&&te?{account:g,key_authorization:te}:{},...a.state?{state:a.state}:{},...ne?{upgrade_available:!0}:{}};if(_&&(d?.account||m)&&e.header(`set-cookie`,_.setCookie,{append:!0}),e.header(`cache-control`,`no-store`),!y)return{...re,code:E};if(ee.status===`rejected`)throw ee.reason;return{...re,tokens:VM.tokens.parse(ee.value)}}(function(e){e.errors=[...HQ.errors,...UQ.errors,BM]})(S$||={});async function C$(e,t){let{app:n,email:r,passkey:i,request:a,setCookie:o}=t,s=e.var.newSession;if(!s)throw Error(`The sign-in session is missing.`);return await Y(e,S$(e,{create:!0,headers:h$(e,{setCookie:o}),passkey:i?{}:void 0,request:a,secret:!!n.secret,session:{...s,user:{...s.user,email:r}}}),`Headless.authorize`)}(function(e){e.errors=S$.errors})(C$||={});async function w$(e,t){let{assertion:n,challenge:r,email:i,setCookie:a}=t,o=VM.request.parse(r.authorize),s=await Y(e,b$(e,{clientId:o.client_id}),`Headless.app`),c=HM(o,{app:s,origin:e.req.header(`origin`)});if(c)return c;let l=h$(e,{setCookie:a}),u=e.var.newSession;if(!u)throw Error(`The sign-in session is missing.`);let d=await Y(e,S$(e,{headers:l,keySignature:r.witness&&r.origin?{assertion:n,origin:r.origin,witness:r.witness}:void 0,request:o,secret:!!s.secret,session:{...u,user:{...u.user,email:i}}}),`Headless.authorize`);if(`options`in d)throw Error(`The passkey step is unexpected.`);return d}(function(e){e.errors=[...HM.errors,...S$.errors]})(w$||={});async function T$(e,t){let{assertion:n,challenge:r}=t;if(r.authorize===void 0)return!0;let i=VM.request.parse(r.authorize);return i.key_authorization?i.key_authorization.expiry<=Date.now()/1e3?!1:await Y(e,lP($,{authenticatorData:n.metadata.authenticatorData,expiry:i.key_authorization.expiry,signature:n.signature}),`Passkey.spendSignIn`):!0}function E$(e,t){if(!e.code_challenge&&t.secret)return new BM({description:"Tokens refused: the app holds a client secret, so its backend redeems a code. Send `code_challenge`, then redeem the code with the secret."})}var D$=[...WI,jQ],O$=7200,k$=new Set([`/v1/account`,`/v1/account/upgrade`,`/v1/auth/code`,`/v1/auth/code/verify`,`/v1/auth/logout`,`/v1/auth/passkey/options`,`/v1/auth/passkey/verify`,`/v1/auth/session`,`/v1/authorize`,`/v1/realms`]);function A$(e){let t=e.req.header(`origin`);if(t&&![new URL(I.URL).origin,new URL(e.req.url).origin].includes(t))return t}var j$=TP(async(e,t)=>{if(!k$.has(e.req.path))return t();let n=A$(e),r=![`GET`,`HEAD`,`OPTIONS`].includes(e.req.method),i=n!==void 0&&await Y(e,(async()=>{if(r){let t=await TD($,{origin:n});return e.set(`firstParty`,t),t.length>0}return await UP(e,async()=>(await TD($,{origin:n})).length>0,[`apps.firstPartyOrigin`,n],{keep:e=>e})})(),`Apps.firstPartyOrigin`);return n&&!i&&r?J(e,new eO):kQ({credentials:!0,exposeHeaders:[...D$,_$],maxAge:O$,origin:()=>i?n:null})(e,t)}),M$=kQ({exposeHeaders:D$});function N$(e){let t=e.req.header(`sec-fetch-site`);if(t!==`same-origin`&&(t!==void 0||!e.req.header(`origin`)||A$(e)))return new eO}(function(e){e.errors=[eO]})(N$||={});function P$(e,t){if(t.oauth_query&&A$(e))return new eO}(function(e){e.errors=[eO]})(P$||={});async function F$(e){let t=await Y(e,e.var.auth.api.signOut({headers:new Headers,returnHeaders:!0}),`auth.signOut`);for(let n of t.headers.getSetCookie())e.header(`set-cookie`,n,{append:!0})}async function I$(e){let t=await Y(e,e.var.auth.api.getSession({headers:e.req.raw.headers,returnHeaders:!0}),`auth.getSession`);for(let n of t.headers.getSetCookie())e.header(`set-cookie`,n,{append:!0});return t.response}async function L$(e){let t=await Y(e,e.var.auth.$context,`auth.context`);return await Y(e,FF(e,t.secret,t.authCookies.sessionToken.name),`cookie.verify`)||void 0}var R$;(function(e){let t=Ci([`0x`,j().regex(/^[0-9a-fA-F]{40}$/)]),n;(function(e){e.query=A({chain:Pj.optional().meta({description:"The chain whose balance each account carries: `mainnet`, `testnet`, or another chain that the deployment lists. Without it, the accounts carry no balance.",examples:[`testnet`]}),client_id:j().min(1).max(255).optional().meta({description:"The app's client ID, whose realms select the accounts. A browser page from an origin that none of the app's redirect URIs has receives the `default` realm, as does a request without one.",examples:[`client_01JZ8Q6W3N1R5B4V7C2X9K0M3T`]})}),e.response=A({email:Li().meta({description:`The user's email address.`,examples:[`ada@example.com`]}),id:j().meta({description:"The user's ID, which is the `sub` of every token Tempo ID issues for the user.",examples:[`user_01JZ8Q6W3N1R5B4V7C2X9K0M3T`]}),name:j().nullable().meta({description:"The user's name, or `null` for a user who signed up without one.",examples:[`Ada Lovelace`]}),passkeys:Pi().meta({description:"Whether the realms the request reaches hold passkeys that sign in at Tempo ID's origin. Without `client_id`, the `default` realm's, where `POST /v1/account/passkey/options` registers a passkey.",examples:[!0]}),tempo:Gi(sX.tempoAccount.extend({balance:NP.balance.nullable().optional().meta({description:"The USD value of the account's verified holdings on the chain that `chain` names, or absent without `chain`. `null` when the chain has no Tempo API URL, or the read fails or takes longer than 3 seconds."})})).readonly().meta({description:`The user's Tempo Accounts in the realms the request reaches: the account that the user selected for the app first, then oldest first.`})}).meta({id:`Account`})})(n||=e.account||={});let r;(function(e){e.json=n.query,e.response=n.response})(r||=e.create||={});let i;(function(e){e.json=A({}),e.response=A({options:A({publicKey:A({attestation:oa(`none`).meta({description:`Tempo ID requests no attestation statement from the authenticator.`}),authenticatorSelection:A({requireResidentKey:oa(!0).meta({description:`The passkey must be discoverable, so it signs in without an email.`}),residentKey:oa(`required`).meta({description:`The passkey must be discoverable, so it signs in without an email.`}),userVerification:oa(`required`).meta({description:`Every passkey registration requires user verification.`})}).meta({description:`The authenticator that the passkey requires.`}),challenge:Ci([`0x`,j()]).meta({description:`The single-use challenge, as hex. It expires after 5 minutes, and only the same user spends it.`,examples:[`0xf6310589abb21116acc6e123967ed0a125b5041c43f8e157237093e07eaa354c`]}),excludeCredentials:Gi(A({id:j().meta({description:`A credential ID, base64url.`,examples:[`KEbWNCc7NgaYnUyrNeFGX9_3Y-8`]}),type:oa(`public-key`).meta({description:`The credential type.`})}).meta({description:`A passkey that the user holds already.`})).optional().meta({description:`The user's passkeys of the relying party, which an authenticator that holds one of them refuses to replace. Absent for a user with none.`}),pubKeyCredParams:Gi(A({alg:oa(-7).meta({description:`ES256: ECDSA over P-256 with SHA-256.`}),type:oa(`public-key`).meta({description:`The credential type.`})}).meta({description:`The only key type that a Tempo Account accepts.`})).meta({description:`The key types the passkey may use: P-256 alone, which a Tempo Account verifies.`}),rp:A({id:j().meta({description:"The relying party ID of the `default` realm.",examples:[`tempo.xyz`]}),name:j().meta({description:"The `default` realm's display name.",examples:[`Tempo`]})}).meta({description:`The relying party.`}),user:A({displayName:j().meta({description:`The user's name, or the email address for a user without one.`,examples:[`Ada Lovelace`]}),id:j().meta({description:`A random user handle for this passkey, base64url, so a new passkey never replaces another in the authenticator.`,examples:[`3q2-7wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA`]}),name:Li().meta({description:`The user's email address.`,examples:[`ada@example.com`]})}).meta({description:`The user, as the authenticator labels the passkey.`})}).meta({description:"The `PublicKeyCredentialCreationOptions`, serialized with the challenge as hex."})}).meta({description:"The options for `navigator.credentials.create()`."})})})(i||=e.passkeyOptions||={});let a;(function(e){e.json=A({credential:BN.credential}),e.response=A({step:A({options:A({publicKey:A({allowCredentials:Gi(A({id:BN.credentialId.meta({description:`The credential ID of the new passkey, base64url.`,examples:[`KEbWNCc7NgaYnUyrNeFGX9_3Y-8`]}),type:oa(`public-key`).meta({description:`The credential type.`})}).meta({description:`The new passkey.`})).meta({description:`The new passkey, the only one the browser offers.`}),challenge:Ci([`0x`,j()]).meta({description:`The single-use proof challenge, as hex. It expires after 5 minutes, and only the same user spends it.`,examples:[`0xf6310589abb21116acc6e123967ed0a125b5041c43f8e157237093e07eaa354c`]}),rpId:j().meta({description:"The relying party ID of the `default` realm.",examples:[`tempo.xyz`]}),userVerification:oa(`required`).meta({description:`Every passkey signature requires user verification.`})}).meta({description:"The `PublicKeyCredentialRequestOptions`, serialized with the challenge as hex."})}).meta({description:"The options for `navigator.credentials.get()`."}),type:oa(`passkey`).meta({description:"Sign the options with the new passkey, then send the assertion to `POST /v1/account/passkey/verify`."})}).meta({description:`The next step: the new passkey's signature, which proves that the authenticator holds its private key.`})})})(a||=e.passkey||={});let o;(function(e){e.json=A({account:t.optional().meta({description:"A configurable Tempo Account that the user's cloud wallet owns in the `default` realm, which the passkey joins as a second owner on `chain`. Absent, the passkey owns an account of its own.",examples:[`0x7a3f9c2b1e5d8a4f6c0b3e7d9a2f5c8b1e4d7a0f`]}),assertion:BN.assertion,chain:Pj.optional().meta({description:"The chain whose accounts are configurable, where `account` is, and whose address of the passkey's own account the response returns. Without it, the first such chain for `account`, and the passkey's own address otherwise.",examples:[`local`]})}),e.response=A({address:j().meta({description:"The address of the Tempo Account that the passkey owns: `account`, or the passkey's own account on `chain`.",examples:[`0x7a3f9c2b1e5d8a4f6c0b3e7d9a2f5c8b1e4d7a0f`]}),id:BN.credentialId.meta({description:`The credential ID of the passkey, base64url.`,examples:[`KEbWNCc7NgaYnUyrNeFGX9_3Y-8`]})})})(o||=e.passkeyVerify||={});let s;(function(e){e.query=n.query.omit({chain:!0}),e.response=A({passkeys:Pi().meta({description:"Whether a passkey sign-in for the app runs on the page that sends the request, at a relying party of the app's realms. `false` without `client_id`, or for Tempo ID's own page.",examples:[!0]}),realms:Gi(sX.realm).readonly().meta({description:`The realms the app reaches, never empty. The first holds a user's first account.`})})})(s||=e.realms||={});let c;(function(e){let t=e.entry=A({chainId:Ti().int().meta({description:`The ID of the Tempo chain that serves the name.`,examples:[42431]}),configurable:Pi().meta({description:`Whether Tempo Accounts can be upgraded to configurable accounts (TIP-1107) on the chain, as the deployment sets.`,examples:[!1]}),name:Pj.meta({description:"The name that the `chain` parameter carries.",examples:[`testnet`]})}).meta({description:`A chain that a page can select.`});e.response=A({chains:Gi(t).readonly().meta({description:"The chains in order: `mainnet`, `testnet`, then the deployment's listed chains."})})})(c||=e.chains||={});let l;(function(e){e.response=A({chains:Gi(c.entry.extend({faucet:Pi().meta({description:"Whether `POST /i/account/fund` funds an account on the chain, which every Tempo chain but mainnet offers.",examples:[!0]})}).meta({description:`A chain that a page can select.`})).readonly().meta({description:"The chains in order: `mainnet`, `testnet`, then the deployment's listed chains."})})})(l||=e.pageChains||={});let u;(function(e){e.response=A({chains:Gi(A({api:Qi([`down`,`none`,`up`]).meta({description:"Whether the chain's Tempo API responds on `/health`: `up`, `down`, or `none` when `TEMPO_API_URLS` lists none for the chain.",examples:[`up`]}),chainId:Ti().int().meta({description:`The ID of the Tempo chain that serves the name.`,examples:[1337]}),name:Pj.meta({description:"The name that the `chain` parameter carries.",examples:[`local`]}),node:Qi([`down`,`up`]).meta({description:"Whether the chain's node serves the chain ID: `up`, or `down` when it does not respond or serves another.",examples:[`up`]})}).meta({description:`The status of a listed chain.`})).readonly().meta({description:"The deployment's listed chains in order, apart from `mainnet` and `testnet`."})})})(u||=e.chainStatus||={});let d;(function(e){e.json=A({address:Ci([`0x`,j().regex(/^[0-9a-fA-F]{40}$/)]).meta({description:"The Tempo Account that receives the tokens, one of the user's accounts in the `default` realm.",examples:[`0x7a3f9c2b1e5d8a4f6c0b3e7d9a2f5c8b1e4d7a0f`],pattern:`^0x[0-9a-fA-F]{40}$`}),chain:Pj.meta({description:"The test chain whose faucet drips the tokens: `testnet`, or a name that `GET /i/chains` lists. Tempo mainnet has no faucet.",examples:[`testnet`]})}),e.response=A({transactions:Gi(Ci([`0x`,j().regex(/^[0-9a-f]{64}$/)]).meta({description:`The hash of one transfer from the faucet.`,examples:[`0x5c504ed432cb51138bcf09aa5e8a410dd4a1e204ef84bfed1be16dfba1b22060`]})).readonly().meta({description:`The hashes of the transfers, one for each token that the faucet drips, each one landed.`,examples:[[`0x5c504ed432cb51138bcf09aa5e8a410dd4a1e204ef84bfed1be16dfba1b22060`]]})})})(d||=e.fund||={});let f;(function(e){e.json=A({account:t.optional().meta({description:"One of the user's Tempo Accounts in the app's realms on `chain`, which a linked wallet.tempo passkey owns and the upgrade makes configurable. Absent with `credentialId`.",examples:[`0x7a3f9c2b1e5d8a4f6c0b3e7d9a2f5c8b1e4d7a0f`]}),chain:Pj.optional().meta({description:`The chain whose accounts are configurable, where the upgrade runs. Defaults to the first such chain that the deployment names.`,examples:[`local`]}),client_id:j().min(1).max(255).optional().meta({description:"The app whose realms hold the account. Without it, the `default` realm.",examples:[`client_01JZ8Q6W3N1R5B4V7C2X9K0M3T`]}),credentialId:BN.credentialId.optional().meta({description:"A wallet.tempo passkey of the user's email that has not linked to the user yet, as `GET /i/account/passkeys` lists it. Its assertion over the upgrade links it. Absent with `account`. Only Tempo ID's own page sends it.",examples:[`KEbWNCc7NgaYnUyrNeFGX9_3Y-8`]}),key:A({signature:Ci([`0x`,j().regex(/^[0-9a-fA-F]*$/)]).refine(U$,{message:`Expected the serialized signature envelope of a secp256k1, P256, or WebAuthn access key`}).meta({description:"The access key's raw signature over `step.key.digest`, as a serialized signature envelope.",examples:[`0x997c61aa10e2330c076d6ba7abca1e71703a8f039291db103a62e085c9b2cf0d3f7e31ec9028229acc83093fbb722fa700fd6e4ea15d584df1bf384eb0051e0d1c`]})}).optional().meta({description:"The access key's signature of its registration, on the repeated request of a step with `key`."}),key_authorization:uM.rpc.optional().meta({description:"A key that the passkey signed as the account's own key, such as with `skip_upgrade`, on the first request. The chain registers it before the upgrade, so it keeps working after. Its chain is the upgrade's when `chain` is absent."}),passkey:A({assertion:BN.assertion}).optional().meta({description:`The passkey step's result: the passkey's assertion over the step's challenge. Absent on the first request.`})}).refine(e=>e.account===void 0!=(e.credentialId===void 0),{message:"Name exactly one of `account` or `credentialId`.",path:[`account`]}),e.response=Ui([A({account:sX.tempoAccount}).meta({description:`The installed configuration.`}),A({step:A({options:A({publicKey:A({allowCredentials:Gi(A({id:BN.credentialId.meta({description:`The credential ID of the account's passkey, base64url.`,examples:[`KEbWNCc7NgaYnUyrNeFGX9_3Y-8`]}),type:oa(`public-key`).meta({description:`The credential type.`})}).meta({description:`The account's passkey.`})).meta({description:`The account's passkey, the only one the browser offers.`}),challenge:Ci([`0x`,j()]).meta({description:`The digest of the transaction that installs the configuration, as hex. It expires after 5 minutes, and only the same user spends it.`,examples:[`0xf6310589abb21116acc6e123967ed0a125b5041c43f8e157237093e07eaa354c`]}),rpId:j().meta({description:`The passkey's relying party ID.`,examples:[`tempo.xyz`]}),userVerification:oa(`required`).meta({description:`Every passkey signature requires user verification.`})}).meta({description:"The `PublicKeyCredentialRequestOptions`, serialized with the challenge as hex."})}).meta({description:"The options for `navigator.credentials.get()`."}),key:A({digest:Ci([`0x`,j()]).meta({description:`The digest of the transaction that registers the key, which the access key signs raw. Tempo ID sponsors the transaction.`,examples:[`0x3c8a5e1f0b7d2c946a1e8f3b5d7c9a2e4f6b8d0c1e3a5f7b9d2c4e6a8f0b1d3c`]})}).optional().meta({description:"The key's registration, for a request with `key_authorization` whose key the chain does not hold yet. Repeat the request with `key.signature` too."}),type:oa(`passkey`).meta({description:"Sign the options with the passkey, then repeat the request with `passkey.assertion`."})}).meta({description:`The next step: the passkey's signature of the transaction, since only the passkey signs for the account.`})}).meta({description:`The passkey step.`})])})(f||=e.upgrade||={});let p;(function(e){e.response=A({passkeys:Gi(A({address:t.meta({description:`The address of the passkey's Tempo Account, which its public key derives.`,examples:[`0x7a3f9c2b1e5d8a4f6c0b3e7d9a2f5c8b1e4d7a0f`]}),credentialId:BN.credentialId.meta({description:`The credential ID of the passkey, base64url.`,examples:[`KEbWNCc7NgaYnUyrNeFGX9_3Y-8`]})}).meta({description:`A wallet.tempo passkey of the email.`})).readonly().meta({description:`The passkeys that wallet.tempo stores for the user's email and that link to no user yet, oldest first. Empty without the wallet service.`})})})(p||=e.passkeys||={});let m;(function(e){e.query=A({chain:Pj.meta({description:`The chain to list upgrades on, such as the chain that the sign-in page shows. A chain whose accounts are not configurable lists none.`,examples:[`t14`]})});let n=Pj.meta({description:"The name of the chain where the upgrade applies, which `CONFIGURABLE_ACCOUNTS` names.",examples:[`t14`]});e.response=A({upgrades:Gi(Ui([A({account:t.meta({description:"The linked wallet.tempo passkey's account, which `POST /v1/account/upgrade` takes as `account`.",examples:[`0x7a3f9c2b1e5d8a4f6c0b3e7d9a2f5c8b1e4d7a0f`]}),chain:n}).meta({description:`A linked wallet.tempo passkey's account that is not configurable on the chain.`}),A({chain:n,credentialId:BN.credentialId.meta({description:"The credential ID of the wallet.tempo passkey, which `POST /v1/account/upgrade` takes as `credentialId`.",examples:[`KEbWNCc7NgaYnUyrNeFGX9_3Y-8`]})}).meta({description:`A wallet.tempo passkey of the email that links to no user, whose upgrade links it.`})])).readonly().meta({description:`The upgrades, linked accounts first, in the order of the chains. Empty without a chain whose accounts are configurable.`})})})(m||=e.upgrades||={})})(R$||={});var z$=2e3,B$=new Jl().get(`/v1/account`,DI({description:"Reads the signed-in user and their Tempo Accounts in the realms of the app that `client_id` names, or of the `default` realm. The account that the user selected for the app comes first, then the oldest.",responses:II({errors:[...X.errors,...Z.errors,...uX.errors,xP,eO],success:{description:`The user and their Tempo Accounts.`,schema:R$.account.response}}),security:[{sessionCookie:[]}],tags:[`Account`]}),X(`query`,R$.account.query),async e=>{if(e.req.header(`sec-fetch-site`)===`cross-site`)return J(e,new eO);let t=await Y(e,I$(e),`Session.get`);if(!t)return J(e,new xP);let{chain:n}=e.req.valid(`query`),r=n?Ws({name:n,rpcUrl:I.TEMPO_RPC_URL,rpcUrls:I.RPC_URLS}):void 0;if(n&&!r)return J(e,Z$({chain:n}));let i=await Y(e,Z(e,{limits:[{binding:`ACCOUNT_LIMIT`,key:t.user.id}]}),`RateLimit.check`);if(i)return i;let a=await Y(e,WL(e,{clientId:e.req.valid(`query`).client_id,db:$,origin:e.req.header(`origin`),own:new URL(I.URL).origin}),`Realm.forRequest`),o=await Y(e,JL(e,{db:$,origin:I.URL,realms:a}),`Realm.withDefaults`),s=await Y(e,uX(e,{chainId:r?.chainId,db:$,env:I,realms:o,userId:t.user.id}),`TempoAccount.list`),{client_id:c}=e.req.valid(`query`),l=c?SQ(s,{clientId:c,cookie:e.req.header(`cookie`),sessionId:t.session.id}):s,u=r?await Y(e,FP(e,{accounts:l,apiUrl:Ij({apiUrls:I.TEMPO_API_URLS,chainId:r.chainId}),chainId:r.chainId}),`Balance.list`):void 0;return e.header(`cache-control`,`private, no-store`),e.json({email:t.user.email,id:t.user.id,name:t.user.name||null,passkeys:!!QN(o,{origin:I.URL}),tempo:l.map((e,t)=>u?{...e,balance:u[t]??null}:e)},200)}).post(`/v1/account`,DI({description:"Returns the signed-in user and their Tempo Accounts, as `GET /v1/account` does. For a user with no account or passkey, it also creates a Privy-owned account in the first realm, when that realm has a Privy app. The JSON body needs a CORS preflight, which Tempo ID grants only to the origins of first-party apps.",responses:II({errors:[...zP,...X.errors,...Z.errors,...cX.errors,xP,eO],success:{description:`The user and their Tempo Accounts.`,schema:R$.create.response}}),security:[{sessionCookie:[]}],tags:[`Account`]}),X(`json`,R$.create.json),async e=>{let t=await Y(e,I$(e),`Session.get`);if(!t)return J(e,new xP);let{chain:n}=e.req.valid(`json`),r=n?Ws({name:n,rpcUrl:I.TEMPO_RPC_URL,rpcUrls:I.RPC_URLS}):void 0;if(n&&!r)return J(e,Z$({chain:n}));let i=await Y(e,Z(e,{limits:[{binding:`ACCOUNT_LIMIT`,key:t.user.id}]}),`RateLimit.check`);if(i)return i;let a=await Y(e,WL(e,{clientId:e.req.valid(`json`).client_id,db:$,origin:e.req.header(`origin`),own:new URL(I.URL).origin}),`Realm.forRequest`),o=await Y(e,JL(e,{db:$,origin:I.URL,realms:a}),`Realm.withDefaults`),s=await Y(e,tQ(e,{email:t.user.email,realms:o,userId:t.user.id}),`Configure.awaitsUpgrade`),c={chainId:r?.chainId,db:$,env:I,realms:o,userId:t.user.id},l=(await Y(e,s?lX(e,c):cX(e,c),`TempoAccount.create`)).map(_X),{client_id:u}=e.req.valid(`json`),d=u?SQ(l,{clientId:u,cookie:e.req.header(`cookie`),sessionId:t.session.id}):l,f=r?await Y(e,FP(e,{accounts:d,apiUrl:Ij({apiUrls:I.TEMPO_API_URLS,chainId:r.chainId}),chainId:r.chainId}),`Balance.list`):void 0;return e.header(`cache-control`,`private, no-store`),e.json({email:t.user.email,id:t.user.id,name:t.user.name||null,passkeys:!!QN(o,{origin:I.URL}),tempo:d.map((e,t)=>f?{...e,balance:f[t]??null}:e)},200)}).post(`/v1/account/passkey/options`,DI({description:"Issues a single-use registration challenge for the signed-in user, and returns creation options for a passkey of the `default` realm. Requires a sign-in within the last 10 minutes and fewer than 10 passkeys. Only Tempo ID's own page sends the request.",responses:II({errors:[...zP,...X.errors,...Z.errors,xP,eO,DN,kN,AN],success:{description:`The creation options.`,schema:R$.passkeyOptions.response}}),security:[{sessionCookie:[]}],tags:[`Account`]}),X(`json`,R$.passkeyOptions.json),async e=>{if(A$(e))return J(e,new eO);let t=await Y(e,I$(e),`Session.get`);if(!t)return J(e,new xP);if(!Q$(t))return J(e,new AN);let n=await Y(e,Z(e,{limits:[{binding:`ACCOUNT_LIMIT`,key:t.user.id}]}),`RateLimit.check`);if(n)return n;let r=t.user.id,i=await Y(e,qN($,{userId:r}),`Passkey.list`);if(i.filter(e=>e.registered).length>=10)return J(e,new DN);let a=await Y(e,JL(e,{db:$,origin:I.URL,realms:[await Y(e,UP(e,()=>KL($,{id:VL}),[`realm.get`,VL]),`Realm.get`)]}),`Realm.withDefaults`),o=QN(a,{origin:I.URL}),s=a.find(e=>e.id===o?.realmId);if(!o||!s)return J(e,new kN);let c=await Y(e,eP($,{rpId:o.rpId,userId:r}),`Passkey.requestRegistration`),l=i.flatMap(e=>e.rpId===o.rpId?[e.id]:[]),u=R$.passkeyOptions.response.shape.options.parse(em({authenticatorSelection:{requireResidentKey:!0,residentKey:`required`,userVerification:`required`},challenge:c,...l.length>0?{excludeCredentialIds:l}:{},rp:{id:o.rpId,name:s.name},user:{displayName:t.user.name||t.user.email,id:crypto.getRandomValues(new Uint8Array(32)),name:t.user.email}}).options);return e.header(`cache-control`,`private, no-store`),e.json({options:u},200)}).post(`/v1/account/passkey`,DI({description:"Verifies a new passkey's credential over a challenge from `POST /v1/account/passkey/options`, and returns a proof challenge for the passkey to sign. The attestation carries no signature, so only `POST /v1/account/passkey/verify` stores the passkey. Requires a sign-in within the last 10 minutes. Only Tempo ID's own page sends the request.",responses:II({errors:[...zP,...cO.errors,...X.errors,...Z.errors,xP,eO,DN,AN,jN],success:{description:`The proof step.`,schema:R$.passkey.response}}),security:[{sessionCookie:[]}],tags:[`Account`]}),X(`json`,R$.passkey.json),async e=>{if(A$(e))return J(e,new eO);let t=await Y(e,I$(e),`Session.get`);if(!t)return J(e,new xP);if(!Q$(t))return J(e,new AN);let n=await Y(e,Z(e,{limits:[{binding:`ACCOUNT_LIMIT`,key:t.user.id}]}),`RateLimit.check`);if(n)return n;let{credential:r}=e.req.valid(`json`),i=t.user.id,a=await Y(e,cP($,{clientDataJSON:r.clientDataJSON,userId:i}),`Passkey.takeRegistration`),o=a?_P(r,{challenge:a.challenge,origin:new URL(I.URL).origin,rpId:a.rpId}):void 0;if(!a||!o)return J(e,new jN);let[s,c]=await Promise.all([(async()=>{if(e.env.WALLET)try{return await Y(e,yX(e.env.WALLET,{id:o.id}),`Wallet.credential`)}catch(t){return $s(e,{error:t,message:`The wallet service failed a passkey lookup.`}),t instanceof Error&&cO(t)||new aO}})(),Y(e,YN($,{userId:i}),`Passkey.registered`)]);if(s instanceof $D)return J(e,s);if(s)return J(e,new jN);if(c>=10)return J(e,new DN);let l=await Y(e,$N($,{credential:o,rpId:a.rpId,userId:i}),`Passkey.requestProof`),u=R$.passkey.response.shape.step.shape.options.parse(Xp({challenge:l,credentialId:[o.id],rpId:a.rpId,userVerification:`required`}).options);return e.header(`cache-control`,`private, no-store`),e.json({step:{options:u,type:`passkey`}},200)}).post(`/v1/account/passkey/verify`,DI({description:"Registers a passkey for the signed-in user with its assertion over the proof challenge. The passkey owns its own Tempo Account in the `default` realm, or joins `account` as a second owner. Requires a sign-in within the last 10 minutes. Only Tempo ID's own page sends the request.",responses:II({errors:[...zP,...ZZ.errors,...oQ.errors,...X.errors,...Z.errors,JP,YP,xP,eO,DN,AN,jN],success:{description:`The passkey and the address of the account it owns.`,schema:R$.passkeyVerify.response}}),security:[{sessionCookie:[]}],tags:[`Account`]}),X(`json`,R$.passkeyVerify.json),async e=>{if(A$(e))return J(e,new eO);let t=await Y(e,I$(e),`Session.get`);if(!t)return J(e,new xP);if(!Q$(t))return J(e,new AN);let n=await Y(e,Z(e,{limits:[{binding:`ACCOUNT_LIMIT`,key:t.user.id}]}),`RateLimit.check`);if(n)return n;let{assertion:r}=e.req.valid(`json`),i=t.user.id,a=await Y(e,sP($,{clientDataJSON:r.metadata.clientDataJSON,userId:i}),`Passkey.takeProof`);if(!a||r.id!==a.id||!gP(r,{challenge:a.challenge,origin:new URL(I.URL).origin,publicKey:a.publicKey,rpId:a.rpId}))return J(e,new jN);let{account:o,chain:s}=e.req.valid(`json`),c=o?await Y(e,ZZ(e,{account:o,chain:s,userId:i}),`Configure.find`):void 0;if(c instanceof $D)return J(e,c);if(c&&!c.current)return J(e,new JP({account:vN(c.owner),reason:`upgrade`}));if(c&&(c.owner.type===`webAuthn`||c.current?.owners.some(e=>e.type===`webAuthn`)))return J(e,new YP({account:vN(c.owner),owner:`passkey`}));let l=await Y(e,XN($,{id:a.id,publicKey:a.publicKey,rpId:a.rpId,userId:i}),`Passkey.register`);if(dX(e),l===`limit`)return J(e,new DN);if(l!==`stored`)return J(e,new jN);let u=ae(he(Vn(a.publicKey)));if(e.header(`cache-control`,`private, no-store`),!c){let t=s?iF({rpcUrl:I.TEMPO_RPC_URL,rpcUrls:I.RPC_URLS,value:I.CONFIGURABLE_ACCOUNTS}).find(e=>e.name===s):void 0;if(!t)return e.json({address:u,id:a.id},200);let n=sF({chainId:t.chainId,key:u,type:`webAuthn`});return e.json({address:n.address,id:a.id},200)}let{client:d,current:f,owner:p}=c,m=uF({add:[{address:u,type:`webAuthn`,weight:1}],address:vN(p),chainId:c.chain.chainId,current:f,type:p.type});return await oQ(e,{client:d,current:f,signing:sQ(p,{current:f}),target:m,userId:i}),e.json({address:m.address,id:a.id},200)}).get(`/v1/realms`,DI({description:"Lists the realms of the app that `client_id` names, in order, and whether its passkey sign-in runs on the page that sends the request. An app without realms reaches the `default` realm alone.",responses:II({errors:[...X.errors],success:{description:`The realms.`,schema:R$.realms.response}}),tags:[`Account`]}),X(`query`,R$.realms.query),async e=>{let t=e.req.valid(`query`).client_id,n=await Y(e,WL(e,{clientId:t,db:$,origin:e.req.header(`origin`),own:new URL(I.URL).origin}),`Realm.forRequest`),r=A$(e),i=await(async()=>{if(!r||!t)return!1;let i=await Y(e,b$(e,{clientId:t}),`Headless.app`);return!HN({app:i,clientId:t,origin:r})&&QN(await Y(e,JL(e,{db:$,origin:I.URL,realms:n}),`Realm.withDefaults`),{origin:I.URL,page:r})!==void 0})();return e.header(`cache-control`,`private, no-store`),e.json({passkeys:i,realms:n.map(e=>({id:e.id,name:e.name}))},200)}).get(`/v1/chains`,DI({description:"Lists the chains that the `chain` parameter selects, each with its chain ID: `mainnet`, `testnet`, then the chains that the deployment lists.",responses:II({success:{description:`The chains.`,schema:R$.chains.response}}),tags:[`Account`]}),e=>e.json({chains:$$()},200)).get(`/i/chains`,DI({description:"Lists the chains that the `chain` parameter of `GET /v1/account` and `POST /v1/account` selects, as `GET /v1/chains` does, each with whether its faucet funds accounts. Internal: only Tempo ID's own pages send the request, so the public document leaves it out.",hide:!0,responses:II({success:{description:`The chains.`,schema:R$.pageChains.response}}),tags:[`Account`]}),e=>e.json({chains:$$().map(e=>({...e,faucet:jF.some(t=>t.id===e.chainId)}))},200)).get(`/i/chains/status`,DI({description:"Returns whether the node and the Tempo API of each chain that the deployment lists respond, apart from `mainnet` and `testnet`. A probe that fails or takes longer than a second reads as `down`, and a status can be up to 2 seconds old. Internal: only Tempo ID's own page sends the request, so the public document leaves it out.",hide:!0,responses:II({errors:[...N$.errors],success:{description:`The status of each listed chain.`,schema:R$.chainStatus.response}}),tags:[`Account`]}),async e=>{let t=N$(e);if(t)return J(e,t);let n=Ks({value:I.RPC_URLS}).filter(e=>!(e.name in Xs)),r=await Promise.all(n.map(async t=>({...await Y(e,UP(e,()=>GP({apiUrl:Ij({apiUrls:I.TEMPO_API_URLS,chainId:t.chainId}),chainId:t.chainId,rpcUrl:t.url}),[`ChainStatus.get`,t.name],{ttl:z$}),`ChainStatus.get`),chainId:t.chainId,name:t.name})));return e.header(`cache-control`,`no-store`),e.json({chains:r},200)}).post(`/i/account/fund`,DI({description:"Funds one of the signed-in user's Tempo Accounts in the `default` realm from the faucet of the test chain that `chain` names, and waits until each transfer lands. Tempo mainnet has no faucet. Internal: only Tempo ID's own page sends the request, so the public document leaves it out.",hide:!0,responses:II({errors:[...zP,...N$.errors,...X.errors,...cO.errors,...Z.errors,...uX.errors,xP,eO],success:{description:`The transfers from the faucet.`,schema:R$.fund.response}}),security:[{sessionCookie:[]}],tags:[`Account`]}),X(`json`,R$.fund.json),async e=>{let t=N$(e);if(t)return J(e,t);let n=await Y(e,I$(e),`Session.get`);if(!n)return J(e,new xP);let{address:r,chain:i}=e.req.valid(`json`),a=Ws({name:i,rpcUrl:I.TEMPO_RPC_URL,rpcUrls:I.RPC_URLS});if(!a)return J(e,Z$({chain:i}));let o=jF.find(e=>e.id===a.chainId);if(!o)return J(e,X$({chain:i}));let s=await Y(e,Z(e,{limits:[{binding:`ACCOUNT_LIMIT`,key:n.user.id}]}),`RateLimit.check`);if(s)return s;let c=await Y(e,WL(e,{clientId:void 0,db:$,origin:e.req.header(`origin`),own:new URL(I.URL).origin}),`Realm.forRequest`),l=await Y(e,JL(e,{db:$,origin:I.URL,realms:c}),`Realm.withDefaults`),u=(await Y(e,uX(e,{chainId:a.chainId,db:$,env:I,realms:l,userId:n.user.id}),`TempoAccount.list`)).find(e=>e.address.toLowerCase()===r.toLowerCase());if(!u)return J(e,Y$({address:r}));let d=await(async()=>{try{return await Y(e,MF({address:u.address,chain:o,rpcUrl:a.rpcUrl}),`Faucet.fund`)}catch(t){throw!(t instanceof Error)||cO(t)?t:($s(e,{error:t,message:`The faucet did not fund the account.`}),new aO)}})();return e.json({transactions:d},200)}).post(`/v1/account/upgrade`,DI({description:"Upgrades a wallet.tempo passkey's Tempo Account of the signed-in user in place to a configurable account (TIP-1113), on a chain whose accounts are configurable. The account keeps its address, and the passkey stays its only owner. The first request returns the passkey step, and the repeat with `passkey.assertion` sends the upgrade. With `key_authorization`, Tempo ID first registers that key, sponsored, so it keeps working. Requires a sign-in within the last 10 minutes.",responses:II({errors:[...zP,...XZ.errors,...aQ.errors,...N$.errors,...X.errors,...Z.errors,xP,rM,AN,LM],success:{description:`The upgraded account, or the passkey step.`,schema:R$.upgrade.response}}),security:[{sessionCookie:[]}],tags:[`Account`]}),X(`json`,R$.upgrade.json),async e=>{let{account:t,client_id:n,credentialId:r,key:i,key_authorization:a,passkey:o}=e.req.valid(`json`),s=await V$(e,{internal:r!==void 0});if(s instanceof Response)return s;let c=s.user.id,l=a?wt(a):void 0,u=e.req.valid(`json`).chain??(l?aF({chainId:Number(l.chainId),env:I})?.name:void 0),d=await Y(e,aQ(e,{account:t,chain:u,clientId:n,credentialId:r,email:s.user.email,userId:c}),`Configure.root`);if(d instanceof $D)return J(e,d);e.header(`cache-control`,`private, no-store`);let f=A$(e),p=f??new URL(I.URL).origin;if(o){let t=await Y(e,XZ(e,{account:d.account,assertion:o.assertion,client:d.client,credential:d.credential,keySignature:i?.signature,link:d.link,origin:p,userId:c}),`Configure.confirm`);if(t instanceof $D)return J(e,t);let r=await Y(e,J$(e,{account:d.account,chain:d.chain,clientId:n,userId:c}),`reread`);return e.json({account:r},200)}if(QN([d.realm],{origin:I.URL,page:f})?.rpId!==d.credential.rpId)return J(e,q$({account:d.account}));let m=uF({add:[],address:d.account,chainId:d.chain.chainId,current:void 0,type:`webAuthn`}),h=l?H$(l,{chainId:d.chain.chainId,publicKey:d.credential.publicKey}):void 0;if(h)return J(e,h);let g=l?await cQ(e,()=>_F({account:d.account,client:d.client,key:l.address})):`active`;if(g===`revoked`)return J(e,W$());let _=g===`active`;if(await Y(e,wF({client:d.client,target:m}),`ConfigurableAccount.installed`)){let t=d.link?await Y(e,d.link(),`Configure.link`):void 0;if(t)return J(e,t);await Y(e,pF($,{config:m,userId:c}),`db.accountConfig.save`);let r=await Y(e,J$(e,{account:d.account,chain:d.chain,clientId:n,userId:c}),`reread`);return _?e.json({account:r},200):J(e,G$())}let v=_?void 0:await cQ(e,()=>gF({account:d.account,client:d.client,key:l}));if(!_&&!v)return J(e,K$());let y=R$.upgrade.response.options[1].shape.step.shape.options.parse(await Y(e,$Z(e,{account:d.account,client:d.client,credential:d.credential,current:void 0,registration:v,target:m,userId:c}),`Configure.request`));return e.json({step:{options:y,...v?{key:{digest:v.digest}}:{},type:`passkey`}},200)}).get(`/i/account/passkeys`,DI({description:"Lists the wallet.tempo passkeys of the signed-in user's email that link to no user yet, which `POST /v1/account/upgrade` takes as `credentialId`. The sign-in proved the email, so the list reveals nothing to another person. Counts against the user's `ACCOUNT_LIMIT`. Refuses a cross-site navigation with `cross_site_request`. Internal: only Tempo ID's own page sends the request, so the public document leaves it out.",hide:!0,responses:II({errors:[...cO.errors,...Z.errors,xP,eO],success:{description:`The passkeys.`,schema:R$.passkeys.response}}),security:[{sessionCookie:[]}],tags:[`Account`]}),async e=>{if(e.req.header(`sec-fetch-site`)===`cross-site`)return J(e,new eO);let t=await Y(e,I$(e),`Session.get`);if(!t)return J(e,new xP);let n=await Y(e,Z(e,{limits:[{binding:`ACCOUNT_LIMIT`,key:t.user.id}]}),`RateLimit.check`);if(n)return n;let r=await Y(e,rQ(e,{email:t.user.email}),`Configure.unlinked`);return e.header(`cache-control`,`private, no-store`),e.json({passkeys:r.map(e=>({address:ae(e.address),credentialId:e.credentialId}))},200)}).get(`/i/account/upgrades`,DI({description:"Lists the upgrades that wait for the signed-in user on `chain`, which the sign-in page offers, when `CONFIGURABLE_ACCOUNTS` names it. Each linked wallet.tempo passkey's account without a configuration on the chain comes first. For a user who holds no account, each wallet.tempo passkey of the email that links to no user follows. `POST /v1/account/upgrade` takes either. Reads stored rows and wallet.tempo, never a chain. Counts against the user's `ACCOUNT_LIMIT`. Refuses a cross-site navigation with `cross_site_request`. Internal: only Tempo ID's own page sends the request, so the public document leaves it out.",hide:!0,responses:II({errors:[...cO.errors,...X.errors,...Z.errors,xP,eO],success:{description:`The upgrades.`,schema:R$.upgrades.response}}),security:[{sessionCookie:[]}],tags:[`Account`]}),X(`query`,R$.upgrades.query),async e=>{if(e.req.header(`sec-fetch-site`)===`cross-site`)return J(e,new eO);let t=await Y(e,I$(e),`Session.get`);if(!t)return J(e,new xP);let n=await Y(e,Z(e,{limits:[{binding:`ACCOUNT_LIMIT`,key:t.user.id}]}),`RateLimit.check`);if(n)return n;let r=await Y(e,iQ(e,{chain:e.req.valid(`query`).chain,email:t.user.email,userId:t.user.id}),`Configure.upgrades`);return e.header(`cache-control`,`private, no-store`),e.json({upgrades:r},200)});async function V$(e,t={}){let{internal:n=!0}=t,r=n?N$(e):void 0;if(r)return J(e,r);let i=await Y(e,I$(e),`Session.get`);return i?Q$(i)?await Y(e,Z(e,{limits:[{binding:`ACCOUNT_LIMIT`,key:i.user.id}]}),`RateLimit.check`)||i:J(e,new AN):J(e,new xP)}function H$(e,t){let n=(e,t)=>new LM({issues:[{message:e,path:[`key_authorization`,t]}]}),{signature:r}=e;if(r.type!==`webAuthn`||qn(r.publicKey,{includePrefix:!1})!==qn(Vn(t.publicKey),{includePrefix:!1}))return n("The account's passkey did not sign the key. Send a key that the passkey signed as the account's own key, such as with `skip_upgrade`",`signature`);if(Number(e.chainId)!==t.chainId)return n(`The key acts on chain ${Number(e.chainId)}, not the upgrade's chain ${t.chainId}. Send a key of the upgrade's chain`,`chainId`);if(e.expiry&&e.expiry*1e3<=Date.now())return n(`The key expired. Authorize a new key`,`expiry`)}function U$(e){try{return[`p256`,`secp256k1`,`webAuthn`].includes(Xe(e).type)}catch{return!1}}function W$(){return new LM({issues:[{message:`The chain holds the key as revoked, so it signs nothing after the upgrade. Authorize a new key, then upgrade with it`,path:[`key_authorization`]}]})}function G$(){return new LM({issues:[{message:`The account upgraded before the chain registered the key, so the chain refuses its signature. The account is configurable now. Authorize a new key`,path:[`key_authorization`]}]})}function K$(){return new LM({issues:[{message:"No scope of the key allows a TIP-20 `transfer` or `transferWithMemo`, so no transaction registers it before the upgrade. Authorize a key that allows one, or upgrade without `key_authorization`",path:[`key_authorization`,`allowedCalls`]}]})}function q$(e){return new rM({account:e.account,description:`Passkey required: the passkey of Tempo Account ${e.account} signs only at its own relying party, which this page is not part of. Change the account there.`})}async function J$(e,t){let{account:n,chain:r,clientId:i,userId:a}=t,o=await Y(e,QZ(e,{clientId:i}),`Configure.reach`),s=(await Y(e,lX(e,{chainId:r.chainId,db:$,env:I,realms:o,userId:a}),`TempoAccount.held`)).find(e=>vN(e).toLowerCase()===n.toLowerCase());if(!s)throw new aX({account:n});return _X(s)}function Y$(e){return new LM({issues:[{message:`The signed-in user has no Tempo Account at ${e.address}. Use an address that \`GET /v1/account\` lists`,path:[`address`]}]})}function X$(e){return new LM({issues:[{message:`The chain "${e.chain}" has no faucet. Use \`testnet\`, or a test chain that the deployment lists`,path:[`chain`]}]})}function Z$(e){return new LM({issues:[{message:`No chain is named "${e.chain}". Use \`mainnet\`, \`testnet\`, or another chain that the deployment lists`,path:[`chain`]}]})}function Q$(e){return Date.now()-e.session.createdAt.getTime()<6e5}function $$(){let e=iF({rpcUrl:I.TEMPO_RPC_URL,rpcUrls:I.RPC_URLS,value:I.CONFIGURABLE_ACCOUNTS}).map(e=>e.chainId);return[{chainId:Xs.mainnet,name:`mainnet`},{chainId:Xs.testnet,name:`testnet`},...Ks({value:I.RPC_URLS}).filter(e=>!(e.name in Xs)).map(e=>({chainId:e.chainId,name:e.name}))].map(t=>({...t,configurable:e.includes(t.chainId)}))}var e1=60,t1;(function(e){e.continuation=A({client_id:j().optional(),expiresAt:Ti(),id_token_hint:j(),post_logout_redirect_uri:j().optional(),state:j().optional()})})(t1||={});var n1=class extends q(`invalid_id_token_hint`){name=`Logout.HintInvalidError`;constructor(){super({error_description:`Invalid id_token_hint: it is not an ID token that this issuer signed for the app. Send the ID token that the app received at sign-in.`,field:`id_token_hint`})}},r1=class extends q(`logout_not_permitted`){name=`Logout.NotPermittedError`;constructor(e){super({error_description:`Logout not permitted: the app ${e.clientId} may not end the session. Register the app for logout, then retry.`,meta:{client_id:e.clientId}})}},i1=class extends q(`post_logout_redirect_not_permitted`){name=`Logout.RedirectNotPermittedError`;constructor(e){super({error_description:`Invalid post_logout_redirect_uri: ${e.uri} is not registered for the app. Use one of its post-logout redirect URIs, or leave it out.`,field:`post_logout_redirect_uri`,meta:{post_logout_redirect_uri:e.uri}})}};async function a1(e,t){let n=await l1(t);if(n instanceof n1)return n;let[r]=await e.select({disabled:G.disabled,enableEndSession:G.enableEndSession,postLogoutRedirectUris:G.postLogoutRedirectUris}).from(G).where(W(G.clientId,n.clientId));if(!r||r.disabled||!r.enableEndSession)return new r1({clientId:n.clientId});let i=(()=>{let e=t.postLogoutRedirectUri;if(e===void 0)return;if(!(r.postLogoutRedirectUris??[]).includes(e))return new i1({uri:e});let n=new URL(e);return t.state!==void 0&&n.searchParams.set(`state`,t.state),n.href})();return i instanceof i1?i:{redirect:i,sessionId:n.sessionId}}(function(e){e.errors=[n1,r1,i1]})(a1||={});async function o1(e,t){return await Yo({data:JSON.stringify(t1.continuation.parse({...e,expiresAt:Math.floor(Date.now()/1e3)+e1})),key:await u1(t.secret)})}async function s1(e,t){let n=await fs({data:e,key:await u1(t.secret)}).then(e=>t1.continuation.safeParse(JSON.parse(e))).catch(()=>void 0);if(n?.success&&!(n.data.expiresAt<=Date.now()/1e3))return n.data}async function c1(e,t){let n=new Date,r=e.$with(`ended`).as(e.delete(vE).where(qC(W(vE.token,t.token),t.sessionId===void 0?void 0:W(vE.id,t.sessionId),V`set_config('tempo_id.logout', 'on', true) = 'on'`)).returning({id:vE.id})),i=e.$with(`access_tokens`).as(e.update(oE).set({revoked:n}).where(qC(ew(oE.sessionId,e.select({id:r.id}).from(r)),nw(oE.revoked))).returning({id:oE.id})),a=e.$with(`refresh_tokens`).as(e.update(mE).set({revoked:n}).where(qC(ew(mE.sessionId,e.select({id:r.id}).from(r)),nw(mE.revoked))).returning({id:mE.id})),[o]=await e.with(r,i,a).select({id:r.id}).from(r);return o?.id}async function l1(e){let{clientId:t,issuer:n,jwks:r}=e,i=await(async()=>{try{let t=await Ko(e.hint,So(r),{algorithms:[`RS256`]});return JSON.parse(new TextDecoder().decode(t.payload))}catch{return}})();if(!i||typeof i!=`object`)return new n1;let a=i,o=typeof a.aud==`string`?[a.aud]:Array.isArray(a.aud)?a.aud.filter(e=>typeof e==`string`):[],s=t??(o.length===1?o[0]:void 0);return a.iss!==n||!s||!o.includes(s)||typeof a.sid!=`string`||!a.sid||typeof a.sub!=`string`||!a.sub?new n1:{clientId:s,sessionId:a.sid,userId:a.sub}}async function u1(e){let t=new TextEncoder,n=await crypto.subtle.importKey(`raw`,t.encode(e),`HKDF`,!1,[`deriveBits`]),r=await crypto.subtle.deriveBits({hash:`SHA-256`,info:t.encode(`tempo-id:logout-continuation:v1`),name:`HKDF`,salt:new Uint8Array},n,256);return xn(new Uint8Array(r))}async function d1(e,t){let n;if(e.database)n=typeof e.database==`function`?e.database(e):await t(e);else{let t=Ri(e),r=Object.keys(t).reduce((e,t)=>(e[t]=[],e),{}),{memoryAdapter:i}=await import(`./assets/dist-DcICI3fd.js`);n=i(r)(e)}return n.transaction||(ra.warn(`Adapter does not correctly implement transaction function, patching it automatically. Please update your adapter implementation.`),n.transaction=async e=>e(n)),n}async function f1(e){return d1(e,async e=>{let{createKyselyAdapter:t,kyselyAdapter:n}=await import(`./assets/kysely-adapter-B8tQwTcu.js`),{kysely:r,databaseType:i,transaction:a}=await t(e);if(!r)throw new N(`Failed to initialize database adapter`);return n(r,{type:i||`sqlite`,debugLogs:e.database&&`debugLogs`in e.database?e.database.debugLogs:!1,transaction:a})(e)})}var p1={postgres:{string:[`character varying`,`varchar`,`text`,`uuid`],number:[`int4`,`int8`,`integer`,`bigint`,`smallint`,`numeric`,`real`,`double precision`],boolean:[`bool`,`boolean`],date:[`timestamptz`,`timestamp`,`date`],json:[`json`,`jsonb`]},mysql:{string:[`varchar`,`text`,`uuid`],number:[`integer`,`int`,`bigint`,`smallint`,`decimal`,`float`,`double`],boolean:[`boolean`,`tinyint`],date:[`timestamp`,`datetime`,`date`],json:[`json`]},sqlite:{string:[`TEXT`],number:[`INTEGER`,`REAL`,`BIGINT`],boolean:[`INTEGER`,`BOOLEAN`],date:[`DATE`,`INTEGER`],json:[`TEXT`]},mssql:{string:[`varchar`,`nvarchar`,`uniqueidentifier`],number:[`int`,`bigint`,`smallint`,`decimal`,`float`,`double`],boolean:[`bit`,`smallint`],date:[`datetime2`,`date`,`datetime`],json:[`varchar`,`nvarchar`]}};function m1(e,t){return`${aa(e)}\u0000${aa(t)}`}function h1(e,t){return`${e}\u0000${t}`}function g1(e,t){return e.unique===(t.unique??!1)&&e.validFullColumns&&e.columns.length===t.columns.length&&e.columns.every((e,n)=>e===t.columns[n])}function _1(e){return typeof e==`boolean`?e:typeof e==`number`?e!==0:e===`1`||e?.toLowerCase()===`true`||e===`t`}function v1(e){return new Map(e.map(e=>{let t=[...e.columns].sort((e,t)=>e.position-t.position);return[m1(e.table,e.name),{columns:t.flatMap(e=>e.name===null?[]:[e.name]),name:e.name,table:e.table,unique:e.unique,validFullColumns:e.valid&&!e.partial&&t.length>0&&t.every(e=>e.name!==null&&e.fullLength)}]}))}async function y1(e,t,n,r){if(r)return v1(await r(n));let i;switch(t.type){case`sqlite`:i=(await ic`
428
+ SELECT
429
+ tables.name AS "tableName",
430
+ index_list.name AS "indexName",
431
+ index_info.name AS "columnName",
432
+ index_list."unique" AS "isUnique",
433
+ index_list.partial AS "isPartial",
434
+ index_info.seqno AS "columnPosition"
435
+ FROM sqlite_master AS tables
436
+ INNER JOIN pragma_index_list(tables.name) AS index_list
437
+ INNER JOIN pragma_index_info(index_list.name) AS index_info
438
+ WHERE tables.type = 'table'
439
+ `.execute(e)).rows;break;case`postgres`:i=(await ic`
440
+ SELECT
441
+ table_class.relname AS "tableName",
442
+ index_class.relname AS "indexName",
443
+ index_attribute.attname AS "columnName",
444
+ index_data.indisunique AS "isUnique",
445
+ index_data.indisvalid AS "isValid",
446
+ (index_data.indpred IS NOT NULL) AS "isPartial",
447
+ index_column.ordinality AS "columnPosition"
448
+ FROM pg_class AS table_class
449
+ INNER JOIN pg_namespace AS table_namespace
450
+ ON table_namespace.oid = table_class.relnamespace
451
+ INNER JOIN pg_index AS index_data
452
+ ON index_data.indrelid = table_class.oid
453
+ INNER JOIN pg_class AS index_class
454
+ ON index_class.oid = index_data.indexrelid
455
+ INNER JOIN LATERAL unnest(index_data.indkey)
456
+ WITH ORDINALITY AS index_column(attribute_number, ordinality)
457
+ ON TRUE
458
+ LEFT JOIN pg_attribute AS index_attribute
459
+ ON index_attribute.attrelid = table_class.oid
460
+ AND index_attribute.attnum = index_column.attribute_number
461
+ WHERE table_namespace.nspname = ${t.schema}
462
+ AND table_class.relkind = 'r'
463
+ AND index_column.ordinality <= index_data.indnkeyatts
464
+ `.execute(e)).rows;break;case`mysql`:i=(await ic`
465
+ SELECT
466
+ table_name AS tableName,
467
+ index_name AS indexName,
468
+ column_name AS columnName,
469
+ non_unique AS nonUnique,
470
+ seq_in_index AS columnPosition,
471
+ sub_part AS prefixLength,
472
+ COALESCE(LOWER(comment) = 'disabled', FALSE) AS isDisabled
473
+ FROM information_schema.statistics
474
+ WHERE table_schema = DATABASE()
475
+ `.execute(e)).rows;break;case`mssql`:i=(await ic`
476
+ SELECT
477
+ tables.name AS "tableName",
478
+ indexes.name AS "indexName",
479
+ columns.name AS "columnName",
480
+ indexes.is_unique AS "isUnique",
481
+ indexes.is_disabled AS "isDisabled",
482
+ indexes.is_hypothetical AS "isHypothetical",
483
+ indexes.has_filter AS "isPartial",
484
+ index_columns.key_ordinal AS "columnPosition"
485
+ FROM sys.indexes AS indexes
486
+ INNER JOIN sys.tables AS tables
487
+ ON indexes.object_id = tables.object_id
488
+ INNER JOIN sys.schemas AS table_schemas
489
+ ON table_schemas.schema_id = tables.schema_id
490
+ INNER JOIN sys.index_columns AS index_columns
491
+ ON index_columns.object_id = indexes.object_id
492
+ AND index_columns.index_id = indexes.index_id
493
+ INNER JOIN sys.columns AS columns
494
+ ON columns.object_id = index_columns.object_id
495
+ AND columns.column_id = index_columns.column_id
496
+ WHERE table_schemas.name = ${t.schema}
497
+ AND indexes.name IS NOT NULL
498
+ AND index_columns.key_ordinal > 0
499
+ `.execute(e)).rows}let a=new Map;for(let e of i){let t=e.tableName??e.table_name??e.TABLE_NAME??e.tablename??e.tbl_name,n=e.indexName??e.index_name??e.INDEX_NAME??e.name,r=e.columnName??e.column_name??e.COLUMN_NAME;if(!t||!n)continue;let i=m1(t,n),o=e.nonUnique??e.non_unique??e.NON_UNIQUE,s=o===void 0?_1(e.isUnique??e.is_unique):!_1(o),c=Number(e.columnPosition??e.column_position??e.keyOrdinal??e.key_ordinal??e.ordinality??e.seqInIndex??e.seq_in_index??e.SEQ_IN_INDEX??e.seqno??0),l={fullLength:r!=null&&(e.prefixLength===void 0||e.prefixLength===null),name:r??null,position:c},u=_1(e.isPartial),d=!_1(e.isDisabled)&&!_1(e.isHypothetical)&&(e.isValid===void 0||_1(e.isValid)),f=a.get(i);a.set(i,f?{...f,columns:[...f.columns,l],partial:f.partial||u,valid:f.valid&&d}:{columns:[l],name:n,partial:u,table:t,unique:s,valid:d})}return v1([...a.values()])}async function b1(e,t){let n;switch(t.type){case`postgres`:case`sqlite`:return new Map;case`mysql`:n=(await ic`
500
+ SELECT
501
+ table_name AS tableName,
502
+ column_name AS columnName,
503
+ character_octet_length AS maxIndexBytes
504
+ FROM information_schema.columns
505
+ WHERE table_schema = DATABASE()
506
+ `.execute(e)).rows;break;case`mssql`:n=(await ic`
507
+ SELECT
508
+ tables.name AS "tableName",
509
+ columns.name AS "columnName",
510
+ columns.max_length AS "maxIndexBytes"
511
+ FROM sys.columns AS columns
512
+ INNER JOIN sys.tables AS tables
513
+ ON tables.object_id = columns.object_id
514
+ INNER JOIN sys.schemas AS table_schemas
515
+ ON table_schemas.schema_id = tables.schema_id
516
+ WHERE table_schemas.name = ${t.schema}
517
+ `.execute(e)).rows}let r=new Map;for(let e of n){let t=e.tableName??e.TABLE_NAME,n=e.columnName??e.COLUMN_NAME;if(!t||!n)continue;let i=Number(e.maxIndexBytes??e.MAX_INDEX_BYTES??-1);r.set(h1(t,n),{maxIndexBytes:i<0?null:i})}return r}function x1({columnBounds:e,dbType:t,existingColumns:n,fields:r,indexes:i,index:a,table:o}){let s=t===`mysql`?3072:1700,c=0;for(let s of a.columns){let l=r[s];if(l){if(l.type===`string`||Array.isArray(l.type)){if(!n.has(s)){let e=na({columnName:s,dialect:t,fields:r,indexes:i});c+=(e??0)*(t===`mysql`?4:1);continue}let l=e.get(h1(o,s));if(!l?.maxIndexBytes)throw new N(`Cannot create database index "${a.name}" on existing table "${o}" because column "${s}" is not bounded for ${t===`mysql`?`MySQL`:`SQL Server`}. Change it to a bounded string column, resolve oversized values, then run the migration again.`);c+=l.maxIndexBytes}else c+=16}}if(c>s)throw new N(`Cannot create database index "${a.name}" on existing table "${o}" because its columns can exceed ${t===`mysql`?`MySQL`:`SQL Server`}'s ${s}-byte index-key limit. Bound the indexed string columns to the generated schema lengths, resolve oversized values, then run the migration again.`)}var S1=class extends N{};function C1(e,t){return e.type===`date`&&typeof e.defaultValue==`function`&&(t===`postgres`||t===`mysql`||t===`mssql`)}function w1(e){return!(e.unique&&e.required===!1)&&(e.type===`string`||e.type===`number`||e.type===`boolean`)&&e.defaultValue!==void 0&&e.defaultValue!==null&&typeof e.defaultValue!=`function`}async function T1(e,t,n){let r=e.selectFrom(n).select(ic`1`.as(`present`));return(await(t===`mssql`?r.top(1):r.limit(1)).execute()).length>0}function E1(e,t,n){function r(e){return e.toLowerCase().split(`(`)[0].trim()}if(t===`string[]`||t===`number[]`)return e.toLowerCase().includes(`json`);let i=p1[n];return(Array.isArray(t)?i.string.map(e=>e.toLowerCase()):i[t].map(e=>e.toLowerCase())).includes(r(e))}async function D1(e,{throwOnUnsafe:t=!0}={}){let{schema:n,tables:r,referenceKeys:i}=Yy(e),a=mi(e.logger),o=[],s=e=>{if(t)throw new S1(e);o.push(e)},{kysely:c,databaseType:l,introspectIndexes:u,schemaName:d}=await uc(e);l||=(a.warn(`Could not determine database type, defaulting to sqlite. Please provide a type in the database options to avoid this.`),`sqlite`),c||(a.error("Only kysely adapter is supported for migrations. You can use `generate` command to generate the schema, if you're using a different adapter."),process.exit(1));let f=await c.introspection.getTables(),p,m=f;switch(l){case`postgres`:{let e=d??await ac(c);p={type:`postgres`,schema:e},a.debug(`PostgreSQL migration: Using schema '${e}' (${d?`from database.schemaName`:`from search_path`})`);try{(await c.introspection.getSchemas()).some(({name:t})=>t===e)||(d?a.debug(`Schema '${e}' does not exist yet. The migration creates it before creating tables.`):a.warn(`Schema '${e}' does not exist. Create it before running migrations or check your database configuration.`))}catch(e){a.debug(`Could not verify schema existence: ${e instanceof Error?e.message:String(e)}`)}m=f.filter(t=>t.schema===e&&!t.isView&&!(`isForeign`in t&&t.isForeign)),a.debug(`Found ${m.length} table(s) in schema '${e}': ${m.map(e=>e.name).join(`, `)||`(none)`}`);break}case`mssql`:{let e=await cc(c);p={type:`mssql`,schema:e},a.debug(`SQL Server migration: Using schema '${e}' (from the current user's default schema)`),m=f.filter(t=>t.schema===e);break}case`mysql`:p={type:`mysql`};break;case`sqlite`:p={type:`sqlite`}}let h=await y1(c,p,f.map(e=>e.name),u),g=await b1(c,p),_=Ms(lc(c,n),sc(m)).filter(e=>e.kind===`unexpected-required-column`).map(e=>Ps(e,`database`)),v=[],y=[],b=[],x=new Map;for(let[e,t]of Object.entries(n)){if(t.disableMigrations)continue;let n=m.find(t=>t.name===e);for(let r of t.indexes??[]){let i=r.name,a=m1(e,i),o=h.get(a);if(o){if(!g1(o,r))throw new N(`Database index "${i}" on table "${e}" does not match the configured fields and uniqueness. Rename or replace the existing index, then run the migration again.`);continue}if(l===`sqlite`||l===`postgres`){let t=[...h.values()].find(t=>aa(t.name)===aa(i)&&aa(t.table)!==aa(e));if(t)throw new N(`Database index name "${i}" is already used by table "${t.table}". Index names must be unique across the schema.`)}let s=x.get(a);if(s){if(!g1({columns:s.columns,name:s.name,table:e,unique:s.unique??!1,validFullColumns:!0},r))throw new N(`Database index name "${i}" identifies more than one index on table "${e}".`)}else n&&(l===`mysql`||l===`mssql`)&&x1({columnBounds:g,dbType:l,existingColumns:new Set(n.columns.map(e=>e.name)),fields:t.fields,index:r,indexes:t.indexes??[],table:e}),x.set(a,r),b.push({table:e,index:r,name:i})}if(!n){let n=v.findIndex(t=>t.table===e),r={table:e,fields:t.fields,order:t.order||1/0},i=v.findIndex(e=>(e.order||1/0)>r.order);i===-1?n===-1?v.push(r):v[n].fields={...v[n].fields,...t.fields}:v.splice(i,0,r);continue}let r={};for(let[i,o]of Object.entries(t.fields)){let t=n.columns.find(e=>e.name===i);t?(o.required!==!1&&t.isNullable&&a.warn(`Column "${i}" on table "${e}" stays nullable while the schema declares the field required, so existing rows can still hold null. Backfill every row for this column and enforce NOT NULL to remove the drift.`),!E1(t.dataType,o.type,l)&&a.warn(`Field ${i} in table ${e} has a different type in the database. Expected ${o.type} but got ${t.dataType}.`)):r[i]=o}Object.keys(r).length>0&&y.push({table:e,fields:r,order:t.order||1/0})}let S=[];d&&v.length>0&&S.push(c.schema.createSchema(d).ifNotExists());let C=e.advanced?.database?.generateId===`uuid`,w=e.advanced?.database?.generateId===`serial`;function T(e,t,n){let r=e.type,i=l||`sqlite`,a={string:{sqlite:`text`,postgres:`text`,mysql:n?`varchar(${n})`:e.unique?`varchar(255)`:e.references?`varchar(36)`:e.sortable||e.index?`varchar(255)`:`text`,mssql:n?`varchar(${n})`:e.unique||e.sortable?`varchar(255)`:e.references?`varchar(36)`:`varchar(8000)`},boolean:{sqlite:`integer`,postgres:`boolean`,mysql:`boolean`,mssql:`smallint`},number:{sqlite:e.bigint?`bigint`:`integer`,postgres:e.bigint?`bigint`:`integer`,mysql:e.bigint?`bigint`:`integer`,mssql:e.bigint?`bigint`:`integer`},date:{sqlite:`date`,postgres:`timestamptz`,mysql:`timestamp(3)`,mssql:ic`datetime2(3)`},json:{sqlite:`text`,postgres:`jsonb`,mysql:`json`,mssql:`varchar(8000)`},id:{postgres:w?ic`integer GENERATED BY DEFAULT AS IDENTITY`:C?`uuid`:`text`,mysql:w?`integer`:`varchar(36)`,mssql:w?`integer`:`varchar(36)`,sqlite:w?`integer`:`text`},foreignKeyId:{postgres:w?`integer`:C?`uuid`:`text`,mysql:w?`integer`:`varchar(36)`,mssql:w?`integer`:`varchar(36)`,sqlite:w?`integer`:`text`},"string[]":{sqlite:`text`,postgres:`jsonb`,mysql:`json`,mssql:`varchar(8000)`},"number[]":{sqlite:`text`,postgres:`jsonb`,mysql:`json`,mssql:`varchar(8000)`}};if(t===`id`||e.references?.field===`id`)return t===`id`?a.id[i]:a.foreignKeyId[i];if(Array.isArray(r))return`text`;if(!(r in a))throw Error(`Unsupported field type '${String(r)}' for field '${t}'. Allowed types are: string, number, boolean, date, string[], number[]. If you need to store structured data, store it as a JSON string (type: "string") or split it into primitive fields. See https://better-auth.com/docs/advanced/schema#additional-fields`);return a[r][i]}let E=Vs({schema:r,usePlural:!1}),D=Hs({schema:r,usePlural:!1});function ee(e){let t=e.references;if(!t)throw new N(`Cannot resolve a field without references.`);let n=i.get(e);if(!n)throw new N(`Missing migration reference metadata for "${t.model}.${t.field}".`);try{return`${E(n.modelKey)}.${D({model:n.modelKey,field:n.fieldKey})}`}catch{return`${t.model}.${t.field}`}}let te=[],ne=(e,t)=>{if(l!==`mysql`&&l!==`mssql`)return;let r=n[e];if(r)return na({columnName:t,dialect:l,fields:r.fields,indexes:r.indexes??[]})};if(y.length){let e=new Map;for(let t of y)for(let[n,r]of Object.entries(t.fields)){let i=C1(r,l),o=w1(r);if(r.required!==!1&&!i&&!o){let i=e.get(t.table);if(i===void 0&&(i=await T1(c,l,t.table),e.set(t.table,i)),i){let e=r.type===`string`?` For a text column, every existing row ends up with the same empty string.`:``;s(`Cannot add required column "${n}" to populated table "${t.table}": the schema declares no default value, so existing rows have no value to backfill. MySQL accepts this statement instead of rejecting it and fills every existing row with an implicit default for the column type, reporting a successful migration over corrupted data.${e} Add the column as nullable, backfill a correct value for every row, then make it NOT NULL.`)}}let u=T(r,n,ne(t.table,n)),d=c.schema.alterTable(t.table);if(r.index||r.unique){let e=Ai(t.table,n,r.unique??!1),i=c.schema.createIndex(e).on(t.table).columns([n]);r.unique&&(i=i.unique(),r.required===!1&&l===`mssql`&&(i=i.where(n,`is not`,null)),r.required!==!1&&r.defaultValue!==void 0&&r.defaultValue!==null&&typeof r.defaultValue!=`function`&&a.warn(`Adding unique column "${n}" to existing table "${t.table}" backfills every existing row with its default value. If the table has more than one row, creating the unique index "${e}" will fail; backfill distinct values manually, then re-run the migration or create the index yourself.`)),te.push(i)}let f=d.addColumn(n,u,e=>(e=r.required===!1?e:e.notNull(),r.references&&(e=e.references(ee(r)).onDelete(r.references.onDelete||`cascade`)),i?e=l===`mysql`?e.defaultTo(ic`CURRENT_TIMESTAMP(3)`):e.defaultTo(ic`CURRENT_TIMESTAMP`):o&&(e=e.defaultTo(typeof r.defaultValue==`boolean`&&(l===`sqlite`||l===`mssql`)?+!!r.defaultValue:r.defaultValue)),e));S.push(f)}}if(v.length)for(let e of v){let t=T({type:w?`number`:`string`},`id`),n=c.schema.createTable(e.table).addColumn(`id`,t,e=>w?l===`postgres`||l===`sqlite`?e.primaryKey().notNull():l===`mssql`?e.identity().primaryKey().notNull():e.autoIncrement().primaryKey().notNull():C&&l===`postgres`?e.primaryKey().defaultTo(ic`pg_catalog.gen_random_uuid()`).notNull():e.primaryKey().notNull());for(let[t,r]of Object.entries(e.fields)){let i=T(r,t,ne(e.table,t));if(n=n.addColumn(t,i,e=>(e=r.required===!1?e:e.notNull(),r.references&&(e=e.references(ee(r)).onDelete(r.references.onDelete||`cascade`)),r.unique&&(e=e.unique()),r.type===`date`&&typeof r.defaultValue==`function`&&(l===`postgres`||l===`mysql`||l===`mssql`)&&(e=l===`mysql`?e.defaultTo(ic`CURRENT_TIMESTAMP(3)`):e.defaultTo(ic`CURRENT_TIMESTAMP`)),e)),r.index&&!r.unique){let n=c.schema.createIndex(Ai(e.table,t,!1)).on(e.table).columns([t]);te.push(n)}}S.push(n)}for(let{table:e,index:t,name:n}of b){let r=c.schema.createIndex(n).on(e).columns([...t.columns]);t.unique&&(r=r.unique()),te.push(r)}for(let e of te)S.push(e);async function re(){try{for(let e of S)await e.execute()}finally{S.length&&e.database&&Ls(e.database)}}async function ie(){return S.map(e=>e.compile().sql).join(`;
518
+
519
+ `)+`;`}return{toBeCreated:v,toBeAdded:y,toBeAddedIndexes:b,unsafeChanges:o,schemaProblems:_,runMigrations:re,compileMigrations:ie}}var O1=`better-auth-secret-12345678901234567890`;function k1(e){let t=new Set(e).size;return t===0?0:Math.log2(t**+e.length)}function A1(e){return e?e.split(`,`).map(e=>{e=e.trim();let t=e.indexOf(`:`);if(t===-1)throw new N(`Invalid BETTER_AUTH_SECRETS entry: "${e}". Expected format: "<version>:<secret>"`);let n=parseInt(e.slice(0,t),10);if(!Number.isInteger(n)||n<0)throw new N(`Invalid version in BETTER_AUTH_SECRETS: "${e.slice(0,t)}". Version must be a non-negative integer.`);let r=e.slice(t+1).trim();if(!r)throw new N(`Empty secret value for version ${n} in BETTER_AUTH_SECRETS.`);return{version:n,value:r}}):null}function j1(e,t){if(e.length===0)throw new N("`secrets` array must contain at least one entry.");let n=new Set;for(let t of e){let e=parseInt(String(t.version),10);if(!Number.isInteger(e)||e<0||String(e)!==String(t.version).trim())throw new N(`Invalid version ${t.version} in \`secrets\`. Version must be a non-negative integer.`);if(!t.value)throw new N(`Empty secret value for version ${e} in \`secrets\`.`);if(n.has(e))throw new N(`Duplicate version ${e} in \`secrets\`. Each version must be unique.`);n.add(e)}let r=e[0];r.value.length<32&&t.warn(`[better-auth] Warning: the current secret (version ${r.version}) should be at least 32 characters long for adequate security.`),k1(r.value)<120&&t.warn(`[better-auth] Warning: the current secret appears low-entropy. Use a randomly generated secret for production.`)}function M1(e,t){let n=new Map;for(let t of e)n.set(parseInt(String(t.version),10),t.value);return{keys:n,currentVersion:parseInt(String(e[0].version),10),legacySecret:t&&t!==`better-auth-secret-12345678901234567890`?t:void 0}}async function N1(e,t){return{database:t?.database,adapter:t?.adapter,emailVerification:{sendVerificationEmail:!!e.emailVerification?.sendVerificationEmail,sendOnSignUp:!!e.emailVerification?.sendOnSignUp,sendOnSignIn:!!e.emailVerification?.sendOnSignIn,autoSignInAfterVerification:!!e.emailVerification?.autoSignInAfterVerification,expiresIn:e.emailVerification?.expiresIn,beforeEmailVerification:!!e.emailVerification?.beforeEmailVerification,afterEmailVerification:!!e.emailVerification?.afterEmailVerification},emailAndPassword:{enabled:!!e.emailAndPassword?.enabled,disableSignUp:!!e.emailAndPassword?.disableSignUp,requireEmailVerification:!!e.emailAndPassword?.requireEmailVerification,maxPasswordLength:e.emailAndPassword?.maxPasswordLength,minPasswordLength:e.emailAndPassword?.minPasswordLength,sendResetPassword:!!e.emailAndPassword?.sendResetPassword,resetPasswordTokenExpiresIn:e.emailAndPassword?.resetPasswordTokenExpiresIn,onPasswordReset:!!e.emailAndPassword?.onPasswordReset,password:{hash:!!e.emailAndPassword?.password?.hash,verify:!!e.emailAndPassword?.password?.verify},autoSignIn:!!e.emailAndPassword?.autoSignIn,revokeSessionsOnPasswordReset:!!e.emailAndPassword?.revokeSessionsOnPasswordReset},socialProviders:await Promise.all(Object.keys(e.socialProviders||{}).map(async t=>{let n=e.socialProviders?.[t];if(!n)return{};let r=typeof n==`function`?await n():n;return{id:t,mapProfileToUser:!!r.mapProfileToUser,disableDefaultScope:!!r.disableDefaultScope,disableIdTokenSignIn:!!r.disableIdTokenSignIn,disableImplicitSignUp:r.disableImplicitSignUp,disableSignUp:r.disableSignUp,getUserInfo:!!r.getUserInfo,overrideUserInfoOnSignIn:!!r.overrideUserInfoOnSignIn,prompt:r.prompt,verifyIdToken:!!r.verifyIdToken,scope:r.scope,refreshAccessToken:!!r.refreshAccessToken}})),plugins:e.plugins?.map(e=>e.id.toString()),user:{modelName:e.user?.modelName,fields:e.user?.fields,additionalFields:e.user?.additionalFields,changeEmail:{enabled:e.user?.changeEmail?.enabled,sendChangeEmailConfirmation:!!e.user?.changeEmail?.sendChangeEmailConfirmation}},verification:{modelName:e.verification?.modelName,disableCleanup:e.verification?.disableCleanup,fields:e.verification?.fields},session:{modelName:e.session?.modelName,additionalFields:e.session?.additionalFields,cookieCache:{enabled:e.session?.cookieCache?.enabled,maxAge:e.session?.cookieCache?.maxAge,strategy:e.session?.cookieCache?.strategy},disableSessionRefresh:e.session?.disableSessionRefresh,expiresIn:e.session?.expiresIn,fields:e.session?.fields,freshAge:e.session?.freshAge,preserveSessionInDatabase:e.session?.preserveSessionInDatabase,storeSessionInDatabase:e.session?.storeSessionInDatabase,updateAge:e.session?.updateAge},account:{modelName:e.account?.modelName,fields:e.account?.fields,encryptOAuthTokens:e.account?.encryptOAuthTokens,updateAccountOnSignIn:e.account?.updateAccountOnSignIn,accountLinking:{enabled:e.account?.accountLinking?.enabled,trustedProviders:e.account?.accountLinking?.trustedProviders,updateUserInfoOnLink:e.account?.accountLinking?.updateUserInfoOnLink,allowUnlinkingAll:e.account?.accountLinking?.allowUnlinkingAll}},hooks:{after:!!e.hooks?.after,before:!!e.hooks?.before},secondaryStorage:!!e.secondaryStorage,advanced:{cookiePrefix:!!e.advanced?.cookiePrefix,cookies:!!e.advanced?.cookies,crossSubDomainCookies:{domain:!!e.advanced?.crossSubDomainCookies?.domain,enabled:e.advanced?.crossSubDomainCookies?.enabled,additionalCookies:e.advanced?.crossSubDomainCookies?.additionalCookies},database:{generateId:e.advanced?.database?.generateId,defaultFindManyLimit:e.advanced?.database?.defaultFindManyLimit},useSecureCookies:e.advanced?.useSecureCookies,ipAddress:{disableIpTracking:e.advanced?.ipAddress?.disableIpTracking,ipAddressHeaders:e.advanced?.ipAddress?.ipAddressHeaders},disableCSRFCheck:e.advanced?.disableCSRFCheck,cookieAttributes:{expires:e.advanced?.defaultCookieAttributes?.expires,secure:e.advanced?.defaultCookieAttributes?.secure,sameSite:e.advanced?.defaultCookieAttributes?.sameSite,domain:!!e.advanced?.defaultCookieAttributes?.domain,path:e.advanced?.defaultCookieAttributes?.path,httpOnly:e.advanced?.defaultCookieAttributes?.httpOnly}},trustedOrigins:e.trustedOrigins?.length,rateLimit:{storage:e.rateLimit?.storage,modelName:e.rateLimit?.modelName,window:e.rateLimit?.window,customStorage:!!e.rateLimit?.customStorage,enabled:e.rateLimit?.enabled,max:e.rateLimit?.max},onAPIError:{errorURL:e.onAPIError?.errorURL,onError:!!e.onAPIError?.onError,throw:e.onAPIError?.throw},logger:{disabled:e.logger?.disabled,level:e.logger?.level,log:!!e.logger?.log},databaseHooks:{user:{create:{after:!!e.databaseHooks?.user?.create?.after,before:!!e.databaseHooks?.user?.create?.before},update:{after:!!e.databaseHooks?.user?.update?.after,before:!!e.databaseHooks?.user?.update?.before}},session:{create:{after:!!e.databaseHooks?.session?.create?.after,before:!!e.databaseHooks?.session?.create?.before},update:{after:!!e.databaseHooks?.session?.update?.after,before:!!e.databaseHooks?.session?.update?.before}},account:{create:{after:!!e.databaseHooks?.account?.create?.after,before:!!e.databaseHooks?.account?.create?.before},update:{after:!!e.databaseHooks?.account?.update?.after,before:!!e.databaseHooks?.account?.update?.before}},verification:{create:{after:!!e.databaseHooks?.verification?.create?.after,before:!!e.databaseHooks?.verification?.create?.before},update:{after:!!e.databaseHooks?.verification?.update?.after,before:!!e.databaseHooks?.verification?.update?.before}}}}}async function P1(e){}async function F1(){}var I1={pg:`postgresql`,mysql:`mysql`,mariadb:`mariadb`,sqlite3:`sqlite`,"better-sqlite3":`sqlite`,"@prisma/client":`prisma`,mongoose:`mongodb`,mongodb:`mongodb`,"drizzle-orm":`drizzle`};async function L1(){for(let[e,t]of Object.entries(I1)){let n=await P1(e);if(n)return{name:t,version:n}}}var R1={next:`next`,nuxt:`nuxt`,"react-router":`react-router`,astro:`astro`,"@sveltejs/kit":`sveltekit`,"solid-start":`solid-start`,"tanstack-start":`tanstack-start`,hono:`hono`,express:`express`,elysia:`elysia`,expo:`expo`};async function z1(){for(let[e,t]of Object.entries(R1)){let n=await P1(e);if(n)return{name:t,version:n}}}function B1(){let e=Vi.npm_config_user_agent;if(!e)return;let t=e.split(` `)[0],n=t.lastIndexOf(`/`),r=t.substring(0,n);return{name:r===`npminstall`?`cnpm`:r,version:t.substring(n+1)}}function V1(){let e=(...e)=>e.some(e=>!!Vi[e]);return e(`CF_PAGES`,`CF_PAGES_URL`,`CF_ACCOUNT_ID`)||typeof navigator<`u`&&navigator.userAgent===`Cloudflare-Workers`?`cloudflare`:e(`VERCEL`,`VERCEL_URL`,`VERCEL_ENV`)?`vercel`:e(`NETLIFY`,`NETLIFY_URL`)?`netlify`:e(`RENDER`,`RENDER_URL`,`RENDER_INTERNAL_HOSTNAME`,`RENDER_SERVICE_ID`)?`render`:e(`AWS_LAMBDA_FUNCTION_NAME`,`AWS_EXECUTION_ENV`,`LAMBDA_TASK_ROOT`)?`aws`:e(`GOOGLE_CLOUD_FUNCTION_NAME`,`GOOGLE_CLOUD_PROJECT`,`GCP_PROJECT`,`K_SERVICE`)?`gcp`:e(`AZURE_FUNCTION_NAME`,`FUNCTIONS_WORKER_RUNTIME`,`WEBSITE_INSTANCE_ID`,`WEBSITE_SITE_NAME`)?`azure`:e(`DENO_DEPLOYMENT_ID`,`DENO_REGION`)?`deno-deploy`:e(`FLY_APP_NAME`,`FLY_REGION`,`FLY_ALLOC_ID`)?`fly-io`:e(`RAILWAY_STATIC_URL`,`RAILWAY_ENVIRONMENT_NAME`)?`railway`:e(`DYNO`,`HEROKU_APP_NAME`)?`heroku`:e(`DO_DEPLOYMENT_ID`,`DO_APP_NAME`,`DIGITALOCEAN`)?`digitalocean`:e(`KOYEB`,`KOYEB_DEPLOYMENT_ID`,`KOYEB_APP_NAME`)?`koyeb`:null}async function H1(){return{deploymentVendor:V1(),systemPlatform:null,systemRelease:null,systemArchitecture:null,cpuCount:null,cpuModel:null,cpuSpeed:null,memory:null,isWSL:null,isDocker:null,isTTY:null}}function U1(){return Vi.CI!==`false`&&(`BUILD_ID`in Vi||`BUILD_NUMBER`in Vi||`CI`in Vi||`CI_APP_ID`in Vi||`CI_BUILD_ID`in Vi||`CI_BUILD_NUMBER`in Vi||`CI_NAME`in Vi||`CONTINUOUS_INTEGRATION`in Vi||`RUN_ID`in Vi)}function W1(){return typeof Deno<`u`?{name:`deno`,version:Deno?.version?.deno??null}:typeof Bun<`u`?{name:`bun`,version:Bun?.version??null}:typeof process<`u`&&process?.versions?.node?{name:`node`,version:process.versions.node??null}:{name:`edge`,version:null}}function G1(){return xi(`NODE_ENV`)===`production`?`production`:U1()?`ci`:vi()?`test`:`development`}async function K1(e){let t=await os(`SHA-256`).digest(e);return Di.encode(t)}var q1=e=>Oi(`a-z`,`A-Z`,`0-9`)(e||32),J1=null;async function Y1(e){if(J1)return J1;let t=await F1();return t?(J1=await K1(e?e+t:t),J1):e?(J1=await K1(e),J1):(J1=q1(32),J1)}var X1=async function(){};async function Z1(e,t){let n=e.telemetry?.debug||bi(`BETTER_AUTH_TELEMETRY_DEBUG`,!1),r=fi.BETTER_AUTH_TELEMETRY_ENDPOINT;if(!r&&!t?.customTrack)return{publish:X1};let i=async e=>{t?.customTrack?await t.customTrack(e).catch(ra.error):r&&(n?ra.info(`telemetry event`,JSON.stringify(e,null,2)):await Za(r,{method:`POST`,body:e}).catch(ra.error))},a=await(async()=>{let n=e.telemetry?.enabled!==void 0&&e.telemetry.enabled;return(bi(`BETTER_AUTH_TELEMETRY`,!1)||n)&&(t?.skipTestCheck||!vi())})(),o;return a&&(o=await Y1(typeof e.baseURL==`string`?e.baseURL:void 0),i({type:`init`,payload:{config:await N1(e,t),runtime:W1(),database:await L1(),framework:await z1(),environment:G1(),systemInfo:await H1(),packageManager:B1()},anonymousId:o})),{publish:async t=>{a&&(o||=await Y1(typeof e.baseURL==`string`?e.baseURL:void 0),await i({type:t.type,payload:t.payload,anonymousId:o}))}}}function Q1(e){let t=new Set(e).size;return t===0?0:Math.log2(t**+e.length)}function $1(e,t){let n=e===O1;if(!vi()){if(n&&gi)throw new N("You are using the default secret. Please set `BETTER_AUTH_SECRET` in your environment variables or pass `secret` in your auth config.");if(!e)throw new N("BETTER_AUTH_SECRET is missing. Set it in your environment or pass `secret` to betterAuth({ secret }).");e.length<32&&t.warn("[better-auth] Warning: your BETTER_AUTH_SECRET should be at least 32 characters long for adequate security. Generate one with `npx auth secret` or `openssl rand -base64 32`."),Q1(e)<120&&t.warn(`[better-auth] Warning: your BETTER_AUTH_SECRET appears low-entropy. Use a randomly generated secret for production.`)}}async function e0(e,t,n){let r=To(t);r||(t=Ga(t,{session:{cookieCache:{enabled:!0,strategy:`jwe`,refreshCache:!0,maxAge:t.session?.expiresIn||604800}}})),t.database||(t=Ga(t,{account:{storeAccountCookie:!0}}));let i=t.plugins||[],a=Ph(t),o=mi(t.logger),s=_o(t.baseURL);if(_o(t.baseURL)){let{allowedHosts:e}=t.baseURL;if(!e||e.length===0)throw new N(`baseURL.allowedHosts cannot be empty. Provide at least one allowed host pattern (e.g., ["myapp.com", "*.vercel.app"]).`)}let c=s?void 0:jo(typeof t.baseURL==`string`?t.baseURL:void 0,t.basePath);!c&&!s&&o.warn(`[better-auth] Base URL is not set. Set the baseURL option or BETTER_AUTH_URL env, or use a dynamic baseURL with allowedHosts for multi-host setups. Without it the origin is derived from the incoming request, and callbacks and redirects may not work correctly.`),e.id===`memory`&&t.advanced?.database?.generateId===!1&&o.error(`[better-auth] Misconfiguration detected.
520
+ You are using the memory DB with generateId: false.
521
+ This will cause no id to be generated for any model.
522
+ Most of the features of Better Auth will not work correctly.`);let l=t.secrets??A1(Vi.BETTER_AUTH_SECRETS),u=t.secret||Vi.BETTER_AUTH_SECRET||Vi.AUTH_SECRET||``,d,f;l?(j1(l,o),d=l[0].value,f=M1(l,u)):(d=u||`better-auth-secret-12345678901234567890`,$1(d,o),f=d),t={...t,secret:d,baseURL:s?t.baseURL:c?new URL(c).origin:``,basePath:t.basePath||`/api/auth`,plugins:i.concat(a)},uv(t,o);let p=t.advanced?.ipAddress?.trustedProxies;if(p&&p.length>0){let e=Oo(p);e.length>0&&o.warn(`Ignoring invalid \`advanced.ipAddress.trustedProxies\` entries: ${e.join(`, `)}. Each entry must be an IP address or CIDR range.`)}let m=Ea(t),h=Ri(t),g=(await Promise.all(Object.entries(t.socialProviders||{}).map(async([e,t])=>{let n=typeof t==`function`?await t():t;if(n==null||n.enabled===!1)return null;n.clientId||o.warn(`Social provider ${e} is missing clientId or clientSecret`);let r=d_[e](n);return r.disableImplicitSignUp=n.disableImplicitSignUp,r}))).filter(e=>e!==null),_=({model:e,size:n})=>{if(typeof t.advanced?.generateId==`function`)return t.advanced.generateId({model:e,size:n});let r=t?.advanced?.database?.generateId;return typeof r==`function`?r({model:e,size:n}):r===`uuid`?crypto.randomUUID():r===`serial`||r===!1?!1:Bi(n)},{publish:v}=await Z1(t,{adapter:e.id,database:typeof t.database==`function`?`adapter`:n(t.database)}),y=new Set(t.plugins.map(e=>e.id)),b=e=>t.plugins.find(t=>t.id===e)??null,x=e=>y.has(e),S=await Fh(t),C=await Bh(t),w={appName:t.appName||`Better Auth`,baseURL:c||``,version:Si(),socialProviders:g,options:t,oauthConfig:{storeStateStrategy:t.account?.storeStateStrategy||(r?`database`:`cookie`),skipStateCookieCheck:!!t.account?.skipStateCookieCheck},tables:h,trustedOrigins:S,trustedProviders:C,isTrustedOrigin(e,t){return this.trustedOrigins.some(n=>Zm(e,n,t))},sessionConfig:{updateAge:t.session?.updateAge===void 0?86400:t.session.updateAge,expiresIn:t.session?.expiresIn||604800,freshAge:t.session?.freshAge===void 0?86400:t.session.freshAge,cookieRefreshCache:(()=>{let e=t.session?.cookieCache?.refreshCache,n=t.session?.cookieCache?.maxAge||300;return r&&e?(o.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):e===!1||e===void 0?!1:e===!0?{enabled:!0,updateAge:Math.floor(n*.2)}:{enabled:!0,updateAge:e.updateAge===void 0?Math.floor(n*.2):e.updateAge}})()},secret:d,secretConfig:f,rateLimit:{...t.rateLimit,enabled:t.rateLimit?.enabled??gi,window:t.rateLimit?.window||10,max:t.rateLimit?.max||100,storage:t.rateLimit?.storage||(t.secondaryStorage?`secondary-storage`:`memory`)},authCookies:m,logger:o,generateId:_,session:null,secondaryStorage:t.secondaryStorage,password:{hash:t.emailAndPassword?.password?.hash||mm,verify:t.emailAndPassword?.password?.verify||hm,config:{minPasswordLength:t.emailAndPassword?.minPasswordLength||8,maxPasswordLength:t.emailAndPassword?.maxPasswordLength||128},checkPassword:R_},setNewSession(e){this.newSession=e},newSession:null,adapter:e,internalAdapter:Mh(e,{options:t,logger:o,hooks:t.databaseHooks?[{source:`user`,hooks:t.databaseHooks}]:[],generateId:_}),createAuthCookie:Ia(t),async runMigrations(){throw new N(`runMigrations will be set by the specific init implementation`)},publishTelemetry:v,skipCSRFCheck:!!t.advanced?.disableCSRFCheck,skipOriginCheck:t.advanced?.disableOriginCheck===void 0?!!vi():t.advanced.disableOriginCheck,runInBackground:t.advanced?.backgroundTasks?.handler??(e=>{e.catch(()=>{})}),async runInBackgroundOrAwait(e){try{t.advanced?.backgroundTasks?.handler?e instanceof Promise&&t.advanced.backgroundTasks.handler(e.catch(e=>{o.error(`Failed to run background task:`,e)})):await e}catch(e){o.error(`Failed to run background task:`,e)}},getPlugin:b,hasPlugin:x},T=Nh(w);return Qa(T)&&await T,w.checkSchema=js(w.adapter),w.explicitSchemaCheck=Is(w.adapter),w}var t0=async e=>{let t=await e0(await f1(e),e,e=>oc(e)||`unknown`);return t.runMigrations=async function(){if(!e.database||`updateMany`in e.database)throw new N(`Database is not provided or it's an adapter. Migrations are only supported with a database instance.`);let{runMigrations:t}=await D1(e);await t()},t},n0=(e,t)=>{let n=t(e).then(e=>{let t=e.options.advanced?.database?.validateSchema;if(!e.checkSchema&&t!==!1){let n=t===!0?`warn`:`debug`;e.logger[n](`Schema validation is not available for adapter "${e.adapter.id}". Skipping schema validation. Database operations will proceed normally.`)}let n=e.checkSchema?.();return n&&n.catch(t=>{e.logger.error(t instanceof Rs?t.message:`Could not validate the database schema. Check your database connection.`)}),e}),{api:r}=dv(n,e),i=e.plugins?.reduce((e,t)=>t.$ERROR_CODES?{...e,...t.$ERROR_CODES}:e,{}),a=async t=>{let r=await n,i=r.options.basePath||`/api/auth`,a;if(_o(e.baseURL))a=await Rh(r,t,Lh(r.options));else{a=Object.create(Object.getPrototypeOf(r),Object.getOwnPropertyDescriptors(r));let e=r.options;if(!r.options.baseURL){let n=jo(void 0,i,t,void 0,r.options.advanced?.trustedProxyHeaders);if(!n)throw new N(`Could not get base URL from request. Please provide a valid base URL.`);a.baseURL=n,a.options={...r.options,baseURL:ys(n)||void 0},e=a.options}a.trustedOrigins=await Fh(e,t),a.trustedProviders=await Bh(e,t)}let{handler:o}=fv(a,e);return us(a.adapter,()=>o(t))};return{handler:a,fetch:a,api:r,options:e,$context:n,$ERROR_CODES:{...i,...P}}},r0=e=>n0(e,t0);function i0(e){let t=``,n=32768;for(let r=0;r<e.length;r+=n)t+=String.fromCharCode(...e.subarray(r,r+n));return btoa(t)}var a0=i((e=>{var t=/^[-!#$%&'*+\/0-9=?A-Z^_a-z{|}~](\.?[-!#$%&'*+\/0-9=?A-Z^_a-z`{|}~])*@[a-zA-Z0-9](-*\.?[a-zA-Z0-9])*\.[a-zA-Z](-?[a-zA-Z0-9])+$/;e.validate=function(e){if(!e||e.length>254||!t.test(e))return!1;var n=e.split(`@`);return!(n[0].length>64||n[1].split(`.`).some(function(e){return e.length>63}))}}))(),o0=5242880,s0=Math.floor(o0*3/4),c0=16384,l0=`\r
523
+ `,u0=/^[\x20-\x7e]*$/,d0=/^[!-9;-~]+$/;function f0(e,t){for(let n=0;n<t.length;n++){let r=t.charCodeAt(n);if(r===13||r===10||r===0)throw new C0(`MIME_ERROR`,`${e}: must not contain CR, LF, or NUL.`)}}function p0(e){for(let t=0;t<e.length;t++){let n=e.charCodeAt(t);if(n<32&&n!==9||n===127)return t}return-1}function m0(e,t){let n=p0(t);if(n!==-1)throw new C0(`MIME_ERROR`,`${e} contains a control character (U+${t.charCodeAt(n).toString(16).toUpperCase().padStart(4,`0`)}).`)}var h0=`()<>@,;:\\"/[]?=`;function g0(e){return e>32&&e<127&&!h0.includes(String.fromCharCode(e))}function _0(e,t){let n=()=>new C0(`MIME_ERROR`,`${e} is not a valid media type (RFC 2045 §5.1: type/subtype, then ; attribute=value parameters).`),r=t.length,i=0,a=()=>{let e=i;for(;i<r&&g0(t.charCodeAt(i));)i++;return i-e},o=()=>{for(;i<r&&(t[i]===` `||t[i]===` `);)i++};if(a()===0||t[i]!==`/`||(i++,a()===0))throw n();let s=new Set;for(;i<r;){if(o(),t[i]!==`;`)throw n();i++,o();let c=i;if(a()===0||t[i]!==`=`)throw n();let l=t.slice(c,i).toLowerCase();if(i++,t[i]===`"`)for(i++;;){if(i>=r)throw n();let e=t[i++];if(e===`"`)break;if(e===`\\`){if(i>=r)throw n();i++}}else if(a()===0)throw n();if(l===`name`)throw new C0(`MIME_ERROR`,`${e} must not carry a name= parameter; the builder adds name="<filename>" itself.`);if(s.has(l))throw new C0(`MIME_ERROR`,`${e} gives the same parameter twice; attribute names are case-insensitive and each may appear once (RFC 6838 §4.3).`);s.add(l)}}var v0="!#$%&'*+-/=?^_`{|}~";function y0(e){return e>=48&&e<=57||e>=65&&e<=90||e>=97&&e<=122||v0.includes(String.fromCharCode(e))}function b0(e,t){let n=()=>new C0(`MIME_ERROR`,`${e} is not a valid Content-ID (RFC 5322 §3.6.4 msg-id: an identifier of atext, "." and "@", optionally in one pair of angle brackets).`),r=0,i=t.length;if(t[0]===`<`){if(i<2||t[i-1]!==`>`)throw n();r=1,i--}let a=()=>{let e=0;for(;r<i;r++){let n=t.charCodeAt(r);if(y0(n))e++;else if(n===46&&e>0)e=0;else break}return e>0};if(!a()||r<i&&(t[r]!==`@`||(r++,!a()))||r!==i)throw n()}var x0={txt:`text/plain`,html:`text/html`,htm:`text/html`,css:`text/css`,csv:`text/csv`,pdf:`application/pdf`,json:`application/json`,xml:`application/xml`,zip:`application/zip`,png:`image/png`,jpg:`image/jpeg`,jpeg:`image/jpeg`,gif:`image/gif`,webp:`image/webp`,svg:`image/svg+xml`,ico:`image/x-icon`,ics:`text/calendar`,eml:`message/rfc822`};function S0(e){return x0[e.split(`.`).pop()?.toLowerCase()??``]??`application/octet-stream`}var C0=class extends Error{code;constructor(e,t){super(t),this.name=`MimeError`,this.code=e}};function w0(e){return e===`from`?`INVALID_FROM`:e===`to`?`INVALID_TO`:`MIME_ERROR`}function T0(e,t,n){if(t.length>320)throw new C0(w0(e),`${e}: address is ${t.length} characters, over the 320-character limit.`);if(!(0,a0.validate)(t))throw new C0(w0(e),`${e}: address is not a valid email address (ASCII local part and dotted domain, RFC 5322 dot-atom; at most 64 characters before the '@' and 254 in total).`);if(n!==void 0){if(f0(`${e} display name`,n),u0.test(n)&&L0.test(n)&&n.length+G0>V0)throw new C0(w0(e),`${e}: display name is ${n.length} characters and must be quoted, which cannot be folded, so its line would exceed the ${V0}-octet limit in RFC 5322 §2.1.1. Shorten it.`);if(n.includes(`@`))throw new C0(w0(e),`${e}: display name '${n}' must not contain '@' (likely a malformed address).`)}}function E0(e){let t=e.indexOf(`\\`);if(t===-1)return e;let n=0;for(let r=t;r<e.length;r++)e.charCodeAt(r)===92&&(n++,r++);let r=new Uint16Array(e.length-n),i=0;for(let t=0;t<e.length;t++){let n=e.charCodeAt(t);n===92&&(n=e.charCodeAt(++t)),r[i++]=n}return Q0(r)}function D0(e,t){if(typeof e==`string`){f0(`${t} address`,e);let n=e.match(/^\s*"((?:[^"\\]|\\.)*)"\s*<\s*([^>\s]+)\s*>\s*$/),r=n??e.match(/^\s*(?:([^"<\s](?:[^"<]*[^"<\s])?)\s*)?<\s*([^>\s]+)\s*>\s*$/);if(r){let e=(n?E0(r[1]??``):r[1])?.trim(),i=r[2];return T0(t,i,e),e?{email:i,name:e}:{email:i}}let i=e.trim();return T0(t,i),{email:i}}return T0(t,e.email??``,e.name),e.name?{email:e.email,name:e.name}:{email:e.email}}function O0(e,t){return(Array.isArray(e)?e:[e]).map(e=>D0(e,t))}function k0(e){return e?Array.isArray(e)?e.length:1:0}function A0(e){return new C0(`MIME_ERROR`,`email: attachment size ${e} bytes exceeds Cloudflare limit of ${s0} bytes.`)}function j0(e){return e instanceof Uint8Array||e instanceof ArrayBuffer?e.byteLength:typeof Blob<`u`&&e instanceof Blob?e.size:typeof e==`string`?e.length:0}async function M0(e){if(e instanceof Uint8Array)return e;if(e instanceof ArrayBuffer)return new Uint8Array(e);if(typeof Blob<`u`&&e instanceof Blob)return new Uint8Array(await e.arrayBuffer());if(typeof e==`string`)return new TextEncoder().encode(e);throw new C0(`MIME_ERROR`,`attachment content must be string, Uint8Array, ArrayBuffer, or Blob.`)}async function N0(e){if(!e.filename)throw new C0(`MIME_ERROR`,`attachment: missing filename.`);if(f0(`attachment filename`,e.filename),e.filename.length+H0>V0)throw new C0(`MIME_ERROR`,`attachment filename is ${e.filename.length} characters; a quoted \`filename=\` parameter cannot be folded, so its line would exceed the ${V0}-octet limit in RFC 5322 §2.1.1. Shorten the filename.`);if(m0(`attachment filename`,e.filename),e.contentType!==void 0){if(f0(`attachment contentType`,e.contentType),e.contentType.length+U0>V0)throw new C0(`MIME_ERROR`,`attachment contentType is ${e.contentType.length} characters; at most ${V0-U0} fit on the Content-Type line under the ${V0}-octet limit in RFC 5322 §2.1.1. Shorten it.`);m0(`attachment contentType`,e.contentType),_0(`attachment contentType`,e.contentType)}if(e.contentId!==void 0){f0(`attachment contentId`,e.contentId);let t=e.contentId.startsWith(`<`)?0:2;if(e.contentId.length+t+W0>V0)throw new C0(`MIME_ERROR`,`attachment contentId is ${e.contentId.length} characters; at most ${V0-W0-t} fit on the Content-ID line under the ${V0}-octet limit in RFC 5322 §2.1.1. Shorten it.`);m0(`attachment contentId`,e.contentId),b0(`attachment contentId`,e.contentId)}if(e.disposition!==void 0&&e.disposition!==`attachment`&&e.disposition!==`inline`)throw new C0(`MIME_ERROR`,`attachment disposition must be 'attachment' or 'inline'.`);let t=await M0(e.content);return{filename:e.filename,contentType:e.contentType??S0(e.filename),bytes:t,contentId:e.contentId,disposition:e.disposition??(e.contentId?`inline`:`attachment`)}}async function P0(e){if(!e.text&&!e.html)throw new C0(`MIME_ERROR`,`email: at least one of 'text' or 'html' is required.`);if(e.subject!==void 0&&f0(`subject`,e.subject),e.headers){let t=0,n=0,r=new TextEncoder;for(let[i,a]of Object.entries(e.headers)){if(!d0.test(i))throw new C0(`MIME_ERROR`,`headers: '${i}' is not a valid RFC 5322 header name.`);if(i.length+K0>V0)throw new C0(`MIME_ERROR`,`headers: a header name is ${i.length} characters; a field name cannot be folded, so its line would exceed the ${V0}-octet limit in RFC 5322 §2.1.1. Shorten the name.`);if(t+i.length+a.length+4>c0||(t+=i.length+r.encode(a).byteLength+4,t>c0)||(f0(`header '${i}'`,a),!c2.has(i.toLowerCase())&&(n+i.length+m2+l2(a)>c0||(n+=B0(i,I0(a)).length+2,n>c0))))throw new C0(`MIME_ERROR`,`email: custom headers exceed the 16 KiB limit.`)}}let t=k0(e.to)+k0(e.cc)+k0(e.bcc);if(t>50)throw new C0(`INVALID_TO`,`email: too many recipients (max 50, got ${t}) across 'to', 'cc' and 'bcc'.`);let n=D0(e.from,`from`),r=O0(e.to,`to`);if(r.length===0)throw new C0(`INVALID_TO`,`email: 'to' must include at least one recipient.`);let i=e.cc?O0(e.cc,`cc`):[],a=e.bcc?O0(e.bcc,`bcc`):[],o=e.replyTo?D0(e.replyTo,`replyTo`):void 0,s=e.attachments??[];if(!Array.isArray(s))throw new C0(`MIME_ERROR`,`email: attachments must be an array.`);if(s.length>p2)throw new C0(`MIME_ERROR`,`email: too many attachments (max ${p2}, got ${s.length}).`);let c=[],l=0;for(let e of s){let t=j0(e.content);if(l+t>s0)throw A0(l+t);let n=await N0(e);if(l+=n.bytes.byteLength,l>s0)throw A0(l);c.push(n)}return e.threading?.inReplyTo&&f0(`threading.inReplyTo`,e.threading.inReplyTo),e.threading?.references&&f0(`threading.references`,e.threading.references),{from:n,to:r,cc:i,bcc:a,replyTo:o,subject:e.subject??``,text:e.text,html:e.html,headers:e.headers?{...e.headers}:{},attachments:c,threading:e.threading}}var F0=45;function I0(e){if(u0.test(e))return e;let t=new TextEncoder,n=new Uint8Array(49),r=0,i=[],a=()=>{r>0&&(i.push(`=?UTF-8?B?${i0(n.subarray(0,r))}?=`),r=0)};for(let i of e){let e=t.encode(i);r>0&&r+e.length>F0&&a(),n.set(e,r),r+=e.length}return a(),i.join(` `)}var L0=/[()<>[\]:;@\\,."]/;function R0(e){return e.name?u0.test(e.name)?L0.test(e.name)?`"${J0(e.name)}" <${e.email}>`:`${e.name} <${e.email}>`:`${I0(e.name)} <${e.email}>`:e.email}function z0(e){return e.map(R0).join(`, `)}function B0(e,t){let n=`${e}: ${t}`;if(n.length<=78)return n;let r=[],i=[`${e}:`],a=e.length+1,o=0,s=(e,t)=>{o++;let n=t?`${e},`:e;n.length>0&&a+1+n.length>76?(r.push(i.join(` `)),i=[``,n],a=1+n.length):(i.push(n),a+=1+n.length)},c=-1,l=-1,u=-1,d=e=>{c<0||(l>=0&&s(t.slice(l,u),!1),l=c,u=e,c=-1)},f=e=>{l>=0?(s(t.slice(l,u),!e),l=-1):s(``,!e)},p=!1,m=!1;for(let e=0;e<t.length;e++){let n=t[e];m?(m=!1,c<0&&(c=e)):n===`\\`&&p?(m=!0,c<0&&(c=e)):n===`"`?(p=!p,c<0&&(c=e)):!p&&n===`,`&&t[e+1]===` `?(d(e),f(!1),e++):!p&&(n===` `||n===` `)?d(e):c<0&&(c=e)}return d(t.length),f(!0),o<=1?n:(r.push(i.join(` `)),r.join(l0))}var V0=998,H0=12,U0=2,W0=12,G0=3,K0=1;function q0(e){let t=0,n=0;for(let r=0;r<e.length;r++){let i=e.charCodeAt(r);if(i===13&&e.charCodeAt(r+1)===10){if(n>V0)return{index:t,octets:n};t++,n=0,r++}else if(i<128)n+=1;else if(i<2048)n+=2;else if(i>=55296&&i<=56319&&r+1<e.length){let t=e.charCodeAt(r+1);t>=56320&&t<=57343?(n+=4,r++):n+=3}else n+=3}return n>V0?{index:t,octets:n}:void 0}function J0(e){return e.replace(/\\/g,`\\\\`).replace(/"/g,`\\"`)}function Y0(e){let t=new Uint8Array(8);crypto.getRandomValues(t);let n=``;for(let e of t)n+=e.toString(16).padStart(2,`0`);return`${e}_${Date.now().toString(36)}${n}`}function X0(e){let t=i0(e),n=[];for(let e=0;e<t.length;e+=76)n.push(t.slice(e,e+76));return n.join(l0)}function Z0(e){let t=new TextEncoder().encode(e),n=new Uint8Array(Math.ceil(t.length*3*(76/73))+8),r=0,i=0,a=`0123456789ABCDEF`,o=e=>{n[r++]=e},s=(e,t,n)=>{let r=n===void 0?t===void 0?1:2:3;i+r>75&&(o(61),o(13),o(10),i=0),o(e),t!==void 0&&o(t),n!==void 0&&o(n),i+=r},c=e=>s(61,a.charCodeAt(e>>4),a.charCodeAt(e&15));for(let e=0;e<t.length;e++){let n=t[e];if(n===10)o(13),o(10),i=0;else if(n===13){if(t[e+1]===10)continue;o(13),o(10),i=0}else n===32||n===9?e===t.length-1||t[e+1]===10||t[e+1]===13?c(n):s(n):n===61||n<32||n>126?c(n):s(n)}return Q0(n.subarray(0,r))}function Q0(e){let t=``,n=32768;for(let r=0;r<e.length;r+=n)t+=String.fromCharCode(...e.subarray(r,r+n));return t}function $0(e){let t=0;for(let n=0;n<e.length;n++){let r=e.charCodeAt(n);if(r===10)t=0;else{if(r===13){if(e.charCodeAt(n+1)===10)continue;return!0}if(r<32||r>126||(t++,t>990))return!0}}return!1}function e2(e){let t=0;for(let n=0;n<e.length;n++)e.charCodeAt(n)===10&&(n===0||e.charCodeAt(n-1)!==13)&&t++;if(t===0)return e;let n=new Uint8Array(e.length+t),r=0;for(let t=0;t<e.length;t++){let i=e.charCodeAt(t);i===10&&(t===0||e.charCodeAt(t-1)!==13)&&(n[r++]=13),n[r++]=i}return Q0(n)}function t2(e){let t=0;for(let n=0;n<e.length;n++){let r=e.charCodeAt(n);if(r<128)t+=1;else if(r<2048)t+=6;else if(r>=55296&&r<=56319&&n+1<e.length){let r=e.charCodeAt(n+1);if(r>=56320&&r<=57343){t+=12,n++;continue}t+=9}else t+=9}return t}function n2(e){return Math.ceil(e/3)*4}function r2(e){return e.headers.map(([e,t])=>B0(e,t)).join(l0)+`\r
524
+ \r
525
+ `+e.body}function i2(e,t){let n=$0(t);return{headers:[[`Content-Type`,`${e}; charset=UTF-8`],[`Content-Transfer-Encoding`,n?`quoted-printable`:`7bit`]],body:n?Z0(t):e2(t)}}function a2(e){let t=[[`Content-Type`,`${e.contentType}; name="${J0(e.filename)}"`],[`Content-Transfer-Encoding`,`base64`],[`Content-Disposition`,`${e.disposition}; filename="${J0(e.filename)}"`]];if(e.contentId){let n=e.contentId.startsWith(`<`)?e.contentId:`<${e.contentId}>`;t.push([`Content-ID`,n])}return{headers:t,body:X0(e.bytes)}}function o2(e){let t=new Uint8Array(16);return crypto.getRandomValues(t),`=_void_${e}_${i0(t).replace(/[+/=]/g,``)}`}function s2(e,t){let n=o2(e);return{headers:[[`Content-Type`,`multipart/${e}; boundary="${n}"`]],body:t.map(e=>`--${n}${l0}${r2(e)}`).join(l0)+`${l0}--${n}--${l0}`}}var c2=new Set([`from`,`to`,`cc`,`bcc`,`subject`,`reply-to`,`date`,`message-id`,`in-reply-to`,`references`,`mime-version`,`content-type`,`content-transfer-encoding`,`content-disposition`]);function l2(e){let t=0,n=0,r=!1;for(let i=0;i<e.length;i++){let a=e.charCodeAt(i);if(a<128){if(t+=1,a===32||a===9)continue;(a<32||a===127)&&(r=!0),n+=1}else if(r=!0,a<2048)t+=2;else if(a>=55296&&a<=56319&&i+1<e.length){let n=e.charCodeAt(i+1);if(n>=56320&&n<=57343){t+=4,i++;continue}t+=3}else t+=3}return r?Math.floor(t*4/3)+12*Math.floor(t/F0):n}function u2(e){return e.email.length+(e.name?l2(e.name):0)}function d2(e){let t=0;for(let n=0;n<e.length;n++){let r=e.charCodeAt(n);r!==32&&r!==9&&(t+=1)}return t}var f2=117,p2=Math.floor(o0/119),m2=4;function h2(e){let t=l2(e.subject);for(let[n,r]of Object.entries(e.headers))c2.has(n.toLowerCase())||(t+=n.length+m2+l2(r));t+=u2(e.from);for(let n of e.to)t+=u2(n);for(let n of e.cc)t+=u2(n);e.replyTo&&(t+=u2(e.replyTo)),e.threading?.inReplyTo&&(t+=d2(e.threading.inReplyTo)),e.threading?.references&&(t+=d2(e.threading.references));for(let n of e.attachments)t+=f2+2*n.filename.length,t+=d2(n.contentType),n.contentId&&(t+=d2(n.contentId));return t}function g2(e){let t=e.split(`@`)[1]??`localhost`,n=new Uint8Array(12);return crypto.getRandomValues(n),`<${i0(n).replace(/[+/=]/g,``)}@${t}>`}function _2(e){let t=h2(e)+(e.text?t2(e.text):0)+(e.html?t2(e.html):0)+e.attachments.reduce((e,t)=>e+n2(t.bytes.byteLength),0);if(t>5242880)throw new C0(`MIME_ERROR`,`email: message is at least ${t} bytes once encoded, which exceeds Cloudflare limit of ${o0} bytes.`);let n=g2(e.from.email),r=[[`Date`,new Date().toUTCString().replace(`GMT`,`+0000`)],[`From`,R0(e.from)],[`To`,z0(e.to)]];e.cc.length>0&&r.push([`Cc`,z0(e.cc)]),e.replyTo&&r.push([`Reply-To`,R0(e.replyTo)]),r.push([`Subject`,I0(e.subject)]),r.push([`Message-ID`,n]),e.threading?.inReplyTo&&r.push([`In-Reply-To`,e.threading.inReplyTo]),e.threading?.references&&r.push([`References`,e.threading.references]),r.push([`MIME-Version`,`1.0`]);for(let[t,n]of Object.entries(e.headers))c2.has(t.toLowerCase())||r.push([t,I0(n)]);let i=e.text?i2(`text/plain`,e.text):void 0,a=e.html?i2(`text/html`,e.html):void 0,o;if(o=i&&a?s2(`alternative`,[i,a]):i??a,e.attachments.length>0){let t=e.attachments.filter(e=>e.disposition===`inline`),n=e.attachments.filter(e=>e.disposition!==`inline`);t.length>0&&a?o=s2(`related`,[o,...t.map(a2)]):n.push(...t),n.length>0&&(o=s2(`mixed`,[o,...n.map(a2)]))}for(let[e,t]of o.headers)r.push([e,t]);let s=r.map(([e,t])=>B0(e,t)).join(l0)+`\r
526
+ \r
527
+ `+o.body,c=new TextEncoder().encode(s),l=q0(s);if(l!==void 0)throw new C0(`MIME_ERROR`,`email: header line ${l.index+1} is ${l.octets} octets, over the ${V0}-octet limit in RFC 5322 §2.1.1. A value with no whitespace cannot be folded — shorten it, or move it into the body.`);if(c.byteLength>5242880)throw new C0(`MIME_ERROR`,`email: message size ${c.byteLength} bytes exceeds Cloudflare limit of ${o0} bytes.`);return{raw:c,messageId:n}}var v2=`/__void/inbox/_capture`,y2=`__VOID_EMAIL_DEV_INBOX`,b2=`__VOID_EMAIL_DEV_INBOX_TOKEN`;function x2(e){return JSON.stringify({...e,raw:i0(e.raw)})}var S2=`__voidEmailSinks__`,C2=globalThis;function w2(){let e=C2[S2];return e||(e={sinks:new Set},C2[S2]=e),e}function T2(e){for(let t of w2().sinks)try{t(e)}catch(e){console.warn(`[email-dev-inbox] sink error:`,e)}}function E2(){return w2().sinks.size>0}function D2(e,t,n){return{id:Y0(`dev`),capturedAt:Date.now(),raw:t,messageId:n,from:e.from,to:e.to,cc:e.cc,bcc:e.bcc,replyTo:e.replyTo,subject:e.subject,text:e.text,html:e.html,headers:{...e.headers},attachments:e.attachments.map(e=>({filename:e.filename,contentType:e.contentType,size:e.bytes.byteLength,contentId:e.contentId,disposition:e.disposition}))}}new TextEncoder,new TextDecoder(`utf-8`,{fatal:!0});var O2=new TextDecoder(`utf-8`,{fatal:!0,ignoreBOM:!1});async function k2(e,t,n){if(e<=0)throw n();let r;try{return await Promise.race([t(),new Promise((t,i)=>{r=setTimeout(()=>i(n()),e)})])}finally{r!==void 0&&clearTimeout(r)}}async function A2(e,t,n,{rejectEncoding:r=!1}={}){let i=e.headers.get(`content-length`);if(r&&e.headers.has(`content-encoding`)||i!==null&&(!/^\d+$/.test(i)||Number(i)>t))throw e.body?.cancel().catch(()=>{}),Error(`email response refused before reading`);let a=e.body?.getReader();if(!a)throw Error(`email response is empty`);let o=new Uint8Array(t),s=0;try{for(;;){let e=await n(()=>a.read());if(e.done)break;if(s+e.value.byteLength>t)throw Error(`email response too large`);o.set(e.value,s),s+=e.value.byteLength}}finally{a.cancel().catch(()=>{});try{a.releaseLock()}catch{}}if(i!==null&&s!==Number(i))throw Error(`email response length mismatch`);return JSON.parse(O2.decode(o.subarray(0,s)))}new TextEncoder;function j2(){try{return Kc()}catch{return}}function M2(e){let t=j2()?.[e];return typeof t==`string`&&t.length>0?t:void 0}var N2=/^[a-z0-9](?:[a-z0-9-]{0,54}[a-z0-9])?$/;function P2(){let e=M2(`__VOID_PROJECT_SLUG`);return e!==void 0&&N2.test(e)?e:void 0}function F2(e){return new ReadableStream({start(t){t.enqueue(e),t.close()}})}function I2(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function L2(e,t,n){return n===void 0?{code:e,message:t}:{code:e,message:t,cause:n}}var R2=`SEND_EMAIL`,z2=3e4,B2=6e4,V2=class extends Error{constructor(){super(`email binding outcome unknown after timeout`),this.name=`EmailBindingTimeoutError`}};function H2(e){let t=e?.[R2];if(typeof t==`object`&&t)return typeof t.send==`function`?t:void 0}function U2(e){let t=e instanceof Error?e.message:String(e);switch(typeof e?.code==`string`?e.code:``){case`E_RECIPIENT_NOT_ALLOWED`:return L2(`UNVERIFIED_DESTINATION`,t,e);case`E_SENDER_NOT_VERIFIED`:case`E_SENDER_DOMAIN_NOT_AVAILABLE`:return L2(`INVALID_FROM`,t,e);case`E_RATE_LIMIT_EXCEEDED`:case`E_DAILY_LIMIT_EXCEEDED`:return L2(`QUOTA_EXCEEDED`,t,e)}return W2.test(t)?L2(`UNVERIFIED_DESTINATION`,t,e):L2(`OUTCOME_UNKNOWN`,t,e)}var W2=/^[^\n]{0,200}destination address[^\n]{0,200}not (?:yet )?verified/i;async function G2(e,t,n,r,i){let a;try{({EmailMessage:a}=await import(`cloudflare:email`))}catch(e){return J2(`UPSTREAM_ERROR`,`email: SEND_EMAIL is bound but cloudflare:email could not be loaded: ${e instanceof Error?e.message:String(e)}`,e)}let o=[],s=Date.now()+B2,c=()=>Math.min(z2,s-Date.now());for(let s=0;s<n.length;s++){let l=n[s];if(c()<=0){for(let e of n.slice(s))o.push({recipient:e,ok:!1,state:`cancelled`,error:L2(`UPSTREAM_ERROR`,`email: batch deadline elapsed before provider submission`)});break}try{let n=await k2(c(),()=>e.send(new a(t,l,F2(r))),()=>new V2),s=typeof n?.messageId==`string`?n.messageId:``;o.push({recipient:l,ok:!0,messageId:s||i})}catch(e){let t=e instanceof V2?L2(`OUTCOME_UNKNOWN`,`email: binding submission timed out; inspect provider logs before retrying`,e):U2(e);o.push({recipient:l,ok:!1,...t.code===`OUTCOME_UNKNOWN`?{state:`outcome_unknown`}:{},error:t})}}return o.some(e=>!e.ok)?{ok:!1,deliveries:o}:{ok:!0,ids:o.map(e=>({recipient:e.recipient,messageId:e.messageId}))}}function K2(e){let t=new Set,n=[];for(let r of[...e.to,...e.cc,...e.bcc]){let e=r.email.toLowerCase();t.has(e)||(t.add(e),n.push(e))}return n}function q2(e){let t=e.from;if(!(t==null||typeof t==`string`&&t.trim()===``||typeof t==`object`&&t&&!(`email`in t)))return e;let n=M2(`__VOID_EMAIL_FROM`);if(n)return{...e,from:n};let r=P2(),i=M2(`__VOID_EMAIL_DOMAIN`);if(!r||!i){if(t===null){let t={...e};return delete t.from,t}return e}return{...e,from:`${r}+noreply@${i}`}}function J2(e,t,n){return{ok:!1,error:L2(e,t,n)}}function Y2(e){return[`BINDING_MISSING`,`INVALID_FROM`,`INVALID_TO`,`UNVERIFIED_DESTINATION`,`MIME_ERROR`,`QUOTA_EXCEEDED`,`IDEMPOTENCY_CONFLICT`,`OUTCOME_UNKNOWN`,`UPSTREAM_ERROR`].find(t=>t===e)??`UPSTREAM_ERROR`}function X2(e){if(typeof e!=`object`||!e||Array.isArray(e))return null;let{error:t,message:n}=e;return typeof t!=`string`||t===``?null:typeof n==`string`&&n!==``?n:t}function Z2(e){if(!I2(e))return null;let t=e.operationId;if(e.ok===!0&&Array.isArray(e.ids))return{ok:!0,ids:e.ids,operationId:t};if(e.ok!==!1)return null;if(Array.isArray(e.deliveries))return{ok:!1,deliveries:e.deliveries,operationId:t};let n=e.error;return typeof n==`object`&&n?{ok:!1,error:{code:`code`in n?n.code:void 0,message:`message`in n?n.message:void 0},operationId:t}:null}function Q2(e,t,n,r){if(e.length!==t.length)return{ok:!1,reason:`expected ${t.length} deliveries, got ${e.length}`};let i=new Set(t),a=new Set,o=[];for(let[t,s]of e.entries()){let e=typeof s==`object`&&s?s:null,c=e?.recipient;if(e===null||typeof c!=`string`)return{ok:!1,reason:`entry ${t} is not ${n}`};let l=r(e,c);if(l===void 0)return{ok:!1,reason:`entry ${t} is not ${n}`};if(!i.has(c))return{ok:!1,reason:`entry ${t} names a recipient that was not requested`};if(a.has(c))return{ok:!1,reason:`entry ${t} repeats a recipient`};a.add(c),o.push(l)}return{ok:!0,entries:o}}function $2(e,t,n){return Q2(e,t,`{ recipient: string, messageId: string }`,(e,t)=>typeof e.messageId==`string`?{recipient:t,messageId:e.messageId||n,...e.state===`provider_accepted`?{state:`provider_accepted`}:{}}:void 0)}function e4(e,t,n){return Q2(e,t,`{ recipient: string, ok: true, messageId: string } | { recipient: string, ok: false, error: { message: string } }`,(e,t)=>{if(e.ok===!0)return typeof e.messageId==`string`?{recipient:t,ok:!0,messageId:e.messageId||n,...e.state===`provider_accepted`?{state:`provider_accepted`}:{}}:void 0;if(e.ok===!1){let n=t4(e.state),r=e.error;return typeof r==`object`&&r&&typeof r.message==`string`?{recipient:t,ok:!1,error:L2(Y2(r.code),r.message),...n?{state:n}:{}}:void 0}})}function t4(e){return[`rejected`,`reserved`,`attempt_started`,`provider_accepted`,`failed`,`outcome_unknown`,`cancelled`].find(t=>t===e)}var n4=65536;async function r4(e,t,n,r){let i;try{i=await A2(e,n4,r)}catch{return J2(`OUTCOME_UNKNOWN`,`email: could not establish the send outcome (status ${e.status}); check email logs or repeat the same idempotency key`)}let a=Z2(i);if(a===null){let t=X2(i);return!e.ok&&t!==null?J2(`UPSTREAM_ERROR`,`email: proxy returned ${e.status}: ${t}`,i):J2(`OUTCOME_UNKNOWN`,`email: proxy returned malformed response (status ${e.status})`,i)}let o=e=>J2(`OUTCOME_UNKNOWN`,`email: proxy returned a malformed delivery list (${e}); do not retry with a new idempotency key`,i),s=typeof a.operationId==`string`&&a.operationId.length<=128?{operationId:a.operationId}:{};if(a.ok===!0){let e=$2(a.ids,t,n);return e.ok?{ok:!0,ids:e.entries,...s}:o(e.reason)}if(`deliveries`in a){let e=e4(a.deliveries,t,n);return e.ok?{ok:!1,deliveries:e.entries,...s}:o(e.reason)}let c=a.error;return{...J2(Y2(c.code),typeof c.message==`string`?c.message:`email: upstream send failed`),...s}}function i4(e){let t=e?.[y2];if(typeof t!=`string`||t.length===0)return;let n=e?.[t];if(typeof n!=`object`||!n||typeof n.fetch!=`function`)return;let r=e?.[b2];return{fetcher:n,token:typeof r==`string`&&r.length>0?r:void 0}}var a4=5e3,o4=200,s4=1e3;async function c4(e){let t;try{let n=e.body?.getReader();if(!n)return``;let r=await Promise.race([n.read().then(({value:e})=>e),new Promise(e=>{t=setTimeout(()=>e(void 0),s4)})]);return n.cancel().catch(()=>{}),r?new TextDecoder().decode(r).trim().split(`
528
+ `)[0].slice(0,o4):``}catch{return``}finally{t!==void 0&&clearTimeout(t)}}async function l4(e,t){let n;try{let r=Promise.resolve(e.fetcher.fetch(`http://localhost${v2}`,{method:`POST`,headers:{"content-type":`application/json`,...e.token!==void 0&&{"x-void-dev-trigger":e.token}},body:x2(t)})).then(e=>({kind:`response`,res:e}),e=>({kind:`error`,cause:e})),i=await Promise.race([r,new Promise(e=>{n=setTimeout(()=>e({kind:`timeout`}),a4)})]);if(i.kind===`timeout`)return{ok:!1,reason:`no response within ${a4}ms`};if(i.kind===`error`){let e=i.cause;return{ok:!1,reason:e instanceof Error?e.message:String(e)}}let{res:a}=i;if(!a.ok){let e=await c4(a);return{ok:!1,reason:`dev server responded ${a.status}${e?`: ${e}`:``}`}}return a.headers.get(`x-void-email-inbox`)===`captured`?{ok:!0}:{ok:!1,reason:`response did not come from the dev inbox`}}catch(e){return{ok:!1,reason:e instanceof Error?e.message:String(e)}}finally{n!==void 0&&clearTimeout(n)}}function u4(e,t){return{ok:!0,ids:K2(e).map(e=>({recipient:e,messageId:t}))}}async function d4(e){if(e.idempotencyKey!==void 0&&(typeof e.idempotencyKey!=`string`||!/^[\x21-\x7e]{1,128}$/.test(e.idempotencyKey)))return J2(`MIME_ERROR`,`email: idempotencyKey must contain 1–128 printable non-space ASCII characters.`);let t=q2(e);if(t.from===void 0)return J2(`INVALID_FROM`,`email: 'from' is required. Set it explicitly or deploy via Void so the platform-injected __VOID_PROJECT_SLUG and __VOID_EMAIL_DOMAIN can default it to <slug>+noreply@<domain>.`);let n=t,r,i,a;try{r=await P0(n),{raw:i,messageId:a}=_2(r)}catch(e){return e instanceof C0?J2(e.code,e.message,e):J2(`MIME_ERROR`,e instanceof Error?e.message:String(e),e)}let o=j2();if(!e.sendInDev&&E2()){let e=D2(r,i,a);return T2(e),u4(r,e.id)}let s=e.sendInDev?void 0:i4(o);if(s){let e=D2(r,i,a),t=await l4(s,e);if(t.ok)return u4(r,e.id);let n=`email: the void dev inbox at ${v2} is unreachable (${t.reason}), so nothing was captured and nothing was sent.`;return console.warn(`[void/email] ${n}`),J2(`UPSTREAM_ERROR`,n)}let c=K2(r),l=H2(o);if(l)return e.idempotencyKey===void 0?G2(l,r.from.email,c,i,a):J2(`MIME_ERROR`,`email: idempotencyKey requires a Void platform; the native Cloudflare binding cannot deduplicate sends.`);let u=o,d=u?.__VOID_PROXY,f=u?.__PROJECT_ID,p=u?.__VOID_PROXY_TOKEN;if(!d||!f||!p)return J2(`BINDING_MISSING`,"email: neither SEND_EMAIL nor __VOID_PROXY is available, so nothing was sent. Deploy via Void to bind the platform proxy, or set `email.from` in void.config.ts so `void deploy --platform cloudflare` provisions the SEND_EMAIL binding. Under `void dev` messages are captured by the local inbox at /__void/inbox instead — reaching this error there means that path was bypassed by the deprecated `sendInDev: true` (it never delivers) or unavailable (the worker has no assets binding to reach the dev server through).");let m={projectId:f,aiToken:p,from:r.from.email,recipients:c,mimeBase64:i0(i),requestId:Y0(`req`),...e.idempotencyKey===void 0?{}:{idempotencyKey:e.idempotencyKey}},h=JSON.stringify(m),g=new AbortController,_=Date.now()+B2,v=e=>k2(_-Date.now(),e,()=>(g.abort(),Error(`email platform send timed out`))),y;try{y=await v(()=>d.fetch(`https://email-proxy/email/send`,{method:`POST`,headers:{"content-type":`application/json`},body:h,signal:g.signal}))}catch(e){return J2(`OUTCOME_UNKNOWN`,`email: send outcome is unknown: ${e instanceof Error?e.message:String(e)}. Check email logs or repeat the same idempotency key; do not create a new send.`,e)}return r4(y,c,a,v)}var f4=[`example.com`,`example.net`,`example.org`];function p4(e){let{domain:t,email:n}=e;return!t||!f4.some(e=>e===t)?!1:n.toLowerCase().endsWith(`@${t}`)}var m4=class extends Error{name=`Auth.UndeliverableError`},h4=TP(async(e,t)=>{e.set(`auth`,g4(e)),await t()});function g4(e){return r0(wP({accountStep:t=>{if(e.var.accountChosen)return Promise.resolve(!1);let n=WM(t.query);return Y(e,yQ(e,{chainId:n&&!(n instanceof $D)?Number(n.chainId):void 0,clientId:t.clientId,cookie:t.headers.get(`cookie`),sessionId:t.sessionId,userId:t.userId}),`AccountStep.due`)},baseURL:I.URL,cache:e.var.cache,db:YZ,metadataFetch:wD(e.env.CLIENT_METADATA),pendingKey:t=>Y(e,i$($,t),`PendingKey.take`),secret:I.SECRET,sendCode:t=>v4(e,t),sessionCreated:t=>e.set(`newSession`,{session:{id:t.id},user:{id:t.userId}}),signUpDomains:_4(),userCreated:t=>zY(e,{userId:t.id}),waitUntil:t=>e.executionCtx.waitUntil(t)}))}function _4(){let e=(I.SIGN_UP_DOMAINS??``).split(`,`).map(e=>e.trim().toLowerCase()).filter(Boolean);return e.length>0?e:void 0}async function v4(e,t){let n=YD({code:t.code}),r=e.env.TEST_INBOX;if(r&&p4({domain:I.TEST_EMAIL_DOMAIN,email:t.email})){await Y(e,r.capture({subject:n.subject,text:n.text,to:[{email:t.email}]}),`inbox.capture`);return}let i=await Y(e,d4({attachments:[n.logo],html:n.html,subject:n.subject,text:n.text,to:t.email}),`email.send`);if(i.ok)return;let a=`error`in i?i.error.code:void 0;throw a===`QUOTA_EXCEEDED`?new nO:a===`UNVERIFIED_DESTINATION`?new m4(`The email service does not deliver to the address.`):Error(`Sending the sign-in code failed: ${a??`delivery`}.`)}(function(e){e.errors=[nO]})(v4||={});async function y4(e,t){let{clientId:n,userId:r}=t;if(!A$(e))try{let[i]=await Y(e,$.select({held:V`exists (${$.select({realmId:EE.realmId}).from(EE).where(W(EE.userId,r))}) or exists (${$.select({id:DE.id}).from(DE).where(qC(W(DE.userId,r),rw(DE.address)))})`}).from(V`(values (1)) as one`),`db.account.held`);if(i?.held||!await GI(e,{binding:`ACCOUNT_LIMIT`,key:r}))return;let a=await Y(e,WL(e,{clientId:n??void 0,db:$,own:new URL(I.URL).origin}),`Realm.forRequest`),o=await Y(e,JL(e,{db:$,origin:I.URL,realms:a}),`Realm.withDefaults`),s=await(async()=>{if(t.email!==void 0)return t.email;if(!nQ(e,{realms:o}))return;let[n]=await Y(e,$.select({email:bE.email}).from(bE).where(W(bE.id,r)),`db.user.get`);return n?.email})();if(s!==void 0&&await Y(e,tQ(e,{email:s,realms:o,userId:r}),`Configure.awaitsUpgrade`))return;await Y(e,cX(e,{db:$,env:I,realms:o,userId:r}),`TempoAccount.create`)}catch(t){$s(e,{error:t,fields:{clientId:n??void 0},message:`The sign-in created no first account, since its creation failed.`})}}var b4=`tempo-id-passkey-link`,x4=`host`;async function S4(e,t){let n=PF(e,b4,x4);if(!n)return;let r=await Y(e,mP(n,{host:new URL(e.req.url).host,secret:I.SECRET}),`Passkey.unseal`);if(!r)return;let[i,a]=await Y(e,Promise.all([r.nonce,t.nonce].map(e=>crypto.subtle.digest(`SHA-256`,new TextEncoder().encode(e)))),`crypto.digest`);return crypto.subtle.timingSafeEqual(i,a)?r:void 0}async function C4(e,t){let n=sr(crypto.getRandomValues(new Uint8Array(32)),{pad:!1,url:!0});return LF(e,b4,await Y(e,rP({address:t.credential.address,createdAt:t.credential.createdAt,expiresAt:Math.floor(Date.now()/1e3)+300,host:new URL(e.req.url).host,id:t.id,nonce:n,publicKey:t.credential.publicKey,rpId:t.rpId},{secret:I.SECRET}),`Passkey.seal`),{httpOnly:!0,maxAge:300,path:`/`,prefix:x4,sameSite:`Lax`,secure:!0}),n}async function w4(e){let t=await crypto.subtle.digest(`SHA-256`,new TextEncoder().encode(e.nonce));return xn(new Uint8Array(t))}async function T4(e){if(!e.expected)return!1;let t=await w4({nonce:e.nonce});return t.length===e.expected.length&&crypto.subtle.timingSafeEqual(hn(t).buffer,hn(e.expected).buffer)}function E4(e){RF(e,b4,{path:`/`,prefix:x4,secure:!0})}var D4=/^[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?$/,O4;(function(e){let t;(function(e){e.json=A({email:j().trim().toLowerCase().pipe(Li({abort:!0}).max(254,{abort:!0,error:`Invalid email address`}).refine(e=>{let[t=``,n=``]=e.split(`@`);return t.length<=64&&n.split(`.`).every(e=>D4.test(e))},`Invalid email address`)).meta({description:`The user's email address.`,examples:[`ada@example.com`]})}),e.response=A({sent:oa(!0).meta({description:`The request is accepted. The value is the same for every address.`})})})(t||=e.code||={});let n;(function(e){e.json=A({assertion:BN.assertion.optional().meta({description:"The assertion of the email step's passkey, over a challenge from `POST /v1/auth/passkey/options` with `link`. Required with `link`, since only the person who holds the passkey can link it."}),authorize:VM.request.optional().meta({description:"The app's headless authorization request, as `POST /v1/authorize` takes it, from a first-party app's page. The sign-in then authorizes the app in the same request, creates a first Tempo Account for a user who holds none, and returns the authorization. A refusal that depends only on the app and the request, such as a key over the headless ceiling, comes before the sign-in and leaves the code unspent. A refusal of the authorization server after the sign-in, such as for a scope that the app's registration lacks, spends the code. Not with `link` or `oauth_query`."}),code:j().trim().regex(/^\d{6}$/).meta({description:`The six-digit emailed code.`,examples:[`123456`]}),email:t.json.shape.email,link:j().max(64).optional().meta({description:"The email step's `link`, which links the wallet.tempo passkey that asked for it to this user, with that passkey's `assertion`. An expired link refuses the sign-in with `passkey_link_expired`, and the code stays valid.",examples:[`dGhlIG5vbmNlIHRoYXQgdGhlIHN0ZXAgY2Fycmllcw`]}),passkey:oa(!0).optional().meta({description:"With `authorize`, requests the passkey step for an account that a passkey owns, in place of `webauthn_required`. The response's `authorization` is then the step, which the page signs, and `POST /v1/authorize` with `passkey: { assertion }` signs the key."}),oauth_query:j().max(8192).optional().meta({description:`The sign-in page's query string, which Better Auth signs when an app's authorization request sends the browser there. At most 8,192 characters.`,examples:[`client_id=client_01JZ8Q6W3N1R5B4V7C2X9K0M3T&response_type=code&exp=1760000000&sig=Gx3kB0`]})}).refine(e=>!e.link||e.assertion,{message:"Required with `link`.",path:[`assertion`]}).refine(e=>!e.authorize||!e.link&&!e.oauth_query,{message:"Not allowed with `link` or `oauth_query`.",path:[`authorize`]});let n=e.user=A({email:Li().meta({description:`The user's email address.`,examples:[`ada@example.com`]}),id:j().meta({description:"The user's ID, which is the `sub` of every token Tempo ID issues for the user.",examples:[`user_01JZ8Q6W3N1R5B4V7C2X9K0M3T`]})}).meta({description:`The signed-in user.`,id:`User`});e.response=A({authorization:Ui([VM.response,BN.headlessStep]).optional().meta({description:"The app's headless authorization, for a sign-in that carried `authorize`, or a sign-in with key signature on the app's page whose options carried it. With `passkey`, the passkey step for a passkey-owned account. Absent for any other sign-in."}),redirect:Hi().nullable().meta({description:"Where the browser continues: the app's `redirect_uri` with an authorization code, or `null` for a sign-in that no app waits on.",examples:[`https://app.example.com/callback?code=SplxlOBeZQQYbYS6WxSbIA`]}),user:n}),e.signedIn=Ui([A({url:j()}),A({user:A({email:j(),id:j()})})])})(n||=e.verify||={});let r;(function(e){e.json=A({authorize:VM.request.optional().meta({description:"The app's headless authorization request, as `POST /v1/authorize` takes it, from a first-party app's page. The challenge is then the digest of its key, so the passkey's one assertion signs the user in and signs the key, and `POST /v1/auth/passkey/verify` returns the authorization. Requires `client_id`, the same as its own."}),client_id:j().min(1).max(64).optional().meta({description:"The client ID of the first-party app whose page runs the ceremony, which selects the app's realms. Required from an app's page, whose `Origin` must be one of the app's redirect URI origins.",examples:[`client_01JZ8Q6W3N1R5B4V7C2X9K0M3T`]}),credentialId:Ui([BN.credentialId,Gi(BN.credentialId).max(16)]).optional().meta({description:"The credential ID, or up to 16 IDs, that the browser offers as `allowCredentials`, base64url. Defaults to every discoverable passkey of the relying party, as an empty list does.",examples:[`KEbWNCc7NgaYnUyrNeFGX9_3Y-8`]}),link:n.json.shape.link.meta({description:"The email step's `link`, which limits the options to that step's passkey, in place of `credentialId`. The emailed-code sign-in then sends the passkey's assertion with the `link`.",examples:[`dGhlIG5vbmNlIHRoYXQgdGhlIHN0ZXAgY2Fycmllcw`]}),mediation:Qi([`conditional`,`optional`,`required`,`silent`]).optional().meta({description:"Returned in the options for `navigator.credentials.get()`, such as `conditional` for passkey autofill.",examples:[`conditional`]}),oauth_query:n.json.shape.oauth_query,user_code:j().max(32).optional().meta({description:"The user code of the device grant that the sign-in returns to, ignored with `oauth_query` or `client_id`. A pending, unbound code selects its app's realms, and any other code selects the `default` realm.",examples:[`WDJB-MJHT`]})}).refine(e=>!e.authorize||e.authorize.client_id===e.client_id,{message:"Requires the same `client_id`.",path:[`authorize`]}),e.sent=A({authorize:Mi({key_authorization:Mi({}).optional()})}),e.response=A({options:A({mediation:r.json.shape.mediation,publicKey:A({allowCredentials:Gi(A({id:j().meta({description:`A credential ID, base64url.`,examples:[`KEbWNCc7NgaYnUyrNeFGX9_3Y-8`]}),type:oa(`public-key`).meta({description:`The credential type.`})}).meta({description:`A passkey the browser offers.`})).optional().meta({description:"The passkeys the browser offers, from `credentialId`. Absent, it offers every discoverable passkey of the relying party."}),challenge:Ci([`0x`,j()]).meta({description:`The single-use challenge, as hex. It expires after 5 minutes.`,examples:[`0xf6310589abb21116acc6e123967ed0a125b5041c43f8e157237093e07eaa354c`]}),rpId:j().meta({description:`The relying party ID of the passkeys.`,examples:[`tempo.xyz`]}),userVerification:oa(`required`).meta({description:`Every passkey sign-in requires user verification.`})}).meta({description:"The `PublicKeyCredentialRequestOptions`, serialized with the challenge as hex."})}).meta({description:"The options for `navigator.credentials.get()`."})})})(r||=e.passkeyOptions||={});let i;(function(e){e.json=A({assertion:BN.assertion,oauth_query:n.json.shape.oauth_query}),e.response=Ui([n.response.meta({description:`The signed-in user.`}),A({step:A({link:j().meta({description:"Send as `link` with the emailed-code sign-in, which links the passkey to that user.",examples:[`dGhlIG5vbmNlIHRoYXQgdGhlIHN0ZXAgY2Fycmllcw`]}),signed:oa(!1).meta({description:`Whether the assertion already signed a key authorization. This route signs none.`}),type:oa(`email`).meta({description:`Sign in with an emailed code, which links the passkey to that user.`})}).meta({description:`The email step, for a wallet.tempo passkey whose account has no email.`})}).meta({description:`A passkey sign-in that continues when the user verifies an email address.`})])})(i||=e.passkeyVerify||={});let a;(function(e){e.response=A({signed_out:oa(!0).meta({description:`The session is over, or there was none.`})})})(a||=e.logout||={});let o;(function(e){e.response=A({user:n.user.extend({name:j().nullable().meta({description:"The user's name, or `null` for a user who signed up without one.",examples:[`Ada Lovelace`]})}).nullable().meta({description:"The signed-in user, or `null` without a session.",id:`SessionUser`})})})(o||=e.session||={});let s;(function(e){e.response=A({assets:Gi(j().meta({description:`The path of a script or style sheet on Tempo ID's origin.`,examples:[`/assets/index-QK4GWdO3.js`]})).meta({description:`The sign-in page's scripts and style sheets, each once.`,examples:[[`/assets/index-QK4GWdO3.js`,`/assets/zyzz-DYC-X0_B.css`]]})})})(s||=e.assets||={});let c;(function(e){e.query=A({oauth_query:n.json.shape.oauth_query,return_to:j().max(2048).optional().meta({description:`The page that sign-in returns to, from the sign-in page's query. Only a path on the device page passes, and any other value reads as absent.`,examples:[`/device?code=WDJB-MJHT`]})}),e.response=A({passkeys:Pi().meta({description:`Whether one of the sign-in's realms holds passkeys that sign in at Tempo ID's origin, so the page offers passkey sign-in.`,examples:[!0]}),app:j().nullable().meta({description:"The display name of the app of the request in `oauth_query`, or its client ID without a name. `null` for a forged or expired query, or an unknown app.",examples:[`Tempo Cash`]}),host:j().nullable().meta({description:"The host of a third-party app's client ID, which the page shows beside its name, or `null` for a registered app or without an app.",examples:[`app.example`]}),request:A({app:j().meta({description:`The app's display name, or its client ID without one.`,examples:[`Tempo Cash`]}),key:uM.description}).nullable().meta({description:"The app and the key of the signed authorization request in `oauth_query`, which the sign-in grants. `null` when the sign-in grants no key, such as for an invalid query or a third-party app."}),return_to:j().nullable().meta({description:"The page that sign-in returns to, a path on the device page, or `null` for the account.",examples:[`/device?code=WDJB-MJHT`]}),user_code:j().nullable().meta({description:"The user code of the device page that sign-in returns to, or `null` without one.",examples:[`WDJBMJHT`]}),verified:Pi().meta({description:"Whether `app` is a registered app, whose name the page marks as verified. `false` for a third-party app, which names itself in its metadata document, and without an app.",examples:[!0]})})})(c||=e.methods||={})})(O4||={});async function k4(e,t){let n=t.email.trim().toLowerCase(),r=await Y(e,e.var.auth.$context,`auth.context`),i=await Y(e,r.internalAdapter.findUserByEmail(n),`db.user.findByEmail`);if(i)return{email:i.user.email,id:i.user.id};try{let t=await Y(e,r.internalAdapter.createUser({email:n,emailVerified:!0,name:``},{method:`passkey`}),`db.user.create`);return{email:t.email,id:t.id}}catch(t){if(za(t)&&t.body?.code===SP.reason)throw new SP({domains:_4()??[]});let i=await Y(e,r.internalAdapter.findUserByEmail(n),`db.user.findByEmail`);if(i)return{email:i.user.email,id:i.user.id};throw t}}(function(e){e.errors=[SP]})(k4||={});var A4=new Jl().post(`/v1/auth/code`,DI({description:`Emails a sign-in code. The response is the same for every address, so it reveals no account.`,responses:II({errors:[...zP,...v4.errors,...X.errors,...Z.errors,eO,aO],success:{description:`The response for every address: the email service accepted the code, or does not deliver to the address.`,schema:O4.code.response}}),tags:[`Authenticate`]}),X(`json`,O4.code.json),async e=>{let{email:t}=e.req.valid(`json`),n=await Y(e,Z(e,{limits:[{binding:`SIGN_IN_IP_LIMIT`,key:XI(e)},{binding:`SIGN_IN_CODE_LIMIT`,key:JI({email:t})}]}),`RateLimit.check`);if(n)return n;if(!await Y(e,KI($,{email:t}),`RateLimit.countCode`))return qI(e,{policy:UI}),QI(e,{policy:UI,retryAfter:UI.window});let r=await Y(e,e.var.auth.api.createVerificationOTP({body:{email:t,type:`sign-in`}}),`auth.createVerificationOTP`),i=await Y(e,v4(e,{code:r,email:t.toLowerCase()}),`Auth.sendCode`).catch(e=>e);return i&&($s(e,{error:i,message:`The email service refused a sign-in code.`}),!(i instanceof m4))?J(e,i instanceof nO?i:new aO):e.json({sent:!0},200)}).post(`/v1/auth/code/verify`,DI({description:"Signs in with an emailed code, and sets the session cookie. For a user with no Tempo Account in the first realm of the app that `oauth_query` names, or in the `default` realm, it creates one when that realm creates accounts. A failed creation leaves the user signed in, and the next sign-in or `POST /v1/account` creates the account. With `authorize`, it also authorizes the app as `POST /v1/authorize` does, and a refusal after the sign-in carries `Tempo-Id-Signed-In: true`.",responses:II({errors:[...zP,...P$.errors,...X.errors,...C$.errors,...x$.errors,...w$.errors,...Z.errors,vP,yP,SP,ON,jN],success:{description:`The signed-in user.`,schema:O4.verify.response}}),tags:[`Authenticate`]}),X(`json`,O4.verify.json),async e=>{let{assertion:t,authorize:n,code:r,email:i,link:a,oauth_query:o,passkey:s}=e.req.valid(`json`),c=P$(e,{oauth_query:o});if(c)return J(e,c);let l=await Y(e,Z(e,{limits:[{binding:`SIGN_IN_IP_LIMIT`,key:XI(e)}]}),`RateLimit.check`);if(l)return l;let u=n?await Y(e,b$(e,{clientId:n.client_id}),`Headless.app`):void 0,d=n&&x$(n,{app:u,origin:e.req.header(`origin`)});if(d)return J(e,d);let f=a?await Y(e,S4(e,{nonce:a}),`PasskeyLink.claim`):void 0;if(a&&!f)return J(e,new ON);let p=f&&t?await Y(e,iP($,{clientDataJSON:t.metadata.clientDataJSON}),`Passkey.take`):void 0;if(f){let n=p&&a?await Y(e,T4({expected:p.link,nonce:a}),`PasskeyLink.matches`):!1;if(!t||!p||!n||p.clientId!==j4({oauth_query:o})||p.origin!==A$(e)||p.rpId!==f.rpId||t.id!==f.id||!gP(t,{challenge:p.challenge,origin:p.origin??new URL(I.URL).origin,publicKey:f.publicKey,rpId:f.rpId})||!await Y(e,T$(e,{assertion:t,challenge:p}),`Headless.spend`))return J(e,new jN)}let m=await Y(e,e.var.auth.api.signInEmailOTP({asResponse:!1,body:{email:i,otp:r,...o?{oauth_query:o}:{}},headers:new Headers(e.req.raw.headers),request:e.req.raw,returnHeaders:!0}),`auth.signInEmailOTP`).catch(e=>{if(za(e)&&e.body?.error===`invalid_signature`)return new vP;if(za(e)&&e.body?.code===SP.reason)return new SP({domains:_4()??[]});if(za(e))return new yP;throw e});if(m instanceof $D)return J(e,m);for(let t of m.headers.getSetCookie())e.header(`set-cookie`,t,{append:!0});e.header(`cache-control`,`private, no-store`);let h=O4.verify.signedIn.parse(m.response),g=(()=>{if(`user`in h)return{email:h.user.email,id:h.user.id};let t=e.var.newSession?.user.id;if(!t)throw Error(`The signed-in user is missing.`);return{email:i,id:t}})();if(f){let t=await Y(e,GN($,{credential:f,id:f.id,rpId:f.rpId,userId:g.id}),`Passkey.link`);dX(e),t===g.id&&E4(e)}if(await Y(e,y4(e,{clientId:j4({oauth_query:o}),email:g.email.toLowerCase(),userId:g.id}),`FirstAccount.create`),p?.authorize!==void 0&&t){e.header(_$,`true`);let n=await Y(e,w$(e,{assertion:t,challenge:p,email:g.email,setCookie:m.headers.getSetCookie()}),`Headless.keySignature`);return n instanceof Response?n:n instanceof $D?J(e,n):e.json({authorization:n,redirect:null,user:g},200)}if(n&&u){e.header(_$,`true`);let t=await Y(e,C$(e,{app:u,email:g.email,passkey:s,request:n,setCookie:m.headers.getSetCookie()}),`Headless.afterCode`);return t instanceof Response?t:t instanceof $D?J(e,t):`options`in t?e.json({authorization:BN.headlessStep.parse({expiry:t.expiry,step:{options:t.options,type:`passkey`}}),redirect:null,user:g},200):e.json({authorization:t,redirect:null,user:g},200)}let _=`user`in h?null:await Y(e,d$(e,{redirect:h.url,setCookie:m.headers.getSetCookie()}),`SignInConsent.afterSignIn`);return e.json({redirect:_,user:g},200)}).post(`/v1/auth/passkey/options`,DI({description:"Issues a single-use challenge, and returns request options for the passkeys of the first realm whose relying party covers Tempo ID's origin, and also the page's origin from an app's page. The realms are those of the app that `oauth_query`, `client_id`, or `user_code` names, or the `default` realm. With `link`, that realm must be the `default` realm at the link's relying party.",responses:II({errors:[...zP,...P$.errors,...X.errors,...HM.errors,...HN.errors,...Z.errors,ON,kN],success:{description:`The request options.`,schema:O4.passkeyOptions.response}}),tags:[`Authenticate`]}),X(`json`,O4.passkeyOptions.json),async e=>{let{authorize:t,client_id:n,credentialId:r,link:i,mediation:a,oauth_query:o,user_code:s}=e.req.valid(`json`),c=P$(e,{oauth_query:o});if(c)return J(e,c);let l=XI(e),u=await Y(e,Z(e,{limits:[{binding:`SIGN_IN_IP_LIMIT`,key:l?`passkey-options:${l}`:void 0}]}),`RateLimit.check`);if(u)return u;let d=i?await Y(e,S4(e,{nonce:i}),`PasskeyLink.claim`):void 0;if(i&&!d)return J(e,new ON);let f=A$(e),p=n?await Y(e,b$(e,{clientId:n}),`Headless.app`):void 0;if(f||n){let t=HN({app:p,clientId:n,origin:e.req.header(`origin`)});if(t)return J(e,t)}let m=j4({oauth_query:o}),h=s?cN(s):void 0,g=!m&&!n&&h?await Y(e,eN($,{userCode:h}),`Device.client`):void 0,_=m??n??g,v=_?await Y(e,UP(e,()=>UL($,{clientId:_}),[`realm.forApp`,_]),`Realm.forApp`):[await Y(e,UP(e,()=>KL($,{id:VL}),[`realm.get`,VL]),`Realm.get`)],y=QN(await Y(e,JL(e,{db:$,origin:I.URL,realms:v}),`Realm.withDefaults`),{origin:I.URL,page:f}),b=d&&(y?.realmId!=="default"||y.rpId!==d.rpId);if(!y||b)return J(e,new kN({clientId:(m??n)||void 0,origin:f}));let x=i?await Y(e,w4({nonce:i}),`PasskeyLink.digest`):void 0,S=t&&(f?HM(t,{app:p,origin:e.req.header(`origin`)}):new zM({error_description:"Invalid `Origin`: none. A sign-in with `authorize` runs only on the app's page.",field:`Origin`}));if(S)return J(e,S);let C=await Y(e,VN($,{authorize:await(async()=>{if(!t)return;let n=O4.passkeyOptions.sent.parse(await e.req.json()),r=t.key_authorization;return r?{...n.authorize,key_authorization:{...n.authorize.key_authorization,expiry:r.expiry}}:n.authorize})(),clientId:m,keyChallenge:await(async()=>{if(f){let e=t?.key_authorization;if(!e)return;let n=e.witness??xn(crypto.getRandomValues(new Uint8Array(32)));return{digest:DM({key:e,witness:n}),witness:n}}if(o&&!i)return await Y(e,f$(e,{oauthQuery:o}),`SignInConsent.keyChallenge`)})(),link:x,origin:f,...y}),`Passkey.challenge`);if(!C)return J(e,new jN);let w=d?[d.id]:r===void 0?[]:[r].flat(),T=O4.passkeyOptions.response.shape.options.parse({...Xp({challenge:C,...w.length>0?{credentialId:w}:{},rpId:y.rpId,userVerification:`required`}).options,...a?{mediation:a}:{}});return e.header(`cache-control`,`private, no-store`),e.json({options:T},200)}).post(`/v1/auth/passkey/verify`,DI({description:"Signs in with a passkey assertion over a challenge from `POST /v1/auth/passkey/options`, and sets the session cookie. For a user with no Tempo Account in the first realm of the app that `oauth_query` names, or in the `default` realm, it creates one when that realm creates accounts. A failed creation leaves the user signed in, and the next sign-in or `POST /v1/account` creates the account.",responses:II({errors:[...zP,...P$.errors,...X.errors,...cO.errors,...w$.errors,...Z.errors,...k4.errors,vP,jN],success:{description:`The signed-in user, with the authorization of a sign-in with key signature, or the email step for a wallet.tempo passkey without an email.`,schema:O4.passkeyVerify.response}}),tags:[`Authenticate`]}),X(`json`,O4.passkeyVerify.json),async e=>{let{assertion:t,oauth_query:n}=e.req.valid(`json`),r=P$(e,{oauth_query:n});if(r)return J(e,r);let i=await Y(e,Z(e,{limits:[{binding:`SIGN_IN_IP_LIMIT`,key:XI(e)}]}),`RateLimit.check`);if(i)return i;let{id:a}=t,o=await Y(e,oP($,{clientDataJSON:t.metadata.clientDataJSON,id:a}),`Passkey.takeWithKey`),s=o?.challenge;if(!s||s.link!==void 0||s.clientId!==j4({oauth_query:n})||s.origin!==A$(e))return J(e,new jN);let c=o.key,l=await(async()=>{if(!c&&e.env.WALLET&&s.realmId==="default")try{return await Y(e,yX(e.env.WALLET,{id:a}),`Wallet.credential`)}catch(t){return $s(e,{error:t,message:`The wallet service failed a passkey lookup.`}),t instanceof Error&&cO(t)||new aO}})();if(l instanceof $D)return J(e,l);let u=c?.publicKey??l?.publicKey;if(!u||!gP(t,{challenge:s.challenge,origin:s.origin??new URL(I.URL).origin,publicKey:u,rpId:s.rpId})||!await Y(e,T$(e,{assertion:t,challenge:s}),`Headless.spend`))return J(e,new jN);if(l&&!l.email){let t=await Y(e,C4(e,{credential:l,id:a,rpId:s.rpId}),`PasskeyLink.defer`);return e.header(`cache-control`,`private, no-store`),e.json({step:{link:t,signed:!1,type:`email`}},200)}let d=await(async()=>{if(c)return{user:c.user,userId:c.userId};let t=await Y(e,k4(e,{email:l.email}),`authenticate.emailUser`),n=await Y(e,GN($,{credential:l,id:a,rpId:s.rpId,userId:t.id}),`Passkey.link`);return dX(e),n?{user:n===t.id?t:void 0,userId:n}:void 0})();if(!d)return J(e,new jN);let{userId:f}=d,p=await(async()=>{if(!n)return!0;let t=await Y(e,e.var.auth.$context,`auth.context`);return await Y(e,$a(n,t.secret),`auth.verifyOAuthQueryParams`)})(),m=p?j4({oauth_query:n})??VM.request.safeParse(s.authorize).data?.client_id:void 0,[h]=await Promise.allSettled([Y(e,e.var.auth.api.signInPasskey({asResponse:!1,body:{userId:f,...c?{user:c.user}:{},...n?{oauth_query:n}:{}},headers:new Headers(e.req.raw.headers),request:e.req.raw,returnHeaders:!0}),`auth.signInPasskey`).catch(e=>{if(za(e)&&e.body?.error===`invalid_signature`)return new vP;throw e}),m?Y(e,CQ(e,{clientId:m,userId:f}),`AccountStep.prefetch`):void 0,p?Y(e,y4(e,{clientId:j4({oauth_query:n}),email:d.user?.email,userId:f}),`FirstAccount.create`):void 0]);if(h.status===`rejected`)throw h.reason;let g=h.value;if(g instanceof $D)return J(e,g);for(let t of g.headers.getSetCookie())e.header(`set-cookie`,t,{append:!0});e.header(`cache-control`,`private, no-store`);let _=O4.verify.signedIn.parse(g.response);if(`user`in _){let n={email:_.user.email,id:_.user.id};if(s.authorize===void 0)return e.json({redirect:null,user:n},200);e.header(_$,`true`);let r=await Y(e,w$(e,{assertion:t,challenge:s,email:n.email,setCookie:g.headers.getSetCookie()}),`Headless.keySignature`);return r instanceof Response?r:r instanceof $D?J(e,r):e.json({authorization:r,redirect:null,user:n},200)}let v=await(async()=>{if(d.user)return{email:d.user.email,id:d.user.id};let[t]=await Y(e,$.select({email:bE.email,id:bE.id}).from(bE).where(W(bE.id,f)),`db.user.get`);return t})();if(!v)throw Error(`The signed-in user is missing.`);let y=await Y(e,d$(e,{keySignature:s.witness?{assertion:t,witness:s.witness}:void 0,redirect:_.url,setCookie:g.headers.getSetCookie()}),`SignInConsent.afterSignIn`);return e.json({redirect:y,user:v},200)}).post(`/v1/auth/logout`,DI({description:`Signs out: ends the session, revokes the access and refresh tokens that apps received through it, and clears its cookie.`,responses:II({errors:[...zP,eO],success:{description:`The session is over.`,schema:O4.logout.response}}),tags:[`Authenticate`]}),async e=>{let t=await Y(e,L$(e),`Session.token`);return t&&await Y(e,c1($,{token:t}),`Logout.end`),await Y(e,F$(e),`Session.clear`),e.header(`set-cookie`,gQ(),{append:!0}),e.header(`cache-control`,`private, no-store`),e.json({signed_out:!0},200)}).get(`/v1/auth/session`,DI({description:"Reads the signed-in user, or `null` without a session.",responses:II({success:{description:`The session.`,schema:O4.session.response}}),tags:[`Authenticate`]}),async e=>{let t=await Y(e,I$(e),`Session.get`);return e.header(`cache-control`,`private, no-store`),t?e.json({user:{email:t.user.email,id:t.user.id,name:t.user.name||null}},200):e.json({user:null},200)}).get(`/v1/auth/assets`,DI({description:`Lists the sign-in page's scripts and style sheets, which a page on Tempo ID's site prefetches before it redirects. Browsers partition their caches by site, so a page on another site gains nothing.`,responses:II({success:{description:`The assets.`,schema:O4.assets.response}}),tags:[`Authenticate`]}),async e=>{let t=await Y(e,e.env.signInAssets(),`pages.assets`);return e.header(`cache-control`,`public, max-age=300`),e.json({assets:t},200)}).get(`/v1/auth/methods`,DI({description:"Reads the sign-in methods that the sign-in page offers, the key that `oauth_query` grants, and the page that sign-in returns to. The app of `oauth_query`, or of a pending, unbound device code in `return_to`, selects the realms. The read binds nothing, and counts against the sign-in limit of the IP address.",responses:II({errors:[...X.errors],success:{description:`The sign-in methods.`,schema:O4.methods.response}}),tags:[`Authenticate`]}),X(`query`,O4.methods.query),async e=>{let t=e.req.valid(`query`),n=uN(t.return_to,{origin:I.URL}),r=(()=>{if(!t.oauth_query)return;let e=new URLSearchParams(t.oauth_query);return e.has(`sig`)?e:void 0})(),i=n?cN(new URL(n,I.URL).searchParams.get(`code`)??``):void 0,a=await(async()=>{if(r)return r.get(`client_id`)??void 0;if(!i)return;let t=XI(e);if(t&&(await Y(e,e.env.SIGN_IN_IP_LIMIT.limit({key:`device-lookup:${t}`}),`ratelimit.limit`)).success)return await Y(e,eN($,{userCode:i}),`Device.client`)})(),o=a?await Y(e,UP(e,()=>UL($,{clientId:a}),[`realm.forApp`,a]),`Realm.forApp`):[await Y(e,UP(e,()=>KL($,{id:VL}),[`realm.get`,VL]),`Realm.get`)],s=await Y(e,JL(e,{db:$,origin:I.URL,realms:o}),`Realm.withDefaults`),c=r?await Y(e,M4(e,{query:r}),`authenticate.granted`):null;return e.json({app:c?.app??null,host:c?.host??null,passkeys:!!QN(s,{origin:I.URL}),request:c?.key?{app:c.app,key:c.key}:null,return_to:n??null,user_code:i||null,verified:c?.verified??!1},200)});function j4(e){return e.oauth_query?new URLSearchParams(e.oauth_query).get(`client_id`):null}async function M4(e,t){let{query:n}=t,r=await Y(e,e.var.auth.$context,`auth.context`),i=await Y(e,$a(n.toString(),r.secret),`auth.verifyOAuthQueryParams`),a=n.get(`client_id`);if(!i||!a)return null;let o=await Y(e,UP(e,async()=>{let e=await ED($,{clientId:a}).catch(e=>{if(!(e instanceof yD))throw e});return e?{name:e.name}:void 0},[`apps.name`,a],{keep:e=>e!==void 0}),`Apps.get`);if(!o)return null;let s=MD(a),c=n.has(`challenge`)||s||!n.has(`key_authorization`)||await Y(e,e$($,{query:n}),`SignInGrant.spent`)?void 0:WM(n);return{app:o.name??a,host:s?new URL(a).host:null,key:c&&!(c instanceof $D)?EM(c):null,verified:!s}}var N4;(function(e){let t;(function(e){e.json=VM.request.and(A({passkey:Ui([oa(!0).meta({description:"Requests the passkey step for an account that a passkey owns, in place of `webauthn_required`. The passkey's relying party must cover the page's origin."}),A({assertion:BN.assertion}).meta({description:`The passkey's assertion over the options of the passkey step. The repeated request signs the key with it.`})]).optional().meta({description:"Whether the app's page signs the key with the passkey that owns the account. Absent, a passkey-owned account refuses the key with `webauthn_required`."})}));let t=e.step=BN.headlessStep;e.response=Ui([VM.response,t])})(t||=e.authorize||={});let n;(function(e){e.json=A({account:sX.tempoAccount.shape.address.meta({description:`The address of the account that the user selects, one of the user's accounts in the app's realms.`,examples:[`0x8C3b5d0e2A4f6B1c9D7e3F5a0B2c4D6e8F1a3B5c`]}),oauth_query:j().min(1).max(8192).meta({description:`The account step's query string, which Better Auth signs when it sends the browser there. At most 8,192 characters.`,examples:[`client_id=Qk3vT9xZbLmN2pRw8YcHjF6sDaE4uGtK&response_type=code&exp=1760000000&sig=Gx3kB0`]}),passkey:A({assertion:BN.assertion}).optional().meta({description:`The passkey's assertion over the options of the passkey step, which the selection of a passkey-owned account returns. The repeated selection signs the key with it.`})}),e.response=Ui([A({redirect:j().meta({description:"Where the browser continues: the approval page's path on Tempo ID, or the app's `redirect_uri` with an authorization code and `state`.",examples:[`https://app.example.com/callback?code=Vb7mQ2xLkP9sTzR4&state=af0ifjsldkj`]})}).meta({description:`A selection that continues the authorization.`}),BN.step]),e.result=A({url:j().min(1)})})(n||=e.account||={});let r;(function(e){e.json=A({accept:Pi().meta({description:"Whether the user approves the request. `false` denies it, and the app receives `access_denied`.",examples:[!0]}),account:sX.tempoAccount.shape.address.optional().meta({description:`The Tempo Account that the approval page showed for the request's key authorization, one of the user's accounts in the app's realms. Ignored when the key names its account, and absent for a request without a key.`,examples:[`0x8C3b5d0e2A4f6B1c9D7e3F5a0B2c4D6e8F1a3B5c`]}),oauth_query:j().min(1).max(8192).meta({description:`The approval page's query string, which Better Auth signs when it sends the browser there. At most 8,192 characters.`,examples:[`client_id=Qk3vT9xZbLmN2pRw8YcHjF6sDaE4uGtK&response_type=code&exp=1760000000&sig=Gx3kB0`]}),passkey:A({assertion:BN.assertion}).optional().meta({description:`The passkey's assertion over the options of the passkey step, which a passkey-owned account's approval returns. The repeated approval signs the key with it.`}),session_id:j().min(1).max(256).meta({description:`The ID of the session that the approval page showed. The decision applies only while that session is the signed-in one.`,examples:[`8nVq3kZ0bT5wXy2mLp7sR4dA`]}),skip_upgrade:Pi().optional().meta({description:"Whether the approval skips the pending upgrade of a wallet.tempo passkey's wallet on the key's chain, `false` by default. The passkey then signs the key as its own account, and the key stops working on that chain once the wallet upgrades, unless the chain registered it first.",examples:[!0]})});let t=e.step=BN.step;e.response=Ui([A({redirect:Hi().meta({description:"The app's `redirect_uri`, with an authorization code and `state`, or with `error=access_denied` when the user denied the request.",examples:[`https://app.example.com/callback?code=Vb7mQ2xLkP9sTzR4&state=af0ifjsldkj`]})}).meta({description:`A decision that returns to the app.`}),t])})(r||=e.consent||={});let i;(function(e){e.query=A({oauth_query:j().min(1).max(8192).meta({description:`The approval page's query string, which Better Auth signs when it sends the browser there. At most 8,192 characters.`,examples:[`client_id=Qk3vT9xZbLmN2pRw8YcHjF6sDaE4uGtK&response_type=code&exp=1760000000&sig=Gx3kB0`]})}),e.response=Ui([A({redirect:Hi().meta({description:"The app's `redirect_uri`, with the refusal of the request's key as `error` and `error_description`, `state`, and `iss`.",examples:[`https://app.example.com/callback?error=invalid_request&state=af0ifjsldkj`]})}).meta({description:`A key that Tempo ID refuses, which returns the browser to the app.`}),A({request:A({account:A({address:sX.tempoAccount.shape.address.meta({description:`The account address.`,examples:[`0x8C3b5d0e2A4f6B1c9D7e3F5a0B2c4D6e8F1a3B5c`]}),owner:sX.tempoAccount.shape.config.shape.owners.unwrap().element.shape.type}).optional().meta({description:`The Tempo Account that the approval applies to: the account that the key names, else the app's selected account, else the user's oldest. Present only when the user holds more than one account in the app's realms.`}),app:j().meta({description:`The app's display name, or the host of its redirect URI without one.`,examples:[`Tempo Cash`]}),destination:j().meta({description:`The host of the app's redirect URI, or its scheme for a native app. For a third-party app, the host that serves its metadata document.`,examples:[`cash.tempo.xyz`]}),email:Li().meta({description:`The signed-in user's email address.`,examples:[`ada@example.com`]}),key:uM.description.extend({chain:A({id:Ti().int().meta({description:`The ID of the chain that the key acts on.`,examples:[42431]}),name:Pj.optional().meta({description:"The name that `GET /v1/chains` lists for the chain. Absent for a chain that no name lists.",examples:[`testnet`]})}).meta({description:`The chain that the key acts on.`}),challenge:j().optional().meta({description:`The message that the key's witness binds, such as a sign-in challenge from the app. Absent when the request carries none.`,examples:[`Sign in to app.example.com
529
+ Nonce: 7f3a9c2e5b1d4f60`]}),refusal:zQ.refusal.optional()}).optional().meta({description:`What the key that the request carries may do, and the account that approval signs for. Absent for a request without a key.`}),logo:j().startsWith(`data:image/`).optional().meta({description:"The app's logo as a `data:` URL, which Tempo ID fetched from the origin of its client ID. Present only for an app with an origin client ID whose manifest or page names a logo.",examples:[`data:image/png;base64,iVBORw0KGgo=`]}),session:j().meta({description:"The ID of the signed-in session, which `POST /v1/authorize/consent` names.",examples:[`8nVq3kZ0bT5wXy2mLp7sR4dA`]}),verified:Pi().meta({description:`Whether the app is a registered app, whose name the page marks as verified. A third-party app names itself in its metadata document.`,examples:[!0]})}).nullable().meta({description:"The request that the approval page shows, or `null` for a forged or expired query, or a request without a known app."})}).meta({description:`The request that the approval page shows.`})])})(i||=e.request||={});let a;(function(e){e.query=i.query,e.response=i.response})(a||=e.pageRequest||={});let o;(function(e){e.query=i.query,e.response=A({request:A({accounts:Gi(A({address:sX.tempoAccount.shape.address.meta({description:`The account address.`,examples:[`0x8C3b5d0e2A4f6B1c9D7e3F5a0B2c4D6e8F1a3B5c`]}),balance:NP.balance.nullable().meta({description:"The account's holdings of USD tokens on the chain of the request's key, or of Tempo mainnet without one. `null` when the read fails or takes longer than 3 seconds."}),owner:sX.tempoAccount.shape.config.shape.owners.unwrap().element.shape.type,realm:j().nullable().meta({description:"The name of the account's realm, or `null` for the `default` realm.",examples:[`Tempo Cash`]})})).readonly().meta({description:`The user's accounts in the app's realms, oldest first.`}),app:j().meta({description:`The app's display name.`,examples:[`Tempo Cash`]})}).nullable().meta({description:"The account step, or `null` for a forged or expired query, or a request without a known app."})})})(o||=e.accounts||={})})(N4||={});async function P4(e,t){if(e.req.header(`sec-fetch-site`)===`cross-site`)return new eO;let n=await Y(e,I$(e),`Session.get`);if(!n)return new xP;e.header(`cache-control`,`private, no-store`);let r=new URLSearchParams(t.oauthQuery),i=await Y(e,e.var.auth.$context,`auth.context`);if(!await Y(e,$a(t.oauthQuery,i.secret),`auth.verifyOAuthQueryParams`))return{request:null};let a=r.get(`client_id`),o=r.get(`redirect_uri`),s=URL.parse(o??``);if(!a||!o||!s)return{request:null};let c=await Y(e,ED($,{clientId:a}).catch(e=>{if(!(e instanceof yD))throw e}),`Apps.get`);if(!c||!c.redirectUris.includes(o))return{request:null};let l=e=>{let t=new URL(o);t.searchParams.append(`error`,e.response.error),t.searchParams.append(`error_description`,e.response.error_description);let n=r.get(`state`);return n&&t.searchParams.append(`state`,n),t.searchParams.append(`iss`,I.URL),{redirect:t.href}},u=WM(r);if(u instanceof $D)return l(u);let d=u&&UM({app:c,clientId:a,codeChallenge:r.get(`code_challenge`),key:u,query:r});if(d)return l(d);let f=MD(a)?new URL(a).host:[`http:`,`https:`].includes(s.protocol)?s.host:s.protocol.slice(0,-1),p=t.preview?await Y(e,VQ(e,{account:u?.account,chainId:u?.chainId,clientId:a,email:n.user.email,sessionId:n.session.id,userId:n.user.id}),`KeySigner.preview`):void 0,m=(()=>{if(!p||p.accounts.length<2)return;let e=bQ(p.accounts,p.account),t=e?gX(e):void 0;if(e&&t)return{address:e.address,owner:t.type}})(),h=(()=>{if(!u)return;let e=r.get(`challenge`),t=Number(u.chainId),n=Lj({chainId:t,rpcUrls:I.RPC_URLS});return{...EM(u),...p?.account?{account:p.account}:{},chain:{id:t,...n?{name:n}:{}},...e?{challenge:e}:{},...p?.refusal?{refusal:p.refusal}:{}}})();return{request:{...m?{account:m}:{},app:c.name??f,destination:f,email:n.user.email,...h?{key:h}:{},...c.logo?{logo:c.logo}:{},session:n.session.id,verified:!MD(a)}}}(function(e){e.errors=[xP,eO]})(P4||={});var F4=new Jl().post(`/v1/authorize`,DI({description:"Authorizes the app for the signed-in user without a redirect, from a first-party app's page on the redirect URI's origin. It returns a code with `code_challenge`, or tokens to a public app without one, and signs any key within the headless ceiling. With `passkey: true`, a passkey-owned account returns the passkey step, and the repeated request with `passkey: { assertion }` and the step's `expiry` signs the key.",responses:II({errors:[...HM.errors,...xQ.errors,...zP,...X.errors,...Z.errors,xP,eO,rM,jN,aX],success:{description:`The authorization, or the passkey step.`,schema:N4.authorize.response}}),security:[{sessionCookie:[]}],tags:[`Authorization`]}),X(`json`,N4.authorize.json),async e=>{let{passkey:t,...n}=e.req.valid(`json`),r=n.client_id,i=await Y(e,b$(e,{clientId:r}),`Headless.app`),a=HM(n,{app:i,origin:e.req.header(`origin`)});if(a)return J(e,a);let o=await Y(e,I$(e),`Session.get`);if(!o)return J(e,new xP);let s=await Y(e,S$(e,{create:!0,headers:new Headers(e.req.raw.headers),passkey:t===!0?{}:t,request:n,secret:!!i.secret,session:o}),`Headless.authorize`);return s instanceof Response?s:s instanceof $D?J(e,s):`options`in s?(e.header(`cache-control`,`no-store`),e.json(N4.authorize.step.parse({expiry:s.expiry,step:{options:s.options,type:`passkey`}}),200)):e.json(s,200)}).post(`/v1/authorize/account`,DI({description:"Selects the account that the app of `oauth_query` uses, and returns the next redirect of the authorization. The selection holds for the app's later authorizations in the session, and `GET /v1/account` lists it first.",responses:II({errors:[...zP,...P$.errors,...X.errors,...mQ.errors,...Z.errors,vP,xP,aX],success:{description:`The next redirect, or the passkey step.`,schema:N4.account.response}}),security:[{sessionCookie:[]}],tags:[`Authorization`]}),X(`json`,N4.account.json),async e=>{let{account:t,oauth_query:n,passkey:r}=e.req.valid(`json`),i=P$(e,{oauth_query:n});if(i)return J(e,i);let a=await Y(e,I$(e),`Session.get`);if(!a)return J(e,new xP);let o=await Y(e,Z(e,{limits:[{binding:`ACCOUNT_LIMIT`,key:a.user.id}]}),`RateLimit.check`);if(o)return o;let s=await Y(e,e.var.auth.$context,`auth.context`),c=await Y(e,$a(n,s.secret),`auth.verifyOAuthQueryParams`),l=new URLSearchParams(n),u=l.get(`client_id`);if(!c||!u)return J(e,new vP);c$(l);let d=WM(l);if(!bQ(await Y(e,mQ(e,{chainId:d&&!(d instanceof $D)&&d.chainId?Number(d.chainId):mM,clientId:u,userId:a.user.id}),`AccountStep.accounts`),t))return J(e,new aX({account:t}));e.set(`accountChosen`,!0);let f=wQ({account:t.toLowerCase(),clientId:u,cookie:e.req.header(`cookie`),sessionId:a.session.id}),p=new Headers(e.req.raw.headers);p.set(`cookie`,f.header);let m=await Y(e,e.var.auth.api.oauth2Continue({asResponse:!1,body:{oauth_query:n,postLogin:!0},headers:p,request:new Request(e.req.url,{headers:p,method:`POST`})}),`auth.oauth2Continue`).catch(e=>{if(za(e)&&e.body?.error===`invalid_signature`)return new vP;throw e});if(m instanceof $D)return J(e,m);let h=await Y(e,u$(e,{account:t,assertion:r?.assertion,headers:p,redirect:N4.account.result.parse(m).url,session:a}),`SignInConsent.afterAccountStep`);return e.header(`set-cookie`,f.setCookie,{append:!0}),e.header(`cache-control`,`private, no-store`),`options`in h?e.json(BN.step.parse({step:{options:h.options,type:`passkey`}}),200):e.json({redirect:h.redirect},200)}).post(`/v1/authorize/consent`,DI({description:"Records the signed-in user's decision on the request in `oauth_query`, stores an approval's consent, and returns the app's redirect. An approval of a key authorization signs the key. If the key names no account and the user holds none, the approval first creates an account.",responses:II({errors:[...UM.errors,...zP,...P$.errors,...HQ.errors,...UQ.errors,...WQ.errors,...X.errors,...Z.errors,BM,vP,bP,xP,LM],success:{description:`The app's redirect, or the passkey step.`,schema:N4.consent.response}}),security:[{sessionCookie:[]}],tags:[`Authorization`]}),X(`json`,N4.consent.json),async e=>{let{accept:t,account:n,oauth_query:r,passkey:i,session_id:a,skip_upgrade:o}=e.req.valid(`json`),s=P$(e,{oauth_query:r});if(s)return J(e,s);let c=await Y(e,I$(e),`Session.get`);if(!c)return J(e,new xP);if(c.session.id!==a)return J(e,new bP);let l=await Y(e,e.var.auth.$context,`auth.context`);if(!await Y(e,$a(r,l.secret),`auth.verifyOAuthQueryParams`))return J(e,new vP);let u=new URLSearchParams(r);c$(u);let d=t&&(u.has(`key_authorization`)||u.has(`challenge`))?await Y(e,Z(e,{limits:[{binding:`AUTHORIZE_LIMIT`,key:c.user.id}]}),`RateLimit.check`):void 0;if(d)return d;if(t){let t=await Y(e,o$(e,{account:n,assertion:i?.assertion,email:c.user.email,headers:new Headers(e.req.raw.headers),oauthQuery:r,session:c,skipUpgrade:o}),`Consent.approve`);return t instanceof $D?J(e,t):(e.header(`cache-control`,`private, no-store`),`options`in t?e.json(N4.consent.step.parse({step:{options:t.options,type:`passkey`}}),200):e.json({redirect:t.redirect},200))}let f=await Y(e,e.var.auth.api.oauth2Consent({asResponse:!1,body:{accept:t,oauth_query:r},headers:new Headers(e.req.raw.headers),request:e.req.raw}),`auth.oauth2Consent`).catch(e=>{if(za(e)&&e.body?.error===`invalid_signature`)return new vP;throw e});return f instanceof $D?J(e,f):(e.header(`cache-control`,`private, no-store`),e.json({redirect:N4.account.result.parse(f).url},200))}).get(`/v1/authorize/request`,DI({description:"Reads the authorization request in `oauth_query` as the approval page shows it: the app, the destination, the account, and any key. For a key that Tempo ID refuses, it returns the app's redirect with the refusal.",responses:II({errors:[...X.errors,xP,eO],success:{description:`The request, or the app's redirect with a refusal.`,schema:N4.request.response}}),security:[{sessionCookie:[]}],tags:[`Authorization`]}),X(`query`,N4.request.query),async e=>{let t=await Y(e,P4(e,{oauthQuery:e.req.valid(`query`).oauth_query,preview:!0}),`authorize.readRequest`);return t instanceof $D?J(e,t):e.json(t,200)}).get(`/i/authorize/request`,DI({description:"Reads the app's authorization request that `oauth_query` carries, as `GET /v1/authorize/request` does, without the account that the approval applies to, the account that approval signs for, or why approval cannot sign the key. The read holds no account, so it does not count against the user's `ACCOUNT_LIMIT`. Internal: only Tempo ID's approval page sends the request, so the public document leaves it out.",hide:!0,responses:II({errors:[...X.errors,...P4.errors],success:{description:`The request, or the app's redirect with a refusal.`,schema:N4.pageRequest.response}}),security:[{sessionCookie:[]}],tags:[`Authorization`]}),X(`query`,N4.pageRequest.query),async e=>{let t=await Y(e,P4(e,{oauthQuery:e.req.valid(`query`).oauth_query,preview:!1}),`authorize.readRequest`);return t instanceof $D?J(e,t):e.json(t,200)}).get(`/v1/authorize/accounts`,DI({description:"Reads the account step of the authorization request in `oauth_query`: the app, and the user's accounts in its realms, oldest first. Each account carries its balance on the chain of the request's key, or of Tempo mainnet without a key.",responses:II({errors:[...mQ.errors,...X.errors,...Z.errors,xP,eO],success:{description:`The account step.`,schema:N4.accounts.response}}),security:[{sessionCookie:[]}],tags:[`Authorization`]}),X(`query`,N4.accounts.query),async e=>{if(e.req.header(`sec-fetch-site`)===`cross-site`)return J(e,new eO);let t=await Y(e,I$(e),`Session.get`);if(!t)return J(e,new xP);e.header(`cache-control`,`private, no-store`);let{oauth_query:n}=e.req.valid(`query`),r=new URLSearchParams(n),i=await Y(e,e.var.auth.$context,`auth.context`),a=await Y(e,$a(n,i.secret),`auth.verifyOAuthQueryParams`),o=r.get(`client_id`);if(!a||!o)return e.json({request:null},200);let s=await Y(e,UP(e,()=>ED($,{clientId:o}).catch(e=>{if(!(e instanceof yD))throw e}),[`apps.get`,o]),`Apps.get`);if(!s)return e.json({request:null},200);let c=await Y(e,Z(e,{limits:[{binding:`ACCOUNT_LIMIT`,key:t.user.id}]}),`RateLimit.check`);if(c)return c;let l=WM(r),u=l&&!(l instanceof $D)&&l.chainId?Number(l.chainId):mM,d=(await Y(e,mQ(e,{chainId:u,clientId:o,userId:t.user.id}),`AccountStep.accounts`)).flatMap(e=>{let t=gX(e);return t?[{address:e.address,owner:t.type,realm:e.realm.id==="default"?null:e.realm.name}]:[]}),f=await Y(e,FP(e,{accounts:d,apiUrl:Ij({apiUrls:I.TEMPO_API_URLS,chainId:u}),chainId:u}),`Balance.list`);return e.json({request:{accounts:d.map((e,t)=>({...e,balance:f[t]??null})),app:s.name??`The app`}},200)});async function I4(e,t){let n=e.req.raw.cf,r=[n?.city,n?.country].filter(Boolean).join(`, `);await Y(e,tN($,{challenge:t.challenge??null,device:t.device,deviceCode:t.deviceCode,expiresAt:new Date(Date.now()+t.expiresIn*1e3),ip:e.req.header(`cf-connecting-ip`)??null,key:t.key??null,location:r||null}),`Device.create`)}async function L4(e,t){let n=cN(t.code),r=n?await Y(e,iN($,{userCode:n}),`Device.get`):void 0;if(!n||!r)return new XM;let i=await(async()=>r.status!==`pending`||r.userId?r:await Y(e,$M($,{id:r.id,userId:t.userId}),`Device.bind`)?{...r,userId:t.userId}:await Y(e,iN($,{userCode:n}),`Device.get`))();return!i||i.userId&&i.userId!==t.userId?new XM:{chainId:r.key?.chainId,clientId:r.clientId,request:{...r.appName?{app:{name:r.appName}}:{},...r.challenge?{challenge:r.challenge}:{},created_at:Math.floor(r.createdAt.getTime()/1e3),...r.device?{device:r.device}:{},...r.ip?{ip:r.ip}:{},...r.key?{key_authorization:EM(r.key)}:{},...r.location?{location:r.location}:{},status:i.status,user_code:i.userCode}}}(function(e){e.errors=[XM]})(L4||={});async function R4(e,t){let{request:n,session:r}=t,i=n.key,a=await Y(e,ED($,{clientId:n.clientId,enabled:!0}).catch(e=>{if(!(e instanceof yD))throw e}),`Apps.get`);if(!a?.device||a.secret||!a.firstParty)return new BM({description:`Approval refused: \`client_id\` ${n.clientId} names no enabled public first-party device app. Deny the request, and start the sign-in again.`});let o=SM(i)??CM({app:a,clientId:n.clientId,key:i});if(o)return o;let s=await Y(e,HQ(e,{account:i.account??t.account,chainId:i.chainId,clientId:n.clientId,cookie:e.req.header(`cookie`),create:!0,passkey:!0,sessionId:r.session.id,userId:r.user.id}),`KeySigner.resolve`);if(s instanceof rM){let e=s.response.meta?.account;return new rM({account:e,description:`Passkey required: the passkey of Tempo Account ${e} signs only at its own relying party, which the device page is not part of. Name another account, or deny the request.`})}if(s instanceof $D)return s;if(t.assertion&&s.owner.signer)return new jN;if(!t.assertion&&!s.owner.signer)return{options:await Y(e,BQ(e,{account:s.account,clientId:n.clientId,key:i,owner:s.owner,userId:r.user.id}),`KeySigner.challenge`)};let c=await Y(e,UQ(e,{account:s.account,assertion:t.assertion,clientId:n.clientId,key:i,owner:s.owner,userId:r.user.id}),`KeySigner.sign`);return c instanceof $D?c:{account:s.account,keyAuthorization:c}}(function(e){e.errors=[...SM.errors,BM,...CM.errors,...HQ.errors,...UQ.errors,rM,jN]})(R4||={});var z4;(function(e){let t;(function(e){e.param=A({code:j().meta({description:`The user code.`,examples:[`WDJB-MJHT`]})}),e.response=A({request:A({app:A({name:j().meta({description:`The app's display name.`,examples:[`Tempo CLI`]})}).optional().meta({description:`The app that requested the code. Absent when the app has no display name.`}),challenge:j().optional().meta({description:`The message whose EIP-191 hash is the key's witness, which approval signs. Absent when the CLI sent none.`,examples:[`Sign in to app.example.com
530
+ Nonce: 7f3a9c2e5b1d4f60`]}),created_at:Ti().meta({description:`When the CLI requested the code, in Unix seconds.`,examples:[1792075800]}),device:j().optional().meta({description:"The name that the CLI reported, such as its hostname. Absent for a code from `POST /device/code`.",examples:[`ada-macbook`]}),ip:j().optional().meta({description:`The CLI's IP address. Absent when it is unknown.`,examples:[`203.0.113.7`]}),key_authorization:uM.description.extend({account:uM.description.shape.account.meta({description:`The Tempo Account that approval signs for: the one the request names, else the one the user selected for the app, else the oldest. Absent when the request names none and the accounts cannot be read, or the user holds none.`,examples:[`0x9a073914db0d149375ac2b7fbb72c68c0780fb5f`]}),chain:A({id:Ti().int().meta({description:`The ID of the chain that the key acts on.`,examples:[42431]}),name:Pj.optional().meta({description:"The name that `GET /v1/chains` lists for the chain. Absent for a chain that no name lists.",examples:[`testnet`]})}).optional().meta({description:`The chain that the key acts on. Absent once the user decides.`}),refusal:zQ.refusal.optional()}).optional().meta({description:`What the key that the CLI requested may do. Absent when the CLI requested no key.`}),location:j().optional().meta({description:`The CLI's city and country, from its IP address. Absent when they are unknown.`,examples:[`Berlin, DE`]}),status:Qi([`approved`,`denied`,`pending`]).meta({description:"Whether the user approved or denied the code. `pending` until the user decides.",examples:[`pending`]}),user_code:j().meta({description:`The user code.`,examples:[`WDJB-MJHT`]})}).meta({description:`The request that the CLI made with the code.`})})})(t||=e.requests||={});let n;(function(e){e.json=A({account:sX.tempoAccount.shape.address.optional().meta({description:`The Tempo Account that the device page showed for the request's key authorization, one of the user's accounts in the app's realms. Ignored when the key names its account, and absent for a request without a key.`,examples:[`0x8C3b5d0e2A4f6B1c9D7e3F5a0B2c4D6e8F1a3B5c`]}),code:j().max(32).meta({description:`The user code.`,examples:[`WDJB-MJHT`]}),passkey:A({assertion:BN.assertion}).optional().meta({description:`The passkey's assertion over the options of the passkey step, which a passkey-owned account's approval returns. The repeated approval signs the key with it.`})});let t=e.step=BN.step;e.response=Ui([A({status:oa(`approved`).meta({description:`The user approved the code. The CLI receives its tokens, and any signed key, on its next poll.`})}).meta({description:`A stored approval.`}),t])})(n||=e.approve||={});let r;(function(e){e.json=A({code:n.json.shape.code}),e.response=A({status:oa(`denied`).meta({description:"The user denied the code. The next poll returns `access_denied`."})})})(r||=e.deny||={})})(z4||={});async function B4(e,t){if(A$(e))return new eO;let n=await Y(e,I$(e),`Session.get`);if(!n)return new xP;let r=await Y(e,Z(e,{limits:[{binding:`AUTHORIZE_LIMIT`,key:n.user.id}]}),`RateLimit.check`);if(r)return r;let i=cN(t.code),a=i?await Y(e,iN($,{userCode:i}),`Device.get`):void 0;if(!i||!a||a.userId&&a.userId!==n.user.id)return new XM;if(a.status!==`pending`)return new YM;let o=await(async()=>a.userId?a:await Y(e,$M($,{id:a.id,userId:n.user.id}),`Device.bind`)?{...a,userId:n.user.id}:await Y(e,iN($,{userCode:i}),`Device.get`))();if(!o||o.userId!==n.user.id)return new XM;if(o.status!==`pending`)return new YM;let s=await(async()=>{if(t.decision!==`approve`||!o.key)return;let r=await Y(e,R4(e,{account:t.account,assertion:t.assertion,request:o,session:n}),`DeviceRequest.sign`);if(r instanceof $D)return r;if(r.options)return{options:r.options};let i={account:r.account,keyAuthorization:r.keyAuthorization};return await Y(e,aN($,{id:o.id,key:i,userId:n.user.id}),`Device.hold`)?{key:i}:await l()})();if(s instanceof $D)return s;if(s&&`options`in s)return{options:s.options};let c=async()=>{s&&await Y(e,oN($,{id:o.id,key:s.key}),`Device.release`)};return await Y(e,nN($,{id:o.id,status:t.decision===`approve`?`approved`:`denied`,userId:n.user.id}).catch(async e=>{throw await c(),e}),`Device.decide`)?void 0:(await c(),await l());async function l(){return await Y(e,iN($,{userCode:i}),`Device.get`)?new YM:new XM}}(function(e){e.errors=[...R4.errors,xP,YM,XM,eO]})(B4||={});var V4=new Jl().get(`/v1/device/requests/:code`,DI({description:`Reads the request of a device code for the device page, by its user code. The first signed-in user to read a pending code binds it, so no other user can decide it.`,responses:II({errors:[...X.errors,...L4.errors,...Z.errors,xP,eO],success:{description:`What the CLI requested.`,schema:z4.requests.response}}),security:[{sessionCookie:[]}],tags:[`Device grant`]}),X(`param`,z4.requests.param),async e=>{if(e.req.header(`sec-fetch-site`)===`cross-site`)return J(e,new eO);let t=await Y(e,I$(e),`Session.get`);if(!t)return J(e,new xP);let n=await Y(e,Z(e,{limits:[{binding:`AUTHORIZE_LIMIT`,key:`${t.user.id}:device`}]}),`RateLimit.check`);if(n)return n;let r=await Y(e,L4(e,{code:e.req.valid(`param`).code,userId:t.user.id}),`DeviceRequest.read`);if(e.header(`cache-control`,`private, no-store`),r instanceof $D)return J(e,r);let{chainId:i,clientId:a,request:o}=r,{key_authorization:s,...c}=o;if(!s||o.status!==`pending`)return e.json({request:o},200);let l=await Y(e,VQ(e,{account:s.account,chainId:i,clientId:a,email:t.user.email,sessionId:t.session.id,userId:t.user.id}),`KeySigner.preview`),u=Number(i),d=Lj({chainId:u,rpcUrls:I.RPC_URLS});return e.json({request:{...c,key_authorization:{...s,...l.account?{account:l.account}:{},chain:{id:u,...d?{name:d}:{}},...l.refusal?{refusal:l.refusal}:{}}}},200)}).post(`/v1/device/approve`,DI({description:`Approves a device code for the signed-in user, and the CLI's next poll returns its tokens and any signed key. If the key names no account and the user holds none, the approval first creates an account. Only Tempo ID's device page sends the request.`,responses:II({errors:[...zP,...X.errors,...Z.errors,...B4.errors],success:{description:`The code is approved, or the passkey step.`,schema:z4.approve.response}}),security:[{sessionCookie:[]}],tags:[`Device grant`]}),X(`json`,z4.approve.json),async e=>{let{account:t,code:n,passkey:r}=e.req.valid(`json`),i=await Y(e,B4(e,{account:t,assertion:r?.assertion,code:n,decision:`approve`}),`device.decide`);return i instanceof Response?i:i instanceof $D?J(e,i):i?(e.header(`cache-control`,`private, no-store`),e.json(z4.approve.step.parse({step:{options:i.options,type:`passkey`}}),200)):e.json({status:`approved`},200)}).post(`/v1/device/deny`,DI({description:"Denies a device code for the signed-in user, and the CLI's next poll returns `access_denied`. Only Tempo ID's device page sends the request.",responses:II({errors:[...zP,...X.errors,...Z.errors,...B4.errors],success:{description:`The code is denied.`,schema:z4.deny.response}}),security:[{sessionCookie:[]}],tags:[`Device grant`]}),X(`json`,z4.deny.json),async e=>{let t=await Y(e,B4(e,{code:e.req.valid(`json`).code,decision:`deny`}),`device.decide`);return t instanceof Response?t:t instanceof $D?J(e,t):e.json({status:`denied`},200)}),H4;(function(e){let t;(function(e){e.response=A({ok:oa(!0).meta({description:"Always `true`."}),version:A({id:j().meta({description:"The version's ID, as `wrangler deploy` prints it.",examples:[`a5f3c2e1-7b4d-4e8a-9c6f-2d1b0e3a4c5f`]}),tag:j().meta({description:`The version's tag, or empty when it has none.`,examples:[`v1.4.0`]})}).meta({description:`The deployed Worker version that served the request.`})})})(t||=e.health||={})})(H4||={});var U4=new Jl().get(`/health`,DI({description:`Responds while the Worker is up, with the version that served the request.`,responses:II({success:{description:`The Worker is up.`,schema:H4.health.response}}),tags:[`Health`]}),e=>{let{id:t,tag:n}=e.env.CF_VERSION_METADATA;return e.header(`cache-control`,`no-store`),e.json({ok:!0,version:{id:t,tag:n}},200)}),W4,G4=TP(async(e,t)=>{e.set(`cache`,e.env.CACHE??(W4??=HP({ttl:(I.CONFIG_CACHE_TTL??30)*1e3}))),await t()}),K4;(function(e){let t;(function(e){e.response=Mi({authorization_endpoint:Hi().meta({description:`The authorization endpoint.`,examples:[`https://id.tempo.xyz/oauth2/authorize`]}),issuer:Hi().meta({description:"The issuer's identifier, every token's `iss`.",examples:[`https://id.tempo.xyz`]}),jwks_uri:Hi().meta({description:`The issuer's signing keys.`,examples:[`https://id.tempo.xyz/oauth2/jwks`]}),token_endpoint:Hi().meta({description:`The token endpoint.`,examples:[`https://id.tempo.xyz/oauth2/token`]})}).meta({description:`The issuer's metadata (RFC 8414 §2, OpenID Connect Discovery §3), with the members that RFC 8414 defines.`,id:`AuthorizationServerMetadata`})})(t||=e.openidConfiguration||={});let n;(function(e){e.response=t.response})(n||=e.oauthAuthorizationServer||={});let r;(function(e){e.query=A({challenge:j().optional().meta({description:"A message, such as a sign-in challenge from the app's backend, whose EIP-191 hash becomes the key authorization's `witness` (TIP-1053). Requires `key_authorization`, and the app's `tempo-id:sign` scope.",examples:[`Sign in to app.example.com
531
+ Nonce: 7f3a9c2e5b1d4f60`]}),client_id:j().meta({description:`The app's client ID.`,examples:[`tempo-cli`]}),code_challenge:j().meta({description:`The PKCE challenge: the base64url SHA-256 hash of the code verifier (RFC 7636 §4.2).`,examples:[`E9Melhoa2OwvFrEMTJguCHaoeK1t8URWbuGJSstw-cM`]}),code_challenge_method:oa(`S256`).meta({description:`The PKCE challenge method.`}),key_authorization:j().optional().meta({description:"A key authorization for the app's own key, as base64url JSON in the shape of `KeyAuthorizationRequest`. The approval page shows the key, and `/oauth2/token` returns it beside the tokens once approval signs it. A key that breaks a rule returns to the redirect URI with the refusal.",examples:[`eyJhZGRyZXNzIjoiMHg4MWMwZjIyYmQxNzNjMTE1ZDE4ZWVlYTBmNmEzOGU5MzVlY2Y1MmZiIn0`]}),prompt:Qi([`consent`,`login`,`none`,`select_account`]).optional().meta({description:`Whether the user signs in or consents again (OIDC Core §3.1.2.1). Absent to reuse the session and stored consent.`,examples:[`consent`]}),redirect_uri:Hi().meta({description:`One of the app's registered redirect URIs.`,examples:[`https://app.example/callback`]}),resource:Hi().optional().meta({description:`The API the access token is for (RFC 8707). Absent for Tempo ID's own origin.`,examples:[`https://id.tempo.xyz`]}),response_type:oa(`code`).meta({description:`The authorization code flow.`}),scope:j().meta({description:`Space-separated OAuth scopes.`,examples:[`openid profile email`]}),state:j().optional().meta({description:`An opaque value that the redirect returns to the app unchanged.`,examples:[`af0ifjsldkj`]})}),e.response=A({redirect:Pi().meta({description:"Whether the app sends the browser to `url`.",examples:[!0]}),url:j().meta({description:`Where the browser goes next: the sign-in page, the consent page, or the redirect URI with a code.`,examples:[`https://app.example/callback?code=SplxlOBeZQQYbYS6WxSbIA`]})}).meta({description:`The next step of the authorization, for a request that a script sends.`})})(r||=e.authorize||={});let i;(function(e){e.error=A({error:j().meta({description:"The RFC 6749 error code, such as `invalid_grant` or `invalid_client`.",examples:[`invalid_grant`]}),error_description:j().optional().meta({description:`The issuer's description of the error. Absent when the issuer sends none.`,examples:[`invalid code`]}),error_uri:Hi().optional().meta({description:`A page about the error. Absent when the issuer sends none.`,examples:[`https://example.com/docs/errors#invalid_grant`]}),request_id:j().optional().meta({description:"The request ID, which Tempo ID adds and `X-Request-Id` also carries.",examples:[`5b3e1f2a-8c4d-4e6f-9a0b-7c2d1e3f4a5b`]})}).meta({description:`The issuer's OAuth error response (RFC 6749 §5.2), passed through.`,id:`OAuthErrorResponse`}),e.form=A({client_id:j().optional().meta({description:"The app's client ID. Absent when the app authenticates with HTTP Basic `Authorization`.",examples:[`tempo-cli`]}),client_secret:j().optional().meta({description:`A confidential app's secret.`,examples:[`3bTm9qXc2Lr7WvN5kYp8Hs4Df6Ga1Je0`]}),code:j().optional().meta({description:"The authorization code to redeem, for the `authorization_code` grant.",examples:[`SplxlOBeZQQYbYS6WxSbIA`]}),code_verifier:j().optional().meta({description:"The PKCE verifier whose S256 hash is the authorization request's `code_challenge` (RFC 7636 §4.5).",examples:[`dBjftJeZ4CVP-mB92K27uhbUJU1p1r_wW1gFWFOEjXk`]}),device_code:j().optional().meta({description:`The device code, for the device code grant (RFC 8628 §3.4).`,examples:[`GmRhmhcxhwAzkoEqiMEg_DnyEysNkuNhszIySk9eS`]}),grant_type:Qi([`authorization_code`,`client_credentials`,`refresh_token`,`urn:ietf:params:oauth:grant-type:device_code`]).meta({description:`The OAuth grant that the request redeems.`,examples:[`authorization_code`]}),redirect_uri:j().optional().meta({description:"The redirect URI of the authorization request, for the `authorization_code` grant.",examples:[`https://app.example/callback`]}),refresh_token:j().optional().meta({description:"The refresh token to redeem, for the `refresh_token` grant.",examples:[`yAjhKk7QnRZ3vD9pLm2Xc8Ws5Tf1Ub4N`]}),resource:Hi().optional().meta({description:`The API the access token is for (RFC 8707). Absent for Tempo ID's own origin.`,examples:[`https://id.tempo.xyz`]}),scope:j().optional().meta({description:`Space-separated OAuth scopes to request. Absent to keep the scopes of the grant.`,examples:[`openid profile email`]})}),e.response=Mi({access_token:j().meta({description:`The access token, an RS256 JWT for the requested resource.`,examples:[`eyJhbGciOiJSUzI1NiIsInR5cCI6ImF0K2p3dCJ9.e30.c2lnbmF0dXJl`]}),account:uM.account.optional().meta({description:"The Tempo Account that the key acts for. Present beside `key_authorization`.",examples:[`0x9a073914db0d149375ac2b7fbb72c68c0780fb5f`]}),expires_in:Ti().meta({description:`How long the access token lasts, in seconds.`,examples:[300]}),id_token:j().optional().meta({description:"The ID token, an RS256 JWT. Absent without the `openid` scope.",examples:[`eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.e30.c2lnbmF0dXJl`]}),key_authorization:uM.rpc.optional().meta({description:"The key authorization that the approval page or the device page signed, for the first redemption of a code or device code whose request carried `key_authorization`. Absent for every other code, a refresh, and a key that expired."}),refresh_token:j().optional().meta({description:"The refresh token. Absent without the `offline_access` scope.",examples:[`yAjhKk7QnRZ3vD9pLm2Xc8Ws5Tf1Ub4N`]}),scope:j().optional().meta({description:`Space-separated OAuth scopes of the tokens.`,examples:[`openid profile email`]}),token_type:j().meta({description:`The type of the access token (RFC 6749 §7.1).`,examples:[`Bearer`]})}).meta({description:`The issuer's token response (RFC 6749 §5.1).`,id:`TokenResponse`})})(i||=e.token||={});let a;(function(e){e.form=A({client_id:j().optional().meta({description:"The client ID of an app that holds the device grant. Absent when the app authenticates with HTTP Basic `Authorization`.",examples:[`tempo-cli`]}),client_secret:j().optional().meta({description:`A confidential app's secret.`,examples:[`3bTm9qXc2Lr7WvN5kYp8Hs4Df6Ga1Je0`]}),resource:Hi().optional().meta({description:`The API the access token is for (RFC 8707). Absent for Tempo ID's own origin.`,examples:[`https://id.tempo.xyz`]}),scope:j().optional().meta({description:"Space-separated OAuth scopes. Defaults to `openid email offline_access`.",examples:[`openid email offline_access`]})}),e.extension=A({challenge:VM.challenge.refine(e=>e===void 0||/^(?:[\t\n]|[^\p{Cc}\p{Cf}])*$/u.test(e),{message:`Remove control and format characters, such as bidi overrides`}),device:j().trim().min(1).max(64).regex(/^[^\p{Cc}\p{Cf}]*$/u,{message:`Remove control and format characters, such as bidi overrides`}).optional().meta({description:`The name that the device page shows, such as the machine's hostname. It holds no control or format characters.`,examples:[`ada-macbook`]}),key_authorization:r.query.shape.key_authorization.meta({description:"A key authorization for the app's own key, as base64url JSON in the shape of `KeyAuthorizationRequest`, from a public first-party app only. The device page shows it, approval signs it, and `/oauth2/token` returns it beside the tokens.",examples:[`eyJhZGRyZXNzIjoiMHg4MWMwZjIyYmQxNzNjMTE1ZDE4ZWVlYTBmNmEzOGU5MzVlY2Y1MmZiIn0`]})}),e.response=A({device_code:j().meta({description:"The secret code that the device polls `/oauth2/token` with (RFC 8628 §3.2). The device keeps it private.",examples:[`GmRhmhcxhwAzkoEqiMEg_DnyEysNkuNhszIySk9eS`]}),expires_in:Ti().meta({description:`Seconds until the device code and user code expire.`,examples:[600]}),interval:Ti().meta({description:`Seconds between polls.`,examples:[5]}),user_code:j().meta({description:`The code that the user enters on the verification page: eight consonants.`,examples:[`WDJBMJHT`]}),verification_uri:Hi().meta({description:`The page where the user enters the user code.`,examples:[`https://id.tempo.xyz/device`]}),verification_uri_complete:Hi().meta({description:`The verification page with the user code filled in, for a link or QR code.`,examples:[`https://id.tempo.xyz/device?user_code=WDJBMJHT`]})}).meta({description:`The issuer's device authorization response (RFC 8628 §3.2).`}),e.issued=Mi({device_code:j(),expires_in:Ti(),user_code:j()})})(a||=e.deviceCode||={});let o;(function(e){e.form=A({client_id:i.form.shape.client_id,client_secret:i.form.shape.client_secret,token:j().meta({description:`The token to introspect.`,examples:[`yAjhKk7QnRZ3vD9pLm2Xc8Ws5Tf1Ub4N`]}),token_type_hint:Qi([`access_token`,`refresh_token`]).optional().meta({description:"The type of `token`, which helps the issuer find it (RFC 7662 §2.1).",examples:[`refresh_token`]})}),e.response=Mi({active:Pi().meta({description:`Whether the token is active. An inactive token has no other members.`,examples:[!0]}),client_id:j().optional().meta({description:`The client ID of the app that the token belongs to.`,examples:[`tempo-cli`]}),exp:Ti().optional().meta({description:`When the token expires, in Unix seconds.`,examples:[1792076100]}),iat:Ti().optional().meta({description:`When the issuer issued the token, in Unix seconds.`,examples:[1792075800]}),iss:j().optional().meta({description:`The issuer's identifier.`,examples:[`https://id.tempo.xyz`]}),scope:j().optional().meta({description:`Space-separated OAuth scopes of the token.`,examples:[`openid profile email`]}),sub:j().optional().meta({description:`The user ID of the token's subject.`,examples:[`user_01JZ8Q6W3N1R5B4V7C2X9K0M3T`]})}).meta({description:`The issuer's introspection response (RFC 7662 §2.2).`,id:`IntrospectionResponse`})})(o||=e.introspect||={});let s;(function(e){e.form=A({client_id:i.form.shape.client_id,client_secret:i.form.shape.client_secret,token:j().meta({description:`The access or refresh token to revoke.`,examples:[`yAjhKk7QnRZ3vD9pLm2Xc8Ws5Tf1Ub4N`]}),token_type_hint:o.form.shape.token_type_hint})})(s||=e.revoke||={});let c;(function(e){e.response=Mi({email:j().optional().meta({description:"The user's email address. Absent without the `email` scope.",examples:[`ada@example.com`]}),email_verified:Pi().optional().meta({description:"Whether the issuer verified the email address. Absent without the `email` scope.",examples:[!0]}),sub:j().meta({description:`The user ID.`,examples:[`user_01JZ8Q6W3N1R5B4V7C2X9K0M3T`]})}).meta({description:`The issuer's UserInfo response (OIDC Core §5.3.2).`,id:`UserInfoResponse`})})(c||=e.userinfo||={});let l;(function(e){e.form=(e.query=A({client_id:j().optional().meta({description:"The app's client ID. Absent when `id_token_hint` names the app.",examples:[`tempo-cli`]}),continuation:j().optional().meta({description:`The sealed parameters of a form POST that carried no session cookie, which its 303 sends here. Absent otherwise.`,examples:[`a3f1c2…`]}),id_token_hint:j().optional().meta({description:"An ID token that Tempo ID issued to the app, even an expired one, which names the session to end. Required without `continuation`.",examples:[`eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.e30.c2lnbmF0dXJl`]}),post_logout_redirect_uri:Hi().optional().meta({description:`Where the browser goes after sign-out: one of the app's registered post-logout redirect URIs.`,examples:[`https://app.example/signed-out`]}),state:r.query.shape.state})).omit({continuation:!0}).extend({id_token_hint:j().meta({description:`An ID token that Tempo ID issued to the app, which names the session to end. It may be expired.`,examples:[`eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.e30.c2lnbmF0dXJl`]})}),e.response=A({signed_out:oa(!0).meta({description:`The browser holds no session that the hint names, since it ended or never held one.`})})})(l||=e.endSession||={});let u;(function(e){e.response=A({keys:Gi(Mi({alg:j().optional().meta({description:`The algorithm that the key signs with.`,examples:[`RS256`]}),kid:j().optional().meta({description:"The key ID, which matches the `kid` header of a token that the key signs.",examples:[`Qq0BN2lPx8VzTRsaGgMjc5HbEFKY4Wty`]}),kty:j().meta({description:`The key family (RFC 7518 §6.1).`,examples:[`RSA`]})})).meta({description:`The issuer's public signing keys, with the members of each key that RFC 7517 defines.`})}).meta({description:`The issuer's JSON Web Key Set (RFC 7517 §5).`,id:`JsonWebKeySet`})})(u||=e.jwks||={})})(K4||={});var q4={...PI([]),400:{content:{"application/json":{schema:CI(K4.token.error)}},description:`The issuer's refusal, passed through.`},401:{content:{"application/json":{schema:CI(K4.token.error)}},description:`The issuer's refusal of the client or token, passed through.`}},J4={responses:{200:{content:{"application/json":{schema:CI(K4.introspect.response)}},description:`The issuer's introspection response.`},...q4,...PI([...zP,...Z.errors])},security:[{},{clientBasic:[]}],tags:[`OAuth`]},Y4={description:`Signs the browser out of the session that the app's ID token names, if the browser holds it, and revokes the tokens that apps received through it (OpenID Connect RP-Initiated Logout). Any other session stays signed in, and Tempo ID redirects the browser to the app's post-logout redirect URI.`,responses:{302:{description:"Redirects the browser to the app's post-logout redirect URI, with `state`."},...II({errors:[...X.errors,...a1.errors],success:{description:"The browser is signed out of the session that the hint names, for a request without `post_logout_redirect_uri`.",schema:K4.endSession.response}})},tags:[`OAuth`]};async function X4(e,t){let{form:n,key:r}=t,i=l3(e.req.raw)??n.get(`client_id`),a=i?await Y(e,ED($,{clientId:i,enabled:!0}).catch(e=>{if(!(e instanceof yD))throw e}),`Apps.get`):void 0;return!i||!a?.device||a.secret||!a.firstParty?new BM({description:`Device grant refused: \`client_id\` ${i??`(none)`} names no enabled public first-party device app. Send the client ID of a registered device app, or leave out \`key_authorization\`.`}):SM(r)??CM({app:a,clientId:i,key:r})}(function(e){e.errors=[...SM.errors,...CM.errors,BM]})(X4||={});function Z4(e,t){let n=t.names.find(t=>e.getAll(t).length>1);if(n)return new LM({issues:[{message:`Repeated parameter. Send it once`,path:[n]}]})}var Q4=[`/.well-known/oauth-authorization-server`,`/.well-known/openid-configuration`,`/oauth2/authorize`,`/oauth2/introspect`,`/oauth2/jwks`,`/oauth2/revoke`,`/oauth2/token`,`/oauth2/userinfo`],$4=new Set([`/authorize`,`/choose-account`,`/error`,`/login`]),e3=new Set([`/device/code`,`/oauth2/authorize`,`/oauth2/introspect`,`/oauth2/revoke`,`/oauth2/token`]),t3=new Jl().get(`/.well-known/openid-configuration`,DI({description:`Reads the issuer's OpenID Connect discovery document.`,responses:II({success:{description:`The discovery document.`,schema:K4.openidConfiguration.response}}),tags:[`OAuth`]}),e=>a3(e)).get(`/.well-known/oauth-authorization-server`,DI({description:`Reads the issuer's authorization server metadata.`,responses:II({success:{description:`The metadata.`,schema:K4.oauthAuthorizationServer.response}}),tags:[`OAuth`]}),e=>a3(e)).get(`/oauth2/authorize`,DI({description:`Starts an authorization. A signed-out browser receives the sign-in page, and a signed-in one the consent page or a redirect to the redirect URI with a code.`,responses:{200:{content:{"application/json":{schema:CI(K4.authorize.response)},"text/html":{schema:{type:`string`}}},description:`The next step as JSON, for a request from a script. A browser navigation receives Tempo ID's page of the next step, such as the sign-in page or the error page.`},302:{description:"Redirects the browser to the redirect URI with a code. A refused `key_authorization` returns to the redirect URI with `error` and `error_description`."},...q4,...PI(Z.errors)},tags:[`OAuth`]}),FI(`query`,K4.authorize.query),async e=>{let t=await Y(e,o3(e),`oauth2.forward`),n=URL.parse(t.headers.get(`location`)??``,I.URL);if(t.status!==302||n?.origin!==new URL(I.URL).origin||!$4.has(n.pathname))return t;let r=t.headers.getSetCookie();for(let t of r)e.header(`set-cookie`,t,{append:!0});let i=new Request(n,{headers:h$(e,{setCookie:r})});return Y(e,e.env.pages(e,{request:i}),`page.render`)}).post(`/oauth2/token`,DI({description:`Redeems an authorization code, a refresh token, a device code, or client credentials for tokens.`,responses:{200:{content:{"application/json":{schema:CI(K4.token.response)}},description:`The tokens.`},...q4,...PI([...zP,...X.errors,...Z.errors])},security:[{},{clientBasic:[]}],tags:[`OAuth`]}),FI(`form`,K4.token.form),async e=>{let t=await Y(e,Z(e,{limits:[{binding:`TOKEN_LIMIT`,key:XI(e)}]}),`RateLimit.check`);if(t)return t;let n=new URLSearchParams(await Y(e,e.req.text(),`request.text`)),r=n3({authorization:e.req.header(`authorization`),form:n}),i=r?await Y(e,CD($,r),`Apps.authenticate`):!1,a=await Y(e,Z(e,{limits:[{binding:`TOKEN_APP_LIMIT`,key:i?r?.clientId:void 0}]}),`RateLimit.check`);if(a)return a;let o=Z4(n,{names:[`device_code`,`grant_type`]});if(o)return J(e,o);let s=n.get(`grant_type`)===`urn:ietf:params:oauth:grant-type:device_code`?n.get(`device_code`):null,c=s?await Y(e,sN($,{deviceCode:s}),`Device.find`):void 0,l=await Y(e,o3(e),`oauth2.forward`);return!c||!l.ok?l:Y(e,d3(e,{id:c.id,response:l}),`oauth2.withDeviceKey`)}).post(`/device/code`,DI({description:"Starts the device grant (RFC 8628 §3.1). The user approves the user code on the device page, and the device then redeems the device code at `/oauth2/token`.",responses:{200:{content:{"application/json":{schema:CI(K4.deviceCode.response)}},description:`The device code.`},...q4,...PI([...zP,...X.errors,...Z.errors,...X4.errors])},security:[{},{clientBasic:[]}],tags:[`OAuth`]}),FI(`form`,K4.deviceCode.form.extend(K4.deviceCode.extension.shape)),async e=>{let t=XI(e),n=await Y(e,Z(e,{limits:[{binding:`DEVICE_LIMIT`,key:t!==void 0&&e.req.header(`origin`)!==void 0?`${t}:browser`:t}]}),`RateLimit.check`);if(n)return n;let r=new URLSearchParams(await Y(e,e.req.text(),`request.text`)),i=Z4(r,{names:[`client_id`,`device`]});if(i)return J(e,i);let a=l3(e.req.raw);if(a&&r.has(`client_id`)&&r.get(`client_id`)!==a)return J(e,new LM({issues:[{message:`Conflicting client ID. Send the one of the Basic credentials, or leave it out`,path:[`client_id`]}]}));let o=K4.deviceCode.extension.safeParse({challenge:r.get(`challenge`)??void 0,device:r.get(`device`)??void 0,key_authorization:r.get(`key_authorization`)??void 0});if(!o.success)return J(e,new LM({issues:o.error.issues}));let{challenge:s,device:c}=o.data,l=WM(r);if(l instanceof $D)return J(e,l);if(l){let t=await Y(e,X4(e,{form:r,key:l}),`oauth2.refuseDeviceKey`);if(t)return J(e,t)}let u=await Y(e,o3(e),`oauth2.forward`);if(!u.ok)return u;let d=K4.deviceCode.issued.parse(await Y(e,u.json(),`response.json`));await Y(e,I4(e,{challenge:s,device:c??null,deviceCode:d.device_code,expiresIn:d.expires_in,key:l&&f3(r)}),`DeviceRequest.create`);let f=rN(d.user_code),p=new URL(lN,I.URL),m=new Headers(u.headers);return m.delete(`content-length`),new Response(JSON.stringify({...d,user_code:f,verification_uri:p.href,verification_uri_complete:`${p.href}?${new URLSearchParams({code:f})}`}),{headers:m,status:u.status})}).post(`/oauth2/introspect`,DI({description:"Introspects a token (RFC 7662). The app authenticates with its client credentials, in the body or as HTTP Basic `Authorization`.",...J4}),FI(`form`,K4.introspect.form),e=>o3(e)).post(`/oauth2/revoke`,DI({description:"Revokes an access or refresh token (RFC 7009). The app authenticates with its client credentials, in the body or as HTTP Basic `Authorization`.",responses:{200:{content:{"application/json":{schema:{description:`Empty: the token is revoked, or was already invalid (RFC 7009 §2.2).`}}},description:`The token is revoked.`},...q4,...PI([...zP,...Z.errors])},security:[{},{clientBasic:[]}],tags:[`OAuth`]}),FI(`form`,K4.revoke.form),e=>o3(e)).get(`/oauth2/userinfo`,DI({description:`Reads the token subject's claims (OIDC Core §5.3).`,responses:{200:{content:{"application/json":{schema:CI(K4.userinfo.response)}},description:`The issuer's UserInfo response.`},...q4},security:[{accessToken:[]}],tags:[`OAuth`]}),e=>o3(e)).get(`/oauth2/end-session`,DI(Y4),X(`query`,K4.endSession.query),async e=>r3(e,e.req.valid(`query`))).post(`/oauth2/end-session`,DI({...Y4,responses:{...Y4.responses,...PI(zP),303:{description:"Continues a form POST without the session cookie as `GET /oauth2/end-session` with the sealed parameters in `continuation`, which the browser sends with the cookie."}}}),X(`form`,K4.endSession.form),async e=>r3(e,e.req.valid(`form`))).get(`/oauth2/jwks`,DI({description:`Reads the issuer's signing keys. A verifier may cache the response for 60 seconds, since a new key signs 5 minutes after its rotation.`,responses:II({success:{description:`The JSON Web Key Set.`,schema:K4.jwks.response}}),tags:[`OAuth`]}),async e=>{let t=await Y(e,o3(e),`oauth2.forward`);if(!t.ok)return t;let n=K4.jwks.response.safeParse(await Y(e,t.clone().json(),`response.json`));return n.success&&n.data.keys.length>0&&t.headers.set(`cache-control`,`public, max-age=60`),t}).on([`GET`,`POST`],[...Q4],e=>o3(e));function n3(e){let{authorization:t,form:n}=e;if(t&&/^Basic +/i.test(t))try{return Ca(t)}catch{return}let[r,...i]=n.getAll(`client_id`).filter(e=>e.length>0),[a,...o]=n.getAll(`client_secret`).filter(e=>e.length>0);if(r&&a&&!i.length&&!o.length)return{clientId:r,clientSecret:a}}async function r3(e,t){let n=t.continuation===void 0?t:await Y(e,s1(t.continuation,{secret:I.SECRET}),`Logout.unseal`);if(!n)return J(e,new LM({issues:[{message:`Expired or invalid continuation. Send the logout request again`,path:[`continuation`]}]}));let r=n.id_token_hint;if(!r)return J(e,new LM({issues:[{message:`Required`,path:[`id_token_hint`]}]}));let i=await Y(e,_D($,{hint:r}),`SigningKey.hintKeys`),a=await Y(e,a1($,{clientId:n.client_id,hint:r,issuer:I.URL,jwks:i,postLogoutRedirectUri:n.post_logout_redirect_uri,state:n.state}),`Logout.check`);if(a instanceof $D)return J(e,a);let o=await Y(e,L$(e),`Session.token`),s=(o?await Y(e,c1($,{sessionId:a.sessionId,token:o}),`Logout.end`):void 0)!==void 0;if(!s&&e.req.method===`POST`){let t=await Y(e,o1({client_id:n.client_id,id_token_hint:r,post_logout_redirect_uri:n.post_logout_redirect_uri,state:n.state},{secret:I.SECRET}),`Logout.seal`),i=new URL(`/oauth2/end-session`,I.URL);return i.searchParams.set(`continuation`,t),e.header(`cache-control`,`no-store`),e.redirect(i.href,303)}return s&&(await Y(e,F$(e),`Session.clear`),e.header(`set-cookie`,gQ(),{append:!0})),e.header(`cache-control`,`no-store`),a.redirect?e.redirect(a.redirect,302):e.json({signed_out:!0},200)}var i3=[`frontchannel_logout_session_supported`,`frontchannel_logout_supported`];async function a3(e){let t=await Y(e,o3(e),`oauth2.forward`);if(!t.ok||e.req.method===`HEAD`)return t;let n=Ei(j(),pi()).parse(await Y(e,t.json(),`response.json`));for(let e of i3)delete n[e];let r=new Headers(t.headers);return r.delete(`content-length`),new Response(JSON.stringify(n),{headers:r,status:t.status})}async function o3(e){let t=await Y(e,p3(e),`oauth2.withResource`),n=t.method===`POST`?await Y(e,t.clone().text(),`request.text`):void 0,r=n!==void 0&&t.headers.get(`content-type`)?.toLowerCase().includes(`application/x-www-form-urlencoded`),i=r?new URLSearchParams(n):new URL(t.url).searchParams,a=await Y(e,s3(e,{body:n,request:t}),`oauth2.limitDiscovery`);if(a)return a;if(e.req.path===`/oauth2/authorize`&&i.getAll(`client_id`).length>1)return J(e,new LM({issues:[{message:`Repeated parameter. Send it once`,path:[`client_id`]}]}));if(e.req.path===`/oauth2/authorize`&&i.has(`user_code`))return J(e,new LM({issues:[{message:`Unsupported parameter. Approve a device code at /device`,path:[`user_code`]}]}));if(e.req.path===`/oauth2/token`&&r){let n={};for(let[e,t]of i)n[e]=t;return Y(e,e.var.auth.api.oauth2Token({asResponse:!0,body:n,headers:t.headers,request:t}),`auth.oauth2Token`)}return e.req.path===`/oauth2/authorize`&&await Y(e,u3(e,{query:i}),`oauth2.refuseKey`)||Y(e,e.var.auth.handler(t),`auth.handler`)}async function s3(e,t){let{body:n,request:r}=t,i=new URL(r.url);if(!e3.has(i.pathname))return;let a=[...i.searchParams.getAll(`client_id`),...c3(n),l3(r)].filter(e=>e!==void 0);if(a.some(MD)&&(await Y(e,ND($,{clientIds:a}),`Apps.stale`)).length!==0)return Y(e,Z(e,{limits:[{binding:`APP_DISCOVERY_LIMIT`,key:XI(e)}]}),`RateLimit.check`)}function c3(e){if(!e)return[];let t=new URLSearchParams(e),n=(()=>{try{let t=JSON.parse(e);if(typeof t!=`object`||!t)return[];let n=t.client_id;return typeof n==`string`?[n]:[]}catch{return[]}})(),r=t.getAll(`client_assertion`).flatMap(e=>{try{let[,t]=e.split(`.`),n=JSON.parse(new TextDecoder().decode(Ln(t??``)));if(typeof n!=`object`||!n)return[];let{iss:r,sub:i}=n;return[r,i].filter(e=>typeof e==`string`)}catch{return[]}});return[...t.getAll(`client_id`),...n,...r]}function l3(e){let t=e.headers.get(`authorization`);if(t&&/^Basic +/i.test(t))try{return Ca(t).clientId}catch{return}}async function u3(e,t){let{query:n}=t;if(!n.has(`key_authorization`)&&!n.has(`challenge`))return;let r=n.get(`client_id`),i=n.get(`redirect_uri`);if(!r||!i||MD(r)&&!(await Y(e,e.var.auth.api.resolveOAuthClient({body:{client_id:r}}).catch(e=>{if(za(e))return{resolved:!1};throw e}),`auth.resolveOAuthClient`)).resolved)return;let a=await Y(e,ED($,{clientId:r}).catch(e=>{if(!(e instanceof yD))throw e}),`Apps.get`);if(!a||!a.redirectUris.includes(i))return;let o=WM(n),s=o instanceof $D?o:o&&UM({app:a,clientId:r,codeChallenge:n.get(`code_challenge`),key:o,query:n});if(!s)return;let c=new URL(i);c.searchParams.append(`error`,s.response.error),c.searchParams.append(`error_description`,s.response.error_description);let l=n.get(`state`);return l&&c.searchParams.append(`state`,l),c.searchParams.append(`iss`,I.URL),e.header(`cache-control`,`no-store`),e.redirect(c.href,302)}async function d3(e,t){let{id:n,response:r}=t,i=await Y(e,dN($,{id:n}),`Device.take`).catch(t=>{Zs(e,{error:t,message:`A device code redemption failed to take the held key.`})});if(!i)return r;let a=await Y(e,r.json(),`response.json`),o=new Headers(r.headers);return o.delete(`content-length`),new Response(JSON.stringify({...a,account:i.account,key_authorization:i.keyAuthorization}),{headers:o,status:r.status})}function f3(e){let t=new URLSearchParams(e);t.delete(`challenge`);let n=WM(t);return n instanceof $D?void 0:n}async function p3(e){let t=e.req.raw;if(e.req.path===`/oauth2/authorize`&&e.req.method===`GET`){let e=new URL(t.url);return e.searchParams.has(`resource`)||e.searchParams.set(`resource`,I.URL),e.search=GM(e.searchParams).toString(),new Request(e,t)}if(e.req.path===`/oauth2/authorize`&&e.req.method===`POST`&&e.req.header(`content-type`)?.split(`;`)[0]?.toLowerCase().includes(`application/x-www-form-urlencoded`)){let n=new URLSearchParams(await Y(e,e.req.text(),`request.text`));n.has(`resource`)||n.set(`resource`,I.URL);let r=new Headers(t.headers);return r.delete(`content-length`),r.set(`content-type`,`application/x-www-form-urlencoded`),new Request(t.url,{body:GM(n),headers:r,method:`POST`})}if(e.req.path===`/oauth2/token`&&e.req.method===`POST`){let n=new URLSearchParams(await Y(e,e.req.text(),`request.text`));n.has(`resource`)||n.set(`resource`,I.URL);let r=new Headers(t.headers);return r.delete(`content-length`),r.delete(`cookie`),new Request(t.url,{body:n,headers:r,method:`POST`})}if(e.req.path===`/device/code`&&e.req.method===`POST`){let n=new URLSearchParams(await Y(e,e.req.text(),`request.text`));n.has(`resource`)||n.set(`resource`,I.URL),n.has(`scope`)||n.set(`scope`,ZM),n.delete(`user_id`);for(let e of[`challenge`,`device`,`key_authorization`])n.delete(e);let r=new Headers(t.headers);return r.delete(`content-length`),r.delete(`cookie`),r.set(`content-type`,`application/x-www-form-urlencoded`),new Request(t.url,{body:n,headers:r,method:`POST`})}return t}var m3=new Jl().route(`/`,U4).route(`/`,B$).route(`/`,A4).route(`/`,F4).route(`/`,V4).route(`/`,t3),h3=new Jl().use(DP).use(MQ()).use(G4).use(HY).use(fX).use(au({referrerPolicy:`same-origin`})).use(pu()).use(`/.well-known/oauth-authorization-server`,M$).use(`/.well-known/openid-configuration`,M$).use(`/oauth2/introspect`,M$).use(`/oauth2/jwks`,M$).use(`/oauth2/revoke`,M$).use(`/oauth2/token`,M$).use(`/oauth2/userinfo`,M$).use(`/v1/auth/assets`,M$).use(`/v1/chains`,M$).use(`/v1/*`,j$).use(Zl([`/device/code`,`/oauth2/*`],nu())).use(`/device/code`,VP).use(`/i/*`,VP).use(`/oauth2/*`,VP).use(`/v1/*`,VP).use(h4).route(`/`,m3).get(`/openapi.json`,DI({description:`Returns this OpenAPI document.`,responses:{200:{content:{"application/json":{schema:{type:`object`}}},description:`The OpenAPI 3.1 document.`},...PI([])},tags:[`Reference`]}),async e=>e.json(await Y(e,jI(h3),`OpenApi.document`),200)).get(`/docs`,DI({description:`Renders this OpenAPI document as an API reference.`,responses:{200:{content:{"text/html":{schema:{type:`string`}}},description:`The API reference page.`},...PI([])},tags:[`Reference`]}),e=>(e.header(`content-security-policy`,NI),e.html(MI))).all(`/:version{v\\d+}/*`,e=>J(e,new iO)).notFound(async e=>g3(e.req.path)?J(e,new iO):Y(e,e.env.pages(e),`page.render`)).onError(lO);function g3(e){if(_3.has(e))return!1;let t=e.split(`/`)[1]??``;return v3.has(t)||/^v\d+$/.test(t)}var _3=new Set([`/device`]),v3=new Set(h3.routes.flatMap(e=>{let t=e.path.split(`/`)[1]??``;return t&&t!==`*`&&!t.startsWith(`:`)?[t]:[]})),y3=new WeakSet;function b3(e){if(e instanceof Response)return e;let t;return t=e==null?new Response(null,{status:204}):typeof e==`string`?new Response(e,{headers:{"Content-Type":`text/html; charset=utf-8`}}):Response.json(e),y3.add(t),t}function x3(e){return Array.from(e,e=>({message:e.message,path:e.path?.map(e=>typeof e==`object`?e.key:e).join(`.`)}))}async function S3(e,t){let n=await e[`~standard`].validate(t);return n.issues?{ok:!1,issues:n.issues}:{ok:!0,value:n.value}}async function C3(e,t){let n={},r=[];if(e.params){let i=t.req.param(),a=await S3(e.params,i);a.ok?n.params=a.value:r.push({slot:`params`,issues:x3(a.issues)})}if(e.query){let i=new URL(t.req.url),a={};for(let[e,t]of i.searchParams)a[e]=t;let o=await S3(e.query,a);o.ok?n.query=o.value:r.push({slot:`query`,issues:x3(o.issues)})}if(e.body){let i;try{i=await t.req.json()}catch{return{ok:!1,response:Response.json({error:`Invalid JSON body`},{status:400})}}let a=await S3(e.body,i);a.ok?n.body=a.value:r.push({slot:`body`,issues:x3(a.issues)})}return r.length>0?{ok:!1,response:Response.json({error:`Validation failed`,issues:r},{status:400})}:{ok:!0,input:n}}function w3(...e){if(e.length===1)return e[0];let t=e.slice(0,-1),n=e[e.length-1];return(async e=>{let r=0,i=async()=>{if(r<t.length){let n=t[r++],a=await n(e,i);a instanceof Response&&(e.res=a)}else e.res=b3(await n(e))};return await i(),e.res})}(function(e){function t(e){return t=>(async n=>{let r=await C3(e,n);return r.ok?b3(await t(n,r.input)):r.response})}e.withValidator=t})(w3||={}),new TextEncoder,new TextDecoder(`utf-8`,{fatal:!0});function T3(e){return e}var E3=864e5,D3=T3(async e=>{let t=new Date;try{await YZ.delete(K).where(QC(K.expiresAt,t)),await YZ.delete(iE).where(QC(iE.expiresAt,t)),await YZ.delete(TE).where(QC(TE.expiresAt,t)),await YZ.delete(OE).where(QC(OE.expiresAt,t)),await YZ.delete(G).where(qC(rw(G.clientDiscoveryId),QC(G.updatedAt,new Date(t.getTime()-E3)),V`not exists (select 1 from ${fE} where ${fE.clientId} = ${G.clientId})`,V`not exists (select 1 from ${wE} where ${wE.clientId} = ${G.clientId})`)),await YZ.delete(cE).where(QC(cE.expiresAt,t)),await YZ.delete(oE).where(QC(oE.expiresAt,t)),await YZ.delete(mE).where(qC(QC(mE.expiresAt,t),aw(YZ.select({one:V`1`}).from(oE).where(W(oE.refreshId,mE.id))))),await YZ.delete(vE).where(qC(QC(vE.expiresAt,t),aw(YZ.select({one:V`1`}).from(oE).where(W(oE.sessionId,vE.id))),aw(YZ.select({one:V`1`}).from(mE).where(W(mE.sessionId,vE.id)))))}catch(t){throw Zs({error:t,fields:{cron:e.cron},message:`The cleanup cron failed.`}),t}}),O3=[`ratelimit`,`ratelimit-policy`,`retry-after`],k3=[`cf-connecting-ip`,`cf-ray`,`cf-worker`,`user-agent`],A3,j3,M3={fetch:(e,t,n)=>h3.fetch(e,{...t,pages:(e,r={})=>N3(e,{ctx:n,env:t,request:r.request}),signInAssets:()=>j3??=L3()},n),scheduled:(...e)=>Zc(e[1],()=>D3(...e))};async function N3(e,t){let{ctx:n,env:r}=t,i=t.request??e.req.raw,a=z3(i.headers.get(`cookie`)??void 0),o=new URL(e.req.url).origin,s,c,l=!1,u=async(t,i)=>{let s=new Request(t,i),c=new URL(s.url);if(c.origin!==o||![`/i/`,`/v1/`].some(e=>c.pathname.startsWith(e)))throw Error(`A page called a path outside the JSON API.`);a.size>0&&s.headers.set(`cookie`,B3(a));for(let t of k3){let n=e.req.header(t);n&&s.headers.set(t,n)}let u=await Y(e,Promise.resolve(h3.fetch(s,{...r,ownerLists:e.var.ownerLists,pages:()=>R3(),signInAssets:e.env.signInAssets},n)),`api`,`${s.method} ${new URL(s.url).pathname}`);for(let t of u.headers.getSetCookie())I3(a,{setCookie:t}),l?$s(e,{message:`A page set a cookie after its headers were sent.`}):e.header(`set-cookie`,t,{append:!0});return u},d=t=>async(n,r)=>{s&&await Y(e,s.catch(()=>void 0),`api.wait`);let i=u(n,r);s??=i;let a=await i;return a.status===429&&!t.optional&&(c??=a),a};A3??=import(`./assets/server-RRUiOef2.js`).then(e=>e.createStartHandler(e.defaultStreamHandler));let f=await(await Y(e,A3,`pages.load`))(i,{context:{fetch:d({optional:!1}),fetchOptional:d({optional:!0}),origin:o}}),p=t.signIn||![`GET`,`HEAD`].includes(i.method)?void 0:P3(f,{origin:o});if(p){await f.body?.cancel();let t=new Headers(i.headers);return a.size>0?t.set(`cookie`,B3(a)):t.delete(`cookie`),N3(e,{ctx:n,env:r,request:new Request(p,{headers:t}),signIn:!0})}l=!0,e.header(`cache-control`,`private, no-store`);let m=(i===e.req.raw?f:F3(f,{url:i.url})).body;if(c&&f.status===200){for(let t of O3){let n=c.headers.get(t);n&&e.header(t,n)}return e.newResponse(m,{headers:f.headers,status:429})}return e.newResponse(m,f)}function P3(e,t){if(e.status<300||e.status>399)return;let n=URL.parse(e.headers.get(`location`)??``,t.origin);if(n?.origin===t.origin&&n.pathname===`/login`)return n.href}function F3(e,t){let n=new URL(t.url),r=JSON.stringify(n.pathname+n.search).replaceAll(`<`,`\\u003c`);return new HTMLRewriter().on(`head`,{element:e=>{e.prepend(`<script>history.replaceState(null, '', ${r})<\/script>`,{html:!0})}}).transform(e)}function I3(e,t){let[n,...r]=t.setCookie.split(`;`),i=n.indexOf(`=`),a=n.slice(0,i).trim(),o=n.slice(i+1).trim();r.some(e=>/^max-age=0$/i.test(e.trim()))||!o?e.delete(a):e.set(a,o)}async function L3(){let{tsrStartManifest:e}=await import(`./assets/_tanstack-start-manifest_v-U7TrtUSA.js`),{routes:t}=e(),n=[`__root__`,`/login`].flatMap(e=>{let n=t[e];return[...n?.css??[],...n?.preloads??[]].map(e=>typeof e==`string`?e:e.href)});return[...new Set([a,...n])]}function R3(){return Promise.resolve(new Response(null,{status:404}))}function z3(e){let t=new Map;for(let n of e?.split(`;`)??[]){let e=n.indexOf(`=`);e>0&&t.set(n.slice(0,e).trim(),n.slice(e+1).trim())}return t}function B3(e){return[...e].map(([e,t])=>`${e}=${t}`).join(`; `)}function V3(){let e=null;return async(t,n)=>{if(e)return e;let r=globalThis.__VITE_MANIFEST__;if(typeof r==`object`&&r)return e=r,e;let i=n?.ASSETS;if(!i||typeof i.fetch!=`function`)return null;let a=await i.fetch(new Request(new URL(`/.vite/manifest.json`,t.url).toString()));return a.ok?(e=await a.json(),e):null}}var H3={".avif":`image/avif`,".css":`text/css; charset=utf-8`,".gif":`image/gif`,".html":`text/html; charset=utf-8`,".ico":`image/x-icon`,".jpeg":`image/jpeg`,".jpg":`image/jpeg`,".js":`text/javascript; charset=utf-8`,".json":`application/json; charset=utf-8`,".mjs":`text/javascript; charset=utf-8`,".png":`image/png`,".svg":`image/svg+xml`,".txt":`text/plain; charset=utf-8`,".wasm":`application/wasm`,".webp":`image/webp`,".woff":`font/woff`,".woff2":`font/woff2`};function U3(e,t,n=`assets`,r=!1){if(![`GET`,`HEAD`].includes(e.method)||![200,206,304].includes(t.status))return t;let i=new URL(e.url).pathname,a=i.slice(i.lastIndexOf(`/`)+1),o=a.slice(a.lastIndexOf(`.`)).toLowerCase(),s=new Headers(t.headers);!s.has(`Content-Type`)&&H3[o]&&s.set(`Content-Type`,H3[o]);let c=s.get(`Cache-Control`),l=(c??``).toLowerCase().split(`,`).map(e=>e.trim()).sort().join(`,`)===`max-age=0,must-revalidate,public`,u=r&&i.startsWith(`/`+n.replace(/^\/+|\/+$/g,``)+`/`)&&o!==`.html`&&!(s.get(`Content-Type`)??``).toLowerCase().includes(`text/html`);return!s.has(`Set-Cookie`)&&u&&(!c||l)?s.set(`Cache-Control`,`public, max-age=31536000, immutable`):c||s.set(`Cache-Control`,`no-store`),new Response(t.body,{status:t.status,statusText:t.statusText,headers:s})}function W3(e,t=V3()){let n;return async(r,i,a)=>{let o=new URL(r.url).pathname;return![`GET`,`HEAD`].includes(r.method)||![200,206,304].includes(a.status)||!o.startsWith(`/`+(e??`assets`).replace(/^\/+|\/+$/g,``)+`/`)?U3(r,a,e):(n||=t(r,i).then(e=>new Set(Object.values(e??{}).flatMap(e=>Array.isArray(e?.immutableFiles)?e.immutableFiles:[])),()=>new Set),U3(r,a,e,(await n).has(o.slice(1))))}}function G3(e={}){let t=W3(e.assetsDir);return async(n,r,i)=>{if(i.status!==404||!r.ASSETS||n.method!==`GET`&&n.method!==`HEAD`)return i;let a=await r.ASSETS.fetch(new Request(n.url,{method:n.method,headers:n.headers}));if(a.status!==404)return t(n,r,a);let o=n.headers.get(`accept`)??``;if(e.serveSpaFallback&&o.includes(`text/html`)){let e=new URL(`/index.html`,n.url),t=await r.ASSETS.fetch(new Request(e,{method:n.method}));if(t.status===200){let e=new Response(t.body,{status:200,headers:t.headers});return e.headers.set(`Cache-Control`,`no-store`),e.headers.set(`Content-Type`,`text/html; charset=utf-8`),e}}else if(!e.serveSpaFallback&&e.notFound===`404-page`&&o.includes(`text/html`)&&(a.headers.get(`content-type`)??``).includes(`text/html`)){let e=new Response(a.body,a);return e.headers.set(`Cache-Control`,`no-store`),e}return i}}var K3={...M3,fetch(e,t,n){return Zc(t,async()=>q3(e,t,await M3.fetch(e,t,n)))}},q3=G3({assetsDir:`assets`,serveSpaFallback:!1,notFound:`none`}),J3=K3??{};export{J3 as default};
532
+ //# sourceMappingURL=index.js.map