@kyro-cms/core 0.12.44 → 0.12.46

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 (311) hide show
  1. package/dist/{WebhookService-C19xR8qE.d.ts → WebhookService-CZf_na-J.d.ts} +1 -1
  2. package/dist/{WebhookService-BBcCHBo8.d.cts → WebhookService-DgIx21X-.d.cts} +1 -1
  3. package/dist/api-handler-graphql.cjs +1 -1
  4. package/dist/api-handler-graphql.js +2 -1
  5. package/dist/api-handler-trpc.cjs +1 -1
  6. package/dist/api-handler-trpc.js +2 -1
  7. package/dist/api-handler.cjs +1 -1
  8. package/dist/api-handler.js +1 -1
  9. package/dist/{base-yXdYZxFK.d.ts → base-7vJMzr4V.d.ts} +1 -1
  10. package/dist/{base-C2iwjdJQ.d.cts → base-DDEmdRqV.d.cts} +1 -1
  11. package/dist/bcryptjs-AZA6WEN2.js +2 -0
  12. package/dist/bcryptjs-WIQSWJGK.cjs +1 -0
  13. package/dist/better-sqlite3-42Q3FG3E.js +2 -0
  14. package/dist/better-sqlite3-5IISPX34.cjs +1 -0
  15. package/dist/bootstrap-7CI3NVSY.js +1 -0
  16. package/dist/bootstrap-DOOM2CNQ.cjs +1 -0
  17. package/dist/bowser-FI5JQGKZ.js +11 -0
  18. package/dist/bowser-VX6B6ZSE.cjs +10 -0
  19. package/dist/chokidar-24HVS6XD.cjs +5 -0
  20. package/dist/chokidar-43DT7CVN.js +6 -0
  21. package/dist/chunk-227MEHYX.cjs +269 -0
  22. package/dist/chunk-26Q7JXM4.cjs +3 -0
  23. package/dist/chunk-2BUODBE2.js +2 -0
  24. package/dist/chunk-2WFTETFB.js +2 -0
  25. package/dist/chunk-35PGCW3S.cjs +1 -0
  26. package/dist/chunk-3VXEK5ZW.cjs +1 -0
  27. package/dist/chunk-45TJAB5X.js +301 -0
  28. package/dist/chunk-5DWYVUQR.cjs +1 -0
  29. package/dist/chunk-5LPNEYK5.cjs +1 -0
  30. package/dist/chunk-66BJXVFJ.js +2 -0
  31. package/dist/chunk-6KRR7YHA.js +2 -0
  32. package/dist/chunk-6KUL2BSA.cjs +133 -0
  33. package/dist/chunk-6MSS5X77.js +2 -0
  34. package/dist/chunk-6QWLXJ7L.js +2 -0
  35. package/dist/chunk-73D2PNHD.cjs +7 -0
  36. package/dist/chunk-7ACHOBWY.cjs +13 -0
  37. package/dist/chunk-7AQSH3KR.js +2 -0
  38. package/dist/chunk-7GGZA5YU.cjs +2 -0
  39. package/dist/chunk-7I6URA6F.js +4 -0
  40. package/dist/chunk-7JWQ2PZP.cjs +1 -0
  41. package/dist/chunk-7T35572E.js +75 -0
  42. package/dist/chunk-7V67ONUD.js +4 -0
  43. package/dist/chunk-7WMMKGEO.cjs +1 -0
  44. package/dist/chunk-A73AVVFR.js +11 -0
  45. package/dist/chunk-AK754S3T.cjs +2 -0
  46. package/dist/chunk-AMGJ5AFH.cjs +1 -0
  47. package/dist/chunk-ATBH763U.js +2 -0
  48. package/dist/chunk-B3GDQ7UI.cjs +114 -0
  49. package/dist/chunk-BAVN7VDR.cjs +1 -0
  50. package/dist/chunk-BCEE4NBZ.cjs +2 -0
  51. package/dist/{chunk-J4252I5B.cjs → chunk-BHR7OAU4.cjs} +4 -4
  52. package/dist/chunk-BLH2MRK4.js +2 -0
  53. package/dist/chunk-BPMA2ECA.js +10 -0
  54. package/dist/chunk-BUNLC3II.cjs +1 -0
  55. package/dist/chunk-C2PXMVR5.js +2 -0
  56. package/dist/chunk-CAJ4ZJO6.cjs +1 -0
  57. package/dist/chunk-CGPAS4U5.js +4 -0
  58. package/dist/chunk-DS5DE5BU.js +2 -0
  59. package/dist/chunk-DT3LHRQT.js +57 -0
  60. package/dist/chunk-DUO523BH.cjs +1 -0
  61. package/dist/chunk-DVWYO3KK.cjs +1 -0
  62. package/dist/chunk-E27KEZPT.js +2 -0
  63. package/dist/chunk-EHWUALGH.cjs +1 -0
  64. package/dist/chunk-EN65ZEK2.cjs +2 -0
  65. package/dist/chunk-EOOZDOL7.js +3 -0
  66. package/dist/chunk-EZIDQBXI.cjs +1 -0
  67. package/dist/chunk-F4ITQ6XQ.cjs +3 -0
  68. package/dist/chunk-GIS6X43A.cjs +3 -0
  69. package/dist/chunk-GNEVCEJU.cjs +3 -0
  70. package/dist/chunk-GNOSG3PK.cjs +1 -0
  71. package/dist/chunk-HLAEJB5R.js +384 -0
  72. package/dist/chunk-HPYH7GTS.cjs +1 -0
  73. package/dist/chunk-HT44I66C.js +24 -0
  74. package/dist/chunk-HTYVI2HK.cjs +9 -0
  75. package/dist/chunk-ICVQWR2A.js +2 -0
  76. package/dist/chunk-IP6JUEH3.js +3 -0
  77. package/dist/chunk-IPXOY4RI.js +2 -0
  78. package/dist/chunk-IUAWDAUD.cjs +56 -0
  79. package/dist/chunk-J6U5LWZ7.js +11 -0
  80. package/dist/{chunk-UHFDH3PG.js → chunk-JT36FTHY.cjs} +4 -4
  81. package/dist/chunk-JUJZOG6P.js +2 -0
  82. package/dist/{chunk-2BTRHVT3.cjs → chunk-K7YNEKVE.js} +5 -4
  83. package/dist/chunk-KCHPADCH.cjs +7 -0
  84. package/dist/chunk-KH7LM52S.js +3 -0
  85. package/dist/chunk-LEBM6ZSZ.cjs +10 -0
  86. package/dist/chunk-LQ3YZTPU.cjs +15 -0
  87. package/dist/chunk-LY7N3UHH.cjs +23 -0
  88. package/dist/chunk-MCZ3YZ2L.js +2 -0
  89. package/dist/chunk-MP5VC5ER.cjs +1 -0
  90. package/dist/chunk-MVX2PYJJ.cjs +1 -0
  91. package/dist/chunk-MY42EWZP.js +2 -0
  92. package/dist/chunk-MZOWPV4D.js +20 -0
  93. package/dist/chunk-NGNJSUGL.cjs +1 -0
  94. package/dist/chunk-NWCREF47.js +3 -0
  95. package/dist/chunk-OMWQVPV7.js +14 -0
  96. package/dist/chunk-ORG67NXX.js +3 -0
  97. package/dist/chunk-OSAVAYJZ.js +16 -0
  98. package/dist/chunk-P7XYIKL6.cjs +300 -0
  99. package/dist/chunk-PBOZJOKN.js +2 -0
  100. package/dist/chunk-PITMDQYN.cjs +18 -0
  101. package/dist/chunk-PL5AIE6F.js +2 -0
  102. package/dist/chunk-PTWQQMWW.js +270 -0
  103. package/dist/chunk-QC4YXUBT.cjs +383 -0
  104. package/dist/chunk-QDHP5E4P.cjs +2 -0
  105. package/dist/chunk-QVDY6S4B.js +2 -0
  106. package/dist/chunk-QYI3GOHF.cjs +1 -0
  107. package/dist/chunk-R3NEPC4I.js +3 -0
  108. package/dist/chunk-R4LXRAMX.js +2 -0
  109. package/dist/chunk-S5HTTLN7.cjs +2 -0
  110. package/dist/chunk-STX5V7HG.cjs +20 -0
  111. package/dist/chunk-SVYUTQVE.js +115 -0
  112. package/dist/chunk-SYEP5QLG.js +19 -0
  113. package/dist/chunk-TR3ZS3T3.js +3 -0
  114. package/dist/chunk-UB5TJHQR.js +2 -0
  115. package/dist/chunk-UD6ZPO7T.js +2 -0
  116. package/dist/chunk-UNYXWPLZ.cjs +2 -0
  117. package/dist/chunk-VBPAAQEF.js +2 -0
  118. package/dist/chunk-VIUU4D5I.js +2 -0
  119. package/dist/chunk-VJ2WMKPK.js +21 -0
  120. package/dist/chunk-VOQUO2EZ.cjs +74 -0
  121. package/dist/chunk-VQ53TFYA.cjs +1 -0
  122. package/dist/chunk-VRZC4TTF.cjs +1 -0
  123. package/dist/chunk-W46LZ4MY.js +2 -0
  124. package/dist/chunk-WCFHS7EZ.cjs +1 -0
  125. package/dist/chunk-WGESLAWV.js +8 -0
  126. package/dist/chunk-WSP7PSXC.js +8 -0
  127. package/dist/chunk-X54XZACS.cjs +10 -0
  128. package/dist/{chunk-Q2UYCYKV.js → chunk-XBH4YMC7.js} +5 -4
  129. package/dist/chunk-XDE7CFV6.cjs +19 -0
  130. package/dist/chunk-XOACKBG7.js +4 -0
  131. package/dist/chunk-XPPVX4GQ.cjs +1 -0
  132. package/dist/chunk-ZJE3VAAW.js +134 -0
  133. package/dist/chunk-ZO3YB5DK.cjs +1 -0
  134. package/dist/chunk-ZOVH6QT5.cjs +1 -0
  135. package/dist/cli/index.cjs +197 -78
  136. package/dist/cli/index.js +198 -78
  137. package/dist/client.cjs +1 -1
  138. package/dist/client.d.cts +1 -1
  139. package/dist/client.d.ts +1 -1
  140. package/dist/client.js +2 -1
  141. package/dist/d1-5ZQJOFDX.cjs +1 -0
  142. package/dist/d1-VPH75GI2.js +2 -0
  143. package/dist/dist-es-3SSNUZST.cjs +1 -0
  144. package/dist/dist-es-6SVFVYN3.js +1 -0
  145. package/dist/dist-es-6TQTDPE7.js +2 -0
  146. package/dist/dist-es-A5OF2STN.cjs +2 -0
  147. package/dist/dist-es-BOW5V247.cjs +6 -0
  148. package/dist/dist-es-CRIMATLL.cjs +2 -0
  149. package/dist/dist-es-DL3VLVP6.cjs +1 -0
  150. package/dist/dist-es-EMUQ6ZNZ.js +3 -0
  151. package/dist/dist-es-MNIQZC4U.js +2 -0
  152. package/dist/dist-es-P25IKLBI.cjs +1 -0
  153. package/dist/dist-es-SJ76GYCI.js +2 -0
  154. package/dist/dist-es-SRPWSAF4.cjs +1 -0
  155. package/dist/dist-es-T2H2W5BX.cjs +3 -0
  156. package/dist/dist-es-TX4DBXEW.js +3 -0
  157. package/dist/dist-es-U4ZB3ZDA.js +7 -0
  158. package/dist/dist-es-XZBHIIKY.js +4 -0
  159. package/dist/drizzle/index.cjs +1 -1
  160. package/dist/drizzle/index.d.cts +2 -2
  161. package/dist/drizzle/index.d.ts +2 -2
  162. package/dist/drizzle/index.js +1 -1
  163. package/dist/drizzle-orm-47ELDEM6.cjs +1 -0
  164. package/dist/drizzle-orm-7YTX5NTT.js +1 -0
  165. package/dist/event-streams-25YJ2Z6R.js +1 -0
  166. package/dist/event-streams-JBMWCI2O.cjs +1 -0
  167. package/dist/fields/index.cjs +1 -1
  168. package/dist/fields/index.js +1 -1
  169. package/dist/fs-DGKZLRM6.cjs +1 -0
  170. package/dist/fs-YZJ5FM6J.js +2 -0
  171. package/dist/graphql/index.cjs +1 -1
  172. package/dist/graphql/index.d.cts +2 -2
  173. package/dist/graphql/index.d.ts +2 -2
  174. package/dist/graphql/index.js +1 -1
  175. package/dist/{index-DTz6u7w9.d.cts → index-BJ1rwHxk.d.cts} +1 -1
  176. package/dist/{index-BeQtbl3z.d.ts → index-BTjlptCL.d.ts} +1 -1
  177. package/dist/index.cjs +28 -46
  178. package/dist/index.d.cts +23 -9
  179. package/dist/index.d.ts +23 -9
  180. package/dist/index.js +29 -46
  181. package/dist/integration.cjs +1 -1
  182. package/dist/integration.js +1 -1
  183. package/dist/jsonwebtoken-DFB6ZBZA.cjs +8 -0
  184. package/dist/jsonwebtoken-S7BG2YWK.js +9 -0
  185. package/dist/lib-5QYYN6ML.cjs +12 -0
  186. package/dist/lib-IYW32OER.js +13 -0
  187. package/dist/loadSso-JY4WDQPS.cjs +2 -0
  188. package/dist/loadSso-YTG2GQGW.js +3 -0
  189. package/dist/local-VDCSEMC2.js +1 -0
  190. package/dist/local-YCWBUF3R.cjs +1 -0
  191. package/dist/media-3Z6YW5J4.cjs +1 -0
  192. package/dist/media-HK2IZMUZ.js +1 -0
  193. package/dist/mongo-auth-adapter-7K64Y2QM.cjs +1 -0
  194. package/dist/mongo-auth-adapter-BUKINEZL.js +1 -0
  195. package/dist/mongodb/index.cjs +1 -1
  196. package/dist/mongodb/index.d.cts +2 -2
  197. package/dist/mongodb/index.d.ts +2 -2
  198. package/dist/mongodb/index.js +1 -1
  199. package/dist/nodemailer-AXROO37D.js +54 -0
  200. package/dist/nodemailer-IDML4L6W.cjs +53 -0
  201. package/dist/postgres-auth-adapter-2M4RNEY3.cjs +1 -0
  202. package/dist/postgres-auth-adapter-MKSHIJDL.js +1 -0
  203. package/dist/postgres-js-3Y54EXVQ.cjs +1 -0
  204. package/dist/postgres-js-INQPBHJP.js +1 -0
  205. package/dist/redis-adapter-EGMUN65D.cjs +1 -0
  206. package/dist/redis-adapter-SXOXLHNH.js +1 -0
  207. package/dist/rest/index.cjs +1 -1
  208. package/dist/rest/index.d.cts +5 -5
  209. package/dist/rest/index.d.ts +5 -5
  210. package/dist/rest/index.js +1 -1
  211. package/dist/schema-RT6WSUYC.cjs +1 -0
  212. package/dist/schema-XC5ISGNR.js +2 -0
  213. package/dist/signin-KZBIAHGS.js +3 -0
  214. package/dist/signin-VFBLX7EL.cjs +2 -0
  215. package/dist/sqlite-adapter-DV7ZX2EJ.js +1 -0
  216. package/dist/sqlite-adapter-ZTABLT2X.cjs +1 -0
  217. package/dist/src-6LAUXXDM.cjs +1 -0
  218. package/dist/src-GZRZ4VAO.js +1 -0
  219. package/dist/sso-oidc-54BIRYR6.cjs +2 -0
  220. package/dist/sso-oidc-SX5OIQGG.js +3 -0
  221. package/dist/sts-HVGDJYIF.js +3 -0
  222. package/dist/sts-YLXXIB3X.cjs +2 -0
  223. package/dist/templates/index.cjs +1 -1
  224. package/dist/templates/index.d.cts +1 -1
  225. package/dist/templates/index.d.ts +1 -1
  226. package/dist/templates/index.js +1 -1
  227. package/dist/trpc/index.cjs +1 -1
  228. package/dist/trpc/index.d.cts +7 -7
  229. package/dist/trpc/index.d.ts +7 -7
  230. package/dist/trpc/index.js +1 -1
  231. package/dist/{types-CaXXmV9h.d.ts → types-CYGXsNcJ.d.ts} +5 -5
  232. package/dist/{types-BjivdGbU.d.cts → types-DOKMyC3y.d.cts} +5 -5
  233. package/dist/ws/index.cjs +1 -1
  234. package/dist/ws/index.js +1 -1
  235. package/package.json +2 -2
  236. package/dist/bootstrap-ROSTPMVL.js +0 -1
  237. package/dist/bootstrap-WW5NJ6EB.cjs +0 -1
  238. package/dist/chunk-3CVLI5C5.cjs +0 -3
  239. package/dist/chunk-3Q2WUG63.cjs +0 -2
  240. package/dist/chunk-3RSMK4DA.cjs +0 -2
  241. package/dist/chunk-4IGWJMBY.cjs +0 -2
  242. package/dist/chunk-4ORJMSJU.cjs +0 -1
  243. package/dist/chunk-4RMFCTWH.js +0 -1
  244. package/dist/chunk-5B6X2GBJ.js +0 -2
  245. package/dist/chunk-5J6HXUF6.js +0 -1
  246. package/dist/chunk-5KOQYQEE.js +0 -1
  247. package/dist/chunk-5SEHX7ON.js +0 -1
  248. package/dist/chunk-6ROHVUXF.js +0 -1
  249. package/dist/chunk-6SPPR5JZ.js +0 -3
  250. package/dist/chunk-7IVN6TTY.js +0 -133
  251. package/dist/chunk-AHSFSERC.cjs +0 -1
  252. package/dist/chunk-B5XWYVWK.js +0 -1
  253. package/dist/chunk-BGX27ZRG.cjs +0 -300
  254. package/dist/chunk-C2W5PSHC.js +0 -300
  255. package/dist/chunk-CCUQZ66T.cjs +0 -133
  256. package/dist/chunk-D5P2IPGX.cjs +0 -3
  257. package/dist/chunk-EPMGPNBE.js +0 -1
  258. package/dist/chunk-FHJJKFAU.cjs +0 -1
  259. package/dist/chunk-FVZ5RFLO.js +0 -2
  260. package/dist/chunk-FZ6Q2EBJ.cjs +0 -20
  261. package/dist/chunk-G3J2EU5D.cjs +0 -1
  262. package/dist/chunk-G7SSHELM.cjs +0 -1
  263. package/dist/chunk-GKYEJ2UF.js +0 -1
  264. package/dist/chunk-GO34AOBZ.cjs +0 -1
  265. package/dist/chunk-GYQMNXXW.cjs +0 -114
  266. package/dist/chunk-HLSB2MCK.js +0 -1
  267. package/dist/chunk-HQP2Y7QQ.js +0 -251
  268. package/dist/chunk-HS2KNFAB.cjs +0 -2
  269. package/dist/chunk-HVXO3OFB.cjs +0 -1
  270. package/dist/chunk-IETGL7WJ.js +0 -1
  271. package/dist/chunk-IFJ73O3A.cjs +0 -1
  272. package/dist/chunk-ILEZ3NYX.cjs +0 -2
  273. package/dist/chunk-INB4LNA6.js +0 -90
  274. package/dist/chunk-K6WUOU6P.js +0 -1
  275. package/dist/chunk-KD7LUCFY.cjs +0 -1
  276. package/dist/chunk-KDNYHLD2.js +0 -1
  277. package/dist/chunk-LHW4R367.js +0 -1
  278. package/dist/chunk-MIOMMB23.cjs +0 -1
  279. package/dist/chunk-N5VNHUJS.cjs +0 -4
  280. package/dist/chunk-NRLIGDYF.js +0 -1
  281. package/dist/chunk-NY47CFVP.cjs +0 -1
  282. package/dist/chunk-NZJAGASC.cjs +0 -251
  283. package/dist/chunk-OG7CNQGU.js +0 -1
  284. package/dist/chunk-PP5S2UBV.js +0 -0
  285. package/dist/chunk-PP7W5UKL.js +0 -2
  286. package/dist/chunk-Q3Q7BJVQ.cjs +0 -1
  287. package/dist/chunk-QCA3AP3M.cjs +0 -1
  288. package/dist/chunk-QOCHBPMK.js +0 -2
  289. package/dist/chunk-QYFU5Y7S.js +0 -3
  290. package/dist/chunk-RHCWCG3O.js +0 -114
  291. package/dist/chunk-SK2Q4PRV.cjs +0 -90
  292. package/dist/chunk-TFBHE5FF.cjs +0 -1
  293. package/dist/chunk-UBRYJP2G.js +0 -1
  294. package/dist/chunk-V65NPSR5.cjs +0 -1
  295. package/dist/chunk-VGQ4VUG6.js +0 -2
  296. package/dist/chunk-W7C6SJXZ.js +0 -20
  297. package/dist/chunk-WIZ6C5QZ.cjs +0 -1
  298. package/dist/chunk-ZIWJJRWQ.js +0 -4
  299. package/dist/chunk-ZUVP4UK7.cjs +0 -1
  300. package/dist/media-L5XDD47D.js +0 -1
  301. package/dist/media-OUBQTIQP.cjs +0 -1
  302. package/dist/mongo-auth-adapter-5TJO5J5U.js +0 -1
  303. package/dist/mongo-auth-adapter-JVE5M3S4.cjs +0 -1
  304. package/dist/postgres-auth-adapter-33QOIRXT.js +0 -1
  305. package/dist/postgres-auth-adapter-JKDYYULH.cjs +0 -1
  306. package/dist/redis-adapter-NN3H4GRX.js +0 -1
  307. package/dist/redis-adapter-OUKQGYCH.cjs +0 -1
  308. package/dist/schema-HIUSHSUI.cjs +0 -1
  309. package/dist/schema-KFYUM674.js +0 -1
  310. package/dist/sqlite-adapter-GTTVSXRV.cjs +0 -1
  311. package/dist/sqlite-adapter-UPANATIW.js +0 -1
