@kyro-cms/core 0.13.5 → 0.13.6

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 (319) hide show
  1. package/dist/api-handler-graphql.cjs +1 -1
  2. package/dist/api-handler-graphql.js +2 -2
  3. package/dist/api-handler-trpc.cjs +1 -1
  4. package/dist/api-handler-trpc.js +2 -2
  5. package/dist/api-handler.cjs +1 -1
  6. package/dist/api-handler.js +1 -1
  7. package/dist/auth-session-4WJUKESW.js +1 -0
  8. package/dist/auth-session-VHUHDBCL.cjs +1 -0
  9. package/dist/bootstrap-JYAUQ52D.cjs +1 -0
  10. package/dist/bootstrap-TTMLNQM3.js +1 -0
  11. package/dist/chunk-23RSKVJP.cjs +1 -0
  12. package/dist/chunk-24W5I6SJ.cjs +2 -0
  13. package/dist/{chunk-CH4TZZI5.js → chunk-2I2AXTKY.cjs} +38 -39
  14. package/dist/chunk-34LCWI5X.cjs +1 -0
  15. package/dist/chunk-3A5UO6OQ.cjs +114 -0
  16. package/dist/chunk-3N34WXBS.js +2 -0
  17. package/dist/chunk-5BUAWCU6.js +91 -0
  18. package/dist/{chunk-7NKNSRCB.cjs → chunk-5I3BM5TV.js} +33 -32
  19. package/dist/chunk-5RBGM5N5.js +3 -0
  20. package/dist/chunk-7EY3GXRA.js +2 -0
  21. package/dist/chunk-7KTPBTH5.cjs +1 -0
  22. package/dist/chunk-A4XM33WO.js +109 -0
  23. package/dist/chunk-A7763NCF.cjs +19 -0
  24. package/dist/chunk-AQWTJGML.cjs +1 -0
  25. package/dist/chunk-CIWLQXB2.js +2 -0
  26. package/dist/chunk-DCFOVCJX.cjs +1 -0
  27. package/dist/chunk-DCKJT247.cjs +1 -0
  28. package/dist/chunk-EG4SRTYS.cjs +2 -0
  29. package/dist/chunk-FAG2645P.js +2 -0
  30. package/dist/chunk-FIVTKI25.cjs +3 -0
  31. package/dist/chunk-FU76HURF.cjs +1 -0
  32. package/dist/chunk-GDLMPZKD.cjs +2 -0
  33. package/dist/chunk-GS4CMYKS.cjs +1 -0
  34. package/dist/chunk-GTAKGVUY.js +2 -0
  35. package/dist/chunk-GWUHIIPO.cjs +132 -0
  36. package/dist/chunk-H2IJDTA2.cjs +1 -0
  37. package/dist/chunk-HACW42ZZ.cjs +108 -0
  38. package/dist/chunk-HCM2G674.cjs +20 -0
  39. package/dist/chunk-I22MSXGL.js +2 -0
  40. package/dist/chunk-IIPSXKNV.js +115 -0
  41. package/dist/{chunk-WNU76M2C.js → chunk-IIVBEZC2.js} +6 -6
  42. package/dist/chunk-JHFD3IAU.cjs +1 -0
  43. package/dist/chunk-JJY2F6NL.cjs +3 -0
  44. package/dist/chunk-JQ4V2MGJ.cjs +2 -0
  45. package/dist/chunk-JXJTFBHG.js +3 -0
  46. package/dist/chunk-KOSR7235.cjs +1 -0
  47. package/dist/chunk-KUY4QDAL.js +2 -0
  48. package/dist/chunk-LGUHXOEW.js +3 -0
  49. package/dist/chunk-LXTVMP5F.cjs +6 -0
  50. package/dist/chunk-N25DOGLQ.js +5 -0
  51. package/dist/chunk-N2BMGZIX.cjs +90 -0
  52. package/dist/chunk-N7CDHWQH.cjs +2 -0
  53. package/dist/chunk-NBBAMC2X.cjs +1 -0
  54. package/dist/chunk-NGNXOXI5.js +2 -0
  55. package/dist/chunk-O4PPZOVI.cjs +1 -0
  56. package/dist/chunk-O4RKZQYQ.js +2 -0
  57. package/dist/chunk-OJBL4CXK.cjs +2 -0
  58. package/dist/chunk-OPKZYQV7.js +3 -0
  59. package/dist/chunk-OXEJCIOA.cjs +1 -0
  60. package/dist/chunk-OXH6CANN.js +2 -0
  61. package/dist/{chunk-EQN3HDES.cjs → chunk-PW6Y5MQL.cjs} +5 -5
  62. package/dist/chunk-RLW6AQF2.js +2 -0
  63. package/dist/chunk-SBFVITY2.js +7 -0
  64. package/dist/chunk-SEJ7LMYY.js +4 -0
  65. package/dist/chunk-SZY25KAE.js +21 -0
  66. package/dist/chunk-TG5YQ4PB.cjs +4 -0
  67. package/dist/chunk-TJ6N5ZPZ.js +133 -0
  68. package/dist/chunk-V2RMDMWN.js +2 -0
  69. package/dist/chunk-V4SR7DU5.js +3 -0
  70. package/dist/chunk-VLFM66BZ.js +4 -0
  71. package/dist/chunk-VPBGZW4P.cjs +1 -0
  72. package/dist/chunk-VQWOCGJ2.cjs +1 -0
  73. package/dist/chunk-VWXHW74B.js +3 -0
  74. package/dist/chunk-W5GDZG64.js +2 -0
  75. package/dist/chunk-WLSVS3NC.js +2 -0
  76. package/dist/chunk-YLP3EKTQ.js +2 -0
  77. package/dist/chunk-YNSKDTFG.js +2 -0
  78. package/dist/chunk-YOJOVQIH.cjs +1 -0
  79. package/dist/chunk-ZE2X3FBU.js +20 -0
  80. package/dist/chunk-ZMH35QYG.js +2 -0
  81. package/dist/cli/index.cjs +53 -182
  82. package/dist/cli/index.js +54 -183
  83. package/dist/drizzle/index.cjs +1 -1
  84. package/dist/drizzle/index.js +1 -1
  85. package/dist/fields/index.cjs +1 -1
  86. package/dist/fields/index.js +1 -1
  87. package/dist/graphql/index.cjs +1 -1
  88. package/dist/graphql/index.js +1 -1
  89. package/dist/index.cjs +30 -30
  90. package/dist/index.js +31 -31
  91. package/dist/integration.cjs +1 -1
  92. package/dist/integration.js +1 -1
  93. package/dist/local-DKP43BWQ.cjs +1 -0
  94. package/dist/local-TF5ZMHWW.js +1 -0
  95. package/dist/media-M3EIZ4QS.cjs +1 -0
  96. package/dist/media-WYEILC6K.js +1 -0
  97. package/dist/mongo-auth-adapter-33M5ENM7.cjs +1 -0
  98. package/dist/mongo-auth-adapter-4ITULS2P.js +1 -0
  99. package/dist/mongodb/index.cjs +1 -1
  100. package/dist/mongodb/index.js +1 -1
  101. package/dist/nodemailer-transport-7F3VLLBW.js +1 -0
  102. package/dist/nodemailer-transport-WAPZD3SJ.cjs +1 -0
  103. package/dist/postgres-auth-adapter-7BCPXNBO.js +1 -0
  104. package/dist/postgres-auth-adapter-HMXFUM5W.cjs +1 -0
  105. package/dist/redis-adapter-2E5AWMMA.cjs +1 -0
  106. package/dist/redis-adapter-GFH74CF4.js +1 -0
  107. package/dist/rest/index.cjs +1 -1
  108. package/dist/rest/index.js +1 -1
  109. package/dist/schema-FNIDQKIJ.cjs +1 -0
  110. package/dist/schema-KD736QFN.js +1 -0
  111. package/dist/sqlite-adapter-HL53RLSN.cjs +1 -0
  112. package/dist/sqlite-adapter-TT6ZASDG.js +1 -0
  113. package/dist/templates/index.cjs +1 -1
  114. package/dist/templates/index.js +1 -1
  115. package/dist/trpc/index.cjs +1 -1
  116. package/dist/trpc/index.js +1 -1
  117. package/dist/ws/index.cjs +1 -1
  118. package/dist/ws/index.js +1 -1
  119. package/package.json +2 -10
  120. package/dist/WebhookService-CGxHtw7E.d.cts +0 -143
  121. package/dist/WebhookService-CNC1lYz7.d.ts +0 -143
  122. package/dist/auth-session-DHVGXHOH.cjs +0 -1
  123. package/dist/auth-session-O7IIH7EP.js +0 -1
  124. package/dist/base-A9AJPCG5.d.ts +0 -219
  125. package/dist/base-C6wyX2nC.d.cts +0 -219
  126. package/dist/bcryptjs-WIQSWJGK.cjs +0 -1
  127. package/dist/bcryptjs-ZEEHSMAG.js +0 -2
  128. package/dist/better-sqlite3-5IISPX34.cjs +0 -1
  129. package/dist/better-sqlite3-B34RIU4C.js +0 -2
  130. package/dist/bootstrap-PG2LGDLB.js +0 -1
  131. package/dist/bootstrap-YD3GLTWX.cjs +0 -1
  132. package/dist/bowser-SB3ZUPO4.js +0 -11
  133. package/dist/bowser-VX6B6ZSE.cjs +0 -10
  134. package/dist/chokidar-5RVQZVHP.cjs +0 -5
  135. package/dist/chokidar-BOYGRT4Q.js +0 -6
  136. package/dist/chunk-262YP5XA.cjs +0 -1
  137. package/dist/chunk-2HA6EKXX.js +0 -24
  138. package/dist/chunk-2SPWRQ5O.js +0 -122
  139. package/dist/chunk-2TYITUOC.js +0 -122
  140. package/dist/chunk-35PGCW3S.cjs +0 -1
  141. package/dist/chunk-3CIMGC2F.cjs +0 -56
  142. package/dist/chunk-3KZXF4US.js +0 -2
  143. package/dist/chunk-3NSZZCOJ.js +0 -2
  144. package/dist/chunk-3TAUNYEM.js +0 -8
  145. package/dist/chunk-3VXEK5ZW.cjs +0 -1
  146. package/dist/chunk-47CXBWMA.js +0 -2
  147. package/dist/chunk-4BMWWGJN.js +0 -384
  148. package/dist/chunk-4NTIK6DF.cjs +0 -2
  149. package/dist/chunk-6E44MQQ5.js +0 -115
  150. package/dist/chunk-6LWF5MPL.js +0 -20
  151. package/dist/chunk-6NBZDW53.js +0 -133
  152. package/dist/chunk-6TPICJ2L.js +0 -7
  153. package/dist/chunk-6YS6XLOD.cjs +0 -121
  154. package/dist/chunk-73D2PNHD.cjs +0 -7
  155. package/dist/chunk-7ACHOBWY.cjs +0 -13
  156. package/dist/chunk-7GGZA5YU.cjs +0 -2
  157. package/dist/chunk-7JWQ2PZP.cjs +0 -1
  158. package/dist/chunk-7KLEANTO.cjs +0 -1
  159. package/dist/chunk-7MNDQU6K.js +0 -8
  160. package/dist/chunk-7NH7H3WA.js +0 -10
  161. package/dist/chunk-7WMMKGEO.cjs +0 -1
  162. package/dist/chunk-ALTU3FDG.js +0 -2
  163. package/dist/chunk-BAVN7VDR.cjs +0 -1
  164. package/dist/chunk-BCEE4NBZ.cjs +0 -2
  165. package/dist/chunk-BUNLC3II.cjs +0 -1
  166. package/dist/chunk-C7QCZX7X.js +0 -2
  167. package/dist/chunk-D6SDGHY6.js +0 -2
  168. package/dist/chunk-DVWYO3KK.cjs +0 -1
  169. package/dist/chunk-EHWUALGH.cjs +0 -1
  170. package/dist/chunk-EML5FDUU.js +0 -2
  171. package/dist/chunk-EN65ZEK2.cjs +0 -2
  172. package/dist/chunk-EW424IBO.cjs +0 -1
  173. package/dist/chunk-EZIDQBXI.cjs +0 -1
  174. package/dist/chunk-F2O4QO5N.cjs +0 -383
  175. package/dist/chunk-F4ITQ6XQ.cjs +0 -3
  176. package/dist/chunk-FK2BG4HU.js +0 -3
  177. package/dist/chunk-FLMUMPDE.js +0 -2
  178. package/dist/chunk-GIS6X43A.cjs +0 -3
  179. package/dist/chunk-GNEVCEJU.cjs +0 -3
  180. package/dist/chunk-GNOSG3PK.cjs +0 -1
  181. package/dist/chunk-GQGFNTDZ.js +0 -2
  182. package/dist/chunk-GTR7JAKP.cjs +0 -3
  183. package/dist/chunk-HPIJI7TM.js +0 -3
  184. package/dist/chunk-HPYH7GTS.cjs +0 -1
  185. package/dist/chunk-HRAY65XH.js +0 -3
  186. package/dist/chunk-HTYVI2HK.cjs +0 -9
  187. package/dist/chunk-IKGVPXMK.js +0 -3
  188. package/dist/chunk-J6V573PE.cjs +0 -1
  189. package/dist/chunk-JA44K75G.js +0 -2
  190. package/dist/chunk-JRUQ5ABB.js +0 -4
  191. package/dist/chunk-JV4HJBXW.js +0 -14
  192. package/dist/chunk-KEITOXIP.js +0 -2
  193. package/dist/chunk-KMFLHGD5.cjs +0 -1
  194. package/dist/chunk-KZHXYXSH.cjs +0 -10
  195. package/dist/chunk-L3Q64RUX.js +0 -3
  196. package/dist/chunk-LEBM6ZSZ.cjs +0 -10
  197. package/dist/chunk-LKRI5X2V.cjs +0 -1
  198. package/dist/chunk-LQ3YZTPU.cjs +0 -15
  199. package/dist/chunk-LVBHOZZF.js +0 -4
  200. package/dist/chunk-LWM4WABU.js +0 -3
  201. package/dist/chunk-LY7N3UHH.cjs +0 -23
  202. package/dist/chunk-MCIZG4A3.cjs +0 -1
  203. package/dist/chunk-MDLJTZLV.cjs +0 -1
  204. package/dist/chunk-N4FXLQE3.cjs +0 -132
  205. package/dist/chunk-N5POANYV.js +0 -2
  206. package/dist/chunk-NGNJSUGL.cjs +0 -1
  207. package/dist/chunk-NRE6VKL6.cjs +0 -121
  208. package/dist/chunk-O4YE57OS.cjs +0 -6
  209. package/dist/chunk-OBYAIJVU.js +0 -11
  210. package/dist/chunk-OLRCZ6E3.js +0 -2
  211. package/dist/chunk-OOVNTOZC.cjs +0 -56
  212. package/dist/chunk-P6JITOFF.js +0 -4
  213. package/dist/chunk-PITMDQYN.cjs +0 -18
  214. package/dist/chunk-PYUWSKKP.js +0 -57
  215. package/dist/chunk-Q5TFO66G.cjs +0 -1
  216. package/dist/chunk-QO5ZWQA3.cjs +0 -74
  217. package/dist/chunk-QYN6C3FZ.cjs +0 -114
  218. package/dist/chunk-REQ622YC.js +0 -3
  219. package/dist/chunk-RPRGGGIW.js +0 -11
  220. package/dist/chunk-RVBSJ4UQ.cjs +0 -7
  221. package/dist/chunk-RYHOWZLK.js +0 -2
  222. package/dist/chunk-RYXLEFS5.js +0 -2
  223. package/dist/chunk-SBNMXQNO.cjs +0 -2
  224. package/dist/chunk-SLMIYECU.js +0 -2
  225. package/dist/chunk-SRIXRJHL.js +0 -4
  226. package/dist/chunk-TBHNE4VV.js +0 -2
  227. package/dist/chunk-TCFL3UWT.cjs +0 -2
  228. package/dist/chunk-TYQYKKWJ.js +0 -16
  229. package/dist/chunk-U6KFONKM.js +0 -2
  230. package/dist/chunk-UNYXWPLZ.cjs +0 -2
  231. package/dist/chunk-UWHWSWDE.js +0 -2
  232. package/dist/chunk-V4FAL7AG.js +0 -2
  233. package/dist/chunk-VQ53TFYA.cjs +0 -1
  234. package/dist/chunk-VRZC4TTF.cjs +0 -1
  235. package/dist/chunk-W45TLOOT.js +0 -2
  236. package/dist/chunk-WAVGRSE6.js +0 -2
  237. package/dist/chunk-WPM6LFCY.js +0 -2
  238. package/dist/chunk-WXT2XW7T.js +0 -13
  239. package/dist/chunk-X473JI7Z.js +0 -75
  240. package/dist/chunk-X6HUA6EF.cjs +0 -20
  241. package/dist/chunk-XDPLVJRO.js +0 -21
  242. package/dist/chunk-XDQVYCIR.cjs +0 -1
  243. package/dist/chunk-XFYSADHV.cjs +0 -2
  244. package/dist/chunk-XOR64WUQ.cjs +0 -19
  245. package/dist/chunk-Y2YAKDEQ.js +0 -2
  246. package/dist/chunk-YENNL5HG.js +0 -2
  247. package/dist/chunk-YGI5W4RS.js +0 -2
  248. package/dist/chunk-YIFKTA5N.js +0 -57
  249. package/dist/chunk-YUUXFD73.js +0 -19
  250. package/dist/chunk-ZAKYTBEN.js +0 -3
  251. package/dist/chunk-ZHA446FA.cjs +0 -1
  252. package/dist/chunk-ZTLGK6R4.cjs +0 -12
  253. package/dist/chunk-ZUBJ6RLQ.cjs +0 -1
  254. package/dist/client.d.cts +0 -1291
  255. package/dist/client.d.ts +0 -1291
  256. package/dist/d1-5ZQJOFDX.cjs +0 -1
  257. package/dist/d1-HPB6B253.js +0 -2
  258. package/dist/dist-es-3SSNUZST.cjs +0 -1
  259. package/dist/dist-es-64F22JL2.js +0 -2
  260. package/dist/dist-es-A5OF2STN.cjs +0 -2
  261. package/dist/dist-es-BOW5V247.cjs +0 -6
  262. package/dist/dist-es-CRIMATLL.cjs +0 -2
  263. package/dist/dist-es-DL3VLVP6.cjs +0 -1
  264. package/dist/dist-es-F2ZR55UK.js +0 -4
  265. package/dist/dist-es-IPSSZNFP.js +0 -1
  266. package/dist/dist-es-M2F7M27Y.js +0 -2
  267. package/dist/dist-es-M66JKZF5.js +0 -7
  268. package/dist/dist-es-OKLLRYI3.js +0 -2
  269. package/dist/dist-es-P25IKLBI.cjs +0 -1
  270. package/dist/dist-es-SRPWSAF4.cjs +0 -1
  271. package/dist/dist-es-SVHZDVUF.js +0 -3
  272. package/dist/dist-es-T2H2W5BX.cjs +0 -3
  273. package/dist/dist-es-WFI55HKT.js +0 -3
  274. package/dist/drizzle-orm-47ELDEM6.cjs +0 -1
  275. package/dist/drizzle-orm-XRTSOQJS.js +0 -1
  276. package/dist/event-streams-7NAWZW2I.js +0 -1
  277. package/dist/event-streams-JBMWCI2O.cjs +0 -1
  278. package/dist/fs-KWBRQ6T6.js +0 -1
  279. package/dist/fs-ZQYOJOIO.cjs +0 -1
  280. package/dist/index-NGnJpSgf.d.ts +0 -105
  281. package/dist/index-Zrg3sZ6R.d.cts +0 -105
  282. package/dist/jsonwebtoken-DFB6ZBZA.cjs +0 -8
  283. package/dist/jsonwebtoken-OD67R5JS.js +0 -9
  284. package/dist/lib-A2D63VXD.cjs +0 -1
  285. package/dist/lib-JQD2JAOO.js +0 -2
  286. package/dist/loadSso-JY4WDQPS.cjs +0 -2
  287. package/dist/loadSso-UQR6545M.js +0 -3
  288. package/dist/local-6UUGBZ4M.js +0 -1
  289. package/dist/local-ZYHV3J2K.cjs +0 -1
  290. package/dist/media-3Z6YW5J4.cjs +0 -1
  291. package/dist/media-E762GEHL.js +0 -1
  292. package/dist/mongo-auth-adapter-2H2AXDRH.cjs +0 -1
  293. package/dist/mongo-auth-adapter-YWMEOC42.js +0 -1
  294. package/dist/nodemailer-IDML4L6W.cjs +0 -53
  295. package/dist/nodemailer-NITB45SS.js +0 -54
  296. package/dist/nodemailer-transport-3VWVUBM5.cjs +0 -1
  297. package/dist/nodemailer-transport-7RHATUKL.js +0 -1
  298. package/dist/postgres-auth-adapter-QKBNXVPT.js +0 -1
  299. package/dist/postgres-auth-adapter-WMLM4UUC.cjs +0 -1
  300. package/dist/postgres-js-7YBZKGXG.cjs +0 -1
  301. package/dist/postgres-js-JLFIWOBH.js +0 -1
  302. package/dist/redis-adapter-EVK2SMKH.cjs +0 -1
  303. package/dist/redis-adapter-LY2NBSAG.js +0 -1
  304. package/dist/schema-RT6WSUYC.cjs +0 -1
  305. package/dist/schema-YFMSJK2P.js +0 -2
  306. package/dist/signin-N3T2KF5Q.js +0 -3
  307. package/dist/signin-VFBLX7EL.cjs +0 -2
  308. package/dist/sqlite-adapter-KPSISY6E.cjs +0 -1
  309. package/dist/sqlite-adapter-PI6SIY7O.js +0 -1
  310. package/dist/src-6LAUXXDM.cjs +0 -1
  311. package/dist/src-QBADSZV4.js +0 -1
  312. package/dist/sso-oidc-54BIRYR6.cjs +0 -2
  313. package/dist/sso-oidc-UB7G4END.js +0 -3
  314. package/dist/sts-WAA6I22C.js +0 -3
  315. package/dist/sts-YLXXIB3X.cjs +0 -2
  316. package/dist/types-BCOhfwHC.d.ts +0 -839
  317. package/dist/types-DxaK39ix.d.cts +0 -330
  318. package/dist/types-DxaK39ix.d.ts +0 -330
  319. package/dist/types-QglJ7PwT.d.cts +0 -839
