gemi 0.116.0 → 0.118.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (355) hide show
  1. package/dist/ai/index.js +2 -2
  2. package/dist/ai/index.js.map +1 -1
  3. package/dist/app/index.js +2 -2
  4. package/dist/app/index.js.map +1 -1
  5. package/dist/auth/AuthServiceProvider.d.ts.map +1 -1
  6. package/dist/auth/config.d.ts +27 -0
  7. package/dist/auth/config.d.ts.map +1 -1
  8. package/dist/auth/connections/ConnectionManager.d.ts +133 -0
  9. package/dist/auth/connections/ConnectionManager.d.ts.map +1 -0
  10. package/dist/auth/connections/ConnectionStore.d.ts +146 -0
  11. package/dist/auth/connections/ConnectionStore.d.ts.map +1 -0
  12. package/dist/auth/connections/ConnectionsController.d.ts +23 -0
  13. package/dist/auth/connections/ConnectionsController.d.ts.map +1 -0
  14. package/dist/auth/connections/OAuthConnectionProvider.d.ts +105 -0
  15. package/dist/auth/connections/OAuthConnectionProvider.d.ts.map +1 -0
  16. package/dist/auth/connections/errors.d.ts +32 -0
  17. package/dist/auth/connections/errors.d.ts.map +1 -0
  18. package/dist/auth/oauth/oauthState.d.ts +15 -2
  19. package/dist/auth/oauth/oauthState.d.ts.map +1 -1
  20. package/dist/auth/routes.d.ts +13 -0
  21. package/dist/auth/routes.d.ts.map +1 -1
  22. package/dist/bin/orm/emit.d.ts.map +1 -1
  23. package/dist/bin/orm-generator.js +51 -4
  24. package/dist/bin/orm-generator.js.map +4 -4
  25. package/dist/bun/plugin.js +2 -2
  26. package/dist/bun/plugin.js.map +1 -1
  27. package/dist/bun/preload.js +2 -2
  28. package/dist/bun/preload.js.map +1 -1
  29. package/dist/{chunk-2tzm58j3.js → chunk-01ehxca0.js} +2 -2
  30. package/dist/{chunk-2tzm58j3.js.map → chunk-01ehxca0.js.map} +1 -1
  31. package/dist/chunk-0gtyects.js +10 -0
  32. package/dist/{chunk-yf1njzd5.js.map → chunk-0gtyects.js.map} +6 -5
  33. package/dist/{chunk-15c2vgaf.js → chunk-1m3hvy3q.js} +2 -2
  34. package/dist/{chunk-15c2vgaf.js.map → chunk-1m3hvy3q.js.map} +1 -1
  35. package/dist/{chunk-6cx8ncd4.js → chunk-1z1rj2zq.js} +3 -3
  36. package/dist/{chunk-6cx8ncd4.js.map → chunk-1z1rj2zq.js.map} +1 -1
  37. package/dist/{chunk-5stgtwqw.js → chunk-2bja99cq.js} +2 -2
  38. package/dist/{chunk-5stgtwqw.js.map → chunk-2bja99cq.js.map} +1 -1
  39. package/dist/{chunk-n672d4g8.js → chunk-30xxc6r7.js} +2 -2
  40. package/dist/{chunk-n672d4g8.js.map → chunk-30xxc6r7.js.map} +1 -1
  41. package/dist/{chunk-qjhw8nje.js → chunk-33s2xqv1.js} +1 -1
  42. package/dist/{chunk-4088szy9.js → chunk-39kyz4k6.js} +3 -3
  43. package/dist/{chunk-4088szy9.js.map → chunk-39kyz4k6.js.map} +1 -1
  44. package/dist/chunk-3nf95j9e.js +5 -0
  45. package/dist/{chunk-1q9kd20m.js.map → chunk-3nf95j9e.js.map} +1 -1
  46. package/dist/chunk-3zxfd7pn.js +14 -0
  47. package/dist/{chunk-pn8v6fj2.js.map → chunk-3zxfd7pn.js.map} +11 -6
  48. package/dist/{chunk-pyk3gzvc.js → chunk-453rmkpm.js} +2 -2
  49. package/dist/{chunk-pyk3gzvc.js.map → chunk-453rmkpm.js.map} +1 -1
  50. package/dist/chunk-47h12eme.js +57 -0
  51. package/dist/{chunk-ms9k0rx6.js.map → chunk-47h12eme.js.map} +15 -11
  52. package/dist/chunk-490sbcma.js +5 -0
  53. package/dist/chunk-490sbcma.js.map +12 -0
  54. package/dist/{chunk-kqxdsv22.js → chunk-4c1kdd8p.js} +2 -2
  55. package/dist/{chunk-kqxdsv22.js.map → chunk-4c1kdd8p.js.map} +1 -1
  56. package/dist/{chunk-jdhdrr2k.js → chunk-5cgq9c43.js} +2 -2
  57. package/dist/{chunk-jdhdrr2k.js.map → chunk-5cgq9c43.js.map} +1 -1
  58. package/dist/{chunk-9n1hx3mq.js → chunk-5dbpgyrx.js} +3 -3
  59. package/dist/{chunk-9n1hx3mq.js.map → chunk-5dbpgyrx.js.map} +1 -1
  60. package/dist/{chunk-eqse2m6n.js → chunk-5ses4tcz.js} +2 -2
  61. package/dist/{chunk-eqse2m6n.js.map → chunk-5ses4tcz.js.map} +1 -1
  62. package/dist/{chunk-2z1981d0.js → chunk-675kzd7z.js} +2 -2
  63. package/dist/{chunk-2z1981d0.js.map → chunk-675kzd7z.js.map} +1 -1
  64. package/dist/{chunk-p1aqq0ga.js → chunk-6ggmk2eg.js} +3 -3
  65. package/dist/{chunk-p1aqq0ga.js.map → chunk-6ggmk2eg.js.map} +1 -1
  66. package/dist/{chunk-mazznq15.js → chunk-76p0rf4d.js} +3 -3
  67. package/dist/{chunk-mazznq15.js.map → chunk-76p0rf4d.js.map} +1 -1
  68. package/dist/{chunk-41da9628.js → chunk-8t6dwwz6.js} +1 -1
  69. package/dist/{chunk-zyt2w03d.js → chunk-8wcpxm41.js} +2 -2
  70. package/dist/{chunk-zyt2w03d.js.map → chunk-8wcpxm41.js.map} +1 -1
  71. package/dist/chunk-9pkj7sk6.js +50 -0
  72. package/dist/chunk-9pkj7sk6.js.map +10 -0
  73. package/dist/{chunk-jmpw6bqz.js → chunk-a1qt8aky.js} +2 -2
  74. package/dist/{chunk-jmpw6bqz.js.map → chunk-a1qt8aky.js.map} +1 -1
  75. package/dist/{chunk-frerzsxq.js → chunk-a22h5cby.js} +2 -2
  76. package/dist/{chunk-frerzsxq.js.map → chunk-a22h5cby.js.map} +1 -1
  77. package/dist/{chunk-e573yxpq.js → chunk-aedkrck1.js} +3 -3
  78. package/dist/{chunk-e573yxpq.js.map → chunk-aedkrck1.js.map} +1 -1
  79. package/dist/{chunk-vxm6yevm.js → chunk-aqpaw4jq.js} +2 -2
  80. package/dist/{chunk-vxm6yevm.js.map → chunk-aqpaw4jq.js.map} +1 -1
  81. package/dist/{chunk-aeh67ynz.js → chunk-bgwtdbfw.js} +3 -3
  82. package/dist/{chunk-aeh67ynz.js.map → chunk-bgwtdbfw.js.map} +1 -1
  83. package/dist/{chunk-tw5kwbx4.js → chunk-bz8xssrc.js} +2 -2
  84. package/dist/{chunk-tw5kwbx4.js.map → chunk-bz8xssrc.js.map} +1 -1
  85. package/dist/{chunk-tzm3c7n6.js → chunk-cte6ysqd.js} +4 -4
  86. package/dist/{chunk-tzm3c7n6.js.map → chunk-cte6ysqd.js.map} +1 -1
  87. package/dist/{chunk-qsrcdzan.js → chunk-cvfg88cx.js} +3 -3
  88. package/dist/{chunk-qsrcdzan.js.map → chunk-cvfg88cx.js.map} +1 -1
  89. package/dist/{chunk-1vzks22y.js → chunk-d806cy7p.js} +2 -2
  90. package/dist/{chunk-1vzks22y.js.map → chunk-d806cy7p.js.map} +1 -1
  91. package/dist/{chunk-6chz1ktz.js → chunk-de4t48j9.js} +3 -3
  92. package/dist/{chunk-6chz1ktz.js.map → chunk-de4t48j9.js.map} +1 -1
  93. package/dist/{chunk-mqfzdfnz.js → chunk-dwpn6fze.js} +2 -2
  94. package/dist/{chunk-mqfzdfnz.js.map → chunk-dwpn6fze.js.map} +1 -1
  95. package/dist/{chunk-vbdty91k.js → chunk-ebret82e.js} +3 -3
  96. package/dist/{chunk-vbdty91k.js.map → chunk-ebret82e.js.map} +1 -1
  97. package/dist/chunk-eke2frrm.js +9 -0
  98. package/dist/{chunk-hytt9qyj.js.map → chunk-eke2frrm.js.map} +3 -4
  99. package/dist/{chunk-yer1r3t3.js → chunk-epvpmakp.js} +2 -2
  100. package/dist/{chunk-yer1r3t3.js.map → chunk-epvpmakp.js.map} +1 -1
  101. package/dist/{chunk-fxgxf16k.js → chunk-fsj5k511.js} +2 -2
  102. package/dist/{chunk-fxgxf16k.js.map → chunk-fsj5k511.js.map} +1 -1
  103. package/dist/{chunk-t4yh4nf9.js → chunk-g5ppst76.js} +3 -3
  104. package/dist/{chunk-t4yh4nf9.js.map → chunk-g5ppst76.js.map} +1 -1
  105. package/dist/{chunk-aazmrxj9.js → chunk-g9hhdcax.js} +2 -2
  106. package/dist/{chunk-aazmrxj9.js.map → chunk-g9hhdcax.js.map} +1 -1
  107. package/dist/{chunk-cbqazg9k.js → chunk-gqfqnv3f.js} +2 -2
  108. package/dist/{chunk-cbqazg9k.js.map → chunk-gqfqnv3f.js.map} +1 -1
  109. package/dist/chunk-hkf2k2eq.js +5 -0
  110. package/dist/{chunk-whtzggn6.js.map → chunk-hkf2k2eq.js.map} +3 -4
  111. package/dist/{chunk-vw8849ys.js → chunk-hm9cjxy2.js} +2 -2
  112. package/dist/{chunk-m54s6jpr.js.map → chunk-hm9cjxy2.js.map} +1 -1
  113. package/dist/{chunk-kejwjerj.js → chunk-hr1r3g0d.js} +2 -2
  114. package/dist/{chunk-kejwjerj.js.map → chunk-hr1r3g0d.js.map} +1 -1
  115. package/dist/{chunk-3hrj5rwm.js → chunk-hzepfrzy.js} +2 -2
  116. package/dist/{chunk-3hrj5rwm.js.map → chunk-hzepfrzy.js.map} +1 -1
  117. package/dist/{chunk-785b41h1.js → chunk-j5858bz7.js} +3 -3
  118. package/dist/{chunk-785b41h1.js.map → chunk-j5858bz7.js.map} +1 -1
  119. package/dist/{chunk-d9mar37g.js → chunk-jf6qqzat.js} +2 -2
  120. package/dist/{chunk-d9mar37g.js.map → chunk-jf6qqzat.js.map} +1 -1
  121. package/dist/{chunk-1hr4xht1.js → chunk-jg79n382.js} +2 -2
  122. package/dist/{chunk-1hr4xht1.js.map → chunk-jg79n382.js.map} +1 -1
  123. package/dist/chunk-k31qfe7a.js +71 -0
  124. package/dist/chunk-k31qfe7a.js.map +13 -0
  125. package/dist/{chunk-4mfrgd5m.js → chunk-kk77x2v4.js} +2 -2
  126. package/dist/{chunk-4mfrgd5m.js.map → chunk-kk77x2v4.js.map} +1 -1
  127. package/dist/{chunk-1myhm0g3.js → chunk-kkte8nze.js} +3 -3
  128. package/dist/{chunk-1myhm0g3.js.map → chunk-kkte8nze.js.map} +1 -1
  129. package/dist/{chunk-hdps9n52.js → chunk-m4kmetpb.js} +3 -3
  130. package/dist/{chunk-hdps9n52.js.map → chunk-m4kmetpb.js.map} +1 -1
  131. package/dist/{chunk-gts5p6mw.js → chunk-n4sdm0jn.js} +4 -4
  132. package/dist/{chunk-gts5p6mw.js.map → chunk-n4sdm0jn.js.map} +1 -1
  133. package/dist/chunk-nang3847.js +416 -0
  134. package/dist/chunk-nang3847.js.map +24 -0
  135. package/dist/{chunk-agyfv3f8.js → chunk-nrezmscd.js} +1 -1
  136. package/dist/{chunk-xt9tv99x.js → chunk-p83erprx.js} +2 -2
  137. package/dist/{chunk-xt9tv99x.js.map → chunk-p83erprx.js.map} +1 -1
  138. package/dist/{chunk-sr942vb1.js → chunk-pkr5dsbk.js} +2 -2
  139. package/dist/{chunk-sr942vb1.js.map → chunk-pkr5dsbk.js.map} +1 -1
  140. package/dist/{chunk-yhrye9cm.js → chunk-pqc16rrx.js} +2 -2
  141. package/dist/{chunk-yhrye9cm.js.map → chunk-pqc16rrx.js.map} +1 -1
  142. package/dist/{chunk-m54s6jpr.js → chunk-pvz90a49.js} +2 -2
  143. package/dist/{chunk-vw8849ys.js.map → chunk-pvz90a49.js.map} +1 -1
  144. package/dist/{chunk-fre6f4nk.js → chunk-q290tgza.js} +2 -2
  145. package/dist/{chunk-fre6f4nk.js.map → chunk-q290tgza.js.map} +1 -1
  146. package/dist/{chunk-8rv62v14.js → chunk-qf4bmee9.js} +2 -2
  147. package/dist/{chunk-8rv62v14.js.map → chunk-qf4bmee9.js.map} +1 -1
  148. package/dist/chunk-qkxnvpaj.js +5 -0
  149. package/dist/chunk-qkxnvpaj.js.map +10 -0
  150. package/dist/chunk-r1favzz4.js +19 -0
  151. package/dist/{chunk-ktr3k768.js.map → chunk-r1favzz4.js.map} +5 -4
  152. package/dist/{chunk-303mprnv.js → chunk-r3v2cnrj.js} +2 -2
  153. package/dist/{chunk-303mprnv.js.map → chunk-r3v2cnrj.js.map} +1 -1
  154. package/dist/{chunk-x7cpth2f.js → chunk-razjfecn.js} +1 -1
  155. package/dist/{chunk-t04f3akb.js → chunk-scc0j5k9.js} +2 -2
  156. package/dist/{chunk-t04f3akb.js.map → chunk-scc0j5k9.js.map} +1 -1
  157. package/dist/{chunk-56jky6vf.js → chunk-sce5jes2.js} +2 -2
  158. package/dist/{chunk-56jky6vf.js.map → chunk-sce5jes2.js.map} +1 -1
  159. package/dist/chunk-sd02ktf2.js +24 -0
  160. package/dist/{chunk-79xg42e7.js.map → chunk-sd02ktf2.js.map} +2 -2
  161. package/dist/{chunk-mschc94q.js → chunk-sn04cyw0.js} +2 -2
  162. package/dist/{chunk-mschc94q.js.map → chunk-sn04cyw0.js.map} +1 -1
  163. package/dist/{chunk-bra1a1fq.js → chunk-tfdmvxza.js} +2 -2
  164. package/dist/{chunk-bra1a1fq.js.map → chunk-tfdmvxza.js.map} +1 -1
  165. package/dist/{chunk-z10cas5r.js → chunk-thz75w6e.js} +2 -2
  166. package/dist/{chunk-z10cas5r.js.map → chunk-thz75w6e.js.map} +1 -1
  167. package/dist/{chunk-v1tfdgy1.js → chunk-tzdenj0n.js} +3 -3
  168. package/dist/{chunk-v1tfdgy1.js.map → chunk-tzdenj0n.js.map} +1 -1
  169. package/dist/{chunk-98m15b9x.js → chunk-x6v2zex2.js} +2 -2
  170. package/dist/{chunk-98m15b9x.js.map → chunk-x6v2zex2.js.map} +1 -1
  171. package/dist/{chunk-d2gfcf85.js → chunk-xfw8zyvn.js} +2 -2
  172. package/dist/{chunk-d2gfcf85.js.map → chunk-xfw8zyvn.js.map} +1 -1
  173. package/dist/{chunk-wyw6p3fg.js → chunk-xtzn0qfh.js} +3 -3
  174. package/dist/{chunk-wyw6p3fg.js.map → chunk-xtzn0qfh.js.map} +1 -1
  175. package/dist/{chunk-tn2bryy2.js → chunk-xx3zvc3g.js} +2 -2
  176. package/dist/{chunk-tn2bryy2.js.map → chunk-xx3zvc3g.js.map} +1 -1
  177. package/dist/{chunk-er3wf6ng.js → chunk-xzn2nmny.js} +2 -2
  178. package/dist/{chunk-er3wf6ng.js.map → chunk-xzn2nmny.js.map} +1 -1
  179. package/dist/{chunk-p91b8zcn.js → chunk-xzyy896s.js} +2 -2
  180. package/dist/{chunk-p91b8zcn.js.map → chunk-xzyy896s.js.map} +1 -1
  181. package/dist/chunk-y09r0wsw.js +5 -0
  182. package/dist/chunk-y09r0wsw.js.map +12 -0
  183. package/dist/{chunk-6d8rvr1v.js → chunk-ygf0z7kk.js} +2 -2
  184. package/dist/{chunk-6d8rvr1v.js.map → chunk-ygf0z7kk.js.map} +1 -1
  185. package/dist/chunk-z759yah5.js +5 -0
  186. package/dist/chunk-z759yah5.js.map +12 -0
  187. package/dist/client/Head.d.ts.map +1 -1
  188. package/dist/client/fonts.d.ts +69 -0
  189. package/dist/client/fonts.d.ts.map +1 -0
  190. package/dist/client/index.d.ts +1 -0
  191. package/dist/client/index.d.ts.map +1 -1
  192. package/dist/client/index.js +75 -1
  193. package/dist/client/index.js.map +1 -1
  194. package/dist/config/index.js +1 -1
  195. package/dist/console/builtins.d.ts +13 -0
  196. package/dist/console/builtins.d.ts.map +1 -0
  197. package/dist/console/run.js +13 -11
  198. package/dist/console/run.js.map +6 -5
  199. package/dist/console/runner.d.ts.map +1 -1
  200. package/dist/console/usage.d.ts +2 -0
  201. package/dist/console/usage.d.ts.map +1 -1
  202. package/dist/container/index.js +2 -2
  203. package/dist/container/index.js.map +1 -1
  204. package/dist/database/index.js +2 -2
  205. package/dist/database/index.js.map +1 -1
  206. package/dist/email/index.js +2 -2
  207. package/dist/email/index.js.map +1 -1
  208. package/dist/facades/Connections.d.ts +36 -0
  209. package/dist/facades/Connections.d.ts.map +1 -0
  210. package/dist/facades/Crypt.d.ts +26 -0
  211. package/dist/facades/Crypt.d.ts.map +1 -0
  212. package/dist/facades/Meta.d.ts +7 -1
  213. package/dist/facades/Meta.d.ts.map +1 -1
  214. package/dist/facades/Storage.d.ts +29 -0
  215. package/dist/facades/Storage.d.ts.map +1 -1
  216. package/dist/facades/index.d.ts +2 -0
  217. package/dist/facades/index.d.ts.map +1 -1
  218. package/dist/facades/index.js +2 -2
  219. package/dist/facades/index.js.map +1 -1
  220. package/dist/foundation/index.js +2 -2
  221. package/dist/foundation/index.js.map +1 -1
  222. package/dist/http/HttpRequest.d.ts +1 -0
  223. package/dist/http/HttpRequest.d.ts.map +1 -1
  224. package/dist/http/Metadata.d.ts +5 -0
  225. package/dist/http/Metadata.d.ts.map +1 -1
  226. package/dist/http/index.d.ts +3 -1
  227. package/dist/http/index.d.ts.map +1 -1
  228. package/dist/http/index.js +2 -2
  229. package/dist/http/index.js.map +1 -1
  230. package/dist/http/requestContext.d.ts +1 -0
  231. package/dist/http/requestContext.d.ts.map +1 -1
  232. package/dist/http/safeFetch/errors.d.ts +10 -0
  233. package/dist/http/safeFetch/errors.d.ts.map +1 -1
  234. package/dist/http/safeFetch/index.d.ts +1 -1
  235. package/dist/http/safeFetch/index.d.ts.map +1 -1
  236. package/dist/http/sitemap/Robots.d.ts +95 -0
  237. package/dist/http/sitemap/Robots.d.ts.map +1 -0
  238. package/dist/http/sitemap/Sitemap.d.ts +145 -0
  239. package/dist/http/sitemap/Sitemap.d.ts.map +1 -0
  240. package/dist/http/sitemap/fetchText.d.ts +16 -0
  241. package/dist/http/sitemap/fetchText.d.ts.map +1 -0
  242. package/dist/http/sitemap/index.d.ts +3 -0
  243. package/dist/http/sitemap/index.d.ts.map +1 -0
  244. package/dist/http/sitemap/xml.d.ts +21 -0
  245. package/dist/http/sitemap/xml.d.ts.map +1 -0
  246. package/dist/i18n/Translator.d.ts.map +1 -1
  247. package/dist/i18n/dictionaryRuntime.js +2 -2
  248. package/dist/i18n/dictionaryRuntime.js.map +1 -1
  249. package/dist/i18n/index.d.ts +1 -1
  250. package/dist/i18n/index.d.ts.map +1 -1
  251. package/dist/i18n/index.js +2 -2
  252. package/dist/i18n/index.js.map +2 -2
  253. package/dist/i18n/resolveLocale.d.ts +18 -0
  254. package/dist/i18n/resolveLocale.d.ts.map +1 -1
  255. package/dist/kernel/index.js +3 -3
  256. package/dist/kernel/index.js.map +3 -3
  257. package/dist/kernel/providers.d.ts +2 -2
  258. package/dist/kernel/providers.d.ts.map +1 -1
  259. package/dist/orm/Model.d.ts.map +1 -1
  260. package/dist/orm/encryption-rotate.d.ts +44 -0
  261. package/dist/orm/encryption-rotate.d.ts.map +1 -0
  262. package/dist/orm/encryption.d.ts +54 -0
  263. package/dist/orm/encryption.d.ts.map +1 -0
  264. package/dist/orm/index.d.ts +2 -0
  265. package/dist/orm/index.d.ts.map +1 -1
  266. package/dist/orm/index.js +3 -3
  267. package/dist/orm/index.js.map +4 -4
  268. package/dist/orm/schema.d.ts +25 -1
  269. package/dist/orm/schema.d.ts.map +1 -1
  270. package/dist/server/index.js +2 -2
  271. package/dist/server/index.js.map +1 -1
  272. package/dist/services/discovery.d.ts +8 -0
  273. package/dist/services/discovery.d.ts.map +1 -1
  274. package/dist/services/encryption/Encrypter.d.ts +86 -0
  275. package/dist/services/encryption/Encrypter.d.ts.map +1 -0
  276. package/dist/services/encryption/EncryptionServiceProvider.d.ts +13 -0
  277. package/dist/services/encryption/EncryptionServiceProvider.d.ts.map +1 -0
  278. package/dist/services/encryption/config.d.ts +36 -0
  279. package/dist/services/encryption/config.d.ts.map +1 -0
  280. package/dist/services/file-storage/drivers/FileStorageDriver.d.ts +12 -1
  281. package/dist/services/file-storage/drivers/FileStorageDriver.d.ts.map +1 -1
  282. package/dist/services/file-storage/drivers/FileSystemDriver.d.ts +8 -1
  283. package/dist/services/file-storage/drivers/FileSystemDriver.d.ts.map +1 -1
  284. package/dist/services/file-storage/drivers/types.d.ts +17 -0
  285. package/dist/services/file-storage/drivers/types.d.ts.map +1 -1
  286. package/dist/services/file-storage/putFromUrl.d.ts +56 -0
  287. package/dist/services/file-storage/putFromUrl.d.ts.map +1 -0
  288. package/dist/services/file-storage/sniffContentType.d.ts +33 -0
  289. package/dist/services/file-storage/sniffContentType.d.ts.map +1 -0
  290. package/dist/services/index.d.ts +26 -5
  291. package/dist/services/index.d.ts.map +1 -1
  292. package/dist/services/index.js +10 -10
  293. package/dist/services/index.js.map +4 -3
  294. package/dist/services/queue/DatabaseQueueDriver.d.ts +117 -7
  295. package/dist/services/queue/DatabaseQueueDriver.d.ts.map +1 -1
  296. package/dist/services/queue/Job.d.ts +75 -0
  297. package/dist/services/queue/Job.d.ts.map +1 -1
  298. package/dist/services/queue/MemoryQueueDriver.d.ts +32 -2
  299. package/dist/services/queue/MemoryQueueDriver.d.ts.map +1 -1
  300. package/dist/services/queue/QueueDriver.d.ts +83 -1
  301. package/dist/services/queue/QueueDriver.d.ts.map +1 -1
  302. package/dist/services/queue/QueueManager.d.ts +80 -7
  303. package/dist/services/queue/QueueManager.d.ts.map +1 -1
  304. package/dist/services/queue/QueueServiceProvider.d.ts.map +1 -1
  305. package/dist/services/queue/backoff.d.ts +6 -0
  306. package/dist/services/queue/backoff.d.ts.map +1 -0
  307. package/dist/services/queue/batch.d.ts +112 -0
  308. package/dist/services/queue/batch.d.ts.map +1 -0
  309. package/dist/services/queue/config.d.ts +9 -0
  310. package/dist/services/queue/config.d.ts.map +1 -1
  311. package/dist/services/queue/queueDriverContract.d.ts +5 -0
  312. package/dist/services/queue/queueDriverContract.d.ts.map +1 -1
  313. package/dist/services/queue/work.js +2 -2
  314. package/dist/services/queue/work.js.map +1 -1
  315. package/dist/services/queue/workflow/DatabaseWorkflowStore.d.ts +89 -0
  316. package/dist/services/queue/workflow/DatabaseWorkflowStore.d.ts.map +1 -0
  317. package/dist/services/queue/workflow/MemoryWorkflowStore.d.ts +43 -0
  318. package/dist/services/queue/workflow/MemoryWorkflowStore.d.ts.map +1 -0
  319. package/dist/services/queue/workflow/Step.d.ts +202 -0
  320. package/dist/services/queue/workflow/Step.d.ts.map +1 -0
  321. package/dist/services/queue/workflow/Workflow.d.ts +124 -0
  322. package/dist/services/queue/workflow/Workflow.d.ts.map +1 -0
  323. package/dist/services/queue/workflow/WorkflowRuntime.d.ts +60 -0
  324. package/dist/services/queue/workflow/WorkflowRuntime.d.ts.map +1 -0
  325. package/dist/services/queue/workflow/WorkflowStore.d.ts +184 -0
  326. package/dist/services/queue/workflow/WorkflowStore.d.ts.map +1 -0
  327. package/dist/services/queue/workflow/duration.d.ts +8 -0
  328. package/dist/services/queue/workflow/duration.d.ts.map +1 -0
  329. package/dist/services/queue/workflow/workflowContract.d.ts +30 -0
  330. package/dist/services/queue/workflow/workflowContract.d.ts.map +1 -0
  331. package/dist/services/router/ViewRouteDispatcher.d.ts.map +1 -1
  332. package/dist/stats/route-table.js +1 -1
  333. package/dist/support/index.js +2 -2
  334. package/dist/support/index.js.map +1 -1
  335. package/dist/vitest/index.js +2 -2
  336. package/dist/vitest/index.js.map +1 -1
  337. package/package.json +1 -1
  338. package/dist/chunk-1q9kd20m.js +0 -5
  339. package/dist/chunk-49nyyjfe.js +0 -5
  340. package/dist/chunk-49nyyjfe.js.map +0 -11
  341. package/dist/chunk-79xg42e7.js +0 -24
  342. package/dist/chunk-7vb4eey2.js +0 -217
  343. package/dist/chunk-7vb4eey2.js.map +0 -16
  344. package/dist/chunk-hytt9qyj.js +0 -54
  345. package/dist/chunk-jmg2zsaf.js +0 -5
  346. package/dist/chunk-jmg2zsaf.js.map +0 -12
  347. package/dist/chunk-ktr3k768.js +0 -19
  348. package/dist/chunk-ms9k0rx6.js +0 -46
  349. package/dist/chunk-pn8v6fj2.js +0 -14
  350. package/dist/chunk-whtzggn6.js +0 -5
  351. package/dist/chunk-yf1njzd5.js +0 -10
  352. /package/dist/{chunk-qjhw8nje.js.map → chunk-33s2xqv1.js.map} +0 -0
  353. /package/dist/{chunk-41da9628.js.map → chunk-8t6dwwz6.js.map} +0 -0
  354. /package/dist/{chunk-agyfv3f8.js.map → chunk-nrezmscd.js.map} +0 -0
  355. /package/dist/{chunk-x7cpth2f.js.map → chunk-razjfecn.js.map} +0 -0
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{R as C,T as h,U as m}from"./chunk-6d8rvr1v.js";import{la as w,ma as q}from"./chunk-6chz1ktz.js";import"./chunk-frerzsxq.js";import"./chunk-yer1r3t3.js";import"./chunk-303mprnv.js";import"./chunk-p1aqq0ga.js";import{Ca as N}from"./chunk-4mfrgd5m.js";import"./chunk-5stgtwqw.js";import"./chunk-tw5kwbx4.js";import{Tg as _}from"./chunk-15c2vgaf.js";import{oi as y}from"./chunk-d9mar37g.js";import"./chunk-vw8849ys.js";import{join as $J}from"path";import{createServer as zJ}from"vite";import{join as l}from"path";import{IncomingMessage as d,ServerResponse as p}from"http";import{Socket as i}from"net";function v(J){return J.replace(/\x1b\[[0-9;]*m/g,"").replace(/\[[0-9;]*m/g,"").replace(/\n\s*\n/g,`
2
+ import{R as C,T as h,U as m}from"./chunk-ygf0z7kk.js";import{ma as w,na as q}from"./chunk-de4t48j9.js";import"./chunk-a22h5cby.js";import"./chunk-epvpmakp.js";import"./chunk-r3v2cnrj.js";import"./chunk-6ggmk2eg.js";import{Da as N}from"./chunk-kk77x2v4.js";import"./chunk-2bja99cq.js";import"./chunk-bz8xssrc.js";import{Lg as _}from"./chunk-1m3hvy3q.js";import{cj as y}from"./chunk-jf6qqzat.js";import"./chunk-hm9cjxy2.js";import{join as $J}from"path";import{createServer as zJ}from"vite";import{join as l}from"path";import{IncomingMessage as d,ServerResponse as p}from"http";import{Socket as i}from"net";function v(J){return J.replace(/\x1b\[[0-9;]*m/g,"").replace(/\[[0-9;]*m/g,"").replace(/\n\s*\n/g,`
3
3
  `).split(`
4
4
  `).map((W)=>W.trim()).filter((W)=>W.length>0).join(`
5
5
  `).trim()}function D(J){return`
@@ -55,4 +55,4 @@ window.$RefreshSig$ = () => (type) => type;
55
55
  window.__vite_plugin_react_preamble_installed__ = true;
56
56
  `;function t(J){let{pathname:W}=new URL(J.url),Z=($)=>new Response($,{headers:{"Content-Type":"application/javascript"}});if(W===S)return Z(s);if(W.startsWith("/render-error.js"))return Z("window.render_error = true");if(W.startsWith("/refresh.js"))return Z(a);return null}function k(J,W,Z){let $=l(process.cwd(),"app");return async(Q)=>{let{pathname:X}=new URL(Q.url),Y=(z)=>{if(console.error(z),Z.ssrFixStacktrace?.(z),O(z),y(X))return new Response(JSON.stringify({error:_("server_error",z?.message??String(z),500)}),{status:500,headers:{"Content-Type":"application/json"}});return globalThis.__gemiErrorPageServed=!0,new Response(D(H(z)),{status:500,headers:{"Content-Type":"text/html"}})},G=async(z)=>{let U=t(z);if(U)return U;try{let B=J.fetch.bind(J),K=await n(Z,z)??await B(z);if(K instanceof Response)return K;let j={},b={},M={},c=(L,A)=>`"${L}": () => import("${A}")`,F=[];for(let L of["404",...J.getFlatComponentTree.call(J)]){if(Bun.env.NODE_ENV==="test")break;let A=`${process.env.APP_DIR}`,x=await I(Z).import(`${A}/views/${L}.tsx`);j[L]=x.default,b[L]=x?.OpenGraph,M[L]=x,F.push(c(L,`/app/views/${L}.tsx`))}let u=`{${F.join(",")}}`;return await K({getStyles:async(L,A)=>await C($,Z,L,A?.layout),resolveIsland:(L)=>({src:`/${L}${N}`,preload:[]}),bootstrapModules:[S],viewImportMap:j,viewModules:M,ogMap:b,loaders:u,cssManifest:{}})}catch(B){return Y(B)}};return await W(Q,(z)=>J.withGlobalMiddleware(z,G,Y))}}function r(J){try{return Bun.listen({hostname:"0.0.0.0",port:J,socket:{data(){}}}).stop(!0),!0}catch(W){return W?.code!=="EADDRINUSE"}}function T(J,W=r){let Z=24678+(J-5173);if(Z>65471)Z=24678;for(let $=Z;$<Z+64;$++)if(W($))return $;throw Error(`Could not find a free port for Vite's HMR websocket: tried ${Z}-${Z+64-1}. Set one explicitly in gemi.config.ts as \`vite: { server: { ws: { port } } }\`.`)}import{createServer as e}from"http";var JJ=new Set(["vite-hmr","vite-ping"]);async function P(J){let W=e((Z,$)=>{$.writeHead(426,{"Content-Type":"text/plain"}),$.end("Upgrade Required")});return await new Promise((Z,$)=>{W.once("error",$),W.listen(J,"127.0.0.1",()=>{W.off("error",$),Z()})}),W}function f(J){if(!J||typeof J!=="object")return null;let Z=J.server?.address?.();if(Z&&typeof Z==="object"&&"port"in Z)return Number(Z.port)||null;return null}function R(J){if(J.headers.get("upgrade")?.toLowerCase()!=="websocket")return!1;return JJ.has(J.headers.get("sec-websocket-protocol")??"")}var WJ=(J)=>typeof J==="string"?J:new Uint8Array(J);async function g(J,W,Z){let $=new URL(J.url),Q=J.headers.get("sec-websocket-protocol")??"vite-hmr",X={host:J.headers.get("host")??$.host},Y=J.headers.get("origin");if(Y)X.origin=Y;let G=new WebSocket(`ws://127.0.0.1:${Z}${$.pathname}${$.search}`,{protocols:[Q],headers:X});G.binaryType="arraybuffer";let z={upstream:G,early:[]};if(G.onmessage=(K)=>{let j=WJ(K.data);if(z.browser)z.browser.send(j);else z.early.push(j)},G.onclose=(K)=>{z.browser?.close(ZJ(K.code),K.reason)},G.onerror=()=>{},!await new Promise((K)=>{G.addEventListener("open",()=>K(!0),{once:!0}),G.addEventListener("close",()=>K(!1),{once:!0})}))return new Response("Vite refused the HMR websocket",{status:403});if(!W.upgrade(J,{headers:{"Sec-WebSocket-Protocol":Q},data:z}))return G.close(),new Response("WebSocket upgrade failed",{status:400});return}function ZJ(J){if(J===1000||J>=1001&&J<=1003||J>=1007&&J<=1014)return J;if(J>=3000&&J<=4999)return J;return 1000}var E={open(J){let W=J.data;for(let Z of W.early)J.send(Z);if(W.early=[],W.browser=J,W.upstream.readyState!==WebSocket.OPEN)J.close(1000)},message(J,W){if(J.data.upstream.readyState===WebSocket.OPEN)J.data.upstream.send(W)},close(J){let{upstream:W}=J.data;if(W.readyState<=WebSocket.OPEN)W.close()}};var V=process.cwd(),GJ=$J(V,"app");if(!globalThis.__gemiErrorHooked)globalThis.__gemiErrorHooked=!0,process.on("unhandledRejection",(J)=>{console.error(J),O(J)}),process.on("uncaughtException",(J)=>{console.error(J),O(J)});async function SJ(J,W){let Z=Number(process.env.PORT)||5173,$=m(),Q=Boolean(globalThis.__gemiVite),X=globalThis.__gemiVite??=await zJ({configFile:!1,plugins:[q()],server:{middlewareMode:!0,port:Z,ws:{server:await P(T(Z))},allowedHosts:J.devAllowedHosts.call(J),watch:{ignored:(U)=>{let B=U.split(/[/\\]/).pop()??"";return B===".env"||B.startsWith(".env.")}}},appType:"custom",resolve:{dedupe:["react","react-dom"]},optimizeDeps:{include:["react","react-dom","react-dom/client"]},ssr:{external:[...w]}});process.env.ROOT_DIR=V,process.env.APP_DIR=GJ;let Y=k(J,W,X),G=f(X.config?.server?.ws),z=Bun.serve({port:Z,idleTimeout:$,fetch:(U,B)=>{if(G!==null&&R(U))return g(U,B,G);return Y(U)},websocket:E});if(Q)I(X).clearCache();if(Q)if(globalThis.__gemiErrorActive&&globalThis.__gemiErrorPageServed)globalThis.__gemiErrorActive=!1,globalThis.__gemiErrorPageServed=!1,X.ws.send({type:"full-reload"});else globalThis.__gemiErrorActive=!1,X.ws.send({type:"custom",event:"http-reload"});else h({port:z.port,rootDir:V});return z}export{H as viteErrorPayload,SJ as httpDev};
57
57
 
58
- //# debugId=12A501EA67C37B7E64756E2164756E21
58
+ //# debugId=C79A8DACF5D6C13A64756E2164756E21
@@ -9,6 +9,6 @@
9
9
  "import { createServer, type Server as NodeServer } from \"node:http\";\n\nimport type { Server, ServerWebSocket, WebSocketHandler } from \"bun\";\n\n// Vite's HMR websocket, carried on the dev server's own port.\n//\n// In middleware mode Vite has no HTTP server of its own, so by default it\n// stands up a second one for the websocket, on a second port (see\n// `hmrPort.ts`), and tells the browser to connect to `<page host>:<that port>`.\n// A reverse proxy or tunnel (ngrok, a container port mapping, a phone on the\n// LAN through https) only carries the port the page came from, so HMR could\n// not connect there, and the client logged connection failures forever.\n//\n// Vite can attach its websocket to a server it is handed (`server.ws.server`)\n// instead, and then tells the browser to connect to the page's own origin. That\n// server has to be a Node `http.Server`; the dev server is `Bun.serve`. So:\n//\n// - the Node server Vite is handed listens on loopback only, on the port\n// `resolveHmrPort` picked, and answers nothing but websocket upgrades;\n// - `Bun.serve` accepts the browser's upgrade on the page's origin and relays\n// frames both ways to that loopback server.\n//\n// The relay forwards the browser's `Host` and `Origin` and the request's query\n// (the `token`), so Vite still runs its own host and token checks against what\n// the browser actually sent.\n\n/** The subprotocols Vite's client opens its sockets with. */\nconst VITE_PROTOCOLS = new Set([\"vite-hmr\", \"vite-ping\"]);\n\n/**\n * Start the loopback Node server Vite attaches its HMR websocket to.\n * Everything but an upgrade gets `426 Upgrade Required`, as Vite's own\n * websocket server answers.\n */\nexport async function listenHmrServer(port: number): Promise<NodeServer> {\n const server = createServer((_req, res) => {\n res.writeHead(426, { \"Content-Type\": \"text/plain\" });\n res.end(\"Upgrade Required\");\n });\n await new Promise<void>((resolve, reject) => {\n server.once(\"error\", reject);\n server.listen(port, \"127.0.0.1\", () => {\n server.off(\"error\", reject);\n resolve();\n });\n });\n return server;\n}\n\n/**\n * The loopback port to relay to, read from the config Vite actually resolved,\n * so an app that set its own `server.ws` in `gemi.config.ts` is relayed to\n * where Vite really is, or not relayed at all. `null` when Vite was not given\n * a server (its websocket is then on a port of its own, and the client goes\n * there directly) or when HMR is off.\n */\nexport function hmrRelayPort(wsConfig: unknown): number | null {\n if (!wsConfig || typeof wsConfig !== \"object\") return null;\n const server = (wsConfig as { server?: { address?: () => unknown } }).server;\n const address = server?.address?.();\n if (address && typeof address === \"object\" && \"port\" in address) {\n return Number((address as { port: number }).port) || null;\n }\n return null;\n}\n\n/** Whether a request is the Vite client opening its HMR (or ping) socket. */\nexport function isHmrUpgrade(req: Request): boolean {\n if (req.headers.get(\"upgrade\")?.toLowerCase() !== \"websocket\") return false;\n return VITE_PROTOCOLS.has(req.headers.get(\"sec-websocket-protocol\") ?? \"\");\n}\n\nexport type HmrRelayData = {\n /** The socket to Vite, already open when the browser's is accepted. */\n upstream: WebSocket;\n /** Frames Vite sent before the browser's socket opened (its `connected`). */\n early: (string | Uint8Array)[];\n browser?: ServerWebSocket<HmrRelayData>;\n};\n\ntype Frame = string | Uint8Array;\n\nconst frameOf = (data: unknown): Frame =>\n typeof data === \"string\" ? data : new Uint8Array(data as ArrayBuffer);\n\n/**\n * Open the socket to Vite first, and accept the browser's upgrade only once\n * Vite has accepted it. Returns `undefined` once Bun has taken the request\n * over, or a refusal.\n *\n * The order matters. Vite refuses a socket whose host is not in\n * `allowedHosts`, or a cross-origin one without its token. Had the browser's\n * socket been accepted first and closed when Vite refused, the client would\n * read that as \"server connection lost\", ping (which Vite always answers),\n * and reload the page, forever. Refused before it opens, the client logs one\n * \"failed to connect to websocket\" and the page keeps working.\n */\nexport async function upgradeHmr(\n req: Request,\n server: Server<HmrRelayData>,\n port: number,\n): Promise<Response | undefined> {\n const url = new URL(req.url);\n const protocol = req.headers.get(\"sec-websocket-protocol\") ?? \"vite-hmr\";\n // `Host` is what Vite's `allowedHosts` check reads; the URL's host is the\n // same value `Bun.serve` derived it from.\n const headers: Record<string, string> = {\n host: req.headers.get(\"host\") ?? url.host,\n };\n const origin = req.headers.get(\"origin\");\n if (origin) headers.origin = origin;\n\n const upstream = new WebSocket(\n `ws://127.0.0.1:${port}${url.pathname}${url.search}`,\n {\n protocols: [protocol],\n headers,\n } as any,\n );\n upstream.binaryType = \"arraybuffer\";\n const data: HmrRelayData = { upstream, early: [] };\n\n upstream.onmessage = (event) => {\n const frame = frameOf(event.data);\n if (data.browser) data.browser.send(frame);\n else data.early.push(frame);\n };\n upstream.onclose = (event) => {\n data.browser?.close(sendableCloseCode(event.code), event.reason);\n };\n upstream.onerror = () => {\n // A `close` follows; it ends the browser's socket if there is one.\n };\n\n const opened = await new Promise<boolean>((resolve) => {\n upstream.addEventListener(\"open\", () => resolve(true), { once: true });\n upstream.addEventListener(\"close\", () => resolve(false), { once: true });\n });\n if (!opened) {\n return new Response(\"Vite refused the HMR websocket\", { status: 403 });\n }\n\n const upgraded = server.upgrade(req, {\n // The browser fails a connection whose response does not echo the\n // subprotocol it asked for.\n headers: { \"Sec-WebSocket-Protocol\": protocol },\n data,\n });\n if (!upgraded) {\n upstream.close();\n return new Response(\"WebSocket upgrade failed\", { status: 400 });\n }\n return undefined;\n}\n\n// A close code that may be sent in a close frame. 1005, 1006 and 1015 are\n// reported locally and never sent.\nfunction sendableCloseCode(code: number): number {\n if (\n code === 1000 ||\n (code >= 1001 && code <= 1003) ||\n (code >= 1007 && code <= 1014)\n ) {\n return code;\n }\n if (code >= 3000 && code <= 4999) return code;\n return 1000;\n}\n\n/** `Bun.serve`'s `websocket` option: relays frames to and from Vite. */\nexport const hmrRelayHandler: WebSocketHandler<HmrRelayData> = {\n open(ws: ServerWebSocket<HmrRelayData>) {\n const data = ws.data;\n for (const frame of data.early) ws.send(frame);\n data.early = [];\n data.browser = ws;\n // Vite may have hung up while the upgrade was in flight.\n if (data.upstream.readyState !== WebSocket.OPEN) ws.close(1000);\n },\n message(ws: ServerWebSocket<HmrRelayData>, message) {\n if (ws.data.upstream.readyState === WebSocket.OPEN) {\n ws.data.upstream.send(message);\n }\n },\n close(ws: ServerWebSocket<HmrRelayData>) {\n const { upstream } = ws.data;\n if (upstream.readyState <= WebSocket.OPEN) upstream.close();\n },\n};\n"
10
10
  ],
11
11
  "mappings": ";weAAA,SAAS,QAET,iBAAS,QCDT,SAAS,OACT,oBAAS,cAAiB,OAC1B,WAAS,MCHT,SAAS,CAAmB,CAAC,EAAM,CACjC,OACE,EAEG,QAAQ,kBAAmB,EAAE,EAE7B,QAAQ,cAAe,EAAE,EAEzB,QAAQ,WAAY;AAAA,CAAI,EAExB,MAAM;AAAA,CAAI,EACV,IAAI,CAAC,IAAS,EAAK,KAAK,CAAC,EACzB,OAAO,CAAC,IAAS,EAAK,OAAS,CAAC,EAChC,KAAK;AAAA,CAAI,EACT,KAAK,EAIL,SAAS,CAAe,CAAC,EAAU,CACxC,MAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AA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W,CACtB,GAAI,IAAc,MAAQ,EAAa,CAAG,EACxC,OAAO,EAAW,EAAK,EAAQ,CAAS,EAE1C,OAAO,EAAS,CAAG,GAErB,UAAW,CACb,CAAC,EA+BD,GAAI,EACF,EAAU,CAAI,EAAE,WAAW,EAQ7B,GAAI,EAMF,GAAI,WAAW,mBAAqB,WAAW,sBAC7C,WAAW,kBAAoB,GAC/B,WAAW,sBAAwB,GACnC,EAAK,GAAG,KAAK,CAAE,KAAM,aAAc,CAAC,EAEpC,gBAAW,kBAAoB,GAC/B,EAAK,GAAG,KAAK,CAAE,KAAM,SAAU,MAAO,aAAc,CAAC,EAIvD,OAAmB,CAAE,KAAM,EAAO,KAAM,SAAQ,CAAC,EAGnD,OAAO",
12
- "debugId": "12A501EA67C37B7E64756E2164756E21",
12
+ "debugId": "C79A8DACF5D6C13A64756E2164756E21",
13
13
  "names": []
14
14
  }
@@ -0,0 +1,5 @@
1
+ // @bun
2
+ import{Hh as k,mh as g,nh as m}from"./chunk-9pkj7sk6.js";import{Ri as p}from"./chunk-g5ppst76.js";import{gj as n}from"./chunk-hm9cjxy2.js";var b={};n(b,{registeredNames:()=>x,register:()=>i,has:()=>S,get:()=>_,clearRegistry:()=>a});var M=new Map;function i(q,z){M.set(q,z)}function S(q){return M.has(q)}function _(q){let z=M.get(q);if(z===void 0)throw new k(q,[...M.keys()]);return z}function x(){return[...M.keys()]}function a(){M.clear()}import{createCipheriv as r,createDecipheriv as e,randomBytes as qq}from"crypto";class Y{static token="encrypter";keys=new Map;currentId;constructor(q={}){for(let[z,J]of Object.entries(q.keys??{})){if(!u.test(z))throw new U(`Encryption key id "${z}" is not valid. Use 1-32 letters, digits, "_" or "-": the id is written into every encrypted value.`);this.keys.set(z,zq(z,J))}if(q.current!==void 0){if(!this.keys.has(q.current))throw new U(`encryption.current is "${q.current}", but encryption.keys has no key by that id (${I(this.keys)}).`);this.currentId=q.current}else if(this.keys.size===1)this.currentId=[...this.keys.keys()][0];else if(this.keys.size>1)throw new U(`encryption.keys has ${this.keys.size} keys (${I(this.keys)}) and no encryption.current to say which one encrypts new values.`)}get configured(){return this.currentId!==void 0}get currentKeyId(){return this.requireCurrent()}encrypt(q){if(typeof q!=="string")throw TypeError(`Encrypter.encrypt takes a string, got ${Jq(q)}. Serialise other values first (JSON.stringify).`);let z=this.requireCurrent(),J=this.keys.get(z),Q=`${j}:${z}`,Z=qq(y),$=r(E,J,Z);$.setAAD(Buffer.from(Q));let X=Buffer.concat([$.update(q,"utf8"),$.final(),$.getAuthTag()]);return`${Q}:${Z.toString("base64url")}:${X.toString("base64url")}`}decrypt(q){let z=D(q);if(!z)throw new N("malformed","The value is not an encrypted envelope.");if(!this.configured)this.requireCurrent();let J=this.keys.get(z.keyId);if(!J)throw new N("unknown_key",`The value was encrypted with key "${z.keyId}", which is not in encryption.keys (${I(this.keys)}). Keep a key configured until encryption:rotate has re-encrypted the values written with it.`);try{let Q=e(E,J,z.iv);return Q.setAAD(Buffer.from(`${j}:${z.keyId}`)),Q.setAuthTag(z.tag),Buffer.concat([Q.update(z.ciphertext),Q.final()]).toString("utf8")}catch{throw new N("invalid",`The value did not authenticate under key "${z.keyId}": it was altered, or encrypted with a different key under the same id.`)}}isEncrypted(q){return D(q)!==null}keyIdOf(q){return D(q)?.keyId??null}needsReencryption(q){return this.keyIdOf(q)!==this.requireCurrent()}requireCurrent(){if(this.currentId===void 0)throw new U("No encryption key is configured. Add app/config/encryption.ts (defineEncryptionConfig({ keys: { k1: process.env.APP_ENCRYPTION_KEY } })) and list it as `encryption` in your Kernel's config. Generate a key with `openssl rand -base64 32`.");return this.currentId}}class U extends Error{constructor(q){super(q);this.name="EncryptionKeyError"}}class N extends Error{reason;column;constructor(q,z){super(z);this.reason=q;this.name="DecryptionError"}}var j="v1",E="aes-256-gcm",f=32,y=12,A=16,u=/^[A-Za-z0-9_-]{1,32}$/,v=/^[A-Za-z0-9_-]+$/;function zq(q,z){if(typeof z!=="string"||z.trim()==="")throw new U(`Encryption key "${q}" is empty. Is the environment variable it reads set?`);let J=z.trim().replace(/^base64:/,""),Q=/^[A-Za-z0-9+/=_-]+$/.test(J)?Buffer.from(J,"base64"):Buffer.alloc(0);if(Q.length!==f)throw new U(`Encryption key "${q}" is not ${f} bytes of base64 (it decodes to ${Q.length}). Generate one with \`openssl rand -base64 32\`.`);return Q}function D(q){if(typeof q!=="string")return null;let z=q.split(":");if(z.length!==4||z[0]!==j)return null;let[,J,Q,Z]=z;if(!u.test(J)||!v.test(Q)||!v.test(Z))return null;let $=Buffer.from(Q,"base64url"),X=Buffer.from(Z,"base64url");if($.length!==y||X.length<A)return null;return{keyId:J,iv:$,ciphertext:X.subarray(0,X.length-A),tag:X.subarray(X.length-A)}}function I(q){return q.size===0?"none configured":[...q.keys()].map((z)=>`"${z}"`).join(", ")}function Jq(q){return q===null?"null":Array.isArray(q)?"an array":`a ${typeof q}`}var h=new WeakMap;function T(q){let z=h.get(q);if(z===void 0)z=Object.values(q.fields).filter((J)=>J.encrypted===!0).map((J)=>J.name),h.set(q,z);return z}function Mq(){let q=new Set,z=[];for(let J of x()){let Q=O(J);if(!Q||q.has(Q.name))continue;q.add(Q.name);for(let Z of T(Q))z.push(`${Q.name}.${Z}`)}return z}function c(){let q=p();if(!q.bound(Y))throw new U("Encrypted columns need an Encrypter, and none is bound in this application. A booted Kernel binds one from the `encryption` config slice; a hand-built Application can bind its own: `application.instance(Encrypter, new Encrypter({ keys: { k1: key } }))`.");return q.make(Y)}var l=Symbol("gemi.orm.encryptedColumnsRaw");function Nq(q){return{...q,[l]:!0}}function Vq(q){return typeof q==="object"&&q!==null&&q[l]===!0}function Lq(q,z,J){if(!P(J))return;let Q={model:q.name,operation:z};d(q,J,Q,0);for(let Z of["by","_min","_max","_avg","_sum"])if(J[Z]!==void 0)o(q,J[Z],Z,Q);if(J.having!==void 0)B(q,J.having,Q)}var w=64;function d(q,z,J,Q){if(Q>w)return;if(z.where!==void 0)W(q,z.where,"where",J,Q);if(z.cursor!==void 0)W(q,z.cursor,"cursor",J,Q);if(z.orderBy!==void 0)K(q,z.orderBy,J,Q);if(z.distinct!==void 0)o(q,z.distinct,"distinct",J);for(let Z of[z.include,z.select]){if(!P(Z))continue;for(let[$,X]of Object.entries(Z)){if(!P(X))continue;if($==="_count"){if(!P(X.select))continue;for(let[G,F]of Object.entries(X.select)){let H=R(q,G);if(H&&P(F)&&F.where!==void 0)W(H,F.where,"where",J,Q+1)}continue}let C=R(q,$);if(C)d(C,X,J,Q+1)}}}var Qq=["some","every","none","is","isNot"];function W(q,z,J,Q,Z){if(Z>w)return;if(Array.isArray(z)){for(let $ of z)W(q,$,J,Q,Z);return}if(!P(z))return;for(let[$,X]of Object.entries(z)){if(X===void 0)continue;if($==="AND"||$==="OR"||$==="NOT"){W(q,X,J,Q,Z);continue}let C=q.fields[$];if(C){if(C.encrypted===!0&&!t(X))L(q,$,J,Q);continue}let G=R(q,$);if(G){if(!P(X))continue;let F=Object.keys(X).filter((H)=>Qq.includes(H));if(F.length>0)for(let H of F)W(G,X[H],J,Q,Z+1);else W(G,X,J,Q,Z+1);continue}if(P(X)){for(let F of Object.keys(X))if(q.fields[F]?.encrypted===!0)L(q,F,J,Q)}}}function K(q,z,J,Q){if(Q>w)return;if(Array.isArray(z)){for(let Z of z)K(q,Z,J,Q);return}if(!P(z))return;for(let[Z,$]of Object.entries(z)){if(q.fields[Z]?.encrypted===!0)L(q,Z,"orderBy",J);let X=R(q,Z);if(X&&P($)&&!("_count"in $))K(X,$,J,Q+1)}}function o(q,z,J,Q){let Z=typeof z==="string"?[z]:Array.isArray(z)?z.filter(($)=>typeof $==="string"):P(z)?Object.keys(z).filter(($)=>z[$]):[];for(let $ of Z)if(q.fields[$]?.encrypted===!0)L(q,$,J,Q)}function B(q,z,J){if(Array.isArray(z)){for(let Q of z)B(q,Q,J);return}if(!P(z))return;for(let[Q,Z]of Object.entries(z)){if(Q==="AND"||Q==="OR"||Q==="NOT"){B(q,Z,J);continue}if(q.fields[Q]?.encrypted===!0&&!t(Z))L(q,Q,"having",J)}}function t(q){if(q===null)return!0;if(!P(q))return!1;let z=Object.entries(q).filter(([,J])=>J!==void 0);return z.length>0&&z.every(([J,Q])=>(J==="equals"||J==="not")&&Q===null)}function L(q,z,J,Q){throw new m(J,Q.model,Q.operation,`${q.name}.${z} is an encrypted column: each write stores a different random ciphertext, so the database cannot compare, sort or group by it. Only null checks work on it ({ ${z}: null } or { ${z}: { not: null } }). To look a row up by a secret, store a keyed hash of it in a separate column and filter on that.`)}function Yq(q,z,J){let Q=T(q);if(Q.length===0||!P(J))return J;let Z={model:q.name,operation:z},$,X=(F)=>($??=c()).encrypt(F),C=J,G=(F,H)=>{if(H===C[F])return;if(C===J)C={...J};C[F]=H};switch(z){case"create":case"update":case"updateMany":G("data",V(Q,J.data,X,Z));break;case"createMany":G("data",Array.isArray(J.data)?Zq(J.data,(F)=>V(Q,F,X,Z)):V(Q,J.data,X,Z));break;case"upsert":G("create",V(Q,J.create,X,Z)),G("update",V(Q,J.update,X,Z));break}return C}function V(q,z,J,Q){if(!P(z))return z;let Z;for(let $ of q){if(!($ in z))continue;let X=z[$],C=s($,X,J,Q);if(C!==X)(Z??={...z})[$]=C}return Z??z}function s(q,z,J,Q){if(z===void 0||z===null)return z;if(typeof z==="string")return J(z);if(P(z)&&Object.keys(z).length===1&&"set"in z){let Z=z.set;return Z===null||Z===void 0?z:{set:s(q,Z,J,Q)}}throw new g("data",Q.model,Q.operation,`${Q.model}.${q} is an encrypted column and takes a string or null (or { set: string | null }); got ${Cq(z)}.`)}function Zq(q,z){let J;return q.forEach((Q,Z)=>{let $=z(Q);if($!==Q)(J??=[...q])[Z]=$}),J??q}function $q(q,z){let J=T(q);if(J.length===0||z.length===0)return;let Q;for(let Z of z){if(!P(Z))continue;for(let $ of J){let X=Z[$];if(typeof X!=="string")continue;Q??=c();try{Z[$]=Q.decrypt(X)}catch(C){if(C instanceof N)C.column={model:q.name,field:$},C.message=`Could not decrypt ${q.name}.${$}: ${C.message}`;throw C}}}}function Xq(q,z){let J=O(q.model),Q=[];for(let Z of z){if(!P(Z))continue;let $=Z[q.as];if(Array.isArray($))Q.push(...$);else if(P($))Q.push($)}if(Q.length===0)return;if(J)$q(J,Q);for(let Z of q.folded??[])Xq(Z,Q)}function O(q){if(!S(q))return;return _(q).$schema}function R(q,z){let J=q.relations[z];return J?O(J.model):void 0}function P(q){return typeof q==="object"&&q!==null&&!Array.isArray(q)&&!(q instanceof Date)}function Cq(q){if(Array.isArray(q))return"an array";if(q instanceof Date)return"a Date";return`a ${typeof q}`}
3
+ export{i as Wg,S as Xg,_ as Yg,x as Zg,b as _g,Y as $g,U as ah,N as bh,T as ch,Mq as dh,c as eh,Nq as fh,Vq as gh,Lq as hh,Yq as ih,$q as jh,Xq as kh};
4
+
5
+ //# debugId=7BC05010EB21074264756E2164756E21
@@ -0,0 +1,12 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../orm/registry.ts", "../services/encryption/Encrypter.ts", "../orm/encryption.ts"],
4
+ "sourcesContent": [
5
+ "import { ModelNotRegisteredError } from \"./errors\";\n\n/**\n * Name-keyed, resolved at call time, never at module load.\n *\n * The generated schema refers to a relation's target by model *name*, not by\n * importing the class. Without that indirection `User.ts` imports `Post.ts`\n * imports `User.ts` and, under ESM, one of them is `undefined` while the other\n * is still evaluating. It is the classic ORM bootstrap failure and it shows up\n * the moment two models reference each other — which, in any real schema, is\n * immediately.\n *\n * It also keeps the generated files free of an import graph: they hold data and\n * strings only.\n */\nconst models = new Map<string, unknown>();\n\nexport function register(name: string, model: unknown): void {\n models.set(name, model);\n}\n\nexport function has(name: string): boolean {\n return models.has(name);\n}\n\nexport function get<T = unknown>(name: string): T {\n const model = models.get(name);\n if (model === undefined) {\n throw new ModelNotRegisteredError(name, [...models.keys()]);\n }\n return model as T;\n}\n\nexport function registeredNames(): string[] {\n return [...models.keys()];\n}\n\nexport function clearRegistry(): void {\n models.clear();\n}\n",
6
+ "import { createCipheriv, createDecipheriv, randomBytes } from \"node:crypto\";\n\nimport type { EncryptionConfig } from \"./config\";\n\n/**\n * Authenticated encryption for values at rest: encrypted columns\n * (`/// @gemi.encrypted` in the Prisma schema) and the `Crypt` facade.\n *\n * AES-256-GCM with a random 96-bit IV per value, so encrypting the same\n * plaintext twice gives two different ciphertexts, and a value that was\n * altered, truncated or encrypted under another key fails to decrypt rather\n * than decrypting to something else.\n *\n * Every value is a self-describing envelope:\n *\n * v1:<keyId>:<iv>:<ciphertext+tag> (iv and ciphertext base64url)\n *\n * The key id is what makes rotation work: a value names the key it was\n * written with, so after `current` moves to a new key the old values still\n * decrypt as long as their key stays in `keys`, and `encryption:rotate` can\n * tell which values still need re-encrypting without decrypting them. The\n * `v1:<keyId>` prefix is authenticated as associated data, so it cannot be\n * edited to point a value at a different key.\n *\n * The envelope is plain ASCII, so it fits any text column. It is longer than\n * the plaintext: 4/3 of it plus about 50 characters.\n */\nexport class Encrypter {\n static token = \"encrypter\";\n\n private readonly keys = new Map<string, Buffer>();\n private readonly currentId: string | undefined;\n\n /**\n * @throws EncryptionKeyError when a key is empty or not 32 bytes, an id is\n * not a valid name, or `current` names no key. Construction is where a bad\n * configuration is reported, which is why the provider builds this at boot.\n */\n constructor(config: EncryptionConfig = {}) {\n for (const [id, value] of Object.entries(config.keys ?? {})) {\n if (!KEY_ID.test(id)) {\n throw new EncryptionKeyError(\n `Encryption key id \"${id}\" is not valid. Use 1-32 letters, digits, ` +\n `\"_\" or \"-\": the id is written into every encrypted value.`,\n );\n }\n this.keys.set(id, parseKey(id, value));\n }\n\n if (config.current !== undefined) {\n if (!this.keys.has(config.current)) {\n throw new EncryptionKeyError(\n `encryption.current is \"${config.current}\", but encryption.keys has ` +\n `no key by that id (${describeIds(this.keys)}).`,\n );\n }\n this.currentId = config.current;\n } else if (this.keys.size === 1) {\n this.currentId = [...this.keys.keys()][0];\n } else if (this.keys.size > 1) {\n throw new EncryptionKeyError(\n `encryption.keys has ${this.keys.size} keys (${describeIds(this.keys)}) ` +\n `and no encryption.current to say which one encrypts new values.`,\n );\n }\n }\n\n /** Whether a key is configured at all. */\n get configured(): boolean {\n return this.currentId !== undefined;\n }\n\n /** The id of the key new values are encrypted with. */\n get currentKeyId(): string {\n return this.requireCurrent();\n }\n\n /** Encrypts `plaintext` under the current key. */\n encrypt(plaintext: string): string {\n if (typeof plaintext !== \"string\") {\n throw new TypeError(\n `Encrypter.encrypt takes a string, got ${describeValue(plaintext)}. ` +\n `Serialise other values first (JSON.stringify).`,\n );\n }\n const id = this.requireCurrent();\n const key = this.keys.get(id)!;\n const header = `${VERSION}:${id}`;\n const iv = randomBytes(IV_BYTES);\n const cipher = createCipheriv(ALGORITHM, key, iv);\n cipher.setAAD(Buffer.from(header));\n const body = Buffer.concat([cipher.update(plaintext, \"utf8\"), cipher.final(), cipher.getAuthTag()]);\n return `${header}:${iv.toString(\"base64url\")}:${body.toString(\"base64url\")}`;\n }\n\n /**\n * The plaintext of an envelope `encrypt` produced, under whichever\n * configured key it names.\n *\n * @throws DecryptionError when the value is not an envelope, names a key\n * that is not configured, or fails authentication (tampered, truncated, or\n * encrypted under a different key with the same id). Never returns the input.\n */\n decrypt(envelope: string): string {\n const parsed = parseEnvelope(envelope);\n if (!parsed) {\n throw new DecryptionError(\"malformed\", \"The value is not an encrypted envelope.\");\n }\n if (!this.configured) this.requireCurrent();\n const key = this.keys.get(parsed.keyId);\n if (!key) {\n throw new DecryptionError(\n \"unknown_key\",\n `The value was encrypted with key \"${parsed.keyId}\", which is not in ` +\n `encryption.keys (${describeIds(this.keys)}). Keep a key configured ` +\n `until encryption:rotate has re-encrypted the values written with it.`,\n );\n }\n try {\n const decipher = createDecipheriv(ALGORITHM, key, parsed.iv);\n decipher.setAAD(Buffer.from(`${VERSION}:${parsed.keyId}`));\n decipher.setAuthTag(parsed.tag);\n return Buffer.concat([decipher.update(parsed.ciphertext), decipher.final()]).toString(\"utf8\");\n } catch {\n throw new DecryptionError(\n \"invalid\",\n `The value did not authenticate under key \"${parsed.keyId}\": it was ` +\n `altered, or encrypted with a different key under the same id.`,\n );\n }\n }\n\n /** Whether `value` has the shape of an envelope. Says nothing about its key. */\n isEncrypted(value: unknown): value is string {\n return parseEnvelope(value) !== null;\n }\n\n /** The key id an envelope names, or `null` when `value` is not one. */\n keyIdOf(value: unknown): string | null {\n return parseEnvelope(value)?.keyId ?? null;\n }\n\n /**\n * Whether `value` should be re-encrypted to be under the current key: true\n * for an envelope under an older key and for anything that is not an\n * envelope at all (a plaintext value written before the column was\n * encrypted).\n */\n needsReencryption(value: string): boolean {\n return this.keyIdOf(value) !== this.requireCurrent();\n }\n\n private requireCurrent(): string {\n if (this.currentId === undefined) {\n throw new EncryptionKeyError(\n \"No encryption key is configured. Add app/config/encryption.ts \" +\n \"(defineEncryptionConfig({ keys: { k1: process.env.APP_ENCRYPTION_KEY } })) \" +\n \"and list it as `encryption` in your Kernel's config. Generate a key \" +\n \"with `openssl rand -base64 32`.\",\n );\n }\n return this.currentId;\n }\n}\n\n/**\n * The encryption configuration is unusable: no key, a key that is not 32\n * bytes, or a `current` naming no key. Raised at boot when the app has\n * encrypted columns, and by the first encrypt or decrypt otherwise.\n */\nexport class EncryptionKeyError extends Error {\n constructor(message: string) {\n super(message);\n this.name = \"EncryptionKeyError\";\n }\n}\n\n/**\n * A value could not be decrypted. `reason` says why: `malformed` (not an\n * envelope, such as a plaintext value written before the column was\n * encrypted), `unknown_key` (its key is no longer configured) or `invalid`\n * (it failed authentication). The value itself is never in the message.\n */\nexport class DecryptionError extends Error {\n /** The model and field, when the value came from an encrypted column. */\n column?: { model: string; field: string };\n\n constructor(\n public readonly reason: \"malformed\" | \"unknown_key\" | \"invalid\",\n message: string,\n ) {\n super(message);\n this.name = \"DecryptionError\";\n }\n}\n\nconst VERSION = \"v1\";\nconst ALGORITHM = \"aes-256-gcm\";\nconst KEY_BYTES = 32;\nconst IV_BYTES = 12;\nconst TAG_BYTES = 16;\nconst KEY_ID = /^[A-Za-z0-9_-]{1,32}$/;\nconst BASE64URL = /^[A-Za-z0-9_-]+$/;\n\nfunction parseKey(id: string, value: string | undefined): Buffer {\n if (typeof value !== \"string\" || value.trim() === \"\") {\n throw new EncryptionKeyError(\n `Encryption key \"${id}\" is empty. Is the environment variable it reads set?`,\n );\n }\n const text = value.trim().replace(/^base64:/, \"\");\n const bytes = /^[A-Za-z0-9+/=_-]+$/.test(text) ? Buffer.from(text, \"base64\") : Buffer.alloc(0);\n if (bytes.length !== KEY_BYTES) {\n throw new EncryptionKeyError(\n `Encryption key \"${id}\" is not ${KEY_BYTES} bytes of base64 ` +\n `(it decodes to ${bytes.length}). Generate one with ` +\n \"`openssl rand -base64 32`.\",\n );\n }\n return bytes;\n}\n\ninterface Envelope {\n keyId: string;\n iv: Buffer;\n ciphertext: Buffer;\n tag: Buffer;\n}\n\nfunction parseEnvelope(value: unknown): Envelope | null {\n if (typeof value !== \"string\") return null;\n const parts = value.split(\":\");\n if (parts.length !== 4 || parts[0] !== VERSION) return null;\n const [, keyId, iv, body] = parts;\n if (!KEY_ID.test(keyId) || !BASE64URL.test(iv) || !BASE64URL.test(body)) return null;\n const ivBytes = Buffer.from(iv, \"base64url\");\n const bodyBytes = Buffer.from(body, \"base64url\");\n if (ivBytes.length !== IV_BYTES || bodyBytes.length < TAG_BYTES) return null;\n return {\n keyId,\n iv: ivBytes,\n ciphertext: bodyBytes.subarray(0, bodyBytes.length - TAG_BYTES),\n tag: bodyBytes.subarray(bodyBytes.length - TAG_BYTES),\n };\n}\n\nfunction describeIds(keys: Map<string, unknown>): string {\n return keys.size === 0 ? \"none configured\" : [...keys.keys()].map((id) => `\"${id}\"`).join(\", \");\n}\n\nfunction describeValue(value: unknown): string {\n return value === null ? \"null\" : Array.isArray(value) ? \"an array\" : `a ${typeof value}`;\n}\n",
7
+ "import { app } from \"../foundation/app\";\nimport {\n DecryptionError,\n Encrypter,\n EncryptionKeyError,\n} from \"../services/encryption/Encrypter\";\nimport { InvalidArgumentError, UnsupportedByDesignError } from \"./errors\";\nimport * as registry from \"./registry\";\nimport type { ModelSchema } from \"./schema\";\n\n/**\n * Encrypted columns: a `String` field marked `/// @gemi.encrypted` in the\n * Prisma schema is stored as an `Encrypter` envelope and read back as the\n * plaintext.\n *\n * Applied in `Model.$exec`, per model, at the two places a value crosses the\n * boundary:\n *\n * - **Writes** encrypt the model's *own* columns in `data` (and an upsert's\n * `create` / `update`). A nested write into a related model is not touched\n * here: every nested write runs through the related model's own `$exec`,\n * which encrypts its own columns, so encrypting it here as well would\n * encrypt it twice.\n * - **Reads** decrypt the model's own rows after shaping. A batched `include`\n * comes back through the child's `$exec` and is already decrypted; a folded\n * (lateral) one never enters it, so the parent decrypts those rows on the\n * child's behalf (`decryptFolded`) — the same split `redactFolded` handles\n * for policies.\n *\n * The schema, not the model class, says which columns are encrypted. That is\n * deliberate: a column that is encrypted when written through `FigmaConnection`\n * and plaintext when written through `FigmaConnectionModel` is not encrypted\n * at rest. The generated base, the subclass and every `Model.on(...)` variant\n * share one `$schema`, so none of them can write the column in the clear.\n *\n * A filter, sort or grouping on an encrypted column is refused: every write\n * stores a different random ciphertext, so the database cannot compare it to\n * anything. A null check is the exception, because a NULL column is stored as\n * NULL.\n */\n\nconst fieldsBySchema = new WeakMap<ModelSchema, readonly string[]>();\n\n/** The schema's encrypted fields, in declaration order. Empty for most models. */\nexport function encryptedFields(schema: ModelSchema): readonly string[] {\n let fields = fieldsBySchema.get(schema);\n if (fields === undefined) {\n fields = Object.values(schema.fields)\n .filter((field) => field.encrypted === true)\n .map((field) => field.name);\n fieldsBySchema.set(schema, fields);\n }\n return fields;\n}\n\n/** `Model.field` for every encrypted column of every registered model. */\nexport function encryptedColumnsInRegistry(): string[] {\n const seen = new Set<string>();\n const columns: string[] = [];\n for (const name of registry.registeredNames()) {\n const schema = schemaOf(name);\n if (!schema || seen.has(schema.name)) continue;\n seen.add(schema.name);\n for (const field of encryptedFields(schema)) columns.push(`${schema.name}.${field}`);\n }\n return columns;\n}\n\n/**\n * The application's `Encrypter`. An application booted without the\n * framework's providers (a test harness that binds only the database) gets a\n * typed error naming the fix rather than a container error.\n */\nexport function currentEncrypter(): Encrypter {\n const application = app();\n if (!application.bound(Encrypter)) {\n throw new EncryptionKeyError(\n \"Encrypted columns need an Encrypter, and none is bound in this \" +\n \"application. A booted Kernel binds one from the `encryption` config \" +\n \"slice; a hand-built Application can bind its own: \" +\n \"`application.instance(Encrypter, new Encrypter({ keys: { k1: key } }))`.\",\n );\n }\n return application.make(Encrypter);\n}\n\n// --- the internal raw mode ---------------------------------------------------\n\n/**\n * Marks an `$exec` call as reading and writing encrypted columns *as stored*:\n * no decryption of results, no encryption of `data`, and filters on encrypted\n * columns allowed (compared against the envelope). Used by `encryption:rotate`\n * to compare-and-swap one envelope for another. A module-private symbol, like\n * the other `$exec` markers, so an application cannot set it.\n */\nconst RAW = Symbol(\"gemi.orm.encryptedColumnsRaw\");\n\nexport function markEncryptionRaw<T extends object>(options: T): T {\n return { ...options, [RAW]: true };\n}\n\nexport function isEncryptionRaw(options: unknown): boolean {\n return (\n typeof options === \"object\" &&\n options !== null &&\n (options as Record<symbol, unknown>)[RAW] === true\n );\n}\n\n// --- refusing filters --------------------------------------------------------\n\ninterface Origin {\n model: string;\n operation: string;\n}\n\n/**\n * Refuses any argument that would make the database compare, sort or group an\n * encrypted column: `where` (including relation filters into other models),\n * `orderBy`, `distinct`, `cursor`, `groupBy`'s `by` and `having`, the\n * `_min` / `_max` aggregates, and the same arguments nested inside an\n * `include` or `select`.\n *\n * Walked whether or not this model has encrypted columns, because a relation\n * filter or an include reaches other models'.\n */\nexport function assertNoEncryptedFilters(schema: ModelSchema, op: string, args: unknown): void {\n if (!isObject(args)) return;\n const origin: Origin = { model: schema.name, operation: op };\n readArgs(schema, args, origin, 0);\n for (const key of [\"by\", \"_min\", \"_max\", \"_avg\", \"_sum\"]) {\n if (args[key] !== undefined) fieldList(schema, args[key], key, origin);\n }\n if (args.having !== undefined) having(schema, args.having, origin);\n}\n\n/** Generous: relation depth is bounded by `MAX_RELATION_DEPTH` long before this. */\nconst MAX_WALK_DEPTH = 64;\n\nfunction readArgs(schema: ModelSchema, args: Record<string, any>, origin: Origin, depth: number) {\n if (depth > MAX_WALK_DEPTH) return;\n if (args.where !== undefined) where(schema, args.where, \"where\", origin, depth);\n if (args.cursor !== undefined) where(schema, args.cursor, \"cursor\", origin, depth);\n if (args.orderBy !== undefined) orderBy(schema, args.orderBy, origin, depth);\n if (args.distinct !== undefined) fieldList(schema, args.distinct, \"distinct\", origin);\n\n for (const projection of [args.include, args.select]) {\n if (!isObject(projection)) continue;\n for (const [key, value] of Object.entries(projection)) {\n if (!isObject(value)) continue;\n if (key === \"_count\") {\n if (!isObject(value.select)) continue;\n for (const [name, count] of Object.entries(value.select)) {\n const target = relationTarget(schema, name);\n if (target && isObject(count) && count.where !== undefined) {\n where(target, count.where, \"where\", origin, depth + 1);\n }\n }\n continue;\n }\n const target = relationTarget(schema, key);\n if (target) readArgs(target, value, origin, depth + 1);\n }\n }\n}\n\nconst RELATION_FILTERS = [\"some\", \"every\", \"none\", \"is\", \"isNot\"];\n\nfunction where(\n schema: ModelSchema,\n node: unknown,\n argument: string,\n origin: Origin,\n depth: number,\n): void {\n if (depth > MAX_WALK_DEPTH) return;\n if (Array.isArray(node)) {\n for (const item of node) where(schema, item, argument, origin, depth);\n return;\n }\n if (!isObject(node)) return;\n\n for (const [key, value] of Object.entries(node)) {\n if (value === undefined) continue;\n\n if (key === \"AND\" || key === \"OR\" || key === \"NOT\") {\n where(schema, value, argument, origin, depth);\n continue;\n }\n\n const field = schema.fields[key];\n if (field) {\n if (field.encrypted === true && !isNullCheck(value)) {\n refuse(schema, key, argument, origin);\n }\n continue;\n }\n\n const target = relationTarget(schema, key);\n if (target) {\n if (!isObject(value)) continue;\n const filters = Object.keys(value).filter((name) => RELATION_FILTERS.includes(name));\n if (filters.length > 0) {\n for (const name of filters) where(target, value[name], argument, origin, depth + 1);\n } else {\n where(target, value, argument, origin, depth + 1);\n }\n continue;\n }\n\n // A compound unique key — `provider_providerId: { provider, providerId }`.\n if (isObject(value)) {\n for (const name of Object.keys(value)) {\n if (schema.fields[name]?.encrypted === true) refuse(schema, name, argument, origin);\n }\n }\n }\n}\n\nfunction orderBy(schema: ModelSchema, node: unknown, origin: Origin, depth: number): void {\n if (depth > MAX_WALK_DEPTH) return;\n if (Array.isArray(node)) {\n for (const item of node) orderBy(schema, item, origin, depth);\n return;\n }\n if (!isObject(node)) return;\n for (const [key, value] of Object.entries(node)) {\n if (schema.fields[key]?.encrypted === true) refuse(schema, key, \"orderBy\", origin);\n const target = relationTarget(schema, key);\n if (target && isObject(value) && !(\"_count\" in value)) {\n orderBy(target, value, origin, depth + 1);\n }\n }\n}\n\n/** `distinct`, `by`, and the `_min` / `_max` / `_avg` / `_sum` selections. */\nfunction fieldList(schema: ModelSchema, node: unknown, argument: string, origin: Origin): void {\n const names =\n typeof node === \"string\"\n ? [node]\n : Array.isArray(node)\n ? node.filter((name): name is string => typeof name === \"string\")\n : isObject(node)\n ? Object.keys(node).filter((name) => node[name])\n : [];\n for (const name of names) {\n if (schema.fields[name]?.encrypted === true) refuse(schema, name, argument, origin);\n }\n}\n\nfunction having(schema: ModelSchema, node: unknown, origin: Origin): void {\n if (Array.isArray(node)) {\n for (const item of node) having(schema, item, origin);\n return;\n }\n if (!isObject(node)) return;\n for (const [key, value] of Object.entries(node)) {\n if (key === \"AND\" || key === \"OR\" || key === \"NOT\") {\n having(schema, value, origin);\n continue;\n }\n if (schema.fields[key]?.encrypted === true && !isNullCheck(value)) {\n refuse(schema, key, \"having\", origin);\n }\n }\n}\n\n/** `null`, `{ equals: null }`, `{ not: null }` — the only comparisons a ciphertext supports. */\nfunction isNullCheck(value: unknown): boolean {\n if (value === null) return true;\n if (!isObject(value)) return false;\n const entries = Object.entries(value).filter(([, operand]) => operand !== undefined);\n return (\n entries.length > 0 &&\n entries.every(([operator, operand]) => (operator === \"equals\" || operator === \"not\") && operand === null)\n );\n}\n\nfunction refuse(schema: ModelSchema, field: string, argument: string, origin: Origin): never {\n throw new UnsupportedByDesignError(\n argument,\n origin.model,\n origin.operation,\n `${schema.name}.${field} is an encrypted column: each write stores a ` +\n `different random ciphertext, so the database cannot compare, sort or ` +\n `group by it. Only null checks work on it ({ ${field}: null } or ` +\n `{ ${field}: { not: null } }). To look a row up by a secret, store a ` +\n `keyed hash of it in a separate column and filter on that.`,\n );\n}\n\n// --- writes ------------------------------------------------------------------\n\n/**\n * `args` with this model's encrypted columns encrypted, or `args` itself when\n * there is nothing to encrypt. Never mutates the caller's objects: the same\n * `data` may be reused for a second call.\n *\n * Only `data` (and an upsert's `create` / `update`) at this level. Nested\n * relation writes are left as they are; see the note at the top of the file.\n */\nexport function encryptWriteArgs(schema: ModelSchema, op: string, args: any): any {\n const fields = encryptedFields(schema);\n if (fields.length === 0 || !isObject(args)) return args;\n\n const origin: Origin = { model: schema.name, operation: op };\n let encrypter: Encrypter | undefined;\n const encrypt = (value: string) => (encrypter ??= currentEncrypter()).encrypt(value);\n\n let next = args;\n const replace = (key: string, value: unknown) => {\n if (value === next[key]) return;\n if (next === args) next = { ...args };\n next[key] = value;\n };\n\n switch (op) {\n case \"create\":\n case \"update\":\n case \"updateMany\":\n replace(\"data\", encryptData(fields, args.data, encrypt, origin));\n break;\n case \"createMany\":\n replace(\n \"data\",\n Array.isArray(args.data)\n ? mapIfChanged(args.data, (row) => encryptData(fields, row, encrypt, origin))\n : encryptData(fields, args.data, encrypt, origin),\n );\n break;\n case \"upsert\":\n replace(\"create\", encryptData(fields, args.create, encrypt, origin));\n replace(\"update\", encryptData(fields, args.update, encrypt, origin));\n break;\n }\n return next;\n}\n\nfunction encryptData(\n fields: readonly string[],\n data: unknown,\n encrypt: (value: string) => string,\n origin: Origin,\n): unknown {\n if (!isObject(data)) return data;\n let copy: Record<string, unknown> | undefined;\n for (const name of fields) {\n if (!(name in data)) continue;\n const value = data[name];\n const next = encryptValue(name, value, encrypt, origin);\n if (next !== value) (copy ??= { ...data })[name] = next;\n }\n return copy ?? data;\n}\n\nfunction encryptValue(\n field: string,\n value: unknown,\n encrypt: (value: string) => string,\n origin: Origin,\n): unknown {\n if (value === undefined || value === null) return value;\n if (typeof value === \"string\") return encrypt(value);\n // Prisma's `{ set: value }` spelling of a scalar update.\n if (isObject(value) && Object.keys(value).length === 1 && \"set\" in value) {\n const set = value.set;\n return set === null || set === undefined ? value : { set: encryptValue(field, set, encrypt, origin) };\n }\n throw new InvalidArgumentError(\n \"data\",\n origin.model,\n origin.operation,\n `${origin.model}.${field} is an encrypted column and takes a string or ` +\n `null (or { set: string | null }); got ${describe(value)}.`,\n );\n}\n\nfunction mapIfChanged<T>(items: T[], fn: (item: T) => T): T[] {\n let copy: T[] | undefined;\n items.forEach((item, index) => {\n const next = fn(item);\n if (next !== item) (copy ??= [...items])[index] = next;\n });\n return copy ?? items;\n}\n\n// --- reads -------------------------------------------------------------------\n\n/**\n * Decrypts this model's encrypted columns on `rows`, in place. A value that\n * does not decrypt raises `DecryptionError` naming the column — a ciphertext\n * is never handed back as if it were the value.\n */\nexport function decryptRows(schema: ModelSchema, rows: readonly unknown[]): void {\n const fields = encryptedFields(schema);\n if (fields.length === 0 || rows.length === 0) return;\n\n let encrypter: Encrypter | undefined;\n for (const row of rows) {\n if (!isObject(row)) continue;\n for (const field of fields) {\n const value = row[field];\n if (typeof value !== \"string\") continue;\n encrypter ??= currentEncrypter();\n try {\n row[field] = encrypter.decrypt(value);\n } catch (error) {\n if (error instanceof DecryptionError) {\n error.column = { model: schema.name, field };\n error.message = `Could not decrypt ${schema.name}.${field}: ${error.message}`;\n }\n throw error;\n }\n }\n }\n}\n\n/**\n * Decrypts the rows a strategy folded into the parent's statement, which never\n * passed through their own model's `$exec`. Recursive, because the fold is.\n */\nexport function decryptFolded(\n relation: { as: string; model: string; folded?: readonly { as: string; model: string; folded?: readonly unknown[] }[] },\n parents: readonly unknown[],\n): void {\n const schema = schemaOf(relation.model);\n const rows: unknown[] = [];\n for (const parent of parents) {\n if (!isObject(parent)) continue;\n const value = parent[relation.as];\n if (Array.isArray(value)) rows.push(...value);\n else if (isObject(value)) rows.push(value);\n }\n if (rows.length === 0) return;\n if (schema) decryptRows(schema, rows);\n for (const child of relation.folded ?? []) {\n decryptFolded(child as Parameters<typeof decryptFolded>[0], rows);\n }\n}\n\n// --- helpers -----------------------------------------------------------------\n\nfunction schemaOf(model: string): ModelSchema | undefined {\n if (!registry.has(model)) return undefined;\n return registry.get<{ $schema?: ModelSchema }>(model).$schema;\n}\n\nfunction relationTarget(schema: ModelSchema, name: string): ModelSchema | undefined {\n const relation = schema.relations[name];\n return relation ? schemaOf(relation.model) : undefined;\n}\n\nfunction isObject(value: unknown): value is Record<string, any> {\n return typeof value === \"object\" && value !== null && !Array.isArray(value) && !(value instanceof Date);\n}\n\nfunction describe(value: unknown): string {\n if (Array.isArray(value)) return \"an array\";\n if (value instanceof Date) return \"a Date\";\n return `a ${typeof value}`;\n}\n"
8
+ ],
9
+ "mappings": ";oPAeA,FAAM,JAAS,IAAI,IAEZ,SAAS,CAAQ,CAAC,EAAc,EAAsB,CAC3D,EAAO,IAAI,EAAM,CAAK,EAGjB,SAAS,CAAG,CAAC,EAAuB,CACzC,OAAO,EAAO,IAAI,CAAI,EAGjB,SAAS,CAAgB,CAAC,EAAiB,CAChD,IAAM,EAAQ,EAAO,IAAI,CAAI,EAC7B,GAAI,IAAU,OACZ,MAAM,IAAI,EAAwB,EAAM,CAAC,GAAG,EAAO,KAAK,CAAC,CAAC,EAE5D,OAAO,EAGF,SAAS,CAAe,EAAa,CAC1C,MAAO,CAAC,GAAG,EAAO,KAAK,CAAC,EAGnB,SAAS,CAAa,EAAS,CACpC,EAAO,MAAM,ECtCf,yBAAS,sBAAgB,iBAAkB,gBA2BpC,MAAM,CAAU,OACd,OAAQ,YAEE,KAAO,IAAI,IACX,UAOjB,WAAW,CAAC,EAA2B,CAAC,EAAG,CACzC,QAAY,EAAI,KAAU,OAAO,QAAQ,EAAO,MAAQ,CAAC,CAAC,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AA8C,CAAI,EAMpE,SAAS,CAAQ,CAAC,EAAwC,CACxD,GAAI,CAAU,EAAI,CAAK,EAAG,OAC1B,OAAgB,EAA+B,CAAK,EAAE,QAGxD,SAAS,CAAc,CAAC,EAAqB,EAAuC,CAClF,IAAM,EAAW,EAAO,UAAU,GAClC,OAAO,EAAW,EAAS,EAAS,KAAK,EAAI,OAG/C,SAAS,CAAQ,CAAC,EAA8C,CAC9D,OAAO,OAAO,IAAU,UAAY,IAAU,MAAQ,CAAC,MAAM,QAAQ,CAAK,GAAK,EAAE,aAAiB,MAGpG,SAAS,EAAQ,CAAC,EAAwB,CACxC,GAAI,MAAM,QAAQ,CAAK,EAAG,MAAO,WACjC,GAAI,aAAiB,KAAM,MAAO,SAClC,MAAO,KAAK,OAAO",
10
+ "debugId": "7BC05010EB21074264756E2164756E21",
11
+ "names": []
12
+ }
@@ -1,6 +1,6 @@
1
1
  // @bun
2
- import{Fa as y}from"./chunk-5stgtwqw.js";import{createElement as q}from"react";function z(i,n){let p=Object.keys(n).sort((s,g)=>g.length-s.length).map((s)=>s.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")),b=new RegExp(p.join("|"),"g");return i.replace(b,(s)=>n[s])}async function L(i,n,p=[],b){let s=[...p.map((t)=>`${i}/views/${t}.tsx`),b?`${i}/views/${b}.tsx`:`${i}/views/RootLayout.tsx`],g=new Set;for(let t of s){let u=n.moduleGraph.getModulesByFile(t);if(u)for(let x of u)g.add(x)}let e=[],l=[],r={};for(let t of g)if(t)for(let u of t.importedModules){if(u.file.includes("module.css"))r[u.file]=u.ssrTransformResult.map.sourcesContent.join("");if(u.file.includes(".css"))l.push(u.file)}for(let t of l){let u=await n.transformRequest(t+"?direct"),x=t.includes("module.css"),k="";if(x)k=z(r[t],u.default);e.push({isDev:!0,id:t,content:x?k:u.code})}return e.map((t,u)=>{return q("style",{key:u,type:"text/css","data-vite-dev-id":t.id,dangerouslySetInnerHTML:{__html:t.content}})})}async function _(i=[]){return i.map((n,p)=>{return q("style",{key:p,id:n?.id,type:"text/css",dangerouslySetInnerHTML:{__html:n.content}})})}import{existsSync as J}from"fs";import{basename as N}from"path";import{networkInterfaces as O}from"os";var v={name:"gemi",version:"0.116.0",private:!1,license:"MIT",author:"Enes Tufekci <enes@gemijs.dev>",repository:{type:"git",url:"git+https://github.com/nstfkc/gemi.git",directory:"packages/gemi"},bin:{gemi:"./dist/bin/gemi.js","gemi-orm-generator":"./dist/bin/orm-generator.js"},files:["dist/**/*","ide/typescript-plugin/package.json","skills/**/*"],module:!0,exports:{"./http":"./http/index.ts","./client":"./client/index.ts","./ai":"./ai/index.ts","./ai/client":"./ai/client/index.ts","./testing":"./testing/index.ts","./app":"./app/index.ts","./facades":"./facades/index.ts","./email":"./email/index.ts","./vite":"./dist/vite/index.mjs","./kernel":"./kernel/index.ts","./services":"./services/index.ts","./i18n":"./i18n/index.ts","./dictionary":"./i18n/dictionaryRuntime.ts","./server":"./server/index.ts","./config":"./config/index.ts","./container":"./container/index.ts","./foundation":"./foundation/index.ts","./database":"./database/index.ts","./orm":"./orm/index.ts","./support":"./support/index.ts","./console/run":"./console/run.ts","./queue/work":"./services/queue/work.ts","./stats/route-table":"./stats/route-table.ts","./ide/typescript-plugin":"./ide/typescript-plugin/index.ts","./bun/preload":"./bun/preload.ts","./bun/plugin":"./bun/plugin.ts","./vitest":"./vitest/index.ts"},scripts:{lint:"oxlint",typecheck:"tsc --noEmit -p tsconfig.json && tsc --noEmit -p tsconfig.browser.json && tsc --noEmit -p ide/typescript-plugin/tsconfig.json",build:"NODE_ENV=production bun run build:core && bun run build:bin && bun run build:types && bun run build:client && bun run build:plugin && bun run build:ts-plugin && bun run build:client-types && bun run build:augmentation","build:core":"bun ./scripts/build.ts","build:bin":"bun build --outdir=./dist/bin --target=bun --external=vite --external=react-dom --external=react/jsx-runtime --external=bun --external=sharp --external=@azure/storage-blob --external=typescript --sourcemap ./bin/gemi.ts ./bin/orm-generator.ts && bun ./scripts/prepare-bin.ts","build:client":"rm -rf dist/client dist/testing dist/ai/client dist/chunks && vite build -c vite.client.config.mts","build:plugin":"vite build -c vite.plugin.config.mts","build:ts-plugin":"bun ./scripts/build-ts-plugin.ts","build:types":"tsc -p tsconfig.build.json","build:client-types":"tsc -p tsconfig.browser.json",test:"bun --bun x vitest","test:types":"vitest run --typecheck.only","test:live":"bun --bun x vitest run ai/live","test:packaging":"bun --bun x vitest run --config vitest.packaging.config.ts","build:publish":"bun scripts/build-publish.ts",prepublishOnly:"echo 'Do not publish from this directory \u2014 its exports point at TS source. Run: bun run build:publish, then publish from .publish/' && exit 1","build:augmentation":"bun ./scripts/wire-augmentation.ts"},dependencies:{"@aws-sdk/client-s3":"^3.629.0","@aws-sdk/s3-request-presigner":"^3.629.0","ast-types":"^0.14.2",commander:"^12.1.0",history:"^5.3.0","jsx-email":"2.0.0-rc2.1","magic-string":"^0.30.17",open:"^10.1.0","react-error-boundary":"^6.0.0",recast:"^0.23.9",resend:"^6.12.3",satori:"^0.12.2","temporal-polyfill":"^0.2.5","twitter-api-v2":"^1.20.2","urlpattern-polyfill":"^10.0.0",uuid:"^9.0.1"},devDependencies:{"@babel/parser":"^7.25.4","@prisma/generator-helper":"^6.5.0","@repo/typescript-config":"*","@testing-library/react":"^16.3.2","@types/bun":"^1.3.14","@types/eslint":"^8.56.5","@types/node":"^20.11.24","@types/react":"^19.0.2","@types/react-dom":"^19.0.2",eslint:"^8.57.0",jsdom:"^30.0.1",oxlint:"^1.39.0",postgres:"^3.4.5",react:"19.2.3","react-dom":"19.2.3",typescript:"^5.7.3",vitest:"^4.0.0"},peerDependencies:{"@azure/storage-blob":"^12.28.0",react:">=19","react-dom":">=19",sharp:"^0.34.2",typescript:">=5",vite:"^8.0.0",postgres:"^3.4.0"},peerDependenciesMeta:{"@azure/storage-blob":{optional:!0},typescript:{optional:!0},postgres:{optional:!0}}};var Q=[" \u2588\u2588\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557\u2588\u2588\u2588\u2557 \u2588\u2588\u2588\u2557\u2588\u2588\u2557","\u2588\u2588\u2554\u2550\u2550\u2550\u2550\u255D \u2588\u2588\u2554\u2550\u2550\u2550\u2550\u255D\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2588\u2588\u2551\u2588\u2588\u2551","\u2588\u2588\u2551 \u2588\u2588\u2588\u2557\u2588\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2554\u2588\u2588\u2588\u2588\u2554\u2588\u2588\u2551\u2588\u2588\u2551","\u2588\u2588\u2551 \u2588\u2588\u2551\u2588\u2588\u2554\u2550\u2550\u255D \u2588\u2588\u2551\u255A\u2588\u2588\u2554\u255D\u2588\u2588\u2551\u2588\u2588\u2551","\u255A\u2588\u2588\u2588\u2588\u2588\u2588\u2554\u255D\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557\u2588\u2588\u2551 \u255A\u2550\u255D \u2588\u2588\u2551\u2588\u2588\u2551"," \u255A\u2550\u2550\u2550\u2550\u2550\u255D \u255A\u2550\u2550\u2550\u2550\u2550\u2550\u255D\u255A\u2550\u255D \u255A\u2550\u255D\u255A\u2550\u255D"],W=Boolean(process.stdout.isTTY)&&!process.env.NO_COLOR,c=(i,n)=>W?`\x1B[${i}m${n}\x1B[0m`:n,X=(i)=>c("1",i),d=(i)=>c("2",i),j=(i)=>c("36",i),Y=(i)=>c("32",i),Z=(i)=>c("35",i);function $(){return v.version??"?"}function f(i){for(let n of Object.values(O()))for(let p of n??[])if((p.family==="IPv4"||p.family===4)&&!p.internal)return`http://${p.address}:${i}`;return null}function H(i){return y(i).filter((n)=>J(n)).map((n)=>N(n))}function T(i){let{port:n,rootDir:p}=i,b=`http://localhost:${n}`,s=f(n),g=H(p),e=(r,t)=>` ${Y("\u279C")} ${X(r.padEnd(9))}${t}`,l=["",...Q.map((r)=>Z(r)),"",` ${d("gemi")} ${j(`v${$()}`)}`,"",e("Local:",j(b)),e("Network:",s?j(s):d("unavailable")),e("Env:",g.length?g.join(", "):d("none")),""];console.log(l.join(`
2
+ import{Ga as y}from"./chunk-2bja99cq.js";import{createElement as q}from"react";function z(i,n){let p=Object.keys(n).sort((s,g)=>g.length-s.length).map((s)=>s.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")),b=new RegExp(p.join("|"),"g");return i.replace(b,(s)=>n[s])}async function L(i,n,p=[],b){let s=[...p.map((t)=>`${i}/views/${t}.tsx`),b?`${i}/views/${b}.tsx`:`${i}/views/RootLayout.tsx`],g=new Set;for(let t of s){let u=n.moduleGraph.getModulesByFile(t);if(u)for(let x of u)g.add(x)}let e=[],l=[],r={};for(let t of g)if(t)for(let u of t.importedModules){if(u.file.includes("module.css"))r[u.file]=u.ssrTransformResult.map.sourcesContent.join("");if(u.file.includes(".css"))l.push(u.file)}for(let t of l){let u=await n.transformRequest(t+"?direct"),x=t.includes("module.css"),k="";if(x)k=z(r[t],u.default);e.push({isDev:!0,id:t,content:x?k:u.code})}return e.map((t,u)=>{return q("style",{key:u,type:"text/css","data-vite-dev-id":t.id,dangerouslySetInnerHTML:{__html:t.content}})})}async function _(i=[]){return i.map((n,p)=>{return q("style",{key:p,id:n?.id,type:"text/css",dangerouslySetInnerHTML:{__html:n.content}})})}import{existsSync as J}from"fs";import{basename as N}from"path";import{networkInterfaces as O}from"os";var v={name:"gemi",version:"0.118.0",private:!1,license:"MIT",author:"Enes Tufekci <enes@gemijs.dev>",repository:{type:"git",url:"git+https://github.com/nstfkc/gemi.git",directory:"packages/gemi"},bin:{gemi:"./dist/bin/gemi.js","gemi-orm-generator":"./dist/bin/orm-generator.js"},files:["dist/**/*","ide/typescript-plugin/package.json","skills/**/*"],module:!0,exports:{"./http":"./http/index.ts","./client":"./client/index.ts","./ai":"./ai/index.ts","./ai/client":"./ai/client/index.ts","./testing":"./testing/index.ts","./app":"./app/index.ts","./facades":"./facades/index.ts","./email":"./email/index.ts","./vite":"./dist/vite/index.mjs","./kernel":"./kernel/index.ts","./services":"./services/index.ts","./i18n":"./i18n/index.ts","./dictionary":"./i18n/dictionaryRuntime.ts","./server":"./server/index.ts","./config":"./config/index.ts","./container":"./container/index.ts","./foundation":"./foundation/index.ts","./database":"./database/index.ts","./orm":"./orm/index.ts","./support":"./support/index.ts","./console/run":"./console/run.ts","./queue/work":"./services/queue/work.ts","./stats/route-table":"./stats/route-table.ts","./ide/typescript-plugin":"./ide/typescript-plugin/index.ts","./bun/preload":"./bun/preload.ts","./bun/plugin":"./bun/plugin.ts","./vitest":"./vitest/index.ts"},scripts:{lint:"oxlint",typecheck:"tsc --noEmit -p tsconfig.json && tsc --noEmit -p tsconfig.browser.json && tsc --noEmit -p ide/typescript-plugin/tsconfig.json",build:"NODE_ENV=production bun run build:core && bun run build:bin && bun run build:types && bun run build:client && bun run build:plugin && bun run build:ts-plugin && bun run build:client-types && bun run build:augmentation","build:core":"bun ./scripts/build.ts","build:bin":"bun build --outdir=./dist/bin --target=bun --external=vite --external=react-dom --external=react/jsx-runtime --external=bun --external=sharp --external=@azure/storage-blob --external=typescript --sourcemap ./bin/gemi.ts ./bin/orm-generator.ts && bun ./scripts/prepare-bin.ts","build:client":"rm -rf dist/client dist/testing dist/ai/client dist/chunks && vite build -c vite.client.config.mts","build:plugin":"vite build -c vite.plugin.config.mts","build:ts-plugin":"bun ./scripts/build-ts-plugin.ts","build:types":"tsc -p tsconfig.build.json","build:client-types":"tsc -p tsconfig.browser.json",test:"bun --bun x vitest","test:types":"vitest run --typecheck.only","test:live":"bun --bun x vitest run ai/live","test:packaging":"bun --bun x vitest run --config vitest.packaging.config.ts","build:publish":"bun scripts/build-publish.ts",prepublishOnly:"echo 'Do not publish from this directory \u2014 its exports point at TS source. Run: bun run build:publish, then publish from .publish/' && exit 1","build:augmentation":"bun ./scripts/wire-augmentation.ts"},dependencies:{"@aws-sdk/client-s3":"^3.629.0","@aws-sdk/s3-request-presigner":"^3.629.0","ast-types":"^0.14.2",commander:"^12.1.0",history:"^5.3.0","jsx-email":"2.0.0-rc2.1","magic-string":"^0.30.17",open:"^10.1.0","react-error-boundary":"^6.0.0",recast:"^0.23.9",resend:"^6.12.3",satori:"^0.12.2","temporal-polyfill":"^0.2.5","twitter-api-v2":"^1.20.2","urlpattern-polyfill":"^10.0.0",uuid:"^9.0.1"},devDependencies:{"@babel/parser":"^7.25.4","@prisma/generator-helper":"^6.5.0","@repo/typescript-config":"*","@testing-library/react":"^16.3.2","@types/bun":"^1.3.14","@types/eslint":"^8.56.5","@types/node":"^20.11.24","@types/react":"^19.0.2","@types/react-dom":"^19.0.2",eslint:"^8.57.0",jsdom:"^30.0.1",oxlint:"^1.39.0",postgres:"^3.4.5",react:"19.2.3","react-dom":"19.2.3",typescript:"^5.7.3",vitest:"^4.0.0"},peerDependencies:{"@azure/storage-blob":"^12.28.0",react:">=19","react-dom":">=19",sharp:"^0.34.2",typescript:">=5",vite:"^8.0.0",postgres:"^3.4.0"},peerDependenciesMeta:{"@azure/storage-blob":{optional:!0},typescript:{optional:!0},postgres:{optional:!0}}};var Q=[" \u2588\u2588\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557\u2588\u2588\u2588\u2557 \u2588\u2588\u2588\u2557\u2588\u2588\u2557","\u2588\u2588\u2554\u2550\u2550\u2550\u2550\u255D \u2588\u2588\u2554\u2550\u2550\u2550\u2550\u255D\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2588\u2588\u2551\u2588\u2588\u2551","\u2588\u2588\u2551 \u2588\u2588\u2588\u2557\u2588\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2554\u2588\u2588\u2588\u2588\u2554\u2588\u2588\u2551\u2588\u2588\u2551","\u2588\u2588\u2551 \u2588\u2588\u2551\u2588\u2588\u2554\u2550\u2550\u255D \u2588\u2588\u2551\u255A\u2588\u2588\u2554\u255D\u2588\u2588\u2551\u2588\u2588\u2551","\u255A\u2588\u2588\u2588\u2588\u2588\u2588\u2554\u255D\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557\u2588\u2588\u2551 \u255A\u2550\u255D \u2588\u2588\u2551\u2588\u2588\u2551"," \u255A\u2550\u2550\u2550\u2550\u2550\u255D \u255A\u2550\u2550\u2550\u2550\u2550\u2550\u255D\u255A\u2550\u255D \u255A\u2550\u255D\u255A\u2550\u255D"],W=Boolean(process.stdout.isTTY)&&!process.env.NO_COLOR,c=(i,n)=>W?`\x1B[${i}m${n}\x1B[0m`:n,X=(i)=>c("1",i),d=(i)=>c("2",i),j=(i)=>c("36",i),Y=(i)=>c("32",i),Z=(i)=>c("35",i);function $(){return v.version??"?"}function f(i){for(let n of Object.values(O()))for(let p of n??[])if((p.family==="IPv4"||p.family===4)&&!p.internal)return`http://${p.address}:${i}`;return null}function H(i){return y(i).filter((n)=>J(n)).map((n)=>N(n))}function T(i){let{port:n,rootDir:p}=i,b=`http://localhost:${n}`,s=f(n),g=H(p),e=(r,t)=>` ${Y("\u279C")} ${X(r.padEnd(9))}${t}`,l=["",...Q.map((r)=>Z(r)),"",` ${d("gemi")} ${j(`v${$()}`)}`,"",e("Local:",j(b)),e("Network:",s?j(s):d("unavailable")),e("Env:",g.length?g.join(", "):d("none")),""];console.log(l.join(`
3
3
  `))}function I(i=process.env.SERVER_IDLE_TIMEOUT){if(i===void 0||i.trim()==="")return 10;let n=Number(i.trim());if(!Number.isInteger(n)||n<0||n>255)throw Error(`SERVER_IDLE_TIMEOUT must be a whole number of seconds from 0 to 255 (0 disables the timeout), got ${JSON.stringify(i)}.`);return n}
4
4
  export{L as R,_ as S,T,I as U};
5
5
 
6
- //# debugId=CA6084C1FF63828F64756E2164756E21
6
+ //# debugId=5943BCDC9399E0C564756E2164756E21
@@ -7,6 +7,6 @@
7
7
  "/**\n * Bun's default, and what both servers use when `SERVER_IDLE_TIMEOUT` is unset.\n */\nexport const DEFAULT_SERVER_IDLE_TIMEOUT = 10;\n\n/**\n * The `idleTimeout` (seconds) both `gemi dev` and `gemi start` pass to\n * `Bun.serve`, from `SERVER_IDLE_TIMEOUT` (#787).\n *\n * One reader for both servers, so a long-poll that works under `gemi start`\n * also works under `gemi dev`. Before this, only `httpProd` read the variable\n * and the dev server always ran at Bun's 10 seconds.\n *\n * It is the time a connection may stay silent, a response that has not started\n * included, before Bun closes it; `0` disables it. It does not apply to an\n * upgraded websocket (the HMR relay included), which has its own\n * `websocket.idleTimeout`.\n *\n * Unset or blank means the default. Anything that is not a whole number from 0\n * to 255 (Bun's own limits) fails the boot with the variable's name, instead\n * of Bun's \"expects idleTimeout to be an integer\", which does not say where the\n * value came from.\n */\nexport function serverIdleTimeout(raw: string | undefined = process.env.SERVER_IDLE_TIMEOUT): number {\n if (raw === undefined || raw.trim() === \"\") return DEFAULT_SERVER_IDLE_TIMEOUT;\n\n const seconds = Number(raw.trim());\n if (!Number.isInteger(seconds) || seconds < 0 || seconds > 255) {\n throw new Error(\n `SERVER_IDLE_TIMEOUT must be a whole number of seconds from 0 to 255 ` +\n `(0 disables the timeout), got ${JSON.stringify(raw)}.`,\n );\n }\n return seconds;\n}\n"
8
8
  ],
9
9
  "mappings": ";yCAAA,wBAAS,cAGT,SAAS,CAAc,CAAC,EAAc,EAAwC,CAC5E,IAAM,EAAc,OAAO,KAAK,CAAM,EACnC,KAAK,CAAC,EAAG,IAAM,EAAE,OAAS,EAAE,MAAM,EAClC,IAAI,CAAC,IAAQ,EAAI,QAAQ,sBAAuB,MAAM,CAAC,EAGpD,EAAQ,IAAI,OAAO,EAAY,KAAK,GAAG,EAAG,GAAG,EAEnD,OAAO,EAAK,QAAQ,EAAO,CAAC,IAAU,EAAO,EAAM,EAGrD,eAAsB,CAAe,CACnC,EACA,EACA,EAAyB,CAAC,EAE1B,EACA,CACA,IAAM,EAAQ,CACZ,GAAG,EAAa,IAAI,CAAC,IAAS,GAAG,WAAgB,OAAU,EAC3D,EAAS,GAAG,WAAgB,QAAe,GAAG,wBAChD,EAEM,EAAU,IAAI,IACpB,QAAW,KAAQ,EAAO,CACxB,IAAM,EAAM,EAAK,YAAY,iBAAiB,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AQ,IAAI,oBAA6B,CACnG,GAAI,IAAQ,QAAa,EAAI,KAAK,IAAM,GAAI,MArBH,IAuBzC,IAAM,EAAU,OAAO,EAAI,KAAK,CAAC,EACjC,GAAI,CAAC,OAAO,UAAU,CAAO,GAAK,EAAU,GAAK,EAAU,IACzD,MAAU,MACR,qGACmC,KAAK,UAAU,CAAG,IACvD,EAEF,OAAO",
10
- "debugId": "CA6084C1FF63828F64756E2164756E21",
10
+ "debugId": "5943BCDC9399E0C564756E2164756E21",
11
11
  "names": []
12
12
  }
@@ -0,0 +1,5 @@
1
+ // @bun
2
+ var _=/^[a-z]{2,3}(?:[-_][a-z0-9]{2,8})*$/i;function I(j){return _.test(j)}function U(j){return j.split(/[-_]/)[0].toLowerCase()}function H(j,B,N){let R=j?.split(";")[0].trim();if(!R||!I(R))return null;let W=R.replaceAll("_","-").toLowerCase(),J=B.find((X)=>X.toLowerCase()===W);if(J)return J;let K=U(R),S=B.filter((X)=>U(X)===K);if(S.length===0)return null;if(N&&S.includes(N))return N;return S[0]}var C=/^(?:0(?:\.\d{0,3})?|1(?:\.0{0,3})?)$/;function V(j){let B=[];for(let N of j.split(",")){let[R,...W]=N.split(";"),J=R.trim();if(!J||J!=="*"&&!I(J))continue;let K=1,S=!0;for(let X of W){let[z,O=""]=X.split("=");if(z.trim().toLowerCase()!=="q")continue;let Q=O.trim();if(!C.test(Q)){S=!1;break}K=Number(Q)}if(S)B.push({tag:J,q:K,index:B.length})}return B.sort((N,R)=>R.q-N.q||N.index-R.index)}function E(j,B){let N=j.replaceAll("_","-").toLowerCase(),R=B.replaceAll("_","-").toLowerCase();return R===N||R.startsWith(`${N}-`)}function M(j,B,N){if(!j||B.length===0)return null;let R=V(j),W=R.filter((S)=>S.q===0&&S.tag!=="*").map((S)=>S.tag),J=B.filter((S)=>!W.some((X)=>E(X,S)));if(J.length===0)return null;let K=!1;for(let{tag:S,q:X}of R){if(X===0)continue;if(S==="*"){K=!0;continue}let z=H(S,J,N);if(z)return z}if(!K)return null;return(N&&J.includes(N)?N:J[0])??null}var y="UTC";function G(j){if(typeof j!=="string"||j.length===0)return!1;try{return new Intl.DateTimeFormat("en-US",{timeZone:j}),!0}catch{return!1}}var Y=new Map,F=500;function $(j,B){let N=Y.get(j);if(N===void 0){if(Y.size>=F)Y.delete(Y.keys().next().value);N=B(),Y.set(j,N)}return N}function P(j){return j instanceof Date?j:new Date(j)}function D(j){return j.dateStyle!==void 0||j.timeStyle!==void 0||j.weekday!==void 0||j.era!==void 0||j.year!==void 0||j.month!==void 0||j.day!==void 0||j.dayPeriod!==void 0||j.hour!==void 0||j.minute!==void 0||j.second!==void 0||j.fractionalSecondDigits!==void 0||j.timeZoneName!==void 0}function x(j){let{locale:B,timeZone:N}=j,R=(J={})=>{let K={...J,timeZone:J.timeZone??N};return $(`dt|${B}|${JSON.stringify(K)}`,()=>{return new Intl.DateTimeFormat(B,K)})},W=(J,K)=>{if(J&&D(J))return J;return{...K,...J}};return{locale:B,timeZone:N,date(J,K){return R(W(K,{dateStyle:"medium"})).format(P(J))},time(J,K){return R(W(K,{timeStyle:"short"})).format(P(J))},dateTime(J,K){return R(W(K,{dateStyle:"medium",timeStyle:"short"})).format(P(J))},number(J,K={}){return $(`n|${B}|${JSON.stringify(K)}`,()=>new Intl.NumberFormat(B,K)).format(J)},relative(J,K,S={}){return $(`r|${B}|${JSON.stringify(S)}`,()=>new Intl.RelativeTimeFormat(B,S)).format(J,K)},list(J,K={}){return $(`l|${B}|${JSON.stringify(K)}`,()=>new Intl.ListFormat(B,K)).format(J)},plural(J,K={}){return $(`p|${B}|${JSON.stringify(K)}`,()=>new Intl.PluralRules(B,K)).select(J)},dateTimeFormat:R}}class b{config;static token="translator";translations={};isEnabled=!1;constructor(j){this.config=j;if(!G(this.config.timeZone))throw Error(`translation.timeZone: "${String(this.config.timeZone)}" is not a time zone this runtime knows. Use an IANA name such as "UTC" or "Europe/Istanbul".`);let B={};for(let[N,R]of Object.entries(this.config.prefetch))for(let W of this.config.supportedLocales){if(!B[W])B[W]={};B[W][N]={};for(let J of R){B[W][N][J.name]={};for(let[K,S]of Object.entries(J.dictionary))this.isEnabled=!0,B[W][N][J.name][K]=S[W]}}this.translations=B}get isLocaleAware(){return this.isEnabled||this.config.supportedLocales.length>0}get supportedLocales(){return this.config.supportedLocales}get defaultLocale(){return this.config.defaultLocale}get components(){return this.config.components}get timeZone(){return this.config.timeZone}detectTimeZone(j){if(j){let B=this.config.detectTimeZone(j);if(G(B))return B}return this.config.timeZone}formatter(j,B){return x({locale:j||this.defaultLocale,timeZone:G(B)?B:this.timeZone})}onLocaleChange(j){return this.config.onLocaleChange(j)}detectLocale(j){let B=this.config.defaultLocale??this.config.supportedLocales[0]??"en-US",N=(K)=>H(K,this.config.supportedLocales,this.config.defaultLocale),R=N(this.config.detectLocale(j));if(R)return R;let W=N(j.cookies.get("i18n-locale"));if(W)return W;let J=M(j.headers.get("accept-language"),this.config.supportedLocales,this.config.defaultLocale);if(J)return J;return B}getPageTranslations(j,B){if(this.translations[j][B])return this.translations[j][B];return{}}}
3
+ export{H as Ii,M as Ji,y as Ki,G as Li,x as Mi,b as Ni};
4
+
5
+ //# debugId=8E4803E56EF14CA564756E2164756E21
@@ -0,0 +1,12 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../i18n/resolveLocale.ts", "../i18n/formatter.ts", "../i18n/Translator.ts"],
4
+ "sourcesContent": [
5
+ "// A BCP 47-ish tag: a 2–3 letter language, then any number of subtags. Loose on\n// purpose — it only has to tell `en`, `de-AT` and `zh-Hant-TW` apart from path\n// segments like `blog` or `settings`.\nconst LOCALE_TAG = /^[a-z]{2,3}(?:[-_][a-z0-9]{2,8})*$/i;\n\nexport function looksLikeLocale(segment: string): boolean {\n return LOCALE_TAG.test(segment);\n}\n\nfunction languageOf(tag: string): string {\n return tag.split(/[-_]/)[0].toLowerCase();\n}\n\n/**\n * Maps a requested locale onto one the app supports, or `null` when none fits.\n *\n * An exact match wins, ignoring case (`en-us` → `en-US`). Otherwise the tag\n * falls back to a supported locale of the same language, so a short tag\n * resolves to its long form (`en` → `en-US`) and an unsupported region to a\n * supported one (`de-AT` → `de-DE`). When several share the language, the\n * default locale is preferred, then the first in `supportedLocales`.\n */\nexport function resolveLocale(\n requested: string | null | undefined,\n supportedLocales: string[],\n defaultLocale?: string,\n): string | null {\n // An `Accept-Language` entry may carry a weight: `de-AT;q=0.9`.\n const tag = requested?.split(\";\")[0].trim();\n if (!tag || !looksLikeLocale(tag)) {\n return null;\n }\n\n const normalized = tag.replaceAll(\"_\", \"-\").toLowerCase();\n const exact = supportedLocales.find((l) => l.toLowerCase() === normalized);\n if (exact) {\n return exact;\n }\n\n const language = languageOf(tag);\n const sameLanguage = supportedLocales.filter((l) => languageOf(l) === language);\n if (sameLanguage.length === 0) {\n return null;\n }\n if (defaultLocale && sameLanguage.includes(defaultLocale)) {\n return defaultLocale;\n }\n return sameLanguage[0];\n}\n\n// RFC 9110 §12.4.2: a weight is 0–1 with at most three decimals.\nconst Q_VALUE = /^(?:0(?:\\.\\d{0,3})?|1(?:\\.0{0,3})?)$/;\n\ntype LanguageRange = { tag: string; q: number };\n\n/**\n * Parses an `Accept-Language` header into its ranges, most preferred first:\n * by weight, then by position. An entry with a malformed weight or tag is\n * skipped; `q=0` entries are kept (they mark a language as unacceptable).\n */\nfunction parseAcceptLanguage(header: string): LanguageRange[] {\n const ranges: (LanguageRange & { index: number })[] = [];\n for (const entry of header.split(\",\")) {\n const [rawTag, ...params] = entry.split(\";\");\n const tag = rawTag.trim();\n if (!tag || (tag !== \"*\" && !looksLikeLocale(tag))) {\n continue;\n }\n let q = 1;\n let valid = true;\n for (const param of params) {\n const [name, value = \"\"] = param.split(\"=\");\n if (name.trim().toLowerCase() !== \"q\") {\n continue;\n }\n const weight = value.trim();\n if (!Q_VALUE.test(weight)) {\n valid = false;\n break;\n }\n q = Number(weight);\n }\n if (valid) {\n ranges.push({ tag, q, index: ranges.length });\n }\n }\n return ranges.sort((a, b) => b.q - a.q || a.index - b.index);\n}\n\n/** Does the language range `range` (`de`, `de-AT`) cover `locale`? (RFC 4647 basic filtering) */\nfunction rangeCovers(range: string, locale: string): boolean {\n const r = range.replaceAll(\"_\", \"-\").toLowerCase();\n const l = locale.replaceAll(\"_\", \"-\").toLowerCase();\n return l === r || l.startsWith(`${r}-`);\n}\n\n/**\n * Picks the best of `supportedLocales` for a whole `Accept-Language` header,\n * or `null` when none fits.\n *\n * Entries are tried by `q` weight, highest first (ties keep header order), and\n * each is matched with {@link resolveLocale}, so `de-AT` falls back to `de`.\n * An entry with `q=0` rules out every supported locale it covers (`de;q=0`\n * rules out `de` and `de-DE`). A `*` entry, when nothing more specific fits,\n * resolves to `defaultLocale` (or the first supported locale) unless that is\n * ruled out. Malformed entries are skipped.\n *\n * ```ts\n * negotiateLocale(\"de-AT,de;q=0.9,en;q=0.5\", [\"en\", \"de\"], \"en\"); // \"de\"\n * negotiateLocale(\"fr\", [\"en\", \"de\"], \"en\"); // null\n * negotiateLocale(\"fr,*;q=0.1\", [\"en\", \"de\"], \"en\"); // \"en\"\n * ```\n */\nexport function negotiateLocale(\n acceptLanguage: string | null | undefined,\n supportedLocales: string[],\n defaultLocale?: string,\n): string | null {\n if (!acceptLanguage || supportedLocales.length === 0) {\n return null;\n }\n\n const ranges = parseAcceptLanguage(acceptLanguage);\n const excluded = ranges.filter((r) => r.q === 0 && r.tag !== \"*\").map((r) => r.tag);\n const candidates = supportedLocales.filter(\n (locale) => !excluded.some((range) => rangeCovers(range, locale)),\n );\n if (candidates.length === 0) {\n return null;\n }\n\n let wildcard = false;\n for (const { tag, q } of ranges) {\n if (q === 0) {\n continue;\n }\n if (tag === \"*\") {\n wildcard = true;\n continue;\n }\n const locale = resolveLocale(tag, candidates, defaultLocale);\n if (locale) {\n return locale;\n }\n }\n\n if (!wildcard) {\n return null;\n }\n return (defaultLocale && candidates.includes(defaultLocale) ? defaultLocale : candidates[0]) ?? null;\n}\n",
6
+ "/**\n * Locale- and time-zone-aware formatting, shared by `useFormatter`, the\n * `format` property of a `useDictionary` result and `Lang.formatter()`.\n *\n * Dependency-free on purpose: components import it, so it must not pull in the\n * server facades.\n *\n * Why the time zone is pinned: a `Date` formatted with no `timeZone` uses the\n * runtime's zone, which is the server's during SSR and the viewer's in the\n * browser. The two disagree for anyone not sitting in the server's zone, so the\n * same instant can print a different hour, or a different day, on each side —\n * a hydration mismatch at best, a wrong date at worst. Every formatter here\n * carries one zone, resolved on the server and shipped with the page, so both\n * sides print the same text.\n */\n\nexport type DateInput = Date | number | string;\n\nexport interface FormatterInit {\n /** BCP 47 locale tag. */\n locale: string;\n /** IANA time zone, such as `UTC` or `Europe/Istanbul`. */\n timeZone: string;\n}\n\nexport interface Formatter {\n readonly locale: string;\n readonly timeZone: string;\n /** A date, `{ dateStyle: \"medium\" }` unless options are given. */\n date(value: DateInput, options?: Intl.DateTimeFormatOptions): string;\n /** A time of day, `{ timeStyle: \"short\" }` unless options are given. */\n time(value: DateInput, options?: Intl.DateTimeFormatOptions): string;\n /** Date and time, `{ dateStyle: \"medium\", timeStyle: \"short\" }` unless options are given. */\n dateTime(value: DateInput, options?: Intl.DateTimeFormatOptions): string;\n number(value: number | bigint, options?: Intl.NumberFormatOptions): string;\n relative(\n value: number,\n unit: Intl.RelativeTimeFormatUnit,\n options?: Intl.RelativeTimeFormatOptions,\n ): string;\n list(values: Iterable<string>, options?: Intl.ListFormatOptions): string;\n /** The CLDR plural category for `count`: `one`, `few`, `other`, … */\n plural(count: number, options?: Intl.PluralRulesOptions): Intl.LDMLPluralRule;\n /**\n * The cached `Intl.DateTimeFormat` behind `date`/`time`/`dateTime`, with the\n * formatter's zone applied. For `formatToParts` or `formatRange`.\n */\n dateTimeFormat(options?: Intl.DateTimeFormatOptions): Intl.DateTimeFormat;\n}\n\n/** The zone used when the app configures none. */\nexport const DEFAULT_TIME_ZONE = \"UTC\";\n\n/**\n * Whether `timeZone` is an IANA zone (or offset) this runtime's `Intl` accepts.\n * An unknown zone makes `Intl.DateTimeFormat` throw a `RangeError`, so a zone\n * that comes from a cookie or a user record is checked before it is trusted.\n */\nexport function isValidTimeZone(timeZone: unknown): timeZone is string {\n if (typeof timeZone !== \"string\" || timeZone.length === 0) {\n return false;\n }\n try {\n new Intl.DateTimeFormat(\"en-US\", { timeZone });\n return true;\n } catch {\n return false;\n }\n}\n\n// Constructing an `Intl` formatter is the expensive part — it resolves locale\n// data — so each one is built once per (kind, locale, options). Options are\n// keyed by their JSON; callers pass small literal objects, and a key order\n// difference only costs a duplicate entry, never a wrong result.\nconst cache = new Map<string, unknown>();\nconst CACHE_LIMIT = 500;\n\nfunction cached<T>(key: string, create: () => T): T {\n let value = cache.get(key) as T | undefined;\n if (value === undefined) {\n if (cache.size >= CACHE_LIMIT) {\n // Insertion order: drop the oldest. Unbounded user-driven option objects\n // (a currency per row) must not grow a long-lived server process forever.\n cache.delete(cache.keys().next().value!);\n }\n value = create();\n cache.set(key, value);\n }\n return value;\n}\n\nfunction toDate(value: DateInput): Date {\n return value instanceof Date ? value : new Date(value);\n}\n\nfunction hasDateTimeFields(options: Intl.DateTimeFormatOptions): boolean {\n return (\n options.dateStyle !== undefined ||\n options.timeStyle !== undefined ||\n options.weekday !== undefined ||\n options.era !== undefined ||\n options.year !== undefined ||\n options.month !== undefined ||\n options.day !== undefined ||\n options.dayPeriod !== undefined ||\n options.hour !== undefined ||\n options.minute !== undefined ||\n options.second !== undefined ||\n options.fractionalSecondDigits !== undefined ||\n options.timeZoneName !== undefined\n );\n}\n\nexport function createFormatter(init: FormatterInit): Formatter {\n const { locale, timeZone } = init;\n\n const dateTimeFormat = (options: Intl.DateTimeFormatOptions = {}) => {\n // `??`, not a spread: `{ timeZone: undefined }` would otherwise drop the\n // pinned zone and fall back to the runtime's, which is the bug this exists\n // to prevent.\n const resolved = { ...options, timeZone: options.timeZone ?? timeZone };\n return cached(`dt|${locale}|${JSON.stringify(resolved)}`, () => {\n return new Intl.DateTimeFormat(locale, resolved);\n });\n };\n\n const withDefaults = (\n options: Intl.DateTimeFormatOptions | undefined,\n defaults: Intl.DateTimeFormatOptions,\n ) => {\n if (options && hasDateTimeFields(options)) {\n return options;\n }\n // Options that only tweak (a `timeZone`, `hour12`) still get the default\n // fields; otherwise `{ timeZone }` alone would print a bare numeric date.\n return { ...defaults, ...options };\n };\n\n return {\n locale,\n timeZone,\n date(value, options) {\n return dateTimeFormat(withDefaults(options, { dateStyle: \"medium\" })).format(\n toDate(value),\n );\n },\n time(value, options) {\n return dateTimeFormat(withDefaults(options, { timeStyle: \"short\" })).format(\n toDate(value),\n );\n },\n dateTime(value, options) {\n return dateTimeFormat(\n withDefaults(options, { dateStyle: \"medium\", timeStyle: \"short\" }),\n ).format(toDate(value));\n },\n number(value, options = {}) {\n return cached(\n `n|${locale}|${JSON.stringify(options)}`,\n () => new Intl.NumberFormat(locale, options),\n ).format(value);\n },\n relative(value, unit, options = {}) {\n return cached(\n `r|${locale}|${JSON.stringify(options)}`,\n () => new Intl.RelativeTimeFormat(locale, options),\n ).format(value, unit);\n },\n list(values, options = {}) {\n return cached(\n `l|${locale}|${JSON.stringify(options)}`,\n () => new Intl.ListFormat(locale, options),\n ).format(values);\n },\n plural(count, options = {}) {\n return cached(\n `p|${locale}|${JSON.stringify(options)}`,\n () => new Intl.PluralRules(locale, options),\n ).select(count);\n },\n dateTimeFormat,\n };\n}\n",
7
+ "import type { HttpRequest } from \"../http/HttpRequest\";\nimport type { Dictionary } from \"./Dictionary\";\nimport type { TranslationConfig } from \"./config\";\nimport { negotiateLocale, resolveLocale } from \"./resolveLocale\";\nimport {\n createFormatter,\n isValidTimeZone,\n type Formatter,\n} from \"./formatter\";\n\nexport class Translator {\n static token = \"translator\";\n\n translations = {};\n isEnabled = false;\n\n constructor(public config: Required<TranslationConfig>) {\n // Fail at boot rather than on the first page that prints a date: `Intl`\n // throws a `RangeError` for a zone it does not know.\n if (!isValidTimeZone(this.config.timeZone)) {\n throw new Error(\n `translation.timeZone: \"${String(this.config.timeZone)}\" is not a time zone this runtime knows. Use an IANA name such as \"UTC\" or \"Europe/Istanbul\".`,\n );\n }\n\n const translations = {};\n\n for (const [route, dicArray] of Object.entries(this.config.prefetch)) {\n for (const locale of this.config.supportedLocales) {\n if (!translations[locale]) {\n translations[locale] = {};\n }\n translations[locale][route] = {};\n for (const dic of dicArray) {\n translations[locale][route][dic.name] = {};\n for (const [key, value] of Object.entries(dic.dictionary)) {\n this.isEnabled = true;\n translations[locale][route][dic.name][key] = value[locale];\n }\n }\n }\n }\n this.translations = translations;\n }\n\n /**\n * Whether the app does locale-aware routing and rendering at all.\n *\n * `isEnabled` only means the legacy `prefetch` config has dictionaries to\n * serve. An app on `defineDictionary` has an empty `prefetch` and declares\n * its locales through `supportedLocales` alone, so gating on `isEnabled`\n * leaves it without locale detection or a locale URL prefix. Both the render\n * path and the redirect read this, because when they disagreed a migrated app\n * rendered a non-default locale at `/` with no redirect and no `Vary` — one\n * cache fill away from serving that document to everyone.\n */\n get isLocaleAware(): boolean {\n return this.isEnabled || this.config.supportedLocales.length > 0;\n }\n\n get supportedLocales(): string[] {\n return this.config.supportedLocales;\n }\n\n get defaultLocale(): string {\n return this.config.defaultLocale;\n }\n\n get components(): Record<string, Dictionary<any>> {\n return this.config.components;\n }\n\n /** The configured zone; `UTC` unless `translation.timeZone` says otherwise. */\n get timeZone(): string {\n return this.config.timeZone;\n }\n\n /**\n * The zone dates are formatted in for this request: `detectTimeZone`'s\n * answer when it gives a zone `Intl` knows, the configured zone otherwise.\n * A bad value from a cookie must not take the page down, so it is ignored\n * rather than thrown.\n */\n detectTimeZone(req: HttpRequest<any, any> | null | undefined): string {\n if (req) {\n const detected = this.config.detectTimeZone(req);\n if (isValidTimeZone(detected)) {\n return detected;\n }\n }\n return this.config.timeZone;\n }\n\n /**\n * A formatter for `locale` (the default locale when omitted) in `timeZone`\n * (the configured zone when omitted). For server code outside a request —\n * jobs, emails. Inside a request, `Lang.formatter()` picks up the request's\n * locale and zone.\n */\n formatter(locale?: string, timeZone?: string): Formatter {\n return createFormatter({\n locale: locale || this.defaultLocale,\n timeZone: isValidTimeZone(timeZone) ? timeZone : this.timeZone,\n });\n }\n\n onLocaleChange(locale: string): Promise<void> | void {\n return this.config.onLocaleChange(locale);\n }\n\n detectLocale(req: HttpRequest<any, any>) {\n const fallbackLocale =\n this.config.defaultLocale ?? this.config.supportedLocales[0] ?? \"en-US\";\n const resolve = (tag: string | null | undefined) =>\n resolveLocale(tag, this.config.supportedLocales, this.config.defaultLocale);\n\n const detectedLocale = resolve(this.config.detectLocale(req));\n if (detectedLocale) {\n return detectedLocale;\n }\n\n const previousLocale = resolve(req.cookies.get(\"i18n-locale\"));\n if (previousLocale) {\n return previousLocale;\n }\n\n // The best entry by `q` weight the app can serve, even by language alone\n // (`de-AT` → `de-DE`), wins.\n const acceptedLocale = negotiateLocale(\n req.headers.get(\"accept-language\"),\n this.config.supportedLocales,\n this.config.defaultLocale,\n );\n if (acceptedLocale) {\n return acceptedLocale;\n }\n\n return fallbackLocale;\n }\n\n getPageTranslations(locale: string, scope: string) {\n if (this.translations[locale][scope]) {\n return this.translations[locale][scope];\n }\n return {};\n }\n}\n"
8
+ ],
9
+ "mappings": ";AAGA,IAAM,EAAa,sCAEZ,SAAS,CAAe,CAAC,EAA0B,CACxD,OAAO,EAAW,KAAK,CAAO,EAGhC,SAAS,CAAU,CAAC,EAAqB,CACvC,OAAO,EAAI,MAAM,MAAM,EAAE,GAAG,YAAY,EAYnC,SAAS,CAAa,CAC3B,EACA,EACA,EACe,CAEf,IAAM,EAAM,GAAW,MAAM,GAAG,EAAE,GAAG,KAAK,EAC1C,GAAI,CAAC,GAAO,CAAC,EAAgB,CAAG,EAC9B,OAAO,KAGT,IAAM,EAAa,EAAI,WAAW,IAAK,GAAG,EAAE,YAAY,EAClD,EAAQ,EAAiB,KAAK,CAAC,IAAM,EAAE,YAAY,IAAM,CAAU,EACzE,GAAI,EACF,OAAO,EAGT,IAAM,EAAW,EAAW,CAAG,EACzB,EAAe,EAAiB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
1
+ {"version":3,"file":"Head.d.ts","sourceRoot":"","sources":["../../client/Head.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,SAAS,EAAc,MAAM,OAAO,CAAC;AAmCnD,wBAAgB,UAAU,CAAC,IAAI,EAAE,GAAG,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,QAoD3D;AAmED,eAAO,MAAM,IAAI,GAAI,wBAGlB;IAAE,QAAQ,CAAC,EAAE,SAAS,CAAC;IAAC,OAAO,CAAC,EAAE,MAAM,CAAA;CAAE,4CA6D5C,CAAC"}
@@ -0,0 +1,69 @@
1
+ /**
2
+ * `Meta.fonts`: the `@font-face` rules and font preloads of one response.
3
+ * Pure, so the server (validation) and `<Head />` (rendering) share it.
4
+ */
5
+ /** A font file format, as `@font-face`'s `format()` names it. */
6
+ export type FontFormat = "woff2" | "woff" | "truetype" | "opentype" | "collection" | "embedded-opentype" | "svg";
7
+ /** One file of a font; list the preferred format first. */
8
+ export type FontSource = {
9
+ url: string;
10
+ /** Inferred from the url's extension when left out. */
11
+ format?: FontFormat;
12
+ };
13
+ /** One `@font-face`, see `Meta.fonts`. */
14
+ export type MetaFont = {
15
+ /** The `font-family` name that CSS refers to, e.g. `"Acme Sans"`. */
16
+ family: string;
17
+ /** A url, or several files with the preferred one first. */
18
+ src: string | FontSource[];
19
+ /** `font-weight`: `400`, `"bold"`, or a range for a variable font, `"100 900"`. */
20
+ weight?: string | number;
21
+ /** `font-style`: `"normal"`, `"italic"`, `"oblique 10deg"`. */
22
+ style?: string;
23
+ /** `font-stretch`: `"condensed"`, `"75% 125%"`. */
24
+ stretch?: string;
25
+ /** `font-display`. Defaults to `"swap"`. */
26
+ display?: "auto" | "block" | "swap" | "fallback" | "optional";
27
+ /** `unicode-range`, e.g. `"U+0000-00FF, U+0131"`. */
28
+ unicodeRange?: string;
29
+ /**
30
+ * Preload the first file with `<link rel="preload" as="font" crossorigin>`.
31
+ * Only for fonts the page renders above the fold: a preloaded font that is
32
+ * never used is a wasted download (and a console warning).
33
+ */
34
+ preload?: boolean;
35
+ };
36
+ /** A font after `normalizeFonts`: validated, with every source's format resolved. */
37
+ export type NormalizedFont = {
38
+ family: string;
39
+ src: {
40
+ url: string;
41
+ format: FontFormat | null;
42
+ }[];
43
+ weight: string | null;
44
+ style: string | null;
45
+ stretch: string | null;
46
+ display: NonNullable<MetaFont["display"]>;
47
+ unicodeRange: string | null;
48
+ preload: boolean;
49
+ };
50
+ export type FontPreload = {
51
+ href: string;
52
+ type: string | null;
53
+ };
54
+ /** The format a url's extension implies (`.woff2` → `"woff2"`), ignoring query and hash. */
55
+ export declare function fontFormatOf(url: string): FontFormat | null;
56
+ /** Validates what a handler passed; throws a `TypeError` naming the bad value. */
57
+ export declare function normalizeFonts(fonts: MetaFont[]): NormalizedFont[];
58
+ /**
59
+ * A CSS string literal holding `value`. Quotes, backslashes, control
60
+ * characters and `<` (so `</style>` can't close the element) are escaped.
61
+ */
62
+ export declare function cssString(value: string): string;
63
+ /** One `@font-face` rule. */
64
+ export declare function fontFaceRule(font: NormalizedFont): string;
65
+ /** The `@font-face` rules for `fonts`, an identical font declared twice once. */
66
+ export declare function fontFaceRules(fonts: NormalizedFont[] | null | undefined): string[];
67
+ /** The first file of every font marked `preload`, each url once. */
68
+ export declare function fontPreloads(fonts: NormalizedFont[] | null | undefined): FontPreload[];
69
+ //# sourceMappingURL=fonts.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fonts.d.ts","sourceRoot":"","sources":["../../client/fonts.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,iEAAiE;AACjE,MAAM,MAAM,UAAU,GAClB,OAAO,GACP,MAAM,GACN,UAAU,GACV,UAAU,GACV,YAAY,GACZ,mBAAmB,GACnB,KAAK,CAAC;AAEV,2DAA2D;AAC3D,MAAM,MAAM,UAAU,GAAG;IACvB,GAAG,EAAE,MAAM,CAAC;IACZ,uDAAuD;IACvD,MAAM,CAAC,EAAE,UAAU,CAAC;CACrB,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AAgB,cAAc,CAAC,KAAK,EAAE,QAAQ,EAAE,GAAG,cAAc,EAAE,CAsClE;AAED;;;GAGG;AACH,wBAAgB,SAAS,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAM/C;AAED,6BAA6B;AAC7B,wBAAgB,YAAY,CAAC,IAAI,EAAE,cAAc,GAAG,MAAM,CAczD;AAED,iFAAiF;AACjF,wBAAgB,aAAa,CAAC,KAAK,EAAE,cAAc,EAAE,GAAG,IAAI,GAAG,SAAS,GAAG,MAAM,EAAE,CAElF;AAED,oEAAoE;AACpE,wBAAgB,YAAY,CAAC,KAAK,EAAE,cAAc,EAAE,GAAG,IAAI,GAAG,SAAS,GAAG,WAAW,EAAE,CAYtF"}
@@ -42,6 +42,7 @@ export type { CreateI18nDictionary } from "./I18nContext";
42
42
  export { Image } from "./Image";
43
43
  export { Head } from "./Head";
44
44
  export { textDirection, type HtmlAttributes, type RootLayoutProps, } from "./htmlAttributes";
45
+ export type { MetaFont, FontSource, FontFormat } from "./fonts";
45
46
  export { useForgotPassword } from "./auth/useForgotPassword";
46
47
  export { useSignIn } from "./auth/useSignIn";
47
48
  export { useSignUp } from "./auth/useSignUp";
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../client/index.ts"],"names":[],"mappings":";AAMA,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,YAAY,EAAE,WAAW,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AACjE,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,YAAY,EACV,mBAAmB,EACnB,mBAAmB,GACpB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,qBAAqB,EAAE,MAAM,eAAe,CAAC;AACtD,YAAY,EACV,YAAY,EACZ,WAAW,EACX,gBAAgB,GACjB,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,W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,CAAC;AAG9D,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAElD,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAC3C,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AACnC,YAAY,EAAE,UAAU,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC"}
@@ -1644,6 +1644,51 @@ function resolveHtmlAttributes(set, locale) {
1644
1644
  };
1645
1645
  }
1646
1646
  //#endregion
1647
+ //#region client/fonts.ts
1648
+ var MIME_BY_FORMAT = {
1649
+ woff2: "font/woff2",
1650
+ woff: "font/woff",
1651
+ truetype: "font/ttf",
1652
+ opentype: "font/otf",
1653
+ collection: "font/collection"
1654
+ };
1655
+ /**
1656
+ * A CSS string literal holding `value`. Quotes, backslashes, control
1657
+ * characters and `<` (so `</style>` can't close the element) are escaped.
1658
+ */
1659
+ function cssString(value) {
1660
+ return `"${value.replace(/[\\"<>\u0000-\u001f\u007f]/g, (char) => char === "\\" || char === "\"" ? `\\${char}` : `\\${char.charCodeAt(0).toString(16)} `)}"`;
1661
+ }
1662
+ /** One `@font-face` rule. */
1663
+ function fontFaceRule(font) {
1664
+ const src = font.src.map(({ url, format }) => `url(${cssString(url)})${format ? ` format(${cssString(format)})` : ""}`).join(", ");
1665
+ return `@font-face { ${[
1666
+ `font-family: ${cssString(font.family)}`,
1667
+ `src: ${src}`,
1668
+ font.weight && `font-weight: ${font.weight}`,
1669
+ font.style && `font-style: ${font.style}`,
1670
+ font.stretch && `font-stretch: ${font.stretch}`,
1671
+ `font-display: ${font.display}`,
1672
+ font.unicodeRange && `unicode-range: ${font.unicodeRange}`
1673
+ ].filter(Boolean).join("; ")}; }`;
1674
+ }
1675
+ /** The `@font-face` rules for `fonts`, an identical font declared twice once. */
1676
+ function fontFaceRules(fonts) {
1677
+ return [...new Set((fonts ?? []).map(fontFaceRule))];
1678
+ }
1679
+ /** The first file of every font marked `preload`, each url once. */
1680
+ function fontPreloads(fonts) {
1681
+ const preloads = /* @__PURE__ */ new Map();
1682
+ for (const font of fonts ?? []) {
1683
+ const first = font.preload ? font.src[0] : void 0;
1684
+ if (first && !preloads.has(first.url)) preloads.set(first.url, {
1685
+ href: first.url,
1686
+ type: (first.format && MIME_BY_FORMAT[first.format]) ?? null
1687
+ });
1688
+ }
1689
+ return [...preloads.values()];
1690
+ }
1691
+ //#endregion
1647
1692
  //#region client/Head.tsx
1648
1693
  /** Marks the `<link>`s rendered from metadata, so a navigation can replace them. */
1649
1694
  var GEMI_META_ATTRIBUTE = "data-gemi-meta";
@@ -1660,11 +1705,19 @@ function metaLinks(canonical, alternates) {
1660
1705
  });
1661
1706
  return links;
1662
1707
  }
1708
+ /** Marks the `<style>`s holding `Meta.fonts`' `@font-face` rules. */
1709
+ var GEMI_FONTS_ATTRIBUTE = "data-gemi-fonts";
1710
+ /**
1711
+ * The `@font-face` rules already in the document. A navigation adds the new
1712
+ * page's and removes none: a skipped layout's fonts are still in use, and an
1713
+ * unused `@font-face` costs nothing (it is only fetched when text uses it).
1714
+ */
1715
+ var appliedFontRules = /* @__PURE__ */ new Set();
1663
1716
  /** Whether a navigation has set `<html>` attributes from metadata. */
1664
1717
  var htmlAttributesApplied = false;
1665
1718
  function updateMeta(meta, locale) {
1666
1719
  if (!meta) return;
1667
- const { title, description, htmlAttributes, canonical, alternates } = meta;
1720
+ const { title, description, htmlAttributes, canonical, alternates, fonts } = meta;
1668
1721
  if (htmlAttributes || htmlAttributesApplied) {
1669
1722
  htmlAttributesApplied = true;
1670
1723
  for (const [name, value] of Object.entries(resolveHtmlAttributes(htmlAttributes, locale))) if (typeof value === "string") document.documentElement.setAttribute(name, value);
@@ -1678,6 +1731,14 @@ function updateMeta(meta, locale) {
1678
1731
  element.setAttribute(GEMI_META_ATTRIBUTE, "");
1679
1732
  document.head.appendChild(element);
1680
1733
  }
1734
+ const newFontRules = fontFaceRules(fonts).filter((rule) => !appliedFontRules.has(rule));
1735
+ if (newFontRules.length > 0) {
1736
+ const style = document.createElement("style");
1737
+ style.setAttribute(GEMI_FONTS_ATTRIBUTE, "");
1738
+ style.textContent = newFontRules.join("\n");
1739
+ document.head.appendChild(style);
1740
+ for (const rule of newFontRules) appliedFontRules.add(rule);
1741
+ }
1681
1742
  if (title) document.title = title;
1682
1743
  if (description) {
1683
1744
  const desc = document.querySelector("meta[name='description']");
@@ -1749,6 +1810,8 @@ var OpenGraph = (props) => {
1749
1810
  var Head = ({ children = null, charSet = "utf-8" }) => {
1750
1811
  const { meta } = useContext(ServerDataContext);
1751
1812
  if (meta?.htmlAttributes) htmlAttributesApplied = true;
1813
+ const fontRules = fontFaceRules(meta?.fonts);
1814
+ if (typeof window !== "undefined") for (const rule of fontRules) appliedFontRules.add(rule);
1752
1815
  return /* @__PURE__ */ jsxs("head", { children: [
1753
1816
  /* @__PURE__ */ jsx("meta", { charSet }),
1754
1817
  /* @__PURE__ */ jsx("meta", {
@@ -1771,6 +1834,17 @@ var Head = ({ children = null, charSet = "utf-8" }) => {
1771
1834
  hrefLang: link.hrefLang,
1772
1835
  [GEMI_META_ATTRIBUTE]: ""
1773
1836
  }, `${link.rel}:${link.hrefLang ?? ""}:${link.href}`)),
1837
+ fontPreloads(meta?.fonts).map((preload) => /* @__PURE__ */ jsx("link", {
1838
+ rel: "preload",
1839
+ as: "font",
1840
+ href: preload.href,
1841
+ type: preload.type ?? void 0,
1842
+ crossOrigin: ""
1843
+ }, `preload:${preload.href}`)),
1844
+ fontRules.length > 0 && /* @__PURE__ */ jsx("style", {
1845
+ [GEMI_FONTS_ATTRIBUTE]: "",
1846
+ dangerouslySetInnerHTML: { __html: fontRules.join("\n") }
1847
+ }),
1774
1848
  children
1775
1849
  ] });
1776
1850
  };