drizzle-cube 0.4.28 → 0.4.30

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 (382) hide show
  1. package/dist/adapters/anthropic-BIva8k1r.cjs +1 -0
  2. package/dist/adapters/anthropic-B_rg0BhK.js +140 -0
  3. package/dist/adapters/dist-Boc63-1q.cjs +2 -0
  4. package/dist/adapters/dist-De5fzUEM.js +581 -0
  5. package/dist/adapters/express/index.cjs +2 -10
  6. package/dist/adapters/express/index.js +232 -342
  7. package/dist/adapters/fastify/index.cjs +2 -10
  8. package/dist/adapters/fastify/index.js +275 -424
  9. package/dist/adapters/google-CT4kgmBf.js +154 -0
  10. package/dist/adapters/google-Dgo9-Kb5.cjs +2 -0
  11. package/dist/adapters/handler-B8vuFQYP.cjs +25 -0
  12. package/dist/adapters/handler-D-2-6uLM.js +2951 -0
  13. package/dist/adapters/hono/index.cjs +2 -10
  14. package/dist/adapters/hono/index.js +307 -402
  15. package/dist/adapters/mcp-prompts-BAutSQYA.js +344 -0
  16. package/dist/adapters/mcp-prompts-DsAkafVn.cjs +5 -0
  17. package/dist/adapters/mcp-transport-CuugoG8t.js +7821 -0
  18. package/dist/adapters/mcp-transport-Dpp6hdZe.cjs +253 -0
  19. package/dist/adapters/nextjs/index.cjs +1 -9
  20. package/dist/adapters/nextjs/index.js +377 -600
  21. package/dist/adapters/openai-CjBvA6mK.js +4114 -0
  22. package/dist/adapters/openai-DhLE0A9Z.cjs +1 -0
  23. package/dist/adapters/openai-Zjw4Zo4R.js +153 -0
  24. package/dist/adapters/openai-eJBw3LfQ.cjs +16 -0
  25. package/dist/adapters/types.cjs +0 -1
  26. package/dist/adapters/types.js +0 -1
  27. package/dist/adapters/utils-ChhNGUOF.js +5396 -0
  28. package/dist/adapters/utils-CwJplXR5.cjs +15 -0
  29. package/dist/adapters/utils.cjs +1 -19
  30. package/dist/adapters/utils.js +2 -21333
  31. package/dist/client/charts.js +15 -186
  32. package/dist/client/chunks/DashboardEditModal-C076pscL.js +6678 -0
  33. package/dist/client/chunks/DashboardEditModal-C076pscL.js.map +1 -0
  34. package/dist/client/chunks/FieldSearchModal-C0DjSWk3.js +2631 -0
  35. package/dist/client/chunks/FieldSearchModal-C0DjSWk3.js.map +1 -0
  36. package/dist/client/chunks/RetentionCombinedChart-DuGXc-AP.js +270 -0
  37. package/dist/client/chunks/RetentionCombinedChart-DuGXc-AP.js.map +1 -0
  38. package/dist/client/chunks/RetentionCombinedChart.config-DprbXd1N.js +56 -0
  39. package/dist/client/chunks/RetentionCombinedChart.config-DprbXd1N.js.map +1 -0
  40. package/dist/client/chunks/RetentionHeatmap-BoGY6mlZ.js +193 -0
  41. package/dist/client/chunks/RetentionHeatmap-BoGY6mlZ.js.map +1 -0
  42. package/dist/client/chunks/RetentionHeatmap.config-cbaNExVy.js +25 -0
  43. package/dist/client/chunks/RetentionHeatmap.config-cbaNExVy.js.map +1 -0
  44. package/dist/client/chunks/analysis-builder-DF0XntqC.js +6111 -0
  45. package/dist/client/chunks/analysis-builder-DF0XntqC.js.map +1 -0
  46. package/dist/client/chunks/analysis-builder-shared-2QhKYbs6.js +3114 -0
  47. package/dist/client/chunks/analysis-builder-shared-2QhKYbs6.js.map +1 -0
  48. package/dist/client/chunks/chart-activity-grid-CNES9VBk.js +803 -0
  49. package/dist/client/chunks/chart-activity-grid-CNES9VBk.js.map +1 -0
  50. package/dist/client/chunks/chart-area-CRJc3KOu.js +449 -0
  51. package/dist/client/chunks/chart-area-CRJc3KOu.js.map +1 -0
  52. package/dist/client/chunks/chart-bar-DD2PjJ5n.js +270 -0
  53. package/dist/client/chunks/chart-bar-DD2PjJ5n.js.map +1 -0
  54. package/dist/client/chunks/chart-box-plot-BcqleldJ.js +377 -0
  55. package/dist/client/chunks/chart-box-plot-BcqleldJ.js.map +1 -0
  56. package/dist/client/chunks/chart-bubble-BmQkVk4K.js +273 -0
  57. package/dist/client/chunks/chart-bubble-BmQkVk4K.js.map +1 -0
  58. package/dist/client/chunks/chart-candlestick-C3Rep469.js +306 -0
  59. package/dist/client/chunks/chart-candlestick-C3Rep469.js.map +1 -0
  60. package/dist/client/chunks/chart-config-activity-grid-USo7JrPh.js +51 -0
  61. package/dist/client/chunks/chart-config-activity-grid-USo7JrPh.js.map +1 -0
  62. package/dist/client/chunks/chart-config-area-D_ZufYzg.js +93 -0
  63. package/dist/client/chunks/chart-config-area-D_ZufYzg.js.map +1 -0
  64. package/dist/client/chunks/chart-config-bar-BCi2Wmd6.js +87 -0
  65. package/dist/client/chunks/chart-config-bar-BCi2Wmd6.js.map +1 -0
  66. package/dist/client/chunks/chart-config-box-plot-afKLzJSp.js +35 -0
  67. package/dist/client/chunks/chart-config-box-plot-afKLzJSp.js.map +1 -0
  68. package/dist/client/chunks/chart-config-bubble-CgbBjPv8.js +82 -0
  69. package/dist/client/chunks/chart-config-bubble-CgbBjPv8.js.map +1 -0
  70. package/dist/client/chunks/chart-config-candlestick-7boGjZ-A.js +72 -0
  71. package/dist/client/chunks/chart-config-candlestick-7boGjZ-A.js.map +1 -0
  72. package/dist/client/chunks/chart-config-data-table-Cl7sBasW.js +30 -0
  73. package/dist/client/chunks/chart-config-data-table-Cl7sBasW.js.map +1 -0
  74. package/dist/client/chunks/chart-config-funnel-CXPYQtTl.js +93 -0
  75. package/dist/client/chunks/chart-config-funnel-CXPYQtTl.js.map +1 -0
  76. package/dist/client/chunks/chart-config-gauge-DUNEUCvh.js +64 -0
  77. package/dist/client/chunks/chart-config-gauge-DUNEUCvh.js.map +1 -0
  78. package/dist/client/chunks/chart-config-heat-map-BFf1tO11.js +91 -0
  79. package/dist/client/chunks/chart-config-heat-map-BFf1tO11.js.map +1 -0
  80. package/dist/client/chunks/chart-config-kpi-delta-C5k2waIJ.js +94 -0
  81. package/dist/client/chunks/chart-config-kpi-delta-C5k2waIJ.js.map +1 -0
  82. package/dist/client/chunks/chart-config-kpi-number-DptOyhk0.js +75 -0
  83. package/dist/client/chunks/chart-config-kpi-number-DptOyhk0.js.map +1 -0
  84. package/dist/client/chunks/chart-config-kpi-text-D9DdVWqd.js +47 -0
  85. package/dist/client/chunks/chart-config-kpi-text-D9DdVWqd.js.map +1 -0
  86. package/dist/client/chunks/chart-config-line-B3NgLF7K.js +104 -0
  87. package/dist/client/chunks/chart-config-line-B3NgLF7K.js.map +1 -0
  88. package/dist/client/chunks/chart-config-markdown-tlfivQTt.js +117 -0
  89. package/dist/client/chunks/chart-config-markdown-tlfivQTt.js.map +1 -0
  90. package/dist/client/chunks/chart-config-measure-profile-D7XDwrU2.js +82 -0
  91. package/dist/client/chunks/chart-config-measure-profile-D7XDwrU2.js.map +1 -0
  92. package/dist/client/chunks/chart-config-pie-wY0B52PC.js +68 -0
  93. package/dist/client/chunks/chart-config-pie-wY0B52PC.js.map +1 -0
  94. package/dist/client/chunks/chart-config-radar-DRpJBy1M.js +49 -0
  95. package/dist/client/chunks/chart-config-radar-DRpJBy1M.js.map +1 -0
  96. package/dist/client/chunks/chart-config-radial-bar-DCUpXv9G.js +38 -0
  97. package/dist/client/chunks/chart-config-radial-bar-DCUpXv9G.js.map +1 -0
  98. package/dist/client/chunks/chart-config-sankey-CdOhlm4h.js +66 -0
  99. package/dist/client/chunks/chart-config-sankey-CdOhlm4h.js.map +1 -0
  100. package/dist/client/chunks/chart-config-scatter-B2su_x8f.js +61 -0
  101. package/dist/client/chunks/chart-config-scatter-B2su_x8f.js.map +1 -0
  102. package/dist/client/chunks/chart-config-sunburst-BPdjbk18.js +45 -0
  103. package/dist/client/chunks/chart-config-sunburst-BPdjbk18.js.map +1 -0
  104. package/dist/client/chunks/chart-config-tree-map-Cbsh2fe2.js +51 -0
  105. package/dist/client/chunks/chart-config-tree-map-Cbsh2fe2.js.map +1 -0
  106. package/dist/client/chunks/chart-config-waterfall-DGmuZfQF.js +59 -0
  107. package/dist/client/chunks/chart-config-waterfall-DGmuZfQF.js.map +1 -0
  108. package/dist/client/chunks/chart-data-table-DehW1C1G.js +4088 -0
  109. package/dist/client/chunks/chart-data-table-DehW1C1G.js.map +1 -0
  110. package/dist/client/chunks/chart-funnel-BjkpnG5g.js +447 -0
  111. package/dist/client/chunks/chart-funnel-BjkpnG5g.js.map +1 -0
  112. package/dist/client/chunks/chart-gauge-BWW_HEfg.js +424 -0
  113. package/dist/client/chunks/chart-gauge-BWW_HEfg.js.map +1 -0
  114. package/dist/client/chunks/chart-heat-map-BWuOuDcm.js +236 -0
  115. package/dist/client/chunks/chart-heat-map-BWuOuDcm.js.map +1 -0
  116. package/dist/client/chunks/chart-kpi-delta-D5OHtDJx.js +343 -0
  117. package/dist/client/chunks/chart-kpi-delta-D5OHtDJx.js.map +1 -0
  118. package/dist/client/chunks/chart-kpi-number-C9zH-aKC.js +326 -0
  119. package/dist/client/chunks/chart-kpi-number-C9zH-aKC.js.map +1 -0
  120. package/dist/client/chunks/chart-kpi-text-ChVn3S7j.js +149 -0
  121. package/dist/client/chunks/chart-kpi-text-ChVn3S7j.js.map +1 -0
  122. package/dist/client/chunks/chart-line-DOIMkP0b.js +431 -0
  123. package/dist/client/chunks/chart-line-DOIMkP0b.js.map +1 -0
  124. package/dist/client/chunks/chart-markdown-DXxc43w1.js +3457 -0
  125. package/dist/client/chunks/chart-markdown-DXxc43w1.js.map +1 -0
  126. package/dist/client/chunks/chart-measure-profile-C6wrr9il.js +179 -0
  127. package/dist/client/chunks/chart-measure-profile-C6wrr9il.js.map +1 -0
  128. package/dist/client/chunks/chart-pie-BU_FgwDc.js +172 -0
  129. package/dist/client/chunks/chart-pie-BU_FgwDc.js.map +1 -0
  130. package/dist/client/chunks/chart-radar-DlufwnAX.js +154 -0
  131. package/dist/client/chunks/chart-radar-DlufwnAX.js.map +1 -0
  132. package/dist/client/chunks/chart-radial-bar-B5vS_Aw5.js +148 -0
  133. package/dist/client/chunks/chart-radial-bar-B5vS_Aw5.js.map +1 -0
  134. package/dist/client/chunks/chart-sankey-FChb26UX.js +222 -0
  135. package/dist/client/chunks/chart-sankey-FChb26UX.js.map +1 -0
  136. package/dist/client/chunks/chart-scatter-DW0cAZ2H.js +255 -0
  137. package/dist/client/chunks/chart-scatter-DW0cAZ2H.js.map +1 -0
  138. package/dist/client/chunks/chart-sunburst-Clf-6WxW.js +221 -0
  139. package/dist/client/chunks/chart-sunburst-Clf-6WxW.js.map +1 -0
  140. package/dist/client/chunks/chart-tree-map-p_VwUJPF.js +298 -0
  141. package/dist/client/chunks/chart-tree-map-p_VwUJPF.js.map +1 -0
  142. package/dist/client/chunks/chart-waterfall-jt44IQ-w.js +237 -0
  143. package/dist/client/chunks/chart-waterfall-jt44IQ-w.js.map +1 -0
  144. package/dist/client/chunks/charts-core-CUVzf4cV.js +215 -0
  145. package/dist/client/chunks/charts-core-CUVzf4cV.js.map +1 -0
  146. package/dist/client/chunks/charts-loader-AGpph8_I.js +259 -0
  147. package/dist/client/chunks/charts-loader-AGpph8_I.js.map +1 -0
  148. package/dist/client/chunks/core-D1TOj17W.js +845 -0
  149. package/dist/client/chunks/core-D1TOj17W.js.map +1 -0
  150. package/dist/client/chunks/dist-DDBeV_JI.js +847 -0
  151. package/dist/client/chunks/dist-DDBeV_JI.js.map +1 -0
  152. package/dist/client/chunks/javascript-BBwTSo6e.js +438 -0
  153. package/dist/client/chunks/javascript-BBwTSo6e.js.map +1 -0
  154. package/dist/client/chunks/json-BpTrLZSh.js +38 -0
  155. package/dist/client/chunks/json-BpTrLZSh.js.map +1 -0
  156. package/dist/client/chunks/lazyChartConfigRegistry-BjhxDaSf.js +149 -0
  157. package/dist/client/chunks/lazyChartConfigRegistry-BjhxDaSf.js.map +1 -0
  158. package/dist/client/chunks/providers-DX3Vw5kc.js +7 -0
  159. package/dist/client/chunks/providers-DX3Vw5kc.js.map +1 -0
  160. package/dist/client/chunks/retention-UEXlSdZ-.js +132 -0
  161. package/dist/client/chunks/retention-UEXlSdZ-.js.map +1 -0
  162. package/dist/client/chunks/rolldown-runtime-lc2dmIiU.js +20 -0
  163. package/dist/client/chunks/schema-visualization-ZugB4Io9.js +1073 -0
  164. package/dist/client/chunks/schema-visualization-ZugB4Io9.js.map +1 -0
  165. package/dist/client/chunks/sql-B0chxcEK.js +120 -0
  166. package/dist/client/chunks/sql-B0chxcEK.js.map +1 -0
  167. package/dist/client/chunks/syntaxHighlighting-87bOwTxj.js +30 -0
  168. package/dist/client/chunks/syntaxHighlighting-87bOwTxj.js.map +1 -0
  169. package/dist/client/chunks/useDebounce-BQjNWndQ.js +1394 -0
  170. package/dist/client/chunks/useDebounce-BQjNWndQ.js.map +1 -0
  171. package/dist/client/chunks/useDirtyStateTracking-CgKZWkel.js +66 -0
  172. package/dist/client/chunks/useDirtyStateTracking-CgKZWkel.js.map +1 -0
  173. package/dist/client/chunks/useExplainAI-c_bHxZe5.js +203 -0
  174. package/dist/client/chunks/useExplainAI-c_bHxZe5.js.map +1 -0
  175. package/dist/client/chunks/useNotebookLayout-BFZ_33Kb.js +37 -0
  176. package/dist/client/chunks/useNotebookLayout-BFZ_33Kb.js.map +1 -0
  177. package/dist/client/chunks/utils-A54Ny29G.js +128 -0
  178. package/dist/client/chunks/utils-A54Ny29G.js.map +1 -0
  179. package/dist/client/chunks/vendor-CoPBRumI.js +828 -0
  180. package/dist/client/chunks/vendor-CoPBRumI.js.map +1 -0
  181. package/dist/client/components.js +4 -18
  182. package/dist/client/hooks.js +6 -58
  183. package/dist/client/icons.js +2 -15
  184. package/dist/client/index.js +1061 -1295
  185. package/dist/client/index.js.map +1 -1
  186. package/dist/client/providers.js +3 -9
  187. package/dist/client/styles.css +2 -1
  188. package/dist/client/types.d.ts +1 -0
  189. package/dist/client/utils.js +7 -74
  190. package/dist/client-bundle-stats.html +1 -1
  191. package/dist/server/anthropic-BsNspi1r.js +140 -0
  192. package/dist/server/anthropic-DsCEX6Fm.cjs +1 -0
  193. package/dist/server/dist-CMWZC51B.js +581 -0
  194. package/dist/server/dist-DxegvyZF.cjs +2 -0
  195. package/dist/server/google-BXwMolCu.js +154 -0
  196. package/dist/server/google-DzQWXFwF.cjs +2 -0
  197. package/dist/server/index.cjs +109 -127
  198. package/dist/server/index.d.ts +13 -4
  199. package/dist/server/index.js +15089 -34349
  200. package/dist/server/openai-BPhmb8mi.js +4114 -0
  201. package/dist/server/openai-CLsoLaue.cjs +1 -0
  202. package/dist/server/openai-D1kZ5sdM.js +153 -0
  203. package/dist/server/openai-DkOKbVLC.cjs +16 -0
  204. package/package.json +5 -5
  205. package/dist/adapters/anthropic-BTkjgFpT.cjs +0 -1
  206. package/dist/adapters/anthropic-CTu9E801.js +0 -126
  207. package/dist/adapters/google-BAK9pnQf.cjs +0 -2
  208. package/dist/adapters/google-DficVAsJ.js +0 -146
  209. package/dist/adapters/handler-BV2_dul8.js +0 -2713
  210. package/dist/adapters/handler-LMRPeTNJ.cjs +0 -39
  211. package/dist/adapters/index-BgCeQBuN.cjs +0 -2
  212. package/dist/adapters/index-C3PskWTr.js +0 -5353
  213. package/dist/adapters/index-C45_meK_.js +0 -719
  214. package/dist/adapters/index-ht4NPca9.cjs +0 -23
  215. package/dist/adapters/mcp-transport-B6ZudTSk.js +0 -11010
  216. package/dist/adapters/mcp-transport-DCiSGtp1.cjs +0 -257
  217. package/dist/adapters/openai-BvA6eLs8.cjs +0 -1
  218. package/dist/adapters/openai-mcE24du8.js +0 -131
  219. package/dist/client/charts.js.map +0 -1
  220. package/dist/client/chunks/RetentionCombinedChart--SnU4Y_I.js +0 -256
  221. package/dist/client/chunks/RetentionCombinedChart--SnU4Y_I.js.map +0 -1
  222. package/dist/client/chunks/RetentionCombinedChart.config-Bbp2ghim.js +0 -48
  223. package/dist/client/chunks/RetentionCombinedChart.config-Bbp2ghim.js.map +0 -1
  224. package/dist/client/chunks/RetentionHeatmap-BHYU8MXY.js +0 -178
  225. package/dist/client/chunks/RetentionHeatmap-BHYU8MXY.js.map +0 -1
  226. package/dist/client/chunks/RetentionHeatmap.config-BWf_-vdj.js +0 -29
  227. package/dist/client/chunks/RetentionHeatmap.config-BWf_-vdj.js.map +0 -1
  228. package/dist/client/chunks/analysis-builder-DMFoAkjT.js +0 -6203
  229. package/dist/client/chunks/analysis-builder-DMFoAkjT.js.map +0 -1
  230. package/dist/client/chunks/analysis-builder-shared-CunrT3gi.js +0 -3140
  231. package/dist/client/chunks/analysis-builder-shared-CunrT3gi.js.map +0 -1
  232. package/dist/client/chunks/chart-activity-grid-DCznpK6N.js +0 -347
  233. package/dist/client/chunks/chart-activity-grid-DCznpK6N.js.map +0 -1
  234. package/dist/client/chunks/chart-area-CqKRIUpj.js +0 -234
  235. package/dist/client/chunks/chart-area-CqKRIUpj.js.map +0 -1
  236. package/dist/client/chunks/chart-bar-Bl5jvrU_.js +0 -267
  237. package/dist/client/chunks/chart-bar-Bl5jvrU_.js.map +0 -1
  238. package/dist/client/chunks/chart-box-plot-CzMb00z_.js +0 -322
  239. package/dist/client/chunks/chart-box-plot-CzMb00z_.js.map +0 -1
  240. package/dist/client/chunks/chart-bubble-BF8Z52eW.js +0 -249
  241. package/dist/client/chunks/chart-bubble-BF8Z52eW.js.map +0 -1
  242. package/dist/client/chunks/chart-candlestick-ByWS945g.js +0 -269
  243. package/dist/client/chunks/chart-candlestick-ByWS945g.js.map +0 -1
  244. package/dist/client/chunks/chart-config-activity-grid-CmOqDuOT.js +0 -50
  245. package/dist/client/chunks/chart-config-activity-grid-CmOqDuOT.js.map +0 -1
  246. package/dist/client/chunks/chart-config-area-CK_GVApT.js +0 -77
  247. package/dist/client/chunks/chart-config-area-CK_GVApT.js.map +0 -1
  248. package/dist/client/chunks/chart-config-bar-C8uzktxl.js +0 -71
  249. package/dist/client/chunks/chart-config-bar-C8uzktxl.js.map +0 -1
  250. package/dist/client/chunks/chart-config-box-plot-D_E_SSc2.js +0 -38
  251. package/dist/client/chunks/chart-config-box-plot-D_E_SSc2.js.map +0 -1
  252. package/dist/client/chunks/chart-config-bubble-q3DoQX5F.js +0 -71
  253. package/dist/client/chunks/chart-config-bubble-q3DoQX5F.js.map +0 -1
  254. package/dist/client/chunks/chart-config-candlestick-CRCpD43-.js +0 -70
  255. package/dist/client/chunks/chart-config-candlestick-CRCpD43-.js.map +0 -1
  256. package/dist/client/chunks/chart-config-data-table-B20Y5JCm.js +0 -28
  257. package/dist/client/chunks/chart-config-data-table-B20Y5JCm.js.map +0 -1
  258. package/dist/client/chunks/chart-config-funnel-3eYnGg8M.js +0 -92
  259. package/dist/client/chunks/chart-config-funnel-3eYnGg8M.js.map +0 -1
  260. package/dist/client/chunks/chart-config-gauge-CQx9w3d4.js +0 -64
  261. package/dist/client/chunks/chart-config-gauge-CQx9w3d4.js.map +0 -1
  262. package/dist/client/chunks/chart-config-heat-map-_wEnTnRA.js +0 -77
  263. package/dist/client/chunks/chart-config-heat-map-_wEnTnRA.js.map +0 -1
  264. package/dist/client/chunks/chart-config-kpi-delta-DLGZ2A3X.js +0 -97
  265. package/dist/client/chunks/chart-config-kpi-delta-DLGZ2A3X.js.map +0 -1
  266. package/dist/client/chunks/chart-config-kpi-number-K-wzviXF.js +0 -75
  267. package/dist/client/chunks/chart-config-kpi-number-K-wzviXF.js.map +0 -1
  268. package/dist/client/chunks/chart-config-kpi-text-BjYqwqaJ.js +0 -47
  269. package/dist/client/chunks/chart-config-kpi-text-BjYqwqaJ.js.map +0 -1
  270. package/dist/client/chunks/chart-config-line-JNagi9tf.js +0 -88
  271. package/dist/client/chunks/chart-config-line-JNagi9tf.js.map +0 -1
  272. package/dist/client/chunks/chart-config-markdown-BWQSjJpy.js +0 -97
  273. package/dist/client/chunks/chart-config-markdown-BWQSjJpy.js.map +0 -1
  274. package/dist/client/chunks/chart-config-measure-profile-ZYaMrtws.js +0 -70
  275. package/dist/client/chunks/chart-config-measure-profile-ZYaMrtws.js.map +0 -1
  276. package/dist/client/chunks/chart-config-pie-CNLXb-fr.js +0 -39
  277. package/dist/client/chunks/chart-config-pie-CNLXb-fr.js.map +0 -1
  278. package/dist/client/chunks/chart-config-radar-oxHfRAa3.js +0 -44
  279. package/dist/client/chunks/chart-config-radar-oxHfRAa3.js.map +0 -1
  280. package/dist/client/chunks/chart-config-radial-bar-_Aw3jAEm.js +0 -37
  281. package/dist/client/chunks/chart-config-radial-bar-_Aw3jAEm.js.map +0 -1
  282. package/dist/client/chunks/chart-config-sankey-C8FX9hGF.js +0 -61
  283. package/dist/client/chunks/chart-config-sankey-C8FX9hGF.js.map +0 -1
  284. package/dist/client/chunks/chart-config-scatter-DFKM80eO.js +0 -53
  285. package/dist/client/chunks/chart-config-scatter-DFKM80eO.js.map +0 -1
  286. package/dist/client/chunks/chart-config-sunburst-BmC0NLTU.js +0 -50
  287. package/dist/client/chunks/chart-config-sunburst-BmC0NLTU.js.map +0 -1
  288. package/dist/client/chunks/chart-config-tree-map-DGMbNTaa.js +0 -47
  289. package/dist/client/chunks/chart-config-tree-map-DGMbNTaa.js.map +0 -1
  290. package/dist/client/chunks/chart-config-waterfall-DTyXV_fo.js +0 -60
  291. package/dist/client/chunks/chart-config-waterfall-DTyXV_fo.js.map +0 -1
  292. package/dist/client/chunks/chart-data-table-HwfF-Ujv.js +0 -293
  293. package/dist/client/chunks/chart-data-table-HwfF-Ujv.js.map +0 -1
  294. package/dist/client/chunks/chart-funnel-WmuoWlCq.js +0 -259
  295. package/dist/client/chunks/chart-funnel-WmuoWlCq.js.map +0 -1
  296. package/dist/client/chunks/chart-gauge-Cot4By-w.js +0 -374
  297. package/dist/client/chunks/chart-gauge-Cot4By-w.js.map +0 -1
  298. package/dist/client/chunks/chart-heat-map-bGNtsZMr.js +0 -231
  299. package/dist/client/chunks/chart-heat-map-bGNtsZMr.js.map +0 -1
  300. package/dist/client/chunks/chart-kpi-delta-DeyKMxgq.js +0 -351
  301. package/dist/client/chunks/chart-kpi-delta-DeyKMxgq.js.map +0 -1
  302. package/dist/client/chunks/chart-kpi-number-D1z1gxXO.js +0 -476
  303. package/dist/client/chunks/chart-kpi-number-D1z1gxXO.js.map +0 -1
  304. package/dist/client/chunks/chart-kpi-text-b7q6KWc0.js +0 -165
  305. package/dist/client/chunks/chart-kpi-text-b7q6KWc0.js.map +0 -1
  306. package/dist/client/chunks/chart-line-3Nf-EPqJ.js +0 -450
  307. package/dist/client/chunks/chart-line-3Nf-EPqJ.js.map +0 -1
  308. package/dist/client/chunks/chart-markdown-BT_-MBq1.js +0 -2721
  309. package/dist/client/chunks/chart-markdown-BT_-MBq1.js.map +0 -1
  310. package/dist/client/chunks/chart-measure-profile-BVjUonqU.js +0 -114
  311. package/dist/client/chunks/chart-measure-profile-BVjUonqU.js.map +0 -1
  312. package/dist/client/chunks/chart-pie-DblG6w7g.js +0 -137
  313. package/dist/client/chunks/chart-pie-DblG6w7g.js.map +0 -1
  314. package/dist/client/chunks/chart-radar-BHZbeeTg.js +0 -129
  315. package/dist/client/chunks/chart-radar-BHZbeeTg.js.map +0 -1
  316. package/dist/client/chunks/chart-radial-bar-AlEJC1Jo.js +0 -119
  317. package/dist/client/chunks/chart-radial-bar-AlEJC1Jo.js.map +0 -1
  318. package/dist/client/chunks/chart-sankey-E8vYKjQF.js +0 -189
  319. package/dist/client/chunks/chart-sankey-E8vYKjQF.js.map +0 -1
  320. package/dist/client/chunks/chart-scatter-Bbxqi0iw.js +0 -202
  321. package/dist/client/chunks/chart-scatter-Bbxqi0iw.js.map +0 -1
  322. package/dist/client/chunks/chart-sunburst-BgnTKolT.js +0 -188
  323. package/dist/client/chunks/chart-sunburst-BgnTKolT.js.map +0 -1
  324. package/dist/client/chunks/chart-tree-map-i9LGCLwl.js +0 -284
  325. package/dist/client/chunks/chart-tree-map-i9LGCLwl.js.map +0 -1
  326. package/dist/client/chunks/chart-waterfall-BeIhCm83.js +0 -191
  327. package/dist/client/chunks/chart-waterfall-BeIhCm83.js.map +0 -1
  328. package/dist/client/chunks/charts-core-BUUO36OM.js +0 -692
  329. package/dist/client/chunks/charts-core-BUUO36OM.js.map +0 -1
  330. package/dist/client/chunks/charts-loader-goTYnavu.js +0 -258
  331. package/dist/client/chunks/charts-loader-goTYnavu.js.map +0 -1
  332. package/dist/client/chunks/components-BFgYvFq6.js +0 -10066
  333. package/dist/client/chunks/components-BFgYvFq6.js.map +0 -1
  334. package/dist/client/chunks/core-Y9e-sNfb.js +0 -1068
  335. package/dist/client/chunks/core-Y9e-sNfb.js.map +0 -1
  336. package/dist/client/chunks/flow-utils-CjQZG5qq.js +0 -16
  337. package/dist/client/chunks/flow-utils-CjQZG5qq.js.map +0 -1
  338. package/dist/client/chunks/funnel-utils-CyonoNeC.js +0 -135
  339. package/dist/client/chunks/funnel-utils-CyonoNeC.js.map +0 -1
  340. package/dist/client/chunks/icons-CwvgmdIP.js +0 -1636
  341. package/dist/client/chunks/icons-CwvgmdIP.js.map +0 -1
  342. package/dist/client/chunks/index-CApFCBF9.js +0 -81
  343. package/dist/client/chunks/index-CApFCBF9.js.map +0 -1
  344. package/dist/client/chunks/index-_2PSgbkC.js +0 -1046
  345. package/dist/client/chunks/index-_2PSgbkC.js.map +0 -1
  346. package/dist/client/chunks/javascript-DII1YQGr.js +0 -659
  347. package/dist/client/chunks/javascript-DII1YQGr.js.map +0 -1
  348. package/dist/client/chunks/json-C_6Prymp.js +0 -39
  349. package/dist/client/chunks/json-C_6Prymp.js.map +0 -1
  350. package/dist/client/chunks/providers-Ds7DRmnO.js +0 -554
  351. package/dist/client/chunks/providers-Ds7DRmnO.js.map +0 -1
  352. package/dist/client/chunks/retention-CzCo8262.js +0 -120
  353. package/dist/client/chunks/retention-CzCo8262.js.map +0 -1
  354. package/dist/client/chunks/schema-visualization-B97a1Ybu.js +0 -772
  355. package/dist/client/chunks/schema-visualization-B97a1Ybu.js.map +0 -1
  356. package/dist/client/chunks/sql-IeKX8fQ8.js +0 -616
  357. package/dist/client/chunks/sql-IeKX8fQ8.js.map +0 -1
  358. package/dist/client/chunks/syntaxHighlighting-DAMSW_A6.js +0 -34
  359. package/dist/client/chunks/syntaxHighlighting-DAMSW_A6.js.map +0 -1
  360. package/dist/client/chunks/theme-Dp3hFed1.js +0 -112
  361. package/dist/client/chunks/theme-Dp3hFed1.js.map +0 -1
  362. package/dist/client/chunks/useDirtyStateTracking-CyAXd07d.js +0 -1231
  363. package/dist/client/chunks/useDirtyStateTracking-CyAXd07d.js.map +0 -1
  364. package/dist/client/chunks/useExplainAI-CfQ_JmF1.js +0 -182
  365. package/dist/client/chunks/useExplainAI-CfQ_JmF1.js.map +0 -1
  366. package/dist/client/chunks/vendor-B2EH3V58.js +0 -2892
  367. package/dist/client/chunks/vendor-B2EH3V58.js.map +0 -1
  368. package/dist/client/components.js.map +0 -1
  369. package/dist/client/hooks.js.map +0 -1
  370. package/dist/client/icons.js.map +0 -1
  371. package/dist/client/providers.js.map +0 -1
  372. package/dist/client/utils.js.map +0 -1
  373. package/dist/server/anthropic-BTkjgFpT.cjs +0 -1
  374. package/dist/server/anthropic-CTu9E801.js +0 -126
  375. package/dist/server/google-BAK9pnQf.cjs +0 -2
  376. package/dist/server/google-DficVAsJ.js +0 -146
  377. package/dist/server/index-BgCeQBuN.cjs +0 -2
  378. package/dist/server/index-C3PskWTr.js +0 -5353
  379. package/dist/server/index-C45_meK_.js +0 -719
  380. package/dist/server/index-ht4NPca9.cjs +0 -23
  381. package/dist/server/openai-BvA6eLs8.cjs +0 -1
  382. package/dist/server/openai-mcE24du8.js +0 -131
