gemi 0.203.0 → 0.204.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (289) hide show
  1. package/dist/ai/Agent.d.ts +20 -1
  2. package/dist/ai/Agent.d.ts.map +1 -1
  3. package/dist/ai/AgentProvider.d.ts +5 -0
  4. package/dist/ai/AgentProvider.d.ts.map +1 -1
  5. package/dist/ai/index.d.ts +1 -1
  6. package/dist/ai/index.d.ts.map +1 -1
  7. package/dist/ai/index.js +52 -55
  8. package/dist/ai/index.js.map +3 -13
  9. package/dist/ai/providers/request.d.ts +1 -0
  10. package/dist/ai/providers/request.d.ts.map +1 -1
  11. package/dist/ai/testing/Fingerprints.d.ts +106 -0
  12. package/dist/ai/testing/Fingerprints.d.ts.map +1 -0
  13. package/dist/ai/testing/RecordingProvider.d.ts +258 -0
  14. package/dist/ai/testing/RecordingProvider.d.ts.map +1 -0
  15. package/dist/ai/testing/index.d.ts +4 -0
  16. package/dist/ai/testing/index.d.ts.map +1 -0
  17. package/dist/ai/testing/index.js +6 -0
  18. package/dist/ai/testing/index.js.map +12 -0
  19. package/dist/ai/testing/pinClock.d.ts +19 -0
  20. package/dist/ai/testing/pinClock.d.ts.map +1 -0
  21. package/dist/app/index.js +2 -2
  22. package/dist/app/index.js.map +1 -1
  23. package/dist/bun/plugin.js +2 -2
  24. package/dist/bun/plugin.js.map +1 -1
  25. package/dist/bun/preload.js +2 -2
  26. package/dist/bun/preload.js.map +1 -1
  27. package/dist/{chunk-dj9nspcw.js → chunk-0hfzzb3k.js} +3 -3
  28. package/dist/{chunk-dj9nspcw.js.map → chunk-0hfzzb3k.js.map} +1 -1
  29. package/dist/chunk-0pgk811s.js +4 -0
  30. package/dist/{chunk-3e19n0f2.js.map → chunk-0pgk811s.js.map} +2 -2
  31. package/dist/{chunk-2fbsd1b0.js → chunk-0shq2d31.js} +2 -2
  32. package/dist/{chunk-2fbsd1b0.js.map → chunk-0shq2d31.js.map} +1 -1
  33. package/dist/{chunk-wfwpjx25.js → chunk-0t1d9s34.js} +3 -3
  34. package/dist/{chunk-wfwpjx25.js.map → chunk-0t1d9s34.js.map} +1 -1
  35. package/dist/{chunk-gz2ekvd6.js → chunk-13vtn7h9.js} +2 -2
  36. package/dist/{chunk-gz2ekvd6.js.map → chunk-13vtn7h9.js.map} +2 -2
  37. package/dist/{chunk-hergje99.js → chunk-1e82gfk9.js} +3 -3
  38. package/dist/{chunk-hergje99.js.map → chunk-1e82gfk9.js.map} +1 -1
  39. package/dist/{chunk-95re1b2y.js → chunk-1kehwa3s.js} +1 -1
  40. package/dist/chunk-1x60thpm.js +8 -0
  41. package/dist/chunk-1x60thpm.js.map +19 -0
  42. package/dist/{chunk-px2a83jv.js → chunk-2ngdhbz7.js} +2 -2
  43. package/dist/{chunk-px2a83jv.js.map → chunk-2ngdhbz7.js.map} +1 -1
  44. package/dist/{chunk-5dhp90cx.js → chunk-2t1eyzvq.js} +2 -2
  45. package/dist/{chunk-5dhp90cx.js.map → chunk-2t1eyzvq.js.map} +1 -1
  46. package/dist/{chunk-ggmznkqs.js → chunk-39hed4yr.js} +3 -3
  47. package/dist/{chunk-ggmznkqs.js.map → chunk-39hed4yr.js.map} +1 -1
  48. package/dist/{chunk-tgbj942e.js → chunk-3gkxnfef.js} +3 -3
  49. package/dist/{chunk-tgbj942e.js.map → chunk-3gkxnfef.js.map} +1 -1
  50. package/dist/{chunk-k3m1wr1c.js → chunk-3xzhbkya.js} +3 -3
  51. package/dist/{chunk-k3m1wr1c.js.map → chunk-3xzhbkya.js.map} +1 -1
  52. package/dist/chunk-418n4s1m.js +6 -0
  53. package/dist/{chunk-z97tptd1.js.map → chunk-418n4s1m.js.map} +2 -2
  54. package/dist/{chunk-95cs3r49.js → chunk-4c0rb2ng.js} +2 -2
  55. package/dist/{chunk-95cs3r49.js.map → chunk-4c0rb2ng.js.map} +1 -1
  56. package/dist/chunk-4ex4s616.js +4 -0
  57. package/dist/{chunk-tkskgvhc.js.map → chunk-4ex4s616.js.map} +2 -2
  58. package/dist/{chunk-n5g9a48h.js → chunk-4m8t67px.js} +2 -2
  59. package/dist/{chunk-n5g9a48h.js.map → chunk-4m8t67px.js.map} +1 -1
  60. package/dist/{chunk-1hpedme7.js → chunk-4v5c4mes.js} +2 -2
  61. package/dist/{chunk-1hpedme7.js.map → chunk-4v5c4mes.js.map} +1 -1
  62. package/dist/{chunk-g5j5hx6a.js → chunk-5gvc03cv.js} +3 -3
  63. package/dist/{chunk-g5j5hx6a.js.map → chunk-5gvc03cv.js.map} +1 -1
  64. package/dist/{chunk-r842yxd9.js → chunk-5km0np8s.js} +2 -2
  65. package/dist/{chunk-r842yxd9.js.map → chunk-5km0np8s.js.map} +1 -1
  66. package/dist/{chunk-m3xvm2va.js → chunk-6bfj0mbp.js} +3 -3
  67. package/dist/{chunk-m3xvm2va.js.map → chunk-6bfj0mbp.js.map} +1 -1
  68. package/dist/chunk-6g1xac70.js +7 -0
  69. package/dist/chunk-6g1xac70.js.map +10 -0
  70. package/dist/{chunk-kmpxda7j.js → chunk-6w6q9mxe.js} +3 -3
  71. package/dist/{chunk-kmpxda7j.js.map → chunk-6w6q9mxe.js.map} +2 -2
  72. package/dist/{chunk-dyb649h3.js → chunk-77x9vxht.js} +3 -3
  73. package/dist/{chunk-dyb649h3.js.map → chunk-77x9vxht.js.map} +1 -1
  74. package/dist/{chunk-5q2tt76t.js → chunk-7gxmf9rg.js} +2 -2
  75. package/dist/{chunk-5q2tt76t.js.map → chunk-7gxmf9rg.js.map} +1 -1
  76. package/dist/{chunk-vyp7d7xz.js → chunk-8jfnn7v6.js} +2 -2
  77. package/dist/{chunk-vyp7d7xz.js.map → chunk-8jfnn7v6.js.map} +1 -1
  78. package/dist/{chunk-zvhks9s7.js → chunk-8pw4zjnx.js} +1 -1
  79. package/dist/{chunk-9q5xhb64.js → chunk-9bjggtdt.js} +2 -2
  80. package/dist/{chunk-9q5xhb64.js.map → chunk-9bjggtdt.js.map} +1 -1
  81. package/dist/{chunk-rwe4bgt3.js → chunk-9hqnecjt.js} +2 -2
  82. package/dist/{chunk-rwe4bgt3.js.map → chunk-9hqnecjt.js.map} +1 -1
  83. package/dist/{chunk-s0z61m9j.js → chunk-9m7c4mws.js} +2 -2
  84. package/dist/{chunk-s0z61m9j.js.map → chunk-9m7c4mws.js.map} +1 -1
  85. package/dist/{chunk-r02em4jv.js → chunk-b1mdan5a.js} +2 -2
  86. package/dist/{chunk-r02em4jv.js.map → chunk-b1mdan5a.js.map} +1 -1
  87. package/dist/{chunk-7txst143.js → chunk-bq4pgzcd.js} +2 -2
  88. package/dist/{chunk-7txst143.js.map → chunk-bq4pgzcd.js.map} +1 -1
  89. package/dist/chunk-c7nbzryd.js +9 -0
  90. package/dist/chunk-c7nbzryd.js.map +10 -0
  91. package/dist/{chunk-pp34d463.js → chunk-cdgnwzwf.js} +2 -2
  92. package/dist/{chunk-pp34d463.js.map → chunk-cdgnwzwf.js.map} +1 -1
  93. package/dist/chunk-cf7xc02m.js +5 -0
  94. package/dist/{chunk-9mhr0kwd.js.map → chunk-cf7xc02m.js.map} +1 -1
  95. package/dist/{chunk-2nw8rf5y.js → chunk-cq7hk8v9.js} +2 -2
  96. package/dist/{chunk-2nw8rf5y.js.map → chunk-cq7hk8v9.js.map} +1 -1
  97. package/dist/{chunk-8m9kgynj.js → chunk-crqbzfd5.js} +2 -2
  98. package/dist/{chunk-8m9kgynj.js.map → chunk-crqbzfd5.js.map} +1 -1
  99. package/dist/{chunk-vee6v6qf.js → chunk-d3k38gk1.js} +3 -3
  100. package/dist/{chunk-vee6v6qf.js.map → chunk-d3k38gk1.js.map} +1 -1
  101. package/dist/{chunk-41fqkygr.js → chunk-d5d3a8bm.js} +3 -3
  102. package/dist/{chunk-41fqkygr.js.map → chunk-d5d3a8bm.js.map} +1 -1
  103. package/dist/chunk-d7kknkmq.js +13 -0
  104. package/dist/{chunk-4fw84bh6.js.map → chunk-d7kknkmq.js.map} +3 -4
  105. package/dist/{chunk-ke7d7j2y.js → chunk-dk1xxtgk.js} +2 -2
  106. package/dist/{chunk-ke7d7j2y.js.map → chunk-dk1xxtgk.js.map} +1 -1
  107. package/dist/{chunk-nqg7hdy8.js → chunk-e3ehv27z.js} +3 -3
  108. package/dist/{chunk-nqg7hdy8.js.map → chunk-e3ehv27z.js.map} +1 -1
  109. package/dist/{chunk-se58ty45.js → chunk-e5mqjren.js} +4 -4
  110. package/dist/{chunk-se58ty45.js.map → chunk-e5mqjren.js.map} +2 -2
  111. package/dist/{chunk-t91x2k88.js → chunk-efnerp0c.js} +2 -2
  112. package/dist/{chunk-t91x2k88.js.map → chunk-efnerp0c.js.map} +1 -1
  113. package/dist/{chunk-ys4q1jg2.js → chunk-ek0dvbck.js} +3 -3
  114. package/dist/{chunk-ys4q1jg2.js.map → chunk-ek0dvbck.js.map} +1 -1
  115. package/dist/{chunk-a4twd6qh.js → chunk-ezvtkbp9.js} +2 -2
  116. package/dist/{chunk-a4twd6qh.js.map → chunk-ezvtkbp9.js.map} +1 -1
  117. package/dist/{chunk-h19qtrg9.js → chunk-f52maa9b.js} +2 -2
  118. package/dist/{chunk-h19qtrg9.js.map → chunk-f52maa9b.js.map} +1 -1
  119. package/dist/{chunk-nfbf388w.js → chunk-f9c8bnzx.js} +3 -3
  120. package/dist/{chunk-nfbf388w.js.map → chunk-f9c8bnzx.js.map} +2 -2
  121. package/dist/{chunk-bwg7genv.js → chunk-fq5b1k4n.js} +2 -2
  122. package/dist/{chunk-bwg7genv.js.map → chunk-fq5b1k4n.js.map} +1 -1
  123. package/dist/{chunk-dvw8cr6n.js → chunk-gc9g7c4p.js} +3 -3
  124. package/dist/{chunk-dvw8cr6n.js.map → chunk-gc9g7c4p.js.map} +1 -1
  125. package/dist/{chunk-sq5ytcpd.js → chunk-jeq8wvj6.js} +2 -2
  126. package/dist/{chunk-sq5ytcpd.js.map → chunk-jeq8wvj6.js.map} +1 -1
  127. package/dist/{chunk-vw57atx4.js → chunk-jma5d7zd.js} +3 -3
  128. package/dist/{chunk-vw57atx4.js.map → chunk-jma5d7zd.js.map} +1 -1
  129. package/dist/{chunk-nsxw6v2b.js → chunk-jmsfkzav.js} +2 -2
  130. package/dist/{chunk-nsxw6v2b.js.map → chunk-jmsfkzav.js.map} +1 -1
  131. package/dist/chunk-js9rm7g0.js +4 -0
  132. package/dist/{chunk-02s440vh.js.map → chunk-js9rm7g0.js.map} +2 -2
  133. package/dist/{chunk-6t9n4qdm.js → chunk-k1gt7fgy.js} +3 -3
  134. package/dist/{chunk-6t9n4qdm.js.map → chunk-k1gt7fgy.js.map} +1 -1
  135. package/dist/{chunk-cbmne0wt.js → chunk-k62338g2.js} +2 -2
  136. package/dist/{chunk-cbmne0wt.js.map → chunk-k62338g2.js.map} +1 -1
  137. package/dist/{chunk-05k9201j.js → chunk-k9882kqg.js} +2 -2
  138. package/dist/{chunk-05k9201j.js.map → chunk-k9882kqg.js.map} +1 -1
  139. package/dist/chunk-ks6dczvn.js +24 -0
  140. package/dist/{chunk-70qqpvd9.js.map → chunk-ks6dczvn.js.map} +2 -2
  141. package/dist/{chunk-bzaespn5.js → chunk-n26atakz.js} +3 -3
  142. package/dist/{chunk-bzaespn5.js.map → chunk-n26atakz.js.map} +1 -1
  143. package/dist/{chunk-vbdy4k14.js → chunk-n3kg99yw.js} +3 -3
  144. package/dist/{chunk-vbdy4k14.js.map → chunk-n3kg99yw.js.map} +1 -1
  145. package/dist/{chunk-c6v3sjvh.js → chunk-n5k42dh7.js} +3 -3
  146. package/dist/{chunk-c6v3sjvh.js.map → chunk-n5k42dh7.js.map} +1 -1
  147. package/dist/chunk-p2nqksdq.js +10 -0
  148. package/dist/{chunk-ht5mq6ev.js.map → chunk-p2nqksdq.js.map} +2 -2
  149. package/dist/{chunk-mvd4mc8p.js → chunk-p9pwskv6.js} +2 -2
  150. package/dist/{chunk-mvd4mc8p.js.map → chunk-p9pwskv6.js.map} +1 -1
  151. package/dist/{chunk-14dtbk7d.js → chunk-phvvxv1a.js} +3 -3
  152. package/dist/{chunk-14dtbk7d.js.map → chunk-phvvxv1a.js.map} +1 -1
  153. package/dist/chunk-pq15dt8j.js +46 -0
  154. package/dist/chunk-pq15dt8j.js.map +27 -0
  155. package/dist/{chunk-q05648ac.js → chunk-ptpzh61m.js} +3 -3
  156. package/dist/{chunk-q05648ac.js.map → chunk-ptpzh61m.js.map} +1 -1
  157. package/dist/{chunk-nkasdjx2.js → chunk-qcrj4t72.js} +3 -3
  158. package/dist/{chunk-nkasdjx2.js.map → chunk-qcrj4t72.js.map} +1 -1
  159. package/dist/{chunk-bfhcx1ca.js → chunk-re9ac4tc.js} +27 -27
  160. package/dist/{chunk-bfhcx1ca.js.map → chunk-re9ac4tc.js.map} +7 -6
  161. package/dist/{chunk-q093ph67.js → chunk-rr8bzm6k.js} +2 -2
  162. package/dist/{chunk-q093ph67.js.map → chunk-rr8bzm6k.js.map} +1 -1
  163. package/dist/{chunk-gm34n6da.js → chunk-s5hdrpam.js} +3 -3
  164. package/dist/{chunk-gm34n6da.js.map → chunk-s5hdrpam.js.map} +1 -1
  165. package/dist/{chunk-k0220nam.js → chunk-s6bq91cm.js} +2 -2
  166. package/dist/{chunk-k0220nam.js.map → chunk-s6bq91cm.js.map} +1 -1
  167. package/dist/{chunk-vt0vybw8.js → chunk-vsd5h2d9.js} +3 -3
  168. package/dist/{chunk-vt0vybw8.js.map → chunk-vsd5h2d9.js.map} +1 -1
  169. package/dist/{chunk-a1cwr0wh.js → chunk-w3mc696j.js} +2 -2
  170. package/dist/{chunk-a1cwr0wh.js.map → chunk-w3mc696j.js.map} +1 -1
  171. package/dist/{chunk-811qpkzd.js → chunk-wn4j741t.js} +2 -2
  172. package/dist/{chunk-811qpkzd.js.map → chunk-wn4j741t.js.map} +1 -1
  173. package/dist/{chunk-xmy09pr9.js → chunk-wxyxnbh6.js} +4 -4
  174. package/dist/{chunk-xmy09pr9.js.map → chunk-wxyxnbh6.js.map} +1 -1
  175. package/dist/{chunk-tp37k8c0.js → chunk-x244kqcc.js} +2 -2
  176. package/dist/{chunk-tp37k8c0.js.map → chunk-x244kqcc.js.map} +1 -1
  177. package/dist/chunk-x26jb60f.js +4 -0
  178. package/dist/{chunk-z7wchajg.js.map → chunk-x26jb60f.js.map} +2 -2
  179. package/dist/{chunk-4ehzm7p1.js → chunk-xvk6aqd7.js} +3 -3
  180. package/dist/{chunk-4ehzm7p1.js.map → chunk-xvk6aqd7.js.map} +1 -1
  181. package/dist/chunk-xwqdh388.js +5 -0
  182. package/dist/chunk-xwqdh388.js.map +13 -0
  183. package/dist/{chunk-56b6m0d4.js → chunk-y45whafz.js} +2 -2
  184. package/dist/{chunk-56b6m0d4.js.map → chunk-y45whafz.js.map} +1 -1
  185. package/dist/{chunk-q8a7ncvs.js → chunk-y5kfqq4f.js} +2 -2
  186. package/dist/{chunk-q8a7ncvs.js.map → chunk-y5kfqq4f.js.map} +1 -1
  187. package/dist/chunk-ybcdxrqx.js +4 -0
  188. package/dist/{chunk-wqphnrej.js.map → chunk-ybcdxrqx.js.map} +2 -2
  189. package/dist/{chunk-7nmbzdys.js → chunk-yrbvfda9.js} +1 -1
  190. package/dist/{chunk-wc3q88a2.js → chunk-yykrvrpt.js} +1 -1
  191. package/dist/{chunk-fxvqtwte.js → chunk-zk1vwwv6.js} +2 -2
  192. package/dist/{chunk-fxvqtwte.js.map → chunk-zk1vwwv6.js.map} +1 -1
  193. package/dist/chunks/{RealtimeClient-BnNSz8AK.js → RealtimeClient-CLXePUcE.js} +2 -2
  194. package/dist/chunks/{RealtimeClient-BnNSz8AK.js.map → RealtimeClient-CLXePUcE.js.map} +1 -1
  195. package/dist/chunks/{ThemeProvider-CoQ-vnvy.js → ThemeProvider-COjYIalw.js} +74 -1273
  196. package/dist/chunks/ThemeProvider-COjYIalw.js.map +1 -0
  197. package/dist/chunks/{fetchFileRequest-Bhp0oJ0T.js → fetchFileRequest-BaufNZpI.js} +2 -2
  198. package/dist/chunks/{fetchFileRequest-Bhp0oJ0T.js.map → fetchFileRequest-BaufNZpI.js.map} +1 -1
  199. package/dist/chunks/{live-Dt8sq9W4.js → live-Dz_rk7fm.js} +4 -15
  200. package/dist/chunks/{live-Dt8sq9W4.js.map → live-Dz_rk7fm.js.map} +1 -1
  201. package/dist/chunks/{mutationExtras-ChOGPZlY.js → mutationExtras-DtSw6BcX.js} +2 -2
  202. package/dist/chunks/{mutationExtras-ChOGPZlY.js.map → mutationExtras-DtSw6BcX.js.map} +1 -1
  203. package/dist/chunks/rolldown-runtime-D7D4PA-g.js +13 -0
  204. package/dist/chunks/{subscriptionStream-DDl_H-QM.js → subscriptionStream-CqhJOfPn.js} +2 -2
  205. package/dist/chunks/{subscriptionStream-DDl_H-QM.js.map → subscriptionStream-CqhJOfPn.js.map} +1 -1
  206. package/dist/chunks/urlpattern-polyfill-Cc7YrzJf.js +913 -0
  207. package/dist/chunks/urlpattern-polyfill-Cc7YrzJf.js.map +1 -0
  208. package/dist/client/ClientRouter.d.ts +1 -1
  209. package/dist/client/ClientRouter.d.ts.map +1 -1
  210. package/dist/client/ClientRouterContext.d.ts +1 -1
  211. package/dist/client/ClientRouterContext.d.ts.map +1 -1
  212. package/dist/client/browserHistory.d.ts +13 -0
  213. package/dist/client/browserHistory.d.ts.map +1 -0
  214. package/dist/client/index.js +9 -6
  215. package/dist/client/index.js.map +1 -1
  216. package/dist/client/init.d.ts.map +1 -1
  217. package/dist/client/scrollRestoration.d.ts +1 -1
  218. package/dist/client/scrollRestoration.d.ts.map +1 -1
  219. package/dist/client/urlPattern.d.ts +30 -0
  220. package/dist/client/urlPattern.d.ts.map +1 -0
  221. package/dist/config/index.js +1 -1
  222. package/dist/console/run.js +2 -2
  223. package/dist/console/run.js.map +1 -1
  224. package/dist/container/index.js +2 -2
  225. package/dist/container/index.js.map +1 -1
  226. package/dist/database/index.js +2 -2
  227. package/dist/database/index.js.map +1 -1
  228. package/dist/email/index.js +2 -2
  229. package/dist/email/index.js.map +1 -1
  230. package/dist/facades/DB.d.ts +10 -0
  231. package/dist/facades/DB.d.ts.map +1 -1
  232. package/dist/facades/index.js +2 -2
  233. package/dist/facades/index.js.map +1 -1
  234. package/dist/foundation/index.js +2 -2
  235. package/dist/foundation/index.js.map +1 -1
  236. package/dist/http/index.js +2 -2
  237. package/dist/http/index.js.map +1 -1
  238. package/dist/i18n/dictionaryRuntime.js +2 -2
  239. package/dist/i18n/dictionaryRuntime.js.map +1 -1
  240. package/dist/i18n/index.js +2 -2
  241. package/dist/i18n/index.js.map +2 -2
  242. package/dist/kernel/index.js +2 -2
  243. package/dist/kernel/index.js.map +2 -2
  244. package/dist/orm/Model.d.ts.map +1 -1
  245. package/dist/orm/context.d.ts +54 -0
  246. package/dist/orm/context.d.ts.map +1 -1
  247. package/dist/orm/index.d.ts +1 -1
  248. package/dist/orm/index.d.ts.map +1 -1
  249. package/dist/orm/index.js +4 -4
  250. package/dist/orm/index.js.map +3 -3
  251. package/dist/probe/index.js +2 -2
  252. package/dist/probe/index.js.map +1 -1
  253. package/dist/server/index.js +2 -2
  254. package/dist/server/index.js.map +1 -1
  255. package/dist/services/index.js +2 -2
  256. package/dist/services/index.js.map +2 -2
  257. package/dist/services/queue/work.js +2 -2
  258. package/dist/services/queue/work.js.map +1 -1
  259. package/dist/services/router/ViewRouteDispatcher.d.ts +1 -0
  260. package/dist/services/router/ViewRouteDispatcher.d.ts.map +1 -1
  261. package/dist/stats/route-table.js +1 -1
  262. package/dist/support/index.js +2 -2
  263. package/dist/support/index.js.map +1 -1
  264. package/dist/testing/index.d.ts +1 -0
  265. package/dist/testing/index.d.ts.map +1 -1
  266. package/dist/testing/index.js +234 -2
  267. package/dist/testing/index.js.map +1 -1
  268. package/dist/vitest/index.js +2 -2
  269. package/dist/vitest/index.js.map +1 -1
  270. package/package.json +2 -1
  271. package/dist/chunk-02s440vh.js +0 -4
  272. package/dist/chunk-3e19n0f2.js +0 -4
  273. package/dist/chunk-4fw84bh6.js +0 -15
  274. package/dist/chunk-70qqpvd9.js +0 -24
  275. package/dist/chunk-9mhr0kwd.js +0 -5
  276. package/dist/chunk-ht5mq6ev.js +0 -10
  277. package/dist/chunk-rczmh97n.js +0 -9
  278. package/dist/chunk-rczmh97n.js.map +0 -10
  279. package/dist/chunk-tkskgvhc.js +0 -4
  280. package/dist/chunk-v325k8qj.js +0 -46
  281. package/dist/chunk-v325k8qj.js.map +0 -31
  282. package/dist/chunk-wqphnrej.js +0 -4
  283. package/dist/chunk-z7wchajg.js +0 -4
  284. package/dist/chunk-z97tptd1.js +0 -6
  285. package/dist/chunks/ThemeProvider-CoQ-vnvy.js.map +0 -1
  286. /package/dist/{chunk-95re1b2y.js.map → chunk-1kehwa3s.js.map} +0 -0
  287. /package/dist/{chunk-zvhks9s7.js.map → chunk-8pw4zjnx.js.map} +0 -0
  288. /package/dist/{chunk-7nmbzdys.js.map → chunk-yrbvfda9.js.map} +0 -0
  289. /package/dist/{chunk-wc3q88a2.js.map → chunk-yykrvrpt.js.map} +0 -0
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import"./chunk-05k9201j.js";import Eu from"os";import Au from"fs";var Wl=new Map,hh=new Map,nh=Symbol("OriginError"),Dl={};class fl extends Promise{constructor(l,n,u,c,w={}){let E,t;super((_,B)=>{E=_,t=B});this.tagged=Array.isArray(l.raw),this.strings=l,this.args=n,this.handler=u,this.canceller=c,this.options=w,this.state=null,this.statement=null,this.resolve=(_)=>(this.active=!1,E(_)),this.reject=(_)=>(this.active=!1,t(_)),this.active=!1,this.cancelled=null,this.executed=!1,this.signature="",this[nh]=this.handler.debug?Error():this.tagged&&vn(this.strings)}get origin(){return(this.handler.debug?this[nh].stack:this.tagged&&hh.has(this.strings)?hh.get(this.strings):hh.set(this.strings,this[nh].stack).get(this.strings))||""}static get[Symbol.species](){return Promise}cancel(){return this.canceller&&(this.canceller(this),this.canceller=null)}simple(){return this.options.simple=!0,this.options.prepare=!1,this}async readable(){return this.simple(),this.streaming=!0,this}async writable(){return this.simple(),this.streaming=!0,this}cursor(l=1,n){if(this.options.simple=!1,typeof l==="function")n=l,l=1;if(this.cursorRows=l,typeof n==="function")return this.cursorFn=n,this;let u;return{[Symbol.asyncIterator]:()=>({next:()=>{if(this.executed&&!this.active)return{done:!0};u&&u();let c=new Promise((w,E)=>{this.cursorFn=(t)=>{return w({value:t,done:!1}),new Promise((_)=>u=_)},this.resolve=()=>(this.active=!1,w({done:!0})),this.reject=(t)=>(this.active=!1,E(t))});return this.execute(),c},return(){return u&&u(Dl),{done:!0}}})}}describe(){return this.options.simple=!1,this.onlyDescribe=this.options.prepare=!0,this}stream(){throw Error(".stream has been renamed to .forEach")}forEach(l){return this.forEachFn=l,this.handle(),this}raw(){return this.isRaw=!0,this}values(){return this.isRaw="values",this}async handle(){!this.executed&&(this.executed=!0)&&await 1&&this.handler(this)}execute(){return this.handle(),this}then(){return this.handle(),super.then.apply(this,arguments)}catch(){return this.handle(),super.catch.apply(this,arguments)}finally(){return this.handle(),super.finally.apply(this,arguments)}}function vn(l){if(Wl.has(l))return Wl.get(l);let n=Error.stackTraceLimit;return Error.stackTraceLimit=4,Wl.set(l,Error()),Error.stackTraceLimit=n,Wl.get(l)}class Yl extends Error{constructor(l){super(l.message);this.name=this.constructor.name,Object.assign(this,l)}}var K={connection:Th,postgres:Xh,generic:Ch,notSupported:Zh};function Th(l,n,u){let{host:c,port:w}=u||n,E=Object.assign(Error("write "+l+" "+(n.path||c+":"+w)),{code:l,errno:l,address:n.path||c},n.path?{}:{port:w});return Error.captureStackTrace(E,Th),E}function Xh(l){let n=new Yl(l);return Error.captureStackTrace(n,Xh),n}function Ch(l,n){let u=Object.assign(Error(l+": "+n),{code:l});return Error.captureStackTrace(u,Ch),u}function Zh(l){let n=Object.assign(Error(l+" (B) is not supported"),{code:"MESSAGE_NOT_SUPPORTED",name:l});return Error.captureStackTrace(n,Zh),n}var mn={string:{to:25,from:null,serialize:(l)=>""+l},number:{to:0,from:[21,23,26,700,701],serialize:(l)=>""+l,parse:(l)=>+l},json:{to:114,from:[114,3802],serialize:(l)=>JSON.stringify(l),parse:(l)=>JSON.parse(l)},boolean:{to:16,from:16,serialize:(l)=>l===!0?"t":"f",parse:(l)=>l==="t"},date:{to:1184,from:[1082,1114,1184],serialize:(l)=>(l instanceof Date?l:new Date(l)).toISOString(),parse:(l)=>new Date(l)},bytea:{to:17,from:17,serialize:(l)=>"\\x"+Buffer.from(l).toString("hex"),parse:(l)=>Buffer.from(l.slice(2),"hex")}};class ml{then(){uh()}catch(){uh()}finally(){uh()}}class il extends ml{constructor(l){super();this.value=el(l)}}class wl extends ml{constructor(l,n,u){super();this.value=l,this.type=n,this.array=u}}class bl extends ml{constructor(l,n){super();this.first=l,this.rest=n}build(l,n,u,c){let w=bn.map(([E,t])=>({fn:t,i:l.search(E)})).sort((E,t)=>E.i-t.i).pop();return w.i===-1?_h(this.first,c):w.fn(this.first,this.rest,n,u,c)}}function al(l,n,u,c){let w=l instanceof wl?l.value:l;if(w===void 0){if(l instanceof wl?l.value=c.transform.undefined:w=l=c.transform.undefined,w===void 0)throw K.generic("UNDEFINED_VALUE","Undefined values are not allowed")}return"$"+u.push(l instanceof wl?(n.push(l.value),l.array?l.array[l.type||vl(l.value)]||l.type||ih(l.value):l.type):(n.push(l),vl(l)))}var Hh=Qh(mn);function th(l,n,u,c,w,E){for(let t=1;t<l.strings.length;t++)n+=wh(n,u,c,w,E)+l.strings[t],u=l.args[t];return n}function wh(l,n,u,c,w){return n instanceof bl?n.build(l,u,c,w):n instanceof fl?ch(n,u,c,w):n instanceof il?n.value:n&&n[0]instanceof fl?n.reduce((E,t)=>E+" "+ch(t,u,c,w),""):al(n,u,c,w)}function ch(l,n,u,c){return l.fragment=!0,th(l,l.strings[0],l.args[0],n,u,c)}function zh(l,n,u,c,w){return l.map((E)=>"("+c.map((t)=>wh("values",E[t],n,u,w)).join(",")+")").join(",")}function Fh(l,n,u,c,w){let E=Array.isArray(l[0]),t=n.length?n.flat():Object.keys(E?l[0]:l);return zh(E?l:[l],u,c,t,w)}function Kl(l,n,u,c,w){if(typeof l==="string"&&(l=[l].concat(n)),Array.isArray(l))return _h(l,w);let E;return(n.length?n.flat():Object.keys(l)).map((_)=>{return E=l[_],(E instanceof fl?ch(E,u,c,w):E instanceof il?E.value:al(E,u,c,w))+" as "+el(w.transform.column.to?w.transform.column.to(_):_)}).join(",")}var bn=Object.entries({values:Fh,in:(...l)=>{let n=Fh(...l);return n==="()"?"(null)":n},select:Kl,as:Kl,returning:Kl,"\\(":Kl,update(l,n,u,c,w){return(n.length?n.flat():Object.keys(l)).map((E)=>el(w.transform.column.to?w.transform.column.to(E):E)+"="+wh("values",l[E],u,c,w))},insert(l,n,u,c,w){let E=n.length?n.flat():Object.keys(Array.isArray(l)?l[0]:l);return"("+_h(E,w)+")values"+zh(Array.isArray(l)?l:[l],u,c,E,w)}}).map(([l,n])=>[new RegExp("((?:^|[\\s(])"+l+"(?:$|[\\s(]))(?![\\s\\S]*\\1)","i"),n]);function uh(){throw K.generic("NOT_TAGGED_CALL","Query not called as a tagged template literal")}var{serializers:an,parsers:en}=Hh;function ih(l){if(Array.isArray(l))return ih(l[0]);return typeof l==="string"?1009:0}var Jh=function(l){let n=Qh(l||{});return{serializers:Object.assign({},an,n.serializers),parsers:Object.assign({},en,n.parsers)}};function Qh(l){return Object.keys(l).reduce((n,u)=>{if(l[u].from&&[].concat(l[u].from).forEach((c)=>n.parsers[c]=l[u].parse),l[u].serialize)n.serializers[l[u].to]=l[u].serialize,l[u].from&&[].concat(l[u].from).forEach((c)=>n.serializers[c]=l[u].serialize);return n},{parsers:{},serializers:{}})}function _h(l,{transform:{column:n}}){return l.map((u)=>el(n.to?n.to(u):u)).join(",")}var el=function(n){return'"'+n.replace(/"/g,'""').replace(/\./g,'"."')+'"'},vl=function l(n){return n instanceof wl?n.type:n instanceof Date?1184:n instanceof Uint8Array?17:n===!0||n===!1?16:typeof n==="bigint"?20:Array.isArray(n)?l(n[0]):0},kn=/\\/g,on=/"/g;function pn(l){return l.replace(kn,"\\\\").replace(on,"\\\"")}var Vh=function l(n,u,c,w){if(Array.isArray(n)===!1)return n;if(!n.length)return"{}";let E=n[0],t=w===1020?";":",";if(Array.isArray(E)&&!E.type)return"{"+n.map((_)=>l(_,u,c,w)).join(t)+"}";return"{"+n.map((_)=>{if(_===void 0){if(_=c.transform.undefined,_===void 0)throw K.generic("UNDEFINED_VALUE","Undefined values are not allowed")}return _===null?"null":'"'+pn(u?u(_.type?_.value:_):""+_)+'"'}).join(t)+"}"},fh={i:0,char:null,str:"",quoted:!1,last:0},Wh=function(n,u,c){return fh.i=fh.last=0,Kh(fh,n,u,c)};function Kh(l,n,u,c){let w=[],E=c===1020?";":",";for(;l.i<n.length;l.i++){if(l.char=n[l.i],l.quoted)if(l.char==="\\")l.str+=n[++l.i];else if(l.char==='"')w.push(u?u(l.str):l.str),l.str="",l.quoted=n[l.i+1]==='"',l.last=l.i+2;else l.str+=l.char;else if(l.char==='"')l.quoted=!0;else if(l.char==="{")l.last=++l.i,w.push(Kh(l,n,u,c));else if(l.char==="}"){l.quoted=!1,l.last<l.i&&w.push(u?u(n.slice(l.last,l.i)):n.slice(l.last,l.i)),l.last=l.i+1;break}else if(l.char===E&&l.p!=="}"&&l.p!=='"')w.push(u?u(n.slice(l.last,l.i)):n.slice(l.last,l.i)),l.last=l.i+1;l.p=l.char}return l.last<l.i&&w.push(u?u(n.slice(l.last,l.i+1)):n.slice(l.last,l.i+1)),w}var Sl=(l)=>{let n=l[0];for(let u=1;u<l.length;u++)n+=l[u]==="_"?l[++u].toUpperCase():l[u];return n},Gl=(l)=>{let n=l[0].toUpperCase();for(let u=1;u<l.length;u++)n+=l[u]==="_"?l[++u].toUpperCase():l[u];return n},jl=(l)=>l.replace(/_/g,"-"),Fl=(l)=>l.replace(/([A-Z])/g,"_$1").toLowerCase(),Hl=(l)=>(l.slice(0,1)+l.slice(1).replace(/([A-Z])/g,"_$1")).toLowerCase(),zl=(l)=>l.replace(/-/g,"_");function Oh(l){return function n(u,c){return typeof u==="object"&&u!==null&&(c.type===114||c.type===3802)?Array.isArray(u)?u.map((w)=>n(w,c)):Object.entries(u).reduce((w,[E,t])=>Object.assign(w,{[l(E)]:n(t,c)}),{}):u}}Sl.column={from:Sl};Sl.value={from:Oh(Sl)};Fl.column={to:Fl};var Eh={...Sl};Eh.column.to=Fl;Gl.column={from:Gl};Gl.value={from:Oh(Gl)};Hl.column={to:Hl};var Ah={...Gl};Ah.column.to=Hl;jl.column={from:jl};jl.value={from:Oh(jl)};zl.column={to:zl};var Uh={...jl};Uh.column.to=zl;import vh from"net";import qn from"tls";import Jl from"crypto";import $h from"stream";import{performance as mh}from"perf_hooks";class Ml extends Array{constructor(){super();Object.defineProperties(this,{count:{value:null,writable:!0},state:{value:null,writable:!0},command:{value:null,writable:!0},columns:{value:null,writable:!0},statement:{value:null,writable:!0}})}static get[Symbol.species](){return Array}}var hl=yn;function yn(l=[]){let n=l.slice(),u=0;return{get length(){return n.length-u},remove:(c)=>{let w=n.indexOf(c);return w===-1?null:(n.splice(w,1),c)},push:(c)=>(n.push(c),c),shift:()=>{let c=n[u++];if(u===n.length)u=0,n=[];else n[u-1]=void 0;return c}}}var p=Buffer.allocUnsafe(256),rn="BCcDdEFfHPpQSX".split("").reduce((l,n)=>{let u=n.charCodeAt(0);return l[n]=()=>{return p[0]=u,R.i=5,R},l},{}),R=Object.assign(sn,rn,{N:String.fromCharCode(0),i:0,inc(l){return R.i+=l,R},str(l){let n=Buffer.byteLength(l);return kl(n),R.i+=p.write(l,R.i,n,"utf8"),R},i16(l){return kl(2),p.writeUInt16BE(l,R.i),R.i+=2,R},i32(l,n){if(n||n===0)return p.writeUInt32BE(l,n),R;return kl(4),p.writeUInt32BE(l,R.i),R.i+=4,R},z(l){return kl(l),p.fill(0,R.i,R.i+l),R.i+=l,R},raw(l){return p=Buffer.concat([p.subarray(0,R.i),l]),R.i=p.length,R},end(l=1){p.writeUInt32BE(R.i-l,l);let n=p.subarray(0,R.i);return R.i=0,p=Buffer.allocUnsafe(256),n}}),$=R;function kl(l){if(p.length-R.i<l){let n=p,u=n.length;p=Buffer.allocUnsafe(u+(u>>1)+l),n.copy(p)}}function sn(){return R.i=0,R}var Bh=eh,xn=1,Bl=$().S().end(),bh=$().H().end(),lu=$().i32(8).i32(80877103).end(8),hu=Buffer.concat([$().E().str($.N).i32(0).end(),Bl]),nu=$().D().str("S").str($.N).end(),Rl=()=>{},uu=new Set(["FetchPreparedStatement","RevalidateCachedQuery","transformAssignedExpr"]),fu={83:"severity_local",86:"severity",67:"code",77:"message",68:"detail",72:"hint",80:"position",112:"internal_position",113:"internal_query",87:"where",115:"schema_name",116:"table_name",99:"column_name",100:"data type_name",110:"constraint_name",70:"file",76:"line",82:"routine"};function eh(l,n={},{onopen:u=Rl,onend:c=Rl,onclose:w=Rl}={}){let{sslnegotiation:E,ssl:t,max:_,user:B,host:Q,port:T,database:Y,parsers:j,transform:M,onnotice:H,onnotify:I,onparameter:b,max_pipeline:Z,keep_alive:cl,backoff:nl,target_session_attrs:x}=l,d=hl(),Ul=xn++,_l={pid:null,secret:null},Pl=gh(xl,l.idle_timeout),Il=gh(xl,l.max_lifetime),L=gh(xh,l.connect_timeout),U=null,Ol,q=null,N=new Ml,y=Buffer.alloc(0),dl=l.fetch_types,El={},O={},S=Math.random().toString(36).slice(2),F=1,v=0,V=0,G=0,D=0,i=0,J=0,m=0,r=null,X=null,Al=!1,tl=null,$l=null,e=null,z=null,C=null,ll=null,Ql=null,sl=null,A=null,Tl=null,k={queue:n.closed,idleTimer:Pl,connect(h){e=h,Lh()},terminate:Zl,execute:Xl,cancel:yh,end:xl,count:0,id:Ul};return n.closed&&n.closed.push(k),k;async function ph(){let h;try{h=l.socket?await Promise.resolve(l.socket(l)):new vh.Socket}catch(f){Nl(f);return}return h.on("error",Nl),h.on("close",Nh),h.on("drain",Ph),h}async function yh({pid:h,secret:f},g,P){try{Ol=$().i32(16).i32(80877102).i32(h).i32(f).end(16),await dh(),U.once("error",P),U.once("close",g)}catch(W){P(W)}}function Xl(h){if(Al)return Cl(h,K.connection("CONNECTION_DESTROYED",l));if(C)return Cl(h,K.generic("COPY_IN_PROGRESS","You cannot execute queries during copy"));if(h.cancelled)return;try{return h.state=_l,A?d.push(h):(A=h,A.active=!0),qh(h),a(rh(h))&&!h.describeFirst&&!h.cursorFn&&d.length<Z&&(!h.options.onexecute||h.options.onexecute(k))}catch(f){return d.length===0&&a(Bl),ul(f),!0}}function rh(h){if(h.parameters.length>=65534)throw K.generic("MAX_PARAMETERS_EXCEEDED","Max number of parameters (65534) exceeded");return h.options.simple?$().Q().str(h.statement.string+$.N).end():h.describeFirst?Buffer.concat([Gh(h),bh]):h.prepare?h.prepared?Vl(h):Buffer.concat([Gh(h),Vl(h)]):sh(h)}function Gh(h){return Buffer.concat([Yh(h.statement.string,h.parameters,h.statement.types,h.statement.name),Vn("S",h.statement.name)])}function Vl(h){return Buffer.concat([Qn(h.parameters,h.statement.types,h.statement.name,h.cursorName),h.cursorFn?Rh("",h.cursorRows):hu])}function sh(h){return Buffer.concat([Yh(h.statement.string,h.parameters,h.statement.types),nu,Vl(h)])}function qh(h){let f=[],g=[],P=th(h,h.strings[0],h.args[0],f,g,l);!h.tagged&&h.args.forEach((W)=>al(W,f,g,l)),h.prepare=l.prepare&&("prepare"in h.options?h.options.prepare:!0),h.string=P,h.signature=h.prepare&&g+P,h.onlyDescribe&&delete O[h.signature],h.parameters=h.parameters||f,h.prepared=h.prepare&&h.signature in O,h.describeFirst=h.onlyDescribe||f.length&&!h.prepared,h.statement=h.prepared?O[h.signature]:{string:P,types:g,name:h.prepare?S+F++:""},typeof l.debug==="function"&&l.debug(Ul,P,f,g)}function a(h,f){if(ll=ll?Buffer.concat([ll,h]):Buffer.from(h),f||ll.length>=1024)return jh(f);return X===null&&(X=setImmediate(jh)),!0}function jh(h){let f=U.write(ll,h);return X!==null&&clearImmediate(X),ll=X=null,f}function xh(){ul(K.connection("CONNECT_TIMEOUT",l,U)),U.destroy()}async function Mh(){if(E!=="direct"){if(a(lu),!await new Promise((g)=>U.once("data",(P)=>g(P[0]===83)))&&t==="prefer")return Ll()}let h={socket:U,servername:vh.isIP(U.host)?void 0:U.host};if(E==="direct")h.ALPNProtocols=["postgresql"];if(t==="require"||t==="allow"||t==="prefer")h.rejectUnauthorized=!1;else if(typeof t==="object")Object.assign(h,t);U.removeAllListeners(),U=qn.connect(h),U.on("secureConnect",Ll),U.on("error",Nl),U.on("close",Nh),U.on("drain",Ph)}function Ph(){!A&&u(k)}function ql(h){if(tl){if(tl.push(h),V-=h.length,V>0)return}y=tl?Buffer.concat(tl,i-V):y.length===0?h:Buffer.concat([y,h],y.length+h.length);while(y.length>4){if(i=y.readUInt32BE(1),i>=y.length){V=i-y.length,tl=[y];break}try{ln(y.subarray(0,i+1))}catch(f){A&&(A.cursorFn||A.describeFirst)&&a(Bl),ul(f)}y=y.subarray(i+1),V=0,tl=null}}async function dh(){if(Al=!1,El={},U||(U=await ph()),!U)return;if(L.start(),l.socket)return t?Mh():Ll();if(U.on("connect",t?Mh:Ll),l.path)return U.connect(l.path);U.ssl=t,U.connect(T[G],Q[G]),U.host=Q[G],U.port=T[G],G=(G+1)%T.length}function Lh(){setTimeout(dh,v?Math.max(0,v+J-mh.now()):0)}function Ll(){try{O={},dl=l.fetch_types,S=Math.random().toString(36).slice(2),F=1,Il.start(),U.on("data",ql),cl&&U.setKeepAlive&&U.setKeepAlive(!0,1000*cl);let h=Kn();a(h)}catch(h){Nl(h)}}function Nl(h){if(k.queue===n.connecting&&l.host[D+1])return;ul(h);while(d.length)Cl(d.shift(),h)}function ul(h){C&&(C.destroy(h),C=null),A&&Cl(A,h),e&&(Cl(e,h),e=null)}function Cl(h,f){if(h.reserve)return h.reject(f);if(!f||typeof f!=="object")f=Error(f);"query"in f||"parameters"in f||Object.defineProperties(f,{stack:{value:f.stack+h.origin.replace(/.*\n/,`
2
+ import"./chunk-k9882kqg.js";import Eu from"os";import Au from"fs";var Wl=new Map,hh=new Map,nh=Symbol("OriginError"),Dl={};class fl extends Promise{constructor(l,n,u,c,w={}){let E,t;super((_,B)=>{E=_,t=B});this.tagged=Array.isArray(l.raw),this.strings=l,this.args=n,this.handler=u,this.canceller=c,this.options=w,this.state=null,this.statement=null,this.resolve=(_)=>(this.active=!1,E(_)),this.reject=(_)=>(this.active=!1,t(_)),this.active=!1,this.cancelled=null,this.executed=!1,this.signature="",this[nh]=this.handler.debug?Error():this.tagged&&vn(this.strings)}get origin(){return(this.handler.debug?this[nh].stack:this.tagged&&hh.has(this.strings)?hh.get(this.strings):hh.set(this.strings,this[nh].stack).get(this.strings))||""}static get[Symbol.species](){return Promise}cancel(){return this.canceller&&(this.canceller(this),this.canceller=null)}simple(){return this.options.simple=!0,this.options.prepare=!1,this}async readable(){return this.simple(),this.streaming=!0,this}async writable(){return this.simple(),this.streaming=!0,this}cursor(l=1,n){if(this.options.simple=!1,typeof l==="function")n=l,l=1;if(this.cursorRows=l,typeof n==="function")return this.cursorFn=n,this;let u;return{[Symbol.asyncIterator]:()=>({next:()=>{if(this.executed&&!this.active)return{done:!0};u&&u();let c=new Promise((w,E)=>{this.cursorFn=(t)=>{return w({value:t,done:!1}),new Promise((_)=>u=_)},this.resolve=()=>(this.active=!1,w({done:!0})),this.reject=(t)=>(this.active=!1,E(t))});return this.execute(),c},return(){return u&&u(Dl),{done:!0}}})}}describe(){return this.options.simple=!1,this.onlyDescribe=this.options.prepare=!0,this}stream(){throw Error(".stream has been renamed to .forEach")}forEach(l){return this.forEachFn=l,this.handle(),this}raw(){return this.isRaw=!0,this}values(){return this.isRaw="values",this}async handle(){!this.executed&&(this.executed=!0)&&await 1&&this.handler(this)}execute(){return this.handle(),this}then(){return this.handle(),super.then.apply(this,arguments)}catch(){return this.handle(),super.catch.apply(this,arguments)}finally(){return this.handle(),super.finally.apply(this,arguments)}}function vn(l){if(Wl.has(l))return Wl.get(l);let n=Error.stackTraceLimit;return Error.stackTraceLimit=4,Wl.set(l,Error()),Error.stackTraceLimit=n,Wl.get(l)}class Yl extends Error{constructor(l){super(l.message);this.name=this.constructor.name,Object.assign(this,l)}}var K={connection:Th,postgres:Xh,generic:Ch,notSupported:Zh};function Th(l,n,u){let{host:c,port:w}=u||n,E=Object.assign(Error("write "+l+" "+(n.path||c+":"+w)),{code:l,errno:l,address:n.path||c},n.path?{}:{port:w});return Error.captureStackTrace(E,Th),E}function Xh(l){let n=new Yl(l);return Error.captureStackTrace(n,Xh),n}function Ch(l,n){let u=Object.assign(Error(l+": "+n),{code:l});return Error.captureStackTrace(u,Ch),u}function Zh(l){let n=Object.assign(Error(l+" (B) is not supported"),{code:"MESSAGE_NOT_SUPPORTED",name:l});return Error.captureStackTrace(n,Zh),n}var mn={string:{to:25,from:null,serialize:(l)=>""+l},number:{to:0,from:[21,23,26,700,701],serialize:(l)=>""+l,parse:(l)=>+l},json:{to:114,from:[114,3802],serialize:(l)=>JSON.stringify(l),parse:(l)=>JSON.parse(l)},boolean:{to:16,from:16,serialize:(l)=>l===!0?"t":"f",parse:(l)=>l==="t"},date:{to:1184,from:[1082,1114,1184],serialize:(l)=>(l instanceof Date?l:new Date(l)).toISOString(),parse:(l)=>new Date(l)},bytea:{to:17,from:17,serialize:(l)=>"\\x"+Buffer.from(l).toString("hex"),parse:(l)=>Buffer.from(l.slice(2),"hex")}};class ml{then(){uh()}catch(){uh()}finally(){uh()}}class il extends ml{constructor(l){super();this.value=el(l)}}class wl extends ml{constructor(l,n,u){super();this.value=l,this.type=n,this.array=u}}class bl extends ml{constructor(l,n){super();this.first=l,this.rest=n}build(l,n,u,c){let w=bn.map(([E,t])=>({fn:t,i:l.search(E)})).sort((E,t)=>E.i-t.i).pop();return w.i===-1?_h(this.first,c):w.fn(this.first,this.rest,n,u,c)}}function al(l,n,u,c){let w=l instanceof wl?l.value:l;if(w===void 0){if(l instanceof wl?l.value=c.transform.undefined:w=l=c.transform.undefined,w===void 0)throw K.generic("UNDEFINED_VALUE","Undefined values are not allowed")}return"$"+u.push(l instanceof wl?(n.push(l.value),l.array?l.array[l.type||vl(l.value)]||l.type||ih(l.value):l.type):(n.push(l),vl(l)))}var Hh=Qh(mn);function th(l,n,u,c,w,E){for(let t=1;t<l.strings.length;t++)n+=wh(n,u,c,w,E)+l.strings[t],u=l.args[t];return n}function wh(l,n,u,c,w){return n instanceof bl?n.build(l,u,c,w):n instanceof fl?ch(n,u,c,w):n instanceof il?n.value:n&&n[0]instanceof fl?n.reduce((E,t)=>E+" "+ch(t,u,c,w),""):al(n,u,c,w)}function ch(l,n,u,c){return l.fragment=!0,th(l,l.strings[0],l.args[0],n,u,c)}function zh(l,n,u,c,w){return l.map((E)=>"("+c.map((t)=>wh("values",E[t],n,u,w)).join(",")+")").join(",")}function Fh(l,n,u,c,w){let E=Array.isArray(l[0]),t=n.length?n.flat():Object.keys(E?l[0]:l);return zh(E?l:[l],u,c,t,w)}function Kl(l,n,u,c,w){if(typeof l==="string"&&(l=[l].concat(n)),Array.isArray(l))return _h(l,w);let E;return(n.length?n.flat():Object.keys(l)).map((_)=>{return E=l[_],(E instanceof fl?ch(E,u,c,w):E instanceof il?E.value:al(E,u,c,w))+" as "+el(w.transform.column.to?w.transform.column.to(_):_)}).join(",")}var bn=Object.entries({values:Fh,in:(...l)=>{let n=Fh(...l);return n==="()"?"(null)":n},select:Kl,as:Kl,returning:Kl,"\\(":Kl,update(l,n,u,c,w){return(n.length?n.flat():Object.keys(l)).map((E)=>el(w.transform.column.to?w.transform.column.to(E):E)+"="+wh("values",l[E],u,c,w))},insert(l,n,u,c,w){let E=n.length?n.flat():Object.keys(Array.isArray(l)?l[0]:l);return"("+_h(E,w)+")values"+zh(Array.isArray(l)?l:[l],u,c,E,w)}}).map(([l,n])=>[new RegExp("((?:^|[\\s(])"+l+"(?:$|[\\s(]))(?![\\s\\S]*\\1)","i"),n]);function uh(){throw K.generic("NOT_TAGGED_CALL","Query not called as a tagged template literal")}var{serializers:an,parsers:en}=Hh;function ih(l){if(Array.isArray(l))return ih(l[0]);return typeof l==="string"?1009:0}var Jh=function(l){let n=Qh(l||{});return{serializers:Object.assign({},an,n.serializers),parsers:Object.assign({},en,n.parsers)}};function Qh(l){return Object.keys(l).reduce((n,u)=>{if(l[u].from&&[].concat(l[u].from).forEach((c)=>n.parsers[c]=l[u].parse),l[u].serialize)n.serializers[l[u].to]=l[u].serialize,l[u].from&&[].concat(l[u].from).forEach((c)=>n.serializers[c]=l[u].serialize);return n},{parsers:{},serializers:{}})}function _h(l,{transform:{column:n}}){return l.map((u)=>el(n.to?n.to(u):u)).join(",")}var el=function(n){return'"'+n.replace(/"/g,'""').replace(/\./g,'"."')+'"'},vl=function l(n){return n instanceof wl?n.type:n instanceof Date?1184:n instanceof Uint8Array?17:n===!0||n===!1?16:typeof n==="bigint"?20:Array.isArray(n)?l(n[0]):0},kn=/\\/g,on=/"/g;function pn(l){return l.replace(kn,"\\\\").replace(on,"\\\"")}var Vh=function l(n,u,c,w){if(Array.isArray(n)===!1)return n;if(!n.length)return"{}";let E=n[0],t=w===1020?";":",";if(Array.isArray(E)&&!E.type)return"{"+n.map((_)=>l(_,u,c,w)).join(t)+"}";return"{"+n.map((_)=>{if(_===void 0){if(_=c.transform.undefined,_===void 0)throw K.generic("UNDEFINED_VALUE","Undefined values are not allowed")}return _===null?"null":'"'+pn(u?u(_.type?_.value:_):""+_)+'"'}).join(t)+"}"},fh={i:0,char:null,str:"",quoted:!1,last:0},Wh=function(n,u,c){return fh.i=fh.last=0,Kh(fh,n,u,c)};function Kh(l,n,u,c){let w=[],E=c===1020?";":",";for(;l.i<n.length;l.i++){if(l.char=n[l.i],l.quoted)if(l.char==="\\")l.str+=n[++l.i];else if(l.char==='"')w.push(u?u(l.str):l.str),l.str="",l.quoted=n[l.i+1]==='"',l.last=l.i+2;else l.str+=l.char;else if(l.char==='"')l.quoted=!0;else if(l.char==="{")l.last=++l.i,w.push(Kh(l,n,u,c));else if(l.char==="}"){l.quoted=!1,l.last<l.i&&w.push(u?u(n.slice(l.last,l.i)):n.slice(l.last,l.i)),l.last=l.i+1;break}else if(l.char===E&&l.p!=="}"&&l.p!=='"')w.push(u?u(n.slice(l.last,l.i)):n.slice(l.last,l.i)),l.last=l.i+1;l.p=l.char}return l.last<l.i&&w.push(u?u(n.slice(l.last,l.i+1)):n.slice(l.last,l.i+1)),w}var Sl=(l)=>{let n=l[0];for(let u=1;u<l.length;u++)n+=l[u]==="_"?l[++u].toUpperCase():l[u];return n},Gl=(l)=>{let n=l[0].toUpperCase();for(let u=1;u<l.length;u++)n+=l[u]==="_"?l[++u].toUpperCase():l[u];return n},jl=(l)=>l.replace(/_/g,"-"),Fl=(l)=>l.replace(/([A-Z])/g,"_$1").toLowerCase(),Hl=(l)=>(l.slice(0,1)+l.slice(1).replace(/([A-Z])/g,"_$1")).toLowerCase(),zl=(l)=>l.replace(/-/g,"_");function Oh(l){return function n(u,c){return typeof u==="object"&&u!==null&&(c.type===114||c.type===3802)?Array.isArray(u)?u.map((w)=>n(w,c)):Object.entries(u).reduce((w,[E,t])=>Object.assign(w,{[l(E)]:n(t,c)}),{}):u}}Sl.column={from:Sl};Sl.value={from:Oh(Sl)};Fl.column={to:Fl};var Eh={...Sl};Eh.column.to=Fl;Gl.column={from:Gl};Gl.value={from:Oh(Gl)};Hl.column={to:Hl};var Ah={...Gl};Ah.column.to=Hl;jl.column={from:jl};jl.value={from:Oh(jl)};zl.column={to:zl};var Uh={...jl};Uh.column.to=zl;import vh from"net";import qn from"tls";import Jl from"crypto";import $h from"stream";import{performance as mh}from"perf_hooks";class Ml extends Array{constructor(){super();Object.defineProperties(this,{count:{value:null,writable:!0},state:{value:null,writable:!0},command:{value:null,writable:!0},columns:{value:null,writable:!0},statement:{value:null,writable:!0}})}static get[Symbol.species](){return Array}}var hl=yn;function yn(l=[]){let n=l.slice(),u=0;return{get length(){return n.length-u},remove:(c)=>{let w=n.indexOf(c);return w===-1?null:(n.splice(w,1),c)},push:(c)=>(n.push(c),c),shift:()=>{let c=n[u++];if(u===n.length)u=0,n=[];else n[u-1]=void 0;return c}}}var p=Buffer.allocUnsafe(256),rn="BCcDdEFfHPpQSX".split("").reduce((l,n)=>{let u=n.charCodeAt(0);return l[n]=()=>{return p[0]=u,R.i=5,R},l},{}),R=Object.assign(sn,rn,{N:String.fromCharCode(0),i:0,inc(l){return R.i+=l,R},str(l){let n=Buffer.byteLength(l);return kl(n),R.i+=p.write(l,R.i,n,"utf8"),R},i16(l){return kl(2),p.writeUInt16BE(l,R.i),R.i+=2,R},i32(l,n){if(n||n===0)return p.writeUInt32BE(l,n),R;return kl(4),p.writeUInt32BE(l,R.i),R.i+=4,R},z(l){return kl(l),p.fill(0,R.i,R.i+l),R.i+=l,R},raw(l){return p=Buffer.concat([p.subarray(0,R.i),l]),R.i=p.length,R},end(l=1){p.writeUInt32BE(R.i-l,l);let n=p.subarray(0,R.i);return R.i=0,p=Buffer.allocUnsafe(256),n}}),$=R;function kl(l){if(p.length-R.i<l){let n=p,u=n.length;p=Buffer.allocUnsafe(u+(u>>1)+l),n.copy(p)}}function sn(){return R.i=0,R}var Bh=eh,xn=1,Bl=$().S().end(),bh=$().H().end(),lu=$().i32(8).i32(80877103).end(8),hu=Buffer.concat([$().E().str($.N).i32(0).end(),Bl]),nu=$().D().str("S").str($.N).end(),Rl=()=>{},uu=new Set(["FetchPreparedStatement","RevalidateCachedQuery","transformAssignedExpr"]),fu={83:"severity_local",86:"severity",67:"code",77:"message",68:"detail",72:"hint",80:"position",112:"internal_position",113:"internal_query",87:"where",115:"schema_name",116:"table_name",99:"column_name",100:"data type_name",110:"constraint_name",70:"file",76:"line",82:"routine"};function eh(l,n={},{onopen:u=Rl,onend:c=Rl,onclose:w=Rl}={}){let{sslnegotiation:E,ssl:t,max:_,user:B,host:Q,port:T,database:Y,parsers:j,transform:M,onnotice:H,onnotify:I,onparameter:b,max_pipeline:Z,keep_alive:cl,backoff:nl,target_session_attrs:x}=l,d=hl(),Ul=xn++,_l={pid:null,secret:null},Pl=gh(xl,l.idle_timeout),Il=gh(xl,l.max_lifetime),L=gh(xh,l.connect_timeout),U=null,Ol,q=null,N=new Ml,y=Buffer.alloc(0),dl=l.fetch_types,El={},O={},S=Math.random().toString(36).slice(2),F=1,v=0,V=0,G=0,D=0,i=0,J=0,m=0,r=null,X=null,Al=!1,tl=null,$l=null,e=null,z=null,C=null,ll=null,Ql=null,sl=null,A=null,Tl=null,k={queue:n.closed,idleTimer:Pl,connect(h){e=h,Lh()},terminate:Zl,execute:Xl,cancel:yh,end:xl,count:0,id:Ul};return n.closed&&n.closed.push(k),k;async function ph(){let h;try{h=l.socket?await Promise.resolve(l.socket(l)):new vh.Socket}catch(f){Nl(f);return}return h.on("error",Nl),h.on("close",Nh),h.on("drain",Ph),h}async function yh({pid:h,secret:f},g,P){try{Ol=$().i32(16).i32(80877102).i32(h).i32(f).end(16),await dh(),U.once("error",P),U.once("close",g)}catch(W){P(W)}}function Xl(h){if(Al)return Cl(h,K.connection("CONNECTION_DESTROYED",l));if(C)return Cl(h,K.generic("COPY_IN_PROGRESS","You cannot execute queries during copy"));if(h.cancelled)return;try{return h.state=_l,A?d.push(h):(A=h,A.active=!0),qh(h),a(rh(h))&&!h.describeFirst&&!h.cursorFn&&d.length<Z&&(!h.options.onexecute||h.options.onexecute(k))}catch(f){return d.length===0&&a(Bl),ul(f),!0}}function rh(h){if(h.parameters.length>=65534)throw K.generic("MAX_PARAMETERS_EXCEEDED","Max number of parameters (65534) exceeded");return h.options.simple?$().Q().str(h.statement.string+$.N).end():h.describeFirst?Buffer.concat([Gh(h),bh]):h.prepare?h.prepared?Vl(h):Buffer.concat([Gh(h),Vl(h)]):sh(h)}function Gh(h){return Buffer.concat([Yh(h.statement.string,h.parameters,h.statement.types,h.statement.name),Vn("S",h.statement.name)])}function Vl(h){return Buffer.concat([Qn(h.parameters,h.statement.types,h.statement.name,h.cursorName),h.cursorFn?Rh("",h.cursorRows):hu])}function sh(h){return Buffer.concat([Yh(h.statement.string,h.parameters,h.statement.types),nu,Vl(h)])}function qh(h){let f=[],g=[],P=th(h,h.strings[0],h.args[0],f,g,l);!h.tagged&&h.args.forEach((W)=>al(W,f,g,l)),h.prepare=l.prepare&&("prepare"in h.options?h.options.prepare:!0),h.string=P,h.signature=h.prepare&&g+P,h.onlyDescribe&&delete O[h.signature],h.parameters=h.parameters||f,h.prepared=h.prepare&&h.signature in O,h.describeFirst=h.onlyDescribe||f.length&&!h.prepared,h.statement=h.prepared?O[h.signature]:{string:P,types:g,name:h.prepare?S+F++:""},typeof l.debug==="function"&&l.debug(Ul,P,f,g)}function a(h,f){if(ll=ll?Buffer.concat([ll,h]):Buffer.from(h),f||ll.length>=1024)return jh(f);return X===null&&(X=setImmediate(jh)),!0}function jh(h){let f=U.write(ll,h);return X!==null&&clearImmediate(X),ll=X=null,f}function xh(){ul(K.connection("CONNECT_TIMEOUT",l,U)),U.destroy()}async function Mh(){if(E!=="direct"){if(a(lu),!await new Promise((g)=>U.once("data",(P)=>g(P[0]===83)))&&t==="prefer")return Ll()}let h={socket:U,servername:vh.isIP(U.host)?void 0:U.host};if(E==="direct")h.ALPNProtocols=["postgresql"];if(t==="require"||t==="allow"||t==="prefer")h.rejectUnauthorized=!1;else if(typeof t==="object")Object.assign(h,t);U.removeAllListeners(),U=qn.connect(h),U.on("secureConnect",Ll),U.on("error",Nl),U.on("close",Nh),U.on("drain",Ph)}function Ph(){!A&&u(k)}function ql(h){if(tl){if(tl.push(h),V-=h.length,V>0)return}y=tl?Buffer.concat(tl,i-V):y.length===0?h:Buffer.concat([y,h],y.length+h.length);while(y.length>4){if(i=y.readUInt32BE(1),i>=y.length){V=i-y.length,tl=[y];break}try{ln(y.subarray(0,i+1))}catch(f){A&&(A.cursorFn||A.describeFirst)&&a(Bl),ul(f)}y=y.subarray(i+1),V=0,tl=null}}async function dh(){if(Al=!1,El={},U||(U=await ph()),!U)return;if(L.start(),l.socket)return t?Mh():Ll();if(U.on("connect",t?Mh:Ll),l.path)return U.connect(l.path);U.ssl=t,U.connect(T[G],Q[G]),U.host=Q[G],U.port=T[G],G=(G+1)%T.length}function Lh(){setTimeout(dh,v?Math.max(0,v+J-mh.now()):0)}function Ll(){try{O={},dl=l.fetch_types,S=Math.random().toString(36).slice(2),F=1,Il.start(),U.on("data",ql),cl&&U.setKeepAlive&&U.setKeepAlive(!0,1000*cl);let h=Kn();a(h)}catch(h){Nl(h)}}function Nl(h){if(k.queue===n.connecting&&l.host[D+1])return;ul(h);while(d.length)Cl(d.shift(),h)}function ul(h){C&&(C.destroy(h),C=null),A&&Cl(A,h),e&&(Cl(e,h),e=null)}function Cl(h,f){if(h.reserve)return h.reject(f);if(!f||typeof f!=="object")f=Error(f);"query"in f||"parameters"in f||Object.defineProperties(f,{stack:{value:f.stack+h.origin.replace(/.*\n/,`
3
3
  `),enumerable:l.debug},query:{value:h.string,enumerable:l.debug},parameters:{value:h.parameters,enumerable:l.debug},args:{value:h.args,enumerable:l.debug},types:{value:h.statement&&h.statement.types,enumerable:l.debug}}),h.reject(f)}function xl(){return z||(!k.reserved&&c(k),!k.reserved&&!e&&!A&&d.length===0?(Zl(),new Promise((h)=>U&&U.readyState!=="closed"?U.once("close",h):h())):z=new Promise((h)=>Ql=h))}function Zl(){if(Al=!0,C||A||e||d.length)Nl(K.connection("CONNECTION_DESTROYED",l));if(clearImmediate(X),U)U.removeListener("data",ql),U.removeListener("connect",Ll),U.readyState==="open"&&U.end($().X().end());Ql&&(Ql(),z=Ql=null)}async function Nh(h){if(y=Buffer.alloc(0),V=0,tl=null,clearImmediate(X),U.removeListener("data",ql),U.removeListener("connect",Ll),Pl.cancel(),Il.cancel(),L.cancel(),U.removeAllListeners(),U=null,e)return Lh();!h&&(A||d.length)&&Nl(K.connection("CONNECTION_CLOSED",l,U)),v=mh.now(),h&&l.shared.retries++,J=(typeof nl==="function"?nl(l.shared.retries):nl)*1000,w(k,K.connection("CONNECTION_CLOSED",l,U))}function ln(h,f=h[0]){(f===68?hn:f===100?Tn:f===65?dn:f===83?nn:f===90?un:f===67?fn:f===50?Dh:f===49?cn:f===116?tn:f===84?wn:f===82?_n:f===110?gn:f===75?Bn:f===69?Mn:f===115?Ln:f===51?Nn:f===71?Dn:f===78?Cn:f===72?Yn:f===99?Xn:f===73?Zn:f===86?Fn:f===118?Hn:f===87?Rn:zn)(h)}function hn(h){let f=7,g,P,W,o=A.isRaw?Array(A.statement.columns.length):{};for(let s=0;s<A.statement.columns.length;s++)P=A.statement.columns[s],g=h.readInt32BE(f),f+=4,W=g===-1?null:A.isRaw===!0?h.subarray(f,f+=g):P.parser===void 0?h.toString("utf8",f,f+=g):P.parser.array===!0?P.parser(h.toString("utf8",f+1,f+=g)):P.parser(h.toString("utf8",f,f+=g)),A.isRaw?o[s]=A.isRaw===!0?W:M.value.from?M.value.from(W,P):W:o[P.name]=M.value.from?M.value.from(W,P):W;A.forEachFn?A.forEachFn(M.row.from?M.row.from(o):o,N):N[m++]=M.row.from?M.row.from(o):o}function nn(h){let[f,g]=h.toString("utf8",5,h.length-1).split($.N);if(El[f]=g,l.parameters[f]!==g)l.parameters[f]=g,b&&b(f,g)}function un(h){if(A)if(q)A.retried?ul(A.retried):A.prepared&&uu.has(q.routine)?Pn(A,q):ul(q);else A.resolve($l||N);else if(q)ul(q);if(A=$l=q=null,N=new Ml,L.cancel(),e){if(x){if(!El.in_hot_standby||!El.default_transaction_read_only)return jn();else if(Gn(x,El))return Zl()}if(dl)return e.reserve&&(e=null),In();e&&!e.reserve&&Xl(e),l.shared.retries=D=0,e=null;return}while(d.length&&(A=d.shift())&&(A.active=!0,A.cancelled))eh(l).cancel(A.state,A.cancelled.resolve,A.cancelled.reject);if(A)return;k.reserved?!k.reserved.release&&h[5]===73?z?Zl():(k.reserved=null,u(k)):k.reserved():z?Zl():u(k)}function fn(h){m=0;for(let f=h.length-1;f>0;f--){if(h[f]===32&&h[f+1]<58&&N.count===null)N.count=+h.toString("utf8",f+1,h.length-1);if(h[f-1]>=65){N.command=h.toString("utf8",5,f),N.state=_l;break}}if(Tl&&(Tl(),Tl=null),N.command==="BEGIN"&&_!==1&&!k.reserved)return ul(K.generic("UNSAFE_TRANSACTION","Only use sql.begin, sql.reserved or max: 1"));if(A.options.simple)return Dh();if(A.cursorFn)N.count&&A.cursorFn(N),a(Bl)}function cn(){A.parsing=!1}function Dh(){!N.statement&&(N.statement=A.statement),N.columns=A.statement.columns}function tn(h){let f=h.readUInt16BE(5);for(let g=0;g<f;++g)!A.statement.types[g]&&(A.statement.types[g]=h.readUInt32BE(7+g*4));A.prepare&&(O[A.signature]=A.statement),A.describeFirst&&!A.onlyDescribe&&(a(Vl(A)),A.describeFirst=!1)}function wn(h){if(N.command)$l=$l||[N],$l.push(N=new Ml),N.count=null,A.statement.columns=null;let f=h.readUInt16BE(5),g=7,P;A.statement.columns=Array(f);for(let W=0;W<f;++W){P=g;while(h[g++]!==0);let o=h.readUInt32BE(g),s=h.readUInt16BE(g+4),gl=h.readUInt32BE(g+6);A.statement.columns[W]={name:M.column.from?M.column.from(h.toString("utf8",P,g-1)):h.toString("utf8",P,g-1),parser:j[gl],table:o,number:s,type:gl},g+=18}if(N.statement=A.statement,A.onlyDescribe)return A.resolve(A.statement),a(Bl)}async function _n(h,f=h.readUInt32BE(5)){(f===3?On:f===5?En:f===10?An:f===11?Un:f===12?$n:f!==0?Jn:Rl)(h,f)}async function On(){let h=await lh();a($().p().str(h).z(1).end())}async function En(h){let f="md5"+await ah(Buffer.concat([Buffer.from(await ah(await lh()+B)),h.subarray(9)]));a($().p().str(f).z(1).end())}async function An(){sl=(await Jl.randomBytes(18)).toString("base64"),$().p().str("SCRAM-SHA-256"+$.N);let h=$.i;a($.inc(4).str("n,,n=*,r="+sl).i32($.i-h-4,h).end())}async function Un(h){let f=h.toString("utf8",9).split(",").reduce((s,gl)=>(s[gl[0]]=gl.slice(2),s),{}),g=await Jl.pbkdf2Sync(await lh(),Buffer.from(f.s,"base64"),parseInt(f.i),32,"sha256"),P=await pl(g,"Client Key"),W="n=*,r="+sl+",r="+f.r+",s="+f.s+",i="+f.i+",c=biws,r="+f.r;r=(await pl(await pl(g,"Server Key"),W)).toString("base64");let o="c=biws,r="+f.r+",p="+tu(P,Buffer.from(await pl(await cu(P),W))).toString("base64");a($().p().str(o).end())}function $n(h){if(h.toString("utf8",9).split($.N,1)[0].slice(2)===r)return;ul(K.generic("SASL_SIGNATURE_MISMATCH","The server did not return the correct signature")),U.destroy()}function lh(){return Promise.resolve(typeof l.pass==="function"?l.pass():l.pass)}function gn(){if(N.statement=A.statement,N.statement.columns=[],A.onlyDescribe)return A.resolve(A.statement),a(Bl)}function Bn(h){_l.pid=h.readUInt32BE(5),_l.secret=h.readUInt32BE(9)}async function In(){dl=!1,(await new fl([`
4
4
  select b.oid, b.typarray
5
5
  from pg_catalog.pg_type a
@@ -0,0 +1,8 @@
1
+ // @bun
2
+ import{Kd as YJ,Qd as S,Rd as f,Sd as AJ,Td as RJ,Ud as TJ,Vd as T,Wd as D,ud as kJ,wd as m}from"./chunk-xwqdh388.js";import{Rj as PJ}from"./chunk-6g1xac70.js";var cJ=500,BJ=20000;function mJ(J,Q){if(!J)return;let $=J.trim();if(/^\d+(\.\d+)?$/.test($))return Math.max(0,Number($)*1000);let Z=Date.parse($);if(Number.isNaN(Z))return;return Math.max(0,Z-Q)}function g(J,Q){let $=Math.min(BJ,cJ*2**J);return Math.round($*(0.5+Q()*0.5))}function dJ(J){return J===429||J===408||J===409||J>=500}function pJ(J,Q){return dJ(J)&&D(Q).retryable}function VJ(J){return J.reason??new DOMException("The operation was aborted.","AbortError")}function UJ(J,Q){return new Promise(($,Z)=>{let G=setTimeout($,J);Q?.addEventListener("abort",()=>{clearTimeout(G),Z(VJ(Q))},{once:!0})})}async function p(J,Q,$=UJ){if(!Q)return await $(J);Q.throwIfAborted();let Z;try{await Promise.race([$(J,Q),new Promise((G,K)=>{Z=()=>K(VJ(Q)),Q.addEventListener("abort",Z,{once:!0})})])}finally{if(Z)Q.removeEventListener("abort",Z)}}async function h(J,Q,$){let Z=$.fetchImpl??((j,W)=>fetch(j,W)),G=$.sleep??UJ,K=$.random??Math.random,X=$.now??Date.now,H=Math.max(0,$.maxRetries),B=$.startedAt??X(),Y=(j,W,V,q)=>{try{$.onRetry?.({attempt:W+1,maxRetries:H,error:D(V),...T(V),timedOut:q,delayMs:j,elapsedMs:X()-B})}catch{}return p(j,$.signal,G)},U;for(let j=0;j<=H;j++){$.signal?.throwIfAborted();let W=new AbortController,V=()=>W.abort($.signal?.reason);$.signal?.addEventListener("abort",V,{once:!0});let q=!1,z=$.timeoutMs>0?setTimeout(()=>{q=!0,W.abort()},$.timeoutMs):void 0,L;try{L=await Z(J,{...Q,signal:W.signal})}catch(M){if(z!==void 0)clearTimeout(z);if($.signal?.removeEventListener("abort",V),$.signal?.aborted)throw M;if(U=q?new f($.timeoutMs):M,q&&$.retryTimeouts===!1)throw U;if(j===H)throw U;await Y(g(j,K),j,U,q);continue}if(z!==void 0)clearTimeout(z);if(L.ok)return L;$.signal?.removeEventListener("abort",V);let N=await lJ(L),_=new S(L.status,N,L.headers.get("x-request-id")??void 0,mJ(L.headers.get("retry-after"),X()));if(j===H||!pJ(L.status,_))throw _;let A=_.retryAfter??(L.status===429?D(_).retryAfter:void 0);await Y(A===void 0?g(j,K):Math.min(A,BJ),j,_,!1),U=_}throw U??Error("Provider request failed with no response.")}async function lJ(J){let Q;try{Q=await J.text()}catch{return null}try{return JSON.parse(Q)}catch{return Q}}function jJ(J,Q,$){let Z=Q.idleMs>0?Q.idleMs:0,G=Q.maxMs>0?Q.maxMs:0;if(!J||!Z&&!G)return J;let K=G?performance.now()+G:1/0,X=J.getReader();return new ReadableStream({async pull(H){let B,Y,U=Math.max(0,K-performance.now()),j=!Z||U<=Z,W=j?U:Z,V=new Promise((q,z)=>{B=setTimeout(()=>{Y=j?$.max():$.idle(),z(Y)},W)});try{let q=await Promise.race([X.read(),V]);if(q.done)H.close();else H.enqueue(q.value)}catch(q){let z=Y??q;H.error(z),X.cancel(z).catch(()=>{})}finally{clearTimeout(B)}},cancel(H){return X.cancel(H)}},{highWaterMark:0})}var i=30000,FJ=10,qJ=7200,iJ=600,nJ="gpt-live-transcribe";function rJ(J){return J.type==="transcription"}function aJ(J){if(J.language!==void 0&&J.languages!==void 0)throw TypeError("A transcription session takes `languages` or `language`, not both (gpt-live-transcribe reads `languages`).");for(let G of J.keywords??[])if(/[<>\r\n]/.test(G))throw TypeError(`Transcription keywords must be one line without "<" or ">", got ${JSON.stringify(G)}.`);let Q={model:J.model??nJ};if(J.prompt!==void 0)Q.prompt=J.prompt;if(J.keywords?.length)Q.keywords=J.keywords;if(J.languages?.length)Q.languages=J.languages;if(J.language!==void 0)Q.language=J.language;if(J.delay!==void 0)Q.delay=J.delay;let $={transcription:Q,turn_detection:J.turnDetection?zJ(J.turnDetection):null};if(J.noiseReduction!==void 0)$.noise_reduction=J.noiseReduction&&{type:J.noiseReduction};let Z={type:"transcription",audio:{input:$}};if(J.logprobs)Z.include=["item.input_audio_transcription.logprobs"];return{...Z,...J.vendor}}function oJ(J){if(!J)return{type:"object",properties:{}};return PJ(J)?J.toJSONSchema():J}function u(J,Q){if(rJ(J))return aJ(J);let $={type:"realtime"},Z=J.model??Q;if(Z)$.model=Z;if(J.instructions!==void 0)$.instructions=J.instructions;if(J.outputModalities)$.output_modalities=J.outputModalities;if(J.maxOutputTokens!==void 0)$.max_output_tokens=J.maxOutputTokens;if(J.truncation!==void 0)$.truncation=J.truncation;if(J.tools)$.tools=J.tools.map((X)=>({type:"function",name:X.name,...X.description?{description:X.description}:{},parameters:oJ(X.parameters)}));if(J.toolChoice!==void 0)$.tool_choice=typeof J.toolChoice==="string"?J.toolChoice:{type:"function",name:J.toolChoice.name};let G={};if(J.turnDetection!==void 0)G.turn_detection=J.turnDetection&&zJ(J.turnDetection);if(J.transcription!==void 0)G.transcription=J.transcription;if(J.noiseReduction!==void 0)G.noise_reduction=J.noiseReduction&&{type:J.noiseReduction};let K={};if(J.voice!==void 0)K.voice=J.voice;if(J.speed!==void 0)K.speed=J.speed;if(Object.keys(G).length||Object.keys(K).length)$.audio={...Object.keys(G).length?{input:G}:{},...Object.keys(K).length?{output:K}:{}};return{...$,...J.vendor}}function zJ(J){let Q={type:J.type};if(J.createResponse!==void 0)Q.create_response=J.createResponse;if(J.interruptResponse!==void 0)Q.interrupt_response=J.interruptResponse;if(J.type==="semantic_vad"){if(J.eagerness!==void 0)Q.eagerness=J.eagerness}else{if(J.threshold!==void 0)Q.threshold=J.threshold;if(J.prefixPaddingMs!==void 0)Q.prefix_padding_ms=J.prefixPaddingMs;if(J.silenceDurationMs!==void 0)Q.silence_duration_ms=J.silenceDurationMs;if(J.idleTimeoutMs!==void 0)Q.idle_timeout_ms=J.idleTimeoutMs}return Q}function n(J){let Q=Number(J?.input_tokens??0),$=Number(J?.output_tokens??0),Z={inputTokens:Q,outputTokens:$,totalTokens:Number(J?.total_tokens??Q+$)},G=J?.input_token_details??J?.input_tokens_details,K=J?.output_token_details??J?.output_tokens_details;if(typeof G?.cached_tokens==="number")Z.cachedInputTokens=G.cached_tokens;if(typeof G?.audio_tokens==="number")Z.audioInputTokens=G.audio_tokens;let X=G?.cached_tokens_details?.audio_tokens;if(typeof X==="number")Z.cachedAudioInputTokens=X;if(typeof G?.image_tokens==="number"&&G.image_tokens>0)Z.imageInputTokens=G.image_tokens;if(typeof K?.audio_tokens==="number")Z.audioOutputTokens=K.audio_tokens;return Z}class v extends Error{code;retryable;status;constructor(J,Q={}){super(J.message,{cause:Q.cause});if(this.name="RealtimeRequestError",this.code=J.code,this.retryable=J.retryable,Q.status!==void 0)this.status=Q.status}}var sJ=60;class c{model;target;options;constructor(J,Q){this.target=J,this.options=Q,this.model=Q.model}url(J){return`${this.target.base}/realtime${J}${this.target.query}`}sidebandUrl(J){let Q=this.target.base.replace(/^http(s?):/i,(Z,G)=>`ws${G}:`),$=this.target.query?`${this.target.query}&`:"?";return`${Q}/realtime${$}call_id=${encodeURIComponent(J)}`}async createCall(J){let Q=J.flow??this.options.callFlow??"unified",$,Z;if(Q==="ephemeral")$={authorization:`Bearer ${(await this.clientSecret({session:J.session,ttlSeconds:sJ,signal:J.signal})).value}`,"content-type":"application/sdp"},Z=J.sdp;else{let B=new FormData;B.set("sdp",J.sdp),B.set("session",JSON.stringify(u(J.session??{},this.model))),$=await this.target.headers(),Z=B}if(J.safetyIdentifier)$["OpenAI-Safety-Identifier"]=J.safetyIdentifier;let G=this.url("/calls"),K=await this.request(J.webrtcFilter?`${G}${G.includes("?")?"&":"?"}webrtcfilter=on`:G,{method:"POST",headers:$,body:Z},J.signal),X=await K.text(),H=eJ(K);if(!H)throw new v({code:"provider_error",message:"The provider started a realtime call but did not say which one (no Location).",retryable:!1});return{sdpAnswer:X,callId:H}}async clientSecret(J={}){let Q=J.ttlSeconds??iJ;if(!Number.isInteger(Q)||Q<FJ||Q>qJ)throw RangeError(`ttlSeconds must be a whole number from ${FJ} to ${qJ}, got ${Q}.`);let $={...await this.target.headers(),"content-type":"application/json"};if(J.safetyIdentifier)$["OpenAI-Safety-Identifier"]=J.safetyIdentifier;let G=await(await this.request(this.url("/client_secrets"),{method:"POST",headers:$,body:JSON.stringify({expires_after:{anchor:"created_at",seconds:Q},session:u(J.session??{},this.model)})},J.signal)).json();if(typeof G?.value!=="string")throw new v({code:"provider_error",message:"The provider answered a client secret request with no secret.",retryable:!1});return{value:G.value,expiresAt:Number(G.expires_at??0),session:G.session,callsUrl:this.url("/calls")}}async hangup(J,Q={}){try{await this.request(this.url(`/calls/${encodeURIComponent(J)}/hangup`),{method:"POST",headers:await this.target.headers()},Q.signal)}catch($){if(tJ($,J))return;throw $}}sideband(J,Q={}){return new l({...Q,callId:J,url:this.sidebandUrl(J),headers:this.target.headers,webSocket:Q.webSocket??this.options.webSocket,hangup:()=>this.hangup(J)})}async request(J,Q,$){try{return await h(J,Q,{maxRetries:this.target.maxRetries,timeoutMs:this.target.timeoutMs,retryTimeouts:!1,signal:$,fetchImpl:this.options.fetchImpl})}catch(Z){if($?.aborted)throw Z;throw new v(D(Z),{cause:Z,...Z instanceof S?{status:Z.status}:{}})}}}function tJ(J,Q){if(!(J instanceof v)||J.status!==404)return!1;let $=J.cause instanceof S?J.cause.body:void 0,Z=$?.error??$,G=String(Z?.code??"").toLowerCase(),K=String(Z?.message??"").toLowerCase();if(G.includes("call"))return!0;if(K.includes(Q.toLowerCase()))return!0;return/\bcall\b/.test(K)&&/not (be )?found|does not exist|no longer|ended/.test(K)}function eJ(J){let Q=J.headers.get("location");if(!Q)return;let $=Q.split("?")[0].replace(/\/+$/,""),Z=$.slice($.lastIndexOf("/")+1);return Z?decodeURIComponent(Z):void 0}var JQ={"response.audio_transcript.delta":"response.output_audio_transcript.delta","response.audio_transcript.done":"response.output_audio_transcript.done","response.text.delta":"response.output_text.delta","response.text.done":"response.output_text.done","response.audio.delta":"response.output_audio.delta","response.audio.done":"response.output_audio.done"};function QQ(J){if(typeof J!=="string")return;let Q;try{Q=JSON.parse(J)}catch{return}if(!Q||typeof Q!=="object"||typeof Q.type!=="string")return;let $=JQ[Q.type];if($)Q.type=$;if(Q.type==="response.done"&&Q.response?.usage)Q.usage=n(Q.response.usage);if(Q.type==="conversation.item.input_audio_transcription.completed"&&Q.usage)if(Q.usage.type==="duration"){let Z=Number(Q.usage.seconds);if(Number.isFinite(Z))Q.transcriptionSeconds=Z}else Q.transcriptionUsage=n(Q.usage);return Q}var LJ=1,$Q=500;function ZQ(J,Q){let $=globalThis.WebSocket;if(!$)throw Error("No global WebSocket: the realtime sideband needs Bun or Node 22+.");return new $(J,{headers:Q.headers})}class l{callId;ready;closed;init;socket;finalEvent;outbox=[];subscribers=new Set;listeners=new Set;backlog=[];closing=!1;finished=!1;everOpened=!1;failures=0;resolveReady;rejectReady;resolveClosed;constructor(J){this.init=J,this.callId=J.callId,this.ready=new Promise((Q,$)=>{this.resolveReady=Q,this.rejectReady=$}),this.ready.catch(()=>{}),this.closed=new Promise((Q)=>this.resolveClosed=Q),this.open()}send(J){if(this.finished||this.closing)return;let Q=JSON.stringify(J);if(this.socket?.readyState===LJ)this.socket.send(Q);else this.outbox.push(Q)}updateSession(J){this.send({type:"session.update",session:u(J)})}addItem(J){this.send({type:"conversation.item.create",item:J})}addNote(J){this.addItem({type:"message",role:"system",content:[{type:"input_text",text:J}]})}functionOutput(J,Q){this.addItem({type:"function_call_output",call_id:J,output:typeof Q==="string"?Q:JSON.stringify(Q)})}createResponse(J={}){let Q={};if(J.instructions!==void 0)Q.instructions=J.instructions;if(J.toolChoice!==void 0)Q.tool_choice=typeof J.toolChoice==="string"?J.toolChoice:{type:"function",name:J.toolChoice.name};if(J.outputModalities)Q.output_modalities=J.outputModalities;if(J.conversation)Q.conversation=J.conversation;if(J.metadata)Q.metadata=J.metadata;Object.assign(Q,J.vendor),this.send(Object.keys(Q).length?{type:"response.create",response:Q}:{type:"response.create"})}cancelResponse(J){this.send(J?{type:"response.cancel",response_id:J}:{type:"response.cancel"})}on(J){return this.listeners.add(J),()=>this.listeners.delete(J)}[Symbol.asyncIterator](){let J={queue:this.backlog??[],done:this.finished};return this.backlog=void 0,this.subscribers.add(J),{next:async()=>{for(;;){let $=J.queue.shift();if($)return{value:$,done:!1};if(J.done)return this.subscribers.delete(J),{value:void 0,done:!0};await new Promise((Z)=>J.wake=Z),J.wake=void 0}},return:async()=>{return J.done=!0,J.queue.length=0,this.subscribers.delete(J),{value:void 0,done:!0}}}}close(J=1000,Q="closed"){if(this.finished||this.closing)return;if(this.closing=!0,this.socket&&this.socket.readyState<=LJ)this.socket.close(J,Q);else this.finish(J,Q,!0)}async hangup(){try{await this.init.hangup()}catch(J){if(this.finalEvent&&!this.finalEvent.byClient&&this.finalEvent.code===1000)return;throw J}this.close(1000,"hangup")}async open(){let J;try{let $=await this.init.headers();if(this.closing)return this.finish(1000,"closed",!0);J=(this.init.webSocket??ZQ)(this.init.url,{headers:$})}catch($){return this.dropped(1006,$ instanceof Error?$.message:String($),!1)}this.socket=J;let Q=!1;J.addEventListener("open",()=>{Q=!0;let $=this.everOpened;this.everOpened=!0;let Z=this.failures;this.failures=0;for(let G of this.outbox.splice(0))J.send(G);if(this.resolveReady(),$)this.emit({type:"sideband.reconnected",attempt:Z})}),J.addEventListener("message",($)=>{let Z=QQ($.data);if(Z)this.emit(Z)}),J.addEventListener("close",($)=>{if(this.socket!==J)return;this.dropped($.code??1006,$.reason??"",Q)}),J.addEventListener("error",()=>{})}dropped(J,Q,$){if(this.socket=void 0,this.closing)return this.finish(J,Q,!0);let Z=this.init.reconnect?.attempts??3;if(!((J!==1000||!$)&&this.failures<Z))return this.finish(J,Q,!1);this.failures+=1;let K=(this.init.reconnect?.delayMs??500)*2**(this.failures-1);setTimeout(()=>void this.open(),K)}finish(J,Q,$){if(this.finished)return;this.finished=!0,this.outbox.length=0;let Z={type:"sideband.closed",code:J,reason:Q,byClient:$};this.finalEvent=Z,this.emit(Z);for(let G of this.subscribers)G.done=!0,G.wake?.();if(!this.everOpened)this.rejectReady(Error(`Realtime sideband did not open (${J} ${Q}).`));this.resolveClosed(Z)}emit(J){if(this.backlog){if(this.backlog.push(J),this.backlog.length>$Q)this.backlog.shift()}for(let Q of this.subscribers){if(Q.done)continue;Q.queue.push(J),Q.wake?.()}for(let Q of this.listeners)try{Q(J)}catch{}}}var NJ=3;function r(J){let Q=new Map;for(let $ of J)for(let Z of $.content??[]){if(Z.type!=="file"||!Z.fileId||Q.has(Z.fileId))continue;Q.set(Z.fileId,{name:Z.name,mimeType:Z.mimeType})}return Q}function CJ(J,Q,$=new Map){if(!(Q instanceof S))return[];if(Q.status!==400&&Q.status!==404)return[];let Z=KQ(Q.body);if(!Z)return[];let G=GQ(J.input);if(G.length===0)return[];let K=/^input\[(\d+)\]\.content\[(\d+)\]\.file_id$/.exec(Z.param??"");if(K){let Y=J.input[Number(K[1])],U=o(Y)[Number(K[2])],j=U&&typeof U.file_id==="string"?U.file_id:void 0;if(j)return[j]}let X=Z.message??"",H=DJ(G.map((Y)=>Y.fileId).filter((Y)=>YQ(X,Y)));if(H.length>0)return H;let B=/Expected (image type|context stuffing file type) to be a supported format:.*but got \.([a-z0-9]+)\.?\s*$/is.exec(X);if(B){let Y=B[1].toLowerCase()==="image type"?"input_image":"input_file",U=B[2].toLowerCase(),j=DJ(G.filter((V)=>V.type===Y).map((V)=>V.fileId)),W=j.filter((V)=>($.get(V)?.name??"").trim().toLowerCase().endsWith(`.${U}`));if(W.length===1)return W;if(W.length===0&&j.length===1)return j}return[]}function _J(J,Q,$=new Map){return{...J,input:J.input.map((Z)=>{let G=o(Z);if(!G.some((K)=>xJ(K,Q)))return Z;return{...Z,content:G.map((K)=>xJ(K,Q)?{type:"input_text",text:a($.get(String(K.file_id))?.name)}:K)}})}}function a(J){return`[${J?`attachment ${JSON.stringify(J)}`:"an attachment"} could not be read by the provider and is not shown to you. Tell the user if it matters to the answer; uploading it again may help.]`}function xJ(J,Q){return typeof J.file_id==="string"&&Q.has(J.file_id)}function o(J){let Q=J?.content;return Array.isArray(Q)?Q:[]}function GQ(J){let Q=[];for(let $ of J)for(let Z of o($))if(typeof Z.file_id==="string"&&Z.file_id)Q.push({type:String(Z.type),fileId:Z.file_id});return Q}function KQ(J){if(!J||typeof J!=="object")return null;let Q=J,$=Q.error&&typeof Q.error==="object"?Q.error:J;return{message:typeof $.message==="string"?$.message:void 0,param:typeof $.param==="string"?$.param:void 0}}function YQ(J,Q){let $=Q.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return new RegExp(`(^|[^A-Za-z0-9_-])${$}($|[^A-Za-z0-9_-])`).test(J)}function DJ(J){return[...new Set(J)]}async function*WQ(J){let Q="",$="",Z=[],G,K=()=>{if(Z.length===0&&!$)return null;let B={event:$,data:Z.join(`
3
+ `),id:G};return $="",Z=[],G=void 0,B.data?B:null},X=(B)=>{let Y=B.endsWith("\r")?B.slice(0,-1):B;if(Y==="")return K();if(Y.startsWith(":"))return null;let U=Y.indexOf(":"),j=U===-1?Y:Y.slice(0,U),W=U===-1?"":Y.slice(U+1);if(W.startsWith(" "))W=W.slice(1);if(j==="event")$=W;else if(j==="data")Z.push(W);else if(j==="id")G=W;return null};for await(let B of J){Q+=B;let Y=Q.indexOf(`
4
+ `);while(Y!==-1){let U=Q.slice(0,Y);Q=Q.slice(Y+1);let j=X(U);if(j)yield j;Y=Q.indexOf(`
5
+ `)}}if(Q.length>0){let B=X(Q);if(B)yield B}let H=K();if(H)yield H}async function*MJ(J,Q={}){let $=new Map,Z=new Set,G,K=!1,X,H=(B,Y)=>({type:"finish",reason:B,usage:Y,...X?{model:X}:{}});for await(let B of WQ(J)){if(B.data==="[DONE]")break;let Y;try{Y=JSON.parse(B.data)}catch{continue}let U=typeof Y.type==="string"?Y.type:B.event,j=Y.response?.model;if(typeof j==="string"&&j)X=j;switch(U){case"response.output_text.delta":{let W=String(Y.delta??"");if(!W)break;yield Q.structuredOutput?{type:"output-delta",delta:W}:{type:"text-delta",delta:W};break}case"response.reasoning_summary_text.delta":case"response.reasoning_text.delta":{let W=String(Y.delta??"");if(!W)break;yield{type:"reasoning-delta",delta:W,id:Y.item_id};break}case"response.output_item.added":{let W=Y.item;if(!W)break;if(W.type==="function_call"){let V=String(W.id??Y.item_id??W.call_id??"");$.set(V,{callId:String(W.call_id??V),name:String(W.name??""),namespace:typeof W.namespace==="string"&&W.namespace?W.namespace:void 0,done:!1})}break}case"response.function_call_arguments.delta":{let W=$.get(String(Y.item_id??""));if(!W)break;let V=String(Y.delta??"");if(!V)break;yield{type:"tool-call-delta",toolCallId:W.callId,name:W.name,argsDelta:V,...W.namespace?{namespace:W.namespace}:{}};break}case"response.function_call_arguments.done":{let W=String(Y.item_id??""),V=$.get(W);if(!V)break;V.done=!0,yield{type:"tool-call",toolCallId:V.callId,name:V.name,args:String(Y.arguments??""),...V.namespace?{namespace:V.namespace}:{}};break}case"response.output_item.done":{let W=Y.item;if(!W)break;if(W.type==="function_call"){let V=String(W.id??Y.item_id??W.call_id??""),q=$.get(V);if(q?.done)break;let z=(typeof W.namespace==="string"?W.namespace:"")||q?.namespace;if(yield{type:"tool-call",toolCallId:String(W.call_id??V),name:String(W.name??q?.name??""),args:String(W.arguments??""),...z?{namespace:z}:{}},q)q.done=!0;break}if(W.type==="tool_search_call"||W.type==="tool_search_output"){if(W.type==="tool_search_call"&&W.arguments!==void 0)G=W.arguments;let V=XQ(W);if(V.loaded.length===0&&V.namespaces.length===0)break;let q=String(W.tool_search_call_id??W.id??"");if(Z.has(q))break;Z.add(q);let z=G;G=void 0,yield{type:"tool-search",...V,...z!==void 0&&z!==null?{arguments:z}:{}}}break}case"response.refusal.done":{yield{type:"error",error:{code:"content_filtered",message:String(Y.refusal??"The model refused to answer."),retryable:!1}};break}case"response.completed":{K=!0,yield H("stop",s(Y.response?.usage));break}case"response.incomplete":{K=!0;let W=s(Y.response?.usage),V=Y.response?.incomplete_details?.reason;if(V==="content_filter"){yield{type:"error",error:{code:"content_filtered",message:HQ(Y.response?.content_filters),retryable:!1}},yield H("error",W);break}yield H(V==="max_output_tokens"?"length":"stop",W);break}case"response.failed":case"error":{K=!0;let W=Y.response?.error??Y.error??Y;yield{type:"error",error:BQ(W)},yield H("error",s(Y.response?.usage));break}}if(K)return}if(!K)yield{type:"error",error:{code:"provider_error",message:"The provider stream ended without a terminal event.",retryable:!0}},yield H("error",C())}function XQ(J){let Q=[],$=[];return OJ(J.results??J.tools??J.loaded??J.output,Q,$,0),{loaded:t(Q),namespaces:t($)}}function OJ(J,Q,$,Z){if(!Array.isArray(J)||Z>4)return;for(let G of J){if(typeof G==="string"){Q.push(G);continue}if(!G||typeof G!=="object")continue;let K=G,X=typeof K.name==="string"?K.name:typeof K.tool_name==="string"?K.tool_name:"",H=K.tools??K.functions;if(Array.isArray(H)){if(X)$.push(X);OJ(H,Q,$,Z+1);continue}if(X)Q.push(X)}}function t(J){return J.filter((Q,$)=>J.indexOf(Q)===$)}function HQ(J){if(!Array.isArray(J))return"The provider's content filter blocked this request.";let $=[];for(let Z of J){if(!Z||typeof Z!=="object")continue;let G=Z,K=G.content_filter_results;if(!K||typeof K!=="object")continue;for(let[X,H]of Object.entries(K))if(H&&typeof H==="object"&&H.filtered===!0)$.push(`${X} (${String(G.source_type??"unknown")})`)}return $.length===0?"The provider's content filter blocked this request.":`The provider's content filter blocked this request. Categories: ${t($).join(", ")}.`}function BQ(J){let Q=typeof J?.message==="string"?J.message:"The provider stream failed.",$=String(J?.code??"").toLowerCase();if($==="rate_limit_exceeded")return{code:"rate_limited",message:Q,retryable:!0};if($==="context_length_exceeded")return{code:"context_length_exceeded",message:Q,retryable:!1};if($.includes("content_filter"))return{code:"content_filtered",message:Q,retryable:!1};return{code:"provider_error",message:Q,retryable:!0}}function C(){return{inputTokens:0,outputTokens:0,totalTokens:0}}function s(J){if(!J)return C();let Q=Number(J.input_tokens??0),$=Number(J.output_tokens??0),Z={inputTokens:Q,outputTokens:$,totalTokens:Number(J.total_tokens??Q+$)},G=J.output_tokens_details?.reasoning_tokens;if(typeof G==="number")Z.reasoningTokens=G;let K=J.input_tokens_details?.cached_tokens;if(typeof K==="number")Z.cachedInputTokens=K;return Z}async function*SJ(J){if(!J)return;let Q=J.getReader(),$=new TextDecoder;try{while(!0){let{done:G,value:K}=await Q.read();if(G)break;if(K)yield $.decode(K,{stream:!0})}let Z=$.decode();if(Z)yield Z}finally{Q.releaseLock()}}function e(J){return{responsesUrl:`${J.base}/responses${J.query}`,filesUrl:`${J.base}/files${J.query}`,headers:J.headers,timeoutMs:J.timeoutMs,streamIdleTimeoutMs:J.streamIdleTimeoutMs,streamMaxDurationMs:J.streamMaxDurationMs,maxToolArgumentChars:J.maxToolArgumentChars,maxRetries:J.maxRetries}}async function*JJ(J,Q,$){let Z=Q,G=new Set,K=0,X=Math.max(0,J.maxRetries),H=J.random??Math.random,B,Y=(L)=>{if(!B)return L;let N=m(m(C(),B),L.usage);return B=void 0,{...L,usage:N}},U=()=>Y({type:"finish",reason:"aborted",usage:C()}),j=J.streamIdleTimeoutMs??0,W=J.streamMaxDurationMs??0,V=J.maxToolArgumentChars??0,q=J.now??Date.now,z=q();for(let L=0;;L++){let N=new AbortController,_=$.signal?AbortSignal.any([$.signal,N.signal]):N.signal,A;while(A===void 0)try{let P=[],F=()=>{},x=h(J.responsesUrl,{method:"POST",headers:{...await J.headers(),"content-type":"application/json"},body:JSON.stringify(Z)},{maxRetries:J.maxRetries,timeoutMs:J.timeoutMs,signal:_,fetchImpl:J.fetchImpl,sleep:J.sleep,random:J.random,now:J.now,startedAt:z,onRetry:(R)=>{P.push({type:"retry",...R,phase:"request"}),F()}}),O=x.then(()=>!0,()=>!0);for(;;){let R=new Promise((uJ)=>F=()=>uJ(!1)),fJ=await Promise.race([O,R]);if(yield*P.splice(0),fJ)break}A=await x}catch(P){let F=K<NJ?CJ(Z,P,$.files).filter((O)=>!G.has(O)):[];if(F.length>0){K++;let O=D(P).message;for(let R of F)G.add(R),yield{type:"file-rejected",fileId:R,message:O,...T(P)};Z=_J(Z,new Set(F),$.files);continue}let x=D(P);if(x.code==="aborted"){yield U();return}yield{type:"error",error:x,...T(P)},yield Y({type:"finish",reason:"error",usage:C()});return}let M=[],b=!1,y,HJ=!1,w=new Map;try{let P=jJ(A.body,{idleMs:j,maxMs:W},{idle:()=>{let F=new AJ(j);return N.abort(F),F},max:()=>{let F=new RJ(W);return N.abort(F),F}});for await(let F of MJ(SJ(P),{structuredOutput:$.structuredOutput})){if(F.type==="tool-call-delta"){let x=(w.get(F.toolCallId)??0)+F.argsDelta.length;if(w.set(F.toolCallId,x),V>0&&x>V){let O=new TJ(V,F.name);throw N.abort(O),O}yield F;continue}if(F.type==="tool-call")w.delete(F.toolCallId);if(b){yield F.type==="finish"?Y(F):F;continue}if(kJ(F)){b=!0,yield*M.splice(0),yield F;continue}if(F.type==="error")y=F.error;M.push(F)}}catch(P){HJ=P instanceof f;let F=D(P);if(F.code==="aborted"||$.signal?.aborted){yield U();return}if(b){yield{type:"error",error:F},yield Y({type:"finish",reason:"error",usage:C()});return}y=F,M.push({type:"error",error:F},{type:"finish",reason:"error",usage:C()})}if(b)return;if(y?.retryable&&L<X&&!$.signal?.aborted){let P={};for(let x of M){if(x.type==="finish")B=m(B??C(),x.usage);if(x.type==="error")P=T(x)}if(w.size>0)yield{type:"tool-call-discard",toolCallIds:[...w.keys()]};let F=g(L,H);yield{type:"retry",attempt:L+1,maxRetries:X,error:y,...P,phase:"stream",timedOut:HJ,delayMs:F,elapsedMs:q()-z};try{await p(F,$.signal,J.sleep)}catch{yield U();return}continue}for(let P of M)yield P.type==="finish"?Y(P):P;return}}async function QJ(J,Q,$="user_data"){let Z=new FormData;Z.set("purpose",$),Z.set("file",Q);let K=await(await h(J.filesUrl,{method:"POST",headers:await J.headers(),body:Z},{maxRetries:J.maxRetries,timeoutMs:J.timeoutMs,fetchImpl:J.fetchImpl})).json();if(!K?.id)throw Error("The provider accepted the upload but returned no file id.");return K.id}function $J(J){let Q=VQ(J);if(Q.startsWith("gpt-3.5")||Q.startsWith("text-")||Q.startsWith("davinci"))return{reasoning:!1,structuredOutput:!1,fileInput:!1,parallelToolCalls:!0,toolSearch:!1};let $=UQ(Q);if($?.kind==="o")return{reasoning:!0,structuredOutput:!0,fileInput:!0,parallelToolCalls:$.major>1,toolSearch:IJ($)};if($?.kind==="gpt")return{reasoning:$.major>=5,structuredOutput:$.major>4||Q.startsWith("gpt-4o")||Q.startsWith("gpt-4.1"),fileInput:$.major>4||Q.startsWith("gpt-4o")||Q.startsWith("gpt-4.1"),parallelToolCalls:!0,toolSearch:IJ($)};return{reasoning:!0,structuredOutput:!0,fileInput:!0,parallelToolCalls:!0,toolSearch:!0}}function IJ(J){if(J.kind==="o")return J.major>=5;return J.major>5||J.major===5&&J.minor>=2}function VQ(J){return J.trim().toLowerCase()}function UQ(J){let Q=/^gpt-(\d+)(?:\.(\d+))?/.exec(J);if(Q?.[1])return{kind:"gpt",major:Number(Q[1]),minor:Number(Q[2]??0)};let $=/^o(\d+)(?:[-.]|$)/.exec(J);if($?.[1])return{kind:"o",major:Number($[1]),minor:0};return null}function k(J){return typeof process>"u"?void 0:process.env?.[J]}var jQ="preview";function EJ(J){let Q=J.trim().replace(/\/+$/,"");if(!Q)return"";return`${Q.replace(/\/openai(?:\/v1)?$/i,"")}/openai`}function FQ(J){return/^\d{4}-\d{2}-\d{2}/.test(J)?"":"/v1"}function ZJ(J,Q={}){return{base:(J.baseURL??k("OPENAI_BASE_URL")??"https://api.openai.com/v1").replace(/\/+$/,""),query:"",headers:async()=>{let Z=J.apiKey??k("OPENAI_API_KEY");return{...Z?{authorization:`Bearer ${Z}`}:{},...J.headers}},timeoutMs:J.timeoutMs??Q.timeoutMs??120000,streamIdleTimeoutMs:J.streamIdleTimeoutMs??120000,streamMaxDurationMs:J.streamMaxDurationMs??300000,maxToolArgumentChars:J.maxToolArgumentChars??0,maxRetries:J.maxRetries??2}}function wJ(J){let Q=J.baseURL??J.endpoint??k("AZURE_OPENAI_ENDPOINT");if(Q)return EJ(Q);let $=J.resourceName??k("AZURE_OPENAI_RESOURCE_NAME")??k("AZURE_RESOURCE_NAME");return $?EJ(`https://${$.trim()}.cognitiveservices.azure.com`):""}function GJ(J,Q={}){let $=J.apiVersion??k("AZURE_OPENAI_API_VERSION")??jQ;return{base:`${wJ(J)}${FQ($)}`,query:`?api-version=${encodeURIComponent($)}`,headers:async()=>{if(J.getToken)return{authorization:`Bearer ${await J.getToken()}`,...J.headers};let Z=J.apiKey??k("AZURE_OPENAI_API_KEY");return{...Z?{"api-key":Z}:{},...J.headers}},timeoutMs:J.timeoutMs??Q.timeoutMs??120000,streamIdleTimeoutMs:J.streamIdleTimeoutMs??120000,streamMaxDurationMs:J.streamMaxDurationMs??300000,maxToolArgumentChars:J.maxToolArgumentChars??0,maxRetries:J.maxRetries??2}}function hJ(J,Q={}){return{...GJ(J,Q),base:`${wJ(J)}/v1`,query:""}}function WJ(J,Q){let{capabilities:$}=Q,Z={model:Q.model,input:qQ(J.messages,$,J.tools),stream:!0};if(J.systemPrompt)Z.instructions=J.systemPrompt;let G=OQ(J.tools,$);if(G.length>0){if(Z.tools=G,!$.parallelToolCalls)Z.parallel_tool_calls=!1;if(J.toolChoice!==void 0)Z.tool_choice=typeof J.toolChoice==="string"?J.toolChoice:{type:"function",name:J.toolChoice.name}}if(J.output)Z.text={format:{type:"json_schema",name:J.output.name,schema:J.output.schema,strict:J.output.strict}};if(J.reasoning&&$.reasoning)Z.reasoning=J.reasoning==="none"?{effort:"none"}:{effort:J.reasoning,summary:"auto"};if(typeof J.temperature==="number")Z.temperature=J.temperature;if(typeof J.maxOutputTokens==="number")Z.max_output_tokens=J.maxOutputTokens;if(J.promptCacheKey)Z.prompt_cache_key=J.promptCacheKey;return Z}function qQ(J,Q,$){let Z=[],G=new Map;if(Q.toolSearch){for(let K of $??[])if(d(K))G.set(K.name,K)}for(let K of J){let X=K.role,H=[],B=()=>{if(H.length===0)return;Z.push({type:"message",role:X,content:H}),H=[]};for(let Y of K.content??[])switch(Y.type){case"text":{if(!Y.text)break;H.push(I(X,Y.text));break}case"output":{if(Y.partial)break;H.push(I(X,JSON.stringify(Y.value)));break}case"file":{if(X==="assistant")break;let U=LQ(Y);if(!Q.fileInput){if(U)H.push(I(X,KJ(Y,!1)));break}if(Y.fileId?.startsWith(YJ))throw Error(`FilePart.fileId holds a gemi attachment id (${Y.fileId}). That field is the *provider's* file id, from \`fileId\` on the upload response; the \`attachmentId\` goes in \`FilePart.attachmentId\`, is shown to the model as text, and is resolved by a tool through \`ctx.attachments\`.`);if(!Y.fileId&&!U)throw Error("FilePart.fileId is empty and there is no `attachmentId` either. `fileId` is the *provider's* file id and `attachmentId` is gemi's (`gemi_att_\u2026`), both from the upload response; an upload always answers at least one, so a part with neither was built from something other than that answer.");if(Y.providerRejected){if(U)H.push(I(X,KJ(Y,!1)));H.push(I(X,a(Y.name)));break}if(U)H.push(I(X,KJ(Y,!!Y.fileId)));if(Y.fileId)H.push(xQ(Y));break}case"reasoning":{B();let U=CQ(Y);if(U)Z.push(U);break}case"tool-call":{if(Y.partial)break;if(B(),Q.toolSearch&&Array.isArray(Y.toolSearches))for(let j of Y.toolSearches)Z.push(...MQ(j,$??[]));let U={type:"function_call",call_id:Y.toolCallId,name:String(Y.name),arguments:JSON.stringify(Y.input??{})};if(Y.namespace&&G.has(Y.namespace))U.namespace=Y.namespace;Z.push(U);break}case"tool-result":{B(),Z.push({type:"function_call_output",call_id:Y.toolCallId,output:_Q(Y)});break}}B()}return zQ(Z)}var PQ="No result was recorded for this tool call. Assume it did not complete.";function zQ(J){let Q=new Set,$=new Set,Z=[];for(let K of J){if(K.type==="function_call"){let X=String(K.call_id);if(Q.has(X))continue;Q.add(X)}else if(K.type==="function_call_output"){let X=String(K.call_id);if(!Q.has(X)||$.has(X))continue;$.add(X)}Z.push(K)}if($.size===Q.size)return Z;let G=[];for(let K of Z){if(G.push(K),K.type!=="function_call")continue;let X=String(K.call_id);if($.has(X))continue;$.add(X),G.push({type:"function_call_output",call_id:X,output:PQ})}return G}function I(J,Q){return{type:J==="assistant"?"output_text":"input_text",text:Q}}function LQ(J){let Q=J.attachmentId;return typeof Q==="string"&&Q.startsWith(YJ)?Q:void 0}function KJ(J,Q){let $=[`id=${JSON.stringify(J.attachmentId)}`];if(J.name)$.push(`name=${JSON.stringify(J.name)}`);if(J.mimeType)$.push(`mimeType=${JSON.stringify(J.mimeType)}`);let Z=`attachment ${$.join(" ")}`;return Q?`[${Z}]`:`[${Z} \u2014 its contents are not shown to you; a tool can read the file by this id]`}function xQ(J){let Q=J.mimeType?.trim().toLowerCase()??"";return{type:(Q?Q.startsWith("image/")&&Q!=="image/svg+xml":DQ(J.name))?"input_image":"input_file",file_id:J.fileId}}function DQ(J){let Q=/\.([a-z0-9]+)$/.exec(J?.trim().toLowerCase()??"");return Q?.[1]!==void 0&&NQ.has(Q[1])}var NQ=new Set(["jpeg","jpg","png","gif","webp"]);function CQ(J){if(!J.id)return null;let Q={type:"reasoning",id:J.id};return Q.summary=J.text?[{type:"summary_text",text:J.text}]:[],Q}function _Q(J){if(J.status==="ok"){let Q=J.modelOutput!==void 0?J.modelOutput:J.output;return typeof Q==="string"?Q:JSON.stringify(Q??null)}if(J.status==="running"){let Q=J.job?.summary===void 0?"":` Started with: ${JSON.stringify(J.job.summary)}.`;return`Started background job ${J.job?.id??"(unknown)"}. It is still running, so there is no result yet: this message will be replaced by the result when it finishes. Do not start it again.${Q}`}if(J.status==="denied"){let Q=J.reason?` Reason given: ${J.reason}`:"";if(J.cause==="stopped")return`The run was stopped before this tool call could complete, so it did not run.${Q}`;if(J.cause==="interrupted")return`The run was interrupted (the server stopped) while this tool call was in progress, so its result was lost. It may have run in part or in full: check its effects before repeating it.${Q}`;return`The user declined this tool call, so it did not run.${Q}`}return`The tool call failed and produced no result. Error (${J.error?.code??"unknown"}): ${J.error?.message??"no message"}`}function MQ(J,Q){let $=new Set(vJ(J?.loaded)),Z=vJ(J?.namespaces),G=new Set(Z),K=[];for(let H of Q)if(d(H)){if(!G.has(H.name))continue;let B=H.tools.filter((Y)=>$.size===0||$.has(Y.name));if(B.length===0)continue;K.push({type:"namespace",name:H.name,description:H.description,tools:B.map((Y)=>E(Y,!0))})}else if(H.deferred&&$.has(H.name))K.push(E(H,!0));if(K.length===0)return[];return[{type:"tool_search_call",call_id:null,execution:"server",status:"completed",arguments:J.arguments&&typeof J.arguments==="object"?J.arguments:{paths:Z.length>0?Z:[...$]}},{type:"tool_search_output",call_id:null,execution:"server",status:"completed",tools:K}]}function vJ(J){return Array.isArray(J)?J.filter((Q)=>typeof Q==="string"):[]}function d(J){return Array.isArray(J.tools)}function OQ(J,Q){if(!J||J.length===0)return[];if(!Q.toolSearch){let G=[];for(let K of J)if(d(K))for(let X of K.tools)G.push(E(X,!1));else G.push(E(K,!1));return G}let $=[],Z=!1;for(let G of J)if(d(G)){let K=G.tools.map((X)=>{if(X.deferred)Z=!0;return E(X,!0)});$.push({type:"namespace",name:G.name,description:G.description,tools:K})}else{if(G.deferred)Z=!0;$.push(E(G,!0))}if(Z)$.push({type:"tool_search"});return $}function E(J,Q){let $={type:"function",name:J.name,description:J.description,parameters:J.parameters,strict:J.strict};if(Q&&J.deferred)$.defer_loading=!0;return $}class XJ{static models(){return[]}normalizeError(J){return D(J)}}var bJ=["gpt-5.5","gpt-5.4","gpt-5.4-mini","gpt-5.4-nano","gpt-5.2","gpt-5.1","gpt-5","gpt-5-mini","gpt-5-nano","gpt-4.1","gpt-4.1-mini","gpt-4.1-nano","gpt-4o","gpt-4o-mini","o4-mini","o3","o3-mini"];class yJ extends XJ{model;capabilities;config;constructor(J,Q={}){super();this.model=J,this.capabilities=$J(J),this.config=Q}static model(J,Q){return new yJ(J,Q)}static models(){return bJ}stream(J){let Q=WJ(J,{model:this.model,capabilities:this.capabilities});return JJ(this.endpoint(),Q,{signal:J.signal,structuredOutput:Boolean(J.output),files:r(J.messages)})}upload(J){return QJ(this.endpoint(),J)}endpoint(){return e(ZJ(this.config))}get realtime(){return new c(ZJ(this.config,{timeoutMs:i}),{model:this.model})}}class gJ extends XJ{model;capabilities;config;constructor(J,Q={}){super();this.model=J,this.capabilities=$J(J),this.config=Q}static model(J,Q){return new gJ(J,Q)}static models(){return bJ}stream(J){let Q=WJ(J,{model:this.deployment(),capabilities:this.capabilities});return JJ(this.endpoint(),Q,{signal:J.signal,structuredOutput:Boolean(J.output),files:r(J.messages)})}upload(J){return QJ(this.endpoint(),J,"assistants")}deployment(){return this.config.deployment??this.model}endpoint(){return e(GJ(this.config))}get realtime(){return new c(hJ(this.config,{timeoutMs:i}),{model:this.deployment(),callFlow:"ephemeral"})}}
6
+ export{ZJ as ca,GJ as da,h as ea,l as fa,nJ as ga,n as ha,v as ia,c as ja,tJ as ka,XJ as la,yJ as ma,gJ as na};
7
+
8
+ //# debugId=C4C92C34D42F203064756E2164756E21