@@ -0,0 +1,114 @@
1
+ 'use strict';var chunk23RSKVJP_cjs=require('./chunk-23RSKVJP.cjs'),drizzleOrm=require('drizzle-orm'),S=require('bcryptjs'),crypto$1=require('crypto');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var S__default=/*#__PURE__*/_interopDefault(S);var R=false,g=class{db;prefix;sessionTTL;refreshTokenTTL;constructor(e){this.db=e.db,this.prefix=e.prefix||"kyro:",this.sessionTTL=e.sessionTTL||86400,this.refreshTokenTTL=e.refreshTokenTTL||604800;}async connect(){if(!R){await this.db.execute(drizzleOrm.sql`
2
+ CREATE TABLE IF NOT EXISTS "users" (
3
+ "id" UUID PRIMARY KEY DEFAULT gen_random_uuid(),
4
+ "name" VARCHAR(255),
5
+ "email" VARCHAR(255) NOT NULL,
6
+ "password_hash" VARCHAR(255),
7
+ "role" VARCHAR(50) NOT NULL DEFAULT 'customer',
8
+ "tenant_id" UUID,
9
+ "email_verified" BOOLEAN DEFAULT false,
10
+ "locked" BOOLEAN DEFAULT false,
11
+ "last_login" TIMESTAMP,
12
+ "failed_login_attempts" INTEGER DEFAULT 0,
13
+ "metadata" JSONB,
14
+ "avatar" VARCHAR(255),
15
+ "created_at" TIMESTAMP NOT NULL DEFAULT NOW(),
16
+ "updated_at" TIMESTAMP NOT NULL DEFAULT NOW()
17
+ )
18
+ `),await this.db.execute(drizzleOrm.sql`ALTER TABLE "users" ADD COLUMN IF NOT EXISTS "avatar" VARCHAR(255)`),await this.db.execute(drizzleOrm.sql`ALTER TABLE "users" ADD COLUMN IF NOT EXISTS "metadata" JSONB`),await this.db.execute(drizzleOrm.sql`ALTER TABLE "users" ADD COLUMN IF NOT EXISTS "tenant_id" UUID`),await this.db.execute(drizzleOrm.sql`ALTER TABLE "users" ADD COLUMN IF NOT EXISTS "email_verified" BOOLEAN DEFAULT false`),await this.db.execute(drizzleOrm.sql`ALTER TABLE "users" ADD COLUMN IF NOT EXISTS "locked" BOOLEAN DEFAULT false`),await this.db.execute(drizzleOrm.sql`ALTER TABLE "users" ADD COLUMN IF NOT EXISTS "last_login" TIMESTAMP`),await this.db.execute(drizzleOrm.sql`ALTER TABLE "users" ADD COLUMN IF NOT EXISTS "failed_login_attempts" INTEGER DEFAULT 0`),await this.db.execute(drizzleOrm.sql`CREATE UNIQUE INDEX IF NOT EXISTS "users_email_idx" ON "users" ("email")`),await this.db.execute(drizzleOrm.sql`CREATE INDEX IF NOT EXISTS "users_tenant_idx" ON "users" ("tenant_id")`),await this.db.execute(drizzleOrm.sql`CREATE INDEX IF NOT EXISTS "users_role_idx" ON "users" ("role")`),await this.db.execute(drizzleOrm.sql`
19
+ CREATE TABLE IF NOT EXISTS "sessions" (
20
+ "id" UUID PRIMARY KEY DEFAULT gen_random_uuid(),
21
+ "user_id" UUID NOT NULL REFERENCES "users"("id") ON DELETE CASCADE,
22
+ "token" VARCHAR(512) NOT NULL UNIQUE,
23
+ "refresh_token" VARCHAR(512),
24
+ "ip_address" VARCHAR(45),
25
+ "user_agent" TEXT,
26
+ "expires_at" TIMESTAMP NOT NULL,
27
+ "created_at" TIMESTAMP NOT NULL DEFAULT NOW()
28
+ )
29
+ `),await this.db.execute(drizzleOrm.sql`CREATE INDEX IF NOT EXISTS "sessions_user_idx" ON "sessions" ("user_id")`),await this.db.execute(drizzleOrm.sql`CREATE INDEX IF NOT EXISTS "sessions_token_idx" ON "sessions" ("token")`),await this.db.execute(drizzleOrm.sql`CREATE INDEX IF NOT EXISTS "sessions_expires_idx" ON "sessions" ("expires_at")`),await this.db.execute(drizzleOrm.sql`
30
+ CREATE TABLE IF NOT EXISTS "audit_logs" (
31
+ "id" UUID PRIMARY KEY DEFAULT gen_random_uuid(),
32
+ "action" VARCHAR(100) NOT NULL,
33
+ "user_id" UUID REFERENCES "users"("id") ON DELETE SET NULL,
34
+ "user_email" VARCHAR(255),
35
+ "role" VARCHAR(50),
36
+ "resource" VARCHAR(100) NOT NULL,
37
+ "resource_id" VARCHAR(255),
38
+ "changes" JSONB,
39
+ "ip_address" VARCHAR(45),
40
+ "user_agent" TEXT,
41
+ "success" BOOLEAN NOT NULL DEFAULT true,
42
+ "error" TEXT,
43
+ "metadata" JSONB,
44
+ "timestamp" TIMESTAMP NOT NULL DEFAULT NOW()
45
+ )
46
+ `),await this.db.execute(drizzleOrm.sql`ALTER TABLE "audit_logs" ADD COLUMN IF NOT EXISTS "resource_id" VARCHAR(255)`),await this.db.execute(drizzleOrm.sql`ALTER TABLE "audit_logs" ADD COLUMN IF NOT EXISTS "changes" JSONB`),await this.db.execute(drizzleOrm.sql`ALTER TABLE "audit_logs" ADD COLUMN IF NOT EXISTS "user_agent" TEXT`),await this.db.execute(drizzleOrm.sql`ALTER TABLE "audit_logs" ADD COLUMN IF NOT EXISTS "error" TEXT`),await this.db.execute(drizzleOrm.sql`ALTER TABLE "audit_logs" ADD COLUMN IF NOT EXISTS "metadata" JSONB`);try{await this.db.execute(drizzleOrm.sql`ALTER TABLE "audit_logs" ALTER COLUMN "resource_id" TYPE VARCHAR(255)`);}catch{}await this.db.execute(drizzleOrm.sql`CREATE INDEX IF NOT EXISTS "audit_logs_user_idx" ON "audit_logs" ("user_id")`),await this.db.execute(drizzleOrm.sql`CREATE INDEX IF NOT EXISTS "audit_logs_action_idx" ON "audit_logs" ("action")`),await this.db.execute(drizzleOrm.sql`CREATE INDEX IF NOT EXISTS "audit_logs_resource_idx" ON "audit_logs" ("resource")`),await this.db.execute(drizzleOrm.sql`CREATE INDEX IF NOT EXISTS "audit_logs_timestamp_idx" ON "audit_logs" ("timestamp")`),await this.db.execute(drizzleOrm.sql`
47
+ CREATE TABLE IF NOT EXISTS "password_history" (
48
+ "id" UUID PRIMARY KEY DEFAULT gen_random_uuid(),
49
+ "user_id" UUID NOT NULL REFERENCES "users"("id") ON DELETE CASCADE,
50
+ "password_hash" VARCHAR(255) NOT NULL,
51
+ "created_at" TIMESTAMP NOT NULL DEFAULT NOW()
52
+ )
53
+ `),await this.db.execute(drizzleOrm.sql`CREATE INDEX IF NOT EXISTS "password_history_user_idx" ON "password_history" ("user_id")`),await this.db.execute(drizzleOrm.sql`
54
+ CREATE TABLE IF NOT EXISTS "lockouts" (
55
+ "id" UUID PRIMARY KEY DEFAULT gen_random_uuid(),
56
+ "user_id" UUID NOT NULL REFERENCES "users"("id") ON DELETE CASCADE,
57
+ "ip_address" VARCHAR(45),
58
+ "reason" VARCHAR(255),
59
+ "locked_until" TIMESTAMP NOT NULL,
60
+ "released_at" TIMESTAMP,
61
+ "created_at" TIMESTAMP NOT NULL DEFAULT NOW()
62
+ )
63
+ `),await this.db.execute(drizzleOrm.sql`CREATE INDEX IF NOT EXISTS "lockouts_user_idx" ON "lockouts" ("user_id")`),await this.db.execute(drizzleOrm.sql`CREATE INDEX IF NOT EXISTS "lockouts_locked_until_idx" ON "lockouts" ("locked_until")`),await this.db.execute(drizzleOrm.sql`
64
+ CREATE TABLE IF NOT EXISTS "roles" (
65
+ "id" UUID PRIMARY KEY DEFAULT gen_random_uuid(),
66
+ "name" VARCHAR(100) NOT NULL UNIQUE,
67
+ "level" INTEGER NOT NULL DEFAULT 0,
68
+ "inherits" TEXT[],
69
+ "description" TEXT,
70
+ "permissions" JSONB DEFAULT '[]',
71
+ "is_system" BOOLEAN DEFAULT false,
72
+ "created_at" TIMESTAMP NOT NULL DEFAULT NOW(),
73
+ "updated_at" TIMESTAMP NOT NULL DEFAULT NOW()
74
+ )
75
+ `),await this.db.execute(drizzleOrm.sql`CREATE INDEX IF NOT EXISTS "roles_level_idx" ON "roles" ("level")`),await this.db.execute(drizzleOrm.sql`
76
+ CREATE TABLE IF NOT EXISTS "tenants" (
77
+ "id" UUID PRIMARY KEY DEFAULT gen_random_uuid(),
78
+ "name" VARCHAR(255) NOT NULL,
79
+ "slug" VARCHAR(100) NOT NULL UNIQUE,
80
+ "settings" JSONB DEFAULT '{}',
81
+ "is_active" BOOLEAN DEFAULT true,
82
+ "created_at" TIMESTAMP NOT NULL DEFAULT NOW(),
83
+ "updated_at" TIMESTAMP NOT NULL DEFAULT NOW()
84
+ )
85
+ `),await this.db.execute(drizzleOrm.sql`
86
+ CREATE TABLE IF NOT EXISTS "api_keys" (
87
+ "id" UUID PRIMARY KEY DEFAULT gen_random_uuid(),
88
+ "user_id" UUID NOT NULL REFERENCES "users"("id") ON DELETE CASCADE,
89
+ "name" VARCHAR(255) NOT NULL,
90
+ "key" VARCHAR(64) NOT NULL UNIQUE,
91
+ "key_prefix" VARCHAR(8) NOT NULL,
92
+ "permissions" JSONB DEFAULT '[]',
93
+ "last_used_at" TIMESTAMP,
94
+ "expires_at" TIMESTAMP,
95
+ "created_at" TIMESTAMP NOT NULL DEFAULT NOW()
96
+ )
97
+ `),await this.db.execute(drizzleOrm.sql`
98
+ CREATE TABLE IF NOT EXISTS "email_verifications" (
99
+ "id" UUID PRIMARY KEY DEFAULT gen_random_uuid(),
100
+ "user_id" UUID NOT NULL REFERENCES "users"("id") ON DELETE CASCADE,
101
+ "token" VARCHAR(64) NOT NULL UNIQUE,
102
+ "expires_at" TIMESTAMP NOT NULL,
103
+ "created_at" TIMESTAMP NOT NULL DEFAULT NOW()
104
+ )
105
+ `),await this.db.execute(drizzleOrm.sql`
106
+ CREATE TABLE IF NOT EXISTS "password_resets" (
107
+ "id" UUID PRIMARY KEY DEFAULT gen_random_uuid(),
108
+ "user_id" UUID NOT NULL REFERENCES "users"("id") ON DELETE CASCADE,
109
+ "token" VARCHAR(64) NOT NULL UNIQUE,
110
+ "expires_at" TIMESTAMP NOT NULL,
111
+ "used_at" TIMESTAMP,
112
+ "created_at" TIMESTAMP NOT NULL DEFAULT NOW()
113
+ )
114
+ `),R=true;}}async disconnect(){}async createUser(e){let s=await this.hashPassword(e.password),[i]=await this.db.insert(chunk23RSKVJP_cjs.a).values({email:e.email.toLowerCase(),name:e.name,passwordHash:s,role:e.role||"customer",avatar:e.avatar,tenantId:e.tenantId,emailVerified:e.emailVerified??true}).returning();return this.userToAuthUser(i)}async findUserByEmail(e){let[s]=await this.db.select().from(chunk23RSKVJP_cjs.a).where(drizzleOrm.eq(chunk23RSKVJP_cjs.a.email,e.toLowerCase())).limit(1);return s?this.userToAuthUser(s):null}async findUserById(e){let[s]=await this.db.select().from(chunk23RSKVJP_cjs.a).where(drizzleOrm.eq(chunk23RSKVJP_cjs.a.id,e)).limit(1);return s?this.userToAuthUser(s):null}async updateUser(e,s){let i={updatedAt:new Date};s.name!==void 0&&(i.name=s.name),s.email!==void 0&&(i.email=s.email),s.passwordHash!==void 0&&(i.passwordHash=s.passwordHash),s.role!==void 0&&(i.role=s.role),s.tenantId!==void 0&&(i.tenantId=s.tenantId),s.avatar!==void 0&&(i.avatar=s.avatar),s.emailVerified!==void 0&&(i.emailVerified=s.emailVerified),s.locked!==void 0&&(i.locked=s.locked),s.lastLogin!==void 0&&(i.lastLogin=s.lastLogin?new Date(s.lastLogin):null),s.failedLoginAttempts!==void 0&&(i.failedLoginAttempts=s.failedLoginAttempts);let[r]=await this.db.update(chunk23RSKVJP_cjs.a).set(i).where(drizzleOrm.eq(chunk23RSKVJP_cjs.a.id,e)).returning();return r?this.userToAuthUser(r):null}async deleteUser(e){return await this.db.delete(chunk23RSKVJP_cjs.a).where(drizzleOrm.eq(chunk23RSKVJP_cjs.a.id,e)),true}async findUsers(e={}){let s=e.page??1,i=e.limit??10,r=(s-1)*i,u=e.search;if(u){let L=`%${u}%`,[U,[{count:f}]]=await Promise.all([this.db.select().from(chunk23RSKVJP_cjs.a).where(drizzleOrm.sql`${chunk23RSKVJP_cjs.a.email} ILIKE ${L}`).orderBy(drizzleOrm.desc(chunk23RSKVJP_cjs.a.createdAt)).limit(i).offset(r),this.db.select({count:drizzleOrm.sql`count(*)`}).from(chunk23RSKVJP_cjs.a).where(drizzleOrm.sql`${chunk23RSKVJP_cjs.a.email} ILIKE ${L}`)]);return {users:U.map(A=>this.userToAuthUser(A)),total:Number(f)}}let[E,[{count:c}]]=await Promise.all([this.db.select().from(chunk23RSKVJP_cjs.a).orderBy(drizzleOrm.desc(chunk23RSKVJP_cjs.a.createdAt)).limit(i).offset(r),this.db.select({count:drizzleOrm.sql`count(*)`}).from(chunk23RSKVJP_cjs.a)]);return {users:E.map(L=>this.userToAuthUser(L)),total:Number(c)}}async verifyPassword(e,s){let i=await this.findUserByEmail(e);if(!i)return null;let[r]=await this.db.select().from(chunk23RSKVJP_cjs.a).where(drizzleOrm.eq(chunk23RSKVJP_cjs.a.email,e.toLowerCase())).limit(1);return r?.passwordHash&&await S__default.default.compare(s,r.passwordHash)?i:null}async hashPassword(e){return S__default.default.hash(e,12)}async createSession(e,s){let i=crypto$1.randomBytes(32).toString("base64url"),r=crypto$1.randomBytes(32).toString("base64url"),u=new Date(Date.now()+this.sessionTTL*1e3);new Date(Date.now()+this.refreshTokenTTL*1e3);let [c]=await this.db.insert(chunk23RSKVJP_cjs.d).values({userId:e,token:i,refreshToken:r,ipAddress:s?.ipAddress,userAgent:s?.userAgent,expiresAt:u}).returning();return this.sessionToSession(c)}async findSessionByToken(e){let[s]=await this.db.select().from(chunk23RSKVJP_cjs.d).where(drizzleOrm.and(drizzleOrm.eq(chunk23RSKVJP_cjs.d.token,e),drizzleOrm.gt(chunk23RSKVJP_cjs.d.expiresAt,new Date))).limit(1);return s?this.sessionToSession(s):null}async findSessionByRefreshToken(e){let[s]=await this.db.select().from(chunk23RSKVJP_cjs.d).where(drizzleOrm.and(drizzleOrm.eq(chunk23RSKVJP_cjs.d.refreshToken,e),drizzleOrm.gt(chunk23RSKVJP_cjs.d.expiresAt,new Date))).limit(1);return s?this.sessionToSession(s):null}async deleteSession(e){return await this.db.delete(chunk23RSKVJP_cjs.d).where(drizzleOrm.eq(chunk23RSKVJP_cjs.d.id,e)),true}async deleteUserSessions(e){return await this.db.delete(chunk23RSKVJP_cjs.d).where(drizzleOrm.eq(chunk23RSKVJP_cjs.d.userId,e)),1}async addPasswordToHistory(e,s){await this.db.insert(chunk23RSKVJP_cjs.j).values({userId:e,passwordHash:s});}async getPasswordHistory(e,s=5){return (await this.db.select({passwordHash:chunk23RSKVJP_cjs.j.passwordHash}).from(chunk23RSKVJP_cjs.j).where(drizzleOrm.eq(chunk23RSKVJP_cjs.j.userId,e)).orderBy(drizzleOrm.desc(chunk23RSKVJP_cjs.j.createdAt)).limit(s)).map(r=>r.passwordHash)}async isPasswordInHistory(e,s,i=5){let r=await this.getPasswordHistory(s,i);for(let u of r)if(await this.verifyPassword(e,u))return true;return false}async isLocked(e){let[s]=await this.db.select().from(chunk23RSKVJP_cjs.k).where(drizzleOrm.and(drizzleOrm.eq(chunk23RSKVJP_cjs.k.userId,e),drizzleOrm.gt(chunk23RSKVJP_cjs.k.lockedUntil,new Date))).limit(1);return !!s}async getLockout(e){let[s]=await this.db.select().from(chunk23RSKVJP_cjs.k).where(drizzleOrm.and(drizzleOrm.eq(chunk23RSKVJP_cjs.k.userId,e),drizzleOrm.gt(chunk23RSKVJP_cjs.k.lockedUntil,new Date))).limit(1);return s?{lockedUntil:s.lockedUntil}:null}async recordFailedAttempt(e,s){let r=((await this.findUserById(e))?.failedLoginAttempts||0)+1;await this.updateUser(e,{failedLoginAttempts:r});let E=r>=5;return E&&await this.db.insert(chunk23RSKVJP_cjs.k).values({userId:e,ipAddress:s,reason:"Too many failed login attempts",lockedUntil:new Date(Date.now()+9e5)}),{attempts:r,locked:E}}async resetAttempts(e){await this.updateUser(e,{failedLoginAttempts:0});}async findAuditLogs(e){let{limit:s=50,offset:i=0,userId:r,action:u,resource:E,resourceId:c,success:L,startDate:U,endDate:f}=e,A=[];r&&A.push(drizzleOrm.eq(chunk23RSKVJP_cjs.e.userId,r)),u&&(Array.isArray(u)?A.push(drizzleOrm.sql`${chunk23RSKVJP_cjs.e.action} = ANY(${u})`):A.push(drizzleOrm.eq(chunk23RSKVJP_cjs.e.action,u))),E&&A.push(drizzleOrm.eq(chunk23RSKVJP_cjs.e.resource,E)),c&&A.push(drizzleOrm.eq(chunk23RSKVJP_cjs.e.resourceId,c)),L!==void 0&&A.push(drizzleOrm.eq(chunk23RSKVJP_cjs.e.success,L)),U&&A.push(drizzleOrm.sql`${chunk23RSKVJP_cjs.e.timestamp} >= ${U}`),f&&A.push(drizzleOrm.sql`${chunk23RSKVJP_cjs.e.timestamp} <= ${f}`);let D=A.length>0?drizzleOrm.and(...A):void 0,_=await this.db.select({count:drizzleOrm.sql`count(*)`}).from(chunk23RSKVJP_cjs.e).where(D);return {logs:(await this.db.select().from(chunk23RSKVJP_cjs.e).where(D).orderBy(drizzleOrm.desc(chunk23RSKVJP_cjs.e.timestamp)).limit(s).offset(i)).map(o=>({id:o.id,timestamp:o.timestamp,action:o.action,userId:o.userId||void 0,userEmail:o.userEmail||void 0,role:o.role||void 0,resource:o.resource,resourceId:o.resourceId||void 0,changes:o.changes||void 0,ipAddress:o.ipAddress||void 0,userAgent:o.userAgent||void 0,success:o.success,error:o.error||void 0,metadata:o.metadata||void 0})),total:Number(_[0]?.count||0)}}async createAuditLog(e){let s=crypto.randomUUID(),i=new Date;return await this.db.insert(chunk23RSKVJP_cjs.e).values({id:s,action:e.action,userId:e.userId??null,userEmail:e.userEmail??null,role:e.role??null,resource:e.resource,resourceId:e.resourceId??null,changes:e.changes??null,ipAddress:e.ipAddress??null,userAgent:e.userAgent??null,success:e.success,error:e.error??null,metadata:e.metadata??null,timestamp:i}),{...e,id:s,timestamp:i}}userToAuthUser(e){return {id:e.id,name:e.name||void 0,email:e.email,passwordHash:e.passwordHash||void 0,role:e.role,avatar:e.avatar&&typeof e.avatar=="object"?e.avatar.id||void 0:e.avatar||void 0,tenantId:e.tenantId||void 0,emailVerified:e.emailVerified||false,locked:e.locked||false,lastLogin:e.lastLogin?new Date(e.lastLogin).toISOString():void 0,failedLoginAttempts:e.failedLoginAttempts||0,createdAt:new Date(e.createdAt).toISOString(),updatedAt:new Date(e.updatedAt).toISOString()}}sessionToSession(e){return {id:e.id,userId:e.userId,token:e.token,refreshToken:e.refreshToken||void 0,expiresAt:new Date(e.expiresAt).toISOString(),createdAt:new Date(e.createdAt).toISOString(),ipAddress:e.ipAddress||void 0,userAgent:e.userAgent||void 0}}async createEmailVerificationToken(e){let s=crypto$1.randomBytes(32).toString("hex"),i=new Date(Date.now()+1440*60*1e3);return await this.db.insert(chunk23RSKVJP_cjs.h).values({userId:e,token:s,expiresAt:i}),{token:s,expiresAt:i}}async verifyEmailToken(e){let[s]=await this.db.select().from(chunk23RSKVJP_cjs.h).where(drizzleOrm.eq(chunk23RSKVJP_cjs.h.token,e)).limit(1);return s?s.expiresAt<new Date?{success:false,error:"Verification token has expired"}:(await this.db.update(chunk23RSKVJP_cjs.a).set({emailVerified:true}).where(drizzleOrm.eq(chunk23RSKVJP_cjs.a.id,s.userId)),await this.db.delete(chunk23RSKVJP_cjs.h).where(drizzleOrm.eq(chunk23RSKVJP_cjs.h.id,s.id)),{success:true,userId:s.userId}):{success:false,error:"Invalid verification token"}}async createPasswordResetToken(e){let s=await this.findUserByEmail(e);if(!s)return {token:"",expiresAt:new Date,error:"User not found"};let i=crypto$1.randomBytes(32).toString("hex"),r=new Date(Date.now()+3600*1e3);return await this.db.insert(chunk23RSKVJP_cjs.i).values({userId:s.id,token:i,expiresAt:r}),{token:i,expiresAt:r}}async resetPasswordWithToken(e,s){let[i]=await this.db.select().from(chunk23RSKVJP_cjs.i).where(drizzleOrm.eq(chunk23RSKVJP_cjs.i.token,e)).limit(1);if(!i)return {success:false,error:"Invalid reset token"};if(i.expiresAt<new Date)return {success:false,error:"Reset token has expired"};if(i.usedAt)return {success:false,error:"Reset token has already been used"};let r=await this.hashPassword(s);return await this.db.update(chunk23RSKVJP_cjs.a).set({passwordHash:r,updatedAt:new Date}).where(drizzleOrm.eq(chunk23RSKVJP_cjs.a.id,i.userId)),await this.db.update(chunk23RSKVJP_cjs.i).set({usedAt:new Date}).where(drizzleOrm.eq(chunk23RSKVJP_cjs.i.id,i.id)),await this.db.delete(chunk23RSKVJP_cjs.d).where(drizzleOrm.eq(chunk23RSKVJP_cjs.d.userId,i.userId)),{success:true}}};exports.a=g;
@@ -0,0 +1,2 @@
1
+ import {timingSafeEqual}from'crypto';if (typeof window === "undefined") { const { createRequire } = await import(/* @vite-ignore */ 'module'); createRequire(import.meta.url); }
2
+ async function f(e,r){return typeof e=="boolean"?e:typeof e=="function"?await e(r):true}function y(...e){let r={};for(let t of e)t&&typeof t=="object"&&Object.assign(r,t);return r}function h(e,r){return f(e,r).then(t=>{if(t!==true)return t===false?{_id:{$eq:null}}:t})}var c="api_keys";function A(e){return e.substring(0,8)}function g(e,r){if(e.length!==r.length)return false;try{return timingSafeEqual(Buffer.from(e),Buffer.from(r))}catch{return false}}async function C(e,r,t){if(!e||typeof e!="string")return {valid:false,error:"No API key provided"};if(!e.startsWith("kyro_"))return {valid:false,error:"Invalid API key format"};let a=A(e);try{let s=await r.find({collection:c,where:{keyPrefix:{equals:a}},limit:100,page:1});if(!s.docs||s.docs.length===0)return {valid:!1,error:"Invalid API key"};let n=null;for(let i of s.docs){let l=i;if(g(l.key,e)){n=l;break}}if(!n)return {valid:!1,error:"Invalid API key"};if(n.expiresAt&&new Date(n.expiresAt)<new Date)return {valid:!1,error:"API key has expired"};try{await r.update({collection:c,id:n.id,data:{lastUsedAt:new Date().toISOString()}});}catch{}let o={id:n.userId,role:n.role||"author",tenantId:n.tenantId};if(t){let i=await t(n.userId);i&&Object.assign(o,i);}return {valid:!0,userId:n.userId,user:o,permissions:n.permissions||[],apiKeyId:n.id,tenantId:o.tenantId,role:o.role}}catch(s){return console.error("[ApiKey] Validation error:",s),{valid:false,error:"Failed to validate API key"}}}function P(e){let r=e.headers.get("Authorization");if(r){if(r.startsWith("ApiKey "))return r.slice(7).trim();if(r.startsWith("Bearer "))return null}let t=e.headers.get("X-API-Key");return t?t.trim():null}function K(e){return !e.valid||!e.userId?null:{userId:e.userId,user:e.user||{},permissions:e.permissions||[],apiKeyId:e.apiKeyId||"",tenantId:e.tenantId,role:e.role}}function k(e,r){if(e.length===0)return false;if(e.includes("*")||e.includes(r))return true;let[t,a]=r.split(":");return !!e.includes(`${t}:*`)}function v(){let e="abcdefghijklmnopqrstuvwxyz0123456789",r="";for(let t=0;t<32;t++)r+=e[Math.floor(Math.random()*e.length)];return `kyro_${r}`}function b(e){return e.substring(0,8)}export{c as a,C as b,P as c,K as d,k as e,v as f,b as g,f as h,y as i,h as j};
@@ -0,0 +1,91 @@
1
+ import {generateHTML}from'@tiptap/html';import c from'@tiptap/starter-kit';import p from'@tiptap/extension-link';import g from'@tiptap/extension-image';import x from'@tiptap/extension-text-align';import u from'@tiptap/extension-underline';import m from'@tiptap/extension-highlight';import F from'@tiptap/extension-task-list';import y from'@tiptap/extension-task-item';import {TextStyle}from'@tiptap/extension-text-style';import f from'@tiptap/extension-color';if (typeof window === "undefined") { const { createRequire } = await import(/* @vite-ignore */ 'module'); createRequire(import.meta.url); }
2
+ function k(e){return e.type==="text"}function R(e){return e.type==="number"}function B(e){return e.type==="relationship"}function T(e){return e.type==="array"}function w(e){return e.type==="group"}function I(e){return e.type==="blocks"}function D(e){return e.type==="upload"}function A(e){return e.type==="image"}function L(e){return e.type==="richtext"}function C(e){return e.type==="select"}function V(e){return e.type==="row"||e.type==="collapsible"||e.type==="tabs"}function E(e){return e.type==="icon"}function S(e){return e.type==="embedding"}var o=["text","number","checkbox","date","email","password","textarea","select","radio","color","icon"],a=["richtext","json","code","upload","image","markdown","embedding"],l=["relationship","array","group","blocks"],d=["row","collapsible","tabs"],q=[...o,...a,...l,...d];function O(e,t,i){return {name:e,type:"relationship",relationTo:t,...i,required:i?.required??false}}var X=`
3
+ .kyro-richtext {
4
+ color: inherit;
5
+ line-height: 1.7;
6
+ }
7
+
8
+ .kyro-richtext > *:first-child {
9
+ margin-top: 0;
10
+ }
11
+
12
+ .kyro-richtext > *:last-child {
13
+ margin-bottom: 0;
14
+ }
15
+
16
+ .kyro-richtext p,
17
+ .kyro-richtext ul,
18
+ .kyro-richtext ol,
19
+ .kyro-richtext blockquote,
20
+ .kyro-richtext pre {
21
+ margin: 0 0 1rem;
22
+ }
23
+
24
+ .kyro-richtext h1,
25
+ .kyro-richtext h2,
26
+ .kyro-richtext h3,
27
+ .kyro-richtext h4,
28
+ .kyro-richtext h5,
29
+ .kyro-richtext h6 {
30
+ margin: 0 0 0.75rem;
31
+ line-height: 1.2;
32
+ }
33
+
34
+ .kyro-richtext ul,
35
+ .kyro-richtext ol {
36
+ padding-left: 1.5rem;
37
+ }
38
+
39
+ .kyro-richtext blockquote {
40
+ border-left: 4px solid rgba(148, 163, 184, 0.5);
41
+ margin-left: 0;
42
+ padding-left: 1rem;
43
+ font-style: italic;
44
+ }
45
+
46
+ .kyro-richtext pre {
47
+ overflow-x: auto;
48
+ border-radius: 0.75rem;
49
+ background: rgba(15, 23, 42, 0.92);
50
+ color: #f8fafc;
51
+ padding: 1rem;
52
+ }
53
+
54
+ .kyro-richtext code {
55
+ font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
56
+ }
57
+
58
+ .kyro-richtext img {
59
+ display: block;
60
+ max-width: 100%;
61
+ height: auto;
62
+ border-radius: 0.75rem;
63
+ }
64
+
65
+ .kyro-richtext ul[data-type="taskList"] {
66
+ list-style: none;
67
+ padding: 0;
68
+ }
69
+
70
+ .kyro-richtext li[data-type="taskItem"] {
71
+ display: flex;
72
+ align-items: flex-start;
73
+ gap: 0.5rem;
74
+ }
75
+
76
+ .kyro-richtext li[data-type="taskItem"] > label {
77
+ user-select: none;
78
+ pointer-events: none;
79
+ margin-top: 0.2rem;
80
+ }
81
+
82
+ .kyro-richtext li[data-type="taskItem"] > div {
83
+ flex: 1;
84
+ }
85
+
86
+ .kyro-richtext mark {
87
+ background-color: #fef08a;
88
+ border-radius: 0.25rem;
89
+ padding: 0.125rem 0.25rem;
90
+ }
91
+ `.trim(),h=[c,p.configure({openOnClick:false}),g,x.configure({types:["heading","paragraph"]}),u,m.configure({multicolor:true}),F,y.configure({nested:true}),TextStyle,f];function $(e){return typeof e=="object"&&e!==null?e:{}}function Q(e){if(typeof e!="object"||e===null)return "";try{return `<div class="kyro-richtext">${generateHTML(e,h)}</div>`}catch(t){return console.error("Failed to render rich text:",t),""}}export{k as a,R as b,B as c,T as d,w as e,I as f,D as g,A as h,L as i,C as j,V as k,E as l,S as m,o as n,a as o,l as p,d as q,q as r,O as s,X as t,$ as u,Q as v};
@@ -1,4 +1,5 @@
1
- 'use strict';var chunkHPYH7GTS_cjs=require('./chunk-HPYH7GTS.cjs'),chunkBUNLC3II_cjs=require('./chunk-BUNLC3II.cjs');chunkBUNLC3II_cjs.h();chunkBUNLC3II_cjs.h();chunkBUNLC3II_cjs.h();function g(o){let{brand:e,title:t,badge:r,previewText:s=t,bodyHtml:i,ctaText:n,ctaUrl:a,secondaryCtaText:l,secondaryCtaUrl:p}=o,f=e?.siteName||"Lagos Buka",m=e?.logoUrl||"https://resources.lagosbukasantonio.com/lagosbuka.svg",u=e?.logoDarkUrl||e?.logoUrl||m,K=e?.appUrl||"https://lagosbukasantonio.com";return `<!DOCTYPE html>
1
+ import {a}from'./chunk-W5GDZG64.js';if (typeof window === "undefined") { const { createRequire } = await import(/* @vite-ignore */ 'module'); createRequire(import.meta.url); }
2
+ function c(o){let{brand:e,title:t,badge:r,previewText:s=t,bodyHtml:i,ctaText:n,ctaUrl:a,secondaryCtaText:l,secondaryCtaUrl:g}=o,f=e?.siteName||"Lagos Buka",m=e?.logoUrl||"https://resources.lagosbukasantonio.com/lagosbuka.svg",u=e?.logoDarkUrl||e?.logoUrl||m,K=e?.appUrl||"https://lagosbukasantonio.com";return `<!DOCTYPE html>
2
3
  <html lang="en">
3
4
  <head>
4
5
  <meta charset="UTF-8">
@@ -80,8 +81,8 @@
80
81
  <a href="${a}" target="_blank" class="email-btn-primary" style="display: inline-block; padding: 12px 24px; background-color: #0b3b24; color: #ffffff; font-size: 13px; font-weight: 600; text-decoration: none; border-radius: 12px; box-shadow: 0 2px 6px rgba(11, 59, 36, 0.15);">
81
82
  ${n} &rarr;
82
83
  </a>
83
- ${l&&p?`
84
- <a href="${p}" target="_blank" style="display: inline-block; padding: 12px 20px; margin-left: 8px; background-color: #f8fafc; border: 1px solid #e2e8f0; color: #334155; font-size: 13px; font-weight: 500; text-decoration: none; border-radius: 12px;">
84
+ ${l&&g?`
85
+ <a href="${g}" target="_blank" style="display: inline-block; padding: 12px 20px; margin-left: 8px; background-color: #f8fafc; border: 1px solid #e2e8f0; color: #334155; font-size: 13px; font-weight: 500; text-decoration: none; border-radius: 12px;">
85
86
  ${l}
86
87
  </a>
87
88
  `:""}
@@ -103,7 +104,7 @@
103
104
  </tr>
104
105
  </table>
105
106
  </body>
106
- </html>`}chunkBUNLC3II_cjs.h();function b(o,e="User",t){let r="Confirm your email address \u2014 Kyro CMS",s=`
107
+ </html>`}function b(o,e="User",t){let r="Confirm your email address \u2014 Kyro CMS",s=`
107
108
  <p class="email-text" style="margin: 0 0 16px; font-size: 14px; line-height: 1.6; color: #52525b;">
108
109
  Hello <strong class="email-strong" style="color: #09090b;">${e}</strong>,
109
110
  </p>
@@ -124,14 +125,14 @@
124
125
  <p class="email-text" style="margin: 0 0 8px; font-size: 12px; color: #71717a;">
125
126
  This verification link will expire in 24 hours. If you did not create an account, you can safely ignore this email.
126
127
  </p>
127
- `,i=g({brand:t,title:"Confirm Your Email Address",previewText:"Please confirm your email address to activate your Kyro CMS account.",bodyHtml:s,ctaText:"Confirm Email Address",ctaUrl:o,secondaryCtaText:"Documentation",secondaryCtaUrl:"https://kyro-cms.com/docs"}),n=`Welcome, ${e}!
128
+ `,i=c({brand:t,title:"Confirm Your Email Address",previewText:"Please confirm your email address to activate your Kyro CMS account.",bodyHtml:s,ctaText:"Confirm Email Address",ctaUrl:o,secondaryCtaText:"Documentation",secondaryCtaUrl:"https://kyro-cms.com/docs"}),n=`Welcome, ${e}!
128
129
 
129
130
  Please verify your email address by visiting:
130
131
  ${o}
131
132
 
132
133
  This link expires in 24 hours.
133
134
 
134
- Kyro CMS \u2014 https://kyro-cms.com`;return {subject:r,html:i,text:n}}chunkBUNLC3II_cjs.h();function x(o,e="User",t){let r="Reset your password \u2014 Kyro CMS",s=`
135
+ Kyro CMS \u2014 https://kyro-cms.com`;return {subject:r,html:i,text:n}}function x(o,e="User",t){let r="Reset your password \u2014 Kyro CMS",s=`
135
136
  <p class="email-text" style="margin: 0 0 16px; font-size: 14px; line-height: 1.6; color: #52525b;">
136
137
  Hello <strong class="email-strong" style="color: #09090b;">${e}</strong>,
137
138
  </p>
@@ -152,14 +153,14 @@ Kyro CMS \u2014 https://kyro-cms.com`;return {subject:r,html:i,text:n}}chunkBUNL
152
153
  <p class="email-text" style="margin: 0 0 8px; font-size: 12px; color: #71717a;">
153
154
  For security reasons, this link will expire in 1 hour. If you did not request a password reset, no further action is required.
154
155
  </p>
155
- `,i=g({brand:t,title:"Reset Your Password",previewText:"Use this secure link to reset your Kyro CMS password.",bodyHtml:s,ctaText:"Reset Password",ctaUrl:o}),n=`Hello ${e},
156
+ `,i=c({brand:t,title:"Reset Your Password",previewText:"Use this secure link to reset your Kyro CMS password.",bodyHtml:s,ctaText:"Reset Password",ctaUrl:o}),n=`Hello ${e},
156
157
 
157
158
  Reset your password using the following link:
158
159
  ${o}
159
160
 
160
161
  This link will expire in 1 hour.
161
162
 
162
- Kyro CMS \u2014 https://kyro-cms.com`;return {subject:r,html:i,text:n}}chunkBUNLC3II_cjs.h();function _(o="User",e="https://kyro-cms.com",t){let r="Welcome to Kyro CMS!",s=`
163
+ Kyro CMS \u2014 https://kyro-cms.com`;return {subject:r,html:i,text:n}}function _(o="User",e="https://kyro-cms.com",t){let r="Welcome to Kyro CMS!",s=`
163
164
  <p class="email-text" style="margin: 0 0 16px; font-size: 14px; line-height: 1.6; color: #52525b;">
164
165
  Welcome <strong class="email-strong" style="color: #09090b;">${o}</strong>,
165
166
  </p>
@@ -180,11 +181,11 @@ Kyro CMS \u2014 https://kyro-cms.com`;return {subject:r,html:i,text:n}}chunkBUNL
180
181
  </td>
181
182
  </tr>
182
183
  </table>
183
- `,i=g({brand:t,title:"Welcome to Kyro CMS",previewText:"Your account is verified and ready. Start building content applications.",bodyHtml:s,ctaText:"Open Dashboard",ctaUrl:e,secondaryCtaText:"Documentation",secondaryCtaUrl:"https://kyro-cms.com/docs"}),n=`Welcome to Kyro CMS, ${o}!
184
+ `,i=c({brand:t,title:"Welcome to Kyro CMS",previewText:"Your account is verified and ready. Start building content applications.",bodyHtml:s,ctaText:"Open Dashboard",ctaUrl:e,secondaryCtaText:"Documentation",secondaryCtaUrl:"https://kyro-cms.com/docs"}),n=`Welcome to Kyro CMS, ${o}!
184
185
 
185
186
  Your account is active. Log in at ${e} to start building.
186
187
 
187
- Documentation: https://kyro-cms.com/docs`;return {subject:r,html:i,text:n}}chunkBUNLC3II_cjs.h();function w(o="User",e,t,r){let s="Security Alert: Password Changed \u2014 Kyro CMS",i=new Date().toUTCString(),n=`
188
+ Documentation: https://kyro-cms.com/docs`;return {subject:r,html:i,text:n}}function w(o="User",e,t,r){let s="Security Alert: Password Changed \u2014 Kyro CMS",i=new Date().toUTCString(),n=`
188
189
  <p class="email-text" style="margin: 0 0 16px; font-size: 14px; line-height: 1.6; color: #52525b; text-align: center;">
189
190
  Hello <strong class="email-strong" style="color: #09090b;">${o}</strong>,
190
191
  </p>
@@ -211,11 +212,11 @@ Documentation: https://kyro-cms.com/docs`;return {subject:r,html:i,text:n}}chunk
211
212
  </td>
212
213
  </tr>
213
214
  </table>`:""}
214
- `,a=g({brand:e,title:"Password Updated",previewText:"Your Kyro CMS account password was updated.",bodyHtml:n,ctaText:"Account Security",ctaUrl:"https://kyro-cms.com"}),l=`Security Alert: Your Kyro CMS password was updated at ${i}.
215
+ `,a=c({brand:e,title:"Password Updated",previewText:"Your Kyro CMS account password was updated.",bodyHtml:n,ctaText:"Account Security",ctaUrl:"https://kyro-cms.com"}),l=`Security Alert: Your Kyro CMS password was updated at ${i}.
215
216
 
216
217
  If you did not make this change, please reset your password immediately.
217
218
 
218
- Kyro CMS \u2014 https://kyro-cms.com`;return {subject:s,html:a,text:l}}chunkBUNLC3II_cjs.h();function S(o,e,t="User",r){let s="Your one-time login link \u2014 Kyro CMS",i=`
219
+ Kyro CMS \u2014 https://kyro-cms.com`;return {subject:s,html:a,text:l}}function S(o,e,t="User",r){let s="Your one-time login link \u2014 Kyro CMS",i=`
219
220
  <p class="email-text" style="margin: 0 0 16px; font-size: 14px; line-height: 1.6; color: #52525b;">
220
221
  Hello <strong class="email-strong" style="color: #09090b;">${t}</strong>,
221
222
  </p>
@@ -241,7 +242,7 @@ Kyro CMS \u2014 https://kyro-cms.com`;return {subject:s,html:a,text:l}}chunkBUNL
241
242
  <p class="email-text" style="margin: 0 0 8px; font-size: 12px; color: #71717a;">