@@ -0,0 +1,2 @@
1
+ 'use strict';var chunkVRZC4TTF_cjs=require('./chunk-VRZC4TTF.cjs'),chunkBUNLC3II_cjs=require('./chunk-BUNLC3II.cjs');chunkBUNLC3II_cjs.h();var x=class{constructor(r){this.table=r;}static[chunkVRZC4TTF_cjs.a]="ColumnAliasProxyHandler";get(r,t){return t==="table"?this.table:r[t]}},A=class{constructor(r,t){this.alias=r,this.replaceOriginalName=t;}static[chunkVRZC4TTF_cjs.a]="TableAliasProxyHandler";get(r,t){if(t===chunkVRZC4TTF_cjs.t.Symbol.IsAlias)return true;if(t===chunkVRZC4TTF_cjs.t.Symbol.Name)return this.alias;if(this.replaceOriginalName&&t===chunkVRZC4TTF_cjs.t.Symbol.OriginalName)return this.alias;if(t===chunkVRZC4TTF_cjs.l)return {...r[chunkVRZC4TTF_cjs.l],name:this.alias,isAlias:true};if(t===chunkVRZC4TTF_cjs.t.Symbol.Columns){let o=r[chunkVRZC4TTF_cjs.t.Symbol.Columns];if(!o)return o;let a={};return Object.keys(o).map(l=>{a[l]=new Proxy(o[l],new x(new Proxy(r,this)));}),a}let i=r[t];return chunkVRZC4TTF_cjs.c(i,chunkVRZC4TTF_cjs.d)?new Proxy(i,new x(new Proxy(r,this))):i}},P=class{constructor(r){this.alias=r;}static[chunkVRZC4TTF_cjs.a]="RelationTableAliasProxyHandler";get(r,t){return t==="sourceTable"?pe(r.sourceTable,this.alias):r[t]}};function pe(e,r){return new Proxy(e,new A(r,false))}function Ke(e,r){return new Proxy(e,new P(r))}function Ne(e,r){return new Proxy(e,new x(new Proxy(e.table,new A(r,false))))}function ge(e,r){return new chunkVRZC4TTF_cjs.A.Aliased(z(e.sql,r),e.fieldAlias)}function z(e,r){return chunkVRZC4TTF_cjs.J.join(e.queryChunks.map(t=>chunkVRZC4TTF_cjs.c(t,chunkVRZC4TTF_cjs.d)?Ne(t,r):chunkVRZC4TTF_cjs.c(t,chunkVRZC4TTF_cjs.A)?z(t,r):chunkVRZC4TTF_cjs.c(t,chunkVRZC4TTF_cjs.A.Aliased)?ge(t,r):t))}chunkBUNLC3II_cjs.h();var H=class{static[chunkVRZC4TTF_cjs.a]="QueryPromise";[Symbol.toStringTag]="QueryPromise";catch(r){return this.then(void 0,r)}finally(r){return this.then(t=>(r?.(),t),t=>{throw r?.(),t})}then(r,t){return this.execute().then(r,t)}};chunkBUNLC3II_cjs.h();var j=class extends Error{static[chunkVRZC4TTF_cjs.a]="DrizzleError";constructor({message:r,cause:t}){super(r),this.name="DrizzleError",this.cause=t;}},M=class e extends Error{constructor(r,t,i){super(`Failed query: ${r}
2
+ params: ${t}`),this.query=r,this.params=t,this.cause=i,Error.captureStackTrace(this,e),i&&(this.cause=i);}},U=class extends j{static[chunkVRZC4TTF_cjs.a]="TransactionRollbackError";constructor(){super({message:"Rollback"});}};chunkBUNLC3II_cjs.h();function m(e,r){return chunkVRZC4TTF_cjs.D(r)&&!chunkVRZC4TTF_cjs.y(e)&&!chunkVRZC4TTF_cjs.c(e,chunkVRZC4TTF_cjs.H)&&!chunkVRZC4TTF_cjs.c(e,chunkVRZC4TTF_cjs.K)&&!chunkVRZC4TTF_cjs.c(e,chunkVRZC4TTF_cjs.d)&&!chunkVRZC4TTF_cjs.c(e,chunkVRZC4TTF_cjs.t)&&!chunkVRZC4TTF_cjs.c(e,chunkVRZC4TTF_cjs.N)?new chunkVRZC4TTF_cjs.H(e,r):e}var W=(e,r)=>chunkVRZC4TTF_cjs.J`${e} = ${m(r,e)}`,G=(e,r)=>chunkVRZC4TTF_cjs.J`${e} <> ${m(r,e)}`;function X(...e){let r=e.filter(t=>t!==void 0);if(r.length!==0)return r.length===1?new chunkVRZC4TTF_cjs.A(r):new chunkVRZC4TTF_cjs.A([new chunkVRZC4TTF_cjs.z("("),chunkVRZC4TTF_cjs.J.join(r,new chunkVRZC4TTF_cjs.z(" and ")),new chunkVRZC4TTF_cjs.z(")")])}function Y(...e){let r=e.filter(t=>t!==void 0);if(r.length!==0)return r.length===1?new chunkVRZC4TTF_cjs.A(r):new chunkVRZC4TTF_cjs.A([new chunkVRZC4TTF_cjs.z("("),chunkVRZC4TTF_cjs.J.join(r,new chunkVRZC4TTF_cjs.z(" or ")),new chunkVRZC4TTF_cjs.z(")")])}function Z(e){return chunkVRZC4TTF_cjs.J`not ${e}`}var _=(e,r)=>chunkVRZC4TTF_cjs.J`${e} > ${m(r,e)}`,v=(e,r)=>chunkVRZC4TTF_cjs.J`${e} >= ${m(r,e)}`,ee=(e,r)=>chunkVRZC4TTF_cjs.J`${e} < ${m(r,e)}`,re=(e,r)=>chunkVRZC4TTF_cjs.J`${e} <= ${m(r,e)}`;function te(e,r){return Array.isArray(r)?r.length===0?chunkVRZC4TTF_cjs.J`false`:chunkVRZC4TTF_cjs.J`${e} in ${r.map(t=>m(t,e))}`:chunkVRZC4TTF_cjs.J`${e} in ${m(r,e)}`}function ne(e,r){return Array.isArray(r)?r.length===0?chunkVRZC4TTF_cjs.J`true`:chunkVRZC4TTF_cjs.J`${e} not in ${r.map(t=>m(t,e))}`:chunkVRZC4TTF_cjs.J`${e} not in ${m(r,e)}`}function ie(e){return chunkVRZC4TTF_cjs.J`${e} is null`}function oe(e){return chunkVRZC4TTF_cjs.J`${e} is not null`}function se(e){return chunkVRZC4TTF_cjs.J`exists ${e}`}function ae(e){return chunkVRZC4TTF_cjs.J`not exists ${e}`}function le(e,r,t){return chunkVRZC4TTF_cjs.J`${e} between ${m(r,e)} and ${m(t,e)}`}function ce(e,r,t){return chunkVRZC4TTF_cjs.J`${e} not between ${m(r,e)} and ${m(t,e)}`}function ue(e,r){return chunkVRZC4TTF_cjs.J`${e} like ${r}`}function fe(e,r){return chunkVRZC4TTF_cjs.J`${e} not like ${r}`}function me(e,r){return chunkVRZC4TTF_cjs.J`${e} ilike ${r}`}function he(e,r){return chunkVRZC4TTF_cjs.J`${e} not ilike ${r}`}function Ve(e,r){if(Array.isArray(r)){if(r.length===0)throw new Error("arrayContains requires at least one value");let t=chunkVRZC4TTF_cjs.J`${m(r,e)}`;return chunkVRZC4TTF_cjs.J`${e} @> ${t}`}return chunkVRZC4TTF_cjs.J`${e} @> ${m(r,e)}`}function ze(e,r){if(Array.isArray(r)){if(r.length===0)throw new Error("arrayContained requires at least one value");let t=chunkVRZC4TTF_cjs.J`${m(r,e)}`;return chunkVRZC4TTF_cjs.J`${e} <@ ${t}`}return chunkVRZC4TTF_cjs.J`${e} <@ ${m(r,e)}`}function He(e,r){if(Array.isArray(r)){if(r.length===0)throw new Error("arrayOverlaps requires at least one value");let t=chunkVRZC4TTF_cjs.J`${m(r,e)}`;return chunkVRZC4TTF_cjs.J`${e} && ${t}`}return chunkVRZC4TTF_cjs.J`${e} && ${m(r,e)}`}chunkBUNLC3II_cjs.h();function ye(e){return chunkVRZC4TTF_cjs.J`${e} asc`}function de(e){return chunkVRZC4TTF_cjs.J`${e} desc`}chunkBUNLC3II_cjs.h();chunkBUNLC3II_cjs.h();var C=class{static[chunkVRZC4TTF_cjs.a]="PgPrimaryKeyBuilder";columns;name;constructor(r,t){this.columns=r,this.name=t;}build(r){return new q(r,this.columns,this.name)}},q=class{constructor(r,t,i){this.table=r,this.columns=t,this.name=i;}static[chunkVRZC4TTF_cjs.a]="PgPrimaryKey";columns;name;getName(){return this.name??`${this.table[chunkVRZC4TTF_cjs.qa.Symbol.Name]}_${this.columns.map(r=>r.name).join("_")}_pk`}};var O=class{constructor(r,t,i){this.sourceTable=r,this.referencedTable=t,this.relationName=i,this.referencedTableName=t[chunkVRZC4TTF_cjs.t.Symbol.Name];}static[chunkVRZC4TTF_cjs.a]="Relation";referencedTableName;fieldName},E=class{constructor(r,t){this.table=r,this.config=t;}static[chunkVRZC4TTF_cjs.a]="Relations"},g=class e extends O{constructor(r,t,i,o){super(r,t,i?.relationName),this.config=i,this.isNullable=o;}static[chunkVRZC4TTF_cjs.a]="One";withFieldName(r){let t=new e(this.sourceTable,this.referencedTable,this.config,this.isNullable);return t.fieldName=r,t}},R=class e extends O{constructor(r,t,i){super(r,t,i?.relationName),this.config=i;}static[chunkVRZC4TTF_cjs.a]="Many";withFieldName(r){let t=new e(this.sourceTable,this.referencedTable,this.config);return t.fieldName=r,t}};function sr(){return {and:X,between:le,eq:W,exists:se,gt:_,gte:v,ilike:me,inArray:te,isNull:ie,isNotNull:oe,like:ue,lt:ee,lte:re,ne:G,not:Z,notBetween:ce,notExists:ae,notLike:fe,notIlike:he,notInArray:ne,or:Y,sql:chunkVRZC4TTF_cjs.J}}function ar(){return {sql:chunkVRZC4TTF_cjs.J,asc:ye,desc:de}}function lr(e,r){Object.keys(e).length===1&&"default"in e&&!chunkVRZC4TTF_cjs.c(e.default,chunkVRZC4TTF_cjs.t)&&(e=e.default);let t={},i={},o={};for(let[a,l]of Object.entries(e))if(chunkVRZC4TTF_cjs.c(l,chunkVRZC4TTF_cjs.t)){let s=chunkVRZC4TTF_cjs.w(l),d=i[s];t[s]=a,o[a]={tsName:a,dbName:l[chunkVRZC4TTF_cjs.t.Symbol.Name],schema:l[chunkVRZC4TTF_cjs.t.Symbol.Schema],columns:l[chunkVRZC4TTF_cjs.t.Symbol.Columns],relations:d?.relations??{},primaryKey:d?.primaryKey??[]};for(let h of Object.values(l[chunkVRZC4TTF_cjs.t.Symbol.Columns]))h.primary&&o[a].primaryKey.push(h);let b=l[chunkVRZC4TTF_cjs.t.Symbol.ExtraConfigBuilder]?.(l[chunkVRZC4TTF_cjs.t.Symbol.ExtraConfigColumns]);if(b)for(let h of Object.values(b))chunkVRZC4TTF_cjs.c(h,C)&&o[a].primaryKey.push(...h.columns);}else if(chunkVRZC4TTF_cjs.c(l,E)){let s=chunkVRZC4TTF_cjs.w(l.table),d=t[s],b=l.config(r(l.table)),h;for(let[S,Q]of Object.entries(b))if(d){let L=o[d];L.relations[S]=Q;}else s in i||(i[s]={relations:{},primaryKey:h}),i[s].relations[S]=Q;}return {tables:o,tableNamesMap:t}}function cr(e,r){return new E(e,t=>Object.fromEntries(Object.entries(r(t)).map(([i,o])=>[i,o.withFieldName(i)])))}function Te(e){return function(t,i){return new g(e,t,i,i?.fields.reduce((o,a)=>o&&a.notNull,true)??false)}}function xe(e){return function(t,i){return new R(e,t,i)}}function ur(e,r,t){if(chunkVRZC4TTF_cjs.c(t,g)&&t.config)return {fields:t.config.fields,references:t.config.references};let i=r[chunkVRZC4TTF_cjs.w(t.referencedTable)];if(!i)throw new Error(`Table "${t.referencedTable[chunkVRZC4TTF_cjs.t.Symbol.Name]}" not found in schema`);let o=e[i];if(!o)throw new Error(`Table "${i}" not found in schema`);let a=t.sourceTable,l=r[chunkVRZC4TTF_cjs.w(a)];if(!l)throw new Error(`Table "${a[chunkVRZC4TTF_cjs.t.Symbol.Name]}" not found in schema`);let s=[];for(let d of Object.values(o.relations))(t.relationName&&t!==d&&d.relationName===t.relationName||!t.relationName&&d.referencedTable===t.sourceTable)&&s.push(d);if(s.length>1)throw t.relationName?new Error(`There are multiple relations with name "${t.relationName}" in table "${i}"`):new Error(`There are multiple relations between "${i}" and "${t.sourceTable[chunkVRZC4TTF_cjs.t.Symbol.Name]}". Please specify relation name`);if(s[0]&&chunkVRZC4TTF_cjs.c(s[0],g)&&s[0].config)return {fields:s[0].config.references,references:s[0].config.fields};throw new Error(`There is not enough information to infer relation "${l}.${t.fieldName}"`)}function fr(e){return {one:Te(e),many:xe(e)}}function be(e,r,t,i,o=a=>a){let a={};for(let[l,s]of i.entries())if(s.isJson){let d=r.relations[s.tsKey],b=t[l],h=typeof b=="string"?JSON.parse(b):b;a[s.tsKey]=chunkVRZC4TTF_cjs.c(d,g)?h&&be(e,e[s.relationTableTsKey],h,s.selection,o):h.map(S=>be(e,e[s.relationTableTsKey],S,s.selection,o));}else {let d=o(t[l]),b=s.field,h;chunkVRZC4TTF_cjs.c(b,chunkVRZC4TTF_cjs.d)?h=b:chunkVRZC4TTF_cjs.c(b,chunkVRZC4TTF_cjs.A)?h=b.decoder:h=b.sql.decoder,a[s.tsKey]=d===null?null:h.mapFromDriverValue(d);}return a}chunkBUNLC3II_cjs.h();var I=class{static[chunkVRZC4TTF_cjs.a]="ConsoleLogWriter";write(r){console.log(r);}},we=class{static[chunkVRZC4TTF_cjs.a]="DefaultLogger";writer;constructor(r){this.writer=r?.writer??new I;}logQuery(r,t){let i=t.map(a=>{try{return JSON.stringify(a)}catch{return String(a)}}),o=i.length?` -- params: [${i.join(", ")}]`:"";this.writer.write(`Query: ${r}${o}`);}},$e=class{static[chunkVRZC4TTF_cjs.a]="NoopLogger";logQuery(){}};exports.$=we;exports.A=se;exports.B=ae;exports.C=le;exports.D=ce;exports.E=ue;exports.F=fe;exports.G=me;exports.H=he;exports.I=Ve;exports.J=ze;exports.K=He;exports.L=ye;exports.M=de;exports.N=O;exports.O=E;exports.P=g;exports.Q=R;exports.R=sr;exports.S=ar;exports.T=lr;exports.U=cr;exports.V=Te;exports.W=xe;exports.X=ur;exports.Y=fr;exports.Z=be;exports._=I;exports.a=x;exports.aa=$e;exports.b=A;exports.c=P;exports.d=pe;exports.e=Ke;exports.f=Ne;exports.g=ge;exports.h=z;exports.i=H;exports.j=j;exports.k=M;exports.l=U;exports.m=m;exports.n=W;exports.o=G;exports.p=X;exports.q=Y;exports.r=Z;exports.s=_;exports.t=v;exports.u=ee;exports.v=re;exports.w=te;exports.x=ne;exports.y=ie;exports.z=oe;
@@ -1,4 +1,4 @@
1
- 'use strict';var E=require('bcryptjs'),crypto=require('crypto'),fs=require('fs'),path=require('path'),module$1=require('module');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var E__default=/*#__PURE__*/_interopDefault(E);var c;function m(){return c||(c=module$1.createRequire("file:///")("node:sqlite").DatabaseSync,c)}var g=5e3,S=1e3,k=-64e3,A=268435456,l=class{db=null;path;saltRounds;externalDb;busyTimeout;walAutoCheckpoint;cacheSize;mmapSize;preparedStatements=new Map;constructor(e={}){this.path=e.path||"./data/auth.db",this.saltRounds=e.saltRounds||12,this.externalDb=!!e.db,this.busyTimeout=e.busyTimeout??g,this.walAutoCheckpoint=e.walAutoCheckpoint??S,this.cacheSize=e.cacheSize??k,this.mmapSize=e.mmapSize??A,e.db&&(this.db=e.db);}async connect(){if(this.db)return;let e=path.dirname(this.path);e&&e!=="."&&fs.mkdirSync(e,{recursive:true}),this.db=new(m())(this.path),this.db.exec(`PRAGMA busy_timeout = ${this.busyTimeout}`),this.db.exec("PRAGMA journal_mode = WAL"),this.db.exec("PRAGMA synchronous = NORMAL"),this.db.exec("PRAGMA cache_size = "+this.cacheSize),this.db.exec("PRAGMA mmap_size = "+this.mmapSize),this.db.exec("PRAGMA wal_autocheckpoint = "+this.walAutoCheckpoint),this.db.exec("PRAGMA foreign_keys = ON"),this.db.exec("PRAGMA temp_store = MEMORY"),this.ensureTables(),this.prepareStatements();}async disconnect(){this.db&&!this.externalDb&&(this.db.exec("PRAGMA wal_checkpoint(TRUNCATE)"),this.db.close(),this.db=null,this.preparedStatements.clear());}async ensureConnected(){if(this.db||await this.connect(),!this.db)throw new Error("Failed to connect to SQLite database");return this.db}ensureTables(){if(this.db){this.db.exec(`
1
+ 'use strict';var chunkHTYVI2HK_cjs=require('./chunk-HTYVI2HK.cjs'),chunkBUNLC3II_cjs=require('./chunk-BUNLC3II.cjs'),crypto=require('crypto'),fs=require('fs'),path=require('path'),module$1=require('module');chunkBUNLC3II_cjs.h();var E=chunkBUNLC3II_cjs.e(chunkHTYVI2HK_cjs.a(),1);var c;function k(){return c||(c=module$1.createRequire("file:///")("node:sqlite").DatabaseSync,c)}var A=5e3,y=1e3,R=-64e3,L=268435456,p=class{db=null;path;saltRounds;externalDb;busyTimeout;walAutoCheckpoint;cacheSize;mmapSize;preparedStatements=new Map;constructor(e={}){this.path=e.path||"./data/auth.db",this.saltRounds=e.saltRounds||12,this.externalDb=!!e.db,this.busyTimeout=e.busyTimeout??A,this.walAutoCheckpoint=e.walAutoCheckpoint??y,this.cacheSize=e.cacheSize??R,this.mmapSize=e.mmapSize??L,e.db&&(this.db=e.db);}async connect(){if(this.db)return;let e=path.dirname(this.path);e&&e!=="."&&fs.mkdirSync(e,{recursive:true}),this.db=new(k())(this.path),this.db.exec(`PRAGMA busy_timeout = ${this.busyTimeout}`),this.db.exec("PRAGMA journal_mode = WAL"),this.db.exec("PRAGMA synchronous = NORMAL"),this.db.exec("PRAGMA cache_size = "+this.cacheSize),this.db.exec("PRAGMA mmap_size = "+this.mmapSize),this.db.exec("PRAGMA wal_autocheckpoint = "+this.walAutoCheckpoint),this.db.exec("PRAGMA foreign_keys = ON"),this.db.exec("PRAGMA temp_store = MEMORY"),this.ensureTables(),this.prepareStatements();}async disconnect(){this.db&&!this.externalDb&&(this.db.exec("PRAGMA wal_checkpoint(TRUNCATE)"),this.db.close(),this.db=null,this.preparedStatements.clear());}async ensureConnected(){if(this.db||await this.connect(),!this.db)throw new Error("Failed to connect to SQLite database");return this.db}ensureTables(){if(this.db){this.db.exec(`
2
2
  CREATE TABLE IF NOT EXISTS kyro_users (
3
3
  id TEXT PRIMARY KEY,
4
4
  name TEXT,
@@ -115,8 +115,8 @@
115
115
  locked_at = excluded.locked_at,
116
116
  locked_until = excluded.locked_until
117
117
  `)),this.preparedStatements.set("resetLockout",this.db.prepare("UPDATE kyro_lockouts SET attempts = 0, locked_at = NULL, locked_until = NULL WHERE user_id = ?")));}stmt(e){let s=this.preparedStatements.get(e);if(!s)throw new Error(`Prepared statement not found: ${e}`);return s}async cleanupExpiredSessions(){return await this.ensureConnected(),this.stmt("deleteExpiredSessions").run(new Date().toISOString()).changes}async cleanupOldAuditLogs(e=30){await this.ensureConnected();let s=new Date(Date.now()-e*24*60*60*1e3).toISOString();return this.stmt("cleanupOldAuditLogs").run(s).changes}async getStats(){await this.ensureConnected();let e=this.stmt("countUsers").get().count,s=this.db.prepare("SELECT COUNT(*) as count FROM kyro_sessions WHERE expires_at > ?").get(new Date().toISOString()).count,t=this.db.prepare("SELECT COUNT(*) as count FROM kyro_audit_logs").get().count;return {userCount:e,activeSessionCount:s,auditLogCount:t}}async createUser(e){await this.ensureConnected();let s=crypto.randomBytes(16).toString("hex"),t=new Date().toISOString(),r=await this.hashPassword(e.password),n={id:s,name:e.name,email:e.email.toLowerCase(),passwordHash:r,role:e.role||"customer",avatar:e.avatar,tenantId:e.tenantId,createdAt:t,updatedAt:t};return this.db.prepare(`INSERT INTO kyro_users (id, name, email, password_hash, role, avatar, tenant_id, created_at, updated_at)
118
- VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)`).run(s,n.name||null,n.email,n.passwordHash,n.role,n.avatar||null,n.tenantId||null,t,t),n}async findUserByEmail(e){await this.ensureConnected();let s=this.stmt("findUserByEmail").get(e.toLowerCase());return s?this.rowToUser(s):null}async findUserById(e){await this.ensureConnected();let s=this.stmt("findUserById").get(e);return s?this.rowToUser(s):null}async updateUser(e,s){if(await this.ensureConnected(),!await this.findUserById(e))return null;let r=[],n=[];return s.email!==void 0&&(r.push("email = ?"),n.push(s.email.toLowerCase())),s.name!==void 0&&(r.push("name = ?"),n.push(s.name)),s.passwordHash!==void 0&&(r.push("password_hash = ?"),n.push(s.passwordHash)),s.role!==void 0&&(r.push("role = ?"),n.push(s.role)),s.avatar!==void 0&&(r.push("avatar = ?"),n.push(s.avatar)),s.tenantId!==void 0&&(r.push("tenant_id = ?"),n.push(s.tenantId)),s.emailVerified!==void 0&&(r.push("email_verified = ?"),n.push(s.emailVerified?1:0)),s.locked!==void 0&&(r.push("locked = ?"),n.push(s.locked?1:0)),s.lastLogin!==void 0&&(r.push("last_login = ?"),n.push(s.lastLogin)),s.failedLoginAttempts!==void 0&&(r.push("failed_login_attempts = ?"),n.push(s.failedLoginAttempts)),r.push("updated_at = ?"),n.push(new Date().toISOString()),n.push(e),this.db.prepare(`UPDATE kyro_users SET ${r.join(", ")} WHERE id = ?`).run(...n),this.findUserById(e)}async deleteUser(e){return await this.ensureConnected(),this.stmt("deleteUser").run(e).changes>0}async hashPassword(e){return E__default.default.hash(e,this.saltRounds)}async verifyPassword(e,s){await this.ensureConnected();let t=await this.findUserByEmail(e);if(!t)return null;let r=this.db.prepare("SELECT password_hash FROM kyro_users WHERE id = ?").get(t.id);return r?.password_hash&&await E__default.default.compare(s,r.password_hash)?t:null}async createSession(e,s={}){await this.ensureConnected();let t=crypto.randomBytes(32).toString("hex"),r=crypto.randomBytes(32).toString("base64url"),n=crypto.randomBytes(32).toString("base64url"),d=new Date,u=new Date(d.getTime()+864e5).toISOString(),i={id:t,userId:e,token:r,refreshToken:n,expiresAt:u,createdAt:d.toISOString(),ipAddress:s.ipAddress,userAgent:s.userAgent};return this.db.prepare(`INSERT INTO kyro_sessions (id, user_id, token, refresh_token, expires_at, created_at, ip_address, user_agent)
119
- VALUES (?, ?, ?, ?, ?, ?, ?, ?)`).run(i.id,i.userId,i.token,i.refreshToken??null,i.expiresAt,i.createdAt,i.ipAddress??null,i.userAgent??null),i}async findSessionByToken(e){await this.ensureConnected();let s=this.stmt("findSessionByToken").get(e);return s?this.rowToSession(s):null}async findSessionByRefreshToken(e){await this.ensureConnected();let s=this.stmt("findSessionByRefreshToken").get(e);return s?this.rowToSession(s):null}async deleteSession(e){return await this.ensureConnected(),this.stmt("deleteSession").run(e,e).changes>0}async deleteUserSessions(e){return await this.ensureConnected(),this.stmt("deleteUserSessions").run(e).changes}async hasAnyUsers(){return await this.ensureConnected(),this.stmt("countUsers").get().count>0}async findUsers(e={}){await this.ensureConnected();let s=e.page??1,t=e.limit??10,r=(s-1)*t,n=e.search,d,u;if(n){let i=`%${n}%`;d=this.stmt("countUsersWithSearch").get(i).count,u=this.stmt("findUsersWithSearch").all(i,t,r);}else d=this.stmt("countUsers").get().count,u=this.stmt("findUsersPaginated").all(t,r);return {users:u.map(i=>this.rowToUser(i)),total:d}}async addPasswordToHistory(e,s){await this.ensureConnected(),this.stmt("addPasswordHistory").run(e,s,new Date().toISOString()),this.stmt("trimPasswordHistory").run(e);}async getPasswordHistory(e,s=5){return await this.ensureConnected(),this.stmt("getPasswordHistory").all(e,s).map(r=>r.password_hash)}async isPasswordInHistory(e,s,t=5){let r=await this.getPasswordHistory(s,t);for(let n of r)if(await E__default.default.compare(e,n))return true;return false}async recordFailedAttempt(e){await this.ensureConnected();let s=Date.now(),t=this.stmt("getLockout").get(e),r=(t?.attempts||0)+1,n=r>=5?s+900*1e3:t?.locked_until||null;this.stmt("upsertLockout").run(e,r,s,n!==null?s:null,n);}async resetAttempts(e){await this.ensureConnected(),this.stmt("resetLockout").run(e);}async checkLockout(e){await this.ensureConnected(),this.stmt("cleanupExpiredLockouts").run(Date.now());let s=this.stmt("getLockout").get(e);return s?s.locked_until!==null&&s.locked_until>Date.now()?{locked:true,attemptsRemaining:0,lockedUntil:new Date(s.locked_until),totalAttempts:s.attempts}:{locked:false,attemptsRemaining:Math.max(0,5-s.attempts),totalAttempts:s.attempts}:{locked:false,attemptsRemaining:5,totalAttempts:0}}async logAudit(e){await this.ensureConnected();let s=crypto.randomBytes(16).toString("hex"),t=new Date().toISOString();return this.db.prepare(`INSERT INTO kyro_audit_logs (
118
+ VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)`).run(s,n.name||null,n.email,n.passwordHash,n.role,n.avatar||null,n.tenantId||null,t,t),n}async findUserByEmail(e){await this.ensureConnected();let s=this.stmt("findUserByEmail").get(e.toLowerCase());return s?this.rowToUser(s):null}async findUserById(e){await this.ensureConnected();let s=this.stmt("findUserById").get(e);return s?this.rowToUser(s):null}async updateUser(e,s){if(await this.ensureConnected(),!await this.findUserById(e))return null;let r=[],n=[];return s.email!==void 0&&(r.push("email = ?"),n.push(s.email.toLowerCase())),s.name!==void 0&&(r.push("name = ?"),n.push(s.name)),s.passwordHash!==void 0&&(r.push("password_hash = ?"),n.push(s.passwordHash)),s.role!==void 0&&(r.push("role = ?"),n.push(s.role)),s.avatar!==void 0&&(r.push("avatar = ?"),n.push(s.avatar)),s.tenantId!==void 0&&(r.push("tenant_id = ?"),n.push(s.tenantId)),s.emailVerified!==void 0&&(r.push("email_verified = ?"),n.push(s.emailVerified?1:0)),s.locked!==void 0&&(r.push("locked = ?"),n.push(s.locked?1:0)),s.lastLogin!==void 0&&(r.push("last_login = ?"),n.push(s.lastLogin)),s.failedLoginAttempts!==void 0&&(r.push("failed_login_attempts = ?"),n.push(s.failedLoginAttempts)),r.push("updated_at = ?"),n.push(new Date().toISOString()),n.push(e),this.db.prepare(`UPDATE kyro_users SET ${r.join(", ")} WHERE id = ?`).run(...n),this.findUserById(e)}async deleteUser(e){return await this.ensureConnected(),this.stmt("deleteUser").run(e).changes>0}async hashPassword(e){return E.default.hash(e,this.saltRounds)}async verifyPassword(e,s){await this.ensureConnected();let t=await this.findUserByEmail(e);if(!t)return null;let r=this.db.prepare("SELECT password_hash FROM kyro_users WHERE id = ?").get(t.id);return r?.password_hash&&await E.default.compare(s,r.password_hash)?t:null}async createSession(e,s={}){await this.ensureConnected();let t=crypto.randomBytes(32).toString("hex"),r=crypto.randomBytes(32).toString("base64url"),n=crypto.randomBytes(32).toString("base64url"),d=new Date,u=new Date(d.getTime()+864e5).toISOString(),i={id:t,userId:e,token:r,refreshToken:n,expiresAt:u,createdAt:d.toISOString(),ipAddress:s.ipAddress,userAgent:s.userAgent};return this.db.prepare(`INSERT INTO kyro_sessions (id, user_id, token, refresh_token, expires_at, created_at, ip_address, user_agent)
119
+ VALUES (?, ?, ?, ?, ?, ?, ?, ?)`).run(i.id,i.userId,i.token,i.refreshToken??null,i.expiresAt,i.createdAt,i.ipAddress??null,i.userAgent??null),i}async findSessionByToken(e){await this.ensureConnected();let s=this.stmt("findSessionByToken").get(e);return s?this.rowToSession(s):null}async findSessionByRefreshToken(e){await this.ensureConnected();let s=this.stmt("findSessionByRefreshToken").get(e);return s?this.rowToSession(s):null}async deleteSession(e){return await this.ensureConnected(),this.stmt("deleteSession").run(e,e).changes>0}async deleteUserSessions(e){return await this.ensureConnected(),this.stmt("deleteUserSessions").run(e).changes}async hasAnyUsers(){return await this.ensureConnected(),this.stmt("countUsers").get().count>0}async findUsers(e={}){await this.ensureConnected();let s=e.page??1,t=e.limit??10,r=(s-1)*t,n=e.search,d,u;if(n){let i=`%${n}%`;d=this.stmt("countUsersWithSearch").get(i).count,u=this.stmt("findUsersWithSearch").all(i,t,r);}else d=this.stmt("countUsers").get().count,u=this.stmt("findUsersPaginated").all(t,r);return {users:u.map(i=>this.rowToUser(i)),total:d}}async addPasswordToHistory(e,s){await this.ensureConnected(),this.stmt("addPasswordHistory").run(e,s,new Date().toISOString()),this.stmt("trimPasswordHistory").run(e);}async getPasswordHistory(e,s=5){return await this.ensureConnected(),this.stmt("getPasswordHistory").all(e,s).map(r=>r.password_hash)}async isPasswordInHistory(e,s,t=5){let r=await this.getPasswordHistory(s,t);for(let n of r)if(await E.default.compare(e,n))return true;return false}async recordFailedAttempt(e){await this.ensureConnected();let s=Date.now(),t=this.stmt("getLockout").get(e),r=(t?.attempts||0)+1,n=r>=5?s+900*1e3:t?.locked_until||null;this.stmt("upsertLockout").run(e,r,s,n!==null?s:null,n);}async resetAttempts(e){await this.ensureConnected(),this.stmt("resetLockout").run(e);}async checkLockout(e){await this.ensureConnected(),this.stmt("cleanupExpiredLockouts").run(Date.now());let s=this.stmt("getLockout").get(e);return s?s.locked_until!==null&&s.locked_until>Date.now()?{locked:true,attemptsRemaining:0,lockedUntil:new Date(s.locked_until),totalAttempts:s.attempts}:{locked:false,attemptsRemaining:Math.max(0,5-s.attempts),totalAttempts:s.attempts}:{locked:false,attemptsRemaining:5,totalAttempts:0}}async logAudit(e){await this.ensureConnected();let s=crypto.randomBytes(16).toString("hex"),t=new Date().toISOString();return this.db.prepare(`INSERT INTO kyro_audit_logs (
120
120
  id, timestamp, action, user_id, user_email, role, resource, resource_id,
121
121
  ip_address, user_agent, success, error, metadata, created_at
122
- ) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`).run(s,t,e.action,e.userId||null,e.userEmail||null,e.role||null,e.resource,e.resourceId||null,e.ipAddress||null,e.userAgent||null,e.success?1:0,e.error||null,e.metadata?JSON.stringify(e.metadata):null,new Date().toISOString()),s}async queryAuditLogs(e={}){await this.ensureConnected();let s=[],t=[];e.action&&(s.push("action = ?"),t.push(e.action)),e.userId&&(s.push("user_id = ?"),t.push(e.userId)),e.resource&&(s.push("resource = ?"),t.push(e.resource)),e.success!==void 0&&(s.push("success = ?"),t.push(e.success?1:0)),e.startDate&&(s.push("timestamp >= ?"),t.push(e.startDate.toISOString())),e.endDate&&(s.push("timestamp <= ?"),t.push(e.endDate.toISOString()));let r=s.length>0?"WHERE "+s.join(" AND "):"",n=e.limit||50,d=e.offset||0,u=this.db.prepare(`SELECT COUNT(*) as count FROM kyro_audit_logs ${r}`).get(...t),i=this.db.prepare(`SELECT * FROM kyro_audit_logs ${r} ORDER BY timestamp DESC LIMIT ? OFFSET ?`).all(...t,n,d);return {total:u.count,logs:i.map(a=>({id:a.id,timestamp:new Date(a.timestamp),action:a.action,userId:a.user_id||void 0,userEmail:a.user_email||void 0,resource:a.resource,resourceId:a.resource_id||void 0,ipAddress:a.ip_address||void 0,userAgent:a.user_agent||void 0,success:a.success===1,error:a.error||void 0,metadata:a.metadata?JSON.parse(a.metadata):void 0}))}}rowToUser(e){return {id:e.id,name:e.name||void 0,email:e.email,passwordHash:e.password_hash,role:e.role,tenantId:e.tenant_id,avatar:e.avatar,emailVerified:e.email_verified===1,locked:e.locked===1,lastLogin:e.last_login,failedLoginAttempts:e.failed_login_attempts||0,createdAt:e.created_at,updatedAt:e.updated_at}}rowToSession(e){return {id:e.id,userId:e.user_id,token:e.token,refreshToken:e.refresh_token,expiresAt:e.expires_at,createdAt:e.created_at,ipAddress:e.ip_address,userAgent:e.user_agent}}async findAuditLogs(e){let s=await this.queryAuditLogs({action:e.action,userId:e.userId,resource:e.resource,success:e.success,startDate:e.startDate,endDate:e.endDate,limit:e.limit,offset:e.offset});return {logs:s.logs.map(t=>({...t,action:t.action})),total:s.total}}async createAuditLog(e){let s=await this.logAudit({action:e.action,userId:e.userId,userEmail:e.userEmail,role:e.role,resource:e.resource,resourceId:e.resourceId,ipAddress:e.ipAddress,userAgent:e.userAgent,success:e.success,error:e.error,metadata:e.metadata}),t=this.db?.prepare("SELECT * FROM kyro_audit_logs WHERE id = ?").get(s);return {...e,id:s,timestamp:t?new Date(t.timestamp):new Date}}async createEmailVerificationToken(e){await this.ensureConnected();let s=crypto.randomBytes(16).toString("hex"),t=crypto.randomBytes(32).toString("hex"),r=new Date(Date.now()+1440*60*1e3);return this.db.prepare("INSERT INTO kyro_email_verifications (id, user_id, token, expires_at, created_at) VALUES (?, ?, ?, ?, ?)").run(s,e,t,r.toISOString(),new Date().toISOString()),{token:t,expiresAt:r}}async verifyEmailToken(e){await this.ensureConnected();let s=this.db.prepare("SELECT * FROM kyro_email_verifications WHERE token = ?").get(e);return s?new Date(s.expires_at)<new Date?{success:false,error:"Verification token has expired"}:(this.db.prepare("UPDATE kyro_users SET email_verified = 1 WHERE id = ?").run(s.user_id),this.db.prepare("DELETE FROM kyro_email_verifications WHERE id = ?").run(s.id),{success:true,userId:s.user_id}):{success:false,error:"Invalid verification token"}}async createPasswordResetToken(e){await this.ensureConnected();let s=await this.findUserByEmail(e);if(!s)return {token:"",expiresAt:new Date,error:"User not found"};let t=crypto.randomBytes(16).toString("hex"),r=crypto.randomBytes(32).toString("hex"),n=new Date(Date.now()+3600*1e3);return this.db.prepare("INSERT INTO kyro_password_resets (id, user_id, token, expires_at, created_at) VALUES (?, ?, ?, ?, ?)").run(t,s.id,r,n.toISOString(),new Date().toISOString()),{token:r,expiresAt:n}}async resetPasswordWithToken(e,s){await this.ensureConnected();let t=this.db.prepare("SELECT * FROM kyro_password_resets WHERE token = ?").get(e);if(!t)return {success:false,error:"Invalid reset token"};if(new Date(t.expires_at)<new Date)return {success:false,error:"Reset token has expired"};if(t.used_at)return {success:false,error:"Reset token has already been used"};let r=await this.hashPassword(s);return this.db.prepare("UPDATE kyro_users SET password_hash = ?, updated_at = ? WHERE id = ?").run(r,new Date().toISOString(),t.user_id),this.db.prepare("UPDATE kyro_password_resets SET used_at = ? WHERE id = ?").run(new Date().toISOString(),t.id),this.db.prepare("DELETE FROM kyro_sessions WHERE user_id = ?").run(t.user_id),{success:true}}};exports.a=l;
122
+ ) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`).run(s,t,e.action,e.userId||null,e.userEmail||null,e.role||null,e.resource,e.resourceId||null,e.ipAddress||null,e.userAgent||null,e.success?1:0,e.error||null,e.metadata?JSON.stringify(e.metadata):null,new Date().toISOString()),s}async queryAuditLogs(e={}){await this.ensureConnected();let s=[],t=[];e.action&&(s.push("action = ?"),t.push(e.action)),e.userId&&(s.push("user_id = ?"),t.push(e.userId)),e.resource&&(s.push("resource = ?"),t.push(e.resource)),e.success!==void 0&&(s.push("success = ?"),t.push(e.success?1:0)),e.startDate&&(s.push("timestamp >= ?"),t.push(e.startDate.toISOString())),e.endDate&&(s.push("timestamp <= ?"),t.push(e.endDate.toISOString()));let r=s.length>0?"WHERE "+s.join(" AND "):"",n=e.limit||50,d=e.offset||0,u=this.db.prepare(`SELECT COUNT(*) as count FROM kyro_audit_logs ${r}`).get(...t),i=this.db.prepare(`SELECT * FROM kyro_audit_logs ${r} ORDER BY timestamp DESC LIMIT ? OFFSET ?`).all(...t,n,d);return {total:u.count,logs:i.map(a=>({id:a.id,timestamp:new Date(a.timestamp),action:a.action,userId:a.user_id||void 0,userEmail:a.user_email||void 0,resource:a.resource,resourceId:a.resource_id||void 0,ipAddress:a.ip_address||void 0,userAgent:a.user_agent||void 0,success:a.success===1,error:a.error||void 0,metadata:a.metadata?JSON.parse(a.metadata):void 0}))}}rowToUser(e){return {id:e.id,name:e.name||void 0,email:e.email,passwordHash:e.password_hash,role:e.role,tenantId:e.tenant_id,avatar:e.avatar,emailVerified:e.email_verified===1,locked:e.locked===1,lastLogin:e.last_login,failedLoginAttempts:e.failed_login_attempts||0,createdAt:e.created_at,updatedAt:e.updated_at}}rowToSession(e){return {id:e.id,userId:e.user_id,token:e.token,refreshToken:e.refresh_token,expiresAt:e.expires_at,createdAt:e.created_at,ipAddress:e.ip_address,userAgent:e.user_agent}}async findAuditLogs(e){let s=await this.queryAuditLogs({action:e.action,userId:e.userId,resource:e.resource,success:e.success,startDate:e.startDate,endDate:e.endDate,limit:e.limit,offset:e.offset});return {logs:s.logs.map(t=>({...t,action:t.action})),total:s.total}}async createAuditLog(e){let s=await this.logAudit({action:e.action,userId:e.userId,userEmail:e.userEmail,role:e.role,resource:e.resource,resourceId:e.resourceId,ipAddress:e.ipAddress,userAgent:e.userAgent,success:e.success,error:e.error,metadata:e.metadata}),t=this.db?.prepare("SELECT * FROM kyro_audit_logs WHERE id = ?").get(s);return {...e,id:s,timestamp:t?new Date(t.timestamp):new Date}}async createEmailVerificationToken(e){await this.ensureConnected();let s=crypto.randomBytes(16).toString("hex"),t=crypto.randomBytes(32).toString("hex"),r=new Date(Date.now()+1440*60*1e3);return this.db.prepare("INSERT INTO kyro_email_verifications (id, user_id, token, expires_at, created_at) VALUES (?, ?, ?, ?, ?)").run(s,e,t,r.toISOString(),new Date().toISOString()),{token:t,expiresAt:r}}async verifyEmailToken(e){await this.ensureConnected();let s=this.db.prepare("SELECT * FROM kyro_email_verifications WHERE token = ?").get(e);return s?new Date(s.expires_at)<new Date?{success:false,error:"Verification token has expired"}:(this.db.prepare("UPDATE kyro_users SET email_verified = 1 WHERE id = ?").run(s.user_id),this.db.prepare("DELETE FROM kyro_email_verifications WHERE id = ?").run(s.id),{success:true,userId:s.user_id}):{success:false,error:"Invalid verification token"}}async createPasswordResetToken(e){await this.ensureConnected();let s=await this.findUserByEmail(e);if(!s)return {token:"",expiresAt:new Date,error:"User not found"};let t=crypto.randomBytes(16).toString("hex"),r=crypto.randomBytes(32).toString("hex"),n=new Date(Date.now()+3600*1e3);return this.db.prepare("INSERT INTO kyro_password_resets (id, user_id, token, expires_at, created_at) VALUES (?, ?, ?, ?, ?)").run(t,s.id,r,n.toISOString(),new Date().toISOString()),{token:r,expiresAt:n}}async resetPasswordWithToken(e,s){await this.ensureConnected();let t=this.db.prepare("SELECT * FROM kyro_password_resets WHERE token = ?").get(e);if(!t)return {success:false,error:"Invalid reset token"};if(new Date(t.expires_at)<new Date)return {success:false,error:"Reset token has expired"};if(t.used_at)return {success:false,error:"Reset token has already been used"};let r=await this.hashPassword(s);return this.db.prepare("UPDATE kyro_users SET password_hash = ?, updated_at = ? WHERE id = ?").run(r,new Date().toISOString(),t.user_id),this.db.prepare("UPDATE kyro_password_resets SET used_at = ? WHERE id = ?").run(new Date().toISOString(),t.id),this.db.prepare("DELETE FROM kyro_sessions WHERE user_id = ?").run(t.user_id),{success:true}}};exports.a=p;
@@ -0,0 +1,2 @@
1
+ import {createRequire}from'module';import {g}from'./chunk-C2PXMVR5.js';createRequire(import.meta.url);
2
+ g();function o(e){if(e==null)return e;if(Array.isArray(e))return e.map(n=>o(n));if(typeof e=="object"&&!(e instanceof Date)&&!(e instanceof RegExp)){let n={};for(let r of Object.keys(e))/^\d+$/.test(r)||(n[r]=o(e[r]));return n}return e}export{o as a};
@@ -0,0 +1,10 @@
1
+ import {createRequire}from'module';import {c,g,a}from'./chunk-C2PXMVR5.js';createRequire(import.meta.url);
2
+ var q=c((X,g$1)=>{g();(function(i,y){typeof define=="function"&&define.amd?define([],y):typeof a=="function"&&typeof g$1=="object"&&g$1&&g$1.exports?g$1.exports=y():(i.dcodeIO=i.dcodeIO||{}).bcrypt=y();})(X,function(){var i={},y=null;function O(c){if(typeof g$1<"u"&&g$1&&g$1.exports)try{return a("crypto").randomBytes(c)}catch{}try{var a$1;return (self.crypto||self.msCrypto).getRandomValues(a$1=new Uint32Array(c)),Array.prototype.slice.call(a$1)}catch{}if(!y)throw Error("Neither WebCryptoAPI nor a crypto module is available. Use bcrypt.setRandomFallback to set an alternative");return y(c)}var H=false;try{O(1),H=!0;}catch{}y=null,i.setRandomFallback=function(c){y=c;},i.genSaltSync=function(c,a){if(c=c||C,typeof c!="number")throw Error("Illegal arguments: "+typeof c+", "+typeof a);c<4?c=4:c>31&&(c=31);var f=[];return f.push("$2a$"),c<10&&f.push("0"),f.push(c.toString()),f.push("$"),f.push(T(O(w),w)),f.join("")},i.genSalt=function(c,a,f){if(typeof a=="function"&&(f=a,a=void 0),typeof c=="function"&&(f=c,c=void 0),typeof c>"u")c=C;else if(typeof c!="number")throw Error("illegal arguments: "+typeof c);function e(x){p(function(){try{x(null,i.genSaltSync(c));}catch(d){x(d);}});}if(f){if(typeof f!="function")throw Error("Illegal callback: "+typeof f);e(f);}else return new Promise(function(x,d){e(function(b,r){if(b){d(b);return}x(r);});})},i.hashSync=function(c,a){if(typeof a>"u"&&(a=C),typeof a=="number"&&(a=i.genSaltSync(a)),typeof c!="string"||typeof a!="string")throw Error("Illegal arguments: "+typeof c+", "+typeof a);return _(c,a)},i.hash=function(c,a,f,e){function x(d){typeof c=="string"&&typeof a=="number"?i.genSalt(a,function(b,r){_(c,r,d,e);}):typeof c=="string"&&typeof a=="string"?_(c,a,d,e):p(d.bind(this,Error("Illegal arguments: "+typeof c+", "+typeof a)));}if(f){if(typeof f!="function")throw Error("Illegal callback: "+typeof f);x(f);}else return new Promise(function(d,b){x(function(r,n){if(r){b(r);return}d(n);});})};function R(c,a){for(var f=0,e=0,x=0,d=c.length;x<d;++x)c.charCodeAt(x)===a.charCodeAt(x)?++f:++e;return f<0?false:e===0}i.compareSync=function(c,a){if(typeof c!="string"||typeof a!="string")throw Error("Illegal arguments: "+typeof c+", "+typeof a);return a.length!==60?false:R(i.hashSync(c,a.substr(0,a.length-31)),a)},i.compare=function(c,a,f,e){function x(d){if(typeof c!="string"||typeof a!="string"){p(d.bind(this,Error("Illegal arguments: "+typeof c+", "+typeof a)));return}if(a.length!==60){p(d.bind(this,null,false));return}i.hash(c,a.substr(0,29),function(b,r){b?d(b):d(null,R(r,a));},e);}if(f){if(typeof f!="function")throw Error("Illegal callback: "+typeof f);x(f);}else return new Promise(function(d,b){x(function(r,n){if(r){b(r);return}d(n);});})},i.getRounds=function(c){if(typeof c!="string")throw Error("Illegal arguments: "+typeof c);return parseInt(c.split("$")[2],10)},i.getSalt=function(c){if(typeof c!="string")throw Error("Illegal arguments: "+typeof c);if(c.length!==60)throw Error("Illegal hash length: "+c.length+" != 60");return c.substring(0,29)};var p=typeof process<"u"&&process&&typeof process.nextTick=="function"?typeof setImmediate=="function"?setImmediate:process.nextTick:setTimeout;function V(c){var a=[],f=0;return Y.encodeUTF16toUTF8(function(){return f>=c.length?null:c.charCodeAt(f++)},function(e){a.push(e);}),a}var F="./ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789".split(""),s=[-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,1,54,55,56,57,58,59,60,61,62,63,-1,-1,-1,-1,-1,-1,-1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,-1,-1,-1,-1,-1,-1,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,-1,-1,-1,-1,-1],A=String.fromCharCode;function T(c,a){var f=0,e=[],x,d;if(a<=0||a>c.length)throw Error("Illegal len: "+a);for(;f<a;){if(x=c[f++]&255,e.push(F[x>>2&63]),x=(x&3)<<4,f>=a){e.push(F[x&63]);break}if(d=c[f++]&255,x|=d>>4&15,e.push(F[x&63]),x=(d&15)<<2,f>=a){e.push(F[x&63]);break}d=c[f++]&255,x|=d>>6&3,e.push(F[x&63]),e.push(F[d&63]);}return e.join("")}function N(c,a){var f=0,e=c.length,x=0,d=[],b,r,n,t,o,u;if(a<=0)throw Error("Illegal len: "+a);for(;f<e-1&&x<a&&(u=c.charCodeAt(f++),b=u<s.length?s[u]:-1,u=c.charCodeAt(f++),r=u<s.length?s[u]:-1,!(b==-1||r==-1||(o=b<<2>>>0,o|=(r&48)>>4,d.push(A(o)),++x>=a||f>=e)||(u=c.charCodeAt(f++),n=u<s.length?s[u]:-1,n==-1)||(o=(r&15)<<4>>>0,o|=(n&60)>>2,d.push(A(o)),++x>=a||f>=e)));)u=c.charCodeAt(f++),t=u<s.length?s[u]:-1,o=(n&3)<<6>>>0,o|=t,d.push(A(o)),++x;var h=[];for(f=0;f<x;f++)h.push(d[f].charCodeAt(0));return h}var Y=(function(){var c={};return c.MAX_CODEPOINT=1114111,c.encodeUTF8=function(a,f){var e=null;for(typeof a=="number"&&(e=a,a=function(){return null});e!==null||(e=a())!==null;)e<128?f(e&127):e<2048?(f(e>>6&31|192),f(e&63|128)):e<65536?(f(e>>12&15|224),f(e>>6&63|128),f(e&63|128)):(f(e>>18&7|240),f(e>>12&63|128),f(e>>6&63|128),f(e&63|128)),e=null;},c.decodeUTF8=function(a,f){for(var e,x,d,b,r=function(n){n=n.slice(0,n.indexOf(null));var t=Error(n.toString());throw t.name="TruncatedError",t.bytes=n,t};(e=a())!==null;)if((e&128)===0)f(e);else if((e&224)===192)(x=a())===null&&r([e,x]),f((e&31)<<6|x&63);else if((e&240)===224)((x=a())===null||(d=a())===null)&&r([e,x,d]),f((e&15)<<12|(x&63)<<6|d&63);else if((e&248)===240)((x=a())===null||(d=a())===null||(b=a())===null)&&r([e,x,d,b]),f((e&7)<<18|(x&63)<<12|(d&63)<<6|b&63);else throw RangeError("Illegal starting byte: "+e)},c.UTF16toUTF8=function(a,f){for(var e,x=null;(e=x!==null?x:a())!==null;){if(e>=55296&&e<=57343&&(x=a())!==null&&x>=56320&&x<=57343){f((e-55296)*1024+x-56320+65536),x=null;continue}f(e);}x!==null&&f(x);},c.UTF8toUTF16=function(a,f){var e=null;for(typeof a=="number"&&(e=a,a=function(){return null});e!==null||(e=a())!==null;)e<=65535?f(e):(e-=65536,f((e>>10)+55296),f(e%1024+56320)),e=null;},c.encodeUTF16toUTF8=function(a,f){c.UTF16toUTF8(a,function(e){c.encodeUTF8(e,f);});},c.decodeUTF8toUTF16=function(a,f){c.decodeUTF8(a,function(e){c.UTF8toUTF16(e,f);});},c.calculateCodePoint=function(a){return a<128?1:a<2048?2:a<65536?3:4},c.calculateUTF8=function(a){for(var f,e=0;(f=a())!==null;)e+=c.calculateCodePoint(f);return e},c.calculateUTF16asUTF8=function(a){var f=0,e=0;return c.UTF16toUTF8(a,function(x){++f,e+=c.calculateCodePoint(x);}),[f,e]},c})();Date.now=Date.now||function(){return +new Date};var w=16,C=10,z=16,J=100,$=[608135816,2242054355,320440878,57701188,2752067618,698298832,137296536,3964562569,1160258022,953160567,3193202383,887688300,3232508343,3380367581,1065670069,3041331479,2450970073,2306472731],B=[3509652390,2564797868,805139163,3491422135,3101798381,1780907670,3128725573,4046225305,614570311,3012652279,134345442,2240740374,1667834072,1901547113,2757295779,4103290238,227898511,1921955416,1904987480,2182433518,2069144605,3260701109,2620446009,720527379,3318853667,677414384,3393288472,3101374703,2390351024,1614419982,1822297739,2954791486,3608508353,3174124327,2024746970,1432378464,3864339955,2857741204,1464375394,1676153920,1439316330,715854006,3033291828,289532110,2706671279,2087905683,3018724369,1668267050,732546397,1947742710,3462151702,2609353502,2950085171,1814351708,2050118529,680887927,999245976,1800124847,3300911131,1713906067,1641548236,4213287313,1216130144,1575780402,4018429277,3917837745,3693486850,3949271944,596196993,3549867205,258830323,2213823033,772490370,2760122372,1774776394,2652871518,566650946,4142492826,1728879713,2882767088,1783734482,3629395816,2517608232,2874225571,1861159788,326777828,3124490320,2130389656,2716951837,967770486,1724537150,2185432712,2364442137,1164943284,2105845187,998989502,3765401048,2244026483,1075463327,1455516326,1322494562,910128902,469688178,1117454909,936433444,3490320968,3675253459,1240580251,122909385,2157517691,634681816,4142456567,3825094682,3061402683,2540495037,79693498,3249098678,1084186820,1583128258,426386531,1761308591,1047286709,322548459,995290223,1845252383,2603652396,3431023940,2942221577,3202600964,3727903485,1712269319,422464435,3234572375,1170764815,3523960633,3117677531,1434042557,442511882,3600875718,1076654713,1738483198,4213154764,2393238008,3677496056,1014306527,4251020053,793779912,2902807211,842905082,4246964064,1395751752,1040244610,2656851899,3396308128,445077038,3742853595,3577915638,679411651,2892444358,2354009459,1767581616,3150600392,3791627101,3102740896,284835224,4246832056,1258075500,768725851,2589189241,3069724005,3532540348,1274779536,3789419226,2764799539,1660621633,3471099624,4011903706,913787905,3497959166,737222580,2514213453,2928710040,3937242737,1804850592,3499020752,2949064160,2386320175,2390070455,2415321851,4061277028,2290661394,2416832540,1336762016,1754252060,3520065937,3014181293,791618072,3188594551,3933548030,2332172193,3852520463,3043980520,413987798,3465142937,3030929376,4245938359,2093235073,3534596313,375366246,2157278981,2479649556,555357303,3870105701,2008414854,3344188149,4221384143,3956125452,2067696032,3594591187,2921233993,2428461,544322398,577241275,1471733935,610547355,4027169054,1432588573,1507829418,2025931657,3646575487,545086370,48609733,2200306550,1653985193,298326376,1316178497,3007786442,2064951626,458293330,2589141269,3591329599,3164325604,727753846,2179363840,146436021,1461446943,4069977195,705550613,3059967265,3887724982,4281599278,3313849956,1404054877,2845806497,146425753,1854211946,1266315497,3048417604,3681880366,3289982499,290971e4,1235738493,2632868024,2414719590,3970600049,1771706367,1449415276,3266420449,422970021,1963543593,2690192192,3826793022,1062508698,1531092325,1804592342,2583117782,2714934279,4024971509,1294809318,4028980673,1289560198,2221992742,1669523910,35572830,157838143,1052438473,1016535060,1802137761,1753167236,1386275462,3080475397,2857371447,1040679964,2145300060,2390574316,1461121720,2956646967,4031777805,4028374788,33600511,2920084762,1018524850,629373528,3691585981,3515945977,2091462646,2486323059,586499841,988145025,935516892,3367335476,2599673255,2839830854,265290510,3972581182,2759138881,3795373465,1005194799,847297441,406762289,1314163512,1332590856,1866599683,4127851711,750260880,613907577,1450815602,3165620655,3734664991,3650291728,3012275730,3704569646,1427272223,778793252,1343938022,2676280711,2052605720,1946737175,3164576444,3914038668,3967478842,3682934266,1661551462,3294938066,4011595847,840292616,3712170807,616741398,312560963,711312465,1351876610,322626781,1910503582,271666773,2175563734,1594956187,70604529,3617834859,1007753275,1495573769,4069517037,2549218298,2663038764,504708206,2263041392,3941167025,2249088522,1514023603,1998579484,1312622330,694541497,2582060303,2151582166,1382467621,776784248,2618340202,3323268794,2497899128,2784771155,503983604,4076293799,907881277,423175695,432175456,1378068232,4145222326,3954048622,3938656102,3820766613,2793130115,2977904593,26017576,3274890735,3194772133,1700274565,1756076034,4006520079,3677328699,720338349,1533947780,354530856,688349552,3973924725,1637815568,332179504,3949051286,53804574,2852348879,3044236432,1282449977,3583942155,3416972820,4006381244,1617046695,2628476075,3002303598,1686838959,431878346,2686675385,1700445008,1080580658,1009431731,832498133,3223435511,2605976345,2271191193,2516031870,1648197032,4164389018,2548247927,300782431,375919233,238389289,3353747414,2531188641,2019080857,1475708069,455242339,2609103871,448939670,3451063019,1395535956,2413381860,1841049896,1491858159,885456874,4264095073,4001119347,1565136089,3898914787,1108368660,540939232,1173283510,2745871338,3681308437,4207628240,3343053890,4016749493,1699691293,1103962373,3625875870,2256883143,3830138730,1031889488,3479347698,1535977030,4236805024,3251091107,2132092099,1774941330,1199868427,1452454533,157007616,2904115357,342012276,595725824,1480756522,206960106,497939518,591360097,863170706,2375253569,3596610801,1814182875,2094937945,3421402208,1082520231,3463918190,2785509508,435703966,3908032597,1641649973,2842273706,3305899714,1510255612,2148256476,2655287854,3276092548,4258621189,236887753,3681803219,274041037,1734335097,3815195456,3317970021,1899903192,1026095262,4050517792,356393447,2410691914,3873677099,3682840055,3913112168,2491498743,4132185628,2489919796,1091903735,1979897079,3170134830,3567386728,3557303409,857797738,1136121015,1342202287,507115054,2535736646,337727348,3213592640,1301675037,2528481711,1895095763,1721773893,3216771564,62756741,2142006736,835421444,2531993523,1442658625,3659876326,2882144922,676362277,1392781812,170690266,3921047035,1759253602,3611846912,1745797284,664899054,1329594018,3901205900,3045908486,2062866102,2865634940,3543621612,3464012697,1080764994,553557557,3656615353,3996768171,991055499,499776247,1265440854,648242737,3940784050,980351604,3713745714,1749149687,3396870395,4211799374,3640570775,1161844396,3125318951,1431517754,545492359,4268468663,3499529547,1437099964,2702547544,3433638243,2581715763,2787789398,1060185593,1593081372,2418618748,4260947970,69676912,2159744348,86519011,2512459080,3838209314,1220612927,3339683548,133810670,1090789135,1078426020,1569222167,845107691,3583754449,4072456591,1091646820,628848692,1613405280,3757631651,526609435,236106946,48312990,2942717905,3402727701,1797494240,859738849,992217954,4005476642,2243076622,3870952857,3732016268,765654824,3490871365,2511836413,1685915746,3888969200,1414112111,2273134842,3281911079,4080962846,172450625,2569994100,980381355,4109958455,2819808352,2716589560,2568741196,3681446669,3329971472,1835478071,660984891,3704678404,4045999559,3422617507,3040415634,1762651403,1719377915,3470491036,2693910283,3642056355,3138596744,1364962596,2073328063,1983633131,926494387,3423689081,2150032023,4096667949,1749200295,3328846651,309677260,2016342300,1779581495,3079819751,111262694,1274766160,443224088,298511866,1025883608,3806446537,1145181785,168956806,3641502830,3584813610,1689216846,3666258015,3200248200,1692713982,2646376535,4042768518,1618508792,1610833997,3523052358,4130873264,2001055236,3610705100,2202168115,4028541809,2961195399,1006657119,2006996926,3186142756,1430667929,3210227297,1314452623,4074634658,4101304120,2273951170,1399257539,3367210612,3027628629,1190975929,2062231137,2333990788,2221543033,2438960610,1181637006,548689776,2362791313,3372408396,3104550113,3145860560,296247880,1970579870,3078560182,3769228297,1714227617,3291629107,3898220290,166772364,1251581989,493813264,448347421,195405023,2709975567,677966185,3703036547,1463355134,2715995803,1338867538,1343315457,2802222074,2684532164,233230375,2599980071,2000651841,3277868038,1638401717,4028070440,3237316320,6314154,819756386,300326615,590932579,1405279636,3267499572,3150704214,2428286686,3959192993,3461946742,1862657033,1266418056,963775037,2089974820,2263052895,1917689273,448879540,3550394620,3981727096,150775221,3627908307,1303187396,508620638,2975983352,2726630617,1817252668,1876281319,1457606340,908771278,3720792119,3617206836,2455994898,1729034894,1080033504,976866871,3556439503,2881648439,1522871579,1555064734,1336096578,3548522304,2579274686,3574697629,3205460757,3593280638,3338716283,3079412587,564236357,2993598910,1781952180,1464380207,3163844217,3332601554,1699332808,1393555694,1183702653,3581086237,1288719814,691649499,2847557200,2895455976,3193889540,2717570544,1781354906,1676643554,2592534050,3230253752,1126444790,2770207658,2633158820,2210423226,2615765581,2414155088,3127139286,673620729,2805611233,1269405062,4015350505,3341807571,4149409754,1057255273,2012875353,2162469141,2276492801,2601117357,993977747,3918593370,2654263191,753973209,36408145,2530585658,25011837,3520020182,2088578344,530523599,2918365339,1524020338,1518925132,3760827505,3759777254,1202760957,3985898139,3906192525,674977740,4174734889,2031300136,2019492241,3983892565,4153806404,3822280332,352677332,2297720250,60907813,90501309,3286998549,1016092578,2535922412,2839152426,457141659,509813237,4120667899,652014361,1966332200,2975202805,55981186,2327461051,676427537,3255491064,2882294119,3433927263,1307055953,942726286,933058658,2468411793,3933900994,4215176142,1361170020,2001714738,2830558078,3274259782,1222529897,1679025792,2729314320,3714953764,1770335741,151462246,3013232138,1682292957,1483529935,471910574,1539241949,458788160,3436315007,1807016891,3718408830,978976581,1043663428,3165965781,1927990952,4200891579,2372276910,3208408903,3533431907,1412390302,2931980059,4132332400,1947078029,3881505623,4168226417,2941484381,1077988104,1320477388,886195818,18198404,3786409e3,2509781533,112762804,3463356488,1866414978,891333506,18488651,661792760,1628790961,3885187036,3141171499,876946877,2693282273,1372485963,791857591,2686433993,3759982718,3167212022,3472953795,2716379847,445679433,3561995674,3504004811,3574258232,54117162,3331405415,2381918588,3769707343,4154350007,1140177722,4074052095,668550556,3214352940,367459370,261225585,2610173221,4209349473,3468074219,3265815641,314222801,3066103646,3808782860,282218597,3406013506,3773591054,379116347,1285071038,846784868,2669647154,3771962079,3550491691,2305946142,453669953,1268987020,3317592352,3279303384,3744833421,2610507566,3859509063,266596637,3847019092,517658769,3462560207,3443424879,370717030,4247526661,2224018117,4143653529,4112773975,2788324899,2477274417,1456262402,2901442914,1517677493,1846949527,2295493580,3734397586,2176403920,1280348187,1908823572,3871786941,846861322,1172426758,3287448474,3383383037,1655181056,3139813346,901632758,1897031941,2986607138,3066810236,3447102507,1393639104,373351379,950779232,625454576,3124240540,4148612726,2007998917,544563296,2244738638,2330496472,2058025392,1291430526,424198748,50039436,29584100,3605783033,2429876329,2791104160,1057563949,3255363231,3075367218,3463963227,1469046755,985887462],L=[1332899944,1700884034,1701343084,1684370003,1668446532,1869963892];function E(c,a,f,e){var x,d=c[a],b=c[a+1];return d^=f[0],x=e[d>>>24],x+=e[256|d>>16&255],x^=e[512|d>>8&255],x+=e[768|d&255],b^=x^f[1],x=e[b>>>24],x+=e[256|b>>16&255],x^=e[512|b>>8&255],x+=e[768|b&255],d^=x^f[2],x=e[d>>>24],x+=e[256|d>>16&255],x^=e[512|d>>8&255],x+=e[768|d&255],b^=x^f[3],x=e[b>>>24],x+=e[256|b>>16&255],x^=e[512|b>>8&255],x+=e[768|b&255],d^=x^f[4],x=e[d>>>24],x+=e[256|d>>16&255],x^=e[512|d>>8&255],x+=e[768|d&255],b^=x^f[5],x=e[b>>>24],x+=e[256|b>>16&255],x^=e[512|b>>8&255],x+=e[768|b&255],d^=x^f[6],x=e[d>>>24],x+=e[256|d>>16&255],x^=e[512|d>>8&255],x+=e[768|d&255],b^=x^f[7],x=e[b>>>24],x+=e[256|b>>16&255],x^=e[512|b>>8&255],x+=e[768|b&255],d^=x^f[8],x=e[d>>>24],x+=e[256|d>>16&255],x^=e[512|d>>8&255],x+=e[768|d&255],b^=x^f[9],x=e[b>>>24],x+=e[256|b>>16&255],x^=e[512|b>>8&255],x+=e[768|b&255],d^=x^f[10],x=e[d>>>24],x+=e[256|d>>16&255],x^=e[512|d>>8&255],x+=e[768|d&255],b^=x^f[11],x=e[b>>>24],x+=e[256|b>>16&255],x^=e[512|b>>8&255],x+=e[768|b&255],d^=x^f[12],x=e[d>>>24],x+=e[256|d>>16&255],x^=e[512|d>>8&255],x+=e[768|d&255],b^=x^f[13],x=e[b>>>24],x+=e[256|b>>16&255],x^=e[512|b>>8&255],x+=e[768|b&255],d^=x^f[14],x=e[d>>>24],x+=e[256|d>>16&255],x^=e[512|d>>8&255],x+=e[768|d&255],b^=x^f[15],x=e[b>>>24],x+=e[256|b>>16&255],x^=e[512|b>>8&255],x+=e[768|b&255],d^=x^f[16],c[a]=b^f[z+1],c[a+1]=d,c}function v(c,a){for(var f=0,e=0;f<4;++f)e=e<<8|c[a]&255,a=(a+1)%c.length;return {key:e,offp:a}}function j(c,a,f){for(var e=0,x=[0,0],d=a.length,b=f.length,r,n=0;n<d;n++)r=v(c,e),e=r.offp,a[n]=a[n]^r.key;for(n=0;n<d;n+=2)x=E(x,0,a,f),a[n]=x[0],a[n+1]=x[1];for(n=0;n<b;n+=2)x=E(x,0,a,f),f[n]=x[0],f[n+1]=x[1];}function K(c,a,f,e){for(var x=0,d=[0,0],b=f.length,r=e.length,n,t=0;t<b;t++)n=v(a,x),x=n.offp,f[t]=f[t]^n.key;for(x=0,t=0;t<b;t+=2)n=v(c,x),x=n.offp,d[0]^=n.key,n=v(c,x),x=n.offp,d[1]^=n.key,d=E(d,0,f,e),f[t]=d[0],f[t+1]=d[1];for(t=0;t<r;t+=2)n=v(c,x),x=n.offp,d[0]^=n.key,n=v(c,x),x=n.offp,d[1]^=n.key,d=E(d,0,f,e),e[t]=d[0],e[t+1]=d[1];}function G(c,a,f,e,x){var d=L.slice(),b=d.length,r;if(f<4||f>31)if(r=Error("Illegal number of rounds (4-31): "+f),e){p(e.bind(this,r));return}else throw r;if(a.length!==w)if(r=Error("Illegal salt length: "+a.length+" != "+w),e){p(e.bind(this,r));return}else throw r;f=1<<f>>>0;var n,t,o=0,u;Int32Array?(n=new Int32Array($),t=new Int32Array(B)):(n=$.slice(),t=B.slice()),K(a,c,n,t);function h(){if(x&&x(o/f),o<f)for(var m=Date.now();o<f&&(o=o+1,j(c,n,t),j(a,n,t),!(Date.now()-m>J)););else {for(o=0;o<64;o++)for(u=0;u<b>>1;u++)E(d,u<<1,n,t);var l=[];for(o=0;o<b;o++)l.push((d[o]>>24&255)>>>0),l.push((d[o]>>16&255)>>>0),l.push((d[o]>>8&255)>>>0),l.push((d[o]&255)>>>0);if(e){e(null,l);return}else return l}e&&p(h);}if(typeof e<"u")h();else for(var I;;)if(typeof(I=h())<"u")return I||[]}function _(c,a,f,e){var x;if(typeof c!="string"||typeof a!="string")if(x=Error("Invalid string / salt: Not a string"),f){p(f.bind(this,x));return}else throw x;var d,b;if(a.charAt(0)!=="$"||a.charAt(1)!=="2")if(x=Error("Invalid salt version: "+a.substring(0,2)),f){p(f.bind(this,x));return}else throw x;if(a.charAt(2)==="$")d="\0",b=3;else {if(d=a.charAt(2),d!=="a"&&d!=="b"&&d!=="y"||a.charAt(3)!=="$")if(x=Error("Invalid salt revision: "+a.substring(2,4)),f){p(f.bind(this,x));return}else throw x;b=4;}if(a.charAt(b+2)>"$")if(x=Error("Missing salt rounds"),f){p(f.bind(this,x));return}else throw x;var r=parseInt(a.substring(b,b+1),10)*10,n=parseInt(a.substring(b+1,b+2),10),t=r+n,o=a.substring(b+3,b+25);c+=d>="a"?"\0":"";var u=V(c),h=N(o,w);function I(m){var l=[];return l.push("$2"),d>="a"&&l.push(d),l.push("$"),t<10&&l.push("0"),l.push(t.toString()),l.push("$"),l.push(T(h,h.length)),l.push(T(m,L.length*4-1)),l.join("")}if(typeof f>"u")return I(G(u,h,t));G(u,h,t,function(m,l){m?f(m,null):f(null,I(l));},e);}return i.encodeBase64=T,i.decodeBase64=N,i});});var k=c((x0,W)=>{g();W.exports=q();});/*! Bundled license information:
3
+
4
+ bcryptjs/dist/bcrypt.js:
5
+ (**
6
+ * @license bcrypt.js (c) 2013 Daniel Wirtz <dcode@dcode.io>
7
+ * Released under the Apache License, Version 2.0
8
+ * see: https://github.com/dcodeIO/bcrypt.js for details
9
+ *)
10
+ */export{k as a};
@@ -0,0 +1 @@
1
+ 'use strict';var p=Object.create;var c=Object.defineProperty;var u=Object.getOwnPropertyDescriptor;var a=Object.getOwnPropertyNames;var i=Object.getPrototypeOf,d=Object.prototype.hasOwnProperty;var l=(e=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(e,{get:(t,r)=>(typeof require<"u"?require:t)[r]}):e)(function(e){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+e+'" is not supported')});var f=(e,t)=>()=>(e&&(t=e(e=0)),t);var R=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),S=(e,t)=>{for(var r in t)c(e,r,{get:t[r],enumerable:true});},m=(e,t,r,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of a(t))!d.call(e,n)&&n!==r&&c(e,n,{get:()=>t[n],enumerable:!(o=u(t,n))||o.enumerable});return e};var I=(e,t,r)=>(r=e!=null?p(i(e)):{},m(t||!e||!e.__esModule?c(r,"default",{value:e,enumerable:true}):r,e)),g=e=>m(c({},"__esModule",{value:true}),e);var s;exports.g=void 0;var U=f(()=>{s=()=>typeof document>"u"?new URL(`file:${__filename}`).href:document.currentScript&&document.currentScript.tagName.toUpperCase()==="SCRIPT"?document.currentScript.src:new URL("main.js",document.baseURI).href,exports.g=s();});exports.a=l;exports.b=f;exports.c=R;exports.d=S;exports.e=I;exports.f=g;exports.h=U;
@@ -0,0 +1,2 @@
1
+ import {createRequire}from'module';import'path';import'url';var require$1 = createRequire(import.meta.url);
2
+ var a=Object.create;var r=Object.defineProperty;var p=Object.getOwnPropertyDescriptor;var c=Object.getOwnPropertyNames;var f=Object.getPrototypeOf,l=Object.prototype.hasOwnProperty;var d=(t=>typeof require$1<"u"?require$1:typeof Proxy<"u"?new Proxy(t,{get:(e,o)=>(typeof require$1<"u"?require$1:e)[o]}):t)(function(t){if(typeof require$1<"u")return require$1.apply(this,arguments);throw Error('Dynamic require of "'+t+'" is not supported')});var s=(t,e)=>()=>(t&&(e=t(t=0)),e);var g=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),h=(t,e)=>{for(var o in e)r(t,o,{get:e[o],enumerable:true});},n=(t,e,o,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let m of c(e))!l.call(t,m)&&m!==o&&r(t,m,{get:()=>e[m],enumerable:!(i=p(e,m))||i.enumerable});return t};var x=(t,e,o)=>(o=t!=null?a(f(t)):{},n(e||!t||!t.__esModule?r(o,"default",{value:t,enumerable:true}):o,t)),u=t=>n(r({},"__esModule",{value:true}),t);var _=s(()=>{});export{d as a,s as b,g as c,h as d,x as e,u as f,_ as g};
@@ -0,0 +1 @@
1
+ 'use strict';var chunkIUAWDAUD_cjs=require('./chunk-IUAWDAUD.cjs'),chunkQYI3GOHF_cjs=require('./chunk-QYI3GOHF.cjs'),chunk227MEHYX_cjs=require('./chunk-227MEHYX.cjs'),chunkBHR7OAU4_cjs=require('./chunk-BHR7OAU4.cjs'),chunk6KUL2BSA_cjs=require('./chunk-6KUL2BSA.cjs'),chunkB3GDQ7UI_cjs=require('./chunk-B3GDQ7UI.cjs'),chunk5DWYVUQR_cjs=require('./chunk-5DWYVUQR.cjs'),chunkBUNLC3II_cjs=require('./chunk-BUNLC3II.cjs'),w=require('kyro:config');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var w__default=/*#__PURE__*/_interopDefault(w);chunkBUNLC3II_cjs.h();exports.a=null;var l=null;async function b(){if(!exports.a){if(globalThis.__KYRO_INSTANCE__)try{await globalThis.__KYRO_INSTANCE__.shutdown();}catch{}try{let e=w__default.default.default||w__default.default,t=e.adapter,o=t&&!t.dialect&&typeof t.connect=="function";if(globalThis.DB&&(!t||o)){let s=globalThis.DB;e.adapter=new chunk6KUL2BSA_cjs.c({type:"sqlite",client:s}),chunkIUAWDAUD_cjs.C.info("Hot-swapped to D1 DrizzleAdapter");}exports.a=chunkIUAWDAUD_cjs.A(e);let a=e.adapter,p=a&&a.dialect&&(a.dialect==="postgres"||a.dialect==="sqlite"),c=a&&a.dialect==="mongodb",n;if(p)a.dialect==="postgres"?n=new chunkB3GDQ7UI_cjs.a({db:a.client}):a.dialect==="sqlite"&&(n=new chunk227MEHYX_cjs.nb({db:a.rawClient||a.client}));else if(o&&!globalThis.DB){let s=process.env.KYRO_AUTH_DB_PATH||"./data/auth.db";n=new chunkBHR7OAU4_cjs.a({path:s});}else c&&(n=new chunk5DWYVUQR_cjs.a({db:a.client}));if(n?.connect)try{await n.connect();}catch(s){chunkIUAWDAUD_cjs.C.warn("Auth connect warning:",s);}await exports.a.init();try{await exports.a.loadSettings();}catch(s){chunkIUAWDAUD_cjs.C.warn("loadSettings warning:",s);}try{await chunkQYI3GOHF_cjs.e(n);}catch(s){chunkIUAWDAUD_cjs.C.warn("autoBootstrap warning:",s);}globalThis.__KYRO_INSTANCE__=exports.a;}catch(e){throw exports.a=null,l=null,chunkIUAWDAUD_cjs.C.error("Init failed, will retry:",e),e}}}async function E(e){let t=globalThis.DB?globalThis:null;try{let{env:o}=await import('cloudflare:workers');o&&(t=o);}catch{}if(e)try{t=e.locals?.cfContext?.env||e?.env||t;}catch{}if(!t)try{t=process.env;}catch{}t?.DB&&(globalThis.DB=t.DB),t?.STORAGE_BUCKET&&(globalThis.STORAGE_BUCKET=t.STORAGE_BUCKET),l||(l=b()),await l;}var _={graphqlEnabled:false,trpcEnabled:false,wsEnabled:false,requireAuth:false};function T(e){return exports.a?exports.a.settings?.access?.apiAccess?.[e]??_[e]??true:_[e]??true}var q=async e=>{if(!exports.a)try{await Promise.race([E(e),new Promise((t,o)=>setTimeout(()=>o(new Error("Initialization timeout")),3e4))]);}catch(t){return console.error("[Kyro API] Warm error:",t?.stack||t?.message||t),new Response(JSON.stringify({error:"Service Unavailable",message:"Kyro CMS is still starting up. Please try again in a moment."}),{status:503,headers:{"Content-Type":"application/json","Retry-After":"5"}})}try{let o=new URL(e.request.url).pathname,a=__KYRO_API_PATH__;if(o===`${a}/graphql`&&typeof exports.a.getGraphQL=="function"){if(!T("graphqlEnabled"))return new Response(JSON.stringify({error:"GraphQL is disabled"}),{status:503,headers:{"Content-Type":"application/json"}});let n=await exports.a.getGraphQL().fetch(e.request,e.locals);return new Response(n.body,n)}if(o.startsWith(`${a}/trpc/`)&&typeof exports.a.getTRPC=="function"){if(!T("trpcEnabled"))return new Response(JSON.stringify({error:"tRPC is disabled"}),{status:503,headers:{"Content-Type":"application/json"}});let n=await exports.a.getTRPC().fetch(e.request,e.locals);return new Response(n.body,n)}return await(await exports.a.getREST()).fetch(e.request,e.locals)}catch(t){return console.error("[Kyro API Execution Error]:",t?.stack||t?.message||t),new Response(JSON.stringify({error:"Internal Server Error",message:t?.message||String(t),stack:t?.stack}),{status:500,headers:{"Content-Type":"application/json"}})}};exports.b=E;exports.c=q;
@@ -0,0 +1,4 @@
1
+ import {createRequire}from'module';import {g}from'./chunk-C2PXMVR5.js';import {execSync}from'child_process';import {existsSync}from'fs';import {join}from'path';createRequire(import.meta.url);
2
+ g();function s(){let n=process.cwd();return existsSync(join(n,"pnpm-lock.yaml"))?"pnpm":existsSync(join(n,"yarn.lock"))?"yarn":existsSync(join(n,"bun.lockb"))||existsSync(join(n,"bun.lock"))?"bun":"npm"}function d(n){let o=s();console.log(`
3
+ \u{1F4E6} [Kyro CMS] Auto-installing missing database drivers: ${n.join(", ")}...`);try{let i=o==="npm"?"npm install":`${o} add`;execSync(`${i} ${n.join(" ")}`,{stdio:"inherit"}),console.log(`\u2705 [Kyro CMS] Successfully installed drivers!
4
+ `);}catch(i){throw console.error(`\u274C [Kyro CMS] Failed to auto-install drivers. Please run manually: ${o==="npm"?"npm install":`${o} add`} ${n.join(" ")}`),i}}export{d as a};
@@ -0,0 +1,2 @@
1
+ import {createRequire}from'module';import {l,k}from'./chunk-45TJAB5X.js';import {a}from'./chunk-XBH4YMC7.js';import {g as g$1}from'./chunk-C2PXMVR5.js';createRequire(import.meta.url);
2
+ g$1();async function g(t){let{adminEmail:e,adminPassword:r,adminRole:a$1="super_admin",tenantId:n,emailConfig:o,sendWelcomeEmail:c=false}=t,s=t.authAdapter||new a({path:t.authDbPath||"./data/auth.db"});try{await s.connect?.();}catch{return {success:false,error:"Failed to connect to auth storage"}}let u=new l().validate(r);if(!u.valid)return await s.disconnect?.(),{success:false,error:`Invalid password: ${u.errors.join(", ")}`};if(await s.findUserByEmail(e))return await s.disconnect?.(),{success:false,error:"Admin user already exists"};try{let i=await s.createUser({name:"Super Admin",email:e,password:r,role:a$1||"admin",tenantId:n});if(await s.updateUser?.(i.id,{emailVerified:!0}),c&&o){let l=new k(o),A=l.getTemplates().welcome(e.split("@")[0]);await l.send({to:e,...A});}return await s.disconnect?.(),{success:!0,user:i}}catch(i){return await s.disconnect?.(),{success:false,error:i instanceof Error?i.message:"Failed to create admin user"}}}async function M(t,e){return !await t.findUserByEmail(e)}function w(t){let e=t.KYRO_ADMIN_EMAIL,r=t.KYRO_ADMIN_PASSWORD;return !e||!r?null:{authDbPath:t.KYRO_AUTH_DB_PATH||"./data/auth.db",adminEmail:e,adminPassword:r,adminRole:t.KYRO_ADMIN_ROLE||"super_admin",tenantId:t.KYRO_ADMIN_TENANT_ID,emailConfig:t.SMTP_HOST?{provider:"smtp",smtp:{host:t.SMTP_HOST,port:parseInt(t.SMTP_PORT||"587",10),secure:t.SMTP_SECURE==="true",auth:{user:t.SMTP_USER||"",pass:t.SMTP_PASS||""}},from:t.SMTP_FROM||"noreply@example.com",fromName:t.SMTP_FROM_NAME}:void 0,sendWelcomeEmail:t.KYRO_ADMIN_SEND_WELCOME==="true"}}function h(){return w(process.env)}async function E(){try{let{env:t}=await import('cloudflare:workers');if(t){let e=w(t);if(e)return e}}catch{}return null}async function x(t){let e=h()||await E();if(!e)return null;t&&(e.authAdapter=t);try{if(await e.authAdapter?.connect?.(),await e.authAdapter?.findUserByEmail(e.adminEmail))return await e.authAdapter?.disconnect?.(),{success:!1,error:"Admin user already exists"}}catch{}let r=await g(e);return r.success||console.error(`Bootstrap failed: ${r.error}`),r}async function C(t,e=3,r=2e3){let a="";for(let n=0;n<e;n++){let o=await g(t);if(o.success||(a=o.error||"Unknown error",a.includes("already exists")))return o;n<e-1&&await new Promise(c=>setTimeout(c,r));}return {success:false,error:`Failed after ${e} retries: ${a}`}}export{g as a,M as b,w as c,h as d,x as e,C as f};