@@ -0,0 +1,581 @@
1
+ //#region node_modules/@google/generative-ai/dist/index.mjs
2
+ var e;
3
+ (function(e) {
4
+ e.STRING = "string", e.NUMBER = "number", e.INTEGER = "integer", e.BOOLEAN = "boolean", e.ARRAY = "array", e.OBJECT = "object";
5
+ })(e ||= {});
6
+ var t;
7
+ (function(e) {
8
+ e.LANGUAGE_UNSPECIFIED = "language_unspecified", e.PYTHON = "python";
9
+ })(t ||= {});
10
+ var n;
11
+ (function(e) {
12
+ e.OUTCOME_UNSPECIFIED = "outcome_unspecified", e.OUTCOME_OK = "outcome_ok", e.OUTCOME_FAILED = "outcome_failed", e.OUTCOME_DEADLINE_EXCEEDED = "outcome_deadline_exceeded";
13
+ })(n ||= {});
14
+ var r = [
15
+ "user",
16
+ "model",
17
+ "function",
18
+ "system"
19
+ ], i;
20
+ (function(e) {
21
+ e.HARM_CATEGORY_UNSPECIFIED = "HARM_CATEGORY_UNSPECIFIED", e.HARM_CATEGORY_HATE_SPEECH = "HARM_CATEGORY_HATE_SPEECH", e.HARM_CATEGORY_SEXUALLY_EXPLICIT = "HARM_CATEGORY_SEXUALLY_EXPLICIT", e.HARM_CATEGORY_HARASSMENT = "HARM_CATEGORY_HARASSMENT", e.HARM_CATEGORY_DANGEROUS_CONTENT = "HARM_CATEGORY_DANGEROUS_CONTENT", e.HARM_CATEGORY_CIVIC_INTEGRITY = "HARM_CATEGORY_CIVIC_INTEGRITY";
22
+ })(i ||= {});
23
+ var a;
24
+ (function(e) {
25
+ e.HARM_BLOCK_THRESHOLD_UNSPECIFIED = "HARM_BLOCK_THRESHOLD_UNSPECIFIED", e.BLOCK_LOW_AND_ABOVE = "BLOCK_LOW_AND_ABOVE", e.BLOCK_MEDIUM_AND_ABOVE = "BLOCK_MEDIUM_AND_ABOVE", e.BLOCK_ONLY_HIGH = "BLOCK_ONLY_HIGH", e.BLOCK_NONE = "BLOCK_NONE";
26
+ })(a ||= {});
27
+ var o;
28
+ (function(e) {
29
+ e.HARM_PROBABILITY_UNSPECIFIED = "HARM_PROBABILITY_UNSPECIFIED", e.NEGLIGIBLE = "NEGLIGIBLE", e.LOW = "LOW", e.MEDIUM = "MEDIUM", e.HIGH = "HIGH";
30
+ })(o ||= {});
31
+ var s;
32
+ (function(e) {
33
+ e.BLOCKED_REASON_UNSPECIFIED = "BLOCKED_REASON_UNSPECIFIED", e.SAFETY = "SAFETY", e.OTHER = "OTHER";
34
+ })(s ||= {});
35
+ var c;
36
+ (function(e) {
37
+ e.FINISH_REASON_UNSPECIFIED = "FINISH_REASON_UNSPECIFIED", e.STOP = "STOP", e.MAX_TOKENS = "MAX_TOKENS", e.SAFETY = "SAFETY", e.RECITATION = "RECITATION", e.LANGUAGE = "LANGUAGE", e.BLOCKLIST = "BLOCKLIST", e.PROHIBITED_CONTENT = "PROHIBITED_CONTENT", e.SPII = "SPII", e.MALFORMED_FUNCTION_CALL = "MALFORMED_FUNCTION_CALL", e.OTHER = "OTHER";
38
+ })(c ||= {});
39
+ var l;
40
+ (function(e) {
41
+ e.TASK_TYPE_UNSPECIFIED = "TASK_TYPE_UNSPECIFIED", e.RETRIEVAL_QUERY = "RETRIEVAL_QUERY", e.RETRIEVAL_DOCUMENT = "RETRIEVAL_DOCUMENT", e.SEMANTIC_SIMILARITY = "SEMANTIC_SIMILARITY", e.CLASSIFICATION = "CLASSIFICATION", e.CLUSTERING = "CLUSTERING";
42
+ })(l ||= {});
43
+ var u;
44
+ (function(e) {
45
+ e.MODE_UNSPECIFIED = "MODE_UNSPECIFIED", e.AUTO = "AUTO", e.ANY = "ANY", e.NONE = "NONE";
46
+ })(u ||= {});
47
+ var d;
48
+ (function(e) {
49
+ e.MODE_UNSPECIFIED = "MODE_UNSPECIFIED", e.MODE_DYNAMIC = "MODE_DYNAMIC";
50
+ })(d ||= {});
51
+ var f = class extends Error {
52
+ constructor(e) {
53
+ super(`[GoogleGenerativeAI Error]: ${e}`);
54
+ }
55
+ }, p = class extends f {
56
+ constructor(e, t) {
57
+ super(e), this.response = t;
58
+ }
59
+ }, m = class extends f {
60
+ constructor(e, t, n, r) {
61
+ super(e), this.status = t, this.statusText = n, this.errorDetails = r;
62
+ }
63
+ }, h = class extends f {}, g = class extends f {}, ee = "https://generativelanguage.googleapis.com", _ = "v1beta", v = "0.24.1", te = "genai-js", y;
64
+ (function(e) {
65
+ e.GENERATE_CONTENT = "generateContent", e.STREAM_GENERATE_CONTENT = "streamGenerateContent", e.COUNT_TOKENS = "countTokens", e.EMBED_CONTENT = "embedContent", e.BATCH_EMBED_CONTENTS = "batchEmbedContents";
66
+ })(y ||= {});
67
+ var b = class {
68
+ constructor(e, t, n, r, i) {
69
+ this.model = e, this.task = t, this.apiKey = n, this.stream = r, this.requestOptions = i;
70
+ }
71
+ toString() {
72
+ let e = this.requestOptions?.apiVersion || _, t = `${this.requestOptions?.baseUrl || ee}/${e}/${this.model}:${this.task}`;
73
+ return this.stream && (t += "?alt=sse"), t;
74
+ }
75
+ };
76
+ function x(e) {
77
+ let t = [];
78
+ return e?.apiClient && t.push(e.apiClient), t.push(`${te}/${v}`), t.join(" ");
79
+ }
80
+ async function S(e) {
81
+ let t = new Headers();
82
+ t.append("Content-Type", "application/json"), t.append("x-goog-api-client", x(e.requestOptions)), t.append("x-goog-api-key", e.apiKey);
83
+ let n = e.requestOptions?.customHeaders;
84
+ if (n) {
85
+ if (!(n instanceof Headers)) try {
86
+ n = new Headers(n);
87
+ } catch (e) {
88
+ throw new h(`unable to convert customHeaders value ${JSON.stringify(n)} to Headers: ${e.message}`);
89
+ }
90
+ for (let [e, r] of n.entries()) {
91
+ if (e === "x-goog-api-key") throw new h(`Cannot set reserved header name ${e}`);
92
+ if (e === "x-goog-api-client") throw new h(`Header name ${e} can only be set using the apiClient field`);
93
+ t.append(e, r);
94
+ }
95
+ }
96
+ return t;
97
+ }
98
+ async function ne(e, t, n, r, i, a) {
99
+ let o = new b(e, t, n, r, a);
100
+ return {
101
+ url: o.toString(),
102
+ fetchOptions: Object.assign(Object.assign({}, D(a)), {
103
+ method: "POST",
104
+ headers: await S(o),
105
+ body: i
106
+ })
107
+ };
108
+ }
109
+ async function C(e, t, n, r, i, a = {}, o = fetch) {
110
+ let { url: s, fetchOptions: c } = await ne(e, t, n, r, i, a);
111
+ return w(s, c, o);
112
+ }
113
+ async function w(e, t, n = fetch) {
114
+ let r;
115
+ try {
116
+ r = await n(e, t);
117
+ } catch (t) {
118
+ T(t, e);
119
+ }
120
+ return r.ok || await E(r, e), r;
121
+ }
122
+ function T(e, t) {
123
+ let n = e;
124
+ throw n.name === "AbortError" ? (n = new g(`Request aborted when fetching ${t.toString()}: ${e.message}`), n.stack = e.stack) : e instanceof m || e instanceof h || (n = new f(`Error fetching from ${t.toString()}: ${e.message}`), n.stack = e.stack), n;
125
+ }
126
+ async function E(e, t) {
127
+ let n = "", r;
128
+ try {
129
+ let t = await e.json();
130
+ n = t.error.message, t.error.details && (n += ` ${JSON.stringify(t.error.details)}`, r = t.error.details);
131
+ } catch {}
132
+ throw new m(`Error fetching from ${t.toString()}: [${e.status} ${e.statusText}] ${n}`, e.status, e.statusText, r);
133
+ }
134
+ function D(e) {
135
+ let t = {};
136
+ if (e?.signal !== void 0 || e?.timeout >= 0) {
137
+ let n = new AbortController();
138
+ e?.timeout >= 0 && setTimeout(() => n.abort(), e.timeout), e?.signal && e.signal.addEventListener("abort", () => {
139
+ n.abort();
140
+ }), t.signal = n.signal;
141
+ }
142
+ return t;
143
+ }
144
+ function O(e) {
145
+ return e.text = () => {
146
+ if (e.candidates && e.candidates.length > 0) {
147
+ if (e.candidates.length > 1 && console.warn(`This response had ${e.candidates.length} candidates. Returning text from the first candidate only. Access response.candidates directly to use the other candidates.`), j(e.candidates[0])) throw new p(`${M(e)}`, e);
148
+ return k(e);
149
+ } else if (e.promptFeedback) throw new p(`Text not available. ${M(e)}`, e);
150
+ return "";
151
+ }, e.functionCall = () => {
152
+ if (e.candidates && e.candidates.length > 0) {
153
+ if (e.candidates.length > 1 && console.warn(`This response had ${e.candidates.length} candidates. Returning function calls from the first candidate only. Access response.candidates directly to use the other candidates.`), j(e.candidates[0])) throw new p(`${M(e)}`, e);
154
+ return console.warn("response.functionCall() is deprecated. Use response.functionCalls() instead."), A(e)[0];
155
+ } else if (e.promptFeedback) throw new p(`Function call not available. ${M(e)}`, e);
156
+ }, e.functionCalls = () => {
157
+ if (e.candidates && e.candidates.length > 0) {
158
+ if (e.candidates.length > 1 && console.warn(`This response had ${e.candidates.length} candidates. Returning function calls from the first candidate only. Access response.candidates directly to use the other candidates.`), j(e.candidates[0])) throw new p(`${M(e)}`, e);
159
+ return A(e);
160
+ } else if (e.promptFeedback) throw new p(`Function call not available. ${M(e)}`, e);
161
+ }, e;
162
+ }
163
+ function k(e) {
164
+ let t = [];
165
+ if (e.candidates?.[0].content?.parts) for (let n of e.candidates?.[0].content?.parts) n.text && t.push(n.text), n.executableCode && t.push("\n```" + n.executableCode.language + "\n" + n.executableCode.code + "\n```\n"), n.codeExecutionResult && t.push("\n```\n" + n.codeExecutionResult.output + "\n```\n");
166
+ return t.length > 0 ? t.join("") : "";
167
+ }
168
+ function A(e) {
169
+ let t = [];
170
+ if (e.candidates?.[0].content?.parts) for (let n of e.candidates?.[0].content?.parts) n.functionCall && t.push(n.functionCall);
171
+ if (t.length > 0) return t;
172
+ }
173
+ var re = [
174
+ c.RECITATION,
175
+ c.SAFETY,
176
+ c.LANGUAGE
177
+ ];
178
+ function j(e) {
179
+ return !!e.finishReason && re.includes(e.finishReason);
180
+ }
181
+ function M(e) {
182
+ let t = "";
183
+ if ((!e.candidates || e.candidates.length === 0) && e.promptFeedback) t += "Response was blocked", e.promptFeedback?.blockReason && (t += ` due to ${e.promptFeedback.blockReason}`), e.promptFeedback?.blockReasonMessage && (t += `: ${e.promptFeedback.blockReasonMessage}`);
184
+ else if (e.candidates?.[0]) {
185
+ let n = e.candidates[0];
186
+ j(n) && (t += `Candidate was blocked due to ${n.finishReason}`, n.finishMessage && (t += `: ${n.finishMessage}`));
187
+ }
188
+ return t;
189
+ }
190
+ function N(e) {
191
+ return this instanceof N ? (this.v = e, this) : new N(e);
192
+ }
193
+ function P(e, t, n) {
194
+ if (!Symbol.asyncIterator) throw TypeError("Symbol.asyncIterator is not defined.");
195
+ var r = n.apply(e, t || []), i, a = [];
196
+ return i = {}, o("next"), o("throw"), o("return"), i[Symbol.asyncIterator] = function() {
197
+ return this;
198
+ }, i;
199
+ function o(e) {
200
+ r[e] && (i[e] = function(t) {
201
+ return new Promise(function(n, r) {
202
+ a.push([
203
+ e,
204
+ t,
205
+ n,
206
+ r
207
+ ]) > 1 || s(e, t);
208
+ });
209
+ });
210
+ }
211
+ function s(e, t) {
212
+ try {
213
+ c(r[e](t));
214
+ } catch (e) {
215
+ d(a[0][3], e);
216
+ }
217
+ }
218
+ function c(e) {
219
+ e.value instanceof N ? Promise.resolve(e.value.v).then(l, u) : d(a[0][2], e);
220
+ }
221
+ function l(e) {
222
+ s("next", e);
223
+ }
224
+ function u(e) {
225
+ s("throw", e);
226
+ }
227
+ function d(e, t) {
228
+ e(t), a.shift(), a.length && s(a[0][0], a[0][1]);
229
+ }
230
+ }
231
+ var F = /^data\: (.*)(?:\n\n|\r\r|\r\n\r\n)/;
232
+ function I(e) {
233
+ let [t, n] = z(e.body.pipeThrough(new TextDecoderStream("utf8", { fatal: !0 }))).tee();
234
+ return {
235
+ stream: R(t),
236
+ response: L(n)
237
+ };
238
+ }
239
+ async function L(e) {
240
+ let t = [], n = e.getReader();
241
+ for (;;) {
242
+ let { done: e, value: r } = await n.read();
243
+ if (e) return O(B(t));
244
+ t.push(r);
245
+ }
246
+ }
247
+ function R(e) {
248
+ return P(this, arguments, function* () {
249
+ let t = e.getReader();
250
+ for (;;) {
251
+ let { value: e, done: n } = yield N(t.read());
252
+ if (n) break;
253
+ yield yield N(O(e));
254
+ }
255
+ });
256
+ }
257
+ function z(e) {
258
+ let t = e.getReader();
259
+ return new ReadableStream({ start(e) {
260
+ let n = "";
261
+ return r();
262
+ function r() {
263
+ return t.read().then(({ value: t, done: i }) => {
264
+ if (i) {
265
+ if (n.trim()) {
266
+ e.error(new f("Failed to parse stream"));
267
+ return;
268
+ }
269
+ e.close();
270
+ return;
271
+ }
272
+ n += t;
273
+ let a = n.match(F), o;
274
+ for (; a;) {
275
+ try {
276
+ o = JSON.parse(a[1]);
277
+ } catch {
278
+ e.error(new f(`Error parsing JSON response: "${a[1]}"`));
279
+ return;
280
+ }
281
+ e.enqueue(o), n = n.substring(a[0].length), a = n.match(F);
282
+ }
283
+ return r();
284
+ }).catch((e) => {
285
+ let t = e;
286
+ throw t.stack = e.stack, t = t.name === "AbortError" ? new g("Request aborted when reading from the stream") : new f("Error reading from the stream"), t;
287
+ });
288
+ }
289
+ } });
290
+ }
291
+ function B(e) {
292
+ let t = { promptFeedback: e[e.length - 1]?.promptFeedback };
293
+ for (let n of e) {
294
+ if (n.candidates) {
295
+ let e = 0;
296
+ for (let r of n.candidates) if (t.candidates ||= [], t.candidates[e] || (t.candidates[e] = { index: e }), t.candidates[e].citationMetadata = r.citationMetadata, t.candidates[e].groundingMetadata = r.groundingMetadata, t.candidates[e].finishReason = r.finishReason, t.candidates[e].finishMessage = r.finishMessage, t.candidates[e].safetyRatings = r.safetyRatings, r.content && r.content.parts) {
297
+ t.candidates[e].content || (t.candidates[e].content = {
298
+ role: r.content.role || "user",
299
+ parts: []
300
+ });
301
+ let n = {};
302
+ for (let i of r.content.parts) i.text && (n.text = i.text), i.functionCall && (n.functionCall = i.functionCall), i.executableCode && (n.executableCode = i.executableCode), i.codeExecutionResult && (n.codeExecutionResult = i.codeExecutionResult), Object.keys(n).length === 0 && (n.text = ""), t.candidates[e].content.parts.push(n);
303
+ }
304
+ e++;
305
+ }
306
+ n.usageMetadata && (t.usageMetadata = n.usageMetadata);
307
+ }
308
+ return t;
309
+ }
310
+ async function V(e, t, n, r) {
311
+ return I(await C(t, y.STREAM_GENERATE_CONTENT, e, !0, JSON.stringify(n), r));
312
+ }
313
+ async function H(e, t, n, r) {
314
+ return { response: O(await (await C(t, y.GENERATE_CONTENT, e, !1, JSON.stringify(n), r)).json()) };
315
+ }
316
+ function U(e) {
317
+ if (e != null) {
318
+ if (typeof e == "string") return {
319
+ role: "system",
320
+ parts: [{ text: e }]
321
+ };
322
+ if (e.text) return {
323
+ role: "system",
324
+ parts: [e]
325
+ };
326
+ if (e.parts) return e.role ? e : {
327
+ role: "system",
328
+ parts: e.parts
329
+ };
330
+ }
331
+ }
332
+ function W(e) {
333
+ let t = [];
334
+ if (typeof e == "string") t = [{ text: e }];
335
+ else for (let n of e) typeof n == "string" ? t.push({ text: n }) : t.push(n);
336
+ return G(t);
337
+ }
338
+ function G(e) {
339
+ let t = {
340
+ role: "user",
341
+ parts: []
342
+ }, n = {
343
+ role: "function",
344
+ parts: []
345
+ }, r = !1, i = !1;
346
+ for (let a of e) "functionResponse" in a ? (n.parts.push(a), i = !0) : (t.parts.push(a), r = !0);
347
+ if (r && i) throw new f("Within a single message, FunctionResponse cannot be mixed with other type of part in the request for sending chat message.");
348
+ if (!r && !i) throw new f("No content is provided for sending chat message.");
349
+ return r ? t : n;
350
+ }
351
+ function K(e, t) {
352
+ let n = {
353
+ model: t?.model,
354
+ generationConfig: t?.generationConfig,
355
+ safetySettings: t?.safetySettings,
356
+ tools: t?.tools,
357
+ toolConfig: t?.toolConfig,
358
+ systemInstruction: t?.systemInstruction,
359
+ cachedContent: t?.cachedContent?.name,
360
+ contents: []
361
+ }, r = e.generateContentRequest != null;
362
+ if (e.contents) {
363
+ if (r) throw new h("CountTokensRequest must have one of contents or generateContentRequest, not both.");
364
+ n.contents = e.contents;
365
+ } else if (r) n = Object.assign(Object.assign({}, n), e.generateContentRequest);
366
+ else {
367
+ let t = W(e);
368
+ n.contents = [t];
369
+ }
370
+ return { generateContentRequest: n };
371
+ }
372
+ function q(e) {
373
+ let t;
374
+ return t = e.contents ? e : { contents: [W(e)] }, e.systemInstruction && (t.systemInstruction = U(e.systemInstruction)), t;
375
+ }
376
+ function J(e) {
377
+ return typeof e == "string" || Array.isArray(e) ? { content: W(e) } : e;
378
+ }
379
+ var Y = [
380
+ "text",
381
+ "inlineData",
382
+ "functionCall",
383
+ "functionResponse",
384
+ "executableCode",
385
+ "codeExecutionResult"
386
+ ], ie = {
387
+ user: ["text", "inlineData"],
388
+ function: ["functionResponse"],
389
+ model: [
390
+ "text",
391
+ "functionCall",
392
+ "executableCode",
393
+ "codeExecutionResult"
394
+ ],
395
+ system: ["text"]
396
+ };
397
+ function ae(e) {
398
+ let t = !1;
399
+ for (let n of e) {
400
+ let { role: e, parts: i } = n;
401
+ if (!t && e !== "user") throw new f(`First content should be with role 'user', got ${e}`);
402
+ if (!r.includes(e)) throw new f(`Each item should include role field. Got ${e} but valid roles are: ${JSON.stringify(r)}`);
403
+ if (!Array.isArray(i)) throw new f("Content should have 'parts' property with an array of Parts");
404
+ if (i.length === 0) throw new f("Each Content should have at least one part");
405
+ let a = {
406
+ text: 0,
407
+ inlineData: 0,
408
+ functionCall: 0,
409
+ functionResponse: 0,
410
+ fileData: 0,
411
+ executableCode: 0,
412
+ codeExecutionResult: 0
413
+ };
414
+ for (let e of i) for (let t of Y) t in e && (a[t] += 1);
415
+ let o = ie[e];
416
+ for (let t of Y) if (!o.includes(t) && a[t] > 0) throw new f(`Content with role '${e}' can't contain '${t}' part`);
417
+ t = !0;
418
+ }
419
+ }
420
+ function X(e) {
421
+ if (e.candidates === void 0 || e.candidates.length === 0) return !1;
422
+ let t = e.candidates[0]?.content;
423
+ if (t === void 0 || t.parts === void 0 || t.parts.length === 0) return !1;
424
+ for (let e of t.parts) if (e === void 0 || Object.keys(e).length === 0 || e.text !== void 0 && e.text === "") return !1;
425
+ return !0;
426
+ }
427
+ var Z = "SILENT_ERROR", Q = class {
428
+ constructor(e, t, n, r = {}) {
429
+ this.model = t, this.params = n, this._requestOptions = r, this._history = [], this._sendPromise = Promise.resolve(), this._apiKey = e, n?.history && (ae(n.history), this._history = n.history);
430
+ }
431
+ async getHistory() {
432
+ return await this._sendPromise, this._history;
433
+ }
434
+ async sendMessage(e, t = {}) {
435
+ await this._sendPromise;
436
+ let n = W(e), r = {
437
+ safetySettings: this.params?.safetySettings,
438
+ generationConfig: this.params?.generationConfig,
439
+ tools: this.params?.tools,
440
+ toolConfig: this.params?.toolConfig,
441
+ systemInstruction: this.params?.systemInstruction,
442
+ cachedContent: this.params?.cachedContent,
443
+ contents: [...this._history, n]
444
+ }, i = Object.assign(Object.assign({}, this._requestOptions), t), a;
445
+ return this._sendPromise = this._sendPromise.then(() => H(this._apiKey, this.model, r, i)).then((e) => {
446
+ if (X(e.response)) {
447
+ this._history.push(n);
448
+ let t = Object.assign({
449
+ parts: [],
450
+ role: "model"
451
+ }, e.response.candidates?.[0].content);
452
+ this._history.push(t);
453
+ } else {
454
+ let t = M(e.response);
455
+ t && console.warn(`sendMessage() was unsuccessful. ${t}. Inspect response object for details.`);
456
+ }
457
+ a = e;
458
+ }).catch((e) => {
459
+ throw this._sendPromise = Promise.resolve(), e;
460
+ }), await this._sendPromise, a;
461
+ }
462
+ async sendMessageStream(e, t = {}) {
463
+ await this._sendPromise;
464
+ let n = W(e), r = {
465
+ safetySettings: this.params?.safetySettings,
466
+ generationConfig: this.params?.generationConfig,
467
+ tools: this.params?.tools,
468
+ toolConfig: this.params?.toolConfig,
469
+ systemInstruction: this.params?.systemInstruction,
470
+ cachedContent: this.params?.cachedContent,
471
+ contents: [...this._history, n]
472
+ }, i = Object.assign(Object.assign({}, this._requestOptions), t), a = V(this._apiKey, this.model, r, i);
473
+ return this._sendPromise = this._sendPromise.then(() => a).catch((e) => {
474
+ throw Error(Z);
475
+ }).then((e) => e.response).then((e) => {
476
+ if (X(e)) {
477
+ this._history.push(n);
478
+ let t = Object.assign({}, e.candidates[0].content);
479
+ t.role ||= "model", this._history.push(t);
480
+ } else {
481
+ let t = M(e);
482
+ t && console.warn(`sendMessageStream() was unsuccessful. ${t}. Inspect response object for details.`);
483
+ }
484
+ }).catch((e) => {
485
+ e.message !== Z && console.error(e);
486
+ }), a;
487
+ }
488
+ };
489
+ async function oe(e, t, n, r) {
490
+ return (await C(t, y.COUNT_TOKENS, e, !1, JSON.stringify(n), r)).json();
491
+ }
492
+ async function se(e, t, n, r) {
493
+ return (await C(t, y.EMBED_CONTENT, e, !1, JSON.stringify(n), r)).json();
494
+ }
495
+ async function ce(e, t, n, r) {
496
+ let i = n.requests.map((e) => Object.assign(Object.assign({}, e), { model: t }));
497
+ return (await C(t, y.BATCH_EMBED_CONTENTS, e, !1, JSON.stringify({ requests: i }), r)).json();
498
+ }
499
+ var $ = class {
500
+ constructor(e, t, n = {}) {
501
+ this.apiKey = e, this._requestOptions = n, t.model.includes("/") ? this.model = t.model : this.model = `models/${t.model}`, this.generationConfig = t.generationConfig || {}, this.safetySettings = t.safetySettings || [], this.tools = t.tools, this.toolConfig = t.toolConfig, this.systemInstruction = U(t.systemInstruction), this.cachedContent = t.cachedContent;
502
+ }
503
+ async generateContent(e, t = {}) {
504
+ let n = q(e), r = Object.assign(Object.assign({}, this._requestOptions), t);
505
+ return H(this.apiKey, this.model, Object.assign({
506
+ generationConfig: this.generationConfig,
507
+ safetySettings: this.safetySettings,
508
+ tools: this.tools,
509
+ toolConfig: this.toolConfig,
510
+ systemInstruction: this.systemInstruction,
511
+ cachedContent: this.cachedContent?.name
512
+ }, n), r);
513
+ }
514
+ async generateContentStream(e, t = {}) {
515
+ let n = q(e), r = Object.assign(Object.assign({}, this._requestOptions), t);
516
+ return V(this.apiKey, this.model, Object.assign({
517
+ generationConfig: this.generationConfig,
518
+ safetySettings: this.safetySettings,
519
+ tools: this.tools,
520
+ toolConfig: this.toolConfig,
521
+ systemInstruction: this.systemInstruction,
522
+ cachedContent: this.cachedContent?.name
523
+ }, n), r);
524
+ }
525
+ startChat(e) {
526
+ return new Q(this.apiKey, this.model, Object.assign({
527
+ generationConfig: this.generationConfig,
528
+ safetySettings: this.safetySettings,
529
+ tools: this.tools,
530
+ toolConfig: this.toolConfig,
531
+ systemInstruction: this.systemInstruction,
532
+ cachedContent: this.cachedContent?.name
533
+ }, e), this._requestOptions);
534
+ }
535
+ async countTokens(e, t = {}) {
536
+ let n = K(e, {
537
+ model: this.model,
538
+ generationConfig: this.generationConfig,
539
+ safetySettings: this.safetySettings,
540
+ tools: this.tools,
541
+ toolConfig: this.toolConfig,
542
+ systemInstruction: this.systemInstruction,
543
+ cachedContent: this.cachedContent
544
+ }), r = Object.assign(Object.assign({}, this._requestOptions), t);
545
+ return oe(this.apiKey, this.model, n, r);
546
+ }
547
+ async embedContent(e, t = {}) {
548
+ let n = J(e), r = Object.assign(Object.assign({}, this._requestOptions), t);
549
+ return se(this.apiKey, this.model, n, r);
550
+ }
551
+ async batchEmbedContents(e, t = {}) {
552
+ let n = Object.assign(Object.assign({}, this._requestOptions), t);
553
+ return ce(this.apiKey, this.model, e, n);
554
+ }
555
+ }, le = class {
556
+ constructor(e) {
557
+ this.apiKey = e;
558
+ }
559
+ getGenerativeModel(e, t) {
560
+ if (!e.model) throw new f("Must provide a model name. Example: genai.getGenerativeModel({ model: 'my-model-name' })");
561
+ return new $(this.apiKey, e, t);
562
+ }
563
+ getGenerativeModelFromCachedContent(e, t, n) {
564
+ if (!e.name) throw new h("Cached content must contain a `name` field.");
565
+ if (!e.model) throw new h("Cached content must contain a `model` field.");
566
+ for (let n of ["model", "systemInstruction"]) if (t?.[n] && e[n] && t?.[n] !== e[n]) {
567
+ if (n === "model" && (t.model.startsWith("models/") ? t.model.replace("models/", "") : t.model) === (e.model.startsWith("models/") ? e.model.replace("models/", "") : e.model)) continue;
568
+ throw new h(`Different value for "${n}" specified in modelParams (${t[n]}) and cachedContent (${e[n]})`);
569
+ }
570
+ let r = Object.assign(Object.assign({}, t), {
571
+ model: e.model,
572
+ tools: e.tools,
573
+ toolConfig: e.toolConfig,
574
+ systemInstruction: e.systemInstruction,
575
+ cachedContent: e
576
+ });
577
+ return new $(this.apiKey, r, n);
578
+ }
579
+ };
580
+ //#endregion
581
+ export { s as BlockReason, Q as ChatSession, d as DynamicRetrievalMode, t as ExecutableCodeLanguage, c as FinishReason, u as FunctionCallingMode, $ as GenerativeModel, le as GoogleGenerativeAI, g as GoogleGenerativeAIAbortError, f as GoogleGenerativeAIError, m as GoogleGenerativeAIFetchError, h as GoogleGenerativeAIRequestInputError, p as GoogleGenerativeAIResponseError, a as HarmBlockThreshold, i as HarmCategory, o as HarmProbability, n as Outcome, r as POSSIBLE_ROLES, e as SchemaType, l as TaskType };
@@ -0,0 +1,2 @@
1
+ var e;(function(e){e.STRING=`string`,e.NUMBER=`number`,e.INTEGER=`integer`,e.BOOLEAN=`boolean`,e.ARRAY=`array`,e.OBJECT=`object`})(e||={});var t;(function(e){e.LANGUAGE_UNSPECIFIED=`language_unspecified`,e.PYTHON=`python`})(t||={});var n;(function(e){e.OUTCOME_UNSPECIFIED=`outcome_unspecified`,e.OUTCOME_OK=`outcome_ok`,e.OUTCOME_FAILED=`outcome_failed`,e.OUTCOME_DEADLINE_EXCEEDED=`outcome_deadline_exceeded`})(n||={});var r=[`user`,`model`,`function`,`system`],i;(function(e){e.HARM_CATEGORY_UNSPECIFIED=`HARM_CATEGORY_UNSPECIFIED`,e.HARM_CATEGORY_HATE_SPEECH=`HARM_CATEGORY_HATE_SPEECH`,e.HARM_CATEGORY_SEXUALLY_EXPLICIT=`HARM_CATEGORY_SEXUALLY_EXPLICIT`,e.HARM_CATEGORY_HARASSMENT=`HARM_CATEGORY_HARASSMENT`,e.HARM_CATEGORY_DANGEROUS_CONTENT=`HARM_CATEGORY_DANGEROUS_CONTENT`,e.HARM_CATEGORY_CIVIC_INTEGRITY=`HARM_CATEGORY_CIVIC_INTEGRITY`})(i||={});var a;(function(e){e.HARM_BLOCK_THRESHOLD_UNSPECIFIED=`HARM_BLOCK_THRESHOLD_UNSPECIFIED`,e.BLOCK_LOW_AND_ABOVE=`BLOCK_LOW_AND_ABOVE`,e.BLOCK_MEDIUM_AND_ABOVE=`BLOCK_MEDIUM_AND_ABOVE`,e.BLOCK_ONLY_HIGH=`BLOCK_ONLY_HIGH`,e.BLOCK_NONE=`BLOCK_NONE`})(a||={});var o;(function(e){e.HARM_PROBABILITY_UNSPECIFIED=`HARM_PROBABILITY_UNSPECIFIED`,e.NEGLIGIBLE=`NEGLIGIBLE`,e.LOW=`LOW`,e.MEDIUM=`MEDIUM`,e.HIGH=`HIGH`})(o||={});var s;(function(e){e.BLOCKED_REASON_UNSPECIFIED=`BLOCKED_REASON_UNSPECIFIED`,e.SAFETY=`SAFETY`,e.OTHER=`OTHER`})(s||={});var c;(function(e){e.FINISH_REASON_UNSPECIFIED=`FINISH_REASON_UNSPECIFIED`,e.STOP=`STOP`,e.MAX_TOKENS=`MAX_TOKENS`,e.SAFETY=`SAFETY`,e.RECITATION=`RECITATION`,e.LANGUAGE=`LANGUAGE`,e.BLOCKLIST=`BLOCKLIST`,e.PROHIBITED_CONTENT=`PROHIBITED_CONTENT`,e.SPII=`SPII`,e.MALFORMED_FUNCTION_CALL=`MALFORMED_FUNCTION_CALL`,e.OTHER=`OTHER`})(c||={});var l;(function(e){e.TASK_TYPE_UNSPECIFIED=`TASK_TYPE_UNSPECIFIED`,e.RETRIEVAL_QUERY=`RETRIEVAL_QUERY`,e.RETRIEVAL_DOCUMENT=`RETRIEVAL_DOCUMENT`,e.SEMANTIC_SIMILARITY=`SEMANTIC_SIMILARITY`,e.CLASSIFICATION=`CLASSIFICATION`,e.CLUSTERING=`CLUSTERING`})(l||={});var u;(function(e){e.MODE_UNSPECIFIED=`MODE_UNSPECIFIED`,e.AUTO=`AUTO`,e.ANY=`ANY`,e.NONE=`NONE`})(u||={});var d;(function(e){e.MODE_UNSPECIFIED=`MODE_UNSPECIFIED`,e.MODE_DYNAMIC=`MODE_DYNAMIC`})(d||={});var f=class extends Error{constructor(e){super(`[GoogleGenerativeAI Error]: ${e}`)}},p=class extends f{constructor(e,t){super(e),this.response=t}},m=class extends f{constructor(e,t,n,r){super(e),this.status=t,this.statusText=n,this.errorDetails=r}},h=class extends f{},g=class extends f{},ee=`https://generativelanguage.googleapis.com`,_=`v1beta`,v=`0.24.1`,te=`genai-js`,y;(function(e){e.GENERATE_CONTENT=`generateContent`,e.STREAM_GENERATE_CONTENT=`streamGenerateContent`,e.COUNT_TOKENS=`countTokens`,e.EMBED_CONTENT=`embedContent`,e.BATCH_EMBED_CONTENTS=`batchEmbedContents`})(y||={});var b=class{constructor(e,t,n,r,i){this.model=e,this.task=t,this.apiKey=n,this.stream=r,this.requestOptions=i}toString(){let e=this.requestOptions?.apiVersion||_,t=`${this.requestOptions?.baseUrl||ee}/${e}/${this.model}:${this.task}`;return this.stream&&(t+=`?alt=sse`),t}};function x(e){let t=[];return e?.apiClient&&t.push(e.apiClient),t.push(`${te}/${v}`),t.join(` `)}async function S(e){let t=new Headers;t.append(`Content-Type`,`application/json`),t.append(`x-goog-api-client`,x(e.requestOptions)),t.append(`x-goog-api-key`,e.apiKey);let n=e.requestOptions?.customHeaders;if(n){if(!(n instanceof Headers))try{n=new Headers(n)}catch(e){throw new h(`unable to convert customHeaders value ${JSON.stringify(n)} to Headers: ${e.message}`)}for(let[e,r]of n.entries()){if(e===`x-goog-api-key`)throw new h(`Cannot set reserved header name ${e}`);if(e===`x-goog-api-client`)throw new h(`Header name ${e} can only be set using the apiClient field`);t.append(e,r)}}return t}async function ne(e,t,n,r,i,a){let o=new b(e,t,n,r,a);return{url:o.toString(),fetchOptions:Object.assign(Object.assign({},D(a)),{method:`POST`,headers:await S(o),body:i})}}async function C(e,t,n,r,i,a={},o=fetch){let{url:s,fetchOptions:c}=await ne(e,t,n,r,i,a);return w(s,c,o)}async function w(e,t,n=fetch){let r;try{r=await n(e,t)}catch(t){T(t,e)}return r.ok||await E(r,e),r}function T(e,t){let n=e;throw n.name===`AbortError`?(n=new g(`Request aborted when fetching ${t.toString()}: ${e.message}`),n.stack=e.stack):e instanceof m||e instanceof h||(n=new f(`Error fetching from ${t.toString()}: ${e.message}`),n.stack=e.stack),n}async function E(e,t){let n=``,r;try{let t=await e.json();n=t.error.message,t.error.details&&(n+=` ${JSON.stringify(t.error.details)}`,r=t.error.details)}catch{}throw new m(`Error fetching from ${t.toString()}: [${e.status} ${e.statusText}] ${n}`,e.status,e.statusText,r)}function D(e){let t={};if(e?.signal!==void 0||e?.timeout>=0){let n=new AbortController;e?.timeout>=0&&setTimeout(()=>n.abort(),e.timeout),e?.signal&&e.signal.addEventListener(`abort`,()=>{n.abort()}),t.signal=n.signal}return t}function O(e){return e.text=()=>{if(e.candidates&&e.candidates.length>0){if(e.candidates.length>1&&console.warn(`This response had ${e.candidates.length} candidates. Returning text from the first candidate only. Access response.candidates directly to use the other candidates.`),j(e.candidates[0]))throw new p(`${M(e)}`,e);return k(e)}else if(e.promptFeedback)throw new p(`Text not available. ${M(e)}`,e);return``},e.functionCall=()=>{if(e.candidates&&e.candidates.length>0){if(e.candidates.length>1&&console.warn(`This response had ${e.candidates.length} candidates. Returning function calls from the first candidate only. Access response.candidates directly to use the other candidates.`),j(e.candidates[0]))throw new p(`${M(e)}`,e);return console.warn(`response.functionCall() is deprecated. Use response.functionCalls() instead.`),A(e)[0]}else if(e.promptFeedback)throw new p(`Function call not available. ${M(e)}`,e)},e.functionCalls=()=>{if(e.candidates&&e.candidates.length>0){if(e.candidates.length>1&&console.warn(`This response had ${e.candidates.length} candidates. Returning function calls from the first candidate only. Access response.candidates directly to use the other candidates.`),j(e.candidates[0]))throw new p(`${M(e)}`,e);return A(e)}else if(e.promptFeedback)throw new p(`Function call not available. ${M(e)}`,e)},e}function k(e){let t=[];if(e.candidates?.[0].content?.parts)for(let n of e.candidates?.[0].content?.parts)n.text&&t.push(n.text),n.executableCode&&t.push("\n```"+n.executableCode.language+`
2
+ `+n.executableCode.code+"\n```\n"),n.codeExecutionResult&&t.push("\n```\n"+n.codeExecutionResult.output+"\n```\n");return t.length>0?t.join(``):``}function A(e){let t=[];if(e.candidates?.[0].content?.parts)for(let n of e.candidates?.[0].content?.parts)n.functionCall&&t.push(n.functionCall);if(t.length>0)return t}var re=[c.RECITATION,c.SAFETY,c.LANGUAGE];function j(e){return!!e.finishReason&&re.includes(e.finishReason)}function M(e){let t=``;if((!e.candidates||e.candidates.length===0)&&e.promptFeedback)t+=`Response was blocked`,e.promptFeedback?.blockReason&&(t+=` due to ${e.promptFeedback.blockReason}`),e.promptFeedback?.blockReasonMessage&&(t+=`: ${e.promptFeedback.blockReasonMessage}`);else if(e.candidates?.[0]){let n=e.candidates[0];j(n)&&(t+=`Candidate was blocked due to ${n.finishReason}`,n.finishMessage&&(t+=`: ${n.finishMessage}`))}return t}function N(e){return this instanceof N?(this.v=e,this):new N(e)}function P(e,t,n){if(!Symbol.asyncIterator)throw TypeError(`Symbol.asyncIterator is not defined.`);var r=n.apply(e,t||[]),i,a=[];return i={},o(`next`),o(`throw`),o(`return`),i[Symbol.asyncIterator]=function(){return this},i;function o(e){r[e]&&(i[e]=function(t){return new Promise(function(n,r){a.push([e,t,n,r])>1||s(e,t)})})}function s(e,t){try{c(r[e](t))}catch(e){d(a[0][3],e)}}function c(e){e.value instanceof N?Promise.resolve(e.value.v).then(l,u):d(a[0][2],e)}function l(e){s(`next`,e)}function u(e){s(`throw`,e)}function d(e,t){e(t),a.shift(),a.length&&s(a[0][0],a[0][1])}}var F=/^data\: (.*)(?:\n\n|\r\r|\r\n\r\n)/;function I(e){let[t,n]=z(e.body.pipeThrough(new TextDecoderStream(`utf8`,{fatal:!0}))).tee();return{stream:R(t),response:L(n)}}async function L(e){let t=[],n=e.getReader();for(;;){let{done:e,value:r}=await n.read();if(e)return O(B(t));t.push(r)}}function R(e){return P(this,arguments,function*(){let t=e.getReader();for(;;){let{value:e,done:n}=yield N(t.read());if(n)break;yield yield N(O(e))}})}function z(e){let t=e.getReader();return new ReadableStream({start(e){let n=``;return r();function r(){return t.read().then(({value:t,done:i})=>{if(i){if(n.trim()){e.error(new f(`Failed to parse stream`));return}e.close();return}n+=t;let a=n.match(F),o;for(;a;){try{o=JSON.parse(a[1])}catch{e.error(new f(`Error parsing JSON response: "${a[1]}"`));return}e.enqueue(o),n=n.substring(a[0].length),a=n.match(F)}return r()}).catch(e=>{let t=e;throw t.stack=e.stack,t=t.name===`AbortError`?new g(`Request aborted when reading from the stream`):new f(`Error reading from the stream`),t})}}})}function B(e){let t={promptFeedback:e[e.length-1]?.promptFeedback};for(let n of e){if(n.candidates){let e=0;for(let r of n.candidates)if(t.candidates||=[],t.candidates[e]||(t.candidates[e]={index:e}),t.candidates[e].citationMetadata=r.citationMetadata,t.candidates[e].groundingMetadata=r.groundingMetadata,t.candidates[e].finishReason=r.finishReason,t.candidates[e].finishMessage=r.finishMessage,t.candidates[e].safetyRatings=r.safetyRatings,r.content&&r.content.parts){t.candidates[e].content||(t.candidates[e].content={role:r.content.role||`user`,parts:[]});let n={};for(let i of r.content.parts)i.text&&(n.text=i.text),i.functionCall&&(n.functionCall=i.functionCall),i.executableCode&&(n.executableCode=i.executableCode),i.codeExecutionResult&&(n.codeExecutionResult=i.codeExecutionResult),Object.keys(n).length===0&&(n.text=``),t.candidates[e].content.parts.push(n)}e++}n.usageMetadata&&(t.usageMetadata=n.usageMetadata)}return t}async function V(e,t,n,r){return I(await C(t,y.STREAM_GENERATE_CONTENT,e,!0,JSON.stringify(n),r))}async function H(e,t,n,r){return{response:O(await(await C(t,y.GENERATE_CONTENT,e,!1,JSON.stringify(n),r)).json())}}function U(e){if(e!=null){if(typeof e==`string`)return{role:`system`,parts:[{text:e}]};if(e.text)return{role:`system`,parts:[e]};if(e.parts)return e.role?e:{role:`system`,parts:e.parts}}}function W(e){let t=[];if(typeof e==`string`)t=[{text:e}];else for(let n of e)typeof n==`string`?t.push({text:n}):t.push(n);return G(t)}function G(e){let t={role:`user`,parts:[]},n={role:`function`,parts:[]},r=!1,i=!1;for(let a of e)`functionResponse`in a?(n.parts.push(a),i=!0):(t.parts.push(a),r=!0);if(r&&i)throw new f(`Within a single message, FunctionResponse cannot be mixed with other type of part in the request for sending chat message.`);if(!r&&!i)throw new f(`No content is provided for sending chat message.`);return r?t:n}function K(e,t){let n={model:t?.model,generationConfig:t?.generationConfig,safetySettings:t?.safetySettings,tools:t?.tools,toolConfig:t?.toolConfig,systemInstruction:t?.systemInstruction,cachedContent:t?.cachedContent?.name,contents:[]},r=e.generateContentRequest!=null;if(e.contents){if(r)throw new h(`CountTokensRequest must have one of contents or generateContentRequest, not both.`);n.contents=e.contents}else if(r)n=Object.assign(Object.assign({},n),e.generateContentRequest);else{let t=W(e);n.contents=[t]}return{generateContentRequest:n}}function q(e){let t;return t=e.contents?e:{contents:[W(e)]},e.systemInstruction&&(t.systemInstruction=U(e.systemInstruction)),t}function J(e){return typeof e==`string`||Array.isArray(e)?{content:W(e)}:e}var Y=[`text`,`inlineData`,`functionCall`,`functionResponse`,`executableCode`,`codeExecutionResult`],ie={user:[`text`,`inlineData`],function:[`functionResponse`],model:[`text`,`functionCall`,`executableCode`,`codeExecutionResult`],system:[`text`]};function ae(e){let t=!1;for(let n of e){let{role:e,parts:i}=n;if(!t&&e!==`user`)throw new f(`First content should be with role 'user', got ${e}`);if(!r.includes(e))throw new f(`Each item should include role field. Got ${e} but valid roles are: ${JSON.stringify(r)}`);if(!Array.isArray(i))throw new f(`Content should have 'parts' property with an array of Parts`);if(i.length===0)throw new f(`Each Content should have at least one part`);let a={text:0,inlineData:0,functionCall:0,functionResponse:0,fileData:0,executableCode:0,codeExecutionResult:0};for(let e of i)for(let t of Y)t in e&&(a[t]+=1);let o=ie[e];for(let t of Y)if(!o.includes(t)&&a[t]>0)throw new f(`Content with role '${e}' can't contain '${t}' part`);t=!0}}function X(e){if(e.candidates===void 0||e.candidates.length===0)return!1;let t=e.candidates[0]?.content;if(t===void 0||t.parts===void 0||t.parts.length===0)return!1;for(let e of t.parts)if(e===void 0||Object.keys(e).length===0||e.text!==void 0&&e.text===``)return!1;return!0}var Z=`SILENT_ERROR`,Q=class{constructor(e,t,n,r={}){this.model=t,this.params=n,this._requestOptions=r,this._history=[],this._sendPromise=Promise.resolve(),this._apiKey=e,n?.history&&(ae(n.history),this._history=n.history)}async getHistory(){return await this._sendPromise,this._history}async sendMessage(e,t={}){await this._sendPromise;let n=W(e),r={safetySettings:this.params?.safetySettings,generationConfig:this.params?.generationConfig,tools:this.params?.tools,toolConfig:this.params?.toolConfig,systemInstruction:this.params?.systemInstruction,cachedContent:this.params?.cachedContent,contents:[...this._history,n]},i=Object.assign(Object.assign({},this._requestOptions),t),a;return this._sendPromise=this._sendPromise.then(()=>H(this._apiKey,this.model,r,i)).then(e=>{if(X(e.response)){this._history.push(n);let t=Object.assign({parts:[],role:`model`},e.response.candidates?.[0].content);this._history.push(t)}else{let t=M(e.response);t&&console.warn(`sendMessage() was unsuccessful. ${t}. Inspect response object for details.`)}a=e}).catch(e=>{throw this._sendPromise=Promise.resolve(),e}),await this._sendPromise,a}async sendMessageStream(e,t={}){await this._sendPromise;let n=W(e),r={safetySettings:this.params?.safetySettings,generationConfig:this.params?.generationConfig,tools:this.params?.tools,toolConfig:this.params?.toolConfig,systemInstruction:this.params?.systemInstruction,cachedContent:this.params?.cachedContent,contents:[...this._history,n]},i=Object.assign(Object.assign({},this._requestOptions),t),a=V(this._apiKey,this.model,r,i);return this._sendPromise=this._sendPromise.then(()=>a).catch(e=>{throw Error(Z)}).then(e=>e.response).then(e=>{if(X(e)){this._history.push(n);let t=Object.assign({},e.candidates[0].content);t.role||=`model`,this._history.push(t)}else{let t=M(e);t&&console.warn(`sendMessageStream() was unsuccessful. ${t}. Inspect response object for details.`)}}).catch(e=>{e.message!==Z&&console.error(e)}),a}};async function oe(e,t,n,r){return(await C(t,y.COUNT_TOKENS,e,!1,JSON.stringify(n),r)).json()}async function se(e,t,n,r){return(await C(t,y.EMBED_CONTENT,e,!1,JSON.stringify(n),r)).json()}async function ce(e,t,n,r){let i=n.requests.map(e=>Object.assign(Object.assign({},e),{model:t}));return(await C(t,y.BATCH_EMBED_CONTENTS,e,!1,JSON.stringify({requests:i}),r)).json()}var $=class{constructor(e,t,n={}){this.apiKey=e,this._requestOptions=n,t.model.includes(`/`)?this.model=t.model:this.model=`models/${t.model}`,this.generationConfig=t.generationConfig||{},this.safetySettings=t.safetySettings||[],this.tools=t.tools,this.toolConfig=t.toolConfig,this.systemInstruction=U(t.systemInstruction),this.cachedContent=t.cachedContent}async generateContent(e,t={}){let n=q(e),r=Object.assign(Object.assign({},this._requestOptions),t);return H(this.apiKey,this.model,Object.assign({generationConfig:this.generationConfig,safetySettings:this.safetySettings,tools:this.tools,toolConfig:this.toolConfig,systemInstruction:this.systemInstruction,cachedContent:this.cachedContent?.name},n),r)}async generateContentStream(e,t={}){let n=q(e),r=Object.assign(Object.assign({},this._requestOptions),t);return V(this.apiKey,this.model,Object.assign({generationConfig:this.generationConfig,safetySettings:this.safetySettings,tools:this.tools,toolConfig:this.toolConfig,systemInstruction:this.systemInstruction,cachedContent:this.cachedContent?.name},n),r)}startChat(e){return new Q(this.apiKey,this.model,Object.assign({generationConfig:this.generationConfig,safetySettings:this.safetySettings,tools:this.tools,toolConfig:this.toolConfig,systemInstruction:this.systemInstruction,cachedContent:this.cachedContent?.name},e),this._requestOptions)}async countTokens(e,t={}){let n=K(e,{model:this.model,generationConfig:this.generationConfig,safetySettings:this.safetySettings,tools:this.tools,toolConfig:this.toolConfig,systemInstruction:this.systemInstruction,cachedContent:this.cachedContent}),r=Object.assign(Object.assign({},this._requestOptions),t);return oe(this.apiKey,this.model,n,r)}async embedContent(e,t={}){let n=J(e),r=Object.assign(Object.assign({},this._requestOptions),t);return se(this.apiKey,this.model,n,r)}async batchEmbedContents(e,t={}){let n=Object.assign(Object.assign({},this._requestOptions),t);return ce(this.apiKey,this.model,e,n)}},le=class{constructor(e){this.apiKey=e}getGenerativeModel(e,t){if(!e.model)throw new f(`Must provide a model name. Example: genai.getGenerativeModel({ model: 'my-model-name' })`);return new $(this.apiKey,e,t)}getGenerativeModelFromCachedContent(e,t,n){if(!e.name)throw new h("Cached content must contain a `name` field.");if(!e.model)throw new h("Cached content must contain a `model` field.");for(let n of[`model`,`systemInstruction`])if(t?.[n]&&e[n]&&t?.[n]!==e[n]){if(n===`model`&&(t.model.startsWith(`models/`)?t.model.replace(`models/`,``):t.model)===(e.model.startsWith(`models/`)?e.model.replace(`models/`,``):e.model))continue;throw new h(`Different value for "${n}" specified in modelParams (${t[n]}) and cachedContent (${e[n]})`)}let r=Object.assign(Object.assign({},t),{model:e.model,tools:e.tools,toolConfig:e.toolConfig,systemInstruction:e.systemInstruction,cachedContent:e});return new $(this.apiKey,r,n)}};Object.defineProperty(exports,`BlockReason`,{enumerable:!0,get:function(){return s}}),exports.ChatSession=Q,Object.defineProperty(exports,`DynamicRetrievalMode`,{enumerable:!0,get:function(){return d}}),Object.defineProperty(exports,`ExecutableCodeLanguage`,{enumerable:!0,get:function(){return t}}),Object.defineProperty(exports,`FinishReason`,{enumerable:!0,get:function(){return c}}),Object.defineProperty(exports,`FunctionCallingMode`,{enumerable:!0,get:function(){return u}}),exports.GenerativeModel=$,exports.GoogleGenerativeAI=le,exports.GoogleGenerativeAIAbortError=g,exports.GoogleGenerativeAIError=f,exports.GoogleGenerativeAIFetchError=m,exports.GoogleGenerativeAIRequestInputError=h,exports.GoogleGenerativeAIResponseError=p,Object.defineProperty(exports,`HarmBlockThreshold`,{enumerable:!0,get:function(){return a}}),Object.defineProperty(exports,`HarmCategory`,{enumerable:!0,get:function(){return i}}),Object.defineProperty(exports,`HarmProbability`,{enumerable:!0,get:function(){return o}}),Object.defineProperty(exports,`Outcome`,{enumerable:!0,get:function(){return n}}),exports.POSSIBLE_ROLES=r,Object.defineProperty(exports,`SchemaType`,{enumerable:!0,get:function(){return e}}),Object.defineProperty(exports,`TaskType`,{enumerable:!0,get:function(){return l}});