242
243
  This single-use link will expire in 10 minutes. Never share authentication links with anyone.
243
244
  </p>
244
- `,n=g({brand:r,title:"Sign in to Kyro CMS",previewText:"Your secure magic login link for Kyro CMS.",bodyHtml:i,ctaText:"Sign In Now",ctaUrl:o}),a=`Hello ${t},
245
+ `,n=c({brand:r,title:"Sign in to Kyro CMS",previewText:"Your secure magic login link for Kyro CMS.",bodyHtml:i,ctaText:"Sign In Now",ctaUrl:o}),a=`Hello ${t},
245
246
 
246
247
  Sign in to Kyro CMS using the link below:
247
248
  ${o}${e?`
@@ -250,7 +251,7 @@ Or enter code: ${e}`:""}
250
251
 
251
252
  This link expires in 10 minutes.
252
253
 
253
- Kyro CMS \u2014 https://kyro-cms.com`;return {subject:s,html:n,text:a}}chunkBUNLC3II_cjs.h();function C(o,e,t="User",r,s,i){let n="Security Alert: Account Temporarily Locked \u2014 Kyro CMS",a=`
254
+ Kyro CMS \u2014 https://kyro-cms.com`;return {subject:s,html:n,text:a}}function C(o,e,t="User",r,s,i){let n="Security Alert: Account Temporarily Locked \u2014 Kyro CMS",a=`
254
255
  <p class="email-text" style="margin: 0 0 16px; font-size: 14px; line-height: 1.6; color: #52525b; text-align: center;">
255
256
  Hello <strong class="email-strong" style="color: #09090b;">${t}</strong>,
256
257
  </p>
@@ -277,9 +278,9 @@ Kyro CMS \u2014 https://kyro-cms.com`;return {subject:s,html:n,text:a}}chunkBUNL
277
278
  </td>
278
279
  </tr>
279
280
  </table>`:""}
280
- `,l=g({brand:r,title:"Account Temporarily Locked",previewText:"Your Kyro CMS account was locked due to multiple failed login attempts.",bodyHtml:a,ctaText:"Unlock Instructions",ctaUrl:"https://kyro-cms.com/docs"}),p=`Security Alert: Account temporarily locked for ${t} after ${o} failed login attempts. Unlocks in ${e} minutes.
281
+ `,l=c({brand:r,title:"Account Temporarily Locked",previewText:"Your Kyro CMS account was locked due to multiple failed login attempts.",bodyHtml:a,ctaText:"Unlock Instructions",ctaUrl:"https://kyro-cms.com/docs"}),g=`Security Alert: Account temporarily locked for ${t} after ${o} failed login attempts. Unlocks in ${e} minutes.
281
282
 
282
- Kyro CMS \u2014 https://kyro-cms.com`;return {subject:n,html:l,text:p}}chunkBUNLC3II_cjs.h();function T(o,e="Editor",t="An Administrator",r){let s="You're invited to join Kyro CMS",i=`
283
+ Kyro CMS \u2014 https://kyro-cms.com`;return {subject:n,html:l,text:g}}function T(o,e="Editor",t="An Administrator",r){let s="You're invited to join Kyro CMS",i=`
283
284
  <p class="email-text" style="margin: 0 0 16px; font-size: 14px; line-height: 1.6; color: #52525b;">
284
285
  Hello,
285
286
  </p>
@@ -296,12 +297,12 @@ Kyro CMS \u2014 https://kyro-cms.com`;return {subject:n,html:l,text:p}}chunkBUNL
296
297
  </td>
297
298
  </tr>
298
299
  </table>
299
- `,n=g({brand:r,title:"Workspace Invitation",previewText:`You have been invited to join Kyro CMS as an ${e}.`,bodyHtml:i,ctaText:"Accept Invitation",ctaUrl:o,secondaryCtaText:"Documentation",secondaryCtaUrl:"https://kyro-cms.com/docs"}),a=`You're invited to join Kyro CMS as an ${e} by ${t}.
300
+ `,n=c({brand:r,title:"Workspace Invitation",previewText:`You have been invited to join Kyro CMS as an ${e}.`,bodyHtml:i,ctaText:"Accept Invitation",ctaUrl:o,secondaryCtaText:"Documentation",secondaryCtaUrl:"https://kyro-cms.com/docs"}),a=`You're invited to join Kyro CMS as an ${e} by ${t}.
300
301
 
301
302
  Accept your invitation here:
302
303
  ${o}
303
304
 
304
- Kyro CMS \u2014 https://kyro-cms.com`;return {subject:s,html:n,text:a}}chunkBUNLC3II_cjs.h();function k(o,e,t="User",r,s="Unknown Device"){let i="Security Alert: New Sign-in to Kyro CMS",n=`
305
+ Kyro CMS \u2014 https://kyro-cms.com`;return {subject:s,html:n,text:a}}function k(o,e,t="User",r,s="Unknown Device"){let i="Security Alert: New Sign-in to Kyro CMS",n=`
305
306
  <p class="email-text" style="margin: 0 0 16px; font-size: 14px; line-height: 1.6; color: #52525b; text-align: center;">
306
307
  Hello <strong class="email-strong" style="color: #09090b;">${t}</strong>,
307
308
  </p>
@@ -329,7 +330,7 @@ Kyro CMS \u2014 https://kyro-cms.com`;return {subject:s,html:n,text:a}}chunkBUNL
329
330
  </td>
330
331
  </tr>
331
332
  </table>
332
- `,a=g({brand:r,title:"New Sign-in Detected",previewText:"A new sign-in was detected on your Kyro CMS account.",bodyHtml:n,ctaText:"Review Account Security",ctaUrl:"https://kyro-cms.com"}),l=`Security Alert: New Sign-in to Kyro CMS
333
+ `,a=c({brand:r,title:"New Sign-in Detected",previewText:"A new sign-in was detected on your Kyro CMS account.",bodyHtml:n,ctaText:"Review Account Security",ctaUrl:"https://kyro-cms.com"}),l=`Security Alert: New Sign-in to Kyro CMS
333
334
 
334
335
  Hello ${t},
335
336
 
@@ -337,7 +338,7 @@ A new sign-in to your account was detected at ${e} from ${o} using ${s}.
337
338
 
338
339
  If you did not sign in recently, please reset your password immediately.
339
340
 
340
- Kyro CMS \u2014 https://kyro-cms.com`;return {subject:i,html:a,text:l}}chunkBUNLC3II_cjs.h();function E(o,e="Customer",t,r,s){let i=`Order confirmed #${o}`,n=`
341
+ Kyro CMS \u2014 https://kyro-cms.com`;return {subject:i,html:a,text:l}}function E(o,e="Customer",t,r,s){let i=`Order confirmed #${o}`,n=`
341
342
  <p class="email-text" style="margin: 0 0 14px; font-size: 14px; line-height: 1.6; color: #475569; text-align: center;">
342
343
  Hi ${e}, thanks for your order. We're getting your food freshly prepared.
343
344
  </p>
@@ -362,13 +363,13 @@ Kyro CMS \u2014 https://kyro-cms.com`;return {subject:i,html:a,text:l}}chunkBUNL
362
363
  <p style="margin: 0; font-size: 12px; color: #94a3b8; text-align: center; line-height: 1.5;">
363
364
  You can track the live preparation and delivery status anytime.
364
365
  </p>
365
- `,a=g({brand:s,title:"Order Confirmed",badge:"Order received",previewText:`Your order #${o} has been confirmed.`,bodyHtml:n,ctaText:"Track order live",ctaUrl:r||"https://lagosbukasantonio.com/track-order"}),l=`Hi ${e},
366
+ `,a=c({brand:s,title:"Order Confirmed",badge:"Order received",previewText:`Your order #${o} has been confirmed.`,bodyHtml:n,ctaText:"Track order live",ctaUrl:r||"https://lagosbukasantonio.com/track-order"}),l=`Hi ${e},
366
367
 
367
368
  Thank you for your order #${o}!
368
369
 
369
370
  Total: ${t}
370
371
 
371
- Track your order: ${r||"https://lagosbukasantonio.com"}`;return {subject:i,html:a,text:l}}chunkBUNLC3II_cjs.h();function v(o,e="Customer",t,r,s){let i=`Your Order #${o} is on the way!`,n=`
372
+ Track your order: ${r||"https://lagosbukasantonio.com"}`;return {subject:i,html:a,text:l}}function v(o,e="Customer",t,r,s){let i=`Your Order #${o} is on the way!`,n=`
372
373
  <p class="email-text" style="margin: 0 0 16px; font-size: 14px; line-height: 1.6; color: #52525b;">
373
374
  Great news, <strong class="email-strong" style="color: #09090b;">${e}</strong>!
374
375
  </p>
@@ -383,12 +384,12 @@ Track your order: ${r||"https://lagosbukasantonio.com"}`;return {subject:i,html:
383
384
  </td>
384
385
  </tr>
385
386
  </table>
386
- `,a=g({brand:s,title:"Order Shipped",previewText:`Your order #${o} has shipped. Track your package now.`,bodyHtml:n,ctaText:"Track Package",ctaUrl:r}),l=`Hi ${e},
387
+ `,a=c({brand:s,title:"Order Shipped",previewText:`Your order #${o} has shipped. Track your package now.`,bodyHtml:n,ctaText:"Track Package",ctaUrl:r}),l=`Hi ${e},
387
388
 
388
389
  Your order #${o} has been shipped!
389
390
 
390
391
  Tracking Number: ${t}
391
- Track it here: ${r}`;return {subject:i,html:a,text:l}}chunkBUNLC3II_cjs.h();function A(o,e="Customer",t,r){let s=`Your Order #${o} has been delivered`,i=`
392
+ Track it here: ${r}`;return {subject:i,html:a,text:l}}function A(o,e="Customer",t,r){let s=`Your Order #${o} has been delivered`,i=`
392
393
  <p class="email-text" style="margin: 0 0 16px; font-size: 14px; line-height: 1.6; color: #52525b;">
393
394
  Hi <strong class="email-strong" style="color: #09090b;">${e}</strong>,
394
395
  </p>
@@ -398,11 +399,11 @@ Track it here: ${r}`;return {subject:i,html:a,text:l}}chunkBUNLC3II_cjs.h();func
398
399
  <p class="email-text" style="margin: 0 0 20px; font-size: 14px; line-height: 1.6; color: #52525b;">
399
400
  We'd love to hear your thoughts. If you have a minute, please leave a review for your items.
400
401
  </p>
401
- `,n=g({brand:r,title:"Order Delivered",previewText:`Your order #${o} has arrived!`,bodyHtml:i,ctaText:"Leave a Review",ctaUrl:t}),a=`Hi ${e},
402
+ `,n=c({brand:r,title:"Order Delivered",previewText:`Your order #${o} has arrived!`,bodyHtml:i,ctaText:"Leave a Review",ctaUrl:t}),a=`Hi ${e},
402
403
 
403
404
  Your order #${o} has been delivered!
404
405
 
405
- Leave a review here: ${t}`;return {subject:s,html:n,text:a}}chunkBUNLC3II_cjs.h();function R(o,e="Customer",t,r){let s=`Refund Processed for Order #${o}`,i=`
406
+ Leave a review here: ${t}`;return {subject:s,html:n,text:a}}function R(o,e="Customer",t,r){let s=`Refund Processed for Order #${o}`,i=`
406
407
  <p class="email-text" style="margin: 0 0 16px; font-size: 14px; line-height: 1.6; color: #52525b;">
407
408
  Hi <strong class="email-strong" style="color: #09090b;">${e}</strong>,
408
409
  </p>
@@ -417,20 +418,20 @@ Leave a review here: ${t}`;return {subject:s,html:n,text:a}}chunkBUNLC3II_cjs.h(
417
418
  </td>
418
419
  </tr>
419
420
  </table>
420
- `,n=g({brand:r,title:"Refund Processed",previewText:`We have processed a refund of ${t} for order #${o}.`,bodyHtml:i,ctaText:"View Store",ctaUrl:"https://kyro-cms.com"}),a=`Hi ${e},
421
+ `,n=c({brand:r,title:"Refund Processed",previewText:`We have processed a refund of ${t} for order #${o}.`,bodyHtml:i,ctaText:"View Store",ctaUrl:"https://kyro-cms.com"}),a=`Hi ${e},
421
422
 
422
423
  We have processed a refund of ${t} for order #${o}.
423
424
 
424
- View store: https://kyro-cms.com`;return {subject:s,html:n,text:a}}chunkBUNLC3II_cjs.h();function I(o="Customer",e,t){let r="You left something behind...",s=`
425
+ View store: https://kyro-cms.com`;return {subject:s,html:n,text:a}}function I(o="Customer",e,t){let r="You left something behind...",s=`
425
426
  <p class="email-text" style="margin: 0 0 16px; font-size: 14px; line-height: 1.6; color: #52525b;">
426
427
  Hi <strong class="email-strong" style="color: #09090b;">${o}</strong>,
427
428
  </p>
428
429
  <p class="email-text" style="margin: 0 0 20px; font-size: 14px; line-height: 1.6; color: #52525b;">
429
430
  We noticed you left some great items in your shopping cart. They are still waiting for you, but they might sell out soon!
430
431
  </p>
431
- `,i=g({brand:t,title:"Complete Your Purchase",previewText:"Your shopping cart is waiting for you. Complete your purchase now.",bodyHtml:s,ctaText:"Return to Checkout",ctaUrl:e}),n=`Hi ${o},
432
+ `,i=c({brand:t,title:"Complete Your Purchase",previewText:"Your shopping cart is waiting for you. Complete your purchase now.",bodyHtml:s,ctaText:"Return to Checkout",ctaUrl:e}),n=`Hi ${o},
432
433
 
433
- You left some items in your cart! Complete your purchase here: ${e}`;return {subject:r,html:i,text:n}}function $(o){return {verifyEmail:(e,t)=>b(e,t,o),resetPassword:(e,t)=>x(e,t,o),welcome:(e,t)=>_(e,t,o),passwordChanged:e=>w(e,o),magicLink:(e,t,r)=>S(e,t,r,o),accountLocked:(e,t,r)=>C(e,t,r,o),newLogin:(e,t,r)=>k(e,t,r,o),userInvite:(e,t,r)=>T(e,t,r,o),orderConfirmation:(e,t,r,s)=>E(e,t,r||"0.00",s,o),orderShipped:(e,t,r,s)=>v(e,t,r||"",s||"",o),orderDelivered:(e,t,r)=>A(e,t,r||"",o),orderRefunded:(e,t,r)=>R(e,t,r||"0.00",o),abandonedCart:(e,t)=>I(e,t||"",o)}}chunkBUNLC3II_cjs.h();var O=false,y=class o{db;cache={};loaded=false;static SENSITIVE_KEYS=["storage.s3.secret_access_key","storage.r2.secret_access_key","storage.gcs.private_key","storage.backblaze.application_key","storage.wasabi.secret_access_key","storage.ftp.password","storage.bunny.api_key","storage.cloudinary.api_secret","storage.imgix.sign_key","email.smtp.pass","auth.jwt_secret","auth.github_secret","auth.google_secret","auth.app_secret","database.url","redis.url","auth.admin_password"];constructor(e){this.db=e;}async load(){if(!this.loaded){await this.ensureSettingsTable();try{if(typeof this.db?.select=="function"){let e=await this.db.select().from(chunkHPYH7GTS_cjs.a);this.cache=e.reduce((t,r)=>(t[r.key]=r.value,t),{});}await this.loadFromGlobals();}catch{console.warn("ConfigService: Could not load settings from database, using environment fallbacks.");}this.loaded=true;}}async ensureSettingsTable(){if(!O)try{if(typeof this.db?.execute=="function"){let{sql:e}=await import('./drizzle-orm-47ELDEM6.cjs');await this.db.execute(e`
434
+ You left some items in your cart! Complete your purchase here: ${e}`;return {subject:r,html:i,text:n}}function $(o){return {verifyEmail:(e,t)=>b(e,t,o),resetPassword:(e,t)=>x(e,t,o),welcome:(e,t)=>_(e,t,o),passwordChanged:e=>w(e,o),magicLink:(e,t,r)=>S(e,t,r,o),accountLocked:(e,t,r)=>C(e,t,r,o),newLogin:(e,t,r)=>k(e,t,r,o),userInvite:(e,t,r)=>T(e,t,r,o),orderConfirmation:(e,t,r,s)=>E(e,t,r||"0.00",s,o),orderShipped:(e,t,r,s)=>v(e,t,r||"",s||"",o),orderDelivered:(e,t,r)=>A(e,t,r||"",o),orderRefunded:(e,t,r)=>R(e,t,r||"0.00",o),abandonedCart:(e,t)=>I(e,t||"",o)}}var O=false,y=class o{db;cache={};loaded=false;static SENSITIVE_KEYS=["storage.s3.secret_access_key","storage.r2.secret_access_key","storage.gcs.private_key","storage.backblaze.application_key","storage.wasabi.secret_access_key","storage.ftp.password","storage.bunny.api_key","storage.cloudinary.api_secret","storage.imgix.sign_key","email.smtp.pass","auth.jwt_secret","auth.github_secret","auth.google_secret","auth.app_secret","database.url","redis.url","auth.admin_password"];constructor(e){this.db=e;}async load(){if(!this.loaded){await this.ensureSettingsTable();try{if(typeof this.db?.select=="function"){let e=await this.db.select().from(a);this.cache=e.reduce((t,r)=>(t[r.key]=r.value,t),{});}await this.loadFromGlobals();}catch{console.warn("ConfigService: Could not load settings from database, using environment fallbacks.");}this.loaded=true;}}async ensureSettingsTable(){if(!O)try{if(typeof this.db?.execute=="function"){let{sql:e}=await import('drizzle-orm');await this.db.execute(e`
434
435
  CREATE TABLE IF NOT EXISTS "settings" (
435
436
  "key" VARCHAR(255) PRIMARY KEY,
436
437
  "value" TEXT NOT NULL,
@@ -444,5 +445,5 @@ You left some items in your cart! Complete your purchase here: ${e}`;return {sub
444
445
  description TEXT,
445
446
  updated_at TEXT
446
447
  )
447
- `),O=!0);}catch{}}async loadFromGlobals(){try{let e=null;if(typeof this.db?.findOne=="function")try{let s=await this.db.findOne({collection:"_globals_storage-settings",where:{},draft:!0});s&&(e=s);}catch{}if(!e&&typeof this.db?.execute=="function"){let{sql:s}=await import('./drizzle-orm-47ELDEM6.cjs'),i=['"_globals_storage-settings"','"_globals_storage_settings"','"global_storage_settings"'];for(let n of i)try{let a=await this.db.execute(s`SELECT * FROM ${s.raw(n)} LIMIT 1`);if(e=Array.isArray(a)?a[0]:a?.rows?a.rows[0]:null,e)break}catch{}}else if(!e&&typeof this.db?.prepare=="function"){let s=['"_globals_storage-settings"','"_globals_storage_settings"','"global_storage_settings"'];for(let i of s)try{if(e=this.db.prepare(`SELECT * FROM ${i} LIMIT 1`).get(),e)break}catch{}}if(!e)return;let t=s=>{if(!s)return null;if(typeof s=="string")try{return JSON.parse(s)}catch{return null}return s},r=e.provider||"local";if(this.cache["storage.type"]=r,r==="local"){let s=t(e.local);this.cache["storage.local.dir"]=s?.uploadDir||"./public/uploads",this.cache["storage.local.url"]=s?.baseUrl||"/uploads";}if(r==="aws"){let s=t(e.aws);this.cache["storage.s3.bucket"]=s?.bucket||"",this.cache["storage.s3.region"]=s?.region||"us-east-1",this.cache["storage.s3.access_key_id"]=s?.accessKeyId||"",this.cache["storage.s3.secret_access_key"]=s?.secretAccessKey||"",this.cache["storage.s3.endpoint"]=s?.endpoint||"",this.cache["storage.s3.cdn_url"]=s?.cdnUrl||"",this.cache["storage.s3.prefix"]=s?.prefix||"";}if(r==="r2"){let s=t(e.r2);this.cache["storage.r2.account_id"]=s?.accountId||"",this.cache["storage.r2.access_key_id"]=s?.accessKeyId||"",this.cache["storage.r2.secret_access_key"]=s?.secretAccessKey||"",this.cache["storage.r2.bucket"]=s?.bucket||"",this.cache["storage.r2.cdn_url"]=s?.cdnUrl||"",this.cache["storage.r2.prefix"]=s?.prefix||"";}if(r==="cloudinary"){let s=t(e.cloudinary);this.cache["storage.cloudinary.cloud_name"]=s?.cloudName||"",this.cache["storage.cloudinary.api_key"]=s?.apiKey||"",this.cache["storage.cloudinary.api_secret"]=s?.apiSecret||"",this.cache["storage.cloudinary.folder"]=s?.folder||"";}if(r==="ftp"){let s=t(e.ftp);this.cache["storage.ftp.host"]=s?.host||"",this.cache["storage.ftp.port"]=String(s?.port||"21"),this.cache["storage.ftp.user"]=s?.user||"",this.cache["storage.ftp.password"]=s?.password||"",this.cache["storage.ftp.secure"]=s?.secure?"true":"false",this.cache["storage.ftp.base_url"]=s?.baseUrl||"",this.cache["storage.ftp.prefix"]=s?.prefix||"";}}catch(e){console.warn("ConfigService: Could not load storage settings from globals table:",e);}try{let e=null;if(typeof this.db?.findOne=="function")try{let t=await this.db.findOne({collection:"_globals_email-settings",where:{},draft:!0});t&&(e=t);}catch{}if(!e&&typeof this.db?.execute=="function"){let{sql:t}=await import('./drizzle-orm-47ELDEM6.cjs'),r=['"_globals_email-settings"','"_globals_email_settings"','"global_email_settings"'];for(let s of r)try{let i=await this.db.execute(t`SELECT * FROM ${t.raw(s)} LIMIT 1`);if(e=Array.isArray(i)?i[0]:i?.rows?i.rows[0]:null,e)break}catch{}}else if(!e&&typeof this.db?.prepare=="function"){let t=['"_globals_email-settings"','"_globals_email_settings"','"global_email_settings"'];for(let r of t)try{if(e=this.db.prepare(`SELECT * FROM ${r} LIMIT 1`).get(),e)break}catch{}}if(e){let t=r=>{if(!r)return null;if(typeof r=="string")try{return JSON.parse(r)}catch{return null}return r};if(this.cache["email.provider"]=e.provider||"smtp",this.cache["email.smtp.from"]=e.fromEmail||"",this.cache["email.smtp.from_name"]=e.fromName||"",this.cache["email.smtp.reply_to"]=e.replyTo||"",e.provider==="smtp"){let r=t(e.smtp);this.cache["email.smtp.host"]=r?.host||"",this.cache["email.smtp.port"]=String(r?.port||"587"),this.cache["email.smtp.user"]=r?.username||"",this.cache["email.smtp.pass"]=r?.password||"",this.cache["email.smtp.secure"]=r?.secure?"true":"false";}else if(e.provider==="resend"){let r=t(e.resend);this.cache["email.smtp.pass"]=r?.apiKey||"";}else if(e.provider==="sendgrid"){let r=t(e.sendgrid);this.cache["email.smtp.pass"]=r?.apiKey||"";}else if(e.provider==="mailgun"){let r=t(e.mailgun);this.cache["email.smtp.pass"]=r?.apiKey||"";}else if(e.provider==="ses"){let r=t(e.ses);this.cache["email.smtp.user"]=r?.accessKeyId||"",this.cache["email.smtp.pass"]=r?.secretAccessKey||"";}}}catch(e){console.warn("ConfigService: Could not load email settings from globals table:",e);}}get(e,t,r){return this.cache[e]?this.cache[e]:t&&process.env[t]?process.env[t]:r}getStorageConfig(){let e="local";return typeof globalThis.STORAGE_BUCKET<"u"&&(e="cloudflare_r2"),{type:this.get("storage.type","STORAGE_TYPE",e),s3:{bucket:this.get("storage.s3.bucket","STORAGE_BUCKET"),region:this.get("storage.s3.region","STORAGE_REGION","us-east-1"),accessKeyId:this.get("storage.s3.access_key_id","STORAGE_ACCESS_KEY_ID"),secretAccessKey:this.get("storage.s3.secret_access_key","STORAGE_SECRET_ACCESS_KEY"),endpoint:this.get("storage.s3.endpoint","STORAGE_ENDPOINT"),cdnUrl:this.get("storage.s3.cdn_url","STORAGE_CDN_URL"),prefix:this.get("storage.s3.prefix","STORAGE_PREFIX")},r2:{accountId:this.get("storage.r2.account_id","R2_ACCOUNT_ID"),accessKeyId:this.get("storage.r2.access_key_id","R2_ACCESS_KEY_ID"),secretAccessKey:this.get("storage.r2.secret_access_key","R2_SECRET_ACCESS_KEY"),bucket:this.get("storage.r2.bucket","R2_BUCKET"),cdnUrl:this.get("storage.r2.cdn_url","R2_CDN_URL"),prefix:this.get("storage.r2.prefix","R2_PREFIX")},gcs:{bucket:this.get("storage.gcs.bucket","GCS_BUCKET"),projectId:this.get("storage.gcs.project_id","GCS_PROJECT_ID"),clientEmail:this.get("storage.gcs.client_email","GCS_CLIENT_EMAIL"),privateKey:this.get("storage.gcs.private_key","GCS_PRIVATE_KEY"),cdnUrl:this.get("storage.gcs.cdn_url","GCS_CDN_URL"),prefix:this.get("storage.gcs.prefix","GCS_PREFIX")},digitalocean:{bucket:this.get("storage.digitalocean.bucket","DO_BUCKET"),region:this.get("storage.digitalocean.region","DO_REGION","nyc3"),accessKeyId:this.get("storage.digitalocean.access_key_id","DO_ACCESS_KEY_ID"),secretAccessKey:this.get("storage.digitalocean.secret_access_key","DO_SECRET_ACCESS_KEY"),cdnUrl:this.get("storage.digitalocean.cdn_url","DO_CDN_URL"),prefix:this.get("storage.digitalocean.prefix","DO_PREFIX")},backblaze:{bucket:this.get("storage.backblaze.bucket","BB_BUCKET"),accountId:this.get("storage.backblaze.account_id","BB_ACCOUNT_ID"),applicationKeyId:this.get("storage.backblaze.application_key_id","BB_APPLICATION_KEY_ID"),applicationKey:this.get("storage.backblaze.application_key","BB_APPLICATION_KEY"),cdnUrl:this.get("storage.backblaze.cdn_url","BB_CDN_URL"),prefix:this.get("storage.backblaze.prefix","BB_PREFIX")},wasabi:{bucket:this.get("storage.wasabi.bucket","WASABI_BUCKET"),region:this.get("storage.wasabi.region","WASABI_REGION","us-east-1"),accessKeyId:this.get("storage.wasabi.access_key_id","WASABI_ACCESS_KEY_ID"),secretAccessKey:this.get("storage.wasabi.secret_access_key","WASABI_SECRET_ACCESS_KEY"),cdnUrl:this.get("storage.wasabi.cdn_url","WASABI_CDN_URL"),prefix:this.get("storage.wasabi.prefix","WASABI_PREFIX")},bunny:{storageZone:this.get("storage.bunny.storage_zone","BUNNY_STORAGE_ZONE"),apiKey:this.get("storage.bunny.api_key","BUNNY_API_KEY"),cdnUrl:this.get("storage.bunny.cdn_url","BUNNY_CDN_URL"),prefix:this.get("storage.bunny.prefix","BUNNY_PREFIX")},ftp:{host:this.get("storage.ftp.host","FTP_HOST"),port:parseInt(this.get("storage.ftp.port","FTP_PORT","21"),10),user:this.get("storage.ftp.user","FTP_USER"),password:this.get("storage.ftp.password","FTP_PASSWORD"),secure:this.get("storage.ftp.secure","FTP_SECURE")==="true",baseUrl:this.get("storage.ftp.base_url","FTP_BASE_URL"),prefix:this.get("storage.ftp.prefix","FTP_PREFIX")},cloudinary:{cloudName:this.get("storage.cloudinary.cloud_name","CLOUDINARY_CLOUD_NAME"),apiKey:this.get("storage.cloudinary.api_key","CLOUDINARY_API_KEY"),apiSecret:this.get("storage.cloudinary.api_secret","CLOUDINARY_API_SECRET"),folder:this.get("storage.cloudinary.folder","CLOUDINARY_FOLDER")},imgix:{domain:this.get("storage.imgix.domain","IMGIX_DOMAIN"),signKey:this.get("storage.imgix.sign_key","IMGIX_SIGN_KEY")},local:{uploadDir:this.get("storage.local.dir","STORAGE_LOCAL_DIR","./public/uploads"),baseUrl:this.get("storage.local.url","STORAGE_LOCAL_URL","/uploads")}}}getEmailConfig(){return {provider:this.get("email.provider","EMAIL_PROVIDER","smtp"),host:this.get("email.smtp.host","SMTP_HOST"),port:parseInt(this.get("email.smtp.port","SMTP_PORT","587"),10),secure:this.get("email.smtp.secure","SMTP_SECURE")==="true",user:this.get("email.smtp.user","SMTP_USER"),pass:this.get("email.smtp.pass","SMTP_PASS"),from:this.get("email.smtp.from","SMTP_FROM","noreply@example.com"),fromName:this.get("email.smtp.from_name","SMTP_FROM_NAME","Kyro CMS"),replyTo:this.get("email.smtp.reply_to","SMTP_REPLY_TO")}}maskSensitive(e,t){return t&&(o.SENSITIVE_KEYS.includes(e)?"********":t)}async set(e,t,r){await this.db.insert(chunkHPYH7GTS_cjs.a).values({key:e,value:t,description:r,updatedAt:new Date}).onConflictDoUpdate({target:[chunkHPYH7GTS_cjs.a.key],set:{value:t,description:r,updatedAt:new Date}}),this.cache[e]=t;}};var U=class o{transporter;config;templates;transporterInitialized=false;constructor(e,t){this.config=e,this.templates={...$(e.brand),...t};}async ensureTransporter(){if(this.transporterInitialized)return this.transporter;let{default:e}=await import('./nodemailer-IDML4L6W.cjs');return this.config.provider==="smtp"&&this.config.smtp?this.transporter=e.createTransport({host:this.config.smtp.host,port:this.config.smtp.port,secure:this.config.smtp.secure,auth:this.config.smtp.auth}):this.config.provider==="ses"&&this.config.ses&&(this.transporter=e.createTransport({host:`email-smtp.${this.config.ses.region}.amazonaws.com`,port:587,secure:false,auth:{user:this.config.ses.accessKeyId,pass:this.config.ses.secretAccessKey}})),this.transporterInitialized=true,this.transporter}async send(e){let{provider:t,from:r,fromName:s,replyTo:i}=this.config,n=`"${s||"Kyro CMS"}" <${r}>`,a=e.replyTo||i;try{let l;switch(t){case "smtp":case "ses":{let p=await this.ensureTransporter();if(!p)throw new Error(`${t} transporter not initialized`);l=await p.sendMail({from:n,to:Array.isArray(e.to)?e.to.join(", "):e.to,subject:e.subject,html:e.html,text:e.text,replyTo:a});}break;case "resend":l=await this.sendViaResend(n,e,a);break;case "sendgrid":l=await this.sendViaSendGrid(n,e,a);break;case "mailgun":l=await this.sendViaMailgun(n,e,a);break;default:throw new Error(`Unsupported email provider: ${t}`)}return l}catch(l){throw console.error("[EmailTransport] FAILED to send email:",l.message),l.response&&console.error("[EmailTransport] Provider Error Detail:",JSON.stringify(l.response,null,2)),l}}async sendViaResend(e,t,r){let s=this.config.resend?.apiKey;if(!s)throw new Error("Resend API Key missing");let i={from:e,to:t.to,subject:t.subject,html:t.html,text:t.text,reply_to:r},n=await fetch("https://api.resend.com/emails",{method:"POST",headers:{Authorization:`Bearer ${s}`,"Content-Type":"application/json"},body:JSON.stringify(i)});if(!n.ok){let a=await n.json();throw new Error(`Resend Error: ${JSON.stringify(a)}`)}return n.json()}async sendViaSendGrid(e,t,r){let s=this.config.sendgrid?.apiKey;if(!s)throw new Error("SendGrid API Key missing");let i={personalizations:[{to:Array.isArray(t.to)?t.to.map(a=>({email:a})):[{email:t.to}]}],from:{email:e.match(/<(.+)>/)?.[1]||e,name:e.match(/"(.+)"/)?.[1]},subject:t.subject,content:[{type:"text/plain",value:t.text||""},{type:"text/html",value:t.html}],reply_to:r?{email:r}:void 0},n=await fetch("https://api.sendgrid.com/v3/mail/send",{method:"POST",headers:{Authorization:`Bearer ${s}`,"Content-Type":"application/json"},body:JSON.stringify(i)});if(!n.ok){let a=await n.json();throw new Error(`SendGrid Error: ${JSON.stringify(a)}`)}return {success:true}}async sendViaMailgun(e,t,r){let{apiKey:s,domain:i,region:n}=this.config.mailgun||{};if(!s||!i)throw new Error("Mailgun config missing");let a=n==="eu"?"api.eu.mailgun.net":"api.mailgun.net",l=btoa(`api:${s}`),p=new URLSearchParams;p.append("from",e);let f=Array.isArray(t.to)?t.to.join(", "):t.to;p.append("to",f),p.append("subject",t.subject),p.append("html",t.html),t.text&&p.append("text",t.text),r&&p.append("h:Reply-To",r);let m=await fetch(`https://${a}/v3/${i}/messages`,{method:"POST",headers:{Authorization:`Basic ${l}`,"Content-Type":"application/x-www-form-urlencoded"},body:p});if(!m.ok){let u=await m.json();throw new Error(`Mailgun Error: ${JSON.stringify(u)}`)}return m.json()}getTemplates(){return this.templates}async verifyConnection(){if(this.config.provider==="smtp"||this.config.provider==="ses")try{let e=await this.ensureTransporter();if(e)return await e.verify(),!0}catch{return false}return !!(this.config.resend?.apiKey||this.config.sendgrid?.apiKey||this.config.mailgun?.apiKey)}static async fetchBrandConfig(e){let t="Kyro CMS",r="https://kyro-cms.com/logo.svg",s="https://kyro-cms.com/logo-white.svg";try{let i=null,n=null;if(typeof e?.findOne=="function")i=await e.findOne({collection:"_globals_store-settings",where:{},draft:!0}),n=await e.findOne({collection:"_globals_brand-settings",where:{},draft:!0});else if(typeof e?.execute=="function"){let{sql:a}=await import('./drizzle-orm-47ELDEM6.cjs');try{let l=await e.execute(a`SELECT * FROM "_globals_store-settings" LIMIT 1`);i=Array.isArray(l)?l[0]:l?.rows?l.rows[0]:null;}catch{}try{let l=await e.execute(a`SELECT * FROM "_globals_brand-settings" LIMIT 1`);n=Array.isArray(l)?l[0]:l?.rows?l.rows[0]:null;}catch{}}else if(typeof e?.prepare=="function"){try{i=e.prepare('SELECT * FROM "_globals_store-settings" LIMIT 1').get();}catch{}try{n=e.prepare('SELECT * FROM "_globals_brand-settings" LIMIT 1').get();}catch{}}if(i?.storeName&&(t=i.storeName),n?.identity){let a=typeof n.identity=="string"?JSON.parse(n.identity):n.identity,l=async p=>{if(typeof e?.findOne=="function")return (await e.findOne({collection:"media",where:{id:{equals:p}}}))?.url;if(typeof e?.execute=="function"){let{sql:f}=await import('./drizzle-orm-47ELDEM6.cjs');try{let m=await e.execute(f`SELECT url FROM "media" WHERE id = ${p}`);return (Array.isArray(m)?m[0]:m?.rows?m.rows[0]:null)?.url}catch{}}else if(typeof e?.prepare=="function")try{return e.prepare('SELECT url FROM "media" WHERE id = ?').get(p)?.url}catch{}};if(a.primaryLogo){let p=await l(a.primaryLogo);p&&(r=p);}if(a.darkLogo){let p=await l(a.darkLogo);p&&(s=p);}}}catch{}return {siteName:t,logoUrl:r,logoDarkUrl:s,appUrl:process.env.PUBLIC_URL||"https://kyro-cms.com"}}static async fromConfig(e){let t=new y(e);await t.load();let r=t.getEmailConfig();if(!r.provider)return this.fromEnv();let i={brand:await this.fetchBrandConfig(e),provider:r.provider||"smtp",from:r.from||"noreply@example.com",fromName:r.fromName,replyTo:r.replyTo,smtp:r.provider==="smtp"?{host:r.host||"",port:r.port||587,secure:r.secure||false,auth:{user:r.user||"",pass:r.pass||""}}:void 0,resend:r.provider==="resend"?{apiKey:r.pass||""}:void 0,sendgrid:r.provider==="sendgrid"?{apiKey:r.pass||""}:void 0,mailgun:r.provider==="mailgun"?{apiKey:r.pass||"",domain:r.host||"",region:r.secure?"eu":"us"}:void 0,ses:r.provider==="ses"?{accessKeyId:r.user||"",secretAccessKey:r.pass||"",region:r.host||"us-east-1"}:void 0};return new o(i)}static fromEnv(){let e=process.env.EMAIL_PROVIDER||"smtp",t=process.env.SMTP_FROM||process.env.DEFAULT_FROM||"noreply@example.com",r=process.env.SMTP_FROM_NAME||"Kyro CMS",s=process.env.SMTP_REPLY_TO;if(e==="smtp"){let i=process.env.SMTP_HOST,n=process.env.SMTP_USER,a=process.env.SMTP_PASS;return !i||!n||!a?null:new o({provider:"smtp",from:t,fromName:r,replyTo:s,smtp:{host:i,port:parseInt(process.env.SMTP_PORT||"587",10),secure:process.env.SMTP_SECURE==="true",auth:{user:n,pass:a}}})}if(e==="resend"){let i=process.env.RESEND_API_KEY||process.env.SMTP_PASS;return i?new o({provider:"resend",from:t,fromName:r,replyTo:s,resend:{apiKey:i}}):null}if(e==="sendgrid"){let i=process.env.SENDGRID_API_KEY||process.env.SMTP_PASS;return i?new o({provider:"sendgrid",from:t,fromName:r,replyTo:s,sendgrid:{apiKey:i}}):null}if(e==="mailgun"){let i=process.env.MAILGUN_API_KEY||process.env.SMTP_PASS,n=process.env.MAILGUN_DOMAIN||process.env.SMTP_HOST;return !i||!n?null:new o({provider:"mailgun",from:t,fromName:r,replyTo:s,mailgun:{apiKey:i,domain:n,region:process.env.MAILGUN_REGION||(process.env.SMTP_SECURE==="true"?"eu":"us")}})}if(e==="ses"){let i=process.env.AWS_ACCESS_KEY_ID||process.env.SMTP_USER,n=process.env.AWS_SECRET_ACCESS_KEY||process.env.SMTP_PASS,a=process.env.AWS_REGION||process.env.SMTP_HOST||"us-east-1";return !i||!n?null:new o({provider:"ses",from:t,fromName:r,replyTo:s,ses:{accessKeyId:i,secretAccessKey:n,region:a}})}return null}};
448
- exports.a=g;exports.b=b;exports.c=x;exports.d=_;exports.e=w;exports.f=S;exports.g=C;exports.h=T;exports.i=k;exports.j=E;exports.k=v;exports.l=A;exports.m=R;exports.n=I;exports.o=$;exports.p=y;exports.q=U;
448
+ `),O=!0);}catch{}}async loadFromGlobals(){try{let e=null;if(typeof this.db?.findOne=="function")try{let s=await this.db.findOne({collection:"_globals_storage-settings",where:{},draft:!0});s&&(e=s);}catch{}if(!e&&typeof this.db?.execute=="function"){let{sql:s}=await import('drizzle-orm'),i=['"_globals_storage-settings"','"_globals_storage_settings"','"global_storage_settings"'];for(let n of i)try{let a=await this.db.execute(s`SELECT * FROM ${s.raw(n)} LIMIT 1`);if(e=Array.isArray(a)?a[0]:a?.rows?a.rows[0]:null,e)break}catch{}}else if(!e&&typeof this.db?.prepare=="function"){let s=['"_globals_storage-settings"','"_globals_storage_settings"','"global_storage_settings"'];for(let i of s)try{if(e=this.db.prepare(`SELECT * FROM ${i} LIMIT 1`).get(),e)break}catch{}}if(!e)return;let t=s=>{if(!s)return null;if(typeof s=="string")try{return JSON.parse(s)}catch{return null}return s},r=e.provider||"local";if(this.cache["storage.type"]=r,r==="local"){let s=t(e.local);this.cache["storage.local.dir"]=s?.uploadDir||"./public/uploads",this.cache["storage.local.url"]=s?.baseUrl||"/uploads";}if(r==="aws"){let s=t(e.aws);this.cache["storage.s3.bucket"]=s?.bucket||"",this.cache["storage.s3.region"]=s?.region||"us-east-1",this.cache["storage.s3.access_key_id"]=s?.accessKeyId||"",this.cache["storage.s3.secret_access_key"]=s?.secretAccessKey||"",this.cache["storage.s3.endpoint"]=s?.endpoint||"",this.cache["storage.s3.cdn_url"]=s?.cdnUrl||"",this.cache["storage.s3.prefix"]=s?.prefix||"";}if(r==="r2"){let s=t(e.r2);this.cache["storage.r2.account_id"]=s?.accountId||"",this.cache["storage.r2.access_key_id"]=s?.accessKeyId||"",this.cache["storage.r2.secret_access_key"]=s?.secretAccessKey||"",this.cache["storage.r2.bucket"]=s?.bucket||"",this.cache["storage.r2.cdn_url"]=s?.cdnUrl||"",this.cache["storage.r2.prefix"]=s?.prefix||"";}if(r==="cloudinary"){let s=t(e.cloudinary);this.cache["storage.cloudinary.cloud_name"]=s?.cloudName||"",this.cache["storage.cloudinary.api_key"]=s?.apiKey||"",this.cache["storage.cloudinary.api_secret"]=s?.apiSecret||"",this.cache["storage.cloudinary.folder"]=s?.folder||"";}if(r==="ftp"){let s=t(e.ftp);this.cache["storage.ftp.host"]=s?.host||"",this.cache["storage.ftp.port"]=String(s?.port||"21"),this.cache["storage.ftp.user"]=s?.user||"",this.cache["storage.ftp.password"]=s?.password||"",this.cache["storage.ftp.secure"]=s?.secure?"true":"false",this.cache["storage.ftp.base_url"]=s?.baseUrl||"",this.cache["storage.ftp.prefix"]=s?.prefix||"";}}catch(e){console.warn("ConfigService: Could not load storage settings from globals table:",e);}try{let e=null;if(typeof this.db?.findOne=="function")try{let t=await this.db.findOne({collection:"_globals_email-settings",where:{},draft:!0});t&&(e=t);}catch{}if(!e&&typeof this.db?.execute=="function"){let{sql:t}=await import('drizzle-orm'),r=['"_globals_email-settings"','"_globals_email_settings"','"global_email_settings"'];for(let s of r)try{let i=await this.db.execute(t`SELECT * FROM ${t.raw(s)} LIMIT 1`);if(e=Array.isArray(i)?i[0]:i?.rows?i.rows[0]:null,e)break}catch{}}else if(!e&&typeof this.db?.prepare=="function"){let t=['"_globals_email-settings"','"_globals_email_settings"','"global_email_settings"'];for(let r of t)try{if(e=this.db.prepare(`SELECT * FROM ${r} LIMIT 1`).get(),e)break}catch{}}if(e){let t=r=>{if(!r)return null;if(typeof r=="string")try{return JSON.parse(r)}catch{return null}return r};if(this.cache["email.provider"]=e.provider||"smtp",this.cache["email.smtp.from"]=e.fromEmail||"",this.cache["email.smtp.from_name"]=e.fromName||"",this.cache["email.smtp.reply_to"]=e.replyTo||"",e.provider==="smtp"){let r=t(e.smtp);this.cache["email.smtp.host"]=r?.host||"",this.cache["email.smtp.port"]=String(r?.port||"587"),this.cache["email.smtp.user"]=r?.username||"",this.cache["email.smtp.pass"]=r?.password||"",this.cache["email.smtp.secure"]=r?.secure?"true":"false";}else if(e.provider==="resend"){let r=t(e.resend);this.cache["email.smtp.pass"]=r?.apiKey||"";}else if(e.provider==="sendgrid"){let r=t(e.sendgrid);this.cache["email.smtp.pass"]=r?.apiKey||"";}else if(e.provider==="mailgun"){let r=t(e.mailgun);this.cache["email.smtp.pass"]=r?.apiKey||"";}else if(e.provider==="ses"){let r=t(e.ses);this.cache["email.smtp.user"]=r?.accessKeyId||"",this.cache["email.smtp.pass"]=r?.secretAccessKey||"";}}}catch(e){console.warn("ConfigService: Could not load email settings from globals table:",e);}}get(e,t,r){return this.cache[e]?this.cache[e]:t&&process.env[t]?process.env[t]:r}getStorageConfig(){let e="local";return typeof globalThis.STORAGE_BUCKET<"u"&&(e="cloudflare_r2"),{type:this.get("storage.type","STORAGE_TYPE",e),s3:{bucket:this.get("storage.s3.bucket","STORAGE_BUCKET"),region:this.get("storage.s3.region","STORAGE_REGION","us-east-1"),accessKeyId:this.get("storage.s3.access_key_id","STORAGE_ACCESS_KEY_ID"),secretAccessKey:this.get("storage.s3.secret_access_key","STORAGE_SECRET_ACCESS_KEY"),endpoint:this.get("storage.s3.endpoint","STORAGE_ENDPOINT"),cdnUrl:this.get("storage.s3.cdn_url","STORAGE_CDN_URL"),prefix:this.get("storage.s3.prefix","STORAGE_PREFIX")},r2:{accountId:this.get("storage.r2.account_id","R2_ACCOUNT_ID"),accessKeyId:this.get("storage.r2.access_key_id","R2_ACCESS_KEY_ID"),secretAccessKey:this.get("storage.r2.secret_access_key","R2_SECRET_ACCESS_KEY"),bucket:this.get("storage.r2.bucket","R2_BUCKET"),cdnUrl:this.get("storage.r2.cdn_url","R2_CDN_URL"),prefix:this.get("storage.r2.prefix","R2_PREFIX")},gcs:{bucket:this.get("storage.gcs.bucket","GCS_BUCKET"),projectId:this.get("storage.gcs.project_id","GCS_PROJECT_ID"),clientEmail:this.get("storage.gcs.client_email","GCS_CLIENT_EMAIL"),privateKey:this.get("storage.gcs.private_key","GCS_PRIVATE_KEY"),cdnUrl:this.get("storage.gcs.cdn_url","GCS_CDN_URL"),prefix:this.get("storage.gcs.prefix","GCS_PREFIX")},digitalocean:{bucket:this.get("storage.digitalocean.bucket","DO_BUCKET"),region:this.get("storage.digitalocean.region","DO_REGION","nyc3"),accessKeyId:this.get("storage.digitalocean.access_key_id","DO_ACCESS_KEY_ID"),secretAccessKey:this.get("storage.digitalocean.secret_access_key","DO_SECRET_ACCESS_KEY"),cdnUrl:this.get("storage.digitalocean.cdn_url","DO_CDN_URL"),prefix:this.get("storage.digitalocean.prefix","DO_PREFIX")},backblaze:{bucket:this.get("storage.backblaze.bucket","BB_BUCKET"),accountId:this.get("storage.backblaze.account_id","BB_ACCOUNT_ID"),applicationKeyId:this.get("storage.backblaze.application_key_id","BB_APPLICATION_KEY_ID"),applicationKey:this.get("storage.backblaze.application_key","BB_APPLICATION_KEY"),cdnUrl:this.get("storage.backblaze.cdn_url","BB_CDN_URL"),prefix:this.get("storage.backblaze.prefix","BB_PREFIX")},wasabi:{bucket:this.get("storage.wasabi.bucket","WASABI_BUCKET"),region:this.get("storage.wasabi.region","WASABI_REGION","us-east-1"),accessKeyId:this.get("storage.wasabi.access_key_id","WASABI_ACCESS_KEY_ID"),secretAccessKey:this.get("storage.wasabi.secret_access_key","WASABI_SECRET_ACCESS_KEY"),cdnUrl:this.get("storage.wasabi.cdn_url","WASABI_CDN_URL"),prefix:this.get("storage.wasabi.prefix","WASABI_PREFIX")},bunny:{storageZone:this.get("storage.bunny.storage_zone","BUNNY_STORAGE_ZONE"),apiKey:this.get("storage.bunny.api_key","BUNNY_API_KEY"),cdnUrl:this.get("storage.bunny.cdn_url","BUNNY_CDN_URL"),prefix:this.get("storage.bunny.prefix","BUNNY_PREFIX")},ftp:{host:this.get("storage.ftp.host","FTP_HOST"),port:parseInt(this.get("storage.ftp.port","FTP_PORT","21"),10),user:this.get("storage.ftp.user","FTP_USER"),password:this.get("storage.ftp.password","FTP_PASSWORD"),secure:this.get("storage.ftp.secure","FTP_SECURE")==="true",baseUrl:this.get("storage.ftp.base_url","FTP_BASE_URL"),prefix:this.get("storage.ftp.prefix","FTP_PREFIX")},cloudinary:{cloudName:this.get("storage.cloudinary.cloud_name","CLOUDINARY_CLOUD_NAME"),apiKey:this.get("storage.cloudinary.api_key","CLOUDINARY_API_KEY"),apiSecret:this.get("storage.cloudinary.api_secret","CLOUDINARY_API_SECRET"),folder:this.get("storage.cloudinary.folder","CLOUDINARY_FOLDER")},imgix:{domain:this.get("storage.imgix.domain","IMGIX_DOMAIN"),signKey:this.get("storage.imgix.sign_key","IMGIX_SIGN_KEY")},local:{uploadDir:this.get("storage.local.dir","STORAGE_LOCAL_DIR","./public/uploads"),baseUrl:this.get("storage.local.url","STORAGE_LOCAL_URL","/uploads")}}}getEmailConfig(){return {provider:this.get("email.provider","EMAIL_PROVIDER","smtp"),host:this.get("email.smtp.host","SMTP_HOST"),port:parseInt(this.get("email.smtp.port","SMTP_PORT","587"),10),secure:this.get("email.smtp.secure","SMTP_SECURE")==="true",user:this.get("email.smtp.user","SMTP_USER"),pass:this.get("email.smtp.pass","SMTP_PASS"),from:this.get("email.smtp.from","SMTP_FROM","noreply@example.com"),fromName:this.get("email.smtp.from_name","SMTP_FROM_NAME","Kyro CMS"),replyTo:this.get("email.smtp.reply_to","SMTP_REPLY_TO")}}maskSensitive(e,t){return t&&(o.SENSITIVE_KEYS.includes(e)?"********":t)}async set(e,t,r){await this.db.insert(a).values({key:e,value:t,description:r,updatedAt:new Date}).onConflictDoUpdate({target:[a.key],set:{value:t,description:r,updatedAt:new Date}}),this.cache[e]=t;}};var U=class o{transporter;config;templates;transporterInitialized=false;constructor(e,t){this.config=e,this.templates={...$(e.brand),...t};}async ensureTransporter(){if(this.transporterInitialized)return this.transporter;let{default:e}=await import('nodemailer');return this.config.provider==="smtp"&&this.config.smtp?this.transporter=e.createTransport({host:this.config.smtp.host,port:this.config.smtp.port,secure:this.config.smtp.secure,auth:this.config.smtp.auth}):this.config.provider==="ses"&&this.config.ses&&(this.transporter=e.createTransport({host:`email-smtp.${this.config.ses.region}.amazonaws.com`,port:587,secure:false,auth:{user:this.config.ses.accessKeyId,pass:this.config.ses.secretAccessKey}})),this.transporterInitialized=true,this.transporter}async send(e){let{provider:t,from:r,fromName:s,replyTo:i}=this.config,n=`"${s||"Kyro CMS"}" <${r}>`,a=e.replyTo||i;try{let l;switch(t){case "smtp":case "ses":{let g=await this.ensureTransporter();if(!g)throw new Error(`${t} transporter not initialized`);l=await g.sendMail({from:n,to:Array.isArray(e.to)?e.to.join(", "):e.to,subject:e.subject,html:e.html,text:e.text,replyTo:a});}break;case "resend":l=await this.sendViaResend(n,e,a);break;case "sendgrid":l=await this.sendViaSendGrid(n,e,a);break;case "mailgun":l=await this.sendViaMailgun(n,e,a);break;default:throw new Error(`Unsupported email provider: ${t}`)}return l}catch(l){throw console.error("[EmailTransport] FAILED to send email:",l.message),l.response&&console.error("[EmailTransport] Provider Error Detail:",JSON.stringify(l.response,null,2)),l}}async sendViaResend(e,t,r){let s=this.config.resend?.apiKey;if(!s)throw new Error("Resend API Key missing");let i={from:e,to:t.to,subject:t.subject,html:t.html,text:t.text,reply_to:r},n=await fetch("https://api.resend.com/emails",{method:"POST",headers:{Authorization:`Bearer ${s}`,"Content-Type":"application/json"},body:JSON.stringify(i)});if(!n.ok){let a=await n.json();throw new Error(`Resend Error: ${JSON.stringify(a)}`)}return n.json()}async sendViaSendGrid(e,t,r){let s=this.config.sendgrid?.apiKey;if(!s)throw new Error("SendGrid API Key missing");let i={personalizations:[{to:Array.isArray(t.to)?t.to.map(a=>({email:a})):[{email:t.to}]}],from:{email:e.match(/<(.+)>/)?.[1]||e,name:e.match(/"(.+)"/)?.[1]},subject:t.subject,content:[{type:"text/plain",value:t.text||""},{type:"text/html",value:t.html}],reply_to:r?{email:r}:void 0},n=await fetch("https://api.sendgrid.com/v3/mail/send",{method:"POST",headers:{Authorization:`Bearer ${s}`,"Content-Type":"application/json"},body:JSON.stringify(i)});if(!n.ok){let a=await n.json();throw new Error(`SendGrid Error: ${JSON.stringify(a)}`)}return {success:true}}async sendViaMailgun(e,t,r){let{apiKey:s,domain:i,region:n}=this.config.mailgun||{};if(!s||!i)throw new Error("Mailgun config missing");let a=n==="eu"?"api.eu.mailgun.net":"api.mailgun.net",l=btoa(`api:${s}`),g=new URLSearchParams;g.append("from",e);let f=Array.isArray(t.to)?t.to.join(", "):t.to;g.append("to",f),g.append("subject",t.subject),g.append("html",t.html),t.text&&g.append("text",t.text),r&&g.append("h:Reply-To",r);let m=await fetch(`https://${a}/v3/${i}/messages`,{method:"POST",headers:{Authorization:`Basic ${l}`,"Content-Type":"application/x-www-form-urlencoded"},body:g});if(!m.ok){let u=await m.json();throw new Error(`Mailgun Error: ${JSON.stringify(u)}`)}return m.json()}getTemplates(){return this.templates}async verifyConnection(){if(this.config.provider==="smtp"||this.config.provider==="ses")try{let e=await this.ensureTransporter();if(e)return await e.verify(),!0}catch{return false}return !!(this.config.resend?.apiKey||this.config.sendgrid?.apiKey||this.config.mailgun?.apiKey)}static async fetchBrandConfig(e){let t="Kyro CMS",r="https://kyro-cms.com/logo.svg",s="https://kyro-cms.com/logo-white.svg";try{let i=null,n=null;if(typeof e?.findOne=="function")i=await e.findOne({collection:"_globals_store-settings",where:{},draft:!0}),n=await e.findOne({collection:"_globals_brand-settings",where:{},draft:!0});else if(typeof e?.execute=="function"){let{sql:a}=await import('drizzle-orm');try{let l=await e.execute(a`SELECT * FROM "_globals_store-settings" LIMIT 1`);i=Array.isArray(l)?l[0]:l?.rows?l.rows[0]:null;}catch{}try{let l=await e.execute(a`SELECT * FROM "_globals_brand-settings" LIMIT 1`);n=Array.isArray(l)?l[0]:l?.rows?l.rows[0]:null;}catch{}}else if(typeof e?.prepare=="function"){try{i=e.prepare('SELECT * FROM "_globals_store-settings" LIMIT 1').get();}catch{}try{n=e.prepare('SELECT * FROM "_globals_brand-settings" LIMIT 1').get();}catch{}}if(i?.storeName&&(t=i.storeName),n?.identity){let a=typeof n.identity=="string"?JSON.parse(n.identity):n.identity,l=async g=>{if(typeof e?.findOne=="function")return (await e.findOne({collection:"media",where:{id:{equals:g}}}))?.url;if(typeof e?.execute=="function"){let{sql:f}=await import('drizzle-orm');try{let m=await e.execute(f`SELECT url FROM "media" WHERE id = ${g}`);return (Array.isArray(m)?m[0]:m?.rows?m.rows[0]:null)?.url}catch{}}else if(typeof e?.prepare=="function")try{return e.prepare('SELECT url FROM "media" WHERE id = ?').get(g)?.url}catch{}};if(a.primaryLogo){let g=await l(a.primaryLogo);g&&(r=g);}if(a.darkLogo){let g=await l(a.darkLogo);g&&(s=g);}}}catch{}return {siteName:t,logoUrl:r,logoDarkUrl:s,appUrl:process.env.PUBLIC_URL||"https://kyro-cms.com"}}static async fromConfig(e){let t=new y(e);await t.load();let r=t.getEmailConfig();if(!r.provider)return this.fromEnv();let i={brand:await this.fetchBrandConfig(e),provider:r.provider||"smtp",from:r.from||"noreply@example.com",fromName:r.fromName,replyTo:r.replyTo,smtp:r.provider==="smtp"?{host:r.host||"",port:r.port||587,secure:r.secure||false,auth:{user:r.user||"",pass:r.pass||""}}:void 0,resend:r.provider==="resend"?{apiKey:r.pass||""}:void 0,sendgrid:r.provider==="sendgrid"?{apiKey:r.pass||""}:void 0,mailgun:r.provider==="mailgun"?{apiKey:r.pass||"",domain:r.host||"",region:r.secure?"eu":"us"}:void 0,ses:r.provider==="ses"?{accessKeyId:r.user||"",secretAccessKey:r.pass||"",region:r.host||"us-east-1"}:void 0};return new o(i)}static fromEnv(){let e=process.env.EMAIL_PROVIDER||"smtp",t=process.env.SMTP_FROM||process.env.DEFAULT_FROM||"noreply@example.com",r=process.env.SMTP_FROM_NAME||"Kyro CMS",s=process.env.SMTP_REPLY_TO;if(e==="smtp"){let i=process.env.SMTP_HOST,n=process.env.SMTP_USER,a=process.env.SMTP_PASS;return !i||!n||!a?null:new o({provider:"smtp",from:t,fromName:r,replyTo:s,smtp:{host:i,port:parseInt(process.env.SMTP_PORT||"587",10),secure:process.env.SMTP_SECURE==="true",auth:{user:n,pass:a}}})}if(e==="resend"){let i=process.env.RESEND_API_KEY||process.env.SMTP_PASS;return i?new o({provider:"resend",from:t,fromName:r,replyTo:s,resend:{apiKey:i}}):null}if(e==="sendgrid"){let i=process.env.SENDGRID_API_KEY||process.env.SMTP_PASS;return i?new o({provider:"sendgrid",from:t,fromName:r,replyTo:s,sendgrid:{apiKey:i}}):null}if(e==="mailgun"){let i=process.env.MAILGUN_API_KEY||process.env.SMTP_PASS,n=process.env.MAILGUN_DOMAIN||process.env.SMTP_HOST;return !i||!n?null:new o({provider:"mailgun",from:t,fromName:r,replyTo:s,mailgun:{apiKey:i,domain:n,region:process.env.MAILGUN_REGION||(process.env.SMTP_SECURE==="true"?"eu":"us")}})}if(e==="ses"){let i=process.env.AWS_ACCESS_KEY_ID||process.env.SMTP_USER,n=process.env.AWS_SECRET_ACCESS_KEY||process.env.SMTP_PASS,a=process.env.AWS_REGION||process.env.SMTP_HOST||"us-east-1";return !i||!n?null:new o({provider:"ses",from:t,fromName:r,replyTo:s,ses:{accessKeyId:i,secretAccessKey:n,region:a}})}return null}};
449
+ export{c as a,b,x as c,_ as d,w as e,S as f,C as g,T as h,k as i,E as j,v as k,A as l,R as m,I as n,$ as o,y as p,U as q};